summaryrefslogtreecommitdiff
path: root/filter/source
diff options
context:
space:
mode:
Diffstat (limited to 'filter/source')
-rw-r--r--filter/source/config/cache/basecontainer.cxx638
-rw-r--r--filter/source/config/cache/basecontainer.hxx323
-rw-r--r--filter/source/config/cache/cacheitem.cxx443
-rw-r--r--filter/source/config/cache/cacheitem.hxx261
-rw-r--r--filter/source/config/cache/cacheupdatelistener.cxx246
-rw-r--r--filter/source/config/cache/cacheupdatelistener.hxx147
-rw-r--r--filter/source/config/cache/configflush.cxx168
-rw-r--r--filter/source/config/cache/configflush.hxx128
-rw-r--r--filter/source/config/cache/constant.hxx217
-rw-r--r--filter/source/config/cache/contenthandlerfactory.cxx201
-rw-r--r--filter/source/config/cache/contenthandlerfactory.hxx148
-rw-r--r--filter/source/config/cache/filtercache.cxx2536
-rw-r--r--filter/source/config/cache/filtercache.hxx1066
-rw-r--r--filter/source/config/cache/filterfactory.cxx724
-rw-r--r--filter/source/config/cache/filterfactory.hxx212
-rw-r--r--filter/source/config/cache/frameloaderfactory.cxx198
-rw-r--r--filter/source/config/cache/frameloaderfactory.hxx148
-rw-r--r--filter/source/config/cache/lateinitlistener.cxx136
-rw-r--r--filter/source/config/cache/lateinitlistener.hxx125
-rw-r--r--filter/source/config/cache/lateinitthread.cxx80
-rw-r--r--filter/source/config/cache/lateinitthread.hxx89
-rw-r--r--filter/source/config/cache/macros.hxx132
-rw-r--r--filter/source/config/cache/makefile.mk79
-rw-r--r--filter/source/config/cache/querytokenizer.cxx99
-rw-r--r--filter/source/config/cache/querytokenizer.hxx115
-rw-r--r--filter/source/config/cache/registration.cxx147
-rw-r--r--filter/source/config/cache/registration.hxx214
-rw-r--r--filter/source/config/cache/typedetection.cxx1257
-rw-r--r--filter/source/config/cache/typedetection.hxx459
-rw-r--r--filter/source/config/cache/versions.hxx36
-rw-r--r--filter/source/config/fragments/contenthandlers/com_sun_star_comp_framework_SoundHandler.xcu3
-rw-r--r--filter/source/config/fragments/contenthandlers/com_sun_star_comp_framework_oxt_handler.xcu3
-rw-r--r--filter/source/config/fragments/delzip0
-rw-r--r--filter/source/config/fragments/fcfg_base.mk51
-rw-r--r--filter/source/config/fragments/fcfg_calc.mk108
-rw-r--r--filter/source/config/fragments/fcfg_calc_bf.mk59
-rw-r--r--filter/source/config/fragments/fcfg_chart.mk48
-rw-r--r--filter/source/config/fragments/fcfg_chart_bf.mk47
-rw-r--r--filter/source/config/fragments/fcfg_database.mk45
-rw-r--r--filter/source/config/fragments/fcfg_draw.mk56
-rw-r--r--filter/source/config/fragments/fcfg_draw_bf.mk51
-rw-r--r--filter/source/config/fragments/fcfg_drawgraphics.mk117
-rw-r--r--filter/source/config/fragments/fcfg_global.mk59
-rw-r--r--filter/source/config/fragments/fcfg_global_bf.mk55
-rw-r--r--filter/source/config/fragments/fcfg_impress.mk75
-rw-r--r--filter/source/config/fragments/fcfg_impress_bf.mk66
-rw-r--r--filter/source/config/fragments/fcfg_impressgraphics.mk83
-rw-r--r--filter/source/config/fragments/fcfg_internalgraphics.mk109
-rw-r--r--filter/source/config/fragments/fcfg_math.mk55
-rw-r--r--filter/source/config/fragments/fcfg_math_bf.mk50
-rw-r--r--filter/source/config/fragments/fcfg_palm.mk44
-rw-r--r--filter/source/config/fragments/fcfg_pocketexcel.mk44
-rw-r--r--filter/source/config/fragments/fcfg_pocketword.mk44
-rw-r--r--filter/source/config/fragments/fcfg_w4w.mk260
-rw-r--r--filter/source/config/fragments/fcfg_web.mk65
-rw-r--r--filter/source/config/fragments/fcfg_web_bf.mk54
-rw-r--r--filter/source/config/fragments/fcfg_writer.mk106
-rw-r--r--filter/source/config/fragments/fcfg_writer_bf.mk63
-rw-r--r--filter/source/config/fragments/fcfg_xslt.mk55
-rw-r--r--filter/source/config/fragments/filters/Ami_Pro_1_x_3_1__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/AportisDoc_Palm_DB.xcu13
-rw-r--r--filter/source/config/fragments/filters/BMP___MS_Windows.xcu13
-rw-r--r--filter/source/config/fragments/filters/CGM___Computer_Graphics_Metafile.xcu13
-rw-r--r--filter/source/config/fragments/filters/CTOS_DEF__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/Claris_Works__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/DCA_FFT_Final_Form_Text__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/DCA_Revisable_Form_Text__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/DCA_with_Display_Write_5__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/DEC_DX__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/DEC_WPS_PLUS__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/DIF.xcu13
-rw-r--r--filter/source/config/fragments/filters/DXF___AutoCAD_Interchange.xcu13
-rw-r--r--filter/source/config/fragments/filters/DataGeneral_CEO_Write__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/DisplayWrite_2_0_4_x__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/DisplayWrite_5_x__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/DocBook_File.xcu13
-rw-r--r--filter/source/config/fragments/filters/EBCDIC__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/EMF___MS_Windows_Metafile.xcu13
-rw-r--r--filter/source/config/fragments/filters/EPS___Encapsulated_PostScript.xcu13
-rw-r--r--filter/source/config/fragments/filters/Enable__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/Frame_Maker_MIF_3_0__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/Frame_Maker_MIF_4_0__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/Frame_Maker_MIF_5_0__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/Frame_Work_III__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/Frame_Work_IV___W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/GIF___Graphics_Interchange.xcu13
-rw-r--r--filter/source/config/fragments/filters/HP_AdvanceWrite_Plus__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/HTML.xcu10
-rw-r--r--filter/source/config/fragments/filters/HTML_MasterDoc.xcu13
-rw-r--r--filter/source/config/fragments/filters/HTML_MasterDoc_ui.xcu5
-rw-r--r--filter/source/config/fragments/filters/HTML__StarCalc_.xcu10
-rw-r--r--filter/source/config/fragments/filters/HTML__StarCalc__ui.xcu6
-rw-r--r--filter/source/config/fragments/filters/HTML__StarWriter_.xcu10
-rw-r--r--filter/source/config/fragments/filters/HTML__StarWriter__ui.xcu6
-rw-r--r--filter/source/config/fragments/filters/HTML_ui.xcu6
-rw-r--r--filter/source/config/fragments/filters/ICL_Office_Power_6__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/ICL_Office_Power_7__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/Interleaf_5___6__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/Interleaf__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/JPG___JPEG.xcu13
-rw-r--r--filter/source/config/fragments/filters/Legacy_Winstar_onGO__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/Lotus.xcu13
-rw-r--r--filter/source/config/fragments/filters/Lotus_1_2_3_1_0__DOS___StarWriter_.xcu13
-rw-r--r--filter/source/config/fragments/filters/Lotus_1_2_3_1_0__WIN___StarWriter_.xcu13
-rw-r--r--filter/source/config/fragments/filters/Lotus_Manuscript__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/MASS_11_Rel__8_0_8_3__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/MASS_11_Rel__8_5_9_0__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/MET___OS_2_Metafile.xcu13
-rw-r--r--filter/source/config/fragments/filters/MS_Excel_2003_XML.xcu10
-rw-r--r--filter/source/config/fragments/filters/MS_Excel_2003_XML_ui.xcu12
-rw-r--r--filter/source/config/fragments/filters/MS_Excel_4_0.xcu13
-rw-r--r--filter/source/config/fragments/filters/MS_Excel_4_0_Vorlage_Template.xcu10
-rw-r--r--filter/source/config/fragments/filters/MS_Excel_4_0_Vorlage_Template_ui.xcu6
-rw-r--r--filter/source/config/fragments/filters/MS_Excel_4_0__StarWriter_.xcu13
-rw-r--r--filter/source/config/fragments/filters/MS_Excel_5_0_95.xcu13
-rw-r--r--filter/source/config/fragments/filters/MS_Excel_5_0_95_Vorlage_Template.xcu10
-rw-r--r--filter/source/config/fragments/filters/MS_Excel_5_0_95_Vorlage_Template_ui.xcu6
-rw-r--r--filter/source/config/fragments/filters/MS_Excel_5_0__StarWriter_.xcu13
-rw-r--r--filter/source/config/fragments/filters/MS_Excel_95.xcu13
-rw-r--r--filter/source/config/fragments/filters/MS_Excel_95_Vorlage_Template.xcu10
-rw-r--r--filter/source/config/fragments/filters/MS_Excel_95_Vorlage_Template_ui.xcu6
-rw-r--r--filter/source/config/fragments/filters/MS_Excel_95__StarWriter_.xcu13
-rw-r--r--filter/source/config/fragments/filters/MS_Excel_97.xcu13
-rw-r--r--filter/source/config/fragments/filters/MS_Excel_97_Vorlage_Template.xcu10
-rw-r--r--filter/source/config/fragments/filters/MS_Excel_97_Vorlage_Template_ui.xcu6
-rw-r--r--filter/source/config/fragments/filters/MS_MacWord_3_0__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/MS_MacWord_4_0__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/MS_MacWord_5_x__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/MS_PowerPoint_97.xcu13
-rw-r--r--filter/source/config/fragments/filters/MS_PowerPoint_97_Vorlage.xcu10
-rw-r--r--filter/source/config/fragments/filters/MS_PowerPoint_97_Vorlage_ui.xcu6
-rw-r--r--filter/source/config/fragments/filters/MS_WinWord_1_x__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/MS_WinWord_2_x__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/MS_WinWord_5.xcu13
-rw-r--r--filter/source/config/fragments/filters/MS_WinWord_6_0.xcu13
-rw-r--r--filter/source/config/fragments/filters/MS_Word_2003_XML.xcu10
-rw-r--r--filter/source/config/fragments/filters/MS_Word_2003_XML_ui.xcu12
-rw-r--r--filter/source/config/fragments/filters/MS_Word_2007_XML.xcu13
-rw-r--r--filter/source/config/fragments/filters/MS_Word_2007_XML_Template.xcu13
-rw-r--r--filter/source/config/fragments/filters/MS_Word_2007_XML_Template_ui.xcu6
-rw-r--r--filter/source/config/fragments/filters/MS_Word_2007_XML_ui.xcu6
-rw-r--r--filter/source/config/fragments/filters/MS_Word_3_x__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/MS_Word_4_x__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/MS_Word_5_x__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/MS_Word_6_x__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/MS_Word_95.xcu13
-rw-r--r--filter/source/config/fragments/filters/MS_Word_95_Vorlage.xcu10
-rw-r--r--filter/source/config/fragments/filters/MS_Word_95_Vorlage_ui.xcu6
-rw-r--r--filter/source/config/fragments/filters/MS_Word_97.xcu13
-rw-r--r--filter/source/config/fragments/filters/MS_Word_97_Vorlage.xcu10
-rw-r--r--filter/source/config/fragments/filters/MS_Word_97_Vorlage_ui.xcu6
-rw-r--r--filter/source/config/fragments/filters/MS_Works_2_0_DOS__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/MS_Works_3_0_Win__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/MS_Works_4_0_Mac__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/Mac_Write_4_x_5_0__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/Mac_Write_II__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/Mac_Write_Pro__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/MathML_XML__Math_.xcu13
-rw-r--r--filter/source/config/fragments/filters/MathType_3_x.xcu13
-rw-r--r--filter/source/config/fragments/filters/MiniCalc__Palm_.xcu13
-rw-r--r--filter/source/config/fragments/filters/MultiMate_3_3__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/MultiMate_4__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/MultiMate_Adv__3_6__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/MultiMate_Adv__II_3_7__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/NAVY_DIF__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/OfficeWriter_4_0__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/OfficeWriter_5_0__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/OfficeWriter_6_x__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/PBM___Portable_Bitmap.xcu13
-rw-r--r--filter/source/config/fragments/filters/PCT___Mac_Pict.xcu13
-rw-r--r--filter/source/config/fragments/filters/PCX___Zsoft_Paintbrush.xcu13
-rw-r--r--filter/source/config/fragments/filters/PFS_First_Choice_1_0__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/PFS_First_Choice_2_0__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/PFS_First_Choice_3_0__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/PFS_Write__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/PGM___Portable_Graymap.xcu13
-rw-r--r--filter/source/config/fragments/filters/PNG___Portable_Network_Graphic.xcu13
-rw-r--r--filter/source/config/fragments/filters/PPM___Portable_Pixelmap.xcu13
-rw-r--r--filter/source/config/fragments/filters/PSD___Adobe_Photoshop.xcu13
-rw-r--r--filter/source/config/fragments/filters/Peach_Text__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/PocketWord_File.xcu13
-rw-r--r--filter/source/config/fragments/filters/Pocket_Excel.xcu13
-rw-r--r--filter/source/config/fragments/filters/Professional_Write_1_0__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/Professional_Write_2_x__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/Professional_Write_Plus__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/QPro.xcu13
-rw-r--r--filter/source/config/fragments/filters/Q_A_Write_1_0_3_0__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/Q_A_Write_4_0__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/RAS___Sun_Rasterfile.xcu13
-rw-r--r--filter/source/config/fragments/filters/Rapid_File_1_0__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/Rapid_File_1_2__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/Rich_Text_Format.xcu13
-rw-r--r--filter/source/config/fragments/filters/Rich_Text_Format__StarCalc_.xcu13
-rw-r--r--filter/source/config/fragments/filters/SGF___StarOffice_Writer_SGF.xcu13
-rw-r--r--filter/source/config/fragments/filters/SGV___StarDraw_2_0.xcu13
-rw-r--r--filter/source/config/fragments/filters/SVM___StarView_Metafile.xcu13
-rw-r--r--filter/source/config/fragments/filters/SYLK.xcu13
-rw-r--r--filter/source/config/fragments/filters/Samna_Word_IV_IV_Plus__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/StarCalc_1_0.xcu13
-rw-r--r--filter/source/config/fragments/filters/StarCalc_3_0.xcu13
-rw-r--r--filter/source/config/fragments/filters/StarCalc_3_0_Vorlage_Template.xcu10
-rw-r--r--filter/source/config/fragments/filters/StarCalc_3_0_Vorlage_Template_ui.xcu6
-rw-r--r--filter/source/config/fragments/filters/StarCalc_4_0.xcu13
-rw-r--r--filter/source/config/fragments/filters/StarCalc_4_0_Vorlage_Template.xcu10
-rw-r--r--filter/source/config/fragments/filters/StarCalc_4_0_Vorlage_Template_ui.xcu6
-rw-r--r--filter/source/config/fragments/filters/StarCalc_5_0.xcu13
-rw-r--r--filter/source/config/fragments/filters/StarCalc_5_0_Vorlage_Template.xcu10
-rw-r--r--filter/source/config/fragments/filters/StarCalc_5_0_Vorlage_Template_ui.xcu6
-rw-r--r--filter/source/config/fragments/filters/StarChart_3_0.xcu13
-rw-r--r--filter/source/config/fragments/filters/StarChart_4_0.xcu13
-rw-r--r--filter/source/config/fragments/filters/StarChart_5_0.xcu13
-rw-r--r--filter/source/config/fragments/filters/StarDraw_3_0.xcu13
-rw-r--r--filter/source/config/fragments/filters/StarDraw_3_0_Vorlage.xcu10
-rw-r--r--filter/source/config/fragments/filters/StarDraw_3_0_Vorlage__StarImpress_.xcu10
-rw-r--r--filter/source/config/fragments/filters/StarDraw_3_0_Vorlage__StarImpress__ui.xcu6
-rw-r--r--filter/source/config/fragments/filters/StarDraw_3_0_Vorlage_ui.xcu6
-rw-r--r--filter/source/config/fragments/filters/StarDraw_3_0__StarImpress_.xcu13
-rw-r--r--filter/source/config/fragments/filters/StarDraw_5_0.xcu13
-rw-r--r--filter/source/config/fragments/filters/StarDraw_5_0_Vorlage.xcu10
-rw-r--r--filter/source/config/fragments/filters/StarDraw_5_0_Vorlage__StarImpress_.xcu10
-rw-r--r--filter/source/config/fragments/filters/StarDraw_5_0_Vorlage__StarImpress__ui.xcu6
-rw-r--r--filter/source/config/fragments/filters/StarDraw_5_0_Vorlage_ui.xcu6
-rw-r--r--filter/source/config/fragments/filters/StarDraw_5_0__StarImpress_.xcu13
-rw-r--r--filter/source/config/fragments/filters/StarImpress_4_0.xcu13
-rw-r--r--filter/source/config/fragments/filters/StarImpress_4_0_Vorlage.xcu10
-rw-r--r--filter/source/config/fragments/filters/StarImpress_4_0_Vorlage_ui.xcu6
-rw-r--r--filter/source/config/fragments/filters/StarImpress_5_0.xcu13
-rw-r--r--filter/source/config/fragments/filters/StarImpress_5_0_Vorlage.xcu10
-rw-r--r--filter/source/config/fragments/filters/StarImpress_5_0_Vorlage_ui.xcu6
-rw-r--r--filter/source/config/fragments/filters/StarImpress_5_0__packed_.xcu13
-rw-r--r--filter/source/config/fragments/filters/StarImpress_5_0__packed__ui.xcu6
-rw-r--r--filter/source/config/fragments/filters/StarMath_2_0.xcu13
-rw-r--r--filter/source/config/fragments/filters/StarMath_3_0.xcu13
-rw-r--r--filter/source/config/fragments/filters/StarMath_4_0.xcu13
-rw-r--r--filter/source/config/fragments/filters/StarMath_5_0.xcu13
-rw-r--r--filter/source/config/fragments/filters/StarOffice_XML__Base_.xcu10
-rw-r--r--filter/source/config/fragments/filters/StarOffice_XML__Base__ui.xcu5
-rw-r--r--filter/source/config/fragments/filters/StarOffice_XML__Calc_.xcu10
-rw-r--r--filter/source/config/fragments/filters/StarOffice_XML__Calc__ui.xcu6
-rw-r--r--filter/source/config/fragments/filters/StarOffice_XML__Chart_.xcu10
-rw-r--r--filter/source/config/fragments/filters/StarOffice_XML__Chart__ui.xcu6
-rw-r--r--filter/source/config/fragments/filters/StarOffice_XML__Draw_.xcu10
-rw-r--r--filter/source/config/fragments/filters/StarOffice_XML__Draw__ui.xcu6
-rw-r--r--filter/source/config/fragments/filters/StarOffice_XML__Impress_.xcu10
-rw-r--r--filter/source/config/fragments/filters/StarOffice_XML__Impress__ui.xcu6
-rw-r--r--filter/source/config/fragments/filters/StarOffice_XML__Math_.xcu10
-rw-r--r--filter/source/config/fragments/filters/StarOffice_XML__Math__ui.xcu6
-rw-r--r--filter/source/config/fragments/filters/StarOffice_XML__Writer_.xcu10
-rw-r--r--filter/source/config/fragments/filters/StarOffice_XML__Writer__ui.xcu6
-rw-r--r--filter/source/config/fragments/filters/StarWriter_1_0.xcu13
-rw-r--r--filter/source/config/fragments/filters/StarWriter_2_0.xcu13
-rw-r--r--filter/source/config/fragments/filters/StarWriter_3_0.xcu13
-rw-r--r--filter/source/config/fragments/filters/StarWriter_3_0_Vorlage_Template.xcu10
-rw-r--r--filter/source/config/fragments/filters/StarWriter_3_0_Vorlage_Template_ui.xcu6
-rw-r--r--filter/source/config/fragments/filters/StarWriter_3_0__StarWriter_GlobalDocument_.xcu13
-rw-r--r--filter/source/config/fragments/filters/StarWriter_3_0__StarWriter_Web_.xcu13
-rw-r--r--filter/source/config/fragments/filters/StarWriter_4_0.xcu13
-rw-r--r--filter/source/config/fragments/filters/StarWriter_4_0_GlobalDocument.xcu10
-rw-r--r--filter/source/config/fragments/filters/StarWriter_4_0_GlobalDocument_ui.xcu6
-rw-r--r--filter/source/config/fragments/filters/StarWriter_4_0_Vorlage_Template.xcu10
-rw-r--r--filter/source/config/fragments/filters/StarWriter_4_0_Vorlage_Template_ui.xcu6
-rw-r--r--filter/source/config/fragments/filters/StarWriter_4_0__StarWriter_GlobalDocument_.xcu13
-rw-r--r--filter/source/config/fragments/filters/StarWriter_4_0__StarWriter_Web_.xcu13
-rw-r--r--filter/source/config/fragments/filters/StarWriter_5_0.xcu13
-rw-r--r--filter/source/config/fragments/filters/StarWriter_5_0_GlobalDocument.xcu10
-rw-r--r--filter/source/config/fragments/filters/StarWriter_5_0_GlobalDocument_ui.xcu6
-rw-r--r--filter/source/config/fragments/filters/StarWriter_5_0_Vorlage_Template.xcu10
-rw-r--r--filter/source/config/fragments/filters/StarWriter_5_0_Vorlage_Template_ui.xcu6
-rw-r--r--filter/source/config/fragments/filters/StarWriter_5_0__StarWriter_GlobalDocument_.xcu13
-rw-r--r--filter/source/config/fragments/filters/StarWriter_5_0__StarWriter_Web_.xcu13
-rw-r--r--filter/source/config/fragments/filters/StarWriter_DOS.xcu13
-rw-r--r--filter/source/config/fragments/filters/StarWriter_Web_4_0_Vorlage_Template.xcu10
-rw-r--r--filter/source/config/fragments/filters/StarWriter_Web_4_0_Vorlage_Template_ui.xcu6
-rw-r--r--filter/source/config/fragments/filters/StarWriter_Web_5_0_Vorlage_Template.xcu10
-rw-r--r--filter/source/config/fragments/filters/StarWriter_Web_5_0_Vorlage_Template_ui.xcu6
-rw-r--r--filter/source/config/fragments/filters/T602Document.xcu13
-rw-r--r--filter/source/config/fragments/filters/TGA___Truevision_TARGA.xcu13
-rw-r--r--filter/source/config/fragments/filters/TIF___Tag_Image_File.xcu13
-rw-r--r--filter/source/config/fragments/filters/Text.xcu10
-rw-r--r--filter/source/config/fragments/filters/Text__StarWriter_Web_.xcu10
-rw-r--r--filter/source/config/fragments/filters/Text__StarWriter_Web__ui.xcu6
-rw-r--r--filter/source/config/fragments/filters/Text___txt___csv__StarCalc_.xcu10
-rw-r--r--filter/source/config/fragments/filters/Text___txt___csv__StarCalc__ui.xcu6
-rw-r--r--filter/source/config/fragments/filters/Text__encoded_.xcu10
-rw-r--r--filter/source/config/fragments/filters/Text__encoded___StarWriter_GlobalDocument_.xcu10
-rw-r--r--filter/source/config/fragments/filters/Text__encoded___StarWriter_GlobalDocument__ui.xcu6
-rw-r--r--filter/source/config/fragments/filters/Text__encoded___StarWriter_Web_.xcu10
-rw-r--r--filter/source/config/fragments/filters/Text__encoded___StarWriter_Web__ui.xcu6
-rw-r--r--filter/source/config/fragments/filters/Text__encoded__ui.xcu6
-rw-r--r--filter/source/config/fragments/filters/Text_ui.xcu6
-rw-r--r--filter/source/config/fragments/filters/Total_Word__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/UOF_presentation.xcu13
-rw-r--r--filter/source/config/fragments/filters/UOF_presentation_ui.xcu13
-rw-r--r--filter/source/config/fragments/filters/UOF_spreadsheet.xcu13
-rw-r--r--filter/source/config/fragments/filters/UOF_spreadsheet_ui.xcu13
-rw-r--r--filter/source/config/fragments/filters/UOF_text.xcu13
-rw-r--r--filter/source/config/fragments/filters/UOF_text_ui.xcu13
-rw-r--r--filter/source/config/fragments/filters/Uniplex_V7_V8__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/Uniplex_onGO__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/VolksWriter_3_and_4__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/VolksWriter_Deluxe__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/WITA__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/WMF___MS_Windows_Metafile.xcu13
-rw-r--r--filter/source/config/fragments/filters/Wang_II_SWP__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/Wang_PC__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/Wang_WP_Plus__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/Win_Write_3_x__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/WiziWord_3_0__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/WordPerfect.xcu13
-rw-r--r--filter/source/config/fragments/filters/WordPerfect_4_1__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/WordPerfect_4_2__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/WordPerfect_5_0__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/WordPerfect_5_1__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/WordPerfect_6_0__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/WordPerfect_6_1__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/WordPerfect_Mac_1__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/WordPerfect_Mac_2__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/WordPerfect_Mac_3__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/WordPerfect__Win__5_1_5_2__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/WordPerfect__Win__6_0__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/WordPerfect__Win__6_1__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/WordPerfect__Win__7_0__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/WordStar_2000_Rel__3_0__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/WordStar_2000_Rel__3_5__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/WordStar_3_3x__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/WordStar_3_45__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/WordStar_4_0___W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/WordStar_5_0___W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/WordStar_5_5___W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/WordStar_6_0___W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/WordStar_7_0___W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/WordStar__Win__1_x_2_0__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/WriteNow_3_0__Macintosh___W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/Writing_Assistant__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/XBM___X_Consortium.xcu13
-rw-r--r--filter/source/config/fragments/filters/XEROX_XIF_5_0__Illustrator___W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/XEROX_XIF_5_0__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/XEROX_XIF_6_0__Color_Bitmap___W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/XEROX_XIF_6_0__Res_Graphic___W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/XHTML_Calc_File.xcu13
-rw-r--r--filter/source/config/fragments/filters/XHTML_Draw_File.xcu13
-rw-r--r--filter/source/config/fragments/filters/XHTML_Impress_File.xcu13
-rw-r--r--filter/source/config/fragments/filters/XHTML_Writer_File.xcu13
-rw-r--r--filter/source/config/fragments/filters/XPM.xcu13
-rw-r--r--filter/source/config/fragments/filters/XyWrite_III___W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/XyWrite_III____W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/XyWrite_IV__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/XyWrite_Sig___Win___W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/XyWrite_Signature__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/XyWrite__Win__1_0__W4W_.xcu13
-rw-r--r--filter/source/config/fragments/filters/calc8.xcu10
-rw-r--r--filter/source/config/fragments/filters/calc8_template.xcu10
-rw-r--r--filter/source/config/fragments/filters/calc8_template_ui.xcu5
-rw-r--r--filter/source/config/fragments/filters/calc8_ui.xcu5
-rw-r--r--filter/source/config/fragments/filters/calc_HTML_WebQuery.xcu10
-rw-r--r--filter/source/config/fragments/filters/calc_HTML_WebQuery_ui.xcu6
-rw-r--r--filter/source/config/fragments/filters/calc_MS_Excel_2007_Binary.xcu10
-rw-r--r--filter/source/config/fragments/filters/calc_MS_Excel_2007_Binary_ui.xcu6
-rw-r--r--filter/source/config/fragments/filters/calc_MS_Excel_2007_XML.xcu10
-rw-r--r--filter/source/config/fragments/filters/calc_MS_Excel_2007_XML_Template.xcu10
-rw-r--r--filter/source/config/fragments/filters/calc_MS_Excel_2007_XML_Template_ui.xcu6
-rw-r--r--filter/source/config/fragments/filters/calc_MS_Excel_2007_XML_ui.xcu6
-rw-r--r--filter/source/config/fragments/filters/calc_StarOffice_XML_Calc_Template.xcu10
-rw-r--r--filter/source/config/fragments/filters/calc_StarOffice_XML_Calc_Template_ui.xcu6
-rw-r--r--filter/source/config/fragments/filters/calc_pdf_Export.xcu13
-rw-r--r--filter/source/config/fragments/filters/chart8.xcu10
-rw-r--r--filter/source/config/fragments/filters/chart8_ui.xcu5
-rw-r--r--filter/source/config/fragments/filters/dBase.xcu13
-rw-r--r--filter/source/config/fragments/filters/draw8.xcu10
-rw-r--r--filter/source/config/fragments/filters/draw8_template.xcu10
-rw-r--r--filter/source/config/fragments/filters/draw8_template_ui.xcu5
-rw-r--r--filter/source/config/fragments/filters/draw8_ui.xcu5
-rw-r--r--filter/source/config/fragments/filters/draw_PCD_Photo_CD_Base.xcu13
-rw-r--r--filter/source/config/fragments/filters/draw_PCD_Photo_CD_Base16.xcu13
-rw-r--r--filter/source/config/fragments/filters/draw_PCD_Photo_CD_Base4.xcu13
-rw-r--r--filter/source/config/fragments/filters/draw_StarOffice_XML_Draw_Template.xcu10
-rw-r--r--filter/source/config/fragments/filters/draw_StarOffice_XML_Draw_Template_ui.xcu6
-rw-r--r--filter/source/config/fragments/filters/draw_bmp_Export.xcu13
-rw-r--r--filter/source/config/fragments/filters/draw_emf_Export.xcu13
-rw-r--r--filter/source/config/fragments/filters/draw_eps_Export.xcu13
-rw-r--r--filter/source/config/fragments/filters/draw_flash_Export.xcu13
-rw-r--r--filter/source/config/fragments/filters/draw_gif_Export.xcu13
-rw-r--r--filter/source/config/fragments/filters/draw_html_Export.xcu10
-rw-r--r--filter/source/config/fragments/filters/draw_html_Export_ui.xcu6
-rw-r--r--filter/source/config/fragments/filters/draw_jpg_Export.xcu13
-rw-r--r--filter/source/config/fragments/filters/draw_met_Export.xcu13
-rw-r--r--filter/source/config/fragments/filters/draw_pbm_Export.xcu13
-rw-r--r--filter/source/config/fragments/filters/draw_pct_Export.xcu13
-rw-r--r--filter/source/config/fragments/filters/draw_pdf_Export.xcu13
-rw-r--r--filter/source/config/fragments/filters/draw_pgm_Export.xcu13
-rw-r--r--filter/source/config/fragments/filters/draw_png_Export.xcu13
-rw-r--r--filter/source/config/fragments/filters/draw_ppm_Export.xcu13
-rw-r--r--filter/source/config/fragments/filters/draw_ras_Export.xcu13
-rw-r--r--filter/source/config/fragments/filters/draw_svg_Export.xcu13
-rw-r--r--filter/source/config/fragments/filters/draw_svm_Export.xcu13
-rw-r--r--filter/source/config/fragments/filters/draw_tif_Export.xcu13
-rw-r--r--filter/source/config/fragments/filters/draw_wmf_Export.xcu13
-rw-r--r--filter/source/config/fragments/filters/draw_xpm_Export.xcu13
-rw-r--r--filter/source/config/fragments/filters/impress8.xcu10
-rw-r--r--filter/source/config/fragments/filters/impress8_draw.xcu10
-rw-r--r--filter/source/config/fragments/filters/impress8_draw_ui.xcu5
-rw-r--r--filter/source/config/fragments/filters/impress8_template.xcu10
-rw-r--r--filter/source/config/fragments/filters/impress8_template_ui.xcu5
-rw-r--r--filter/source/config/fragments/filters/impress8_ui.xcu5
-rw-r--r--filter/source/config/fragments/filters/impress_MS_PowerPoint_2007_XML.xcu10
-rw-r--r--filter/source/config/fragments/filters/impress_MS_PowerPoint_2007_XML_Template.xcu10
-rw-r--r--filter/source/config/fragments/filters/impress_MS_PowerPoint_2007_XML_Template_ui.xcu6
-rw-r--r--filter/source/config/fragments/filters/impress_MS_PowerPoint_2007_XML_ui.xcu6
-rw-r--r--filter/source/config/fragments/filters/impress_StarOffice_XML_Draw.xcu10
-rw-r--r--filter/source/config/fragments/filters/impress_StarOffice_XML_Draw_ui.xcu6
-rw-r--r--filter/source/config/fragments/filters/impress_StarOffice_XML_Impress_Template.xcu10
-rw-r--r--filter/source/config/fragments/filters/impress_StarOffice_XML_Impress_Template_ui.xcu6
-rw-r--r--filter/source/config/fragments/filters/impress_bmp_Export.xcu13
-rw-r--r--filter/source/config/fragments/filters/impress_emf_Export.xcu13
-rw-r--r--filter/source/config/fragments/filters/impress_eps_Export.xcu13
-rw-r--r--filter/source/config/fragments/filters/impress_flash_Export.xcu13
-rw-r--r--filter/source/config/fragments/filters/impress_gif_Export.xcu13
-rw-r--r--filter/source/config/fragments/filters/impress_html_Export.xcu10
-rw-r--r--filter/source/config/fragments/filters/impress_html_Export_ui.xcu6
-rw-r--r--filter/source/config/fragments/filters/impress_jpg_Export.xcu13
-rw-r--r--filter/source/config/fragments/filters/impress_met_Export.xcu13
-rw-r--r--filter/source/config/fragments/filters/impress_pbm_Export.xcu13
-rw-r--r--filter/source/config/fragments/filters/impress_pct_Export.xcu13
-rw-r--r--filter/source/config/fragments/filters/impress_pdf_Export.xcu13
-rw-r--r--filter/source/config/fragments/filters/impress_pgm_Export.xcu13
-rw-r--r--filter/source/config/fragments/filters/impress_png_Export.xcu13
-rw-r--r--filter/source/config/fragments/filters/impress_ppm_Export.xcu13
-rw-r--r--filter/source/config/fragments/filters/impress_ras_Export.xcu13
-rw-r--r--filter/source/config/fragments/filters/impress_svg_Export.xcu13
-rw-r--r--filter/source/config/fragments/filters/impress_svm_Export.xcu13
-rw-r--r--filter/source/config/fragments/filters/impress_tif_Export.xcu13
-rw-r--r--filter/source/config/fragments/filters/impress_wmf_Export.xcu13
-rw-r--r--filter/source/config/fragments/filters/impress_xpm_Export.xcu13
-rw-r--r--filter/source/config/fragments/filters/makefile.mk57
-rw-r--r--filter/source/config/fragments/filters/math8.xcu10
-rw-r--r--filter/source/config/fragments/filters/math8_ui.xcu5
-rw-r--r--filter/source/config/fragments/filters/math_pdf_Export.xcu13
-rw-r--r--filter/source/config/fragments/filters/placeware_Export.xcu13
-rw-r--r--filter/source/config/fragments/filters/writer8.xcu10
-rw-r--r--filter/source/config/fragments/filters/writer8_template.xcu10
-rw-r--r--filter/source/config/fragments/filters/writer8_template_ui.xcu5
-rw-r--r--filter/source/config/fragments/filters/writer8_ui.xcu5
-rw-r--r--filter/source/config/fragments/filters/writer_MIZI_Hwp_97.xcu13
-rw-r--r--filter/source/config/fragments/filters/writer_StarOffice_XML_Writer_Template.xcu10
-rw-r--r--filter/source/config/fragments/filters/writer_StarOffice_XML_Writer_Template_ui.xcu6
-rw-r--r--filter/source/config/fragments/filters/writer_globaldocument_StarOffice_XML_Writer.xcu10
-rw-r--r--filter/source/config/fragments/filters/writer_globaldocument_StarOffice_XML_Writer_GlobalDocument.xcu10
-rw-r--r--filter/source/config/fragments/filters/writer_globaldocument_StarOffice_XML_Writer_GlobalDocument_ui.xcu6
-rw-r--r--filter/source/config/fragments/filters/writer_globaldocument_StarOffice_XML_Writer_ui.xcu6
-rw-r--r--filter/source/config/fragments/filters/writer_globaldocument_pdf_Export.xcu13
-rw-r--r--filter/source/config/fragments/filters/writer_pdf_Export.xcu13
-rw-r--r--filter/source/config/fragments/filters/writer_web_HTML_help.xcu13
-rw-r--r--filter/source/config/fragments/filters/writer_web_StarOffice_XML_Writer.xcu10
-rw-r--r--filter/source/config/fragments/filters/writer_web_StarOffice_XML_Writer_Web_Template.xcu10
-rw-r--r--filter/source/config/fragments/filters/writer_web_StarOffice_XML_Writer_Web_Template_ui.xcu6
-rw-r--r--filter/source/config/fragments/filters/writer_web_StarOffice_XML_Writer_ui.xcu6
-rw-r--r--filter/source/config/fragments/filters/writer_web_pdf_Export.xcu13
-rw-r--r--filter/source/config/fragments/filters/writerglobal8.xcu10
-rw-r--r--filter/source/config/fragments/filters/writerglobal8_HTML.xcu13
-rw-r--r--filter/source/config/fragments/filters/writerglobal8_ui.xcu5
-rw-r--r--filter/source/config/fragments/filters/writerglobal8_writer.xcu10
-rw-r--r--filter/source/config/fragments/filters/writerglobal8_writer_ui.xcu5
-rw-r--r--filter/source/config/fragments/filters/writerweb8_writer.xcu10
-rw-r--r--filter/source/config/fragments/filters/writerweb8_writer_template.xcu10
-rw-r--r--filter/source/config/fragments/filters/writerweb8_writer_template_ui.xcu5
-rw-r--r--filter/source/config/fragments/filters/writerweb8_writer_ui.xcu5
-rw-r--r--filter/source/config/fragments/frameloaders/com_sun_star_comp_chart2_ChartFrameLoader.xcu3
-rw-r--r--filter/source/config/fragments/frameloaders/com_sun_star_frame_Bibliography.xcu3
-rw-r--r--filter/source/config/fragments/frameloaders/com_sun_star_sdb_ContentLoader.xcu3
-rw-r--r--filter/source/config/fragments/frameloaders/org_openoffice_comp_dbflt_DBContentLoader2.xcu3
-rw-r--r--filter/source/config/fragments/internalgraphicfilters/bmp_Export.xcu10
-rw-r--r--filter/source/config/fragments/internalgraphicfilters/bmp_Import.xcu10
-rw-r--r--filter/source/config/fragments/internalgraphicfilters/dxf_Import.xcu10
-rw-r--r--filter/source/config/fragments/internalgraphicfilters/emf_Export.xcu10
-rw-r--r--filter/source/config/fragments/internalgraphicfilters/emf_Import.xcu10
-rw-r--r--filter/source/config/fragments/internalgraphicfilters/eps_Export.xcu10
-rw-r--r--filter/source/config/fragments/internalgraphicfilters/eps_Import.xcu10
-rw-r--r--filter/source/config/fragments/internalgraphicfilters/gif_Export.xcu10
-rw-r--r--filter/source/config/fragments/internalgraphicfilters/gif_Import.xcu10
-rw-r--r--filter/source/config/fragments/internalgraphicfilters/jpg_Export.xcu10
-rw-r--r--filter/source/config/fragments/internalgraphicfilters/jpg_Import.xcu10
-rw-r--r--filter/source/config/fragments/internalgraphicfilters/met_Export.xcu10
-rw-r--r--filter/source/config/fragments/internalgraphicfilters/met_Import.xcu10
-rw-r--r--filter/source/config/fragments/internalgraphicfilters/pbm_Export.xcu10
-rw-r--r--filter/source/config/fragments/internalgraphicfilters/pbm_Import.xcu10
-rw-r--r--filter/source/config/fragments/internalgraphicfilters/pcd_Import_Base.xcu10
-rw-r--r--filter/source/config/fragments/internalgraphicfilters/pcd_Import_Base16.xcu10
-rw-r--r--filter/source/config/fragments/internalgraphicfilters/pcd_Import_Base4.xcu10
-rw-r--r--filter/source/config/fragments/internalgraphicfilters/pct_Export.xcu10
-rw-r--r--filter/source/config/fragments/internalgraphicfilters/pct_Import.xcu10
-rw-r--r--filter/source/config/fragments/internalgraphicfilters/pcx_Import.xcu10
-rw-r--r--filter/source/config/fragments/internalgraphicfilters/pgm_Export.xcu10
-rw-r--r--filter/source/config/fragments/internalgraphicfilters/pgm_Import.xcu10
-rw-r--r--filter/source/config/fragments/internalgraphicfilters/png_Export.xcu10
-rw-r--r--filter/source/config/fragments/internalgraphicfilters/png_Import.xcu10
-rw-r--r--filter/source/config/fragments/internalgraphicfilters/ppm_Export.xcu10
-rw-r--r--filter/source/config/fragments/internalgraphicfilters/ppm_Import.xcu10
-rw-r--r--filter/source/config/fragments/internalgraphicfilters/psd_Import.xcu10
-rw-r--r--filter/source/config/fragments/internalgraphicfilters/ras_Export.xcu10
-rw-r--r--filter/source/config/fragments/internalgraphicfilters/ras_Import.xcu10
-rw-r--r--filter/source/config/fragments/internalgraphicfilters/sgf_Import.xcu10
-rw-r--r--filter/source/config/fragments/internalgraphicfilters/sgv_Import.xcu10
-rw-r--r--filter/source/config/fragments/internalgraphicfilters/svg_Export.xcu10
-rw-r--r--filter/source/config/fragments/internalgraphicfilters/svm_Export.xcu10
-rw-r--r--filter/source/config/fragments/internalgraphicfilters/svm_Import.xcu10
-rw-r--r--filter/source/config/fragments/internalgraphicfilters/tga_Import.xcu10
-rw-r--r--filter/source/config/fragments/internalgraphicfilters/tif_Export.xcu10
-rw-r--r--filter/source/config/fragments/internalgraphicfilters/tif_Import.xcu10
-rw-r--r--filter/source/config/fragments/internalgraphicfilters/wmf_Export.xcu10
-rw-r--r--filter/source/config/fragments/internalgraphicfilters/wmf_Import.xcu10
-rw-r--r--filter/source/config/fragments/internalgraphicfilters/xbm_Import.xcu10
-rw-r--r--filter/source/config/fragments/internalgraphicfilters/xpm_Export.xcu10
-rw-r--r--filter/source/config/fragments/internalgraphicfilters/xpm_Import.xcu10
-rw-r--r--filter/source/config/fragments/langfilter.xsl37
-rw-r--r--filter/source/config/fragments/makefile.mk255
-rw-r--r--filter/source/config/fragments/packagedef.mk71
-rw-r--r--filter/source/config/fragments/types/MS_Excel_2007_Binary.xcu10
-rw-r--r--filter/source/config/fragments/types/MS_Excel_2007_XML.xcu10
-rw-r--r--filter/source/config/fragments/types/MS_Excel_2007_XML_Template.xcu10
-rw-r--r--filter/source/config/fragments/types/MS_PowerPoint_2007_XML.xcu10
-rw-r--r--filter/source/config/fragments/types/MS_PowerPoint_2007_XML_Template.xcu10
-rw-r--r--filter/source/config/fragments/types/StarBase.xcu12
-rw-r--r--filter/source/config/fragments/types/Unified_Office_Format_presentation.xcu12
-rw-r--r--filter/source/config/fragments/types/Unified_Office_Format_spreadsheet.xcu12
-rw-r--r--filter/source/config/fragments/types/Unified_Office_Format_text.xcu12
-rw-r--r--filter/source/config/fragments/types/XHTML_File.xcu12
-rw-r--r--filter/source/config/fragments/types/bmp_MS_Windows.xcu12
-rw-r--r--filter/source/config/fragments/types/calc8.xcu12
-rw-r--r--filter/source/config/fragments/types/calc8_template.xcu12
-rw-r--r--filter/source/config/fragments/types/calc_DIF.xcu12
-rw-r--r--filter/source/config/fragments/types/calc_Lotus.xcu12
-rw-r--r--filter/source/config/fragments/types/calc_MS_Excel_2003_XML.xcu12
-rw-r--r--filter/source/config/fragments/types/calc_MS_Excel_40.xcu12
-rw-r--r--filter/source/config/fragments/types/calc_MS_Excel_40_VorlageTemplate.xcu12
-rw-r--r--filter/source/config/fragments/types/calc_MS_Excel_5095.xcu12
-rw-r--r--filter/source/config/fragments/types/calc_MS_Excel_5095_VorlageTemplate.xcu12
-rw-r--r--filter/source/config/fragments/types/calc_MS_Excel_95.xcu12
-rw-r--r--filter/source/config/fragments/types/calc_MS_Excel_95_VorlageTemplate.xcu12
-rw-r--r--filter/source/config/fragments/types/calc_MS_Excel_97.xcu12
-rw-r--r--filter/source/config/fragments/types/calc_MS_Excel_97_VorlageTemplate.xcu12
-rw-r--r--filter/source/config/fragments/types/calc_MiniCalc_PalmDB_File.xcu12
-rw-r--r--filter/source/config/fragments/types/calc_Pocket_Excel_File.xcu12
-rw-r--r--filter/source/config/fragments/types/calc_QPro.xcu12
-rw-r--r--filter/source/config/fragments/types/calc_SYLK.xcu12
-rw-r--r--filter/source/config/fragments/types/calc_StarCalc_10.xcu12
-rw-r--r--filter/source/config/fragments/types/calc_StarCalc_30.xcu12
-rw-r--r--filter/source/config/fragments/types/calc_StarCalc_30_VorlageTemplate.xcu12
-rw-r--r--filter/source/config/fragments/types/calc_StarCalc_40.xcu12
-rw-r--r--filter/source/config/fragments/types/calc_StarCalc_40_VorlageTemplate.xcu12
-rw-r--r--filter/source/config/fragments/types/calc_StarCalc_50.xcu12
-rw-r--r--filter/source/config/fragments/types/calc_StarCalc_50_VorlageTemplate.xcu12
-rw-r--r--filter/source/config/fragments/types/calc_StarOffice_XML_Calc.xcu12
-rw-r--r--filter/source/config/fragments/types/calc_StarOffice_XML_Calc_Template.xcu12
-rw-r--r--filter/source/config/fragments/types/calc_Text_txt_csv_StarCalc.xcu12
-rw-r--r--filter/source/config/fragments/types/calc_dBase.xcu12
-rw-r--r--filter/source/config/fragments/types/chart8.xcu12
-rw-r--r--filter/source/config/fragments/types/chart_StarChart_30.xcu12
-rw-r--r--filter/source/config/fragments/types/chart_StarChart_40.xcu12
-rw-r--r--filter/source/config/fragments/types/chart_StarChart_50.xcu12
-rw-r--r--filter/source/config/fragments/types/chart_StarOffice_XML_Chart.xcu12
-rw-r--r--filter/source/config/fragments/types/component_Bibliography.xcu12
-rw-r--r--filter/source/config/fragments/types/component_DB.xcu12
-rw-r--r--filter/source/config/fragments/types/draw8.xcu12
-rw-r--r--filter/source/config/fragments/types/draw8_template.xcu12
-rw-r--r--filter/source/config/fragments/types/draw_StarDraw_30.xcu12
-rw-r--r--filter/source/config/fragments/types/draw_StarDraw_30_Vorlage.xcu12
-rw-r--r--filter/source/config/fragments/types/draw_StarDraw_50.xcu12
-rw-r--r--filter/source/config/fragments/types/draw_StarDraw_50_Vorlage.xcu12
-rw-r--r--filter/source/config/fragments/types/draw_StarOffice_XML_Draw.xcu12
-rw-r--r--filter/source/config/fragments/types/draw_StarOffice_XML_Draw_Template.xcu12
-rw-r--r--filter/source/config/fragments/types/dxf_AutoCAD_Interchange.xcu12
-rw-r--r--filter/source/config/fragments/types/emf_MS_Windows_Metafile.xcu12
-rw-r--r--filter/source/config/fragments/types/eps_Encapsulated_PostScript.xcu12
-rw-r--r--filter/source/config/fragments/types/gif_Graphics_Interchange.xcu12
-rw-r--r--filter/source/config/fragments/types/graphic_HTML.xcu12
-rw-r--r--filter/source/config/fragments/types/graphic_SWF.xcu12
-rw-r--r--filter/source/config/fragments/types/impress8.xcu12
-rw-r--r--filter/source/config/fragments/types/impress8_template.xcu12
-rw-r--r--filter/source/config/fragments/types/impress_CGM_Computer_Graphics_Metafile.xcu12
-rw-r--r--filter/source/config/fragments/types/impress_MS_PowerPoint_97.xcu12
-rw-r--r--filter/source/config/fragments/types/impress_MS_PowerPoint_97_Vorlage.xcu12
-rw-r--r--filter/source/config/fragments/types/impress_StarImpress_40.xcu12
-rw-r--r--filter/source/config/fragments/types/impress_StarImpress_40_Vorlage.xcu12
-rw-r--r--filter/source/config/fragments/types/impress_StarImpress_50.xcu12
-rw-r--r--filter/source/config/fragments/types/impress_StarImpress_50_Vorlage.xcu12
-rw-r--r--filter/source/config/fragments/types/impress_StarImpress_50_packed.xcu12
-rw-r--r--filter/source/config/fragments/types/impress_StarOffice_XML_Impress.xcu12
-rw-r--r--filter/source/config/fragments/types/impress_StarOffice_XML_Impress_Template.xcu12
-rw-r--r--filter/source/config/fragments/types/jpg_JPEG.xcu12
-rw-r--r--filter/source/config/fragments/types/makefile.mk54
-rw-r--r--filter/source/config/fragments/types/math8.xcu12
-rw-r--r--filter/source/config/fragments/types/math_MathML_XML_Math.xcu12
-rw-r--r--filter/source/config/fragments/types/math_MathType_3x.xcu12
-rw-r--r--filter/source/config/fragments/types/math_StarMath_20.xcu12
-rw-r--r--filter/source/config/fragments/types/math_StarMath_30.xcu12
-rw-r--r--filter/source/config/fragments/types/math_StarMath_40.xcu12
-rw-r--r--filter/source/config/fragments/types/math_StarMath_50.xcu12
-rw-r--r--filter/source/config/fragments/types/math_StarOffice_XML_Math.xcu12
-rw-r--r--filter/source/config/fragments/types/met_OS2_Metafile.xcu12
-rw-r--r--filter/source/config/fragments/types/oxt_OpenOffice_Extension.xcu12
-rw-r--r--filter/source/config/fragments/types/pbm_Portable_Bitmap.xcu12
-rw-r--r--filter/source/config/fragments/types/pcd_Photo_CD_Base.xcu12
-rw-r--r--filter/source/config/fragments/types/pcd_Photo_CD_Base16.xcu12
-rw-r--r--filter/source/config/fragments/types/pcd_Photo_CD_Base4.xcu12
-rw-r--r--filter/source/config/fragments/types/pct_Mac_Pict.xcu12
-rw-r--r--filter/source/config/fragments/types/pcx_Zsoft_Paintbrush.xcu12
-rw-r--r--filter/source/config/fragments/types/pdf_Portable_Document_Format.xcu12
-rw-r--r--filter/source/config/fragments/types/pgm_Portable_Graymap.xcu12
-rw-r--r--filter/source/config/fragments/types/png_Portable_Network_Graphic.xcu12
-rw-r--r--filter/source/config/fragments/types/ppm_Portable_Pixelmap.xcu12
-rw-r--r--filter/source/config/fragments/types/psd_Adobe_Photoshop.xcu12
-rw-r--r--filter/source/config/fragments/types/pwp_PlaceWare.xcu12
-rw-r--r--filter/source/config/fragments/types/ras_Sun_Rasterfile.xcu12
-rw-r--r--filter/source/config/fragments/types/sgf_StarOffice_Writer_SGF.xcu12
-rw-r--r--filter/source/config/fragments/types/sgv_StarDraw_20.xcu12
-rw-r--r--filter/source/config/fragments/types/svg_Scalable_Vector_Graphics.xcu12
-rw-r--r--filter/source/config/fragments/types/svm_StarView_Metafile.xcu12
-rw-r--r--filter/source/config/fragments/types/tga_Truevision_TARGA.xcu12
-rw-r--r--filter/source/config/fragments/types/tif_Tag_Image_File.xcu12
-rw-r--r--filter/source/config/fragments/types/wav_Wave_Audio_File.xcu12
-rw-r--r--filter/source/config/fragments/types/wmf_MS_Windows_Metafile.xcu12
-rw-r--r--filter/source/config/fragments/types/writer8.xcu12
-rw-r--r--filter/source/config/fragments/types/writer8_template.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_Ami_Pro_1x_31_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_AportisDoc_PalmDB_File.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_CTOS_DEF_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_Claris_Works_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_DCAFFT_Final_Form_Text_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_DCA_Revisable_Form_Text_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_DCA_with_Display_Write_5_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_DEC_DX_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_DEC_WPS_PLUS_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_DataGeneral_CEO_Write_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_DisplayWrite_20_4x_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_DisplayWrite_5x_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_DocBook_File.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_EBCDIC_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_Enable_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_Frame_Maker_MIF_30_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_Frame_Maker_MIF_40_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_Frame_Maker_MIF_50_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_Frame_Work_III_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_Frame_Work_IV_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_HP_AdvanceWrite_Plus_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_ICL_Office_Power_6_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_ICL_Office_Power_7_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_Interleaf_5_6_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_Interleaf_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_Legacy_Winstar_onGO_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_Lotus_1_2_3_10_DOS_StarWriter.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_Lotus_1_2_3_10_WIN_StarWriter.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_Lotus_Manuscript_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_MASS_11_Rel_80_83_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_MASS_11_Rel_85_90_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_MIZI_Hwp_97.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_MS_MacWord_30_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_MS_MacWord_40_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_MS_MacWord_5x_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_MS_WinWord_1x_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_MS_WinWord_2x_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_MS_WinWord_5.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_MS_WinWord_60.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_MS_Word_2003_XML.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_MS_Word_2007_XML.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_MS_Word_2007_XML_Template.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_MS_Word_3x_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_MS_Word_4x_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_MS_Word_5x_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_MS_Word_6x_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_MS_Word_95.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_MS_Word_95_Vorlage.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_MS_Word_97.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_MS_Word_97_Vorlage.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_MS_Works_20_DOS_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_MS_Works_30_Win_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_MS_Works_40_Mac_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_Mac_Write_4x_50_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_Mac_Write_II_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_Mac_Write_Pro_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_MultiMate_33_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_MultiMate_4_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_MultiMate_Adv_36_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_MultiMate_Adv_II_37_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_NAVY_DIF_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_OfficeWriter_40_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_OfficeWriter_50_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_OfficeWriter_6x_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_PFS_First_Choice_10_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_PFS_First_Choice_20_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_PFS_First_Choice_30_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_PFS_Write_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_Peach_Text_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_PocketWord_File.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_Professional_Write_10_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_Professional_Write_2x_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_Professional_Write_Plus_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_QA_Write_10_30_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_QA_Write_40_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_Rapid_File_10_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_Rapid_File_12_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_Rich_Text_Format.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_Samna_Word_IV_IV_Plus_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_StarOffice_XML_Writer.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_StarOffice_XML_Writer_Template.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_StarWriter_10.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_StarWriter_20.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_StarWriter_30.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_StarWriter_30_VorlageTemplate.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_StarWriter_40.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_StarWriter_40_VorlageTemplate.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_StarWriter_50.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_StarWriter_50_VorlageTemplate.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_StarWriter_DOS.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_T602_Document.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_Text.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_Text_encoded.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_Total_Word_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_Uniplex_V7_V8_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_Uniplex_onGO_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_VolksWriter_3_and_4_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_VolksWriter_Deluxe_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_WITA_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_Wang_II_SWP_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_Wang_PC_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_Wang_WP_Plus_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_Win_Write_3x_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_WiziWord_30_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_WordPerfect_41_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_WordPerfect_42_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_WordPerfect_50_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_WordPerfect_51_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_WordPerfect_60_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_WordPerfect_61_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_WordPerfect_Document.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_WordPerfect_Mac_1_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_WordPerfect_Mac_2_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_WordPerfect_Mac_3_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_WordPerfect_Win_51_52_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_WordPerfect_Win_60_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_WordPerfect_Win_61_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_WordPerfect_Win_70_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_WordStar_2000_Rel_30_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_WordStar_2000_Rel_35_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_WordStar_33x_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_WordStar_345_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_WordStar_40_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_WordStar_50_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_WordStar_55_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_WordStar_60_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_WordStar_70_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_WordStar_Win_1x_20_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_WriteNow_30_Macintosh_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_Writing_Assistant_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_XEROX_XIF_50_Illustrator_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_XEROX_XIF_50_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_XEROX_XIF_60_Color_Bitmap_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_XEROX_XIF_60_Res_Graphic_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_XyWrite_IIIP_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_XyWrite_III_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_XyWrite_IV_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_XyWrite_Sig_Win_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_XyWrite_Signature_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_XyWrite_Win_10_W4W.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_globaldocument_StarOffice_XML_Writer_GlobalDocument.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_globaldocument_StarWriter_40GlobalDocument.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_globaldocument_StarWriter_50GlobalDocument.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_web_HTML.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_web_HTML_help.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_web_StarOffice_XML_Writer_Web_Template.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_web_StarWriterWeb_40_VorlageTemplate.xcu12
-rw-r--r--filter/source/config/fragments/types/writer_web_StarWriterWeb_50_VorlageTemplate.xcu12
-rw-r--r--filter/source/config/fragments/types/writerglobal8.xcu12
-rw-r--r--filter/source/config/fragments/types/writerweb8_writer_template.xcu12
-rw-r--r--filter/source/config/fragments/types/xbm_X_Consortium.xcu12
-rw-r--r--filter/source/config/fragments/types/xpm_XPM.xcu12
-rw-r--r--filter/source/config/tools/Manifest.mf4
-rwxr-xr-xfilter/source/config/tools/merge/pyAltFCFGMerge591
-rw-r--r--filter/source/config/tools/split/FCFGSplit.cfg110
-rw-r--r--filter/source/config/tools/split/FCFGSplit.java565
-rw-r--r--filter/source/config/tools/split/Manifest.mf1
-rw-r--r--filter/source/config/tools/split/Splitter.java310
-rw-r--r--filter/source/config/tools/split/SplitterData.java87
-rw-r--r--filter/source/config/tools/split/makefile.mk88
-rw-r--r--filter/source/docbook/DocBookTemplate.stwbin0 -> 6688 bytes
-rw-r--r--filter/source/docbook/docbooktosoffheadings.xsl1424
-rw-r--r--filter/source/docbook/makefile.mk51
-rw-r--r--filter/source/docbook/sofftodocbookheadings.xsl1185
-rw-r--r--filter/source/filtertracer/exports.dxp3
-rw-r--r--filter/source/filtertracer/filtertracer.cxx256
-rw-r--r--filter/source/filtertracer/filtertracer.hxx186
-rw-r--r--filter/source/filtertracer/filtertraceruno.cxx110
-rw-r--r--filter/source/filtertracer/makefile.mk63
-rw-r--r--filter/source/flash/impswfdialog.cxx125
-rw-r--r--filter/source/flash/impswfdialog.hrc48
-rw-r--r--filter/source/flash/impswfdialog.hxx85
-rw-r--r--filter/source/flash/impswfdialog.src182
-rw-r--r--filter/source/flash/makefile.mk98
-rw-r--r--filter/source/flash/swfdialog.cxx283
-rw-r--r--filter/source/flash/swfdialog.hxx89
-rw-r--r--filter/source/flash/swfexporter.cxx768
-rw-r--r--filter/source/flash/swfexporter.hxx218
-rw-r--r--filter/source/flash/swffilter.cxx526
-rw-r--r--filter/source/flash/swfuno.cxx136
-rw-r--r--filter/source/flash/swfwriter.cxx640
-rw-r--r--filter/source/flash/swfwriter.hxx462
-rw-r--r--filter/source/flash/swfwriter1.cxx2126
-rw-r--r--filter/source/flash/swfwriter2.cxx692
-rw-r--r--filter/source/graphicfilter/egif/dlgegif.cxx108
-rw-r--r--filter/source/graphicfilter/egif/dlgegif.hrc36
-rw-r--r--filter/source/graphicfilter/egif/dlgegif.hxx71
-rw-r--r--filter/source/graphicfilter/egif/dlgegif.src118
-rw-r--r--filter/source/graphicfilter/egif/egif.cxx629
-rw-r--r--filter/source/graphicfilter/egif/egifstr.src39
-rw-r--r--filter/source/graphicfilter/egif/exports.map8
-rw-r--r--filter/source/graphicfilter/egif/giflzwc.cxx256
-rw-r--r--filter/source/graphicfilter/egif/giflzwc.hxx65
-rw-r--r--filter/source/graphicfilter/egif/makefile.mk78
-rw-r--r--filter/source/graphicfilter/egif/strings.hrc28
-rw-r--r--filter/source/graphicfilter/eos2met/dlgeos2.cxx179
-rw-r--r--filter/source/graphicfilter/eos2met/dlgeos2.hrc41
-rw-r--r--filter/source/graphicfilter/eos2met/dlgeos2.hxx80
-rw-r--r--filter/source/graphicfilter/eos2met/dlgeos2.src162
-rw-r--r--filter/source/graphicfilter/eos2met/eos2met.cxx2648
-rw-r--r--filter/source/graphicfilter/eos2met/eos2mstr.src38
-rw-r--r--filter/source/graphicfilter/eos2met/exports.map8
-rw-r--r--filter/source/graphicfilter/eos2met/makefile.mk74
-rw-r--r--filter/source/graphicfilter/eos2met/strings.hrc29
-rw-r--r--filter/source/graphicfilter/epbm/dlgepbm.cxx99
-rw-r--r--filter/source/graphicfilter/epbm/dlgepbm.hrc34
-rw-r--r--filter/source/graphicfilter/epbm/dlgepbm.hxx71
-rw-r--r--filter/source/graphicfilter/epbm/dlgepbm.src106
-rw-r--r--filter/source/graphicfilter/epbm/epbm.cxx272
-rw-r--r--filter/source/graphicfilter/epbm/epbmstr.src35
-rw-r--r--filter/source/graphicfilter/epbm/exports.map8
-rw-r--r--filter/source/graphicfilter/epbm/makefile.mk75
-rw-r--r--filter/source/graphicfilter/epbm/strings.hrc27
-rw-r--r--filter/source/graphicfilter/epgm/dlgepgm.cxx97
-rw-r--r--filter/source/graphicfilter/epgm/dlgepgm.hrc34
-rw-r--r--filter/source/graphicfilter/epgm/dlgepgm.hxx71
-rw-r--r--filter/source/graphicfilter/epgm/dlgepgm.src105
-rw-r--r--filter/source/graphicfilter/epgm/epgm.cxx297
-rw-r--r--filter/source/graphicfilter/epgm/epgmstr.src35
-rw-r--r--filter/source/graphicfilter/epgm/exports.map8
-rw-r--r--filter/source/graphicfilter/epgm/makefile.mk76
-rw-r--r--filter/source/graphicfilter/epgm/strings.hrc27
-rw-r--r--filter/source/graphicfilter/epict/dlgepct.cxx183
-rw-r--r--filter/source/graphicfilter/epict/dlgepct.hrc41
-rw-r--r--filter/source/graphicfilter/epict/dlgepct.hxx80
-rw-r--r--filter/source/graphicfilter/epict/dlgepct.src163
-rw-r--r--filter/source/graphicfilter/epict/epict.cxx2387
-rw-r--r--filter/source/graphicfilter/epict/epictstr.src38
-rw-r--r--filter/source/graphicfilter/epict/exports.map8
-rw-r--r--filter/source/graphicfilter/epict/makefile.mk76
-rw-r--r--filter/source/graphicfilter/epict/strings.hrc29
-rw-r--r--filter/source/graphicfilter/eppm/dlgeppm.cxx96
-rw-r--r--filter/source/graphicfilter/eppm/dlgeppm.hrc34
-rw-r--r--filter/source/graphicfilter/eppm/dlgeppm.hxx71
-rw-r--r--filter/source/graphicfilter/eppm/dlgeppm.src106
-rw-r--r--filter/source/graphicfilter/eppm/eppm.cxx305
-rw-r--r--filter/source/graphicfilter/eppm/eppmstr.src35
-rw-r--r--filter/source/graphicfilter/eppm/exports.map8
-rw-r--r--filter/source/graphicfilter/eppm/makefile.mk76
-rw-r--r--filter/source/graphicfilter/eppm/strings.hrc27
-rw-r--r--filter/source/graphicfilter/eps/dlgeps.cxx206
-rw-r--r--filter/source/graphicfilter/eps/dlgeps.hrc43
-rw-r--r--filter/source/graphicfilter/eps/dlgeps.hxx82
-rw-r--r--filter/source/graphicfilter/eps/dlgeps.src160
-rw-r--r--filter/source/graphicfilter/eps/eps.cxx2793
-rw-r--r--filter/source/graphicfilter/eps/epsstr.src70
-rw-r--r--filter/source/graphicfilter/eps/exports.map8
-rw-r--r--filter/source/graphicfilter/eps/makefile.mk79
-rw-r--r--filter/source/graphicfilter/eps/strings.hrc29
-rw-r--r--filter/source/graphicfilter/eras/eras.cxx317
-rw-r--r--filter/source/graphicfilter/eras/exports.map7
-rw-r--r--filter/source/graphicfilter/eras/makefile.mk67
-rw-r--r--filter/source/graphicfilter/etiff/etiff.cxx648
-rw-r--r--filter/source/graphicfilter/etiff/exports.map7
-rw-r--r--filter/source/graphicfilter/etiff/makefile.mk65
-rw-r--r--filter/source/graphicfilter/expm/expm.cxx302
-rw-r--r--filter/source/graphicfilter/expm/exports.map7
-rw-r--r--filter/source/graphicfilter/expm/makefile.mk66
-rw-r--r--filter/source/graphicfilter/icgm/actimpr.cxx1134
-rw-r--r--filter/source/graphicfilter/icgm/bitmap.cxx410
-rw-r--r--filter/source/graphicfilter/icgm/bitmap.hxx87
-rw-r--r--filter/source/graphicfilter/icgm/bundles.cxx288
-rw-r--r--filter/source/graphicfilter/icgm/bundles.hxx173
-rw-r--r--filter/source/graphicfilter/icgm/cgm.cxx927
-rw-r--r--filter/source/graphicfilter/icgm/cgm.hxx178
-rw-r--r--filter/source/graphicfilter/icgm/cgmres.hrc28
-rw-r--r--filter/source/graphicfilter/icgm/cgmtypes.hxx145
-rw-r--r--filter/source/graphicfilter/icgm/chart.cxx100
-rw-r--r--filter/source/graphicfilter/icgm/chart.hxx214
-rw-r--r--filter/source/graphicfilter/icgm/class0.cxx138
-rw-r--r--filter/source/graphicfilter/icgm/class1.cxx231
-rw-r--r--filter/source/graphicfilter/icgm/class2.cxx227
-rw-r--r--filter/source/graphicfilter/icgm/class3.cxx144
-rw-r--r--filter/source/graphicfilter/icgm/class4.cxx861
-rw-r--r--filter/source/graphicfilter/icgm/class5.cxx524
-rw-r--r--filter/source/graphicfilter/icgm/class7.cxx237
-rw-r--r--filter/source/graphicfilter/icgm/classx.cxx262
-rw-r--r--filter/source/graphicfilter/icgm/elements.cxx395
-rw-r--r--filter/source/graphicfilter/icgm/elements.hxx145
-rw-r--r--filter/source/graphicfilter/icgm/exports.map7
-rw-r--r--filter/source/graphicfilter/icgm/main.hxx63
-rw-r--r--filter/source/graphicfilter/icgm/makefile.mk80
-rw-r--r--filter/source/graphicfilter/icgm/outact.cxx200
-rw-r--r--filter/source/graphicfilter/icgm/outact.hxx148
-rw-r--r--filter/source/graphicfilter/idxf/dxf2mtf.cxx980
-rw-r--r--filter/source/graphicfilter/idxf/dxf2mtf.hxx128
-rw-r--r--filter/source/graphicfilter/idxf/dxfblkrd.cxx139
-rw-r--r--filter/source/graphicfilter/idxf/dxfblkrd.hxx87
-rw-r--r--filter/source/graphicfilter/idxf/dxfentrd.cxx871
-rw-r--r--filter/source/graphicfilter/idxf/dxfentrd.hxx602
-rw-r--r--filter/source/graphicfilter/idxf/dxfgrprd.cxx361
-rw-r--r--filter/source/graphicfilter/idxf/dxfgrprd.hxx155
-rw-r--r--filter/source/graphicfilter/idxf/dxfreprd.cxx385
-rw-r--r--filter/source/graphicfilter/idxf/dxfreprd.hxx138
-rw-r--r--filter/source/graphicfilter/idxf/dxftblrd.cxx348
-rw-r--r--filter/source/graphicfilter/idxf/dxftblrd.hxx183
-rw-r--r--filter/source/graphicfilter/idxf/dxfvec.cxx254
-rw-r--r--filter/source/graphicfilter/idxf/dxfvec.hxx261
-rw-r--r--filter/source/graphicfilter/idxf/exports.map7
-rw-r--r--filter/source/graphicfilter/idxf/idxf.cxx82
-rw-r--r--filter/source/graphicfilter/idxf/makefile.mk79
-rw-r--r--filter/source/graphicfilter/ieps/exports.map7
-rw-r--r--filter/source/graphicfilter/ieps/ieps.cxx771
-rw-r--r--filter/source/graphicfilter/ieps/makefile.mk66
-rw-r--r--filter/source/graphicfilter/ios2met/exports.map7
-rw-r--r--filter/source/graphicfilter/ios2met/ios2met.cxx2784
-rw-r--r--filter/source/graphicfilter/ios2met/makefile.mk68
-rw-r--r--filter/source/graphicfilter/ipbm/exports.map7
-rw-r--r--filter/source/graphicfilter/ipbm/ipbm.cxx565
-rw-r--r--filter/source/graphicfilter/ipbm/makefile.mk68
-rw-r--r--filter/source/graphicfilter/ipcd/exports.map7
-rw-r--r--filter/source/graphicfilter/ipcd/ipcd.cxx422
-rw-r--r--filter/source/graphicfilter/ipcd/makefile.mk67
-rw-r--r--filter/source/graphicfilter/ipcx/exports.map7
-rw-r--r--filter/source/graphicfilter/ipcx/ipcx.cxx458
-rw-r--r--filter/source/graphicfilter/ipcx/makefile.mk67
-rw-r--r--filter/source/graphicfilter/ipict/exports.map7
-rw-r--r--filter/source/graphicfilter/ipict/ipict.cxx1937
-rw-r--r--filter/source/graphicfilter/ipict/makefile.mk68
-rw-r--r--filter/source/graphicfilter/ipsd/exports.map7
-rw-r--r--filter/source/graphicfilter/ipsd/ipsd.cxx763
-rw-r--r--filter/source/graphicfilter/ipsd/makefile.mk67
-rw-r--r--filter/source/graphicfilter/iras/exports.map7
-rw-r--r--filter/source/graphicfilter/iras/iras.cxx383
-rw-r--r--filter/source/graphicfilter/iras/makefile.mk67
-rw-r--r--filter/source/graphicfilter/itga/exports.map7
-rw-r--r--filter/source/graphicfilter/itga/itga.cxx758
-rw-r--r--filter/source/graphicfilter/itga/makefile.mk67
-rw-r--r--filter/source/graphicfilter/itiff/ccidecom.cxx1112
-rw-r--r--filter/source/graphicfilter/itiff/ccidecom.hxx125
-rw-r--r--filter/source/graphicfilter/itiff/exports.map7
-rw-r--r--filter/source/graphicfilter/itiff/itiff.cxx1342
-rw-r--r--filter/source/graphicfilter/itiff/lzwdecom.cxx192
-rw-r--r--filter/source/graphicfilter/itiff/lzwdecom.hxx79
-rw-r--r--filter/source/graphicfilter/itiff/makefile.mk71
-rw-r--r--filter/source/msfilter/countryid.cxx342
-rw-r--r--filter/source/msfilter/escherex.cxx4944
-rw-r--r--filter/source/msfilter/eschesdo.cxx1255
-rw-r--r--filter/source/msfilter/eschesdo.hxx206
-rw-r--r--filter/source/msfilter/makefile.mk86
-rw-r--r--filter/source/msfilter/makefile.pmk30
-rw-r--r--filter/source/msfilter/mscodec.cxx534
-rw-r--r--filter/source/msfilter/msdffimp.cxx8151
-rw-r--r--filter/source/msfilter/msfiltertracer.cxx251
-rw-r--r--filter/source/msfilter/msocximex.cxx5956
-rw-r--r--filter/source/msfilter/msoleexp.cxx364
-rw-r--r--filter/source/msfilter/msvbahelper.cxx399
-rw-r--r--filter/source/msfilter/msvbasic.cxx639
-rw-r--r--filter/source/msfilter/msvbasic.hxx120
-rw-r--r--filter/source/msfilter/powerpoint/makefile.mk65
-rw-r--r--filter/source/msfilter/powerpoint/pptcom.hxx76
-rw-r--r--filter/source/msfilter/powerpoint/pptimporter.cxx163
-rw-r--r--filter/source/msfilter/powerpoint/pptimporter.hxx91
-rw-r--r--filter/source/msfilter/powerpoint/pptimporteruno.cxx110
-rw-r--r--filter/source/msfilter/powerpoint/ppttoxml.cxx91
-rw-r--r--filter/source/msfilter/powerpoint/ppttoxml.hxx51
-rw-r--r--filter/source/msfilter/svdfppt.cxx7815
-rw-r--r--filter/source/msfilter/svxmsbas.cxx494
-rw-r--r--filter/source/msfilter/svxmsbas2.cxx85
-rw-r--r--filter/source/msfilter/viscache.hxx82
-rw-r--r--filter/source/pdf/impdialog.cxx1553
-rw-r--r--filter/source/pdf/impdialog.hrc185
-rw-r--r--filter/source/pdf/impdialog.hxx406
-rw-r--r--filter/source/pdf/impdialog.src840
-rw-r--r--filter/source/pdf/makefile.mk83
-rw-r--r--filter/source/pdf/pdf.hrc29
-rw-r--r--filter/source/pdf/pdf.src66
-rw-r--r--filter/source/pdf/pdfdialog.cxx222
-rw-r--r--filter/source/pdf/pdfdialog.hxx91
-rw-r--r--filter/source/pdf/pdfexport.cxx1975
-rw-r--r--filter/source/pdf/pdfexport.hxx141
-rw-r--r--filter/source/pdf/pdffilter.cxx267
-rw-r--r--filter/source/pdf/pdffilter.hxx133
-rw-r--r--filter/source/pdf/pdfuno.cxx124
-rw-r--r--filter/source/placeware/Base64Codec.cxx207
-rw-r--r--filter/source/placeware/Base64Codec.hxx47
-rw-r--r--filter/source/placeware/exporter.cxx516
-rw-r--r--filter/source/placeware/exporter.hxx60
-rw-r--r--filter/source/placeware/exports.dxp3
-rw-r--r--filter/source/placeware/filter.cxx217
-rw-r--r--filter/source/placeware/makefile.mk67
-rw-r--r--filter/source/placeware/placeware.xml45
-rw-r--r--filter/source/placeware/tempfile.cxx189
-rw-r--r--filter/source/placeware/tempfile.hxx48
-rw-r--r--filter/source/placeware/uno.cxx110
-rw-r--r--filter/source/placeware/zip.cxx332
-rw-r--r--filter/source/placeware/zip.hxx62
-rw-r--r--filter/source/placeware/zipfile.hxx91
-rw-r--r--filter/source/svg/SOTranscoder.java45
-rw-r--r--filter/source/svg/makefile.mk83
-rw-r--r--filter/source/svg/svgexport.cxx1007
-rw-r--r--filter/source/svg/svgfilter.cxx229
-rw-r--r--filter/source/svg/svgfilter.hxx296
-rw-r--r--filter/source/svg/svgfontexport.cxx258
-rw-r--r--filter/source/svg/svgfontexport.hxx64
-rw-r--r--filter/source/svg/svgimport.cxx188
-rw-r--r--filter/source/svg/svgscript.hxx209
-rw-r--r--filter/source/svg/svguno.cxx102
-rw-r--r--filter/source/svg/svgwriter.cxx1657
-rw-r--r--filter/source/svg/svgwriter.hxx225
-rw-r--r--filter/source/t602/filterenv.cxx128
-rw-r--r--filter/source/t602/makefile.mk62
-rw-r--r--filter/source/t602/t602filter.cxx1266
-rw-r--r--filter/source/t602/t602filter.hrc45
-rw-r--r--filter/source/t602/t602filter.hxx286
-rw-r--r--filter/source/t602/t602filter.src83
-rw-r--r--filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx437
-rw-r--r--filter/source/xmlfilteradaptor/XmlFilterAdaptor.hxx184
-rw-r--r--filter/source/xmlfilteradaptor/genericfilter.cxx180
-rw-r--r--filter/source/xmlfilteradaptor/makefile.mk62
-rwxr-xr-xfilter/source/xmlfilteradaptor/streamwrap.cxx70
-rwxr-xr-xfilter/source/xmlfilteradaptor/streamwrap.hxx78
-rw-r--r--filter/source/xmlfilterdetect/fdcomp.cxx180
-rw-r--r--filter/source/xmlfilterdetect/filterdetect.cxx309
-rw-r--r--filter/source/xmlfilterdetect/filterdetect.hxx168
-rw-r--r--filter/source/xmlfilterdetect/makefile.mk60
-rw-r--r--filter/source/xslt/common/copy.xsl9
-rw-r--r--filter/source/xslt/common/math.xsl589
-rw-r--r--filter/source/xslt/common/measure_conversion.xsl387
-rw-r--r--filter/source/xslt/export/common/ooo2ms_docpr.xsl137
-rw-r--r--filter/source/xslt/export/spreadsheetml/formular.xsl640
-rw-r--r--filter/source/xslt/export/spreadsheetml/ooo2spreadsheetml.xsl417
-rw-r--r--filter/source/xslt/export/spreadsheetml/style_mapping.xsl390
-rw-r--r--filter/source/xslt/export/spreadsheetml/styles.xsl695
-rw-r--r--filter/source/xslt/export/spreadsheetml/table.xsl937
-rw-r--r--filter/source/xslt/export/uof/odf2uof_presentation.xsl3375
-rw-r--r--filter/source/xslt/export/uof/odf2uof_spreadsheet.xsl6194
-rw-r--r--filter/source/xslt/export/uof/odf2uof_text.xsl4445
-rw-r--r--filter/source/xslt/export/wordml/ooo2wordml.xsl218
-rw-r--r--filter/source/xslt/export/wordml/ooo2wordml_border.xsl153
-rw-r--r--filter/source/xslt/export/wordml/ooo2wordml_custom_draw.xsl284
-rw-r--r--filter/source/xslt/export/wordml/ooo2wordml_draw.xsl1885
-rw-r--r--filter/source/xslt/export/wordml/ooo2wordml_field.xsl733
-rw-r--r--filter/source/xslt/export/wordml/ooo2wordml_list.xsl340
-rw-r--r--filter/source/xslt/export/wordml/ooo2wordml_page.xsl401
-rw-r--r--filter/source/xslt/export/wordml/ooo2wordml_path.xsl858
-rw-r--r--filter/source/xslt/export/wordml/ooo2wordml_settings.xsl312
-rw-r--r--filter/source/xslt/export/wordml/ooo2wordml_table.xsl416
-rw-r--r--filter/source/xslt/export/wordml/ooo2wordml_text.xsl1279
-rw-r--r--filter/source/xslt/import/common/ms2ooo_docpr.xsl101
-rw-r--r--filter/source/xslt/import/spreadsheetml/spreadsheetml2ooo.xsl9173
-rw-r--r--filter/source/xslt/import/uof/uof2odf_presentation.xsl3478
-rw-r--r--filter/source/xslt/import/uof/uof2odf_spreadsheet.xsl9054
-rw-r--r--filter/source/xslt/import/uof/uof2odf_text.xsl4650
-rw-r--r--filter/source/xslt/import/wordml/wordml2ooo.xsl348
-rw-r--r--filter/source/xslt/import/wordml/wordml2ooo_custom_draw.xsl284
-rw-r--r--filter/source/xslt/import/wordml/wordml2ooo_draw.xsl2213
-rw-r--r--filter/source/xslt/import/wordml/wordml2ooo_field.xsl1587
-rw-r--r--filter/source/xslt/import/wordml/wordml2ooo_list.xsl657
-rw-r--r--filter/source/xslt/import/wordml/wordml2ooo_page.xsl387
-rw-r--r--filter/source/xslt/import/wordml/wordml2ooo_path.xsl1818
-rw-r--r--filter/source/xslt/import/wordml/wordml2ooo_props.xsl107
-rw-r--r--filter/source/xslt/import/wordml/wordml2ooo_settings.xsl69
-rw-r--r--filter/source/xslt/import/wordml/wordml2ooo_table.xsl1286
-rw-r--r--filter/source/xslt/import/wordml/wordml2ooo_text.xsl1058
-rw-r--r--filter/source/xslt/odf2xhtml/export/common/body.xsl422
-rw-r--r--filter/source/xslt/odf2xhtml/export/common/styles/style_collector.xsl828
-rw-r--r--filter/source/xslt/odf2xhtml/export/common/styles/style_mapping_css.xsl355
-rw-r--r--filter/source/xslt/odf2xhtml/export/common/table/table.xsl164
-rw-r--r--filter/source/xslt/odf2xhtml/export/common/table/table_cells.xsl279
-rw-r--r--filter/source/xslt/odf2xhtml/export/common/table/table_columns.xsl243
-rw-r--r--filter/source/xslt/odf2xhtml/export/common/table/table_rows.xsl212
-rw-r--r--filter/source/xslt/odf2xhtml/export/common/table_of_content.xsl554
-rw-r--r--filter/source/xslt/odf2xhtml/export/xhtml/body.xsl2872
-rw-r--r--filter/source/xslt/odf2xhtml/export/xhtml/header.xsl484
-rw-r--r--filter/source/xslt/odf2xhtml/export/xhtml/opendoc2xhtml.xsl183
-rw-r--r--filter/source/xslt/odf2xhtml/export/xhtml/table.xsl222
-rw-r--r--filter/source/xsltdialog/exports.dxp3
-rw-r--r--filter/source/xsltdialog/hidother.src78
-rw-r--r--filter/source/xsltdialog/makefile.mk94
-rw-r--r--filter/source/xsltdialog/typedetectionexport.cxx298
-rw-r--r--filter/source/xsltdialog/typedetectionexport.hxx53
-rw-r--r--filter/source/xsltdialog/typedetectionimport.cxx362
-rw-r--r--filter/source/xsltdialog/typedetectionimport.hxx129
-rw-r--r--filter/source/xsltdialog/xmlfileview.cxx990
-rw-r--r--filter/source/xsltdialog/xmlfileview.hrc36
-rw-r--r--filter/source/xsltdialog/xmlfileview.hxx177
-rw-r--r--filter/source/xsltdialog/xmlfileview.src64
-rw-r--r--filter/source/xsltdialog/xmlfiltercommon.hrc41
-rw-r--r--filter/source/xsltdialog/xmlfiltercommon.hxx107
-rw-r--r--filter/source/xsltdialog/xmlfilterdialogcomponent.cxx466
-rw-r--r--filter/source/xsltdialog/xmlfilterdialogstrings.hrc72
-rw-r--r--filter/source/xsltdialog/xmlfilterdialogstrings.src203
-rw-r--r--filter/source/xsltdialog/xmlfilterhelpids.hrc88
-rw-r--r--filter/source/xsltdialog/xmlfilterjar.cxx397
-rw-r--r--filter/source/xsltdialog/xmlfilterjar.hxx65
-rw-r--r--filter/source/xsltdialog/xmlfiltersettingsdialog.cxx1799
-rw-r--r--filter/source/xsltdialog/xmlfiltersettingsdialog.hrc43
-rw-r--r--filter/source/xsltdialog/xmlfiltersettingsdialog.hxx161
-rw-r--r--filter/source/xsltdialog/xmlfiltersettingsdialog.src139
-rw-r--r--filter/source/xsltdialog/xmlfiltertabdialog.cxx373
-rw-r--r--filter/source/xsltdialog/xmlfiltertabdialog.hrc33
-rw-r--r--filter/source/xsltdialog/xmlfiltertabdialog.hxx75
-rw-r--r--filter/source/xsltdialog/xmlfiltertabdialog.src65
-rw-r--r--filter/source/xsltdialog/xmlfiltertabpagebasic.cxx153
-rw-r--r--filter/source/xsltdialog/xmlfiltertabpagebasic.hrc44
-rw-r--r--filter/source/xsltdialog/xmlfiltertabpagebasic.hxx67
-rw-r--r--filter/source/xsltdialog/xmlfiltertabpagebasic.src152
-rw-r--r--filter/source/xsltdialog/xmlfiltertabpagexslt.cxx221
-rw-r--r--filter/source/xsltdialog/xmlfiltertabpagexslt.hrc48
-rw-r--r--filter/source/xsltdialog/xmlfiltertabpagexslt.hxx82
-rw-r--r--filter/source/xsltdialog/xmlfiltertabpagexslt.src176
-rw-r--r--filter/source/xsltdialog/xmlfiltertestdialog.cxx783
-rw-r--r--filter/source/xsltdialog/xmlfiltertestdialog.hrc53
-rw-r--r--filter/source/xsltdialog/xmlfiltertestdialog.hxx107
-rw-r--r--filter/source/xsltdialog/xmlfiltertestdialog.src210
-rw-r--r--filter/source/xsltfilter/Base64.java1833
-rw-r--r--filter/source/xsltfilter/Manifest3
-rw-r--r--filter/source/xsltfilter/XSLTFilter.cxx731
-rw-r--r--filter/source/xsltfilter/XSLTFilterOLEExtracter.java393
-rw-r--r--filter/source/xsltfilter/XSLTransformer.java484
-rw-r--r--filter/source/xsltfilter/fla.cxx327
-rw-r--r--filter/source/xsltfilter/fla.hxx53
-rw-r--r--filter/source/xsltfilter/makefile.mk85
-rw-r--r--filter/source/xsltvalidate/Manifest2
-rw-r--r--filter/source/xsltvalidate/XSLTValidate.java347
-rw-r--r--filter/source/xsltvalidate/makefile.mk76
1140 files changed, 201903 insertions, 0 deletions
diff --git a/filter/source/config/cache/basecontainer.cxx b/filter/source/config/cache/basecontainer.cxx
new file mode 100644
index 000000000000..800876ce1abd
--- /dev/null
+++ b/filter/source/config/cache/basecontainer.cxx
@@ -0,0 +1,638 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include "basecontainer.hxx"
+#include "constant.hxx"
+
+//_______________________________________________
+// includes
+#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
+#include <com/sun/star/uno/Type.h>
+#include <comphelper/enumhelper.hxx>
+#include <osl/diagnose.h>
+
+//_______________________________________________
+// namespace
+
+#define LOAD_IMPLICIT
+
+namespace css = ::com::sun::star;
+
+namespace filter{
+ namespace config{
+
+//_______________________________________________
+// definitions
+
+::salhelper::SingletonRef< FilterCache >* BaseContainer::m_pPerformanceOptimizer = 0;
+
+/*-----------------------------------------------
+ 03.03.2004 11:37
+-----------------------------------------------*/
+BaseContainer::BaseContainer()
+ : BaseLock ( )
+ , m_rCache ( )
+ , m_pFlushCache(NULL )
+ , m_lListener (m_aLock)
+{
+ m_rCache->load(FilterCache::E_CONTAINS_STANDARD);
+
+ // GLOBAL SAFE (!) -> -----------------------
+ // TODO use rtl pattern to create it realy threadsafe!
+ ::osl::ResettableMutexGuard aGlobalLock(::osl::Mutex::getGlobalMutex());
+ if (!m_pPerformanceOptimizer)
+ m_pPerformanceOptimizer = new ::salhelper::SingletonRef< FilterCache >();
+ aGlobalLock.clear();
+ // <- GLOBAL SAFE (!) -----------------------
+}
+
+/*-----------------------------------------------
+ 02.07.2003 10:16
+-----------------------------------------------*/
+BaseContainer::~BaseContainer()
+{
+}
+
+/*-----------------------------------------------
+ 03.07.2003 11:16
+-----------------------------------------------*/
+void BaseContainer::init(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR ,
+ const ::rtl::OUString& sImplementationName,
+ const css::uno::Sequence< ::rtl::OUString >& lServiceNames ,
+ FilterCache::EItemType eType )
+{
+ // SAFE ->
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+
+ m_sImplementationName = sImplementationName;
+ m_lServiceNames = lServiceNames ;
+ m_xSMGR = xSMGR ;
+ m_eType = eType ;
+ m_xRefreshBroadcaster = css::uno::Reference< css::util::XRefreshable >(
+ xSMGR->createInstance(SERVICE_FILTERCONFIGREFRESH),
+ css::uno::UNO_QUERY);
+ // <- SAFE
+}
+
+/*-----------------------------------------------
+ 28.10.2003 09:04
+-----------------------------------------------*/
+void BaseContainer::impl_loadOnDemand()
+{
+#ifdef LOAD_IMPLICIT
+ // SAFE ->
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+
+ // A generic container needs all items of a set of our cache!
+ // Of course it can block for a while, till the cache is realy filled.
+ // Note: dont load all sets supported by the cache here!
+
+ FilterCache::EFillState eRequiredState = FilterCache::E_CONTAINS_NOTHING;
+ switch(m_eType)
+ {
+ case FilterCache::E_TYPE :
+ eRequiredState = FilterCache::E_CONTAINS_TYPES;
+ break;
+
+ case FilterCache::E_FILTER :
+ eRequiredState = FilterCache::E_CONTAINS_FILTERS;
+ break;
+
+ case FilterCache::E_DETECTSERVICE :
+ eRequiredState = FilterCache::E_CONTAINS_DETECTSERVICES;
+ break;
+
+ case FilterCache::E_FRAMELOADER :
+ eRequiredState = FilterCache::E_CONTAINS_FRAMELOADERS;
+ break;
+
+ case FilterCache::E_CONTENTHANDLER :
+ eRequiredState = FilterCache::E_CONTAINS_CONTENTHANDLERS;
+ break;
+ }
+
+ m_rCache->load(eRequiredState);
+ // <- SAFE
+#endif
+}
+
+/*-----------------------------------------------
+ 03.03.2004 12:18
+-----------------------------------------------*/
+void BaseContainer::impl_initFlushMode()
+ throw (css::uno::RuntimeException)
+{
+ // SAFE ->
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+ if (!m_pFlushCache)
+ m_pFlushCache = m_rCache->clone();
+ if (!m_pFlushCache)
+ throw css::uno::RuntimeException(
+ ::rtl::OUString::createFromAscii("Cant create write copy of internal used cache on demand."),
+ dynamic_cast< css::container::XNameAccess* >(this));
+ // <- SAFE
+}
+
+/*-----------------------------------------------
+ 03.03.2004 12:11
+-----------------------------------------------*/
+FilterCache* BaseContainer::impl_getWorkingCache() const
+{
+ // SAFE ->
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+ if (m_pFlushCache)
+ return m_pFlushCache;
+ else
+ return &(*m_rCache);
+ // <- SAFE
+}
+
+/*-----------------------------------------------
+ 03.07.2003 11:12
+-----------------------------------------------*/
+::rtl::OUString SAL_CALL BaseContainer::getImplementationName()
+ throw (css::uno::RuntimeException)
+{
+ // SAFE ->
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+ return m_sImplementationName;
+ // <- SAFE
+}
+
+/*-----------------------------------------------
+ 03.07.2003 11:14
+-----------------------------------------------*/
+sal_Bool SAL_CALL BaseContainer::supportsService(const ::rtl::OUString& sServiceName)
+ throw (css::uno::RuntimeException)
+{
+ // SAFE ->
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+
+ sal_Int32 c = m_lServiceNames.getLength();
+ const ::rtl::OUString* pNames = m_lServiceNames.getConstArray();
+ for (sal_Int32 i=0; i<c; ++i)
+ {
+ if (pNames[i].equals(sServiceName))
+ return sal_True;
+ }
+ return sal_False;
+ // <- SAFE
+}
+
+/*-----------------------------------------------
+ 03.07.2003 11:12
+-----------------------------------------------*/
+css::uno::Sequence< ::rtl::OUString > SAL_CALL BaseContainer::getSupportedServiceNames()
+ throw (css::uno::RuntimeException)
+{
+ // SAFE ->
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+ return m_lServiceNames;
+ // <- SAFE
+}
+
+/*-----------------------------------------------
+ 20.10.2003 11:39
+-----------------------------------------------*/
+void SAL_CALL BaseContainer::insertByName(const ::rtl::OUString& sItem ,
+ const css::uno::Any& aValue)
+ throw (css::lang::IllegalArgumentException ,
+ css::container::ElementExistException,
+ css::lang::WrappedTargetException ,
+ css::uno::RuntimeException )
+{
+ if (!sItem.getLength())
+ throw css::lang::IllegalArgumentException(
+ ::rtl::OUString::createFromAscii("empty value not allowed as item name."),
+ static_cast< css::container::XNameContainer* >(this),
+ 1);
+
+ CacheItem aItem;
+ try
+ {
+ aItem << aValue;
+ }
+ catch(const css::uno::Exception& ex)
+ {
+ throw css::lang::IllegalArgumentException(ex.Message, static_cast< css::container::XNameContainer* >(this), 2);
+ }
+
+ impl_loadOnDemand();
+
+ // SAFE -> ----------------------------------
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+
+ // create write copy of used cache on demand ...
+ impl_initFlushMode();
+
+ FilterCache* pCache = impl_getWorkingCache();
+ if (pCache->hasItem(m_eType, sItem))
+ throw css::container::ElementExistException(::rtl::OUString(), static_cast< css::container::XNameContainer* >(this));
+ pCache->setItem(m_eType, sItem, aItem);
+
+ aLock.clear();
+ // <- SAFE ----------------------------------
+}
+
+/*-----------------------------------------------
+ 03.03.2004 11:40
+-----------------------------------------------*/
+void SAL_CALL BaseContainer::removeByName(const ::rtl::OUString& sItem)
+ throw (css::container::NoSuchElementException,
+ css::lang::WrappedTargetException ,
+ css::uno::RuntimeException )
+{
+ impl_loadOnDemand();
+
+ // SAFE -> ----------------------------------
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+
+ // create write copy of used cache on demand ...
+ impl_initFlushMode();
+
+ FilterCache* pCache = impl_getWorkingCache();
+ pCache->removeItem(m_eType, sItem); // throw exceptions automaticly
+
+ aLock.clear();
+ // <- SAFE ----------------------------------
+}
+
+/*-----------------------------------------------
+ 03.03.2004 11:41
+-----------------------------------------------*/
+void SAL_CALL BaseContainer::replaceByName(const ::rtl::OUString& sItem ,
+ const css::uno::Any& aValue)
+ throw (css::lang::IllegalArgumentException ,
+ css::container::NoSuchElementException,
+ css::lang::WrappedTargetException ,
+ css::uno::RuntimeException )
+{
+ if (!sItem.getLength())
+ throw css::lang::IllegalArgumentException(
+ ::rtl::OUString::createFromAscii("empty value not allowed as item name."),
+ static_cast< css::container::XNameContainer* >(this),
+ 1);
+
+ CacheItem aItem;
+ try
+ {
+ aItem << aValue;
+ }
+ catch(const css::uno::Exception& ex)
+ {
+ throw css::lang::IllegalArgumentException(ex.Message, static_cast< css::container::XNameContainer* >(this), 2);
+ }
+
+ impl_loadOnDemand();
+
+ // SAFE -> ----------------------------------
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+
+ // create write copy of used cache on demand ...
+ impl_initFlushMode();
+
+ FilterCache* pCache = impl_getWorkingCache();
+ if (!pCache->hasItem(m_eType, sItem))
+ throw css::container::NoSuchElementException(::rtl::OUString(), static_cast< css::container::XNameContainer* >(this));
+ pCache->setItem(m_eType, sItem, aItem);
+
+ aLock.clear();
+ // <- SAFE ----------------------------------
+}
+
+/*-----------------------------------------------
+ 03.03.2004 11:44
+-----------------------------------------------*/
+css::uno::Any SAL_CALL BaseContainer::getByName(const ::rtl::OUString& sItem)
+ throw (css::container::NoSuchElementException,
+ css::lang::WrappedTargetException ,
+ css::uno::RuntimeException )
+{
+ if (!sItem.getLength())
+ throw css::container::NoSuchElementException(
+ ::rtl::OUString::createFromAscii("An empty item cant be part of this cache!"),
+ css::uno::Reference< css::uno::XInterface >(static_cast< css::container::XNameAccess* >(this), css::uno::UNO_QUERY));
+
+ css::uno::Any aValue;
+
+ impl_loadOnDemand();
+
+ // SAFE ->
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+
+ CacheItem aItem;
+ try
+ {
+ FilterCache* pCache = impl_getWorkingCache();
+ aItem = pCache->getItem(m_eType, sItem);
+ pCache->addStatePropsToItem(m_eType, sItem, aItem); // add implicit props "Finalized"/"Mandatory"
+ }
+ catch(const css::container::NoSuchElementException& exNotExist)
+ {
+ throw exNotExist;
+ }
+ catch(const css::uno::Exception&)
+ {
+ // TODO invalid cache!? How should it be handled right?
+ aItem.clear();
+ }
+
+ aValue <<= aItem.getAsPackedPropertyValueList();
+ // <- SAFE
+
+ return aValue;
+}
+
+/*-----------------------------------------------
+ 03.03.2004 11:46
+-----------------------------------------------*/
+css::uno::Sequence< ::rtl::OUString > SAL_CALL BaseContainer::getElementNames()
+ throw (css::uno::RuntimeException)
+{
+ css::uno::Sequence< ::rtl::OUString > lNames;
+
+ impl_loadOnDemand();
+
+ // SAFE ->
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+
+ try
+ {
+ FilterCache* pCache = impl_getWorkingCache();
+ OUStringList lKeys = pCache->getItemNames(m_eType);
+ lKeys >> lNames;
+ }
+ catch(const css::uno::Exception&)
+ {
+ // invalid cache!?
+ lNames.realloc(0);
+ }
+
+ // <- SAFE
+
+ return lNames;
+}
+
+/*-----------------------------------------------
+ 03.03.2004 11:47
+-----------------------------------------------*/
+sal_Bool SAL_CALL BaseContainer::hasByName(const ::rtl::OUString& sItem)
+ throw (css::uno::RuntimeException)
+{
+ sal_Bool bHasOne = sal_False;
+
+ impl_loadOnDemand();
+
+ // SAFE ->
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+
+ try
+ {
+ FilterCache* pCache = impl_getWorkingCache();
+ bHasOne = pCache->hasItem(m_eType, sItem);
+ }
+ catch(const css::uno::Exception&)
+ {
+ // invalid cache!?
+ bHasOne = sal_False;
+ }
+
+ // <- SAFE
+
+ return bHasOne;
+}
+
+/*-----------------------------------------------
+ 02.07.2003 10:18
+-----------------------------------------------*/
+css::uno::Type SAL_CALL BaseContainer::getElementType()
+ throw (css::uno::RuntimeException)
+{
+ // no lock neccessary - because the type of our items
+ // is fix! no internal call or member needed ...
+ return ::getCppuType(static_cast< css::uno::Sequence< css::beans::PropertyValue >* >(NULL));
+}
+
+/*-----------------------------------------------
+ 03.03.2004 11:48
+-----------------------------------------------*/
+sal_Bool SAL_CALL BaseContainer::hasElements()
+ throw (css::uno::RuntimeException)
+{
+ sal_Bool bHasSome = sal_False;
+
+ impl_loadOnDemand();
+
+ // SAFE ->
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+
+ try
+ {
+ FilterCache* pCache = impl_getWorkingCache();
+ bHasSome = pCache->hasItems(m_eType);
+ }
+ catch(const css::uno::Exception&)
+ {
+ // invalid cache?!
+ bHasSome = sal_False;
+ }
+
+ // <- SAFE
+
+ return bHasSome;
+}
+
+/*-----------------------------------------------
+ 15.07.2003 09:21
+-----------------------------------------------*/
+css::uno::Reference< css::container::XEnumeration > SAL_CALL BaseContainer::createSubSetEnumerationByQuery(const ::rtl::OUString& /* sQuery */ )
+ throw (css::uno::RuntimeException)
+{
+ OSL_ENSURE(sal_False, "not pure virtual ... but not realy implemented .-)");
+
+ ::comphelper::OEnumerationByName* pEnum = new ::comphelper::OEnumerationByName(this, css::uno::Sequence< ::rtl::OUString >());
+ return css::uno::Reference< css::container::XEnumeration >(static_cast< css::container::XEnumeration* >(pEnum), css::uno::UNO_QUERY);
+}
+
+/*-----------------------------------------------
+ 15.07.2003 10:15
+-----------------------------------------------*/
+css::uno::Reference< css::container::XEnumeration > SAL_CALL BaseContainer::createSubSetEnumerationByProperties(const css::uno::Sequence< css::beans::NamedValue >& lProperties)
+ throw (css::uno::RuntimeException)
+{
+ css::uno::Reference< css::container::XEnumeration > xEnum;
+ OUStringList lKeys;
+
+ impl_loadOnDemand();
+
+ // SAFE ->
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+
+ try
+ {
+ // convert the given properties first to our internal representation
+ CacheItem lProps;
+ lProps << lProperties;
+
+ // search the key names of all items, where its properties match
+ // the given ones in its minimum
+ FilterCache* pCache = impl_getWorkingCache();
+ lKeys = pCache->getMatchingItemsByProps(m_eType, lProps);
+ }
+ catch(const css::uno::Exception&)
+ {
+ // invalid cache, internal failure, wrong conversion ...!?
+ // doesnt matter
+ lKeys.clear();
+ }
+
+ // <- SAFE
+
+ // create a specialized enumeration helper, which
+ // provides the collected informations outside.
+ // It hold a reference to us ... and call our container interface directly.
+ // be aware of some direct callbacks if it will be created :-)
+
+ /* Note: Its not allowed to return NULL. Because an empty enumeration
+ transport the same information but make no trouble outside.
+ Further its easiear to work directly with the return value
+ instaed of checking of NULL returns! */
+
+ css::uno::Sequence< ::rtl::OUString > lSubSet;
+ lKeys >> lSubSet;
+ ::comphelper::OEnumerationByName* pEnum = new ::comphelper::OEnumerationByName(this, lSubSet);
+ return css::uno::Reference< css::container::XEnumeration >(static_cast< css::container::XEnumeration* >(pEnum), css::uno::UNO_QUERY);
+}
+
+/*-----------------------------------------------
+ 07.03.2004 10:48
+-----------------------------------------------*/
+void SAL_CALL BaseContainer::flush()
+ throw (css::uno::RuntimeException)
+{
+ // SAFE ->
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+
+ if (!m_pFlushCache)
+ throw css::lang::WrappedTargetRuntimeException(
+ ::rtl::OUString::createFromAscii("Cant guarantee cache consistency. Special flush container does not exists!"),
+ dynamic_cast< css::container::XNameAccess* >(this),
+ css::uno::Any());
+
+ try
+ {
+ m_pFlushCache->flush();
+ // Take over all changes into the global cache and
+ // forget the clone.
+ /* TODO
+ -think about me
+ If the global cache gets this information via listener,
+ we should remove this method!
+ */
+ m_rCache->takeOver(*m_pFlushCache);
+ }
+ catch(const css::uno::Exception& ex)
+ {
+ // Dont remove the clone. May be the outside
+ // user whish to repair it now and calls flush()
+ // later again ...
+
+ throw css::lang::WrappedTargetRuntimeException(
+ ::rtl::OUString::createFromAscii("Flush rejected by internal container."),
+ dynamic_cast< css::container::XNameAccess* >(this),
+ css::uno::makeAny(ex));
+ }
+
+ delete m_pFlushCache;
+ m_pFlushCache = NULL;
+
+ css::uno::Reference< css::util::XRefreshable > xRefreshBroadcaster = m_xRefreshBroadcaster;
+
+ aLock.clear();
+ // <- SAFE
+
+ if (xRefreshBroadcaster.is())
+ xRefreshBroadcaster->refresh();
+
+ // notify listener outside the lock!
+ // The used listener helper lives if we live
+ // and is threadsafe by itself.
+ // Further its not a good idea to hold the own lock
+ // if an outside object is called :-)
+ css::lang::EventObject aSource (static_cast< css::util::XFlushable* >(this));
+ ::cppu::OInterfaceContainerHelper* pContainer = m_lListener.getContainer(::getCppuType(static_cast< css::uno::Reference< css::util::XFlushListener >* >(NULL)));
+ if (pContainer)
+ {
+ ::cppu::OInterfaceIteratorHelper pIterator(*pContainer);
+ while (pIterator.hasMoreElements())
+ {
+ try
+ {
+ // ... this pointer can be interesting to find out, where will be called as listener
+ // Dont optimize it to a direct iterator cast :-)
+ css::util::XFlushListener* pListener = (css::util::XFlushListener*)pIterator.next();
+ pListener->flushed(aSource);
+ }
+ catch(const css::uno::Exception&)
+ {
+ // ignore any "damaged" flush listener!
+ // May its remote reference is broken ...
+ pIterator.remove();
+ }
+ }
+ }
+}
+
+/*-----------------------------------------------
+ 02.07.2003 12:16
+-----------------------------------------------*/
+void SAL_CALL BaseContainer::addFlushListener(const css::uno::Reference< css::util::XFlushListener >& xListener)
+ throw (css::uno::RuntimeException)
+{
+ // no locks neccessary
+ // used helper lives if we live and is threadsafe by itself ...
+ m_lListener.addInterface(::getCppuType(static_cast< css::uno::Reference< css::util::XFlushListener >* >(NULL)),
+ xListener );
+}
+
+/*-----------------------------------------------
+ 02.07.2003 12:18
+-----------------------------------------------*/
+void SAL_CALL BaseContainer::removeFlushListener(const css::uno::Reference< css::util::XFlushListener >& xListener)
+ throw (css::uno::RuntimeException)
+{
+ // no locks neccessary
+ // used helper lives if we live and is threadsafe by itself ...
+ m_lListener.removeInterface(::getCppuType(static_cast< css::uno::Reference< css::util::XFlushListener >* >(NULL)),
+ xListener );
+}
+
+ } // namespace config
+} // namespace filter
diff --git a/filter/source/config/cache/basecontainer.hxx b/filter/source/config/cache/basecontainer.hxx
new file mode 100644
index 000000000000..e3730ce662e4
--- /dev/null
+++ b/filter/source/config/cache/basecontainer.hxx
@@ -0,0 +1,323 @@
+/*************************************************************************
+ *
+ * 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 __FILTER_CONFIG_BASECONTAINER_HXX_
+#define __FILTER_CONFIG_BASECONTAINER_HXX_
+
+//_______________________________________________
+// includes
+
+#include "filtercache.hxx"
+#include <com/sun/star/uno/Exception.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/util/XRefreshable.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/container/XContainerQuery.hpp>
+#include <com/sun/star/util/XFlushable.hpp>
+#include <cppuhelper/interfacecontainer.h>
+#include <salhelper/singletonref.hxx>
+#include <cppuhelper/implbase4.hxx>
+#include <cppuhelper/weakref.hxx>
+#include <rtl/ustring.hxx>
+
+//_______________________________________________
+// namespace
+
+namespace filter{
+ namespace config{
+
+//_______________________________________________
+// definitions
+
+//_______________________________________________
+
+/** @short implements the interface css::container::XNameContainer
+ on top of a FilterCache reference.
+
+ @descr This class can be used as base for own service implementations,
+ which must provide read/write access to the filter configuration.
+ Parameters regulate read/write access, which sub set of informations
+ should be available etc.
+
+ @attention The base class BaseLock must be the first of declared ones.
+ Otherwhise we cant be shure, that our own mutex member (which is
+ present by this base class!) was full initialized inside our own
+ ctor as first!
+ */
+class BaseContainer : public BaseLock
+ , public ::cppu::WeakImplHelper4< css::lang::XServiceInfo ,
+ css::container::XNameContainer , // => XNameReplace => XNameAccess => XElementAccess
+ css::container::XContainerQuery ,
+ css::util::XFlushable >
+{
+ //-------------------------------------------
+ // member
+
+ protected:
+
+ /** @short reference to an uno service manager, which can be used
+ to create own needed services. */
+ css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR;
+
+ // TODO
+ css::uno::WeakReference< css::util::XRefreshable > m_xRefreshBroadcaster;
+
+ /** @short the implementation name of our derived class, which we provide
+ at the interface XServiceInfo of our class ... */
+ ::rtl::OUString m_sImplementationName;
+
+ /** @short the list of supported uno service names of our derived class, which we provide
+ at the interface XServiceInfo of our class ... */
+ css::uno::Sequence< ::rtl::OUString > m_lServiceNames;
+
+ /** @short reference(!) to a singleton filter cache implementation,
+ which is used to work with the underlying configuration. */
+ ::salhelper::SingletonRef< FilterCache > m_rCache;
+
+ /** @short local filter cache, which is used to collect changes on the
+ filter configuration first and flush it later.
+
+ @descr Normaly this member isnt used nor initialized. Thats true,
+ if this container is used for reading only. The first write access
+ (e.g. by calling insertByName()) creates a copy of the current
+ global cache m_rCache to initialize the m_pFlushCache member.
+
+ Afterwards only the flush cache copy is used. Inside flush() this
+ copy will be removed and m_rCache can be used again.
+
+ m_pFlushCache and m_rCache must not be synchronized manually here.
+ m_rCache listen on the global configuration, where m_pFlushCache
+ write its data. m_rCache update itself automaticly.
+ */
+ FilterCache* m_pFlushCache;
+
+ /** @short specify, which sub container of the used filter cache
+ must be wrapped by this container interface. */
+ FilterCache::EItemType m_eType;
+
+ /** @short holds all listener, which are registered at this instance. */
+ ::cppu::OMultiTypeInterfaceContainerHelper m_lListener;
+
+ /** @short hold at least on filter cache instance alive and
+ prevent he office from unloading this cache if no filter
+ is currently used.*/
+ static ::salhelper::SingletonRef< FilterCache >* m_pPerformanceOptimizer;
+
+ //-------------------------------------------
+ // native interface
+
+ public:
+
+ //---------------------------------------
+ // ctor/dtor
+
+ /** @short standard ctor.
+
+ @descr Because mostly this class is used as base class for own service
+ implementations in combination with a ImplInheritanceHelper2 template ...
+ there is no way to provide some initializing data through the ctor :-(
+ This base class will be created inside its default ctor and must be
+ initialized with its needed parameters explicitly by calling: "init()".
+
+ @see init()
+ */
+ BaseContainer();
+
+ //---------------------------------------
+
+ /** @short standard dtor.
+ */
+ virtual ~BaseContainer();
+
+ //---------------------------------------
+
+ /** @short initialize this generic intsnace with some specialized values
+ from our derived object.
+
+ @descr Because an outside class must use ImplInheritanceHelper2 template to
+ use us a base class ... and there is no way to pass such initializing
+ parameters trough a required default ctor ... we must be initialized
+ by this special method. Of course this method must be called first before
+ any other interface method is used.
+
+ @param xSMGR
+ reference to the uno service manager, which created this service instance.
+
+ @param sImplementationName
+ the implementation name of our derived class, which we provide
+ at the interface XServiceInfo of our class ...
+
+ @param lServiceNames
+ the list of supported uno service names of our derived class, which we provide
+ at the interface XServiceInfo of our class ...
+
+ @param eType
+ specify, which sub container of the used filter cache
+ must be wrapped by this container interface.
+ */
+ virtual void init(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR ,
+ const ::rtl::OUString& sImplementationName,
+ const css::uno::Sequence< ::rtl::OUString >& lServiceNames ,
+ FilterCache::EItemType eType );
+
+ //-------------------------------------------
+ // helper
+
+ protected:
+
+ //---------------------------------------
+
+ /** @short check if the underlying configuration data was already loaded
+ and do it if neccessary automaticly.
+ */
+ void impl_loadOnDemand();
+
+ //---------------------------------------
+
+ /** @short it creates the global instance m_pFilterCache, which is a copy
+ of the global instance m_rCache, and will be used to change the
+ configuration.
+
+ @descr If no exception occures, its guaranteed, that the member m_rFlushCache
+ was initialized right and can be used further.
+ */
+ void impl_initFlushMode()
+ throw (css::uno::RuntimeException);
+
+ //---------------------------------------
+
+ /** @short returns a pointer to the current used cache member.
+
+ @descr Its a point to the FilterCache instance behind m_pFlushCache
+ or m_rCache.
+
+ @note The lifetime of this pointer is restricted to the time, where
+ the mutex of this BaseContainer instance is locked.
+ Otherwhise may be the interface method flush() will destroy
+ m_pFlushCache and the here returned pointer will be invalid!
+
+ Use:
+
+ Guard aLock(m_aLock);
+ FilterCache* p = impl_getWorkingCache();
+ p->doSomething();
+ aLock.clear();
+ // after this point p cant b e guaranteed any longer!
+ */
+ FilterCache* impl_getWorkingCache() const;
+
+ //-------------------------------------------
+ // uno interface
+
+ public:
+
+ //---------------------------------------
+ // XServiceInfo
+
+ virtual ::rtl::OUString SAL_CALL getImplementationName()
+ throw (css::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL supportsService(const ::rtl::OUString& sServiceName)
+ throw (css::uno::RuntimeException);
+
+ virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
+ throw (css::uno::RuntimeException);
+
+ //---------------------------------------
+ // XNameContainer
+
+ virtual void SAL_CALL insertByName(const ::rtl::OUString& sItem ,
+ const css::uno::Any& aValue)
+ throw (css::lang::IllegalArgumentException ,
+ css::container::ElementExistException,
+ css::lang::WrappedTargetException ,
+ css::uno::RuntimeException );
+
+ virtual void SAL_CALL removeByName(const ::rtl::OUString& sItem)
+ throw (css::container::NoSuchElementException,
+ css::lang::WrappedTargetException ,
+ css::uno::RuntimeException );
+
+ //---------------------------------------
+ // XNameReplace
+
+ virtual void SAL_CALL replaceByName(const ::rtl::OUString& sItem ,
+ const css::uno::Any& aValue)
+ throw (css::lang::IllegalArgumentException ,
+ css::container::NoSuchElementException,
+ css::lang::WrappedTargetException ,
+ css::uno::RuntimeException );
+
+ //---------------------------------------
+ // XElementAccess
+
+ virtual css::uno::Any SAL_CALL getByName(const ::rtl::OUString& sItem)
+ throw (css::container::NoSuchElementException,
+ css::lang::WrappedTargetException ,
+ css::uno::RuntimeException );
+
+ virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames()
+ throw (css::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL hasByName(const ::rtl::OUString& sItem)
+ throw (css::uno::RuntimeException);
+
+ virtual css::uno::Type SAL_CALL getElementType()
+ throw (css::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL hasElements()
+ throw (css::uno::RuntimeException);
+
+ //---------------------------------------
+ // XContainerQuery
+
+ // must be implemented realy by derived class ...
+ // We implement return of an empty result here only!
+ // But we show an assertion :-)
+ virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createSubSetEnumerationByQuery(const ::rtl::OUString& sQuery)
+ throw (css::uno::RuntimeException);
+
+ virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createSubSetEnumerationByProperties(const css::uno::Sequence< css::beans::NamedValue >& lProperties)
+ throw (css::uno::RuntimeException);
+
+ //---------------------------------------
+ // XFlushable
+
+ virtual void SAL_CALL flush()
+ throw (css::uno::RuntimeException);
+
+ virtual void SAL_CALL addFlushListener(const css::uno::Reference< css::util::XFlushListener >& xListener)
+ throw (css::uno::RuntimeException);
+
+ virtual void SAL_CALL removeFlushListener(const css::uno::Reference< css::util::XFlushListener >& xListener)
+ throw (css::uno::RuntimeException);
+};
+
+ } // namespace config
+} // namespace filter
+
+#endif // __FILTER_CONFIG_BASECONTAINER_HXX_
diff --git a/filter/source/config/cache/cacheitem.cxx b/filter/source/config/cache/cacheitem.cxx
new file mode 100644
index 000000000000..c752516df10f
--- /dev/null
+++ b/filter/source/config/cache/cacheitem.cxx
@@ -0,0 +1,443 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include "cacheitem.hxx"
+#include "macros.hxx"
+#include "constant.hxx"
+
+//_______________________________________________
+// includes
+#include <com/sun/star/uno/Sequence.h>
+
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_Hpp_
+#include <com/sun/star/beans/PropertyValue.hpp>
+#endif
+
+//_______________________________________________
+// namespace
+
+namespace filter{
+ namespace config{
+
+namespace css = ::com::sun::star;
+
+//_______________________________________________
+// definitions
+
+/*-----------------------------------------------
+ 04.11.2003 09:27
+-----------------------------------------------*/
+CacheItem::CacheItem()
+ : SequenceAsHashMap()
+{
+}
+
+/*-----------------------------------------------
+ 26.06.2003 11:37
+-----------------------------------------------*/
+void CacheItem::update(const CacheItem& rUpdateItem)
+{
+ for(const_iterator pItUpdate = rUpdateItem.begin();
+ pItUpdate != rUpdateItem.end() ;
+ ++pItUpdate )
+ {
+ iterator pItThis = this->find(pItUpdate->first);
+ if (pItThis == this->end())
+ (*this)[pItUpdate->first] = pItUpdate->second; // add new prop
+ else
+ pItThis->second = pItUpdate->second; // change value of existing prop
+ }
+}
+
+/*-----------------------------------------------
+ 26.11.2003 13:27
+-----------------------------------------------*/
+void CacheItem::validateUINames(const ::rtl::OUString& sActLocale)
+{
+ if (!sActLocale.getLength())
+ return;
+
+ // 1) check UINames first
+ const_iterator pUINames = find(PROPNAME_UINAMES);
+ const_iterator pUIName = find(PROPNAME_UINAME );
+
+ ::comphelper::SequenceAsHashMap lUINames;
+ if (pUINames != end())
+ lUINames << pUINames->second;
+
+ ::rtl::OUString sUIName;
+ if (pUIName != end())
+ pUIName->second >>= sUIName;
+
+ if (sUIName.getLength())
+ {
+ // 1a) set UIName inside list of UINames for current locale
+ lUINames[sActLocale] <<= sUIName;
+ }
+ else if (lUINames.size()>0)
+ {
+ // 1b) or get it from this list, if it not exist!
+ lUINames[sActLocale] >>= sUIName;
+ }
+
+ (*this)[PROPNAME_UINAMES] <<= lUINames.getAsConstPropertyValueList();
+ (*this)[PROPNAME_UINAME ] <<= sUIName;
+}
+
+/*-----------------------------------------------
+ 12.01.2004 13:32
+-----------------------------------------------*/
+css::uno::Sequence< css::beans::PropertyValue > CacheItem::getAsPackedPropertyValueList()
+{
+ sal_Int32 c = (sal_Int32)size();
+ sal_Int32 i = 0;
+
+ css::uno::Sequence< css::beans::PropertyValue > lList(c);
+ css::beans::PropertyValue* pList = lList.getArray();
+
+ for (const_iterator pProp = begin();
+ pProp != end() ;
+ ++pProp )
+ {
+ const ::rtl::OUString& rName = pProp->first;
+ const css::uno::Any& rValue = pProp->second;
+
+ if (!rValue.hasValue())
+ continue;
+
+ pList[i].Name = rName ;
+ pList[i].Value = rValue;
+ ++i;
+ }
+ lList.realloc(i);
+
+ return lList;
+}
+
+/*-----------------------------------------------
+ 17.07.2003 08:27
+-----------------------------------------------*/
+sal_Bool isSubSet(const css::uno::Any& aSubSet,
+ const css::uno::Any& aSet )
+{
+ css::uno::Type aT1 = aSubSet.getValueType();
+ css::uno::Type aT2 = aSet.getValueType();
+
+ if (!aT1.equals(aT2))
+ {
+ _FILTER_CONFIG_LOG_("isSubSet() ... types of any values are different => return FALSE\n")
+ return sal_False;
+ }
+
+ css::uno::TypeClass aTypeClass = aT1.getTypeClass();
+ switch(aTypeClass)
+ {
+ //---------------------------------------
+ case css::uno::TypeClass_BOOLEAN :
+ case css::uno::TypeClass_BYTE :
+ case css::uno::TypeClass_SHORT :
+ case css::uno::TypeClass_UNSIGNED_SHORT :
+ case css::uno::TypeClass_LONG :
+ case css::uno::TypeClass_UNSIGNED_LONG :
+ case css::uno::TypeClass_HYPER :
+ case css::uno::TypeClass_UNSIGNED_HYPER :
+ case css::uno::TypeClass_FLOAT :
+ case css::uno::TypeClass_DOUBLE :
+ {
+ sal_Bool bIs = (aSubSet == aSet);
+ _FILTER_CONFIG_LOG_1_("isSubSet() ... check for atomic types => return %s\n", bIs ? "TRUE" : "FALSE")
+ return bIs;
+ }
+
+ //---------------------------------------
+ case css::uno::TypeClass_STRING :
+ {
+ ::rtl::OUString v1;
+ ::rtl::OUString v2;
+
+ if (
+ (aSubSet >>= v1) &&
+ (aSet >>= v2)
+ )
+ {
+ sal_Bool bIs = (v1.equals(v2));
+ _FILTER_CONFIG_LOG_1_("isSubSet() ... check for string types => return %s\n", bIs ? "TRUE" : "FALSE")
+ return bIs;
+ }
+ }
+ break;
+
+ //---------------------------------------
+ case css::uno::TypeClass_ANY :
+ {
+ css::uno::Any v1;
+ css::uno::Any v2;
+
+ if (
+ (aSubSet >>= v1) &&
+ (aSet >>= v2)
+ )
+ {
+ sal_Bool bIs = (isSubSet(v1, v2));
+ _FILTER_CONFIG_LOG_1_("isSubSet() ... check for packed any types => return %s\n", bIs ? "TRUE" : "FALSE")
+ return bIs;
+ }
+ }
+ break;
+
+ //---------------------------------------
+ case css::uno::TypeClass_STRUCT :
+ {
+ css::beans::PropertyValue p1;
+ css::beans::PropertyValue p2;
+
+ if (
+ (aSubSet >>= p1) &&
+ (aSet >>= p2)
+ )
+ {
+ sal_Bool bIs = (
+ (p1.Name.equals(p2.Name) ) &&
+ (isSubSet(p1.Value, p2.Value))
+ );
+ _FILTER_CONFIG_LOG_1_("isSubSet() ... check for structured types [PropertyValue] => return %s\n", bIs ? "TRUE" : "FALSE")
+ return bIs;
+ }
+
+ css::beans::NamedValue n1;
+ css::beans::NamedValue n2;
+
+ if (
+ (aSubSet >>= n1) &&
+ (aSet >>= n2)
+ )
+ {
+ sal_Bool bIs = (
+ (n1.Name.equals(n2.Name) ) &&
+ (isSubSet(n1.Value, n2.Value))
+ );
+ _FILTER_CONFIG_LOG_1_("isSubSet() ... check for structured types [NamedValue] => return %s\n", bIs ? "TRUE" : "FALSE")
+ return bIs;
+ }
+ }
+ break;
+
+ //---------------------------------------
+ case css::uno::TypeClass_SEQUENCE :
+ {
+ css::uno::Sequence< ::rtl::OUString > uno_s1;
+ css::uno::Sequence< ::rtl::OUString > uno_s2;
+
+ if (
+ (aSubSet >>= uno_s1) &&
+ (aSet >>= uno_s2)
+ )
+ {
+ OUStringList stl_s1(uno_s1);
+ OUStringList stl_s2(uno_s2);
+
+ for (OUStringList::const_iterator it1 = stl_s1.begin();
+ it1 != stl_s1.end() ;
+ ++it1 )
+ {
+ if (::std::find(stl_s2.begin(), stl_s2.end(), *it1) == stl_s2.end())
+ {
+ _FILTER_CONFIG_LOG_1_("isSubSet() ... check for list types [OUString] ... dont found \"%s\" => return FALSE\n", _FILTER_CONFIG_TO_ASCII_(*it1))
+ return sal_False;
+ }
+ _FILTER_CONFIG_LOG_1_("isSubSet() ... check for list types [OUString] ... found \"%s\" => continue loop\n", _FILTER_CONFIG_TO_ASCII_(*it1))
+ }
+ _FILTER_CONFIG_LOG_("isSubSet() ... check for list types [OUString] => return TRUE\n")
+ return sal_True;
+ }
+
+ css::uno::Sequence< css::beans::PropertyValue > uno_p1;
+ css::uno::Sequence< css::beans::PropertyValue > uno_p2;
+
+ if (
+ (aSubSet >>= uno_p1) &&
+ (aSet >>= uno_p2)
+ )
+ {
+ ::comphelper::SequenceAsHashMap stl_p1(uno_p1);
+ ::comphelper::SequenceAsHashMap stl_p2(uno_p2);
+
+ for (::comphelper::SequenceAsHashMap::const_iterator it1 = stl_p1.begin();
+ it1 != stl_p1.end() ;
+ ++it1 )
+ {
+ ::comphelper::SequenceAsHashMap::const_iterator it2 = stl_p2.find(it1->first);
+ if (it2 == stl_p2.end())
+ {
+ _FILTER_CONFIG_LOG_1_("isSubSet() ... check for list types [PropertyValue] ... dont found \"%s\" => return FALSE\n", _FILTER_CONFIG_TO_ASCII_(it1->first))
+ return sal_False;
+ }
+ if (!isSubSet(it1->second, it2->second))
+ {
+ _FILTER_CONFIG_LOG_1_("isSubSet() ... check for list types [PropertyValue] ... found \"%s\" but has different value => return FALSE\n", _FILTER_CONFIG_TO_ASCII_(it1->first))
+ return sal_False;
+ }
+ _FILTER_CONFIG_LOG_1_("isSubSet() ... check for list types [PropertyValue] ... found \"%s\" with right value => continue loop\n", _FILTER_CONFIG_TO_ASCII_(it1->first))
+ }
+ _FILTER_CONFIG_LOG_("isSubSet() ... check for list types [PropertyValue] => return TRUE\n")
+ return sal_True;
+ }
+
+ css::uno::Sequence< css::beans::NamedValue > uno_n1;
+ css::uno::Sequence< css::beans::NamedValue > uno_n2;
+
+ if (
+ (aSubSet >>= uno_n1) &&
+ (aSet >>= uno_n2)
+ )
+ {
+ ::comphelper::SequenceAsHashMap stl_n1(uno_n1);
+ ::comphelper::SequenceAsHashMap stl_n2(uno_n2);
+
+ for (::comphelper::SequenceAsHashMap::const_iterator it1 = stl_n1.begin();
+ it1 != stl_n1.end() ;
+ ++it1 )
+ {
+ ::comphelper::SequenceAsHashMap::const_iterator it2 = stl_n2.find(it1->first);
+ if (it2 == stl_n2.end())
+ {
+ _FILTER_CONFIG_LOG_1_("isSubSet() ... check for list types [NamedValue] ... dont found \"%s\" => return FALSE\n", _FILTER_CONFIG_TO_ASCII_(it1->first))
+ return sal_False;
+ }
+ if (!isSubSet(it1->second, it2->second))
+ {
+ _FILTER_CONFIG_LOG_1_("isSubSet() ... check for list types [NamedValue] ... found \"%s\" but has different value => return FALSE\n", _FILTER_CONFIG_TO_ASCII_(it1->first))
+ return sal_False;
+ }
+ _FILTER_CONFIG_LOG_1_("isSubSet() ... check for list types [NamedValue] ... found \"%s\" with right value => continue loop\n", _FILTER_CONFIG_TO_ASCII_(it1->first))
+ }
+ _FILTER_CONFIG_LOG_("isSubSet() ... check for list types [NamedValue] => return TRUE\n")
+ return sal_True;
+ }
+ }
+ break;
+/*
+ case css::uno::TypeClass_CHAR :
+ case css::uno::TypeClass_VOID :
+ case css::uno::TypeClass_TYPE :
+ case css::uno::TypeClass_ENUM :
+ case css::uno::TypeClass_TYPEDEF :
+ case css::uno::TypeClass_UNION :
+ case css::uno::TypeClass_EXCEPTION :
+ case css::uno::TypeClass_ARRAY :
+ case css::uno::TypeClass_INTERFACE :
+ case css::uno::TypeClass_SERVICE :
+ case css::uno::TypeClass_MODULE :
+ case css::uno::TypeClass_INTERFACE_METHOD :
+ case css::uno::TypeClass_INTERFACE_ATTRIBUTE :
+ case css::uno::TypeClass_UNKNOWN :
+ case css::uno::TypeClass_PROPERTY :
+ case css::uno::TypeClass_CONSTANT :
+ case css::uno::TypeClass_CONSTANTS :
+ case css::uno::TypeClass_SINGLETON :
+*/
+ default: break;
+ }
+
+ OSL_ENSURE(sal_False, "isSubSet() ... this point should not be reached!");
+ return sal_False;
+}
+
+/*-----------------------------------------------
+ 14.07.2003 10:24
+-----------------------------------------------*/
+sal_Bool CacheItem::haveProps(const CacheItem& lProps) const
+{
+ for (const_iterator pIt = lProps.begin();
+ pIt != lProps.end() ;
+ ++pIt )
+ {
+ // i) one required property does not exist at this item => return false
+ const_iterator pItThis = this->find(pIt->first);
+ if (pItThis == this->end())
+ {
+ _FILTER_CONFIG_LOG_1_("CacheItem::haveProps() ... dont found \"%s\" => return FALSE\n", _FILTER_CONFIG_TO_ASCII_(pIt->first))
+ return sal_False;
+ }
+
+ // ii) one item does not have the right value => return false
+ if (!isSubSet(pIt->second, pItThis->second))
+ {
+ _FILTER_CONFIG_LOG_1_("CacheItem::haveProps() ... item \"%s\" has different value => return FALSE\n", _FILTER_CONFIG_TO_ASCII_(pIt->first))
+ return sal_False;
+ }
+ }
+
+ // this method was not breaked before =>
+ // the given property set seems to match with our
+ // own properties in its minimum => return TRUE
+ _FILTER_CONFIG_LOG_("CacheItem::haveProps() ... => return TRUE\n")
+ return sal_True;
+}
+
+/*-----------------------------------------------
+ 14.07.2003 10:43
+-----------------------------------------------*/
+sal_Bool CacheItem::dontHaveProps(const CacheItem& lProps) const
+{
+ for (const_iterator pIt = lProps.begin();
+ pIt != lProps.end() ;
+ ++pIt )
+ {
+ // i) one item does not exists in general
+ // => continue with next one, because
+ // "excluding" means ... "dont have it".
+ // And "not exists" match to "dont have it".
+ const_iterator pItThis = this->find(pIt->first);
+ if (pItThis == this->end())
+ {
+ _FILTER_CONFIG_LOG_1_("CacheItem::dontHaveProps() ... not found \"%s\" => continue loop!\n", _FILTER_CONFIG_TO_ASCII_(pIt->first))
+ continue;
+ }
+
+ // ii) one item have the right value => return false
+ // because this item has the requested property ...
+ // But we checked for "dont have it" here.
+ if (isSubSet(pIt->second, pItThis->second))
+ {
+ _FILTER_CONFIG_LOG_1_("CacheItem::dontHaveProps() ... item \"%s\" has same value => return FALSE!\n", _FILTER_CONFIG_TO_ASCII_(pIt->first))
+ return sal_False;
+ }
+ }
+
+ // this method was not breaked before =>
+ // That means: this item has no matching property
+ // of the given set. It "dont have" it ... => return true.
+ _FILTER_CONFIG_LOG_("CacheItem::dontHaveProps() ... => return TRUE\n")
+ return sal_True;
+}
+
+ } // namespace config
+} // namespace filter
diff --git a/filter/source/config/cache/cacheitem.hxx b/filter/source/config/cache/cacheitem.hxx
new file mode 100644
index 000000000000..793a5f370cf9
--- /dev/null
+++ b/filter/source/config/cache/cacheitem.hxx
@@ -0,0 +1,261 @@
+/*************************************************************************
+ *
+ * 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 __FILTER_CONFIG_CACHEITEM_HXX_
+#define __FILTER_CONFIG_CACHEITEM_HXX_
+
+//_______________________________________________
+// includes
+
+#include <hash_map>
+#include <deque>
+#include <list>
+#include <com/sun/star/uno/Any.h>
+#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
+#include <comphelper/sequenceasvector.hxx>
+#include <comphelper/sequenceashashmap.hxx>
+#include <osl/mutex.hxx>
+
+//_______________________________________________
+// namespace
+
+namespace filter{
+ namespace config{
+
+namespace css = ::com::sun::star;
+
+//_______________________________________________
+// definitions
+
+/** @short Must be used as first derived base class
+ to get a full initialized mutex member,
+ which can be used during the ctor runs too!
+ */
+struct BaseLock
+{
+ public:
+
+ // must be mutable to be useable in const environments too!
+ mutable ::osl::Mutex m_aLock;
+};
+
+
+typedef ::comphelper::SequenceAsVector< ::rtl::OUString > OUStringList;
+
+//_______________________________________________
+
+/** @short represent an item of a FilterCache
+ instance.
+
+ @descr This class is not threadsafe tp perform
+ operations, which use many instances of
+ this class! Synchronizations must be done outside.
+ */
+class CacheItem : public ::comphelper::SequenceAsHashMap
+{
+ //-------------------------------------------
+ public:
+
+ //---------------------------------------
+ /** @short creates an empty item.
+ */
+ CacheItem();
+
+ //---------------------------------------
+
+ /** @short update only properties, which are given by the
+ specified rItem.
+
+ @descr Update means: - add new properties
+ - change existing values
+
+ @param rUpdateItem
+ another cache item, which contains some special
+ properties, which should by used for updating
+ this one.
+ */
+ void update(const CacheItem& rUpdateItem);
+
+ //---------------------------------------
+
+ /** @short check, if the given properties exists
+ at this item.
+
+ @descr All properties are compared in its minimum.
+ E.g: string lists => only the requested items
+ are checked. Additional existing items are ignored.
+
+ @param lProps
+ contains all properties, which must exist at this item.
+
+ @return TRUE if all given properties exists
+ at this item; FALSE otherwhise.
+ */
+ sal_Bool haveProps(const CacheItem& lProps) const;
+
+ //---------------------------------------
+
+ /** @short check, if the given properties dont exists
+ at this item.
+
+ @descr All properties are compared in its minimum.
+ E.g: string lists => only the requested items
+ are checked. Additional existing items are ignored.
+
+ @param lProps
+ contains all properties, which should not exists at this item.
+
+ @return FALSE if at least on property exists at this item(!);
+ TRUE otherwhise.
+ */
+ sal_Bool dontHaveProps(const CacheItem& lProps) const;
+
+ //---------------------------------------
+
+ /** @short check, if the given properties dont exists
+ at this item.
+
+ @descr All properties are compared in its minimum.
+ E.g: string lists => only the specified items
+ are checked. Additional existing items are ignored.
+
+ @param lProps
+ contains all properties, which should be checked.
+
+ @return TRUE if all given properties dont exists
+ at this item; FALSE otherwhise.
+ */
+ sal_Bool excludeProps(const CacheItem& lProps) const;
+
+ //---------------------------------------
+
+ /** @short because we know two UIName properties
+ (a list with all locales and the value
+ for the current locale only), we must be shure
+ that the correspond together.
+
+ @param sActLocale
+ must specify the current office locale.
+ Its needed to adress the UIName property inside
+ the list of possible ones.
+ */
+ void validateUINames(const ::rtl::OUString& sActLocale);
+
+ //---------------------------------------
+
+ /** @short convert this structure to a seq< PropertyValue >
+ and ignore all empty properties!
+
+ @descr Normaly the converter routines of the base class
+ SequenceAsHashMap do this job already.
+ But it doesnt provide a "pack" mechanism to
+ ignore properties with empty (means "void") values.
+
+ @return css::uno::Sequence< css::beans::PropertyValue >
+ as a list of all properties of this cacheitem,
+ where empty properties was removed.
+ */
+ css::uno::Sequence< css::beans::PropertyValue > getAsPackedPropertyValueList();
+};
+
+//_______________________________________________
+
+/** @short represent an item list of a FilterCache
+ instance.
+ */
+typedef ::std::hash_map< ::rtl::OUString ,
+ CacheItem ,
+ ::rtl::OUStringHash ,
+ ::std::equal_to< ::rtl::OUString > > CacheItemList;
+
+//_______________________________________________
+
+/** @short supports registration of multiple key to
+ another string information.
+
+ @descr E.g. a list of internal type names can be registered
+ to an extension. Organization as an hash makes it
+ faster then searching inside vectors.
+
+ On the other side e.g. URLPattern cant be realy adressed
+ by a hash value ... because the use wildcards. But
+ there we need key-value pairs too, which cant be provided
+ by a pur vector!
+ */
+typedef ::std::hash_map< ::rtl::OUString ,
+ OUStringList ,
+ ::rtl::OUStringHash ,
+ ::std::equal_to< ::rtl::OUString > > CacheItemRegistration;
+
+//_______________________________________________
+
+/** @short is used to collect all matching types of an URL
+ during type detection.
+
+ @descr Every type in this list is combined with an information,
+ which property matched to the given URL. The user of this
+ structure can decide then, if a deep detection should be
+ supressed e.g. if an URLPattern was used.
+ */
+struct FlatDetectionInfo
+{
+ // the internal type name
+ ::rtl::OUString sType;
+
+ // this type was found by a matching the URL extension
+ sal_Bool bMatchByExtension;
+
+ // this type was found by a matching URL Pattern
+ sal_Bool bMatchByPattern;
+
+ // the user selected this type explicitly
+ sal_Bool bPreselectedAsType;
+
+ // the user selected this type implicit by selecting a corresponding filter
+ sal_Bool bPreselectedByFilter;
+
+ // the user selected this type implicit by selecting a corresponding office module
+ sal_Bool bPreselectedByDocumentService;
+
+ FlatDetectionInfo()
+ : sType (::rtl::OUString())
+ , bMatchByExtension (sal_False )
+ , bMatchByPattern (sal_False )
+ , bPreselectedAsType (sal_False )
+ , bPreselectedByFilter (sal_False )
+ , bPreselectedByDocumentService(sal_False )
+ {}
+};
+
+typedef ::std::list< FlatDetectionInfo > FlatDetection;
+
+ } // namespace config
+} // namespace filter
+
+#endif // __FILTER_CONFIG_CACHEITEM_HXX_
diff --git a/filter/source/config/cache/cacheupdatelistener.cxx b/filter/source/config/cache/cacheupdatelistener.cxx
new file mode 100644
index 000000000000..90bd89c9d864
--- /dev/null
+++ b/filter/source/config/cache/cacheupdatelistener.cxx
@@ -0,0 +1,246 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include "cacheupdatelistener.hxx"
+#include "constant.hxx"
+
+//_______________________________________________
+// includes
+#include <com/sun/star/util/XChangesNotifier.hpp>
+#include <com/sun/star/util/XRefreshable.hpp>
+#include <salhelper/singletonref.hxx>
+#include <unotools/configpathes.hxx>
+#include <rtl/ustring.hxx>
+
+//_______________________________________________
+// namespace
+
+namespace filter{
+ namespace config{
+
+namespace css = ::com::sun::star;
+
+//_______________________________________________
+// definitions
+
+/*-----------------------------------------------
+ 05.03.2004 08:36
+-----------------------------------------------*/
+CacheUpdateListener::CacheUpdateListener(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR ,
+ const css::uno::Reference< css::uno::XInterface >& xConfigAccess,
+ FilterCache::EItemType eConfigType )
+ : BaseLock ( )
+ , m_xSMGR (xSMGR )
+ , m_rCache ( )
+ , m_xConfig (xConfigAccess)
+ , m_eConfigType(eConfigType )
+{
+}
+
+/*-----------------------------------------------
+ 05.03.2004 08:37
+-----------------------------------------------*/
+CacheUpdateListener::~CacheUpdateListener()
+{
+}
+
+/*-----------------------------------------------
+ 07.03.2004 07:59
+-----------------------------------------------*/
+void CacheUpdateListener::startListening()
+{
+ // SAFE ->
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+ css::uno::Reference< css::util::XChangesNotifier > xNotifier(m_xConfig, css::uno::UNO_QUERY);
+ aLock.clear();
+ // <- SAFE
+
+ if (!xNotifier.is())
+ return;
+
+ css::uno::Reference< css::util::XChangesListener > xThis(static_cast< css::util::XChangesListener* >(this), css::uno::UNO_QUERY_THROW);
+ xNotifier->addChangesListener(xThis);
+
+/*
+ css::uno::Reference< css::container::XContainer > xNotifier(xConfigAccess, css::uno::UNO_QUERY);
+ if (!xNotifier.is())
+ return;
+
+ css::uno::Reference< css::container::XContainerListener > xThis(static_cast< css::container::XContainerListener* >(this), css::uno::UNO_QUERY);
+ xNotifier->addContainerListener(xThis);
+*/
+}
+
+/*-----------------------------------------------
+ 07.03.2004 07:59
+-----------------------------------------------*/
+void CacheUpdateListener::stopListening()
+{
+ // SAFE ->
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+ css::uno::Reference< css::util::XChangesNotifier > xNotifier(m_xConfig, css::uno::UNO_QUERY);
+ aLock.clear();
+ // <- SAFE
+
+ if (!xNotifier.is())
+ return;
+
+ css::uno::Reference< css::util::XChangesListener > xThis(static_cast< css::util::XChangesListener* >(this), css::uno::UNO_QUERY);
+ xNotifier->removeChangesListener(xThis);
+
+/*
+ css::uno::Reference< css::container::XContainer > xNotifier(xConfigAccess, css::uno::UNO_QUERY);
+ if (!xNotifier.is())
+ return;
+
+ css::uno::Reference< css::container::XContainerListener > xThis(static_cast< css::container::XContainerListener* >(this), css::uno::UNO_QUERY);
+ xNotifier->removeContainerListener(xThis);
+*/
+}
+
+/*-----------------------------------------------
+ 07.03.2004 08:17
+-----------------------------------------------*/
+void SAL_CALL CacheUpdateListener::changesOccurred(const css::util::ChangesEvent& aEvent)
+ throw(css::uno::RuntimeException)
+{
+ // SAFE ->
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+
+ // disposed ?
+ if ( ! m_xConfig.is())
+ return;
+
+ css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR;
+ FilterCache::EItemType eType = m_eConfigType;
+
+ aLock.clear();
+ // <- SAFE
+
+ OUStringList lChangedItems;
+ sal_Int32 c = aEvent.Changes.getLength();
+ sal_Int32 i = 0;
+
+ for (i=0; i<c; ++i)
+ {
+ const css::util::ElementChange& aChange = aEvent.Changes[i];
+
+ ::rtl::OUString sOrgPath ;
+ ::rtl::OUString sTempPath;
+
+ ::rtl::OUString sProperty;
+ ::rtl::OUString sNode ;
+ ::rtl::OUString sLocale ;
+
+ /* at least we must be able to retrieve 2 path elements
+ But sometimes the original path can contain 3 of them ... in case
+ a localized value was changed.
+ =>
+ 1) Filters/Filter["filtername"]/Property
+ 2) Filters/Filter["filtername"]/LocalizedProperty/Locale
+ */
+
+ aChange.Accessor >>= sOrgPath;
+ if ( ! ::utl::splitLastFromConfigurationPath(sOrgPath, sTempPath, sLocale))
+ continue;
+ sOrgPath = sTempPath;
+ if ( ! ::utl::splitLastFromConfigurationPath(sOrgPath, sTempPath, sProperty))
+ {
+ sNode = sLocale;
+ sProperty = ::rtl::OUString();
+ sLocale = ::rtl::OUString();
+ }
+ else
+ {
+ sOrgPath = sTempPath;
+ if ( ! ::utl::splitLastFromConfigurationPath(sOrgPath, sTempPath, sNode))
+ {
+ sNode = sProperty;
+ sProperty = sLocale;
+ sLocale = ::rtl::OUString();
+ }
+ }
+
+ if ( ! sNode.getLength() )
+ continue;
+
+ OUStringList::const_iterator pIt = ::std::find(lChangedItems.begin(), lChangedItems.end(), sNode);
+ if (pIt == lChangedItems.end())
+ lChangedItems.push_back(sNode);
+ }
+
+ sal_Bool bNotifyRefresh = sal_False;
+ OUStringList::const_iterator pIt;
+ for ( pIt = lChangedItems.begin();
+ pIt != lChangedItems.end() ;
+ ++pIt )
+ {
+ const ::rtl::OUString& sItem = *pIt;
+ try
+ {
+ m_rCache->refreshItem(eType, sItem);
+ }
+ catch(const css::container::NoSuchElementException&)
+ {
+ // can be ignored! Because we must be aware that
+ // sItem was removed from the condfiguration and we forced an update of the cache.
+ // But we know, that the cache is up-to-date know and has thrown this exception afterwards .-)
+ }
+ // NO FLUSH! Otherwhise we start a never ending story here .-)
+ bNotifyRefresh = sal_True;
+ }
+
+ // notify sfx cache about the changed filter cache .-)
+ if (bNotifyRefresh)
+ {
+ css::uno::Reference< css::util::XRefreshable > xRefreshBroadcaster(
+ xSMGR->createInstance(SERVICE_FILTERCONFIGREFRESH),
+ css::uno::UNO_QUERY);
+ if (xRefreshBroadcaster.is())
+ xRefreshBroadcaster->refresh();
+ }
+}
+
+/*-----------------------------------------------
+ 05.03.2004 08:44
+-----------------------------------------------*/
+void SAL_CALL CacheUpdateListener::disposing(const css::lang::EventObject& aEvent)
+ throw(css::uno::RuntimeException)
+{
+ // SAFE ->
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+ if (aEvent.Source == m_xConfig)
+ m_xConfig.clear();
+ aLock.clear();
+ // <- SAFE
+}
+
+ } // namespace config
+} // namespace filter
diff --git a/filter/source/config/cache/cacheupdatelistener.hxx b/filter/source/config/cache/cacheupdatelistener.hxx
new file mode 100644
index 000000000000..8e75e4304bf2
--- /dev/null
+++ b/filter/source/config/cache/cacheupdatelistener.hxx
@@ -0,0 +1,147 @@
+/*************************************************************************
+ *
+ * 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 __FILTER_CONFIG_CACHEUPDATELISTENER_HXX_
+#define __FILTER_CONFIG_CACHEUPDATELISTENER_HXX_
+
+//_______________________________________________
+// includes
+
+#include "filtercache.hxx"
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XEventListener.hpp>
+#include <com/sun/star/util/XChangesListener.hpp>
+#include <salhelper/singletonref.hxx>
+#include <cppuhelper/implbase1.hxx>
+
+//_______________________________________________
+// namespace
+
+namespace filter{
+ namespace config{
+
+//_______________________________________________
+// definitions
+
+//_______________________________________________
+
+/** @short implements a listener, which will update the
+ global filter cache, if the underlying configuration
+ wa changed by other processes.
+ */
+class CacheUpdateListener : public BaseLock // must be the first one to guarantee right initialized mutex member!
+ , public ::cppu::WeakImplHelper1< css::util::XChangesListener >
+{
+ //-------------------------------------------
+ // member
+
+ private:
+
+ /** @short reference to an uno service manager, which can be used
+ to create own needed services. */
+ css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR;
+
+ /** @short reference to the singleton(!) filter cache implementation,
+ which should be updated by this thread. */
+ ::salhelper::SingletonRef< FilterCache > m_rCache;
+
+ /** @short holds the configuration access, where we listen alive. */
+ css::uno::Reference< css::uno::XInterface > m_xConfig;
+
+ /** @short every instance of this update listener listen on
+ a special sub set of the filter configuration.
+ So it should know, which type of configuration entry
+ it must put into the filter cache, if the configuration notifys changes ... */
+ FilterCache::EItemType m_eConfigType;
+
+ //-------------------------------------------
+ // native interface
+
+ public:
+
+ //---------------------------------------
+ // ctor/dtor
+
+ /** @short initialize new instance of this class.
+
+ @descr Listening wont be started here. It can be done
+ by calling startListening() on this instance.
+
+ @see startListening()
+
+ @param xSMGR
+ reference to a service manager, which can be used to create
+ own needed uno services.
+
+ @param xConfigAccess
+ the configuration access, where this instance should listen for changes.
+
+ @param eConfigType
+ specify the type of configuration.
+ */
+ CacheUpdateListener(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR ,
+ const css::uno::Reference< css::uno::XInterface >& xConfigAccess,
+ FilterCache::EItemType eConfigType );
+
+ //---------------------------------------
+
+ /** @short standard dtor.
+ */
+ virtual ~CacheUpdateListener();
+
+ //---------------------------------------
+
+ /** @short starts listening.
+ */
+ virtual void startListening();
+
+ //---------------------------------------
+
+ /** @short stop listening.
+ */
+ virtual void stopListening();
+
+ //-------------------------------------------
+ // uno interface
+
+ public:
+
+ //---------------------------------------
+ // XChangesListener
+
+ virtual void SAL_CALL changesOccurred(const css::util::ChangesEvent& aEvent)
+ throw(css::uno::RuntimeException);
+
+ //---------------------------------------
+ // lang.XEventListener
+ virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent)
+ throw(css::uno::RuntimeException);
+};
+
+ } // namespace config
+} // namespace filter
+
+#endif // __FILTER_CONFIG_CACHEUPDATELISTENER_HXX_
diff --git a/filter/source/config/cache/configflush.cxx b/filter/source/config/cache/configflush.cxx
new file mode 100644
index 000000000000..e97df2a7f40d
--- /dev/null
+++ b/filter/source/config/cache/configflush.cxx
@@ -0,0 +1,168 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include "configflush.hxx"
+#include "constant.hxx"
+
+//_______________________________________________
+// includes
+#include <osl/diagnose.h>
+
+//_______________________________________________
+// namespace
+
+namespace css = ::com::sun::star;
+
+namespace filter{
+ namespace config{
+
+//_______________________________________________
+// definitions
+
+//-----------------------------------------------
+ConfigFlush::ConfigFlush(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR)
+ : BaseLock ( )
+ , m_xSMGR (xSMGR )
+ , m_lListener(m_aLock)
+{
+}
+
+//-----------------------------------------------
+ConfigFlush::~ConfigFlush()
+{
+}
+
+//-----------------------------------------------
+::rtl::OUString SAL_CALL ConfigFlush::getImplementationName()
+ throw (css::uno::RuntimeException)
+{
+ return impl_getImplementationName();
+ // <- SAFE
+}
+
+//-----------------------------------------------
+sal_Bool SAL_CALL ConfigFlush::supportsService(const ::rtl::OUString& sServiceName)
+ throw (css::uno::RuntimeException)
+{
+ css::uno::Sequence< ::rtl::OUString > lServiceNames = impl_getSupportedServiceNames();
+ sal_Int32 c = lServiceNames.getLength();
+ const ::rtl::OUString* pNames = lServiceNames.getConstArray();
+ for (sal_Int32 i=0; i<c; ++i)
+ {
+ if (pNames[i].equals(sServiceName))
+ return sal_True;
+ }
+ return sal_False;
+}
+
+//-----------------------------------------------
+css::uno::Sequence< ::rtl::OUString > SAL_CALL ConfigFlush::getSupportedServiceNames()
+ throw (css::uno::RuntimeException)
+{
+ return impl_getSupportedServiceNames();
+}
+
+//-----------------------------------------------
+void SAL_CALL ConfigFlush::refresh()
+ throw(css::uno::RuntimeException)
+{
+ // notify listener outside the lock!
+ // The used listener helper lives if we live
+ // and is threadsafe by itself.
+ // Further its not a good idea to hold the own lock
+ // if an outside object is called :-)
+ css::lang::EventObject aSource (static_cast< css::util::XRefreshable* >(this));
+ ::cppu::OInterfaceContainerHelper* pContainer = m_lListener.getContainer(::getCppuType(static_cast< css::uno::Reference< css::util::XRefreshListener >* >(NULL)));
+ if (pContainer)
+ {
+ ::cppu::OInterfaceIteratorHelper pIterator(*pContainer);
+ while (pIterator.hasMoreElements())
+ {
+ try
+ {
+ // ... this pointer can be interesting to find out, where will be called as listener
+ // Dont optimize it to a direct iterator cast :-)
+ css::util::XRefreshListener* pListener = (css::util::XRefreshListener*)pIterator.next();
+ pListener->refreshed(aSource);
+ }
+ catch(const css::uno::Exception&)
+ {
+ // ignore any "damaged" flush listener!
+ // May its remote reference is broken ...
+ pIterator.remove();
+ }
+ }
+ }
+}
+
+//-----------------------------------------------
+void SAL_CALL ConfigFlush::addRefreshListener(const css::uno::Reference< css::util::XRefreshListener >& xListener)
+ throw(css::uno::RuntimeException)
+{
+ // no locks neccessary
+ // used helper lives if we live and is threadsafe by itself ...
+ m_lListener.addInterface(::getCppuType(static_cast< css::uno::Reference< css::util::XRefreshListener >* >(NULL)),
+ xListener);
+}
+
+//-----------------------------------------------
+void SAL_CALL ConfigFlush::removeRefreshListener(const css::uno::Reference< css::util::XRefreshListener >& xListener)
+ throw(css::uno::RuntimeException)
+{
+ // no locks neccessary
+ // used helper lives if we live and is threadsafe by itself ...
+ m_lListener.removeInterface(::getCppuType(static_cast< css::uno::Reference< css::util::XRefreshListener >* >(NULL)),
+ xListener);
+}
+
+//-----------------------------------------------
+::rtl::OUString ConfigFlush::impl_getImplementationName()
+{
+ static ::rtl::OUString IMPLNAME = ::rtl::OUString::createFromAscii("com.sun.star.comp.filter.config.ConfigFlush");
+ return IMPLNAME;
+}
+
+//-----------------------------------------------
+css::uno::Sequence< ::rtl::OUString > ConfigFlush::impl_getSupportedServiceNames()
+{
+ css::uno::Sequence< ::rtl::OUString > lServiceNames(1);
+ lServiceNames[0] = SERVICE_FILTERCONFIGREFRESH;
+ return lServiceNames;
+}
+
+//-----------------------------------------------
+css::uno::Reference< css::uno::XInterface > ConfigFlush::impl_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR)
+{
+ ConfigFlush* pNew = new ConfigFlush(xSMGR);
+ return css::uno::Reference< css::uno::XInterface >(static_cast< css::util::XRefreshable* >(pNew), css::uno::UNO_QUERY);
+}
+
+ } // namespace config
+} // namespace filter
diff --git a/filter/source/config/cache/configflush.hxx b/filter/source/config/cache/configflush.hxx
new file mode 100644
index 000000000000..477d7017ca35
--- /dev/null
+++ b/filter/source/config/cache/configflush.hxx
@@ -0,0 +1,128 @@
+/*************************************************************************
+ *
+ * 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 __FILTER_CONFIG_CONFIGFLUSH_HXX_
+#define __FILTER_CONFIG_CONFIGFLUSH_HXX_
+
+//_______________________________________________
+// includes
+
+#include "cacheitem.hxx"
+#include <com/sun/star/util/XRefreshable.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <cppuhelper/interfacecontainer.h>
+#include <cppuhelper/implbase1.hxx>
+
+//_______________________________________________
+// namespace
+
+namespace filter{
+ namespace config{
+
+//_______________________________________________
+// definitions
+
+//_______________________________________________
+
+/** @short supports registration of XRefreshListener
+ on the global filter configuration.
+
+ @descr Such refresh listener will be called in case the
+ type/filter configuration will be changed at runtime.
+ */
+class ConfigFlush : public BaseLock
+ , public ::cppu::WeakImplHelper1< css::util::XRefreshable >
+{
+ //-------------------------------------------
+ // member
+
+ protected:
+
+ /** @short reference to an uno service manager, which can be used
+ to create own needed services. */
+ css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR;
+
+ /** @short holds all listener, which are registered at this instance. */
+ ::cppu::OMultiTypeInterfaceContainerHelper m_lListener;
+
+ //-------------------------------------------
+ // native interface
+
+ public:
+
+ //---------------------------------------
+ // ctor/dtor
+
+ /** @short standard ctor.
+ */
+ ConfigFlush(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR);
+
+ //---------------------------------------
+
+ /** @short standard dtor.
+ */
+ virtual ~ConfigFlush();
+
+ //-------------------------------------------
+ // uno interface
+
+ public:
+
+ //---------------------------------------
+ // XServiceInfo
+
+ virtual ::rtl::OUString SAL_CALL getImplementationName()
+ throw (css::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL supportsService(const ::rtl::OUString& sServiceName)
+ throw (css::uno::RuntimeException);
+
+ virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
+ throw (css::uno::RuntimeException);
+
+ //---------------------------------------
+ // XRefreshable
+
+ virtual void SAL_CALL refresh()
+ throw(css::uno::RuntimeException);
+
+ virtual void SAL_CALL addRefreshListener(const css::uno::Reference< css::util::XRefreshListener >& xListener)
+ throw(css::uno::RuntimeException);
+
+ virtual void SAL_CALL removeRefreshListener(const css::uno::Reference< css::util::XRefreshListener >& xListener)
+ throw(css::uno::RuntimeException);
+
+ //---------------------------------------
+ // interface to register/create this instance as an UNO service
+ static ::rtl::OUString impl_getImplementationName();
+ static css::uno::Sequence< ::rtl::OUString > impl_getSupportedServiceNames();
+ static css::uno::Reference< css::uno::XInterface > impl_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR);
+};
+
+ } // namespace config
+} // namespace filter
+
+#endif // __FILTER_CONFIG_CONFIGFLUSH_HXX_
diff --git a/filter/source/config/cache/constant.hxx b/filter/source/config/cache/constant.hxx
new file mode 100644
index 000000000000..244a78864228
--- /dev/null
+++ b/filter/source/config/cache/constant.hxx
@@ -0,0 +1,217 @@
+/*************************************************************************
+ *
+ * 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 _FILTER_CONFIG_CONSTANT_HXX_
+#define _FILTER_CONFIG_CONSTANT_HXX_
+
+#include "macros.hxx"
+
+namespace filter { namespace config {
+extern rtl::OUString pFilterStrings[];
+} }
+#ifndef PROPNAME_IMPL_DECL
+# define PROPNAME_DECL(index, str) (pFilterStrings[(index)])
+#else
+# define PROPNAME_DECL(index, str) pFilterStrings[(index)] = _FILTER_CONFIG_FROM_ASCII_(str)
+#endif
+
+/* disable impl_loadOnDemand function of BaseContainer for certain
+ functions, where it the feature "impl_loadItemOnDemand() of class FilterCache
+ can be used instead of loadAll()!*/
+// #define LOAD_IMPLICIT
+
+//_______________________________________________
+
+/** @short used to identify a some generic item properties against the
+ configuration API and can be used at all name containers
+ (based on this filtercache) too.
+ */
+#define PROPNAME_NAME PROPNAME_DECL(0, "Name")
+
+/** @short used to identify a type item property against the
+ configuration API and can be used at all name containers
+ (based on this filtercache) too.
+ */
+#define PROPNAME_UINAME PROPNAME_DECL(1, "UIName" )
+#define PROPNAME_UINAMES PROPNAME_DECL(2, "UINames" )
+#define PROPNAME_PREFERRED PROPNAME_DECL(3, "Preferred" )
+#define PROPNAME_PREFERREDFILTER PROPNAME_DECL(4, "PreferredFilter" )
+#define PROPNAME_DETECTSERVICE PROPNAME_DECL(5, "DetectService" )
+#define PROPNAME_MEDIATYPE PROPNAME_DECL(6, "MediaType" )
+#define PROPNAME_CLIPBOARDFORMAT PROPNAME_DECL(7, "ClipboardFormat" )
+#define PROPNAME_URLPATTERN PROPNAME_DECL(8, "URLPattern" )
+#define PROPNAME_EXTENSIONS PROPNAME_DECL(9, "Extensions" )
+
+/** @short used to identify a filter item property against the
+ configuration API and can be used at all name containers
+ (based on this filtercache) too.
+ */
+#define PROPNAME_TYPE PROPNAME_DECL(10, "Type" )
+#define PROPNAME_DOCUMENTSERVICE PROPNAME_DECL(11, "DocumentService" )
+#define PROPNAME_FILTERSERVICE PROPNAME_DECL(12, "FilterService" )
+#define PROPNAME_UICOMPONENT PROPNAME_DECL(13, "UIComponent" )
+#define PROPNAME_FLAGS PROPNAME_DECL(14, "Flags" )
+#define PROPNAME_USERDATA PROPNAME_DECL(15, "UserData" )
+#define PROPNAME_TEMPLATENAME PROPNAME_DECL(16, "TemplateName" )
+#define PROPNAME_FILEFORMATVERSION PROPNAME_DECL(17, "FileFormatVersion")
+
+/** @short used to identify a frame loader or detect service item
+ property against the configuration API and can be used
+ at all name containers (based on this filtercache) too.
+ */
+#define PROPNAME_TYPES PROPNAME_DECL(18, "Types")
+
+/** @short used to identify the list of sorted filters for a specific
+ office module
+ */
+#define PROPNAME_SORTEDFILTERLIST _FILTER_CONFIG_FROM_ASCII_("SortedFilterList")
+
+/** @short implicit properties. which are used at the container interface only.
+ */
+#define PROPNAME_FINALIZED _FILTER_CONFIG_FROM_ASCII_("Finalized")
+#define PROPNAME_MANDATORY _FILTER_CONFIG_FROM_ASCII_("Mandatory")
+
+/** @short used to identify a set of items against the configuration API. */
+#define CFGSET_TYPES _FILTER_CONFIG_FROM_ASCII_("Types" )
+#define CFGSET_FILTERS _FILTER_CONFIG_FROM_ASCII_("Filters" )
+#define CFGSET_FRAMELOADERS _FILTER_CONFIG_FROM_ASCII_("FrameLoaders" )
+#define CFGSET_CONTENTHANDLERS _FILTER_CONFIG_FROM_ASCII_("ContentHandlers")
+
+/** @short used to adress some configuration keys directly.
+
+ @descr Such direct keys should be used with function
+ FilterCache::impl_getDirectCFGValue() only!
+
+ @TODO define these direct keys ...
+ */
+#define CFGDIRECTKEY_OFFICELOCALE _FILTER_CONFIG_FROM_ASCII_("/org.openoffice.Setup/L10N/ooLocale" )
+#define CFGDIRECTKEY_DEFAULTFRAMELOADER _FILTER_CONFIG_FROM_ASCII_("/org.openoffice.TypeDetection.Misc/Defaults/DefaultFrameLoader")
+#define CFGDIRECTKEY_OFFICELOCALE _FILTER_CONFIG_FROM_ASCII_("/org.openoffice.Setup/L10N/ooLocale" )
+#define CFGDIRECTKEY_FORMATNAME _FILTER_CONFIG_FROM_ASCII_("/org.openoffice.Setup/Product/ooXMLFileFormatName" )
+#define CFGDIRECTKEY_FORMATVERSION _FILTER_CONFIG_FROM_ASCII_("/org.openoffice.Setup/Product/ooXMLFileFormatVersion" )
+#define CFGDIRECTKEY_PRODUCTNAME _FILTER_CONFIG_FROM_ASCII_("/org.openoffice.Setup/Product/ooName" )
+
+/** @short names of filter flags, sorted in alphabetical order */
+#define FLAGNAME_3RDPARTYFILTER _FILTER_CONFIG_FROM_ASCII_("3RDPARTYFILTER" )
+#define FLAGNAME_ALIEN _FILTER_CONFIG_FROM_ASCII_("ALIEN" )
+#define FLAGNAME_ASYNCHRON _FILTER_CONFIG_FROM_ASCII_("ASYNCHRON" )
+#define FLAGNAME_BROWSERPREFERRED _FILTER_CONFIG_FROM_ASCII_("BROWSERPREFERRED" )
+#define FLAGNAME_CONSULTSERVICE _FILTER_CONFIG_FROM_ASCII_("CONSULTSERVICE" )
+#define FLAGNAME_DEFAULT _FILTER_CONFIG_FROM_ASCII_("DEFAULT" )
+#define FLAGNAME_ENCRYPTION _FILTER_CONFIG_FROM_ASCII_("ENCRYPTION" )
+#define FLAGNAME_EXPORT _FILTER_CONFIG_FROM_ASCII_("EXPORT" )
+#define FLAGNAME_IMPORT _FILTER_CONFIG_FROM_ASCII_("IMPORT" )
+#define FLAGNAME_INTERNAL _FILTER_CONFIG_FROM_ASCII_("INTERNAL" )
+#define FLAGNAME_NOTINCHOOSER _FILTER_CONFIG_FROM_ASCII_("NOTINCHOOSER" )
+#define FLAGNAME_NOTINFILEDIALOG _FILTER_CONFIG_FROM_ASCII_("NOTINFILEDIALOG" )
+#define FLAGNAME_NOTINSTALLED _FILTER_CONFIG_FROM_ASCII_("NOTINSTALLED" )
+#define FLAGNAME_OWN _FILTER_CONFIG_FROM_ASCII_("OWN" )
+#define FLAGNAME_PACKED _FILTER_CONFIG_FROM_ASCII_("PACKED" )
+#define FLAGNAME_PASSWORDTOMODIFY _FILTER_CONFIG_FROM_ASCII_("PASSWORDTOMODIFY" )
+#define FLAGNAME_PREFERRED _FILTER_CONFIG_FROM_ASCII_("PREFERRED" )
+#define FLAGNAME_READONLY _FILTER_CONFIG_FROM_ASCII_("READONLY" )
+#define FLAGNAME_SILENTEXPORT _FILTER_CONFIG_FROM_ASCII_("SILENTEXPORT" )
+#define FLAGNAME_SUPPORTSSELECTION _FILTER_CONFIG_FROM_ASCII_("SUPPORTSSELECTION")
+#define FLAGNAME_TEMPLATE _FILTER_CONFIG_FROM_ASCII_("TEMPLATE" )
+#define FLAGNAME_TEMPLATEPATH _FILTER_CONFIG_FROM_ASCII_("TEMPLATEPATH" )
+#define FLAGNAME_USESOPTIONS _FILTER_CONFIG_FROM_ASCII_("USESOPTIONS" )
+#define FLAGNAME_COMBINED _FILTER_CONFIG_FROM_ASCII_("COMBINED" )
+
+/** @short values of filter flags, sorted based on value */
+#define FLAGVAL_IMPORT 0x00000001 // 1
+#define FLAGVAL_EXPORT 0x00000002 // 2
+#define FLAGVAL_TEMPLATE 0x00000004 // 4
+#define FLAGVAL_INTERNAL 0x00000008 // 8
+#define FLAGVAL_TEMPLATEPATH 0x00000010 // 16
+#define FLAGVAL_OWN 0x00000020 // 32
+#define FLAGVAL_ALIEN 0x00000040 // 64
+#define FLAGVAL_USESOPTIONS 0x00000080 // 128
+#define FLAGVAL_DEFAULT 0x00000100 // 256
+#define FLAGVAL_SUPPORTSSELECTION 0x00000400 // 1024
+#define FLAGVAL_NOTINFILEDIALOG 0x00001000 // 4096
+#define FLAGVAL_NOTINCHOOSER 0x00002000 // 8192
+#define FLAGVAL_ASYNCHRON 0x00004000 // 16384
+#define FLAGVAL_READONLY 0x00010000 // 65536
+#define FLAGVAL_NOTINSTALLED 0x00020000 // 131072
+#define FLAGVAL_CONSULTSERVICE 0x00040000 // 262144
+#define FLAGVAL_3RDPARTYFILTER 0x00080000 // 524288
+#define FLAGVAL_PACKED 0x00100000 // 1048576
+#define FLAGVAL_SILENTEXPORT 0x00200000 // 2097152
+#define FLAGVAL_BROWSERPREFERRED 0x00400000 // 4194304
+#define FLAGVAL_COMBINED 0x00800000 // 8388608
+#define FLAGVAL_ENCRYPTION 0x01000000 // 16777216
+#define FLAGVAL_PASSWORDTOMODIFY 0x02000000 // 33554432
+#define FLAGVAL_PREFERRED 0x10000000 // 268435456
+#define FLAGVAL_ALL 0xffffffff // 4294967295
+
+/** @short uno service names of our document services
+ provided by our application modules.
+ */
+#define DOCUMENTSERVICE_WRITER _FILTER_CONFIG_FROM_ASCII_("com.sun.star.text.TextDocument" )
+#define DOCUMENTSERVICE_WRITER_WEB _FILTER_CONFIG_FROM_ASCII_("com.sun.star.text.WebDocument" )
+#define DOCUMENTSERVICE_WRITER_GLOBAL _FILTER_CONFIG_FROM_ASCII_("com.sun.star.text.GlobalDocument" )
+#define DOCUMENTSERVICE_CALC _FILTER_CONFIG_FROM_ASCII_("com.sun.star.sheet.SpreadsheetDocument" )
+#define DOCUMENTSERVICE_DRAW _FILTER_CONFIG_FROM_ASCII_("com.sun.star.drawing.DrawingDocument" )
+#define DOCUMENTSERVICE_IMPRESS _FILTER_CONFIG_FROM_ASCII_("com.sun.star.presentation.PresentationDocument")
+#define DOCUMENTSERVICE_CHART _FILTER_CONFIG_FROM_ASCII_("com.sun.star.chart2.ChartDocument" )
+#define DOCUMENTSERVICE_MATH _FILTER_CONFIG_FROM_ASCII_("com.sun.star.formula.FormulaProperties" )
+
+/** @short some uno service names.
+ */
+#define SERVICE_CONFIGURATIONPROVIDER _FILTER_CONFIG_FROM_ASCII_("com.sun.star.configuration.ConfigurationProvider" )
+#define SERVICE_CONFIGURATIONUPDATEACCESS _FILTER_CONFIG_FROM_ASCII_("com.sun.star.configuration.ConfigurationUpdateAccess" )
+#define SERVICE_CONFIGURATIONACCESS _FILTER_CONFIG_FROM_ASCII_("com.sun.star.configuration.ConfigurationAccess" )
+#define SERVICE_URLTRANSFORMER _FILTER_CONFIG_FROM_ASCII_("com.sun.star.util.URLTransformer" )
+#define SERVICE_FILTERCONFIGREFRESH _FILTER_CONFIG_FROM_ASCII_("com.sun.star.document.FilterConfigRefresh" )
+
+/** @short some configuration pathes.
+ */
+#define CFGPACKAGE_TD_TYPES _FILTER_CONFIG_FROM_ASCII_("/org.openoffice.TypeDetection.Types" )
+#define CFGPACKAGE_TD_FILTERS _FILTER_CONFIG_FROM_ASCII_("/org.openoffice.TypeDetection.Filter")
+#define CFGPACKAGE_TD_OTHERS _FILTER_CONFIG_FROM_ASCII_("/org.openoffice.TypeDetection.Misc" )
+#define CFGPACKAGE_TD_UISORT _FILTER_CONFIG_FROM_ASCII_("/org.openoffice.TypeDetection.UISort/ModuleDependendFilterOrder")
+#define CFGPACKAGE_TD_OLD _FILTER_CONFIG_FROM_ASCII_("/org.openoffice.Office.TypeDetection")
+#define CFGPACKAGE_OOO_MODULES _FILTER_CONFIG_FROM_ASCII_("/org.openoffice.Setup/Office/Factories")
+
+/** @short some default values.
+ */
+#define DEFAULT_OFFICELOCALE _FILTER_CONFIG_FROM_ASCII_("en-US")
+#define DEFAULT_FORMATNAME _FILTER_CONFIG_FROM_ASCII_("OpenOffice")
+#define DEFAULT_FORMATVERSION _FILTER_CONFIG_FROM_ASCII_("1.0")
+
+/** @short used for the queries of the FilterFactory service.
+ */
+#define QUERY_IDENTIFIER_MATCHBYDOCUMENTSERVICE _FILTER_CONFIG_FROM_ASCII_("matchByDocumentService" )
+#define QUERY_IDENTIFIER_GETPREFERREDFILTERFORTYPE _FILTER_CONFIG_FROM_ASCII_("getDefaultFilterForType")
+#define QUERY_IDENTIFIER_GET_SORTED_FILTERLIST _FILTER_CONFIG_FROM_ASCII_("getSortedFilterList()" )
+
+#define QUERY_PARAM_IFLAGS _FILTER_CONFIG_FROM_ASCII_("iflags")
+#define QUERY_PARAM_EFLAGS _FILTER_CONFIG_FROM_ASCII_("eflags")
+#define QUERY_PARAM_MODULE _FILTER_CONFIG_FROM_ASCII_("module")
+#define QUERY_PARAM_DEFAULTFIRST _FILTER_CONFIG_FROM_ASCII_("default_first")
+#define QUERY_CONSTVALUE_ALL _FILTER_CONFIG_FROM_ASCII_("all")
+
+#endif // _FILTER_CONFIG_CONSTANT_HXX_
diff --git a/filter/source/config/cache/contenthandlerfactory.cxx b/filter/source/config/cache/contenthandlerfactory.cxx
new file mode 100644
index 000000000000..3863658d9abb
--- /dev/null
+++ b/filter/source/config/cache/contenthandlerfactory.cxx
@@ -0,0 +1,201 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include "contenthandlerfactory.hxx"
+#include "querytokenizer.hxx"
+#include "macros.hxx"
+#include "constant.hxx"
+#include "versions.hxx"
+
+//_______________________________________________
+// includes
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <comphelper/enumhelper.hxx>
+
+//_______________________________________________
+// namespace
+
+namespace filter{
+ namespace config{
+
+namespace css = ::com::sun::star;
+
+//_______________________________________________
+// definitions
+
+/*-----------------------------------------------
+ 09.07.2003 07:43
+-----------------------------------------------*/
+ContentHandlerFactory::ContentHandlerFactory(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR)
+{
+ BaseContainer::init(xSMGR ,
+ ContentHandlerFactory::impl_getImplementationName() ,
+ ContentHandlerFactory::impl_getSupportedServiceNames(),
+ FilterCache::E_CONTENTHANDLER );
+}
+
+/*-----------------------------------------------
+ 09.07.2003 07:43
+-----------------------------------------------*/
+ContentHandlerFactory::~ContentHandlerFactory()
+{
+}
+
+/*-----------------------------------------------
+ 16.07.2003 13:38
+-----------------------------------------------*/
+css::uno::Reference< css::uno::XInterface > SAL_CALL ContentHandlerFactory::createInstance(const ::rtl::OUString& sHandler)
+ throw(css::uno::Exception ,
+ css::uno::RuntimeException)
+{
+ return createInstanceWithArguments(sHandler, css::uno::Sequence< css::uno::Any >());
+}
+
+/*-----------------------------------------------
+ 16.07.2003 13:40
+-----------------------------------------------*/
+css::uno::Reference< css::uno::XInterface > SAL_CALL ContentHandlerFactory::createInstanceWithArguments(const ::rtl::OUString& sHandler ,
+ const css::uno::Sequence< css::uno::Any >& lArguments)
+ throw(css::uno::Exception ,
+ css::uno::RuntimeException)
+{
+ css::uno::Reference< css::uno::XInterface > xHandler;
+
+ // SAFE ->
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+
+ ::rtl::OUString sRealHandler = sHandler;
+
+ #ifdef _FILTER_CONFIG_MIGRATION_Q_
+
+ /* -> TODO - HACK
+ check if the given handler name realy exist ...
+ Because our old implementation worked with an internal
+ type name instead of a handler name. For a small migration time
+ we must simulate this old feature :-( */
+
+ if (!m_rCache->hasItem(FilterCache::E_CONTENTHANDLER, sHandler) && m_rCache->hasItem(FilterCache::E_TYPE, sHandler))
+ {
+ _FILTER_CONFIG_LOG_("ContentHandlerFactory::createInstanceWithArguments() ... simulate old type search functionality!\n");
+
+ css::uno::Sequence< ::rtl::OUString > lTypes(1);
+ lTypes[0] = sHandler;
+
+ css::uno::Sequence< css::beans::NamedValue > lQuery(1);
+ lQuery[0].Name = PROPNAME_TYPES;
+ lQuery[0].Value <<= lTypes;
+
+ css::uno::Reference< css::container::XEnumeration > xSet = createSubSetEnumerationByProperties(lQuery);
+ while(xSet->hasMoreElements())
+ {
+ ::comphelper::SequenceAsHashMap lHandlerProps(xSet->nextElement());
+ if (!(lHandlerProps[PROPNAME_NAME] >>= sRealHandler))
+ continue;
+ }
+
+ // prevent outside code against NoSuchElementException!
+ // But dont implement such defensive strategy for our new create handling :-)
+ if (!m_rCache->hasItem(FilterCache::E_CONTENTHANDLER, sRealHandler))
+ return css::uno::Reference< css::uno::XInterface>();
+ }
+
+ /* <- HACK */
+
+ #endif // _FILTER_CONFIG_MIGRATION_Q_
+
+ // search handler on cache
+ CacheItem aHandler = m_rCache->getItem(FilterCache::E_CONTENTHANDLER, sRealHandler);
+
+ // create service instance
+ xHandler = m_xSMGR->createInstance(sRealHandler);
+
+ // initialize filter
+ css::uno::Reference< css::lang::XInitialization > xInit(xHandler, css::uno::UNO_QUERY);
+ if (xInit.is())
+ {
+ // format: lInitData[0] = seq<PropertyValue>, which contains all configuration properties of this handler
+ // lInitData[1] = lArguments[0]
+ // ...
+ // lInitData[n] = lArguments[n-1]
+ css::uno::Sequence< css::beans::PropertyValue > lConfig;
+ aHandler >> lConfig;
+
+ ::comphelper::SequenceAsVector< css::uno::Any > stlArguments(lArguments);
+ stlArguments.insert(stlArguments.begin(), css::uno::makeAny(lConfig));
+
+ css::uno::Sequence< css::uno::Any > lInitData;
+ stlArguments >> lInitData;
+
+ xInit->initialize(lInitData);
+ }
+
+ return xHandler;
+ // <- SAFE
+}
+
+/*-----------------------------------------------
+ 09.07.2003 07:46
+-----------------------------------------------*/
+css::uno::Sequence< ::rtl::OUString > SAL_CALL ContentHandlerFactory::getAvailableServiceNames()
+ throw(css::uno::RuntimeException)
+{
+ // must be the same list as ((XNameAccess*)this)->getElementNames() return!
+ return getElementNames();
+}
+
+/*-----------------------------------------------
+ 09.07.2003 07:43
+-----------------------------------------------*/
+::rtl::OUString ContentHandlerFactory::impl_getImplementationName()
+{
+ return ::rtl::OUString::createFromAscii("com.sun.star.comp.filter.config.ContentHandlerFactory");
+}
+
+/*-----------------------------------------------
+ 09.07.2003 07:43
+-----------------------------------------------*/
+css::uno::Sequence< ::rtl::OUString > ContentHandlerFactory::impl_getSupportedServiceNames()
+{
+ css::uno::Sequence< ::rtl::OUString > lServiceNames(1);
+ lServiceNames[0] = ::rtl::OUString::createFromAscii("com.sun.star.frame.ContentHandlerFactory");
+ return lServiceNames;
+}
+
+/*-----------------------------------------------
+ 09.07.2003 07:43
+-----------------------------------------------*/
+css::uno::Reference< css::uno::XInterface > SAL_CALL ContentHandlerFactory::impl_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR)
+{
+ ContentHandlerFactory* pNew = new ContentHandlerFactory(xSMGR);
+ return css::uno::Reference< css::uno::XInterface >(static_cast< css::lang::XMultiServiceFactory* >(pNew), css::uno::UNO_QUERY);
+}
+
+ } // namespace config
+} // namespace filter
diff --git a/filter/source/config/cache/contenthandlerfactory.hxx b/filter/source/config/cache/contenthandlerfactory.hxx
new file mode 100644
index 000000000000..a50f91c0b61e
--- /dev/null
+++ b/filter/source/config/cache/contenthandlerfactory.hxx
@@ -0,0 +1,148 @@
+/*************************************************************************
+ *
+ * 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 __FILTER_CONFIG_CONTENTHANDLERFACTORY_HXX_
+#define __FILTER_CONFIG_CONTENTHANDLERFACTORY_HXX_
+
+//_______________________________________________
+// includes
+
+#include "basecontainer.hxx"
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <cppuhelper/implbase1.hxx>
+
+//_______________________________________________
+// namespace
+
+namespace filter{
+ namespace config{
+
+namespace css = ::com::sun::star;
+
+//_______________________________________________
+// definitions
+
+//_______________________________________________
+
+/** @short implements the service <type scope="com.sun.star.document">ContentHandlerFactory</type>.
+ */
+class ContentHandlerFactory : public ::cppu::ImplInheritanceHelper1< BaseContainer ,
+ css::lang::XMultiServiceFactory >
+{
+ //-------------------------------------------
+ // native interface
+
+ public:
+
+ //---------------------------------------
+ // ctor/dtor
+
+ /** @short standard ctor to connect this interface wrapper to
+ the global filter cache instance ...
+
+ @param xSMGR
+ reference to the uno service manager, which created this service instance.
+ */
+ ContentHandlerFactory(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR);
+
+ //---------------------------------------
+
+ /** @short standard dtor.
+ */
+ virtual ~ContentHandlerFactory();
+
+ //-------------------------------------------
+ // uno interface
+
+ public:
+
+ //---------------------------------------
+ // XMultiServiceFactory
+
+ virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance(const ::rtl::OUString& sHandler)
+ throw(css::uno::Exception ,
+ css::uno::RuntimeException);
+
+ virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithArguments(const ::rtl::OUString& sHandler ,
+ const css::uno::Sequence< css::uno::Any >& lArguments)
+ throw(css::uno::Exception ,
+ css::uno::RuntimeException);
+
+ virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableServiceNames()
+ throw(css::uno::RuntimeException);
+
+ //-------------------------------------------
+ // static uno helper!
+
+ public:
+
+ //---------------------------------------
+
+ /** @short return the uno implementation name of this class.
+
+ @descr Because this information is used at several places
+ (and mostly an object instance of this class is not possible)
+ its implemented as a static function!
+
+ @return The fix uno implementation name of this class.
+ */
+ static ::rtl::OUString impl_getImplementationName();
+
+ //---------------------------------------
+
+ /** @short return the list of supported uno services of this class.
+
+ @descr Because this information is used at several places
+ (and mostly an object instance of this class is not possible)
+ its implemented as a static function!
+
+ @return The fix list of uno services supported by this class.
+ */
+ static css::uno::Sequence< ::rtl::OUString > impl_getSupportedServiceNames();
+
+ //---------------------------------------
+
+ /** @short return a new intsnace of this class.
+
+ @descr This method is used by the uno service manager, to create
+ a new instance of this service if needed.
+
+ @param xSMGR
+ reference to the uno service manager, which require
+ this new instance. It should be passed to the new object
+ so it can be used internaly to create own needed uno resources.
+
+ @return The new instance of this service as an uno reference.
+ */
+ static css::uno::Reference< css::uno::XInterface > impl_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR);
+};
+
+ } // namespace config
+} // namespace filter
+
+#endif // __FILTER_CONFIG_CONTENTHANDLERFACTORY_HXX_
diff --git a/filter/source/config/cache/filtercache.cxx b/filter/source/config/cache/filtercache.cxx
new file mode 100644
index 000000000000..d4435e2182f1
--- /dev/null
+++ b/filter/source/config/cache/filtercache.cxx
@@ -0,0 +1,2536 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include "filtercache.hxx"
+#include "lateinitlistener.hxx"
+#include "macros.hxx"
+#include "constant.hxx"
+#include "cacheupdatelistener.hxx"
+
+/*TODO see using below ... */
+#define AS_ENABLE_FILTER_UINAMES
+#define WORKAROUND_EXCEPTION_PROBLEM
+
+//_______________________________________________
+// includes
+#include <com/sun/star/util/XChangesBatch.hpp>
+#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XProperty.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/beans/Property.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/document/CorruptedFilterConfigurationException.hpp>
+#include <comphelper/sequenceasvector.hxx>
+#include <comphelper/locale.hxx>
+#include <unotools/processfactory.hxx>
+
+#ifndef _UNOTOOLS_CONFIGPATHES_HXX_
+#include <unotools/configpathes.hxx>
+#endif
+#include <rtl/ustrbuf.hxx>
+#include <rtl/logfile.hxx>
+#include <rtl/uri.hxx>
+#include <tools/urlobj.hxx>
+#include <tools/wldcrd.hxx>
+
+#include <comphelper/configurationhelper.hxx>
+
+//_______________________________________________
+// namespace
+
+namespace filter{
+ namespace config{
+
+namespace css = ::com::sun::star;
+
+//_______________________________________________
+// definitions
+
+// Error message in case filter config seems to be corrupted.
+// Note: Dont tell user something about "setup -repair"!
+// Its no longer supported by using native installers ...
+static ::rtl::OUString MESSAGE_CORRUPTED_FILTERCONFIG = ::rtl::OUString::createFromAscii("The filter configuration appears to be defective. Please install the office suite again.");
+
+/*-----------------------------------------------
+ 15.03.2004 08:59
+-----------------------------------------------*/
+FilterCache::FilterCache()
+ : BaseLock ( )
+ , m_xSMGR (::comphelper::getProcessServiceFactory())
+ , m_eFillState(E_CONTAINS_NOTHING )
+{
+ RTL_LOGFILE_TRACE("{ (as96863) FilterCache lifetime");
+}
+
+/*-----------------------------------------------
+ 15.03.2004 08:59
+-----------------------------------------------*/
+FilterCache::~FilterCache()
+{
+ RTL_LOGFILE_TRACE("} (as96863) FilterCache lifetime");
+}
+
+/*-----------------------------------------------
+ 03.03.2004 11:27
+-----------------------------------------------*/
+FilterCache* FilterCache::clone() const
+{
+ // SAFE -> ----------------------------------
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+
+ FilterCache* pClone = new FilterCache();
+
+ // Dont copy the configuration access points here.
+ // They will be created on demand inside the cloned instance,
+ // if they are needed.
+
+ pClone->m_xSMGR = m_xSMGR;
+
+ pClone->m_lTypes = m_lTypes;
+ pClone->m_lDetectServices = m_lDetectServices;
+ pClone->m_lFilters = m_lFilters;
+ pClone->m_lFrameLoaders = m_lFrameLoaders;
+ pClone->m_lContentHandlers = m_lContentHandlers;
+ pClone->m_lExtensions2Types = m_lExtensions2Types;
+ pClone->m_lURLPattern2Types = m_lURLPattern2Types;
+
+ pClone->m_sActLocale = m_sActLocale;
+ pClone->m_sFormatName = m_sFormatName;
+ pClone->m_sFormatVersion = m_sFormatVersion;
+
+ pClone->m_eFillState = m_eFillState;
+
+ pClone->m_lChangedTypes = m_lChangedTypes;
+ pClone->m_lChangedFilters = m_lChangedFilters;
+ pClone->m_lChangedDetectServices = m_lChangedDetectServices;
+ pClone->m_lChangedFrameLoaders = m_lChangedFrameLoaders;
+ pClone->m_lChangedContentHandlers = m_lChangedContentHandlers;
+
+ return pClone;
+ // <- SAFE ----------------------------------
+}
+
+/*-----------------------------------------------
+ 03.03.2004 14:39
+-----------------------------------------------*/
+void FilterCache::takeOver(const FilterCache& rClone)
+{
+ // SAFE -> ----------------------------------
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+
+ // a)
+ // Dont copy the configuration access points here!
+ // We must use our own ones ...
+
+ // b)
+ // Further we can ignore the uno service manager.
+ // We should already have a valid instance.
+
+ // c)
+ // Take over only changed items!
+ // Otherwhise we risk the following scenario:
+ // c1) clone_1 contains changed filters
+ // c2) clone_2 container changed types
+ // c3) clone_1 take over changed filters and unchanged types
+ // c4) clone_2 take over unchanged filters(!) and changed types(!)
+ // c5) c4 overwrites c3!
+
+ if (rClone.m_lChangedTypes.size()>0)
+ m_lTypes = rClone.m_lTypes;
+ if (rClone.m_lChangedDetectServices.size()>0)
+ m_lDetectServices = rClone.m_lDetectServices;
+ if (rClone.m_lChangedFilters.size()>0)
+ m_lFilters = rClone.m_lFilters;
+ if (rClone.m_lChangedFrameLoaders.size()>0)
+ m_lFrameLoaders = rClone.m_lFrameLoaders;
+ if (rClone.m_lChangedContentHandlers.size()>0)
+ m_lContentHandlers = rClone.m_lContentHandlers;
+
+ m_lChangedTypes.clear();
+ m_lChangedDetectServices.clear();
+ m_lChangedFilters.clear();
+ m_lChangedFrameLoaders.clear();
+ m_lChangedContentHandlers.clear();
+
+ m_sActLocale = rClone.m_sActLocale;
+ m_sFormatName = rClone.m_sFormatName;
+ m_sFormatVersion = rClone.m_sFormatVersion;
+
+ m_eFillState = rClone.m_eFillState;
+
+ // renew all dependencies and optimizations
+ // Because we cant be shure, that changed filters on one clone
+ // and changed types of another clone work together.
+ // But here we can check against the lates changes ...
+ impl_validateAndOptimize();
+ // <- SAFE ----------------------------------
+}
+
+/*-----------------------------------------------
+ 28.10.2003 09:01
+-----------------------------------------------*/
+void FilterCache::load(EFillState eRequired,
+#if OSL_DEBUG_LEVEL > 1
+ sal_Bool bByThread
+#else
+ sal_Bool
+#endif
+)
+ throw(css::uno::Exception)
+{
+ // SAFE -> ----------------------------------
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+
+ // check if required fill state is already reached ...
+ // There is nothing to do then.
+ if ((m_eFillState & eRequired) == eRequired)
+ return;
+
+#if OSL_DEBUG_LEVEL > 1 && !defined(OS2)
+ if (
+ (!bByThread) &&
+ (
+ ((eRequired & E_CONTAINS_FILTERS) == E_CONTAINS_FILTERS) ||
+ ((eRequired & E_CONTAINS_ALL ) == E_CONTAINS_ALL )
+ )
+ )
+ {
+ OSL_ENSURE(sal_False, "Who disturb our \"fill cache on demand\" feature and force loading of ALL data during office startup? Please optimize your code, so a full filled filter cache is not realy needed here!");
+ }
+#endif
+
+ // Otherwhise load the missing items.
+
+ // ------------------------------------------
+ // a) load some const values from configration.
+ // These values are needed there for loading
+ // config items ...
+ // Further we load some std items from the
+ // configuration so we can try to load the first
+ // office document with a minimal set of values.
+ if (m_eFillState == E_CONTAINS_NOTHING)
+ {
+ impl_getDirectCFGValue(CFGDIRECTKEY_OFFICELOCALE) >>= m_sActLocale;
+ if (!m_sActLocale.getLength())
+ {
+ _FILTER_CONFIG_LOG_1_("FilterCache::ctor() ... could not specify office locale => use default \"%s\"\n", _FILTER_CONFIG_TO_ASCII_(DEFAULT_OFFICELOCALE));
+ m_sActLocale = DEFAULT_OFFICELOCALE;
+ }
+
+ impl_getDirectCFGValue(CFGDIRECTKEY_FORMATNAME) >>= m_sFormatName;
+ if (!m_sFormatName.getLength())
+ impl_getDirectCFGValue(CFGDIRECTKEY_PRODUCTNAME) >>= m_sFormatName;
+
+ if (!m_sFormatName.getLength())
+ {
+ _FILTER_CONFIG_LOG_1_("FilterCache::ctor() ... could not specify format name => use default \"%s\"\n", _FILTER_CONFIG_TO_ASCII_(DEFAULT_FORMATNAME));
+ m_sFormatName = DEFAULT_FORMATNAME;
+ }
+
+ impl_getDirectCFGValue(CFGDIRECTKEY_FORMATVERSION) >>= m_sFormatVersion;
+ if (!m_sFormatVersion.getLength())
+ {
+ _FILTER_CONFIG_LOG_1_("FilterCache::ctor() ... could not specify format version => use default \"%s\"\n", _FILTER_CONFIG_TO_ASCII_(DEFAULT_FORMATVERSION));
+ m_sFormatVersion = DEFAULT_FORMATVERSION;
+ }
+
+ // Support the old configuration support. Read it only one times during office runtime!
+ impl_readOldFormat();
+
+ // enable "loadOnDemand" feature ...
+ // Create uno listener, which waits for finishing the office startup
+ // and starts a thread, which calls loadAll() at this filter cache.
+ // Note: Its not a leak to create this listener with new here.
+ // It kills itself after working!
+ /* LateInitListener* pLateInit = */ new LateInitListener(m_xSMGR);
+ }
+
+ // ------------------------------------------
+ // b) If the required fill state was not reached
+ // but std values was already loaded ...
+ // we must load some further missing items.
+ impl_load(eRequired);
+ // <- SAFE
+}
+
+/*-----------------------------------------------
+ 28.10.2003 09:50
+-----------------------------------------------*/
+sal_Bool FilterCache::isFillState(FilterCache::EFillState eState) const
+ throw(css::uno::Exception)
+{
+ // SAFE ->
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+ return ((m_eFillState & eState) == eState);
+ // <- SAFE
+}
+
+/*-----------------------------------------------
+ 14.07.2003 10:45
+-----------------------------------------------*/
+OUStringList FilterCache::getMatchingItemsByProps( EItemType eType ,
+ const CacheItem& lIProps,
+ const CacheItem& lEProps) const
+ throw(css::uno::Exception)
+{
+ // SAFE ->
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+
+ // search for right list
+ // An exception is thrown �f "eType" is unknown.
+ // => rList will be valid everytimes next line is reached.
+ CacheItemList& rList = impl_getItemList(eType);
+
+ OUStringList lKeys;
+
+ // search items, which provides all needed properties of set "lIProps"
+ // but not of set "lEProps"!
+ for (CacheItemList::const_iterator pIt = rList.begin();
+ pIt != rList.end() ;
+ ++pIt )
+ {
+ _FILTER_CONFIG_LOG_1_("getMatchingProps for \"%s\" ...\n",
+ _FILTER_CONFIG_TO_ASCII_(pIt->first))
+ if (
+ (pIt->second.haveProps(lIProps) ) &&
+ (pIt->second.dontHaveProps(lEProps))
+ )
+ {
+ lKeys.push_back(pIt->first);
+ }
+ }
+
+ return lKeys;
+ // <- SAFE
+}
+
+/*-----------------------------------------------
+ 02.07.2003 09:32
+-----------------------------------------------*/
+sal_Bool FilterCache::hasItems(EItemType eType) const
+ throw(css::uno::Exception)
+{
+ // SAFE ->
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+
+ // search for right list
+ // An exception is thrown �f "eType" is unknown.
+ // => rList will be valid everytimes next line is reached.
+ CacheItemList& rList = impl_getItemList(eType);
+
+ return (rList.size()>0);
+ // <- SAFE
+}
+
+/*-----------------------------------------------
+ 02.07.2003 11:48
+-----------------------------------------------*/
+OUStringList FilterCache::getItemNames(EItemType eType) const
+ throw(css::uno::Exception)
+{
+ // SAFE ->
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+
+ // search for right list
+ // An exception is thrown �f "eType" is unknown.
+ // => rList will be valid everytimes next line is reached.
+ CacheItemList& rList = impl_getItemList(eType);
+
+ OUStringList lKeys;
+ for (CacheItemList::const_iterator pIt = rList.begin();
+ pIt != rList.end() ;
+ ++pIt )
+ {
+ lKeys.push_back(pIt->first);
+ }
+ return lKeys;
+ // <- SAFE
+}
+
+/*-----------------------------------------------
+ 27.10.2003 08:37
+-----------------------------------------------*/
+sal_Bool FilterCache::hasItem( EItemType eType,
+ const ::rtl::OUString& sItem)
+ throw(css::uno::Exception)
+{
+ // SAFE ->
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+
+ // search for right list
+ // An exception is thrown �f "eType" is unknown.
+ // => rList will be valid everytimes next line is reached.
+ CacheItemList& rList = impl_getItemList(eType);
+
+ // if item could not be found - check if it can be loaded
+ // from the underlying configuration layer. Might it was not already
+ // loaded into this FilterCache object before.
+ CacheItemList::const_iterator pIt = rList.find(sItem);
+ if (pIt != rList.end())
+ return sal_True;
+
+ try
+ {
+ impl_loadItemOnDemand(eType, sItem);
+ // no exception => item could be loaded!
+ return sal_True;
+ }
+ catch(const css::container::NoSuchElementException&)
+ {}
+
+ return sal_False;
+ // <- SAFE
+}
+
+/*-----------------------------------------------
+ 17.07.2006 09:15
+-----------------------------------------------*/
+CacheItem FilterCache::getItem( EItemType eType,
+ const ::rtl::OUString& sItem)
+ throw(css::uno::Exception)
+{
+ // SAFE ->
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+
+ // search for right list
+ // An exception is thrown if "eType" is unknown.
+ // => rList will be valid everytimes next line is reached.
+ CacheItemList& rList = impl_getItemList(eType);
+
+ // check if item exists ...
+ CacheItemList::iterator pIt = rList.find(sItem);
+ if (pIt == rList.end())
+ {
+ // ... or load it on demand from the
+ // underlying configuration layer.
+ // Note: NoSuchElementException is thrown automaticly here if
+ // item could not be loaded!
+ pIt = impl_loadItemOnDemand(eType, sItem);
+ }
+
+ /* Workaround for #137955#
+ Draw types and filters are installed ... but draw was disabled during setup.
+ We must supress accessing these filters. Otherwise the office can crash.
+ Solution for the next major release: do not install those filters !
+ */
+ if (eType == E_FILTER)
+ {
+ CacheItem& rFilter = pIt->second;
+ ::rtl::OUString sDocService;
+ rFilter[PROPNAME_DOCUMENTSERVICE] >>= sDocService;
+
+ // --> PB 2006-10-18 #142498#
+ // In Standalone-Impress the module WriterWeb is not installed
+ // but it is there to load help pages
+ sal_Bool bIsHelpFilter = sItem.equalsAscii( "writer_web_HTML_help" );
+
+ if ( !bIsHelpFilter && !impl_isModuleInstalled(sDocService) )
+ // <--
+ {
+ ::rtl::OUStringBuffer sMsg(256);
+ sMsg.appendAscii("The requested filter '" );
+ sMsg.append (sItem );
+ sMsg.appendAscii("' exists ... but it shouldnt; because the corresponding OOo module was not installed.");
+ throw css::container::NoSuchElementException(sMsg.makeStringAndClear(), css::uno::Reference< css::uno::XInterface >());
+ }
+ }
+
+ return pIt->second;
+ // <- SAFE
+}
+
+/*-----------------------------------------------
+ 03.03.2004 11:28
+-----------------------------------------------*/
+void FilterCache::removeItem( EItemType eType,
+ const ::rtl::OUString& sItem)
+ throw(css::uno::Exception)
+{
+ // SAFE ->
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+
+ // search for right list
+ // An exception is thrown �f "eType" is unknown.
+ // => rList will be valid everytimes next line is reached.
+ CacheItemList& rList = impl_getItemList(eType);
+
+ CacheItemList::iterator pItem = rList.find(sItem);
+ if (pItem == rList.end())
+ pItem = impl_loadItemOnDemand(eType, sItem); // throws NoSuchELementException!
+ rList.erase(pItem);
+
+ impl_addItem2FlushList(eType, sItem);
+}
+
+/*-----------------------------------------------
+ 26.11.2003 13:28
+-----------------------------------------------*/
+void FilterCache::setItem( EItemType eType ,
+ const ::rtl::OUString& sItem ,
+ const CacheItem& aValue)
+ throw(css::uno::Exception)
+{
+ // SAFE ->
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+
+ // search for right list
+ // An exception is thrown �f "eType" is unknown.
+ // => rList will be valid everytimes next line is reached.
+ CacheItemList& rList = impl_getItemList(eType);
+
+ // name must be part of the property set too ... otherwhise our
+ // container query cant work correctly
+ CacheItem aItem = aValue;
+ aItem[PROPNAME_NAME] <<= sItem;
+ aItem.validateUINames(m_sActLocale);
+
+ // remove implicit properties as e.g. FINALIZED or MANDATORY
+ // They cant be saved here and must be readed on demand later, if they are needed.
+ removeStatePropsFromItem(aItem);
+
+ rList[sItem] = aItem;
+
+ impl_addItem2FlushList(eType, sItem);
+}
+
+//-----------------------------------------------
+void FilterCache::refreshItem( EItemType eType,
+ const ::rtl::OUString& sItem)
+ throw(css::uno::Exception)
+{
+ // SAFE ->
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+ impl_loadItemOnDemand(eType, sItem);
+}
+
+/*-----------------------------------------------
+ 27.10.2003 08:14
+-----------------------------------------------*/
+void FilterCache::addStatePropsToItem( EItemType eType,
+ const ::rtl::OUString& sItem,
+ CacheItem& rItem)
+ throw(css::uno::Exception)
+{
+ // SAFE ->
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+
+ // Note: Opening of the configuration layer throws some exceptions
+ // if it failed. So we dont must check any reference here ...
+ css::uno::Reference< css::container::XNameAccess > xPackage;
+ css::uno::Reference< css::container::XNameAccess > xSet;
+ switch(eType)
+ {
+ case E_TYPE :
+ {
+ xPackage = css::uno::Reference< css::container::XNameAccess >(impl_openConfig(E_PROVIDER_TYPES), css::uno::UNO_QUERY);
+ xPackage->getByName(CFGSET_TYPES) >>= xSet;
+ }
+ break;
+
+ case E_FILTER :
+ {
+ xPackage = css::uno::Reference< css::container::XNameAccess >(impl_openConfig(E_PROVIDER_FILTERS), css::uno::UNO_QUERY);
+ xPackage->getByName(CFGSET_FILTERS) >>= xSet;
+ }
+ break;
+
+ case E_FRAMELOADER :
+ {
+ /* TODO
+ Hack -->
+ The default frame loader cant be located inside te normal set of frame loaders.
+ Its an atomic property inside the misc cfg package. So we cant retrieve the information
+ about FINALIZED and MANDATORY very easy ... :-(
+ => set it to readonly/required everytimes :-)
+ */
+ css::uno::Any aDirectValue = impl_getDirectCFGValue(CFGDIRECTKEY_DEFAULTFRAMELOADER);
+ ::rtl::OUString sDefaultFrameLoader;
+ if (
+ (aDirectValue >>= sDefaultFrameLoader) &&
+ (sDefaultFrameLoader.getLength() ) &&
+ (sItem.equals(sDefaultFrameLoader) )
+ )
+ {
+ rItem[PROPNAME_FINALIZED] <<= sal_True;
+ rItem[PROPNAME_MANDATORY] <<= sal_True;
+ return;
+ }
+ /* <-- HACK */
+
+ xPackage = css::uno::Reference< css::container::XNameAccess >(impl_openConfig(E_PROVIDER_OTHERS), css::uno::UNO_QUERY);
+ xPackage->getByName(CFGSET_FRAMELOADERS) >>= xSet;
+ }
+ break;
+
+ case E_CONTENTHANDLER :
+ {
+ xPackage = css::uno::Reference< css::container::XNameAccess >(impl_openConfig(E_PROVIDER_OTHERS), css::uno::UNO_QUERY);
+ xPackage->getByName(CFGSET_CONTENTHANDLERS) >>= xSet;
+ }
+ break;
+ default: break;
+ }
+
+ try
+ {
+ css::uno::Reference< css::beans::XProperty > xItem;
+ xSet->getByName(sItem) >>= xItem;
+ css::beans::Property aDescription = xItem->getAsProperty();
+
+ sal_Bool bFinalized = ((aDescription.Attributes & css::beans::PropertyAttribute::READONLY ) == css::beans::PropertyAttribute::READONLY );
+ sal_Bool bMandatory = ((aDescription.Attributes & css::beans::PropertyAttribute::REMOVEABLE) != css::beans::PropertyAttribute::REMOVEABLE);
+
+ rItem[PROPNAME_FINALIZED] <<= bFinalized;
+ rItem[PROPNAME_MANDATORY] <<= bMandatory;
+ }
+ catch(const css::container::NoSuchElementException&)
+ {
+ /* Ignore exceptions for missing elements inside configuration.
+ May by the following reason exists:
+ - The item does not exists inside the new configuration package org.openoffice.TypeDetection - but
+ we got it from the old package org.openoffice.Office/TypeDetection. We dont migrate such items
+ automaticly to the new format. Because it will disturb e.g. the deinstallation of an external filter
+ package. Because such external filter can remove the old file - but not the automaticly created new one ...
+
+ => mark item as FINALIZED / MANDATORY, we dont support writing to the old format
+ */
+ rItem[PROPNAME_FINALIZED] <<= sal_True;
+ rItem[PROPNAME_MANDATORY] <<= sal_True;
+ }
+
+ // <- SAFE
+}
+
+/*-----------------------------------------------
+ 05.03.2004 10:36
+-----------------------------------------------*/
+void FilterCache::removeStatePropsFromItem(CacheItem& rItem)
+ throw(css::uno::Exception)
+{
+ CacheItem::iterator pIt;
+ pIt = rItem.find(PROPNAME_FINALIZED);
+ if (pIt != rItem.end())
+ rItem.erase(pIt);
+ pIt = rItem.find(PROPNAME_MANDATORY);
+ if (pIt != rItem.end())
+ rItem.erase(pIt);
+}
+
+/*-----------------------------------------------
+ 02.07.2003 09:17
+-----------------------------------------------*/
+void FilterCache::flush()
+ throw(css::uno::Exception)
+{
+ // SAFE ->
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+
+ // renew all dependencies and optimizations
+ impl_validateAndOptimize();
+
+ if (m_lChangedTypes.size() > 0)
+ {
+ css::uno::Reference< css::container::XNameAccess > xConfig(impl_openConfig(E_PROVIDER_TYPES), css::uno::UNO_QUERY);
+ css::uno::Reference< css::container::XNameAccess > xSet ;
+
+ xConfig->getByName(CFGSET_TYPES) >>= xSet;
+ impl_flushByList(xSet, E_TYPE, m_lTypes, m_lChangedTypes);
+
+ css::uno::Reference< css::util::XChangesBatch > xFlush(xConfig, css::uno::UNO_QUERY);
+ xFlush->commitChanges();
+ }
+
+ if (m_lChangedFilters.size() > 0)
+ {
+ css::uno::Reference< css::container::XNameAccess > xConfig(impl_openConfig(E_PROVIDER_FILTERS), css::uno::UNO_QUERY);
+ css::uno::Reference< css::container::XNameAccess > xSet ;
+
+ xConfig->getByName(CFGSET_FILTERS) >>= xSet;
+ impl_flushByList(xSet, E_FILTER, m_lFilters, m_lChangedFilters);
+
+ css::uno::Reference< css::util::XChangesBatch > xFlush(xConfig, css::uno::UNO_QUERY);
+ xFlush->commitChanges();
+ }
+
+ /*TODO FrameLoader/ContentHandler must be flushed here too ... */
+}
+
+/*-----------------------------------------------
+ 20.10.2003 09:22
+-----------------------------------------------*/
+void FilterCache::impl_flushByList(const css::uno::Reference< css::container::XNameAccess >& xSet ,
+ EItemType eType ,
+ const CacheItemList& rCache,
+ const OUStringList& lItems)
+ throw(css::uno::Exception)
+{
+ css::uno::Reference< css::container::XNameContainer > xAddRemoveSet = css::uno::Reference< css::container::XNameContainer > (xSet, css::uno::UNO_QUERY);
+ css::uno::Reference< css::container::XNameReplace > xReplaceeSet = css::uno::Reference< css::container::XNameReplace > (xSet, css::uno::UNO_QUERY);
+ css::uno::Reference< css::lang::XSingleServiceFactory > xFactory = css::uno::Reference< css::lang::XSingleServiceFactory >(xSet, css::uno::UNO_QUERY);
+
+ for (OUStringList::const_iterator pIt = lItems.begin();
+ pIt != lItems.end() ;
+ ++pIt )
+ {
+ const ::rtl::OUString& sItem = *pIt;
+ EItemFlushState eState = impl_specifyFlushOperation(xSet, rCache, sItem);
+ switch(eState)
+ {
+ case E_ITEM_REMOVED :
+ {
+ xAddRemoveSet->removeByName(sItem);
+ }
+ break;
+
+ case E_ITEM_ADDED :
+ {
+ css::uno::Reference< css::container::XNameReplace > xItem (xFactory->createInstance(), css::uno::UNO_QUERY);
+
+ // special case. no exception - but not a valid item => set must be finalized or mandatory!
+ // Reject flush operation by throwing an exception. At least one item couldnt be flushed.
+ if (!xItem.is())
+ throw css::uno::Exception(::rtl::OUString::createFromAscii("Cant add item. Set is finalized or mandatory!"),
+ css::uno::Reference< css::uno::XInterface >() );
+
+ CacheItemList::const_iterator pItem = rCache.find(sItem);
+ impl_saveItem(xItem, eType, pItem->second);
+ xAddRemoveSet->insertByName(sItem, css::uno::makeAny(xItem));
+ }
+ break;
+
+ case E_ITEM_CHANGED :
+ {
+ css::uno::Reference< css::container::XNameReplace > xItem;
+ xSet->getByName(sItem) >>= xItem;
+
+ // special case. no exception - but not a valid item => it must be finalized or mandatory!
+ // Reject flush operation by throwing an exception. At least one item couldnt be flushed.
+ if (!xItem.is())
+ throw css::uno::Exception(::rtl::OUString::createFromAscii("Cant change item. Its finalized or mandatory!"),
+ css::uno::Reference< css::uno::XInterface >() );
+
+ CacheItemList::const_iterator pItem = rCache.find(sItem);
+ impl_saveItem(xItem, eType, pItem->second);
+ }
+ break;
+ default: break;
+ }
+ }
+}
+
+/*-----------------------------------------------
+ 03.11.2003 08:38
+-----------------------------------------------*/
+void FilterCache::detectFlatForURL(const css::util::URL& aURL ,
+ FlatDetection& rFlatTypes) const
+ throw(css::uno::Exception)
+{
+ // extract extension from URL, so it can be used directly as key into our hash map!
+ // Note further: It must be converted to lower case, because the optimize hash
+ // (which maps extensions to types) work with lower case key strings!
+ INetURLObject aParser (aURL.Main);
+ ::rtl::OUString sExtension = aParser.getExtension(INetURLObject::LAST_SEGMENT ,
+ sal_True ,
+ INetURLObject::DECODE_WITH_CHARSET);
+ sExtension = sExtension.toAsciiLowerCase();
+
+ // SAFE -> ----------------------------------
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+
+ //*******************************************
+ // i) Step over all well known URL pattern
+ // and add registered types to the return list too
+ // Do it as first one - because: if a type match by a
+ // pattern a following deep detection can be supressed!
+ // Further we can stop after first match ...
+ for (CacheItemRegistration::const_iterator pPattReg = m_lURLPattern2Types.begin();
+ pPattReg != m_lURLPattern2Types.end() ;
+ ++pPattReg )
+ {
+ WildCard aPatternCheck(pPattReg->first);
+ if (aPatternCheck.Matches(aURL.Main))
+ {
+ const OUStringList& rTypesForPattern = pPattReg->second;
+
+ FlatDetectionInfo aInfo;
+ aInfo.sType = *(rTypesForPattern.begin());
+ aInfo.bMatchByPattern = sal_True;
+
+ rFlatTypes.push_back(aInfo);
+// return;
+ }
+ }
+
+ //*******************************************
+ // ii) search types matching to the given extension.
+ // Copy every macthing type without changing its order!
+ // Because preferred types was added as first one during
+ // loading configuration.
+ CacheItemRegistration::const_iterator pExtReg = m_lExtensions2Types.find(sExtension);
+ if (pExtReg != m_lExtensions2Types.end())
+ {
+ const OUStringList& rTypesForExtension = pExtReg->second;
+ for (OUStringList::const_iterator pIt = rTypesForExtension.begin();
+ pIt != rTypesForExtension.end() ;
+ ++pIt )
+ {
+ FlatDetectionInfo aInfo;
+ aInfo.sType = *pIt;
+ aInfo.bMatchByExtension = sal_True;
+
+ rFlatTypes.push_back(aInfo);
+ }
+ }
+
+ aLock.clear();
+ // <- SAFE ----------------------------------
+}
+
+/*-----------------------------------------------
+ 03.11.2003 08:38
+-----------------------------------------------*/
+CacheItemList& FilterCache::impl_getItemList(EItemType eType) const
+ throw(css::uno::Exception)
+{
+ // SAFE -> ----------------------------------
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+
+ switch(eType)
+ {
+ case E_TYPE : return m_lTypes ;
+ case E_FILTER : return m_lFilters ;
+ case E_FRAMELOADER : return m_lFrameLoaders ;
+ case E_CONTENTHANDLER : return m_lContentHandlers;
+ case E_DETECTSERVICE : return m_lDetectServices ;
+
+ default : throw css::uno::Exception(::rtl::OUString::createFromAscii("unknown sub container requested."),
+ css::uno::Reference< css::uno::XInterface >() );
+ }
+
+ // <- SAFE ----------------------------------
+}
+
+/*-----------------------------------------------
+ 21.10.2003 13:20
+-----------------------------------------------*/
+css::uno::Reference< css::uno::XInterface > FilterCache::impl_openConfig(EConfigProvider eProvider)
+ throw(css::uno::Exception)
+{
+ // SAFE ->
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+
+ ::rtl::OUString sPath ;
+ css::uno::Reference< css::uno::XInterface >* pConfig = 0;
+ css::uno::Reference< css::uno::XInterface > xOld ;
+ ::rtl::OString sRtlLog ;
+ FilterCache::EItemType eItemType( FilterCache::E_TYPE ) ;
+ sal_Bool bStartListening = sal_False;
+
+ switch(eProvider)
+ {
+ case E_PROVIDER_TYPES :
+ {
+ if (m_xConfigTypes.is())
+ return m_xConfigTypes;
+ sPath = CFGPACKAGE_TD_TYPES;
+ pConfig = &m_xConfigTypes;
+ eItemType = FilterCache::E_TYPE;
+ bStartListening = sal_True;
+ sRtlLog = ::rtl::OString("framework (as96863) ::FilterCache::impl_openconfig(E_PROVIDER_TYPES)");
+ }
+ break;
+
+ case E_PROVIDER_FILTERS :
+ {
+ if (m_xConfigFilters.is())
+ return m_xConfigFilters;
+ sPath = CFGPACKAGE_TD_FILTERS;
+ pConfig = &m_xConfigFilters;
+ eItemType = FilterCache::E_FILTER;
+ bStartListening = sal_True;
+ sRtlLog = ::rtl::OString("framework (as96863) ::FilterCache::impl_openconfig(E_PROVIDER_FILTERS)");
+ }
+ break;
+
+ case E_PROVIDER_OTHERS :
+ {
+ if (m_xConfigOthers.is())
+ return m_xConfigOthers;
+ sPath = CFGPACKAGE_TD_OTHERS;
+ pConfig = &m_xConfigOthers;
+ eItemType = FilterCache::E_TYPE;
+ sRtlLog = ::rtl::OString("framework (as96863) ::FilterCache::impl_openconfig(E_PROVIDER_OTHERS)");
+ }
+ break;
+
+ case E_PROVIDER_OLD :
+ {
+ // This special provider is used to work with
+ // the old configuration format only. Its not cached!
+ sPath = CFGPACKAGE_TD_OLD;
+ pConfig = &xOld;
+ sRtlLog = ::rtl::OString("framework (as96863) ::FilterCache::impl_openconfig(E_PROVIDER_OLD)");
+ }
+ break;
+
+ default : throw css::uno::Exception(::rtl::OUString::createFromAscii("These configuration node isnt supported here for open!"), 0);
+ }
+
+ {
+ RTL_LOGFILE_CONTEXT(aLog, sRtlLog.getStr());
+ *pConfig = impl_createConfigAccess(sPath ,
+ sal_False, // bReadOnly
+ sal_True ); // bLocalesMode
+ }
+
+ // Start listening for changes on that configuration access.
+ // We must not control the lifetime of this listener. Itself
+ // checks, when ist time to die :-)
+ if (bStartListening)
+ {
+ CacheUpdateListener* pListener = new CacheUpdateListener(m_xSMGR, *pConfig, eItemType);
+ pListener->startListening();
+ }
+
+ return *pConfig;
+ // <- SAFE
+}
+
+/*-----------------------------------------------
+ 17.07.2003 10:10
+-----------------------------------------------*/
+css::uno::Any FilterCache::impl_getDirectCFGValue(const ::rtl::OUString& sDirectKey)
+{
+ ::rtl::OUString sRoot;
+ ::rtl::OUString sKey ;
+
+ if (
+ (!::utl::splitLastFromConfigurationPath(sDirectKey, sRoot, sKey)) ||
+ (!sRoot.getLength() ) ||
+ (!sKey.getLength() )
+ )
+ return css::uno::Any();
+
+ css::uno::Reference< css::uno::XInterface > xCfg = impl_createConfigAccess(sRoot ,
+ sal_True , // bReadOnly
+ sal_False); // bLocalesMode
+ if (!xCfg.is())
+ return css::uno::Any();
+
+ css::uno::Reference< css::container::XNameAccess > xAccess(xCfg, css::uno::UNO_QUERY);
+ if (!xAccess.is())
+ return css::uno::Any();
+
+ css::uno::Any aValue;
+ try
+ {
+ aValue = xAccess->getByName(sKey);
+ }
+ catch(const css::uno::RuntimeException& exRun)
+ { throw exRun; }
+ #if OSL_DEBUG_LEVEL>0
+ catch(const css::uno::Exception& ex)
+ #else
+ catch(const css::uno::Exception&)
+ #endif
+ {
+ #if OSL_DEBUG_LEVEL > 0
+ OSL_ENSURE(sal_False, ::rtl::OUStringToOString(ex.Message, RTL_TEXTENCODING_UTF8).getStr());
+ #endif
+ aValue.clear();
+ }
+
+ return aValue;
+}
+
+/*-----------------------------------------------
+ 17.07.2003 09:49
+-----------------------------------------------*/
+css::uno::Reference< css::uno::XInterface > FilterCache::impl_createConfigAccess(const ::rtl::OUString& sRoot ,
+ sal_Bool bReadOnly ,
+ sal_Bool bLocalesMode)
+{
+ // SAFE ->
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+
+ css::uno::Reference< css::uno::XInterface > xCfg;
+
+ try
+ {
+ css::uno::Reference< css::lang::XMultiServiceFactory > xConfigProvider(
+ m_xSMGR->createInstance(SERVICE_CONFIGURATIONPROVIDER), css::uno::UNO_QUERY);
+
+ if (!xConfigProvider.is())
+ return css::uno::Reference< css::uno::XInterface >();
+
+ ::comphelper::SequenceAsVector< css::uno::Any > lParams;
+ css::beans::PropertyValue aParam ;
+
+ // set root path
+ aParam.Name = _FILTER_CONFIG_FROM_ASCII_("nodepath");
+ aParam.Value <<= sRoot;
+ lParams.push_back(css::uno::makeAny(aParam));
+
+ // enable "all locales mode" ... if required
+ if (bLocalesMode)
+ {
+ aParam.Name = _FILTER_CONFIG_FROM_ASCII_("locale");
+ aParam.Value <<= _FILTER_CONFIG_FROM_ASCII_("*" );
+ lParams.push_back(css::uno::makeAny(aParam));
+ }
+
+ // open it
+ if (bReadOnly)
+ xCfg = xConfigProvider->createInstanceWithArguments(SERVICE_CONFIGURATIONACCESS, lParams.getAsConstList());
+ else
+ xCfg = xConfigProvider->createInstanceWithArguments(SERVICE_CONFIGURATIONUPDATEACCESS, lParams.getAsConstList());
+
+ // If configuration could not be opened ... but factory method does not throwed an exception
+ // trigger throwing of our own CorruptedFilterConfigurationException.
+ // Let message empty. The normal exception text show enough informations to the user.
+ if (! xCfg.is())
+ throw css::uno::Exception(
+ _FILTER_CONFIG_FROM_ASCII_("Got NULL reference on opening configuration file ... but no exception."),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ catch(const css::uno::Exception& ex)
+ {
+ throw css::document::CorruptedFilterConfigurationException(
+ MESSAGE_CORRUPTED_FILTERCONFIG,
+ css::uno::Reference< css::uno::XInterface >(),
+ ex.Message);
+ }
+
+ return xCfg;
+ // <- SAFE
+}
+
+/*-----------------------------------------------
+ 24.10.2003 10:03
+-----------------------------------------------*/
+void FilterCache::impl_validateAndOptimize()
+ throw(css::uno::Exception)
+{
+ // SAFE ->
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+
+ RTL_LOGFILE_CONTEXT( aLog, "framework (as96863) ::FilterCache::impl_validateAndOptimize");
+
+ // First check if any filter or type could be readed
+ // from the underlying configuration!
+ sal_Bool bSomeTypesShouldExist = ((m_eFillState & E_CONTAINS_STANDARD ) == E_CONTAINS_STANDARD );
+ sal_Bool bAllFiltersShouldExist = ((m_eFillState & E_CONTAINS_FILTERS ) == E_CONTAINS_FILTERS );
+
+#if OSL_DEBUG_LEVEL > 0
+
+ sal_Int32 nWarnings = 0;
+
+// sal_Bool bAllTypesShouldExist = ((m_eFillState & E_CONTAINS_TYPES ) == E_CONTAINS_TYPES );
+ sal_Bool bAllLoadersShouldExist = ((m_eFillState & E_CONTAINS_FRAMELOADERS ) == E_CONTAINS_FRAMELOADERS );
+ sal_Bool bAllHandlersShouldExist = ((m_eFillState & E_CONTAINS_CONTENTHANDLERS) == E_CONTAINS_CONTENTHANDLERS);
+#endif
+
+ if (
+ (
+ (bSomeTypesShouldExist) &&
+ (m_lTypes.size() < 1 )
+ ) ||
+ (
+ (bAllFiltersShouldExist) &&
+ (m_lFilters.size() < 1 )
+ )
+ )
+ {
+ throw css::document::CorruptedFilterConfigurationException(
+ MESSAGE_CORRUPTED_FILTERCONFIG,
+ css::uno::Reference< css::uno::XInterface >(),
+ ::rtl::OUString::createFromAscii("The list of types or filters is empty."));
+ }
+
+ // Create a log for all detected problems, which
+ // occure in the next feew lines.
+ // If there are some real errors throw a RuntimException!
+ // If there are some warnings only, show an assertion.
+ sal_Int32 nErrors = 0;
+ ::rtl::OUStringBuffer sLog(256);
+
+ CacheItemList::iterator pIt;
+
+ for (pIt = m_lTypes.begin(); pIt != m_lTypes.end(); ++pIt)
+ {
+ ::rtl::OUString sType = pIt->first;
+ CacheItem aType = pIt->second;
+
+ // create list of all known detect services / frame loader / content handler on demand
+ // Because these informations are available as type properties!
+ ::rtl::OUString sDetectService;
+ aType[PROPNAME_DETECTSERVICE ] >>= sDetectService;
+ if (sDetectService.getLength())
+ impl_resolveItem4TypeRegistration(&m_lDetectServices, sDetectService, sType);
+
+ // get its registration for file Extensions AND(!) URLPattern ...
+ // It doesnt matter if these items exists or if our
+ // used index access create some default ones ...
+ // only in case there is no filled set of Extensions AND
+ // no filled set of URLPattern -> we must try to remove this invalid item
+ // from this cache!
+ css::uno::Sequence< ::rtl::OUString > lExtensions;
+ css::uno::Sequence< ::rtl::OUString > lURLPattern;
+ aType[PROPNAME_EXTENSIONS] >>= lExtensions;
+ aType[PROPNAME_URLPATTERN] >>= lURLPattern;
+ sal_Int32 ce = lExtensions.getLength();
+ sal_Int32 cu = lURLPattern.getLength();
+
+#if OSL_DEBUG_LEVEL > 0
+
+ ::rtl::OUString sInternalTypeNameCheck;
+ aType[PROPNAME_NAME] >>= sInternalTypeNameCheck;
+ if (!sInternalTypeNameCheck.equals(sType))
+ {
+ sLog.appendAscii("Warning\t:\t");
+ sLog.appendAscii("The type \"" );
+ sLog.append (sType );
+ sLog.appendAscii("\" does support the property \"Name\" correctly.\n");
+ ++nWarnings;
+ }
+
+ if (!ce && !cu)
+ {
+ sLog.appendAscii("Warning\t:\t");
+ sLog.appendAscii("The type \"" );
+ sLog.append (sType );
+ sLog.appendAscii("\" does not contain any URL pattern nor any extensions.\n");
+ ++nWarnings;
+ }
+#endif
+
+ // create an optimized registration for this type to
+ // its set list of extensions/url pattern. If its a "normal" type
+ // set it at the end of this optimized list. But if its
+ // a "Preferred" one - set it to the front of this list.
+ // Of course multiple "Preferred" registrations can occure
+ // (they shouldnt - but they can!) ... Ignore it. The last
+ // preferred type is useable in the same manner then every
+ // other type!
+ sal_Bool bPreferred = sal_False;
+ aType[PROPNAME_PREFERRED] >>= bPreferred;
+
+ const ::rtl::OUString* pExtensions = lExtensions.getConstArray();
+ for (sal_Int32 e=0; e<ce; ++e)
+ {
+ // Note: We must be shure that adress the right hash entry
+ // does not depend from any upper/lower case problems ...
+ ::rtl::OUString sNormalizedExtension = pExtensions[e].toAsciiLowerCase();
+
+ OUStringList& lTypesForExtension = m_lExtensions2Types[sNormalizedExtension];
+ if (::std::find(lTypesForExtension.begin(), lTypesForExtension.end(), sType) != lTypesForExtension.end())
+ continue;
+
+ if (bPreferred)
+ lTypesForExtension.insert(lTypesForExtension.begin(), sType);
+ else
+ lTypesForExtension.push_back(sType);
+ }
+
+ const ::rtl::OUString* pURLPattern = lURLPattern.getConstArray();
+ for (sal_Int32 u=0; u<cu; ++u)
+ {
+ OUStringList& lTypesForURLPattern = m_lURLPattern2Types[pURLPattern[u]];
+ if (::std::find(lTypesForURLPattern.begin(), lTypesForURLPattern.end(), sType) != lTypesForURLPattern.end())
+ continue;
+
+ if (bPreferred)
+ lTypesForURLPattern.insert(lTypesForURLPattern.begin(), sType);
+ else
+ lTypesForURLPattern.push_back(sType);
+ }
+
+#if OSL_DEBUG_LEVEL > 0
+
+ // Dont check cross references between types and filters, if
+ // not all filters read from disk!
+ // OK - this cache can read single filters on demand too ...
+ // but then the fill state of this cache shouldnt be set to E_CONTAINS_FILTERS!
+ if (!bAllFiltersShouldExist)
+ continue;
+
+ ::rtl::OUString sPrefFilter;
+ aType[PROPNAME_PREFERREDFILTER] >>= sPrefFilter;
+ if (!sPrefFilter.getLength())
+ {
+ // OK - there is no filter for this type. But thats not an error.
+ // May be it can be handled by a ContentHandler ...
+ // But at this time its not guaranteed that there is any ContentHandler
+ // or FrameLoader inside this cache ... but on disk ...
+ sal_Bool bReferencedByLoader = sal_True;
+ sal_Bool bReferencedByHandler = sal_True;
+ if (bAllLoadersShouldExist)
+ bReferencedByLoader = (impl_searchFrameLoaderForType(sType).getLength()!=0);
+
+ if (bAllHandlersShouldExist)
+ bReferencedByHandler = (impl_searchContentHandlerForType(sType).getLength()!=0);
+
+ if (
+ (!bReferencedByLoader ) &&
+ (!bReferencedByHandler)
+ )
+ {
+ sLog.appendAscii("Warning\t:\t" );
+ sLog.appendAscii("The type \"" );
+ sLog.append (sType );
+ sLog.appendAscii("\" isnt used by any filter, loader or content handler.\n");
+ ++nWarnings;
+ }
+ }
+
+ if (sPrefFilter.getLength())
+ {
+ CacheItemList::const_iterator pIt2 = m_lFilters.find(sPrefFilter);
+ if (pIt2 == m_lFilters.end())
+ {
+ if (bAllFiltersShouldExist)
+ {
+ ++nWarnings; // preferred filters can point to a non-installed office module ! no error ... it's a warning only .-(
+ sLog.appendAscii("error\t:\t");
+ }
+ else
+ {
+ ++nWarnings;
+ sLog.appendAscii("warning\t:\t");
+ }
+
+ sLog.appendAscii("The type \"" );
+ sLog.append (sType );
+ sLog.appendAscii("\" points to an invalid filter \"");
+ sLog.append (sPrefFilter );
+ sLog.appendAscii("\".\n" );
+
+ continue;
+ }
+
+ CacheItem aPrefFilter = pIt2->second;
+ ::rtl::OUString sFilterTypeReg;
+ aPrefFilter[PROPNAME_TYPE] >>= sFilterTypeReg;
+ if (sFilterTypeReg != sType)
+ {
+ sLog.appendAscii("error\t:\t" );
+ sLog.appendAscii("The preferred filter \"" );
+ sLog.append (sPrefFilter );
+ sLog.appendAscii("\" of type \"" );
+ sLog.append (sType );
+ sLog.appendAscii("is registered for another type \"");
+ sLog.append (sFilterTypeReg );
+ sLog.appendAscii("\".\n" );
+ ++nErrors;
+ }
+
+ sal_Int32 nFlags = 0;
+ aPrefFilter[PROPNAME_FLAGS] >>= nFlags;
+ if ((nFlags & FLAGVAL_IMPORT) != FLAGVAL_IMPORT)
+ {
+ sLog.appendAscii("error\t:\t" );
+ sLog.appendAscii("The preferred filter \"" );
+ sLog.append (sPrefFilter );
+ sLog.appendAscii("\" of type \"" );
+ sLog.append (sType );
+ sLog.appendAscii("\" is not an IMPORT filter!\n");
+ ++nErrors;
+ }
+
+ ::rtl::OUString sInternalFilterNameCheck;
+ aPrefFilter[PROPNAME_NAME] >>= sInternalFilterNameCheck;
+ if (!sInternalFilterNameCheck.equals(sPrefFilter))
+ {
+ sLog.appendAscii("Warning\t:\t" );
+ sLog.appendAscii("The filter \"" );
+ sLog.append (sPrefFilter );
+ sLog.appendAscii("\" does support the property \"Name\" correctly.\n");
+ ++nWarnings;
+ }
+ }
+#endif
+ }
+
+ // create dependencies between the global default frame loader
+ // and all types (and of course if registered filters), which
+ // does not registered for any other loader.
+ css::uno::Any aDirectValue = impl_getDirectCFGValue(CFGDIRECTKEY_DEFAULTFRAMELOADER);
+ ::rtl::OUString sDefaultFrameLoader;
+
+ if (
+ (!(aDirectValue >>= sDefaultFrameLoader)) ||
+ (!sDefaultFrameLoader.getLength() )
+ )
+ {
+ sLog.appendAscii("error\t:\t" );
+ sLog.appendAscii("There is no valid default frame loader!?\n");
+ ++nErrors;
+ }
+
+ // a) get list of all well known types
+ // b) step over all well known frame loader services
+ // and remove all types from list a), which already
+ // referenced by a loader b)
+ OUStringList lTypes = getItemNames(E_TYPE);
+ for ( pIt = m_lFrameLoaders.begin();
+ pIt != m_lFrameLoaders.end() ;
+ ++pIt )
+ {
+ // Note: of course the default loader must be ignored here.
+ // Because we replace its registration later completly with all
+ // types, which are not referenced by any other loader.
+ // So we can avaoid our code against the complexity of a diff!
+ ::rtl::OUString sLoader = pIt->first;
+ if (sLoader.equals(sDefaultFrameLoader))
+ continue;
+
+ CacheItem& rLoader = pIt->second;
+ css::uno::Any& rTypesReg = rLoader[PROPNAME_TYPES];
+ OUStringList lTypesReg (rTypesReg);
+
+ for (OUStringList::const_iterator pTypesReg = lTypesReg.begin();
+ pTypesReg != lTypesReg.end() ;
+ ++pTypesReg )
+ {
+ OUStringList::iterator pTypeCheck = ::std::find(lTypes.begin(), lTypes.end(), *pTypesReg);
+ if (pTypeCheck != lTypes.end())
+ lTypes.erase(pTypeCheck);
+ }
+ }
+
+ CacheItem& rDefaultLoader = m_lFrameLoaders[sDefaultFrameLoader];
+ rDefaultLoader[PROPNAME_NAME ] <<= sDefaultFrameLoader;
+ rDefaultLoader[PROPNAME_TYPES] <<= lTypes.getAsConstList();
+
+ ::rtl::OUString sLogOut = sLog.makeStringAndClear();
+ OSL_ENSURE(!nErrors, ::rtl::OUStringToOString(sLogOut,RTL_TEXTENCODING_UTF8).getStr());
+ if (nErrors>0)
+ throw css::document::CorruptedFilterConfigurationException(
+ MESSAGE_CORRUPTED_FILTERCONFIG,
+ css::uno::Reference< css::uno::XInterface >(),
+ sLogOut);
+ OSL_ENSURE(!nWarnings, ::rtl::OUStringToOString(sLogOut,RTL_TEXTENCODING_UTF8).getStr());
+
+ // <- SAFE
+}
+
+/*-----------------------------------------------
+ 20.10.2003 08:15
+-----------------------------------------------*/
+void FilterCache::impl_addItem2FlushList( EItemType eType,
+ const ::rtl::OUString& sItem)
+ throw(css::uno::Exception)
+{
+ OUStringList* pList = 0;
+ switch(eType)
+ {
+ case E_TYPE :
+ pList = &m_lChangedTypes;
+ break;
+
+ case E_FILTER :
+ pList = &m_lChangedFilters;
+ break;
+
+ case E_FRAMELOADER :
+ pList = &m_lChangedFrameLoaders;
+ break;
+
+ case E_CONTENTHANDLER :
+ pList = &m_lChangedContentHandlers;
+ break;
+
+ case E_DETECTSERVICE :
+ pList = &m_lChangedDetectServices;
+ break;
+
+ default : throw css::uno::Exception(::rtl::OUString::createFromAscii("unsupported item type"), 0);
+ }
+
+ OUStringList::const_iterator pItem = ::std::find(pList->begin(), pList->end(), sItem);
+ if (pItem == pList->end())
+ pList->push_back(sItem);
+}
+
+/*-----------------------------------------------
+ 20.10.2003 08:49
+-----------------------------------------------*/
+FilterCache::EItemFlushState FilterCache::impl_specifyFlushOperation(const css::uno::Reference< css::container::XNameAccess >& xSet ,
+ const CacheItemList& rList,
+ const ::rtl::OUString& sItem)
+ throw(css::uno::Exception)
+{
+ sal_Bool bExistsInConfigLayer = xSet->hasByName(sItem);
+ sal_Bool bExistsInMemory = (rList.find(sItem) != rList.end());
+
+ EItemFlushState eState( E_ITEM_UNCHANGED );
+
+ // !? ... such situation can occure, if an item was added and(!) removed before it was flushed :-)
+ if (!bExistsInConfigLayer && !bExistsInMemory)
+ eState = E_ITEM_UNCHANGED;
+ else
+ if (!bExistsInConfigLayer && bExistsInMemory)
+ eState = E_ITEM_ADDED;
+ else
+ if (bExistsInConfigLayer && bExistsInMemory)
+ eState = E_ITEM_CHANGED;
+ else
+ if (bExistsInConfigLayer && !bExistsInMemory)
+ eState = E_ITEM_REMOVED;
+
+ return eState;
+}
+
+/*-----------------------------------------------
+ 14.10.2003 09:26
+-----------------------------------------------*/
+void FilterCache::impl_resolveItem4TypeRegistration( CacheItemList* pList,
+ const ::rtl::OUString& sItem,
+ const ::rtl::OUString& sType)
+ throw(css::uno::Exception)
+{
+ CacheItem& rItem = (*pList)[sItem];
+ // In case its a new created entry (automaticly done by the hash_map index operator!)
+ // we must be shure, that this entry has its own name as property available.
+ // Its needed later at our container interface!
+ rItem[PROPNAME_NAME] <<= sItem;
+
+ OUStringList lTypeRegs(rItem[PROPNAME_TYPES]);
+ if (::std::find(lTypeRegs.begin(), lTypeRegs.end(), sType) == lTypeRegs.end())
+ {
+ lTypeRegs.push_back(sType);
+ rItem[PROPNAME_TYPES] <<= lTypeRegs.getAsConstList();
+ }
+}
+
+/*-----------------------------------------------
+ 28.10.2003 09:18
+-----------------------------------------------*/
+void FilterCache::impl_load(EFillState eRequiredState)
+ throw(css::uno::Exception)
+{
+ // SAFE ->
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+
+ // Attention: Detect services are part of the standard set!
+ // So there is no need to handle it seperatly.
+
+ // ------------------------------------------
+ // a) The standard set of config value is needed.
+ if (
+ ((eRequiredState & E_CONTAINS_STANDARD) == E_CONTAINS_STANDARD) &&
+ ((m_eFillState & E_CONTAINS_STANDARD) != E_CONTAINS_STANDARD)
+ )
+ {
+ // Attention! If config couldnt be opened successfully
+ // and exception os thrown automaticly and must be forwarded
+ // to our calli ...
+ css::uno::Reference< css::container::XNameAccess > xTypes(impl_openConfig(E_PROVIDER_TYPES), css::uno::UNO_QUERY);
+ {
+ RTL_LOGFILE_CONTEXT( aLog, "framework (as96863) ::FilterCache::load std");
+ impl_loadSet(xTypes, E_TYPE, E_READ_STANDARD, &m_lTypes);
+ }
+ }
+
+ // ------------------------------------------
+ // b) We need all type informations ...
+ if (
+ ((eRequiredState & E_CONTAINS_TYPES) == E_CONTAINS_TYPES) &&
+ ((m_eFillState & E_CONTAINS_TYPES) != E_CONTAINS_TYPES)
+ )
+ {
+ // Attention! If config couldnt be opened successfully
+ // and exception os thrown automaticly and must be forwarded
+ // to our calli ...
+ css::uno::Reference< css::container::XNameAccess > xTypes(impl_openConfig(E_PROVIDER_TYPES), css::uno::UNO_QUERY);
+ {
+ RTL_LOGFILE_CONTEXT( aLog, "framework (as96863) ::FilterCache::load all types");
+ impl_loadSet(xTypes, E_TYPE, E_READ_UPDATE, &m_lTypes);
+ }
+ }
+
+ // ------------------------------------------
+ // c) We need all filter informations ...
+ if (
+ ((eRequiredState & E_CONTAINS_FILTERS) == E_CONTAINS_FILTERS) &&
+ ((m_eFillState & E_CONTAINS_FILTERS) != E_CONTAINS_FILTERS)
+ )
+ {
+ // Attention! If config couldnt be opened successfully
+ // and exception os thrown automaticly and must be forwarded
+ // to our calli ...
+ css::uno::Reference< css::container::XNameAccess > xFilters(impl_openConfig(E_PROVIDER_FILTERS), css::uno::UNO_QUERY);
+ {
+ RTL_LOGFILE_CONTEXT( aLog, "framework (as96863) ::FilterCache::load all filters");
+ impl_loadSet(xFilters, E_FILTER, E_READ_ALL, &m_lFilters);
+ }
+ }
+
+ // ------------------------------------------
+ // c) We need all frame loader informations ...
+ if (
+ ((eRequiredState & E_CONTAINS_FRAMELOADERS) == E_CONTAINS_FRAMELOADERS) &&
+ ((m_eFillState & E_CONTAINS_FRAMELOADERS) != E_CONTAINS_FRAMELOADERS)
+ )
+ {
+ // Attention! If config couldnt be opened successfully
+ // and exception os thrown automaticly and must be forwarded
+ // to our calli ...
+ css::uno::Reference< css::container::XNameAccess > xLoaders(impl_openConfig(E_PROVIDER_OTHERS), css::uno::UNO_QUERY);
+ {
+ RTL_LOGFILE_CONTEXT( aLog, "framework (as96863) ::FilterCache::load all frame loader");
+ impl_loadSet(xLoaders, E_FRAMELOADER, E_READ_ALL, &m_lFrameLoaders);
+ }
+ }
+
+ // ------------------------------------------
+ // d) We need all content handler informations ...
+ if (
+ ((eRequiredState & E_CONTAINS_CONTENTHANDLERS) == E_CONTAINS_CONTENTHANDLERS) &&
+ ((m_eFillState & E_CONTAINS_CONTENTHANDLERS) != E_CONTAINS_CONTENTHANDLERS)
+ )
+ {
+ // Attention! If config couldnt be opened successfully
+ // and exception os thrown automaticly and must be forwarded
+ // to our calli ...
+ css::uno::Reference< css::container::XNameAccess > xHandlers(impl_openConfig(E_PROVIDER_OTHERS), css::uno::UNO_QUERY);
+ {
+ RTL_LOGFILE_CONTEXT( aLog, "framework (as96863) ::FilterCache::load all content handler");
+ impl_loadSet(xHandlers, E_CONTENTHANDLER, E_READ_ALL, &m_lContentHandlers);
+ }
+ }
+
+ // update fill state. Note: its a bit field, which combines different parts.
+ m_eFillState = (EFillState) ((sal_Int32)m_eFillState | (sal_Int32)eRequiredState);
+
+ // any data readed?
+ // yes! => validate it and update optimized structures.
+ impl_validateAndOptimize();
+
+ // <- SAFE
+}
+
+/*-----------------------------------------------
+ 22.09.2003 14:27
+-----------------------------------------------*/
+void FilterCache::impl_loadSet(const css::uno::Reference< css::container::XNameAccess >& xConfig,
+ EItemType eType ,
+ EReadOption eOption,
+ CacheItemList* pCache )
+ throw(css::uno::Exception)
+{
+ // get access to the right configuration set
+ ::rtl::OUString sSetName;
+ switch(eType)
+ {
+ case E_TYPE :
+ sSetName = CFGSET_TYPES;
+ break;
+
+ case E_FILTER :
+ sSetName = CFGSET_FILTERS;
+ break;
+
+ case E_FRAMELOADER :
+ sSetName = CFGSET_FRAMELOADERS;
+ break;
+
+ case E_CONTENTHANDLER :
+ sSetName = CFGSET_CONTENTHANDLERS;
+ break;
+ default: break;
+ }
+
+ css::uno::Reference< css::container::XNameAccess > xSet;
+ css::uno::Sequence< ::rtl::OUString > lItems;
+
+ try
+ {
+ css::uno::Any aVal = xConfig->getByName(sSetName);
+ if (!(aVal >>= xSet) || !xSet.is())
+ {
+ ::rtl::OUStringBuffer sMsg(256);
+ sMsg.appendAscii("Could not open configuration set \"");
+ sMsg.append (sSetName );
+ sMsg.appendAscii("\"." );
+ throw css::uno::Exception(
+ sMsg.makeStringAndClear(),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ lItems = xSet->getElementNames();
+ }
+ catch(const css::uno::Exception& ex)
+ {
+ throw css::document::CorruptedFilterConfigurationException(
+ MESSAGE_CORRUPTED_FILTERCONFIG,
+ css::uno::Reference< css::uno::XInterface >(),
+ ex.Message);
+ }
+
+ // get names of all existing sub items of this set
+ // step over it and fill internal cache structures.
+
+ // But dont update optimized structures like e.g. hash
+ // for mapping extensions to its types!
+
+ const ::rtl::OUString* pItems = lItems.getConstArray();
+ sal_Int32 c = lItems.getLength();
+ for (sal_Int32 i=0; i<c; ++i)
+ {
+ CacheItemList::iterator pItem = pCache->find(pItems[i]);
+ switch(eOption)
+ {
+ // a) read a standard set of properties only or read all
+ case E_READ_STANDARD :
+ case E_READ_ALL :
+ {
+ try
+ {
+ (*pCache)[pItems[i]] = impl_loadItem(xSet, eType, pItems[i], eOption);
+ }
+ catch(const css::uno::Exception& ex)
+ {
+ throw css::document::CorruptedFilterConfigurationException(
+ MESSAGE_CORRUPTED_FILTERCONFIG,
+ css::uno::Reference< css::uno::XInterface >(),
+ ex.Message);
+ }
+ }
+ break;
+
+ // b) read optional properties only!
+ // All items must already exist inside our cache.
+ // But they must be updated.
+ case E_READ_UPDATE :
+ {
+ if (pItem == pCache->end())
+ {
+ ::rtl::OUStringBuffer sMsg(256);
+ sMsg.appendAscii("item \"" );
+ sMsg.append (pItems[i] );
+ sMsg.appendAscii("\" not found for update!");
+ throw css::uno::Exception(sMsg.makeStringAndClear() ,
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ try
+ {
+ CacheItem aItem = impl_loadItem(xSet, eType, pItems[i], eOption);
+ pItem->second.update(aItem);
+ }
+ catch(const css::uno::Exception& ex)
+ {
+ throw css::document::CorruptedFilterConfigurationException(
+ MESSAGE_CORRUPTED_FILTERCONFIG,
+ css::uno::Reference< css::uno::XInterface >(),
+ ex.Message);
+ }
+ }
+ break;
+ default: break;
+ }
+ }
+}
+
+/*-----------------------------------------------
+ 26.11.2003 12:49
+-----------------------------------------------*/
+void FilterCache::impl_readPatchUINames(const css::uno::Reference< css::container::XNameAccess >& xNode,
+ CacheItem& rItem)
+ throw(css::uno::Exception)
+{
+ static ::rtl::OUString FORMATNAME_VAR = ::rtl::OUString::createFromAscii("%productname%" );
+ static ::rtl::OUString FORMATVERSION_VAR = ::rtl::OUString::createFromAscii("%formatversion%");
+
+ // SAFE -> ----------------------------------
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+ ::rtl::OUString sFormatName = m_sFormatName ;
+ ::rtl::OUString sFormatVersion = m_sFormatVersion;
+ ::rtl::OUString sActLocale = m_sActLocale ;
+ aLock.clear();
+ // <- SAFE ----------------------------------
+
+ css::uno::Any aVal = xNode->getByName(PROPNAME_UINAME);
+ css::uno::Reference< css::container::XNameAccess > xUIName;
+ if (!(aVal >>= xUIName) && !xUIName.is())
+ return;
+
+ const ::comphelper::SequenceAsVector< ::rtl::OUString > lLocales(xUIName->getElementNames());
+ ::comphelper::SequenceAsVector< ::rtl::OUString >::const_iterator pLocale ;
+ ::comphelper::SequenceAsHashMap lUINames;
+
+ // patch %PRODUCTNAME and %FORMATNAME
+ for ( pLocale = lLocales.begin();
+ pLocale != lLocales.end() ;
+ ++pLocale )
+ {
+ const ::rtl::OUString& sLocale = *pLocale;
+
+ ::rtl::OUString sValue;
+ xUIName->getByName(sLocale) >>= sValue;
+
+ // replace %productname%
+ sal_Int32 nIndex = sValue.indexOf(FORMATNAME_VAR);
+ while(nIndex != -1)
+ {
+ sValue = sValue.replaceAt(nIndex, FORMATNAME_VAR.getLength(), sFormatName);
+ nIndex = sValue.indexOf(FORMATNAME_VAR, nIndex);
+ }
+ // replace %formatversion%
+ nIndex = sValue.indexOf(FORMATVERSION_VAR);
+ while(nIndex != -1)
+ {
+ sValue = sValue.replaceAt(nIndex, FORMATVERSION_VAR.getLength(), sFormatVersion);
+ nIndex = sValue.indexOf(FORMATVERSION_VAR, nIndex);
+ }
+
+ lUINames[sLocale] <<= sValue;
+ }
+
+ aVal <<= lUINames.getAsConstPropertyValueList();
+ rItem[PROPNAME_UINAMES] = aVal;
+
+ // find right UIName for current office locale
+ // Use fallbacks too!
+ pLocale = ::comphelper::Locale::getFallback(lLocales, sActLocale);
+ if (pLocale == lLocales.end())
+ {
+ #if OSL_DEBUG_LEVEL > 0
+ ::rtl::OUString sName = rItem.getUnpackedValueOrDefault(PROPNAME_NAME, ::rtl::OUString());
+
+ ::rtl::OUStringBuffer sMsg(256);
+ sMsg.appendAscii("Fallback scenario for filter or type '" );
+ sMsg.append (sName );
+ sMsg.appendAscii("' and locale '" );
+ sMsg.append (sActLocale );
+ sMsg.appendAscii("' failed. Please check your filter configuration.");
+
+ OSL_ENSURE(sal_False, _FILTER_CONFIG_TO_ASCII_(sMsg.makeStringAndClear()));
+ #endif
+ return;
+ }
+
+ const ::rtl::OUString& sLocale = *pLocale;
+ ::comphelper::SequenceAsHashMap::const_iterator pUIName = lUINames.find(sLocale);
+ if (pUIName != lUINames.end())
+ rItem[PROPNAME_UINAME] = pUIName->second;
+}
+
+/*-----------------------------------------------
+ 26.11.2003 12:56
+-----------------------------------------------*/
+void FilterCache::impl_savePatchUINames(const css::uno::Reference< css::container::XNameReplace >& xNode,
+ const CacheItem& rItem)
+ throw(css::uno::Exception)
+{
+ css::uno::Reference< css::container::XNameContainer > xAdd (xNode, css::uno::UNO_QUERY);
+ css::uno::Reference< css::container::XNameAccess > xCheck(xNode, css::uno::UNO_QUERY);
+
+ css::uno::Sequence< css::beans::PropertyValue > lUINames = rItem.getUnpackedValueOrDefault(PROPNAME_UINAMES, css::uno::Sequence< css::beans::PropertyValue >());
+ sal_Int32 c = lUINames.getLength();
+ const css::beans::PropertyValue* pUINames = lUINames.getConstArray();
+
+ for (sal_Int32 i=0; i<c; ++i)
+ {
+ if (xCheck->hasByName(pUINames[i].Name))
+ xNode->replaceByName(pUINames[i].Name, pUINames[i].Value);
+ else
+ xAdd->insertByName(pUINames[i].Name, pUINames[i].Value);
+ }
+}
+
+/*-----------------------------------------------
+ 29.10.2003 13:17
+ TODO
+ clarify, how the real problem behind the
+ wrong constructed CacheItem instance (which
+ will force a crash during destruction)
+ can be solved ...
+-----------------------------------------------*/
+CacheItem FilterCache::impl_loadItem(const css::uno::Reference< css::container::XNameAccess >& xSet ,
+ EItemType eType ,
+ const ::rtl::OUString& sItem ,
+ EReadOption eOption)
+ throw(css::uno::Exception)
+{
+ // try to get an API object, which points directly to the
+ // requested item. If it fail an exception should occure and
+ // break this operation. Of course returned API object must be
+ // checked too.
+ css::uno::Reference< css::container::XNameAccess > xItem;
+ #ifdef WORKAROUND_EXCEPTION_PROBLEM
+ try
+ {
+ #endif
+ css::uno::Any aVal = xSet->getByName(sItem);
+ if (!(aVal >>= xItem) || !xItem.is())
+ {
+ ::rtl::OUStringBuffer sMsg(256);
+ sMsg.appendAscii("found corrupted item \"");
+ sMsg.append (sItem );
+ sMsg.appendAscii("\"." );
+ throw css::uno::Exception(sMsg.makeStringAndClear() ,
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ #ifdef WORKAROUND_EXCEPTION_PROBLEM
+ }
+ catch(const css::container::NoSuchElementException&)
+ {
+ throw;
+ }
+ #endif
+
+ // The internal name of an item must(!) be part of the property
+ // set too. Of course its already used as key into the e.g. outside
+ // used hash map ... but some of our API methods provide
+ // this property set as result only. But the user of this CacheItem
+ // should know, which value the key names has :-) ITS IMPORTANT!
+ CacheItem aItem;
+ aItem[PROPNAME_NAME] = css::uno::makeAny(sItem);
+ switch(eType)
+ {
+ //---------------------------------------
+ case E_TYPE :
+ {
+ // read standard properties of a type
+ if (
+ (eOption == E_READ_STANDARD) ||
+ (eOption == E_READ_ALL )
+ )
+ {
+ aItem[PROPNAME_PREFERREDFILTER] = xItem->getByName(PROPNAME_PREFERREDFILTER);
+ aItem[PROPNAME_DETECTSERVICE ] = xItem->getByName(PROPNAME_DETECTSERVICE );
+ aItem[PROPNAME_URLPATTERN ] = xItem->getByName(PROPNAME_URLPATTERN );
+ aItem[PROPNAME_EXTENSIONS ] = xItem->getByName(PROPNAME_EXTENSIONS );
+ aItem[PROPNAME_PREFERRED ] = xItem->getByName(PROPNAME_PREFERRED );
+ aItem[PROPNAME_CLIPBOARDFORMAT] = xItem->getByName(PROPNAME_CLIPBOARDFORMAT);
+ }
+ // read optional properties of a type
+ // no else here! Is an additional switch ...
+ if (
+ (eOption == E_READ_UPDATE) ||
+ (eOption == E_READ_ALL )
+ )
+ {
+ aItem[PROPNAME_MEDIATYPE ] = xItem->getByName(PROPNAME_MEDIATYPE );
+ impl_readPatchUINames(xItem, aItem);
+ }
+ }
+ break;
+
+ //---------------------------------------
+ case E_FILTER :
+ {
+ // read standard properties of a filter
+ if (
+ (eOption == E_READ_STANDARD) ||
+ (eOption == E_READ_ALL )
+ )
+ {
+ aItem[PROPNAME_TYPE ] = xItem->getByName(PROPNAME_TYPE );
+ aItem[PROPNAME_FILEFORMATVERSION] = xItem->getByName(PROPNAME_FILEFORMATVERSION);
+ aItem[PROPNAME_UICOMPONENT ] = xItem->getByName(PROPNAME_UICOMPONENT );
+ aItem[PROPNAME_FILTERSERVICE ] = xItem->getByName(PROPNAME_FILTERSERVICE );
+ aItem[PROPNAME_DOCUMENTSERVICE ] = xItem->getByName(PROPNAME_DOCUMENTSERVICE );
+
+ // special handling for flags! Convert it from a list of names to its
+ // int representation ...
+ css::uno::Sequence< ::rtl::OUString > lFlagNames;
+ if (xItem->getByName(PROPNAME_FLAGS) >>= lFlagNames)
+ aItem[PROPNAME_FLAGS] <<= FilterCache::impl_convertFlagNames2FlagField(lFlagNames);
+ }
+ // read optional properties of a filter
+ // no else here! Is an additional switch ...
+ if (
+ (eOption == E_READ_UPDATE) ||
+ (eOption == E_READ_ALL )
+ )
+ {
+ aItem[PROPNAME_USERDATA ] = xItem->getByName(PROPNAME_USERDATA );
+ aItem[PROPNAME_TEMPLATENAME] = xItem->getByName(PROPNAME_TEMPLATENAME);
+//TODO remove it if moving of filter uinames to type uinames
+// will be finished realy
+#ifdef AS_ENABLE_FILTER_UINAMES
+ impl_readPatchUINames(xItem, aItem);
+#endif // AS_ENABLE_FILTER_UINAMES
+ }
+ }
+ break;
+
+ //---------------------------------------
+ case E_FRAMELOADER :
+ case E_CONTENTHANDLER :
+ {
+ aItem[PROPNAME_TYPES] = xItem->getByName(PROPNAME_TYPES);
+ }
+ break;
+ default: break;
+ }
+
+ return aItem;
+}
+
+/*-----------------------------------------------
+ 27.10.2003 08:47
+-----------------------------------------------*/
+CacheItemList::iterator FilterCache::impl_loadItemOnDemand( EItemType eType,
+ const ::rtl::OUString& sItem)
+ throw(css::uno::Exception)
+{
+ CacheItemList* pList = 0;
+ css::uno::Reference< css::uno::XInterface > xConfig ;
+ ::rtl::OUString sSet ;
+
+ switch(eType)
+ {
+ case E_TYPE :
+ {
+ pList = &m_lTypes;
+ xConfig = impl_openConfig(E_PROVIDER_TYPES);
+ sSet = CFGSET_TYPES;
+ }
+ break;
+
+ case E_FILTER :
+ {
+ pList = &m_lFilters;
+ xConfig = impl_openConfig(E_PROVIDER_FILTERS);
+ sSet = CFGSET_FILTERS;
+ }
+ break;
+
+ case E_FRAMELOADER :
+ {
+ pList = &m_lFrameLoaders;
+ xConfig = impl_openConfig(E_PROVIDER_OTHERS);
+ sSet = CFGSET_FRAMELOADERS;
+ }
+ break;
+
+ case E_CONTENTHANDLER :
+ {
+ pList = &m_lContentHandlers;
+ xConfig = impl_openConfig(E_PROVIDER_OTHERS);
+ sSet = CFGSET_CONTENTHANDLERS;
+ }
+ break;
+
+ case E_DETECTSERVICE :
+ {
+ OSL_ENSURE(sal_False, "Cant load detect services on demand. Who use this unsupported feature?");
+ }
+ break;
+ }
+
+ css::uno::Reference< css::container::XNameAccess > xRoot(xConfig, css::uno::UNO_QUERY_THROW);
+ css::uno::Reference< css::container::XNameAccess > xSet ;
+ xRoot->getByName(sSet) >>= xSet;
+
+ CacheItemList::iterator pItemInCache = pList->find(sItem);
+ sal_Bool bItemInConfig = xSet->hasByName(sItem);
+
+ if (bItemInConfig)
+ {
+ CacheItem aItem;
+ CacheItem::iterator pDbgTest = aItem.find(PROPNAME_NAME);
+ aItem = impl_loadItem(xSet, eType, sItem, E_READ_ALL);
+ (*pList)[sItem] = aItem;
+ _FILTER_CONFIG_LOG_2_("impl_loadItemOnDemand(%d, \"%s\") ... OK", (int)eType, _FILTER_CONFIG_TO_ASCII_(sItem).getStr())
+ }
+ else
+ {
+ if (pItemInCache != pList->end())
+ pList->erase(pItemInCache);
+ // OK - this item does not exists inside configuration.
+ // And we already updated our internal cache.
+ // But the outside code needs this NoSuchElementException
+ // to know, that this item does notexists.
+ // Nobody checks the iterator!
+ throw css::container::NoSuchElementException();
+ }
+
+ return pList->find(sItem);
+}
+
+/*-----------------------------------------------
+ 20.10.2003 09:38
+-----------------------------------------------*/
+void FilterCache::impl_saveItem(const css::uno::Reference< css::container::XNameReplace >& xItem,
+ EItemType eType,
+ const CacheItem& aItem)
+ throw(css::uno::Exception)
+{
+ CacheItem::const_iterator pIt;
+ switch(eType)
+ {
+ //---------------------------------------
+ case E_TYPE :
+ {
+ pIt = aItem.find(PROPNAME_PREFERREDFILTER);
+ if (pIt != aItem.end())
+ xItem->replaceByName(PROPNAME_PREFERREDFILTER, pIt->second);
+ pIt = aItem.find(PROPNAME_DETECTSERVICE);
+ if (pIt != aItem.end())
+ xItem->replaceByName(PROPNAME_DETECTSERVICE, pIt->second);
+ pIt = aItem.find(PROPNAME_URLPATTERN);
+ if (pIt != aItem.end())
+ xItem->replaceByName(PROPNAME_URLPATTERN, pIt->second);
+ pIt = aItem.find(PROPNAME_EXTENSIONS);
+ if (pIt != aItem.end())
+ xItem->replaceByName(PROPNAME_EXTENSIONS, pIt->second);
+ pIt = aItem.find(PROPNAME_PREFERRED);
+ if (pIt != aItem.end())
+ xItem->replaceByName(PROPNAME_PREFERRED, pIt->second);
+ pIt = aItem.find(PROPNAME_MEDIATYPE);
+ if (pIt != aItem.end())
+ xItem->replaceByName(PROPNAME_MEDIATYPE, pIt->second);
+ pIt = aItem.find(PROPNAME_CLIPBOARDFORMAT);
+ if (pIt != aItem.end())
+ xItem->replaceByName(PROPNAME_CLIPBOARDFORMAT, pIt->second);
+
+ css::uno::Reference< css::container::XNameReplace > xUIName;
+ xItem->getByName(PROPNAME_UINAME) >>= xUIName;
+ impl_savePatchUINames(xUIName, aItem);
+ }
+ break;
+
+ //---------------------------------------
+ case E_FILTER :
+ {
+ pIt = aItem.find(PROPNAME_TYPE);
+ if (pIt != aItem.end())
+ xItem->replaceByName(PROPNAME_TYPE, pIt->second);
+ pIt = aItem.find(PROPNAME_FILEFORMATVERSION);
+ if (pIt != aItem.end())
+ xItem->replaceByName(PROPNAME_FILEFORMATVERSION, pIt->second);
+ pIt = aItem.find(PROPNAME_UICOMPONENT);
+ if (pIt != aItem.end())
+ xItem->replaceByName(PROPNAME_UICOMPONENT, pIt->second);
+ pIt = aItem.find(PROPNAME_FILTERSERVICE);
+ if (pIt != aItem.end())
+ xItem->replaceByName(PROPNAME_FILTERSERVICE, pIt->second);
+ pIt = aItem.find(PROPNAME_DOCUMENTSERVICE);
+ if (pIt != aItem.end())
+ xItem->replaceByName(PROPNAME_DOCUMENTSERVICE, pIt->second);
+ pIt = aItem.find(PROPNAME_USERDATA);
+ if (pIt != aItem.end())
+ xItem->replaceByName(PROPNAME_USERDATA, pIt->second);
+ pIt = aItem.find(PROPNAME_TEMPLATENAME);
+ if (pIt != aItem.end())
+ xItem->replaceByName(PROPNAME_TEMPLATENAME, pIt->second);
+
+ // special handling for flags! Convert it from an integer flag field back
+ // to a list of names ...
+ // But note: because we work directly on a reference to the cache item,
+ // its not allowd to change the value here. We must work on a copy!
+ sal_Int32 nFlags = 0;
+ pIt = aItem.find(PROPNAME_FLAGS);
+ if (pIt != aItem.end())
+ {
+ pIt->second >>= nFlags;
+ css::uno::Any aFlagNameList;
+ aFlagNameList <<= FilterCache::impl_convertFlagField2FlagNames(nFlags);
+ xItem->replaceByName(PROPNAME_FLAGS, aFlagNameList);
+ }
+
+//TODO remove it if moving of filter uinames to type uinames
+// will be finished realy
+#ifdef AS_ENABLE_FILTER_UINAMES
+ css::uno::Reference< css::container::XNameReplace > xUIName;
+ xItem->getByName(PROPNAME_UINAME) >>= xUIName;
+ impl_savePatchUINames(xUIName, aItem);
+#endif // AS_ENABLE_FILTER_UINAMES
+ }
+ break;
+
+ //---------------------------------------
+ case E_FRAMELOADER :
+ case E_CONTENTHANDLER :
+ {
+ pIt = aItem.find(PROPNAME_TYPES);
+ if (pIt != aItem.end())
+ xItem->replaceByName(PROPNAME_TYPES, pIt->second);
+ }
+ break;
+ default: break;
+ }
+}
+
+/*-----------------------------------------------
+ 20.10.2003 09:45
+ static! => no locks neccessary
+-----------------------------------------------*/
+css::uno::Sequence< ::rtl::OUString > FilterCache::impl_convertFlagField2FlagNames(sal_Int32 nFlags)
+{
+ OUStringList lFlagNames;
+
+ if ((nFlags & FLAGVAL_3RDPARTYFILTER ) == FLAGVAL_3RDPARTYFILTER ) lFlagNames.push_back(FLAGNAME_3RDPARTYFILTER );
+ if ((nFlags & FLAGVAL_ALIEN ) == FLAGVAL_ALIEN ) lFlagNames.push_back(FLAGNAME_ALIEN );
+ if ((nFlags & FLAGVAL_ASYNCHRON ) == FLAGVAL_ASYNCHRON ) lFlagNames.push_back(FLAGNAME_ASYNCHRON );
+ if ((nFlags & FLAGVAL_BROWSERPREFERRED ) == FLAGVAL_BROWSERPREFERRED ) lFlagNames.push_back(FLAGNAME_BROWSERPREFERRED );
+ if ((nFlags & FLAGVAL_CONSULTSERVICE ) == FLAGVAL_CONSULTSERVICE ) lFlagNames.push_back(FLAGNAME_CONSULTSERVICE );
+ if ((nFlags & FLAGVAL_DEFAULT ) == FLAGVAL_DEFAULT ) lFlagNames.push_back(FLAGNAME_DEFAULT );
+ if ((nFlags & FLAGVAL_ENCRYPTION ) == FLAGVAL_ENCRYPTION ) lFlagNames.push_back(FLAGNAME_ENCRYPTION );
+ if ((nFlags & FLAGVAL_EXPORT ) == FLAGVAL_EXPORT ) lFlagNames.push_back(FLAGNAME_EXPORT );
+ if ((nFlags & FLAGVAL_IMPORT ) == FLAGVAL_IMPORT ) lFlagNames.push_back(FLAGNAME_IMPORT );
+ if ((nFlags & FLAGVAL_INTERNAL ) == FLAGVAL_INTERNAL ) lFlagNames.push_back(FLAGNAME_INTERNAL );
+ if ((nFlags & FLAGVAL_NOTINCHOOSER ) == FLAGVAL_NOTINCHOOSER ) lFlagNames.push_back(FLAGNAME_NOTINCHOOSER );
+ if ((nFlags & FLAGVAL_NOTINFILEDIALOG ) == FLAGVAL_NOTINFILEDIALOG ) lFlagNames.push_back(FLAGNAME_NOTINFILEDIALOG );
+ if ((nFlags & FLAGVAL_NOTINSTALLED ) == FLAGVAL_NOTINSTALLED ) lFlagNames.push_back(FLAGNAME_NOTINSTALLED );
+ if ((nFlags & FLAGVAL_OWN ) == FLAGVAL_OWN ) lFlagNames.push_back(FLAGNAME_OWN );
+ if ((nFlags & FLAGVAL_PACKED ) == FLAGVAL_PACKED ) lFlagNames.push_back(FLAGNAME_PACKED );
+ if ((nFlags & FLAGVAL_PASSWORDTOMODIFY ) == FLAGVAL_PASSWORDTOMODIFY ) lFlagNames.push_back(FLAGNAME_PASSWORDTOMODIFY );
+ if ((nFlags & FLAGVAL_PREFERRED ) == FLAGVAL_PREFERRED ) lFlagNames.push_back(FLAGNAME_PREFERRED );
+ if ((nFlags & FLAGVAL_READONLY ) == FLAGVAL_READONLY ) lFlagNames.push_back(FLAGNAME_READONLY );
+ if ((nFlags & FLAGVAL_SILENTEXPORT ) == FLAGVAL_SILENTEXPORT ) lFlagNames.push_back(FLAGNAME_SILENTEXPORT );
+ if ((nFlags & FLAGVAL_SUPPORTSSELECTION) == FLAGVAL_SUPPORTSSELECTION) lFlagNames.push_back(FLAGNAME_SUPPORTSSELECTION);
+ if ((nFlags & FLAGVAL_TEMPLATE ) == FLAGVAL_TEMPLATE ) lFlagNames.push_back(FLAGNAME_TEMPLATE );
+ if ((nFlags & FLAGVAL_TEMPLATEPATH ) == FLAGVAL_TEMPLATEPATH ) lFlagNames.push_back(FLAGNAME_TEMPLATEPATH );
+ if ((nFlags & FLAGVAL_USESOPTIONS ) == FLAGVAL_USESOPTIONS ) lFlagNames.push_back(FLAGNAME_USESOPTIONS );
+ if ((nFlags & FLAGVAL_COMBINED ) == FLAGVAL_COMBINED ) lFlagNames.push_back(FLAGNAME_COMBINED );
+
+ return lFlagNames.getAsConstList();
+}
+
+/*-----------------------------------------------
+ 27.06.2003 09:26
+ static! => no locks neccessary
+-----------------------------------------------*/
+sal_Int32 FilterCache::impl_convertFlagNames2FlagField(const css::uno::Sequence< ::rtl::OUString >& lNames)
+{
+ sal_Int32 nField = 0;
+
+ const ::rtl::OUString* pNames = lNames.getConstArray();
+ sal_Int32 c = lNames.getLength();
+ for (sal_Int32 i=0; i<c; ++i)
+ {
+ if (pNames[i].equals(FLAGNAME_3RDPARTYFILTER))
+ {
+ nField |= FLAGVAL_3RDPARTYFILTER;
+ continue;
+ }
+ if (pNames[i].equals(FLAGNAME_ALIEN))
+ {
+ nField |= FLAGVAL_ALIEN;
+ continue;
+ }
+ if (pNames[i].equals(FLAGNAME_ASYNCHRON))
+ {
+ nField |= FLAGVAL_ASYNCHRON;
+ continue;
+ }
+ if (pNames[i].equals(FLAGNAME_BROWSERPREFERRED))
+ {
+ nField |= FLAGVAL_BROWSERPREFERRED;
+ continue;
+ }
+ if (pNames[i].equals(FLAGNAME_CONSULTSERVICE))
+ {
+ nField |= FLAGVAL_CONSULTSERVICE;
+ continue;
+ }
+ if (pNames[i].equals(FLAGNAME_DEFAULT))
+ {
+ nField |= FLAGVAL_DEFAULT;
+ continue;
+ }
+ if (pNames[i].equals(FLAGNAME_ENCRYPTION))
+ {
+ nField |= FLAGVAL_ENCRYPTION;
+ continue;
+ }
+ if (pNames[i].equals(FLAGNAME_EXPORT))
+ {
+ nField |= FLAGVAL_EXPORT;
+ continue;
+ }
+ if (pNames[i].equals(FLAGNAME_IMPORT))
+ {
+ nField |= FLAGVAL_IMPORT;
+ continue;
+ }
+ if (pNames[i].equals(FLAGNAME_INTERNAL))
+ {
+ nField |= FLAGVAL_INTERNAL;
+ continue;
+ }
+ if (pNames[i].equals(FLAGNAME_NOTINCHOOSER))
+ {
+ nField |= FLAGVAL_NOTINCHOOSER;
+ continue;
+ }
+ if (pNames[i].equals(FLAGNAME_NOTINFILEDIALOG))
+ {
+ nField |= FLAGVAL_NOTINFILEDIALOG;
+ continue;
+ }
+ if (pNames[i].equals(FLAGNAME_NOTINSTALLED))
+ {
+ nField |= FLAGVAL_NOTINSTALLED;
+ continue;
+ }
+ if (pNames[i].equals(FLAGNAME_OWN))
+ {
+ nField |= FLAGVAL_OWN;
+ continue;
+ }
+ if (pNames[i].equals(FLAGNAME_PACKED))
+ {
+ nField |= FLAGVAL_PACKED;
+ continue;
+ }
+ if (pNames[i].equals(FLAGNAME_PASSWORDTOMODIFY))
+ {
+ nField |= FLAGVAL_PASSWORDTOMODIFY;
+ continue;
+ }
+ if (pNames[i].equals(FLAGNAME_PREFERRED))
+ {
+ nField |= FLAGVAL_PREFERRED;
+ continue;
+ }
+ if (pNames[i].equals(FLAGNAME_READONLY))
+ {
+ nField |= FLAGVAL_READONLY;
+ continue;
+ }
+ if (pNames[i].equals(FLAGNAME_SILENTEXPORT))
+ {
+ nField |= FLAGVAL_SILENTEXPORT;
+ continue;
+ }
+ if (pNames[i].equals(FLAGNAME_SUPPORTSSELECTION))
+ {
+ nField |= FLAGVAL_SUPPORTSSELECTION;
+ continue;
+ }
+ if (pNames[i].equals(FLAGNAME_TEMPLATE))
+ {
+ nField |= FLAGVAL_TEMPLATE;
+ continue;
+ }
+ if (pNames[i].equals(FLAGNAME_TEMPLATEPATH))
+ {
+ nField |= FLAGVAL_TEMPLATEPATH;
+ continue;
+ }
+ if (pNames[i].equals(FLAGNAME_USESOPTIONS))
+ {
+ nField |= FLAGVAL_USESOPTIONS;
+ continue;
+ }
+ if (pNames[i].equals(FLAGNAME_COMBINED))
+ {
+ nField |= FLAGVAL_COMBINED;
+ continue;
+ }
+ }
+
+ return nField;
+}
+
+/*-----------------------------------------------
+ 12.02.2004 08:40
+-----------------------------------------------*/
+void FilterCache::impl_interpretDataVal4Type(const ::rtl::OUString& sValue,
+ sal_Int32 nProp ,
+ CacheItem& rItem )
+{
+ switch(nProp)
+ {
+ // Preferred
+ case 0: {
+ if (sValue.toInt32() == 1)
+ rItem[PROPNAME_PREFERRED] = css::uno::makeAny(sal_True);
+ else
+ rItem[PROPNAME_PREFERRED] = css::uno::makeAny(sal_False);
+ }
+ break;
+ // MediaType
+ case 1: rItem[PROPNAME_MEDIATYPE] <<= ::rtl::Uri::decode(sValue, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8);
+ break;
+ // ClipboardFormat
+ case 2: rItem[PROPNAME_CLIPBOARDFORMAT] <<= ::rtl::Uri::decode(sValue, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8);
+ break;
+ // URLPattern
+ case 3: rItem[PROPNAME_URLPATTERN] <<= impl_tokenizeString(sValue, (sal_Unicode)';').getAsConstList();
+ break;
+ // Extensions
+ case 4: rItem[PROPNAME_EXTENSIONS] <<= impl_tokenizeString(sValue, (sal_Unicode)';').getAsConstList();
+ break;
+ }
+}
+
+/*-----------------------------------------------
+ 12.02.2004 08:50
+-----------------------------------------------*/
+void FilterCache::impl_interpretDataVal4Filter(const ::rtl::OUString& sValue,
+ sal_Int32 nProp ,
+ CacheItem& rItem )
+{
+ switch(nProp)
+ {
+ // Order
+ case 0: {
+ sal_Int32 nOrder = sValue.toInt32();
+ if (nOrder > 0)
+ {
+ OSL_ENSURE(sal_False, "FilterCache::impl_interpretDataVal4Filter()\nCant move Order value from filter to type on demand!\n");
+ _FILTER_CONFIG_LOG_2_("impl_interpretDataVal4Filter(%d, \"%s\") ... OK", (int)eType, _FILTER_CONFIG_TO_ASCII_(rItem).getStr())
+ }
+ }
+ break;
+ // Type
+ case 1: rItem[PROPNAME_TYPE] <<= ::rtl::Uri::decode(sValue, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8);
+ break;
+ // DocumentService
+ case 2: rItem[PROPNAME_DOCUMENTSERVICE] <<= ::rtl::Uri::decode(sValue, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8);
+ break;
+ // FilterService
+ case 3: rItem[PROPNAME_FILTERSERVICE] <<= ::rtl::Uri::decode(sValue, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8);
+ break;
+ // Flags
+ case 4: rItem[PROPNAME_FLAGS] <<= sValue.toInt32();
+ break;
+ // UserData
+ case 5: rItem[PROPNAME_USERDATA] <<= impl_tokenizeString(sValue, (sal_Unicode)';').getAsConstList();
+ break;
+ // FileFormatVersion
+ case 6: rItem[PROPNAME_FILEFORMATVERSION] <<= sValue.toInt32();
+ break;
+ // TemplateName
+ case 7: rItem[PROPNAME_TEMPLATENAME] <<= ::rtl::Uri::decode(sValue, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8);
+ break;
+ // [optional!] UIComponent
+ case 8: rItem[PROPNAME_UICOMPONENT] <<= ::rtl::Uri::decode(sValue, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8);
+ break;
+ }
+}
+
+/*-----------------------------------------------
+ 12.02.2004 08:30
+ TODO work on a cache copy first, which can be flushed afterwards
+ That would be usefully to gurantee a consistent cache.
+-----------------------------------------------*/
+void FilterCache::impl_readOldFormat()
+ throw(css::uno::Exception)
+{
+ static ::rtl::OUString TYPES_SET = ::rtl::OUString::createFromAscii("Types" );
+ static ::rtl::OUString FILTER_SET = ::rtl::OUString::createFromAscii("Filters");
+
+ // Attention: Opening/Reading of this old configuration format has to be handled gracefully.
+ // Its optional and shouldnt disturb our normal work!
+ // E.g. we must check, if the package exists ...
+
+ css::uno::Reference< css::container::XNameAccess > xCfg;
+ try
+ {
+ css::uno::Reference< css::uno::XInterface > xInt = impl_openConfig(E_PROVIDER_OLD);
+ xCfg = css::uno::Reference< css::container::XNameAccess >(xInt, css::uno::UNO_QUERY_THROW);
+ }
+ /* corrupt filter addon ? because it's external (optional) code .. we can ignore it. Addon wont work then ...
+ but that seams to be acceptable.
+ see #139088# for further informations
+ */
+ catch(const css::uno::Exception&)
+ { return; }
+
+ // May be there is no type set ...
+ if (xCfg->hasByName(TYPES_SET))
+ {
+ css::uno::Reference< css::container::XNameAccess > xSet;
+ xCfg->getByName(TYPES_SET) >>= xSet;
+ const css::uno::Sequence< ::rtl::OUString > lItems = xSet->getElementNames();
+ const ::rtl::OUString* pItems = lItems.getConstArray();
+ for (sal_Int32 i=0; i<lItems.getLength(); ++i)
+ m_lTypes[pItems[i]] = impl_readOldItem(xSet, E_TYPE, pItems[i]);
+ }
+
+ // May be there is no filter set ...
+ if (xCfg->hasByName(FILTER_SET))
+ {
+ css::uno::Reference< css::container::XNameAccess > xSet;
+ xCfg->getByName(FILTER_SET) >>= xSet;
+ const css::uno::Sequence< ::rtl::OUString > lItems = xSet->getElementNames();
+ const ::rtl::OUString* pItems = lItems.getConstArray();
+ for (sal_Int32 i=0; i<lItems.getLength(); ++i)
+ m_lFilters[pItems[i]] = impl_readOldItem(xSet, E_FILTER, pItems[i]);
+ }
+}
+
+/*-----------------------------------------------
+ 12.02.2004 08:30
+-----------------------------------------------*/
+CacheItem FilterCache::impl_readOldItem(const css::uno::Reference< css::container::XNameAccess >& xSet ,
+ EItemType eType,
+ const ::rtl::OUString& sItem)
+ throw(css::uno::Exception)
+{
+ css::uno::Reference< css::container::XNameAccess > xItem;
+ xSet->getByName(sItem) >>= xItem;
+ if (!xItem.is())
+ throw css::uno::Exception(
+ ::rtl::OUString::createFromAscii("Cant read old item."),
+ css::uno::Reference< css::uno::XInterface >());
+
+ CacheItem aItem;
+ aItem[PROPNAME_NAME] <<= sItem;
+
+ // Installed flag ...
+ // Isnt used any longer!
+
+ // UIName
+ impl_readPatchUINames(xItem, aItem);
+
+ // Data
+ ::rtl::OUString sData;
+ OUStringList lData;
+ xItem->getByName(::rtl::OUString::createFromAscii("Data")) >>= sData;
+ lData = impl_tokenizeString(sData, (sal_Unicode)',');
+ if (
+ (!sData.getLength()) ||
+ (lData.size()<1 )
+ )
+ {
+ throw css::uno::Exception(
+ ::rtl::OUString::createFromAscii("Cant read old item property DATA."),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+
+ sal_Int32 nProp = 0;
+ for (OUStringList::const_iterator pProp = lData.begin();
+ pProp != lData.end() ;
+ ++pProp )
+ {
+ const ::rtl::OUString& sProp = *pProp;
+ switch(eType)
+ {
+ case E_TYPE :
+ impl_interpretDataVal4Type(sProp, nProp, aItem);
+ break;
+
+ case E_FILTER :
+ impl_interpretDataVal4Filter(sProp, nProp, aItem);
+ break;
+ default: break;
+ }
+ ++nProp;
+ }
+
+ return aItem;
+}
+
+/*-----------------------------------------------
+ 12.02.2004 08:15
+-----------------------------------------------*/
+OUStringList FilterCache::impl_tokenizeString(const ::rtl::OUString& sData ,
+ sal_Unicode cSeperator)
+{
+ OUStringList lData ;
+ sal_Int32 nToken = 0;
+ do
+ {
+ ::rtl::OUString sToken = sData.getToken(0, cSeperator, nToken);
+ lData.push_back(sToken);
+ }
+ while(nToken >= 0);
+ return lData;
+}
+
+#if OSL_DEBUG_LEVEL > 0
+/*-----------------------------------------------*/
+::rtl::OUString FilterCache::impl_searchFrameLoaderForType(const ::rtl::OUString& sType) const
+{
+ CacheItemList::const_iterator pIt;
+ for ( pIt = m_lFrameLoaders.begin();
+ pIt != m_lFrameLoaders.end() ;
+ ++pIt )
+ {
+ const ::rtl::OUString& sItem = pIt->first;
+ ::comphelper::SequenceAsHashMap lProps(pIt->second);
+ OUStringList lTypes(lProps[PROPNAME_TYPES]);
+
+ if (::std::find(lTypes.begin(), lTypes.end(), sType) != lTypes.end())
+ return sItem;
+ }
+
+ return ::rtl::OUString();
+}
+
+/*-----------------------------------------------*/
+::rtl::OUString FilterCache::impl_searchContentHandlerForType(const ::rtl::OUString& sType) const
+{
+ CacheItemList::const_iterator pIt;
+ for ( pIt = m_lContentHandlers.begin();
+ pIt != m_lContentHandlers.end() ;
+ ++pIt )
+ {
+ const ::rtl::OUString& sItem = pIt->first;
+ ::comphelper::SequenceAsHashMap lProps(pIt->second);
+ OUStringList lTypes(lProps[PROPNAME_TYPES]);
+
+ if (::std::find(lTypes.begin(), lTypes.end(), sType) != lTypes.end())
+ return sItem;
+ }
+
+ return ::rtl::OUString();
+}
+#endif
+
+/*-----------------------------------------------*/
+sal_Bool FilterCache::impl_isModuleInstalled(const ::rtl::OUString& sModule)
+{
+ css::uno::Reference< css::container::XNameAccess > xCfg;
+
+ // SAFE ->
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+ if (! m_xModuleCfg.is())
+ {
+ m_xModuleCfg = css::uno::Reference< css::container::XNameAccess >(
+ ::comphelper::ConfigurationHelper::openConfig(
+ m_xSMGR,
+ ::rtl::OUString::createFromAscii("org.openoffice.Setup/Office/Factories"),
+ ::comphelper::ConfigurationHelper::E_READONLY),
+ css::uno::UNO_QUERY_THROW);
+ }
+
+ xCfg = m_xModuleCfg;
+ aLock.clear();
+ // <- SAFE
+
+ if (xCfg.is())
+ return xCfg->hasByName(sModule);
+
+ return sal_False;
+}
+
+ } // namespace config
+} // namespace filter
diff --git a/filter/source/config/cache/filtercache.hxx b/filter/source/config/cache/filtercache.hxx
new file mode 100644
index 000000000000..0c0e34b2783b
--- /dev/null
+++ b/filter/source/config/cache/filtercache.hxx
@@ -0,0 +1,1066 @@
+/*************************************************************************
+ *
+ * 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 __FILTER_CONFIG_FILTERCACHE_HXX_
+#define __FILTER_CONFIG_FILTERCACHE_HXX_
+
+//_______________________________________________
+// includes
+
+#include "cacheitem.hxx"
+#include <com/sun/star/uno/Exception.hpp>
+#include <com/sun/star/util/URL.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/container/XNameReplace.hpp>
+#include <com/sun/star/util/ChangesEvent.hpp>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Any.h>
+#include <rtl/ustring.hxx>
+
+//_______________________________________________
+// namespace
+
+namespace filter{
+ namespace config{
+
+//_______________________________________________
+// definitions
+
+//_______________________________________________
+
+/** @short implements a cache, which contains all
+ elements of our filter and type detection
+ configuration.
+
+ @descr The cache itself is threadsafe implemented.
+ Because it should be used as a singleton only.
+ To do so please use reference mechanism as wrapper
+ around this FilterCache class.
+
+ @attention Because we use a trick to get a full initialized
+ mutex lock during initialization time (means during
+ the constructor runs), the base class FilterCacheLock
+ must be the first of all declared one!
+ Further we make it public. So any user of this class
+ can lock us from outside too.
+ */
+class FilterCache : public BaseLock
+{
+ //-------------------------------------------
+ // public types
+
+ public:
+
+ //---------------------------------------
+
+ /** @short identify the type of a container item.
+
+ @descr Because the cache interface is a generic one
+ every group of container items must be specified.
+ */
+ enum EItemType
+ {
+ E_TYPE ,
+ E_FILTER ,
+ E_FRAMELOADER ,
+ E_CONTENTHANDLER,
+ E_DETECTSERVICE
+ };
+
+ //---------------------------------------
+
+ /** @short indicates, which items already exists inside this cache
+ and which not.
+
+ @descr This cache supports a 2-step load mechanism.
+ First only types (and only some special properties of every type!)
+ but no filters/frame loaders/content handlers will be readed.
+ That should be enough to work with this cache e.g. for loading
+ the first document. After this first document was loaded successfully,
+ a special "load-on-demand-thread" will be started to fill this cache
+ with ALL other informations, which was not readed before.
+ Thats the second step. All operations on top of this cache will be
+ blocked then.
+ */
+ enum EFillState
+ {
+ E_CONTAINS_NOTHING = 0,
+ E_CONTAINS_STANDARD = 1,
+ E_CONTAINS_TYPES = 2,
+ E_CONTAINS_FILTERS = 4,
+ E_CONTAINS_DETECTSERVICES = 8,
+ E_CONTAINS_FRAMELOADERS = 16,
+ E_CONTAINS_CONTENTHANDLERS = 32,
+ E_CONTAINS_ALL = 63 // must be a combination of all excepting E_CONTAINS_NOTHING! Please update if items will be added or removed ...
+ };
+
+ //-------------------------------------------
+ // private types
+
+ private:
+
+ //---------------------------------------
+ /** @short regulate, which properties of a configured item
+ will be readed.
+
+ @descr To perform reading of all configuration items,
+ only standard properties will be handled. At a second
+ step all optional properties will be read and added to
+ our internal structures. Of course the combination of
+ both options can be used too, to get all properties
+ at the same time.
+ */
+ enum EReadOption
+ {
+ E_READ_NOTHING = 0,
+ E_READ_STANDARD = 1,
+ E_READ_UPDATE = 2,
+ E_READ_ALL = 3
+ };
+
+ //---------------------------------------
+ /** @short indicates the state of a configuration set item.
+
+ @descr Inside method flush we check:
+ <ul>
+ <li>if the item exists inside config layer but not inside our cache => REMOVED</li>
+ <li>if the item exists inside config layer and inside our cache => CHANGED</li>
+ <li>if the item does not exists inside config layer but inside our cache => ADDED.</li>
+ </ul>
+ */
+ enum EItemFlushState
+ {
+ /// indicates an unchanged item (can occure e.g. if an item was added and(!) removed before it was flushed ...
+ E_ITEM_UNCHANGED = 0,
+ /// indicates an item, which exists inside config layer but not inside our own cache
+ E_ITEM_REMOVED = 1,
+ /// indicates an item, which exists inside config layer and inside our own cache
+ E_ITEM_CHANGED = 2,
+ /// indicates an item, which does not exists inside config layer but inside our own cache
+ E_ITEM_ADDED = 3
+ };
+
+ //---------------------------------------
+ /** TODO document me */
+ enum EConfigProvider
+ {
+ E_PROVIDER_TYPES = 0,
+ E_PROVIDER_FILTERS = 1,
+ E_PROVIDER_OTHERS = 2,
+ E_PROVIDER_OLD = 3
+ };
+
+ //-------------------------------------------
+ // member
+
+ private:
+
+ //---------------------------------------
+ /** @short reference to an uno service manager, which can be used
+ to create own needed services. */
+ mutable css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR;
+
+ //---------------------------------------
+ /** @short holds the used configuration provider alive, which
+ provides access to the list of types. */
+ mutable css::uno::Reference< css::uno::XInterface > m_xConfigTypes;
+
+ //---------------------------------------
+ /** @short holds the used configuration provider alive, which
+ provides access to the list of filters. */
+ mutable css::uno::Reference< css::uno::XInterface > m_xConfigFilters;
+
+ //---------------------------------------
+ /** @short holds the used configuration provider alive, which
+ provides access to the list of other values needed
+ by our type detection framework. */
+ mutable css::uno::Reference< css::uno::XInterface > m_xConfigOthers;
+
+ //---------------------------------------
+ /** @short contains all loaded types with its properties. */
+ mutable CacheItemList m_lTypes;
+
+ //---------------------------------------
+ /** @short contains all well known detect service with its properties. */
+ mutable CacheItemList m_lDetectServices;
+
+ //---------------------------------------
+ /** @short contains all loaded filters with its properties. */
+ mutable CacheItemList m_lFilters;
+
+ //---------------------------------------
+ /** @short contains all loaded frame loader with its properties. */
+ mutable CacheItemList m_lFrameLoaders;
+
+ //---------------------------------------
+ /** @short contains all loaded content handler with its properties. */
+ mutable CacheItemList m_lContentHandlers;
+
+ //---------------------------------------
+ /** @short optimize mapping of URL extensions to a type representation,
+ by using extensions as key and a list of internal
+ type names as value. */
+ mutable CacheItemRegistration m_lExtensions2Types;
+
+ //---------------------------------------
+ /** @short optimize mapping of URL pattern to a type representation,
+ by using patterns as key and a list of internal
+ type names as value. */
+ mutable CacheItemRegistration m_lURLPattern2Types;
+
+ //---------------------------------------
+ /** @short contains the current locale of the office and will be
+ used to work with localized configuration values. */
+ ::rtl::OUString m_sActLocale;
+
+ //---------------------------------------
+ /** TODO */
+ ::rtl::OUString m_sFormatName;
+
+ //---------------------------------------
+ /** TODO */
+ ::rtl::OUString m_sFormatVersion;
+
+ //---------------------------------------
+ /** @short contains status, which cache items/properties
+ was already loaded from the underlying configuration.
+
+ @descr This information can be used to detect missing
+ informations and load it on demand.
+
+ @see EFillState
+ @see load()
+ */
+ EFillState m_eFillState;
+
+ //---------------------------------------
+ /** TODO document me ... */
+ OUStringList m_lChangedTypes;
+ OUStringList m_lChangedFilters;
+ OUStringList m_lChangedDetectServices;
+ OUStringList m_lChangedFrameLoaders;
+ OUStringList m_lChangedContentHandlers;
+
+ //---------------------------------------
+ /// readonly acccess to the module configuration of OOo
+ css::uno::Reference< css::container::XNameAccess > m_xModuleCfg;
+
+ //-------------------------------------------
+ // interface
+
+ public:
+
+ //---------------------------------------
+ // ctor/dtor
+
+ /** @short standard ctor
+
+ @descr Its not allowed to do anything here ...
+ especialy is forbidden to start operations,
+ which needs a FilterCache instance too!
+ Why? Because thie FilterCache instance will be
+ used as a singleton! And if during this ctor any
+ action related to this FilterCache singleton is
+ started ... a race will be the result.
+
+ The first method after construction of a new
+ singleton reference should be "load()". There
+ a special fill state of this cache can be forced.
+ */
+ FilterCache();
+
+ //---------------------------------------
+
+ /** @short standard dtor.
+ */
+ virtual ~FilterCache();
+
+ //---------------------------------------
+
+ /** @short creates a copy of this container.
+
+ @descr Such copy can be used then to modify items (add/change/remove)
+ without the risk to damage the original container.
+ After its changed data was flushed to the configuration it can be
+ removed.
+
+ The original container will get these new data automaticly
+ because it listen for changes on the internal used configuration layer.
+ If the new data are needed immediatly inside the original container,
+ the method takeOver() can be used to copy all changes back.
+ The may be following notifications of the configuration will be superflous then.
+ But they cant be stopped ...
+
+ All internal structures will be copied here. But the internal used
+ configuration (update) access wont be copied. The cloned instance contains
+ a different one.
+
+ @note The cloned instance is created on the heap. The user of this instance
+ has to remove it later.
+ */
+ virtual FilterCache* clone() const;
+
+ //---------------------------------------
+
+ /** @short copy the cache content or rClone back to this instance.
+ */
+ virtual void takeOver(const FilterCache& rClone);
+
+ //---------------------------------------
+
+ /** @short force special fill state of this cache.
+
+ @descr This method check if all requested items/properties already
+ exists. Only missing informations will be readed.
+ Otherwhise this method does nothing!
+
+ This method must be called from every user of this cache
+ everytimes it need a filled cache. Normaly we load
+ only standard informations into this cache on startup.
+ After a few seconds we start a special thread, which
+ may fill this cache completely. But if somehwere outside
+ need a filled cache before ... it can run into trouble,
+ if this "load-on-demand" thread does not finished its work before.
+ This method "load(xxx)" synchronize such load-on-demand requests.
+
+ Of course it would be possible to supress this special load thread
+ in general and start it manualy inside this load() request.
+ The outside code decide then, if and when this cache will be filled
+ with all available informations ...
+
+ @param bByThread
+ indicates using of this method by our global "load-on-demand-thread".
+ Its an implementation detail! We use it to check, if this "load()"
+ request was forced e.g. by one of our derived service container (which need
+ it to full fill its own operations) or if it was forced by our own
+ "load-on-demand-thread", which tries to optimize our startup performance
+ and start this load() only in case the office startup was already finished!
+
+ @throw An exception if the cache could not be filled realy
+ or seems to be invalid afterwards. But there is no reaction
+ at all if this method does nothing inside, because the cache
+ is already full filled!
+ */
+ virtual void load(EFillState eRequired ,
+ sal_Bool bByThread = sal_False)
+ throw(css::uno::Exception);
+
+ //---------------------------------------
+
+ /** @short return the current fill state of this cache.
+
+ @descr This information can be used e.g. to start
+ a search on top of this cache with a minimum on
+ informations ... and do it again, if some other
+ cache items seems to be available after calling of "loadAll()"
+ on this cache and first search does not had any valid results.
+
+ @return TRUE if the required fill state exists for this cache; FALSE
+ otherwise.
+ */
+ virtual sal_Bool isFillState(EFillState eRequired) const
+ throw(css::uno::Exception);
+
+ //---------------------------------------
+
+ /** @short return a list of key names for items, which match
+ the specified criteria.
+
+ @descr The returned key names can be used at another method "getItem()"
+ of this cache to get further informations about this item.
+
+ @attention Please note: because this cache can be used inside multithreaded
+ environments, such returned key name can point to an already removed
+ item! Please be aware of some "NoSuchElementExceptions" if you try to
+ call any other method of this cache in relation to this key name.
+
+ @param eType
+ specify the sub container of this cache, which should be used for
+ searching. see also EItemType.
+
+ @param lIProps
+ specify the property set, which must exist at the searched items
+ as minimum.
+
+ @param lEProps
+ specify the property set, which must not(!) exist at the searched items
+ as minimum.
+
+ @return [OUStringList]
+ a list of key names, which identify items of the queried sub container.
+ May be an empty list.
+
+ @throw [css::uno::Exception]
+ if some input parameter are wrong or the cache itself is not valid
+ any longer, because any operation before damage it.
+ */
+ virtual OUStringList getMatchingItemsByProps( EItemType eType ,
+ const CacheItem& lIProps ,
+ const CacheItem& lEProps = CacheItem()) const
+ throw(css::uno::Exception);
+
+ //---------------------------------------
+
+ /** @short indicates if the requested sub container
+ contains some items.
+
+ @descr We dont provide any information about the count
+ of such items. Because we dont implement any index
+ based interface! The information "we have items or not"
+ must be enough for the outside code ... till somewhere
+ give us a good reason. :-)
+
+ @param eType
+ specify the sub container of this cache, which should be used.
+ see also EItemType.
+
+ @return [sal_Bool]
+ True, if the requested sub container contains some items;
+ False otherwhise.
+
+ @throw [css::uno::Exception]
+ if some input parameter are wrong or the cache itself is not valid
+ any longer, because any operation before damage it.
+ */
+ virtual sal_Bool hasItems(EItemType eType) const
+ throw(css::uno::Exception);
+
+ //---------------------------------------
+
+ /** @short return a list of all key names, which represent
+ an item inside the specified sub container.
+
+ @attention Please note: because this cache can be used inside multithreaded
+ environments, such returned key names can point to some already removed
+ items! Please be aware of some "NoSuchElementExceptions" if you try to
+ call any other method of this cache in relation to this key names.
+
+ @param eType
+ specify the sub container of this cache, which should be used for
+ searching. see also EItemType.
+
+ @return [OUStringList]
+ a list of key names, which can be used to access the item properties
+ using some other methods of this cache.
+
+ @throw [css::uno::Exception]
+ if some input parameter are wrong or the cache itself is not valid
+ any longer, because any operation before damage it.
+ */
+ virtual OUStringList getItemNames(EItemType eType) const
+ throw(css::uno::Exception);
+
+ //---------------------------------------
+
+ /** @short check if the required item exist inside this container.
+
+ @attention This method exists to supports some UNO container interfaces
+ only. (e.g. XNameAccess.hasByName()). But inside multithreaded
+ environments there is no guarantee, that this item still exists, if
+ its realy requested e.g. by calling getItem()!
+ Be aware of some NoSuchElementExistExceptions ...
+
+ @param eType
+ specify the sub container of this cache, which should be used.
+ see also EItemType.
+
+ @param sItem
+ the key name of the requested item inside the pecified sub container.
+
+ @throw [css::uno::Exception]
+ if some input parameter are wrong or the cache itself is not valid
+ any longer, because any operation before damage it.
+ */
+ virtual sal_Bool hasItem( EItemType eType,
+ const ::rtl::OUString& sItem)
+ throw(css::uno::Exception);
+
+ //---------------------------------------
+
+ /** @short return an item, which match the specified type and name.
+
+ @descr Because this cache can be used inside multithreaded environments
+ the caller must be aware of some exceptions - especialy a "NoSuchElementExcepotion".
+ May another thread already removed the required item before ...
+
+ @param eType
+ specify the sub container of this cache, which should be used for
+ searching. see also EItemType.
+
+ @param sItem
+ specify the requested item by its key name.
+
+ @return [CacheItem]
+ the required item if it could be located ...
+ But we throw an exception if the required item does not exist!
+
+ @throw [css::container::NoSuchElementException]
+ if the required item does not still exist.
+
+ @throw [css::uno::Exception]
+ if some input parameter are wrong or the cache itself is not valid
+ any longer, because any operation before damage it.
+ */
+ virtual CacheItem getItem( EItemType eType,
+ const ::rtl::OUString& sItem)
+ throw(css::uno::Exception);
+
+ //---------------------------------------
+
+ /** TODO document me ...
+ */
+ virtual void removeItem( EItemType eType,
+ const ::rtl::OUString& sItem)
+ throw(css::uno::Exception);
+
+ //---------------------------------------
+
+ /** TODO document me ...
+ */
+ virtual void setItem( EItemType eType ,
+ const ::rtl::OUString& sItem ,
+ const CacheItem& aValue)
+ throw(css::uno::Exception);
+
+ //---------------------------------------
+
+ /** TODO document me ...
+ */
+ virtual void refreshItem( EItemType eType,
+ const ::rtl::OUString& sItem)
+ throw(css::uno::Exception);
+
+ //---------------------------------------
+
+ /** @short add some implicit properties to the given
+ cache item reference.
+
+ @descr Such properties can e.g. finalized or mandatory.
+ They are not persistent and not realy part of e.g. a
+ filter not. But they are attributes of a configuration
+ entry and can influence our container interface.
+
+ @attention These properties are not part of the normal CacheItem
+ returned by the method getItem(). Because getItem() is
+ used internaly too but these specialized properties
+ are needed at our container services only. So these
+ function sets are different to allow different handling.
+
+ @param eType
+ specify the sub container of this cache, which should be used for
+ searching. see also EItemType.
+
+ @param sItem
+ specify the requested item by its key name.
+
+ @param rItem
+ contains already the normal properties of this item,
+ and will be used as out parameter to add the implicit
+ attributes there.
+
+ @throw [css::uno::Exception]
+ if an internal error occured.
+ Note: If the item is missing inside the underlying configuration
+ no exception will be thrown. In such case the item is marked as
+ finalized/mandatory automaticly
+ Reason: May be the item cames from the old configuration package and
+ was not migrated to the new one. So we cant provide write access
+ to such items ...
+ */
+ virtual void addStatePropsToItem( EItemType eType,
+ const ::rtl::OUString& sItem,
+ CacheItem& rItem)
+ throw(css::uno::Exception);
+
+ //---------------------------------------
+
+ /** TODO document me
+ */
+ virtual void removeStatePropsFromItem(CacheItem& aValue)
+ throw(css::uno::Exception);
+
+ //---------------------------------------
+
+ /** @short force writing of all changes (which was made after
+ last flush was called) back to the configuration.
+
+ @descr TODO
+
+ @throw [css::uno::Exception]
+ if the cache itself is not valid
+ any longer, because any operation before damage it.
+ */
+ virtual void flush()
+ throw(css::uno::Exception);
+
+ //---------------------------------------
+
+ /** @short supports a flat type detection for given URL.
+
+ @descr Because such detection works on our optimized internal
+ structures (e.g. mapping from extensions/pattern to type names),
+ it should be made inside this cache.
+
+ @param aURL
+ URL of the content, which type should be detected.
+ Its already parsed and splitted into its differnt parts,
+ like e.g.: main, jump marks etcpp.
+
+ @param rFlatTypes
+ used as [out] parameter to add all types, which match to the given
+ URL. Further an information is added for every type. It indicates, how
+ this type is related to the specified URL (means e.g. if it matches
+ by extension or URLPattern ...).
+
+ @attention Please note: because this cache can be used inside multithreaded
+ environments, such returned key names can point to some already removed
+ items! Please be aware of some "NoSuchElementExceptions" if you try to
+ call any other method of this cache in relation to this key names.
+
+ @throw [css::uno::Exception]
+ if the cache itself is not valid
+ any longer, because any operation before damage it.
+ */
+ virtual void detectFlatForURL(const css::util::URL& aURL ,
+ FlatDetection& rFlatTypes) const
+ throw(css::uno::Exception);
+
+ //-------------------------------------------
+ // private helper
+
+ private:
+
+ //---------------------------------------
+
+ /** @short return a reference to one of our internal
+ sub container, which contains items of the
+ requested type.
+
+ @param eType
+ specify, which sub container is needed outside.
+
+ @return [CacheItemList&]
+ a reference(!) to the right sub container member.
+
+ @throw [css::uno::Exception]
+ if the required list does not exist.
+ */
+ CacheItemList& impl_getItemList(EItemType eType) const
+ throw(css::uno::Exception);
+
+ //---------------------------------------
+
+ /** @short return a valid configuration update access
+ to the underlying configuration package, which
+ is fix for this cache.
+
+ @descr It checks first, if the internal member m_xConfig already
+ points to an open update access. If not - it opens a new one.
+ Doing so this method can be called everytimes a configuration
+ access is needed.
+
+ @param eProvider
+ specify the needed configuration provider.
+ see EConfigProvider for further informations ...
+
+ @attention If a configuration access was opened successfully
+ all neccessary listener connections will be established
+ too. So this cache will be informed about outside updates.
+ */
+ css::uno::Reference< css::uno::XInterface > impl_openConfig(EConfigProvider eProvide)
+ throw(css::uno::Exception);
+
+ //---------------------------------------
+
+ /** @short tries to open the requested configuration root
+ using the specified modi.
+
+ @param sRoot
+ specify the configuration root, which should be opened.
+
+ @param bReadOnly
+ enable/disable write access on the returned configuration
+ object.
+
+ @param bLocalesMode
+ enable/disable special handling of localized configuratiom
+ items by the returned configuration object.
+
+ @return A valid reference, if the configuration access could be opened
+ and initialized within the requested modes successfully;
+ a NULL reference otherwhise.
+ */
+ css::uno::Reference< css::uno::XInterface > impl_createConfigAccess(const ::rtl::OUString& sRoot ,
+ sal_Bool bReadOnly ,
+ sal_Bool bLocalesMode);
+
+ //---------------------------------------
+
+ /** @short reads the specified configuration key
+ and return its value.
+
+ @descr The specified key must be an absolute configuration path,
+ which can be splitted into its package and relative path tokens.
+
+ @attention Because this function might opens a new configuration
+ read access for reading one key value only, it should
+ be used in rare cases only. Its an easy way ... but an
+ expensive one.
+
+ @param sDirectKey
+ the absolute configuration path, which should be readed.
+
+ @return [css::uno::Any]
+ the value of the requested key.
+ Can be empty if an internal error occured or if the requested
+ key does not exists!
+ */
+ css::uno::Any impl_getDirectCFGValue(const ::rtl::OUString& sDirectKey);
+
+ //---------------------------------------
+
+ /** @short load the underlying configuration into this cache.
+
+ @descr Which items should be readed can be regulate by the
+ parameter eRequiredState. That provides the possibility
+ to load standard values on startup only and update this
+ cache later on demand with all available informations.
+
+ @param eRequiredState
+ indicates, which fill state this cache should have afterwards.
+ */
+ void impl_load(EFillState eRequiredState)
+ throw(css::uno::Exception);
+
+ //---------------------------------------
+
+ /** @short validate the whole cache and create
+ structures for optimized items access.
+
+ @descr Wrong cache items will be removed automaticly.
+ Wrong dependencies will be corrected automaticly.
+ If something could not be repaired - an exception
+ is thrown.
+ Further some optmized structures will be created.
+ E.g.: a hash to map extensions to her types.
+
+ @attention There is no exception, if the cache could be repaired
+ but contained wrong elements before!
+
+ @throw [css::uno::Exception]
+ if cache is invalid and could not be repaired.
+ */
+ void impl_validateAndOptimize()
+ throw(css::uno::Exception);
+
+ //---------------------------------------
+
+ /** @short register the specified item for the given type.
+
+ @descr Because detect services, frame loader or content handler
+ are not listed inside the xml configuration as seperated
+ items (they are properties of any type entry!), this method update
+ the internal lists of such items. Thats neccessary to have
+ it accessible for our container interfaces of detect, frame loader
+ and content handler services.
+
+ @param pList
+ points to a CacheItemList of this filter cache, where
+ this item registration should be updated or added.
+
+ @param sItem
+ specify the detect service, frame loader or content handler,
+ which should be registered for the given type.
+
+ @param sType
+ contains the internal type name, where the item should be registered for.
+
+ @throw [css::uno::Exception]
+ If registration failed by any reason.
+ That does not include double registrations!
+ */
+ void impl_resolveItem4TypeRegistration( CacheItemList* pList,
+ const ::rtl::OUString& sItem,
+ const ::rtl::OUString& sType)
+ throw(css::uno::Exception);
+
+ //-------------------------------------------
+ // static helper
+
+ private:
+
+ //---------------------------------------
+
+ /** @short read the specified config set into the cache.
+
+ @descr This method provides the following mechanism for reading:
+ a) read only standard properties of set items
+ b) read anything
+ c) read only optional properties and update already existing
+ items of the specified cache
+
+ @param xConfig
+ API which provides access to the required configuration set.
+
+ @param eType
+ specify the type of config item, which must be interpreted.
+ Of course this information can be used to locate the right set
+ at the given xConfig API object.
+
+ @param eOption
+ regulate reading of standard/optional or all properties.
+
+ @param pCache
+ points to the cache member, which should be filled or updated.
+
+ @throw [css::uno::Exception]
+ if an unrecoverable error occure inside this operation.
+ */
+ void impl_loadSet(const css::uno::Reference< css::container::XNameAccess >& xConfig,
+ EItemType eType ,
+ EReadOption eOption,
+ CacheItemList* pCache )
+ throw(css::uno::Exception);
+
+ //---------------------------------------
+
+ /** @short read the specified container item from the given configuration set.
+
+ @descr Its not added to any internal structures here. That must be done
+ outside this method.
+
+ @param xSet
+ provides access to the configuration set, which includes all items.
+
+ @param eType
+ specify, which container item type must be readed.
+
+ @param sItem
+ means the internal name, which can be used to adress the item
+ properties relativ to the given configuration set.
+
+ @param eOption
+ regulate, which properties of the requested item should be read.
+ See defintion of EReadOption for further informations.
+
+ @throw [css::uno::Exception]
+ if an unrecoverable error occure inside this operation.
+ */
+ CacheItem impl_loadItem(const css::uno::Reference< css::container::XNameAccess >& xSet ,
+ EItemType eType ,
+ const ::rtl::OUString& sItem ,
+ EReadOption eOption)
+ throw(css::uno::Exception);
+
+ //---------------------------------------
+
+ /** @short try to load the requested item on demand from the underlying configuration
+ layer.
+
+ @descr The outside code has to be shure, that the item does not already exists
+ inside this cachse. Otherwise it will be loaded twice. This method
+ doesnt check such constellations!
+
+ @param eType
+ specify the type of config item, which must be interpreted.
+ Of course this information can be used to locate the right set
+ at the given xConfig API object.
+
+ @param sItem
+ the set node name of the requested item.
+
+ @return An iterator, which points directly to the new cached item.
+ Is a valid iterator if no exception occured here!
+ But to improve robustness - it should be checked :-)
+
+ @throw [css::container::NoSuchElementException]
+ if the item does not exists inside the configuration layer too!
+
+ @throw [css::uno::Exception]
+ if an unrecoverable error occure inside this operation.
+ */
+ CacheItemList::iterator impl_loadItemOnDemand( EItemType eType,
+ const ::rtl::OUString& sItem)
+ throw(css::uno::Exception);
+
+ //---------------------------------------
+
+ /** TODO */
+ void impl_saveItem(const css::uno::Reference< css::container::XNameReplace >& xSet ,
+ EItemType eType ,
+ const CacheItem& aValue)
+ throw(css::uno::Exception);
+
+ //---------------------------------------
+
+ /** TODO */
+ void impl_addItem2FlushList( EItemType eType,
+ const ::rtl::OUString& sItem)
+ throw(css::uno::Exception);
+
+
+ //---------------------------------------
+
+ /** TODO */
+ void impl_flushByList(const css::uno::Reference< css::container::XNameAccess >& xSet ,
+ EItemType eType ,
+ const CacheItemList& rCache,
+ const OUStringList& lItems)
+ throw(css::uno::Exception);
+
+ //---------------------------------------
+
+ /** @short specify, which save operation is neccessary for the specified item.
+
+ @desrc If an item of this cache will be added/removed or modified it will
+ be changed inside memory only first. But we save its name inside a special
+ list of changed items. If at least the method flush() is called, we use
+ this list to check if the item was changed/added or removed. This method
+ checks the exist state of the requested item inside our own cache
+ and inside the underlying configuration layer to find out, if the item
+ must be removed/added or modified inside the configuratuion layer.
+
+ @param xSet
+ points directly to the configuration set, where the item should resist
+ (if it exists!).
+
+ @param rList
+ points to our internal cache list, where the item should resist
+ (if it exists!).
+
+ @param sItem
+ the internal name of the item, which should be checked.
+
+ @return An enum value of type EItemFlushState, which indicates the needed
+ API operation for updating the underlying configuration layer.
+
+ @throws An exception if anything failed inside this operation.
+ e.g. the given configuration set was not open.
+ */
+ EItemFlushState impl_specifyFlushOperation(const css::uno::Reference< css::container::XNameAccess >& xSet ,
+ const CacheItemList& rList,
+ const ::rtl::OUString& sItem)
+ throw(css::uno::Exception);
+
+ //---------------------------------------
+
+ /** TODO */
+ void impl_readPatchUINames(const css::uno::Reference< css::container::XNameAccess >& xNode,
+ CacheItem& rItem)
+ throw(css::uno::Exception);
+
+ //---------------------------------------
+
+ /** TODO */
+ void impl_savePatchUINames(const css::uno::Reference< css::container::XNameReplace >& xNode,
+ const CacheItem& rItem)
+ throw(css::uno::Exception);
+
+ //---------------------------------------
+
+ /** TODO */
+ void impl_readOldFormat()
+ throw(css::uno::Exception);
+
+ //---------------------------------------
+
+ /** TODO */
+ CacheItem impl_readOldItem(const css::uno::Reference< css::container::XNameAccess >& xSet ,
+ EItemType eType,
+ const ::rtl::OUString& sItem)
+ throw(css::uno::Exception);
+
+ //---------------------------------------
+
+ /** TODO */
+ void impl_interpretDataVal4Type(const ::rtl::OUString& sValue,
+ sal_Int32 nProp ,
+ CacheItem& rItem );
+
+ //---------------------------------------
+
+ /** TODO */
+ void impl_interpretDataVal4Filter(const ::rtl::OUString& sValue,
+ sal_Int32 nProp ,
+ CacheItem& rItem );
+
+ //---------------------------------------
+
+ /** TODO */
+ OUStringList impl_tokenizeString(const ::rtl::OUString& sData ,
+ sal_Unicode cSeperator);
+
+ //---------------------------------------
+
+#if OSL_DEBUG_LEVEL > 0
+ /** TODO */
+ ::rtl::OUString impl_searchFrameLoaderForType(const ::rtl::OUString& sType) const;
+ ::rtl::OUString impl_searchContentHandlerForType(const ::rtl::OUString& sType) const;
+#endif
+
+ //---------------------------------------
+ /** @short check if the specified OOo module is installed.
+
+ @param sModule
+ the long name of the module (e.g. "com.sun.star.text.TextDocument").
+
+ @return TRUE if the requested module is installed; FALSE otherwise.
+ */
+ sal_Bool impl_isModuleInstalled(const ::rtl::OUString& sModule);
+
+ //---------------------------------------
+
+ /** @short convert a list of flag names to its int representation.
+
+ @param lNames
+ the list of flag names.
+
+ @return [sal_Int32]
+ the converted flag field.
+ */
+ static sal_Int32 impl_convertFlagNames2FlagField(const css::uno::Sequence< ::rtl::OUString >& lNames);
+
+ //---------------------------------------
+
+ /** @short convert a flag field value to its list representation of flag names.
+
+ @param nFlags
+ the flag field value
+
+ @return [seq< string >]
+ the converted flag name list.
+ */
+ static css::uno::Sequence< ::rtl::OUString > impl_convertFlagField2FlagNames(sal_Int32 nFlags);
+};
+
+ } // namespace config
+} // namespace filter
+
+#endif // __FILTER_CONFIG_FILTERCACHE_HXX_
diff --git a/filter/source/config/cache/filterfactory.cxx b/filter/source/config/cache/filterfactory.cxx
new file mode 100644
index 000000000000..dc7869be27ca
--- /dev/null
+++ b/filter/source/config/cache/filterfactory.cxx
@@ -0,0 +1,724 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include "filterfactory.hxx"
+#include "macros.hxx"
+#include "constant.hxx"
+#include "versions.hxx"
+
+//_______________________________________________
+// includes
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <comphelper/enumhelper.hxx>
+#include <comphelper/configurationhelper.hxx>
+#include <rtl/ustrbuf.hxx>
+
+//_______________________________________________
+// namespace
+
+namespace filter{
+ namespace config{
+
+namespace css = ::com::sun::star;
+
+//_______________________________________________
+// definitions
+
+/** @short can be used to query for filters related to its application module.
+ */
+#define BASE_QUERY_ALL "_query_all"
+#define BASE_QUERY_WRITER "_query_Writer"
+#define BASE_QUERY_WEB "_query_web"
+#define BASE_QUERY_GLOBAL "_query_global"
+#define BASE_QUERY_CHART "_query_chart"
+#define BASE_QUERY_CALC "_query_calc"
+#define BASE_QUERY_IMPRESS "_query_impress"
+#define BASE_QUERY_DRAW "_query_draw"
+#define BASE_QUERY_MATH "_query_math"
+
+//_______________________________________________
+
+/** @short define all possible parts of a filter query.
+
+ @descr syntax: "<query>[:<param>[=<value>]]"
+ e.g.: "_query_writer:default_first:use_order:sort_prop=uiname"
+
+ argument description default
+ -----------------------------------------------------------------------------------------------
+ iflags=<mask> include filters by given mask 0
+ eflags=<mask> exclude filters by given mask 0
+ sort_prop=<[name,uiname]> sort by internal name or uiname name
+ descending sort descending false
+ use_order use order flag of filters for sorting false
+ default_first set default filter on top of return list false
+ case_sensitive compare "sort_prop" case sensitive false
+ */
+#define SEPERATOR_QUERYPARAM ((sal_Unicode)':')
+#define SEPERATOR_QUERYPARAMVALUE ((sal_Unicode)'=')
+
+#define QUERYPARAM_IFLAGS ::rtl::OUString::createFromAscii("iflags")
+#define QUERYPARAM_EFLAGS ::rtl::OUString::createFromAscii("eflags")
+#define QUERYPARAM_SORT_PROP ::rtl::OUString::createFromAscii("sort_prop")
+
+#define QUERYPARAM_DESCENDING ::rtl::OUString::createFromAscii("descending")
+#define QUERYPARAM_USE_ORDER ::rtl::OUString::createFromAscii("use_order")
+#define QUERYPARAM_DEFAULT_FIRST ::rtl::OUString::createFromAscii("default_first")
+#define QUERYPARAM_CASE_SENSITIVE ::rtl::OUString::createFromAscii("case_sensitive")
+
+#define QUERYPARAMVALUE_SORT_PROP_NAME ::rtl::OUString::createFromAscii("name")
+#define QUERYPARAMVALUE_SORT_PROP_UINAME ::rtl::OUString::createFromAscii("uiname")
+
+/*-----------------------------------------------
+ 09.07.2003 07:43
+-----------------------------------------------*/
+FilterFactory::FilterFactory(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR)
+{
+ BaseContainer::init(xSMGR ,
+ FilterFactory::impl_getImplementationName() ,
+ FilterFactory::impl_getSupportedServiceNames(),
+ FilterCache::E_FILTER );
+}
+
+/*-----------------------------------------------
+ 09.07.2003 07:43
+-----------------------------------------------*/
+FilterFactory::~FilterFactory()
+{
+}
+
+/*-----------------------------------------------
+ 16.07.2003 13:43
+-----------------------------------------------*/
+css::uno::Reference< css::uno::XInterface > SAL_CALL FilterFactory::createInstance(const ::rtl::OUString& sFilter)
+ throw(css::uno::Exception ,
+ css::uno::RuntimeException)
+{
+ return createInstanceWithArguments(sFilter, css::uno::Sequence< css::uno::Any >());
+}
+
+/*-----------------------------------------------
+ 17.07.2003 08:56
+-----------------------------------------------*/
+css::uno::Reference< css::uno::XInterface > SAL_CALL FilterFactory::createInstanceWithArguments(const ::rtl::OUString& sFilter ,
+ const css::uno::Sequence< css::uno::Any >& lArguments)
+ throw(css::uno::Exception ,
+ css::uno::RuntimeException)
+{
+ // SAFE ->
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+
+ ::rtl::OUString sRealFilter = sFilter;
+
+ #ifdef _FILTER_CONFIG_MIGRATION_Q_
+
+ /* -> TODO - HACK
+ check if the given filter name realy exist ...
+ Because our old implementation worked with an internal
+ type name instead of a filter name. For a small migration time
+ we must simulate this old feature :-( */
+
+ if (!m_rCache->hasItem(FilterCache::E_FILTER, sFilter) && m_rCache->hasItem(FilterCache::E_TYPE, sFilter))
+ {
+ OSL_ENSURE(sal_False, "Who use this deprecated functionality?");
+ _FILTER_CONFIG_LOG_("FilterFactory::createInstanceWithArguments() ... simulate old type search functionality!\n");
+
+ css::uno::Sequence< css::beans::NamedValue > lQuery(1);
+ lQuery[0].Name = PROPNAME_TYPE;
+ lQuery[0].Value <<= sFilter;
+
+ css::uno::Reference< css::container::XEnumeration > xSet = createSubSetEnumerationByProperties(lQuery);
+ while(xSet->hasMoreElements())
+ {
+ ::comphelper::SequenceAsHashMap lHandlerProps(xSet->nextElement());
+ if (!(lHandlerProps[PROPNAME_NAME] >>= sRealFilter))
+ continue;
+ }
+
+ // prevent outside code against NoSuchElementException!
+ // But dont implement such defensive strategy for our new create handling :-)
+ if (!m_rCache->hasItem(FilterCache::E_FILTER, sRealFilter))
+ return css::uno::Reference< css::uno::XInterface>();
+ }
+
+ /* <- HACK */
+
+ #endif // _FILTER_CONFIG_MIGRATION_Q_
+
+ // search filter on cache
+ CacheItem aFilter = m_rCache->getItem(FilterCache::E_FILTER, sRealFilter);
+ ::rtl::OUString sFilterService;
+ aFilter[PROPNAME_FILTERSERVICE] >>= sFilterService;
+
+ // create service instance
+ css::uno::Reference< css::uno::XInterface > xFilter;
+ if (sFilterService.getLength())
+ xFilter = m_xSMGR->createInstance(sFilterService);
+
+ // initialize filter
+ css::uno::Reference< css::lang::XInitialization > xInit(xFilter, css::uno::UNO_QUERY);
+ if (xInit.is())
+ {
+ // format: lInitData[0] = seq<PropertyValue>, which contains all configuration properties of this filter
+ // lInitData[1] = lArguments[0]
+ // ...
+ // lInitData[n] = lArguments[n-1]
+ css::uno::Sequence< css::beans::PropertyValue > lConfig;
+ aFilter >> lConfig;
+
+ ::comphelper::SequenceAsVector< css::uno::Any > stlArguments(lArguments);
+ stlArguments.insert(stlArguments.begin(), css::uno::makeAny(lConfig));
+
+ css::uno::Sequence< css::uno::Any > lInitData;
+ stlArguments >> lInitData;
+
+ xInit->initialize(lInitData);
+ }
+
+ return xFilter;
+ // <- SAFE
+}
+
+/*-----------------------------------------------
+ 18.02.2004 14:21
+-----------------------------------------------*/
+css::uno::Sequence< ::rtl::OUString > SAL_CALL FilterFactory::getAvailableServiceNames()
+ throw(css::uno::RuntimeException)
+{
+ /* Attention: Instead of getElementNames() this method have to return only filter names,
+ which can be created as UNO Services realy. Thats why we search for filters,
+ which dont have a valid value for the property "FilterService".
+ Of course we cant check for corrupted service names here. We can check
+ for empty strings only ...
+ */
+ CacheItem lIProps;
+ CacheItem lEProps;
+ lEProps[PROPNAME_FILTERSERVICE] <<= ::rtl::OUString();
+
+ OUStringList lUNOFilters;
+ try
+ {
+ lUNOFilters = m_rCache->getMatchingItemsByProps(FilterCache::E_FILTER, lIProps, lEProps);
+ }
+ catch(const css::uno::RuntimeException&)
+ { throw; }
+ catch(const css::uno::Exception&)
+ { lUNOFilters.clear(); }
+
+ return lUNOFilters.getAsConstList();
+}
+
+/*-----------------------------------------------
+ 11.03.2004 08:37
+-----------------------------------------------*/
+css::uno::Reference< css::container::XEnumeration > SAL_CALL FilterFactory::createSubSetEnumerationByQuery(const ::rtl::OUString& sQuery)
+ throw (css::uno::RuntimeException)
+{
+ // reject old deprecated queries ...
+ if (sQuery.matchAsciiL("_filterquery_",13,0))
+ throw css::uno::RuntimeException(
+ _FILTER_CONFIG_FROM_ASCII_("Use of deprecated and now unsupported query!"),
+ static_cast< css::container::XContainerQuery* >(this));
+
+ // convert "_query_xxx:..." to "getByDocService=xxx:..."
+ ::rtl::OUString sNewQuery(sQuery);
+ sal_Int32 pos = sNewQuery.indexOf(::rtl::OUString::createFromAscii("_query_"),0);
+ if (pos != -1)
+ {
+ OSL_ENSURE(sal_False, "DEPRECATED!\nPlease use new query format: 'matchByDocumentService=...'");
+ ::rtl::OUStringBuffer sPatchedQuery(256);
+ sPatchedQuery.appendAscii("matchByDocumentService=");
+ sPatchedQuery.append (sNewQuery.copy(7) );
+ sNewQuery = sPatchedQuery.makeStringAndClear();
+ }
+
+ // analyze query and split it into its tokens
+ QueryTokenizer lTokens(sNewQuery);
+ QueryTokenizer::const_iterator pIt;
+ OUStringList lEnumSet;
+
+ // start query
+ // (see attention comment below!)
+ if (lTokens.valid())
+ {
+ // SAFE -> ----------------------
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+ // May be not all filters was loaded ...
+ // But we need it now!
+ impl_loadOnDemand();
+ aLock.clear();
+ // <- SAFE ----------------------
+
+ if (lTokens.find(QUERY_IDENTIFIER_GETPREFERREDFILTERFORTYPE) != lTokens.end())
+ OSL_ENSURE(sal_False, "DEPRECATED!\nPlease use prop search at the TypeDetection container!");
+// lEnumSet = impl_queryGetPreferredFilterForType(lTokens);
+ else
+ if (lTokens.find(QUERY_IDENTIFIER_MATCHBYDOCUMENTSERVICE) != lTokens.end())
+ lEnumSet = impl_queryMatchByDocumentService(lTokens);
+ else
+ if (lTokens.find(QUERY_IDENTIFIER_GET_SORTED_FILTERLIST) != lTokens.end())
+ lEnumSet = impl_getSortedFilterList(lTokens);
+ }
+
+ // pack list of item names as an enum list
+ // Attention: Do not return empty reference for empty list!
+ // The outside check "hasMoreElements()" should be enough, to detect this state :-)
+// size_t c = lEnumSet.size();
+ css::uno::Sequence< ::rtl::OUString > lSet = lEnumSet.getAsConstList();
+ ::comphelper::OEnumerationByName* pEnum = new ::comphelper::OEnumerationByName(this, lSet);
+ return css::uno::Reference< css::container::XEnumeration >(static_cast< css::container::XEnumeration* >(pEnum), css::uno::UNO_QUERY);
+}
+/*
+ if (lEnumSet.empty())
+ {
+ //-------------------------------------------
+ // 1) getDefaultFilterForType=<internal_typename>
+
+ pIt = lTokens.find(::rtl::OUString::createFromAscii("getDefaultFilterForType"));
+ if (pIt != lTokens.end())
+ {
+ // SAFE ->
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+
+ // might not all types was loaded till now!
+ impl_loadOnDemand();
+
+ ::rtl::OUString sType = pIt->second;
+ FilterCache* pCache = impl_getWorkingCache();
+ if (pCache->hasItem(FilterCache::E_TYPE, sType))
+ {
+ CacheItem aType = pCache->getItem(FilterCache::E_TYPE, sType);
+ ::rtl::OUString sPreferredFilter;
+ aType[PROPNAME_PREFERREDFILTER] >>= sPreferredFilter;
+
+ if (
+ (sPreferredFilter.getLength() ) &&
+ (pCache->hasItem(FilterCache::E_FILTER, sPreferredFilter))
+ )
+ {
+ lEnumSet.push_back(sPreferredFilter);
+ }
+ }
+
+ aLock.clear();
+ // <- SAFE
+ }
+ }
+*/
+
+/*-----------------------------------------------
+ 11.03.2004 08:33
+-----------------------------------------------*/
+OUStringList FilterFactory::impl_queryMatchByDocumentService(const QueryTokenizer& lTokens) const
+{
+ // analyze query
+ QueryTokenizer::const_iterator pIt;
+
+ ::rtl::OUString sDocumentService;
+ sal_Int32 nIFlags = 0;
+ sal_Int32 nEFlags = 0;
+
+ pIt = lTokens.find(QUERY_IDENTIFIER_MATCHBYDOCUMENTSERVICE);
+ if (pIt != lTokens.end())
+ sDocumentService = pIt->second;
+
+#define COMP_HACK
+#ifdef COMP_HACK
+ if (sDocumentService.equalsAscii("writer"))
+ {
+ OSL_ENSURE(sal_False, "DEPRECATED!\nPlease use right document service for filter query!");
+ sDocumentService = ::rtl::OUString::createFromAscii("com.sun.star.text.TextDocument");
+ }
+ else
+ if (sDocumentService.equalsAscii("web"))
+ {
+ OSL_ENSURE(sal_False, "DEPRECATED!\nPlease use right document service for filter query!");
+ sDocumentService = ::rtl::OUString::createFromAscii("com.sun.star.text.WebDocument");
+ }
+ else
+ if (sDocumentService.equalsAscii("global"))
+ {
+ OSL_ENSURE(sal_False, "DEPRECATED!\nPlease use right document service for filter query!");
+ sDocumentService = ::rtl::OUString::createFromAscii("com.sun.star.text.GlobalDocument");
+ }
+ else
+ if (sDocumentService.equalsAscii("calc"))
+ {
+ OSL_ENSURE(sal_False, "DEPRECATED!\nPlease use right document service for filter query!");
+ sDocumentService = ::rtl::OUString::createFromAscii("com.sun.star.sheet.SpreadsheetDocument");
+ }
+ else
+ if (sDocumentService.equalsAscii("draw"))
+ {
+ OSL_ENSURE(sal_False, "DEPRECATED!\nPlease use right document service for filter query!");
+ sDocumentService = ::rtl::OUString::createFromAscii("com.sun.star.drawing.DrawingDocument");
+ }
+ else
+ if (sDocumentService.equalsAscii("impress"))
+ {
+ OSL_ENSURE(sal_False, "DEPRECATED!\nPlease use right document service for filter query!");
+ sDocumentService = ::rtl::OUString::createFromAscii("com.sun.star.presentation.PresentationDocument");
+ }
+ else
+ if (sDocumentService.equalsAscii("math"))
+ {
+ OSL_ENSURE(sal_False, "DEPRECATED!\nPlease use right document service for filter query!");
+ sDocumentService = ::rtl::OUString::createFromAscii("com.sun.star.formula.FormulaProperties");
+ }
+#endif
+
+ pIt = lTokens.find(QUERY_PARAM_IFLAGS);
+ if (pIt != lTokens.end())
+ nIFlags = ::rtl::OUString(pIt->second).toInt32();
+
+ pIt = lTokens.find(QUERY_PARAM_EFLAGS);
+ if (pIt != lTokens.end())
+ nEFlags = ::rtl::OUString(pIt->second).toInt32();
+
+ // SAFE -> ----------------------
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+
+ // search suitable filters
+ FilterCache* pCache = impl_getWorkingCache();
+ OUStringList lFilterNames = pCache->getItemNames(FilterCache::E_FILTER);
+ OUStringList lResult ;
+
+ for (OUStringList::const_iterator pName = lFilterNames.begin();
+ pName != lFilterNames.end() ;
+ ++pName )
+ {
+ try
+ {
+ const ::rtl::OUString& sName = *pName;
+ const CacheItem aFilter = pCache->getItem(FilterCache::E_FILTER, sName);
+ CacheItem::const_iterator pProp ;
+
+ // "matchByDocumentService=" => any filter will be adressed here
+ // "matchByDocumentService=all" => any filter will be adressed here
+ // "matchByDocumentService=com.sun.star..." => only filter matching this document service will be adressed
+ ::rtl::OUString sCheckValue = aFilter.getUnpackedValueOrDefault(PROPNAME_DOCUMENTSERVICE, ::rtl::OUString());
+ if (
+ ( sDocumentService.getLength() ) &&
+ (!sDocumentService.equals(QUERY_CONSTVALUE_ALL)) &&
+ (!sCheckValue.equals(sDocumentService) )
+ )
+ {
+ continue; // ignore filter -> try next one!
+ }
+
+ // "iflags=" => not allowed
+ // "iflags=-1" => not allowed
+ // "iflags=0" => not usefull
+ // "iflags=283648" => only filter, which has set these flag field will be adressed
+ sal_Int32 nCheckValue = aFilter.getUnpackedValueOrDefault(PROPNAME_FLAGS, (sal_Int32)0);
+ if (
+ (nIFlags > 0 ) &&
+ ((nCheckValue & nIFlags) != nIFlags)
+ )
+ {
+ continue; // ignore filter -> try next one!
+ }
+
+ // "eflags=" => not allowed
+ // "eflags=-1" => not allowed
+ // "eflags=0" => not usefull
+ // "eflags=283648" => only filter, which has not set these flag field will be adressed
+ if (
+ (nEFlags > 0 ) &&
+ ((nCheckValue & nEFlags) == nEFlags)
+ )
+ {
+ continue; // ignore filter -> try next one!
+ }
+
+ // OK - this filter passed all checks.
+ // It match the query ...
+ lResult.push_back(sName);
+ }
+ catch(const css::uno::RuntimeException& exRun)
+ { throw exRun; }
+ catch(const css::uno::Exception&)
+ { continue; }
+ }
+
+ aLock.clear();
+ // <- SAFE ----------------------
+
+ return lResult;
+}
+
+/*-----------------------------------------------
+ 21.01.2005 13:39
+-----------------------------------------------*/
+class stlcomp_removeIfMatchFlags
+{
+ private:
+ FilterCache* m_pCache ;
+ sal_Int32 m_nFlags ;
+ sal_Bool m_bIFlags;
+
+ public:
+ stlcomp_removeIfMatchFlags(FilterCache* pCache ,
+ sal_Int32 nFlags ,
+ sal_Bool bIFlags)
+ : m_pCache (pCache )
+ , m_nFlags (nFlags )
+ , m_bIFlags(bIFlags)
+ {}
+
+ bool operator() (const ::rtl::OUString& sFilter) const
+ {
+ try
+ {
+ const CacheItem aFilter = m_pCache->getItem(FilterCache::E_FILTER, sFilter);
+ sal_Int32 nFlags = aFilter.getUnpackedValueOrDefault(PROPNAME_FLAGS, ((sal_Int32)0));
+
+ bool bMatch = false;
+ if (m_bIFlags)
+ // IFlags are interpeted as ALL_FLAGS_MUST_MATCH !
+ bMatch = ((nFlags & m_nFlags) == m_nFlags);
+ else
+ // EFlags are interpreted as ATE_LEAST_ONE_FLAG_MUST_MATCH !
+ bMatch = !(nFlags & m_nFlags);
+ // We are asked for bRemove ! And bMatch = !bRemove => so bRemove = !bMatch .-)
+ return !bMatch;
+ }
+ catch(css::container::NoSuchElementException)
+ {
+ return true;
+ }
+ }
+};
+
+/*-----------------------------------------------
+ 21.01.2005 13:39
+-----------------------------------------------*/
+OUStringList FilterFactory::impl_getSortedFilterList(const QueryTokenizer& lTokens) const
+{
+ // analyze the given query parameter
+ QueryTokenizer::const_iterator pIt1;
+
+ ::rtl::OUString sModule;
+ sal_Int32 nIFlags = -1;
+ sal_Int32 nEFlags = -1;
+
+ pIt1 = lTokens.find(QUERY_PARAM_MODULE);
+ if (pIt1 != lTokens.end())
+ sModule = pIt1->second;
+ pIt1 = lTokens.find(QUERY_PARAM_IFLAGS);
+ if (pIt1 != lTokens.end())
+ nIFlags = ::rtl::OUString(pIt1->second).toInt32();
+ pIt1 = lTokens.find(QUERY_PARAM_EFLAGS);
+ if (pIt1 != lTokens.end())
+ nEFlags = ::rtl::OUString(pIt1->second).toInt32();
+
+ // simple search for filters of one specific module.
+ OUStringList lFilterList;
+ if (sModule.getLength())
+ lFilterList = impl_getSortedFilterListForModule(sModule, nIFlags, nEFlags);
+ else
+ {
+ // more complex search for all filters
+ // We check first, which office modules are installed ...
+ OUStringList lModules = impl_getListOfInstalledModules();
+ OUStringList::const_iterator pIt2;
+ for ( pIt2 = lModules.begin();
+ pIt2 != lModules.end() ;
+ ++pIt2 )
+ {
+ sModule = *pIt2;
+ OUStringList lFilters4Module = impl_getSortedFilterListForModule(sModule, nIFlags, nEFlags);
+ OUStringList::const_iterator pIt3;
+ for ( pIt3 = lFilters4Module.begin();
+ pIt3 != lFilters4Module.end() ;
+ ++pIt3 )
+ {
+ const ::rtl::OUString& sFilter = *pIt3;
+ lFilterList.push_back(sFilter);
+ }
+ }
+ }
+
+ return lFilterList;
+}
+
+/*-----------------------------------------------
+ 21.01.2005 10:19
+-----------------------------------------------*/
+OUStringList FilterFactory::impl_getListOfInstalledModules() const
+{
+ // SAFE -> ----------------------
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+ css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR;
+ aLock.clear();
+ // <- SAFE ----------------------
+
+ try
+ {
+ css::uno::Reference< css::container::XNameAccess > xModuleConfig(
+ ::comphelper::ConfigurationHelper::openConfig(xSMGR,
+ CFGPACKAGE_OOO_MODULES,
+ ::comphelper::ConfigurationHelper::E_READONLY),
+ css::uno::UNO_QUERY_THROW);
+ OUStringList lModules(xModuleConfig->getElementNames());
+ return lModules;
+ }
+ catch(const css::uno::RuntimeException& exRun)
+ { throw exRun; }
+ catch(const css::uno::Exception&)
+ {}
+
+ return OUStringList();
+}
+
+/*-----------------------------------------------
+ 21.01.2005 10:19
+-----------------------------------------------*/
+OUStringList FilterFactory::impl_getSortedFilterListForModule(const ::rtl::OUString& sModule,
+ sal_Int32 nIFlags,
+ sal_Int32 nEFlags) const
+{
+ OUStringList lSortedFilters = impl_readSortedFilterListFromConfig(sModule);
+
+ // get all filters for the requested module
+ CacheItem lIProps;
+ lIProps[PROPNAME_DOCUMENTSERVICE] <<= sModule;
+
+ // SAFE -> ----------------------
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+ FilterCache* pCache = impl_getWorkingCache();
+ OUStringList lOtherFilters = pCache->getMatchingItemsByProps(FilterCache::E_FILTER, lIProps);
+ aLock.clear();
+ // <- SAFE ----------------------
+
+ // bring "other" filters in an alphabeticly order
+ // It's needed below.
+ ::std::sort(lOtherFilters.begin(), lOtherFilters.end());
+
+ // merge both lists together
+ OUStringList lMergedFilters = lSortedFilters;
+ OUStringList::iterator pIt2;
+ OUStringList::iterator pIt3;
+ for ( pIt2 = lOtherFilters.begin();
+ pIt2 != lOtherFilters.end() ;
+ ++pIt2 )
+ {
+ const ::rtl::OUString& rFilter = *pIt2;
+ pIt3 = ::std::find(lSortedFilters.begin(), lSortedFilters.end(), rFilter);
+ if (pIt3 == lSortedFilters.end())
+ lMergedFilters.push_back(rFilter);
+ }
+
+ // remove all filters from this merged list, which does not fit the flag specification
+ if (nIFlags != -1)
+ {
+ pIt2 = ::std::remove_if(lMergedFilters.begin(), lMergedFilters.end(), stlcomp_removeIfMatchFlags(pCache, nIFlags, sal_True));
+ lMergedFilters.erase(pIt2, lMergedFilters.end());
+ }
+ if (nEFlags != -1)
+ {
+ pIt2 = ::std::remove_if(lMergedFilters.begin(), lMergedFilters.end(), stlcomp_removeIfMatchFlags(pCache, nEFlags, sal_False));
+ lMergedFilters.erase(pIt2, lMergedFilters.end());
+ }
+
+ // sort the default filter to the front of this list
+ // TODO
+
+ return lMergedFilters;
+}
+
+/*-----------------------------------------------
+ 21.01.2005 10:19
+-----------------------------------------------*/
+OUStringList FilterFactory::impl_readSortedFilterListFromConfig(const ::rtl::OUString& sModule) const
+{
+ // SAFE -> ----------------------
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+ css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR;
+ aLock.clear();
+ // <- SAFE ----------------------
+
+ try
+ {
+ css::uno::Reference< css::container::XNameAccess > xUISortConfig(
+ ::comphelper::ConfigurationHelper::openConfig(xSMGR,
+ CFGPACKAGE_TD_UISORT,
+ ::comphelper::ConfigurationHelper::E_READONLY),
+ css::uno::UNO_QUERY_THROW);
+
+ // dont ccheck the module name here. If it does not exists, an exception is thrown and catched below.
+ // We return an empty list as result then.
+ css::uno::Reference< css::container::XNameAccess > xModule;
+ xUISortConfig->getByName(sModule) >>= xModule;
+ if (xModule.is()) // only to be on the safe side of life if the exception was not thrown .-)
+ {
+ // Note: convertion of the returned Any to OUStringList throws
+ // an IllegalArgumentException if the type does not match ...
+ // but it resets the OUStringList to a length of 0 if the Any is empty!
+ OUStringList lSortedFilters(xModule->getByName(PROPNAME_SORTEDFILTERLIST));
+ return lSortedFilters;
+ }
+ }
+ catch(const css::uno::RuntimeException& exRun)
+ { throw exRun; }
+ catch(const css::uno::Exception&)
+ {}
+
+ return OUStringList();
+}
+
+/*-----------------------------------------------
+ 09.07.2003 07:43
+-----------------------------------------------*/
+::rtl::OUString FilterFactory::impl_getImplementationName()
+{
+ return ::rtl::OUString::createFromAscii("com.sun.star.comp.filter.config.FilterFactory");
+}
+
+/*-----------------------------------------------
+ 09.07.2003 07:43
+-----------------------------------------------*/
+css::uno::Sequence< ::rtl::OUString > FilterFactory::impl_getSupportedServiceNames()
+{
+ css::uno::Sequence< ::rtl::OUString > lServiceNames(1);
+ lServiceNames[0] = ::rtl::OUString::createFromAscii("com.sun.star.document.FilterFactory");
+ return lServiceNames;
+}
+
+/*-----------------------------------------------
+ 09.07.2003 07:43
+-----------------------------------------------*/
+css::uno::Reference< css::uno::XInterface > SAL_CALL FilterFactory::impl_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR)
+{
+ FilterFactory* pNew = new FilterFactory(xSMGR);
+ return css::uno::Reference< css::uno::XInterface >(static_cast< css::lang::XMultiServiceFactory* >(pNew), css::uno::UNO_QUERY);
+}
+
+ } // namespace config
+} // namespace filter
diff --git a/filter/source/config/cache/filterfactory.hxx b/filter/source/config/cache/filterfactory.hxx
new file mode 100644
index 000000000000..2f0ba31f942b
--- /dev/null
+++ b/filter/source/config/cache/filterfactory.hxx
@@ -0,0 +1,212 @@
+/*************************************************************************
+ *
+ * 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 __FILTER_CONFIG_FILTERFACTORY_HXX_
+#define __FILTER_CONFIG_FILTERFACTORY_HXX_
+
+//_______________________________________________
+// includes
+
+#include "basecontainer.hxx"
+#include "querytokenizer.hxx"
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <cppuhelper/implbase1.hxx>
+
+//_______________________________________________
+// namespace
+
+namespace filter{
+ namespace config{
+
+namespace css = ::com::sun::star;
+
+//_______________________________________________
+// definitions
+
+//_______________________________________________
+
+/** @short implements the service <type scope="com.sun.star.document">FilterFactory</type>.
+ */
+class FilterFactory : public ::cppu::ImplInheritanceHelper1< BaseContainer ,
+ css::lang::XMultiServiceFactory >
+{
+ //-------------------------------------------
+ // native interface
+
+ public:
+
+ //---------------------------------------
+ // ctor/dtor
+
+ /** @short standard ctor to connect this interface wrapper to
+ the global filter cache instance ...
+
+ @param xSMGR
+ reference to the uno service manager, which created this service instance.
+ */
+ FilterFactory(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR);
+
+ //---------------------------------------
+
+ /** @short standard dtor.
+ */
+ virtual ~FilterFactory();
+
+ //-------------------------------------------
+ // uno interface
+
+ public:
+
+ //---------------------------------------
+ // XMultiServiceFactory
+
+ virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance(const ::rtl::OUString& sFilter)
+ throw(css::uno::Exception ,
+ css::uno::RuntimeException);
+
+ virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithArguments(const ::rtl::OUString& sFilter ,
+ const css::uno::Sequence< css::uno::Any >& lArguments)
+ throw(css::uno::Exception ,
+ css::uno::RuntimeException);
+
+ virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableServiceNames()
+ throw(css::uno::RuntimeException);
+
+ //---------------------------------------
+ // XContainerQuery
+
+ virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createSubSetEnumerationByQuery(const ::rtl::OUString& sQuery)
+ throw (css::uno::RuntimeException);
+
+ //-------------------------------------------
+ // internal helper!
+
+ private:
+
+ //---------------------------------------
+
+ /** @short implement the container string query: "matchByDocumentService=:iflags=:eflags=:..."
+
+ @param lTokens
+ the list of query tokens and its values.
+
+ @return A string list of internal filter names, including
+ all filters, which match this query.
+ */
+ OUStringList impl_queryMatchByDocumentService(const QueryTokenizer& lTokens) const;
+
+ //---------------------------------------
+
+ /** TODO document me
+ */
+ OUStringList impl_getListOfInstalledModules() const;
+
+ //---------------------------------------
+
+ /** @short implement the container string query:
+ "getSortedFilterList()[:module=<xxx>]:[iflags=<xxx>][:eflags=<xxx>]"
+
+ @param lTokens
+ the list of query tokens and its values.
+
+ @return A string list of internal filter names, including
+ all filters, which match this query.
+ */
+ OUStringList impl_getSortedFilterList(const QueryTokenizer& lTokens) const;
+
+ //---------------------------------------
+
+ /** TODO document me
+ */
+ OUStringList impl_getSortedFilterListForModule(const ::rtl::OUString& sModule,
+ sal_Int32 nIFlags,
+ sal_Int32 nEFlags) const;
+
+ //---------------------------------------
+
+ /** @short read a specialized and sorted list of filter names from
+ the configuration (matching the specified module)
+
+ @param sModule
+ the module for which the sorted list should be retrieved for.
+
+ @return A string list of internal filter names.
+ Can be empty.
+ */
+ OUStringList impl_readSortedFilterListFromConfig(const ::rtl::OUString& sModule) const;
+
+ //-------------------------------------------
+ // static uno helper!
+
+ public:
+
+ //---------------------------------------
+
+ /** @short return the uno implementation name of this class.
+
+ @descr Because this information is used at several places
+ (and mostly an object instance of this class is not possible)
+ its implemented as a static function!
+
+ @return The fix uno implementation name of this class.
+ */
+ static ::rtl::OUString impl_getImplementationName();
+
+ //---------------------------------------
+
+ /** @short return the list of supported uno services of this class.
+
+ @descr Because this information is used at several places
+ (and mostly an object instance of this class is not possible)
+ its implemented as a static function!
+
+ @return The fix list of uno services supported by this class.
+ */
+ static css::uno::Sequence< ::rtl::OUString > impl_getSupportedServiceNames();
+
+ //---------------------------------------
+
+ /** @short return a new intsnace of this class.
+
+ @descr This method is used by the uno service manager, to create
+ a new instance of this service if needed.
+
+ @param xSMGR
+ reference to the uno service manager, which require
+ this new instance. It should be passed to the new object
+ so it can be used internaly to create own needed uno resources.
+
+ @return The new instance of this service as an uno reference.
+ */
+ static css::uno::Reference< css::uno::XInterface > impl_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR);
+};
+
+ } // namespace config
+} // namespace filter
+
+#endif // __FILTER_CONFIG_FILTERFACTORY_HXX_
diff --git a/filter/source/config/cache/frameloaderfactory.cxx b/filter/source/config/cache/frameloaderfactory.cxx
new file mode 100644
index 000000000000..3c9163899a97
--- /dev/null
+++ b/filter/source/config/cache/frameloaderfactory.cxx
@@ -0,0 +1,198 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include "frameloaderfactory.hxx"
+#include "macros.hxx"
+#include "constant.hxx"
+#include "versions.hxx"
+
+//_______________________________________________
+// includes
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <comphelper/enumhelper.hxx>
+
+//_______________________________________________
+// namespace
+
+namespace filter{
+ namespace config{
+
+namespace css = ::com::sun::star;
+
+//_______________________________________________
+// definitions
+
+/*-----------------------------------------------
+ 09.07.2003 07:43
+-----------------------------------------------*/
+FrameLoaderFactory::FrameLoaderFactory(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR)
+{
+ BaseContainer::init(xSMGR ,
+ FrameLoaderFactory::impl_getImplementationName() ,
+ FrameLoaderFactory::impl_getSupportedServiceNames(),
+ FilterCache::E_FRAMELOADER );
+}
+
+/*-----------------------------------------------
+ 09.07.2003 07:43
+-----------------------------------------------*/
+FrameLoaderFactory::~FrameLoaderFactory()
+{
+}
+
+/*-----------------------------------------------
+ 16.07.2003 13:37
+-----------------------------------------------*/
+css::uno::Reference< css::uno::XInterface > SAL_CALL FrameLoaderFactory::createInstance(const ::rtl::OUString& sLoader)
+ throw(css::uno::Exception ,
+ css::uno::RuntimeException)
+{
+ return createInstanceWithArguments(sLoader, css::uno::Sequence< css::uno::Any >());
+}
+
+/*-----------------------------------------------
+ 17.07.2003 09:00
+-----------------------------------------------*/
+css::uno::Reference< css::uno::XInterface > SAL_CALL FrameLoaderFactory::createInstanceWithArguments(const ::rtl::OUString& sLoader ,
+ const css::uno::Sequence< css::uno::Any >& lArguments)
+ throw(css::uno::Exception ,
+ css::uno::RuntimeException)
+{
+ // SAFE ->
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+
+ ::rtl::OUString sRealLoader = sLoader;
+
+ #ifdef _FILTER_CONFIG_MIGRATION_Q_
+
+ /* -> TODO - HACK
+ check if the given loader name realy exist ...
+ Because our old implementation worked with an internal
+ type name instead of a loader name. For a small migration time
+ we must simulate this old feature :-( */
+
+ if (!m_rCache->hasItem(FilterCache::E_FRAMELOADER, sLoader) && m_rCache->hasItem(FilterCache::E_TYPE, sLoader))
+ {
+ _FILTER_CONFIG_LOG_("FrameLoaderFactory::createInstanceWithArguments() ... simulate old type search functionality!\n");
+
+ css::uno::Sequence< ::rtl::OUString > lTypes(1);
+ lTypes[0] = sLoader;
+
+ css::uno::Sequence< css::beans::NamedValue > lQuery(1);
+ lQuery[0].Name = PROPNAME_TYPES;
+ lQuery[0].Value <<= lTypes;
+
+ css::uno::Reference< css::container::XEnumeration > xSet = createSubSetEnumerationByProperties(lQuery);
+ while(xSet->hasMoreElements())
+ {
+ ::comphelper::SequenceAsHashMap lLoaderProps(xSet->nextElement());
+ if (!(lLoaderProps[PROPNAME_NAME] >>= sRealLoader))
+ continue;
+ }
+
+ // prevent outside code against NoSuchElementException!
+ // But dont implement such defensive strategy for our new create handling :-)
+ if (!m_rCache->hasItem(FilterCache::E_FRAMELOADER, sRealLoader))
+ return css::uno::Reference< css::uno::XInterface>();
+ }
+
+ /* <- HACK */
+
+ #endif // _FILTER_CONFIG_MIGRATION_Q_
+
+ // search loader on cache
+ CacheItem aLoader = m_rCache->getItem(m_eType, sRealLoader);
+
+ // create service instance
+ css::uno::Reference< css::uno::XInterface > xLoader = m_xSMGR->createInstance(sRealLoader);
+
+ // initialize filter
+ css::uno::Reference< css::lang::XInitialization > xInit(xLoader, css::uno::UNO_QUERY);
+ if (xInit.is())
+ {
+ // format: lInitData[0] = seq<PropertyValue>, which contains all configuration properties of this loader
+ // lInitData[1] = lArguments[0]
+ // ...
+ // lInitData[n] = lArguments[n-1]
+ css::uno::Sequence< css::beans::PropertyValue > lConfig;
+ aLoader >> lConfig;
+
+ ::comphelper::SequenceAsVector< css::uno::Any > stlArguments(lArguments);
+ stlArguments.insert(stlArguments.begin(), css::uno::makeAny(lConfig));
+
+ css::uno::Sequence< css::uno::Any > lInitData;
+ stlArguments >> lInitData;
+
+ xInit->initialize(lInitData);
+ }
+
+ return xLoader;
+ // <- SAFE
+}
+
+/*-----------------------------------------------
+ 09.07.2003 07:46
+-----------------------------------------------*/
+css::uno::Sequence< ::rtl::OUString > SAL_CALL FrameLoaderFactory::getAvailableServiceNames()
+ throw(css::uno::RuntimeException)
+{
+ // must be the same list as ((XNameAccess*)this)->getElementNames() return!
+ return getElementNames();
+}
+
+/*-----------------------------------------------
+ 09.07.2003 07:43
+-----------------------------------------------*/
+::rtl::OUString FrameLoaderFactory::impl_getImplementationName()
+{
+ return ::rtl::OUString::createFromAscii("com.sun.star.comp.filter.config.FrameLoaderFactory");
+}
+
+/*-----------------------------------------------
+ 09.07.2003 07:43
+-----------------------------------------------*/
+css::uno::Sequence< ::rtl::OUString > FrameLoaderFactory::impl_getSupportedServiceNames()
+{
+ css::uno::Sequence< ::rtl::OUString > lServiceNames(1);
+ lServiceNames[0] = ::rtl::OUString::createFromAscii("com.sun.star.frame.FrameLoaderFactory");
+ return lServiceNames;
+}
+
+/*-----------------------------------------------
+ 09.07.2003 07:43
+-----------------------------------------------*/
+css::uno::Reference< css::uno::XInterface > SAL_CALL FrameLoaderFactory::impl_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR)
+{
+ FrameLoaderFactory* pNew = new FrameLoaderFactory(xSMGR);
+ return css::uno::Reference< css::uno::XInterface >(static_cast< css::lang::XMultiServiceFactory* >(pNew), css::uno::UNO_QUERY);
+}
+
+ } // namespace config
+} // namespace filter
diff --git a/filter/source/config/cache/frameloaderfactory.hxx b/filter/source/config/cache/frameloaderfactory.hxx
new file mode 100644
index 000000000000..7741f0011f38
--- /dev/null
+++ b/filter/source/config/cache/frameloaderfactory.hxx
@@ -0,0 +1,148 @@
+/*************************************************************************
+ *
+ * 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 __FILTER_CONFIG_FRAMELOADERFACTORY_HXX_
+#define __FILTER_CONFIG_FRAMELOADERFACTORY_HXX_
+
+//_______________________________________________
+// includes
+
+#include "basecontainer.hxx"
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <cppuhelper/implbase1.hxx>
+
+//_______________________________________________
+// namespace
+
+namespace filter{
+ namespace config{
+
+namespace css = ::com::sun::star;
+
+//_______________________________________________
+// definitions
+
+//_______________________________________________
+
+/** @short implements the service <type scope="com.sun.star.document">FrameLoaderFactory</type>.
+ */
+class FrameLoaderFactory : public ::cppu::ImplInheritanceHelper1< BaseContainer ,
+ css::lang::XMultiServiceFactory >
+{
+ //-------------------------------------------
+ // native interface
+
+ public:
+
+ //---------------------------------------
+ // ctor/dtor
+
+ /** @short standard ctor to connect this interface wrapper to
+ the global filter cache instance ...
+
+ @param xSMGR
+ reference to the uno service manager, which created this service instance.
+ */
+ FrameLoaderFactory(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR);
+
+ //---------------------------------------
+
+ /** @short standard dtor.
+ */
+ virtual ~FrameLoaderFactory();
+
+ //-------------------------------------------
+ // uno interface
+
+ public:
+
+ //---------------------------------------
+ // XMultiServiceFactory
+
+ virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance(const ::rtl::OUString& sLoader)
+ throw(css::uno::Exception ,
+ css::uno::RuntimeException);
+
+ virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithArguments(const ::rtl::OUString& sLoader ,
+ const css::uno::Sequence< css::uno::Any >& lArguments)
+ throw(css::uno::Exception ,
+ css::uno::RuntimeException);
+
+ virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableServiceNames()
+ throw(css::uno::RuntimeException);
+
+ //-------------------------------------------
+ // static uno helper!
+
+ public:
+
+ //---------------------------------------
+
+ /** @short return the uno implementation name of this class.
+
+ @descr Because this information is used at several places
+ (and mostly an object instance of this class is not possible)
+ its implemented as a static function!
+
+ @return The fix uno implementation name of this class.
+ */
+ static ::rtl::OUString impl_getImplementationName();
+
+ //---------------------------------------
+
+ /** @short return the list of supported uno services of this class.
+
+ @descr Because this information is used at several places
+ (and mostly an object instance of this class is not possible)
+ its implemented as a static function!
+
+ @return The fix list of uno services supported by this class.
+ */
+ static css::uno::Sequence< ::rtl::OUString > impl_getSupportedServiceNames();
+
+ //---------------------------------------
+
+ /** @short return a new intsnace of this class.
+
+ @descr This method is used by the uno service manager, to create
+ a new instance of this service if needed.
+
+ @param xSMGR
+ reference to the uno service manager, which require
+ this new instance. It should be passed to the new object
+ so it can be used internaly to create own needed uno resources.
+
+ @return The new instance of this service as an uno reference.
+ */
+ static css::uno::Reference< css::uno::XInterface > impl_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR);
+};
+
+ } // namespace config
+} // namespace filter
+
+#endif // __FILTER_CONFIG_FRAMELOADERFACTORY_HXX_
diff --git a/filter/source/config/cache/lateinitlistener.cxx b/filter/source/config/cache/lateinitlistener.cxx
new file mode 100644
index 000000000000..b9b090025227
--- /dev/null
+++ b/filter/source/config/cache/lateinitlistener.cxx
@@ -0,0 +1,136 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include "lateinitlistener.hxx"
+#include "lateinitthread.hxx"
+
+//_______________________________________________
+// includes
+#include <rtl/ustring.hxx>
+
+//_______________________________________________
+// namespace
+
+namespace filter{
+ namespace config{
+
+namespace css = ::com::sun::star;
+
+//_______________________________________________
+// definitions
+
+/*-----------------------------------------------
+ 14.08.2003 07:35
+-----------------------------------------------*/
+LateInitListener::LateInitListener(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR)
+ : BaseLock( )
+ , m_xSMGR (xSMGR)
+{
+ // important to do so ...
+ // Otherwhise the temp. reference to ourselves
+ // will kill us at realeasing time!
+ osl_incrementInterlockedCount( &m_refCount );
+
+ m_xBroadcaster = css::uno::Reference< css::document::XEventBroadcaster >(
+ m_xSMGR->createInstance(::rtl::OUString::createFromAscii("com.sun.star.frame.GlobalEventBroadcaster")),
+ css::uno::UNO_QUERY);
+
+ m_xBroadcaster->addEventListener(static_cast< css::document::XEventListener* >(this));
+
+ osl_decrementInterlockedCount( &m_refCount );
+}
+
+/*-----------------------------------------------
+ 14.08.2003 07:25
+-----------------------------------------------*/
+LateInitListener::~LateInitListener()
+{
+}
+
+/*-----------------------------------------------
+ 14.08.2003 08:45
+-----------------------------------------------*/
+void SAL_CALL LateInitListener::notifyEvent(const css::document::EventObject& aEvent)
+ throw(css::uno::RuntimeException)
+{
+ // wait for events, which indicates finished open of the first document
+ if (
+ (aEvent.EventName.equalsAscii("OnNew") ) ||
+ (aEvent.EventName.equalsAscii("OnLoad"))
+ )
+ {
+ // this thread must be started one times only ...
+ // cancel listener connection before!
+
+ // SAFE ->
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+
+ if ( !m_xBroadcaster.is() )
+ // the beauty of multi-threading ... OnLoad can be notified synchronously or asynchronously. In particular,
+ // SFX-based documents notify it synchronously, database documents do it asynchronously.
+ // Now if multiple documents are opened "at the same time", it is well possible that we get two events from
+ // different threads, where upon the first event, we already remove ourself from m_xBroadcaster, and start
+ // the thread, nonetheless there's also a second notification "in the queue", which will arrive short
+ // thereafter.
+ // In such a case, simply ignore this second event.
+ return;
+
+ m_xBroadcaster->removeEventListener(static_cast< css::document::XEventListener* >(this));
+ m_xBroadcaster.clear();
+
+ aLock.clear();
+ // <- SAFE
+
+ LateInitThread* pThread = new LateInitThread();
+ pThread->create();
+ }
+}
+
+/*-----------------------------------------------
+ 14.08.2003 07:48
+-----------------------------------------------*/
+void SAL_CALL LateInitListener::disposing(const css::lang::EventObject& /* aEvent */ )
+ throw(css::uno::RuntimeException)
+{
+ // ???
+ // Normaly it should never be called. Because we cancel our listener connection
+ // if we got the event about finished open of the first office document.
+ // But if this method was reached, it indicates an office, which was started
+ // (might as remote script container for an external API client) but not realy used.
+
+ // SAFE ->
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+ m_xBroadcaster.clear();
+ aLock.clear();
+ // <- SAFE
+}
+
+ } // namespace config
+} // namespace filter
diff --git a/filter/source/config/cache/lateinitlistener.hxx b/filter/source/config/cache/lateinitlistener.hxx
new file mode 100644
index 000000000000..0ed1abf1e679
--- /dev/null
+++ b/filter/source/config/cache/lateinitlistener.hxx
@@ -0,0 +1,125 @@
+/*************************************************************************
+ *
+ * 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 __FILTER_CONFIG_LATEINITLISTENER_HXX_
+#define __FILTER_CONFIG_LATEINITLISTENER_HXX_
+
+//_______________________________________________
+// includes
+
+#include "cacheitem.hxx"
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XEventListener.hpp>
+#include <com/sun/star/document/XEventListener.hpp>
+#include <com/sun/star/document/XEventBroadcaster.hpp>
+#include <cppuhelper/implbase1.hxx>
+
+//_______________________________________________
+// namespace
+
+namespace filter{
+ namespace config{
+
+//_______________________________________________
+// definitions
+
+//_______________________________________________
+
+/** @short implements a listener, which will update the
+ global filter cache of an office, after zje office
+ startup was finished.
+
+ @descr To perform startup of an office, the filter cache starts
+ with a minimum set of properties only. After the first document
+ was loaded successfully a thread will be started to fill the
+ cache with all other proeprties, so it can work with the whole
+ filter configuration.
+ */
+class LateInitListener : public BaseLock // must be the first one to guarantee right initialized mutex member!
+ , public ::cppu::WeakImplHelper1< css::document::XEventListener >
+{
+ //-------------------------------------------
+ // member
+
+ private:
+
+ /** @short reference to an uno service manager, which can be used
+ to create own needed services. */
+ css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR;
+
+ /** @short reference to the global event broadcaster, which is usde to find
+ out, when the first office document was opened successfully. */
+ css::uno::Reference< css::document::XEventBroadcaster > m_xBroadcaster;
+
+ //-------------------------------------------
+ // native interface
+
+ public:
+
+ //---------------------------------------
+ // ctor/dtor
+
+ /** @short initialize new instance of this class.
+
+ @descr It set a reference to the global filter cache singleton,
+ which should be updated here. Further it starts listening
+ on the global event broadcaster to get the information, when
+ loading of the first document was finished.
+
+ @param xSMGR
+ reference to a service manager, which can be used to create
+ own needed uno services.
+ */
+ LateInitListener(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR);
+
+ //---------------------------------------
+
+ /** @short standard dtor.
+ */
+ virtual ~LateInitListener();
+
+ //-------------------------------------------
+ // uno interface
+
+ public:
+
+ //---------------------------------------
+ // document.XEventListener
+
+ virtual void SAL_CALL notifyEvent(const css::document::EventObject& aEvent)
+ throw(css::uno::RuntimeException);
+
+ //---------------------------------------
+ // lang.XEventListener
+ virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent)
+ throw(css::uno::RuntimeException);
+};
+
+ } // namespace config
+} // namespace filter
+
+#endif // __FILTER_CONFIG_LATEINITLISTENER_HXX_
diff --git a/filter/source/config/cache/lateinitthread.cxx b/filter/source/config/cache/lateinitthread.cxx
new file mode 100644
index 000000000000..13432c30ad0f
--- /dev/null
+++ b/filter/source/config/cache/lateinitthread.cxx
@@ -0,0 +1,80 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include "lateinitthread.hxx"
+
+//_______________________________________________
+// includes
+
+//_______________________________________________
+// namespace
+
+namespace filter{
+ namespace config{
+
+namespace css = ::com::sun::star;
+
+//_______________________________________________
+// definitions
+
+/*-----------------------------------------------
+ 14.08.2003 09:31
+-----------------------------------------------*/
+LateInitThread::LateInitThread()
+{
+}
+
+/*-----------------------------------------------
+ 14.08.2003 08:42
+-----------------------------------------------*/
+LateInitThread::~LateInitThread()
+{
+}
+
+/*-----------------------------------------------
+ 28.10.2003 09:30
+-----------------------------------------------*/
+void SAL_CALL LateInitThread::run()
+{
+ // sal_True => It indicates using of this method by this thread
+ // The filter cache use this information to show an assertion
+ // for "optimization failure" in case the first calli of loadAll()
+ // was not this thread ...
+
+ // Further please dont catch any exception here.
+ // May be they show the problem of a corrupted filter
+ // configuration, which is handled inside our event loop or desktop.main()!
+
+ ::salhelper::SingletonRef< FilterCache > rCache;
+ rCache->load(FilterCache::E_CONTAINS_ALL, sal_True);
+}
+
+ } // namespace config
+} // namespace filter
diff --git a/filter/source/config/cache/lateinitthread.hxx b/filter/source/config/cache/lateinitthread.hxx
new file mode 100644
index 000000000000..c330394d434d
--- /dev/null
+++ b/filter/source/config/cache/lateinitthread.hxx
@@ -0,0 +1,89 @@
+/*************************************************************************
+ *
+ * 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 __FILTER_CONFIG_LATEINITTHREAD_HXX_
+#define __FILTER_CONFIG_LATEINITTHREAD_HXX_
+
+//_______________________________________________
+// includes
+
+#include "filtercache.hxx"
+#include <salhelper/singletonref.hxx>
+#include <osl/thread.hxx>
+
+//_______________________________________________
+// namespace
+
+namespace filter{
+ namespace config{
+
+//_______________________________________________
+// definitions
+
+//_______________________________________________
+
+/** @short implements a thread, which will update the
+ global filter cache of an office, after its
+ startup was finished.
+
+ @descr Its started by a LateInitListener instance ...
+
+ @see LateInitListener
+
+ @attention The filter cache will be blocked during this thrad runs!
+ */
+class LateInitThread : public ::osl::Thread
+{
+ //-------------------------------------------
+ // native interface
+
+ public:
+
+ //---------------------------------------
+ // ctor/dtor
+
+ /** @short initialize new instance of this class.
+ */
+ LateInitThread();
+
+ //---------------------------------------
+
+ /** @short standard dtor.
+ */
+ virtual ~LateInitThread();
+
+ //---------------------------------------
+
+ /** @short thread function.
+ */
+ virtual void SAL_CALL run();
+};
+
+ } // namespace config
+} // namespace filter
+
+#endif // __FILTER_CONFIG_LATEINITTHREAD_HXX_
diff --git a/filter/source/config/cache/macros.hxx b/filter/source/config/cache/macros.hxx
new file mode 100644
index 000000000000..485029ead5a8
--- /dev/null
+++ b/filter/source/config/cache/macros.hxx
@@ -0,0 +1,132 @@
+/*************************************************************************
+ *
+ * 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 _FILTER_CONFIG_MACROS_HXX_
+#define _FILTER_CONFIG_MACROS_HXX_
+
+//_______________________________________________
+
+#include <rtl/ustring.hxx>
+
+#ifdef _FILTER_CONFIG_FROM_ASCII_
+ #error "who already defined such macro :-("
+#endif
+
+#ifdef _FILTER_CONFIG_TO_ASCII_
+ #error "who already defined such macro :-("
+#endif
+
+/*
+//#define _FILTER_CONFIG_FROM_ASCII_(ASCII_STRING) \
+// ::rtl::OUString::createFromAscii(ASCII_STRING)
+*/
+
+#define _FILTER_CONFIG_FROM_ASCII_(ASCII_STRING) \
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ASCII_STRING))
+
+#define _FILTER_CONFIG_TO_ASCII_(UNICODE_STRING) \
+ ::rtl::OUStringToOString(UNICODE_STRING, RTL_TEXTENCODING_UTF8).getStr()
+
+#define _FILTER_CONFIG_LOG_(TEXT)
+#define _FILTER_CONFIG_LOG_1_(FORMAT, ARG1)
+#define _FILTER_CONFIG_LOG_2_(FORMAT, ARG1, ARG2)
+#define _FILTER_CONFIG_LOG_3_(FORMAT, ARG1, ARG2, ARG3)
+
+/*
+#include <rtl/ustrbuf.hxx>
+
+#include <stdio.h>
+
+//_______________________________________________
+
+ #ifdef _FILTER_CONFIG_LOG_
+ #error "who already defined such macro :-("
+ #endif
+
+ #ifdef _FILTER_CONFIG_LOG_1_
+ #error "who already defined such macro :-("
+ #endif
+
+ #ifdef _FILTER_CONFIG_LOG_2_
+ #error "who already defined such macro :-("
+ #endif
+
+ #ifdef _FILTER_CONFIG_LOG_3_
+ #error "who already defined such macro :-("
+ #endif
+
+ //-------------------------------------------
+ // @short append given text to the log file
+ //
+ // @param TEXT [const char*]
+ // contains the text, which should be logged
+ //
+ #define _FILTER_CONFIG_LOG_(TEXT) \
+ { \
+ FILE* pFile = fopen("filtercache.log", "a");\
+ fprintf(pFile, "%s", TEXT); \
+ fclose(pFile); \
+ }
+
+ //-------------------------------------------
+ // @short append given text to the log file
+ // and supports using one optional argument.
+ //
+ // @descr The syntax of FORMAT and ARG1 follows the
+ // mechanism of e.g. sprintf();
+ //
+ // @param FORMAT [const char*]
+ // specify the format of the log message
+ //
+ // @param ARGn
+ // points to any argument(s), which will be used
+ // inside the FORMAT string to replace place holder(s).
+ //
+ #define _FILTER_CONFIG_LOG_1_(FORMAT, ARG1) \
+ { \
+ FILE* pFile = fopen("filtercache.log", "a");\
+ fprintf(pFile, FORMAT, ARG1); \
+ fclose(pFile); \
+ }
+
+ #define _FILTER_CONFIG_LOG_2_(FORMAT, ARG1, ARG2) \
+ { \
+ FILE* pFile = fopen("filtercache.log", "a");\
+ fprintf(pFile, FORMAT, ARG1, ARG2); \
+ fclose(pFile); \
+ }
+
+ #define _FILTER_CONFIG_LOG_3_(FORMAT, ARG1, ARG2, ARG3) \
+ { \
+ FILE* pFile = fopen("filtercache.log", "a");\
+ fprintf(pFile, FORMAT, ARG1, ARG2, ARG3); \
+ fclose(pFile); \
+ }
+
+#endif // OSL_DEBUG_LEVEL < 2
+*/
+#endif // _FILTER_CONFIG_MACROS_HXX_
diff --git a/filter/source/config/cache/makefile.mk b/filter/source/config/cache/makefile.mk
new file mode 100644
index 000000000000..fbc4806b0a32
--- /dev/null
+++ b/filter/source/config/cache/makefile.mk
@@ -0,0 +1,79 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ = ..$/..$/..
+
+PRJNAME = filter
+TARGET = filterconfig
+ENABLE_EXCEPTIONS = TRUE
+VERSION = 1
+USE_DEFFILE = TRUE
+LIBTARGET = NO
+
+# --- Settings ----------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Library -----------------------------------
+
+SHL1TARGET= $(TARGET)$(VERSION)
+
+SLOFILES= \
+ $(SLO)$/configflush.obj \
+ $(SLO)$/basecontainer.obj \
+ $(SLO)$/cacheitem.obj \
+ $(SLO)$/contenthandlerfactory.obj \
+ $(SLO)$/filtercache.obj \
+ $(SLO)$/filterfactory.obj \
+ $(SLO)$/frameloaderfactory.obj \
+ $(SLO)$/lateinitlistener.obj \
+ $(SLO)$/lateinitthread.obj \
+ $(SLO)$/querytokenizer.obj \
+ $(SLO)$/registration.obj \
+ $(SLO)$/typedetection.obj \
+ $(SLO)$/cacheupdatelistener.obj
+
+SHL1OBJS= $(SLOFILES)
+
+SHL1STDLIBS= \
+ $(COMPHELPERLIB) \
+ $(CPPUHELPERLIB) \
+ $(CPPULIB) \
+ $(SALLIB) \
+ $(TOOLSLIB) \
+ $(UNOTOOLSLIB) \
+ $(FWELIB)
+
+DEF1NAME= $(SHL1TARGET)
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+SHL1DEPN=
+SHL1IMPLIB= i$(SHL1TARGET)
+SHL1VERSIONMAP= $(SOLARENV)/src/component.map
+
+# --- Targets ----------------------------------
+
+.INCLUDE : target.mk
diff --git a/filter/source/config/cache/querytokenizer.cxx b/filter/source/config/cache/querytokenizer.cxx
new file mode 100644
index 000000000000..a07a95e37d23
--- /dev/null
+++ b/filter/source/config/cache/querytokenizer.cxx
@@ -0,0 +1,99 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include "querytokenizer.hxx"
+
+//_______________________________________________
+// includes
+
+//_______________________________________________
+// namespace
+
+namespace filter{
+ namespace config{
+
+//_______________________________________________
+// definitions
+
+/*-----------------------------------------------
+ 01.08.2003 10:42
+-----------------------------------------------*/
+QueryTokenizer::QueryTokenizer(const ::rtl::OUString& sQuery)
+ : m_bValid(sal_True)
+{
+ sal_Int32 token = 0;
+ while(token != -1)
+ {
+ ::rtl::OUString sToken = sQuery.getToken(0, ':', token);
+ if (sToken.getLength())
+ {
+ sal_Int32 equal = sToken.indexOf('=');
+
+ if (equal == 0)
+ m_bValid = sal_False;
+ OSL_ENSURE(m_bValid, "QueryTokenizer::QueryTokenizer()\nFound non boolean query parameter ... but its key is empty. Will be ignored!\n");
+
+ ::rtl::OUString sKey;
+ ::rtl::OUString sVal;
+
+ sKey = sToken;
+ if (equal > 0)
+ {
+ sKey = sToken.copy(0 , equal );
+ sVal = sToken.copy(equal+1, sToken.getLength()-(equal+1));
+ }
+
+ if (find(sKey) != end())
+ m_bValid = sal_False;
+ OSL_ENSURE(m_bValid, "QueryTokenizer::QueryTokenizer()\nQuery contains same param more then once. Last one wins :-)\n");
+
+ (*this)[sKey] = sVal;
+ }
+ }
+}
+
+/*-----------------------------------------------
+ 01.08.2003 10:28
+-----------------------------------------------*/
+QueryTokenizer::~QueryTokenizer()
+{
+ /*TODO*/
+}
+
+/*-----------------------------------------------
+ 01.08.2003 10:53
+-----------------------------------------------*/
+sal_Bool QueryTokenizer::valid() const
+{
+ return m_bValid;
+}
+
+ } // namespace config
+} // namespace filter
diff --git a/filter/source/config/cache/querytokenizer.hxx b/filter/source/config/cache/querytokenizer.hxx
new file mode 100644
index 000000000000..0823e49f5616
--- /dev/null
+++ b/filter/source/config/cache/querytokenizer.hxx
@@ -0,0 +1,115 @@
+/*************************************************************************
+ *
+ * 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 _FILTER_CONFIG_QUERYTOKENIZER_HXX_
+#define _FILTER_CONFIG_QUERYTOKENIZER_HXX_
+
+//_______________________________________________
+// includes
+
+#include <hash_map>
+#include <rtl/ustring.hxx>
+
+//_______________________________________________
+// namespace
+
+namespace filter{
+ namespace config{
+
+//_______________________________________________
+// definitions
+
+/** @short It can be used to split any query string (which can be used at the
+ related interface <type scope="com::sun::star::container">XContainerQuery</type>)
+ into its different tokens using a fix schema.
+
+ @descr All queries implemented of the services
+ <ul>
+ <li><type scope="com::sun::star::document">TypeDetection</type></li>
+ <li><type scope="com::sun::star::document">FilterFactory</type></li>
+ <li><type scope="com::sun::star::document">ExtendedTypeDetectionFactory</type></li>
+ <li><type scope="com::sun::star::frame">FrameLoaderFactory</type></li>
+ <li><type scope="com::sun::star::frame">ContentHandlerFactory</type></li>
+ </ul>
+ uses this schema.
+
+ @attention This class is not threadsafe implemented. Because its not neccessary.
+ But you have to make shure, that ist not used as such :-)
+ */
+class QueryTokenizer : public ::std::hash_map< ::rtl::OUString ,
+ ::rtl::OUString ,
+ ::rtl::OUStringHash ,
+ ::std::equal_to< ::rtl::OUString > >
+{
+ //-------------------------------------------
+ // member
+
+ private:
+
+ /** @short Because the given query can contain errors,
+ it should be checked outside.
+
+ TODO May its a good idea to describe the real problem
+ more detailed ...
+ */
+ sal_Bool m_bValid;
+
+ //-------------------------------------------
+ // interface
+
+ public:
+
+ /** @short create a new tokenizer instance with a
+ a new query.
+
+ @descr The given query is immidiatly analyzed
+ and seperated into its token, which can
+ be access by some specialized method later.
+
+ @param sQuery
+ the query string.
+ */
+ QueryTokenizer(const ::rtl::OUString& sQuery);
+
+ //---------------------------------------
+
+ /** @short destruct an instance of this class.
+ */
+ virtual ~QueryTokenizer();
+
+ //---------------------------------------
+
+ /** @short can be used to check if analyzing of given query
+ was successfully or not.
+ */
+ virtual sal_Bool valid() const;
+};
+
+ } // namespace config
+} // namespace filter
+
+#endif // _FILTER_CONFIG_QUERYTOKENIZER_HXX_
diff --git a/filter/source/config/cache/registration.cxx b/filter/source/config/cache/registration.cxx
new file mode 100644
index 000000000000..a65f5c42fea8
--- /dev/null
+++ b/filter/source/config/cache/registration.cxx
@@ -0,0 +1,147 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include "registration.hxx"
+
+//_______________________________________________
+// includes
+
+#ifdef _FILTER_CONFIG_CONSTANT_HXX_
+# error "Already included constant.hxx"
+#else
+# define PROPNAME_IMPL_DECL
+# include "constant.hxx"
+#endif
+#include <stdio.h>
+#include "typedetection.hxx"
+#include "filterfactory.hxx"
+#include "contenthandlerfactory.hxx"
+#include "frameloaderfactory.hxx"
+#include "configflush.hxx"
+
+//_______________________________________________
+// namespace
+
+namespace filter{
+ namespace config{
+
+namespace css = ::com::sun::star;
+
+//_______________________________________________
+// definitions
+
+rtl::OUString pFilterStrings[19];
+static bool bInitialized = false;
+
+static void InitConstants()
+{
+ if (!bInitialized)
+ {
+ ::osl::MutexGuard aGuard(::osl::Mutex::getGlobalMutex());
+ if (!bInitialized)
+ {
+ PROPNAME_NAME;
+ PROPNAME_UINAME;
+ PROPNAME_UINAMES;
+ PROPNAME_PREFERRED;
+ PROPNAME_PREFERREDFILTER;
+ PROPNAME_DETECTSERVICE;
+ PROPNAME_MEDIATYPE;
+ PROPNAME_CLIPBOARDFORMAT;
+ PROPNAME_URLPATTERN;
+ PROPNAME_EXTENSIONS;
+ PROPNAME_TYPE;
+ PROPNAME_DOCUMENTSERVICE;
+ PROPNAME_FILTERSERVICE;
+ PROPNAME_UICOMPONENT;
+ PROPNAME_FLAGS;
+ PROPNAME_USERDATA;
+ PROPNAME_TEMPLATENAME;
+ PROPNAME_FILEFORMATVERSION;
+ PROPNAME_TYPES;
+ bInitialized = true;
+ }
+ }
+}
+
+// extern "C" component_getImplementationEnvironment()
+_COMPHELPER_COMPONENT_GETIMPLEMENTATIONENVIRONMENT
+
+// extern "C" component_writeInfo()
+_COMPHELPER_COMPONENT_WRITEINFO
+(
+ _COMPHELPER_COMPONENTINFO( TypeDetection ,
+ TypeDetection::impl_getImplementationName() ,
+ TypeDetection::impl_getSupportedServiceNames())
+
+ _COMPHELPER_COMPONENTINFO( FilterFactory ,
+ FilterFactory::impl_getImplementationName() ,
+ FilterFactory::impl_getSupportedServiceNames())
+
+ _COMPHELPER_COMPONENTINFO( ContentHandlerFactory ,
+ ContentHandlerFactory::impl_getImplementationName() ,
+ ContentHandlerFactory::impl_getSupportedServiceNames())
+
+ _COMPHELPER_COMPONENTINFO( FrameLoaderFactory ,
+ FrameLoaderFactory::impl_getImplementationName() ,
+ FrameLoaderFactory::impl_getSupportedServiceNames())
+
+ _COMPHELPER_COMPONENTINFO( ConfigFlush ,
+ ConfigFlush::impl_getImplementationName() ,
+ ConfigFlush::impl_getSupportedServiceNames())
+)
+
+// extern "C" component_getFactory()
+_COMPHELPER_COMPONENT_GETFACTORY
+(
+ { InitConstants(); },
+ _COMPHELPER_MULTIINSTANCEFACTORY( TypeDetection::impl_getImplementationName() ,
+ TypeDetection::impl_getSupportedServiceNames(),
+ TypeDetection::impl_createInstance )
+
+ _COMPHELPER_MULTIINSTANCEFACTORY( FilterFactory::impl_getImplementationName() ,
+ FilterFactory::impl_getSupportedServiceNames(),
+ FilterFactory::impl_createInstance )
+
+ _COMPHELPER_MULTIINSTANCEFACTORY( ContentHandlerFactory::impl_getImplementationName() ,
+ ContentHandlerFactory::impl_getSupportedServiceNames(),
+ ContentHandlerFactory::impl_createInstance )
+
+ _COMPHELPER_MULTIINSTANCEFACTORY( FrameLoaderFactory::impl_getImplementationName() ,
+ FrameLoaderFactory::impl_getSupportedServiceNames(),
+ FrameLoaderFactory::impl_createInstance )
+
+ _COMPHELPER_ONEINSTANCEFACTORY( ConfigFlush::impl_getImplementationName() ,
+ ConfigFlush::impl_getSupportedServiceNames(),
+ ConfigFlush::impl_createInstance )
+)
+
+ } // namespace config
+} // namespace filter
diff --git a/filter/source/config/cache/registration.hxx b/filter/source/config/cache/registration.hxx
new file mode 100644
index 000000000000..38e5980c967a
--- /dev/null
+++ b/filter/source/config/cache/registration.hxx
@@ -0,0 +1,214 @@
+/*************************************************************************
+ *
+ * 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 __COMPHELPER_REGISTRATION_HXX_
+#define __COMPHELPER_REGISTRATION_HXX_
+
+//_______________________________________________
+// includes
+
+#include <com/sun/star/registry/XRegistryKey.hpp>
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/registry/InvalidRegistryException.hpp>
+#include <rtl/ustrbuf.hxx>
+#include <cppuhelper/factory.hxx>
+
+//_______________________________________________
+// namespace
+
+namespace comphelper{
+
+//_______________________________________________
+// declaration
+
+//_______________________________________________
+
+/** TODO doc
+ */
+#define _COMPHELPER_COMPONENT_GETIMPLEMENTATIONENVIRONMENT \
+ extern "C" void SAL_CALL component_getImplementationEnvironment(const sal_Char** ppEnvironmentTypeName, \
+ uno_Environment** /* ppEnvironment */ ) \
+ { \
+ *ppEnvironmentTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; \
+ }
+
+//_______________________________________________
+
+/** @short creates a new key inside component registry.
+
+ @descr using: a) _COMPHELPER_COMPONENTINFO( MyClass,
+ MyClass::st_getImplName(),
+ MyClass::st_getServNames())
+
+ b) _COMPHELPER_COMPONENTINFO( MyClass,
+ ::rtl::OUString::createFromAscii("css.MyClass"),
+ lServiceNames)
+
+ @param CLASS
+ must be the class name of the implementation
+ of an uno service, which should be registered here.
+
+ @param IMPLEMENTATIONNAME
+ can be an uno implementation name from type [::rtl::OUString]
+ directly or any possible method call, which returns such
+ name.
+
+ @param SERVICENAME
+ a list of supported uno service names from type
+ [css::uno::Sequence< ::rtl::OUString >]
+ or any possible method call, which returns such
+ list.
+ */
+#define _COMPHELPER_COMPONENTINFO(CLASS, IMPLEMENTATIONNAME, SERVICENAMES) \
+ /*define new scope to prevent multiple using of the same variables ... */ \
+ { \
+ /* build new key name */ \
+ ::rtl::OUStringBuffer sKeyBuf(256); \
+ sKeyBuf.appendAscii("/" ); \
+ sKeyBuf.append (IMPLEMENTATIONNAME); \
+ sKeyBuf.appendAscii("/UNO/SERVICES" ); \
+ ::rtl::OUString sKey = sKeyBuf.makeStringAndClear(); \
+ \
+ /* try to register this service ... thrown exception will be catched by COMPONENT_WRITEINFO! */ \
+ css::uno::Reference< css::registry::XRegistryKey > xKey = xRoot->createKey(sKey); \
+ if (!xKey.is()) \
+ throw css::registry::InvalidRegistryException(sKey, css::uno::Reference< css::uno::XInterface >()); \
+ \
+ /* dont optimize it! it must work for simple types and function calls! */ \
+ const css::uno::Sequence< ::rtl::OUString > lServiceNames = SERVICENAMES; \
+ const ::rtl::OUString* pServiceNames = lServiceNames.getConstArray(); \
+ sal_Int32 nCount = lServiceNames.getLength(); \
+ \
+ for (sal_Int32 i=0; i<nCount; ++i) \
+ xKey->createKey(pServiceNames[i]); \
+ }
+
+//_______________________________________________
+
+/** @short implments extern C function component_writeInfo
+
+ @descr using: _COMPHELPER_COMPONENT_WRITEINFO
+ (
+ _COMPHELPER_COMPONENTINFO(...)
+ ..
+ _COMPHELPER_COMPONENTINFO(...)
+ )
+
+ @param INFOLIST
+ list of macros of type COMPONENTINFO without(!) any
+ seperator signs between two elements.
+ */
+#define _COMPHELPER_COMPONENT_WRITEINFO(INFOLIST) \
+ extern "C" sal_Bool SAL_CALL component_writeInfo(void* pServiceManager, \
+ void* pRegistryKey ) \
+ { \
+ if (!pServiceManager || !pRegistryKey) \
+ return sal_False; \
+ \
+ css::uno::Reference< css::registry::XRegistryKey > xRoot = reinterpret_cast< css::registry::XRegistryKey* >(pRegistryKey); \
+ \
+ /*if one of following registration will fail ... an exception is thrown! */ \
+ try \
+ { \
+ /* This parameter will expand to: */ \
+ /* _COMPHELPER_COMPONENTINFO(1) */ \
+ /* ... */ \
+ /* _COMPHELPER_COMPONENTINFO(n) */ \
+ INFOLIST \
+ } \
+ catch(const css::registry::InvalidRegistryException&) \
+ { \
+ return sal_False; \
+ } \
+ return sal_True; \
+ }
+
+//_______________________________________________
+
+/** TODO doc
+ */
+#define _COMPHELPER_MULTIINSTANCEFACTORY(IMPLEMENTATIONNAME, SERVICENAMES, FACTORYMETHOD) \
+ if (IMPLEMENTATIONNAME == sImplName) \
+ xFactory = ::cppu::createSingleFactory(xSMGR , \
+ IMPLEMENTATIONNAME, \
+ FACTORYMETHOD , \
+ SERVICENAMES );
+
+//_______________________________________________
+
+/** TODO doc
+ */
+#define _COMPHELPER_ONEINSTANCEFACTORY(IMPLEMENTATIONNAME, SERVICENAMES, FACTORYMETHOD) \
+ if (IMPLEMENTATIONNAME == sImplName) \
+ xFactory = ::cppu::createOneInstanceFactory(xSMGR , \
+ IMPLEMENTATIONNAME, \
+ FACTORYMETHOD , \
+ SERVICENAMES );
+
+//_______________________________________________
+
+/** TODO doc
+ */
+#define _COMPHELPER_COMPONENT_GETFACTORY(STATIC_INIT,FACTORYLIST) \
+ extern "C" void* SAL_CALL component_getFactory(const sal_Char* pImplementationName, \
+ void* pServiceManager , \
+ void* /* pRegistryKey */ ) \
+ { \
+ if ( \
+ (!pImplementationName) || \
+ (!pServiceManager ) \
+ ) \
+ return NULL; \
+ \
+ STATIC_INIT \
+ \
+ css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = reinterpret_cast< css::lang::XMultiServiceFactory* >(pServiceManager); \
+ css::uno::Reference< css::lang::XSingleServiceFactory > xFactory ; \
+ rtl::OUString sImplName = ::rtl::OUString::createFromAscii(pImplementationName); \
+ \
+ /* This parameter will expand to: */ \
+ /* _COMPHELPER_xxxFACTORY(1) */ \
+ /* else */ \
+ /* ... */ \
+ /* else */ \
+ /* _COMPHELPER_xxxFACTORY(n) */ \
+ FACTORYLIST \
+ \
+ /* And if one of these checks was successfully => xFactory was set! */ \
+ if (xFactory.is()) \
+ { \
+ xFactory->acquire(); \
+ return xFactory.get(); \
+ } \
+ \
+ return NULL; \
+ }
+
+} // namespace comphelper
+
+#endif // #ifndef __COMPHELPER_REGISTRATION_HXX_
diff --git a/filter/source/config/cache/typedetection.cxx b/filter/source/config/cache/typedetection.cxx
new file mode 100644
index 000000000000..4fe9a1df64e6
--- /dev/null
+++ b/filter/source/config/cache/typedetection.cxx
@@ -0,0 +1,1257 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+#include "typedetection.hxx"
+#include "constant.hxx"
+
+//_______________________________________________
+// includes
+#include <com/sun/star/document/XExtendedFilterDetection.hpp>
+#include <com/sun/star/util/XURLTransformer.hpp>
+
+#ifndef _COM_SUN_STAR_IO_XINPUSTREAM_HPP_
+#include <com/sun/star/io/XInputStream.hpp>
+#endif
+#include <com/sun/star/io/XSeekable.hpp>
+#include <com/sun/star/task/XInteractionHandler.hpp>
+#include <tools/wldcrd.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <framework/interaction.hxx>
+#include <tools/urlobj.hxx>
+#include <unotools/localfilehelper.hxx>
+
+//_______________________________________________
+// namespace
+
+namespace filter{
+ namespace config{
+
+namespace css = ::com::sun::star;
+
+//_______________________________________________
+// definitions
+
+// Use this switch to change the behaviour of preselection DocumentService ... (see using for further informations)
+#define IGNORE_NON_URLMATCHING_TYPES_FOR_PRESELECTION_DOCUMENTSERVICE
+
+// enable/disable special handling for CSV/TXT problem
+#define WORKAROUND_CSV_TXT_BUG_i60158
+
+/*-----------------------------------------------
+ 03.07.2003 11:25
+-----------------------------------------------*/
+TypeDetection::TypeDetection(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR)
+{
+ BaseContainer::init(xSMGR ,
+ TypeDetection::impl_getImplementationName() ,
+ TypeDetection::impl_getSupportedServiceNames(),
+ FilterCache::E_TYPE );
+}
+
+/*-----------------------------------------------
+ 03.07.2003 10:36
+-----------------------------------------------*/
+TypeDetection::~TypeDetection()
+{
+}
+
+/*-----------------------------------------------
+ 03.11.2003 08:43
+-----------------------------------------------*/
+::rtl::OUString SAL_CALL TypeDetection::queryTypeByURL(const ::rtl::OUString& sURL)
+ throw (css::uno::RuntimeException)
+{
+ ::rtl::OUString sType;
+
+ // SAFE ->
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+
+ css::util::URL aURL;
+ aURL.Complete = sURL;
+ css::uno::Reference< css::util::XURLTransformer > xParser(m_xSMGR->createInstance(SERVICE_URLTRANSFORMER), css::uno::UNO_QUERY);
+ xParser->parseStrict(aURL);
+
+ // set std types as minimum requirement first!
+ // Only in case no type was found for given URL,
+ // use optional types too ...
+ FlatDetection lFlatTypes;
+ m_rCache->detectFlatForURL(aURL, lFlatTypes);
+
+ if (
+ (lFlatTypes.size() < 1 ) &&
+ (!m_rCache->isFillState(FilterCache::E_CONTAINS_TYPES))
+ )
+ {
+ m_rCache->load(FilterCache::E_CONTAINS_TYPES);
+ m_rCache->detectFlatForURL(aURL, lFlatTypes);
+ }
+
+ // first item is guaranteed as "preferred" one!
+ if (lFlatTypes.size() > 0)
+ {
+ const FlatDetectionInfo& aMatch = *(lFlatTypes.begin());
+ sType = aMatch.sType;
+ }
+
+ return sType;
+ // <- SAFE
+}
+
+/*-----------------------------------------------
+ 31.10.2003 09:36
+-----------------------------------------------*/
+::rtl::OUString SAL_CALL TypeDetection::queryTypeByDescriptor(css::uno::Sequence< css::beans::PropertyValue >& lDescriptor,
+ sal_Bool bAllowDeep )
+ throw (css::uno::RuntimeException)
+{
+ // make the descriptor more useable :-)
+ ::comphelper::MediaDescriptor stlDescriptor(lDescriptor);
+
+ // SAFE -> ----------------------------------
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+
+ //*******************************************
+ // parse given URL to split it into e.g. main and jump marks ...
+ ::rtl::OUString sURL = stlDescriptor.getUnpackedValueOrDefault(::comphelper::MediaDescriptor::PROP_URL(), ::rtl::OUString());
+
+#if OSL_DEBUG_LEVEL > 0
+ if (stlDescriptor.find(::rtl::OUString::createFromAscii("FileName")) != stlDescriptor.end())
+ OSL_ENSURE(sal_False, "Detect using of deprecated and already unsupported MediaDescriptor property \"FileName\"!");
+#endif
+
+ css::util::URL aURL;
+ aURL.Complete = sURL;
+ css::uno::Reference< css::util::XURLTransformer > xParser(m_xSMGR->createInstance(SERVICE_URLTRANSFORMER), css::uno::UNO_QUERY);
+ xParser->parseStrict(aURL);
+
+ //*******************************************
+ // preselected filter, type or document service?
+ // use it as first "flat" detected type later!
+ FlatDetection lFlatTypes;
+ impl_getPreselection(aURL, stlDescriptor, lFlatTypes);
+
+ //*******************************************
+ // get all types, which match to the given descriptor
+ // That can be true by: extensions/url pattern/mime type etcpp.
+ m_rCache->detectFlatForURL(aURL, lFlatTypes);
+
+ aLock.clear();
+ // <- SAFE ----------------------------------
+
+ ::rtl::OUString sType ;
+ ::rtl::OUString sLastChance;
+
+ try
+ {
+ //*******************************************
+ // verify every flat detected (or preselected!) type
+ // by calling its registered deep detection service.
+ // But break this loop if a type match to the given descriptor
+ // by an URL pattern(!) or if deep detection isnt allowed from
+ // outside (bAllowDeep=FALSE) or break the whole detection by
+ // throwing an exception if creation of the might needed input
+ // stream failed by e.g. an IO exception ...
+ OUStringList lUsedDetectors;
+ if (lFlatTypes.size()>0)
+ sType = impl_detectTypeFlatAndDeep(stlDescriptor, lFlatTypes, bAllowDeep, lUsedDetectors, sLastChance);
+
+ //*******************************************
+ // if no flat detected (nor preselected!) type could be
+ // verified and no error occured during creation of
+ // the might needed input stream, start detection
+ // which uses all registered deep detection services.
+ if (
+ (!sType.getLength()) &&
+ (bAllowDeep )
+ )
+ {
+ sType = impl_detectTypeDeepOnly(stlDescriptor, lUsedDetectors);
+ }
+
+ //*******************************************
+ // flat detection failed
+ // pure deep detection failed
+ // => ask might existing InteractionHandler
+ // means: ask user for it's decision
+ if (!sType.getLength())
+ sType = impl_askUserForTypeAndFilterIfAllowed(stlDescriptor);
+
+ //*******************************************
+ // no real detected type - but a might valid one.
+ // update descriptor and set last chance for return.
+ if (!sType.getLength() && sLastChance.getLength())
+ {
+ OSL_ENSURE(sal_False, "set first flat detected type without a registered deep detection service as \"last chance\" ... nevertheless some other deep detections said \"NO\". I TRY IT!");
+ sType = sLastChance;
+ }
+ }
+ catch(const css::uno::RuntimeException&)
+ { throw; }
+ catch(const css::uno::Exception&)
+ { sType = ::rtl::OUString(); }
+
+ //*******************************************
+ // adapt media descriptor, so it contains the right values
+ // for type/filter name/document service/ etcpp.
+ impl_checkResultsAndAddBestFilter(stlDescriptor, sType); // Attention: sType is used as IN/OUT param here and will might be changed inside this method !!!
+ impl_validateAndSetTypeOnDescriptor(stlDescriptor, sType);
+
+ stlDescriptor >> lDescriptor;
+ return sType;
+}
+
+/*-----------------------------------------------
+ 03.07.2003 10:36
+-----------------------------------------------*/
+void TypeDetection::impl_checkResultsAndAddBestFilter(::comphelper::MediaDescriptor& rDescriptor,
+ ::rtl::OUString& sType )
+{
+ // a)
+ // Dont overwrite a might preselected filter!
+ ::rtl::OUString sFilter = rDescriptor.getUnpackedValueOrDefault(
+ ::comphelper::MediaDescriptor::PROP_FILTERNAME(),
+ ::rtl::OUString());
+ if (sFilter.getLength())
+ return;
+
+ // b)
+ // check a preselected document service too.
+ // Then we have to search a suitable filter witin this module.
+ ::rtl::OUString sDocumentService = rDescriptor.getUnpackedValueOrDefault(
+ ::comphelper::MediaDescriptor::PROP_DOCUMENTSERVICE(),
+ ::rtl::OUString());
+ if (sDocumentService.getLength())
+ {
+ try
+ {
+ ::rtl::OUString sRealType = sType;
+
+ #ifdef WORKAROUND_CSV_TXT_BUG_i60158
+ // Workaround for #i60158#
+ // We do not have right filter for Text_Ascii in calc nor a suitable filter for CSV in writer.
+ // So we must overrule our detection and make the right things. Normaly we should have
+ // one type TextAscii and two filters registered for these one type.
+ // But then we loose automatic opening of CSV files in calc instead of opening these files
+ // inside writer.
+ if (
+ (sDocumentService.equalsAscii("com.sun.star.sheet.SpreadsheetDocument")) &&
+ (
+ (sRealType.equalsAscii("writer_Text" )) ||
+ (sRealType.equalsAscii("writer_Text_encoded"))
+ )
+ )
+ {
+ sRealType = ::rtl::OUString::createFromAscii("calc_Text_txt_csv_StarCalc");
+ }
+ else
+ if (
+ (sDocumentService.equalsAscii("com.sun.star.text.TextDocument")) &&
+ (sRealType.equalsAscii("calc_Text_txt_csv_StarCalc" ))
+ )
+ {
+ sRealType = ::rtl::OUString::createFromAscii("writer_Text");
+ }
+ #endif // WORKAROUND_CSV_TXT_BUG_i60158
+
+ // SAFE ->
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+
+ // Attention: For executing next lines of code, We must be shure that
+ // all filters already loaded :-(
+ // That can disturb our "load on demand feature". But we have no other chance!
+ m_rCache->load(FilterCache::E_CONTAINS_FILTERS);
+
+ CacheItem lIProps;
+ lIProps[PROPNAME_DOCUMENTSERVICE] <<= sDocumentService;
+ lIProps[PROPNAME_TYPE ] <<= sRealType;
+ OUStringList lFilters = m_rCache->getMatchingItemsByProps(FilterCache::E_FILTER, lIProps);
+
+ aLock.clear();
+ // <- SAFE
+
+ for ( OUStringList::const_iterator pIt = lFilters.begin();
+ pIt != lFilters.end() && sFilter.getLength() == 0 ;
+ ++pIt )
+ {
+ // SAFE ->
+ aLock.reset();
+ try
+ {
+ CacheItem aFilter = m_rCache->getItem(FilterCache::E_FILTER, *pIt);
+ sal_Int32 nFlags = 0;
+ aFilter[PROPNAME_FLAGS] >>= nFlags;
+
+ if ((nFlags & FLAGVAL_IMPORT) == FLAGVAL_IMPORT)
+ sFilter = *pIt;
+ }
+ catch(const css::uno::Exception&) {}
+ aLock.clear();
+ // <- SAFE
+ }
+
+ if (sFilter.getLength() > 0)
+ {
+ rDescriptor[::comphelper::MediaDescriptor::PROP_TYPENAME() ] <<= sRealType;
+ rDescriptor[::comphelper::MediaDescriptor::PROP_FILTERNAME()] <<= sFilter;
+ sType = sRealType;
+ return;
+ }
+ }
+ catch(const css::uno::Exception&)
+ {}
+ }
+
+ // c)
+ // We can use the preferred filter for the specified type.
+ // Such preferred filter points:
+ // - to the default filter of the preferred application
+ // - or to any other filter if no preferred filter was set.
+ // Note: It's an optimization only!
+ // It's not guaranteed, that such preferred filter exists.
+ sFilter = ::rtl::OUString();
+ try
+ {
+ // SAFE ->
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+
+ CacheItem aType = m_rCache->getItem(FilterCache::E_TYPE, sType);
+ aType[PROPNAME_PREFERREDFILTER] >>= sFilter;
+ CacheItem aFilter = m_rCache->getItem(FilterCache::E_FILTER, sFilter);
+
+ aLock.clear();
+ // <- SAFE
+
+ // no exception => found valid type and filter => set it on the given descriptor
+ rDescriptor[::comphelper::MediaDescriptor::PROP_TYPENAME() ] <<= sType ;
+ rDescriptor[::comphelper::MediaDescriptor::PROP_FILTERNAME()] <<= sFilter;
+ return;
+ }
+ catch(const css::uno::Exception&)
+ {}
+
+ // d)
+ // Search for any import(!) filter, which is registered for this type.
+ sFilter = ::rtl::OUString();
+ try
+ {
+ // SAFE ->
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+
+ // Attention: For executing next lines of code, We must be shure that
+ // all filters already loaded :-(
+ // That can disturb our "load on demand feature". But we have no other chance!
+ m_rCache->load(FilterCache::E_CONTAINS_FILTERS);
+
+ CacheItem lIProps;
+ lIProps[PROPNAME_TYPE] <<= sType;
+ OUStringList lFilters = m_rCache->getMatchingItemsByProps(FilterCache::E_FILTER, lIProps);
+
+ aLock.clear();
+ // <- SAFE
+
+ OUStringList::const_iterator pIt;
+ for ( pIt = lFilters.begin();
+ pIt != lFilters.end() ;
+ ++pIt )
+ {
+ sFilter = *pIt;
+
+ // SAFE ->
+ aLock.reset();
+ try
+ {
+ CacheItem aFilter = m_rCache->getItem(FilterCache::E_FILTER, sFilter);
+ sal_Int32 nFlags = 0;
+ aFilter[PROPNAME_FLAGS] >>= nFlags;
+
+ if ((nFlags & FLAGVAL_IMPORT) == FLAGVAL_IMPORT)
+ break;
+ }
+ catch(const css::uno::Exception&)
+ { continue; }
+ aLock.clear();
+ // <- SAFE
+
+ sFilter = ::rtl::OUString();
+ }
+
+ if (sFilter.getLength())
+ {
+ rDescriptor[::comphelper::MediaDescriptor::PROP_TYPENAME() ] <<= sType ;
+ rDescriptor[::comphelper::MediaDescriptor::PROP_FILTERNAME()] <<= sFilter;
+ return;
+ }
+ }
+ catch(const css::uno::Exception&)
+ {}
+}
+
+/*-----------------------------------------------
+ 14.11.2003 12:06
+-----------------------------------------------*/
+sal_Bool TypeDetection::impl_getPreselectionForType(const ::rtl::OUString& sPreSelType,
+ const css::util::URL& aParsedURL ,
+ FlatDetection& rFlatTypes )
+{
+ // Can be used to supress execution of some parts of this method
+ // if its already clear that detected type is valid or not.
+ // Its neccessary to use shared code at the end, which update
+ // all return parameters constistency!
+ sal_Bool bBreakDetection = sal_False;
+
+ // Further we must know if it matches by pattern
+ // Every flat detected type by pattern wont be detected deep!
+ sal_Bool bMatchByPattern = sal_False;
+
+ // And we must know if a preselection must be preferred, because
+ // it matches by it's extension too.
+ sal_Bool bMatchByExtension = sal_False;
+
+ // If we e.g. collect all filters of a factory (be a forced factory preselection)
+ // we should preferr all filters of this factory, where the type match the given URL.
+ // All other types (which sorrespond to filters of the same factory - but dont match
+ // the URL) should be "used later" for detection and sorted at the end of our return vector
+ // rFlatTypes!
+ // => bPreferredPreselection = (matchByExtension || matchByURLPattern)
+ sal_Bool bPreferredPreselection = sal_False;
+
+ // validate type
+ ::rtl::OUString sType(sPreSelType);
+ CacheItem aType;
+ try
+ {
+ // SAFE -> --------------------------
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+ aType = m_rCache->getItem(FilterCache::E_TYPE, sType);
+ aLock.clear();
+ // <- SAFE --------------------------
+ }
+ catch(const css::container::NoSuchElementException&)
+ {
+ sType = ::rtl::OUString();
+ bBreakDetection = sal_True;
+ }
+
+ if (!bBreakDetection)
+ {
+ // We cant check a preselected type for a given stream!
+ // So we must believe, that it can work ...
+ if (aParsedURL.Complete.equalsAsciiL("private:stream", 14))
+ bBreakDetection = sal_True;
+ }
+
+ if (!bBreakDetection)
+ {
+ // extract extension from URL .. to check it case-insensitive !
+ INetURLObject aParser (aParsedURL.Main);
+ ::rtl::OUString sExtension = aParser.getExtension(INetURLObject::LAST_SEGMENT ,
+ sal_True ,
+ INetURLObject::DECODE_WITH_CHARSET);
+ sExtension = sExtension.toAsciiLowerCase();
+
+ // otherwhise we must know, if it matches to the given URL realy.
+ // especialy if it matches by its extension or pattern registration.
+ OUStringList lExtensions(aType[PROPNAME_EXTENSIONS]);
+ OUStringList lURLPattern(aType[PROPNAME_URLPATTERN]);
+
+ for (OUStringList::const_iterator pIt = lExtensions.begin();
+ pIt != lExtensions.end() ;
+ ++pIt )
+ {
+ ::rtl::OUString sCheckExtension(pIt->toAsciiLowerCase());
+ if (sCheckExtension.equals(sExtension))
+ {
+ bBreakDetection = sal_True;
+ bMatchByExtension = sal_True;
+ bPreferredPreselection = sal_True;
+ break;
+ }
+ }
+
+ if (!bBreakDetection)
+ {
+ for (OUStringList::const_iterator pIt = lURLPattern.begin();
+ pIt != lURLPattern.end() ;
+ ++pIt )
+ {
+ WildCard aCheck(*pIt);
+ if (aCheck.Matches(aParsedURL.Main))
+ {
+ bBreakDetection = sal_True;
+ bMatchByPattern = sal_True;
+ bPreferredPreselection = sal_True;
+ break;
+ }
+ }
+ }
+
+ /*
+ Comment ... why the following line of code should be comened out .-)
+
+ This type does not seem to fit the requirements
+ But its an existing and well known type.
+ At least - [because may be the extension was missing :-( ]
+ we should try to detect this type deep ...
+ So we accept it here :-)
+
+ if (!bBreakDetection)
+ sType = ::rtl::OUString();
+ */
+ }
+
+ // if its a valid type - set it on all return values!
+ if (sType.getLength())
+ {
+ FlatDetectionInfo aInfo;
+ aInfo.sType = sType;
+ aInfo.bMatchByExtension = bMatchByExtension;
+ aInfo.bMatchByPattern = bMatchByPattern;
+ aInfo.bPreselectedAsType = sal_True;
+
+ if (bPreferredPreselection)
+ rFlatTypes.push_front(aInfo);
+ else
+ rFlatTypes.push_back(aInfo);
+
+ return sal_True;
+ }
+
+ // not valid!
+ return sal_False;
+}
+
+/*-----------------------------------------------
+ 14.11.2003 12:09
+-----------------------------------------------*/
+sal_Bool TypeDetection::impl_getPreselectionForFilter(const ::rtl::OUString& sPreSelFilter,
+ const css::util::URL& aParsedURL ,
+ FlatDetection& rFlatTypes )
+{
+ // Can be used to supress execution of some parts of this method
+ // if its already clear that detected filter is valid or not.
+ // Its neccessary to use shared code at the end, which update
+ // all return parameters constistency!
+ sal_Bool bBreakDetection = sal_False;
+
+ // validate filter
+ ::rtl::OUString sFilter(sPreSelFilter);
+ CacheItem aFilter;
+ try
+ {
+ // SAFE -> --------------------------
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+ aFilter = m_rCache->getItem(FilterCache::E_FILTER, sFilter);
+ aLock.clear();
+ // <- SAFE --------------------------
+ }
+ catch(const css::container::NoSuchElementException&)
+ {
+ sFilter = ::rtl::OUString();
+ bBreakDetection = sal_True;
+ }
+
+ if (!bBreakDetection)
+ {
+ // get its type and check if it matches the given URL
+ ::rtl::OUString sType;
+ aFilter[PROPNAME_TYPE] >>= sType;
+
+ bBreakDetection = impl_getPreselectionForType(sType, aParsedURL, rFlatTypes);
+
+ // not a valid type? -> not a valid filter!
+ if (!bBreakDetection)
+ sFilter = ::rtl::OUString();
+ }
+
+ // We have to mark all retrieved preselection items as "preselected by filter"!
+ FlatDetection::iterator pIt;
+ for ( pIt = rFlatTypes.begin();
+ pIt != rFlatTypes.end() ;
+ ++pIt )
+ {
+ FlatDetectionInfo& rInfo = *pIt;
+ rInfo.bPreselectedAsType = sal_False;
+ rInfo.bPreselectedByFilter = sal_True;
+ }
+
+ if (sFilter.getLength())
+ return sal_True;
+ else
+ return sal_False;
+}
+
+/*-----------------------------------------------
+ 14.11.2003 12:11
+-----------------------------------------------*/
+sal_Bool TypeDetection::impl_getPreselectionForDocumentService(const ::rtl::OUString& sPreSelDocumentService,
+ const css::util::URL& aParsedURL ,
+ FlatDetection& rFlatTypes )
+{
+ // get all filters, which match to this doc service
+ OUStringList lFilters;
+ try
+ {
+ // SAFE -> --------------------------
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+
+ // Attention: For executing next lines of code, We must be shure that
+ // all filters already loaded :-(
+ // That can disturb our "load on demand feature". But we have no other chance!
+ m_rCache->load(FilterCache::E_CONTAINS_FILTERS);
+
+ CacheItem lIProps;
+ lIProps[PROPNAME_DOCUMENTSERVICE] <<= sPreSelDocumentService;
+ lFilters = m_rCache->getMatchingItemsByProps(FilterCache::E_FILTER, lIProps);
+
+ aLock.clear();
+ // <- SAFE --------------------------
+ }
+ catch(const css::container::NoSuchElementException&)
+ {
+ lFilters.clear();
+ }
+
+ // step over all filters, and check if its registered type
+ // match the given URL.
+ // But use temp. list of "preselected types" instead of incoming rFlatTypes list!
+ // The reason behind: we must filter the getted results. And copying of stl entries
+ // is an easier job then removing it .-)
+ FlatDetection lPreselections;
+ for (OUStringList::const_iterator pFilter = lFilters.begin();
+ pFilter != lFilters.end() ;
+ ++pFilter )
+ {
+ const ::rtl::OUString sFilter = *pFilter;
+ impl_getPreselectionForFilter(sFilter, aParsedURL, lPreselections);
+ }
+
+ // We have to mark all retrieved preselection items as "preselected by document service".
+ // Further we must ignore all preselected items, which does not match the URL!
+ FlatDetection::iterator pIt;
+ for ( pIt = lPreselections.begin();
+ pIt != lPreselections.end() ;
+ ++pIt )
+ {
+ FlatDetectionInfo& rInfo = *pIt;
+
+ /*
+ #i60158#
+ Preselection by DocumentService ...
+ How many filters (and corresponding types) must be checked ?
+ All or only the list of filters/types, which match to the given URL too ?
+ There is no final decision about this currently. So we make it "configurable" .-)
+ */
+ #ifdef IGNORE_NON_URLMATCHING_TYPES_FOR_PRESELECTION_DOCUMENTSERVICE
+ if (
+ (!rInfo.bMatchByExtension) &&
+ (!rInfo.bMatchByPattern )
+ )
+ continue;
+ #endif
+
+ rInfo.bPreselectedAsType = sal_False;
+ rInfo.bPreselectedByFilter = sal_False;
+ rInfo.bPreselectedByDocumentService = sal_True ;
+ rFlatTypes.push_back(rInfo);
+ }
+
+ return sal_True;
+}
+
+/*-----------------------------------------------
+ 14.11.2003 12:21
+-----------------------------------------------*/
+void TypeDetection::impl_getPreselection(const css::util::URL& aParsedURL ,
+ ::comphelper::MediaDescriptor& rDescriptor,
+ FlatDetection& rFlatTypes )
+{
+ // done to be shure, that only valid results leave this function!
+ rFlatTypes.clear();
+
+ /* #i55122#
+ Sometimes we must detect files without or with real unknown extensions.
+ If it does not work /which can happen of course .-)/, the user tried to preselect
+ the right format. But some special dialogs (e.g. "Insert->Sheet From File")
+ add it's own preselection too.
+ So we have a combination of preselected values ...
+
+ The we should preferr the most important one - set by the user.
+ And the user normaly preselects a filter or type. The preslected
+ document service cames from the dialog.
+
+ Further it doesnt matter if the user preselected a filter or a document service.
+ A filter selection is always more explicit then a document service selection.
+ So it must be pereferred. An order between type and filter selection cant be discussed .-)
+ */
+
+ ::rtl::OUString sSelectedType = rDescriptor.getUnpackedValueOrDefault(::comphelper::MediaDescriptor::PROP_TYPENAME(), ::rtl::OUString());
+ if (sSelectedType.getLength())
+ impl_getPreselectionForType(sSelectedType, aParsedURL, rFlatTypes);
+
+ ::rtl::OUString sSelectedFilter = rDescriptor.getUnpackedValueOrDefault(::comphelper::MediaDescriptor::PROP_FILTERNAME(), ::rtl::OUString());
+ if (sSelectedFilter.getLength())
+ impl_getPreselectionForFilter(sSelectedFilter, aParsedURL, rFlatTypes);
+
+ ::rtl::OUString sSelectedDoc = rDescriptor.getUnpackedValueOrDefault(::comphelper::MediaDescriptor::PROP_DOCUMENTSERVICE(), ::rtl::OUString());
+ if (sSelectedDoc.getLength())
+ impl_getPreselectionForDocumentService(sSelectedDoc, aParsedURL, rFlatTypes);
+}
+
+/*-----------------------------------------------
+ 03.11.2003 09:17
+-----------------------------------------------*/
+::rtl::OUString TypeDetection::impl_detectTypeFlatAndDeep( ::comphelper::MediaDescriptor& rDescriptor ,
+ const FlatDetection& lFlatTypes ,
+ sal_Bool bAllowDeep ,
+ OUStringList& rUsedDetectors,
+ ::rtl::OUString& rLastChance )
+{
+ // reset it everytimes, so the outside code can distinguish between
+ // a set and a not set value.
+ rLastChance = ::rtl::OUString();
+ rUsedDetectors.clear();
+
+ // step over all possible types for this URL.
+ // solutions:
+ // a) no types => no detection
+ // b) deep detection not allowed => return first valid type of list (because its the preferred or the first valid one)
+ // or(!) match by URLPattern => in such case a deep detection will be supressed!
+ // c) type has no detect service => safe the first occured type without a detect service
+ // as "last chance"(!). It will be used outside of this method
+ // if no further type could be detected.
+ // It must be the first one, because it can be a preferred type.
+ // Our types list was sorted by such criteria!
+ // d) detect service return a valid result => return its decision
+ // e) detect service return an invalid result
+ // or any needed information could not be
+ // getted from the cache => ignore it, and continue with search
+
+ for (FlatDetection::const_iterator pFlatIt = lFlatTypes.begin();
+ pFlatIt != lFlatTypes.end() ;
+ ++pFlatIt )
+ {
+ const FlatDetectionInfo& aFlatTypeInfo = *pFlatIt;
+ ::rtl::OUString sFlatType = aFlatTypeInfo.sType;
+
+ if (!impl_validateAndSetTypeOnDescriptor(rDescriptor, sFlatType))
+ continue;
+
+ // b)
+ if (
+ (!bAllowDeep ) ||
+ (aFlatTypeInfo.bMatchByPattern)
+ )
+ {
+ return sFlatType;
+ }
+
+ try
+ {
+ // SAFE -> ----------------------------------
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+ CacheItem aType = m_rCache->getItem(FilterCache::E_TYPE, sFlatType);
+ aLock.clear();
+
+ ::rtl::OUString sDetectService;
+ aType[PROPNAME_DETECTSERVICE] >>= sDetectService;
+
+ // c)
+ if (!sDetectService.getLength())
+ {
+ // accept or not accept flat types without deep detection: that's the question :-)
+ // May be there exists some states, where we have to use our LastChance feature instead
+ // of using the flat type directly.
+ // Here the list of task ID's, which wasrelated to these lines of code:
+ // #i47159#, #i43404#, #i46494#
+
+ // a flat detected type without the chance for a deep detection ... but preselected by the user
+ // explicitly (means preselected as type or filter ... not as documentservice!)
+ // should be accepted. So the user can overrule our detection.
+ if (
+ (aFlatTypeInfo.bPreselectedAsType ) ||
+ (aFlatTypeInfo.bPreselectedByFilter)
+ )
+ return sFlatType;
+
+ // flat detected types without any registered deep detection service and not
+ // preselected by the user can be used as LAST CHANCE in case no other type could
+ // be detected. Of course only the first type without deep detector can be used.
+ // Further ones has to be ignored.
+ if (rLastChance.getLength() < 1)
+ rLastChance = sFlatType;
+
+ continue;
+ }
+
+ // dont forget to add every real asked deep detection service here.
+ // Such detectors will be ignored if may be "impl_detectTypeDeepOnly()"
+ // must be called later!
+ rUsedDetectors.push_back(sDetectService);
+ ::rtl::OUString sDeepType = impl_askDetectService(sDetectService, rDescriptor);
+
+ // d)
+ if (sDeepType.getLength())
+ return sDeepType;
+ }
+ catch(const css::container::NoSuchElementException&)
+ {}
+ // e)
+ }
+
+ return ::rtl::OUString();
+ // <- SAFE ----------------------------------
+}
+
+/*-----------------------------------------------
+ 03.11.2003 09:19
+-----------------------------------------------*/
+::rtl::OUString TypeDetection::impl_detectTypeDeepOnly( ::comphelper::MediaDescriptor& rDescriptor ,
+ const OUStringList& lOutsideUsedDetectors)
+{
+ // We must know if a detect service was already used:
+ // i) in a combined flat/deep detection scenario outside or
+ // ii) in this method for a deep detection only.
+ // Reason: Such deep detection services work differently in these two modes!
+ OUStringList lInsideUsedDetectors;
+ OUStringList::const_iterator pIt;
+
+ // a)
+ // The list of "already used detect services" correspond to the list
+ // of preselected or flat detected types. But these detect services was called
+ // to check these types explicitly and return black/white ... yes/no only.
+ // Now they are called to return any possible result. But we should preferr
+ // these already used detect services against all other ones!
+ for ( pIt = lOutsideUsedDetectors.begin();
+ pIt != lOutsideUsedDetectors.end() ;
+ ++pIt )
+ {
+ const ::rtl::OUString& sDetectService = *pIt;
+ ::rtl::OUString sDeepType = impl_askDetectService(sDetectService, rDescriptor);
+ if (sDeepType.getLength())
+ return sDeepType;
+ lInsideUsedDetectors.push_back(sDetectService);
+ }
+
+ // SAFE -> ----------------------------------
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+ OUStringList lDetectors = m_rCache->getItemNames(FilterCache::E_DETECTSERVICE);
+ aLock.clear();
+ // <- SAFE ----------------------------------
+
+ // b)
+ // Sometimes it would be nice to ask a special set of detect services before
+ // any other detect service is asked. E.g. by using a preselection of a DocumentService.
+ // That's needed to prevent us from asking the "wrong application module" and
+ // opening the files into the "wrong application".
+ ::rtl::OUString sPreselDocumentService = rDescriptor.getUnpackedValueOrDefault(
+ ::comphelper::MediaDescriptor::PROP_DOCUMENTSERVICE(),
+ ::rtl::OUString());
+ if (sPreselDocumentService.getLength())
+ {
+ for ( pIt = lDetectors.begin();
+ pIt != lDetectors.end() ;
+ ++pIt )
+ {
+ const ::rtl::OUString& sDetectService = *pIt;
+
+ OUStringList::const_iterator pAlreadyUsed = ::std::find(lInsideUsedDetectors.begin(), lInsideUsedDetectors.end(), sDetectService);
+ if (pAlreadyUsed != lInsideUsedDetectors.end())
+ continue;
+
+ // SAFE -> --------------------------------------------------------
+ aLock.reset();
+
+ CacheItem lIProps;
+ lIProps[PROPNAME_DETECTSERVICE] <<= sDetectService;
+ OUStringList lTypes = m_rCache->getMatchingItemsByProps(FilterCache::E_TYPE, lIProps);
+
+ aLock.clear();
+ // <- SAFE --------------------------------------------------------
+
+ sal_Bool bMatchDetectorToDocumentService = sal_False;
+ OUStringList::const_iterator pIt2;
+ for ( pIt2 = lTypes.begin();
+ pIt2 != lTypes.end() ;
+ ++pIt2 )
+ {
+ const ::rtl::OUString& sType = *pIt2;
+
+ try
+ {
+ // SAFE -> ----------------------------------------------------
+ aLock.reset();
+
+ CacheItem aType = m_rCache->getItem(FilterCache::E_TYPE, sType);
+ ::rtl::OUString sFilter;
+ aType[PROPNAME_PREFERREDFILTER] >>= sFilter;
+ CacheItem aFilter = m_rCache->getItem(FilterCache::E_FILTER, sFilter);
+ ::rtl::OUString sCheckDocumentService;
+ aFilter[PROPNAME_DOCUMENTSERVICE] >>= sCheckDocumentService;
+
+ aLock.clear();
+ // <- SAFE
+
+ if (sCheckDocumentService.equals(sPreselDocumentService))
+ {
+ bMatchDetectorToDocumentService = sal_True;
+ break;
+ }
+ }
+ catch(const css::uno::Exception&)
+ { continue; }
+ }
+
+ if (bMatchDetectorToDocumentService)
+ {
+ ::rtl::OUString sDeepType = impl_askDetectService(sDetectService, rDescriptor);
+ if (sDeepType.getLength())
+ return sDeepType;
+ lInsideUsedDetectors.push_back(sDetectService);
+ }
+ }
+ }
+
+ // c)
+ // Last chance. No "used detectors", no "preselected detectors" ... ask any existing detect services
+ // for this till know unknown format.
+ for ( pIt = lDetectors.begin();
+ pIt != lDetectors.end() ;
+ ++pIt )
+ {
+ const ::rtl::OUString& sDetectService = *pIt;
+
+ OUStringList::const_iterator pAlreadyUsed = ::std::find(lInsideUsedDetectors.begin(), lInsideUsedDetectors.end(), sDetectService);
+ if (pAlreadyUsed != lInsideUsedDetectors.end())
+ continue;
+
+ ::rtl::OUString sDeepType = impl_askDetectService(sDetectService, rDescriptor);
+ if (sDeepType.getLength())
+ return sDeepType;
+ }
+
+ return ::rtl::OUString();
+}
+
+/*-----------------------------------------------
+ 07.03.2005 11:13
+-----------------------------------------------*/
+void TypeDetection::impl_seekStreamToZero(comphelper::MediaDescriptor& rDescriptor)
+{
+ // try to seek to 0 ...
+ // But because XSeekable is an optional interface ... try it only .-)
+ css::uno::Reference< css::io::XInputStream > xStream = rDescriptor.getUnpackedValueOrDefault(
+ ::comphelper::MediaDescriptor::PROP_INPUTSTREAM(),
+ css::uno::Reference< css::io::XInputStream >());
+ css::uno::Reference< css::io::XSeekable > xSeek(xStream, css::uno::UNO_QUERY);
+ if (xSeek.is())
+ {
+ try
+ {
+ xSeek->seek(0);
+ }
+ catch(const css::uno::RuntimeException& exRun)
+ { throw exRun; }
+ catch(const css::uno::Exception&)
+ {}
+ }
+}
+
+/*-----------------------------------------------
+ 30.10.2003 15:12
+-----------------------------------------------*/
+::rtl::OUString TypeDetection::impl_askDetectService(const ::rtl::OUString& sDetectService,
+ ::comphelper::MediaDescriptor& rDescriptor )
+{
+ // Open the stream and add it to the media descriptor if this method is called for the first time.
+ // All following requests to this method will detect, that there already exists a stream .-)
+ // Attention: This method throws an exception if the stream could not be opened.
+ // It's important to break any further detection in such case.
+ // Catch it on the highest detection level only !!!
+ impl_openStream(rDescriptor);
+
+ // seek to 0 is an optional feature to be more robust against
+ // "simple implemented detect services" .-)
+ impl_seekStreamToZero(rDescriptor);
+
+ css::uno::Reference< css::document::XExtendedFilterDetection > xDetector;
+ css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR;
+
+ // SAFE ->
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+ xSMGR = m_xSMGR;
+ aLock.clear();
+ // <- SAFE
+
+ // Attention! If e.g. an office module was not installed sometimes we find a
+ // registered detect service, which is referred inside the configuration ... but not realy
+ // installed. On the other side we use third party components here, which can make trouble anyway.
+ // So we should handle errors during creation of such services more gracefully .-)
+ xDetector = css::uno::Reference< css::document::XExtendedFilterDetection >(
+ xSMGR->createInstance(sDetectService),
+ css::uno::UNO_QUERY);
+
+ if ( ! xDetector.is())
+ return ::rtl::OUString();
+
+ ::rtl::OUString sDeepType;
+ try
+ {
+ // start deep detection
+ // Dont forget to convert stl descriptor to its uno representation.
+
+ /* Attention!
+ You have to use an explicit instance of this uno sequence ...
+ Because its used as an in out parameter. And in case of a temp. used object
+ we will run into memory corruptions!
+ */
+ css::uno::Sequence< css::beans::PropertyValue > lDescriptor;
+ rDescriptor >> lDescriptor;
+ sDeepType = xDetector->detect(lDescriptor);
+ rDescriptor << lDescriptor;
+ }
+ catch(const css::uno::Exception&)
+ {
+ // We should ignore errors here.
+ // Thrown exceptions mostly will end in crash recovery ...
+ // But might be we find another deep detection service which can detect the same
+ // document without a problem .-)
+ sDeepType = ::rtl::OUString();
+ }
+
+ // seek to 0 is an optional feature to be more robust against
+ // "simple implemented detect services" .-)
+ impl_seekStreamToZero(rDescriptor);
+
+ // analyze the results
+ // a) detect service returns "" => return "" too and remove TYPE/FILTER prop from descriptor
+ // b) returned type is unknown => return "" too and remove TYPE/FILTER prop from descriptor
+ // c) returned type is valid => check TYPE/FILTER props inside descriptor and return the type
+
+ // this special helper checks for a valid type
+ // and set right values on the descriptor!
+ sal_Bool bValidType = impl_validateAndSetTypeOnDescriptor(rDescriptor, sDeepType);
+ if (bValidType)
+ return sDeepType;
+
+ return ::rtl::OUString();
+}
+
+/*-----------------------------------------------
+ 17.12.2004 13:47
+-----------------------------------------------*/
+::rtl::OUString TypeDetection::impl_askUserForTypeAndFilterIfAllowed(::comphelper::MediaDescriptor& rDescriptor)
+{
+ // SAFE ->
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+ css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR;
+ aLock.clear();
+ // <- SAFE
+
+ css::uno::Reference< css::task::XInteractionHandler > xInteraction =
+ rDescriptor.getUnpackedValueOrDefault(::comphelper::MediaDescriptor::PROP_INTERACTIONHANDLER(),
+ css::uno::Reference< css::task::XInteractionHandler >());
+
+ if (!xInteraction.is())
+ return ::rtl::OUString();
+
+ ::rtl::OUString sURL =
+ rDescriptor.getUnpackedValueOrDefault(::comphelper::MediaDescriptor::PROP_URL(),
+ ::rtl::OUString());
+
+ css::uno::Reference< css::io::XInputStream > xStream =
+ rDescriptor.getUnpackedValueOrDefault(::comphelper::MediaDescriptor::PROP_INPUTSTREAM(),
+ css::uno::Reference< css::io::XInputStream >());
+
+ // Dont distrub the user for "non existing files - means empty URLs" or
+ // if we was forced to detect a stream.
+ // Reason behind: We must be shure to ask user for "unknown contents" only ...
+ // and not for "missing files". Especialy if detection is done by a stream only
+ // we cant check if the stream points to an "existing content"!
+ if (
+ (!sURL.getLength() ) || // "non existing file" ?
+ (!xStream.is() ) || // non existing file !
+ (sURL.equalsIgnoreAsciiCaseAsciiL("private:stream", 14)) // not a good idea .-)
+ )
+ return ::rtl::OUString();
+
+ try
+ {
+ // create a new request to ask user for it's decision about the usable filter
+ ::framework::RequestFilterSelect* pRequest = new ::framework::RequestFilterSelect(sURL);
+ css::uno::Reference< css::task::XInteractionRequest > xRequest(static_cast< css::task::XInteractionRequest* >(pRequest), css::uno::UNO_QUERY_THROW);
+ xInteraction->handle(xRequest);
+
+ // "Cancel" pressed? => return with error
+ if (pRequest->isAbort())
+ return ::rtl::OUString();
+
+ // "OK" pressed => verify the selected filter, get it's coressponding
+ // type and return it. (BTW: We must update the media descriptor here ...)
+ // The user selected explicitly a filter ... but normaly we are interested on
+ // a type here only. But we must be shure, that the selected filter is used
+ // too and no ambigous filter registration disturb us .-)
+
+ ::rtl::OUString sFilter = pRequest->getFilter();
+ if (!impl_validateAndSetFilterOnDescriptor(rDescriptor, sFilter))
+ return ::rtl::OUString();
+
+ ::rtl::OUString sType;
+ rDescriptor[::comphelper::MediaDescriptor::PROP_TYPENAME()] >>= sType;
+ return sType;
+ }
+ catch(const css::uno::Exception&)
+ {}
+
+ return ::rtl::OUString();
+}
+
+/*-----------------------------------------------
+ 10.03.2004 10:30
+-----------------------------------------------*/
+void TypeDetection::impl_openStream(::comphelper::MediaDescriptor& rDescriptor)
+ throw (css::uno::Exception)
+{
+ sal_Bool bSuccess = sal_False;
+ ::rtl::OUString sURL = rDescriptor.getUnpackedValueOrDefault( ::comphelper::MediaDescriptor::PROP_URL(), ::rtl::OUString() );
+ sal_Bool bRequestedReadOnly = rDescriptor.getUnpackedValueOrDefault( ::comphelper::MediaDescriptor::PROP_READONLY(), sal_False );
+ if ( sURL.getLength() && ::utl::LocalFileHelper::IsLocalFile( INetURLObject( sURL ).GetMainURL( INetURLObject::NO_DECODE ) ) )
+ {
+ // OOo uses own file locking mechanics in case of local file
+ bSuccess = rDescriptor.addInputStreamOwnLock();
+ }
+ else
+ bSuccess = rDescriptor.addInputStream();
+
+ if ( !bSuccess )
+ throw css::uno::Exception(_FILTER_CONFIG_FROM_ASCII_("Could not open stream."), static_cast< css::document::XTypeDetection* >(this));
+
+ if ( !bRequestedReadOnly )
+ {
+ // The MediaDescriptor implementation adds ReadOnly argument if the file can not be opened for writing
+ // this argument should be either removed or an additional argument should be added so that application
+ // can separate the case when the user explicitly requests readonly document.
+ // The current solution is to remove it here.
+ rDescriptor.erase( ::comphelper::MediaDescriptor::PROP_READONLY() );
+ }
+}
+
+/*-----------------------------------------------
+ 04.07.2003 13:47
+-----------------------------------------------*/
+void TypeDetection::impl_removeTypeFilterFromDescriptor(::comphelper::MediaDescriptor& rDescriptor)
+{
+ ::comphelper::MediaDescriptor::iterator pItType = rDescriptor.find(::comphelper::MediaDescriptor::PROP_TYPENAME() );
+ ::comphelper::MediaDescriptor::iterator pItFilter = rDescriptor.find(::comphelper::MediaDescriptor::PROP_FILTERNAME());
+ if (pItType != rDescriptor.end())
+ rDescriptor.erase(pItType);
+ if (pItFilter != rDescriptor.end())
+ rDescriptor.erase(pItFilter);
+}
+
+/*-----------------------------------------------
+ 14.10.2003 11:15
+-----------------------------------------------*/
+sal_Bool TypeDetection::impl_validateAndSetTypeOnDescriptor( ::comphelper::MediaDescriptor& rDescriptor,
+ const ::rtl::OUString& sType )
+{
+ // SAFE ->
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+ if (m_rCache->hasItem(FilterCache::E_TYPE, sType))
+ {
+ rDescriptor[::comphelper::MediaDescriptor::PROP_TYPENAME()] <<= sType;
+ return sal_True;
+ }
+ aLock.clear();
+ // <- SAFE
+
+ // remove all related informations from the descriptor
+ impl_removeTypeFilterFromDescriptor(rDescriptor);
+ return sal_False;
+}
+
+/*-----------------------------------------------
+ 04.07.2003 14:01
+-----------------------------------------------*/
+sal_Bool TypeDetection::impl_validateAndSetFilterOnDescriptor( ::comphelper::MediaDescriptor& rDescriptor,
+ const ::rtl::OUString& sFilter )
+{
+ try
+ {
+ // SAFE ->
+ ::osl::ResettableMutexGuard aLock(m_aLock);
+
+ CacheItem aFilter = m_rCache->getItem(FilterCache::E_FILTER, sFilter);
+ ::rtl::OUString sType;
+ aFilter[PROPNAME_TYPE] >>= sType;
+ CacheItem aType = m_rCache->getItem(FilterCache::E_TYPE, sType);
+
+ aLock.clear();
+ // <- SAFE
+
+ // found valid type and filter => set it on the given descriptor
+ rDescriptor[::comphelper::MediaDescriptor::PROP_TYPENAME() ] <<= sType ;
+ rDescriptor[::comphelper::MediaDescriptor::PROP_FILTERNAME()] <<= sFilter;
+ return sal_True;
+ }
+ catch(const css::container::NoSuchElementException&){}
+
+ // remove all related informations from the descriptor
+ impl_removeTypeFilterFromDescriptor(rDescriptor);
+ return sal_False;
+}
+
+/*-----------------------------------------------
+ 03.07.2003 10:36
+-----------------------------------------------*/
+::rtl::OUString TypeDetection::impl_getImplementationName()
+{
+ return ::rtl::OUString::createFromAscii("com.sun.star.comp.filter.config.TypeDetection");
+}
+
+/*-----------------------------------------------
+ 03.07.2003 11:27
+-----------------------------------------------*/
+css::uno::Sequence< ::rtl::OUString > TypeDetection::impl_getSupportedServiceNames()
+{
+ css::uno::Sequence< ::rtl::OUString > lServiceNames(1);
+ lServiceNames[0] = ::rtl::OUString::createFromAscii("com.sun.star.document.TypeDetection");
+ return lServiceNames;
+}
+
+/*-----------------------------------------------
+ 09.07.2003 08:02
+-----------------------------------------------*/
+css::uno::Reference< css::uno::XInterface > SAL_CALL TypeDetection::impl_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR)
+{
+ TypeDetection* pNew = new TypeDetection(xSMGR);
+ return css::uno::Reference< css::uno::XInterface >(static_cast< css::document::XTypeDetection* >(pNew), css::uno::UNO_QUERY);
+}
+
+ } // namespace config
+} // namespace filter
diff --git a/filter/source/config/cache/typedetection.hxx b/filter/source/config/cache/typedetection.hxx
new file mode 100644
index 000000000000..4dbf6f07d33e
--- /dev/null
+++ b/filter/source/config/cache/typedetection.hxx
@@ -0,0 +1,459 @@
+/*************************************************************************
+ *
+ * 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 __FILTER_CONFIG_TYPEDETECTION_HXX_
+#define __FILTER_CONFIG_TYPEDETECTION_HXX_
+
+//_______________________________________________
+// includes
+
+#include "basecontainer.hxx"
+#include <com/sun/star/document/XTypeDetection.hpp>
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <comphelper/mediadescriptor.hxx>
+#include <cppuhelper/implbase1.hxx>
+
+//_______________________________________________
+// namespace
+
+namespace filter{
+ namespace config{
+
+namespace css = ::com::sun::star;
+
+//_______________________________________________
+// definitions
+
+//_______________________________________________
+
+/** @short implements the service <type scope="com.sun.star.document">TypeDetection</type>.
+ */
+class TypeDetection : public ::cppu::ImplInheritanceHelper1< BaseContainer ,
+ css::document::XTypeDetection >
+{
+ //-------------------------------------------
+ // native interface
+
+ public:
+
+ //---------------------------------------
+ // ctor/dtor
+
+ /** @short standard ctor to connect this interface wrapper to
+ the global filter cache instance ...
+
+ @param xSMGR
+ reference to the uno service manager, which created this service instance.
+ */
+ TypeDetection(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR);
+
+ //---------------------------------------
+
+ /** @short standard dtor.
+ */
+ virtual ~TypeDetection();
+
+ //-------------------------------------------
+ // private helper
+
+ private:
+
+ //---------------------------------------
+ /** TODO document me */
+ sal_Bool impl_getPreselectionForType(const ::rtl::OUString& sPreSelType,
+ const css::util::URL& aParsedURL ,
+ FlatDetection& rFlatTypes );
+
+ //---------------------------------------
+ /** TODO document me */
+ sal_Bool impl_getPreselectionForFilter(const ::rtl::OUString& sPreSelFilter,
+ const css::util::URL& aParsedURL ,
+ FlatDetection& rFlatTypes );
+
+ //---------------------------------------
+ /** TODO document me */
+ sal_Bool impl_getPreselectionForDocumentService(const ::rtl::OUString& sPreSelDocumentService,
+ const css::util::URL& aParsedURL ,
+ FlatDetection& rFlatTypes );
+
+ //---------------------------------------
+
+ /** @short check if a filter or a type was preselected inside the given
+ MediaDescriptor and validate this information.
+
+ @descr Only in case the preselected filter exists and its type registration
+ seems to be usefully, it would be used realy as valid type detection
+ result. This method doesnt make any deep detection here. It checks only
+ if the preselection match to the URL by an URLPattern.
+ This information has to be added to the given rFlatTypes list too.
+ The outside code can use it to supress a deep detection then in general.
+ Because pattern are defined as non detectable at all!
+
+ @param pDescriptor
+ provides any easy-to-use stl interface to the MediaDescriptor.
+ Note : Its content will be adapted to returned result of this method.
+ Means: The type/filter entries of it will be actualized or removed.
+
+ @param rFlatTypes
+ the preselected type (or the registered type of a preselected filter)
+ will be added here as first(!) element. Further we have to provide the
+ information, if this type match to the given URL by its URLPattern
+ registration.
+ */
+ void impl_getPreselection(const css::util::URL& aParsedURL ,
+ ::comphelper::MediaDescriptor& rDescriptor,
+ FlatDetection& rFlatTypes );
+
+ //---------------------------------------
+
+ /** @short make a combined flat/deep type detection
+
+ @descr It steps over all flat detected types (given by the parameter lFlatTypes),
+ try it and search for most suitable one.
+ The specified MediaDescriptor will be patched, so it contain
+ the right values everytime. Using of any deep detection service
+ can be enabled/disabled. And last but not least: If the results
+ wont be realy clear (because a flat detected type has no deep
+ detection service), a "sugested" type name will be returned as "rLastChance".
+ It can be used after e.g. all well known deep detection services
+ was used without getting any result. Then this "last-chance-type"
+ should be returned. Of course using of it can fail too ... but its a try :-)
+
+ As an optimization - this method collects the names of all used deep
+ detection services. This information can be usefull inside the may be
+ afterwards called method "impl_detectTypeDeepOnly()"!
+
+ @param rDescriptor
+ provides any easy-to-use stl interface to the MediaDescriptor.
+ Note : Its content will be adapted to returned result of this method.
+ Means: The type/filter entries of it will be actualized or removed from it.
+
+ @param lFlatTypes
+ a list of all flat detected types, which should be checked here.
+ No other types are allowed here!
+
+ @param rLastChance
+ the internal name of a "suggested type" ... (see before)
+ Note: it will be reseted to an empty string everytimes. So
+ a set value of "rLastChance" can be detected outside very easy.
+
+ @param rUsedDetectors
+ used as [out] parameter. It contains a list of names of all deep
+ detection services, which was used inside this method.
+ Such detectors can be ignored later if "impl_detectTypeDeepOnly()"
+ is called.
+
+ @param bAllowDeep
+ enable/disable using of a might existing deep detection service.
+
+ @return The internal name of a detected type.
+ An empty value if detection failed. .... but see rLastChance
+ for additional returns!
+ */
+ ::rtl::OUString impl_detectTypeFlatAndDeep( ::comphelper::MediaDescriptor& rDescriptor ,
+ const FlatDetection& lFlatTypes ,
+ sal_Bool bAllowDeep ,
+ OUStringList& rUsedDetectors,
+ ::rtl::OUString& rLastChance );
+
+ //---------------------------------------
+
+ /** @short make a deep type detection only
+
+ @descr It steps over all well known deep detection services
+ and check her results. The first positive result will be
+ used for return. Its more a "try and error" algorithm then
+ a real type detection and will be used if a flat detection
+ cant work realy ... e.g. if the extension of an URL is
+ missing or wrong.
+
+ @param rDescriptor
+ provides any easy-to-use stl interface to the MediaDescriptor.
+ Note : Its content will be adapted to returned result of this method.
+ Means: The type/filter entries of it will be actualized or removed from it.
+
+ @param rUsedDetectors
+ It contains a list of names of all deep detection services,
+ which was already used inside the method "impl_detectTypeFlatAndDeep()"!
+ Such detectors must be ignored here!
+
+ @return The internal name of a detected type.
+ An empty value if detection failed.
+ */
+ ::rtl::OUString impl_detectTypeDeepOnly( ::comphelper::MediaDescriptor& rDescriptor ,
+ const OUStringList& rUsedDetectors);
+
+ //---------------------------------------
+
+ /** @short seek a might existing stream to position 0.
+
+ @descr This is an optinal action to be more robust
+ in case any detect service doesnt make this seek ...
+ Normaly it's part of any called detect service or filter ...
+ but sometimes it's not done there.
+
+ @param rDescriptor
+ a stl representation of the MediaDescriptor as in/out parameter.
+ */
+ void impl_seekStreamToZero(comphelper::MediaDescriptor& rDescriptor);
+
+ //---------------------------------------
+
+ /** @short make deep type detection for a specified
+ detect service (threadsafe!).
+
+ @descr It creates the right uno service, prepare the
+ needed MediaDescriptor, call ths right interfaces,
+ and return the results.
+
+ @attention The results (means type and corresponding filter)
+ are already part of the in/out parameter pDescriptor.
+ (in case they was valid).
+
+ @param sDetectService
+ uno service name of the detect service.
+
+ @param rDescriptor
+ a stl representation of the MediaDescriptor as in/out parameter.
+ */
+ ::rtl::OUString impl_askDetectService(const ::rtl::OUString& sDetectService,
+ ::comphelper::MediaDescriptor& rDescriptor );
+
+ //---------------------------------------
+
+ /** @short try to find an interaction handler and
+ ask him to select a possible filter for
+ this unknown format.
+
+ @descr If the user select a filter, it will be used as return value
+ without further checking against the given file content!
+
+ @param rDescriptor
+ a stl representation of the MediaDescriptor as in/out parameter.
+
+ @return [string]
+ a valid type name or an empty string if user canceled interaction.
+ */
+ ::rtl::OUString impl_askUserForTypeAndFilterIfAllowed(::comphelper::MediaDescriptor& rDescriptor);
+
+ //---------------------------------------
+
+ /** @short check if an input stream is already part of the
+ given MediaDesciptor and creates a new one if neccessary.
+
+ @attention This method does further something special!
+ <ul>
+ <li>
+ If the given URL seem to be a streamable content, but creation of the stream
+ failed (might by an IOException), this method throws an exception.
+ (May be an existing interaction handler must be called here too ...)
+ The whole detection must be interrupted then and the interface method queryTypeByDescriptor()
+ must return an empty type name value.
+
+ That prevent us against multiple handling of the same error more then ones
+ (e.g. if we ask all detect services as fallback ...).
+ </li>
+ <li>
+ In case the stream already exists inside the descriptor this method does nothing.
+ </li>
+ <li>
+ In case the stream does not exists but can be created successfully, the stream will
+ be added to the descriptor.
+ </li>
+ </ul>
+
+ @param rDescriptor
+ provides any easy-to-use stl interface to the MediaDescriptor.
+ Note : Its content will be adapted to returned result of this method.
+ Means: The stream will be added to it.
+
+ @throw Any suitable exception if stream should be opened but operation was not sucessfull.
+ Note: If an interactionHandler is part of the given descriptor too, it was already used.
+ Means: let the exception pass trough the top most interface method!
+ */
+ void impl_openStream(::comphelper::MediaDescriptor& rDescriptor)
+ throw (css::uno::Exception);
+
+ //---------------------------------------
+
+ /** @short validate the specified type and its relation ships
+ and set all needed informations related to this type
+ in the specified descriptor.
+
+ @descr Related informations are: - corresponding filter
+ - media type
+ - ...
+
+ @param rDescriptor
+ provides access to the outside MediaDescriptor.
+
+ @param sType
+ the name of the type, which should be set on the descriptor.
+ Can be empty to remove any related value from the descriptor!
+
+ @return TRUE the specified type and its registrations was valid(!) and
+ could be set on the descriptor.
+ */
+ sal_Bool impl_validateAndSetTypeOnDescriptor( ::comphelper::MediaDescriptor& rDescriptor,
+ const ::rtl::OUString& sType );
+
+ //---------------------------------------
+
+ /** @short validate the specified filter and its relation ships
+ and set all needed informations related to this filter
+ in the specified descriptor.
+
+ @descr Related informations are: - corresponding type
+ - ...
+
+ @param rDescriptor
+ provides access to the outside MediaDescriptor.
+
+ @param sFilter
+ the name of the filter, which should be set on the descriptor.
+ Can be empty to remove any related value from the descriptor!
+
+ @return TRUE the specified type and its registrations was valid(!) and
+ could be set on the descriptor.
+ */
+ sal_Bool impl_validateAndSetFilterOnDescriptor( ::comphelper::MediaDescriptor& rDescriptor,
+ const ::rtl::OUString& sFilter );
+
+ //---------------------------------------
+
+ /** @short remove anythimng related to a TYPE/FILTER entry from the
+ specified MediaDescriptor.
+
+ @descr This method works together with impl_validateAndSetTypeOnDescriptor()/
+ impl_validateAndSetFilterOnDescriptor(). All informations, which can be
+ set by these two operations must be "removeable" by this method.
+
+ @param rDescriptor
+ reference to the MediaDescriptor (represented by an easy-to-use
+ stl interface!), which should be patched.
+ */
+ void impl_removeTypeFilterFromDescriptor(::comphelper::MediaDescriptor& rDescriptor);
+
+ //---------------------------------------
+
+ /** @short search the best suitable filter for the given type
+ and add it into the media descriptor.
+
+ @descr Normaly this is a type detection only ...
+ but for some special features we must overwrite our detection
+ because a file must be loaded into a special (means preselected)
+ application.
+
+ E.g. CSV/TXT format are sometimes ugly to handle .-)
+
+ Note: If the descriptor already include a filter
+ (may be selected by a FilterSelect interaction or preselected
+ by the user itself) ... we dont change that here !
+
+ @param rDescriptor
+ reference to the MediaDescriptor (represented by an easy-to-use
+ stl interface!), which should be patched.
+
+ @param sType
+ the internal type name, where we search a filter for.
+ Used as IN/OUT parameter so we can overrule the detection result for
+ types too !
+
+ @note #i60158#
+ sometimes our text ascii and our csv filter cant work together.
+ Then we overwrite our detection hardly.
+ sType param is used as out parameter then too ... and
+ rDescriptor will be changed by selecting another filter.
+ (see code)
+ */
+ void impl_checkResultsAndAddBestFilter(::comphelper::MediaDescriptor& rDescriptor,
+ ::rtl::OUString& sType );
+
+ //-------------------------------------------
+ // uno interface
+
+ public:
+
+ //---------------------------------------
+ // XTypeDetection
+
+ virtual ::rtl::OUString SAL_CALL queryTypeByURL(const ::rtl::OUString& sURL)
+ throw (css::uno::RuntimeException);
+
+ virtual ::rtl::OUString SAL_CALL queryTypeByDescriptor(css::uno::Sequence< css::beans::PropertyValue >& lDescriptor,
+ sal_Bool bAllowDeep )
+ throw (css::uno::RuntimeException);
+
+ //-------------------------------------------
+ // static uno helper!
+
+ public:
+
+ //---------------------------------------
+
+ /** @short return the uno implementation name of this class.
+
+ @descr Because this information is used at several places
+ (and mostly an object instance of this class is not possible)
+ its implemented as a static function!
+
+ @return The fix uno implementation name of this class.
+ */
+ static ::rtl::OUString impl_getImplementationName();
+
+ //---------------------------------------
+
+ /** @short return the list of supported uno services of this class.
+
+ @descr Because this information is used at several places
+ (and mostly an object instance of this class is not possible)
+ its implemented as a static function!
+
+ @return The fix list of uno services supported by this class.
+ */
+ static css::uno::Sequence< ::rtl::OUString > impl_getSupportedServiceNames();
+
+ //---------------------------------------
+
+ /** @short return a new intsnace of this class.
+
+ @descr This method is used by the uno service manager, to create
+ a new instance of this service if needed.
+
+ @param xSMGR
+ reference to the uno service manager, which require
+ this new instance. It should be passed to the new object
+ so it can be used internaly to create own needed uno resources.
+
+ @return The new instance of this service as an uno reference.
+ */
+ static css::uno::Reference< css::uno::XInterface > impl_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR);
+};
+
+ } // namespace config
+} // namespace filter
+
+#endif // __FILTER_CONFIG_TYPEDETECTION_HXX_
diff --git a/filter/source/config/cache/versions.hxx b/filter/source/config/cache/versions.hxx
new file mode 100644
index 000000000000..fbd92604170f
--- /dev/null
+++ b/filter/source/config/cache/versions.hxx
@@ -0,0 +1,36 @@
+/*************************************************************************
+ *
+ * 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 _FILTER_CONFIG_VERSIONS_HXX_
+#define _FILTER_CONFIG_VERSIONS_HXX_
+
+//_______________________________________________
+
+//#define _FILTER_CONFIG_Q_ // final Q code base
+#define _FILTER_CONFIG_MIGRATION_Q_ // usefull for migration time, to support some old functionality temp. :-)
+
+#endif // _FILTER_CONFIG_VERSIONS_HXX_
diff --git a/filter/source/config/fragments/contenthandlers/com_sun_star_comp_framework_SoundHandler.xcu b/filter/source/config/fragments/contenthandlers/com_sun_star_comp_framework_SoundHandler.xcu
new file mode 100644
index 000000000000..37971f848bef
--- /dev/null
+++ b/filter/source/config/fragments/contenthandlers/com_sun_star_comp_framework_SoundHandler.xcu
@@ -0,0 +1,3 @@
+ <node oor:name="com.sun.star.comp.framework.SoundHandler" oor:op="replace" >
+ <prop oor:name="Types"><value>wav_Wave_Audio_File</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/contenthandlers/com_sun_star_comp_framework_oxt_handler.xcu b/filter/source/config/fragments/contenthandlers/com_sun_star_comp_framework_oxt_handler.xcu
new file mode 100644
index 000000000000..e2b49b8d12b0
--- /dev/null
+++ b/filter/source/config/fragments/contenthandlers/com_sun_star_comp_framework_oxt_handler.xcu
@@ -0,0 +1,3 @@
+ <node oor:name="com.sun.star.comp.framework.OXTFileHandler" oor:op="replace" >
+ <prop oor:name="Types"><value>oxt_OpenOffice_Extension</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/delzip b/filter/source/config/fragments/delzip
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/filter/source/config/fragments/delzip
diff --git a/filter/source/config/fragments/fcfg_base.mk b/filter/source/config/fragments/fcfg_base.mk
new file mode 100644
index 000000000000..d5c0d4cc7f73
--- /dev/null
+++ b/filter/source/config/fragments/fcfg_base.mk
@@ -0,0 +1,51 @@
+all_fragments+=base
+
+# -----------------------------------------------
+# count = 6
+T4_BASE = \
+ writer_web_HTML_help \
+ oxt_OpenOffice_Extension \
+ wav_Wave_Audio_File \
+ component_Bibliography \
+ component_DB
+
+# -----------------------------------------------
+# count = 2
+F4_BASE = \
+ writer_web_HTML_help
+
+# -----------------------------------------------
+# count = 1
+F4_UI_BASE =
+
+# -----------------------------------------------
+# count = 3
+L4_BASE = \
+ com_sun_star_frame_Bibliography \
+ com_sun_star_sdb_ContentLoader
+
+# -----------------------------------------------
+# count = 2
+C4_BASE = \
+ com_sun_star_comp_framework_SoundHandler \
+ com_sun_star_comp_framework_oxt_handler
+
+# -----------------------------------------------
+TYPES_4fcfg_base = $(foreach,i,$(T4_BASE) types$/$i.xcu )
+FILTERS_4fcfg_base = $(foreach,i,$(F4_BASE) filters$/$i.xcu )
+UI_FILTERS_4fcfg_base = $(foreach,i,$(F4_UI_BASE) $(DIR_LOCFRAG)$/filters$/$i.xcu )
+FRAMELOADERS_4fcfg_base = $(foreach,i,$(L4_BASE) frameloaders$/$i.xcu )
+CONTENTHANDLERS_4fcfg_base = $(foreach,i,$(C4_BASE) contenthandlers$/$i.xcu )
+
+# -----------------------------------------------
+# needed to get dependencies inside global makefile work!
+ALL_4fcfg_base = \
+ $(TYPES_4fcfg_base) \
+ $(FILTERS_4fcfg_base) \
+ $(UI_FILTERS_4fcfg_base) \
+ $(FRAMELOADERS_4fcfg_base) \
+ $(CONTENTHANDLERS_4fcfg_base)
+
+ALL_UI_FILTERS+=$(UI_FILTERS_4fcfg_base)
+
+ALL_PACKAGES+=base
diff --git a/filter/source/config/fragments/fcfg_calc.mk b/filter/source/config/fragments/fcfg_calc.mk
new file mode 100644
index 000000000000..ee949ba60184
--- /dev/null
+++ b/filter/source/config/fragments/fcfg_calc.mk
@@ -0,0 +1,108 @@
+all_fragments+=calc
+
+# -----------------------------------------------
+# count = 27
+T4_CALC = \
+ calc_DIF \
+ writer_web_HTML \
+ calc_Lotus \
+ calc_QPro \
+ calc_MS_Excel_40 \
+ calc_MS_Excel_40_VorlageTemplate \
+ calc_MS_Excel_5095 \
+ calc_MS_Excel_5095_VorlageTemplate \
+ calc_MS_Excel_95 \
+ calc_MS_Excel_95_VorlageTemplate \
+ calc_MS_Excel_97 \
+ calc_MS_Excel_97_VorlageTemplate \
+ writer_Rich_Text_Format \
+ calc_SYLK \
+ calc_StarOffice_XML_Calc \
+ calc_Text_txt_csv_StarCalc \
+ calc_StarOffice_XML_Calc_Template \
+ pdf_Portable_Document_Format \
+ calc_dBase\
+ calc8\
+ calc8_template \
+ calc_MS_Excel_2003_XML \
+ MS_Excel_2007_XML \
+ MS_Excel_2007_XML_Template \
+ MS_Excel_2007_Binary
+
+# -----------------------------------------------
+# count = 28
+F4_CALC = \
+ DIF \
+ HTML__StarCalc_ \
+ Lotus \
+ QPro \
+ MS_Excel_4_0 \
+ MS_Excel_4_0_Vorlage_Template \
+ MS_Excel_5_0_95 \
+ MS_Excel_5_0_95_Vorlage_Template \
+ MS_Excel_95 \
+ MS_Excel_95_Vorlage_Template \
+ MS_Excel_97 \
+ MS_Excel_97_Vorlage_Template \
+ Rich_Text_Format__StarCalc_ \
+ SYLK \
+ StarOffice_XML__Calc_ \
+ Text___txt___csv__StarCalc_ \
+ calc_HTML_WebQuery \
+ calc_StarOffice_XML_Calc_Template \
+ calc_pdf_Export \
+ dBase \
+ calc8 \
+ calc8_template \
+ MS_Excel_2003_XML \
+ calc_MS_Excel_2007_XML \
+ calc_MS_Excel_2007_XML_Template \
+ calc_MS_Excel_2007_Binary
+
+# -----------------------------------------------
+# count = 12
+F4_UI_CALC = \
+ HTML__StarCalc__ui \
+ MS_Excel_4_0_Vorlage_Template_ui \
+ MS_Excel_5_0_95_Vorlage_Template_ui \
+ MS_Excel_95_Vorlage_Template_ui \
+ MS_Excel_97_Vorlage_Template_ui \
+ StarOffice_XML__Calc__ui \
+ Text___txt___csv__StarCalc__ui \
+ calc_HTML_WebQuery_ui \
+ calc_StarOffice_XML_Calc_Template_ui \
+ calc8_ui \
+ calc8_template_ui \
+ MS_Excel_2003_XML_ui \
+ calc_MS_Excel_2007_XML_ui \
+ calc_MS_Excel_2007_XML_Template_ui \
+ calc_MS_Excel_2007_Binary_ui
+
+# -----------------------------------------------
+# count = 0
+L4_CALC =
+
+# -----------------------------------------------
+# count = 0
+C4_CALC =
+
+# -----------------------------------------------
+TYPES_4fcfg_calc = $(foreach,i,$(T4_CALC) types$/$i.xcu )
+FILTERS_4fcfg_calc = $(foreach,i,$(F4_CALC) filters$/$i.xcu )
+UI_FILTERS_4fcfg_calc = $(foreach,i,$(F4_UI_CALC) $(DIR_LOCFRAG)$/filters$/$i.xcu )
+FRAMELOADERS_4fcfg_calc = $(foreach,i,$(L4_CALC) frameloaders$/$i.xcu )
+CONTENTHANDLERS_4fcfg_calc = $(foreach,i,$(C4_CALC) contenthandlers$/$i.xcu )
+
+# -----------------------------------------------
+# needed to get dependencies inside global makefile work!
+ALL_4fcfg_calc = \
+ $(TYPES_4fcfg_calc) \
+ $(FILTERS_4fcfg_calc) \
+ $(UI_FILTERS_4fcfg_calc) \
+ $(FRAMELOADERS_4fcfg_calc) \
+ $(CONTENTHANDLERS_4fcfg_calc)
+
+ALL_UI_FILTERS+=$(UI_FILTERS_4fcfg_calc)
+
+ALL_PACKAGES+=calc
+
diff --git a/filter/source/config/fragments/fcfg_calc_bf.mk b/filter/source/config/fragments/fcfg_calc_bf.mk
new file mode 100644
index 000000000000..454d303f86c8
--- /dev/null
+++ b/filter/source/config/fragments/fcfg_calc_bf.mk
@@ -0,0 +1,59 @@
+all_fragments+=calc_bf
+
+# -----------------------------------------------
+# count = 7
+T4_CALC_BF = \
+ calc_StarCalc_10 \
+ calc_StarCalc_30 \
+ calc_StarCalc_30_VorlageTemplate \
+ calc_StarCalc_40 \
+ calc_StarCalc_40_VorlageTemplate \
+ calc_StarCalc_50 \
+ calc_StarCalc_50_VorlageTemplate
+
+# -----------------------------------------------
+# count = 7
+F4_CALC_BF = \
+ StarCalc_1_0 \
+ StarCalc_3_0 \
+ StarCalc_3_0_Vorlage_Template \
+ StarCalc_4_0 \
+ StarCalc_4_0_Vorlage_Template \
+ StarCalc_5_0 \
+ StarCalc_5_0_Vorlage_Template
+
+# -----------------------------------------------
+# count = 3
+F4_UI_CALC_BF = \
+ StarCalc_3_0_Vorlage_Template_ui \
+ StarCalc_4_0_Vorlage_Template_ui \
+ StarCalc_5_0_Vorlage_Template_ui
+
+# -----------------------------------------------
+# count = 0
+L4_CALC_BF =
+
+# -----------------------------------------------
+# count = 0
+C4_CALC_BF =
+
+# -----------------------------------------------
+TYPES_4fcfg_calc_bf = $(foreach,i,$(T4_CALC_BF) types$/$i.xcu )
+FILTERS_4fcfg_calc_bf = $(foreach,i,$(F4_CALC_BF) filters$/$i.xcu )
+UI_FILTERS_4fcfg_calc_bf = $(foreach,i,$(F4_UI_CALC_BF) $(DIR_LOCFRAG)$/filters$/$i.xcu )
+FRAMELOADERS_4fcfg_calc_bf = $(foreach,i,$(L4_CALC_BF) frameloaders$/$i.xcu )
+CONTENTHANDLERS_4fcfg_calc_bf = $(foreach,i,$(C4_CALC_BF) contenthandlers$/$i.xcu )
+
+# -----------------------------------------------
+# needed to get dependencies inside global makefile work!
+ALL_4fcfg_calc_bf = \
+ $(TYPES_4fcfg_calc) \
+ $(FILTERS_4fcfg_calc) \
+ $(UI_FILTERS_4fcfg_calc) \
+ $(FRAMELOADERS_4fcfg_calc) \
+ $(CONTENTHANDLERS_4fcfg_calc)
+
+ALL_UI_FILTERS+=$(UI_FILTERS_4fcfg_calc_bf)
+
+ALL_PACKAGES+=calc_bf
+
diff --git a/filter/source/config/fragments/fcfg_chart.mk b/filter/source/config/fragments/fcfg_chart.mk
new file mode 100644
index 000000000000..c34c8c0bdcdd
--- /dev/null
+++ b/filter/source/config/fragments/fcfg_chart.mk
@@ -0,0 +1,48 @@
+all_fragments+=chart
+
+# -----------------------------------------------
+# count = 3
+T4_CHART = \
+ chart_StarOffice_XML_Chart \
+ chart8
+
+# -----------------------------------------------
+# count = 2
+F4_CHART = \
+ StarOffice_XML__Chart_\
+ chart8
+
+# -----------------------------------------------
+# count = 2
+F4_UI_CHART = \
+ StarOffice_XML__Chart__ui \
+ chart8_ui
+
+# -----------------------------------------------
+# count = 0
+L4_CHART = \
+ com_sun_star_comp_chart2_ChartFrameLoader
+
+# -----------------------------------------------
+# count = 0
+C4_CHART =
+
+# -----------------------------------------------
+TYPES_4fcfg_chart = $(foreach,i,$(T4_CHART) types$/$i.xcu )
+FILTERS_4fcfg_chart = $(foreach,i,$(F4_CHART) filters$/$i.xcu )
+UI_FILTERS_4fcfg_chart = $(foreach,i,$(F4_UI_CHART) $(DIR_LOCFRAG)$/filters$/$i.xcu )
+FRAMELOADERS_4fcfg_chart = $(foreach,i,$(L4_CHART) frameloaders$/$i.xcu )
+CONTENTHANDLERS_4fcfg_chart = $(foreach,i,$(C4_CHART) contenthandlers$/$i.xcu )
+
+# -----------------------------------------------
+# needed to get dependencies inside global makefile work!
+ALL_4fcfg_chart = \
+ $(TYPES_4fcfg_chart) \
+ $(FILTERS_4fcfg_chart) \
+ $(UI_FILTERS_4fcfg_chart) \
+ $(FRAMELOADERS_4fcfg_chart) \
+ $(CONTENTHANDLERS_4fcfg_chart)
+
+ALL_UI_FILTERS+=$(UI_FILTERS_4fcfg_chart)
+
+ALL_PACKAGES+=chart
diff --git a/filter/source/config/fragments/fcfg_chart_bf.mk b/filter/source/config/fragments/fcfg_chart_bf.mk
new file mode 100644
index 000000000000..4286978f2224
--- /dev/null
+++ b/filter/source/config/fragments/fcfg_chart_bf.mk
@@ -0,0 +1,47 @@
+all_fragments+=chart_bf
+
+# -----------------------------------------------
+# count = 3
+T4_CHART_BF = \
+ chart_StarChart_30 \
+ chart_StarChart_40 \
+ chart_StarChart_50
+
+# -----------------------------------------------
+# count = 3
+F4_CHART_BF = \
+ StarChart_3_0 \
+ StarChart_4_0 \
+ StarChart_5_0
+
+# -----------------------------------------------
+# count = 0
+F4_UI_CHART_BF =
+
+# -----------------------------------------------
+# count = 0
+L4_CHART_BF =
+
+# -----------------------------------------------
+# count = 0
+C4_CHART_BF =
+
+# -----------------------------------------------
+TYPES_4fcfg_chart_bf = $(foreach,i,$(T4_CHART_BF) types$/$i.xcu )
+FILTERS_4fcfg_chart_bf = $(foreach,i,$(F4_CHART_BF) filters$/$i.xcu )
+UI_FILTERS_4fcfg_chart_bf = $(foreach,i,$(F4_UI_CHART_BF) $(DIR_LOCFRAG)$/filters$/$i.xcu )
+FRAMELOADERS_4fcfg_chart_bf = $(foreach,i,$(L4_CHART_BF) frameloaders$/$i.xcu )
+CONTENTHANDLERS_4fcfg_chart_bf = $(foreach,i,$(C4_CHART_BF) contenthandlers$/$i.xcu )
+
+# -----------------------------------------------
+# needed to get dependencies inside global makefile work!
+ALL_4fcfg_chart_bf = \
+ $(TYPES_4fcfg_chart_bf) \
+ $(FILTERS_4fcfg_chart_bf) \
+ $(UI_FILTERS_4fcfg_chart_bf) \
+ $(FRAMELOADERS_4fcfg_chart_bf) \
+ $(CONTENTHANDLERS_4fcfg_chart_bf)
+
+ALL_UI_FILTERS+=$(UI_FILTERS_4fcfg_chart_bf)
+
+ALL_PACKAGES+=chart_bf
diff --git a/filter/source/config/fragments/fcfg_database.mk b/filter/source/config/fragments/fcfg_database.mk
new file mode 100644
index 000000000000..906a17e643b4
--- /dev/null
+++ b/filter/source/config/fragments/fcfg_database.mk
@@ -0,0 +1,45 @@
+all_fragments+=database
+
+# -----------------------------------------------
+# count = 1
+T4_DATABASE = \
+ StarBase
+
+# -----------------------------------------------
+# count = 1
+F4_DATABASE = \
+ StarOffice_XML__Base_
+
+# -----------------------------------------------
+# count = 1
+F4_UI_DATABASE = \
+ StarOffice_XML__Base__ui
+
+# -----------------------------------------------
+# count = 1
+L4_DATABASE = \
+ org_openoffice_comp_dbflt_DBContentLoader2
+
+# -----------------------------------------------
+# count = 1
+C4_DATABASE =
+
+# -----------------------------------------------
+TYPES_4fcfg_database = $(foreach,i,$(T4_DATABASE) types$/$i.xcu )
+FILTERS_4fcfg_database = $(foreach,i,$(F4_DATABASE) filters$/$i.xcu )
+UI_FILTERS_4fcfg_database = $(foreach,i,$(F4_UI_DATABASE) $(DIR_LOCFRAG)$/filters$/$i.xcu )
+FRAMELOADERS_4fcfg_database = $(foreach,i,$(L4_DATABASE) frameloaders$/$i.xcu )
+CONTENTHANDLERS_4fcfg_database = $(foreach,i,$(C4_DATABASE) contenthandlers$/$i.xcu )
+
+# -----------------------------------------------
+# needed to get dependencies inside global makefile work!
+ALL_4fcfg_database = \
+ $(TYPES_4fcfg_database) \
+ $(FILTERS_4fcfg_database) \
+ $(UI_FILTERS_4fcfg_database) \
+ $(FRAMELOADERS_4fcfg_database) \
+ $(CONTENTHANDLERS_4fcfg_database)
+
+ALL_UI_FILTERS+=$(UI_FILTERS_4fcfg_database)
+
+ALL_PACKAGES+=database
diff --git a/filter/source/config/fragments/fcfg_draw.mk b/filter/source/config/fragments/fcfg_draw.mk
new file mode 100644
index 000000000000..d6e6d9caad54
--- /dev/null
+++ b/filter/source/config/fragments/fcfg_draw.mk
@@ -0,0 +1,56 @@
+all_fragments+=draw
+
+# -----------------------------------------------
+# count = 9
+T4_DRAW = \
+ draw_StarOffice_XML_Draw \
+ draw_StarOffice_XML_Draw_Template \
+ pdf_Portable_Document_Format\
+ draw8 \
+ draw8_template
+
+# -----------------------------------------------
+# count = 9
+F4_DRAW = \
+ StarOffice_XML__Draw_ \
+ draw_StarOffice_XML_Draw_Template \
+ draw_pdf_Export \
+ draw8 \
+ draw8_template
+
+# -----------------------------------------------
+# count = 4
+F4_UI_DRAW = \
+ StarOffice_XML__Draw__ui \
+ draw_StarOffice_XML_Draw_Template_ui \
+ draw8_ui \
+ draw8_template_ui
+
+# -----------------------------------------------
+# count = 0
+L4_DRAW =
+
+# -----------------------------------------------
+# count = 0
+C4_DRAW =
+
+# -----------------------------------------------
+TYPES_4fcfg_draw = $(foreach,i,$(T4_DRAW) types$/$i.xcu )
+FILTERS_4fcfg_draw = $(foreach,i,$(F4_DRAW) filters$/$i.xcu )
+UI_FILTERS_4fcfg_draw = $(foreach,i,$(F4_UI_DRAW) $(DIR_LOCFRAG)$/filters$/$i.xcu )
+FRAMELOADERS_4fcfg_draw = $(foreach,i,$(L4_DRAW) frameloaders$/$i.xcu )
+CONTENTHANDLERS_4fcfg_draw = $(foreach,i,$(C4_DRAW) contenthandlers$/$i.xcu )
+
+# -----------------------------------------------
+# needed to get dependencies inside global makefile work!
+ALL_4fcfg_draw = \
+ $(TYPES_4fcfg_draw) \
+ $(FILTERS_4fcfg_draw) \
+ $(UI_FILTERS_4fcfg_draw) \
+ $(FRAMELOADERS_4fcfg_draw) \
+ $(CONTENTHANDLERS_4fcfg_draw)
+
+ALL_UI_FILTERS+=$(UI_FILTERS_4fcfg_draw)
+
+ALL_PACKAGES+=draw
+
diff --git a/filter/source/config/fragments/fcfg_draw_bf.mk b/filter/source/config/fragments/fcfg_draw_bf.mk
new file mode 100644
index 000000000000..5fc2f7da0303
--- /dev/null
+++ b/filter/source/config/fragments/fcfg_draw_bf.mk
@@ -0,0 +1,51 @@
+all_fragments+=draw_bf
+
+# -----------------------------------------------
+# count = 4
+T4_DRAW_BF = \
+ draw_StarDraw_30 \
+ draw_StarDraw_30_Vorlage \
+ draw_StarDraw_50 \
+ draw_StarDraw_50_Vorlage
+
+# -----------------------------------------------
+# count = 4
+F4_DRAW_BF = \
+ StarDraw_3_0 \
+ StarDraw_3_0_Vorlage \
+ StarDraw_5_0 \
+ StarDraw_5_0_Vorlage
+
+# -----------------------------------------------
+# count = 2
+F4_UI_DRAW_BF = \
+ StarDraw_3_0_Vorlage_ui \
+ StarDraw_5_0_Vorlage_ui
+
+# -----------------------------------------------
+# count = 0
+L4_DRAW_BF =
+
+# -----------------------------------------------
+# count = 0
+C4_DRAW_BF =
+
+# -----------------------------------------------
+TYPES_4fcfg_draw_bf = $(foreach,i,$(T4_DRAW_BF) types$/$i.xcu )
+FILTERS_4fcfg_draw_bf = $(foreach,i,$(F4_DRAW_BF) filters$/$i.xcu )
+UI_FILTERS_4fcfg_draw_bf = $(foreach,i,$(F4_UI_DRAW_BF) $(DIR_LOCFRAG)$/filters$/$i.xcu )
+FRAMELOADERS_4fcfg_draw_bf = $(foreach,i,$(L4_DRAW_BF) frameloaders$/$i.xcu )
+CONTENTHANDLERS_4fcfg_draw_bf = $(foreach,i,$(C4_DRAW_BF) contenthandlers$/$i.xcu )
+
+# -----------------------------------------------
+# needed to get dependencies inside global makefile work!
+ALL_4fcfg_draw_bf = \
+ $(TYPES_4fcfg_draw_bf) \
+ $(FILTERS_4fcfg_draw_bf) \
+ $(UI_FILTERS_4fcfg_draw_bf) \
+ $(FRAMELOADERS_4fcfg_draw_bf) \
+ $(CONTENTHANDLERS_4fcfg_draw_bf)
+
+ALL_UI_FILTERS+=$(UI_FILTERS_4fcfg_draw_bf)
+
+ALL_PACKAGES+=draw_bf
diff --git a/filter/source/config/fragments/fcfg_drawgraphics.mk b/filter/source/config/fragments/fcfg_drawgraphics.mk
new file mode 100644
index 000000000000..7038e27e8ae4
--- /dev/null
+++ b/filter/source/config/fragments/fcfg_drawgraphics.mk
@@ -0,0 +1,117 @@
+all_fragments+=drawgraphics
+
+# -----------------------------------------------
+# count = 29
+T4_DRAWGRAPHICS = \
+ bmp_MS_Windows \
+ dxf_AutoCAD_Interchange \
+ emf_MS_Windows_Metafile \
+ eps_Encapsulated_PostScript \
+ gif_Graphics_Interchange \
+ graphic_HTML \
+ graphic_SWF \
+ jpg_JPEG \
+ met_OS2_Metafile \
+ pbm_Portable_Bitmap \
+ pcd_Photo_CD_Base \
+ pcd_Photo_CD_Base16 \
+ pcd_Photo_CD_Base4 \
+ pct_Mac_Pict \
+ pcx_Zsoft_Paintbrush \
+ pgm_Portable_Graymap \
+ png_Portable_Network_Graphic \
+ ppm_Portable_Pixelmap \
+ psd_Adobe_Photoshop \
+ ras_Sun_Rasterfile \
+ sgf_StarOffice_Writer_SGF \
+ sgv_StarDraw_20 \
+ svg_Scalable_Vector_Graphics \
+ svm_StarView_Metafile \
+ tga_Truevision_TARGA \
+ tif_Tag_Image_File \
+ wmf_MS_Windows_Metafile \
+ xbm_X_Consortium \
+ xpm_XPM
+
+# -----------------------------------------------
+# count = 45
+F4_DRAWGRAPHICS = \
+ BMP___MS_Windows \
+ DXF___AutoCAD_Interchange \
+ EMF___MS_Windows_Metafile \
+ EPS___Encapsulated_PostScript \
+ GIF___Graphics_Interchange \
+ JPG___JPEG \
+ MET___OS_2_Metafile \
+ PBM___Portable_Bitmap \
+ PCT___Mac_Pict \
+ PCX___Zsoft_Paintbrush \
+ PGM___Portable_Graymap \
+ PNG___Portable_Network_Graphic \
+ PPM___Portable_Pixelmap \
+ PSD___Adobe_Photoshop \
+ RAS___Sun_Rasterfile \
+ SGF___StarOffice_Writer_SGF \
+ SGV___StarDraw_2_0 \
+ SVM___StarView_Metafile \
+ TGA___Truevision_TARGA \
+ TIF___Tag_Image_File \
+ WMF___MS_Windows_Metafile \
+ XBM___X_Consortium \
+ XPM \
+ draw_PCD_Photo_CD_Base \
+ draw_PCD_Photo_CD_Base16 \
+ draw_PCD_Photo_CD_Base4 \
+ draw_bmp_Export \
+ draw_emf_Export \
+ draw_eps_Export \
+ draw_flash_Export \
+ draw_gif_Export \
+ draw_html_Export \
+ draw_jpg_Export \
+ draw_met_Export \
+ draw_pbm_Export \
+ draw_pct_Export \
+ draw_pgm_Export \
+ draw_png_Export \
+ draw_ppm_Export \
+ draw_ras_Export \
+ draw_svg_Export \
+ draw_svm_Export \
+ draw_tif_Export \
+ draw_wmf_Export \
+ draw_xpm_Export
+
+# -----------------------------------------------
+# count = 1
+F4_UI_DRAWGRAPHICS = \
+ draw_html_Export_ui
+
+# -----------------------------------------------
+# count = 0
+L4_DRAWGRAPHICS =
+
+# -----------------------------------------------
+# count = 0
+C4_DRAWGRAPHICS =
+
+# -----------------------------------------------
+TYPES_4fcfg_drawgraphics = $(foreach,i,$(T4_DRAWGRAPHICS) types$/$i.xcu )
+FILTERS_4fcfg_drawgraphics = $(foreach,i,$(F4_DRAWGRAPHICS) filters$/$i.xcu )
+UI_FILTERS_4fcfg_drawgraphics = $(foreach,i,$(F4_UI_DRAWGRAPHICS) $(DIR_LOCFRAG)$/filters$/$i.xcu )
+FRAMELOADERS_4fcfg_drawgraphics = $(foreach,i,$(L4_DRAWGRAPHICS) frameloaders$/$i.xcu )
+CONTENTHANDLERS_4fcfg_drawgraphics = $(foreach,i,$(C4_DRAWGRAPHICS) contenthandlers$/$i.xcu )
+
+# -----------------------------------------------
+# needed to get dependencies inside global makefile work!
+ALL_4fcfg_drawgraphics = \
+ $(TYPES_4fcfg_drawgraphics) \
+ $(FILTERS_4fcfg_drawgraphics) \
+ $(UI_FILTERS_4fcfg_drawgraphics) \
+ $(FRAMELOADERS_4fcfg_drawgraphics) \
+ $(CONTENTHANDLERS_4fcfg_drawgraphics)
+
+ALL_UI_FILTERS+=$(UI_FILTERS_4fcfg_drawgraphics)
+
+ALL_PACKAGES+=drawgraphics
+
diff --git a/filter/source/config/fragments/fcfg_global.mk b/filter/source/config/fragments/fcfg_global.mk
new file mode 100644
index 000000000000..c0f2cbb90e2d
--- /dev/null
+++ b/filter/source/config/fragments/fcfg_global.mk
@@ -0,0 +1,59 @@
+all_fragments+=global
+
+# -----------------------------------------------
+# count = 12
+T4_GLOBAL = \
+ writer_Text \
+ writer_StarOffice_XML_Writer \
+ writer_globaldocument_StarOffice_XML_Writer_GlobalDocument \
+ pdf_Portable_Document_Format \
+ writerglobal8 \
+
+# -----------------------------------------------
+# count = 12
+F4_GLOBAL = \
+ Text__encoded___StarWriter_GlobalDocument_ \
+ writer_globaldocument_StarOffice_XML_Writer \
+ writer_globaldocument_StarOffice_XML_Writer_GlobalDocument \
+ writer_globaldocument_pdf_Export \
+ writerglobal8 \
+ writerglobal8_writer \
+ writerglobal8_HTML
+
+# -----------------------------------------------
+# count = 12
+F4_UI_GLOBAL = \
+ Text__encoded___StarWriter_GlobalDocument__ui \
+ writer_globaldocument_StarOffice_XML_Writer_ui \
+ writer_globaldocument_StarOffice_XML_Writer_GlobalDocument_ui \
+ writerglobal8_ui \
+ writerglobal8_writer_ui
+
+# -----------------------------------------------
+# count = 0
+L4_GLOBAL =
+
+# -----------------------------------------------
+# count = 0
+C4_GLOBAL =
+
+# -----------------------------------------------
+TYPES_4fcfg_global = $(foreach,i,$(T4_GLOBAL) types$/$i.xcu )
+FILTERS_4fcfg_global = $(foreach,i,$(F4_GLOBAL) filters$/$i.xcu )
+UI_FILTERS_4fcfg_global = $(foreach,i,$(F4_UI_GLOBAL) $(DIR_LOCFRAG)$/filters$/$i.xcu )
+FRAMELOADERS_4fcfg_global = $(foreach,i,$(L4_GLOBAL) frameloaders$/$i.xcu )
+CONTENTHANDLERS_4fcfg_global = $(foreach,i,$(C4_GLOBAL) contenthandlers$/$i.xcu )
+
+# -----------------------------------------------
+# needed to get dependencies inside global makefile work!
+ALL_4fcfg_global = \
+ $(TYPES_4fcfg_global) \
+ $(FILTERS_4fcfg_global) \
+ $(UI_FILTERS_4fcfg_global) \
+ $(FRAMELOADERS_4fcfg_global) \
+ $(CONTENTHANDLERS_4fcfg_global)
+
+ALL_UI_FILTERS+=$(UI_FILTERS_4fcfg_global)
+
+ALL_PACKAGES+=global
+
diff --git a/filter/source/config/fragments/fcfg_global_bf.mk b/filter/source/config/fragments/fcfg_global_bf.mk
new file mode 100644
index 000000000000..371359937d5e
--- /dev/null
+++ b/filter/source/config/fragments/fcfg_global_bf.mk
@@ -0,0 +1,55 @@
+all_fragments+=global_bf
+
+
+# -----------------------------------------------
+# count = 5
+T4_GLOBAL_BF = \
+ writer_StarWriter_30 \
+ writer_StarWriter_40 \
+ writer_globaldocument_StarWriter_40GlobalDocument \
+ writer_StarWriter_50 \
+ writer_globaldocument_StarWriter_50GlobalDocument
+
+# -----------------------------------------------
+# count = 5
+F4_GLOBAL_BF = \
+ StarWriter_3_0__StarWriter_GlobalDocument_ \
+ StarWriter_4_0__StarWriter_GlobalDocument_ \
+ StarWriter_4_0_GlobalDocument \
+ StarWriter_5_0__StarWriter_GlobalDocument_ \
+ StarWriter_5_0_GlobalDocument
+
+# -----------------------------------------------
+# count = 2
+F4_UI_GLOBAL_BF = \
+ StarWriter_4_0_GlobalDocument_ui \
+ StarWriter_5_0_GlobalDocument_ui
+
+# -----------------------------------------------
+# count = 0
+L4_GLOBAL_BF =
+
+# -----------------------------------------------
+# count = 0
+C4_GLOBAL_BF =
+
+# -----------------------------------------------
+TYPES_4fcfg_global_bf = $(foreach,i,$(T4_GLOBAL_BF) types$/$i.xcu )
+FILTERS_4fcfg_global_bf = $(foreach,i,$(F4_GLOBAL_BF) filters$/$i.xcu )
+UI_FILTERS_4fcfg_global_bf = $(foreach,i,$(F4_UI_GLOBAL_BF) $(DIR_LOCFRAG)$/filters$/$i.xcu )
+FRAMELOADERS_4fcfg_global_bf = $(foreach,i,$(L4_GLOBAL_BF) frameloaders$/$i.xcu )
+CONTENTHANDLERS_4fcfg_global_bf = $(foreach,i,$(C4_GLOBAL_BF) contenthandlers$/$i.xcu )
+
+# -----------------------------------------------
+# needed to get dependencies inside global makefile work!
+ALL_4fcfg_global_bf = \
+ $(TYPES_4fcfg_global_bf) \
+ $(FILTERS_4fcfg_global_bf) \
+ $(UI_FILTERS_4fcfg_global_bf) \
+ $(FRAMELOADERS_4fcfg_global_bf) \
+ $(CONTENTHANDLERS_4fcfg_global_bf)
+
+ALL_UI_FILTERS+=$(UI_FILTERS_4fcfg_global_bf)
+
+ALL_PACKAGES+=global_bf
+
diff --git a/filter/source/config/fragments/fcfg_impress.mk b/filter/source/config/fragments/fcfg_impress.mk
new file mode 100644
index 000000000000..f5c1c7de750c
--- /dev/null
+++ b/filter/source/config/fragments/fcfg_impress.mk
@@ -0,0 +1,75 @@
+all_fragments+=impress
+
+# -----------------------------------------------
+# count = 19
+T4_IMPRESS = \
+ draw_StarOffice_XML_Draw \
+ impress_MS_PowerPoint_97 \
+ impress_MS_PowerPoint_97_Vorlage \
+ impress_StarOffice_XML_Impress \
+ impress_StarOffice_XML_Impress_Template \
+ pdf_Portable_Document_Format \
+ pwp_PlaceWare\
+ impress8\
+ impress8_template\
+ draw8\
+ MS_PowerPoint_2007_XML\
+ MS_PowerPoint_2007_XML_Template
+
+# -----------------------------------------------
+# count = 20
+F4_IMPRESS = \
+ MS_PowerPoint_97 \
+ MS_PowerPoint_97_Vorlage \
+ impress_StarOffice_XML_Draw \
+ StarOffice_XML__Impress_ \
+ impress_StarOffice_XML_Impress_Template \
+ impress_pdf_Export \
+ placeware_Export\
+ impress8\
+ impress8_template\
+ impress8_draw\
+ impress_MS_PowerPoint_2007_XML\
+ impress_MS_PowerPoint_2007_XML_Template
+
+# -----------------------------------------------
+# count = 12
+F4_UI_IMPRESS = \
+ MS_PowerPoint_97_Vorlage_ui \
+ impress_StarOffice_XML_Draw_ui \
+ StarOffice_XML__Impress__ui \
+ impress_StarOffice_XML_Impress_Template_ui \
+ impress8_ui \
+ impress8_template_ui \
+ impress8_draw_ui \
+ impress_MS_PowerPoint_2007_XML_ui \
+ impress_MS_PowerPoint_2007_XML_Template_ui
+
+# -----------------------------------------------
+# count = 0
+L4_GLOBAL =
+
+# -----------------------------------------------
+# count = 0
+C4_GLOBAL =
+
+# -----------------------------------------------
+TYPES_4fcfg_impress = $(foreach,i,$(T4_IMPRESS) types$/$i.xcu )
+FILTERS_4fcfg_impress = $(foreach,i,$(F4_IMPRESS) filters$/$i.xcu )
+UI_FILTERS_4fcfg_impress = $(foreach,i,$(F4_UI_IMPRESS) $(DIR_LOCFRAG)$/filters$/$i.xcu )
+FRAMELOADERS_4fcfg_impress = $(foreach,i,$(L4_IMPRESS) frameloaders$/$i.xcu )
+CONTENTHANDLERS_4fcfg_impress = $(foreach,i,$(C4_IMPRESS) contenthandlers$/$i.xcu )
+
+# -----------------------------------------------
+# needed to get dependencies inside global makefile work!
+ALL_4fcfg_impress = \
+ $(TYPES_4fcfg_impress) \
+ $(FILTERS_4fcfg_impress) \
+ $(UI_FILTERS_4fcfg_impress) \
+ $(FRAMELOADERS_4fcfg_impress) \
+ $(CONTENTHANDLERS_4fcfg_impress)
+
+ALL_UI_FILTERS+=$(UI_FILTERS_4fcfg_impress)
+
+ALL_PACKAGES+=impress
+
diff --git a/filter/source/config/fragments/fcfg_impress_bf.mk b/filter/source/config/fragments/fcfg_impress_bf.mk
new file mode 100644
index 000000000000..050aeccff300
--- /dev/null
+++ b/filter/source/config/fragments/fcfg_impress_bf.mk
@@ -0,0 +1,66 @@
+all_fragments+=impress_bf
+
+
+# -----------------------------------------------
+# count = 9
+T4_IMPRESS_BF = \
+ draw_StarDraw_30 \
+ draw_StarDraw_30_Vorlage \
+ draw_StarDraw_50 \
+ draw_StarDraw_50_Vorlage \
+ impress_StarImpress_40 \
+ impress_StarImpress_40_Vorlage \
+ impress_StarImpress_50 \
+ impress_StarImpress_50_Vorlage \
+ impress_StarImpress_50_packed
+
+# -----------------------------------------------
+# count = 9
+F4_IMPRESS_BF = \
+ StarDraw_3_0_Vorlage__StarImpress_ \
+ StarDraw_3_0__StarImpress_ \
+ StarDraw_5_0_Vorlage__StarImpress_ \
+ StarDraw_5_0__StarImpress_ \
+ StarImpress_4_0 \
+ StarImpress_4_0_Vorlage \
+ StarImpress_5_0 \
+ StarImpress_5_0_Vorlage \
+ StarImpress_5_0__packed_
+
+# -----------------------------------------------
+# count = 5
+F4_UI_IMPRESS_BF = \
+ StarDraw_3_0_Vorlage__StarImpress__ui \
+ StarDraw_5_0_Vorlage__StarImpress__ui \
+ StarImpress_4_0_Vorlage_ui \
+ StarImpress_5_0_Vorlage_ui \
+ StarImpress_5_0__packed__ui \
+
+# -----------------------------------------------
+# count = 0
+L4_IMPRESS_BF =
+
+# -----------------------------------------------
+# count = 0
+C4_IMPRESS_BF =
+
+# -----------------------------------------------
+TYPES_4fcfg_impress_bf = $(foreach,i,$(T4_IMPRESS_BF) types$/$i.xcu )
+FILTERS_4fcfg_impress_bf = $(foreach,i,$(F4_IMPRESS_BF) filters$/$i.xcu )
+UI_FILTERS_4fcfg_impress_bf = $(foreach,i,$(F4_UI_IMPRESS_BF) $(DIR_LOCFRAG)$/filters$/$i.xcu )
+FRAMELOADERS_4fcfg_impress_bf = $(foreach,i,$(L4_IMPRESS_BF) frameloaders$/$i.xcu )
+CONTENTHANDLERS_4fcfg_impress_bf = $(foreach,i,$(C4_IMPRESS_BF) contenthandlers$/$i.xcu )
+
+# -----------------------------------------------
+# needed to get dependencies inside global makefile work!
+ALL_4fcfg_impress_bf = \
+ $(TYPES_4fcfg_impress_bf) \
+ $(FILTERS_4fcfg_impress_bf) \
+ $(UI_FILTERS_4fcfg_impress_bf) \
+ $(FRAMELOADERS_4fcfg_impress_bf) \
+ $(CONTENTHANDLERS_4fcfg_impress_bf)
+
+ALL_UI_FILTERS+=$(UI_FILTERS_4fcfg_impress_bf)
+
+ALL_PACKAGES+=impress_bf
+
diff --git a/filter/source/config/fragments/fcfg_impressgraphics.mk b/filter/source/config/fragments/fcfg_impressgraphics.mk
new file mode 100644
index 000000000000..a05aac7e7ed4
--- /dev/null
+++ b/filter/source/config/fragments/fcfg_impressgraphics.mk
@@ -0,0 +1,83 @@
+all_fragments+=impressgraphics
+
+# -----------------------------------------------
+# count = 20
+T4_IMPRESSGRAPHICS = \
+ bmp_MS_Windows \
+ emf_MS_Windows_Metafile \
+ eps_Encapsulated_PostScript \
+ gif_Graphics_Interchange \
+ graphic_HTML \
+ graphic_SWF \
+ impress_CGM_Computer_Graphics_Metafile \
+ jpg_JPEG \
+ met_OS2_Metafile \
+ pbm_Portable_Bitmap \
+ pct_Mac_Pict \
+ pgm_Portable_Graymap \
+ png_Portable_Network_Graphic \
+ ppm_Portable_Pixelmap \
+ ras_Sun_Rasterfile \
+ svg_Scalable_Vector_Graphics \
+ svm_StarView_Metafile \
+ tif_Tag_Image_File \
+ wmf_MS_Windows_Metafile \
+ xpm_XPM
+
+# -----------------------------------------------
+# count = 20
+F4_IMPRESSGRAPHICS = \
+ CGM___Computer_Graphics_Metafile \
+ impress_bmp_Export \
+ impress_emf_Export \
+ impress_eps_Export \
+ impress_flash_Export \
+ impress_gif_Export \
+ impress_html_Export \
+ impress_jpg_Export \
+ impress_met_Export \
+ impress_pbm_Export \
+ impress_pct_Export \
+ impress_pgm_Export \
+ impress_png_Export \
+ impress_ppm_Export \
+ impress_ras_Export \
+ impress_svg_Export \
+ impress_svm_Export \
+ impress_tif_Export \
+ impress_wmf_Export \
+ impress_xpm_Export
+
+# -----------------------------------------------
+# count = 1
+F4_UI_IMPRESSGRAPHICS = \
+ impress_html_Export_ui
+
+# -----------------------------------------------
+# count = 0
+L4_IMPRESSGRAPHICS =
+
+# -----------------------------------------------
+# count = 0
+C4_IMPRESSGRAPHICS =
+
+# -----------------------------------------------
+TYPES_4fcfg_impressgraphics = $(foreach,i,$(T4_IMPRESSGRAPHICS) types$/$i.xcu )
+FILTERS_4fcfg_impressgraphics = $(foreach,i,$(F4_IMPRESSGRAPHICS) filters$/$i.xcu )
+UI_FILTERS_4fcfg_impressgraphics = $(foreach,i,$(F4_UI_IMPRESSGRAPHICS) $(DIR_LOCFRAG)$/filters$/$i.xcu )
+FRAMELOADERS_4fcfg_impressgraphics = $(foreach,i,$(L4_IMPRESSGRAPHICS) frameloaders$/$i.xcu )
+CONTENTHANDLERS_4fcfg_impressgraphics = $(foreach,i,$(C4_IMPRESSGRAPHICS) contenthandlers$/$i.xcu )
+
+# -----------------------------------------------
+# needed to get dependencies inside global makefile work!
+ALL_4fcfg_impressgraphics = \
+ $(TYPES_4fcfg_impressgraphics) \
+ $(FILTERS_4fcfg_impressgraphics) \
+ $(UI_FILTERS_4fcfg_impressgraphics) \
+ $(FRAMELOADERS_4fcfg_impressgraphics) \
+ $(CONTENTHANDLERS_4fcfg_impressgraphics)
+
+ALL_UI_FILTERS+=$(UI_FILTERS_4fcfg_impressgraphics)
+
+ALL_PACKAGES+=impressgraphics
+
diff --git a/filter/source/config/fragments/fcfg_internalgraphics.mk b/filter/source/config/fragments/fcfg_internalgraphics.mk
new file mode 100644
index 000000000000..ae978f0ca06c
--- /dev/null
+++ b/filter/source/config/fragments/fcfg_internalgraphics.mk
@@ -0,0 +1,109 @@
+# do not add internal filter
+#all_fragments+=internalgraphics
+
+# -----------------------------------------------
+# count = 27
+T4_INTERNALGRAPHICS = \
+ bmp_MS_Windows \
+ dxf_AutoCAD_Interchange \
+ emf_MS_Windows_Metafile \
+ eps_Encapsulated_PostScript \
+ gif_Graphics_Interchange \
+ jpg_JPEG \
+ met_OS2_Metafile \
+ pbm_Portable_Bitmap \
+ pcd_Photo_CD_Base \
+ pcd_Photo_CD_Base16 \
+ pcd_Photo_CD_Base4 \
+ pct_Mac_Pict \
+ pcx_Zsoft_Paintbrush \
+ pgm_Portable_Graymap \
+ png_Portable_Network_Graphic \
+ ppm_Portable_Pixelmap \
+ psd_Adobe_Photoshop \
+ ras_Sun_Rasterfile \
+ sgf_StarOffice_Writer_SGF \
+ sgv_StarDraw_20 \
+ svg_Scalable_Vector_Graphics \
+ svm_StarView_Metafile \
+ tga_Truevision_TARGA \
+ tif_Tag_Image_File \
+ wmf_MS_Windows_Metafile \
+ xbm_X_Consortium \
+ xpm_XPM
+
+# -----------------------------------------------
+# count = 43
+F4_INTERNALGRAPHICS = \
+ bmp_Export \
+ bmp_Import \
+ dxf_Import \
+ emf_Export \
+ emf_Import \
+ eps_Export \
+ eps_Import \
+ gif_Export \
+ gif_Import \
+ jpg_Export \
+ jpg_Import \
+ met_Export \
+ met_Import \
+ pbm_Export \
+ pbm_Import \
+ pcd_Import_Base \
+ pcd_Import_Base4 \
+ pcd_Import_Base16 \
+ pct_Export \
+ pct_Import \
+ pcx_Import \
+ pgm_Export \
+ pgm_Import \
+ png_Export \
+ png_Import \
+ ppm_Export \
+ ppm_Import \
+ psd_Import \
+ ras_Export \
+ ras_Import \
+ sgf_Import \
+ sgv_Import \
+ svg_Export \
+ svm_Export \
+ svm_Import \
+ tga_Import \
+ tif_Export \
+ tif_Import \
+ wmf_Export \
+ wmf_Import \
+ xbm_Import \
+ xpm_Export \
+ xpm_Import
+
+# -----------------------------------------------
+# count = 0
+L4_INTERNALGRAPHICS =
+
+# -----------------------------------------------
+# count = 0
+C4_INTERNALGRAPHICS =
+
+# -----------------------------------------------
+TYPES_4fcfg_internalgraphics = $(foreach,i,$(T4_INTERNALGRAPHICS) types$/$i.xcu )
+FILTERS_4fcfg_internalgraphics = $(foreach,i,$(F4_INTERNALGRAPHICS) internalgraphicfilters$/$i.xcu )
+FRAMELOADERS_4fcfg_internalgraphics = $(foreach,i,$(L4_INTERNALGRAPHICS) frameloaders$/$i.xcu )
+CONTENTHANDLERS_4fcfg_internalgraphics = $(foreach,i,$(C4_INTERNALGRAPHICS) contenthandlers$/$i.xcu )
+
+# -----------------------------------------------
+# needed to get dependencies inside global makefile work!
+ALL_4fcfg_internalgraphics = \
+ $(TYPES_4fcfg_internalgraphics) \
+ $(FILTERS_4fcfg_internalgraphics) \
+ $(FRAMELOADERS_4fcfg_internalgraphics) \
+ $(CONTENTHANDLERS_4fcfg_internalgraphics)
+
+# do not add internal filter
+# ALL_UI_FILTERS+=
+
+# do not add internal filter
+# ALL_PACKAGES+=internalgraphics
+
diff --git a/filter/source/config/fragments/fcfg_math.mk b/filter/source/config/fragments/fcfg_math.mk
new file mode 100644
index 000000000000..07747769b66a
--- /dev/null
+++ b/filter/source/config/fragments/fcfg_math.mk
@@ -0,0 +1,55 @@
+all_fragments+=math
+
+
+# -----------------------------------------------
+# count = 5
+T4_MATH = \
+ math_MathML_XML_Math \
+ math_MathType_3x \
+ math_StarOffice_XML_Math \
+ pdf_Portable_Document_Format \
+ math8
+
+# -----------------------------------------------
+# count = 5
+F4_MATH = \
+ MathML_XML__Math_ \
+ MathType_3_x \
+ StarOffice_XML__Math_ \
+ math_pdf_Export \
+ math8
+
+# -----------------------------------------------
+# count = 2
+F4_UI_MATH = \
+ StarOffice_XML__Math__ui \
+ math8_ui
+
+# -----------------------------------------------
+# count = 0
+L4_MATH =
+
+# -----------------------------------------------
+# count = 0
+C4_MATH =
+
+# -----------------------------------------------
+TYPES_4fcfg_math = $(foreach,i,$(T4_MATH) types$/$i.xcu )
+FILTERS_4fcfg_math = $(foreach,i,$(F4_MATH) filters$/$i.xcu )
+UI_FILTERS_4fcfg_math = $(foreach,i,$(F4_UI_MATH) $(DIR_LOCFRAG)$/filters$/$i.xcu )
+FRAMELOADERS_4fcfg_math = $(foreach,i,$(L4_MATH) frameloaders$/$i.xcu )
+CONTENTHANDLERS_4fcfg_math = $(foreach,i,$(C4_MATH) contenthandlers$/$i.xcu )
+
+# -----------------------------------------------
+# needed to get dependencies inside global makefile work!
+ALL_4fcfg_math = \
+ $(TYPES_4fcfg_math) \
+ $(FILTERS_4fcfg_math) \
+ $(UI_FILTERS_4fcfg_math) \
+ $(FRAMELOADERS_4fcfg_math) \
+ $(CONTENTHANDLERS_4fcfg_math)
+
+ALL_UI_FILTERS+=$(UI_FILTERS_4fcfg_math)
+
+ALL_PACKAGES+=math
+
diff --git a/filter/source/config/fragments/fcfg_math_bf.mk b/filter/source/config/fragments/fcfg_math_bf.mk
new file mode 100644
index 000000000000..f01fb997653b
--- /dev/null
+++ b/filter/source/config/fragments/fcfg_math_bf.mk
@@ -0,0 +1,50 @@
+all_fragments+=math_bf
+
+# -----------------------------------------------
+# count = 4
+T4_MATH_BF = \
+ math_StarMath_20 \
+ math_StarMath_30 \
+ math_StarMath_40 \
+ math_StarMath_50
+
+# -----------------------------------------------
+# count = 4
+F4_MATH_BF = \
+ StarMath_2_0 \
+ StarMath_3_0 \
+ StarMath_4_0 \
+ StarMath_5_0
+
+# -----------------------------------------------
+# count = 0
+F4_UI_MATH_BF =
+
+# -----------------------------------------------
+# count = 0
+L4_MATH_BF =
+
+# -----------------------------------------------
+# count = 0
+C4_MATH_BF =
+
+# -----------------------------------------------
+TYPES_4fcfg_math_bf = $(foreach,i,$(T4_MATH_BF) types$/$i.xcu )
+FILTERS_4fcfg_math_bf = $(foreach,i,$(F4_MATH_BF) filters$/$i.xcu )
+UI_FILTERS_4fcfg_math_bf = $(foreach,i,$(F4_UI_MATH_BF) $(DIR_LOCFRAG)$/filters$/$i.xcu )
+FRAMELOADERS_4fcfg_math_bf = $(foreach,i,$(L4_MATH_BF) frameloaders$/$i.xcu )
+CONTENTHANDLERS_4fcfg_math_bf = $(foreach,i,$(C4_MATH_BF) contenthandlers$/$i.xcu )
+
+# -----------------------------------------------
+# needed to get dependencies inside global makefile work!
+ALL_4fcfg_math_bf = \
+ $(TYPES_4fcfg_math_bf) \
+ $(FILTERS_4fcfg_math_bf) \
+ $(UI_FILTERS_4fcfg_math_bf) \
+ $(FRAMELOADERS_4fcfg_math_bf) \
+ $(CONTENTHANDLERS_4fcfg_math_bf)
+
+ALL_UI_FILTERS+=$(UI_FILTERS_4fcfg_math_bf)
+
+ALL_PACKAGES+=math_bf
+
diff --git a/filter/source/config/fragments/fcfg_palm.mk b/filter/source/config/fragments/fcfg_palm.mk
new file mode 100644
index 000000000000..8b43b542c896
--- /dev/null
+++ b/filter/source/config/fragments/fcfg_palm.mk
@@ -0,0 +1,44 @@
+all_fragments+=palm
+
+# -----------------------------------------------
+# count = 1
+T4_PALM = \
+ writer_AportisDoc_PalmDB_File
+
+# -----------------------------------------------
+# count = 1
+F4_PALM = \
+ AportisDoc_Palm_DB
+
+# -----------------------------------------------
+# count = 0
+F4_UI_PALM =
+
+# -----------------------------------------------
+# count = 0
+L4_PALM =
+
+# -----------------------------------------------
+# count = 0
+C4_PALM =
+
+# -----------------------------------------------
+TYPES_4fcfg_palm = $(foreach,i,$(T4_PALM) types$/$i.xcu )
+FILTERS_4fcfg_palm = $(foreach,i,$(F4_PALM) filters$/$i.xcu )
+UI_FILTERS_4fcfg_palm = $(foreach,i,$(F4_UI_PALM) $(DIR_LOCFRAG)$/filters$/$i.xcu )
+FRAMELOADERS_4fcfg_palm = $(foreach,i,$(L4_PALM) frameloaders$/$i.xcu )
+CONTENTHANDLERS_4fcfg_palm = $(foreach,i,$(C4_PALM) contenthandlers$/$i.xcu )
+
+# -----------------------------------------------
+# needed to get dependencies inside global makefile work!
+ALL_4fcfg_palm = \
+ $(TYPES_4fcfg_palm) \
+ $(FILTERS_4fcfg_palm) \
+ $(UI_FILTERS_4fcfg_palm) \
+ $(FRAMELOADERS_4fcfg_palm) \
+ $(CONTENTHANDLERS_4fcfg_palm)
+
+ALL_UI_FILTERS+=$(UI_FILTERS_4fcfg_palm)
+
+ALL_PACKAGES+=palm
+
diff --git a/filter/source/config/fragments/fcfg_pocketexcel.mk b/filter/source/config/fragments/fcfg_pocketexcel.mk
new file mode 100644
index 000000000000..02ec4fec488e
--- /dev/null
+++ b/filter/source/config/fragments/fcfg_pocketexcel.mk
@@ -0,0 +1,44 @@
+all_fragments+=pocketexcel
+
+# -----------------------------------------------
+# count = 1
+T4_POCKETEXCEL = \
+ calc_Pocket_Excel_File
+
+# -----------------------------------------------
+# count = 1
+F4_POCKETEXCEL = \
+ Pocket_Excel
+
+# -----------------------------------------------
+# count = 0
+F4_UI_POCKETEXCEL =
+
+# -----------------------------------------------
+# count = 0
+L4_POCKETEXCEL =
+
+# -----------------------------------------------
+# count = 0
+C4_POCKETEXCEL =
+
+# -----------------------------------------------
+TYPES_4fcfg_pocketexcel = $(foreach,i,$(T4_POCKETEXCEL) types$/$i.xcu )
+FILTERS_4fcfg_pocketexcel = $(foreach,i,$(F4_POCKETEXCEL) filters$/$i.xcu )
+UI_FILTERS_4fcfg_pocketexcel = $(foreach,i,$(F4_UI_POCKETEXCEL) $(DIR_LOCFRAG)$/filters$/$i.xcu )
+FRAMELOADERS_4fcfg_pocketexcel = $(foreach,i,$(L4_POCKETEXCEL) frameloaders$/$i.xcu )
+CONTENTHANDLERS_4fcfg_pocketexcel = $(foreach,i,$(C4_POCKETEXCEL) contenthandlers$/$i.xcu )
+
+# -----------------------------------------------
+# needed to get dependencies inside global makefile work!
+ALL_4fcfg_pocketexcel = \
+ $(TYPES_4fcfg_pocketexcel) \
+ $(FILTERS_4fcfg_pocketexcel) \
+ $(UI_FILTERS_4fcfg_pocketexcel) \
+ $(FRAMELOADERS_4fcfg_pocketexcel) \
+ $(CONTENTHANDLERS_4fcfg_pocketexcel)
+
+ALL_UI_FILTERS+=$(UI_FILTERS_4fcfg_pocketexcel)
+
+ALL_PACKAGES+=pocketexcel
+
diff --git a/filter/source/config/fragments/fcfg_pocketword.mk b/filter/source/config/fragments/fcfg_pocketword.mk
new file mode 100644
index 000000000000..6060262147f7
--- /dev/null
+++ b/filter/source/config/fragments/fcfg_pocketword.mk
@@ -0,0 +1,44 @@
+all_fragments+=pocketword
+
+# -----------------------------------------------
+# count = 1
+T4_POCKETWORD = \
+ writer_PocketWord_File
+
+# -----------------------------------------------
+# count = 1
+F4_POCKETWORD = \
+ PocketWord_File
+
+# -----------------------------------------------
+# count = 0
+F4_UI_POCKETWORD =
+
+# -----------------------------------------------
+# count = 0
+L4_POCKETWORD =
+
+# -----------------------------------------------
+# count = 0
+C4_POCKETWORD =
+
+# -----------------------------------------------
+TYPES_4fcfg_pocketword = $(foreach,i,$(T4_POCKETWORD) types$/$i.xcu )
+FILTERS_4fcfg_pocketword = $(foreach,i,$(F4_POCKETWORD) filters$/$i.xcu )
+UI_FILTERS_4fcfg_pocketword = $(foreach,i,$(F4_UI_POCKETWORD) $(DIR_LOCFRAG)$/filters$/$i.xcu )
+FRAMELOADERS_4fcfg_pocketword = $(foreach,i,$(L4_POCKETWORD) frameloaders$/$i.xcu )
+CONTENTHANDLERS_4fcfg_pocketword = $(foreach,i,$(C4_POCKETWORD) contenthandlers$/$i.xcu )
+
+# -----------------------------------------------
+# needed to get dependencies inside global makefile work!
+ALL_4fcfg_pocketword = \
+ $(TYPES_4fcfg_pocketword) \
+ $(FILTERS_4fcfg_pocketword) \
+ $(UI_FILTERS_4fcfg_pocketword) \
+ $(FRAMELOADERS_4fcfg_pocketword) \
+ $(CONTENTHANDLERS_4fcfg_pocketword)
+
+ALL_UI_FILTERS+=$(UI_FILTERS_4fcfg_pocketword)
+
+ALL_PACKAGES+=pocketword
+
diff --git a/filter/source/config/fragments/fcfg_w4w.mk b/filter/source/config/fragments/fcfg_w4w.mk
new file mode 100644
index 000000000000..dd40b5938d80
--- /dev/null
+++ b/filter/source/config/fragments/fcfg_w4w.mk
@@ -0,0 +1,260 @@
+all_fragments+=w4w
+
+# -----------------------------------------------
+# count = 109
+T4_W4W = \
+ writer_Ami_Pro_1x_31_W4W \
+ writer_CTOS_DEF_W4W \
+ writer_Claris_Works_W4W \
+ writer_DCA_Revisable_Form_Text_W4W \
+ writer_DCA_with_Display_Write_5_W4W \
+ writer_DCAFFT_Final_Form_Text_W4W \
+ writer_DEC_DX_W4W \
+ writer_DEC_WPS_PLUS_W4W \
+ writer_DataGeneral_CEO_Write_W4W \
+ writer_DisplayWrite_20_4x_W4W \
+ writer_DisplayWrite_5x_W4W \
+ writer_EBCDIC_W4W \
+ writer_Enable_W4W \
+ writer_Frame_Maker_MIF_30_W4W \
+ writer_Frame_Maker_MIF_40_W4W \
+ writer_Frame_Maker_MIF_50_W4W \
+ writer_Frame_Work_III_W4W \
+ writer_Frame_Work_IV_W4W \
+ writer_HP_AdvanceWrite_Plus_W4W \
+ writer_ICL_Office_Power_6_W4W \
+ writer_ICL_Office_Power_7_W4W \
+ writer_Interleaf_W4W \
+ writer_Interleaf_5_6_W4W \
+ writer_Legacy_Winstar_onGO_W4W \
+ writer_Lotus_Manuscript_W4W \
+ writer_MASS_11_Rel_80_83_W4W \
+ writer_MASS_11_Rel_85_90_W4W \
+ writer_MS_MacWord_30_W4W \
+ writer_MS_MacWord_40_W4W \
+ writer_MS_MacWord_5x_W4W \
+ writer_MS_WinWord_1x_W4W \
+ writer_MS_WinWord_2x_W4W \
+ writer_MS_Word_3x_W4W \
+ writer_MS_Word_4x_W4W \
+ writer_MS_Word_5x_W4W \
+ writer_MS_Word_6x_W4W \
+ writer_MS_Works_20_DOS_W4W \
+ writer_MS_Works_30_Win_W4W \
+ writer_MS_Works_40_Mac_W4W \
+ writer_Mac_Write_4x_50_W4W \
+ writer_Mac_Write_II_W4W \
+ writer_Mac_Write_Pro_W4W \
+ writer_MultiMate_33_W4W \
+ writer_MultiMate_4_W4W \
+ writer_MultiMate_Adv_36_W4W \
+ writer_MultiMate_Adv_II_37_W4W \
+ writer_NAVY_DIF_W4W \
+ writer_OfficeWriter_40_W4W \
+ writer_OfficeWriter_50_W4W \
+ writer_OfficeWriter_6x_W4W \
+ writer_PFS_First_Choice_10_W4W \
+ writer_PFS_First_Choice_20_W4W \
+ writer_PFS_First_Choice_30_W4W \
+ writer_PFS_Write_W4W \
+ writer_Peach_Text_W4W \
+ writer_Professional_Write_10_W4W \
+ writer_Professional_Write_2x_W4W \
+ writer_Professional_Write_Plus_W4W \
+ writer_QA_Write_10_30_W4W \
+ writer_QA_Write_40_W4W \
+ writer_Rapid_File_10_W4W \
+ writer_Rapid_File_12_W4W \
+ writer_Samna_Word_IV_IV_Plus_W4W \
+ writer_Total_Word_W4W \
+ writer_Uniplex_V7_V8_W4W \
+ writer_Uniplex_onGO_W4W \
+ writer_VolksWriter_3_and_4_W4W \
+ writer_VolksWriter_Deluxe_W4W \
+ writer_WITA_W4W \
+ writer_Wang_II_SWP_W4W \
+ writer_Wang_PC_W4W \
+ writer_Wang_WP_Plus_W4W \
+ writer_Win_Write_3x_W4W \
+ writer_WiziWord_30_W4W \
+ writer_WordPerfect_Win_51_52_W4W \
+ writer_WordPerfect_Win_60_W4W \
+ writer_WordPerfect_Win_61_W4W \
+ writer_WordPerfect_Win_70_W4W \
+ writer_WordPerfect_41_W4W \
+ writer_WordPerfect_42_W4W \
+ writer_WordPerfect_50_W4W \
+ writer_WordPerfect_51_W4W \
+ writer_WordPerfect_60_W4W \
+ writer_WordPerfect_61_W4W \
+ writer_WordPerfect_Mac_1_W4W \
+ writer_WordPerfect_Mac_2_W4W \
+ writer_WordPerfect_Mac_3_W4W \
+ writer_WordStar_Win_1x_20_W4W \
+ writer_WordStar_2000_Rel_30_W4W \
+ writer_WordStar_2000_Rel_35_W4W \
+ writer_WordStar_33x_W4W \
+ writer_WordStar_345_W4W \
+ writer_WordStar_40_W4W \
+ writer_WordStar_50_W4W \
+ writer_WordStar_55_W4W \
+ writer_WordStar_60_W4W \
+ writer_WordStar_70_W4W \
+ writer_WriteNow_30_Macintosh_W4W \
+ writer_Writing_Assistant_W4W \
+ writer_XEROX_XIF_50_Illustrator_W4W \
+ writer_XEROX_XIF_50_W4W \
+ writer_XEROX_XIF_60_Color_Bitmap_W4W \
+ writer_XEROX_XIF_60_Res_Graphic_W4W \
+ writer_XyWrite_Win_10_W4W \
+ writer_XyWrite_III_W4W \
+ writer_XyWrite_IIIP_W4W \
+ writer_XyWrite_IV_W4W \
+ writer_XyWrite_Sig_Win_W4W \
+ writer_XyWrite_Signature_W4W
+
+# -----------------------------------------------
+# count = 109
+F4_W4W = \
+ Ami_Pro_1_x_3_1__W4W_ \
+ CTOS_DEF__W4W_ \
+ Claris_Works__W4W_ \
+ DCA_Revisable_Form_Text__W4W_ \
+ DCA_with_Display_Write_5__W4W_ \
+ DCA_FFT_Final_Form_Text__W4W_ \
+ DEC_DX__W4W_ \
+ DEC_WPS_PLUS__W4W_ \
+ DataGeneral_CEO_Write__W4W_ \
+ DisplayWrite_2_0_4_x__W4W_ \
+ DisplayWrite_5_x__W4W_ \
+ EBCDIC__W4W_ \
+ Enable__W4W_ \
+ Frame_Maker_MIF_3_0__W4W_ \
+ Frame_Maker_MIF_4_0__W4W_ \
+ Frame_Maker_MIF_5_0__W4W_ \
+ Frame_Work_III__W4W_ \
+ Frame_Work_IV___W4W_ \
+ HP_AdvanceWrite_Plus__W4W_ \
+ ICL_Office_Power_6__W4W_ \
+ ICL_Office_Power_7__W4W_ \
+ Interleaf__W4W_ \
+ Interleaf_5___6__W4W_ \
+ Legacy_Winstar_onGO__W4W_ \
+ Lotus_Manuscript__W4W_ \
+ MASS_11_Rel__8_0_8_3__W4W_ \
+ MASS_11_Rel__8_5_9_0__W4W_ \
+ MS_MacWord_3_0__W4W_ \
+ MS_MacWord_4_0__W4W_ \
+ MS_MacWord_5_x__W4W_ \
+ MS_WinWord_1_x__W4W_ \
+ MS_WinWord_2_x__W4W_ \
+ MS_Word_3_x__W4W_ \
+ MS_Word_4_x__W4W_ \
+ MS_Word_5_x__W4W_ \
+ MS_Word_6_x__W4W_ \
+ MS_Works_2_0_DOS__W4W_ \
+ MS_Works_3_0_Win__W4W_ \
+ MS_Works_4_0_Mac__W4W_ \
+ Mac_Write_4_x_5_0__W4W_ \
+ Mac_Write_II__W4W_ \
+ Mac_Write_Pro__W4W_ \
+ MultiMate_3_3__W4W_ \
+ MultiMate_4__W4W_ \
+ MultiMate_Adv__3_6__W4W_ \
+ MultiMate_Adv__II_3_7__W4W_ \
+ NAVY_DIF__W4W_ \
+ OfficeWriter_4_0__W4W_ \
+ OfficeWriter_5_0__W4W_ \
+ OfficeWriter_6_x__W4W_ \
+ PFS_First_Choice_1_0__W4W_ \
+ PFS_First_Choice_2_0__W4W_ \
+ PFS_First_Choice_3_0__W4W_ \
+ PFS_Write__W4W_ \
+ Peach_Text__W4W_ \
+ Professional_Write_1_0__W4W_ \
+ Professional_Write_2_x__W4W_ \
+ Professional_Write_Plus__W4W_ \
+ Q_A_Write_1_0_3_0__W4W_ \
+ Q_A_Write_4_0__W4W_ \
+ Rapid_File_1_0__W4W_ \
+ Rapid_File_1_2__W4W_ \
+ Samna_Word_IV_IV_Plus__W4W_ \
+ Total_Word__W4W_ \
+ Uniplex_V7_V8__W4W_ \
+ Uniplex_onGO__W4W_ \
+ VolksWriter_3_and_4__W4W_ \
+ VolksWriter_Deluxe__W4W_ \
+ WITA__W4W_ \
+ Wang_II_SWP__W4W_ \
+ Wang_PC__W4W_ \
+ Wang_WP_Plus__W4W_ \
+ Win_Write_3_x__W4W_ \
+ WiziWord_3_0__W4W_ \
+ WordPerfect__Win__5_1_5_2__W4W_ \
+ WordPerfect__Win__6_0__W4W_ \
+ WordPerfect__Win__6_1__W4W_ \
+ WordPerfect__Win__7_0__W4W_ \
+ WordPerfect_4_1__W4W_ \
+ WordPerfect_4_2__W4W_ \
+ WordPerfect_5_0__W4W_ \
+ WordPerfect_5_1__W4W_ \
+ WordPerfect_6_0__W4W_ \
+ WordPerfect_6_1__W4W_ \
+ WordPerfect_Mac_1__W4W_ \
+ WordPerfect_Mac_2__W4W_ \
+ WordPerfect_Mac_3__W4W_ \
+ WordStar__Win__1_x_2_0__W4W_ \
+ WordStar_2000_Rel__3_0__W4W_ \
+ WordStar_2000_Rel__3_5__W4W_ \
+ WordStar_3_3x__W4W_ \
+ WordStar_3_45__W4W_ \
+ WordStar_4_0___W4W_ \
+ WordStar_5_0___W4W_ \
+ WordStar_5_5___W4W_ \
+ WordStar_6_0___W4W_ \
+ WordStar_7_0___W4W_ \
+ WriteNow_3_0__Macintosh___W4W_ \
+ Writing_Assistant__W4W_ \
+ XEROX_XIF_5_0__Illustrator___W4W_ \
+ XEROX_XIF_5_0__W4W_ \
+ XEROX_XIF_6_0__Color_Bitmap___W4W_ \
+ XEROX_XIF_6_0__Res_Graphic___W4W_ \
+ XyWrite__Win__1_0__W4W_ \
+ XyWrite_III___W4W_ \
+ XyWrite_III____W4W_ \
+ XyWrite_IV__W4W_ \
+ XyWrite_Sig___Win___W4W_ \
+ XyWrite_Signature__W4W_
+
+# -----------------------------------------------
+# count = 0
+F4_UI_W4W =
+
+# -----------------------------------------------
+# count = 0
+L4_W4W =
+
+# -----------------------------------------------
+# count = 0
+C4_W4W =
+
+# -----------------------------------------------
+TYPES_4fcfg_w4w = $(foreach,i,$(T4_W4W) types$/$i.xcu )
+FILTERS_4fcfg_w4w = $(foreach,i,$(F4_W4W) filters$/$i.xcu )
+UI_FILTERS_4fcfg_w4w = $(foreach,i,$(F4_UI_W4W) $(DIR_LOCFRAG)$/filters$/$i.xcu )
+FRAMELOADERS_4fcfg_w4w = $(foreach,i,$(L4_W4W) frameloaders$/$i.xcu )
+CONTENTHANDLERS_4fcfg_w4w = $(foreach,i,$(C4_W4W) contenthandlers$/$i.xcu )
+
+# -----------------------------------------------
+# needed to get dependencies inside global makefile work!
+ALL_4fcfg_w4w = \
+ $(TYPES_4fcfg_w4w) \
+ $(FILTERS_4fcfg_w4w) \
+ $(UI_FILTERS_4fcfg_w4w) \
+ $(FRAMELOADERS_4fcfg_w4w) \
+ $(CONTENTHANDLERS_4fcfg_w4w)
+
+ALL_UI_FILTERS+=$(UI_FILTERS_4fcfg_w4w)
+
+ALL_PACKAGES+=w4w
+
diff --git a/filter/source/config/fragments/fcfg_web.mk b/filter/source/config/fragments/fcfg_web.mk
new file mode 100644
index 000000000000..c333635228c0
--- /dev/null
+++ b/filter/source/config/fragments/fcfg_web.mk
@@ -0,0 +1,65 @@
+all_fragments+=web
+
+# -----------------------------------------------
+# count = 12
+T4_WEB = \
+ writer_web_HTML \
+ writer_Text \
+ writer_web_HTML_help \
+ writer_StarOffice_XML_Writer \
+ writer_web_StarOffice_XML_Writer_Web_Template \
+ pdf_Portable_Document_Format\
+ writerweb8_writer_template
+
+# -----------------------------------------------
+# count = 14
+F4_WEB = \
+ HTML \
+ Text__StarWriter_Web_ \
+ Text__encoded___StarWriter_Web_ \
+ writer_web_HTML_help \
+ writer_web_StarOffice_XML_Writer \
+ writer_web_StarOffice_XML_Writer_Web_Template \
+ writer_web_pdf_Export\
+ writerweb8_writer_template\
+ writerweb8_writer
+
+# -----------------------------------------------
+# count = 9
+F4_UI_WEB = \
+ HTML_ui \
+ Text__StarWriter_Web__ui \
+ Text__encoded___StarWriter_Web__ui \
+ writer_web_StarOffice_XML_Writer_ui \
+ writer_web_StarOffice_XML_Writer_Web_Template_ui \
+ writerweb8_writer_template_ui \
+ writerweb8_writer_ui
+
+# -----------------------------------------------
+# count = 0
+L4_WEB =
+
+# -----------------------------------------------
+# count = 0
+C4_WEB =
+
+# -----------------------------------------------
+TYPES_4fcfg_web = $(foreach,i,$(T4_WEB) types$/$i.xcu )
+FILTERS_4fcfg_web = $(foreach,i,$(F4_WEB) filters$/$i.xcu )
+UI_FILTERS_4fcfg_web = $(foreach,i,$(F4_UI_WEB) $(DIR_LOCFRAG)$/filters$/$i.xcu )
+FRAMELOADERS_4fcfg_web = $(foreach,i,$(L4_WEB) frameloaders$/$i.xcu )
+CONTENTHANDLERS_4fcfg_web = $(foreach,i,$(C4_WEB) contenthandlers$/$i.xcu )
+
+# -----------------------------------------------
+# needed to get dependencies inside global makefile work!
+ALL_4fcfg_web = \
+ $(TYPES_4fcfg_web) \
+ $(FILTERS_4fcfg_web) \
+ $(UI_FILTERS_4fcfg_web) \
+ $(FRAMELOADERS_4fcfg_web) \
+ $(CONTENTHANDLERS_4fcfg_web)
+
+ALL_UI_FILTERS+=$(UI_FILTERS_4fcfg_web)
+
+ALL_PACKAGES+=web
+
diff --git a/filter/source/config/fragments/fcfg_web_bf.mk b/filter/source/config/fragments/fcfg_web_bf.mk
new file mode 100644
index 000000000000..78d43d4360cb
--- /dev/null
+++ b/filter/source/config/fragments/fcfg_web_bf.mk
@@ -0,0 +1,54 @@
+all_fragments+=web_bf
+
+# -----------------------------------------------
+# count = 5
+T4_WEB_BF = \
+ writer_StarWriter_30 \
+ writer_StarWriter_40 \
+ writer_StarWriter_50 \
+ writer_web_StarWriterWeb_40_VorlageTemplate \
+ writer_web_StarWriterWeb_50_VorlageTemplate
+
+# -----------------------------------------------
+# count = 5
+F4_WEB_BF = \
+ StarWriter_3_0__StarWriter_Web_ \
+ StarWriter_4_0__StarWriter_Web_ \
+ StarWriter_5_0__StarWriter_Web_ \
+ StarWriter_Web_4_0_Vorlage_Template \
+ StarWriter_Web_5_0_Vorlage_Template
+
+# -----------------------------------------------
+# count = 2
+F4_UI_WEB_BF = \
+ StarWriter_Web_4_0_Vorlage_Template_ui \
+ StarWriter_Web_5_0_Vorlage_Template_ui
+
+# -----------------------------------------------
+# count = 0
+L4_WEB_BF =
+
+# -----------------------------------------------
+# count = 0
+C4_WEB_BF =
+
+# -----------------------------------------------
+TYPES_4fcfg_web_bf = $(foreach,i,$(T4_WEB_BF) types$/$i.xcu )
+FILTERS_4fcfg_web_bf = $(foreach,i,$(F4_WEB_BF) filters$/$i.xcu )
+UI_FILTERS_4fcfg_web_bf = $(foreach,i,$(F4_UI_WEB_BF) $(DIR_LOCFRAG)$/filters$/$i.xcu )
+FRAMELOADERS_4fcfg_web_bf = $(foreach,i,$(L4_WEB_BF) frameloaders$/$i.xcu )
+CONTENTHANDLERS_4fcfg_web_bf = $(foreach,i,$(C4_WEB_BF) contenthandlers$/$i.xcu )
+
+# -----------------------------------------------
+# needed to get dependencies inside global makefile work!
+ALL_4fcfg_web_bf = \
+ $(TYPES_4fcfg_web_bf) \
+ $(FILTERS_4fcfg_web_bf) \
+ $(UI_FILTERS_4fcfg_web_bf) \
+ $(FRAMELOADERS_4fcfg_web_bf) \
+ $(CONTENTHANDLERS_4fcfg_web_bf)
+
+ALL_UI_FILTERS+=$(UI_FILTERS_4fcfg_web_bf)
+
+ALL_PACKAGES+=web_bf
+
diff --git a/filter/source/config/fragments/fcfg_writer.mk b/filter/source/config/fragments/fcfg_writer.mk
new file mode 100644
index 000000000000..220788049f79
--- /dev/null
+++ b/filter/source/config/fragments/fcfg_writer.mk
@@ -0,0 +1,106 @@
+all_fragments+=writer
+
+# -----------------------------------------------
+# count = 39
+T4_WRITER = \
+ writer_web_HTML \
+ writer_Lotus_1_2_3_10_DOS_StarWriter \
+ writer_Lotus_1_2_3_10_WIN_StarWriter \
+ calc_MS_Excel_40 \
+ calc_MS_Excel_5095 \
+ calc_MS_Excel_95 \
+ writer_MS_WinWord_5 \
+ writer_MS_WinWord_60 \
+ writer_MS_Word_95 \
+ writer_MS_Word_95_Vorlage \
+ writer_MS_Word_97 \
+ writer_MS_Word_97_Vorlage \
+ writer_Rich_Text_Format \
+ writer_StarOffice_XML_Writer \
+ writer_WordPerfect_Document \
+ writer_T602_Document \
+ writer_Text \
+ writer_Text_encoded \
+ writer_MIZI_Hwp_97 \
+ writer_StarOffice_XML_Writer_Template \
+ pdf_Portable_Document_Format\
+ writer8_template\
+ writer8 \
+ writer_MS_Word_2003_XML \
+ writer_MS_Word_2007_XML \
+ writer_MS_Word_2007_XML_Template
+
+# -----------------------------------------------
+# count = 39
+F4_WRITER = \
+ HTML__StarWriter_ \
+ Lotus_1_2_3_1_0__DOS___StarWriter_ \
+ Lotus_1_2_3_1_0__WIN___StarWriter_ \
+ MS_Excel_4_0__StarWriter_ \
+ MS_Excel_5_0__StarWriter_ \
+ MS_Excel_95__StarWriter_ \
+ MS_WinWord_5 \
+ MS_WinWord_6_0 \
+ MS_Word_95 \
+ MS_Word_95_Vorlage \
+ MS_Word_97 \
+ MS_Word_97_Vorlage \
+ Rich_Text_Format \
+ StarOffice_XML__Writer_ \
+ WordPerfect \
+ T602Document \
+ Text \
+ Text__encoded_ \
+ writer_MIZI_Hwp_97 \
+ writer_StarOffice_XML_Writer_Template \
+ writer_pdf_Export\
+ writer8\
+ writer8_template \
+ MS_Word_2003_XML \
+ MS_Word_2007_XML \
+ MS_Word_2007_XML_Template
+
+# -----------------------------------------------
+# count = 14
+F4_UI_WRITER = \
+ HTML__StarWriter__ui \
+ MS_Word_95_Vorlage_ui \
+ MS_Word_97_Vorlage_ui \
+ StarOffice_XML__Writer__ui \
+ Text_ui \
+ Text__encoded__ui \
+ writer_StarOffice_XML_Writer_Template_ui \
+ writer8_ui \
+ writer8_template_ui \
+ MS_Word_2003_XML_ui \
+ MS_Word_2007_XML_ui \
+ MS_Word_2007_XML_Template_ui
+
+# -----------------------------------------------
+# count = 0
+L4_WRITER =
+
+# -----------------------------------------------
+# count = 0
+C4_WRITER =
+
+# -----------------------------------------------
+TYPES_4fcfg_writer = $(foreach,i,$(T4_WRITER) types$/$i.xcu )
+FILTERS_4fcfg_writer = $(foreach,i,$(F4_WRITER) filters$/$i.xcu )
+UI_FILTERS_4fcfg_writer = $(foreach,i,$(F4_UI_WRITER) $(DIR_LOCFRAG)$/filters$/$i.xcu )
+FRAMELOADERS_4fcfg_writer = $(foreach,i,$(L4_WRITER) frameloaders$/$i.xcu )
+CONTENTHANDLERS_4fcfg_writer = $(foreach,i,$(C4_WRITER) contenthandlers$/$i.xcu )
+
+# -----------------------------------------------
+# needed to get dependencies inside global makefile work!
+ALL_4fcfg_writer = \
+ $(TYPES_4fcfg_writer) \
+ $(FILTERS_4fcfg_writer) \
+ $(UI_FILTERS_4fcfg_writer) \
+ $(FRAMELOADERS_4fcfg_writer) \
+ $(CONTENTHANDLERS_4fcfg_writer)
+
+ALL_UI_FILTERS+=$(UI_FILTERS_4fcfg_writer)
+
+ALL_PACKAGES+=writer
+
diff --git a/filter/source/config/fragments/fcfg_writer_bf.mk b/filter/source/config/fragments/fcfg_writer_bf.mk
new file mode 100644
index 000000000000..2e4c5b82b04e
--- /dev/null
+++ b/filter/source/config/fragments/fcfg_writer_bf.mk
@@ -0,0 +1,63 @@
+all_fragments+=writer_bf
+
+# -----------------------------------------------
+# count = 9
+T4_WRITER_BF = \
+ writer_StarWriter_10 \
+ writer_StarWriter_20 \
+ writer_StarWriter_30 \
+ writer_StarWriter_30_VorlageTemplate \
+ writer_StarWriter_40 \
+ writer_StarWriter_40_VorlageTemplate \
+ writer_StarWriter_50 \
+ writer_StarWriter_50_VorlageTemplate \
+ writer_StarWriter_DOS
+
+# -----------------------------------------------
+# count = 9
+F4_WRITER_BF = \
+ StarWriter_1_0 \
+ StarWriter_2_0 \
+ StarWriter_3_0 \
+ StarWriter_3_0_Vorlage_Template \
+ StarWriter_4_0 \
+ StarWriter_4_0_Vorlage_Template \
+ StarWriter_5_0 \
+ StarWriter_5_0_Vorlage_Template \
+ StarWriter_DOS
+
+# -----------------------------------------------
+# count = 3
+F4_UI_WRITER_BF = \
+ StarWriter_3_0_Vorlage_Template_ui \
+ StarWriter_4_0_Vorlage_Template_ui \
+ StarWriter_5_0_Vorlage_Template_ui \
+
+# -----------------------------------------------
+# count = 0
+L4_WRITER_BF =
+
+# -----------------------------------------------
+# count = 0
+C4_WRITER_BF =
+
+# -----------------------------------------------
+TYPES_4fcfg_writer_bf = $(foreach,i,$(T4_WRITER_BF) types$/$i.xcu )
+FILTERS_4fcfg_writer_bf = $(foreach,i,$(F4_WRITER_BF) filters$/$i.xcu )
+UI_FILTERS_4fcfg_writer_bf = $(foreach,i,$(F4_UI_WRITER_BF) $(DIR_LOCFRAG)$/filters$/$i.xcu )
+FRAMELOADERS_4fcfg_writer_bf = $(foreach,i,$(L4_WRITER_BF) frameloaders$/$i.xcu )
+CONTENTHANDLERS_4fcfg_writer_bf = $(foreach,i,$(C4_WRITER_BF) contenthandlers$/$i.xcu )
+
+# -----------------------------------------------
+# needed to get dependencies inside global makefile work!
+ALL_4fcfg_writer_bf = \
+ $(TYPES_4fcfg_writer_bf) \
+ $(FILTERS_4fcfg_writer_bf) \
+ $(UI_FILTERS_4fcfg_writer_bf) \
+ $(FRAMELOADERS_4fcfg_writer_bf) \
+ $(CONTENTHANDLERS_4fcfg_writer_bf)
+
+ALL_UI_FILTERS+=$(UI_FILTERS_4fcfg_writer_bf)
+
+ALL_PACKAGES+=writer_bf
+
diff --git a/filter/source/config/fragments/fcfg_xslt.mk b/filter/source/config/fragments/fcfg_xslt.mk
new file mode 100644
index 000000000000..852383aa760e
--- /dev/null
+++ b/filter/source/config/fragments/fcfg_xslt.mk
@@ -0,0 +1,55 @@
+all_fragments+=xslt
+
+# -----------------------------------------------
+# count = 5
+T4_XSLT = \
+ writer_DocBook_File \
+ XHTML_File \
+ Unified_Office_Format_text \
+ Unified_Office_Format_spreadsheet \
+ Unified_Office_Format_presentation
+
+# -----------------------------------------------
+# count = 8
+F4_XSLT = \
+ DocBook_File \
+ XHTML_Calc_File \
+ XHTML_Draw_File \
+ XHTML_Impress_File \
+ XHTML_Writer_File \
+ UOF_text \
+ UOF_spreadsheet \
+ UOF_presentation
+
+# -----------------------------------------------
+# count = 0
+F4_UI_XSLT =
+
+# -----------------------------------------------
+# count = 0
+L4_XSLT =
+
+# -----------------------------------------------
+# count = 0
+C4_XSLT =
+
+# -----------------------------------------------
+TYPES_4fcfg_xslt = $(foreach,i,$(T4_XSLT) types$/$i.xcu )
+FILTERS_4fcfg_xslt = $(foreach,i,$(F4_XSLT) filters$/$i.xcu )
+UI_FILTERS_4fcfg_xslt = $(foreach,i,$(F4_UI_XSLT) $(DIR_LOCFRAG)$/filters$/$i.xcu )
+FRAMELOADERS_4fcfg_xslt = $(foreach,i,$(L4_XSLT) frameloaders$/$i.xcu )
+CONTENTHANDLERS_4fcfg_xslt = $(foreach,i,$(C4_XSLT) contenthandlers$/$i.xcu )
+
+# -----------------------------------------------
+# needed to get dependencies inside global makefile work!
+ALL_4fcfg_xslt = \
+ $(TYPES_4fcfg_xslt) \
+ $(FILTERS_4fcfg_xslt) \
+ $(UI_FILTERS_4fcfg_xslt) \
+ $(FRAMELOADERS_4fcfg_xslt) \
+ $(CONTENTHANDLERS_4fcfg_xslt)
+
+ALL_UI_FILTERS+=$(UI_FILTERS_4fcfg_xslt)
+
+ALL_PACKAGES+=xslt
+
diff --git a/filter/source/config/fragments/filters/Ami_Pro_1_x_3_1__W4W_.xcu b/filter/source/config/fragments/filters/Ami_Pro_1_x_3_1__W4W_.xcu
new file mode 100644
index 000000000000..71c84d3fb7df
--- /dev/null
+++ b/filter/source/config/fragments/filters/Ami_Pro_1_x_3_1__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="Ami Pro 1.x-3.1 (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W33_0</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Ami Pro 1.x-3.1</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_Ami_Pro_1x_31_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/AportisDoc_Palm_DB.xcu b/filter/source/config/fragments/filters/AportisDoc_Palm_DB.xcu
new file mode 100644
index 000000000000..d3d65abc8f8b
--- /dev/null
+++ b/filter/source/config/fragments/filters/AportisDoc_Palm_DB.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="AportisDoc Palm DB" oor:op="replace">
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_AportisDoc_PalmDB_File</value></prop>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="UserData"><value>com.sun.star.documentconversion.XMergeBridge classes/aportisdoc.jar com.sun.star.comp.Writer.XMLImporter com.sun.star.comp.Writer.XMLExporter staroffice/sxw application/x-aportisdoc</value></prop>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.Writer.XmlFilterAdaptor</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="UIName">
+ <value>AportisDoc (Palm)</value>
+ </prop>
+ <prop oor:name="Flags"><value>IMPORT EXPORT ALIEN 3RDPARTYFILTER</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/BMP___MS_Windows.xcu b/filter/source/config/fragments/filters/BMP___MS_Windows.xcu
new file mode 100644
index 000000000000..911d2841351a
--- /dev/null
+++ b/filter/source/config/fragments/filters/BMP___MS_Windows.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="BMP - MS Windows" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">BMP - Windows Bitmap</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>bmp_MS_Windows</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/CGM___Computer_Graphics_Metafile.xcu b/filter/source/config/fragments/filters/CGM___Computer_Graphics_Metafile.xcu
new file mode 100644
index 000000000000..652821c72247
--- /dev/null
+++ b/filter/source/config/fragments/filters/CGM___Computer_Graphics_Metafile.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="CGM - Computer Graphics Metafile" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value>icg</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">CGM - Computer Graphics Metafile</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>impress_CGM_Computer_Graphics_Metafile</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.presentation.PresentationDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/CTOS_DEF__W4W_.xcu b/filter/source/config/fragments/filters/CTOS_DEF__W4W_.xcu
new file mode 100644
index 000000000000..7eac49b885c4
--- /dev/null
+++ b/filter/source/config/fragments/filters/CTOS_DEF__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="CTOS DEF (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W36_0</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">CTOS DEF</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_CTOS_DEF_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/Claris_Works__W4W_.xcu b/filter/source/config/fragments/filters/Claris_Works__W4W_.xcu
new file mode 100644
index 000000000000..491b57de36ed
--- /dev/null
+++ b/filter/source/config/fragments/filters/Claris_Works__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="Claris Works (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W57_0</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Claris Works</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_Claris_Works_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/DCA_FFT_Final_Form_Text__W4W_.xcu b/filter/source/config/fragments/filters/DCA_FFT_Final_Form_Text__W4W_.xcu
new file mode 100644
index 000000000000..510d30fbbbe2
--- /dev/null
+++ b/filter/source/config/fragments/filters/DCA_FFT_Final_Form_Text__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="DCA/FFT-Final Form Text (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W32_0</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">DCA/FFT-Final Form Text</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_DCAFFT_Final_Form_Text_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/DCA_Revisable_Form_Text__W4W_.xcu b/filter/source/config/fragments/filters/DCA_Revisable_Form_Text__W4W_.xcu
new file mode 100644
index 000000000000..e22a5b7b0a91
--- /dev/null
+++ b/filter/source/config/fragments/filters/DCA_Revisable_Form_Text__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="DCA Revisable Form Text (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W15_0</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">DCA Revisable Form Text</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_DCA_Revisable_Form_Text_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/DCA_with_Display_Write_5__W4W_.xcu b/filter/source/config/fragments/filters/DCA_with_Display_Write_5__W4W_.xcu
new file mode 100644
index 000000000000..ce3bcb947a27
--- /dev/null
+++ b/filter/source/config/fragments/filters/DCA_with_Display_Write_5__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="DCA with Display Write 5 (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W15_1</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">DCA with Display Write 5</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_DCA_with_Display_Write_5_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/DEC_DX__W4W_.xcu b/filter/source/config/fragments/filters/DEC_DX__W4W_.xcu
new file mode 100644
index 000000000000..26a4f367b525
--- /dev/null
+++ b/filter/source/config/fragments/filters/DEC_DX__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="DEC DX (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W30_0</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">DEC DX</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_DEC_DX_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/DEC_WPS_PLUS__W4W_.xcu b/filter/source/config/fragments/filters/DEC_WPS_PLUS__W4W_.xcu
new file mode 100644
index 000000000000..b91cd6f8894d
--- /dev/null
+++ b/filter/source/config/fragments/filters/DEC_WPS_PLUS__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="DEC WPS-PLUS (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W45_0</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">DEC WPS-PLUS</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_DEC_WPS_PLUS_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/DIF.xcu b/filter/source/config/fragments/filters/DIF.xcu
new file mode 100644
index 000000000000..c331ba028e13
--- /dev/null
+++ b/filter/source/config/fragments/filters/DIF.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="DIF" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT ALIEN USESOPTIONS</value></prop>
+ <prop oor:name="UIComponent"><value>com.sun.star.comp.Calc.FilterOptionsDialog</value></prop>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Data Interchange Format</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>calc_DIF</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.sheet.SpreadsheetDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/DXF___AutoCAD_Interchange.xcu b/filter/source/config/fragments/filters/DXF___AutoCAD_Interchange.xcu
new file mode 100644
index 000000000000..699622528196
--- /dev/null
+++ b/filter/source/config/fragments/filters/DXF___AutoCAD_Interchange.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="DXF - AutoCAD Interchange" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">DXF - AutoCAD Interchange Format</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>dxf_AutoCAD_Interchange</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/DataGeneral_CEO_Write__W4W_.xcu b/filter/source/config/fragments/filters/DataGeneral_CEO_Write__W4W_.xcu
new file mode 100644
index 000000000000..dc04e0ea1e97
--- /dev/null
+++ b/filter/source/config/fragments/filters/DataGeneral_CEO_Write__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="DataGeneral CEO Write (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W104_0</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">DataGeneral CEO Write</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_DataGeneral_CEO_Write_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/DisplayWrite_2_0_4_x__W4W_.xcu b/filter/source/config/fragments/filters/DisplayWrite_2_0_4_x__W4W_.xcu
new file mode 100644
index 000000000000..61e8dd2bcbf1
--- /dev/null
+++ b/filter/source/config/fragments/filters/DisplayWrite_2_0_4_x__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="DisplayWrite 2.0-4.x (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W15_2</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">DisplayWrite 2.0-4.x</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_DisplayWrite_20_4x_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/DisplayWrite_5_x__W4W_.xcu b/filter/source/config/fragments/filters/DisplayWrite_5_x__W4W_.xcu
new file mode 100644
index 000000000000..098c463d111c
--- /dev/null
+++ b/filter/source/config/fragments/filters/DisplayWrite_5_x__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="DisplayWrite 5.x (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W15_3</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">DisplayWrite 5.x</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_DisplayWrite_5x_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/DocBook_File.xcu b/filter/source/config/fragments/filters/DocBook_File.xcu
new file mode 100644
index 000000000000..07eb48046acb
--- /dev/null
+++ b/filter/source/config/fragments/filters/DocBook_File.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="DocBook File" oor:op="replace">
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_DocBook_File</value></prop>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="UserData"><value oor:separator=",">com.sun.star.documentconversion.XSLTFilter,,com.sun.star.comp.Writer.XMLImporter,com.sun.star.comp.Writer.XMLExporter,../share/xslt/docbook/docbooktosoffheadings.xsl,../share/xslt/docbook/sofftodocbookheadings.xsl</value></prop>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.Writer.XmlFilterAdaptor</value></prop>
+ <prop oor:name="TemplateName"><value>../share/xslt/docbook/DocBookTemplate.stw</value></prop>
+ <prop oor:name="UIName">
+ <value>DocBook</value>
+ </prop>
+ <prop oor:name="Flags"><value>IMPORT EXPORT ALIEN 3RDPARTYFILTER</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/EBCDIC__W4W_.xcu b/filter/source/config/fragments/filters/EBCDIC__W4W_.xcu
new file mode 100644
index 000000000000..0922f3162273
--- /dev/null
+++ b/filter/source/config/fragments/filters/EBCDIC__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="EBCDIC (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W02_0</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">EBCDIC</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_EBCDIC_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/EMF___MS_Windows_Metafile.xcu b/filter/source/config/fragments/filters/EMF___MS_Windows_Metafile.xcu
new file mode 100644
index 000000000000..3420e53180e9
--- /dev/null
+++ b/filter/source/config/fragments/filters/EMF___MS_Windows_Metafile.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="EMF - MS Windows Metafile" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">EMF - Enhanced Metafile</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>emf_MS_Windows_Metafile</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/EPS___Encapsulated_PostScript.xcu b/filter/source/config/fragments/filters/EPS___Encapsulated_PostScript.xcu
new file mode 100644
index 000000000000..d73045dacc2d
--- /dev/null
+++ b/filter/source/config/fragments/filters/EPS___Encapsulated_PostScript.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="EPS - Encapsulated PostScript" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">EPS - Encapsulated PostScript</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>eps_Encapsulated_PostScript</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/Enable__W4W_.xcu b/filter/source/config/fragments/filters/Enable__W4W_.xcu
new file mode 100644
index 000000000000..7ee528fc3f2f
--- /dev/null
+++ b/filter/source/config/fragments/filters/Enable__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="Enable (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W28_0</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Enable</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_Enable_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/Frame_Maker_MIF_3_0__W4W_.xcu b/filter/source/config/fragments/filters/Frame_Maker_MIF_3_0__W4W_.xcu
new file mode 100644
index 000000000000..1b49abb99539
--- /dev/null
+++ b/filter/source/config/fragments/filters/Frame_Maker_MIF_3_0__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="Frame Maker MIF 3.0 (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W42_0</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Frame Maker MIF 3.0</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_Frame_Maker_MIF_30_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/Frame_Maker_MIF_4_0__W4W_.xcu b/filter/source/config/fragments/filters/Frame_Maker_MIF_4_0__W4W_.xcu
new file mode 100644
index 000000000000..ea2a52f3fbdd
--- /dev/null
+++ b/filter/source/config/fragments/filters/Frame_Maker_MIF_4_0__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="Frame Maker MIF 4.0 (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W42_1</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Frame Maker MIF 4.0</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_Frame_Maker_MIF_40_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/Frame_Maker_MIF_5_0__W4W_.xcu b/filter/source/config/fragments/filters/Frame_Maker_MIF_5_0__W4W_.xcu
new file mode 100644
index 000000000000..fd6da2b5a998
--- /dev/null
+++ b/filter/source/config/fragments/filters/Frame_Maker_MIF_5_0__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="Frame Maker MIF 5.0 (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W42_2</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Frame Maker MIF 5.0</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_Frame_Maker_MIF_50_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/Frame_Work_III__W4W_.xcu b/filter/source/config/fragments/filters/Frame_Work_III__W4W_.xcu
new file mode 100644
index 000000000000..fec82004b7d4
--- /dev/null
+++ b/filter/source/config/fragments/filters/Frame_Work_III__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="Frame Work III (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W29_0</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Frame Work III</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_Frame_Work_III_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/Frame_Work_IV___W4W_.xcu b/filter/source/config/fragments/filters/Frame_Work_IV___W4W_.xcu
new file mode 100644
index 000000000000..b5338bd3be00
--- /dev/null
+++ b/filter/source/config/fragments/filters/Frame_Work_IV___W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="Frame Work IV (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W29_1</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Frame Work IV</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_Frame_Work_IV_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/GIF___Graphics_Interchange.xcu b/filter/source/config/fragments/filters/GIF___Graphics_Interchange.xcu
new file mode 100644
index 000000000000..b0db0e0b7298
--- /dev/null
+++ b/filter/source/config/fragments/filters/GIF___Graphics_Interchange.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="GIF - Graphics Interchange" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">GIF - Graphics Interchange Format</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>gif_Graphics_Interchange</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/HP_AdvanceWrite_Plus__W4W_.xcu b/filter/source/config/fragments/filters/HP_AdvanceWrite_Plus__W4W_.xcu
new file mode 100644
index 000000000000..eab8b2773e45
--- /dev/null
+++ b/filter/source/config/fragments/filters/HP_AdvanceWrite_Plus__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="HP AdvanceWrite Plus (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W22_0</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">HP AdvanceWrite Plus</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_HP_AdvanceWrite_Plus_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/HTML.xcu b/filter/source/config/fragments/filters/HTML.xcu
new file mode 100644
index 000000000000..853b32d112ec
--- /dev/null
+++ b/filter/source/config/fragments/filters/HTML.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="HTML" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT ASYNCHRON PREFERRED</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value>HTML</value></prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_web_HTML</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.WebDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/HTML_MasterDoc.xcu b/filter/source/config/fragments/filters/HTML_MasterDoc.xcu
new file mode 100644
index 000000000000..ff18e7c46068
--- /dev/null
+++ b/filter/source/config/fragments/filters/HTML_MasterDoc.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="HTML_MasterDoc" oor:op="replace">
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_web_HTML</value></prop>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.GlobalDocument</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="UserData"><value>HTML</value></prop>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">HTML Document (%productname% Master Document)</value>
+ </prop>
+ <prop oor:name="Flags"><value>EXPORT INTERNAL NOTINFILEDIALOG NOTINCHOOSER</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/HTML_MasterDoc_ui.xcu b/filter/source/config/fragments/filters/HTML_MasterDoc_ui.xcu
new file mode 100644
index 000000000000..ce18cbf07c81
--- /dev/null
+++ b/filter/source/config/fragments/filters/HTML_MasterDoc_ui.xcu
@@ -0,0 +1,5 @@
+ <node oor:name="HTML_MasterDoc">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">HTML Document (%productname% Master Document)</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/HTML__StarCalc_.xcu b/filter/source/config/fragments/filters/HTML__StarCalc_.xcu
new file mode 100644
index 000000000000..01d88c818c09
--- /dev/null
+++ b/filter/source/config/fragments/filters/HTML__StarCalc_.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="HTML (StarCalc)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT ALIEN USEOPTIONS</value></prop>
+ <prop oor:name="UIComponent"><value>com.sun.star.comp.Calc.FilterOptionsDialog</value></prop>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_web_HTML</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.sheet.SpreadsheetDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/HTML__StarCalc__ui.xcu b/filter/source/config/fragments/filters/HTML__StarCalc__ui.xcu
new file mode 100644
index 000000000000..ec66d294cec1
--- /dev/null
+++ b/filter/source/config/fragments/filters/HTML__StarCalc__ui.xcu
@@ -0,0 +1,6 @@
+ <node oor:name="HTML (StarCalc)">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">HTML Document (%productname% Calc)</value>
+ <value xml:lang="x-translate">HTML Document (%productname% Calc)</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/HTML__StarWriter_.xcu b/filter/source/config/fragments/filters/HTML__StarWriter_.xcu
new file mode 100644
index 000000000000..285fb7d3e3f5
--- /dev/null
+++ b/filter/source/config/fragments/filters/HTML__StarWriter_.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="HTML (StarWriter)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT ALIEN ASYNCHRON</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value>HTML</value></prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_web_HTML</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/HTML__StarWriter__ui.xcu b/filter/source/config/fragments/filters/HTML__StarWriter__ui.xcu
new file mode 100644
index 000000000000..954ad6185586
--- /dev/null
+++ b/filter/source/config/fragments/filters/HTML__StarWriter__ui.xcu
@@ -0,0 +1,6 @@
+ <node oor:name="HTML (StarWriter)">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">HTML Document (%productname% Writer)</value>
+ <value xml:lang="x-translate">HTML Document (%productname% Writer)</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/HTML_ui.xcu b/filter/source/config/fragments/filters/HTML_ui.xcu
new file mode 100644
index 000000000000..2549c90d0676
--- /dev/null
+++ b/filter/source/config/fragments/filters/HTML_ui.xcu
@@ -0,0 +1,6 @@
+ <node oor:name="HTML">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">HTML Document</value>
+ <value xml:lang="x-translate">HTML Document</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/ICL_Office_Power_6__W4W_.xcu b/filter/source/config/fragments/filters/ICL_Office_Power_6__W4W_.xcu
new file mode 100644
index 000000000000..9e4837530df9
--- /dev/null
+++ b/filter/source/config/fragments/filters/ICL_Office_Power_6__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="ICL Office Power 6 (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W102_0</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">ICL Office Power 6</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_ICL_Office_Power_6_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/ICL_Office_Power_7__W4W_.xcu b/filter/source/config/fragments/filters/ICL_Office_Power_7__W4W_.xcu
new file mode 100644
index 000000000000..2f985fee39b3
--- /dev/null
+++ b/filter/source/config/fragments/filters/ICL_Office_Power_7__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="ICL Office Power 7 (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W102_1</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">ICL Office Power 7</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_ICL_Office_Power_7_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/Interleaf_5___6__W4W_.xcu b/filter/source/config/fragments/filters/Interleaf_5___6__W4W_.xcu
new file mode 100644
index 000000000000..b90e6644783d
--- /dev/null
+++ b/filter/source/config/fragments/filters/Interleaf_5___6__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="Interleaf 5 - 6 (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W46_0</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Interleaf 5 - 6</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_Interleaf_5_6_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/Interleaf__W4W_.xcu b/filter/source/config/fragments/filters/Interleaf__W4W_.xcu
new file mode 100644
index 000000000000..b9f89273e5b0
--- /dev/null
+++ b/filter/source/config/fragments/filters/Interleaf__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="Interleaf (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W35_0</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Interleaf</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_Interleaf_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/JPG___JPEG.xcu b/filter/source/config/fragments/filters/JPG___JPEG.xcu
new file mode 100644
index 000000000000..cefaa6416ec8
--- /dev/null
+++ b/filter/source/config/fragments/filters/JPG___JPEG.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="JPG - JPEG" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">JPEG - Joint Photographic Experts Group</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>jpg_JPEG</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/Legacy_Winstar_onGO__W4W_.xcu b/filter/source/config/fragments/filters/Legacy_Winstar_onGO__W4W_.xcu
new file mode 100644
index 000000000000..4e4756f8507f
--- /dev/null
+++ b/filter/source/config/fragments/filters/Legacy_Winstar_onGO__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="Legacy Winstar onGO (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W37_0</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Legacy Winstar onGO</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_Legacy_Winstar_onGO_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/Lotus.xcu b/filter/source/config/fragments/filters/Lotus.xcu
new file mode 100644
index 000000000000..cff013910f8c
--- /dev/null
+++ b/filter/source/config/fragments/filters/Lotus.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="Lotus" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN USESOPTIONS PREFERRED</value></prop>
+ <prop oor:name="UIComponent"><value>com.sun.star.comp.Calc.FilterOptionsDialog</value></prop>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Lotus 1-2-3</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>calc_Lotus</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.sheet.SpreadsheetDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/Lotus_1_2_3_1_0__DOS___StarWriter_.xcu b/filter/source/config/fragments/filters/Lotus_1_2_3_1_0__DOS___StarWriter_.xcu
new file mode 100644
index 000000000000..e8c57c254a4c
--- /dev/null
+++ b/filter/source/config/fragments/filters/Lotus_1_2_3_1_0__DOS___StarWriter_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="Lotus 1-2-3 1.0 (DOS) (StarWriter)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN NOTINFILEDIALOG NOTINCHOOSER 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>LOTUSD</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Lotus 1-2-3 1.0 DOS (%productname% Writer)</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_Lotus_1_2_3_10_DOS_StarWriter</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/Lotus_1_2_3_1_0__WIN___StarWriter_.xcu b/filter/source/config/fragments/filters/Lotus_1_2_3_1_0__WIN___StarWriter_.xcu
new file mode 100644
index 000000000000..2e1a47f961f8
--- /dev/null
+++ b/filter/source/config/fragments/filters/Lotus_1_2_3_1_0__WIN___StarWriter_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="Lotus 1-2-3 1.0 (WIN) (StarWriter)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN NOTINFILEDIALOG NOTINCHOOSER 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>LOTUSW</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Lotus 1-2-3 1.0 WIN (%productname% Writer)</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_Lotus_1_2_3_10_WIN_StarWriter</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/Lotus_Manuscript__W4W_.xcu b/filter/source/config/fragments/filters/Lotus_Manuscript__W4W_.xcu
new file mode 100644
index 000000000000..e2201269e6b6
--- /dev/null
+++ b/filter/source/config/fragments/filters/Lotus_Manuscript__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="Lotus Manuscript (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W24_0</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Lotus Manuscript</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_Lotus_Manuscript_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/MASS_11_Rel__8_0_8_3__W4W_.xcu b/filter/source/config/fragments/filters/MASS_11_Rel__8_0_8_3__W4W_.xcu
new file mode 100644
index 000000000000..d7d490e45780
--- /dev/null
+++ b/filter/source/config/fragments/filters/MASS_11_Rel__8_0_8_3__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="MASS 11 Rel. 8.0-8.3 (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W31_0</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">MASS 11 Rel. 8.0-8.3</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_MASS_11_Rel_80_83_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/MASS_11_Rel__8_5_9_0__W4W_.xcu b/filter/source/config/fragments/filters/MASS_11_Rel__8_5_9_0__W4W_.xcu
new file mode 100644
index 000000000000..ba1924b3e4cc
--- /dev/null
+++ b/filter/source/config/fragments/filters/MASS_11_Rel__8_5_9_0__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="MASS 11 Rel. 8.5-9.0 (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W31_1</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">MASS 11 Rel. 8.5-9.0</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_MASS_11_Rel_85_90_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/MET___OS_2_Metafile.xcu b/filter/source/config/fragments/filters/MET___OS_2_Metafile.xcu
new file mode 100644
index 000000000000..f37c131e7837
--- /dev/null
+++ b/filter/source/config/fragments/filters/MET___OS_2_Metafile.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="MET - OS/2 Metafile" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">MET - OS/2 Metafile</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>met_OS2_Metafile</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/MS_Excel_2003_XML.xcu b/filter/source/config/fragments/filters/MS_Excel_2003_XML.xcu
new file mode 100644
index 000000000000..d0d2b13e5584
--- /dev/null
+++ b/filter/source/config/fragments/filters/MS_Excel_2003_XML.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="MS Excel 2003 XML" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.Writer.XmlFilterAdaptor</value></prop>
+ <prop oor:name="UserData"><value oor:separator=",">com.sun.star.documentconversion.XSLTFilter,,com.sun.star.comp.Calc.XMLOasisImporter,com.sun.star.comp.Calc.XMLOasisExporter,../share/xslt/import/spreadsheetml/spreadsheetml2ooo.xsl,../share/xslt/export/spreadsheetml/ooo2spreadsheetml.xsl</value></prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>calc_MS_Excel_2003_XML</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.sheet.SpreadsheetDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/MS_Excel_2003_XML_ui.xcu b/filter/source/config/fragments/filters/MS_Excel_2003_XML_ui.xcu
new file mode 100644
index 000000000000..b6c743fc1b84
--- /dev/null
+++ b/filter/source/config/fragments/filters/MS_Excel_2003_XML_ui.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="MS Excel 2003 XML">
+ <prop oor:name="UIName">
+ <value xml:lang="el">Microsoft Excel 2003 XML</value>
+ <value xml:lang="en-US">Microsoft Excel 2003 XML</value>
+ <value xml:lang="hu">Microsoft Excel 2003 XML</value>
+ <value xml:lang="cs">Microsoft Excel 2003 XML</value>
+ <value xml:lang="sk">Microsoft Excel 2003 XML</value>
+ <value xml:lang="sl">Microsoft Excel 2003 XML</value>
+ <value xml:lang="nl">Microsoft Excel 2003 XML</value>
+ <value xml:lang="da">Microsoft Excel 2003 XML</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/MS_Excel_4_0.xcu b/filter/source/config/fragments/filters/MS_Excel_4_0.xcu
new file mode 100644
index 000000000000..f0c5bd97fd16
--- /dev/null
+++ b/filter/source/config/fragments/filters/MS_Excel_4_0.xcu
@@ -0,0 +1,13 @@
+<node oor:name="MS Excel 4.0" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN PREFERRED</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"/>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Microsoft Excel 4.0</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>calc_MS_Excel_40</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.sheet.SpreadsheetDocument</value></prop>
+</node>
diff --git a/filter/source/config/fragments/filters/MS_Excel_4_0_Vorlage_Template.xcu b/filter/source/config/fragments/filters/MS_Excel_4_0_Vorlage_Template.xcu
new file mode 100644
index 000000000000..5366f1282ece
--- /dev/null
+++ b/filter/source/config/fragments/filters/MS_Excel_4_0_Vorlage_Template.xcu
@@ -0,0 +1,10 @@
+<node oor:name="MS Excel 4.0 Vorlage/Template" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN TEMPLATE TEMPLATEPATH</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"/>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>calc_MS_Excel_40_VorlageTemplate</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.sheet.SpreadsheetDocument</value></prop>
+</node>
diff --git a/filter/source/config/fragments/filters/MS_Excel_4_0_Vorlage_Template_ui.xcu b/filter/source/config/fragments/filters/MS_Excel_4_0_Vorlage_Template_ui.xcu
new file mode 100644
index 000000000000..c68e1e33ac8a
--- /dev/null
+++ b/filter/source/config/fragments/filters/MS_Excel_4_0_Vorlage_Template_ui.xcu
@@ -0,0 +1,6 @@
+ <node oor:name="MS Excel 4.0 Vorlage/Template">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">Microsoft Excel 4.0 Template</value>
+ <value xml:lang="x-translate">Microsoft Excel 4.0 Template</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/MS_Excel_4_0__StarWriter_.xcu b/filter/source/config/fragments/filters/MS_Excel_4_0__StarWriter_.xcu
new file mode 100644
index 000000000000..611e4a30898b
--- /dev/null
+++ b/filter/source/config/fragments/filters/MS_Excel_4_0__StarWriter_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="MS Excel 4.0 (StarWriter)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN NOTINFILEDIALOG NOTINCHOOSER 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>EXCEL</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Microsoft Excel 4.0 (%productname% Writer)</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>calc_MS_Excel_40</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/MS_Excel_5_0_95.xcu b/filter/source/config/fragments/filters/MS_Excel_5_0_95.xcu
new file mode 100644
index 000000000000..21c8a0c2d67f
--- /dev/null
+++ b/filter/source/config/fragments/filters/MS_Excel_5_0_95.xcu
@@ -0,0 +1,13 @@
+<node oor:name="MS Excel 5.0/95" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT ALIEN PREFERRED</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"/>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Microsoft Excel 5.0</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>calc_MS_Excel_5095</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.sheet.SpreadsheetDocument</value></prop>
+</node>
diff --git a/filter/source/config/fragments/filters/MS_Excel_5_0_95_Vorlage_Template.xcu b/filter/source/config/fragments/filters/MS_Excel_5_0_95_Vorlage_Template.xcu
new file mode 100644
index 000000000000..1fef8ef27461
--- /dev/null
+++ b/filter/source/config/fragments/filters/MS_Excel_5_0_95_Vorlage_Template.xcu
@@ -0,0 +1,10 @@
+<node oor:name="MS Excel 5.0/95 Vorlage/Template" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT ALIEN TEMPLATE TEMPLATEPATH</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"/>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>calc_MS_Excel_5095_VorlageTemplate</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.sheet.SpreadsheetDocument</value></prop>
+</node>
diff --git a/filter/source/config/fragments/filters/MS_Excel_5_0_95_Vorlage_Template_ui.xcu b/filter/source/config/fragments/filters/MS_Excel_5_0_95_Vorlage_Template_ui.xcu
new file mode 100644
index 000000000000..d50a4aa4d941
--- /dev/null
+++ b/filter/source/config/fragments/filters/MS_Excel_5_0_95_Vorlage_Template_ui.xcu
@@ -0,0 +1,6 @@
+ <node oor:name="MS Excel 5.0/95 Vorlage/Template">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">Microsoft Excel 5.0 Template</value>
+ <value xml:lang="x-translate">Microsoft Excel 5.0 Template</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/MS_Excel_5_0__StarWriter_.xcu b/filter/source/config/fragments/filters/MS_Excel_5_0__StarWriter_.xcu
new file mode 100644
index 000000000000..e1fe503830cf
--- /dev/null
+++ b/filter/source/config/fragments/filters/MS_Excel_5_0__StarWriter_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="MS Excel 5.0 (StarWriter)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN NOTINFILEDIALOG NOTINCHOOSER 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>CEXCEL</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Microsoft Excel 5.0 (%productname% Writer)</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>calc_MS_Excel_5095</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/MS_Excel_95.xcu b/filter/source/config/fragments/filters/MS_Excel_95.xcu
new file mode 100644
index 000000000000..1fa61477f073
--- /dev/null
+++ b/filter/source/config/fragments/filters/MS_Excel_95.xcu
@@ -0,0 +1,13 @@
+<node oor:name="MS Excel 95" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT ALIEN PREFERRED</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"/>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Microsoft Excel 95</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>calc_MS_Excel_95</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.sheet.SpreadsheetDocument</value></prop>
+</node>
diff --git a/filter/source/config/fragments/filters/MS_Excel_95_Vorlage_Template.xcu b/filter/source/config/fragments/filters/MS_Excel_95_Vorlage_Template.xcu
new file mode 100644
index 000000000000..b14d6619be0d
--- /dev/null
+++ b/filter/source/config/fragments/filters/MS_Excel_95_Vorlage_Template.xcu
@@ -0,0 +1,10 @@
+<node oor:name="MS Excel 95 Vorlage/Template" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT ALIEN TEMPLATE TEMPLATEPATH</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"/>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>calc_MS_Excel_95_VorlageTemplate</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.sheet.SpreadsheetDocument</value></prop>
+</node>
diff --git a/filter/source/config/fragments/filters/MS_Excel_95_Vorlage_Template_ui.xcu b/filter/source/config/fragments/filters/MS_Excel_95_Vorlage_Template_ui.xcu
new file mode 100644
index 000000000000..eb44244a400f
--- /dev/null
+++ b/filter/source/config/fragments/filters/MS_Excel_95_Vorlage_Template_ui.xcu
@@ -0,0 +1,6 @@
+ <node oor:name="MS Excel 95 Vorlage/Template">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">Microsoft Excel 95 Template</value>
+ <value xml:lang="x-translate">Microsoft Excel 95 Template</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/MS_Excel_95__StarWriter_.xcu b/filter/source/config/fragments/filters/MS_Excel_95__StarWriter_.xcu
new file mode 100644
index 000000000000..35c56ccb0d93
--- /dev/null
+++ b/filter/source/config/fragments/filters/MS_Excel_95__StarWriter_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="MS Excel 95 (StarWriter)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN NOTINFILEDIALOG NOTINCHOOSER 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>CEXCEL</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Microsoft Excel 95 (%productname% Writer)</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>calc_MS_Excel_95</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/MS_Excel_97.xcu b/filter/source/config/fragments/filters/MS_Excel_97.xcu
new file mode 100644
index 000000000000..1baa4341d90d
--- /dev/null
+++ b/filter/source/config/fragments/filters/MS_Excel_97.xcu
@@ -0,0 +1,13 @@
+<node oor:name="MS Excel 97" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT ALIEN PREFERRED ENCRYPTION PASSWORDTOMODIFY</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"/>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Microsoft Excel 97/2000/XP</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>calc_MS_Excel_97</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.sheet.SpreadsheetDocument</value></prop>
+</node>
diff --git a/filter/source/config/fragments/filters/MS_Excel_97_Vorlage_Template.xcu b/filter/source/config/fragments/filters/MS_Excel_97_Vorlage_Template.xcu
new file mode 100644
index 000000000000..42c997f967f9
--- /dev/null
+++ b/filter/source/config/fragments/filters/MS_Excel_97_Vorlage_Template.xcu
@@ -0,0 +1,10 @@
+<node oor:name="MS Excel 97 Vorlage/Template" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT ALIEN TEMPLATE TEMPLATEPATH ENCRYPTION PASSWORDTOMODIFY</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"/>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>calc_MS_Excel_97_VorlageTemplate</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.sheet.SpreadsheetDocument</value></prop>
+</node>
diff --git a/filter/source/config/fragments/filters/MS_Excel_97_Vorlage_Template_ui.xcu b/filter/source/config/fragments/filters/MS_Excel_97_Vorlage_Template_ui.xcu
new file mode 100644
index 000000000000..3916c4e68b59
--- /dev/null
+++ b/filter/source/config/fragments/filters/MS_Excel_97_Vorlage_Template_ui.xcu
@@ -0,0 +1,6 @@
+ <node oor:name="MS Excel 97 Vorlage/Template">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">Microsoft Excel 97/2000/XP Template</value>
+ <value xml:lang="x-translate">Microsoft Excel 97/2000/XP Template</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/MS_MacWord_3_0__W4W_.xcu b/filter/source/config/fragments/filters/MS_MacWord_3_0__W4W_.xcu
new file mode 100644
index 000000000000..679289dd571b
--- /dev/null
+++ b/filter/source/config/fragments/filters/MS_MacWord_3_0__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="MS MacWord 3.0 (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W54_0</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Microsoft MacWord 3.0</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_MS_MacWord_30_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/MS_MacWord_4_0__W4W_.xcu b/filter/source/config/fragments/filters/MS_MacWord_4_0__W4W_.xcu
new file mode 100644
index 000000000000..ec8117695038
--- /dev/null
+++ b/filter/source/config/fragments/filters/MS_MacWord_4_0__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="MS MacWord 4.0 (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W54_1</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Microsoft MacWord 4.0</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_MS_MacWord_40_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/MS_MacWord_5_x__W4W_.xcu b/filter/source/config/fragments/filters/MS_MacWord_5_x__W4W_.xcu
new file mode 100644
index 000000000000..bcef70090790
--- /dev/null
+++ b/filter/source/config/fragments/filters/MS_MacWord_5_x__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="MS MacWord 5.x (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W54_2</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Microsoft MacWord 5.x</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_MS_MacWord_5x_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/MS_PowerPoint_97.xcu b/filter/source/config/fragments/filters/MS_PowerPoint_97.xcu
new file mode 100644
index 000000000000..7c61f7c14084
--- /dev/null
+++ b/filter/source/config/fragments/filters/MS_PowerPoint_97.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="MS PowerPoint 97" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT ALIEN ENCRYPTION PASSWORDTOMODIFY</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value>sdfilt</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Microsoft PowerPoint 97/2000/XP</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>impress_MS_PowerPoint_97</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.presentation.PresentationDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/MS_PowerPoint_97_Vorlage.xcu b/filter/source/config/fragments/filters/MS_PowerPoint_97_Vorlage.xcu
new file mode 100644
index 000000000000..505084d4d39f
--- /dev/null
+++ b/filter/source/config/fragments/filters/MS_PowerPoint_97_Vorlage.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="MS PowerPoint 97 Vorlage" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT TEMPLATE TEMPLATEPATH ALIEN ENCRYPTION PASSWORDTOMODIFY</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value>sdfilt</value></prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>impress_MS_PowerPoint_97_Vorlage</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.presentation.PresentationDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/MS_PowerPoint_97_Vorlage_ui.xcu b/filter/source/config/fragments/filters/MS_PowerPoint_97_Vorlage_ui.xcu
new file mode 100644
index 000000000000..c9b728448f09
--- /dev/null
+++ b/filter/source/config/fragments/filters/MS_PowerPoint_97_Vorlage_ui.xcu
@@ -0,0 +1,6 @@
+ <node oor:name="MS PowerPoint 97 Vorlage">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">Microsoft PowerPoint 97/2000/XP Template</value>
+ <value xml:lang="x-translate">Microsoft PowerPoint 97/2000/XP Template</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/MS_WinWord_1_x__W4W_.xcu b/filter/source/config/fragments/filters/MS_WinWord_1_x__W4W_.xcu
new file mode 100644
index 000000000000..65a88b830d04
--- /dev/null
+++ b/filter/source/config/fragments/filters/MS_WinWord_1_x__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="MS WinWord 1.x (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W44_0</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Microsoft WinWord 1.x</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_MS_WinWord_1x_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/MS_WinWord_2_x__W4W_.xcu b/filter/source/config/fragments/filters/MS_WinWord_2_x__W4W_.xcu
new file mode 100644
index 000000000000..2f6381d80b54
--- /dev/null
+++ b/filter/source/config/fragments/filters/MS_WinWord_2_x__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="MS WinWord 2.x (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W44_1</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Microsoft WinWord 2.x</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_MS_WinWord_2x_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/MS_WinWord_5.xcu b/filter/source/config/fragments/filters/MS_WinWord_5.xcu
new file mode 100644
index 000000000000..4f0c51b95fd2
--- /dev/null
+++ b/filter/source/config/fragments/filters/MS_WinWord_5.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="MS WinWord 5" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value>WW6</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Microsoft WinWord 5</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_MS_WinWord_5</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/MS_WinWord_6_0.xcu b/filter/source/config/fragments/filters/MS_WinWord_6_0.xcu
new file mode 100644
index 000000000000..6c0b17451f0a
--- /dev/null
+++ b/filter/source/config/fragments/filters/MS_WinWord_6_0.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="MS WinWord 6.0" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT ALIEN</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value>CWW6</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Microsoft Word 6.0</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_MS_WinWord_60</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/MS_Word_2003_XML.xcu b/filter/source/config/fragments/filters/MS_Word_2003_XML.xcu
new file mode 100644
index 000000000000..c953598dd67d
--- /dev/null
+++ b/filter/source/config/fragments/filters/MS_Word_2003_XML.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="MS Word 2003 XML" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.Writer.XmlFilterAdaptor</value></prop>
+ <prop oor:name="UserData"><value oor:separator=",">com.sun.star.documentconversion.XSLTFilter,,com.sun.star.comp.Writer.XMLOasisImporter,com.sun.star.comp.Writer.XMLOasisExporter,../share/xslt/import/wordml/wordml2ooo.xsl,../share/xslt/export/wordml/ooo2wordml.xsl</value></prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_MS_Word_2003_XML</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/MS_Word_2003_XML_ui.xcu b/filter/source/config/fragments/filters/MS_Word_2003_XML_ui.xcu
new file mode 100644
index 000000000000..1a6847dfbdb9
--- /dev/null
+++ b/filter/source/config/fragments/filters/MS_Word_2003_XML_ui.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="MS Word 2003 XML">
+ <prop oor:name="UIName">
+ <value xml:lang="el">Microsoft Word 2003 XML</value>
+ <value xml:lang="en-US">Microsoft Word 2003 XML</value>
+ <value xml:lang="hu">Microsoft Word 2003 XML</value>
+ <value xml:lang="cs">Microsoft Word 2003 XML</value>
+ <value xml:lang="sk">Microsoft Word 2003 XML</value>
+ <value xml:lang="sl">Microsoft Word 2003 XML</value>
+ <value xml:lang="nl">Microsoft Word 2003 XML</value>
+ <value xml:lang="da">Microsoft Word 2003 XML</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/MS_Word_2007_XML.xcu b/filter/source/config/fragments/filters/MS_Word_2007_XML.xcu
new file mode 100644
index 000000000000..d8a37406fe93
--- /dev/null
+++ b/filter/source/config/fragments/filters/MS_Word_2007_XML.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="MS Word 2007 XML" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.Writer.WriterFilter</value></prop>
+ <prop oor:name="UserData"><value>OXML</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Microsoft Word 2007 XML</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_MS_Word_2007</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/MS_Word_2007_XML_Template.xcu b/filter/source/config/fragments/filters/MS_Word_2007_XML_Template.xcu
new file mode 100644
index 000000000000..987e57c35f0b
--- /dev/null
+++ b/filter/source/config/fragments/filters/MS_Word_2007_XML_Template.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="MS Word 2007 XML Template" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER TEMPLATE TEMPLATEPATH</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.Writer.WriterFilter</value></prop>
+ <prop oor:name="UserData"><value>OXML</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Microsoft Word 2007 XML Template</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_MS_Word_2007_Template</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/MS_Word_2007_XML_Template_ui.xcu b/filter/source/config/fragments/filters/MS_Word_2007_XML_Template_ui.xcu
new file mode 100644
index 000000000000..818ddbcf00da
--- /dev/null
+++ b/filter/source/config/fragments/filters/MS_Word_2007_XML_Template_ui.xcu
@@ -0,0 +1,6 @@
+ <node oor:name="MS Word 2007 XML Template">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">Microsoft Word 2007 XML Template</value>
+ <value xml:lang="de">Microsoft Word 2007 XML Vorlage</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/MS_Word_2007_XML_ui.xcu b/filter/source/config/fragments/filters/MS_Word_2007_XML_ui.xcu
new file mode 100644
index 000000000000..a4a293561e31
--- /dev/null
+++ b/filter/source/config/fragments/filters/MS_Word_2007_XML_ui.xcu
@@ -0,0 +1,6 @@
+ <node oor:name="MS Word 2007 XML">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">Microsoft Word 2007 XML</value>
+ <value xml:lang="de">Microsoft Word 2007 XML</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/MS_Word_3_x__W4W_.xcu b/filter/source/config/fragments/filters/MS_Word_3_x__W4W_.xcu
new file mode 100644
index 000000000000..b244802b3d3f
--- /dev/null
+++ b/filter/source/config/fragments/filters/MS_Word_3_x__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="MS Word 3.x (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W05_0</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Microsoft Word 3.x</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_MS_Word_3x_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/MS_Word_4_x__W4W_.xcu b/filter/source/config/fragments/filters/MS_Word_4_x__W4W_.xcu
new file mode 100644
index 000000000000..89dc19b3b9d5
--- /dev/null
+++ b/filter/source/config/fragments/filters/MS_Word_4_x__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="MS Word 4.x (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W05_1</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Microsoft Word 4.x</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_MS_Word_4x_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/MS_Word_5_x__W4W_.xcu b/filter/source/config/fragments/filters/MS_Word_5_x__W4W_.xcu
new file mode 100644
index 000000000000..5faa71cfdea2
--- /dev/null
+++ b/filter/source/config/fragments/filters/MS_Word_5_x__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="MS Word 5.x (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W05_2</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Microsoft Word 5.x</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_MS_Word_5x_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/MS_Word_6_x__W4W_.xcu b/filter/source/config/fragments/filters/MS_Word_6_x__W4W_.xcu
new file mode 100644
index 000000000000..2e495455758d
--- /dev/null
+++ b/filter/source/config/fragments/filters/MS_Word_6_x__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="MS Word 6.x (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W05_3</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Microsoft Word 6.x</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_MS_Word_6x_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/MS_Word_95.xcu b/filter/source/config/fragments/filters/MS_Word_95.xcu
new file mode 100644
index 000000000000..40af005de713
--- /dev/null
+++ b/filter/source/config/fragments/filters/MS_Word_95.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="MS Word 95" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT ALIEN</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value>CWW6</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Microsoft Word 95</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_MS_Word_95</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/MS_Word_95_Vorlage.xcu b/filter/source/config/fragments/filters/MS_Word_95_Vorlage.xcu
new file mode 100644
index 000000000000..29b93c2eb79f
--- /dev/null
+++ b/filter/source/config/fragments/filters/MS_Word_95_Vorlage.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="MS Word 95 Vorlage" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT TEMPLATE TEMPLATEPATH ALIEN</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value>CWW6</value></prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_MS_Word_95_Vorlage</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/MS_Word_95_Vorlage_ui.xcu b/filter/source/config/fragments/filters/MS_Word_95_Vorlage_ui.xcu
new file mode 100644
index 000000000000..952bb13bb494
--- /dev/null
+++ b/filter/source/config/fragments/filters/MS_Word_95_Vorlage_ui.xcu
@@ -0,0 +1,6 @@
+ <node oor:name="MS Word 95 Vorlage">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">Microsoft Word 95 Template</value>
+ <value xml:lang="x-translate">Microsoft Word 95 Template</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/MS_Word_97.xcu b/filter/source/config/fragments/filters/MS_Word_97.xcu
new file mode 100644
index 000000000000..c02a895b82f8
--- /dev/null
+++ b/filter/source/config/fragments/filters/MS_Word_97.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="MS Word 97" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT ALIEN PREFERRED ENCRYPTION PASSWORDTOMODIFY</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value>CWW8</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Microsoft Word 97/2000/XP</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_MS_Word_97</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/MS_Word_97_Vorlage.xcu b/filter/source/config/fragments/filters/MS_Word_97_Vorlage.xcu
new file mode 100644
index 000000000000..35d694a4832d
--- /dev/null
+++ b/filter/source/config/fragments/filters/MS_Word_97_Vorlage.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="MS Word 97 Vorlage" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT TEMPLATE TEMPLATEPATH ALIEN ENCRYPTION PASSWORDTOMODIFY</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value>CWW8</value></prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_MS_Word_97_Vorlage</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/MS_Word_97_Vorlage_ui.xcu b/filter/source/config/fragments/filters/MS_Word_97_Vorlage_ui.xcu
new file mode 100644
index 000000000000..f0df07a762ea
--- /dev/null
+++ b/filter/source/config/fragments/filters/MS_Word_97_Vorlage_ui.xcu
@@ -0,0 +1,6 @@
+ <node oor:name="MS Word 97 Vorlage">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">Microsoft Word 97/2000/XP Template</value>
+ <value xml:lang="x-translate">Microsoft Word 97/2000/XP Template</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/MS_Works_2_0_DOS__W4W_.xcu b/filter/source/config/fragments/filters/MS_Works_2_0_DOS__W4W_.xcu
new file mode 100644
index 000000000000..da458068e747
--- /dev/null
+++ b/filter/source/config/fragments/filters/MS_Works_2_0_DOS__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="MS Works 2.0 DOS (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W39_0</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Microsoft Works 2.0 DOS</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_MS_Works_20_DOS_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/MS_Works_3_0_Win__W4W_.xcu b/filter/source/config/fragments/filters/MS_Works_3_0_Win__W4W_.xcu
new file mode 100644
index 000000000000..a9a9b9814dca
--- /dev/null
+++ b/filter/source/config/fragments/filters/MS_Works_3_0_Win__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="MS Works 3.0 Win (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W39_1</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Microsoft Works 3.0 Win</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_MS_Works_30_Win_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/MS_Works_4_0_Mac__W4W_.xcu b/filter/source/config/fragments/filters/MS_Works_4_0_Mac__W4W_.xcu
new file mode 100644
index 000000000000..8a696f7bafe6
--- /dev/null
+++ b/filter/source/config/fragments/filters/MS_Works_4_0_Mac__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="MS Works 4.0 Mac (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W58_0</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Microsoft Works 4.0 Mac</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_MS_Works_40_Mac_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/Mac_Write_4_x_5_0__W4W_.xcu b/filter/source/config/fragments/filters/Mac_Write_4_x_5_0__W4W_.xcu
new file mode 100644
index 000000000000..249220b08db5
--- /dev/null
+++ b/filter/source/config/fragments/filters/Mac_Write_4_x_5_0__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="Mac Write 4.x 5.0 (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W51_0</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Mac Write 4.x 5.0</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_Mac_Write_4x_50_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/Mac_Write_II__W4W_.xcu b/filter/source/config/fragments/filters/Mac_Write_II__W4W_.xcu
new file mode 100644
index 000000000000..68f8ffb6d5f3
--- /dev/null
+++ b/filter/source/config/fragments/filters/Mac_Write_II__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="Mac Write II (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W52_0</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Mac Write II</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_Mac_Write_II_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/Mac_Write_Pro__W4W_.xcu b/filter/source/config/fragments/filters/Mac_Write_Pro__W4W_.xcu
new file mode 100644
index 000000000000..9b6431e04eab
--- /dev/null
+++ b/filter/source/config/fragments/filters/Mac_Write_Pro__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="Mac Write Pro (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W56_0</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Mac Write Pro</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_Mac_Write_Pro_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/MathML_XML__Math_.xcu b/filter/source/config/fragments/filters/MathML_XML__Math_.xcu
new file mode 100644
index 000000000000..b6ab09ac89cd
--- /dev/null
+++ b/filter/source/config/fragments/filters/MathML_XML__Math_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="MathML XML (Math)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT TEMPLATE ENCRYPTION</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">MathML 1.01</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>6200</value></prop>
+ <prop oor:name="Type"><value>math_MathML_XML_Math</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.formula.FormulaProperties</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/MathType_3_x.xcu b/filter/source/config/fragments/filters/MathType_3_x.xcu
new file mode 100644
index 000000000000..93637ee583b2
--- /dev/null
+++ b/filter/source/config/fragments/filters/MathType_3_x.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="MathType 3.x" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT ALIEN NOTINFILEDIALOG NOTINCHOOSER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">MathType3.x</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>math_MathType_3x</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.formula.FormulaProperties</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/MiniCalc__Palm_.xcu b/filter/source/config/fragments/filters/MiniCalc__Palm_.xcu
new file mode 100644
index 000000000000..234d187c2b08
--- /dev/null
+++ b/filter/source/config/fragments/filters/MiniCalc__Palm_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="MiniCalc (Palm)" oor:op="replace">
+ <prop oor:name="FileFormatVersion"><value>1</value></prop>
+ <prop oor:name="Type"><value>calc_MiniCalc_PalmDB_File</value></prop>
+ <prop oor:name="DocumentService"><value>com.sun.star.sheet.SpreadsheetDocument</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="UserData"><value>com.sun.star.documentconversion.XMergeBridge classes/minicalc.jar com.sun.star.comp.Calc.XMLImporter com.sun.star.comp.Calc.XMLExporter staroffice/sxc application/x-minicalc</value></prop>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.Writer.XmlFilterAdaptor</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="UIName">
+ <value>MiniCalc (Palm)</value>
+ </prop>
+ <prop oor:name="Flags"><value>IMPORT EXPORT ALIEN 3RDPARTYFILTER</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/MultiMate_3_3__W4W_.xcu b/filter/source/config/fragments/filters/MultiMate_3_3__W4W_.xcu
new file mode 100644
index 000000000000..9b98327b4af1
--- /dev/null
+++ b/filter/source/config/fragments/filters/MultiMate_3_3__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="MultiMate 3.3 (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W10_0</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">MultiMate 3.3</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_MultiMate_33_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/MultiMate_4__W4W_.xcu b/filter/source/config/fragments/filters/MultiMate_4__W4W_.xcu
new file mode 100644
index 000000000000..9098ed8f3305
--- /dev/null
+++ b/filter/source/config/fragments/filters/MultiMate_4__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="MultiMate 4 (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W10_3</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">MultiMate 4</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_MultiMate_4_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/MultiMate_Adv__3_6__W4W_.xcu b/filter/source/config/fragments/filters/MultiMate_Adv__3_6__W4W_.xcu
new file mode 100644
index 000000000000..4e9dc9e84ba4
--- /dev/null
+++ b/filter/source/config/fragments/filters/MultiMate_Adv__3_6__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="MultiMate Adv. 3.6 (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W10_1</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">MultiMate Adv. 3.6</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_MultiMate_Adv_36_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/MultiMate_Adv__II_3_7__W4W_.xcu b/filter/source/config/fragments/filters/MultiMate_Adv__II_3_7__W4W_.xcu
new file mode 100644
index 000000000000..26939248d58b
--- /dev/null
+++ b/filter/source/config/fragments/filters/MultiMate_Adv__II_3_7__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="MultiMate Adv. II 3.7 (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W10_2</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">MultiMate Adv. II 3.7</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_MultiMate_Adv_II_37_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/NAVY_DIF__W4W_.xcu b/filter/source/config/fragments/filters/NAVY_DIF__W4W_.xcu
new file mode 100644
index 000000000000..dcc5ecc36c39
--- /dev/null
+++ b/filter/source/config/fragments/filters/NAVY_DIF__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="NAVY DIF (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W18_0</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">NAVY DIF</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_NAVY_DIF_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/OfficeWriter_4_0__W4W_.xcu b/filter/source/config/fragments/filters/OfficeWriter_4_0__W4W_.xcu
new file mode 100644
index 000000000000..afc5b8a83586
--- /dev/null
+++ b/filter/source/config/fragments/filters/OfficeWriter_4_0__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="OfficeWriter 4.0 (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W16_0</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">OfficeWriter 4.0</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_OfficeWriter_40_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/OfficeWriter_5_0__W4W_.xcu b/filter/source/config/fragments/filters/OfficeWriter_5_0__W4W_.xcu
new file mode 100644
index 000000000000..299101bd5601
--- /dev/null
+++ b/filter/source/config/fragments/filters/OfficeWriter_5_0__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="OfficeWriter 5.0 (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W16_1</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">OfficeWriter 5.0</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_OfficeWriter_50_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/OfficeWriter_6_x__W4W_.xcu b/filter/source/config/fragments/filters/OfficeWriter_6_x__W4W_.xcu
new file mode 100644
index 000000000000..73baa867021f
--- /dev/null
+++ b/filter/source/config/fragments/filters/OfficeWriter_6_x__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="OfficeWriter 6.x (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W16_2</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">OfficeWriter 6.x</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_OfficeWriter_6x_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/PBM___Portable_Bitmap.xcu b/filter/source/config/fragments/filters/PBM___Portable_Bitmap.xcu
new file mode 100644
index 000000000000..b5d30b17fd5a
--- /dev/null
+++ b/filter/source/config/fragments/filters/PBM___Portable_Bitmap.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="PBM - Portable Bitmap" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">PBM - Portable Bitmap</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>pbm_Portable_Bitmap</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/PCT___Mac_Pict.xcu b/filter/source/config/fragments/filters/PCT___Mac_Pict.xcu
new file mode 100644
index 000000000000..34816883e8d5
--- /dev/null
+++ b/filter/source/config/fragments/filters/PCT___Mac_Pict.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="PCT - Mac Pict" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">PCT - Mac Pict</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>pct_Mac_Pict</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/PCX___Zsoft_Paintbrush.xcu b/filter/source/config/fragments/filters/PCX___Zsoft_Paintbrush.xcu
new file mode 100644
index 000000000000..ad56e44c0314
--- /dev/null
+++ b/filter/source/config/fragments/filters/PCX___Zsoft_Paintbrush.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="PCX - Zsoft Paintbrush" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">PCX - Zsoft Paintbrush</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>pcx_Zsoft_Paintbrush</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/PFS_First_Choice_1_0__W4W_.xcu b/filter/source/config/fragments/filters/PFS_First_Choice_1_0__W4W_.xcu
new file mode 100644
index 000000000000..fb20708bd933
--- /dev/null
+++ b/filter/source/config/fragments/filters/PFS_First_Choice_1_0__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="PFS First Choice 1.0 (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W08_2</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">PFS First Choice 1.0</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_PFS_First_Choice_10_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/PFS_First_Choice_2_0__W4W_.xcu b/filter/source/config/fragments/filters/PFS_First_Choice_2_0__W4W_.xcu
new file mode 100644
index 000000000000..1f7002fa4bdf
--- /dev/null
+++ b/filter/source/config/fragments/filters/PFS_First_Choice_2_0__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="PFS First Choice 2.0 (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W08_3</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">PFS First Choice 2.0</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_PFS_First_Choice_20_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/PFS_First_Choice_3_0__W4W_.xcu b/filter/source/config/fragments/filters/PFS_First_Choice_3_0__W4W_.xcu
new file mode 100644
index 000000000000..9c3be7e436f2
--- /dev/null
+++ b/filter/source/config/fragments/filters/PFS_First_Choice_3_0__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="PFS First Choice 3.0 (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W08_5</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">PFS First Choice 3.0</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_PFS_First_Choice_30_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/PFS_Write__W4W_.xcu b/filter/source/config/fragments/filters/PFS_Write__W4W_.xcu
new file mode 100644
index 000000000000..4abd5c90dba8
--- /dev/null
+++ b/filter/source/config/fragments/filters/PFS_Write__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="PFS Write (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W08_0</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">PFS Write</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_PFS_Write_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/PGM___Portable_Graymap.xcu b/filter/source/config/fragments/filters/PGM___Portable_Graymap.xcu
new file mode 100644
index 000000000000..e79262752cf5
--- /dev/null
+++ b/filter/source/config/fragments/filters/PGM___Portable_Graymap.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="PGM - Portable Graymap" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">PGM - Portable Graymap</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>pgm_Portable_Graymap</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/PNG___Portable_Network_Graphic.xcu b/filter/source/config/fragments/filters/PNG___Portable_Network_Graphic.xcu
new file mode 100644
index 000000000000..d96ce0f9fbd4
--- /dev/null
+++ b/filter/source/config/fragments/filters/PNG___Portable_Network_Graphic.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="PNG - Portable Network Graphic" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">PNG - Portable Network Graphic</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>png_Portable_Network_Graphic</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/PPM___Portable_Pixelmap.xcu b/filter/source/config/fragments/filters/PPM___Portable_Pixelmap.xcu
new file mode 100644
index 000000000000..fec669f4ee5b
--- /dev/null
+++ b/filter/source/config/fragments/filters/PPM___Portable_Pixelmap.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="PPM - Portable Pixelmap" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">PPM - Portable Pixelmap</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>ppm_Portable_Pixelmap</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/PSD___Adobe_Photoshop.xcu b/filter/source/config/fragments/filters/PSD___Adobe_Photoshop.xcu
new file mode 100644
index 000000000000..95683a6de6b5
--- /dev/null
+++ b/filter/source/config/fragments/filters/PSD___Adobe_Photoshop.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="PSD - Adobe Photoshop" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">PSD - Adobe Photoshop</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>psd_Adobe_Photoshop</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/Peach_Text__W4W_.xcu b/filter/source/config/fragments/filters/Peach_Text__W4W_.xcu
new file mode 100644
index 000000000000..5bc2f3c60dda
--- /dev/null
+++ b/filter/source/config/fragments/filters/Peach_Text__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="Peach Text (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W27_0</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Peach Text</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_Peach_Text_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/PocketWord_File.xcu b/filter/source/config/fragments/filters/PocketWord_File.xcu
new file mode 100644
index 000000000000..87d4cf74a40a
--- /dev/null
+++ b/filter/source/config/fragments/filters/PocketWord_File.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="PocketWord File" oor:op="replace">
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_PocketWord_File</value></prop>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="UserData"><value>com.sun.star.documentconversion.XMergeBridge classes/pocketword.jar com.sun.star.comp.Writer.XMLImporter com.sun.star.comp.Writer.XMLExporter staroffice/sxw application/x-pocket-word</value></prop>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.Writer.XmlFilterAdaptor</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="UIName">
+ <value>Pocket Word</value>
+ </prop>
+ <prop oor:name="Flags"><value>IMPORT EXPORT ALIEN 3RDPARTYFILTER</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/Pocket_Excel.xcu b/filter/source/config/fragments/filters/Pocket_Excel.xcu
new file mode 100644
index 000000000000..2fe86184a1cc
--- /dev/null
+++ b/filter/source/config/fragments/filters/Pocket_Excel.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="Pocket Excel" oor:op="replace">
+ <prop oor:name="FileFormatVersion"><value>1</value></prop>
+ <prop oor:name="Type"><value>calc_Pocket_Excel_File</value></prop>
+ <prop oor:name="DocumentService"><value>com.sun.star.sheet.SpreadsheetDocument</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="UserData"><value>com.sun.star.documentconversion.XMergeBridge classes/pexcel.jar com.sun.star.comp.Calc.XMLImporter com.sun.star.comp.Calc.XMLExporter staroffice/sxc application/x-pocket-excel</value></prop>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.Writer.XmlFilterAdaptor</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="UIName">
+ <value>Pocket Excel</value>
+ </prop>
+ <prop oor:name="Flags"><value>IMPORT EXPORT ALIEN 3RDPARTYFILTER</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/Professional_Write_1_0__W4W_.xcu b/filter/source/config/fragments/filters/Professional_Write_1_0__W4W_.xcu
new file mode 100644
index 000000000000..cd52a17c2873
--- /dev/null
+++ b/filter/source/config/fragments/filters/Professional_Write_1_0__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="Professional Write 1.0 (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W08_1</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">PFS Professional Write 1.0</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_Professional_Write_10_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/Professional_Write_2_x__W4W_.xcu b/filter/source/config/fragments/filters/Professional_Write_2_x__W4W_.xcu
new file mode 100644
index 000000000000..5ba7499a79e8
--- /dev/null
+++ b/filter/source/config/fragments/filters/Professional_Write_2_x__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="Professional Write 2.x (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W08_4</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">PFS Professional Write 2.x</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_Professional_Write_2x_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/Professional_Write_Plus__W4W_.xcu b/filter/source/config/fragments/filters/Professional_Write_Plus__W4W_.xcu
new file mode 100644
index 000000000000..5852f02c4083
--- /dev/null
+++ b/filter/source/config/fragments/filters/Professional_Write_Plus__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="Professional Write Plus (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W33_0</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">PFS Professional Write Plus</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_Professional_Write_Plus_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/QPro.xcu b/filter/source/config/fragments/filters/QPro.xcu
new file mode 100644
index 000000000000..950dcaef2758
--- /dev/null
+++ b/filter/source/config/fragments/filters/QPro.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="Quattro Pro 6.0" oor:op="replace" oor:finalized="true" oor:mandatory="true">
+ <prop oor:name="Flags"><value>IMPORT ALIEN PREFERRED</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"/>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Quattro Pro 6.0</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>calc_QPro</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.sheet.SpreadsheetDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/Q_A_Write_1_0_3_0__W4W_.xcu b/filter/source/config/fragments/filters/Q_A_Write_1_0_3_0__W4W_.xcu
new file mode 100644
index 000000000000..124e03b80b4f
--- /dev/null
+++ b/filter/source/config/fragments/filters/Q_A_Write_1_0_3_0__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="Q&amp;A Write 1.0-3.0 (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W23_0</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Q&amp;A Write 1.0-3.0</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_QA_Write_10_30_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/Q_A_Write_4_0__W4W_.xcu b/filter/source/config/fragments/filters/Q_A_Write_4_0__W4W_.xcu
new file mode 100644
index 000000000000..4ad2dd226038
--- /dev/null
+++ b/filter/source/config/fragments/filters/Q_A_Write_4_0__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="Q&amp;A Write 4.0 (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W23_1</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Q&amp;A Write 4.0</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_QA_Write_40_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/RAS___Sun_Rasterfile.xcu b/filter/source/config/fragments/filters/RAS___Sun_Rasterfile.xcu
new file mode 100644
index 000000000000..9b66385d1f82
--- /dev/null
+++ b/filter/source/config/fragments/filters/RAS___Sun_Rasterfile.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="RAS - Sun Rasterfile" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">RAS - Sun Raster Image</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>ras_Sun_Rasterfile</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/Rapid_File_1_0__W4W_.xcu b/filter/source/config/fragments/filters/Rapid_File_1_0__W4W_.xcu
new file mode 100644
index 000000000000..ed2da0acef84
--- /dev/null
+++ b/filter/source/config/fragments/filters/Rapid_File_1_0__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="Rapid File 1.0 (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W25_0</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Rapid File 1.0</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_Rapid_File_10_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/Rapid_File_1_2__W4W_.xcu b/filter/source/config/fragments/filters/Rapid_File_1_2__W4W_.xcu
new file mode 100644
index 000000000000..86bf7a3857bf
--- /dev/null
+++ b/filter/source/config/fragments/filters/Rapid_File_1_2__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="Rapid File 1.2 (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W25_1</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Rapid File 1.2</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_Rapid_File_12_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/Rich_Text_Format.xcu b/filter/source/config/fragments/filters/Rich_Text_Format.xcu
new file mode 100644
index 000000000000..dc8b07e45536
--- /dev/null
+++ b/filter/source/config/fragments/filters/Rich_Text_Format.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="Rich Text Format" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT ALIEN PREFERRED</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value>RTF</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Rich Text Format</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_Rich_Text_Format</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/Rich_Text_Format__StarCalc_.xcu b/filter/source/config/fragments/filters/Rich_Text_Format__StarCalc_.xcu
new file mode 100644
index 000000000000..48af73df89ff
--- /dev/null
+++ b/filter/source/config/fragments/filters/Rich_Text_Format__StarCalc_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="Rich Text Format (StarCalc)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Rich Text Format (%productname% Calc)</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_Rich_Text_Format</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.sheet.SpreadsheetDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/SGF___StarOffice_Writer_SGF.xcu b/filter/source/config/fragments/filters/SGF___StarOffice_Writer_SGF.xcu
new file mode 100644
index 000000000000..41acbb993b0c
--- /dev/null
+++ b/filter/source/config/fragments/filters/SGF___StarOffice_Writer_SGF.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="SGF - StarOffice Writer SGF" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">SGF - StarWriter Graphics Format</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>sgf_StarOffice_Writer_SGF</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/SGV___StarDraw_2_0.xcu b/filter/source/config/fragments/filters/SGV___StarDraw_2_0.xcu
new file mode 100644
index 000000000000..94548119adcf
--- /dev/null
+++ b/filter/source/config/fragments/filters/SGV___StarDraw_2_0.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="SGV - StarDraw 2.0" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">SGV - StarDraw 2.0</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>sgv_StarDraw_20</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/SVM___StarView_Metafile.xcu b/filter/source/config/fragments/filters/SVM___StarView_Metafile.xcu
new file mode 100644
index 000000000000..bb15deff047f
--- /dev/null
+++ b/filter/source/config/fragments/filters/SVM___StarView_Metafile.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="SVM - StarView Metafile" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">SVM - StarView Metafile</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>svm_StarView_Metafile</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/SYLK.xcu b/filter/source/config/fragments/filters/SYLK.xcu
new file mode 100644
index 000000000000..e46fcbdbe3af
--- /dev/null
+++ b/filter/source/config/fragments/filters/SYLK.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="SYLK" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT ALIEN</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">SYLK</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>calc_SYLK</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.sheet.SpreadsheetDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/Samna_Word_IV_IV_Plus__W4W_.xcu b/filter/source/config/fragments/filters/Samna_Word_IV_IV_Plus__W4W_.xcu
new file mode 100644
index 000000000000..0c939ce76dc7
--- /dev/null
+++ b/filter/source/config/fragments/filters/Samna_Word_IV_IV_Plus__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="Samna Word IV-IV Plus (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W22_0</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Samna Word IV-IV Plus</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_Samna_Word_IV_IV_Plus_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarCalc_1_0.xcu b/filter/source/config/fragments/filters/StarCalc_1_0.xcu
new file mode 100644
index 000000000000..ba0603cc13dc
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarCalc_1_0.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="StarCalc 1.0" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="UserData"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">StarCalc 1.0</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>calc_StarCalc_10</value></prop>
+ <prop oor:name="DocumentService"><value>com.sun.star.sheet.SpreadsheetDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarCalc_3_0.xcu b/filter/source/config/fragments/filters/StarCalc_3_0.xcu
new file mode 100644
index 000000000000..fc96b7d6cd99
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarCalc_3_0.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="StarCalc 3.0" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT TEMPLATE OWN ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">StarCalc 3.0</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>3450</value></prop>
+ <prop oor:name="Type"><value>calc_StarCalc_30</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.sheet.SpreadsheetDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarCalc_3_0_Vorlage_Template.xcu b/filter/source/config/fragments/filters/StarCalc_3_0_Vorlage_Template.xcu
new file mode 100644
index 000000000000..1dce482b0fdf
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarCalc_3_0_Vorlage_Template.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="StarCalc 3.0 Vorlage/Template" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT TEMPLATE TEMPLATEPATH OWN ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="FileFormatVersion"><value>3450</value></prop>
+ <prop oor:name="Type"><value>calc_StarCalc_30_VorlageTemplate</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.sheet.SpreadsheetDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarCalc_3_0_Vorlage_Template_ui.xcu b/filter/source/config/fragments/filters/StarCalc_3_0_Vorlage_Template_ui.xcu
new file mode 100644
index 000000000000..e4ce9330a1c5
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarCalc_3_0_Vorlage_Template_ui.xcu
@@ -0,0 +1,6 @@
+ <node oor:name="StarCalc 3.0 Vorlage/Template">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">StarCalc 3.0 Template</value>
+ <value xml:lang="x-translate">StarCalc 3.0 Template</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarCalc_4_0.xcu b/filter/source/config/fragments/filters/StarCalc_4_0.xcu
new file mode 100644
index 000000000000..c12d34b3ee8e
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarCalc_4_0.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="StarCalc 4.0" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT TEMPLATE OWN ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">StarCalc 4.0</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>3580</value></prop>
+ <prop oor:name="Type"><value>calc_StarCalc_40</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.sheet.SpreadsheetDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarCalc_4_0_Vorlage_Template.xcu b/filter/source/config/fragments/filters/StarCalc_4_0_Vorlage_Template.xcu
new file mode 100644
index 000000000000..b27b0cd4fcc1
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarCalc_4_0_Vorlage_Template.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="StarCalc 4.0 Vorlage/Template" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT TEMPLATE TEMPLATEPATH OWN ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="FileFormatVersion"><value>3580</value></prop>
+ <prop oor:name="Type"><value>calc_StarCalc_40_VorlageTemplate</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.sheet.SpreadsheetDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarCalc_4_0_Vorlage_Template_ui.xcu b/filter/source/config/fragments/filters/StarCalc_4_0_Vorlage_Template_ui.xcu
new file mode 100644
index 000000000000..9de89570e351
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarCalc_4_0_Vorlage_Template_ui.xcu
@@ -0,0 +1,6 @@
+ <node oor:name="StarCalc 4.0 Vorlage/Template">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">StarCalc 4.0 Template</value>
+ <value xml:lang="x-translate">StarCalc 4.0 Template</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarCalc_5_0.xcu b/filter/source/config/fragments/filters/StarCalc_5_0.xcu
new file mode 100644
index 000000000000..7378d4d7a405
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarCalc_5_0.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="StarCalc 5.0" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT TEMPLATE OWN ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">StarCalc 5.0</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>5050</value></prop>
+ <prop oor:name="Type"><value>calc_StarCalc_50</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.sheet.SpreadsheetDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarCalc_5_0_Vorlage_Template.xcu b/filter/source/config/fragments/filters/StarCalc_5_0_Vorlage_Template.xcu
new file mode 100644
index 000000000000..edefd738acfa
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarCalc_5_0_Vorlage_Template.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="StarCalc 5.0 Vorlage/Template" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT TEMPLATE TEMPLATEPATH OWN ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="FileFormatVersion"><value>5050</value></prop>
+ <prop oor:name="Type"><value>calc_StarCalc_50_VorlageTemplate</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.sheet.SpreadsheetDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarCalc_5_0_Vorlage_Template_ui.xcu b/filter/source/config/fragments/filters/StarCalc_5_0_Vorlage_Template_ui.xcu
new file mode 100644
index 000000000000..62b2001c0700
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarCalc_5_0_Vorlage_Template_ui.xcu
@@ -0,0 +1,6 @@
+ <node oor:name="StarCalc 5.0 Vorlage/Template">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">StarCalc 5.0 Template</value>
+ <value xml:lang="x-translate">StarCalc 5.0 Template</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarChart_3_0.xcu b/filter/source/config/fragments/filters/StarChart_3_0.xcu
new file mode 100644
index 000000000000..ca7c4ab13867
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarChart_3_0.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="StarChart 3.0" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT OWN ALIEN NOTINFILEDIALOG NOTINCHOOSER 3RDPARTYFILTER SILENTEXPORT</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">StarChart 3.0</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>3450</value></prop>
+ <prop oor:name="Type"><value>chart_StarChart_30</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.chart2.ChartDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarChart_4_0.xcu b/filter/source/config/fragments/filters/StarChart_4_0.xcu
new file mode 100644
index 000000000000..d6b909ed2537
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarChart_4_0.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="StarChart 4.0" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT OWN ALIEN NOTINFILEDIALOG NOTINCHOOSER 3RDPARTYFILTER SILENTEXPORT</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">StarChart 4.0</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>3580</value></prop>
+ <prop oor:name="Type"><value>chart_StarChart_40</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.chart2.ChartDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarChart_5_0.xcu b/filter/source/config/fragments/filters/StarChart_5_0.xcu
new file mode 100644
index 000000000000..8f095aef9c79
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarChart_5_0.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="StarChart 5.0" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT OWN ALIEN NOTINFILEDIALOG NOTINCHOOSER 3RDPARTYFILTER SILENTEXPORT</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">StarChart 5.0</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>5050</value></prop>
+ <prop oor:name="Type"><value>chart_StarChart_50</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.chart2.ChartDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarDraw_3_0.xcu b/filter/source/config/fragments/filters/StarDraw_3_0.xcu
new file mode 100644
index 000000000000..e4c22be3a3ee
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarDraw_3_0.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="StarDraw 3.0" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT TEMPLATE OWN ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">StarDraw 3.0</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>3450</value></prop>
+ <prop oor:name="Type"><value>draw_StarDraw_30</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarDraw_3_0_Vorlage.xcu b/filter/source/config/fragments/filters/StarDraw_3_0_Vorlage.xcu
new file mode 100644
index 000000000000..ab1dd6f0ad23
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarDraw_3_0_Vorlage.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="StarDraw 3.0 Vorlage" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT TEMPLATE TEMPLATEPATH OWN ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="FileFormatVersion"><value>3450</value></prop>
+ <prop oor:name="Type"><value>draw_StarDraw_30_Vorlage</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarDraw_3_0_Vorlage__StarImpress_.xcu b/filter/source/config/fragments/filters/StarDraw_3_0_Vorlage__StarImpress_.xcu
new file mode 100644
index 000000000000..f255fb901937
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarDraw_3_0_Vorlage__StarImpress_.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="StarDraw 3.0 Vorlage (StarImpress)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT TEMPLATE TEMPLATEPATH OWN ALIEN NOTINFILEDIALOG NOTINCHOOSER 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="FileFormatVersion"><value>3450</value></prop>
+ <prop oor:name="Type"><value>draw_StarDraw_30_Vorlage</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.presentation.PresentationDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarDraw_3_0_Vorlage__StarImpress__ui.xcu b/filter/source/config/fragments/filters/StarDraw_3_0_Vorlage__StarImpress__ui.xcu
new file mode 100644
index 000000000000..542736c1168e
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarDraw_3_0_Vorlage__StarImpress__ui.xcu
@@ -0,0 +1,6 @@
+ <node oor:name="StarDraw 3.0 Vorlage (StarImpress)">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">StarDraw 3.0 Template (%productname% Impress)</value>
+ <value xml:lang="x-translate">StarDraw 3.0 Template (%productname% Impress)</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarDraw_3_0_Vorlage_ui.xcu b/filter/source/config/fragments/filters/StarDraw_3_0_Vorlage_ui.xcu
new file mode 100644
index 000000000000..61f15235792b
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarDraw_3_0_Vorlage_ui.xcu
@@ -0,0 +1,6 @@
+ <node oor:name="StarDraw 3.0 Vorlage">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">StarDraw 3.0 Template</value>
+ <value xml:lang="x-translate">StarDraw 3.0 Template</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarDraw_3_0__StarImpress_.xcu b/filter/source/config/fragments/filters/StarDraw_3_0__StarImpress_.xcu
new file mode 100644
index 000000000000..b0ce586e9ee9
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarDraw_3_0__StarImpress_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="StarDraw 3.0 (StarImpress)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT TEMPLATE OWN ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">StarDraw 3.0 (%productname% Impress)</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>3450</value></prop>
+ <prop oor:name="Type"><value>draw_StarDraw_30</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.presentation.PresentationDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarDraw_5_0.xcu b/filter/source/config/fragments/filters/StarDraw_5_0.xcu
new file mode 100644
index 000000000000..da5376827a41
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarDraw_5_0.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="StarDraw 5.0" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT TEMPLATE OWN ALIEN 3RDPARTYFILTER PREFERRED</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">StarDraw 5.0</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>5050</value></prop>
+ <prop oor:name="Type"><value>draw_StarDraw_50</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarDraw_5_0_Vorlage.xcu b/filter/source/config/fragments/filters/StarDraw_5_0_Vorlage.xcu
new file mode 100644
index 000000000000..298ab1215761
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarDraw_5_0_Vorlage.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="StarDraw 5.0 Vorlage" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT TEMPLATE TEMPLATEPATH OWN ALIEN 3RDPARTYFILTER PREFERRED</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="FileFormatVersion"><value>5050</value></prop>
+ <prop oor:name="Type"><value>draw_StarDraw_50_Vorlage</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarDraw_5_0_Vorlage__StarImpress_.xcu b/filter/source/config/fragments/filters/StarDraw_5_0_Vorlage__StarImpress_.xcu
new file mode 100644
index 000000000000..8261bc648b93
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarDraw_5_0_Vorlage__StarImpress_.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="StarDraw 5.0 Vorlage (StarImpress)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT TEMPLATE TEMPLATEPATH OWN ALIEN NOTINFILEDIALOG NOTINCHOOSER 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="FileFormatVersion"><value>5050</value></prop>
+ <prop oor:name="Type"><value>draw_StarDraw_50_Vorlage</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.presentation.PresentationDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarDraw_5_0_Vorlage__StarImpress__ui.xcu b/filter/source/config/fragments/filters/StarDraw_5_0_Vorlage__StarImpress__ui.xcu
new file mode 100644
index 000000000000..2ecf87a4c5f5
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarDraw_5_0_Vorlage__StarImpress__ui.xcu
@@ -0,0 +1,6 @@
+ <node oor:name="StarDraw 5.0 Vorlage (StarImpress)">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">StarDraw 5.0 Template (%productname% Impress)</value>
+ <value xml:lang="x-translate">StarDraw 5.0 Template (%productname% Impress)</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarDraw_5_0_Vorlage_ui.xcu b/filter/source/config/fragments/filters/StarDraw_5_0_Vorlage_ui.xcu
new file mode 100644
index 000000000000..bd057e44dc46
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarDraw_5_0_Vorlage_ui.xcu
@@ -0,0 +1,6 @@
+ <node oor:name="StarDraw 5.0 Vorlage">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">StarDraw 5.0 Template</value>
+ <value xml:lang="x-translate">StarDraw 5.0 Template</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarDraw_5_0__StarImpress_.xcu b/filter/source/config/fragments/filters/StarDraw_5_0__StarImpress_.xcu
new file mode 100644
index 000000000000..a76ebfc3f3c2
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarDraw_5_0__StarImpress_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="StarDraw 5.0 (StarImpress)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT TEMPLATE OWN ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">StarDraw 5.0 (%productname% Impress)</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>5050</value></prop>
+ <prop oor:name="Type"><value>draw_StarDraw_50</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.presentation.PresentationDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarImpress_4_0.xcu b/filter/source/config/fragments/filters/StarImpress_4_0.xcu
new file mode 100644
index 000000000000..b8bd8c51bbb0
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarImpress_4_0.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="StarImpress 4.0" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT TEMPLATE OWN ALIEN 3RDPARTYFILTER PREFERRED</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">StarImpress 4.0</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>3580</value></prop>
+ <prop oor:name="Type"><value>impress_StarImpress_40</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.presentation.PresentationDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarImpress_4_0_Vorlage.xcu b/filter/source/config/fragments/filters/StarImpress_4_0_Vorlage.xcu
new file mode 100644
index 000000000000..68ad61d1270e
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarImpress_4_0_Vorlage.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="StarImpress 4.0 Vorlage" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT TEMPLATE TEMPLATEPATH OWN ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="FileFormatVersion"><value>3580</value></prop>
+ <prop oor:name="Type"><value>impress_StarImpress_40_Vorlage</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.presentation.PresentationDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarImpress_4_0_Vorlage_ui.xcu b/filter/source/config/fragments/filters/StarImpress_4_0_Vorlage_ui.xcu
new file mode 100644
index 000000000000..2071a51476d0
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarImpress_4_0_Vorlage_ui.xcu
@@ -0,0 +1,6 @@
+ <node oor:name="StarImpress 4.0 Vorlage">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">StarImpress 4.0 Template</value>
+ <value xml:lang="x-translate">StarImpress 4.0 Template</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarImpress_5_0.xcu b/filter/source/config/fragments/filters/StarImpress_5_0.xcu
new file mode 100644
index 000000000000..544b9187d1f2
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarImpress_5_0.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="StarImpress 5.0" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT TEMPLATE OWN ALIEN 3RDPARTYFILTER PREFERRED</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">StarImpress 5.0</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>5050</value></prop>
+ <prop oor:name="Type"><value>impress_StarImpress_50</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.presentation.PresentationDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarImpress_5_0_Vorlage.xcu b/filter/source/config/fragments/filters/StarImpress_5_0_Vorlage.xcu
new file mode 100644
index 000000000000..c73995cca8c6
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarImpress_5_0_Vorlage.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="StarImpress 5.0 Vorlage" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT TEMPLATE TEMPLATEPATH OWN ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="FileFormatVersion"><value>5050</value></prop>
+ <prop oor:name="Type"><value>impress_StarImpress_50_Vorlage</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.presentation.PresentationDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarImpress_5_0_Vorlage_ui.xcu b/filter/source/config/fragments/filters/StarImpress_5_0_Vorlage_ui.xcu
new file mode 100644
index 000000000000..e1711fec4e8d
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarImpress_5_0_Vorlage_ui.xcu
@@ -0,0 +1,6 @@
+ <node oor:name="StarImpress 5.0 Vorlage">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">StarImpress 5.0 Template</value>
+ <value xml:lang="x-translate">StarImpress 5.0 Template</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarImpress_5_0__packed_.xcu b/filter/source/config/fragments/filters/StarImpress_5_0__packed_.xcu
new file mode 100644
index 000000000000..e208e69b6ad1
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarImpress_5_0__packed_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="StarImpress 5.0 (packed)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER PACKED</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>impress_StarImpress_50_packed</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.presentation.PresentationDocument</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">StarImpress 5.0 Packed</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarImpress_5_0__packed__ui.xcu b/filter/source/config/fragments/filters/StarImpress_5_0__packed__ui.xcu
new file mode 100644
index 000000000000..2f87eb815f1b
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarImpress_5_0__packed__ui.xcu
@@ -0,0 +1,6 @@
+ <node oor:name="StarImpress 5.0 (packed)">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">StarImpress 5.0 Packed</value>
+ <value xml:lang="x-translate">StarImpress 5.0 Packed</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarMath_2_0.xcu b/filter/source/config/fragments/filters/StarMath_2_0.xcu
new file mode 100644
index 000000000000..bc67524cc407
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarMath_2_0.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="StarMath 2.0" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="UserData"><value>1</value></prop>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">StarMath 2.0</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>math_StarMath_20</value></prop>
+ <prop oor:name="DocumentService"><value>com.sun.star.formula.FormulaProperties</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarMath_3_0.xcu b/filter/source/config/fragments/filters/StarMath_3_0.xcu
new file mode 100644
index 000000000000..916b8208e2ca
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarMath_3_0.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="StarMath 3.0" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT OWN ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>0</value></prop>
+ <prop oor:name="FileFormatVersion"><value>3450</value></prop>
+ <prop oor:name="Type"><value>math_StarMath_30</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.formula.FormulaProperties</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">StarMath 3.0</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarMath_4_0.xcu b/filter/source/config/fragments/filters/StarMath_4_0.xcu
new file mode 100644
index 000000000000..aad13996f029
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarMath_4_0.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="StarMath 4.0" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT OWN ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>0</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">StarMath 4.0</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>3580</value></prop>
+ <prop oor:name="Type"><value>math_StarMath_40</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.formula.FormulaProperties</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarMath_5_0.xcu b/filter/source/config/fragments/filters/StarMath_5_0.xcu
new file mode 100644
index 000000000000..e583d4bf32ec
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarMath_5_0.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="StarMath 5.0" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT OWN ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>0</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">StarMath 5.0</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>5050</value></prop>
+ <prop oor:name="Type"><value>math_StarMath_50</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.formula.FormulaProperties</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarOffice_XML__Base_.xcu b/filter/source/config/fragments/filters/StarOffice_XML__Base_.xcu
new file mode 100644
index 000000000000..c9bc143ac3d8
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarOffice_XML__Base_.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="StarOffice XML (Base)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT OWN DEFAULT 3RDPARTYFILTER ENCRYPTION</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"/>
+ <prop oor:name="FileFormatVersion"><value>6200</value></prop>
+ <prop oor:name="Type"><value>StarBase</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.sdb.OfficeDatabaseDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarOffice_XML__Base__ui.xcu b/filter/source/config/fragments/filters/StarOffice_XML__Base__ui.xcu
new file mode 100644
index 000000000000..0328738a1bee
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarOffice_XML__Base__ui.xcu
@@ -0,0 +1,5 @@
+ <node oor:name="StarOffice XML (Base)">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">ODF Database</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarOffice_XML__Calc_.xcu b/filter/source/config/fragments/filters/StarOffice_XML__Calc_.xcu
new file mode 100644
index 000000000000..36970e6aadae
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarOffice_XML__Calc_.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="StarOffice XML (Calc)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT TEMPLATE OWN ALIEN ENCRYPTION</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="FileFormatVersion"><value>6200</value></prop>
+ <prop oor:name="Type"><value>calc_StarOffice_XML_Calc</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.sheet.SpreadsheetDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarOffice_XML__Calc__ui.xcu b/filter/source/config/fragments/filters/StarOffice_XML__Calc__ui.xcu
new file mode 100644
index 000000000000..0f8abbabf972
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarOffice_XML__Calc__ui.xcu
@@ -0,0 +1,6 @@
+ <node oor:name="StarOffice XML (Calc)">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">%productname% %formatversion% Spreadsheet</value>
+ <value xml:lang="x-translate">%productname% %formatversion% Spreadsheet</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarOffice_XML__Chart_.xcu b/filter/source/config/fragments/filters/StarOffice_XML__Chart_.xcu
new file mode 100644
index 000000000000..b7e05cb17860
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarOffice_XML__Chart_.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="StarOffice XML (Chart)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT OWN ALIEN NOTINFILEDIALOG NOTINCHOOSER ENCRYPTION</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.chart2.XMLFilter</value></prop>
+ <prop oor:name="UserData"><value>XML</value></prop>
+ <prop oor:name="FileFormatVersion"><value>6200</value></prop>
+ <prop oor:name="Type"><value>chart_StarOffice_XML_Chart</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.chart2.ChartDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarOffice_XML__Chart__ui.xcu b/filter/source/config/fragments/filters/StarOffice_XML__Chart__ui.xcu
new file mode 100644
index 000000000000..c74974f0cea5
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarOffice_XML__Chart__ui.xcu
@@ -0,0 +1,6 @@
+ <node oor:name="StarOffice XML (Chart)">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">%productname% %formatversion% Chart</value>
+ <value xml:lang="x-translate">%productname% %formatversion% Chart</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarOffice_XML__Draw_.xcu b/filter/source/config/fragments/filters/StarOffice_XML__Draw_.xcu
new file mode 100644
index 000000000000..089cc612d6c6
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarOffice_XML__Draw_.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="StarOffice XML (Draw)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT TEMPLATE OWN ALIEN PREFERRED ENCRYPTION</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value>XML</value></prop>
+ <prop oor:name="FileFormatVersion"><value>6200</value></prop>
+ <prop oor:name="Type"><value>draw_StarOffice_XML_Draw</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarOffice_XML__Draw__ui.xcu b/filter/source/config/fragments/filters/StarOffice_XML__Draw__ui.xcu
new file mode 100644
index 000000000000..32de3a5842a3
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarOffice_XML__Draw__ui.xcu
@@ -0,0 +1,6 @@
+ <node oor:name="StarOffice XML (Draw)">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">%productname% %formatversion% Drawing</value>
+ <value xml:lang="x-translate">%productname% %formatversion% Drawing</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarOffice_XML__Impress_.xcu b/filter/source/config/fragments/filters/StarOffice_XML__Impress_.xcu
new file mode 100644
index 000000000000..5912555177d1
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarOffice_XML__Impress_.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="StarOffice XML (Impress)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT TEMPLATE OWN ALIEN PREFERRED ENCRYPTION</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value>XML</value></prop>
+ <prop oor:name="FileFormatVersion"><value>6200</value></prop>
+ <prop oor:name="Type"><value>impress_StarOffice_XML_Impress</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.presentation.PresentationDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarOffice_XML__Impress__ui.xcu b/filter/source/config/fragments/filters/StarOffice_XML__Impress__ui.xcu
new file mode 100644
index 000000000000..83adfb8269dd
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarOffice_XML__Impress__ui.xcu
@@ -0,0 +1,6 @@
+ <node oor:name="StarOffice XML (Impress)">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">%productname% %formatversion% Presentation</value>
+ <value xml:lang="x-translate">%productname% %formatversion% Presentation</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarOffice_XML__Math_.xcu b/filter/source/config/fragments/filters/StarOffice_XML__Math_.xcu
new file mode 100644
index 000000000000..282bff7448ed
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarOffice_XML__Math_.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="StarOffice XML (Math)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT TEMPLATE OWN ALIEN ENCRYPTION</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="FileFormatVersion"><value>6200</value></prop>
+ <prop oor:name="Type"><value>math_StarOffice_XML_Math</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.formula.FormulaProperties</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarOffice_XML__Math__ui.xcu b/filter/source/config/fragments/filters/StarOffice_XML__Math__ui.xcu
new file mode 100644
index 000000000000..57315a718777
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarOffice_XML__Math__ui.xcu
@@ -0,0 +1,6 @@
+ <node oor:name="StarOffice XML (Math)">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">%productname% %formatversion% Formula</value>
+ <value xml:lang="x-translate">%productname% %formatversion% Formula</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarOffice_XML__Writer_.xcu b/filter/source/config/fragments/filters/StarOffice_XML__Writer_.xcu
new file mode 100644
index 000000000000..c86b1d3deda7
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarOffice_XML__Writer_.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="StarOffice XML (Writer)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT TEMPLATE OWN ALIEN PREFERRED ENCRYPTION</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value>CXML</value></prop>
+ <prop oor:name="FileFormatVersion"><value>6200</value></prop>
+ <prop oor:name="Type"><value>writer_StarOffice_XML_Writer</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarOffice_XML__Writer__ui.xcu b/filter/source/config/fragments/filters/StarOffice_XML__Writer__ui.xcu
new file mode 100644
index 000000000000..20be1b1e1c04
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarOffice_XML__Writer__ui.xcu
@@ -0,0 +1,6 @@
+ <node oor:name="StarOffice XML (Writer)">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">%productname% %formatversion% Text Document</value>
+ <value xml:lang="x-translate">%productname% %formatversion% Text Document</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarWriter_1_0.xcu b/filter/source/config/fragments/filters/StarWriter_1_0.xcu
new file mode 100644
index 000000000000..23c6715f728b
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarWriter_1_0.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="StarWriter 1.0" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>SWG1</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">StarWriter 1.0</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_StarWriter_10</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarWriter_2_0.xcu b/filter/source/config/fragments/filters/StarWriter_2_0.xcu
new file mode 100644
index 000000000000..2617a6f330de
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarWriter_2_0.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="StarWriter 2.0" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT TEMPLATE ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>SWG</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">StarWriter 2.0</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_StarWriter_20</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarWriter_3_0.xcu b/filter/source/config/fragments/filters/StarWriter_3_0.xcu
new file mode 100644
index 000000000000..6942622a7a14
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarWriter_3_0.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="StarWriter 3.0" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT TEMPLATE OWN ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>CSW3</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">StarWriter 3.0</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>3450</value></prop>
+ <prop oor:name="Type"><value>writer_StarWriter_30</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarWriter_3_0_Vorlage_Template.xcu b/filter/source/config/fragments/filters/StarWriter_3_0_Vorlage_Template.xcu
new file mode 100644
index 000000000000..7902ef2181b8
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarWriter_3_0_Vorlage_Template.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="StarWriter 3.0 Vorlage/Template" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT TEMPLATE TEMPLATEPATH OWN ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>CSW3V</value></prop>
+ <prop oor:name="FileFormatVersion"><value>3450</value></prop>
+ <prop oor:name="Type"><value>writer_StarWriter_30_VorlageTemplate</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarWriter_3_0_Vorlage_Template_ui.xcu b/filter/source/config/fragments/filters/StarWriter_3_0_Vorlage_Template_ui.xcu
new file mode 100644
index 000000000000..a888cf6518d7
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarWriter_3_0_Vorlage_Template_ui.xcu
@@ -0,0 +1,6 @@
+ <node oor:name="StarWriter 3.0 Vorlage/Template">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">StarWriter 3.0 Template</value>
+ <value xml:lang="x-translate">StarWriter 3.0 Template</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarWriter_3_0__StarWriter_GlobalDocument_.xcu b/filter/source/config/fragments/filters/StarWriter_3_0__StarWriter_GlobalDocument_.xcu
new file mode 100644
index 000000000000..4c5b0aa89af8
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarWriter_3_0__StarWriter_GlobalDocument_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="StarWriter 3.0 (StarWriter/GlobalDocument)" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT TEMPLATE ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>CSW3</value></prop>
+ <prop oor:name="FileFormatVersion"><value>3450</value></prop>
+ <prop oor:name="Type"><value>writer_StarWriter_30</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.GlobalDocument</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">StarWriter 3.0</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarWriter_3_0__StarWriter_Web_.xcu b/filter/source/config/fragments/filters/StarWriter_3_0__StarWriter_Web_.xcu
new file mode 100644
index 000000000000..a68affbce5ea
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarWriter_3_0__StarWriter_Web_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="StarWriter 3.0 (StarWriter/Web)" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT TEMPLATE ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>CSW3</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">StarWriter 3.0 (%productname% Writer/Web)</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>3450</value></prop>
+ <prop oor:name="Type"><value>writer_StarWriter_30</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.WebDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarWriter_4_0.xcu b/filter/source/config/fragments/filters/StarWriter_4_0.xcu
new file mode 100644
index 000000000000..5c23ef96809c
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarWriter_4_0.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="StarWriter 4.0" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT TEMPLATE OWN ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>CSW4</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">StarWriter 4.0</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>3580</value></prop>
+ <prop oor:name="Type"><value>writer_StarWriter_40</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarWriter_4_0_GlobalDocument.xcu b/filter/source/config/fragments/filters/StarWriter_4_0_GlobalDocument.xcu
new file mode 100644
index 000000000000..3992a973d896
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarWriter_4_0_GlobalDocument.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="StarWriter 4.0/GlobalDocument" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT TEMPLATE OWN ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>CSW4</value></prop>
+ <prop oor:name="FileFormatVersion"><value>3580</value></prop>
+ <prop oor:name="Type"><value>writer_globaldocument_StarWriter_40GlobalDocument</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.GlobalDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarWriter_4_0_GlobalDocument_ui.xcu b/filter/source/config/fragments/filters/StarWriter_4_0_GlobalDocument_ui.xcu
new file mode 100644
index 000000000000..b1aafd2309bb
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarWriter_4_0_GlobalDocument_ui.xcu
@@ -0,0 +1,6 @@
+ <node oor:name="StarWriter 4.0/GlobalDocument">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">StarWriter 4.0 Master Document</value>
+ <value xml:lang="x-translate">StarWriter 4.0 Master Document</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarWriter_4_0_Vorlage_Template.xcu b/filter/source/config/fragments/filters/StarWriter_4_0_Vorlage_Template.xcu
new file mode 100644
index 000000000000..16feb8df0b3d
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarWriter_4_0_Vorlage_Template.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="StarWriter 4.0 Vorlage/Template" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT TEMPLATE TEMPLATEPATH OWN ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>CSW4V</value></prop>
+ <prop oor:name="FileFormatVersion"><value>3580</value></prop>
+ <prop oor:name="Type"><value>writer_StarWriter_40_VorlageTemplate</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarWriter_4_0_Vorlage_Template_ui.xcu b/filter/source/config/fragments/filters/StarWriter_4_0_Vorlage_Template_ui.xcu
new file mode 100644
index 000000000000..003c3274ca8a
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarWriter_4_0_Vorlage_Template_ui.xcu
@@ -0,0 +1,6 @@
+ <node oor:name="StarWriter 4.0 Vorlage/Template">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">StarWriter 4.0 Template</value>
+ <value xml:lang="x-translate">StarWriter 4.0 Template</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarWriter_4_0__StarWriter_GlobalDocument_.xcu b/filter/source/config/fragments/filters/StarWriter_4_0__StarWriter_GlobalDocument_.xcu
new file mode 100644
index 000000000000..9eff3b736f14
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarWriter_4_0__StarWriter_GlobalDocument_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="StarWriter 4.0 (StarWriter/GlobalDocument)" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT TEMPLATE ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>CSW4</value></prop>
+ <prop oor:name="FileFormatVersion"><value>3580</value></prop>
+ <prop oor:name="Type"><value>writer_StarWriter_40</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.GlobalDocument</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">StarWriter 4.0</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarWriter_4_0__StarWriter_Web_.xcu b/filter/source/config/fragments/filters/StarWriter_4_0__StarWriter_Web_.xcu
new file mode 100644
index 000000000000..04f97b796b6c
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarWriter_4_0__StarWriter_Web_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="StarWriter 4.0 (StarWriter/Web)" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT TEMPLATE ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>CSW4</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">StarWriter 4.0 (%productname% Writer/Web)</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>3580</value></prop>
+ <prop oor:name="Type"><value>writer_StarWriter_40</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.WebDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarWriter_5_0.xcu b/filter/source/config/fragments/filters/StarWriter_5_0.xcu
new file mode 100644
index 000000000000..4556fc72d8c8
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarWriter_5_0.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="StarWriter 5.0" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT TEMPLATE OWN ALIEN 3RDPARTYFILTER PREFERRED</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>CSW5</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">StarWriter 5.0</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>5050</value></prop>
+ <prop oor:name="Type"><value>writer_StarWriter_50</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarWriter_5_0_GlobalDocument.xcu b/filter/source/config/fragments/filters/StarWriter_5_0_GlobalDocument.xcu
new file mode 100644
index 000000000000..3604d7c828b8
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarWriter_5_0_GlobalDocument.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="StarWriter 5.0/GlobalDocument" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT TEMPLATE OWN ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>CSW5</value></prop>
+ <prop oor:name="FileFormatVersion"><value>5050</value></prop>
+ <prop oor:name="Type"><value>writer_globaldocument_StarWriter_50GlobalDocument</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.GlobalDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarWriter_5_0_GlobalDocument_ui.xcu b/filter/source/config/fragments/filters/StarWriter_5_0_GlobalDocument_ui.xcu
new file mode 100644
index 000000000000..912abc802244
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarWriter_5_0_GlobalDocument_ui.xcu
@@ -0,0 +1,6 @@
+ <node oor:name="StarWriter 5.0/GlobalDocument">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">StarWriter 5.0 Master Document</value>
+ <value xml:lang="x-translate">StarWriter 5.0 Master Document</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarWriter_5_0_Vorlage_Template.xcu b/filter/source/config/fragments/filters/StarWriter_5_0_Vorlage_Template.xcu
new file mode 100644
index 000000000000..c33a323126cc
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarWriter_5_0_Vorlage_Template.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="StarWriter 5.0 Vorlage/Template" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT TEMPLATE TEMPLATEPATH OWN ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>CSW5V</value></prop>
+ <prop oor:name="FileFormatVersion"><value>5050</value></prop>
+ <prop oor:name="Type"><value>writer_StarWriter_50_VorlageTemplate</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarWriter_5_0_Vorlage_Template_ui.xcu b/filter/source/config/fragments/filters/StarWriter_5_0_Vorlage_Template_ui.xcu
new file mode 100644
index 000000000000..caf14d0d308f
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarWriter_5_0_Vorlage_Template_ui.xcu
@@ -0,0 +1,6 @@
+ <node oor:name="StarWriter 5.0 Vorlage/Template">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">StarWriter 5.0 Template</value>
+ <value xml:lang="x-translate">StarWriter 5.0 Template</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarWriter_5_0__StarWriter_GlobalDocument_.xcu b/filter/source/config/fragments/filters/StarWriter_5_0__StarWriter_GlobalDocument_.xcu
new file mode 100644
index 000000000000..c5bef5aead6e
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarWriter_5_0__StarWriter_GlobalDocument_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="StarWriter 5.0 (StarWriter/GlobalDocument)" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT TEMPLATE ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>CSW5</value></prop>
+ <prop oor:name="FileFormatVersion"><value>5050</value></prop>
+ <prop oor:name="Type"><value>writer_StarWriter_50</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.GlobalDocument</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">StarWriter 5.0</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarWriter_5_0__StarWriter_Web_.xcu b/filter/source/config/fragments/filters/StarWriter_5_0__StarWriter_Web_.xcu
new file mode 100644
index 000000000000..35cf7c56746d
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarWriter_5_0__StarWriter_Web_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="StarWriter 5.0 (StarWriter/Web)" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT TEMPLATE ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>CSW5</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">StarWriter 5.0 (%productname% Writer/Web)</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>5050</value></prop>
+ <prop oor:name="Type"><value>writer_StarWriter_50</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.WebDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarWriter_DOS.xcu b/filter/source/config/fragments/filters/StarWriter_DOS.xcu
new file mode 100644
index 000000000000..493151f6f806
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarWriter_DOS.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="StarWriter DOS" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>SW6</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">StarWriter DOS</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_StarWriter_DOS</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarWriter_Web_4_0_Vorlage_Template.xcu b/filter/source/config/fragments/filters/StarWriter_Web_4_0_Vorlage_Template.xcu
new file mode 100644
index 000000000000..51367423c493
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarWriter_Web_4_0_Vorlage_Template.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="StarWriter/Web 4.0 Vorlage/Template" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT TEMPLATE TEMPLATEPATH OWN ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>CSW4VWEB</value></prop>
+ <prop oor:name="FileFormatVersion"><value>3580</value></prop>
+ <prop oor:name="Type"><value>writer_web_StarWriterWeb_40_VorlageTemplate</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.WebDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarWriter_Web_4_0_Vorlage_Template_ui.xcu b/filter/source/config/fragments/filters/StarWriter_Web_4_0_Vorlage_Template_ui.xcu
new file mode 100644
index 000000000000..3dd348296d40
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarWriter_Web_4_0_Vorlage_Template_ui.xcu
@@ -0,0 +1,6 @@
+ <node oor:name="StarWriter/Web 4.0 Vorlage/Template">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">StarWriter/Web 4.0 Template</value>
+ <value xml:lang="x-translate">StarWriter/Web 4.0 Template</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarWriter_Web_5_0_Vorlage_Template.xcu b/filter/source/config/fragments/filters/StarWriter_Web_5_0_Vorlage_Template.xcu
new file mode 100644
index 000000000000..2f696b08defa
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarWriter_Web_5_0_Vorlage_Template.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="StarWriter/Web 5.0 Vorlage/Template" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT TEMPLATE TEMPLATEPATH OWN ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>CSW5VWEB</value></prop>
+ <prop oor:name="FileFormatVersion"><value>5050</value></prop>
+ <prop oor:name="Type"><value>writer_web_StarWriterWeb_50_VorlageTemplate</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.WebDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/StarWriter_Web_5_0_Vorlage_Template_ui.xcu b/filter/source/config/fragments/filters/StarWriter_Web_5_0_Vorlage_Template_ui.xcu
new file mode 100644
index 000000000000..1d194cb4ac4c
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarWriter_Web_5_0_Vorlage_Template_ui.xcu
@@ -0,0 +1,6 @@
+ <node oor:name="StarWriter/Web 5.0 Vorlage/Template">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">StarWriter/Web 5.0 Template</value>
+ <value xml:lang="x-translate">StarWriter/Web 5.0 Template</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/T602Document.xcu b/filter/source/config/fragments/filters/T602Document.xcu
new file mode 100644
index 000000000000..544364913dff
--- /dev/null
+++ b/filter/source/config/fragments/filters/T602Document.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="T602Document" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN USESOPTIONS 3RDPARTYFILTER PREFERRED</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.Writer.T602ImportFilter</value></prop>
+ <prop oor:name="UserData"><value>602</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">T602 Document</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_T602_Document</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/TGA___Truevision_TARGA.xcu b/filter/source/config/fragments/filters/TGA___Truevision_TARGA.xcu
new file mode 100644
index 000000000000..48cd2ad8731a
--- /dev/null
+++ b/filter/source/config/fragments/filters/TGA___Truevision_TARGA.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="TGA - Truevision TARGA" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">TGA - Truevision Targa</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>tga_Truevision_TARGA</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/TIF___Tag_Image_File.xcu b/filter/source/config/fragments/filters/TIF___Tag_Image_File.xcu
new file mode 100644
index 000000000000..6ed47b00d6ef
--- /dev/null
+++ b/filter/source/config/fragments/filters/TIF___Tag_Image_File.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="TIF - Tag Image File" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">TIFF - Tagged Image File Format</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>tif_Tag_Image_File</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/Text.xcu b/filter/source/config/fragments/filters/Text.xcu
new file mode 100644
index 000000000000..ac11931b75db
--- /dev/null
+++ b/filter/source/config/fragments/filters/Text.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="Text" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT ALIEN PREFERRED</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value>TEXT</value></prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_Text</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/Text__StarWriter_Web_.xcu b/filter/source/config/fragments/filters/Text__StarWriter_Web_.xcu
new file mode 100644
index 000000000000..5161a52b99a7
--- /dev/null
+++ b/filter/source/config/fragments/filters/Text__StarWriter_Web_.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="Text (StarWriter/Web)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT ALIEN</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value>TEXT</value></prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_Text</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.WebDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/Text__StarWriter_Web__ui.xcu b/filter/source/config/fragments/filters/Text__StarWriter_Web__ui.xcu
new file mode 100644
index 000000000000..98175c30bf6f
--- /dev/null
+++ b/filter/source/config/fragments/filters/Text__StarWriter_Web__ui.xcu
@@ -0,0 +1,6 @@
+ <node oor:name="Text (StarWriter/Web)">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">Text (%productname% Writer/Web)</value>
+ <value xml:lang="x-translate">Text (%productname% Writer/Web)</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/Text___txt___csv__StarCalc_.xcu b/filter/source/config/fragments/filters/Text___txt___csv__StarCalc_.xcu
new file mode 100644
index 000000000000..69b4ff752f06
--- /dev/null
+++ b/filter/source/config/fragments/filters/Text___txt___csv__StarCalc_.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="Text - txt - csv (StarCalc)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT ALIEN USESOPTIONS</value></prop>
+ <prop oor:name="UIComponent"><value>com.sun.star.comp.Calc.FilterOptionsDialog</value></prop>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>calc_Text_txt_csv_StarCalc</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.sheet.SpreadsheetDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/Text___txt___csv__StarCalc__ui.xcu b/filter/source/config/fragments/filters/Text___txt___csv__StarCalc__ui.xcu
new file mode 100644
index 000000000000..7cf434011d1f
--- /dev/null
+++ b/filter/source/config/fragments/filters/Text___txt___csv__StarCalc__ui.xcu
@@ -0,0 +1,6 @@
+ <node oor:name="Text - txt - csv (StarCalc)">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">Text CSV</value>
+ <value xml:lang="x-translate">Text CSV</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/Text__encoded_.xcu b/filter/source/config/fragments/filters/Text__encoded_.xcu
new file mode 100644
index 000000000000..a0b19b9b32bb
--- /dev/null
+++ b/filter/source/config/fragments/filters/Text__encoded_.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="Text (encoded)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT ALIEN</value></prop>
+ <prop oor:name="UIComponent"><value>com.sun.star.comp.Writer.FilterOptionsDialog</value></prop>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value>TEXT_DLG</value></prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_Text_encoded</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/Text__encoded___StarWriter_GlobalDocument_.xcu b/filter/source/config/fragments/filters/Text__encoded___StarWriter_GlobalDocument_.xcu
new file mode 100644
index 000000000000..2c39de832bb6
--- /dev/null
+++ b/filter/source/config/fragments/filters/Text__encoded___StarWriter_GlobalDocument_.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="Text (encoded) (StarWriter/GlobalDocument)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT ALIEN</value></prop>
+ <prop oor:name="UIComponent"><value>com.sun.star.comp.Writer.FilterOptionsDialog</value></prop>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value>TEXT_DLG</value></prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_Text</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.GlobalDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/Text__encoded___StarWriter_GlobalDocument__ui.xcu b/filter/source/config/fragments/filters/Text__encoded___StarWriter_GlobalDocument__ui.xcu
new file mode 100644
index 000000000000..9d2bd9d86e85
--- /dev/null
+++ b/filter/source/config/fragments/filters/Text__encoded___StarWriter_GlobalDocument__ui.xcu
@@ -0,0 +1,6 @@
+ <node oor:name="Text (encoded) (StarWriter/GlobalDocument)">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">Text Encoded (%productname% Master Document)</value>
+ <value xml:lang="x-translate">Text Encoded (%productname% Master Document)</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/Text__encoded___StarWriter_Web_.xcu b/filter/source/config/fragments/filters/Text__encoded___StarWriter_Web_.xcu
new file mode 100644
index 000000000000..f8ced3003be1
--- /dev/null
+++ b/filter/source/config/fragments/filters/Text__encoded___StarWriter_Web_.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="Text (encoded) (StarWriter/Web)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT ALIEN</value></prop>
+ <prop oor:name="UIComponent"><value>com.sun.star.comp.Writer.FilterOptionsDialog</value></prop>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value>TEXT_DLG</value></prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_Text</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.WebDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/Text__encoded___StarWriter_Web__ui.xcu b/filter/source/config/fragments/filters/Text__encoded___StarWriter_Web__ui.xcu
new file mode 100644
index 000000000000..83e261a77147
--- /dev/null
+++ b/filter/source/config/fragments/filters/Text__encoded___StarWriter_Web__ui.xcu
@@ -0,0 +1,6 @@
+ <node oor:name="Text (encoded) (StarWriter/Web)">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">Text Encoded (%productname% Writer/Web)</value>
+ <value xml:lang="x-translate">Text Encoded (%productname% Writer/Web)</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/Text__encoded__ui.xcu b/filter/source/config/fragments/filters/Text__encoded__ui.xcu
new file mode 100644
index 000000000000..0ed1b78d615c
--- /dev/null
+++ b/filter/source/config/fragments/filters/Text__encoded__ui.xcu
@@ -0,0 +1,6 @@
+ <node oor:name="Text (encoded)">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">Text Encoded</value>
+ <value xml:lang="x-translate">Text Encoded</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/Text_ui.xcu b/filter/source/config/fragments/filters/Text_ui.xcu
new file mode 100644
index 000000000000..f0d198f8301b
--- /dev/null
+++ b/filter/source/config/fragments/filters/Text_ui.xcu
@@ -0,0 +1,6 @@
+ <node oor:name="Text">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">Text</value>
+ <value xml:lang="x-translate">Text</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/Total_Word__W4W_.xcu b/filter/source/config/fragments/filters/Total_Word__W4W_.xcu
new file mode 100644
index 000000000000..e50e38a6d0d7
--- /dev/null
+++ b/filter/source/config/fragments/filters/Total_Word__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="Total Word (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W14_1</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Total Word</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_Total_Word_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/UOF_presentation.xcu b/filter/source/config/fragments/filters/UOF_presentation.xcu
new file mode 100644
index 000000000000..f62c623c9af5
--- /dev/null
+++ b/filter/source/config/fragments/filters/UOF_presentation.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="UOF presentation" oor:op="replace">
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>Unified_Office_Format_presentation</value></prop>
+ <prop oor:name="DocumentService"><value>com.sun.star.presentation.PresentationDocument</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="UserData"><value oor:separator=",">com.sun.star.documentconversion.XSLTFilter,,com.sun.star.comp.Impress.XMLOasisImporter,com.sun.star.comp.Impress.XMLOasisExporter,../share/xslt/import/uof/uof2odf_presentation.xsl,../share/xslt/export/uof/odf2uof_presentation.xsl</value></prop>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.Writer.XmlFilterAdaptor</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="UIName">
+ <value>Unified Office Format presentation</value>
+ </prop>
+ <prop oor:name="Flags"><value>IMPORT EXPORT ALIEN 3RDPARTYFILTER</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/UOF_presentation_ui.xcu b/filter/source/config/fragments/filters/UOF_presentation_ui.xcu
new file mode 100644
index 000000000000..46e822cacba6
--- /dev/null
+++ b/filter/source/config/fragments/filters/UOF_presentation_ui.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="UOF presentation" oor:op="replace">
+ <prop oor:name="UIName">
+ <value xml:lang="el">Unified Office Format presentation</value>
+ <value xml:lang="en-US">Unified Office Format presentation</value>
+ <value xml:lang="hu">Unified Office Format presentation</value>
+ <value xml:lang="cs">Unified Office Format presentation</value>
+ <value xml:lang="sk">Unified Office Format presentation</value>
+ <value xml:lang="sl">Unified Office Format presentation</value>
+ <value xml:lang="nl">Unified Office Format presentation</value>
+ <value xml:lang="da">Unified Office Format presentation</value>
+ <value xml:lang="de">Unified Office Format presentation</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/UOF_spreadsheet.xcu b/filter/source/config/fragments/filters/UOF_spreadsheet.xcu
new file mode 100644
index 000000000000..549ed79ac2e0
--- /dev/null
+++ b/filter/source/config/fragments/filters/UOF_spreadsheet.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="UOF spreadsheet" oor:op="replace">
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>Unified_Office_Format_spreadsheet</value></prop>
+ <prop oor:name="DocumentService"><value>com.sun.star.sheet.SpreadsheetDocument</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="UserData"><value oor:separator=",">com.sun.star.documentconversion.XSLTFilter,,com.sun.star.comp.Calc.XMLOasisImporter,com.sun.star.comp.Calc.XMLOasisExporter,../share/xslt/import/uof/uof2odf_spreadsheet.xsl,../share/xslt/export/uof/odf2uof_spreadsheet.xsl</value></prop>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.Writer.XmlFilterAdaptor</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="UIName">
+ <value>Unified Office Format spreadsheet</value>
+ </prop>
+ <prop oor:name="Flags"><value>IMPORT EXPORT ALIEN 3RDPARTYFILTER</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/UOF_spreadsheet_ui.xcu b/filter/source/config/fragments/filters/UOF_spreadsheet_ui.xcu
new file mode 100644
index 000000000000..1b2a88b0d868
--- /dev/null
+++ b/filter/source/config/fragments/filters/UOF_spreadsheet_ui.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="UOF spreadsheet" oor:op="replace">
+ <prop oor:name="UIName">
+ <value xml:lang="el">Unified Office Format spreadsheet</value>
+ <value xml:lang="en-US">Unified Office Format spreadsheet</value>
+ <value xml:lang="hu">Unified Office Format spreadsheet</value>
+ <value xml:lang="cs">Unified Office Format spreadsheet</value>
+ <value xml:lang="sk">Unified Office Format spreadsheet</value>
+ <value xml:lang="sl">Unified Office Format spreadsheet</value>
+ <value xml:lang="nl">Unified Office Format spreadsheet</value>
+ <value xml:lang="da">Unified Office Format spreadsheet</value>
+ <value xml:lang="de">Unified Office Format spreadsheet</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/UOF_text.xcu b/filter/source/config/fragments/filters/UOF_text.xcu
new file mode 100644
index 000000000000..3dd6f2bb3273
--- /dev/null
+++ b/filter/source/config/fragments/filters/UOF_text.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="UOF text" oor:op="replace">
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>Unified_Office_Format_text</value></prop>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="UserData"><value oor:separator=",">com.sun.star.documentconversion.XSLTFilter,,com.sun.star.comp.Writer.XMLOasisImporter,com.sun.star.comp.Writer.XMLOasisExporter,../share/xslt/import/uof/uof2odf_text.xsl,../share/xslt/export/uof/odf2uof_text.xsl</value></prop>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.Writer.XmlFilterAdaptor</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="UIName">
+ <value>Unified Office Format text</value>
+ </prop>
+ <prop oor:name="Flags"><value>IMPORT EXPORT ALIEN 3RDPARTYFILTER</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/UOF_text_ui.xcu b/filter/source/config/fragments/filters/UOF_text_ui.xcu
new file mode 100644
index 000000000000..bf7170a68a9d
--- /dev/null
+++ b/filter/source/config/fragments/filters/UOF_text_ui.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="UOF text" oor:op="replace">
+ <prop oor:name="UIName">
+ <value xml:lang="el">Unified Office Format text</value>
+ <value xml:lang="en-US">Unified Office Format text</value>
+ <value xml:lang="hu">Unified Office Format text</value>
+ <value xml:lang="cs">Unified Office Format text</value>
+ <value xml:lang="sk">Unified Office Format text</value>
+ <value xml:lang="sl">Unified Office Format text</value>
+ <value xml:lang="nl">Unified Office Format text</value>
+ <value xml:lang="da">Unified Office Format text</value>
+ <value xml:lang="de">Unified Office Format text</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/Uniplex_V7_V8__W4W_.xcu b/filter/source/config/fragments/filters/Uniplex_V7_V8__W4W_.xcu
new file mode 100644
index 000000000000..ca42d4f81c78
--- /dev/null
+++ b/filter/source/config/fragments/filters/Uniplex_V7_V8__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="Uniplex V7-V8 (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W101_0</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Uniplex V7-V8</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_Uniplex_V7_V8_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/Uniplex_onGO__W4W_.xcu b/filter/source/config/fragments/filters/Uniplex_onGO__W4W_.xcu
new file mode 100644
index 000000000000..58f5c1ce4648
--- /dev/null
+++ b/filter/source/config/fragments/filters/Uniplex_onGO__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="Uniplex onGO (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W37_2</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Uniplex onGO</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_Uniplex_onGO_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/VolksWriter_3_and_4__W4W_.xcu b/filter/source/config/fragments/filters/VolksWriter_3_and_4__W4W_.xcu
new file mode 100644
index 000000000000..61c25a47ede2
--- /dev/null
+++ b/filter/source/config/fragments/filters/VolksWriter_3_and_4__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="VolksWriter 3 and 4 (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W14_0</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">VolksWriter 3 and 4</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_VolksWriter_3_and_4_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/VolksWriter_Deluxe__W4W_.xcu b/filter/source/config/fragments/filters/VolksWriter_Deluxe__W4W_.xcu
new file mode 100644
index 000000000000..ac95b135b0ad
--- /dev/null
+++ b/filter/source/config/fragments/filters/VolksWriter_Deluxe__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="VolksWriter Deluxe (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W11_0</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">VolksWriter Deluxe</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_VolksWriter_Deluxe_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/WITA__W4W_.xcu b/filter/source/config/fragments/filters/WITA__W4W_.xcu
new file mode 100644
index 000000000000..2f27c4041107
--- /dev/null
+++ b/filter/source/config/fragments/filters/WITA__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="WITA (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W34_0</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">WITA</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_WITA_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/WMF___MS_Windows_Metafile.xcu b/filter/source/config/fragments/filters/WMF___MS_Windows_Metafile.xcu
new file mode 100644
index 000000000000..2210b3afbf8c
--- /dev/null
+++ b/filter/source/config/fragments/filters/WMF___MS_Windows_Metafile.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="WMF - MS Windows Metafile" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">WMF - Windows Metafile</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>wmf_MS_Windows_Metafile</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/Wang_II_SWP__W4W_.xcu b/filter/source/config/fragments/filters/Wang_II_SWP__W4W_.xcu
new file mode 100644
index 000000000000..70f1d1967eae
--- /dev/null
+++ b/filter/source/config/fragments/filters/Wang_II_SWP__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="Wang II SWP (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W88_0</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Wang II SWP</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_Wang_II_SWP_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/Wang_PC__W4W_.xcu b/filter/source/config/fragments/filters/Wang_PC__W4W_.xcu
new file mode 100644
index 000000000000..ae9e3682ce5f
--- /dev/null
+++ b/filter/source/config/fragments/filters/Wang_PC__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="Wang PC (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W26_0</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Wang PC</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_Wang_PC_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/Wang_WP_Plus__W4W_.xcu b/filter/source/config/fragments/filters/Wang_WP_Plus__W4W_.xcu
new file mode 100644
index 000000000000..fc042b041d8b
--- /dev/null
+++ b/filter/source/config/fragments/filters/Wang_WP_Plus__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="Wang WP Plus (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W89_0</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Wang WP Plus</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_Wang_WP_Plus_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/Win_Write_3_x__W4W_.xcu b/filter/source/config/fragments/filters/Win_Write_3_x__W4W_.xcu
new file mode 100644
index 000000000000..fcbeeac669f2
--- /dev/null
+++ b/filter/source/config/fragments/filters/Win_Write_3_x__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="Win Write 3.x (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W43_0</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Win Write 3.x</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_Win_Write_3x_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/WiziWord_3_0__W4W_.xcu b/filter/source/config/fragments/filters/WiziWord_3_0__W4W_.xcu
new file mode 100644
index 000000000000..76ce9136fb54
--- /dev/null
+++ b/filter/source/config/fragments/filters/WiziWord_3_0__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="WiziWord 3.0 (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W47_0</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">WiziWord 3.0</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_WiziWord_30_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/WordPerfect.xcu b/filter/source/config/fragments/filters/WordPerfect.xcu
new file mode 100644
index 000000000000..0683be1dc48a
--- /dev/null
+++ b/filter/source/config/fragments/filters/WordPerfect.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="WordPerfect" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN USESOPTIONS 3RDPARTYFILTER PREFERRED</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.Writer.WordPerfectImportFilter</value></prop>
+ <prop oor:name="UserData"><value>WPD</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">WordPerfect Document</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_WordPerfect_Document</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/WordPerfect_4_1__W4W_.xcu b/filter/source/config/fragments/filters/WordPerfect_4_1__W4W_.xcu
new file mode 100644
index 000000000000..bd84d6d44af4
--- /dev/null
+++ b/filter/source/config/fragments/filters/WordPerfect_4_1__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="WordPerfect 4.1 (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W06_0</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">WordPerfect 4.1</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_WordPerfect_41_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/WordPerfect_4_2__W4W_.xcu b/filter/source/config/fragments/filters/WordPerfect_4_2__W4W_.xcu
new file mode 100644
index 000000000000..b923c2f4b221
--- /dev/null
+++ b/filter/source/config/fragments/filters/WordPerfect_4_2__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="WordPerfect 4.2 (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W06_1</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">WordPerfect 4.2</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_WordPerfect_42_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/WordPerfect_5_0__W4W_.xcu b/filter/source/config/fragments/filters/WordPerfect_5_0__W4W_.xcu
new file mode 100644
index 000000000000..7c95fcfd0003
--- /dev/null
+++ b/filter/source/config/fragments/filters/WordPerfect_5_0__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="WordPerfect 5.0 (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W07_0</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">WordPerfect 5.0</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_WordPerfect_50_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/WordPerfect_5_1__W4W_.xcu b/filter/source/config/fragments/filters/WordPerfect_5_1__W4W_.xcu
new file mode 100644
index 000000000000..2b5447c85585
--- /dev/null
+++ b/filter/source/config/fragments/filters/WordPerfect_5_1__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="WordPerfect 5.1 (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W07_1</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">WordPerfect 5.1</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_WordPerfect_51_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/WordPerfect_6_0__W4W_.xcu b/filter/source/config/fragments/filters/WordPerfect_6_0__W4W_.xcu
new file mode 100644
index 000000000000..5fb7baa804d5
--- /dev/null
+++ b/filter/source/config/fragments/filters/WordPerfect_6_0__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="WordPerfect 6.0 (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W48_0</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">WordPerfect 6.0</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_WordPerfect_60_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/WordPerfect_6_1__W4W_.xcu b/filter/source/config/fragments/filters/WordPerfect_6_1__W4W_.xcu
new file mode 100644
index 000000000000..d349e1002499
--- /dev/null
+++ b/filter/source/config/fragments/filters/WordPerfect_6_1__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="WordPerfect 6.1 (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W48_1</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">WordPerfect 6.1</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_WordPerfect_61_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/WordPerfect_Mac_1__W4W_.xcu b/filter/source/config/fragments/filters/WordPerfect_Mac_1__W4W_.xcu
new file mode 100644
index 000000000000..5da63256533e
--- /dev/null
+++ b/filter/source/config/fragments/filters/WordPerfect_Mac_1__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="WordPerfect Mac 1 (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W59_0</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">WordPerfect Mac 1</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_WordPerfect_Mac_1_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/WordPerfect_Mac_2__W4W_.xcu b/filter/source/config/fragments/filters/WordPerfect_Mac_2__W4W_.xcu
new file mode 100644
index 000000000000..04dc9fdb1449
--- /dev/null
+++ b/filter/source/config/fragments/filters/WordPerfect_Mac_2__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="WordPerfect Mac 2 (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W60_0</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">WordPerfect Mac 2</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_WordPerfect_Mac_2_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/WordPerfect_Mac_3__W4W_.xcu b/filter/source/config/fragments/filters/WordPerfect_Mac_3__W4W_.xcu
new file mode 100644
index 000000000000..7768461689fd
--- /dev/null
+++ b/filter/source/config/fragments/filters/WordPerfect_Mac_3__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="WordPerfect Mac 3 (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W60_1</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">WordPerfect Mac 3</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_WordPerfect_Mac_3_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/WordPerfect__Win__5_1_5_2__W4W_.xcu b/filter/source/config/fragments/filters/WordPerfect__Win__5_1_5_2__W4W_.xcu
new file mode 100644
index 000000000000..9d85af7225e6
--- /dev/null
+++ b/filter/source/config/fragments/filters/WordPerfect__Win__5_1_5_2__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="WordPerfect (Win) 5.1-5.2 (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W07_1</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">WordPerfect (Win) 5.1-5.2</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_WordPerfect_Win_51_52_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/WordPerfect__Win__6_0__W4W_.xcu b/filter/source/config/fragments/filters/WordPerfect__Win__6_0__W4W_.xcu
new file mode 100644
index 000000000000..5c3ceaa6e508
--- /dev/null
+++ b/filter/source/config/fragments/filters/WordPerfect__Win__6_0__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="WordPerfect (Win) 6.0 (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W48_0</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">WordPerfect (Win) 6.0</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_WordPerfect_Win_60_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/WordPerfect__Win__6_1__W4W_.xcu b/filter/source/config/fragments/filters/WordPerfect__Win__6_1__W4W_.xcu
new file mode 100644
index 000000000000..f6f837a2dff1
--- /dev/null
+++ b/filter/source/config/fragments/filters/WordPerfect__Win__6_1__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="WordPerfect (Win) 6.1 (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W48_1</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">WordPerfect (Win) 6.1</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_WordPerfect_Win_61_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/WordPerfect__Win__7_0__W4W_.xcu b/filter/source/config/fragments/filters/WordPerfect__Win__7_0__W4W_.xcu
new file mode 100644
index 000000000000..5af0da68364b
--- /dev/null
+++ b/filter/source/config/fragments/filters/WordPerfect__Win__7_0__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="WordPerfect (Win) 7.0 (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W48_2</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">WordPerfect (Win) 7.0</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_WordPerfect_Win_70_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/WordStar_2000_Rel__3_0__W4W_.xcu b/filter/source/config/fragments/filters/WordStar_2000_Rel__3_0__W4W_.xcu
new file mode 100644
index 000000000000..ede22402b842
--- /dev/null
+++ b/filter/source/config/fragments/filters/WordStar_2000_Rel__3_0__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="WordStar 2000 Rel. 3.0 (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W09_0</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">WordStar 2000 Rel. 3.0</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_WordStar_2000_Rel_30_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/WordStar_2000_Rel__3_5__W4W_.xcu b/filter/source/config/fragments/filters/WordStar_2000_Rel__3_5__W4W_.xcu
new file mode 100644
index 000000000000..0d942c7bac3f
--- /dev/null
+++ b/filter/source/config/fragments/filters/WordStar_2000_Rel__3_5__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="WordStar 2000 Rel. 3.5 (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W09_1</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">WordStar 2000 Rel. 3.5</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_WordStar_2000_Rel_35_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/WordStar_3_3x__W4W_.xcu b/filter/source/config/fragments/filters/WordStar_3_3x__W4W_.xcu
new file mode 100644
index 000000000000..8478b7c8dcc7
--- /dev/null
+++ b/filter/source/config/fragments/filters/WordStar_3_3x__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="WordStar 3.3x (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W04_0</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">WordStar 3.3x</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_WordStar_33x_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/WordStar_3_45__W4W_.xcu b/filter/source/config/fragments/filters/WordStar_3_45__W4W_.xcu
new file mode 100644
index 000000000000..38d7f827624e
--- /dev/null
+++ b/filter/source/config/fragments/filters/WordStar_3_45__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="WordStar 3.45 (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W04_1</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">WordStar 3.45</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_WordStar_345_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/WordStar_4_0___W4W_.xcu b/filter/source/config/fragments/filters/WordStar_4_0___W4W_.xcu
new file mode 100644
index 000000000000..2c7910f7d341
--- /dev/null
+++ b/filter/source/config/fragments/filters/WordStar_4_0___W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="WordStar 4.0 (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W04_2</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">WordStar 4.0</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_WordStar_40_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/WordStar_5_0___W4W_.xcu b/filter/source/config/fragments/filters/WordStar_5_0___W4W_.xcu
new file mode 100644
index 000000000000..94444b0a424b
--- /dev/null
+++ b/filter/source/config/fragments/filters/WordStar_5_0___W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="WordStar 5.0 (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W04_3</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">WordStar 5.0</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_WordStar_50_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/WordStar_5_5___W4W_.xcu b/filter/source/config/fragments/filters/WordStar_5_5___W4W_.xcu
new file mode 100644
index 000000000000..e3714d13fde5
--- /dev/null
+++ b/filter/source/config/fragments/filters/WordStar_5_5___W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="WordStar 5.5 (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W04_4</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">WordStar 5.5</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_WordStar_55_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/WordStar_6_0___W4W_.xcu b/filter/source/config/fragments/filters/WordStar_6_0___W4W_.xcu
new file mode 100644
index 000000000000..08716c85cc62
--- /dev/null
+++ b/filter/source/config/fragments/filters/WordStar_6_0___W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="WordStar 6.0 (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W04_5</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">WordStar 6.0</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_WordStar_60_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/WordStar_7_0___W4W_.xcu b/filter/source/config/fragments/filters/WordStar_7_0___W4W_.xcu
new file mode 100644
index 000000000000..a67aefdc87a8
--- /dev/null
+++ b/filter/source/config/fragments/filters/WordStar_7_0___W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="WordStar 7.0 (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W04_6</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">WordStar 7.0 </value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_WordStar_70_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/WordStar__Win__1_x_2_0__W4W_.xcu b/filter/source/config/fragments/filters/WordStar__Win__1_x_2_0__W4W_.xcu
new file mode 100644
index 000000000000..ac46209420a5
--- /dev/null
+++ b/filter/source/config/fragments/filters/WordStar__Win__1_x_2_0__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="WordStar (Win) 1.x-2.0 (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W37_1</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">WordStar (Win) 1.x-2.0</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_WordStar_Win_1x_20_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/WriteNow_3_0__Macintosh___W4W_.xcu b/filter/source/config/fragments/filters/WriteNow_3_0__Macintosh___W4W_.xcu
new file mode 100644
index 000000000000..4d4a9fe623c7
--- /dev/null
+++ b/filter/source/config/fragments/filters/WriteNow_3_0__Macintosh___W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="WriteNow 3.0 (Macintosh) (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W62_0</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">WriteNow 3.0 (Macintosh)</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_WriteNow_30_Macintosh_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/Writing_Assistant__W4W_.xcu b/filter/source/config/fragments/filters/Writing_Assistant__W4W_.xcu
new file mode 100644
index 000000000000..8673c1a98a63
--- /dev/null
+++ b/filter/source/config/fragments/filters/Writing_Assistant__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="Writing Assistant (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W13_0</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Writing Assistant</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_Writing_Assistant_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/XBM___X_Consortium.xcu b/filter/source/config/fragments/filters/XBM___X_Consortium.xcu
new file mode 100644
index 000000000000..04aa82ce974e
--- /dev/null
+++ b/filter/source/config/fragments/filters/XBM___X_Consortium.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="XBM - X-Consortium" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">XBM - X Bitmap</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>xbm_X_Consortium</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/XEROX_XIF_5_0__Illustrator___W4W_.xcu b/filter/source/config/fragments/filters/XEROX_XIF_5_0__Illustrator___W4W_.xcu
new file mode 100644
index 000000000000..ee10136d54bf
--- /dev/null
+++ b/filter/source/config/fragments/filters/XEROX_XIF_5_0__Illustrator___W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="XEROX XIF 5.0 (Illustrator) (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W103_2</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">XEROX XIF 5.0 (Illustrator)</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_XEROX_XIF_50_Illustrator_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/XEROX_XIF_5_0__W4W_.xcu b/filter/source/config/fragments/filters/XEROX_XIF_5_0__W4W_.xcu
new file mode 100644
index 000000000000..4f647eff5641
--- /dev/null
+++ b/filter/source/config/fragments/filters/XEROX_XIF_5_0__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="XEROX XIF 5.0 (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W103_0</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">XEROX XIF 5.0</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_XEROX_XIF_50_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/XEROX_XIF_6_0__Color_Bitmap___W4W_.xcu b/filter/source/config/fragments/filters/XEROX_XIF_6_0__Color_Bitmap___W4W_.xcu
new file mode 100644
index 000000000000..cc2648a980e7
--- /dev/null
+++ b/filter/source/config/fragments/filters/XEROX_XIF_6_0__Color_Bitmap___W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="XEROX XIF 6.0 (Color Bitmap) (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W103_4</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">XEROX XIF 6.0 (Color Bitmap)</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_XEROX_XIF_60_Color_Bitmap_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/XEROX_XIF_6_0__Res_Graphic___W4W_.xcu b/filter/source/config/fragments/filters/XEROX_XIF_6_0__Res_Graphic___W4W_.xcu
new file mode 100644
index 000000000000..60501f505e06
--- /dev/null
+++ b/filter/source/config/fragments/filters/XEROX_XIF_6_0__Res_Graphic___W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="XEROX XIF 6.0 (Res Graphic) (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W103_8</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">XEROX XIF 6.0 (Res Graphic)</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_XEROX_XIF_60_Res_Graphic_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/XHTML_Calc_File.xcu b/filter/source/config/fragments/filters/XHTML_Calc_File.xcu
new file mode 100644
index 000000000000..60486621ec5c
--- /dev/null
+++ b/filter/source/config/fragments/filters/XHTML_Calc_File.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="XHTML Calc File" oor:op="replace">
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>XHTML_File</value></prop>
+ <prop oor:name="DocumentService"><value>com.sun.star.sheet.SpreadsheetDocument</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="UserData"><value oor:separator=",">com.sun.star.documentconversion.XSLTFilter,,com.sun.star.comp.Calc.XMLOasisImporter,com.sun.star.comp.Calc.XMLOasisExporter,,../share/xslt/export/xhtml/opendoc2xhtml.xsl</value></prop>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.Writer.XmlFilterAdaptor</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="UIName">
+ <value>XHTML</value>
+ </prop>
+ <prop oor:name="Flags"><value>EXPORT ALIEN 3RDPARTYFILTER</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/XHTML_Draw_File.xcu b/filter/source/config/fragments/filters/XHTML_Draw_File.xcu
new file mode 100644
index 000000000000..fe7aa6e85773
--- /dev/null
+++ b/filter/source/config/fragments/filters/XHTML_Draw_File.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="XHTML Draw File" oor:op="replace">
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>XHTML_File</value></prop>
+ <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="UserData"><value oor:separator=",">com.sun.star.documentconversion.XSLTFilter,,com.sun.star.comp.Draw.XMLOasisImporter,com.sun.star.comp.Draw.XMLOasisExporter,,../share/xslt/export/xhtml/opendoc2xhtml.xsl</value></prop>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.Writer.XmlFilterAdaptor</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="UIName">
+ <value>XHTML</value>
+ </prop>
+ <prop oor:name="Flags"><value>EXPORT ALIEN 3RDPARTYFILTER</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/XHTML_Impress_File.xcu b/filter/source/config/fragments/filters/XHTML_Impress_File.xcu
new file mode 100644
index 000000000000..cdec23746cd0
--- /dev/null
+++ b/filter/source/config/fragments/filters/XHTML_Impress_File.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="XHTML Impress File" oor:op="replace">
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>XHTML_File</value></prop>
+ <prop oor:name="DocumentService"><value>com.sun.star.presentation.PresentationDocument</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="UserData"><value oor:separator=",">com.sun.star.documentconversion.XSLTFilter,,com.sun.star.comp.Impress.XMLOasisImporter,com.sun.star.comp.Impress.XMLOasisExporter,,../share/xslt/export/xhtml/opendoc2xhtml.xsl</value></prop>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.Writer.XmlFilterAdaptor</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="UIName">
+ <value>XHTML</value>
+ </prop>
+ <prop oor:name="Flags"><value>EXPORT ALIEN 3RDPARTYFILTER</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/XHTML_Writer_File.xcu b/filter/source/config/fragments/filters/XHTML_Writer_File.xcu
new file mode 100644
index 000000000000..32d954ec52c6
--- /dev/null
+++ b/filter/source/config/fragments/filters/XHTML_Writer_File.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="XHTML Writer File" oor:op="replace">
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>XHTML_File</value></prop>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="UserData"><value oor:separator=",">com.sun.star.documentconversion.XSLTFilter,,com.sun.star.comp.Writer.XMLOasisImporter,com.sun.star.comp.Writer.XMLOasisExporter,,../share/xslt/export/xhtml/opendoc2xhtml.xsl,,true</value></prop>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.Writer.XmlFilterAdaptor</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="UIName">
+ <value>XHTML</value>
+ </prop>
+ <prop oor:name="Flags"><value>EXPORT ALIEN 3RDPARTYFILTER</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/XPM.xcu b/filter/source/config/fragments/filters/XPM.xcu
new file mode 100644
index 000000000000..f4b54ea308ef
--- /dev/null
+++ b/filter/source/config/fragments/filters/XPM.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="XPM" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">XPM - X PixMap</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>xpm_XPM</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/XyWrite_III___W4W_.xcu b/filter/source/config/fragments/filters/XyWrite_III___W4W_.xcu
new file mode 100644
index 000000000000..6cc42a840f22
--- /dev/null
+++ b/filter/source/config/fragments/filters/XyWrite_III___W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="XyWrite III ( W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W17_0</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">XyWrite III</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_XyWrite_III_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/XyWrite_III____W4W_.xcu b/filter/source/config/fragments/filters/XyWrite_III____W4W_.xcu
new file mode 100644
index 000000000000..d00ce5ef1294
--- /dev/null
+++ b/filter/source/config/fragments/filters/XyWrite_III____W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="XyWrite III+ ( W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W17_1</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">XyWrite III+</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_XyWrite_IIIP_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/XyWrite_IV__W4W_.xcu b/filter/source/config/fragments/filters/XyWrite_IV__W4W_.xcu
new file mode 100644
index 000000000000..b9b12ed0f855
--- /dev/null
+++ b/filter/source/config/fragments/filters/XyWrite_IV__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="XyWrite IV (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W17_4</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">XyWrite IV</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_XyWrite_IV_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/XyWrite_Sig___Win___W4W_.xcu b/filter/source/config/fragments/filters/XyWrite_Sig___Win___W4W_.xcu
new file mode 100644
index 000000000000..b9a773af5372
--- /dev/null
+++ b/filter/source/config/fragments/filters/XyWrite_Sig___Win___W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="XyWrite Sig. (Win) (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W17_3</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">XyWrite Sig. (Win)</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_XyWrite_Sig_Win_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/XyWrite_Signature__W4W_.xcu b/filter/source/config/fragments/filters/XyWrite_Signature__W4W_.xcu
new file mode 100644
index 000000000000..50730f7983cb
--- /dev/null
+++ b/filter/source/config/fragments/filters/XyWrite_Signature__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="XyWrite Signature (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W17_2</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">XyWrite Signature</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_XyWrite_Signature_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/XyWrite__Win__1_0__W4W_.xcu b/filter/source/config/fragments/filters/XyWrite__Win__1_0__W4W_.xcu
new file mode 100644
index 000000000000..e1154464e1e1
--- /dev/null
+++ b/filter/source/config/fragments/filters/XyWrite__Win__1_0__W4W_.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="XyWrite (Win) 1.0 (W4W)" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.office.BF_MigrateFilter</value></prop>
+ <prop oor:name="UserData"><value>W4W17_5</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">XyWrite (Win) 1.0</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_XyWrite_Win_10_W4W</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/calc8.xcu b/filter/source/config/fragments/filters/calc8.xcu
new file mode 100644
index 000000000000..1c77a96ad887
--- /dev/null
+++ b/filter/source/config/fragments/filters/calc8.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="calc8" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT TEMPLATE OWN DEFAULT ENCRYPTION PASSWORDTOMODIFY</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="FileFormatVersion"><value>6800</value></prop>
+ <prop oor:name="Type"><value>calc8</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.sheet.SpreadsheetDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/calc8_template.xcu b/filter/source/config/fragments/filters/calc8_template.xcu
new file mode 100644
index 000000000000..5b5c1d5c3d56
--- /dev/null
+++ b/filter/source/config/fragments/filters/calc8_template.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="calc8_template" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT TEMPLATE TEMPLATEPATH OWN ENCRYPTION PASSWORDTOMODIFY</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="FileFormatVersion"><value>6800</value></prop>
+ <prop oor:name="Type"><value>calc8_template</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.sheet.SpreadsheetDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/calc8_template_ui.xcu b/filter/source/config/fragments/filters/calc8_template_ui.xcu
new file mode 100644
index 000000000000..47c22a0544ff
--- /dev/null
+++ b/filter/source/config/fragments/filters/calc8_template_ui.xcu
@@ -0,0 +1,5 @@
+ <node oor:name="calc8_template">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">ODF Spreadsheet Template</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/calc8_ui.xcu b/filter/source/config/fragments/filters/calc8_ui.xcu
new file mode 100644
index 000000000000..57daf1f9a709
--- /dev/null
+++ b/filter/source/config/fragments/filters/calc8_ui.xcu
@@ -0,0 +1,5 @@
+ <node oor:name="calc8">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">ODF Spreadsheet</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/calc_HTML_WebQuery.xcu b/filter/source/config/fragments/filters/calc_HTML_WebQuery.xcu
new file mode 100644
index 000000000000..8808adc140a1
--- /dev/null
+++ b/filter/source/config/fragments/filters/calc_HTML_WebQuery.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="calc_HTML_WebQuery" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN USEOPTIONS</value></prop>
+ <prop oor:name="UIComponent"><value>com.sun.star.comp.Calc.FilterOptionsDialog</value></prop>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_web_HTML</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.sheet.SpreadsheetDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/calc_HTML_WebQuery_ui.xcu b/filter/source/config/fragments/filters/calc_HTML_WebQuery_ui.xcu
new file mode 100644
index 000000000000..828a356f23d9
--- /dev/null
+++ b/filter/source/config/fragments/filters/calc_HTML_WebQuery_ui.xcu
@@ -0,0 +1,6 @@
+ <node oor:name="calc_HTML_WebQuery">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">Web Page Query (%productname% Calc)</value>
+ <value xml:lang="x-translate">Web Page Query (%productname% Calc)</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/calc_MS_Excel_2007_Binary.xcu b/filter/source/config/fragments/filters/calc_MS_Excel_2007_Binary.xcu
new file mode 100644
index 000000000000..650c0cf980fb
--- /dev/null
+++ b/filter/source/config/fragments/filters/calc_MS_Excel_2007_Binary.xcu
@@ -0,0 +1,10 @@
+<node oor:name="Calc MS Excel 2007 Binary" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER PREFERRED</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.oox.ExcelFilter</value></prop>
+ <prop oor:name="UserData"/>
+ <prop oor:name="FileFormatVersion"/>
+ <prop oor:name="Type"><value>MS Excel 2007 Binary</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.sheet.SpreadsheetDocument</value></prop>
+</node>
diff --git a/filter/source/config/fragments/filters/calc_MS_Excel_2007_Binary_ui.xcu b/filter/source/config/fragments/filters/calc_MS_Excel_2007_Binary_ui.xcu
new file mode 100644
index 000000000000..49faa3d1a849
--- /dev/null
+++ b/filter/source/config/fragments/filters/calc_MS_Excel_2007_Binary_ui.xcu
@@ -0,0 +1,6 @@
+<node oor:name="Calc MS Excel 2007 Binary">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">Microsoft Excel 2007 Binary</value>
+ <value xml:lang="de">Microsoft Excel 2007 Binär</value>
+ </prop>
+</node>
diff --git a/filter/source/config/fragments/filters/calc_MS_Excel_2007_XML.xcu b/filter/source/config/fragments/filters/calc_MS_Excel_2007_XML.xcu
new file mode 100644
index 000000000000..508927802621
--- /dev/null
+++ b/filter/source/config/fragments/filters/calc_MS_Excel_2007_XML.xcu
@@ -0,0 +1,10 @@
+<node oor:name="Calc MS Excel 2007 XML" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER PREFERRED</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.oox.ExcelFilter</value></prop>
+ <prop oor:name="UserData"/>
+ <prop oor:name="FileFormatVersion"/>
+ <prop oor:name="Type"><value>MS Excel 2007 XML</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.sheet.SpreadsheetDocument</value></prop>
+</node>
diff --git a/filter/source/config/fragments/filters/calc_MS_Excel_2007_XML_Template.xcu b/filter/source/config/fragments/filters/calc_MS_Excel_2007_XML_Template.xcu
new file mode 100644
index 000000000000..46f1eca86085
--- /dev/null
+++ b/filter/source/config/fragments/filters/calc_MS_Excel_2007_XML_Template.xcu
@@ -0,0 +1,10 @@
+<node oor:name="Calc MS Excel 2007 XML Template" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER TEMPLATE TEMPLATEPATH</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.oox.ExcelFilter</value></prop>
+ <prop oor:name="UserData"/>
+ <prop oor:name="FileFormatVersion"/>
+ <prop oor:name="Type"><value>MS Excel 2007 XML Template</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.sheet.SpreadsheetDocument</value></prop>
+</node>
diff --git a/filter/source/config/fragments/filters/calc_MS_Excel_2007_XML_Template_ui.xcu b/filter/source/config/fragments/filters/calc_MS_Excel_2007_XML_Template_ui.xcu
new file mode 100644
index 000000000000..4d2019e55d2e
--- /dev/null
+++ b/filter/source/config/fragments/filters/calc_MS_Excel_2007_XML_Template_ui.xcu
@@ -0,0 +1,6 @@
+<node oor:name="Calc MS Excel 2007 XML Template">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">Microsoft Excel 2007 XML Template</value>
+ <value xml:lang="de">Microsoft Excel 2007 XML Vorlage</value>
+ </prop>
+</node>
diff --git a/filter/source/config/fragments/filters/calc_MS_Excel_2007_XML_ui.xcu b/filter/source/config/fragments/filters/calc_MS_Excel_2007_XML_ui.xcu
new file mode 100644
index 000000000000..9a81fd99d0d6
--- /dev/null
+++ b/filter/source/config/fragments/filters/calc_MS_Excel_2007_XML_ui.xcu
@@ -0,0 +1,6 @@
+<node oor:name="Calc MS Excel 2007 XML">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">Microsoft Excel 2007 XML</value>
+ <value xml:lang="de">Microsoft Excel 2007 XML</value>
+ </prop>
+</node>
diff --git a/filter/source/config/fragments/filters/calc_StarOffice_XML_Calc_Template.xcu b/filter/source/config/fragments/filters/calc_StarOffice_XML_Calc_Template.xcu
new file mode 100644
index 000000000000..56e132620108
--- /dev/null
+++ b/filter/source/config/fragments/filters/calc_StarOffice_XML_Calc_Template.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="calc_StarOffice_XML_Calc_Template" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT TEMPLATE TEMPLATEPATH OWN ALIEN ENCRYPTION</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="FileFormatVersion"><value>6200</value></prop>
+ <prop oor:name="Type"><value>calc_StarOffice_XML_Calc_Template</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.sheet.SpreadsheetDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/calc_StarOffice_XML_Calc_Template_ui.xcu b/filter/source/config/fragments/filters/calc_StarOffice_XML_Calc_Template_ui.xcu
new file mode 100644
index 000000000000..8d71de15869a
--- /dev/null
+++ b/filter/source/config/fragments/filters/calc_StarOffice_XML_Calc_Template_ui.xcu
@@ -0,0 +1,6 @@
+ <node oor:name="calc_StarOffice_XML_Calc_Template">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">%productname% %formatversion% Spreadsheet Template</value>
+ <value xml:lang="x-translate">%productname% %formatversion% Spreadsheet Template</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/calc_pdf_Export.xcu b/filter/source/config/fragments/filters/calc_pdf_Export.xcu
new file mode 100644
index 000000000000..c00ca73bfc47
--- /dev/null
+++ b/filter/source/config/fragments/filters/calc_pdf_Export.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="calc_pdf_Export" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"><value>com.sun.star.comp.PDF.PDFDialog</value></prop>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.PDF.PDFFilter</value></prop>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">PDF - Portable Document Format</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>pdf_Portable_Document_Format</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.sheet.SpreadsheetDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/chart8.xcu b/filter/source/config/fragments/filters/chart8.xcu
new file mode 100644
index 000000000000..c3700acfeb65
--- /dev/null
+++ b/filter/source/config/fragments/filters/chart8.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="chart8" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT OWN DEFAULT NOTINFILEDIALOG NOTINCHOOSER ENCRYPTION</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.chart2.XMLFilter</value></prop>
+ <prop oor:name="UserData"><value>XML</value></prop>
+ <prop oor:name="FileFormatVersion"><value>6800</value></prop>
+ <prop oor:name="Type"><value>chart8</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.chart2.ChartDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/chart8_ui.xcu b/filter/source/config/fragments/filters/chart8_ui.xcu
new file mode 100644
index 000000000000..d34981fa4bc9
--- /dev/null
+++ b/filter/source/config/fragments/filters/chart8_ui.xcu
@@ -0,0 +1,5 @@
+ <node oor:name="chart8">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">ODF Chart</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/dBase.xcu b/filter/source/config/fragments/filters/dBase.xcu
new file mode 100644
index 000000000000..4e2939520c14
--- /dev/null
+++ b/filter/source/config/fragments/filters/dBase.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="dBase" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT ALIEN USESOPTIONS</value></prop>
+ <prop oor:name="UIComponent"><value>com.sun.star.comp.Calc.FilterOptionsDialog</value></prop>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">dBASE</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>calc_dBase</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.sheet.SpreadsheetDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/draw8.xcu b/filter/source/config/fragments/filters/draw8.xcu
new file mode 100644
index 000000000000..6a1df34e4af3
--- /dev/null
+++ b/filter/source/config/fragments/filters/draw8.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="draw8" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT TEMPLATE OWN DEFAULT PREFERRED ENCRYPTION</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value>XML</value></prop>
+ <prop oor:name="FileFormatVersion"><value>6800</value></prop>
+ <prop oor:name="Type"><value>draw8</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/draw8_template.xcu b/filter/source/config/fragments/filters/draw8_template.xcu
new file mode 100644
index 000000000000..3f42e65f5853
--- /dev/null
+++ b/filter/source/config/fragments/filters/draw8_template.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="draw8_template" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT TEMPLATE TEMPLATEPATH OWN ENCRYPTION</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value>CXMLV</value></prop>
+ <prop oor:name="FileFormatVersion"><value>6800</value></prop>
+ <prop oor:name="Type"><value>draw8_template</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/draw8_template_ui.xcu b/filter/source/config/fragments/filters/draw8_template_ui.xcu
new file mode 100644
index 000000000000..430766aa87fe
--- /dev/null
+++ b/filter/source/config/fragments/filters/draw8_template_ui.xcu
@@ -0,0 +1,5 @@
+ <node oor:name="draw8_template">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">ODF Drawing Template</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/draw8_ui.xcu b/filter/source/config/fragments/filters/draw8_ui.xcu
new file mode 100644
index 000000000000..0852c2042470
--- /dev/null
+++ b/filter/source/config/fragments/filters/draw8_ui.xcu
@@ -0,0 +1,5 @@
+ <node oor:name="draw8">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">ODF Drawing</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/draw_PCD_Photo_CD_Base.xcu b/filter/source/config/fragments/filters/draw_PCD_Photo_CD_Base.xcu
new file mode 100644
index 000000000000..a0878c4d3145
--- /dev/null
+++ b/filter/source/config/fragments/filters/draw_PCD_Photo_CD_Base.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="draw_PCD_Photo_CD_Base" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">PCD - Kodak Photo CD (768x512)</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>pcd_Photo_CD_Base</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/draw_PCD_Photo_CD_Base16.xcu b/filter/source/config/fragments/filters/draw_PCD_Photo_CD_Base16.xcu
new file mode 100644
index 000000000000..24c17ca932e2
--- /dev/null
+++ b/filter/source/config/fragments/filters/draw_PCD_Photo_CD_Base16.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="draw_PCD_Photo_CD_Base16" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">PCD - Kodak Photo CD (192x128)</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>pcd_Photo_CD_Base16</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/draw_PCD_Photo_CD_Base4.xcu b/filter/source/config/fragments/filters/draw_PCD_Photo_CD_Base4.xcu
new file mode 100644
index 000000000000..699358d87b49
--- /dev/null
+++ b/filter/source/config/fragments/filters/draw_PCD_Photo_CD_Base4.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="draw_PCD_Photo_CD_Base4" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">PCD - Kodak Photo CD (384x256)</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>pcd_Photo_CD_Base4</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/draw_StarOffice_XML_Draw_Template.xcu b/filter/source/config/fragments/filters/draw_StarOffice_XML_Draw_Template.xcu
new file mode 100644
index 000000000000..55f1f96a922f
--- /dev/null
+++ b/filter/source/config/fragments/filters/draw_StarOffice_XML_Draw_Template.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="draw_StarOffice_XML_Draw_Template" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT TEMPLATE TEMPLATEPATH OWN ALIEN ENCRYPTION</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value>CXMLV</value></prop>
+ <prop oor:name="FileFormatVersion"><value>6200</value></prop>
+ <prop oor:name="Type"><value>draw_StarOffice_XML_Draw_Template</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/draw_StarOffice_XML_Draw_Template_ui.xcu b/filter/source/config/fragments/filters/draw_StarOffice_XML_Draw_Template_ui.xcu
new file mode 100644
index 000000000000..8121a7bb9646
--- /dev/null
+++ b/filter/source/config/fragments/filters/draw_StarOffice_XML_Draw_Template_ui.xcu
@@ -0,0 +1,6 @@
+ <node oor:name="draw_StarOffice_XML_Draw_Template">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">%productname% %formatversion% Drawing Template</value>
+ <value xml:lang="x-translate">%productname% %formatversion% Drawing Template</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/draw_bmp_Export.xcu b/filter/source/config/fragments/filters/draw_bmp_Export.xcu
new file mode 100644
index 000000000000..fbfddfc06a0b
--- /dev/null
+++ b/filter/source/config/fragments/filters/draw_bmp_Export.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="draw_bmp_Export" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT ALIEN SUPPORTSSELECTION</value></prop>
+ <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">BMP - Windows Bitmap</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>bmp_MS_Windows</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/draw_emf_Export.xcu b/filter/source/config/fragments/filters/draw_emf_Export.xcu
new file mode 100644
index 000000000000..c6f9d933f3f2
--- /dev/null
+++ b/filter/source/config/fragments/filters/draw_emf_Export.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="draw_emf_Export" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT ALIEN SUPPORTSSELECTION</value></prop>
+ <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">EMF - Enhanced Metafile</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>emf_MS_Windows_Metafile</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/draw_eps_Export.xcu b/filter/source/config/fragments/filters/draw_eps_Export.xcu
new file mode 100644
index 000000000000..9cc1eb92678e
--- /dev/null
+++ b/filter/source/config/fragments/filters/draw_eps_Export.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="draw_eps_Export" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT ALIEN SUPPORTSSELECTION</value></prop>
+ <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">EPS - Encapsulated PostScript</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>eps_Encapsulated_PostScript</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/draw_flash_Export.xcu b/filter/source/config/fragments/filters/draw_flash_Export.xcu
new file mode 100644
index 000000000000..222138869266
--- /dev/null
+++ b/filter/source/config/fragments/filters/draw_flash_Export.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="draw_flash_Export" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.Impress.FlashExportFilter</value></prop>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Macromedia Flash (SWF)</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>graphic_SWF</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/draw_gif_Export.xcu b/filter/source/config/fragments/filters/draw_gif_Export.xcu
new file mode 100644
index 000000000000..017a277030f6
--- /dev/null
+++ b/filter/source/config/fragments/filters/draw_gif_Export.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="draw_gif_Export" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT ALIEN SUPPORTSSELECTION</value></prop>
+ <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">GIF - Graphics Interchange Format</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>gif_Graphics_Interchange</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/draw_html_Export.xcu b/filter/source/config/fragments/filters/draw_html_Export.xcu
new file mode 100644
index 000000000000..04ddadb4b38e
--- /dev/null
+++ b/filter/source/config/fragments/filters/draw_html_Export.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="draw_html_Export" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT ALIEN</value></prop>
+ <prop oor:name="UIComponent"><value>com.sun.star.comp.draw.SdHtmlOptionsDialog</value></prop>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>graphic_HTML</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/draw_html_Export_ui.xcu b/filter/source/config/fragments/filters/draw_html_Export_ui.xcu
new file mode 100644
index 000000000000..8c35eb96a157
--- /dev/null
+++ b/filter/source/config/fragments/filters/draw_html_Export_ui.xcu
@@ -0,0 +1,6 @@
+ <node oor:name="draw_html_Export">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">HTML Document (%productname% Draw)</value>
+ <value xml:lang="x-translate">HTML Document (%productname% Draw)</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/draw_jpg_Export.xcu b/filter/source/config/fragments/filters/draw_jpg_Export.xcu
new file mode 100644
index 000000000000..efa6798cf824
--- /dev/null
+++ b/filter/source/config/fragments/filters/draw_jpg_Export.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="draw_jpg_Export" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT ALIEN SUPPORTSSELECTION</value></prop>
+ <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">JPEG - Joint Photographic Experts Group</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>jpg_JPEG</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/draw_met_Export.xcu b/filter/source/config/fragments/filters/draw_met_Export.xcu
new file mode 100644
index 000000000000..e4b47ec8a5da
--- /dev/null
+++ b/filter/source/config/fragments/filters/draw_met_Export.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="draw_met_Export" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT ALIEN SUPPORTSSELECTION</value></prop>
+ <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">MET - OS/2 Metafile</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>met_OS2_Metafile</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/draw_pbm_Export.xcu b/filter/source/config/fragments/filters/draw_pbm_Export.xcu
new file mode 100644
index 000000000000..ff4a84d38548
--- /dev/null
+++ b/filter/source/config/fragments/filters/draw_pbm_Export.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="draw_pbm_Export" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT ALIEN SUPPORTSSELECTION</value></prop>
+ <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">PBM - Portable Bitmap</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>pbm_Portable_Bitmap</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/draw_pct_Export.xcu b/filter/source/config/fragments/filters/draw_pct_Export.xcu
new file mode 100644
index 000000000000..2b9069694d5a
--- /dev/null
+++ b/filter/source/config/fragments/filters/draw_pct_Export.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="draw_pct_Export" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT ALIEN SUPPORTSSELECTION</value></prop>
+ <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">PCT - Mac Pict</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>pct_Mac_Pict</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/draw_pdf_Export.xcu b/filter/source/config/fragments/filters/draw_pdf_Export.xcu
new file mode 100644
index 000000000000..23a76e6812ea
--- /dev/null
+++ b/filter/source/config/fragments/filters/draw_pdf_Export.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="draw_pdf_Export" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"><value>com.sun.star.comp.PDF.PDFDialog</value></prop>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.PDF.PDFFilter</value></prop>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">PDF - Portable Document Format</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>pdf_Portable_Document_Format</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/draw_pgm_Export.xcu b/filter/source/config/fragments/filters/draw_pgm_Export.xcu
new file mode 100644
index 000000000000..fc187599c326
--- /dev/null
+++ b/filter/source/config/fragments/filters/draw_pgm_Export.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="draw_pgm_Export" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT ALIEN SUPPORTSSELECTION</value></prop>
+ <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">PGM - Portable Graymap</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>pgm_Portable_Graymap</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/draw_png_Export.xcu b/filter/source/config/fragments/filters/draw_png_Export.xcu
new file mode 100644
index 000000000000..08c0b2ac5a26
--- /dev/null
+++ b/filter/source/config/fragments/filters/draw_png_Export.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="draw_png_Export" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT ALIEN SUPPORTSSELECTION</value></prop>
+ <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">PNG - Portable Network Graphic</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>png_Portable_Network_Graphic</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/draw_ppm_Export.xcu b/filter/source/config/fragments/filters/draw_ppm_Export.xcu
new file mode 100644
index 000000000000..9631ffcee666
--- /dev/null
+++ b/filter/source/config/fragments/filters/draw_ppm_Export.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="draw_ppm_Export" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT ALIEN SUPPORTSSELECTION</value></prop>
+ <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">PPM - Portable Pixelmap</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>ppm_Portable_Pixelmap</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/draw_ras_Export.xcu b/filter/source/config/fragments/filters/draw_ras_Export.xcu
new file mode 100644
index 000000000000..4cdd9e0b9989
--- /dev/null
+++ b/filter/source/config/fragments/filters/draw_ras_Export.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="draw_ras_Export" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT ALIEN SUPPORTSSELECTION</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">RAS - Sun Raster Image</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>ras_Sun_Rasterfile</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/draw_svg_Export.xcu b/filter/source/config/fragments/filters/draw_svg_Export.xcu
new file mode 100644
index 000000000000..6e273c555060
--- /dev/null
+++ b/filter/source/config/fragments/filters/draw_svg_Export.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="draw_svg_Export" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.Draw.SVGFilter</value></prop>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">SVG - Scalable Vector Graphics</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>svg_Scalable_Vector_Graphics</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/draw_svm_Export.xcu b/filter/source/config/fragments/filters/draw_svm_Export.xcu
new file mode 100644
index 000000000000..29f52d67d3ae
--- /dev/null
+++ b/filter/source/config/fragments/filters/draw_svm_Export.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="draw_svm_Export" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT ALIEN SUPPORTSSELECTION</value></prop>
+ <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">SVM - StarView Metafile</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>svm_StarView_Metafile</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/draw_tif_Export.xcu b/filter/source/config/fragments/filters/draw_tif_Export.xcu
new file mode 100644
index 000000000000..0b03360bf75d
--- /dev/null
+++ b/filter/source/config/fragments/filters/draw_tif_Export.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="draw_tif_Export" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT ALIEN SUPPORTSSELECTION</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">TIFF - Tagged Image File Format</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>tif_Tag_Image_File</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/draw_wmf_Export.xcu b/filter/source/config/fragments/filters/draw_wmf_Export.xcu
new file mode 100644
index 000000000000..667b15259e92
--- /dev/null
+++ b/filter/source/config/fragments/filters/draw_wmf_Export.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="draw_wmf_Export" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT ALIEN SUPPORTSSELECTION</value></prop>
+ <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">WMF - Windows Metafile</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>wmf_MS_Windows_Metafile</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/draw_xpm_Export.xcu b/filter/source/config/fragments/filters/draw_xpm_Export.xcu
new file mode 100644
index 000000000000..18b221c6ccbf
--- /dev/null
+++ b/filter/source/config/fragments/filters/draw_xpm_Export.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="draw_xpm_Export" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT ALIEN SUPPORTSSELECTION</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">XPM - X PixMap</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>xpm_XPM</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/impress8.xcu b/filter/source/config/fragments/filters/impress8.xcu
new file mode 100644
index 000000000000..099bce62d3c5
--- /dev/null
+++ b/filter/source/config/fragments/filters/impress8.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="impress8" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT TEMPLATE OWN DEFAULT PREFERRED ENCRYPTION</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value>XML</value></prop>
+ <prop oor:name="FileFormatVersion"><value>6800</value></prop>
+ <prop oor:name="Type"><value>impress8</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.presentation.PresentationDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/impress8_draw.xcu b/filter/source/config/fragments/filters/impress8_draw.xcu
new file mode 100644
index 000000000000..5781c2a3e709
--- /dev/null
+++ b/filter/source/config/fragments/filters/impress8_draw.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="impress8_draw" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT TEMPLATE OWN ENCRYPTION</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value>XML</value></prop>
+ <prop oor:name="FileFormatVersion"><value>6800</value></prop>
+ <prop oor:name="Type"><value>draw8</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.presentation.PresentationDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/impress8_draw_ui.xcu b/filter/source/config/fragments/filters/impress8_draw_ui.xcu
new file mode 100644
index 000000000000..2ba1fcbd2a7f
--- /dev/null
+++ b/filter/source/config/fragments/filters/impress8_draw_ui.xcu
@@ -0,0 +1,5 @@
+ <node oor:name="impress8_draw">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">ODF Drawing (Impress)</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/impress8_template.xcu b/filter/source/config/fragments/filters/impress8_template.xcu
new file mode 100644
index 000000000000..891f8f86b0c4
--- /dev/null
+++ b/filter/source/config/fragments/filters/impress8_template.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="impress8_template" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT TEMPLATE TEMPLATEPATH OWN ENCRYPTION</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value>CXMLV</value></prop>
+ <prop oor:name="FileFormatVersion"><value>6800</value></prop>
+ <prop oor:name="Type"><value>impress8_template</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.presentation.PresentationDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/impress8_template_ui.xcu b/filter/source/config/fragments/filters/impress8_template_ui.xcu
new file mode 100644
index 000000000000..d8b3d4d68fc3
--- /dev/null
+++ b/filter/source/config/fragments/filters/impress8_template_ui.xcu
@@ -0,0 +1,5 @@
+ <node oor:name="impress8_template">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">ODF Presentation Template</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/impress8_ui.xcu b/filter/source/config/fragments/filters/impress8_ui.xcu
new file mode 100644
index 000000000000..3ac78f8d88b2
--- /dev/null
+++ b/filter/source/config/fragments/filters/impress8_ui.xcu
@@ -0,0 +1,5 @@
+ <node oor:name="impress8">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">ODF Presentation</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/impress_MS_PowerPoint_2007_XML.xcu b/filter/source/config/fragments/filters/impress_MS_PowerPoint_2007_XML.xcu
new file mode 100644
index 000000000000..7fdcbd702a54
--- /dev/null
+++ b/filter/source/config/fragments/filters/impress_MS_PowerPoint_2007_XML.xcu
@@ -0,0 +1,10 @@
+<node oor:name="Impress MS PowerPoint 2007 XML" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER PREFERRED</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.Impress.oox.PowerPointImport</value></prop>
+ <prop oor:name="UserData"/>
+ <prop oor:name="FileFormatVersion"/>
+ <prop oor:name="Type"><value>MS PowerPoint 2007 XML</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.presentation.PresentationDocument</value></prop>
+</node>
diff --git a/filter/source/config/fragments/filters/impress_MS_PowerPoint_2007_XML_Template.xcu b/filter/source/config/fragments/filters/impress_MS_PowerPoint_2007_XML_Template.xcu
new file mode 100644
index 000000000000..4fad96fc0521
--- /dev/null
+++ b/filter/source/config/fragments/filters/impress_MS_PowerPoint_2007_XML_Template.xcu
@@ -0,0 +1,10 @@
+<node oor:name="Impress MS PowerPoint 2007 XML Template" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER TEMPLATE TEMPLATEPATH PREFERRED</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.Impress.oox.PowerPointImport</value></prop>
+ <prop oor:name="UserData"/>
+ <prop oor:name="FileFormatVersion"/>
+ <prop oor:name="Type"><value>MS PowerPoint 2007 XML Template</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.presentation.PresentationDocument</value></prop>
+</node>
diff --git a/filter/source/config/fragments/filters/impress_MS_PowerPoint_2007_XML_Template_ui.xcu b/filter/source/config/fragments/filters/impress_MS_PowerPoint_2007_XML_Template_ui.xcu
new file mode 100644
index 000000000000..24f2d3889b59
--- /dev/null
+++ b/filter/source/config/fragments/filters/impress_MS_PowerPoint_2007_XML_Template_ui.xcu
@@ -0,0 +1,6 @@
+<node oor:name="Impress MS PowerPoint 2007 XML Template">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">Microsoft PowerPoint 2007 XML Template</value>
+ <value xml:lang="de">Microsoft PowerPoint 2007 XML Vorlage</value>
+ </prop>
+</node>
diff --git a/filter/source/config/fragments/filters/impress_MS_PowerPoint_2007_XML_ui.xcu b/filter/source/config/fragments/filters/impress_MS_PowerPoint_2007_XML_ui.xcu
new file mode 100644
index 000000000000..1a6b220a0681
--- /dev/null
+++ b/filter/source/config/fragments/filters/impress_MS_PowerPoint_2007_XML_ui.xcu
@@ -0,0 +1,6 @@
+<node oor:name="Impress MS PowerPoint 2007 XML">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">Microsoft PowerPoint 2007 XML</value>
+ <value xml:lang="de">Microsoft PowerPoint 2007 XML</value>
+ </prop>
+</node>
diff --git a/filter/source/config/fragments/filters/impress_StarOffice_XML_Draw.xcu b/filter/source/config/fragments/filters/impress_StarOffice_XML_Draw.xcu
new file mode 100644
index 000000000000..225843c661b7
--- /dev/null
+++ b/filter/source/config/fragments/filters/impress_StarOffice_XML_Draw.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="impress_StarOffice_XML_Draw" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT TEMPLATE OWN ALIEN ENCRYPTION</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value>XML</value></prop>
+ <prop oor:name="FileFormatVersion"><value>6200</value></prop>
+ <prop oor:name="Type"><value>draw_StarOffice_XML_Draw</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.presentation.PresentationDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/impress_StarOffice_XML_Draw_ui.xcu b/filter/source/config/fragments/filters/impress_StarOffice_XML_Draw_ui.xcu
new file mode 100644
index 000000000000..a0df30be38be
--- /dev/null
+++ b/filter/source/config/fragments/filters/impress_StarOffice_XML_Draw_ui.xcu
@@ -0,0 +1,6 @@
+ <node oor:name="impress_StarOffice_XML_Draw">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">%productname% %formatversion% Drawing (%productname% Impress)</value>
+ <value xml:lang="x-translate">%productname% %formatversion% Drawing (%productname% Impress)</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/impress_StarOffice_XML_Impress_Template.xcu b/filter/source/config/fragments/filters/impress_StarOffice_XML_Impress_Template.xcu
new file mode 100644
index 000000000000..472dcf16130a
--- /dev/null
+++ b/filter/source/config/fragments/filters/impress_StarOffice_XML_Impress_Template.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="impress_StarOffice_XML_Impress_Template" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT TEMPLATE TEMPLATEPATH OWN ALIEN ENCRYPTION</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value>CXMLV</value></prop>
+ <prop oor:name="FileFormatVersion"><value>6200</value></prop>
+ <prop oor:name="Type"><value>impress_StarOffice_XML_Impress_Template</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.presentation.PresentationDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/impress_StarOffice_XML_Impress_Template_ui.xcu b/filter/source/config/fragments/filters/impress_StarOffice_XML_Impress_Template_ui.xcu
new file mode 100644
index 000000000000..24392c0d66dc
--- /dev/null
+++ b/filter/source/config/fragments/filters/impress_StarOffice_XML_Impress_Template_ui.xcu
@@ -0,0 +1,6 @@
+ <node oor:name="impress_StarOffice_XML_Impress_Template">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">%productname% %formatversion% Presentation Template</value>
+ <value xml:lang="x-translate">%productname% %formatversion% Presentation Template</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/impress_bmp_Export.xcu b/filter/source/config/fragments/filters/impress_bmp_Export.xcu
new file mode 100644
index 000000000000..74c632cfd910
--- /dev/null
+++ b/filter/source/config/fragments/filters/impress_bmp_Export.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="impress_bmp_Export" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT ALIEN SUPPORTSSELECTION</value></prop>
+ <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">BMP - Windows Bitmap</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>bmp_MS_Windows</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.presentation.PresentationDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/impress_emf_Export.xcu b/filter/source/config/fragments/filters/impress_emf_Export.xcu
new file mode 100644
index 000000000000..02b575420aba
--- /dev/null
+++ b/filter/source/config/fragments/filters/impress_emf_Export.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="impress_emf_Export" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT ALIEN SUPPORTSSELECTION</value></prop>
+ <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">EMF - Enhanced Metafile</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>emf_MS_Windows_Metafile</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.presentation.PresentationDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/impress_eps_Export.xcu b/filter/source/config/fragments/filters/impress_eps_Export.xcu
new file mode 100644
index 000000000000..a1c7f3694a6f
--- /dev/null
+++ b/filter/source/config/fragments/filters/impress_eps_Export.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="impress_eps_Export" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT ALIEN SUPPORTSSELECTION</value></prop>
+ <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">EPS - Encapsulated PostScript</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>eps_Encapsulated_PostScript</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.presentation.PresentationDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/impress_flash_Export.xcu b/filter/source/config/fragments/filters/impress_flash_Export.xcu
new file mode 100644
index 000000000000..51fa2e39e765
--- /dev/null
+++ b/filter/source/config/fragments/filters/impress_flash_Export.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="impress_flash_Export" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.Impress.FlashExportFilter</value></prop>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Macromedia Flash (SWF)</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>graphic_SWF</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.presentation.PresentationDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/impress_gif_Export.xcu b/filter/source/config/fragments/filters/impress_gif_Export.xcu
new file mode 100644
index 000000000000..3d65c2d165b4
--- /dev/null
+++ b/filter/source/config/fragments/filters/impress_gif_Export.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="impress_gif_Export" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT ALIEN SUPPORTSSELECTION</value></prop>
+ <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">GIF - Graphics Interchange Format</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>gif_Graphics_Interchange</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.presentation.PresentationDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/impress_html_Export.xcu b/filter/source/config/fragments/filters/impress_html_Export.xcu
new file mode 100644
index 000000000000..60de237501b8
--- /dev/null
+++ b/filter/source/config/fragments/filters/impress_html_Export.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="impress_html_Export" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT ALIEN</value></prop>
+ <prop oor:name="UIComponent"><value>com.sun.star.comp.draw.SdHtmlOptionsDialog</value></prop>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>graphic_HTML</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.presentation.PresentationDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/impress_html_Export_ui.xcu b/filter/source/config/fragments/filters/impress_html_Export_ui.xcu
new file mode 100644
index 000000000000..d7392eb427f6
--- /dev/null
+++ b/filter/source/config/fragments/filters/impress_html_Export_ui.xcu
@@ -0,0 +1,6 @@
+ <node oor:name="impress_html_Export">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">HTML Document (%productname% Impress)</value>
+ <value xml:lang="x-translate">HTML Document (%productname% Impress)</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/impress_jpg_Export.xcu b/filter/source/config/fragments/filters/impress_jpg_Export.xcu
new file mode 100644
index 000000000000..3fca1776b2a9
--- /dev/null
+++ b/filter/source/config/fragments/filters/impress_jpg_Export.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="impress_jpg_Export" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT ALIEN SUPPORTSSELECTION</value></prop>
+ <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">JPEG - Joint Photographic Experts Group</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>jpg_JPEG</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.presentation.PresentationDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/impress_met_Export.xcu b/filter/source/config/fragments/filters/impress_met_Export.xcu
new file mode 100644
index 000000000000..d144158465b7
--- /dev/null
+++ b/filter/source/config/fragments/filters/impress_met_Export.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="impress_met_Export" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT ALIEN SUPPORTSSELECTION</value></prop>
+ <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">MET - OS/2 Metafile</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>met_OS2_Metafile</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.presentation.PresentationDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/impress_pbm_Export.xcu b/filter/source/config/fragments/filters/impress_pbm_Export.xcu
new file mode 100644
index 000000000000..bf6dd89de38e
--- /dev/null
+++ b/filter/source/config/fragments/filters/impress_pbm_Export.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="impress_pbm_Export" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT ALIEN SUPPORTSSELECTION</value></prop>
+ <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">PBM - Portable Bitmap</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>pbm_Portable_Bitmap</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.presentation.PresentationDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/impress_pct_Export.xcu b/filter/source/config/fragments/filters/impress_pct_Export.xcu
new file mode 100644
index 000000000000..46f44610437e
--- /dev/null
+++ b/filter/source/config/fragments/filters/impress_pct_Export.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="impress_pct_Export" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT ALIEN SUPPORTSSELECTION</value></prop>
+ <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">PCT - Mac Pict</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>pct_Mac_Pict</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.presentation.PresentationDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/impress_pdf_Export.xcu b/filter/source/config/fragments/filters/impress_pdf_Export.xcu
new file mode 100644
index 000000000000..deadf1d35291
--- /dev/null
+++ b/filter/source/config/fragments/filters/impress_pdf_Export.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="impress_pdf_Export" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"><value>com.sun.star.comp.PDF.PDFDialog</value></prop>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.PDF.PDFFilter</value></prop>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">PDF - Portable Document Format</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>pdf_Portable_Document_Format</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.presentation.PresentationDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/impress_pgm_Export.xcu b/filter/source/config/fragments/filters/impress_pgm_Export.xcu
new file mode 100644
index 000000000000..e14eda40af44
--- /dev/null
+++ b/filter/source/config/fragments/filters/impress_pgm_Export.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="impress_pgm_Export" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT ALIEN SUPPORTSSELECTION</value></prop>
+ <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">PGM - Portable Graymap</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>pgm_Portable_Graymap</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.presentation.PresentationDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/impress_png_Export.xcu b/filter/source/config/fragments/filters/impress_png_Export.xcu
new file mode 100644
index 000000000000..e836c6fb0ede
--- /dev/null
+++ b/filter/source/config/fragments/filters/impress_png_Export.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="impress_png_Export" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT ALIEN SUPPORTSSELECTION</value></prop>
+ <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">PNG - Portable Network Graphic</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>png_Portable_Network_Graphic</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.presentation.PresentationDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/impress_ppm_Export.xcu b/filter/source/config/fragments/filters/impress_ppm_Export.xcu
new file mode 100644
index 000000000000..27c970e32f54
--- /dev/null
+++ b/filter/source/config/fragments/filters/impress_ppm_Export.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="impress_ppm_Export" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT ALIEN SUPPORTSSELECTION</value></prop>
+ <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">PPM - Portable Pixelmap</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>ppm_Portable_Pixelmap</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.presentation.PresentationDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/impress_ras_Export.xcu b/filter/source/config/fragments/filters/impress_ras_Export.xcu
new file mode 100644
index 000000000000..c3327e8d1b5a
--- /dev/null
+++ b/filter/source/config/fragments/filters/impress_ras_Export.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="impress_ras_Export" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT ALIEN SUPPORTSSELECTION</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">RAS - Sun Raster Image</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>ras_Sun_Rasterfile</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.presentation.PresentationDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/impress_svg_Export.xcu b/filter/source/config/fragments/filters/impress_svg_Export.xcu
new file mode 100644
index 000000000000..44efb45bcea4
--- /dev/null
+++ b/filter/source/config/fragments/filters/impress_svg_Export.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="impress_svg_Export" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.Draw.SVGFilter</value></prop>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">SVG - Scalable Vector Graphics</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>svg_Scalable_Vector_Graphics</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.presentation.PresentationDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/impress_svm_Export.xcu b/filter/source/config/fragments/filters/impress_svm_Export.xcu
new file mode 100644
index 000000000000..6bfcd9711ca8
--- /dev/null
+++ b/filter/source/config/fragments/filters/impress_svm_Export.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="impress_svm_Export" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT ALIEN SUPPORTSSELECTION</value></prop>
+ <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">SVM - StarView Metafile</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>svm_StarView_Metafile</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.presentation.PresentationDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/impress_tif_Export.xcu b/filter/source/config/fragments/filters/impress_tif_Export.xcu
new file mode 100644
index 000000000000..f4b76ab8f193
--- /dev/null
+++ b/filter/source/config/fragments/filters/impress_tif_Export.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="impress_tif_Export" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT ALIEN SUPPORTSSELECTION</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">TIFF - Tagged Image File Format</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>tif_Tag_Image_File</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.presentation.PresentationDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/impress_wmf_Export.xcu b/filter/source/config/fragments/filters/impress_wmf_Export.xcu
new file mode 100644
index 000000000000..18864e015375
--- /dev/null
+++ b/filter/source/config/fragments/filters/impress_wmf_Export.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="impress_wmf_Export" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT ALIEN SUPPORTSSELECTION</value></prop>
+ <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">WMF - Windows Metafile</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>wmf_MS_Windows_Metafile</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.presentation.PresentationDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/impress_xpm_Export.xcu b/filter/source/config/fragments/filters/impress_xpm_Export.xcu
new file mode 100644
index 000000000000..0a83d3e853f1
--- /dev/null
+++ b/filter/source/config/fragments/filters/impress_xpm_Export.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="impress_xpm_Export" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT ALIEN SUPPORTSSELECTION</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">XPM - X PixMap</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>xpm_XPM</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.presentation.PresentationDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/makefile.mk b/filter/source/config/fragments/filters/makefile.mk
new file mode 100644
index 000000000000..2c557906df29
--- /dev/null
+++ b/filter/source/config/fragments/filters/makefile.mk
@@ -0,0 +1,57 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ = ..$/..$/..$/..
+TARGET = FCFGPkgFilters
+PRJNAME = filter
+
+# -----------------------------------------------------------------------------
+# include global settings
+# -----------------------------------------------------------------------------
+
+.INCLUDE: settings.mk
+
+# -----------------------------------------------------------------------------
+# include all package definition files
+# -----------------------------------------------------------------------------
+
+.INCLUDE: ..$/packagedef.mk
+
+.INCLUDE: target.mk
+
+ALLTAR: $(ALL_UI_FILTERS)
+
+.IF "$(WITH_LANG)"!=""
+$(DIR_LOCFRAG)$/filters$/%.xcu : %.xcu
+ -$(MKDIRHIER) $(@:d)
+ $(WRAPCMD) $(CFGEX) -p $(PRJNAME) -i $(@:f) -o $@ -m $(LOCALIZESDF) -l all
+
+.IF "$(ALL_UI_FILTERS)"!=""
+$(ALL_UI_FILTERS) : $(LOCALIZESDF)
+.ENDIF # "$(ALL_UI_FILTERS)"!=""
+
+.ENDIF # "$(WITH_LANG)"!=""
diff --git a/filter/source/config/fragments/filters/math8.xcu b/filter/source/config/fragments/filters/math8.xcu
new file mode 100644
index 000000000000..94c86a96cf83
--- /dev/null
+++ b/filter/source/config/fragments/filters/math8.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="math8" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT TEMPLATE OWN DEFAULT ENCRYPTION</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="FileFormatVersion"><value>6800</value></prop>
+ <prop oor:name="Type"><value>math8</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.formula.FormulaProperties</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/math8_ui.xcu b/filter/source/config/fragments/filters/math8_ui.xcu
new file mode 100644
index 000000000000..c892495fca90
--- /dev/null
+++ b/filter/source/config/fragments/filters/math8_ui.xcu
@@ -0,0 +1,5 @@
+ <node oor:name="math8">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">ODF Formula</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/math_pdf_Export.xcu b/filter/source/config/fragments/filters/math_pdf_Export.xcu
new file mode 100644
index 000000000000..844714fbc5ec
--- /dev/null
+++ b/filter/source/config/fragments/filters/math_pdf_Export.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="math_pdf_Export" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"><value>com.sun.star.comp.PDF.PDFDialog</value></prop>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.PDF.PDFFilter</value></prop>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">PDF - Portable Document Format</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>pdf_Portable_Document_Format</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.formula.FormulaProperties</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/placeware_Export.xcu b/filter/source/config/fragments/filters/placeware_Export.xcu
new file mode 100644
index 000000000000..a9c9a655acbb
--- /dev/null
+++ b/filter/source/config/fragments/filters/placeware_Export.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="placeware_Export" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.Impress.PlaceWareExportFilter</value></prop>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">PWP - PlaceWare</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>pwp_PlaceWare</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.presentation.PresentationDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/writer8.xcu b/filter/source/config/fragments/filters/writer8.xcu
new file mode 100644
index 000000000000..bcfd55640e79
--- /dev/null
+++ b/filter/source/config/fragments/filters/writer8.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="writer8" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT TEMPLATE OWN DEFAULT PREFERRED ENCRYPTION PASSWORDTOMODIFY</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value>CXML</value></prop>
+ <prop oor:name="FileFormatVersion"><value>6800</value></prop>
+ <prop oor:name="Type"><value>writer8</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/writer8_template.xcu b/filter/source/config/fragments/filters/writer8_template.xcu
new file mode 100644
index 000000000000..34ee8055113c
--- /dev/null
+++ b/filter/source/config/fragments/filters/writer8_template.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="writer8_template" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT TEMPLATE TEMPLATEPATH OWN ENCRYPTION PASSWORDTOMODIFY</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value>CXMLV</value></prop>
+ <prop oor:name="FileFormatVersion"><value>6800</value></prop>
+ <prop oor:name="Type"><value>writer8_template</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/writer8_template_ui.xcu b/filter/source/config/fragments/filters/writer8_template_ui.xcu
new file mode 100644
index 000000000000..05a5a32ac134
--- /dev/null
+++ b/filter/source/config/fragments/filters/writer8_template_ui.xcu
@@ -0,0 +1,5 @@
+ <node oor:name="writer8_template">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">ODF Text Document Template</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/writer8_ui.xcu b/filter/source/config/fragments/filters/writer8_ui.xcu
new file mode 100644
index 000000000000..e70d69b759d1
--- /dev/null
+++ b/filter/source/config/fragments/filters/writer8_ui.xcu
@@ -0,0 +1,5 @@
+ <node oor:name="writer8">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">ODF Text Document</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/writer_MIZI_Hwp_97.xcu b/filter/source/config/fragments/filters/writer_MIZI_Hwp_97.xcu
new file mode 100644
index 000000000000..01a305bb7eec
--- /dev/null
+++ b/filter/source/config/fragments/filters/writer_MIZI_Hwp_97.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="writer_MIZI_Hwp_97" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.comp.hwpimport.HwpImportFilter</value></prop>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Hangul WP 97</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_MIZI_Hwp_97</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/writer_StarOffice_XML_Writer_Template.xcu b/filter/source/config/fragments/filters/writer_StarOffice_XML_Writer_Template.xcu
new file mode 100644
index 000000000000..9c54cf04e06b
--- /dev/null
+++ b/filter/source/config/fragments/filters/writer_StarOffice_XML_Writer_Template.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="writer_StarOffice_XML_Writer_Template" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT TEMPLATE TEMPLATEPATH OWN ALIEN ENCRYPTION</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value>CXMLV</value></prop>
+ <prop oor:name="FileFormatVersion"><value>6200</value></prop>
+ <prop oor:name="Type"><value>writer_StarOffice_XML_Writer_Template</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/writer_StarOffice_XML_Writer_Template_ui.xcu b/filter/source/config/fragments/filters/writer_StarOffice_XML_Writer_Template_ui.xcu
new file mode 100644
index 000000000000..f15981efe33d
--- /dev/null
+++ b/filter/source/config/fragments/filters/writer_StarOffice_XML_Writer_Template_ui.xcu
@@ -0,0 +1,6 @@
+ <node oor:name="writer_StarOffice_XML_Writer_Template">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">%productname% %formatversion% Text Document Template</value>
+ <value xml:lang="x-translate">%productname% %formatversion% Text Document Template</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/writer_globaldocument_StarOffice_XML_Writer.xcu b/filter/source/config/fragments/filters/writer_globaldocument_StarOffice_XML_Writer.xcu
new file mode 100644
index 000000000000..b1210080e631
--- /dev/null
+++ b/filter/source/config/fragments/filters/writer_globaldocument_StarOffice_XML_Writer.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="writer_globaldocument_StarOffice_XML_Writer" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT TEMPLATE ALIEN ENCRYPTION</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value>CXML</value></prop>
+ <prop oor:name="FileFormatVersion"><value>6200</value></prop>
+ <prop oor:name="Type"><value>writer_StarOffice_XML_Writer</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.GlobalDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/writer_globaldocument_StarOffice_XML_Writer_GlobalDocument.xcu b/filter/source/config/fragments/filters/writer_globaldocument_StarOffice_XML_Writer_GlobalDocument.xcu
new file mode 100644
index 000000000000..2dfb7fe0d21e
--- /dev/null
+++ b/filter/source/config/fragments/filters/writer_globaldocument_StarOffice_XML_Writer_GlobalDocument.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="writer_globaldocument_StarOffice_XML_Writer_GlobalDocument" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT TEMPLATE OWN ALIEN PREFERRED ENCRYPTION</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value>CXML</value></prop>
+ <prop oor:name="FileFormatVersion"><value>6200</value></prop>
+ <prop oor:name="Type"><value>writer_globaldocument_StarOffice_XML_Writer_GlobalDocument</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.GlobalDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/writer_globaldocument_StarOffice_XML_Writer_GlobalDocument_ui.xcu b/filter/source/config/fragments/filters/writer_globaldocument_StarOffice_XML_Writer_GlobalDocument_ui.xcu
new file mode 100644
index 000000000000..28e9b4082a7a
--- /dev/null
+++ b/filter/source/config/fragments/filters/writer_globaldocument_StarOffice_XML_Writer_GlobalDocument_ui.xcu
@@ -0,0 +1,6 @@
+ <node oor:name="writer_globaldocument_StarOffice_XML_Writer_GlobalDocument">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">%productname% %formatversion% Master Document</value>
+ <value xml:lang="x-translate">%productname% %formatversion% Master Document</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/writer_globaldocument_StarOffice_XML_Writer_ui.xcu b/filter/source/config/fragments/filters/writer_globaldocument_StarOffice_XML_Writer_ui.xcu
new file mode 100644
index 000000000000..216e70c0ed1e
--- /dev/null
+++ b/filter/source/config/fragments/filters/writer_globaldocument_StarOffice_XML_Writer_ui.xcu
@@ -0,0 +1,6 @@
+ <node oor:name="writer_globaldocument_StarOffice_XML_Writer">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">%productname% %formatversion% Text Document</value>
+ <value xml:lang="x-translate">%productname% %formatversion% Text Document</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/writer_globaldocument_pdf_Export.xcu b/filter/source/config/fragments/filters/writer_globaldocument_pdf_Export.xcu
new file mode 100644
index 000000000000..cddd4936a50d
--- /dev/null
+++ b/filter/source/config/fragments/filters/writer_globaldocument_pdf_Export.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="writer_globaldocument_pdf_Export" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"><value>com.sun.star.comp.PDF.PDFDialog</value></prop>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.PDF.PDFFilter</value></prop>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">PDF - Portable Document Format</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>pdf_Portable_Document_Format</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.GlobalDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/writer_pdf_Export.xcu b/filter/source/config/fragments/filters/writer_pdf_Export.xcu
new file mode 100644
index 000000000000..ca3e63d3b887
--- /dev/null
+++ b/filter/source/config/fragments/filters/writer_pdf_Export.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="writer_pdf_Export" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"><value>com.sun.star.comp.PDF.PDFDialog</value></prop>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.PDF.PDFFilter</value></prop>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">PDF - Portable Document Format</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>pdf_Portable_Document_Format</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/writer_web_HTML_help.xcu b/filter/source/config/fragments/filters/writer_web_HTML_help.xcu
new file mode 100644
index 000000000000..e03632542233
--- /dev/null
+++ b/filter/source/config/fragments/filters/writer_web_HTML_help.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="writer_web_HTML_help" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT INTERNAL NOTINFILEDIALOG NOTINCHOOSER ASYNCHRON READONLY</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value>HTML_HELP</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Help content</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_web_HTML_help</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.WebDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/writer_web_StarOffice_XML_Writer.xcu b/filter/source/config/fragments/filters/writer_web_StarOffice_XML_Writer.xcu
new file mode 100644
index 000000000000..8e217e6d79a8
--- /dev/null
+++ b/filter/source/config/fragments/filters/writer_web_StarOffice_XML_Writer.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="writer_web_StarOffice_XML_Writer" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT TEMPLATE ALIEN ENCRYPTION</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value>CXML</value></prop>
+ <prop oor:name="FileFormatVersion"><value>6200</value></prop>
+ <prop oor:name="Type"><value>writer_StarOffice_XML_Writer</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.WebDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/writer_web_StarOffice_XML_Writer_Web_Template.xcu b/filter/source/config/fragments/filters/writer_web_StarOffice_XML_Writer_Web_Template.xcu
new file mode 100644
index 000000000000..64b3b8cdfe81
--- /dev/null
+++ b/filter/source/config/fragments/filters/writer_web_StarOffice_XML_Writer_Web_Template.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="writer_web_StarOffice_XML_Writer_Web_Template" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT TEMPLATE TEMPLATEPATH OWN ALIEN ENCRYPTION</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value>CXMLVWEB</value></prop>
+ <prop oor:name="FileFormatVersion"><value>6200</value></prop>
+ <prop oor:name="Type"><value>writer_web_StarOffice_XML_Writer_Web_Template</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.WebDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/writer_web_StarOffice_XML_Writer_Web_Template_ui.xcu b/filter/source/config/fragments/filters/writer_web_StarOffice_XML_Writer_Web_Template_ui.xcu
new file mode 100644
index 000000000000..b02aaf02d50b
--- /dev/null
+++ b/filter/source/config/fragments/filters/writer_web_StarOffice_XML_Writer_Web_Template_ui.xcu
@@ -0,0 +1,6 @@
+ <node oor:name="writer_web_StarOffice_XML_Writer_Web_Template">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">%productname% %formatversion% HTML Template</value>
+ <value xml:lang="x-translate">%productname% %formatversion% HTML Template</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/writer_web_StarOffice_XML_Writer_ui.xcu b/filter/source/config/fragments/filters/writer_web_StarOffice_XML_Writer_ui.xcu
new file mode 100644
index 000000000000..e7e65247c4bf
--- /dev/null
+++ b/filter/source/config/fragments/filters/writer_web_StarOffice_XML_Writer_ui.xcu
@@ -0,0 +1,6 @@
+ <node oor:name="writer_web_StarOffice_XML_Writer">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">%productname% %formatversion% Text Document (%productname% Writer/Web)</value>
+ <value xml:lang="x-translate">%productname% %formatversion% Text Document (%productname% Writer/Web)</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/writer_web_pdf_Export.xcu b/filter/source/config/fragments/filters/writer_web_pdf_Export.xcu
new file mode 100644
index 000000000000..6cdedd21eaed
--- /dev/null
+++ b/filter/source/config/fragments/filters/writer_web_pdf_Export.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="writer_web_pdf_Export" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"><value>com.sun.star.comp.PDF.PDFDialog</value></prop>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.PDF.PDFFilter</value></prop>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">PDF - Portable Document Format</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>pdf_Portable_Document_Format</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.WebDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/writerglobal8.xcu b/filter/source/config/fragments/filters/writerglobal8.xcu
new file mode 100644
index 000000000000..df5fcb7e6d1b
--- /dev/null
+++ b/filter/source/config/fragments/filters/writerglobal8.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="writerglobal8" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT TEMPLATE OWN PREFERRED ENCRYPTION PASSWORDTOMODIFY</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value>CXML</value></prop>
+ <prop oor:name="FileFormatVersion"><value>6800</value></prop>
+ <prop oor:name="Type"><value>writerglobal8</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.GlobalDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/writerglobal8_HTML.xcu b/filter/source/config/fragments/filters/writerglobal8_HTML.xcu
new file mode 100644
index 000000000000..65bfdb5ab0a9
--- /dev/null
+++ b/filter/source/config/fragments/filters/writerglobal8_HTML.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="writerglobal8_HTML" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT ALIEN ASYNCHRON NOTINCHOOSER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value>HTML</value></prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_web_HTML</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.GlobalDocument</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">HTML (Writer/Global)</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/writerglobal8_ui.xcu b/filter/source/config/fragments/filters/writerglobal8_ui.xcu
new file mode 100644
index 000000000000..1a0d5a41bd51
--- /dev/null
+++ b/filter/source/config/fragments/filters/writerglobal8_ui.xcu
@@ -0,0 +1,5 @@
+ <node oor:name="writerglobal8">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">ODF Master Document</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/writerglobal8_writer.xcu b/filter/source/config/fragments/filters/writerglobal8_writer.xcu
new file mode 100644
index 000000000000..ca3794de493b
--- /dev/null
+++ b/filter/source/config/fragments/filters/writerglobal8_writer.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="writerglobal8_writer" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT TEMPLATE DEFAULT ENCRYPTION PASSWORDTOMODIFY</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value>CXML</value></prop>
+ <prop oor:name="FileFormatVersion"><value>6800</value></prop>
+ <prop oor:name="Type"><value>writer8</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.GlobalDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/writerglobal8_writer_ui.xcu b/filter/source/config/fragments/filters/writerglobal8_writer_ui.xcu
new file mode 100644
index 000000000000..ee04bbd2a547
--- /dev/null
+++ b/filter/source/config/fragments/filters/writerglobal8_writer_ui.xcu
@@ -0,0 +1,5 @@
+ <node oor:name="writerglobal8_writer">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">ODF Text Document</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/writerweb8_writer.xcu b/filter/source/config/fragments/filters/writerweb8_writer.xcu
new file mode 100644
index 000000000000..a3fbc783e92a
--- /dev/null
+++ b/filter/source/config/fragments/filters/writerweb8_writer.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="writerweb8_writer" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT TEMPLATE ENCRYPTION PASSWORDTOMODIFY</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value>CXML</value></prop>
+ <prop oor:name="FileFormatVersion"><value>6800</value></prop>
+ <prop oor:name="Type"><value>writer8</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.WebDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/writerweb8_writer_template.xcu b/filter/source/config/fragments/filters/writerweb8_writer_template.xcu
new file mode 100644
index 000000000000..eb383eafaeeb
--- /dev/null
+++ b/filter/source/config/fragments/filters/writerweb8_writer_template.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="writerweb8_writer_template" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT EXPORT TEMPLATE TEMPLATEPATH OWN ENCRYPTION PASSWORDTOMODIFY</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value>CXMLVWEB</value></prop>
+ <prop oor:name="FileFormatVersion"><value>6800</value></prop>
+ <prop oor:name="Type"><value>writerweb8_writer_template</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.WebDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/writerweb8_writer_template_ui.xcu b/filter/source/config/fragments/filters/writerweb8_writer_template_ui.xcu
new file mode 100644
index 000000000000..9ff5d088d15b
--- /dev/null
+++ b/filter/source/config/fragments/filters/writerweb8_writer_template_ui.xcu
@@ -0,0 +1,5 @@
+ <node oor:name="writerweb8_writer_template">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">HTML Document Template</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/writerweb8_writer_ui.xcu b/filter/source/config/fragments/filters/writerweb8_writer_ui.xcu
new file mode 100644
index 000000000000..8b823ceeca70
--- /dev/null
+++ b/filter/source/config/fragments/filters/writerweb8_writer_ui.xcu
@@ -0,0 +1,5 @@
+ <node oor:name="writerweb8_writer">
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">%productname% Text (%productname% Writer/Web)</value>
+ </prop>
+ </node>
diff --git a/filter/source/config/fragments/frameloaders/com_sun_star_comp_chart2_ChartFrameLoader.xcu b/filter/source/config/fragments/frameloaders/com_sun_star_comp_chart2_ChartFrameLoader.xcu
new file mode 100644
index 000000000000..2f315761a296
--- /dev/null
+++ b/filter/source/config/fragments/frameloaders/com_sun_star_comp_chart2_ChartFrameLoader.xcu
@@ -0,0 +1,3 @@
+ <node oor:name="com.sun.star.comp.chart2.ChartFrameLoader" oor:op="replace" oor:finalized="true" oor:mandatory="true">
+ <prop oor:name="Types"><value>chart_StarOffice_XML_Chart chart8 chart_StarChart_50 chart_StarChart_40 chart_StarChart_30</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/frameloaders/com_sun_star_frame_Bibliography.xcu b/filter/source/config/fragments/frameloaders/com_sun_star_frame_Bibliography.xcu
new file mode 100644
index 000000000000..25fa8762f29d
--- /dev/null
+++ b/filter/source/config/fragments/frameloaders/com_sun_star_frame_Bibliography.xcu
@@ -0,0 +1,3 @@
+ <node oor:name="com.sun.star.frame.Bibliography" oor:op="replace" >
+ <prop oor:name="Types"><value>component_Bibliography</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/frameloaders/com_sun_star_sdb_ContentLoader.xcu b/filter/source/config/fragments/frameloaders/com_sun_star_sdb_ContentLoader.xcu
new file mode 100644
index 000000000000..cd5bb4684827
--- /dev/null
+++ b/filter/source/config/fragments/frameloaders/com_sun_star_sdb_ContentLoader.xcu
@@ -0,0 +1,3 @@
+ <node oor:name="com.sun.star.sdb.ContentLoader" oor:op="replace" >
+ <prop oor:name="Types"><value>component_DB</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/frameloaders/org_openoffice_comp_dbflt_DBContentLoader2.xcu b/filter/source/config/fragments/frameloaders/org_openoffice_comp_dbflt_DBContentLoader2.xcu
new file mode 100644
index 000000000000..299a907fb576
--- /dev/null
+++ b/filter/source/config/fragments/frameloaders/org_openoffice_comp_dbflt_DBContentLoader2.xcu
@@ -0,0 +1,3 @@
+ <node oor:name="org.openoffice.comp.dbflt.DBContentLoader2" oor:op="replace">
+ <prop oor:name="Types"><value>StarBase</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/internalgraphicfilters/bmp_Export.xcu b/filter/source/config/fragments/internalgraphicfilters/bmp_Export.xcu
new file mode 100644
index 000000000000..ea5d9f14bebe
--- /dev/null
+++ b/filter/source/config/fragments/internalgraphicfilters/bmp_Export.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="bmp_Export" oor:op="replace" >
+ <prop oor:name="Type"><value>bmp_MS_Windows</value></prop>
+ <prop oor:name="FormatName"><value>SVBMP</value></prop>
+ <prop oor:name="RealFilterName"/>
+ <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">BMP - Windows Bitmap</value>
+ </prop>
+ <prop oor:name="Flags"><value>EXPORT</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/internalgraphicfilters/bmp_Import.xcu b/filter/source/config/fragments/internalgraphicfilters/bmp_Import.xcu
new file mode 100644
index 000000000000..32a213efa594
--- /dev/null
+++ b/filter/source/config/fragments/internalgraphicfilters/bmp_Import.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="bmp_Import" oor:op="replace" >
+ <prop oor:name="Type"><value>bmp_MS_Windows</value></prop>
+ <prop oor:name="FormatName"><value>SVBMP</value></prop>
+ <prop oor:name="RealFilterName"><value>BMP - MS Windows</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">BMP - Windows Bitmap</value>
+ </prop>
+ <prop oor:name="Flags"><value>IMPORT</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/internalgraphicfilters/dxf_Import.xcu b/filter/source/config/fragments/internalgraphicfilters/dxf_Import.xcu
new file mode 100644
index 000000000000..b132f3c59df6
--- /dev/null
+++ b/filter/source/config/fragments/internalgraphicfilters/dxf_Import.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="dxf_Import" oor:op="replace" >
+ <prop oor:name="Type"><value>dxf_AutoCAD_Interchange</value></prop>
+ <prop oor:name="FormatName"><value>idx</value></prop>
+ <prop oor:name="RealFilterName"><value>DXF - AutoCAD Interchange</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">DXF - AutoCAD Interchange Format</value>
+ </prop>
+ <prop oor:name="Flags"><value>IMPORT</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/internalgraphicfilters/emf_Export.xcu b/filter/source/config/fragments/internalgraphicfilters/emf_Export.xcu
new file mode 100644
index 000000000000..4a82c5080ad4
--- /dev/null
+++ b/filter/source/config/fragments/internalgraphicfilters/emf_Export.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="emf_Export" oor:op="replace" >
+ <prop oor:name="Type"><value>emf_MS_Windows_Metafile</value></prop>
+ <prop oor:name="FormatName"><value>SVEMF</value></prop>
+ <prop oor:name="RealFilterName"/>
+ <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">EMF - Enhanced Metafile</value>
+ </prop>
+ <prop oor:name="Flags"><value>EXPORT</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/internalgraphicfilters/emf_Import.xcu b/filter/source/config/fragments/internalgraphicfilters/emf_Import.xcu
new file mode 100644
index 000000000000..f84aab35b0da
--- /dev/null
+++ b/filter/source/config/fragments/internalgraphicfilters/emf_Import.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="emf_Import" oor:op="replace" >
+ <prop oor:name="Type"><value>emf_MS_Windows_Metafile</value></prop>
+ <prop oor:name="FormatName"><value>SVEMF</value></prop>
+ <prop oor:name="RealFilterName"><value>EMF - MS Windows Metafile</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">EMF - Enhanced Metafile</value>
+ </prop>
+ <prop oor:name="Flags"><value>IMPORT</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/internalgraphicfilters/eps_Export.xcu b/filter/source/config/fragments/internalgraphicfilters/eps_Export.xcu
new file mode 100644
index 000000000000..ed08ed2bc783
--- /dev/null
+++ b/filter/source/config/fragments/internalgraphicfilters/eps_Export.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="eps_Export" oor:op="replace" >
+ <prop oor:name="Type"><value>eps_Encapsulated_PostScript</value></prop>
+ <prop oor:name="FormatName"><value>eps</value></prop>
+ <prop oor:name="RealFilterName"/>
+ <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">EPS - Encapsulated PostScript</value>
+ </prop>
+ <prop oor:name="Flags"><value>EXPORT</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/internalgraphicfilters/eps_Import.xcu b/filter/source/config/fragments/internalgraphicfilters/eps_Import.xcu
new file mode 100644
index 000000000000..7fcd90b66481
--- /dev/null
+++ b/filter/source/config/fragments/internalgraphicfilters/eps_Import.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="eps_Import" oor:op="replace" >
+ <prop oor:name="Type"><value>eps_Encapsulated_PostScript</value></prop>
+ <prop oor:name="FormatName"><value>ips</value></prop>
+ <prop oor:name="RealFilterName"><value>EPS - Encapsulated PostScript</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">EPS - Encapsulated PostScript</value>
+ </prop>
+ <prop oor:name="Flags"><value>IMPORT</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/internalgraphicfilters/gif_Export.xcu b/filter/source/config/fragments/internalgraphicfilters/gif_Export.xcu
new file mode 100644
index 000000000000..08d82e808fb4
--- /dev/null
+++ b/filter/source/config/fragments/internalgraphicfilters/gif_Export.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="gif_Export" oor:op="replace" >
+ <prop oor:name="Type"><value>gif_Graphics_Interchange</value></prop>
+ <prop oor:name="FormatName"><value>egi</value></prop>
+ <prop oor:name="RealFilterName"/>
+ <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">GIF - Graphics Interchange Format</value>
+ </prop>
+ <prop oor:name="Flags"><value>EXPORT</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/internalgraphicfilters/gif_Import.xcu b/filter/source/config/fragments/internalgraphicfilters/gif_Import.xcu
new file mode 100644
index 000000000000..5c1b34ffcbfa
--- /dev/null
+++ b/filter/source/config/fragments/internalgraphicfilters/gif_Import.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="gif_Import" oor:op="replace" >
+ <prop oor:name="Type"><value>gif_Graphics_Interchange</value></prop>
+ <prop oor:name="FormatName"><value>SVIGIF</value></prop>
+ <prop oor:name="RealFilterName"><value>GIF - Graphics Interchange</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">GIF - Graphics Interchange Format</value>
+ </prop>
+ <prop oor:name="Flags"><value>IMPORT</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/internalgraphicfilters/jpg_Export.xcu b/filter/source/config/fragments/internalgraphicfilters/jpg_Export.xcu
new file mode 100644
index 000000000000..36e53e14a7ad
--- /dev/null
+++ b/filter/source/config/fragments/internalgraphicfilters/jpg_Export.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="jpg_Export" oor:op="replace" >
+ <prop oor:name="Type"><value>jpg_JPEG</value></prop>
+ <prop oor:name="FormatName"><value>SVEJPEG</value></prop>
+ <prop oor:name="RealFilterName"/>
+ <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">JPEG - Joint Photographic Experts Group</value>
+ </prop>
+ <prop oor:name="Flags"><value>EXPORT</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/internalgraphicfilters/jpg_Import.xcu b/filter/source/config/fragments/internalgraphicfilters/jpg_Import.xcu
new file mode 100644
index 000000000000..2f4482c90a3b
--- /dev/null
+++ b/filter/source/config/fragments/internalgraphicfilters/jpg_Import.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="jpg_Import" oor:op="replace" >
+ <prop oor:name="Type"><value>jpg_JPEG</value></prop>
+ <prop oor:name="FormatName"><value>SVIJPEG</value></prop>
+ <prop oor:name="RealFilterName"><value>JPG - JPEG</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">JPEG - Joint Photographic Experts Group</value>
+ </prop>
+ <prop oor:name="Flags"><value>IMPORT</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/internalgraphicfilters/met_Export.xcu b/filter/source/config/fragments/internalgraphicfilters/met_Export.xcu
new file mode 100644
index 000000000000..95afe373b91a
--- /dev/null
+++ b/filter/source/config/fragments/internalgraphicfilters/met_Export.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="met_Export" oor:op="replace" >
+ <prop oor:name="Type"><value>met_OS2_Metafile</value></prop>
+ <prop oor:name="FormatName"><value>eme</value></prop>
+ <prop oor:name="RealFilterName"/>
+ <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">MET - OS/2 Metafile</value>
+ </prop>
+ <prop oor:name="Flags"><value>EXPORT</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/internalgraphicfilters/met_Import.xcu b/filter/source/config/fragments/internalgraphicfilters/met_Import.xcu
new file mode 100644
index 000000000000..c1084e53e812
--- /dev/null
+++ b/filter/source/config/fragments/internalgraphicfilters/met_Import.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="met_Import" oor:op="replace" >
+ <prop oor:name="Type"><value>met_OS2_Metafile</value></prop>
+ <prop oor:name="FormatName"><value>ime</value></prop>
+ <prop oor:name="RealFilterName"><value>MET - OS/2 Metafile</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">MET - OS/2 Metafile</value>
+ </prop>
+ <prop oor:name="Flags"><value>IMPORT</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/internalgraphicfilters/pbm_Export.xcu b/filter/source/config/fragments/internalgraphicfilters/pbm_Export.xcu
new file mode 100644
index 000000000000..62e728d7b268
--- /dev/null
+++ b/filter/source/config/fragments/internalgraphicfilters/pbm_Export.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="pbm_Export" oor:op="replace" >
+ <prop oor:name="Type"><value>pbm_Portable_Bitmap</value></prop>
+ <prop oor:name="FormatName"><value>epb</value></prop>
+ <prop oor:name="RealFilterName"/>
+ <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">PBM - Portable Bitmap</value>
+ </prop>
+ <prop oor:name="Flags"><value>EXPORT</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/internalgraphicfilters/pbm_Import.xcu b/filter/source/config/fragments/internalgraphicfilters/pbm_Import.xcu
new file mode 100644
index 000000000000..62736e4b8351
--- /dev/null
+++ b/filter/source/config/fragments/internalgraphicfilters/pbm_Import.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="pbm_Import" oor:op="replace" >
+ <prop oor:name="Type"><value>pbm_Portable_Bitmap</value></prop>
+ <prop oor:name="FormatName"><value>ipb</value></prop>
+ <prop oor:name="RealFilterName"><value>PBM - Portable Bitmap</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">PBM - Portable Bitmap</value>
+ </prop>
+ <prop oor:name="Flags"><value>IMPORT</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/internalgraphicfilters/pcd_Import_Base.xcu b/filter/source/config/fragments/internalgraphicfilters/pcd_Import_Base.xcu
new file mode 100644
index 000000000000..5f240c1e24bc
--- /dev/null
+++ b/filter/source/config/fragments/internalgraphicfilters/pcd_Import_Base.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="pcd_Import_Base" oor:op="replace" >
+ <prop oor:name="Type"><value>pcd_Photo_CD_Base</value></prop>
+ <prop oor:name="FormatName"><value>icd</value></prop>
+ <prop oor:name="RealFilterName"><value>draw_PCD_Photo_CD_Base</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">PCD - Kodak Photo CD (768x512)</value>
+ </prop>
+ <prop oor:name="Flags"><value>IMPORT</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/internalgraphicfilters/pcd_Import_Base16.xcu b/filter/source/config/fragments/internalgraphicfilters/pcd_Import_Base16.xcu
new file mode 100644
index 000000000000..64625f1c391c
--- /dev/null
+++ b/filter/source/config/fragments/internalgraphicfilters/pcd_Import_Base16.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="pcd_Import_Base16" oor:op="replace" >
+ <prop oor:name="Type"><value>pcd_Photo_CD_Base16</value></prop>
+ <prop oor:name="FormatName"><value>icd</value></prop>
+ <prop oor:name="RealFilterName"><value>draw_PCD_Photo_CD_Base16</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">PCD - Kodak Photo CD (192x128)</value>
+ </prop>
+ <prop oor:name="Flags"><value>IMPORT</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/internalgraphicfilters/pcd_Import_Base4.xcu b/filter/source/config/fragments/internalgraphicfilters/pcd_Import_Base4.xcu
new file mode 100644
index 000000000000..927d1ad54fc5
--- /dev/null
+++ b/filter/source/config/fragments/internalgraphicfilters/pcd_Import_Base4.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="pcd_Import_Base4" oor:op="replace" >
+ <prop oor:name="Type"><value>pcd_Photo_CD_Base4</value></prop>
+ <prop oor:name="FormatName"><value>icd</value></prop>
+ <prop oor:name="RealFilterName"><value>draw_PCD_Photo_CD_Base4</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">PCD - Kodak Photo CD (384x256)</value>
+ </prop>
+ <prop oor:name="Flags"><value>IMPORT</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/internalgraphicfilters/pct_Export.xcu b/filter/source/config/fragments/internalgraphicfilters/pct_Export.xcu
new file mode 100644
index 000000000000..6dcae82e07d4
--- /dev/null
+++ b/filter/source/config/fragments/internalgraphicfilters/pct_Export.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="pct_Export" oor:op="replace" >
+ <prop oor:name="Type"><value>pct_Mac_Pict</value></prop>
+ <prop oor:name="FormatName"><value>ept</value></prop>
+ <prop oor:name="RealFilterName"/>
+ <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">PCT - Mac Pict</value>
+ </prop>
+ <prop oor:name="Flags"><value>EXPORT</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/internalgraphicfilters/pct_Import.xcu b/filter/source/config/fragments/internalgraphicfilters/pct_Import.xcu
new file mode 100644
index 000000000000..b8fc4175d895
--- /dev/null
+++ b/filter/source/config/fragments/internalgraphicfilters/pct_Import.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="pct_Import" oor:op="replace" >
+ <prop oor:name="Type"><value>pct_Mac_Pict</value></prop>
+ <prop oor:name="FormatName"><value>ipt</value></prop>
+ <prop oor:name="RealFilterName"><value>PCT - Mac Pict</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">PCT - Mac Pict</value>
+ </prop>
+ <prop oor:name="Flags"><value>IMPORT</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/internalgraphicfilters/pcx_Import.xcu b/filter/source/config/fragments/internalgraphicfilters/pcx_Import.xcu
new file mode 100644
index 000000000000..7fa5dac0345a
--- /dev/null
+++ b/filter/source/config/fragments/internalgraphicfilters/pcx_Import.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="pcx_Import" oor:op="replace" >
+ <prop oor:name="Type"><value>pcx_Zsoft_Paintbrush</value></prop>
+ <prop oor:name="FormatName"><value>ipx</value></prop>
+ <prop oor:name="RealFilterName"><value>PCX - Zsoft Paintbrush</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">PCX - Zsoft Paintbrush</value>
+ </prop>
+ <prop oor:name="Flags"><value>IMPORT</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/internalgraphicfilters/pgm_Export.xcu b/filter/source/config/fragments/internalgraphicfilters/pgm_Export.xcu
new file mode 100644
index 000000000000..21628d9c1b02
--- /dev/null
+++ b/filter/source/config/fragments/internalgraphicfilters/pgm_Export.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="pgm_Export" oor:op="replace" >
+ <prop oor:name="Type"><value>pgm_Portable_Graymap</value></prop>
+ <prop oor:name="FormatName"><value>epg</value></prop>
+ <prop oor:name="RealFilterName"/>
+ <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">PGM - Portable Graymap</value>
+ </prop>
+ <prop oor:name="Flags"><value>EXPORT</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/internalgraphicfilters/pgm_Import.xcu b/filter/source/config/fragments/internalgraphicfilters/pgm_Import.xcu
new file mode 100644
index 000000000000..45cc3a83cea4
--- /dev/null
+++ b/filter/source/config/fragments/internalgraphicfilters/pgm_Import.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="pgm_Import" oor:op="replace" >
+ <prop oor:name="Type"><value>pgm_Portable_Graymap</value></prop>
+ <prop oor:name="FormatName"><value>ipb</value></prop>
+ <prop oor:name="RealFilterName"><value>PGM - Portable Graymap</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">PGM - Portable Graymap</value>
+ </prop>
+ <prop oor:name="Flags"><value>IMPORT</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/internalgraphicfilters/png_Export.xcu b/filter/source/config/fragments/internalgraphicfilters/png_Export.xcu
new file mode 100644
index 000000000000..abafad770e3a
--- /dev/null
+++ b/filter/source/config/fragments/internalgraphicfilters/png_Export.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="png_Export" oor:op="replace" >
+ <prop oor:name="Type"><value>png_Portable_Network_Graphic</value></prop>
+ <prop oor:name="FormatName"><value>SVEPNG</value></prop>
+ <prop oor:name="RealFilterName"/>
+ <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">PNG - Portable Network Graphic</value>
+ </prop>
+ <prop oor:name="Flags"><value>EXPORT</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/internalgraphicfilters/png_Import.xcu b/filter/source/config/fragments/internalgraphicfilters/png_Import.xcu
new file mode 100644
index 000000000000..5979e7857f28
--- /dev/null
+++ b/filter/source/config/fragments/internalgraphicfilters/png_Import.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="png_Import" oor:op="replace" >
+ <prop oor:name="Type"><value>png_Portable_Network_Graphic</value></prop>
+ <prop oor:name="FormatName"><value>SVIPNG</value></prop>
+ <prop oor:name="RealFilterName"><value>PNG - Portable Network Graphic</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">PNG - Portable Network Graphic</value>
+ </prop>
+ <prop oor:name="Flags"><value>IMPORT</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/internalgraphicfilters/ppm_Export.xcu b/filter/source/config/fragments/internalgraphicfilters/ppm_Export.xcu
new file mode 100644
index 000000000000..2d7a18c34e3f
--- /dev/null
+++ b/filter/source/config/fragments/internalgraphicfilters/ppm_Export.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="ppm_Export" oor:op="replace" >
+ <prop oor:name="Type"><value>ppm_Portable_Pixelmap</value></prop>
+ <prop oor:name="FormatName"><value>epp</value></prop>
+ <prop oor:name="RealFilterName"/>
+ <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">PPM - Portable Pixelmap</value>
+ </prop>
+ <prop oor:name="Flags"><value>EXPORT</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/internalgraphicfilters/ppm_Import.xcu b/filter/source/config/fragments/internalgraphicfilters/ppm_Import.xcu
new file mode 100644
index 000000000000..2d4792b7b7b5
--- /dev/null
+++ b/filter/source/config/fragments/internalgraphicfilters/ppm_Import.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="ppm_Import" oor:op="replace" >
+ <prop oor:name="Type"><value>ppm_Portable_Pixelmap</value></prop>
+ <prop oor:name="FormatName"><value>ipb</value></prop>
+ <prop oor:name="RealFilterName"><value>PPM - Portable Pixelmap</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">PPM - Portable Pixelmap</value>
+ </prop>
+ <prop oor:name="Flags"><value>IMPORT</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/internalgraphicfilters/psd_Import.xcu b/filter/source/config/fragments/internalgraphicfilters/psd_Import.xcu
new file mode 100644
index 000000000000..cbfc6e4710e7
--- /dev/null
+++ b/filter/source/config/fragments/internalgraphicfilters/psd_Import.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="psd_Import" oor:op="replace" >
+ <prop oor:name="Type"><value>psd_Adobe_Photoshop</value></prop>
+ <prop oor:name="FormatName"><value>ipd</value></prop>
+ <prop oor:name="RealFilterName"><value>PSD - Adobe Photoshop</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">PSD - Adobe Photoshop</value>
+ </prop>
+ <prop oor:name="Flags"><value>IMPORT</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/internalgraphicfilters/ras_Export.xcu b/filter/source/config/fragments/internalgraphicfilters/ras_Export.xcu
new file mode 100644
index 000000000000..aabae28a10c4
--- /dev/null
+++ b/filter/source/config/fragments/internalgraphicfilters/ras_Export.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="ras_Export" oor:op="replace" >
+ <prop oor:name="Type"><value>ras_Sun_Rasterfile</value></prop>
+ <prop oor:name="FormatName"><value>era</value></prop>
+ <prop oor:name="RealFilterName"/>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">RAS - Sun Raster Image</value>
+ </prop>
+ <prop oor:name="Flags"><value>EXPORT</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/internalgraphicfilters/ras_Import.xcu b/filter/source/config/fragments/internalgraphicfilters/ras_Import.xcu
new file mode 100644
index 000000000000..ce30b3c2f00f
--- /dev/null
+++ b/filter/source/config/fragments/internalgraphicfilters/ras_Import.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="ras_Import" oor:op="replace" >
+ <prop oor:name="Type"><value>ras_Sun_Rasterfile</value></prop>
+ <prop oor:name="FormatName"><value>ira</value></prop>
+ <prop oor:name="RealFilterName"><value>RAS - Sun Rasterfile</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">RAS - Sun Raster Image</value>
+ </prop>
+ <prop oor:name="Flags"><value>IMPORT</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/internalgraphicfilters/sgf_Import.xcu b/filter/source/config/fragments/internalgraphicfilters/sgf_Import.xcu
new file mode 100644
index 000000000000..29da3f9f9165
--- /dev/null
+++ b/filter/source/config/fragments/internalgraphicfilters/sgf_Import.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="sgf_Import" oor:op="replace" >
+ <prop oor:name="Type"><value>sgf_StarOffice_Writer_SGF</value></prop>
+ <prop oor:name="FormatName"><value>SVSGF</value></prop>
+ <prop oor:name="RealFilterName"><value>SGF - StarOffice Writer SGF</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">SGF - StarWriter Graphics Format</value>
+ </prop>
+ <prop oor:name="Flags"><value>IMPORT</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/internalgraphicfilters/sgv_Import.xcu b/filter/source/config/fragments/internalgraphicfilters/sgv_Import.xcu
new file mode 100644
index 000000000000..cc40a3815769
--- /dev/null
+++ b/filter/source/config/fragments/internalgraphicfilters/sgv_Import.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="sgv_Import" oor:op="replace" >
+ <prop oor:name="Type"><value>sgv_StarDraw_20</value></prop>
+ <prop oor:name="FormatName"><value>SVSGV</value></prop>
+ <prop oor:name="RealFilterName"><value>SGV - StarDraw 2.0</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">SGV - StarDraw 2.0</value>
+ </prop>
+ <prop oor:name="Flags"><value>IMPORT</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/internalgraphicfilters/svg_Export.xcu b/filter/source/config/fragments/internalgraphicfilters/svg_Export.xcu
new file mode 100644
index 000000000000..72653869a68d
--- /dev/null
+++ b/filter/source/config/fragments/internalgraphicfilters/svg_Export.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="svg_Export" oor:op="replace" >
+ <prop oor:name="Type"><value>svg_Scalable_Vector_Graphics</value></prop>
+ <prop oor:name="FormatName"><value>SVESVG</value></prop>
+ <prop oor:name="RealFilterName"/>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">SVG - Scalable Vector Graphics</value>
+ </prop>
+ <prop oor:name="Flags"><value>EXPORT</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/internalgraphicfilters/svm_Export.xcu b/filter/source/config/fragments/internalgraphicfilters/svm_Export.xcu
new file mode 100644
index 000000000000..d6b55e8bf169
--- /dev/null
+++ b/filter/source/config/fragments/internalgraphicfilters/svm_Export.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="svm_Export" oor:op="replace" >
+ <prop oor:name="Type"><value>svm_StarView_Metafile</value></prop>
+ <prop oor:name="FormatName"><value>SVMETAFILE</value></prop>
+ <prop oor:name="RealFilterName"/>
+ <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">SVM - StarView Metafile</value>
+ </prop>
+ <prop oor:name="Flags"><value>EXPORT</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/internalgraphicfilters/svm_Import.xcu b/filter/source/config/fragments/internalgraphicfilters/svm_Import.xcu
new file mode 100644
index 000000000000..8a291265710b
--- /dev/null
+++ b/filter/source/config/fragments/internalgraphicfilters/svm_Import.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="svm_Import" oor:op="replace" >
+ <prop oor:name="Type"><value>svm_StarView_Metafile</value></prop>
+ <prop oor:name="FormatName"><value>SVMETAFILE</value></prop>
+ <prop oor:name="RealFilterName"><value>SVM - StarView Metafile</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">SVM - StarView Metafile</value>
+ </prop>
+ <prop oor:name="Flags"><value>IMPORT</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/internalgraphicfilters/tga_Import.xcu b/filter/source/config/fragments/internalgraphicfilters/tga_Import.xcu
new file mode 100644
index 000000000000..af3db9b3c8fc
--- /dev/null
+++ b/filter/source/config/fragments/internalgraphicfilters/tga_Import.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="tga_Import" oor:op="replace" >
+ <prop oor:name="Type"><value>tga_Truevision_TARGA</value></prop>
+ <prop oor:name="FormatName"><value>itg</value></prop>
+ <prop oor:name="RealFilterName"><value>TGA - Truevision TARGA</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">TGA - Truevision Targa</value>
+ </prop>
+ <prop oor:name="Flags"><value>IMPORT</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/internalgraphicfilters/tif_Export.xcu b/filter/source/config/fragments/internalgraphicfilters/tif_Export.xcu
new file mode 100644
index 000000000000..a7d39ebdc8a4
--- /dev/null
+++ b/filter/source/config/fragments/internalgraphicfilters/tif_Export.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="tif_Export" oor:op="replace" >
+ <prop oor:name="Type"><value>tif_Tag_Image_File</value></prop>
+ <prop oor:name="FormatName"><value>eti</value></prop>
+ <prop oor:name="RealFilterName"/>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">TIFF - Tagged Image File Format</value>
+ </prop>
+ <prop oor:name="Flags"><value>EXPORT</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/internalgraphicfilters/tif_Import.xcu b/filter/source/config/fragments/internalgraphicfilters/tif_Import.xcu
new file mode 100644
index 000000000000..2737128acf05
--- /dev/null
+++ b/filter/source/config/fragments/internalgraphicfilters/tif_Import.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="tif_Import" oor:op="replace" >
+ <prop oor:name="Type"><value>tif_Tag_Image_File</value></prop>
+ <prop oor:name="FormatName"><value>iti</value></prop>
+ <prop oor:name="RealFilterName"><value>TIF - Tag Image File</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">TIFF - Tagged Image File Format</value>
+ </prop>
+ <prop oor:name="Flags"><value>IMPORT</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/internalgraphicfilters/wmf_Export.xcu b/filter/source/config/fragments/internalgraphicfilters/wmf_Export.xcu
new file mode 100644
index 000000000000..0a97f23b4875
--- /dev/null
+++ b/filter/source/config/fragments/internalgraphicfilters/wmf_Export.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="wmf_Export" oor:op="replace" >
+ <prop oor:name="Type"><value>wmf_MS_Windows_Metafile</value></prop>
+ <prop oor:name="FormatName"><value>SVWMF</value></prop>
+ <prop oor:name="RealFilterName"/>
+ <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">WMF - Windows Metafile</value>
+ </prop>
+ <prop oor:name="Flags"><value>EXPORT</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/internalgraphicfilters/wmf_Import.xcu b/filter/source/config/fragments/internalgraphicfilters/wmf_Import.xcu
new file mode 100644
index 000000000000..313221f4edc4
--- /dev/null
+++ b/filter/source/config/fragments/internalgraphicfilters/wmf_Import.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="wmf_Import" oor:op="replace" >
+ <prop oor:name="Type"><value>wmf_MS_Windows_Metafile</value></prop>
+ <prop oor:name="FormatName"><value>SVWMF</value></prop>
+ <prop oor:name="RealFilterName"><value>WMF - MS Windows Metafile</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">WMF - Windows Metafile</value>
+ </prop>
+ <prop oor:name="Flags"><value>IMPORT</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/internalgraphicfilters/xbm_Import.xcu b/filter/source/config/fragments/internalgraphicfilters/xbm_Import.xcu
new file mode 100644
index 000000000000..a433e15a7fc5
--- /dev/null
+++ b/filter/source/config/fragments/internalgraphicfilters/xbm_Import.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="xbm_Import" oor:op="replace" >
+ <prop oor:name="Type"><value>xbm_X_Consortium</value></prop>
+ <prop oor:name="FormatName"><value>SVIXBM</value></prop>
+ <prop oor:name="RealFilterName"><value>XBM - X-Consortium</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">XBM - X Bitmap</value>
+ </prop>
+ <prop oor:name="Flags"><value>IMPORT</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/internalgraphicfilters/xpm_Export.xcu b/filter/source/config/fragments/internalgraphicfilters/xpm_Export.xcu
new file mode 100644
index 000000000000..ee1effb786e9
--- /dev/null
+++ b/filter/source/config/fragments/internalgraphicfilters/xpm_Export.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="xpm_Export" oor:op="replace" >
+ <prop oor:name="Type"><value>xpm_XPM</value></prop>
+ <prop oor:name="FormatName"><value>exp</value></prop>
+ <prop oor:name="RealFilterName"/>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">XPM - X PixMap</value>
+ </prop>
+ <prop oor:name="Flags"><value>EXPORT</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/internalgraphicfilters/xpm_Import.xcu b/filter/source/config/fragments/internalgraphicfilters/xpm_Import.xcu
new file mode 100644
index 000000000000..886e29bfe708
--- /dev/null
+++ b/filter/source/config/fragments/internalgraphicfilters/xpm_Import.xcu
@@ -0,0 +1,10 @@
+ <node oor:name="xpm_Import" oor:op="replace" >
+ <prop oor:name="Type"><value>xpm_XPM</value></prop>
+ <prop oor:name="FormatName"><value>SVIXPM</value></prop>
+ <prop oor:name="RealFilterName"><value>XPM</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">XPM - X PixMap</value>
+ </prop>
+ <prop oor:name="Flags"><value>IMPORT</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/langfilter.xsl b/filter/source/config/fragments/langfilter.xsl
new file mode 100644
index 000000000000..76cfcff20ac6
--- /dev/null
+++ b/filter/source/config/fragments/langfilter.xsl
@@ -0,0 +1,37 @@
+<?xml version='1.0' encoding="UTF-8"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:oor="http://openoffice.org/2001/registry">
+<xsl:output method="xml" indent="yes" omit-xml-declaration="no" version="1.0" encoding="UTF-8"/>
+<xsl:param name="lang"/>
+<xsl:template match="*">
+ <xsl:if test="count(.//*[@xml:lang=$lang])&gt;0">
+ <xsl:copy>
+ <xsl:apply-templates select="*|@*"/>
+ </xsl:copy>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="@*">
+ <xsl:copy>
+ <xsl:apply-templates select="*|@*"/>
+ </xsl:copy>
+</xsl:template>
+
+<xsl:template match="value">
+ <xsl:if test="@xml:lang=$lang">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|text()"/>
+ </xsl:copy>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="text()">
+ <xsl:if test="../@xml:lang=$lang">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|text()"/>
+ </xsl:copy>
+ </xsl:if>
+</xsl:template>
+
+
+</xsl:stylesheet>
+
diff --git a/filter/source/config/fragments/makefile.mk b/filter/source/config/fragments/makefile.mk
new file mode 100644
index 000000000000..d827b3496359
--- /dev/null
+++ b/filter/source/config/fragments/makefile.mk
@@ -0,0 +1,255 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ = ..$/..$/..
+TARGET = FCFGPkg
+PRJNAME = filter
+
+# -----------------------------------------------------------------------------
+# include global settings
+# -----------------------------------------------------------------------------
+
+.INCLUDE: settings.mk
+
+# -----------------------------------------------------------------------------
+# include all package definition files
+# -----------------------------------------------------------------------------
+
+.INCLUDE: packagedef.mk
+
+# -----------------------------------------------------------------------------
+# list of all required destination files
+# -----------------------------------------------------------------------------
+
+REALFILTERPACKAGES_TYPES_FLAG = \
+ $(DIR_FILTERCFGOUT)$/fcfg_base.types_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_writer.types_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_web.types_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_global.types_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_w4w.types_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_calc.types_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_draw.types_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_impress.types_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_database.types_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_chart.types_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_math.types_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_xslt.types_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_palm.types_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_pocketexcel.types_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_pocketword.types_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_drawgraphics.types_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_impressgraphics.types_flag
+
+.IF "$(WITH_BINFILTER)" != "NO"
+REALFILTERPACKAGES_TYPES_FLAG += \
+ $(DIR_FILTERCFGOUT)$/fcfg_writer_bf.types_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_web_bf.types_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_global_bf.types_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_calc_bf.types_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_draw_bf.types_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_impress_bf.types_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_chart_bf.types_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_math_bf.types_flag
+.ENDIF
+
+REALFILTERPACKAGES_FILTERS_FLAG = \
+ $(DIR_FILTERCFGOUT)$/fcfg_base.filters_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_writer.filters_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_web.filters_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_global.filters_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_w4w.filters_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_calc.filters_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_draw.filters_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_impress.filters_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_database.filters_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_chart.filters_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_math.filters_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_xslt.filters_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_palm.filters_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_pocketexcel.filters_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_pocketword.filters_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_drawgraphics.filters_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_impressgraphics.filters_flag
+
+.IF "$(WITH_BINFILTER)" != "NO"
+REALFILTERPACKAGES_FILTERS_FLAG += \
+ $(DIR_FILTERCFGOUT)$/fcfg_writer_bf.filters_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_web_bf.filters_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_global_bf.filters_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_calc_bf.filters_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_draw_bf.filters_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_impress_bf.filters_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_chart_bf.filters_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_math_bf.filters_flag
+.ENDIF
+
+REALFILTERPACKAGES_FILTERS_UI_MERGE = \
+ $(DIR_LOCMERGE)$/filter_ui.xcu
+
+REALFILTERPACKAGES_FILTERS_UI_LANGPACKS = \
+ $(foreach,i,$(alllangiso) $(DIR_LANGPACK)$/$i$/org$/openoffice$/TypeDetection$/Filter.xcu)
+
+REALFILTERPACKAGES_FILTERS_UI_LANGPACKS_PACKED = \
+ $(foreach,i,$(alllangiso) $(COMMONBIN)$/fcfg_langpack_$i.zip)
+
+REALFILTERPACKAGES_OTHERS_FLAG = \
+ $(DIR_FILTERCFGOUT)$/fcfg_base.others_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_writer.others_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_web.others_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_global.others_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_w4w.others_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_calc.others_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_draw.others_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_impress.others_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_database.others_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_chart.others_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_math.others_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_xslt.others_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_palm.others_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_pocketexcel.others_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_pocketword.others_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_drawgraphics.others_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_impressgraphics.others_flag
+
+.IF "$(WITH_BINFILTER)" != "NO"
+REALFILTERPACKAGES_OTHERS_FLAG += \
+ $(DIR_FILTERCFGOUT)$/fcfg_writer_bf.others_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_web_bf.others_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_global_bf.others_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_calc_bf.others_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_draw_bf.others_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_impress_bf.others_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_chart_bf.others_flag \
+ $(DIR_FILTERCFGOUT)$/fcfg_math_bf.others_flag
+.ENDIF
+
+INTERNALFILTERPACKAGES_TYPES_FLAG = \
+ $(DIR_FILTERCFGOUT)$/fcfg_internalgraphics.types_flag
+
+INTERNALFILTERPACKAGES_FILTERS_FLAG = \
+ $(DIR_FILTERCFGOUT)$/fcfg_internalgraphics.filters_flag
+
+ALL_FLAGS = \
+ $(REALFILTERPACKAGES_TYPES_FLAG) \
+ $(REALFILTERPACKAGES_FILTERS_FLAG) \
+ $(REALFILTERPACKAGES_FILTERS_UI_MERGE) \
+ $(REALFILTERPACKAGES_FILTERS_UI_LANGPACKS) \
+ $(REALFILTERPACKAGES_OTHERS_FLAG) \
+ $(INTERNALFILTERPACKAGES_TYPES_FLAG) \
+ $(INTERNALFILTERPACKAGES_FILTERS_FLAG)
+
+# -----------------------------------------------------------------------------
+# build all
+# -----------------------------------------------------------------------------
+
+zip1generatedlangs=TRUE
+zip1langdirs=$(alllangiso)
+ZIP1TARGET=fcfg_langpack
+ZIP1FLAGS= -u -r
+ZIP1DIR=$(DIR_LANGPACK)$/$(LANGDIR)
+ZIP1LIST=$(LANGDIR)$/*
+
+.INCLUDE: target.mk
+
+ALLTAR : $(ALL_FLAGS)
+
+$(ALL_FLAGS) : $(INCLUDE_FRAGMENTS)
+
+.IF "$(SOLAR_JAVA)"==""
+#cmc, hack to workaround the java build requirement
+.IF "$(SYSTEM_PYTHON)" == "YES"
+MERGE:=python ../tools/merge/pyAltFCFGMerge
+.ELSE
+MERGE:=$(AUGMENT_LIBRARY_PATH) $(SOLARBINDIR)/python ../tools/merge/pyAltFCFGMerge
+.ENDIF
+.ELSE
+MERGE := $(JAVAI) $(JAVAIFLAGS) -jar $(SOLARBINDIR)$/FCFGMerge.jar
+.ENDIF
+
+PACKLANG := $(XSLTPROC) --nonet
+PACKLANG_IN :=
+PACKLANG_PARAM := --stringparam
+PACKLANG_XSL :=
+
+# -----------------------------------------------------------------------------
+# build every module seperated
+# -----------------------------------------------------------------------------
+
+$(REALFILTERPACKAGES_TYPES_FLAG) : $$(TYPES_4$$(@:b))
+ @echo ===================================================================
+ @echo Merge type fragments for package $@
+ @echo ===================================================================
+ -$(MKDIRHIER) $(DIR_MODPACKS)
+ $(MERGE) fragmentsdir=. tempdir=$(TEMP) outdir=$(DIR_MODPACKS) pkg=$(DIR_MODPACKS)$/$(@:b)_types.xcu xmlpackage=Types tcfg=$(mktmp items=$(TYPES_4$(@:b):b:t",":s/.xcu//)) && $(TOUCH) $@
+
+$(REALFILTERPACKAGES_FILTERS_UI_MERGE) : $(ALL_UI_FILTERS)
+ @echo ===================================================================
+ @echo Merge localized filter fragments for package $@
+ @echo ===================================================================
+ -$(MKDIRHIER) $(DIR_LOCMERGE)
+ $(MERGE) fragmentsdir=$(DIR_LOCFRAG) tempdir=$(TEMP) pkg=$@ xmlpackage=Filter fcfg=$(mktmp items=$(ALL_UI_FILTERS:b:t",")) languagepack=true
+
+# Note: The used XSL transformation returns errors on stderr.
+# But they dont do it in case we use the -OUT parameter.
+# So we have to dump stdout to the target file and let stderr messages break the build!
+$(REALFILTERPACKAGES_FILTERS_UI_LANGPACKS) : $(REALFILTERPACKAGES_FILTERS_UI_MERGE)
+ @echo ===================================================================
+ @echo Building language packages $(@:b:s/Filter_//) for filters
+ @echo ===================================================================
+ +-$(MKDIRHIER) $(@:d)
+ $(PACKLANG) $(PACKLANG_PARAM) lang $(@:d:d:d:d:d:d:d:d:b) $(PACKLANG_XSL) langfilter.xsl $(PACKLANG_IN) $< > $@
+
+$(REALFILTERPACKAGES_FILTERS_UI_LANGPACKS_PACKED) : $(REALFILTERPACKAGES_FILTERS_UI_LANGPACKS)
+
+$(REALFILTERPACKAGES_FILTERS_FLAG) : $$(FILTERS_4$$(@:b))
+ @echo ===================================================================
+ @echo Building packages filter $@
+ @echo ===================================================================
+ -$(MKDIRHIER) $(DIR_MODPACKS)
+ $(MERGE) fragmentsdir=. tempdir=$(TEMP) outdir=$(DIR_MODPACKS) pkg=$(DIR_MODPACKS)$/$(@:b)_filters.xcu xmlpackage=Filter fcfg=$(mktmp items=$(FILTERS_4$(@:b):b:t",":s/.xcu//)) && $(TOUCH) $@
+
+$(REALFILTERPACKAGES_OTHERS_FLAG) : $$(ALL_4$$(@:b))
+ @echo ===================================================================
+ @echo Building packages others $@
+ @echo ===================================================================
+ -$(MKDIRHIER) $(DIR_MODPACKS)
+ $(MERGE) fragmentsdir=. tempdir=$(TEMP) outdir=$(DIR_MODPACKS) pkg=$(DIR_MODPACKS)$/$(@:b)_others.xcu xmlpackage=Misc lcfg=$(mktmp items=$(FRAMELOADERS_4$(@:b):b:t",":s/.xcu//)) ccfg=$(mktmp items=$(CONTENTHANDLERS_4$(@:b):b:t",":s/.xcu//)) && $(TOUCH) $@
+
+$(INTERNALFILTERPACKAGES_TYPES_FLAG) : $$(TYPES_4$$(@:b))
+ @echo ===================================================================
+ @echo Building special packages types $@
+ @echo ===================================================================
+ -$(MKDIRHIER) $(DIR_MODPACKS)
+ $(MERGE) fragmentsdir=. tempdir=$(TEMP) outdir=$(DIR_MODPACKS) pkg=$(DIR_MODPACKS)$/$(@:b)_types.xcu xmlpackage=Types tcfg=$(mktmp items=$(TYPES_4$(@:b):b:t",":s/.xcu//)) && $(TOUCH) $@
+
+$(INTERNALFILTERPACKAGES_FILTERS_FLAG) : $$(FILTERS_4$$(@:b))
+ @echo ===================================================================
+ @echo Building special packages filter $@
+ @echo ===================================================================
+ -$(MKDIRHIER) $(DIR_MODPACKS)
+ $(MERGE) fragmentsdir=. tempdir=$(TEMP) outdir=$(DIR_MODPACKS) pkg=$(DIR_MODPACKS)$/$(@:b)_filters.xcu xmlpackage=GraphicFilter fcfg=$(mktmp items=$(FILTERS_4$(@:b):b:t",":s/.xcu//)) subdir_filters=internalgraphicfilters && $(TOUCH) $@
+
diff --git a/filter/source/config/fragments/packagedef.mk b/filter/source/config/fragments/packagedef.mk
new file mode 100644
index 000000000000..fda7b4a6cc60
--- /dev/null
+++ b/filter/source/config/fragments/packagedef.mk
@@ -0,0 +1,71 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+
+DIR_FILTERCFGOUT := $(MISC)$/filters
+.IF "$(WITH_LANG)"!=""
+DIR_LOCFRAG := $(DIR_FILTERCFGOUT)$/ui$/fragments
+.ELSE # "$(WITH_LANG)"!=""
+DIR_LOCFRAG := $(PRJ)$/source$/config$/fragments
+.ENDIF # "$(WITH_LANG)"!=""
+DIR_LOCMERGE := $(DIR_FILTERCFGOUT)$/ui$/merge
+DIR_LANGPACK := $(DIR_FILTERCFGOUT)$/ui$/langpacks
+DIR_MODPACKS := $(DIR_FILTERCFGOUT)$/modulepacks
+
+INCLUDE_FRAGMENTS = \
+ $(PRJ)$/source$/config$/fragments$/fcfg_base.mk \
+ $(PRJ)$/source$/config$/fragments$/fcfg_database.mk \
+ $(PRJ)$/source$/config$/fragments$/fcfg_writer.mk \
+ $(PRJ)$/source$/config$/fragments$/fcfg_web.mk \
+ $(PRJ)$/source$/config$/fragments$/fcfg_global.mk \
+ $(PRJ)$/source$/config$/fragments$/fcfg_w4w.mk \
+ $(PRJ)$/source$/config$/fragments$/fcfg_calc.mk \
+ $(PRJ)$/source$/config$/fragments$/fcfg_draw.mk \
+ $(PRJ)$/source$/config$/fragments$/fcfg_impress.mk \
+ $(PRJ)$/source$/config$/fragments$/fcfg_database.mk \
+ $(PRJ)$/source$/config$/fragments$/fcfg_chart.mk \
+ $(PRJ)$/source$/config$/fragments$/fcfg_math.mk \
+ $(PRJ)$/source$/config$/fragments$/fcfg_xslt.mk \
+ $(PRJ)$/source$/config$/fragments$/fcfg_palm.mk \
+ $(PRJ)$/source$/config$/fragments$/fcfg_pocketword.mk \
+ $(PRJ)$/source$/config$/fragments$/fcfg_pocketexcel.mk \
+ $(PRJ)$/source$/config$/fragments$/fcfg_drawgraphics.mk \
+ $(PRJ)$/source$/config$/fragments$/fcfg_impressgraphics.mk \
+ $(PRJ)$/source$/config$/fragments$/fcfg_internalgraphics.mk
+
+.IF "$(WITH_BINFILTER)" != "NO"
+INCLUDE_FRAGMENTS += \
+ $(PRJ)$/source$/config$/fragments$/fcfg_writer_bf.mk \
+ $(PRJ)$/source$/config$/fragments$/fcfg_web_bf.mk \
+ $(PRJ)$/source$/config$/fragments$/fcfg_global_bf.mk \
+ $(PRJ)$/source$/config$/fragments$/fcfg_calc_bf.mk \
+ $(PRJ)$/source$/config$/fragments$/fcfg_draw_bf.mk \
+ $(PRJ)$/source$/config$/fragments$/fcfg_impress_bf.mk \
+ $(PRJ)$/source$/config$/fragments$/fcfg_chart_bf.mk \
+ $(PRJ)$/source$/config$/fragments$/fcfg_math_bf.mk
+.ENDIF
+
+.INCLUDE: $(INCLUDE_FRAGMENTS)
diff --git a/filter/source/config/fragments/types/MS_Excel_2007_Binary.xcu b/filter/source/config/fragments/types/MS_Excel_2007_Binary.xcu
new file mode 100644
index 000000000000..fd0183d0555f
--- /dev/null
+++ b/filter/source/config/fragments/types/MS_Excel_2007_Binary.xcu
@@ -0,0 +1,10 @@
+<node oor:name="MS Excel 2007 Binary" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.oox.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>xlsb</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>Calc MS Excel 2007 Binary</value></prop>
+ <prop oor:name="UIName"><value xml:lang="x-default">Microsoft Excel 2007 Binary</value></prop>
+ <prop oor:name="ClipboardFormat"/>
+</node>
diff --git a/filter/source/config/fragments/types/MS_Excel_2007_XML.xcu b/filter/source/config/fragments/types/MS_Excel_2007_XML.xcu
new file mode 100644
index 000000000000..edd1498e39df
--- /dev/null
+++ b/filter/source/config/fragments/types/MS_Excel_2007_XML.xcu
@@ -0,0 +1,10 @@
+<node oor:name="MS Excel 2007 XML" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.oox.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>xlsm xlsx</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>Calc MS Excel 2007 XML</value></prop>
+ <prop oor:name="UIName"><value xml:lang="x-default">Microsoft Excel 2007 XML</value></prop>
+ <prop oor:name="ClipboardFormat"/>
+</node>
diff --git a/filter/source/config/fragments/types/MS_Excel_2007_XML_Template.xcu b/filter/source/config/fragments/types/MS_Excel_2007_XML_Template.xcu
new file mode 100644
index 000000000000..5aa05abd7010
--- /dev/null
+++ b/filter/source/config/fragments/types/MS_Excel_2007_XML_Template.xcu
@@ -0,0 +1,10 @@
+<node oor:name="MS Excel 2007 XML Template" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.oox.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>xltm xltx</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>Calc MS Excel 2007 XML Template</value></prop>
+ <prop oor:name="UIName"><value xml:lang="x-default">Microsoft Excel 2007 XML Template</value></prop>
+ <prop oor:name="ClipboardFormat"/>
+</node>
diff --git a/filter/source/config/fragments/types/MS_PowerPoint_2007_XML.xcu b/filter/source/config/fragments/types/MS_PowerPoint_2007_XML.xcu
new file mode 100644
index 000000000000..99f22ee47e7a
--- /dev/null
+++ b/filter/source/config/fragments/types/MS_PowerPoint_2007_XML.xcu
@@ -0,0 +1,10 @@
+<node oor:name="MS PowerPoint 2007 XML" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.oox.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>pptm pptx</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>true</value></prop>
+ <prop oor:name="PreferredFilter"><value>Impress MS PowerPoint 2007 XML</value></prop>
+ <prop oor:name="UIName"><value xml:lang="x-default">Microsoft PowerPoint 2007 XML</value></prop>
+ <prop oor:name="ClipboardFormat"/>
+</node>
diff --git a/filter/source/config/fragments/types/MS_PowerPoint_2007_XML_Template.xcu b/filter/source/config/fragments/types/MS_PowerPoint_2007_XML_Template.xcu
new file mode 100644
index 000000000000..9341c3c57c31
--- /dev/null
+++ b/filter/source/config/fragments/types/MS_PowerPoint_2007_XML_Template.xcu
@@ -0,0 +1,10 @@
+<node oor:name="MS PowerPoint 2007 XML Template" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.oox.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>potm potx</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>true</value></prop>
+ <prop oor:name="PreferredFilter"><value>Impress MS PowerPoint 2007 XML Template</value></prop>
+ <prop oor:name="UIName"><value>Microsoft PowerPoint 2007 XML Template</value></prop>
+ <prop oor:name="ClipboardFormat"/>
+</node>
diff --git a/filter/source/config/fragments/types/StarBase.xcu b/filter/source/config/fragments/types/StarBase.xcu
new file mode 100644
index 000000000000..85d8b7a7e5f1
--- /dev/null
+++ b/filter/source/config/fragments/types/StarBase.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="StarBase" oor:op="replace">
+ <prop oor:name="DetectService"><value>org.openoffice.comp.dbflt.DBTypeDetection</value></prop>
+ <prop oor:name="URLPattern"><value>private:factory/sdatabase*</value></prop>
+ <prop oor:name="Extensions"><value>odb</value></prop>
+ <prop oor:name="MediaType"><value>application/vnd.sun.xml.base</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>StarOffice XML (Base)</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">OpenDocument Database</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>StarBase 6.0</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/Unified_Office_Format_presentation.xcu b/filter/source/config/fragments/types/Unified_Office_Format_presentation.xcu
new file mode 100644
index 000000000000..f814eb998b5f
--- /dev/null
+++ b/filter/source/config/fragments/types/Unified_Office_Format_presentation.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="Unified_Office_Format_presentation" 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 oor:separator=";">uop;uof</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"/>
+ <prop oor:name="UIName">
+ <value>Unified Office Format presentation</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>doctype:vnd.uof.presentation</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/Unified_Office_Format_spreadsheet.xcu b/filter/source/config/fragments/types/Unified_Office_Format_spreadsheet.xcu
new file mode 100644
index 000000000000..a8bae7e1ed2d
--- /dev/null
+++ b/filter/source/config/fragments/types/Unified_Office_Format_spreadsheet.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="Unified_Office_Format_spreadsheet" 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 oor:separator=";">uos;uof</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"/>
+ <prop oor:name="UIName">
+ <value>Unified Office Format spreadsheet</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>doctype:vnd.uof.spreadsheet</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/Unified_Office_Format_text.xcu b/filter/source/config/fragments/types/Unified_Office_Format_text.xcu
new file mode 100644
index 000000000000..76bf0e5fffa9
--- /dev/null
+++ b/filter/source/config/fragments/types/Unified_Office_Format_text.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="Unified_Office_Format_text" 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 oor:separator=";">uot;uof</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"/>
+ <prop oor:name="UIName">
+ <value>Unified Office Format text</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>doctype:vnd.uof.text</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/XHTML_File.xcu b/filter/source/config/fragments/types/XHTML_File.xcu
new file mode 100644
index 000000000000..ea594b1aaf5f
--- /dev/null
+++ b/filter/source/config/fragments/types/XHTML_File.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="XHTML_File" 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>html xhtml</value></prop>
+ <prop oor:name="MediaType"><value>application/xhtml+xml</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"/>
+ <prop oor:name="UIName">
+ <value>XHTML</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/bmp_MS_Windows.xcu b/filter/source/config/fragments/types/bmp_MS_Windows.xcu
new file mode 100644
index 000000000000..a344333abaa0
--- /dev/null
+++ b/filter/source/config/fragments/types/bmp_MS_Windows.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="bmp_MS_Windows" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.draw.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>bmp</value></prop>
+ <prop oor:name="MediaType"><value>image/x-MS-bmp</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>BMP - MS Windows</value></prop>
+ <prop oor:name="UIName">
+ <value>BMP - Windows Bitmap</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/calc8.xcu b/filter/source/config/fragments/types/calc8.xcu
new file mode 100644
index 000000000000..f351e0c14c5d
--- /dev/null
+++ b/filter/source/config/fragments/types/calc8.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="calc8" oor:op="replace">
+ <prop oor:name="DetectService"><value>com.sun.star.comp.calc.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"><value>private:factory/scalc*</value></prop>
+ <prop oor:name="Extensions"><value>ods</value></prop>
+ <prop oor:name="MediaType"><value>application/vnd.oasis.opendocument.spreadsheet</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>calc8</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">Calc 8</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>Calc 8</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/calc8_template.xcu b/filter/source/config/fragments/types/calc8_template.xcu
new file mode 100644
index 000000000000..933cbc84ab34
--- /dev/null
+++ b/filter/source/config/fragments/types/calc8_template.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="calc8_template" 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>ots</value></prop>
+ <prop oor:name="MediaType"><value>application/vnd.oasis.opendocument.spreadsheet-template</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>calc8_template</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">Calc 8 Template</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>Calc 8 Template</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/calc_DIF.xcu b/filter/source/config/fragments/types/calc_DIF.xcu
new file mode 100644
index 000000000000..f2c8a8e9d247
--- /dev/null
+++ b/filter/source/config/fragments/types/calc_DIF.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="calc_DIF" 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>dif</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>DIF</value></prop>
+ <prop oor:name="UIName">
+ <value>Data Interchange Format</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/calc_Lotus.xcu b/filter/source/config/fragments/types/calc_Lotus.xcu
new file mode 100644
index 000000000000..5e4581301586
--- /dev/null
+++ b/filter/source/config/fragments/types/calc_Lotus.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="calc_Lotus" 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>wk1 wks 123</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>true</value></prop>
+ <prop oor:name="PreferredFilter"><value>Lotus</value></prop>
+ <prop oor:name="UIName">
+ <value>Lotus</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
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
new file mode 100644
index 000000000000..a3af765eaeb4
--- /dev/null
+++ b/filter/source/config/fragments/types/calc_MS_Excel_2003_XML.xcu
@@ -0,0 +1,12 @@
+ <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="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>MS Excel 2003 XML</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">Microsoft Excel 2003 XML</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>doctype:Workbook</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/calc_MS_Excel_40.xcu b/filter/source/config/fragments/types/calc_MS_Excel_40.xcu
new file mode 100644
index 000000000000..b45c21fa33bd
--- /dev/null
+++ b/filter/source/config/fragments/types/calc_MS_Excel_40.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="calc_MS_Excel_40" 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>xls xlw xlc xlm</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 4.0</value></prop>
+ <prop oor:name="UIName">
+ <value>Microsoft Excel 4.0</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/calc_MS_Excel_40_VorlageTemplate.xcu b/filter/source/config/fragments/types/calc_MS_Excel_40_VorlageTemplate.xcu
new file mode 100644
index 000000000000..42bb10ed09c8
--- /dev/null
+++ b/filter/source/config/fragments/types/calc_MS_Excel_40_VorlageTemplate.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="calc_MS_Excel_40_VorlageTemplate" 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>xlt</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 4.0 Vorlage/Template</value></prop>
+ <prop oor:name="UIName">
+ <value>MS Excel 4.0 Template</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/calc_MS_Excel_5095.xcu b/filter/source/config/fragments/types/calc_MS_Excel_5095.xcu
new file mode 100644
index 000000000000..3f450f0cb85f
--- /dev/null
+++ b/filter/source/config/fragments/types/calc_MS_Excel_5095.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="calc_MS_Excel_5095" 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>xls xlc xlm xlw</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 5.0/95</value></prop>
+ <prop oor:name="UIName">
+ <value>Microsoft Excel 5.0</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>Biff5</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/calc_MS_Excel_5095_VorlageTemplate.xcu b/filter/source/config/fragments/types/calc_MS_Excel_5095_VorlageTemplate.xcu
new file mode 100644
index 000000000000..8dbb02c0170e
--- /dev/null
+++ b/filter/source/config/fragments/types/calc_MS_Excel_5095_VorlageTemplate.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="calc_MS_Excel_5095_VorlageTemplate" 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>xlt</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 5.0/95 Vorlage/Template</value></prop>
+ <prop oor:name="UIName">
+ <value>MS Excel 5.0 Template</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>Biff5</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/calc_MS_Excel_95.xcu b/filter/source/config/fragments/types/calc_MS_Excel_95.xcu
new file mode 100644
index 000000000000..0ea10dddc31e
--- /dev/null
+++ b/filter/source/config/fragments/types/calc_MS_Excel_95.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="calc_MS_Excel_95" 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>xls xlc xlm xlw</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 95</value></prop>
+ <prop oor:name="UIName">
+ <value>Microsoft Excel 95</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>Biff5</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/calc_MS_Excel_95_VorlageTemplate.xcu b/filter/source/config/fragments/types/calc_MS_Excel_95_VorlageTemplate.xcu
new file mode 100644
index 000000000000..fb3e41014f85
--- /dev/null
+++ b/filter/source/config/fragments/types/calc_MS_Excel_95_VorlageTemplate.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="calc_MS_Excel_95_VorlageTemplate" 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>xlt</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 95 Vorlage/Template</value></prop>
+ <prop oor:name="UIName">
+ <value>MS Excel 95 Template</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>Biff5</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/calc_MS_Excel_97.xcu b/filter/source/config/fragments/types/calc_MS_Excel_97.xcu
new file mode 100644
index 000000000000..9f1949d9f413
--- /dev/null
+++ b/filter/source/config/fragments/types/calc_MS_Excel_97.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="calc_MS_Excel_97" 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>xls xlc xlm xlw</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>
+ <prop oor:name="UIName">
+ <value>Microsoft Excel 97/2000/XP</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>Biff8</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/calc_MS_Excel_97_VorlageTemplate.xcu b/filter/source/config/fragments/types/calc_MS_Excel_97_VorlageTemplate.xcu
new file mode 100644
index 000000000000..26f4bca3a725
--- /dev/null
+++ b/filter/source/config/fragments/types/calc_MS_Excel_97_VorlageTemplate.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="calc_MS_Excel_97_VorlageTemplate" 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>xlt</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 Vorlage/Template</value></prop>
+ <prop oor:name="UIName">
+ <value>MS Excel 97/2000 Template</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>Biff8</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/calc_MiniCalc_PalmDB_File.xcu b/filter/source/config/fragments/types/calc_MiniCalc_PalmDB_File.xcu
new file mode 100644
index 000000000000..7362f8308b52
--- /dev/null
+++ b/filter/source/config/fragments/types/calc_MiniCalc_PalmDB_File.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="calc_MiniCalc_PalmDB_File" oor:op="replace" >
+ <prop oor:name="DetectService"/>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>pdb</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>MiniCalc (Palm)</value></prop>
+ <prop oor:name="UIName">
+ <value>MiniCalc (Palm)</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/calc_Pocket_Excel_File.xcu b/filter/source/config/fragments/types/calc_Pocket_Excel_File.xcu
new file mode 100644
index 000000000000..6be3877cdc81
--- /dev/null
+++ b/filter/source/config/fragments/types/calc_Pocket_Excel_File.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="calc_Pocket_Excel_File" oor:op="replace" >
+ <prop oor:name="DetectService"/>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>pxl</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>Pocket Excel</value></prop>
+ <prop oor:name="UIName">
+ <value>Pocket Excel</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/calc_QPro.xcu b/filter/source/config/fragments/types/calc_QPro.xcu
new file mode 100644
index 000000000000..751b534fb511
--- /dev/null
+++ b/filter/source/config/fragments/types/calc_QPro.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="calc_QPro" oor:op="replace" oor:finalized="true" oor:mandatory="true">
+ <prop oor:name="DetectService"><value>com.sun.star.comp.calc.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>wb2</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>true</value></prop>
+ <prop oor:name="PreferredFilter"><value>Quattro Pro 6.0</value></prop>
+ <prop oor:name="UIName">
+ <value>Quattro Pro 6.0</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/calc_SYLK.xcu b/filter/source/config/fragments/types/calc_SYLK.xcu
new file mode 100644
index 000000000000..bcc970a91987
--- /dev/null
+++ b/filter/source/config/fragments/types/calc_SYLK.xcu
@@ -0,0 +1,12 @@
+ <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="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>SYLK</value></prop>
+ <prop oor:name="UIName">
+ <value>SYLK</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/calc_StarCalc_10.xcu b/filter/source/config/fragments/types/calc_StarCalc_10.xcu
new file mode 100644
index 000000000000..0a90e4001b97
--- /dev/null
+++ b/filter/source/config/fragments/types/calc_StarCalc_10.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="calc_StarCalc_10" 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>sdc</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>StarCalc 1.0</value></prop>
+ <prop oor:name="UIName">
+ <value>StarCalc 1.0</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/calc_StarCalc_30.xcu b/filter/source/config/fragments/types/calc_StarCalc_30.xcu
new file mode 100644
index 000000000000..27f46b7ad70a
--- /dev/null
+++ b/filter/source/config/fragments/types/calc_StarCalc_30.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="calc_StarCalc_30" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>sdc</value></prop>
+ <prop oor:name="MediaType"><value>application/x-starcalc</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>StarCalc 3.0</value></prop>
+ <prop oor:name="UIName">
+ <value>StarCalc 3.0</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>StarCalcDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/calc_StarCalc_30_VorlageTemplate.xcu b/filter/source/config/fragments/types/calc_StarCalc_30_VorlageTemplate.xcu
new file mode 100644
index 000000000000..866b5efa7c1b
--- /dev/null
+++ b/filter/source/config/fragments/types/calc_StarCalc_30_VorlageTemplate.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="calc_StarCalc_30_VorlageTemplate" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>vor</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>StarCalc 3.0 Vorlage/Template</value></prop>
+ <prop oor:name="UIName">
+ <value>StarCalc 3.0 Template</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>StarCalcDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/calc_StarCalc_40.xcu b/filter/source/config/fragments/types/calc_StarCalc_40.xcu
new file mode 100644
index 000000000000..a794e57d4cc6
--- /dev/null
+++ b/filter/source/config/fragments/types/calc_StarCalc_40.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="calc_StarCalc_40" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>sdc</value></prop>
+ <prop oor:name="MediaType"><value>application/x-starcalc</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>StarCalc 4.0</value></prop>
+ <prop oor:name="UIName">
+ <value>StarCalc 4.0</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>StarCalc 4.0</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/calc_StarCalc_40_VorlageTemplate.xcu b/filter/source/config/fragments/types/calc_StarCalc_40_VorlageTemplate.xcu
new file mode 100644
index 000000000000..f16c7510bf20
--- /dev/null
+++ b/filter/source/config/fragments/types/calc_StarCalc_40_VorlageTemplate.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="calc_StarCalc_40_VorlageTemplate" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>vor</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>StarCalc 4.0 Vorlage/Template</value></prop>
+ <prop oor:name="UIName">
+ <value>StarCalc 4.0 Template</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>StarCalc 4.0</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/calc_StarCalc_50.xcu b/filter/source/config/fragments/types/calc_StarCalc_50.xcu
new file mode 100644
index 000000000000..f3659cdcd203
--- /dev/null
+++ b/filter/source/config/fragments/types/calc_StarCalc_50.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="calc_StarCalc_50" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>sdc</value></prop>
+ <prop oor:name="MediaType"><value>application/vnd.stardivision.calc</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>StarCalc 5.0</value></prop>
+ <prop oor:name="UIName">
+ <value>StarCalc 5.0</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>StarCalc 5.0</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/calc_StarCalc_50_VorlageTemplate.xcu b/filter/source/config/fragments/types/calc_StarCalc_50_VorlageTemplate.xcu
new file mode 100644
index 000000000000..e517605c5756
--- /dev/null
+++ b/filter/source/config/fragments/types/calc_StarCalc_50_VorlageTemplate.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="calc_StarCalc_50_VorlageTemplate" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>vor</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>StarCalc 5.0 Vorlage/Template</value></prop>
+ <prop oor:name="UIName">
+ <value>StarCalc 5.0 Template</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>StarCalc 5.0</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/calc_StarOffice_XML_Calc.xcu b/filter/source/config/fragments/types/calc_StarOffice_XML_Calc.xcu
new file mode 100644
index 000000000000..9a37858f5fa7
--- /dev/null
+++ b/filter/source/config/fragments/types/calc_StarOffice_XML_Calc.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="calc_StarOffice_XML_Calc" 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>sxc</value></prop>
+ <prop oor:name="MediaType"><value>application/vnd.sun.xml.calc</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>StarOffice XML (Calc)</value></prop>
+ <prop oor:name="UIName">
+ <value>Calc 6.0</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>Calc 6.0</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/calc_StarOffice_XML_Calc_Template.xcu b/filter/source/config/fragments/types/calc_StarOffice_XML_Calc_Template.xcu
new file mode 100644
index 000000000000..022e6acfae29
--- /dev/null
+++ b/filter/source/config/fragments/types/calc_StarOffice_XML_Calc_Template.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="calc_StarOffice_XML_Calc_Template" 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>stc</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>calc_StarOffice_XML_Calc_Template</value></prop>
+ <prop oor:name="UIName">
+ <value>Calc 6.0 Template</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>Calc 6.0</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/calc_Text_txt_csv_StarCalc.xcu b/filter/source/config/fragments/types/calc_Text_txt_csv_StarCalc.xcu
new file mode 100644
index 000000000000..708717263917
--- /dev/null
+++ b/filter/source/config/fragments/types/calc_Text_txt_csv_StarCalc.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="calc_Text_txt_csv_StarCalc" 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>csv txt</value></prop>
+ <prop oor:name="MediaType"><value>text/plain</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>Text - txt - csv (StarCalc)</value></prop>
+ <prop oor:name="UIName">
+ <value>Text - txt - csv (StarOffice Calc)</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/calc_dBase.xcu b/filter/source/config/fragments/types/calc_dBase.xcu
new file mode 100644
index 000000000000..e2707d4b00f3
--- /dev/null
+++ b/filter/source/config/fragments/types/calc_dBase.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="calc_dBase" 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>dbf</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>dBase</value></prop>
+ <prop oor:name="UIName">
+ <value>dBASE</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/chart8.xcu b/filter/source/config/fragments/types/chart8.xcu
new file mode 100644
index 000000000000..22e6d7d15e36
--- /dev/null
+++ b/filter/source/config/fragments/types/chart8.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="chart8" oor:op="replace">
+ <prop oor:name="DetectService"/>
+ <prop oor:name="URLPattern"><value>private:factory/schart*</value></prop>
+ <prop oor:name="Extensions"><value>odc</value></prop>
+ <prop oor:name="MediaType"><value>application/vnd.oasis.opendocument.chart</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>chart8</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">Chart 8</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>Chart 8</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/chart_StarChart_30.xcu b/filter/source/config/fragments/types/chart_StarChart_30.xcu
new file mode 100644
index 000000000000..f42c5b6c9f05
--- /dev/null
+++ b/filter/source/config/fragments/types/chart_StarChart_30.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="chart_StarChart_30" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>sds</value></prop>
+ <prop oor:name="MediaType"><value>application/x-starchart</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>StarChart 3.0</value></prop>
+ <prop oor:name="UIName">
+ <value>StarChart 3.0</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>StarChartDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/chart_StarChart_40.xcu b/filter/source/config/fragments/types/chart_StarChart_40.xcu
new file mode 100644
index 000000000000..a1ce87af1abe
--- /dev/null
+++ b/filter/source/config/fragments/types/chart_StarChart_40.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="chart_StarChart_40" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>sds</value></prop>
+ <prop oor:name="MediaType"><value>application/x-starchart</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>StarChart 4.0</value></prop>
+ <prop oor:name="UIName">
+ <value>StarChart 4.0</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>StarChartDocument 4.0</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/chart_StarChart_50.xcu b/filter/source/config/fragments/types/chart_StarChart_50.xcu
new file mode 100644
index 000000000000..79ff33234b6a
--- /dev/null
+++ b/filter/source/config/fragments/types/chart_StarChart_50.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="chart_StarChart_50" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>sds</value></prop>
+ <prop oor:name="MediaType"><value>application/vnd.stardivision.chart</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>StarChart 5.0</value></prop>
+ <prop oor:name="UIName">
+ <value>StarChart 5.0</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>StarChart 5.0</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/chart_StarOffice_XML_Chart.xcu b/filter/source/config/fragments/types/chart_StarOffice_XML_Chart.xcu
new file mode 100644
index 000000000000..1d581ae3b87c
--- /dev/null
+++ b/filter/source/config/fragments/types/chart_StarOffice_XML_Chart.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="chart_StarOffice_XML_Chart" oor:op="replace" oor:finalized="true" oor:mandatory="true">
+ <prop oor:name="DetectService"/>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>sxs</value></prop>
+ <prop oor:name="MediaType"><value>application/vnd.sun.xml.chart</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>StarOffice XML (Chart)</value></prop>
+ <prop oor:name="UIName">
+ <value>Chart 6.0</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>Chart 6.0</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/component_Bibliography.xcu b/filter/source/config/fragments/types/component_Bibliography.xcu
new file mode 100644
index 000000000000..dac9d9e2f19c
--- /dev/null
+++ b/filter/source/config/fragments/types/component_Bibliography.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="component_Bibliography" oor:op="replace" >
+ <prop oor:name="URLPattern"><value>.component:Bibliography/*</value></prop>
+ <prop oor:name="Extensions"/>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="UIName">
+ <value>Bibliography component</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ <prop oor:name="DetectService"/>
+ <prop oor:name="PreferredFilter"/>
+ </node>
diff --git a/filter/source/config/fragments/types/component_DB.xcu b/filter/source/config/fragments/types/component_DB.xcu
new file mode 100644
index 000000000000..7fe591eda872
--- /dev/null
+++ b/filter/source/config/fragments/types/component_DB.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="component_DB" oor:op="replace" >
+ <prop oor:name="URLPattern"><value>.component:DB*</value></prop>
+ <prop oor:name="Extensions"/>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="UIName">
+ <value>DB component</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ <prop oor:name="DetectService"/>
+ <prop oor:name="PreferredFilter"/>
+ </node>
diff --git a/filter/source/config/fragments/types/draw8.xcu b/filter/source/config/fragments/types/draw8.xcu
new file mode 100644
index 000000000000..b74358397bff
--- /dev/null
+++ b/filter/source/config/fragments/types/draw8.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="draw8" oor:op="replace">
+ <prop oor:name="DetectService"><value>com.sun.star.comp.draw.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"><value>private:factory/sdraw*</value></prop>
+ <prop oor:name="Extensions"><value>odg</value></prop>
+ <prop oor:name="MediaType"><value>application/vnd.oasis.opendocument.graphics</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>draw8</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">Draw 8</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>Draw 8</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/draw8_template.xcu b/filter/source/config/fragments/types/draw8_template.xcu
new file mode 100644
index 000000000000..aac3d5e7b1eb
--- /dev/null
+++ b/filter/source/config/fragments/types/draw8_template.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="draw8_template" oor:op="replace">
+ <prop oor:name="DetectService"><value>com.sun.star.comp.draw.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>otg</value></prop>
+ <prop oor:name="MediaType"><value>application/vnd.oasis.opendocument.graphics-template</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>draw8_template</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">Draw 8 Template</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>Draw 8 Template</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/draw_StarDraw_30.xcu b/filter/source/config/fragments/types/draw_StarDraw_30.xcu
new file mode 100644
index 000000000000..208b247662b7
--- /dev/null
+++ b/filter/source/config/fragments/types/draw_StarDraw_30.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="draw_StarDraw_30" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>sdd</value></prop>
+ <prop oor:name="MediaType"><value>application/x-stardraw</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>StarDraw 3.0 (StarImpress)</value></prop>
+ <prop oor:name="UIName">
+ <value>StarDraw 3.0</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>StarDrawDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/draw_StarDraw_30_Vorlage.xcu b/filter/source/config/fragments/types/draw_StarDraw_30_Vorlage.xcu
new file mode 100644
index 000000000000..f618780b0de9
--- /dev/null
+++ b/filter/source/config/fragments/types/draw_StarDraw_30_Vorlage.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="draw_StarDraw_30_Vorlage" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>vor</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>StarDraw 3.0 Vorlage</value></prop>
+ <prop oor:name="UIName">
+ <value>StarDraw 3.0 Template</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>StarDrawDocument </value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/draw_StarDraw_50.xcu b/filter/source/config/fragments/types/draw_StarDraw_50.xcu
new file mode 100644
index 000000000000..18340f2a7937
--- /dev/null
+++ b/filter/source/config/fragments/types/draw_StarDraw_50.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="draw_StarDraw_50" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>sda</value></prop>
+ <prop oor:name="MediaType"><value>application/vnd.stardivision.draw</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>StarDraw 5.0</value></prop>
+ <prop oor:name="UIName">
+ <value>StarDraw 5.0</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>StarDraw 5.0</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/draw_StarDraw_50_Vorlage.xcu b/filter/source/config/fragments/types/draw_StarDraw_50_Vorlage.xcu
new file mode 100644
index 000000000000..5063da9bbdfb
--- /dev/null
+++ b/filter/source/config/fragments/types/draw_StarDraw_50_Vorlage.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="draw_StarDraw_50_Vorlage" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>vor</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>StarDraw 5.0 Vorlage</value></prop>
+ <prop oor:name="UIName">
+ <value>StarDraw 5.0 Template</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>StarDraw 5.0</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/draw_StarOffice_XML_Draw.xcu b/filter/source/config/fragments/types/draw_StarOffice_XML_Draw.xcu
new file mode 100644
index 000000000000..9bae1925f977
--- /dev/null
+++ b/filter/source/config/fragments/types/draw_StarOffice_XML_Draw.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="draw_StarOffice_XML_Draw" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.draw.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>sxd</value></prop>
+ <prop oor:name="MediaType"><value>application/vnd.sun.xml.draw</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>StarOffice XML (Draw)</value></prop>
+ <prop oor:name="UIName">
+ <value>%productname% %formatversion% Zeichnung</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>Draw 6.0</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/draw_StarOffice_XML_Draw_Template.xcu b/filter/source/config/fragments/types/draw_StarOffice_XML_Draw_Template.xcu
new file mode 100644
index 000000000000..6367ec382ac2
--- /dev/null
+++ b/filter/source/config/fragments/types/draw_StarOffice_XML_Draw_Template.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="draw_StarOffice_XML_Draw_Template" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.draw.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>std</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>draw_StarOffice_XML_Draw_Template</value></prop>
+ <prop oor:name="UIName">
+ <value>Draw 6.0 Template</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>Draw 6.0</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/dxf_AutoCAD_Interchange.xcu b/filter/source/config/fragments/types/dxf_AutoCAD_Interchange.xcu
new file mode 100644
index 000000000000..d7df23807f1f
--- /dev/null
+++ b/filter/source/config/fragments/types/dxf_AutoCAD_Interchange.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="dxf_AutoCAD_Interchange" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.draw.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>dxf</value></prop>
+ <prop oor:name="MediaType"><value>image/vnd.dxf</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>DXF - AutoCAD Interchange</value></prop>
+ <prop oor:name="UIName">
+ <value>DXF - AutoCAD Interchange Format</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/emf_MS_Windows_Metafile.xcu b/filter/source/config/fragments/types/emf_MS_Windows_Metafile.xcu
new file mode 100644
index 000000000000..3f2789c161b8
--- /dev/null
+++ b/filter/source/config/fragments/types/emf_MS_Windows_Metafile.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="emf_MS_Windows_Metafile" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.draw.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>emf</value></prop>
+ <prop oor:name="MediaType"><value>image/x-emf</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>EMF - MS Windows Metafile</value></prop>
+ <prop oor:name="UIName">
+ <value>EMF - Enhanced Meta File</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/eps_Encapsulated_PostScript.xcu b/filter/source/config/fragments/types/eps_Encapsulated_PostScript.xcu
new file mode 100644
index 000000000000..32fdda46d7f7
--- /dev/null
+++ b/filter/source/config/fragments/types/eps_Encapsulated_PostScript.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="eps_Encapsulated_PostScript" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.draw.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>eps</value></prop>
+ <prop oor:name="MediaType"><value>image/x-eps</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>EPS - Encapsulated PostScript</value></prop>
+ <prop oor:name="UIName">
+ <value>EPS - Encapsulated PostScript</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/gif_Graphics_Interchange.xcu b/filter/source/config/fragments/types/gif_Graphics_Interchange.xcu
new file mode 100644
index 000000000000..13eed4ad46ea
--- /dev/null
+++ b/filter/source/config/fragments/types/gif_Graphics_Interchange.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="gif_Graphics_Interchange" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.draw.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>gif</value></prop>
+ <prop oor:name="MediaType"><value>image/gif</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>GIF - Graphics Interchange</value></prop>
+ <prop oor:name="UIName">
+ <value>GIF - Graphics Interchange</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/graphic_HTML.xcu b/filter/source/config/fragments/types/graphic_HTML.xcu
new file mode 100644
index 000000000000..7c834cccf687
--- /dev/null
+++ b/filter/source/config/fragments/types/graphic_HTML.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="graphic_HTML" oor:op="replace" >
+ <prop oor:name="DetectService"/>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>html htm</value></prop>
+ <prop oor:name="MediaType"><value>text/html</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"/>
+ <prop oor:name="UIName">
+ <value>HTML</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/graphic_SWF.xcu b/filter/source/config/fragments/types/graphic_SWF.xcu
new file mode 100644
index 000000000000..ce67250d0854
--- /dev/null
+++ b/filter/source/config/fragments/types/graphic_SWF.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="graphic_SWF" oor:op="replace" >
+ <prop oor:name="DetectService"/>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>swf</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"/>
+ <prop oor:name="UIName">
+ <value>Macromedia Flash (SWF)</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/impress8.xcu b/filter/source/config/fragments/types/impress8.xcu
new file mode 100644
index 000000000000..8242aac979ec
--- /dev/null
+++ b/filter/source/config/fragments/types/impress8.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="impress8" oor:op="replace">
+ <prop oor:name="DetectService"><value>com.sun.star.comp.draw.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"><value>private:factory/simpress*</value></prop>
+ <prop oor:name="Extensions"><value>odp</value></prop>
+ <prop oor:name="MediaType"><value>application/vnd.oasis.opendocument.presentation</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>impress8</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">Impress 8</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>Impress 8</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/impress8_template.xcu b/filter/source/config/fragments/types/impress8_template.xcu
new file mode 100644
index 000000000000..9b1a49261eb9
--- /dev/null
+++ b/filter/source/config/fragments/types/impress8_template.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="impress8_template" oor:op="replace">
+ <prop oor:name="DetectService"><value>com.sun.star.comp.draw.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>otp</value></prop>
+ <prop oor:name="MediaType"><value>application/vnd.oasis.opendocument.presentation-template</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>impress8_template</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">Impress 8 Template</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>Impress 8 Template</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/impress_CGM_Computer_Graphics_Metafile.xcu b/filter/source/config/fragments/types/impress_CGM_Computer_Graphics_Metafile.xcu
new file mode 100644
index 000000000000..5f30bb455a4c
--- /dev/null
+++ b/filter/source/config/fragments/types/impress_CGM_Computer_Graphics_Metafile.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="impress_CGM_Computer_Graphics_Metafile" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.draw.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>cgm</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>CGM - Computer Graphics Metafile</value></prop>
+ <prop oor:name="UIName">
+ <value>CGM - Computer Graphics Metafile</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/impress_MS_PowerPoint_97.xcu b/filter/source/config/fragments/types/impress_MS_PowerPoint_97.xcu
new file mode 100644
index 000000000000..3584127fed3a
--- /dev/null
+++ b/filter/source/config/fragments/types/impress_MS_PowerPoint_97.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="impress_MS_PowerPoint_97" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.draw.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>ppt pps</value></prop>
+ <prop oor:name="MediaType"><value>application/vnd.ms-powerpoint</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>MS PowerPoint 97</value></prop>
+ <prop oor:name="UIName">
+ <value>Microsoft PowerPoint 97/2000/XP</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/impress_MS_PowerPoint_97_Vorlage.xcu b/filter/source/config/fragments/types/impress_MS_PowerPoint_97_Vorlage.xcu
new file mode 100644
index 000000000000..6e9690e4c554
--- /dev/null
+++ b/filter/source/config/fragments/types/impress_MS_PowerPoint_97_Vorlage.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="impress_MS_PowerPoint_97_Vorlage" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.draw.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>pot</value></prop>
+ <prop oor:name="MediaType"><value>application/vnd.ms-powerpoint</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>MS PowerPoint 97 Vorlage</value></prop>
+ <prop oor:name="UIName">
+ <value>MS PowerPoint 97/2000 Template</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/impress_StarImpress_40.xcu b/filter/source/config/fragments/types/impress_StarImpress_40.xcu
new file mode 100644
index 000000000000..bdb4c6516b63
--- /dev/null
+++ b/filter/source/config/fragments/types/impress_StarImpress_40.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="impress_StarImpress_40" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>sdd</value></prop>
+ <prop oor:name="MediaType"><value>application/x-starimpress</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>StarImpress 4.0</value></prop>
+ <prop oor:name="UIName">
+ <value>StarImpress 4.0</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>StarDrawDocument 4.0</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/impress_StarImpress_40_Vorlage.xcu b/filter/source/config/fragments/types/impress_StarImpress_40_Vorlage.xcu
new file mode 100644
index 000000000000..76db489ac6f0
--- /dev/null
+++ b/filter/source/config/fragments/types/impress_StarImpress_40_Vorlage.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="impress_StarImpress_40_Vorlage" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>vor</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>StarImpress 4.0 Vorlage</value></prop>
+ <prop oor:name="UIName">
+ <value>StarImpress 4.0 Template</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>StarDrawDocument 4.0</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/impress_StarImpress_50.xcu b/filter/source/config/fragments/types/impress_StarImpress_50.xcu
new file mode 100644
index 000000000000..32b54804f077
--- /dev/null
+++ b/filter/source/config/fragments/types/impress_StarImpress_50.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="impress_StarImpress_50" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>sdd</value></prop>
+ <prop oor:name="MediaType"><value>application/vnd.stardivision.impress</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>StarImpress 5.0</value></prop>
+ <prop oor:name="UIName">
+ <value>StarImpress 5.0</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>StarImpress 5.0</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/impress_StarImpress_50_Vorlage.xcu b/filter/source/config/fragments/types/impress_StarImpress_50_Vorlage.xcu
new file mode 100644
index 000000000000..e0538927e440
--- /dev/null
+++ b/filter/source/config/fragments/types/impress_StarImpress_50_Vorlage.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="impress_StarImpress_50_Vorlage" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>vor</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>StarImpress 5.0 Vorlage</value></prop>
+ <prop oor:name="UIName">
+ <value>StarImpress 5.0 Template</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>StarImpress 5.0</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/impress_StarImpress_50_packed.xcu b/filter/source/config/fragments/types/impress_StarImpress_50_packed.xcu
new file mode 100644
index 000000000000..8a9f02a439e0
--- /dev/null
+++ b/filter/source/config/fragments/types/impress_StarImpress_50_packed.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="impress_StarImpress_50_packed" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>sdp</value></prop>
+ <prop oor:name="MediaType"><value>application/vnd.stardivision.impress-packed</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>StarImpress 5.0 (packed)</value></prop>
+ <prop oor:name="UIName">
+ <value>StarImpress (packed)</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/impress_StarOffice_XML_Impress.xcu b/filter/source/config/fragments/types/impress_StarOffice_XML_Impress.xcu
new file mode 100644
index 000000000000..e015eff35e5b
--- /dev/null
+++ b/filter/source/config/fragments/types/impress_StarOffice_XML_Impress.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="impress_StarOffice_XML_Impress" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.draw.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>sxi</value></prop>
+ <prop oor:name="MediaType"><value>application/vnd.sun.xml.impress</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>StarOffice XML (Impress)</value></prop>
+ <prop oor:name="UIName">
+ <value>%productname% %formatversion% Präsentation</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>Impress 6.0</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/impress_StarOffice_XML_Impress_Template.xcu b/filter/source/config/fragments/types/impress_StarOffice_XML_Impress_Template.xcu
new file mode 100644
index 000000000000..764e822d1cbb
--- /dev/null
+++ b/filter/source/config/fragments/types/impress_StarOffice_XML_Impress_Template.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="impress_StarOffice_XML_Impress_Template" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.draw.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>sti</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>impress_StarOffice_XML_Impress_Template</value></prop>
+ <prop oor:name="UIName">
+ <value>Impress 6.0 Template</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>Impress 6.0</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/jpg_JPEG.xcu b/filter/source/config/fragments/types/jpg_JPEG.xcu
new file mode 100644
index 000000000000..00ca0bff41de
--- /dev/null
+++ b/filter/source/config/fragments/types/jpg_JPEG.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="jpg_JPEG" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.draw.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>jpg jpeg jfif jif jpe</value></prop>
+ <prop oor:name="MediaType"><value>image/jpeg</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>JPG - JPEG</value></prop>
+ <prop oor:name="UIName">
+ <value>JPEG - Joint Photographic Experts Group</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/makefile.mk b/filter/source/config/fragments/types/makefile.mk
new file mode 100644
index 000000000000..67ad14b038a2
--- /dev/null
+++ b/filter/source/config/fragments/types/makefile.mk
@@ -0,0 +1,54 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ = ..$/..$/..$/..
+TARGET = FCFGPkgTypes
+PRJNAME = filter
+
+# -----------------------------------------------------------------------------
+# include global settings
+# -----------------------------------------------------------------------------
+
+.INCLUDE: settings.mk
+
+# -----------------------------------------------------------------------------
+# build nothing!
+# This makefile is a fake, to force localization of types
+# in combination with our data base tool!
+# -----------------------------------------------------------------------------
+
+TYPES_LIST= \
+ $(BIN)$/dummy.dummy
+
+.INCLUDE: target.mk
+
+.IF "$(SOLAR_JAVA)"!=""
+ALLTAR: $(TYPES_LIST)
+.ENDIF
+
+$(TYPES_LIST) :
+ @echo "localize types ..."
diff --git a/filter/source/config/fragments/types/math8.xcu b/filter/source/config/fragments/types/math8.xcu
new file mode 100644
index 000000000000..e33c2d6f88ae
--- /dev/null
+++ b/filter/source/config/fragments/types/math8.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="math8" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.math.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"><value>private:factory/smath*</value></prop>
+ <prop oor:name="Extensions"><value>odf</value></prop>
+ <prop oor:name="MediaType"><value>application/vnd.oasis.opendocument.formula</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>math8</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">Math 8</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>Math 8</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/math_MathML_XML_Math.xcu b/filter/source/config/fragments/types/math_MathML_XML_Math.xcu
new file mode 100644
index 000000000000..ae79854aae5c
--- /dev/null
+++ b/filter/source/config/fragments/types/math_MathML_XML_Math.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="math_MathML_XML_Math" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.math.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>mml</value></prop>
+ <prop oor:name="MediaType"><value>application/mathml+xml</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>MathML XML (Math)</value></prop>
+ <prop oor:name="UIName">
+ <value>MathML 1.01</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/math_MathType_3x.xcu b/filter/source/config/fragments/types/math_MathType_3x.xcu
new file mode 100644
index 000000000000..3b3c88b3f1a7
--- /dev/null
+++ b/filter/source/config/fragments/types/math_MathType_3x.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="math_MathType_3x" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.math.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>xxx</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>MathType 3.x</value></prop>
+ <prop oor:name="UIName">
+ <value>MathType3.x</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>DS Equation</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/math_StarMath_20.xcu b/filter/source/config/fragments/types/math_StarMath_20.xcu
new file mode 100644
index 000000000000..3870f92cd83f
--- /dev/null
+++ b/filter/source/config/fragments/types/math_StarMath_20.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="math_StarMath_20" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.math.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>smf</value></prop>
+ <prop oor:name="MediaType"><value>application/x-starmath</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>StarMath 2.0</value></prop>
+ <prop oor:name="UIName">
+ <value>StarMath 2.0</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/math_StarMath_30.xcu b/filter/source/config/fragments/types/math_StarMath_30.xcu
new file mode 100644
index 000000000000..f2410d3bcb77
--- /dev/null
+++ b/filter/source/config/fragments/types/math_StarMath_30.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="math_StarMath_30" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>smf</value></prop>
+ <prop oor:name="MediaType"><value>application/x-starmath</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>StarMath 3.0</value></prop>
+ <prop oor:name="UIName">
+ <value>StarMath 3.0</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>StarMath</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/math_StarMath_40.xcu b/filter/source/config/fragments/types/math_StarMath_40.xcu
new file mode 100644
index 000000000000..c535af92e0e5
--- /dev/null
+++ b/filter/source/config/fragments/types/math_StarMath_40.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="math_StarMath_40" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>smf</value></prop>
+ <prop oor:name="MediaType"><value>application/x-starmath</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>StarMath 4.0</value></prop>
+ <prop oor:name="UIName">
+ <value>StarMath 4.0</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>StarMathDocument 4.0</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/math_StarMath_50.xcu b/filter/source/config/fragments/types/math_StarMath_50.xcu
new file mode 100644
index 000000000000..183d55a4b925
--- /dev/null
+++ b/filter/source/config/fragments/types/math_StarMath_50.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="math_StarMath_50" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>smf</value></prop>
+ <prop oor:name="MediaType"><value>application/vnd.stardivision.math</value></prop>
+ <prop oor:name="Preferred"><value>true</value></prop>
+ <prop oor:name="PreferredFilter"><value>StarMath 5.0</value></prop>
+ <prop oor:name="UIName">
+ <value>StarMath 5.0</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>StarMath 5.0</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/math_StarOffice_XML_Math.xcu b/filter/source/config/fragments/types/math_StarOffice_XML_Math.xcu
new file mode 100644
index 000000000000..0a5b6db26f77
--- /dev/null
+++ b/filter/source/config/fragments/types/math_StarOffice_XML_Math.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="math_StarOffice_XML_Math" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.math.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>sxm</value></prop>
+ <prop oor:name="MediaType"><value>application/vnd.sun.xml.math</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>StarOffice XML (Math)</value></prop>
+ <prop oor:name="UIName">
+ <value>%productname% %formatversion% Formel</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>Math 6.0</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/met_OS2_Metafile.xcu b/filter/source/config/fragments/types/met_OS2_Metafile.xcu
new file mode 100644
index 000000000000..256714f45474
--- /dev/null
+++ b/filter/source/config/fragments/types/met_OS2_Metafile.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="met_OS2_Metafile" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.draw.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>met</value></prop>
+ <prop oor:name="MediaType"><value>image/x-met</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>MET - OS/2 Metafile</value></prop>
+ <prop oor:name="UIName">
+ <value>MET - OS/2 Metafile</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/oxt_OpenOffice_Extension.xcu b/filter/source/config/fragments/types/oxt_OpenOffice_Extension.xcu
new file mode 100644
index 000000000000..67b9ed70d517
--- /dev/null
+++ b/filter/source/config/fragments/types/oxt_OpenOffice_Extension.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="oxt_OpenOffice_Extension" oor:op="replace" >
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>oxt</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="UIName">
+ <value>OpenOffice Extension</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ <prop oor:name="DetectService"><value>com.sun.star.comp.framework.OXTFileHandler</value></prop>
+ <prop oor:name="PreferredFilter"/>
+ </node>
diff --git a/filter/source/config/fragments/types/pbm_Portable_Bitmap.xcu b/filter/source/config/fragments/types/pbm_Portable_Bitmap.xcu
new file mode 100644
index 000000000000..4617f54440d4
--- /dev/null
+++ b/filter/source/config/fragments/types/pbm_Portable_Bitmap.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="pbm_Portable_Bitmap" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.draw.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>pbm</value></prop>
+ <prop oor:name="MediaType"><value>image/x-portable-bitmap</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>PBM - Portable Bitmap</value></prop>
+ <prop oor:name="UIName">
+ <value>PBM - Portable Bitmap</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/pcd_Photo_CD_Base.xcu b/filter/source/config/fragments/types/pcd_Photo_CD_Base.xcu
new file mode 100644
index 000000000000..2888c0f0ba46
--- /dev/null
+++ b/filter/source/config/fragments/types/pcd_Photo_CD_Base.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="pcd_Photo_CD_Base" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.draw.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>pcd</value></prop>
+ <prop oor:name="MediaType"><value>image/x-photo-cd</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>draw_PCD_Photo_CD_Base</value></prop>
+ <prop oor:name="UIName">
+ <value>PCD - Photo CD Base</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/pcd_Photo_CD_Base16.xcu b/filter/source/config/fragments/types/pcd_Photo_CD_Base16.xcu
new file mode 100644
index 000000000000..e7bcee7e4c4c
--- /dev/null
+++ b/filter/source/config/fragments/types/pcd_Photo_CD_Base16.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="pcd_Photo_CD_Base16" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.draw.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>pcd</value></prop>
+ <prop oor:name="MediaType"><value>image/x-photo-cd</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>draw_PCD_Photo_CD_Base16</value></prop>
+ <prop oor:name="UIName">
+ <value>PCD - Photo CD Base16</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/pcd_Photo_CD_Base4.xcu b/filter/source/config/fragments/types/pcd_Photo_CD_Base4.xcu
new file mode 100644
index 000000000000..966a77a47c73
--- /dev/null
+++ b/filter/source/config/fragments/types/pcd_Photo_CD_Base4.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="pcd_Photo_CD_Base4" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.draw.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>pcd</value></prop>
+ <prop oor:name="MediaType"><value>image/x-photo-cd</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>draw_PCD_Photo_CD_Base4</value></prop>
+ <prop oor:name="UIName">
+ <value>PCD - Photo CD Base4</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/pct_Mac_Pict.xcu b/filter/source/config/fragments/types/pct_Mac_Pict.xcu
new file mode 100644
index 000000000000..b15ffded9dfe
--- /dev/null
+++ b/filter/source/config/fragments/types/pct_Mac_Pict.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="pct_Mac_Pict" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.draw.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>pct pict</value></prop>
+ <prop oor:name="MediaType"><value>image/x-pict</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>PCT - Mac Pict</value></prop>
+ <prop oor:name="UIName">
+ <value>PCT - Mac Pict</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/pcx_Zsoft_Paintbrush.xcu b/filter/source/config/fragments/types/pcx_Zsoft_Paintbrush.xcu
new file mode 100644
index 000000000000..c4fa34f4d3e2
--- /dev/null
+++ b/filter/source/config/fragments/types/pcx_Zsoft_Paintbrush.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="pcx_Zsoft_Paintbrush" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.draw.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>pcx</value></prop>
+ <prop oor:name="MediaType"><value>image/x-pcx</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>PCX - Zsoft Paintbrush</value></prop>
+ <prop oor:name="UIName">
+ <value>PCX - Zsoft Paintbrush</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/pdf_Portable_Document_Format.xcu b/filter/source/config/fragments/types/pdf_Portable_Document_Format.xcu
new file mode 100644
index 000000000000..64a09cfc087a
--- /dev/null
+++ b/filter/source/config/fragments/types/pdf_Portable_Document_Format.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="pdf_Portable_Document_Format" oor:op="replace" >
+ <prop oor:name="DetectService"/>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>pdf</value></prop>
+ <prop oor:name="MediaType"><value>application/pdf</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"/>
+ <prop oor:name="UIName">
+ <value>PDF - Portable Document Format</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/pgm_Portable_Graymap.xcu b/filter/source/config/fragments/types/pgm_Portable_Graymap.xcu
new file mode 100644
index 000000000000..35605a54f307
--- /dev/null
+++ b/filter/source/config/fragments/types/pgm_Portable_Graymap.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="pgm_Portable_Graymap" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.draw.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>pgm</value></prop>
+ <prop oor:name="MediaType"><value>image/x-portable-graymap</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>PGM - Portable Graymap</value></prop>
+ <prop oor:name="UIName">
+ <value>PGM - Portable Graymap</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/png_Portable_Network_Graphic.xcu b/filter/source/config/fragments/types/png_Portable_Network_Graphic.xcu
new file mode 100644
index 000000000000..e95b961c601b
--- /dev/null
+++ b/filter/source/config/fragments/types/png_Portable_Network_Graphic.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="png_Portable_Network_Graphic" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.draw.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>png</value></prop>
+ <prop oor:name="MediaType"><value>image/png</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>PNG - Portable Network Graphic</value></prop>
+ <prop oor:name="UIName">
+ <value>PNG - Portable Network Graphic</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/ppm_Portable_Pixelmap.xcu b/filter/source/config/fragments/types/ppm_Portable_Pixelmap.xcu
new file mode 100644
index 000000000000..62d9ac07d723
--- /dev/null
+++ b/filter/source/config/fragments/types/ppm_Portable_Pixelmap.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="ppm_Portable_Pixelmap" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.draw.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>ppm</value></prop>
+ <prop oor:name="MediaType"><value>image/x-portable-pixmap</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>PPM - Portable Pixelmap</value></prop>
+ <prop oor:name="UIName">
+ <value>PPM - Portable Pixelmap</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/psd_Adobe_Photoshop.xcu b/filter/source/config/fragments/types/psd_Adobe_Photoshop.xcu
new file mode 100644
index 000000000000..ad4ce367bb18
--- /dev/null
+++ b/filter/source/config/fragments/types/psd_Adobe_Photoshop.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="psd_Adobe_Photoshop" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.draw.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>psd</value></prop>
+ <prop oor:name="MediaType"><value>image/vnd.adobe.photoshop</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>PSD - Adobe Photoshop</value></prop>
+ <prop oor:name="UIName">
+ <value>PSD - Adobe Photoshop</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/pwp_PlaceWare.xcu b/filter/source/config/fragments/types/pwp_PlaceWare.xcu
new file mode 100644
index 000000000000..6bcd5e6ae86e
--- /dev/null
+++ b/filter/source/config/fragments/types/pwp_PlaceWare.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="pwp_PlaceWare" oor:op="replace" >
+ <prop oor:name="DetectService"/>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>pwp</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"/>
+ <prop oor:name="UIName">
+ <value>PWP - PlaceWare</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/ras_Sun_Rasterfile.xcu b/filter/source/config/fragments/types/ras_Sun_Rasterfile.xcu
new file mode 100644
index 000000000000..aa4ae085b13e
--- /dev/null
+++ b/filter/source/config/fragments/types/ras_Sun_Rasterfile.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="ras_Sun_Rasterfile" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.draw.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>ras</value></prop>
+ <prop oor:name="MediaType"><value>image/x-cmu-raster</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>RAS - Sun Rasterfile</value></prop>
+ <prop oor:name="UIName">
+ <value>RAS - Sun Raster Image</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/sgf_StarOffice_Writer_SGF.xcu b/filter/source/config/fragments/types/sgf_StarOffice_Writer_SGF.xcu
new file mode 100644
index 000000000000..c0e8c5aba4df
--- /dev/null
+++ b/filter/source/config/fragments/types/sgf_StarOffice_Writer_SGF.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="sgf_StarOffice_Writer_SGF" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.draw.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>sgf</value></prop>
+ <prop oor:name="MediaType"><value>image/x-sgf</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>SGF - StarOffice Writer SGF</value></prop>
+ <prop oor:name="UIName">
+ <value>SGF - StarWriter SGF</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/sgv_StarDraw_20.xcu b/filter/source/config/fragments/types/sgv_StarDraw_20.xcu
new file mode 100644
index 000000000000..c4778a602111
--- /dev/null
+++ b/filter/source/config/fragments/types/sgv_StarDraw_20.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="sgv_StarDraw_20" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.draw.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>sgv</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>SGV - StarDraw 2.0</value></prop>
+ <prop oor:name="UIName">
+ <value>SGV - StarDraw 2.0</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/svg_Scalable_Vector_Graphics.xcu b/filter/source/config/fragments/types/svg_Scalable_Vector_Graphics.xcu
new file mode 100644
index 000000000000..37643df4c7ec
--- /dev/null
+++ b/filter/source/config/fragments/types/svg_Scalable_Vector_Graphics.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="svg_Scalable_Vector_Graphics" oor:op="replace" >
+ <prop oor:name="DetectService"/>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>svg</value></prop>
+ <prop oor:name="MediaType"><value>image/svg+xml</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"/>
+ <prop oor:name="UIName">
+ <value>SVG - Scalable Vector Graphics</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/svm_StarView_Metafile.xcu b/filter/source/config/fragments/types/svm_StarView_Metafile.xcu
new file mode 100644
index 000000000000..d7e52dbbb11a
--- /dev/null
+++ b/filter/source/config/fragments/types/svm_StarView_Metafile.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="svm_StarView_Metafile" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.draw.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>svm</value></prop>
+ <prop oor:name="MediaType"><value>image/x-svm</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>SVM - StarView Metafile</value></prop>
+ <prop oor:name="UIName">
+ <value>SVM - StarView Meta File</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/tga_Truevision_TARGA.xcu b/filter/source/config/fragments/types/tga_Truevision_TARGA.xcu
new file mode 100644
index 000000000000..178d75f47c4d
--- /dev/null
+++ b/filter/source/config/fragments/types/tga_Truevision_TARGA.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="tga_Truevision_TARGA" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.draw.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>tga</value></prop>
+ <prop oor:name="MediaType"><value>image/x-targa</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>TGA - Truevision TARGA</value></prop>
+ <prop oor:name="UIName">
+ <value>TGA - Truevision Targa</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/tif_Tag_Image_File.xcu b/filter/source/config/fragments/types/tif_Tag_Image_File.xcu
new file mode 100644
index 000000000000..e08689a65e79
--- /dev/null
+++ b/filter/source/config/fragments/types/tif_Tag_Image_File.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="tif_Tag_Image_File" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.draw.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>tif tiff</value></prop>
+ <prop oor:name="MediaType"><value>image/tiff</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>TIF - Tag Image File</value></prop>
+ <prop oor:name="UIName">
+ <value>TIFF - Tagged Image File Format</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/wav_Wave_Audio_File.xcu b/filter/source/config/fragments/types/wav_Wave_Audio_File.xcu
new file mode 100644
index 000000000000..b4e7d2e65149
--- /dev/null
+++ b/filter/source/config/fragments/types/wav_Wave_Audio_File.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="wav_Wave_Audio_File" oor:op="replace" >
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>wav</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="UIName">
+ <value>Wave Audio File</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ <prop oor:name="DetectService"><value>com.sun.star.comp.framework.SoundHandler</value></prop>
+ <prop oor:name="PreferredFilter"/>
+ </node>
diff --git a/filter/source/config/fragments/types/wmf_MS_Windows_Metafile.xcu b/filter/source/config/fragments/types/wmf_MS_Windows_Metafile.xcu
new file mode 100644
index 000000000000..ef02dd3ce7a9
--- /dev/null
+++ b/filter/source/config/fragments/types/wmf_MS_Windows_Metafile.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="wmf_MS_Windows_Metafile" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.draw.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>wmf</value></prop>
+ <prop oor:name="MediaType"><value>image/x-wmf</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>WMF - MS Windows Metafile</value></prop>
+ <prop oor:name="UIName">
+ <value>WMF - Windows Metafile</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer8.xcu b/filter/source/config/fragments/types/writer8.xcu
new file mode 100644
index 000000000000..b57dbde222f2
--- /dev/null
+++ b/filter/source/config/fragments/types/writer8.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer8" oor:op="replace">
+ <prop oor:name="DetectService"><value>com.sun.star.text.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"><value>private:factory/swriter</value></prop>
+ <prop oor:name="Extensions"><value>odt</value></prop>
+ <prop oor:name="MediaType"><value>application/vnd.oasis.opendocument.text</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>writer8</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">Writer 8</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>Writer 8</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/writer8_template.xcu b/filter/source/config/fragments/types/writer8_template.xcu
new file mode 100644
index 000000000000..c9445969e37f
--- /dev/null
+++ b/filter/source/config/fragments/types/writer8_template.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer8_template" oor:op="replace">
+ <prop oor:name="DetectService"><value>com.sun.star.text.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>ott</value></prop>
+ <prop oor:name="MediaType"><value>application/vnd.oasis.opendocument.text-template</value></prop>
+ <prop oor:name="Preferred"><value>true</value></prop>
+ <prop oor:name="PreferredFilter"><value>writer8_template</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">Writer 8 Template</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>Writer 8 Template</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_Ami_Pro_1x_31_W4W.xcu b/filter/source/config/fragments/types/writer_Ami_Pro_1x_31_W4W.xcu
new file mode 100644
index 000000000000..4d038674fd61
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_Ami_Pro_1x_31_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_Ami_Pro_1x_31_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>sam</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>Ami Pro 1.x-3.1 (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>Ami Pro 1.x-3.1</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_AportisDoc_PalmDB_File.xcu b/filter/source/config/fragments/types/writer_AportisDoc_PalmDB_File.xcu
new file mode 100644
index 000000000000..516d9da0eeaf
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_AportisDoc_PalmDB_File.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_AportisDoc_PalmDB_File" 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>pdb</value></prop>
+ <prop oor:name="MediaType"><value>application/x-aportisdoc</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>AportisDoc Palm DB</value></prop>
+ <prop oor:name="UIName">
+ <value>AportisDoc (Palm)</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>doctype:TEXt</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_CTOS_DEF_W4W.xcu b/filter/source/config/fragments/types/writer_CTOS_DEF_W4W.xcu
new file mode 100644
index 000000000000..15c789e075c9
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_CTOS_DEF_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_CTOS_DEF_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>doc</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>CTOS DEF (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>CTOS DEF</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_Claris_Works_W4W.xcu b/filter/source/config/fragments/types/writer_Claris_Works_W4W.xcu
new file mode 100644
index 000000000000..45bdcb1d792e
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_Claris_Works_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_Claris_Works_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>cwk</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>Claris Works (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>Claris Works</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_DCAFFT_Final_Form_Text_W4W.xcu b/filter/source/config/fragments/types/writer_DCAFFT_Final_Form_Text_W4W.xcu
new file mode 100644
index 000000000000..2773c1894d4c
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_DCAFFT_Final_Form_Text_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_DCAFFT_Final_Form_Text_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>doc</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>DCA/FFT-Final Form Text (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>DCA/FFT-Final Form Text</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_DCA_Revisable_Form_Text_W4W.xcu b/filter/source/config/fragments/types/writer_DCA_Revisable_Form_Text_W4W.xcu
new file mode 100644
index 000000000000..90408305cc91
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_DCA_Revisable_Form_Text_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_DCA_Revisable_Form_Text_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>doc</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>DCA Revisable Form Text (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>DCA Revisable Form Text</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_DCA_with_Display_Write_5_W4W.xcu b/filter/source/config/fragments/types/writer_DCA_with_Display_Write_5_W4W.xcu
new file mode 100644
index 000000000000..e7d57d65fe97
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_DCA_with_Display_Write_5_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_DCA_with_Display_Write_5_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>doc</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>DCA with Display Write 5 (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>DCA with Display Write 5</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_DEC_DX_W4W.xcu b/filter/source/config/fragments/types/writer_DEC_DX_W4W.xcu
new file mode 100644
index 000000000000..d0004b6fa90d
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_DEC_DX_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_DEC_DX_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>doc</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>DEC DX (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>DEC DX</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_DEC_WPS_PLUS_W4W.xcu b/filter/source/config/fragments/types/writer_DEC_WPS_PLUS_W4W.xcu
new file mode 100644
index 000000000000..7a1f5107a162
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_DEC_WPS_PLUS_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_DEC_WPS_PLUS_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>doc</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>DEC WPS-PLUS (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>DEC WPS-PLUS</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_DataGeneral_CEO_Write_W4W.xcu b/filter/source/config/fragments/types/writer_DataGeneral_CEO_Write_W4W.xcu
new file mode 100644
index 000000000000..52feca7ffba7
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_DataGeneral_CEO_Write_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_DataGeneral_CEO_Write_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>doc</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>DataGeneral CEO Write (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>DataGeneral CEO Write</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_DisplayWrite_20_4x_W4W.xcu b/filter/source/config/fragments/types/writer_DisplayWrite_20_4x_W4W.xcu
new file mode 100644
index 000000000000..5fda4a2c89bf
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_DisplayWrite_20_4x_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_DisplayWrite_20_4x_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>doc</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>DisplayWrite 2.0-4.x (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>DisplayWrite 2.0-4.x</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_DisplayWrite_5x_W4W.xcu b/filter/source/config/fragments/types/writer_DisplayWrite_5x_W4W.xcu
new file mode 100644
index 000000000000..a88fd8cdc55c
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_DisplayWrite_5x_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_DisplayWrite_5x_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>doc</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>DisplayWrite 5.x (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>DisplayWrite 5.x</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_DocBook_File.xcu b/filter/source/config/fragments/types/writer_DocBook_File.xcu
new file mode 100644
index 000000000000..f68a64cdc8e6
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_DocBook_File.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_DocBook_File" 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="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>DocBook File</value></prop>
+ <prop oor:name="UIName">
+ <value>DocBook</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>doctype:-//OASIS//DTD DocBook XML V4</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_EBCDIC_W4W.xcu b/filter/source/config/fragments/types/writer_EBCDIC_W4W.xcu
new file mode 100644
index 000000000000..d42dafa29c32
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_EBCDIC_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_EBCDIC_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>doc</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>EBCDIC (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>EBCDIC</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_Enable_W4W.xcu b/filter/source/config/fragments/types/writer_Enable_W4W.xcu
new file mode 100644
index 000000000000..00deca734423
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_Enable_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_Enable_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>wpf</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>Enable (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>Enable</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_Frame_Maker_MIF_30_W4W.xcu b/filter/source/config/fragments/types/writer_Frame_Maker_MIF_30_W4W.xcu
new file mode 100644
index 000000000000..549fc4f3c2d9
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_Frame_Maker_MIF_30_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_Frame_Maker_MIF_30_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>mif</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>Frame Maker MIF 3.0 (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>Frame Maker Melse if 3.0</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_Frame_Maker_MIF_40_W4W.xcu b/filter/source/config/fragments/types/writer_Frame_Maker_MIF_40_W4W.xcu
new file mode 100644
index 000000000000..6c77a7a22d13
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_Frame_Maker_MIF_40_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_Frame_Maker_MIF_40_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>mif</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>Frame Maker MIF 4.0 (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>Frame Maker Melse if 4.0</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_Frame_Maker_MIF_50_W4W.xcu b/filter/source/config/fragments/types/writer_Frame_Maker_MIF_50_W4W.xcu
new file mode 100644
index 000000000000..fa650910597a
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_Frame_Maker_MIF_50_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_Frame_Maker_MIF_50_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>mif</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>Frame Maker MIF 5.0 (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>Frame Maker Melse if 5.0</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_Frame_Work_III_W4W.xcu b/filter/source/config/fragments/types/writer_Frame_Work_III_W4W.xcu
new file mode 100644
index 000000000000..0982e6413cd4
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_Frame_Work_III_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_Frame_Work_III_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>fw3</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>Frame Work III (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>Frame Work III</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_Frame_Work_IV_W4W.xcu b/filter/source/config/fragments/types/writer_Frame_Work_IV_W4W.xcu
new file mode 100644
index 000000000000..93cbc6b4edcd
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_Frame_Work_IV_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_Frame_Work_IV_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>fw4</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>Frame Work IV (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>Frame Work IV</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_HP_AdvanceWrite_Plus_W4W.xcu b/filter/source/config/fragments/types/writer_HP_AdvanceWrite_Plus_W4W.xcu
new file mode 100644
index 000000000000..353c3f23562c
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_HP_AdvanceWrite_Plus_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_HP_AdvanceWrite_Plus_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>hpp</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>HP AdvanceWrite Plus (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>HP AdvanceWrite Plus</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_ICL_Office_Power_6_W4W.xcu b/filter/source/config/fragments/types/writer_ICL_Office_Power_6_W4W.xcu
new file mode 100644
index 000000000000..9f860e62805d
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_ICL_Office_Power_6_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_ICL_Office_Power_6_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>doc</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>ICL Office Power 6 (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>ICL Office Power 6</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_ICL_Office_Power_7_W4W.xcu b/filter/source/config/fragments/types/writer_ICL_Office_Power_7_W4W.xcu
new file mode 100644
index 000000000000..9f9187f51230
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_ICL_Office_Power_7_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_ICL_Office_Power_7_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>doc</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>ICL Office Power 7 (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>ICL Office Power 7</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_Interleaf_5_6_W4W.xcu b/filter/source/config/fragments/types/writer_Interleaf_5_6_W4W.xcu
new file mode 100644
index 000000000000..fbace2175c37
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_Interleaf_5_6_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_Interleaf_5_6_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>doc</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>Interleaf 5 - 6 (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>Interleaf 5 - 6</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_Interleaf_W4W.xcu b/filter/source/config/fragments/types/writer_Interleaf_W4W.xcu
new file mode 100644
index 000000000000..c29ef426e16b
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_Interleaf_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_Interleaf_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>doc</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>Interleaf (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>Interleaf</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_Legacy_Winstar_onGO_W4W.xcu b/filter/source/config/fragments/types/writer_Legacy_Winstar_onGO_W4W.xcu
new file mode 100644
index 000000000000..c58f7a14818e
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_Legacy_Winstar_onGO_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_Legacy_Winstar_onGO_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>nvo</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>Legacy Winstar onGO (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>Legacy Winstar onGO</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_Lotus_1_2_3_10_DOS_StarWriter.xcu b/filter/source/config/fragments/types/writer_Lotus_1_2_3_10_DOS_StarWriter.xcu
new file mode 100644
index 000000000000..0fa4e36a26b6
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_Lotus_1_2_3_10_DOS_StarWriter.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_Lotus_1_2_3_10_DOS_StarWriter" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>wk1 wks</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>Lotus 1-2-3 1.0 (DOS) (StarWriter)</value></prop>
+ <prop oor:name="UIName">
+ <value>Lotus 1-2-3 1.0 (DOS) (%productname% %formatversion% Writer)</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_Lotus_1_2_3_10_WIN_StarWriter.xcu b/filter/source/config/fragments/types/writer_Lotus_1_2_3_10_WIN_StarWriter.xcu
new file mode 100644
index 000000000000..285202b5f650
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_Lotus_1_2_3_10_WIN_StarWriter.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_Lotus_1_2_3_10_WIN_StarWriter" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>wk1 wks</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>Lotus 1-2-3 1.0 (WIN) (StarWriter)</value></prop>
+ <prop oor:name="UIName">
+ <value>Lotus 1-2-3 1.0 (WIN) (%productname% %formatversion% Writer)</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_Lotus_Manuscript_W4W.xcu b/filter/source/config/fragments/types/writer_Lotus_Manuscript_W4W.xcu
new file mode 100644
index 000000000000..b2c7d63d901b
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_Lotus_Manuscript_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_Lotus_Manuscript_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>doc</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>Lotus Manuscript (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>Lotus Manuscript</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_MASS_11_Rel_80_83_W4W.xcu b/filter/source/config/fragments/types/writer_MASS_11_Rel_80_83_W4W.xcu
new file mode 100644
index 000000000000..da2fbcb93ccd
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_MASS_11_Rel_80_83_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_MASS_11_Rel_80_83_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>doc</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>MASS 11 Rel. 8.0-8.3 (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>MASS 11 Rel. 8.0-8.3</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_MASS_11_Rel_85_90_W4W.xcu b/filter/source/config/fragments/types/writer_MASS_11_Rel_85_90_W4W.xcu
new file mode 100644
index 000000000000..9d1169e2203d
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_MASS_11_Rel_85_90_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_MASS_11_Rel_85_90_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>doc</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>MASS 11 Rel. 8.5-9.0 (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>MASS 11 Rel. 8.5-9.0</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_MIZI_Hwp_97.xcu b/filter/source/config/fragments/types/writer_MIZI_Hwp_97.xcu
new file mode 100644
index 000000000000..53678e381517
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_MIZI_Hwp_97.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_MIZI_Hwp_97" oor:op="replace" >
+ <prop oor:name="DetectService"/>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>hwp</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>writer_MIZI_Hwp_97</value></prop>
+ <prop oor:name="UIName">
+ <value>Hangul WP 97</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_MS_MacWord_30_W4W.xcu b/filter/source/config/fragments/types/writer_MS_MacWord_30_W4W.xcu
new file mode 100644
index 000000000000..0a5642d39466
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_MS_MacWord_30_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_MS_MacWord_30_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>doc</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>MS MacWord 3.0 (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>Microsoft MacWord 3.0</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_MS_MacWord_40_W4W.xcu b/filter/source/config/fragments/types/writer_MS_MacWord_40_W4W.xcu
new file mode 100644
index 000000000000..1858a9bb8cef
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_MS_MacWord_40_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_MS_MacWord_40_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>doc</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>MS MacWord 4.0 (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>Microsoft MacWord 4.0</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_MS_MacWord_5x_W4W.xcu b/filter/source/config/fragments/types/writer_MS_MacWord_5x_W4W.xcu
new file mode 100644
index 000000000000..038ca2c8cdd9
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_MS_MacWord_5x_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_MS_MacWord_5x_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>doc</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>MS MacWord 5.x (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>Microsoft MacWord 5.x</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_MS_WinWord_1x_W4W.xcu b/filter/source/config/fragments/types/writer_MS_WinWord_1x_W4W.xcu
new file mode 100644
index 000000000000..ba3e0a1f6942
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_MS_WinWord_1x_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_MS_WinWord_1x_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>doc</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>MS WinWord 1.x (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>Microsoft WinWord 1.x</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_MS_WinWord_2x_W4W.xcu b/filter/source/config/fragments/types/writer_MS_WinWord_2x_W4W.xcu
new file mode 100644
index 000000000000..9b026ac45503
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_MS_WinWord_2x_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_MS_WinWord_2x_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>doc</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>MS WinWord 2.x (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>Microsoft WinWord 2.x</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_MS_WinWord_5.xcu b/filter/source/config/fragments/types/writer_MS_WinWord_5.xcu
new file mode 100644
index 000000000000..5c8993c9c789
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_MS_WinWord_5.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_MS_WinWord_5" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.text.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>doc</value></prop>
+ <prop oor:name="MediaType"><value>application/msword</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>MS WinWord 5</value></prop>
+ <prop oor:name="UIName">
+ <value>Microsoft WinWord 5</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>MSWordDoc</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_MS_WinWord_60.xcu b/filter/source/config/fragments/types/writer_MS_WinWord_60.xcu
new file mode 100644
index 000000000000..e56079d92ba5
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_MS_WinWord_60.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_MS_WinWord_60" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.text.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>doc</value></prop>
+ <prop oor:name="MediaType"><value>application/msword</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>MS WinWord 6.0</value></prop>
+ <prop oor:name="UIName">
+ <value>Microsoft Word 6.0</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>MSWordDoc</value></prop>
+ </node>
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
new file mode 100644
index 000000000000..003b5870773c
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_MS_Word_2003_XML.xcu
@@ -0,0 +1,12 @@
+ <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="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>MS Word 2003 XML</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">Microsoft Word 2003 XML</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>doctype:wordDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_MS_Word_2007_XML.xcu b/filter/source/config/fragments/types/writer_MS_Word_2007_XML.xcu
new file mode 100644
index 000000000000..53a7f5b74ead
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_MS_Word_2007_XML.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_MS_Word_2007" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.oox.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>docx docm</value></prop>
+ <prop oor:name="MediaType"><value>application/msword</value></prop>
+ <prop oor:name="Preferred"><value>true</value></prop>
+ <prop oor:name="PreferredFilter"><value>MS Word 2007 XML</value></prop>
+ <prop oor:name="UIName">
+ <value>Microsoft Word 2007 XML</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>MSWordDoc</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_MS_Word_2007_XML_Template.xcu b/filter/source/config/fragments/types/writer_MS_Word_2007_XML_Template.xcu
new file mode 100644
index 000000000000..c0ec68200f22
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_MS_Word_2007_XML_Template.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_MS_Word_2007_Template" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.oox.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>dotx dotm</value></prop>
+ <prop oor:name="MediaType"><value>application/msword</value></prop>
+ <prop oor:name="Preferred"><value>true</value></prop>
+ <prop oor:name="PreferredFilter"><value>MS Word 2007 XML Template</value></prop>
+ <prop oor:name="UIName">
+ <value>Microsoft Word 2007 XML Template</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>MSWordDoc</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_MS_Word_3x_W4W.xcu b/filter/source/config/fragments/types/writer_MS_Word_3x_W4W.xcu
new file mode 100644
index 000000000000..9e938137690a
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_MS_Word_3x_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_MS_Word_3x_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>txt</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>MS Word 3.x (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>Microsoft Word 3.x</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_MS_Word_4x_W4W.xcu b/filter/source/config/fragments/types/writer_MS_Word_4x_W4W.xcu
new file mode 100644
index 000000000000..fc6eaf12b9dc
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_MS_Word_4x_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_MS_Word_4x_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>txt</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>MS Word 4.x (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>Microsoft Word 4.x</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_MS_Word_5x_W4W.xcu b/filter/source/config/fragments/types/writer_MS_Word_5x_W4W.xcu
new file mode 100644
index 000000000000..0d43e21b5577
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_MS_Word_5x_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_MS_Word_5x_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>txt</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>MS Word 5.x (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>Microsoft Word 5.x</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_MS_Word_6x_W4W.xcu b/filter/source/config/fragments/types/writer_MS_Word_6x_W4W.xcu
new file mode 100644
index 000000000000..6ab45081e712
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_MS_Word_6x_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_MS_Word_6x_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>txt</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>MS Word 6.x (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>Microsoft Word 6.x</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_MS_Word_95.xcu b/filter/source/config/fragments/types/writer_MS_Word_95.xcu
new file mode 100644
index 000000000000..3cb66bd5716e
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_MS_Word_95.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_MS_Word_95" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.text.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>doc</value></prop>
+ <prop oor:name="MediaType"><value>application/msword</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>MS Word 95</value></prop>
+ <prop oor:name="UIName">
+ <value>Microsoft Word 95</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>MSWordDoc</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_MS_Word_95_Vorlage.xcu b/filter/source/config/fragments/types/writer_MS_Word_95_Vorlage.xcu
new file mode 100644
index 000000000000..138130b57602
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_MS_Word_95_Vorlage.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_MS_Word_95_Vorlage" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.text.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>dot</value></prop>
+ <prop oor:name="MediaType"><value>application/msword</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>MS Word 95 Vorlage</value></prop>
+ <prop oor:name="UIName">
+ <value>MS Word 95 Template</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>MSWordDoc</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_MS_Word_97.xcu b/filter/source/config/fragments/types/writer_MS_Word_97.xcu
new file mode 100644
index 000000000000..911beb123e04
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_MS_Word_97.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_MS_Word_97" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.text.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>doc</value></prop>
+ <prop oor:name="MediaType"><value>application/msword</value></prop>
+ <prop oor:name="Preferred"><value>true</value></prop>
+ <prop oor:name="PreferredFilter"><value>MS Word 97</value></prop>
+ <prop oor:name="UIName">
+ <value>Microsoft Word 97/2000/XP</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>MSWordDoc</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_MS_Word_97_Vorlage.xcu b/filter/source/config/fragments/types/writer_MS_Word_97_Vorlage.xcu
new file mode 100644
index 000000000000..46b3b9b03b46
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_MS_Word_97_Vorlage.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_MS_Word_97_Vorlage" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.text.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>dot</value></prop>
+ <prop oor:name="MediaType"><value>application/msword</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>MS Word 97 Vorlage</value></prop>
+ <prop oor:name="UIName">
+ <value>MS Word 97/2000 Template</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>MSWordDoc</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_MS_Works_20_DOS_W4W.xcu b/filter/source/config/fragments/types/writer_MS_Works_20_DOS_W4W.xcu
new file mode 100644
index 000000000000..3c404b350300
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_MS_Works_20_DOS_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_MS_Works_20_DOS_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>wks</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>MS Works 2.0 DOS (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>Microsoft Works 2.0 DOS</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_MS_Works_30_Win_W4W.xcu b/filter/source/config/fragments/types/writer_MS_Works_30_Win_W4W.xcu
new file mode 100644
index 000000000000..bceaf7e9fc0f
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_MS_Works_30_Win_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_MS_Works_30_Win_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>wps</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>MS Works 3.0 Win (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>Microsoft Works 3.0 Windows</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_MS_Works_40_Mac_W4W.xcu b/filter/source/config/fragments/types/writer_MS_Works_40_Mac_W4W.xcu
new file mode 100644
index 000000000000..f1b17496f0bd
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_MS_Works_40_Mac_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_MS_Works_40_Mac_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>wks</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>MS Works 4.0 Mac (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>Microsoft Works 4.0 Mac</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_Mac_Write_4x_50_W4W.xcu b/filter/source/config/fragments/types/writer_Mac_Write_4x_50_W4W.xcu
new file mode 100644
index 000000000000..a8dba50134d9
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_Mac_Write_4x_50_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_Mac_Write_4x_50_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>doc</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>Mac Write 4.x 5.0 (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>Mac Write 4.x 5.0</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_Mac_Write_II_W4W.xcu b/filter/source/config/fragments/types/writer_Mac_Write_II_W4W.xcu
new file mode 100644
index 000000000000..f5d7f54190c3
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_Mac_Write_II_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_Mac_Write_II_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>doc</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>Mac Write II (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>Mac Write II</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_Mac_Write_Pro_W4W.xcu b/filter/source/config/fragments/types/writer_Mac_Write_Pro_W4W.xcu
new file mode 100644
index 000000000000..e50afdf9e97a
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_Mac_Write_Pro_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_Mac_Write_Pro_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>doc</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>Mac Write Pro (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>Mac Write Pro</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_MultiMate_33_W4W.xcu b/filter/source/config/fragments/types/writer_MultiMate_33_W4W.xcu
new file mode 100644
index 000000000000..1046b796134d
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_MultiMate_33_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_MultiMate_33_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>doc</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>MultiMate 3.3 (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>MultiMate 3.3</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_MultiMate_4_W4W.xcu b/filter/source/config/fragments/types/writer_MultiMate_4_W4W.xcu
new file mode 100644
index 000000000000..bd96a8a8b838
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_MultiMate_4_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_MultiMate_4_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>dox</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>MultiMate 4 (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>MultiMate 4</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_MultiMate_Adv_36_W4W.xcu b/filter/source/config/fragments/types/writer_MultiMate_Adv_36_W4W.xcu
new file mode 100644
index 000000000000..8c962e59bae7
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_MultiMate_Adv_36_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_MultiMate_Adv_36_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>doc</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>MultiMate Adv. 3.6 (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>MultiMate Adv. 3.6</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_MultiMate_Adv_II_37_W4W.xcu b/filter/source/config/fragments/types/writer_MultiMate_Adv_II_37_W4W.xcu
new file mode 100644
index 000000000000..9106dee7e95f
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_MultiMate_Adv_II_37_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_MultiMate_Adv_II_37_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>doc</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>MultiMate Adv. II 3.7 (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>MultiMate Adv. II 3.7</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_NAVY_DIF_W4W.xcu b/filter/source/config/fragments/types/writer_NAVY_DIF_W4W.xcu
new file mode 100644
index 000000000000..c55ed5f34d43
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_NAVY_DIF_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_NAVY_DIF_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>doc</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>NAVY DIF (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>NAVY DIF</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_OfficeWriter_40_W4W.xcu b/filter/source/config/fragments/types/writer_OfficeWriter_40_W4W.xcu
new file mode 100644
index 000000000000..58e11ed9ee39
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_OfficeWriter_40_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_OfficeWriter_40_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>wp</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>OfficeWriter 4.0 (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>OfficeWriter 4.0</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_OfficeWriter_50_W4W.xcu b/filter/source/config/fragments/types/writer_OfficeWriter_50_W4W.xcu
new file mode 100644
index 000000000000..895e78c36d40
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_OfficeWriter_50_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_OfficeWriter_50_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>wp</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>OfficeWriter 5.0 (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>OfficeWriter 5.0</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_OfficeWriter_6x_W4W.xcu b/filter/source/config/fragments/types/writer_OfficeWriter_6x_W4W.xcu
new file mode 100644
index 000000000000..80befadbc319
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_OfficeWriter_6x_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_OfficeWriter_6x_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>wp</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>OfficeWriter 6.x (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>OfficeWriter 6.x</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_PFS_First_Choice_10_W4W.xcu b/filter/source/config/fragments/types/writer_PFS_First_Choice_10_W4W.xcu
new file mode 100644
index 000000000000..783b40243c9f
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_PFS_First_Choice_10_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_PFS_First_Choice_10_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>doc</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>PFS First Choice 1.0 (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>PFS First Choice 1.0</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_PFS_First_Choice_20_W4W.xcu b/filter/source/config/fragments/types/writer_PFS_First_Choice_20_W4W.xcu
new file mode 100644
index 000000000000..de4655924c1e
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_PFS_First_Choice_20_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_PFS_First_Choice_20_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>doc</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>PFS First Choice 2.0 (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>PFS First Choice 2.0</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_PFS_First_Choice_30_W4W.xcu b/filter/source/config/fragments/types/writer_PFS_First_Choice_30_W4W.xcu
new file mode 100644
index 000000000000..5ee28be8be41
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_PFS_First_Choice_30_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_PFS_First_Choice_30_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>doc</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>PFS First Choice 3.0 (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>PFS First Choice 3.0</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_PFS_Write_W4W.xcu b/filter/source/config/fragments/types/writer_PFS_Write_W4W.xcu
new file mode 100644
index 000000000000..44c867e1daee
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_PFS_Write_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_PFS_Write_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>doc</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>PFS Write (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>PFS Write</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_Peach_Text_W4W.xcu b/filter/source/config/fragments/types/writer_Peach_Text_W4W.xcu
new file mode 100644
index 000000000000..3388860e62e8
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_Peach_Text_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_Peach_Text_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>doc</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>Peach Text (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>Peach Text</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_PocketWord_File.xcu b/filter/source/config/fragments/types/writer_PocketWord_File.xcu
new file mode 100644
index 000000000000..61c50a935dbc
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_PocketWord_File.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_PocketWord_File" 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>psw</value></prop>
+ <prop oor:name="MediaType"><value>application/x-pocket-word</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>PocketWord File</value></prop>
+ <prop oor:name="UIName">
+ <value>Pocket Word</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>doctype:pwi</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_Professional_Write_10_W4W.xcu b/filter/source/config/fragments/types/writer_Professional_Write_10_W4W.xcu
new file mode 100644
index 000000000000..f97f8cee9387
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_Professional_Write_10_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_Professional_Write_10_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>doc</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>Professional Write 1.0 (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>PFS Professional Write 1.0</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_Professional_Write_2x_W4W.xcu b/filter/source/config/fragments/types/writer_Professional_Write_2x_W4W.xcu
new file mode 100644
index 000000000000..7b6f2d8433c8
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_Professional_Write_2x_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_Professional_Write_2x_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>doc</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>Professional Write 2.x (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>PFS Professional Write 2.x</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_Professional_Write_Plus_W4W.xcu b/filter/source/config/fragments/types/writer_Professional_Write_Plus_W4W.xcu
new file mode 100644
index 000000000000..f745ffd79dd0
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_Professional_Write_Plus_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_Professional_Write_Plus_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>doc</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>Professional Write Plus (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>PFS Professional Write Plus</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_QA_Write_10_30_W4W.xcu b/filter/source/config/fragments/types/writer_QA_Write_10_30_W4W.xcu
new file mode 100644
index 000000000000..1c6723c51280
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_QA_Write_10_30_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_QA_Write_10_30_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>qw</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>Q&amp;A Write 1.0-3.0 (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>Q&amp;A Write 1.0-3.0</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_QA_Write_40_W4W.xcu b/filter/source/config/fragments/types/writer_QA_Write_40_W4W.xcu
new file mode 100644
index 000000000000..d687fa4659eb
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_QA_Write_40_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_QA_Write_40_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>qw</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>Q&amp;A Write 4.0 (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>Q&amp;A Write 4.0</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_Rapid_File_10_W4W.xcu b/filter/source/config/fragments/types/writer_Rapid_File_10_W4W.xcu
new file mode 100644
index 000000000000..3f04250df4f8
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_Rapid_File_10_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_Rapid_File_10_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>doc</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>Rapid File 1.0 (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>Rapid File 1.0</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_Rapid_File_12_W4W.xcu b/filter/source/config/fragments/types/writer_Rapid_File_12_W4W.xcu
new file mode 100644
index 000000000000..a3ba7198ed38
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_Rapid_File_12_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_Rapid_File_12_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>doc</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>Rapid File 1.2 (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>Rapid File 1.2</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_Rich_Text_Format.xcu b/filter/source/config/fragments/types/writer_Rich_Text_Format.xcu
new file mode 100644
index 000000000000..80f7e6c39797
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_Rich_Text_Format.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_Rich_Text_Format" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.text.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>rtf</value></prop>
+ <prop oor:name="MediaType"><value>application/rtf</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>Rich Text Format</value></prop>
+ <prop oor:name="UIName">
+ <value>Rich Text Format</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_Samna_Word_IV_IV_Plus_W4W.xcu b/filter/source/config/fragments/types/writer_Samna_Word_IV_IV_Plus_W4W.xcu
new file mode 100644
index 000000000000..6aab4e9bf9c8
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_Samna_Word_IV_IV_Plus_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_Samna_Word_IV_IV_Plus_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>sw4</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>Samna Word IV-IV Plus (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>Samna Word IV-IV Plus</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_StarOffice_XML_Writer.xcu b/filter/source/config/fragments/types/writer_StarOffice_XML_Writer.xcu
new file mode 100644
index 000000000000..09ebbf6b8224
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_StarOffice_XML_Writer.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_StarOffice_XML_Writer" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.text.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>sxw</value></prop>
+ <prop oor:name="MediaType"><value>application/vnd.sun.xml.writer</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>StarOffice XML (Writer)</value></prop>
+ <prop oor:name="UIName">
+ <value>%productname% %formatversion% Textdokument</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>Writer 6.0</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_StarOffice_XML_Writer_Template.xcu b/filter/source/config/fragments/types/writer_StarOffice_XML_Writer_Template.xcu
new file mode 100644
index 000000000000..1ad5271eadc5
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_StarOffice_XML_Writer_Template.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_StarOffice_XML_Writer_Template" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.text.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>stw</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>true</value></prop>
+ <prop oor:name="PreferredFilter"><value>writer_StarOffice_XML_Writer_Template</value></prop>
+ <prop oor:name="UIName">
+ <value>Writer 6.0 Template</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>Writer 6.0</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_StarWriter_10.xcu b/filter/source/config/fragments/types/writer_StarWriter_10.xcu
new file mode 100644
index 000000000000..f5e55f95d46d
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_StarWriter_10.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_StarWriter_10" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>sdw</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>StarWriter 1.0</value></prop>
+ <prop oor:name="UIName">
+ <value>StarWriter 1.0</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_StarWriter_20.xcu b/filter/source/config/fragments/types/writer_StarWriter_20.xcu
new file mode 100644
index 000000000000..d166b294803c
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_StarWriter_20.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_StarWriter_20" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>sdw</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>StarWriter 2.0</value></prop>
+ <prop oor:name="UIName">
+ <value>StarWriter 2.0</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_StarWriter_30.xcu b/filter/source/config/fragments/types/writer_StarWriter_30.xcu
new file mode 100644
index 000000000000..5b8297f196d5
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_StarWriter_30.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_StarWriter_30" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>sdw</value></prop>
+ <prop oor:name="MediaType"><value>application/x-starwriter</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>StarWriter 3.0</value></prop>
+ <prop oor:name="UIName">
+ <value>StarWriter 3.0 (%productname% %formatversion% Globaldokument)</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>StarWriter 3.0</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_StarWriter_30_VorlageTemplate.xcu b/filter/source/config/fragments/types/writer_StarWriter_30_VorlageTemplate.xcu
new file mode 100644
index 000000000000..ad4ee7d15628
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_StarWriter_30_VorlageTemplate.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_StarWriter_30_VorlageTemplate" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>vor</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>StarWriter 3.0 Vorlage/Template</value></prop>
+ <prop oor:name="UIName">
+ <value>StarWriter 3.0 Template</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>StarWriter 3.0</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_StarWriter_40.xcu b/filter/source/config/fragments/types/writer_StarWriter_40.xcu
new file mode 100644
index 000000000000..cb4148dd1032
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_StarWriter_40.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_StarWriter_40" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>sdw</value></prop>
+ <prop oor:name="MediaType"><value>application/x-starwriter</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>StarWriter 4.0</value></prop>
+ <prop oor:name="UIName">
+ <value>StarWriter 4.0 (%productname% %formatversion% Globaldokument)</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>StarWriter 4.0</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_StarWriter_40_VorlageTemplate.xcu b/filter/source/config/fragments/types/writer_StarWriter_40_VorlageTemplate.xcu
new file mode 100644
index 000000000000..168c63b11b42
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_StarWriter_40_VorlageTemplate.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_StarWriter_40_VorlageTemplate" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>vor</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>StarWriter 4.0 Vorlage/Template</value></prop>
+ <prop oor:name="UIName">
+ <value>StarWriter 4.0 Template</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>StarWriter 4.0</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_StarWriter_50.xcu b/filter/source/config/fragments/types/writer_StarWriter_50.xcu
new file mode 100644
index 000000000000..d8aeeb6bd617
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_StarWriter_50.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_StarWriter_50" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>sdw</value></prop>
+ <prop oor:name="MediaType"><value>application/vnd.stardivision.writer</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>StarWriter 5.0</value></prop>
+ <prop oor:name="UIName">
+ <value>StarWriter 5.0 (%productname% %formatversion% Globaldokument)</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>StarWriter 5.0</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_StarWriter_50_VorlageTemplate.xcu b/filter/source/config/fragments/types/writer_StarWriter_50_VorlageTemplate.xcu
new file mode 100644
index 000000000000..d46b510fc328
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_StarWriter_50_VorlageTemplate.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_StarWriter_50_VorlageTemplate" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>vor</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>StarWriter 5.0 Vorlage/Template</value></prop>
+ <prop oor:name="UIName">
+ <value>StarWriter 5.0 Template</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>StarWriter 5.0</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_StarWriter_DOS.xcu b/filter/source/config/fragments/types/writer_StarWriter_DOS.xcu
new file mode 100644
index 000000000000..00864caffe68
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_StarWriter_DOS.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_StarWriter_DOS" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>txt</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>StarWriter DOS</value></prop>
+ <prop oor:name="UIName">
+ <value>StarWriter DOS</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_T602_Document.xcu b/filter/source/config/fragments/types/writer_T602_Document.xcu
new file mode 100644
index 000000000000..c233c324bd3e
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_T602_Document.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_T602_Document" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.Writer.T602ImportFilter</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>602 txt</value></prop>
+ <prop oor:name="MediaType"><value>application/x-t602</value></prop>
+ <prop oor:name="Preferred"><value>true</value></prop>
+ <prop oor:name="PreferredFilter"><value>T602Document</value></prop>
+ <prop oor:name="UIName">
+ <value>T602 Document</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_Text.xcu b/filter/source/config/fragments/types/writer_Text.xcu
new file mode 100644
index 000000000000..014c73d729b2
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_Text.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_Text" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.text.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>txt</value></prop>
+ <prop oor:name="MediaType"><value>text/plain</value></prop>
+ <prop oor:name="Preferred"><value>true</value></prop>
+ <prop oor:name="PreferredFilter"><value>Text</value></prop>
+ <prop oor:name="UIName">
+ <value>Text</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_Text_encoded.xcu b/filter/source/config/fragments/types/writer_Text_encoded.xcu
new file mode 100644
index 000000000000..6959f61c4dba
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_Text_encoded.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_Text_encoded" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.text.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>txt</value></prop>
+ <prop oor:name="MediaType"><value>text/plain</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>Text (encoded)</value></prop>
+ <prop oor:name="UIName">
+ <value>Text - encoded</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_Total_Word_W4W.xcu b/filter/source/config/fragments/types/writer_Total_Word_W4W.xcu
new file mode 100644
index 000000000000..6af415b72d80
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_Total_Word_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_Total_Word_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>doc</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>Total Word (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>Total Word</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_Uniplex_V7_V8_W4W.xcu b/filter/source/config/fragments/types/writer_Uniplex_V7_V8_W4W.xcu
new file mode 100644
index 000000000000..6f3c7402dc3f
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_Uniplex_V7_V8_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_Uniplex_V7_V8_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>doc</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>Uniplex V7-V8 (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>Uniplex V7-V8</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_Uniplex_onGO_W4W.xcu b/filter/source/config/fragments/types/writer_Uniplex_onGO_W4W.xcu
new file mode 100644
index 000000000000..ee60b06a270e
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_Uniplex_onGO_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_Uniplex_onGO_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>nvo</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>Uniplex onGO (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>Uniplex onGO</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_VolksWriter_3_and_4_W4W.xcu b/filter/source/config/fragments/types/writer_VolksWriter_3_and_4_W4W.xcu
new file mode 100644
index 000000000000..c37992e0322e
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_VolksWriter_3_and_4_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_VolksWriter_3_and_4_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>doc</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>VolksWriter 3 and 4 (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>VolksWriter 3 and 4</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_VolksWriter_Deluxe_W4W.xcu b/filter/source/config/fragments/types/writer_VolksWriter_Deluxe_W4W.xcu
new file mode 100644
index 000000000000..7df44a50309d
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_VolksWriter_Deluxe_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_VolksWriter_Deluxe_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>doc</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>VolksWriter Deluxe (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>VolksWriter Deluxe</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_WITA_W4W.xcu b/filter/source/config/fragments/types/writer_WITA_W4W.xcu
new file mode 100644
index 000000000000..b2c965e3c93f
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_WITA_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_WITA_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>doc</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>WITA (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>WITA</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_Wang_II_SWP_W4W.xcu b/filter/source/config/fragments/types/writer_Wang_II_SWP_W4W.xcu
new file mode 100644
index 000000000000..3dc0fad0a37c
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_Wang_II_SWP_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_Wang_II_SWP_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>doc</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>Wang II SWP (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>Wang II SWP</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_Wang_PC_W4W.xcu b/filter/source/config/fragments/types/writer_Wang_PC_W4W.xcu
new file mode 100644
index 000000000000..380d43c32c1b
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_Wang_PC_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_Wang_PC_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>doc</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>Wang PC (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>Wang PC</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_Wang_WP_Plus_W4W.xcu b/filter/source/config/fragments/types/writer_Wang_WP_Plus_W4W.xcu
new file mode 100644
index 000000000000..6ec9fa5bf66e
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_Wang_WP_Plus_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_Wang_WP_Plus_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>doc</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>Wang WP Plus (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>Wang WP Plus</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_Win_Write_3x_W4W.xcu b/filter/source/config/fragments/types/writer_Win_Write_3x_W4W.xcu
new file mode 100644
index 000000000000..bdd03bc7248a
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_Win_Write_3x_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_Win_Write_3x_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>wri</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>Win Write 3.x (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>Win Write 3.x</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_WiziWord_30_W4W.xcu b/filter/source/config/fragments/types/writer_WiziWord_30_W4W.xcu
new file mode 100644
index 000000000000..9db56666abbe
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_WiziWord_30_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_WiziWord_30_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>doc</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>WiziWord 3.0 (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>WiziWord 3.0</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_WordPerfect_41_W4W.xcu b/filter/source/config/fragments/types/writer_WordPerfect_41_W4W.xcu
new file mode 100644
index 000000000000..ebff7aa049b9
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_WordPerfect_41_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_WordPerfect_41_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>wpd</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>WordPerfect 4.1 (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>WordPerfect 4.1</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_WordPerfect_42_W4W.xcu b/filter/source/config/fragments/types/writer_WordPerfect_42_W4W.xcu
new file mode 100644
index 000000000000..d45ed8db7e84
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_WordPerfect_42_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_WordPerfect_42_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>wpd</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>WordPerfect 4.2 (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>WordPerfect 4.2</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_WordPerfect_50_W4W.xcu b/filter/source/config/fragments/types/writer_WordPerfect_50_W4W.xcu
new file mode 100644
index 000000000000..39020fe18326
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_WordPerfect_50_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_WordPerfect_50_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>wpd</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>WordPerfect 5.0 (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>WordPerfect 5.0</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_WordPerfect_51_W4W.xcu b/filter/source/config/fragments/types/writer_WordPerfect_51_W4W.xcu
new file mode 100644
index 000000000000..215abbf68b4b
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_WordPerfect_51_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_WordPerfect_51_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>wpd</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>WordPerfect 5.1 (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>WordPerfect 5.1</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_WordPerfect_60_W4W.xcu b/filter/source/config/fragments/types/writer_WordPerfect_60_W4W.xcu
new file mode 100644
index 000000000000..1437e283ca9a
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_WordPerfect_60_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_WordPerfect_60_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>wpd</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>WordPerfect 6.0 (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>WordPerfect 6.0</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_WordPerfect_61_W4W.xcu b/filter/source/config/fragments/types/writer_WordPerfect_61_W4W.xcu
new file mode 100644
index 000000000000..c52456bddacb
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_WordPerfect_61_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_WordPerfect_61_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>wpd</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>WordPerfect 6.1 (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>WordPerfect 6.1</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_WordPerfect_Document.xcu b/filter/source/config/fragments/types/writer_WordPerfect_Document.xcu
new file mode 100644
index 000000000000..3798319ca976
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_WordPerfect_Document.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_WordPerfect_Document" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.Writer.WordPerfectImportFilter</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>wpd</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>true</value></prop>
+ <prop oor:name="PreferredFilter"><value>WordPerfect</value></prop>
+ <prop oor:name="UIName">
+ <value>WordPerfect Document</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_WordPerfect_Mac_1_W4W.xcu b/filter/source/config/fragments/types/writer_WordPerfect_Mac_1_W4W.xcu
new file mode 100644
index 000000000000..f05ce9964707
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_WordPerfect_Mac_1_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_WordPerfect_Mac_1_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>wpd</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>WordPerfect Mac 1 (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>WordPerfect Mac 1</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_WordPerfect_Mac_2_W4W.xcu b/filter/source/config/fragments/types/writer_WordPerfect_Mac_2_W4W.xcu
new file mode 100644
index 000000000000..3a5838f96cf7
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_WordPerfect_Mac_2_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_WordPerfect_Mac_2_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>wpd</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>WordPerfect Mac 2 (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>WordPerfect Mac 2</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_WordPerfect_Mac_3_W4W.xcu b/filter/source/config/fragments/types/writer_WordPerfect_Mac_3_W4W.xcu
new file mode 100644
index 000000000000..8dc35dc6eb30
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_WordPerfect_Mac_3_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_WordPerfect_Mac_3_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>wpd</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>WordPerfect Mac 3 (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>WordPerfect Mac 3</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_WordPerfect_Win_51_52_W4W.xcu b/filter/source/config/fragments/types/writer_WordPerfect_Win_51_52_W4W.xcu
new file mode 100644
index 000000000000..aea69373a41e
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_WordPerfect_Win_51_52_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_WordPerfect_Win_51_52_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>wpd</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>WordPerfect (Win) 5.1-5.2 (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>WordPerfect (Win) 5.1-5.2</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_WordPerfect_Win_60_W4W.xcu b/filter/source/config/fragments/types/writer_WordPerfect_Win_60_W4W.xcu
new file mode 100644
index 000000000000..b484283587c6
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_WordPerfect_Win_60_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_WordPerfect_Win_60_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>wpd</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>WordPerfect (Win) 6.0 (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>WordPerfect (Win) 6.0</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_WordPerfect_Win_61_W4W.xcu b/filter/source/config/fragments/types/writer_WordPerfect_Win_61_W4W.xcu
new file mode 100644
index 000000000000..8926abcf4d36
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_WordPerfect_Win_61_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_WordPerfect_Win_61_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>wpd</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>WordPerfect (Win) 6.1 (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>WordPerfect (Win) 6.1</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_WordPerfect_Win_70_W4W.xcu b/filter/source/config/fragments/types/writer_WordPerfect_Win_70_W4W.xcu
new file mode 100644
index 000000000000..fca29da4d451
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_WordPerfect_Win_70_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_WordPerfect_Win_70_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>wpd</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>WordPerfect (Win) 7.0 (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>WordPerfect (Win) 7.0</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_WordStar_2000_Rel_30_W4W.xcu b/filter/source/config/fragments/types/writer_WordStar_2000_Rel_30_W4W.xcu
new file mode 100644
index 000000000000..d3d6d3050253
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_WordStar_2000_Rel_30_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_WordStar_2000_Rel_30_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>ws</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>WordStar 2000 Rel. 3.0 (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>WordStar 2000 Rel. 3.0</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_WordStar_2000_Rel_35_W4W.xcu b/filter/source/config/fragments/types/writer_WordStar_2000_Rel_35_W4W.xcu
new file mode 100644
index 000000000000..fcf1875fb824
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_WordStar_2000_Rel_35_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_WordStar_2000_Rel_35_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>ws</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>WordStar 2000 Rel. 3.5 (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>WordStar 2000 Rel. 3.5</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_WordStar_33x_W4W.xcu b/filter/source/config/fragments/types/writer_WordStar_33x_W4W.xcu
new file mode 100644
index 000000000000..0f5df15cd4a4
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_WordStar_33x_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_WordStar_33x_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>wsd</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>WordStar 3.3x (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>WordStar 3.3</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_WordStar_345_W4W.xcu b/filter/source/config/fragments/types/writer_WordStar_345_W4W.xcu
new file mode 100644
index 000000000000..2393cce4e21e
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_WordStar_345_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_WordStar_345_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>wsd</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>WordStar 3.45 (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>WordStar 3.4</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_WordStar_40_W4W.xcu b/filter/source/config/fragments/types/writer_WordStar_40_W4W.xcu
new file mode 100644
index 000000000000..ff3e5cecd3f7
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_WordStar_40_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_WordStar_40_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>wsd</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>WordStar 4.0 (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>WordStar 4.0</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_WordStar_50_W4W.xcu b/filter/source/config/fragments/types/writer_WordStar_50_W4W.xcu
new file mode 100644
index 000000000000..9a18cefe2aee
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_WordStar_50_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_WordStar_50_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>wsd</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>WordStar 5.0 (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>WordStar 5.0</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_WordStar_55_W4W.xcu b/filter/source/config/fragments/types/writer_WordStar_55_W4W.xcu
new file mode 100644
index 000000000000..ea0267411388
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_WordStar_55_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_WordStar_55_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>wsd</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>WordStar 5.5 (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>WordStar 5.5</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_WordStar_60_W4W.xcu b/filter/source/config/fragments/types/writer_WordStar_60_W4W.xcu
new file mode 100644
index 000000000000..42b7413c1baa
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_WordStar_60_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_WordStar_60_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>wsd</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>WordStar 6.0 (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>WordStar 6.0</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_WordStar_70_W4W.xcu b/filter/source/config/fragments/types/writer_WordStar_70_W4W.xcu
new file mode 100644
index 000000000000..18dbe3e99867
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_WordStar_70_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_WordStar_70_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>wsd</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>WordStar 7.0 (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>WordStar 7.0</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_WordStar_Win_1x_20_W4W.xcu b/filter/source/config/fragments/types/writer_WordStar_Win_1x_20_W4W.xcu
new file mode 100644
index 000000000000..911edcee23cb
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_WordStar_Win_1x_20_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_WordStar_Win_1x_20_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>wsd</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>WordStar (Win) 1.x-2.0 (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>WordStar (Win) 1.x-2.0</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_WriteNow_30_Macintosh_W4W.xcu b/filter/source/config/fragments/types/writer_WriteNow_30_Macintosh_W4W.xcu
new file mode 100644
index 000000000000..9638b4ae4d66
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_WriteNow_30_Macintosh_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_WriteNow_30_Macintosh_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>doc</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>WriteNow 3.0 (Macintosh) (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>WriteNow 3.0 Macintosh</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_Writing_Assistant_W4W.xcu b/filter/source/config/fragments/types/writer_Writing_Assistant_W4W.xcu
new file mode 100644
index 000000000000..b8cf4728957a
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_Writing_Assistant_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_Writing_Assistant_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>doc</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>Writing Assistant (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>Writing Assistant</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_XEROX_XIF_50_Illustrator_W4W.xcu b/filter/source/config/fragments/types/writer_XEROX_XIF_50_Illustrator_W4W.xcu
new file mode 100644
index 000000000000..4072bfca5dea
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_XEROX_XIF_50_Illustrator_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_XEROX_XIF_50_Illustrator_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>xif</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>XEROX XIF 5.0 (Illustrator) (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>XEROX Xelse if 5.0 Illustrator</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_XEROX_XIF_50_W4W.xcu b/filter/source/config/fragments/types/writer_XEROX_XIF_50_W4W.xcu
new file mode 100644
index 000000000000..abb982f5ee37
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_XEROX_XIF_50_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_XEROX_XIF_50_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>xif</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>XEROX XIF 5.0 (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>XEROX Xelse if 5.0</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_XEROX_XIF_60_Color_Bitmap_W4W.xcu b/filter/source/config/fragments/types/writer_XEROX_XIF_60_Color_Bitmap_W4W.xcu
new file mode 100644
index 000000000000..eecea8188781
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_XEROX_XIF_60_Color_Bitmap_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_XEROX_XIF_60_Color_Bitmap_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>xif</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>XEROX XIF 6.0 (Color Bitmap) (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>XEROX Xelse if 6.0 Color Bitmap</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_XEROX_XIF_60_Res_Graphic_W4W.xcu b/filter/source/config/fragments/types/writer_XEROX_XIF_60_Res_Graphic_W4W.xcu
new file mode 100644
index 000000000000..6b023aee7a96
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_XEROX_XIF_60_Res_Graphic_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_XEROX_XIF_60_Res_Graphic_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>xif</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>XEROX XIF 6.0 (Res Graphic) (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>XEROX Xelse if 6.0 Res Graphic</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_XyWrite_IIIP_W4W.xcu b/filter/source/config/fragments/types/writer_XyWrite_IIIP_W4W.xcu
new file mode 100644
index 000000000000..eff7cc2794f9
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_XyWrite_IIIP_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_XyWrite_IIIP_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>xyw</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>XyWrite III+ ( W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>XyWrite III+</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_XyWrite_III_W4W.xcu b/filter/source/config/fragments/types/writer_XyWrite_III_W4W.xcu
new file mode 100644
index 000000000000..d8218de40bf7
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_XyWrite_III_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_XyWrite_III_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>xyw</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>XyWrite III ( W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>XyWrite III</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_XyWrite_IV_W4W.xcu b/filter/source/config/fragments/types/writer_XyWrite_IV_W4W.xcu
new file mode 100644
index 000000000000..b3e652285bc0
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_XyWrite_IV_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_XyWrite_IV_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>xyw</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>XyWrite IV (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>XyWrite IV</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_XyWrite_Sig_Win_W4W.xcu b/filter/source/config/fragments/types/writer_XyWrite_Sig_Win_W4W.xcu
new file mode 100644
index 000000000000..084b2adcc8c7
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_XyWrite_Sig_Win_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_XyWrite_Sig_Win_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>xyw</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>XyWrite Sig. (Win) (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>XyWrite Signature</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_XyWrite_Signature_W4W.xcu b/filter/source/config/fragments/types/writer_XyWrite_Signature_W4W.xcu
new file mode 100644
index 000000000000..c86cb3647278
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_XyWrite_Signature_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_XyWrite_Signature_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>xyw</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>XyWrite Signature (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>XyWrite Signature</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_XyWrite_Win_10_W4W.xcu b/filter/source/config/fragments/types/writer_XyWrite_Win_10_W4W.xcu
new file mode 100644
index 000000000000..e570e578d338
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_XyWrite_Win_10_W4W.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_XyWrite_Win_10_W4W" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>xyw</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>XyWrite (Win) 1.0 (W4W)</value></prop>
+ <prop oor:name="UIName">
+ <value>XyWrite (Win) 1.0</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_globaldocument_StarOffice_XML_Writer_GlobalDocument.xcu b/filter/source/config/fragments/types/writer_globaldocument_StarOffice_XML_Writer_GlobalDocument.xcu
new file mode 100644
index 000000000000..e0efe4d21ccd
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_globaldocument_StarOffice_XML_Writer_GlobalDocument.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_globaldocument_StarOffice_XML_Writer_GlobalDocument" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.text.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>sxg</value></prop>
+ <prop oor:name="MediaType"><value>application/vnd.sun.xml.writer.global</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>writer_globaldocument_StarOffice_XML_Writer_GlobalDocument</value></prop>
+ <prop oor:name="UIName">
+ <value>Writer 6.0 Master Document</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>Writer/Global 6.0</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_globaldocument_StarWriter_40GlobalDocument.xcu b/filter/source/config/fragments/types/writer_globaldocument_StarWriter_40GlobalDocument.xcu
new file mode 100644
index 000000000000..5f0f05204355
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_globaldocument_StarWriter_40GlobalDocument.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_globaldocument_StarWriter_40GlobalDocument" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>sgl</value></prop>
+ <prop oor:name="MediaType"><value>application/x-starwriter</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>StarWriter 4.0/GlobalDocument</value></prop>
+ <prop oor:name="UIName">
+ <value>StarWriter 4.0 Master Document</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>StarWriter/Global 4.0</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_globaldocument_StarWriter_50GlobalDocument.xcu b/filter/source/config/fragments/types/writer_globaldocument_StarWriter_50GlobalDocument.xcu
new file mode 100644
index 000000000000..0850c43becc6
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_globaldocument_StarWriter_50GlobalDocument.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_globaldocument_StarWriter_50GlobalDocument" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sfx2.BinaryFormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>sgl</value></prop>
+ <prop oor:name="MediaType"><value>application/vnd.stardivision.writer-global</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>StarWriter 5.0/GlobalDocument</value></prop>
+ <prop oor:name="UIName">
+ <value>StarWriter 5.0 Master Document</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>StarWriter/Global 5.0</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_web_HTML.xcu b/filter/source/config/fragments/types/writer_web_HTML.xcu
new file mode 100644
index 000000000000..a1d9a0914ff5
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_web_HTML.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_web_HTML" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.text.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"><value>private:factory/swriter/web*</value></prop>
+ <prop oor:name="Extensions"><value>html htm</value></prop>
+ <prop oor:name="MediaType"><value>text/html</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>HTML</value></prop>
+ <prop oor:name="UIName">
+ <value>HTML Document</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_web_HTML_help.xcu b/filter/source/config/fragments/types/writer_web_HTML_help.xcu
new file mode 100644
index 000000000000..5394c7776bea
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_web_HTML_help.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_web_HTML_help" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.text.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"><value>vnd.sun.star.help://*</value></prop>
+ <prop oor:name="Extensions"/>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>writer_web_HTML_help</value></prop>
+ <prop oor:name="UIName">
+ <value>Help content</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_web_StarOffice_XML_Writer_Web_Template.xcu b/filter/source/config/fragments/types/writer_web_StarOffice_XML_Writer_Web_Template.xcu
new file mode 100644
index 000000000000..97fb23c1d3e2
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_web_StarOffice_XML_Writer_Web_Template.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_web_StarOffice_XML_Writer_Web_Template" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.text.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>stw</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>writer_web_StarOffice_XML_Writer_Web_Template</value></prop>
+ <prop oor:name="UIName">
+ <value>Writer/Web 6.0 Template</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>Writer/Web 6.0</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_web_StarWriterWeb_40_VorlageTemplate.xcu b/filter/source/config/fragments/types/writer_web_StarWriterWeb_40_VorlageTemplate.xcu
new file mode 100644
index 000000000000..1e93d6411419
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_web_StarWriterWeb_40_VorlageTemplate.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_web_StarWriterWeb_40_VorlageTemplate" oor:op="replace" >
+ <prop oor:name="DetectService"/>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>vor</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>StarWriter/Web 4.0 Vorlage/Template</value></prop>
+ <prop oor:name="UIName">
+ <value>StarWriter/Web 4.0 Template</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>StarWriter/Web 4.0</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_web_StarWriterWeb_50_VorlageTemplate.xcu b/filter/source/config/fragments/types/writer_web_StarWriterWeb_50_VorlageTemplate.xcu
new file mode 100644
index 000000000000..1cc98cad2e2e
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_web_StarWriterWeb_50_VorlageTemplate.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writer_web_StarWriterWeb_50_VorlageTemplate" oor:op="replace" >
+ <prop oor:name="DetectService"/>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>vor</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>StarWriter/Web 5.0 Vorlage/Template</value></prop>
+ <prop oor:name="UIName">
+ <value>StarWriter/Web 5.0 Template</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>StarWriter/Web 5.0</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/writerglobal8.xcu b/filter/source/config/fragments/types/writerglobal8.xcu
new file mode 100644
index 000000000000..f9f32e7c6b5d
--- /dev/null
+++ b/filter/source/config/fragments/types/writerglobal8.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writerglobal8" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.text.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"><value>private:factory/swriter/GlobalDocument*</value></prop>
+ <prop oor:name="Extensions"><value>odm</value></prop>
+ <prop oor:name="MediaType"><value>application/vnd.oasis.opendocument.text-master</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>writerglobal8</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">Writer 8 Master Document</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>Writer/Global 8</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/writerweb8_writer_template.xcu b/filter/source/config/fragments/types/writerweb8_writer_template.xcu
new file mode 100644
index 000000000000..dbf9b45e0f6c
--- /dev/null
+++ b/filter/source/config/fragments/types/writerweb8_writer_template.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="writerweb8_writer_template" oor:op="replace">
+ <prop oor:name="DetectService"><value>com.sun.star.text.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>oth</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>writerweb8_writer_template</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">Writer/Web 8 Template</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"><value>Writer/Web 8</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/xbm_X_Consortium.xcu b/filter/source/config/fragments/types/xbm_X_Consortium.xcu
new file mode 100644
index 000000000000..948b77dea121
--- /dev/null
+++ b/filter/source/config/fragments/types/xbm_X_Consortium.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="xbm_X_Consortium" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.draw.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>xbm</value></prop>
+ <prop oor:name="MediaType"><value>image/x-xbitmap</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>XBM - X-Consortium</value></prop>
+ <prop oor:name="UIName">
+ <value>XBM - X Bitmap</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/xpm_XPM.xcu b/filter/source/config/fragments/types/xpm_XPM.xcu
new file mode 100644
index 000000000000..8361ec6ac313
--- /dev/null
+++ b/filter/source/config/fragments/types/xpm_XPM.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="xpm_XPM" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.draw.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>xpm</value></prop>
+ <prop oor:name="MediaType"><value>image/x-xpixmap</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>XPM</value></prop>
+ <prop oor:name="UIName">
+ <value>XPM - X PixMap</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/tools/Manifest.mf b/filter/source/config/tools/Manifest.mf
new file mode 100644
index 000000000000..91387715ae71
--- /dev/null
+++ b/filter/source/config/tools/Manifest.mf
@@ -0,0 +1,4 @@
+Manifest-Version: 1.0
+Created-By: Sun Microsystems, Inc.
+Main-Class: MergeApp
+Class-Path: .
diff --git a/filter/source/config/tools/merge/pyAltFCFGMerge b/filter/source/config/tools/merge/pyAltFCFGMerge
new file mode 100755
index 000000000000..a44a4bb81d29
--- /dev/null
+++ b/filter/source/config/tools/merge/pyAltFCFGMerge
@@ -0,0 +1,591 @@
+#!/bin/env python
+#_____________________________________________
+# Caolan McNamara caolanm@redhat.com
+# converted from original java written by Andreas Schluens so we can continue
+# to build 680 OpenOffice.org series without java
+# this is not really a replacement for the existing java tool, just the
+# minimum required to make it work for now, the existing tool is still
+# the canonical base, changes to it will have to be mirrored here until
+# there is a java which is available for use by all
+#_____________________________________________
+
+import sys, string, os.path
+
+CFGFILE = os.environ["SOLARVER"] + "/" + os.environ["INPATH"] + "/inc/l10ntools/FCFGMerge.cfg"
+
+PROP_XMLVERSION = "xmlversion" # // <= global cfg file
+PROP_XMLENCODING = "xmlencoding" # // <= global cfg file
+PROP_XMLPATH = "xmlpath" # // <= global cfg file
+PROP_XMLPACKAGE = "xmlpackage" # // <= global cfg file
+PROP_SETNAME_TYPES = "setname_types" # // <= global cfg file
+PROP_SETNAME_FILTERS = "setname_filters" # // <= global cfg file
+PROP_SETNAME_LOADERS = "setname_frameloaders" # // <= global cfg file
+PROP_SETNAME_HANDLERS = "setname_contenthandlers" # // <= global cfg file
+PROP_SUBDIR_TYPES = "subdir_types" # // <= global cfg file
+PROP_SUBDIR_FILTERS = "subdir_filters" # // <= global cfg file
+PROP_SUBDIR_LOADERS = "subdir_frameloaders" # // <= global cfg file
+PROP_SUBDIR_HANDLERS = "subdir_contenthandlers" # // <= global cfg file
+PROP_EXTENSION_XCU = "extension_xcu" # // <= global cfg file
+PROP_EXTENSION_PKG = "extension_pkg" # // <= global cfg file
+PROP_DELIMITER = "delimiter" # // <= global cfg file
+PROP_TRIM = "trim" # // <= global cfg file
+PROP_DECODE = "decode" # // <= global cfg file
+PROP_FRAGMENTSDIR = "fragmentsdir" # // <= cmdline
+PROP_TEMPDIR = "tempdir" # // <= cmdline
+PROP_OUTDIR = "outdir" # // <= cmdline
+PROP_PKG = "pkg" # // <= cmdline
+PROP_TCFG = "tcfg" # // <= cmdline
+PROP_FCFG = "fcfg" # // <= cmdline
+PROP_LCFG = "lcfg" # // <= cmdline
+PROP_CCFG = "ccfg" # // <= cmdline
+PROP_LANGUAGEPACK = "languagepack" # // <= cmdline
+PROP_ITEMS = "items" # // <= pkg cfg files!
+
+#---begin java.util.Properties copy---#
+"""
+
+An incomplete clean room implementation of
+java.util.Properties written in Python.
+
+Copyright (C) 2002,2004 - Ollie Rutherfurd <oliver@rutherfurd.net>
+
+Based on:
+
+ http://java.sun.com/j2se/1.3/docs/api/java/util/Properties.html
+
+Missing:
+
+ - Currently, u\XXXX sequences are escaped when saving, but not unescaped
+ when read..
+
+License: Python License
+
+Example Usage:
+
+>>> from properties import Properties
+>>> props = Properties()
+>>> props['one'] = '1'
+>>> props['your name'] = "I don't know"
+>>> print '\n'.join(props.keys())
+your name
+one
+>>> from StringIO import StringIO
+>>> buff = StringIO()
+>>> props.store(buff, "a little example...")
+>>> buff.seek(0)
+>>> print buff.read()
+# a little example...
+your\ name=I\ don\'t\ know
+one=1
+>>> print props['your name']
+I don't know
+
+$Id: pyAltFCFGMerge,v 1.3 2007-12-07 10:57:44 vg Exp $
+
+"""
+
+__all__ = ['Properties']
+
+
+def dec2hex(n):
+
+ h = hex(n)[2:].upper()
+ return '\\u' + '0' * (4 - len(h)) + h
+
+
+def escapestr(s):
+
+ buff = []
+ # QUESTION: escape leading or trailing spaces?
+ for c in s:
+ if c == '\\':
+ buff.append('\\\\')
+ elif c == '\t':
+ buff.append('\\t')
+ elif c == '\n':
+ buff.append('\\n')
+ elif c == '\r':
+ buff.append('\\r')
+ elif c == ' ':
+ buff.append('\\ ')
+ elif c == "'":
+ buff.append("\\'")
+ elif c == '"':
+ buff.append('\\"')
+ elif c == '#':
+ buff.append('\\#')
+ elif c == '!':
+ buff.append('\\!')
+ elif c == '=':
+ buff.append('\\=')
+ elif 32 <= ord(c) <= 126:
+ buff.append(c)
+ else:
+ buff.append(dec2hex(c))
+
+ return ''.join(buff)
+
+
+# TODO: add support for \uXXXX?
+def unescapestr(line):
+
+ buff = []
+ escape = 0
+ for i in range(len(line)):
+ c = line[i]
+ if c == '\\':
+ if escape:
+ escape = 0
+ buff.append('\\')
+ continue
+ else:
+ # this is to deal with '\'
+ # acting as a line continuation
+ # character
+ if i == len(line) - 1:
+ buff.append('\\')
+ break
+ else:
+ escape = 1
+ continue
+ elif c == 'n':
+ if escape:
+ escape = 0
+ buff.append('\n')
+ continue
+ elif c == 'r':
+ if escape:
+ escape = 0
+ buff.append('\r')
+ continue
+ elif c == 't':
+ if escape:
+ escape = 0
+ buff.append('\t')
+ continue
+
+ buff.append(c)
+
+ # make sure escape doesn't stay one
+ # all expected escape sequences either break
+ # or continue, so this should be safe
+ if escape:
+ escape = 0
+
+ return ''.join(buff)
+
+
+
+class Properties(dict):
+
+ def __init__(self, defaults={}):
+ dict.__init__(self)
+ for n,v in defaults.items():
+ self[n] = v
+
+ def __getittem__(self,key):
+ try:
+ return dict.__getittem__(self,key)
+ except KeyError:
+ return None
+
+ def read(self,filename):
+ """
+ Reads properties from a file (java Property class
+ reads from an input stream -- see load()).
+ """
+ f = None
+ try:
+ f = open(filename)
+ self.load(f)
+ finally:
+ if f:
+ f.close()
+
+ def load(self, buff):
+ """
+ Reads properties from a stream (StringIO, file, etc...)
+ """
+ props = readprops(buff)
+ for n,v in props.iteritems():
+ self[n] = v
+
+def readprops(buff):
+
+ name,value = None,''
+ props = {}
+ continued = 0
+
+ while 1:
+ line = buff.readline()
+ if not line:
+ break
+ line = line.strip()
+
+ # empty line
+ if not line:
+ continue
+
+ # comment
+ if line[0] in ('#','!'):
+ continue
+
+ # find name
+ i,escaped = 0,0
+ while i < len(line):
+ c = line[i]
+
+ if c == '\\':
+ if escaped:
+ escaped = 0
+ else:
+ escaped = 1
+ i += 1
+ continue
+
+ elif c in (' ', '\t', ':', '=') and not escaped:
+ name = unescapestr(line[:i])
+ break
+
+ # make sure escaped doesn't stay on
+ if escaped:
+ escaped = 0
+
+ i += 1
+
+ # no dlimiter was found, name is entire line, there is no value
+ if name == None:
+ name = unescapestr(line.lstrip())
+
+ # skip delimiter
+ while line[i:i+1] in ('\t', ' ', ':', '='):
+ i += 1
+
+ value = unescapestr(line[i:].strip())
+ while value[-1:] == '\\':
+ value = value[:-1] # remove \
+ line = buff.readline()
+ if not line:
+ break
+ value += unescapestr(line.strip())
+
+ #print 'value:',value ##
+ props[name] = value
+
+ return props
+#---end java.util.Properties copy---#
+
+# Its a simple command line tool, which can merge different XML fragments
+# together. Such fragments must exist as files on disk, will be moved into
+# one file together on disk.
+#
+# @author Andreas Schluens
+#
+def run(sCmdLine):
+ printCopyright()
+
+ aCfg = ConfigHelper(CFGFILE, sCmdLine)
+
+ # help requested?
+ if aCfg.isHelp():
+ printHelp()
+ sys.exit(-1)
+
+ #create new merge object and start operation
+ aMerger = Merger(aCfg)
+ aMerger.merge()
+
+ sys.exit(0)
+
+#prints out a copyright message on stdout.
+def printCopyright():
+ print "FCFGMerge"
+ print "Copyright: 2003 by Red Hat, Inc., based on FCFGMerge.java` by Sun"
+ print "All Rights Reserved."
+
+#prints out a help message on stdout.
+def printHelp():
+ print "____________________________________________________________"
+ print "usage: FCFGMerge cfg=<file name>"
+ print "parameters:"
+ print "\tcfg=<file name>"
+ print "\t\tmust point to a system file, which contains"
+ print "\t\tall neccessary configuration data for the merge process."
+ print "\tFurther cou can specify every parameter allowed in the"
+ print "\tconfig file as command line parameter too, to overwrite"
+ print "\tthe value from the file."
+
+def StringTokenizer(mstring, separators, isSepIncluded=0):
+#Return a list of tokens given a base string and a string of
+#separators, optionally including the separators if asked for"""
+ token=''
+ tokenList=[]
+ for c in mstring:
+ if c in separators:
+ if token != '':
+ tokenList.append(token)
+ token=''
+ if isSepIncluded:
+ tokenList.append(c)
+ else:
+ token+=c
+ if token:
+ tokenList.append(token)
+ return tokenList
+
+# can be used to analyze command line parameters
+# and merge it together with might existing config
+# files. That provides the possibility to overwrite
+# config values via command line parameter.
+#
+# @author Andreas Schluens
+class ConfigHelper:
+ def __init__(self, sPropFile, lCommandLineArgs):
+ self.m_bEmpty = 1
+ # first load prop file, so its values can be overwritten
+ # by command line args later
+ # Do it only, if a valid file name was given.
+ # But in case this file name is wrong, throw an exception.
+ # So the outside code can react!
+ if sPropFile != None and len(sPropFile) > 0:
+ self.props = Properties()
+ self.props.read(sPropFile)
+
+ count = 0
+ if lCommandLineArgs != None:
+ count = len(lCommandLineArgs)
+ self.m_bEmpty = (count < 1)
+
+ print lCommandLineArgs, "and len is", count
+ for arg in range(count):
+ # is it a named-value argument?
+ # Note: We ignores double "=" signs! => search from left to right
+ pos = lCommandLineArgs[arg].find('=')
+ if pos != -1:
+ sArg = lCommandLineArgs[arg][0:pos]
+ sValue = lCommandLineArgs[arg][pos+1:]
+ self.props[sArg] = sValue
+ continue
+
+ # is it a boolean argument?
+ # Note: Because "--" and "-" will be interpreted as the same
+ # we search from right to left!
+ pos = string.rfind(lCommandLineArgs[arg], '-')
+ if pos == -1:
+ pos = lCommandLineArgs[arg].rfind('/')
+ if pos != -1:
+ sArg = lCommandLineArgs[arg][pos+1:]
+ self.props[sArg] = 1
+ continue
+
+ raise Exception("Invalid command line detected. The argument \""+\
+ lCommandLineArgs[arg]+"\" use an unsupported format.")
+
+# for item in self.props:
+# print item, '->', self.props[item]
+
+ def isHelp(self):
+ return (
+ (self.props.has_key("help")) or
+ (self.props.has_key("?") ) or
+ (self.props.has_key("h") )
+ )
+
+ def getValue(self, sProp):
+ if not self.props.has_key(sProp):
+ raise Exception("The requested config value \""+sProp+"\" "\
+ "does not exists!");
+ return self.props[sProp];
+
+ def getValueWithDefault(self, sProp, default):
+ if not self.props.has_key(sProp):
+ return default;
+ return self.props[sProp];
+
+ def getStringList(self, sProp, sDelimiter, bTrim, bDecode):
+ if not self.props.has_key(sProp):
+ raise Exception("The requested config value \""+sProp+"\" does "\
+ "not exists!");
+ sValue = self.props[sProp]
+
+ lValue = []
+ lTokens = StringTokenizer(sValue, sDelimiter)
+ for sToken in lTokens:
+ if bTrim:
+ sToken = string.strip(sToken)
+ # remove ""
+ if ((bDecode) and (sToken.find("\"") == 0) and \
+ (sToken.rfind("\"") == len(sToken)-1)):
+ sToken = sToken[1, len(sToken)-1]
+ lValue.append(sToken)
+
+ return lValue
+
+def generateHeader(sVersion, sEncoding, sPath, sPackage, bLanguagePack):
+ sHeader = "<?xml version=\""
+ sHeader += sVersion
+ sHeader += "\" encoding=\""
+ sHeader += sEncoding
+ sHeader += "\"?>\n"
+
+ if bLanguagePack:
+ sHeader += "<oor:component-data oor:package=\""
+ sHeader += sPath
+ sHeader += "\" oor:name=\""
+ sHeader += sPackage
+ sHeader += "\" xmlns:install=\"http://openoffice.org/2004/installation\""
+ sHeader += " xmlns:oor=\"http://openoffice.org/2001/registry\""
+ sHeader += " xmlns:xs=\"http://www.w3.org/2001/XMLSchema\""
+ sHeader += " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n"
+ else:
+ sHeader += "<oor:component-data xmlns:oor=\"http://openoffice.org/2001/registry\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" oor:package=\""
+ sHeader += sPath
+ sHeader += "\" oor:name=\""
+ sHeader += sPackage
+ sHeader += "\">\n"
+ return sHeader
+
+def generateFooter():
+ return "</oor:component-data>\n"
+
+# can merge different xml fragments together.
+#
+# @author Caolan McNamara converted from the original java by Andreas Schluens
+#
+class Merger:
+ def __init__(self, aCfg):
+ self.m_aCfg = aCfg
+
+ self.m_aFragmentsDir = self.m_aCfg.getValue(PROP_FRAGMENTSDIR)
+
+ sDelimiter = self.m_aCfg.getValue(PROP_DELIMITER)
+ bTrim = self.m_aCfg.getValue(PROP_TRIM)
+ bDecode = self.m_aCfg.getValue(PROP_DECODE)
+
+ try:
+ aFcfg = ConfigHelper(self.m_aCfg.getValue(PROP_TCFG), None)
+ self.m_lTypes = aFcfg.getStringList(PROP_ITEMS, sDelimiter, bTrim, bDecode)
+ except:
+ self.m_lTypes = []
+
+ try:
+ aFcfg = ConfigHelper(self.m_aCfg.getValue(PROP_FCFG), None)
+ self.m_lFilters = aFcfg.getStringList(PROP_ITEMS, sDelimiter, bTrim, bDecode)
+ except:
+ self.m_lFilters = []
+
+ try:
+ aFcfg = ConfigHelper(self.m_aCfg.getValue(PROP_LCFG), None)
+ self.m_lLoaders = aFcfg.getStringList(PROP_ITEMS, sDelimiter, bTrim, bDecode)
+ except:
+ self.m_lLoaders = []
+
+ try:
+ aFcfg = ConfigHelper(self.m_aCfg.getValue(PROP_CCFG), None)
+ self.m_lHandlers = aFcfg.getStringList(PROP_ITEMS, sDelimiter, bTrim, bDecode)
+ except:
+ self.m_lHandlers = []
+
+ def merge(self):
+ sPackage = self.m_aCfg.getValue(PROP_PKG)
+
+ print "create package \""+sPackage+"\" ..."
+ print "generate package header ... "
+
+ sBuffer = generateHeader(\
+ self.m_aCfg.getValue(PROP_XMLVERSION ),\
+ self.m_aCfg.getValue(PROP_XMLENCODING),\
+ self.m_aCfg.getValue(PROP_XMLPATH ),\
+ self.m_aCfg.getValue(PROP_XMLPACKAGE ),\
+ self.m_aCfg.getValueWithDefault(PROP_LANGUAGEPACK, False))
+
+ # counts all transfered fragments
+ # Can be used later to decide, if a generated package file
+ # contains "nothing"!
+ nItemCount = 0
+
+ for i in range(4):
+ sSetName = None
+ sSubDir = None
+ lFragments = None
+
+ try:
+ if i == 0: #types
+ print "generate set for types ... "
+ sSetName = self.m_aCfg.getValue(PROP_SETNAME_TYPES)
+ sSubDir = self.m_aCfg.getValue(PROP_SUBDIR_TYPES )
+ lFragments = self.m_lTypes
+ elif i == 1: # filters
+ print "generate set for filter ... "
+ sSetName = self.m_aCfg.getValue(PROP_SETNAME_FILTERS)
+ sSubDir = self.m_aCfg.getValue(PROP_SUBDIR_FILTERS )
+ lFragments = self.m_lFilters
+ elif i == 2: # loaders
+ print "generate set for frame loader ... "
+ sSetName = self.m_aCfg.getValue(PROP_SETNAME_LOADERS)
+ sSubDir = self.m_aCfg.getValue(PROP_SUBDIR_LOADERS )
+ lFragments = self.m_lLoaders
+ elif i == 3: # handlers
+ print "generate set for content handler ... "
+ sSetName = self.m_aCfg.getValue(PROP_SETNAME_HANDLERS)
+ sSubDir = self.m_aCfg.getValue(PROP_SUBDIR_HANDLERS )
+ lFragments = self.m_lHandlers
+ except:
+ continue
+
+ nItemCount = nItemCount + len(lFragments)
+
+ sBuffer = sBuffer + self.getFragments(\
+ os.path.join(self.m_aFragmentsDir, sSubDir), \
+ sSetName, lFragments, 1)
+
+ print "generate package footer ... "
+ sBuffer = sBuffer + generateFooter()
+
+ # Attention!
+ # If the package seem to be empty, it make no sense to generate a
+ # corresponding xml file. We should suppress writing of this file on
+ # disk completly ...
+ if nItemCount < 1:
+ print "Package is empty and will not result into a xml file on "\
+ "disk!? Please check configuration file."
+ return
+ print "package contains "+str(nItemCount)+" items"
+
+ aPackage = open(sPackage, 'w')
+ print "write temp package \""+sPackage
+ aPackage.write(sBuffer)
+
+ def getFragments(self, aDir, sSetName, lFragments, nPrettyTabs):
+ sBuffer = ''
+ sExtXcu = self.m_aCfg.getValue(PROP_EXTENSION_XCU);
+
+ if len(lFragments) < 1:
+ return sBuffer
+
+ for tabs in range(nPrettyTabs):
+ sBuffer = sBuffer + "\t"
+ sBuffer = sBuffer + "<node oor:name=\""+sSetName+"\">\n"
+ nPrettyTabs = nPrettyTabs + 1
+
+ for sFragment in lFragments:
+ sFragPath = os.path.join(aDir, sFragment+"."+sExtXcu)
+ try:
+ aFragmentFile = open(sFragPath)
+ except:
+ # handle simple files only and check for existence!
+ raise Exception("fragment \""+sFragPath+"\" does not exists.")
+
+ print "merge fragment \""+sFragPath+"\" ..."
+ sBuffer = sBuffer + aFragmentFile.read()
+
+ sBuffer = sBuffer + "\n"
+
+ nPrettyTabs = nPrettyTabs - 1
+ for tabs in range(nPrettyTabs):
+ sBuffer = sBuffer + "\t"
+ sBuffer = sBuffer + "</node>\n"
+ return sBuffer
+
+run(sys.argv)
+
diff --git a/filter/source/config/tools/split/FCFGSplit.cfg b/filter/source/config/tools/split/FCFGSplit.cfg
new file mode 100644
index 000000000000..0c3c72b2029d
--- /dev/null
+++ b/filter/source/config/tools/split/FCFGSplit.cfg
@@ -0,0 +1,110 @@
+#------------------------------------------------------
+# must be a system file name, which points to the
+# xcu file, should be analyzed and splitted
+#------------------------------------------------------
+xmlfile =o:/SRC680/src.m21/officecfg/registry/data/org/openoffice/Office/TypeDetection.xcu
+
+#------------------------------------------------------
+# specify the format of the specified "xmlfile"
+#------------------------------------------------------
+informat = 6.0
+
+#------------------------------------------------------
+# must be a system directory, which can be cleared completly
+# and will be used then to generate all results of this
+# program there - means to generate al xcu fragments
+#------------------------------------------------------
+outdir =c:/temp/split/fragments
+
+#------------------------------------------------------
+# specify the format of the generated xcu fragments
+# inside the "outdir"
+#------------------------------------------------------
+outformat = 6.Y
+
+#------------------------------------------------------
+# specify the text encoding, which must be used for
+# reading the "xmlfile"
+#------------------------------------------------------
+inencoding = UTF-8
+
+#------------------------------------------------------
+# specify the text encoding, which must be used for
+# writing the xcu fragments
+#------------------------------------------------------
+outencoding = UTF-8
+
+#------------------------------------------------------
+# The following defines specify system directories
+# which must be sub directories of "outdir".
+# Every of these sub dir willl be used to generate
+# groups of xcu fragments there.
+#------------------------------------------------------
+subdir_types = types
+subdir_filters = filters
+subdir_detectservices = detectservices
+subdir_frameloaders = frameloaders
+subdir_contenthandlers = contenthandlers
+
+#------------------------------------------------------
+# Enable/Disable grouping of filter fragments and using
+# of specialized sub directories.
+#------------------------------------------------------
+seperate_filters_by_module = false
+
+#------------------------------------------------------
+# The following defines specify system directories
+# which must be sub directories of "outdir/subdir_filters".
+# Every of these sub dir willl be used to generate
+# groups of filter fragments there.
+# Note: These sub directories are used only if
+# "seperate_filters_by_module" is set to true!
+#------------------------------------------------------
+subdir_module_swriter = swriter
+subdir_module_sweb = sweb
+subdir_module_sglobal = sglobal
+subdir_module_scalc = scalc
+subdir_module_sdraw = sdraw
+subdir_module_simpress = simpress
+subdir_module_smath = smath
+subdir_module_schart = schart
+subdir_module_others = others
+
+#------------------------------------------------------
+# Define the file extension, which is used for
+# every generated fragment inside "outdir".
+#------------------------------------------------------
+fragment_extension = .xcu
+
+#------------------------------------------------------
+# specify a debug level for generating debug output
+# on the console
+# The following levels exists:
+# 0 = no output
+# 1 = only errors/exceptions will be shown
+# 2 = errors/exceptions and warnings will be shown
+# 3 = additional to errors and warnings some global
+# informations are shown
+# 4 = additional to errors and warnings some global
+# and many detailed informations are shown
+#------------------------------------------------------
+debug = 4
+
+#------------------------------------------------------
+# Enable/Disable creation of the new "COMBINED" filter flag
+# for 6.y versions. That means: every filter with set
+# "IMPORT" and "EXPORT" flag will get the new flag value
+# and lose the old ones.
+#------------------------------------------------------
+create_combine_filter_flag = false
+
+#------------------------------------------------------
+# Remove some obsolete filter flags for 6.y versions.
+#------------------------------------------------------
+remove_filter_flag_browserpreferred = true
+remove_filter_flag_preferred = false
+remove_filter_flag_3rdparty = false
+
+remove_graphic_filters = false
+remove_filter_uinames = false
+set_default_detector = false
diff --git a/filter/source/config/tools/split/FCFGSplit.java b/filter/source/config/tools/split/FCFGSplit.java
new file mode 100644
index 000000000000..4693db4cdf83
--- /dev/null
+++ b/filter/source/config/tools/split/FCFGSplit.java
@@ -0,0 +1,565 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+package com.sun.star.filter.config.tools.split;
+
+//_______________________________________________
+
+import java.lang.*;
+import java.util.*;
+import java.io.*;
+import com.sun.star.filter.config.tools.utils.*;
+
+//_______________________________________________
+
+/**
+ * Implements a simple command line tool, which can read a given xml
+ * configuration file of the filter configuration, analyze it
+ * and split it into different xml fragments.
+ * All parameters of this process can be given by a configuration file.
+ *
+ *
+ */
+public class FCFGSplit
+{
+ //___________________________________________
+ // private const
+
+ /** specify the command line parameter to set the debug level for this app. */
+ private static final java.lang.String CMD_DEBUG = "debug" ;
+
+ /** specify the command line parameter to set a configuration file for this app. */
+ private static final java.lang.String CMD_CONFIG = "config";
+
+ /** The following strings are used as property names of
+ * the configuration file we need here.
+ *
+ * @seealso readCfg()
+ */
+
+ private static final java.lang.String CFGKEY_XMLFILE = "xmlfile" ;
+ private static final java.lang.String CFGKEY_INFORMAT = "informat" ;
+ private static final java.lang.String CFGKEY_OUTFORMAT = "outformat" ;
+ private static final java.lang.String CFGKEY_INENCODING = "inencoding" ;
+ private static final java.lang.String CFGKEY_OUTENCODING = "outencoding" ;
+ private static final java.lang.String CFGKEY_OUTDIR = "outdir" ;
+ private static final java.lang.String CFGKEY_FRAGMENT_EXTENSION = "fragment_extension" ;
+ private static final java.lang.String CFGKEY_CREATE_COMBINE_FILTER_FLAG = "create_combine_filter_flag" ;
+ private static final java.lang.String CFGKEY_REMOVE_FILTER_FLAG_BROWSERPREFERRED = "remove_filter_flag_browserpreferred" ;
+ private static final java.lang.String CFGKEY_REMOVE_FILTER_FLAG_PREFERRED = "remove_filter_flag_preferred" ;
+ private static final java.lang.String CFGKEY_REMOVE_FILTER_FLAG_3RDPARTY = "remove_filter_flag_3rdparty" ;
+ private static final java.lang.String CFGKEY_REMOVE_FILTER_UINAMES = "remove_filter_uinames" ;
+ private static final java.lang.String CFGKEY_REMOVE_GRAPHIC_FILTERS = "remove_graphic_filters" ;
+ private static final java.lang.String CFGKEY_SET_DEFAULT_DETECTOR = "set_default_detector" ;
+
+ private static final java.lang.String CFGKEY_SUBDIR_TYPES = "subdir_types" ;
+ private static final java.lang.String CFGKEY_SUBDIR_FILTERS = "subdir_filters" ;
+ private static final java.lang.String CFGKEY_SUBDIR_DETECTSERVICES = "subdir_detectservices" ;
+ private static final java.lang.String CFGKEY_SUBDIR_FRAMELOADERS = "subdir_frameloaders" ;
+ private static final java.lang.String CFGKEY_SUBDIR_CONTENTHANDLERS = "subdir_contenthandlers" ;
+
+ private static final java.lang.String CFGKEY_SEPERATE_FILTERS_BY_MODULE = "seperate_filters_by_module" ;
+
+ private static final java.lang.String CFGKEY_SUBDIR_MODULE_SWRITER = "subdir_module_swriter" ;
+ private static final java.lang.String CFGKEY_SUBDIR_MODULE_SWEB = "subdir_module_sweb" ;
+ private static final java.lang.String CFGKEY_SUBDIR_MODULE_SGLOBAL = "subdir_module_sglobal" ;
+ private static final java.lang.String CFGKEY_SUBDIR_MODULE_SCALC = "subdir_module_scalc" ;
+ private static final java.lang.String CFGKEY_SUBDIR_MODULE_SDRAW = "subdir_module_sdraw" ;
+ private static final java.lang.String CFGKEY_SUBDIR_MODULE_SIMPRESS = "subdir_module_simpress" ;
+ private static final java.lang.String CFGKEY_SUBDIR_MODULE_SMATH = "subdir_module_smath" ;
+ private static final java.lang.String CFGKEY_SUBDIR_MODULE_SCHART = "subdir_module_schart" ;
+ private static final java.lang.String CFGKEY_SUBDIR_MODULE_OTHERS = "subdir_module_others" ;
+
+ /** The following strings are used as property default
+ * values if a configuration key does not exist.
+ * It must be a string value, because the class java.util.Properties
+ * accept it as the only type. But of course the value must be
+ * convertable to the right target type.
+ *
+ * @seealso readCfg()
+ */
+
+ private static final java.lang.String DEFAULT_XMLFILE = ".//TypeDetection.xcu" ;
+ private static final java.lang.String DEFAULT_INFORMAT = "6.0" ;
+ private static final java.lang.String DEFAULT_OUTFORMAT = "6.Y" ;
+ private static final java.lang.String DEFAULT_INENCODING = "UTF-8" ;
+ private static final java.lang.String DEFAULT_OUTENCODING = "UTF-8" ;
+ private static final java.lang.String DEFAULT_OUTDIR = ".//temp" ;
+ private static final java.lang.String DEFAULT_FRAGMENT_EXTENSION = ".xcu" ;
+ private static final java.lang.String DEFAULT_CREATE_COMBINE_FILTER_FLAG = "false" ;
+ private static final java.lang.String DEFAULT_REMOVE_FILTER_FLAG_BROWSERPREFERRED = "false" ;
+ private static final java.lang.String DEFAULT_REMOVE_FILTER_FLAG_PREFERRED = "false" ;
+ private static final java.lang.String DEFAULT_REMOVE_FILTER_FLAG_3RDPARTY = "false" ;
+ private static final java.lang.String DEFAULT_REMOVE_FILTER_UINAMES = "false" ;
+ private static final java.lang.String DEFAULT_REMOVE_GRAPHIC_FILTERS = "false" ;
+ private static final java.lang.String DEFAULT_SET_DEFAULT_DETECTOR = "false" ;
+
+ private static final java.lang.String DEFAULT_SUBDIR_TYPES = "Types" ;
+ private static final java.lang.String DEFAULT_SUBDIR_FILTERS = "Filters" ;
+ private static final java.lang.String DEFAULT_SUBDIR_DETECTSERVICES = "DetectServices" ;
+ private static final java.lang.String DEFAULT_SUBDIR_FRAMELOADERS = "FrameLoaders" ;
+ private static final java.lang.String DEFAULT_SUBDIR_CONTENTHANDLERS = "ContentHandlers" ;
+
+ private static final java.lang.String DEFAULT_SEPERATE_FILTERS_BY_MODULE = "false" ;
+
+ private static final java.lang.String DEFAULT_SUBDIR_MODULE_SWRITER = "SWriter" ;
+ private static final java.lang.String DEFAULT_SUBDIR_MODULE_SWEB = "SWeb" ;
+ private static final java.lang.String DEFAULT_SUBDIR_MODULE_SGLOBAL = "SGlobal" ;
+ private static final java.lang.String DEFAULT_SUBDIR_MODULE_SCALC = "SCalc" ;
+ private static final java.lang.String DEFAULT_SUBDIR_MODULE_SDRAW = "SDraw" ;
+ private static final java.lang.String DEFAULT_SUBDIR_MODULE_SIMPRESS = "SImpress" ;
+ private static final java.lang.String DEFAULT_SUBDIR_MODULE_SMATH = "SMath" ;
+ private static final java.lang.String DEFAULT_SUBDIR_MODULE_SCHART = "SChart" ;
+ private static final java.lang.String DEFAULT_SUBDIR_MODULE_OTHERS = "Others" ;
+
+ //___________________________________________
+ // private member
+
+ /** contains the name of the reading xcu file. */
+ private static java.lang.String m_sXMLFile;
+
+ /** specify the xml file format, which must be interpreted at reading time. */
+ private static int m_nInFormat;
+
+ /** specify the xml file format, which must be used
+ * to generate all xcu fragments. */
+ private static int m_nOutFormat;
+
+ /** specify the file encoding for reading. */
+ private static java.lang.String m_sInEncoding;
+
+ /** specify the file encoding for writing fragments. */
+ private static java.lang.String m_sOutEncoding;
+
+ /** specify the target directory, where all results of this
+ * process can be generated.
+ * Note: May it will be cleared! */
+ private static java.lang.String m_sOutDir;
+
+ /** can be used to generate some output on the console. */
+ private static Logger m_aDebug;
+
+ /** contains the file extension for all generated xml fragments. */
+ private static java.lang.String m_sFragmentExtension;
+
+ /** specify the sub directory to generate type fragments.
+ * Its meaned relativ to m_sOutDir. */
+ private static java.lang.String m_sSubDirTypes;
+
+ /** specify the sub directory to generate filter fragments.
+ * Its meaned relativ to m_sOutDir. */
+ private static java.lang.String m_sSubDirFilters;
+
+ /** specify the sub directory to generate detect service fragments.
+ * Its meaned relativ to m_sOutDir. */
+ private static java.lang.String m_sSubDirDetectServices;
+
+ /** specify the sub directory to generate frame loader fragments.
+ * Its meaned relativ to m_sOutDir. */
+ private static java.lang.String m_sSubDirFrameLoaders;
+
+ /** specify the sub directory to generate content handler fragments.
+ * Its meaned relativ to m_sOutDir. */
+ private static java.lang.String m_sSubDirContentHandlers;
+
+ /** enable/disable generating of filter groups - seperated by
+ * application modules. */
+ private static boolean m_bSeperateFiltersByModule;
+
+ /** specify the sub directory to generate filter groups
+ * for the module writer. Will be used only,
+ * if m_bSeperateFiltersByModule is set to TRUE.*/
+ private static java.lang.String m_sSubDirModuleSWriter;
+
+ /** specify the sub directory to generate filter groups
+ * for the module writer/web. Will be used only,
+ * if m_bSeperateFiltersByModule is set to TRUE.*/
+ private static java.lang.String m_sSubDirModuleSWeb;
+
+ /** specify the sub directory to generate filter groups
+ * for the module writer/global. Will be used only,
+ * if m_bSeperateFiltersByModule is set to TRUE.*/
+ private static java.lang.String m_sSubDirModuleSGlobal;
+
+ /** specify the sub directory to generate filter groups
+ * for the module calc. Will be used only,
+ * if m_bSeperateFiltersByModule is set to TRUE.*/
+ private static java.lang.String m_sSubDirModuleSCalc;
+
+ /** specify the sub directory to generate filter groups
+ * for the module draw. Will be used only,
+ * if m_bSeperateFiltersByModule is set to TRUE.*/
+ private static java.lang.String m_sSubDirModuleSDraw;
+
+ /** specify the sub directory to generate filter groups
+ * for the module impress. Will be used only,
+ * if m_bSeperateFiltersByModule is set to TRUE.*/
+ private static java.lang.String m_sSubDirModuleSImpress;
+
+ /** specify the sub directory to generate filter groups
+ * for the module math. Will be used only,
+ * if m_bSeperateFiltersByModule is set to TRUE.*/
+ private static java.lang.String m_sSubDirModuleSMath;
+
+ /** specify the sub directory to generate filter groups
+ * for the module chart. Will be used only,
+ * if m_bSeperateFiltersByModule is set to TRUE.*/
+ private static java.lang.String m_sSubDirModuleSChart;
+
+ /** specify the sub directory to generate filter groups
+ * for unknown modules - e.g. the graphic filters.
+ * Will be used only, if m_bSeperateFiltersByModule
+ * is set to TRUE.*/
+ private static java.lang.String m_sSubDirModuleOthers;
+
+ private static boolean m_bCreateCombineFilterFlag;
+ private static boolean m_bRemoveFilterFlagBrowserPreferred;
+ private static boolean m_bRemoveFilterFlagPreferred;
+ private static boolean m_bRemoveFilterFlag3rdparty;
+ private static boolean m_bRemoveFilterUINames;
+ private static boolean m_bRemoveGraphicFilters;
+ private static boolean m_bSetDefaultDetector;
+
+ //___________________________________________
+ // main
+
+ /** main.
+ *
+ * Analyze the command line arguments, load the configuration file,
+ * fill a cache from the specified xml file and generate all
+ * needed xml fragments inside the specified output directory.
+ *
+ * @param lArgs
+ * contains the command line arguments.
+ */
+ public static void main(java.lang.String[] lArgs)
+ {
+ long t_start = System.currentTimeMillis();
+
+ // must be :-)
+ FCFGSplit.printCopyright();
+ // can be used as exit code
+ int nErr = 0;
+
+ // --------------------------------------------------------------------
+ // analyze command line parameter
+ ConfigHelper aCmdLine = null;
+ try
+ {
+ aCmdLine = new ConfigHelper("com/sun/star/filter/config/tools/split/FCFGSplit.cfg", lArgs);
+ }
+ catch(java.lang.Throwable exCmdLine)
+ {
+ exCmdLine.printStackTrace();
+ FCFGSplit.printHelp();
+ System.exit(--nErr);
+ }
+
+ // --------------------------------------------------------------------
+ // help requested?
+ if (aCmdLine.isHelp())
+ {
+ FCFGSplit.printHelp();
+ System.exit(--nErr);
+ }
+
+ // --------------------------------------------------------------------
+ // initialize an output channel for errors/warnings etc.
+ int nLevel = aCmdLine.getInt(CMD_DEBUG, Logger.LEVEL_DETAILEDINFOS);
+ m_aDebug = new Logger(nLevel);
+ try
+ {
+ FCFGSplit.readCfg(aCmdLine);
+ }
+ catch(java.lang.Exception exCfgLoad)
+ {
+ m_aDebug.setException(exCfgLoad);
+ System.exit(--nErr);
+ }
+
+ // --------------------------------------------------------------------
+ // check if the required resources exists
+ java.io.File aXMLFile = new java.io.File(m_sXMLFile);
+ if (!aXMLFile.exists() || !aXMLFile.isFile())
+ {
+ m_aDebug.setError("The specified xml file \""+aXMLFile.getPath()+"\" does not exist or seems not to be a simple file.");
+ System.exit(--nErr);
+ }
+
+ java.io.File aOutDir = new java.io.File(m_sOutDir);
+ if (!aOutDir.exists() || !aOutDir.isDirectory())
+ {
+ m_aDebug.setError("The specified directory \""+aOutDir.getPath()+"\" does not exist or seems not to be a directory.");
+ System.exit(--nErr);
+ }
+
+ if (m_nInFormat == Cache.FORMAT_UNSUPPORTED)
+ {
+ m_aDebug.setError("The specified xml format for input is not supported.");
+ System.exit(--nErr);
+ }
+
+ if (m_nOutFormat == Cache.FORMAT_UNSUPPORTED)
+ {
+ m_aDebug.setError("The specified xml format for output is not supported.");
+ System.exit(--nErr);
+ }
+
+ // --------------------------------------------------------------------
+ // load the xml file
+ m_aDebug.setGlobalInfo("loading xml file \""+aXMLFile.getPath()+"\" ...");
+ long t_load_start = System.currentTimeMillis();
+ Cache aCache = new Cache(m_aDebug);
+ try
+ {
+ aCache.fromXML(aXMLFile, m_nInFormat);
+ }
+ catch(java.lang.Throwable exLoad)
+ {
+ m_aDebug.setException(exLoad);
+ System.exit(--nErr);
+ }
+ long t_load_end = System.currentTimeMillis();
+
+ // --------------------------------------------------------------------
+ // validate the content, fix some problems and convert it to the output format
+ m_aDebug.setGlobalInfo("validate and transform to output format ...");
+ long t_transform_start = System.currentTimeMillis();
+ try
+ {
+ aCache.validate(m_nInFormat);
+ if (
+ (m_nInFormat == Cache.FORMAT_60) &&
+ (m_nOutFormat == Cache.FORMAT_6Y)
+ )
+ {
+ aCache.transform60to6Y(m_bCreateCombineFilterFlag ,
+ m_bRemoveFilterFlagBrowserPreferred,
+ m_bRemoveFilterFlagPreferred ,
+ m_bRemoveFilterFlag3rdparty ,
+ m_bRemoveFilterUINames ,
+ m_bRemoveGraphicFilters ,
+ m_bSetDefaultDetector );
+ }
+ aCache.validate(m_nOutFormat);
+ }
+ catch(java.lang.Throwable exTransform)
+ {
+ m_aDebug.setException(exTransform);
+ System.exit(--nErr);
+ }
+ long t_transform_end = System.currentTimeMillis();
+
+ // --------------------------------------------------------------------
+ // generate all xml fragments
+ m_aDebug.setGlobalInfo("generate xml fragments into directory \""+aOutDir.getPath()+"\" ...");
+ long t_split_start = System.currentTimeMillis();
+ try
+ {
+ SplitterData aDataSet = new SplitterData();
+ aDataSet.m_aDebug = m_aDebug ;
+ aDataSet.m_aCache = aCache ;
+ aDataSet.m_nFormat = m_nOutFormat ;
+ aDataSet.m_sEncoding = m_sOutEncoding ;
+ aDataSet.m_bSeperateFiltersByModule = m_bSeperateFiltersByModule;
+ aDataSet.m_sFragmentExtension = m_sFragmentExtension ;
+ aDataSet.m_aOutDir = aOutDir ;
+
+ aDataSet.m_aFragmentDirTypes = new java.io.File(aOutDir, m_sSubDirTypes );
+ aDataSet.m_aFragmentDirFilters = new java.io.File(aOutDir, m_sSubDirFilters );
+ aDataSet.m_aFragmentDirDetectServices = new java.io.File(aOutDir, m_sSubDirDetectServices );
+ aDataSet.m_aFragmentDirFrameLoaders = new java.io.File(aOutDir, m_sSubDirFrameLoaders );
+ aDataSet.m_aFragmentDirContentHandlers = new java.io.File(aOutDir, m_sSubDirContentHandlers);
+
+ if (m_bSeperateFiltersByModule)
+ {
+ aDataSet.m_aFragmentDirModuleSWriter = new java.io.File(aDataSet.m_aFragmentDirFilters, m_sSubDirModuleSWriter );
+ aDataSet.m_aFragmentDirModuleSWeb = new java.io.File(aDataSet.m_aFragmentDirFilters, m_sSubDirModuleSWeb );
+ aDataSet.m_aFragmentDirModuleSGlobal = new java.io.File(aDataSet.m_aFragmentDirFilters, m_sSubDirModuleSGlobal );
+ aDataSet.m_aFragmentDirModuleSCalc = new java.io.File(aDataSet.m_aFragmentDirFilters, m_sSubDirModuleSCalc );
+ aDataSet.m_aFragmentDirModuleSDraw = new java.io.File(aDataSet.m_aFragmentDirFilters, m_sSubDirModuleSDraw );
+ aDataSet.m_aFragmentDirModuleSImpress = new java.io.File(aDataSet.m_aFragmentDirFilters, m_sSubDirModuleSImpress);
+ aDataSet.m_aFragmentDirModuleSMath = new java.io.File(aDataSet.m_aFragmentDirFilters, m_sSubDirModuleSMath );
+ aDataSet.m_aFragmentDirModuleSChart = new java.io.File(aDataSet.m_aFragmentDirFilters, m_sSubDirModuleSChart );
+ aDataSet.m_aFragmentDirModuleOthers = new java.io.File(aDataSet.m_aFragmentDirFilters, m_sSubDirModuleOthers );
+ }
+ else
+ {
+ aDataSet.m_aFragmentDirModuleSWriter = aDataSet.m_aFragmentDirFilters;
+ aDataSet.m_aFragmentDirModuleSWeb = aDataSet.m_aFragmentDirFilters;
+ aDataSet.m_aFragmentDirModuleSGlobal = aDataSet.m_aFragmentDirFilters;
+ aDataSet.m_aFragmentDirModuleSCalc = aDataSet.m_aFragmentDirFilters;
+ aDataSet.m_aFragmentDirModuleSDraw = aDataSet.m_aFragmentDirFilters;
+ aDataSet.m_aFragmentDirModuleSImpress = aDataSet.m_aFragmentDirFilters;
+ aDataSet.m_aFragmentDirModuleSMath = aDataSet.m_aFragmentDirFilters;
+ aDataSet.m_aFragmentDirModuleSChart = aDataSet.m_aFragmentDirFilters;
+ aDataSet.m_aFragmentDirModuleOthers = aDataSet.m_aFragmentDirFilters;
+ }
+
+ Splitter aSplitter = new Splitter(aDataSet);
+ aSplitter.split();
+ }
+ catch(java.lang.Throwable exSplit)
+ {
+ m_aDebug.setException(exSplit);
+ System.exit(--nErr);
+ }
+ long t_split_end = System.currentTimeMillis();
+
+ // --------------------------------------------------------------------
+ // generate some special views
+ m_aDebug.setGlobalInfo("generate views and statistics ...");
+ long t_statistics_start = System.currentTimeMillis();
+ try
+ {
+ aCache.analyze();
+ aCache.toHTML(aOutDir, m_nOutFormat, m_sOutEncoding);
+ m_aDebug.setDetailedInfo(aCache.getStatistics());
+ }
+ catch(java.lang.Throwable exStatistics)
+ {
+ m_aDebug.setException(exStatistics);
+ System.exit(--nErr);
+ }
+ long t_statistics_end = System.currentTimeMillis();
+
+ // --------------------------------------------------------------------
+ // analyze some time stamps
+ long t_end = System.currentTimeMillis();
+
+ java.lang.StringBuffer sTimes = new java.lang.StringBuffer(100);
+ sTimes.append("Needed times:\n" );
+ sTimes.append("t [all]\t\t=\t" );
+ sTimes.append(t_end-t_start );
+ sTimes.append(" ms\n" );
+ sTimes.append("t [load]\t=\t" );
+ sTimes.append(t_load_end-t_load_start );
+ sTimes.append(" ms\n" );
+ sTimes.append("t [transform]\t=\t" );
+ sTimes.append(t_transform_end-t_transform_start );
+ sTimes.append(" ms\n" );
+ sTimes.append("t [split]\t=\t" );
+ sTimes.append(t_split_end-t_split_start );
+ sTimes.append(" ms\n" );
+ sTimes.append("t [statistics]\t=\t" );
+ sTimes.append(t_statistics_end-t_statistics_start);
+ sTimes.append(" ms\n" );
+ m_aDebug.setDetailedInfo(sTimes.toString());
+
+ // everyting seems to be ok.
+ // Return "OK" to calli.
+ m_aDebug.setGlobalInfo("Finish.");
+ System.exit(0);
+ }
+
+ //___________________________________________
+
+ /** read the configuration file.
+ *
+ * @param aCfg
+ * contains the content of the
+ * loaded configuration file.
+ */
+ private static void readCfg(java.util.Properties aCfg)
+ {
+ m_sXMLFile = aCfg.getProperty(CFGKEY_XMLFILE , DEFAULT_XMLFILE );
+
+ m_sInEncoding = aCfg.getProperty(CFGKEY_INENCODING , DEFAULT_INENCODING );
+ m_sOutEncoding = aCfg.getProperty(CFGKEY_OUTENCODING , DEFAULT_OUTENCODING );
+ m_sOutDir = aCfg.getProperty(CFGKEY_OUTDIR , DEFAULT_OUTDIR );
+ m_sFragmentExtension = aCfg.getProperty(CFGKEY_FRAGMENT_EXTENSION , DEFAULT_FRAGMENT_EXTENSION );
+
+ m_sSubDirTypes = aCfg.getProperty(CFGKEY_SUBDIR_TYPES , DEFAULT_SUBDIR_TYPES );
+ m_sSubDirFilters = aCfg.getProperty(CFGKEY_SUBDIR_FILTERS , DEFAULT_SUBDIR_FILTERS );
+ m_sSubDirDetectServices = aCfg.getProperty(CFGKEY_SUBDIR_DETECTSERVICES , DEFAULT_SUBDIR_DETECTSERVICES );
+ m_sSubDirFrameLoaders = aCfg.getProperty(CFGKEY_SUBDIR_FRAMELOADERS , DEFAULT_SUBDIR_FRAMELOADERS );
+ m_sSubDirContentHandlers = aCfg.getProperty(CFGKEY_SUBDIR_CONTENTHANDLERS , DEFAULT_SUBDIR_CONTENTHANDLERS );
+
+ m_sSubDirModuleSWriter = aCfg.getProperty(CFGKEY_SUBDIR_MODULE_SWRITER , DEFAULT_SUBDIR_MODULE_SWRITER );
+ m_sSubDirModuleSWeb = aCfg.getProperty(CFGKEY_SUBDIR_MODULE_SWEB , DEFAULT_SUBDIR_MODULE_SWEB );
+ m_sSubDirModuleSGlobal = aCfg.getProperty(CFGKEY_SUBDIR_MODULE_SGLOBAL , DEFAULT_SUBDIR_MODULE_SGLOBAL );
+ m_sSubDirModuleSCalc = aCfg.getProperty(CFGKEY_SUBDIR_MODULE_SCALC , DEFAULT_SUBDIR_MODULE_SCALC );
+ m_sSubDirModuleSDraw = aCfg.getProperty(CFGKEY_SUBDIR_MODULE_SDRAW , DEFAULT_SUBDIR_MODULE_SDRAW );
+ m_sSubDirModuleSImpress = aCfg.getProperty(CFGKEY_SUBDIR_MODULE_SIMPRESS , DEFAULT_SUBDIR_MODULE_SIMPRESS );
+ m_sSubDirModuleSMath = aCfg.getProperty(CFGKEY_SUBDIR_MODULE_SMATH , DEFAULT_SUBDIR_MODULE_SMATH );
+ m_sSubDirModuleSChart = aCfg.getProperty(CFGKEY_SUBDIR_MODULE_SCHART , DEFAULT_SUBDIR_MODULE_SCHART );
+ m_sSubDirModuleOthers = aCfg.getProperty(CFGKEY_SUBDIR_MODULE_OTHERS , DEFAULT_SUBDIR_MODULE_OTHERS );
+
+ m_bSeperateFiltersByModule = new java.lang.Boolean(aCfg.getProperty(CFGKEY_SEPERATE_FILTERS_BY_MODULE , DEFAULT_SEPERATE_FILTERS_BY_MODULE )).booleanValue();
+ m_bCreateCombineFilterFlag = new java.lang.Boolean(aCfg.getProperty(CFGKEY_CREATE_COMBINE_FILTER_FLAG , DEFAULT_CREATE_COMBINE_FILTER_FLAG )).booleanValue();
+ m_bRemoveFilterFlagBrowserPreferred = new java.lang.Boolean(aCfg.getProperty(CFGKEY_REMOVE_FILTER_FLAG_BROWSERPREFERRED, DEFAULT_REMOVE_FILTER_FLAG_BROWSERPREFERRED)).booleanValue();
+ m_bRemoveFilterFlagPreferred = new java.lang.Boolean(aCfg.getProperty(CFGKEY_REMOVE_FILTER_FLAG_PREFERRED , DEFAULT_REMOVE_FILTER_FLAG_PREFERRED )).booleanValue();
+ m_bRemoveFilterFlag3rdparty = new java.lang.Boolean(aCfg.getProperty(CFGKEY_REMOVE_FILTER_FLAG_3RDPARTY , DEFAULT_REMOVE_FILTER_FLAG_3RDPARTY )).booleanValue();
+ m_bRemoveFilterUINames = new java.lang.Boolean(aCfg.getProperty(CFGKEY_REMOVE_FILTER_UINAMES , DEFAULT_REMOVE_FILTER_UINAMES )).booleanValue();
+ m_bRemoveGraphicFilters = new java.lang.Boolean(aCfg.getProperty(CFGKEY_REMOVE_GRAPHIC_FILTERS , DEFAULT_REMOVE_GRAPHIC_FILTERS )).booleanValue();
+ m_bSetDefaultDetector = new java.lang.Boolean(aCfg.getProperty(CFGKEY_SET_DEFAULT_DETECTOR , DEFAULT_SET_DEFAULT_DETECTOR )).booleanValue();
+
+ java.lang.String sFormat = aCfg.getProperty(CFGKEY_INFORMAT, DEFAULT_INFORMAT);
+ m_nInFormat = Cache.mapFormatString2Format(sFormat);
+
+ sFormat = aCfg.getProperty(CFGKEY_OUTFORMAT, DEFAULT_OUTFORMAT);
+ m_nOutFormat = Cache.mapFormatString2Format(sFormat);
+ }
+
+ //___________________________________________
+
+ /** prints out a copyright message on stdout.
+ */
+ private static void printCopyright()
+ {
+ java.lang.StringBuffer sOut = new java.lang.StringBuffer(256);
+ sOut.append("FCFGSplit\n");
+ sOut.append("Copyright: 2000 by Sun Microsystems, Inc.\n");
+ sOut.append("All Rights Reserved.\n");
+ System.out.println(sOut.toString());
+ }
+
+ //___________________________________________
+
+ /** prints out a help message on stdout.
+ */
+ private static void printHelp()
+ {
+ java.lang.StringBuffer sOut = new java.lang.StringBuffer(1000);
+ sOut.append("_______________________________________________________________________________\n\n" );
+ sOut.append("usage: FCFGSplit "+CMD_CONFIG+"=<file name> "+CMD_DEBUG+"=<level>\n" );
+ sOut.append("parameters:\n" );
+ sOut.append("\t-help\n" );
+ sOut.append("\t\tshow this little help.\n\n" );
+ sOut.append("\t"+CMD_CONFIG+"=<file name>\n" );
+ sOut.append("\t\tspecify the configuration file.\n\n" );
+ sOut.append("\t"+CMD_DEBUG+"=<level>\n" );
+ sOut.append("\t\tprints out some debug messages.\n" );
+ sOut.append("\t\tlevel=[0..4]\n" );
+ sOut.append("\t\t0 => no debug messages\n" );
+ sOut.append("\t\t1 => print out errors only\n" );
+ sOut.append("\t\t2 => print out errors & warnings\n" );
+ sOut.append("\t\t3 => print out some global actions (e.g. load file ...)\n" );
+ sOut.append("\t\t4 => print out more detailed actions (e.g. load item nr. xxx of file.)\n\n" );
+ System.out.println(sOut.toString());
+ }
+}
diff --git a/filter/source/config/tools/split/Manifest.mf b/filter/source/config/tools/split/Manifest.mf
new file mode 100644
index 000000000000..4d0d20ed59cc
--- /dev/null
+++ b/filter/source/config/tools/split/Manifest.mf
@@ -0,0 +1 @@
+Main-Class: com.sun.star.filter.config.tools.split.FCFGSplit
diff --git a/filter/source/config/tools/split/Splitter.java b/filter/source/config/tools/split/Splitter.java
new file mode 100644
index 000000000000..d9c171382596
--- /dev/null
+++ b/filter/source/config/tools/split/Splitter.java
@@ -0,0 +1,310 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+package com.sun.star.filter.config.tools.split;
+
+//_______________________________________________
+
+import java.lang.*;
+import java.util.*;
+import java.io.*;
+import com.sun.star.filter.config.tools.utils.*;
+
+//_______________________________________________
+
+/**
+ * Can split one xml file into its different xml fragments.
+ *
+ *
+ */
+public class Splitter
+{
+ //___________________________________________
+ // const
+
+ //___________________________________________
+ // member
+
+ /** contains all real member of this instance.
+ * That make it easy to initialize an instance
+ * of this class inside a multi-threaded environment. */
+ private SplitterData m_aDataSet;
+
+ //___________________________________________
+ // interface
+
+ /** initialize a new instance of this class with all
+ * needed resources.
+ *
+ * @param aDataSet
+ * contains all needed parameters for this instance
+ * as a complete set, which can be filled outside.
+ */
+ public Splitter(SplitterData aDataSet)
+ {
+ m_aDataSet = aDataSet;
+ }
+
+ //___________________________________________
+ // interface
+
+ /** generate xml fragments for all cache items.
+ *
+ * @throw [java.lang.Exception]
+ * if anything will fail inside during
+ * this operation runs.
+ */
+ public synchronized void split()
+ throws java.lang.Exception
+ {
+ createDirectoryStructures();
+
+ // use some statistic values to check if all cache items
+ // will be transformed realy.
+ int nTypes = m_aDataSet.m_aCache.getItemCount(Cache.E_TYPE );
+ int nFilters = m_aDataSet.m_aCache.getItemCount(Cache.E_FILTER );
+ int nDetectServices = m_aDataSet.m_aCache.getItemCount(Cache.E_DETECTSERVICE );
+ int nFrameLoaders = m_aDataSet.m_aCache.getItemCount(Cache.E_FRAMELOADER );
+ int nContentHandlers = m_aDataSet.m_aCache.getItemCount(Cache.E_CONTENTHANDLER);
+
+ // generate all type fragments
+ m_aDataSet.m_aDebug.setGlobalInfo("generate type fragments ...");
+ java.util.Vector lNames = m_aDataSet.m_aCache.getItemNames(Cache.E_TYPE);
+ java.util.Enumeration it = lNames.elements();
+ while(it.hasMoreElements())
+ generateXMLFragment(Cache.E_TYPE, (java.lang.String)it.nextElement(), m_aDataSet.m_aFragmentDirTypes);
+ nTypes -= lNames.size();
+
+ // generate filter fragments for the writer module
+ m_aDataSet.m_aDebug.setGlobalInfo("generate filter fragments ...");
+ m_aDataSet.m_aDebug.setGlobalInfo("\tfor module writer ...");
+ java.util.HashMap rRequestedProps = new java.util.HashMap();
+ rRequestedProps.put(Cache.PROPNAME_DOCUMENTSERVICE, "com.sun.star.text.TextDocument");
+ lNames = m_aDataSet.m_aCache.getMatchedItemNames(Cache.E_FILTER, rRequestedProps);
+ it = lNames.elements();
+ while(it.hasMoreElements())
+ generateXMLFragment(Cache.E_FILTER, (java.lang.String)it.nextElement(), m_aDataSet.m_aFragmentDirModuleSWriter);
+ nFilters -= lNames.size();
+
+ // generate filter fragments for the writer/web module
+ m_aDataSet.m_aDebug.setGlobalInfo("\tfor module writer/web ...");
+ rRequestedProps.put(Cache.PROPNAME_DOCUMENTSERVICE, "com.sun.star.text.WebDocument");
+ lNames = m_aDataSet.m_aCache.getMatchedItemNames(Cache.E_FILTER, rRequestedProps);
+ it = lNames.elements();
+ while(it.hasMoreElements())
+ generateXMLFragment(Cache.E_FILTER, (java.lang.String)it.nextElement(), m_aDataSet.m_aFragmentDirModuleSWeb);
+ nFilters -= lNames.size();
+
+ // generate filter fragments for the writer/global module
+ m_aDataSet.m_aDebug.setGlobalInfo("\tfor module writer/global ...");
+ rRequestedProps.put(Cache.PROPNAME_DOCUMENTSERVICE, "com.sun.star.text.GlobalDocument");
+ lNames = m_aDataSet.m_aCache.getMatchedItemNames(Cache.E_FILTER, rRequestedProps);
+ it = lNames.elements();
+ while(it.hasMoreElements())
+ generateXMLFragment(Cache.E_FILTER, (java.lang.String)it.nextElement(), m_aDataSet.m_aFragmentDirModuleSGlobal);
+ nFilters -= lNames.size();
+
+ // generate filter fragments for the calc module
+ m_aDataSet.m_aDebug.setGlobalInfo("\tfor module calc ...");
+ rRequestedProps.put(Cache.PROPNAME_DOCUMENTSERVICE, "com.sun.star.sheet.SpreadsheetDocument");
+ lNames = m_aDataSet.m_aCache.getMatchedItemNames(Cache.E_FILTER, rRequestedProps);
+ it = lNames.elements();
+ while(it.hasMoreElements())
+ generateXMLFragment(Cache.E_FILTER, (java.lang.String)it.nextElement(), m_aDataSet.m_aFragmentDirModuleSCalc);
+ nFilters -= lNames.size();
+
+ // generate filter fragments for the draw module
+ m_aDataSet.m_aDebug.setGlobalInfo("\tfor module draw ...");
+ rRequestedProps.put(Cache.PROPNAME_DOCUMENTSERVICE, "com.sun.star.drawing.DrawingDocument");
+ lNames = m_aDataSet.m_aCache.getMatchedItemNames(Cache.E_FILTER, rRequestedProps);
+ it = lNames.elements();
+ while(it.hasMoreElements())
+ generateXMLFragment(Cache.E_FILTER, (java.lang.String)it.nextElement(), m_aDataSet.m_aFragmentDirModuleSDraw);
+ nFilters -= lNames.size();
+
+ // generate filter fragments for the impress module
+ m_aDataSet.m_aDebug.setGlobalInfo("\tfor module impress ...");
+ rRequestedProps.put(Cache.PROPNAME_DOCUMENTSERVICE, "com.sun.star.presentation.PresentationDocument");
+ lNames = m_aDataSet.m_aCache.getMatchedItemNames(Cache.E_FILTER, rRequestedProps);
+ it = lNames.elements();
+ while(it.hasMoreElements())
+ generateXMLFragment(Cache.E_FILTER, (java.lang.String)it.nextElement(), m_aDataSet.m_aFragmentDirModuleSImpress);
+ nFilters -= lNames.size();
+
+ // generate filter fragments for the chart module
+ m_aDataSet.m_aDebug.setGlobalInfo("\tfor module chart ...");
+ rRequestedProps.put(Cache.PROPNAME_DOCUMENTSERVICE, "com.sun.star.chart2.ChartDocument");
+ lNames = m_aDataSet.m_aCache.getMatchedItemNames(Cache.E_FILTER, rRequestedProps);
+ it = lNames.elements();
+ while(it.hasMoreElements())
+ generateXMLFragment(Cache.E_FILTER, (java.lang.String)it.nextElement(), m_aDataSet.m_aFragmentDirModuleSChart);
+ nFilters -= lNames.size();
+
+ // generate filter fragments for the math module
+ m_aDataSet.m_aDebug.setGlobalInfo("\tfor module math ...");
+ rRequestedProps.put(Cache.PROPNAME_DOCUMENTSERVICE, "com.sun.star.formula.FormulaProperties");
+ lNames = m_aDataSet.m_aCache.getMatchedItemNames(Cache.E_FILTER, rRequestedProps);
+ it = lNames.elements();
+ while(it.hasMoreElements())
+ generateXMLFragment(Cache.E_FILTER, (java.lang.String)it.nextElement(), m_aDataSet.m_aFragmentDirModuleSMath);
+ nFilters -= lNames.size();
+
+ // generate fragments for 3rdParty or unspecified (may graphics) filters!
+ m_aDataSet.m_aDebug.setGlobalInfo("\tfor unknown modules ...");
+ rRequestedProps.put(Cache.PROPNAME_DOCUMENTSERVICE, "");
+ lNames = m_aDataSet.m_aCache.getMatchedItemNames(Cache.E_FILTER, rRequestedProps);
+ it = lNames.elements();
+ while(it.hasMoreElements())
+ generateXMLFragment(Cache.E_FILTER, (java.lang.String)it.nextElement(), m_aDataSet.m_aFragmentDirModuleOthers);
+ nFilters -= lNames.size();
+
+ // generate all detect service fragments
+ m_aDataSet.m_aDebug.setGlobalInfo("generate detect service fragments ...");
+ lNames = m_aDataSet.m_aCache.getItemNames(Cache.E_DETECTSERVICE);
+ it = lNames.elements();
+ while(it.hasMoreElements())
+ generateXMLFragment(Cache.E_DETECTSERVICE, (java.lang.String)it.nextElement(), m_aDataSet.m_aFragmentDirDetectServices);
+ nDetectServices -= lNames.size();
+
+ // generate all frame loader fragments
+ m_aDataSet.m_aDebug.setGlobalInfo("generate frame loader fragments ...");
+ lNames = m_aDataSet.m_aCache.getItemNames(Cache.E_FRAMELOADER);
+ it = lNames.elements();
+ while(it.hasMoreElements())
+ generateXMLFragment(Cache.E_FRAMELOADER, (java.lang.String)it.nextElement(), m_aDataSet.m_aFragmentDirFrameLoaders);
+ nFrameLoaders -= lNames.size();
+
+ // generate all content handler fragments
+ m_aDataSet.m_aDebug.setGlobalInfo("generate content handler fragments ...");
+ lNames = m_aDataSet.m_aCache.getItemNames(Cache.E_CONTENTHANDLER);
+ it = lNames.elements();
+ while(it.hasMoreElements())
+ generateXMLFragment(Cache.E_CONTENTHANDLER, (java.lang.String)it.nextElement(), m_aDataSet.m_aFragmentDirContentHandlers);
+ nContentHandlers -= lNames.size();
+
+ // check if all cache items was handled
+ if (
+ (nTypes != 0) ||
+ (nFilters != 0) ||
+ (nDetectServices != 0) ||
+ (nFrameLoaders != 0) ||
+ (nContentHandlers != 0)
+ )
+ {
+ java.lang.StringBuffer sStatistic = new java.lang.StringBuffer(256);
+ sStatistic.append("some cache items seems to be not transformed:\n");
+ sStatistic.append(nTypes +" unhandled types\n" );
+ sStatistic.append(nFilters +" unhandled filters\n" );
+ sStatistic.append(nDetectServices +" unhandled detect services\n");
+ sStatistic.append(nFrameLoaders +" unhandled frame loader\n" );
+ sStatistic.append(nContentHandlers+" unhandled content handler\n");
+ throw new java.lang.Exception(sStatistic.toString());
+ }
+ }
+
+ //___________________________________________
+
+ /** generate a xml fragment file from the specified cache item.
+ *
+ * @param eItemType
+ * specify, which sub container of the cache must be used
+ * to locate the right item.
+ *
+ * @param sItemName
+ * the name of the cache item inside the specified sub container.
+ *
+ * @param aOutDir
+ * output directory.
+ *
+ * @throw [java.lang.Exception]
+ * if the fragment file already exists or could not be created
+ * successfully.
+ */
+ private void generateXMLFragment(int eItemType,
+ java.lang.String sItemName,
+ java.io.File aOutDir )
+ throws java.lang.Exception
+ {
+ java.lang.String sFileName = FileHelper.convertName2FileName(sItemName);
+ java.lang.String sXML = m_aDataSet.m_aCache.getItemAsXML(eItemType, sItemName, m_aDataSet.m_nFormat);
+ java.io.File aFile = new java.io.File(aOutDir, sFileName+m_aDataSet.m_sFragmentExtension);
+
+ if (aFile.exists())
+ throw new java.lang.Exception("fragment["+eItemType+", \""+sItemName+"\"] file named \""+aFile.getPath()+"\" already exists.");
+
+ java.io.FileOutputStream aStream = new java.io.FileOutputStream(aFile);
+ java.io.OutputStreamWriter aWriter = new java.io.OutputStreamWriter(aStream, m_aDataSet.m_sEncoding);
+ aWriter.write(sXML, 0, sXML.length());
+ aWriter.flush();
+ aWriter.close();
+
+ m_aDataSet.m_aDebug.setDetailedInfo("fragment["+eItemType+", \""+sItemName+"\"] => \""+aFile.getPath()+"\" ... OK");
+ }
+
+ //___________________________________________
+
+ /** create all needed directory structures.
+ *
+ * First it try to clear old structures and
+ * create new ones afterwards.
+ *
+ * @throw [java.lang.Exception]
+ * if some of the needed structures
+ * could not be created successfully.
+ */
+ private void createDirectoryStructures()
+ throws java.lang.Exception
+ {
+ m_aDataSet.m_aDebug.setGlobalInfo("create needed directory structures ...");
+
+ // delete simple files only; no directories!
+ // Because this tool may run inside
+ // a cvs environment its not a godd idea to do so.
+ boolean bFilesOnly = false;
+ FileHelper.makeDirectoryEmpty(m_aDataSet.m_aOutDir, bFilesOnly);
+
+ if (
+ (!m_aDataSet.m_aFragmentDirTypes.exists() && !m_aDataSet.m_aFragmentDirTypes.mkdir() ) ||
+ (!m_aDataSet.m_aFragmentDirFilters.exists() && !m_aDataSet.m_aFragmentDirFilters.mkdir() ) ||
+ (!m_aDataSet.m_aFragmentDirDetectServices.exists() && !m_aDataSet.m_aFragmentDirDetectServices.mkdir() ) ||
+ (!m_aDataSet.m_aFragmentDirFrameLoaders.exists() && !m_aDataSet.m_aFragmentDirFrameLoaders.mkdir() ) ||
+ (!m_aDataSet.m_aFragmentDirContentHandlers.exists() && !m_aDataSet.m_aFragmentDirContentHandlers.mkdir()) ||
+ (!m_aDataSet.m_aFragmentDirModuleSWriter.exists() && !m_aDataSet.m_aFragmentDirModuleSWriter.mkdir() ) ||
+ (!m_aDataSet.m_aFragmentDirModuleSWeb.exists() && !m_aDataSet.m_aFragmentDirModuleSWeb.mkdir() ) ||
+ (!m_aDataSet.m_aFragmentDirModuleSGlobal.exists() && !m_aDataSet.m_aFragmentDirModuleSGlobal.mkdir() ) ||
+ (!m_aDataSet.m_aFragmentDirModuleSCalc.exists() && !m_aDataSet.m_aFragmentDirModuleSCalc.mkdir() ) ||
+ (!m_aDataSet.m_aFragmentDirModuleSDraw.exists() && !m_aDataSet.m_aFragmentDirModuleSDraw.mkdir() ) ||
+ (!m_aDataSet.m_aFragmentDirModuleSImpress.exists() && !m_aDataSet.m_aFragmentDirModuleSImpress.mkdir() ) ||
+ (!m_aDataSet.m_aFragmentDirModuleSMath.exists() && !m_aDataSet.m_aFragmentDirModuleSMath.mkdir() ) ||
+ (!m_aDataSet.m_aFragmentDirModuleSChart.exists() && !m_aDataSet.m_aFragmentDirModuleSChart.mkdir() ) ||
+ (!m_aDataSet.m_aFragmentDirModuleOthers.exists() && !m_aDataSet.m_aFragmentDirModuleOthers.mkdir() )
+ )
+ {
+ throw new java.lang.Exception("some directory structures does not exists and could not be created successfully.");
+ }
+ }
+}
diff --git a/filter/source/config/tools/split/SplitterData.java b/filter/source/config/tools/split/SplitterData.java
new file mode 100644
index 000000000000..daa09797da68
--- /dev/null
+++ b/filter/source/config/tools/split/SplitterData.java
@@ -0,0 +1,87 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+package com.sun.star.filter.config.tools.split;
+
+//_______________________________________________
+
+import java.lang.*;
+import java.io.*;
+import com.sun.star.filter.config.tools.utils.*;
+
+//_______________________________________________
+
+/**
+ * Data container for class Splitter.
+ *
+ *
+ */
+public class SplitterData
+{
+ /** can be used to generate some debug output. */
+ public Logger m_aDebug;
+
+ /** contains all configuration structures, for which the xml
+ fragments should be generated. */
+ public Cache m_aCache;
+
+ /** specify the output xml format. */
+ public int m_nFormat;
+
+ /** specify the encoding for the output xml files. */
+ public java.lang.String m_sEncoding;
+
+ /** directory to generate some generic views. */
+ public java.io.File m_aOutDir;
+
+ /** directories to generate all xml fragments there.
+ * Must be relative to "m_aOutDir"! */
+ public java.io.File m_aFragmentDirTypes;
+ public java.io.File m_aFragmentDirFilters;
+ public java.io.File m_aFragmentDirDetectServices;
+ public java.io.File m_aFragmentDirFrameLoaders;
+ public java.io.File m_aFragmentDirContentHandlers;
+
+ /** enable/disable grouping of filters by its application modules. */
+ public boolean m_bSeperateFiltersByModule;
+
+ /** directories to group all filter fragments ... if requested.
+ * Must be relative to "m_aOutDir/m_aFragmentDirFilters" and
+ * will be used only, if "m_bSeperateFiltersByModule" is set to true. */
+ public java.io.File m_aFragmentDirModuleSWriter;
+ public java.io.File m_aFragmentDirModuleSWeb;
+ public java.io.File m_aFragmentDirModuleSGlobal;
+ public java.io.File m_aFragmentDirModuleSCalc;
+ public java.io.File m_aFragmentDirModuleSDraw;
+ public java.io.File m_aFragmentDirModuleSImpress;
+ public java.io.File m_aFragmentDirModuleSMath;
+ public java.io.File m_aFragmentDirModuleSChart;
+ public java.io.File m_aFragmentDirModuleOthers;
+
+ /** file extension for generated xml fragments. */
+ public java.lang.String m_sFragmentExtension;
+}
diff --git a/filter/source/config/tools/split/makefile.mk b/filter/source/config/tools/split/makefile.mk
new file mode 100644
index 000000000000..a6942bfa6d5f
--- /dev/null
+++ b/filter/source/config/tools/split/makefile.mk
@@ -0,0 +1,88 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ = ..$/..$/..$/..
+PRJNAME = filter
+TARGET = FCFGSplit
+PACKAGE = com$/sun$/star$/filter$/config$/tools$/split
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE: settings.mk
+
+#----- compile .java files -----------------------------------------
+
+OWNCOPY = \
+ $(MISC)$/$(TARGET)_copied.done
+
+JARFILES = \
+ ridl.jar \
+ unoil.jar \
+ jurt.jar \
+ juh.jar \
+ java_uno.jar
+
+CFGFILES = \
+ FCFGSplit.cfg
+
+JAVACLASSFILES = \
+ $(CLASSDIR)$/$(PACKAGE)$/SplitterData.class \
+ $(CLASSDIR)$/$(PACKAGE)$/Splitter.class \
+ $(CLASSDIR)$/$(PACKAGE)$/FCFGSplit.class
+
+CUSTOMMANIFESTFILE = \
+ Manifest.mf
+
+MAXLINELENGTH = 100000
+
+#----- make a jar from compiled files ------------------------------
+
+JARCLASSDIRS = \
+ com$/sun$/star$/filter$/config$/tools$/utils \
+ com$/sun$/star$/filter$/config$/tools$/split
+
+JARTARGET = $(TARGET).jar
+
+JARCOMPRESS = TRUE
+
+# --- targets -----------------------------------------------------
+
+.INCLUDE : target.mk
+
+ALLTAR : $(OWNCOPY)
+
+.IF "$(JARTARGETN)" != ""
+$(JARTARGETN) : $(OWNCOPY)
+.ENDIF
+
+$(OWNCOPY) : $(CFGFILES)
+ -$(MKDIR) $(CLASSDIR)$/$(PACKAGE)
+ $(COPY) $? $(CLASSDIR)$/$(PACKAGE) && $(TOUCH) $@
+
+run :
+ @$(MKDIR) c:\temp\fragments
+ @$(JAVA) -jar $(CLASSDIR)$/FCFGSplit.jar debug=4 xmlfile=o:/src680/src.m7/officecfg/registry/data/org/openoffice/Office/TypeDetection.xcu outdir=c:/temp/fragments
diff --git a/filter/source/docbook/DocBookTemplate.stw b/filter/source/docbook/DocBookTemplate.stw
new file mode 100644
index 000000000000..ebc95f9f68cb
--- /dev/null
+++ b/filter/source/docbook/DocBookTemplate.stw
Binary files differ
diff --git a/filter/source/docbook/docbooktosoffheadings.xsl b/filter/source/docbook/docbooktosoffheadings.xsl
new file mode 100644
index 000000000000..0b583a9d1452
--- /dev/null
+++ b/filter/source/docbook/docbooktosoffheadings.xsl
@@ -0,0 +1,1424 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:office="http://openoffice.org/2000/office" xmlns:style="http://openoffice.org/2000/style" xmlns:text="http://openoffice.org/2000/text" xmlns:table="http://openoffice.org/2000/table" xmlns:draw="http://openoffice.org/2000/drawing" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="http://openoffice.org/2000/meta" xmlns:number="http://openoffice.org/2000/datastyle" xmlns:svg="http://www.w3.org/2000/svg" xmlns:chart="http://openoffice.org/2000/chart" xmlns:dr3d="http://openoffice.org/2000/dr3d" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="http://openoffice.org/2000/form" xmlns:script="http://openoffice.org/2000/script" xmlns:config="http://openoffice.org/2001/config" office:class="text" office:version="1.0">
+ <xsl:decimal-format name="staff" digit="D"/>
+ <xsl:template match="/">
+ <xsl:element name="office:document">
+ <office:meta>
+ <dc:title>
+ <xsl:value-of select="/article/articleinfo/title"/>
+ </dc:title>
+ <dc:description></dc:description>
+ <dc:subject></dc:subject>
+ <dc:date>
+ <xsl:value-of select="article/articleinfo/pubdate"/>
+ </dc:date>
+ <dc:language>
+ <xsl:value-of select="article/@lang"/>
+ </dc:language>
+ <meta:user-defined meta:name="Info 1"/>
+ <meta:user-defined meta:name="Info 2"/>
+ <meta:user-defined meta:name="Info 3"/>
+ <meta:user-defined meta:name="Info 4"/>
+ </office:meta>
+ <office:font-decls>
+ <style:font-decl style:name="Tahoma1" fo:font-family="Tahoma"/>
+ <style:font-decl style:name="Thorndale" fo:font-family="Thorndale" style:font-family-generic="roman" style:font-pitch="variable"/>
+ <style:font-decl style:name="Albany" fo:font-family="Albany" style:font-family-generic="swiss" style:font-pitch="variable"/>
+ <style:font-decl style:name="Andale Sans UI" fo:font-family="'Andale Sans UI'" style:font-family-generic="system" style:font-pitch="variable"/>
+ <style:font-decl style:name="MS Mincho" fo:font-family="'MS Mincho'" style:font-family-generic="system" style:font-pitch="variable"/>
+ <style:font-decl style:name="Tahoma" fo:font-family="Tahoma" style:font-family-generic="system" style:font-pitch="variable"/>
+ </office:font-decls>
+ <office:styles>
+ <style:default-style style:family="graphics">
+ <style:properties draw:shadow-offset-x="0.3cm" draw:shadow-offset-y="0.3cm" draw:start-line-spacing-horizontal="0.283cm" draw:start-line-spacing-vertical="0.283cm" draw:end-line-spacing-horizontal="0.283cm" draw:end-line-spacing-vertical="0.283cm" style:text-autospace="ideograph-alpha" style:line-break="strict" style:writing-mode="lr-tb" style:font-independent-line-spacing="false" style:use-window-font-color="true" fo:font-size="12pt" fo:language="en" fo:country="US" style:font-size-asian="12pt" style:language-asian="zxx" style:country-asian="none" style:font-size-complex="12pt" style:language-complex="zxx" style:country-complex="none">
+ <style:tab-stops/>
+ </style:properties>
+ </style:default-style>
+ <style:default-style style:family="paragraph">
+ <style:properties fo:hyphenation-ladder-count="no-limit" style:text-autospace="ideograph-alpha" style:punctuation-wrap="hanging" style:line-break="strict" style:tab-stop-distance="2.205cm" style:writing-mode="page" style:use-window-font-color="true" style:font-name="Thorndale" fo:font-size="12pt" fo:language="en" fo:country="US" style:font-name-asian="Andale Sans UI" style:font-size-asian="12pt" style:language-asian="zxx" style:country-asian="none" style:font-name-complex="Tahoma" style:font-size-complex="12pt" style:language-complex="zxx" style:country-complex="none" fo:hyphenate="false" fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2"/>
+ </style:default-style>
+ <style:default-style style:family="table">
+ <style:properties table:border-model="separating"/>
+ </style:default-style>
+ <style:default-style style:family="table-row">
+ <style:properties fo:keep-together="always"/>
+ </style:default-style>
+ <style:style style:name="Standard" style:family="paragraph" style:class="text"/>
+ <style:style style:name="Text body" style:family="paragraph" style:parent-style-name="Standard" style:class="text">
+ <style:properties fo:margin-top="0cm" fo:margin-bottom="0.212cm"/>
+ </style:style>
+ <style:style style:name="Heading" style:family="paragraph" style:parent-style-name="Standard" style:next-style-name="Text body" style:class="text">
+ <style:properties fo:margin-top="0.423cm" fo:margin-bottom="0.212cm" fo:keep-with-next="true" style:font-name="Albany" fo:font-size="14pt" style:font-name-asian="MS Mincho" style:font-size-asian="14pt" style:font-name-complex="Tahoma" style:font-size-complex="14pt"/>
+ </style:style>
+ <style:style style:name="Heading 1" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text body" style:class="text">
+ <style:properties fo:font-size="115%" fo:font-weight="bold" style:font-size-asian="115%" style:font-weight-asian="bold" style:font-size-complex="115%" style:font-weight-complex="bold"/>
+ </style:style>
+ <style:style style:name="Heading 2" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text body" style:class="text">
+ <style:properties fo:font-size="14pt" fo:font-style="italic" fo:font-weight="bold" style:font-size-asian="14pt" style:font-style-asian="italic" style:font-weight-asian="bold" style:font-size-complex="14pt" style:font-style-complex="italic" style:font-weight-complex="bold"/>
+ </style:style>
+ <style:style style:name="Heading 3" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text body" style:class="text">
+ <style:properties fo:font-size="14pt" fo:font-weight="bold" style:font-size-asian="14pt" style:font-weight-asian="bold" style:font-size-complex="14pt" style:font-weight-complex="bold"/>
+ </style:style>
+ <style:style style:name="Heading 4" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text body" style:class="text">
+ <style:properties fo:font-size="85%" fo:font-style="italic" fo:font-weight="bold" style:font-size-asian="85%" style:font-style-asian="italic" style:font-weight-asian="bold" style:font-size-complex="85%" style:font-style-complex="italic" style:font-weight-complex="bold"/>
+ </style:style>
+ <style:style style:name="List" style:family="paragraph" style:parent-style-name="Text body" style:class="list">
+ <style:properties style:font-name-complex="Tahoma1"/>
+ </style:style>
+ <style:style style:name="Table Contents" style:family="paragraph" style:parent-style-name="Text body" style:class="extra">
+ <style:properties text:number-lines="false" text:line-number="0"/>
+ </style:style>
+ <style:style style:name="Table Heading" style:family="paragraph" style:parent-style-name="Table Contents" style:class="extra">
+ <style:properties fo:text-align="center" style:justify-single-word="false" text:number-lines="false" text:line-number="0" fo:font-style="italic" fo:font-weight="bold" style:font-style-asian="italic" style:font-weight-asian="bold" style:font-style-complex="italic" style:font-weight-complex="bold"/>
+ </style:style>
+ <style:style style:name="Caption" style:family="paragraph" style:parent-style-name="Standard" style:class="extra">
+ <style:properties fo:margin-top="0.212cm" fo:margin-bottom="0.212cm" text:number-lines="false" text:line-number="0" fo:font-size="10pt" fo:font-style="italic" style:font-size-asian="10pt" style:font-style-asian="italic" style:font-size-complex="10pt" style:font-style-complex="italic"/>
+ </style:style>
+ <style:style style:name="Table" style:family="paragraph" style:parent-style-name="Caption" style:class="extra"/>
+ <style:style style:name="Frame contents" style:family="paragraph" style:parent-style-name="Text body" style:class="extra"/>
+ <style:style style:name="Footnote" style:family="paragraph" style:parent-style-name="Standard" style:class="extra">
+ <style:properties fo:margin-left="0.499cm" fo:margin-right="0cm" fo:text-indent="-0.499cm" style:auto-text-indent="false" text:number-lines="false" text:line-number="0" fo:font-size="10pt" style:font-size-asian="10pt" style:font-size-complex="10pt"/>
+ </style:style>
+ <style:style style:name="Index" style:family="paragraph" style:parent-style-name="Standard" style:class="index">
+ <style:properties text:number-lines="false" text:line-number="0" style:font-name-complex="Tahoma1"/>
+ </style:style>
+ <style:style style:name="Subtitle" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text body" style:class="chapter">
+ <style:properties fo:text-align="center" style:justify-single-word="false" fo:font-size="14pt" fo:font-style="italic" style:font-size-asian="14pt" style:font-style-asian="italic" style:font-size-complex="14pt" style:font-style-complex="italic"/>
+ </style:style>
+ <style:style style:name="Mediaobject" style:family="paragraph" style:class="text"/>
+ <style:style style:name="Object" style:family="paragraph" style:parent-style-name="Caption" style:class="extra"/>
+ <style:style style:name="Section Title" style:family="paragraph" style:next-style-name="Text body" style:master-page-name="">
+ <style:properties fo:line-height="200%" fo:text-transform="capitalize" fo:font-size="14pt"/>
+ </style:style>
+ <style:style style:name="Appendix Title" style:family="paragraph" style:next-style-name="Text body" style:master-page-name="">
+ <style:properties fo:line-height="200%" fo:text-transform="capitalize" fo:font-size="14pt"/>
+ </style:style>
+ <style:style style:name="Section1 Title" style:family="paragraph" style:next-style-name="Text body" style:master-page-name="">
+ <style:properties fo:line-height="200%" fo:text-transform="capitalize" fo:font-size="14pt"/>
+ </style:style>
+ <style:style style:name="Section2 Title" style:family="paragraph" style:next-style-name="Text body" style:master-page-name="">
+ <style:properties fo:line-height="200%" fo:text-transform="capitalize" fo:font-size="13pt"/>
+ </style:style>
+ <style:style style:name="Section3 Title" style:family="paragraph" style:next-style-name="Text body" style:master-page-name="">
+ <style:properties fo:line-height="200%" fo:text-transform="capitalize" fo:font-size="12pt"/>
+ </style:style>
+ <style:style style:name="Section4 Title" style:family="paragraph" style:next-style-name="Text body" style:master-page-name="">
+ <style:properties fo:line-height="200%" fo:text-transform="capitalize" fo:font-size="12pt"/>
+ </style:style>
+ <style:style style:name="Section5 Title" style:family="paragraph" style:next-style-name="Text body" style:master-page-name="">
+ <style:properties fo:line-height="200%" fo:text-transform="capitalize" fo:font-size="12pt"/>
+ </style:style>
+ <style:style style:name="Document Title" style:family="paragraph" style:parent-style-name="Standard" style:next-style-name="Document SubTitle">
+ <style:properties fo:text-align="center" style:justify-single-word="false" fo:font-size="20pt"/>
+ </style:style>
+ <style:style style:name="Document SubTitle" style:family="paragraph" style:parent-style-name="Document Title" style:next-style-name="Text body">
+ <style:properties fo:font-size="14pt"/>
+ </style:style>
+ <style:style style:name="Section SubTitle" style:family="paragraph" style:parent-style-name="Section Title"/>
+ <style:style style:name="CopyRight" style:family="paragraph" style:parent-style-name="Text body"/>
+ <style:style style:name="VarList Item" style:family="paragraph" style:parent-style-name="Text body" style:list-style-name="Var List" style:class="text">
+ <style:properties fo:margin-left="3cm" fo:margin-right="0cm" fo:text-indent="0cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:properties>
+ </style:style>
+ <style:style style:name="VarList Term" style:family="paragraph" style:parent-style-name="Text body" style:list-style-name="Var List" style:class="text">
+ <style:properties fo:margin-left="1cm" fo:margin-right="0cm" fo:text-indent="-4.5cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:properties>
+ </style:style>
+ <style:style style:name="Footnote Symbol" style:family="text"/>
+ <style:style style:name="Numbering Symbols" style:family="text"/>
+ <style:style style:name="Bullet Symbols" style:family="text">
+ <style:properties fo:font-size="9pt" style:font-size-asian="9pt" style:font-size-complex="9pt"/>
+ </style:style>
+ <style:style style:name="Internet link" style:family="text">
+ <style:properties fo:color="#000080" style:text-underline-color="font-color" style:text-underline="single"/>
+ </style:style>
+ <style:style style:name="Endnote Symbol" style:family="text"/>
+ <style:style style:name="Emphasis" style:family="text">
+ <style:properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic"/>
+ </style:style>
+ <style:style style:name="Source Text" style:family="text"/>
+ <style:style style:name="Highlight" style:family="text">
+ <style:properties style:text-background-color="#fff000"/>
+ </style:style>
+ <style:style style:name="KeyCap" style:family="text">
+ <style:properties fo:font-weight="bold"/>
+ </style:style>
+ <style:style style:name="Command" style:family="text">
+ <style:properties fo:font-weight="bold"/>
+ </style:style>
+ <style:style style:name="Application" style:family="text">
+ <style:properties fo:font-weight="bold"/>
+ </style:style>
+ <style:style style:name="FileName" style:family="text">
+ <style:properties fo:font-weight="bold"/>
+ </style:style>
+ <style:style style:name="SuperScript" style:family="text">
+ <style:properties style:text-position="super 58%"/>
+ </style:style>
+ <style:style style:name="SubScript" style:family="text">
+ <style:properties style:text-position="sub 58%"/>
+ </style:style>
+ <style:style style:name="SystemItem" style:family="text">
+ <style:properties fo:font-weight="bold"/>
+ </style:style>
+ <style:style style:name="ComputerOutput" style:family="text">
+ <style:properties fo:font-weight="bold"/>
+ </style:style>
+ <style:style style:name="KeyCombo" style:family="text">
+ <style:properties fo:font-weight="bold"/>
+ </style:style>
+ <style:style style:name="KeySym" style:family="text">
+ <style:properties fo:font-weight="bold"/>
+ </style:style>
+ <style:style style:name="GuiMenu" style:family="text">
+ <style:properties fo:color="#000fff" fo:font-style="italic"/>
+ </style:style>
+ <style:style style:name="GuiSubMenu" style:family="text">
+ <style:properties fo:color="#ff9966" fo:font-style="italic"/>
+ </style:style>
+ <style:style style:name="GuiButton" style:family="text">
+ <style:properties fo:color="#00f0ff" fo:font-style="italic"/>
+ </style:style>
+ <style:style style:name="GuiMenuItem" style:family="text">
+ <style:properties fo:color="#00ffff" fo:font-style="italic"/>
+ </style:style>
+ <style:style style:name="GuiLabel" style:family="text">
+ <style:properties fo:color="#00777f" fo:font-style="italic"/>
+ </style:style>
+ <style:style style:name="Frame" style:family="graphics">
+ <style:properties text:anchor-type="paragraph" svg:x="0cm" svg:y="0cm" fo:margin-left="0.201cm" fo:margin-right="0.201cm" fo:margin-top="0.201cm" fo:margin-bottom="0.201cm" style:wrap="parallel" style:number-wrapped-paragraphs="no-limit" style:wrap-contour="false" style:vertical-pos="top" style:vertical-rel="paragraph-content" style:horizontal-pos="center" style:horizontal-rel="paragraph-content" fo:padding="0.15cm" fo:border="0.002cm solid #000000"/>
+ </style:style>
+ <text:outline-style>
+ <text:outline-level-style text:level="1" style:num-format=""/>
+ <text:outline-level-style text:level="2" style:num-format=""/>
+ <text:outline-level-style text:level="3" style:num-format=""/>
+ <text:outline-level-style text:level="4" style:num-format=""/>
+ <text:outline-level-style text:level="5" style:num-format=""/>
+ <text:outline-level-style text:level="6" style:num-format=""/>
+ <text:outline-level-style text:level="7" style:num-format=""/>
+ <text:outline-level-style text:level="8" style:num-format=""/>
+ <text:outline-level-style text:level="9" style:num-format=""/>
+ <text:outline-level-style text:level="10" style:num-format=""/>
+ </text:outline-style>
+ <text:list-style style:name="Ordered List">
+ <text:list-level-style-number text:level="1" text:style-name="Numbering Symbols" style:num-suffix="." style:num-format="1">
+ <style:properties text:min-label-width="0.499cm"/>
+ </text:list-level-style-number>
+ <text:list-level-style-number text:level="2" style:num-suffix="." style:num-format="1">
+ <style:properties text:space-before="0.501cm" text:min-label-width="0.499cm"/>
+ </text:list-level-style-number>
+ <text:list-level-style-number text:level="3" style:num-suffix="." style:num-format="1">
+ <style:properties text:space-before="1cm" text:min-label-width="0.499cm"/>
+ </text:list-level-style-number>
+ <text:list-level-style-number text:level="4" style:num-suffix="." style:num-format="1">
+ <style:properties text:space-before="1.501cm" text:min-label-width="0.499cm"/>
+ </text:list-level-style-number>
+ <text:list-level-style-number text:level="5" style:num-suffix="." style:num-format="1">
+ <style:properties text:space-before="2cm" text:min-label-width="0.499cm"/>
+ </text:list-level-style-number>
+ <text:list-level-style-number text:level="6" style:num-suffix="." style:num-format="1">
+ <style:properties text:space-before="2.501cm" text:min-label-width="0.499cm"/>
+ </text:list-level-style-number>
+ <text:list-level-style-number text:level="7" style:num-suffix="." style:num-format="1">
+ <style:properties text:space-before="3.001cm" text:min-label-width="0.499cm"/>
+ </text:list-level-style-number>
+ <text:list-level-style-number text:level="8" style:num-suffix="." style:num-format="1">
+ <style:properties text:space-before="3.502cm" text:min-label-width="0.499cm"/>
+ </text:list-level-style-number>
+ <text:list-level-style-number text:level="9" style:num-suffix="." style:num-format="1">
+ <style:properties text:space-before="4.001cm" text:min-label-width="0.499cm"/>
+ </text:list-level-style-number>
+ <text:list-level-style-number text:level="10" style:num-suffix="." style:num-format="1">
+ <style:properties text:space-before="4.502cm" text:min-label-width="0.499cm"/>
+ </text:list-level-style-number>
+ </text:list-style>
+ <text:list-style style:name="UnOrdered List">
+ <text:list-level-style-bullet text:level="1" text:style-name="Bullet Symbols" text:bullet-char="•">
+ <style:properties text:min-label-width="0.499cm" fo:font-family="StarSymbol" style:font-charset="x-symbol"/>
+ </text:list-level-style-bullet>
+ <text:list-level-style-bullet text:level="2" text:style-name="Bullet Symbols" text:bullet-char="•">
+ <style:properties text:space-before="0.501cm" text:min-label-width="0.499cm" fo:font-family="StarSymbol" style:font-charset="x-symbol"/>
+ </text:list-level-style-bullet>
+ <text:list-level-style-bullet text:level="3" text:style-name="Bullet Symbols" style:num-suffix="." text:bullet-char="•">
+ <style:properties text:space-before="1cm" text:min-label-width="0.499cm" fo:font-family="StarSymbol" style:font-charset="x-symbol"/>
+ </text:list-level-style-bullet>
+ <text:list-level-style-bullet text:level="4" text:style-name="Bullet Symbols" style:num-suffix="." text:bullet-char="•">
+ <style:properties text:space-before="1.501cm" text:min-label-width="0.499cm" fo:font-family="StarSymbol" style:font-charset="x-symbol"/>
+ </text:list-level-style-bullet>
+ <text:list-level-style-bullet text:level="5" text:style-name="Bullet Symbols" style:num-suffix="." text:bullet-char="•">
+ <style:properties text:space-before="2cm" text:min-label-width="0.499cm" fo:font-family="StarSymbol" style:font-charset="x-symbol"/>
+ </text:list-level-style-bullet>
+ <text:list-level-style-bullet text:level="6" text:style-name="Bullet Symbols" style:num-suffix="." text:bullet-char="•">
+ <style:properties text:space-before="2.501cm" text:min-label-width="0.499cm" fo:font-family="StarSymbol" style:font-charset="x-symbol"/>
+ </text:list-level-style-bullet>
+ <text:list-level-style-bullet text:level="7" text:style-name="Bullet Symbols" style:num-suffix="." text:bullet-char="•">
+ <style:properties text:space-before="3.001cm" text:min-label-width="0.499cm" fo:font-family="StarSymbol" style:font-charset="x-symbol"/>
+ </text:list-level-style-bullet>
+ <text:list-level-style-bullet text:level="8" text:style-name="Bullet Symbols" style:num-suffix="." text:bullet-char="•">
+ <style:properties text:space-before="3.502cm" text:min-label-width="0.499cm" fo:font-family="StarSymbol" style:font-charset="x-symbol"/>
+ </text:list-level-style-bullet>
+ <text:list-level-style-bullet text:level="9" text:style-name="Bullet Symbols" style:num-suffix="." text:bullet-char="•">
+ <style:properties text:space-before="4.001cm" text:min-label-width="0.499cm" fo:font-family="StarSymbol" style:font-charset="x-symbol"/>
+ </text:list-level-style-bullet>
+ <text:list-level-style-bullet text:level="10" text:style-name="Bullet Symbols" style:num-suffix="." text:bullet-char="•">
+ <style:properties text:space-before="4.502cm" text:min-label-width="0.499cm" fo:font-family="StarSymbol" style:font-charset="x-symbol"/>
+ </text:list-level-style-bullet>
+ </text:list-style>
+ <text:list-style style:name="Var List">
+ <text:list-level-style-bullet text:level="1" text:style-name="Bullet Symbols" text:bullet-char="•">
+ <style:properties text:min-label-width="0.499cm" fo:font-family="StarSymbol" style:font-charset="x-symbol"/>
+ </text:list-level-style-bullet>
+ <text:list-level-style-bullet text:level="2" text:style-name="Bullet Symbols" style:num-suffix="." text:bullet-char="•">
+ <style:properties text:space-before="0.501cm" text:min-label-width="0.499cm" fo:font-family="StarSymbol" style:font-charset="x-symbol"/>
+ </text:list-level-style-bullet>
+ <text:list-level-style-bullet text:level="3" text:style-name="Bullet Symbols" style:num-suffix="." text:bullet-char="•">
+ <style:properties text:space-before="1cm" text:min-label-width="0.499cm" fo:font-family="StarSymbol" style:font-charset="x-symbol"/>
+ </text:list-level-style-bullet>
+ <text:list-level-style-bullet text:level="4" text:style-name="Bullet Symbols" style:num-suffix="." text:bullet-char="•">
+ <style:properties text:space-before="1.501cm" text:min-label-width="0.499cm" fo:font-family="StarSymbol" style:font-charset="x-symbol"/>
+ </text:list-level-style-bullet>
+ <text:list-level-style-bullet text:level="5" text:style-name="Bullet Symbols" style:num-suffix="." text:bullet-char="•">
+ <style:properties text:space-before="2cm" text:min-label-width="0.499cm" fo:font-family="StarSymbol" style:font-charset="x-symbol"/>
+ </text:list-level-style-bullet>
+ <text:list-level-style-bullet text:level="6" text:style-name="Bullet Symbols" style:num-suffix="." text:bullet-char="•">
+ <style:properties text:space-before="2.501cm" text:min-label-width="0.499cm" fo:font-family="StarSymbol" style:font-charset="x-symbol"/>
+ </text:list-level-style-bullet>
+ <text:list-level-style-bullet text:level="7" text:style-name="Bullet Symbols" style:num-suffix="." text:bullet-char="•">
+ <style:properties text:space-before="3.001cm" text:min-label-width="0.499cm" fo:font-family="StarSymbol" style:font-charset="x-symbol"/>
+ </text:list-level-style-bullet>
+ <text:list-level-style-bullet text:level="8" text:style-name="Bullet Symbols" style:num-suffix="." text:bullet-char="•">
+ <style:properties text:space-before="3.502cm" text:min-label-width="0.499cm" fo:font-family="StarSymbol" style:font-charset="x-symbol"/>
+ </text:list-level-style-bullet>
+ <text:list-level-style-bullet text:level="9" text:style-name="Bullet Symbols" style:num-suffix="." text:bullet-char="•">
+ <style:properties text:space-before="4.001cm" text:min-label-width="0.499cm" fo:font-family="StarSymbol" style:font-charset="x-symbol"/>
+ </text:list-level-style-bullet>
+ <text:list-level-style-bullet text:level="10" text:style-name="Bullet Symbols" style:num-suffix="." text:bullet-char="•">
+ <style:properties text:space-before="4.502cm" text:min-label-width="0.499cm" fo:font-family="StarSymbol" style:font-charset="x-symbol"/>
+ </text:list-level-style-bullet>
+ </text:list-style>
+ <text:footnotes-configuration text:citation-style-name="Footnote Symbol" style:num-format="1" text:start-value="0" text:footnotes-position="page" text:start-numbering-at="page"/>
+ <text:endnotes-configuration text:citation-style-name="Endnote Symbol" text:master-page-name="Endnote" style:num-format="1" text:start-value="0"/>
+ <text:linenumbering-configuration text:number-lines="false" text:offset="0.499cm" style:num-format="1" text:number-position="left" text:increment="5"/>
+ </office:styles>
+ <office:automatic-styles>
+ <style:page-master style:name="pm1">
+ <style:properties fo:page-width="20.999cm" fo:page-height="29.699cm" style:num-format="1" style:print-orientation="portrait" fo:margin-top="2.54cm" fo:margin-bottom="2.54cm" fo:margin-left="3.175cm" fo:margin-right="3.175cm" style:writing-mode="lr-tb" style:footnote-max-height="0cm">
+ <style:footnote-sep style:width="0.018cm" style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" style:adjustment="left" style:rel-width="25%" style:color="#000000"/>
+ </style:properties>
+ <style:header-style/>
+ <style:footer-style/>
+ </style:page-master>
+ <style:page-master style:name="pm2">
+ <style:properties fo:page-width="20.999cm" fo:page-height="29.699cm" style:num-format="1" style:print-orientation="portrait" fo:margin-top="2cm" fo:margin-bottom="2cm" fo:margin-left="2cm" fo:margin-right="2cm" style:writing-mode="lr-tb" style:footnote-max-height="0cm">
+ <style:footnote-sep style:adjustment="left" style:rel-width="25%" style:color="#000000"/>
+ </style:properties>
+ <style:header-style/>
+ <style:footer-style/>
+ </style:page-master>
+ </office:automatic-styles>
+ <office:master-styles>
+ <style:master-page style:name="Standard" style:page-master-name="pm1"/>
+ <style:master-page style:name="Endnote" style:page-master-name="pm2"/>
+ </office:master-styles>
+ <office:body>
+ <xsl:apply-templates/>
+ </office:body>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="subtitle">
+ <xsl:choose>
+ <xsl:when test="parent::table">
+ <xsl:apply-templates/>
+ </xsl:when>
+ <xsl:when test="parent::informaltable">
+ <xsl:apply-templates/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="text:p">
+ <xsl:attribute name="text:style-name">Section SubTitle</xsl:attribute>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+
+
+ <xsl:template match="title">
+ <xsl:choose>
+ <xsl:when test="parent::figure"></xsl:when>
+ <xsl:when test="parent::table"></xsl:when>
+ <xsl:when test="parent::sect1"></xsl:when>
+ <xsl:when test="parent::sect2"></xsl:when>
+ <xsl:when test="parent::sect3"></xsl:when>
+ <xsl:when test="parent::sect4"></xsl:when>
+ <xsl:when test="parent::sect5"></xsl:when>
+ <xsl:when test="parent::informaltable">
+ <xsl:apply-templates/>
+ </xsl:when>
+
+ <xsl:otherwise>
+ <xsl:element name="text:p">
+ <xsl:choose>
+
+ <xsl:when test="parent::appendix">
+ <xsl:attribute name="text:style-name">Appendix Title</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="articleinfo">
+ <xsl:element name="text:section">
+ <xsl:attribute name="text:style-name">ArticleInfo</xsl:attribute>
+ <xsl:attribute name="text:name">ArticleInfo</xsl:attribute>
+ <xsl:if test="/article/articleinfo/title !=''">
+ <xsl:element name="text:p">
+ <xsl:attribute name="text:style-name">Document Title</xsl:attribute>
+ <xsl:value-of select="/article/articleinfo/title"/>
+ </xsl:element>
+ <xsl:if test="/article/articleinfo/subtitle !=''">
+ <xsl:element name="text:p">
+ <xsl:attribute name="text:style-name">Document SubTitle</xsl:attribute>
+ <xsl:value-of select="/article/articleinfo/subtitle"/>
+ </xsl:element>
+ </xsl:if>
+ </xsl:if>
+ <xsl:apply-templates/>
+ </xsl:element>
+
+ </xsl:template>
+
+ <xsl:template match="appendix">
+ <xsl:element name="text:section">
+ <xsl:attribute name="text:style-name">Appendix</xsl:attribute>
+ <xsl:attribute name="text:name">Appendix</xsl:attribute>
+ <xsl:apply-templates/>
+ </xsl:element>
+
+ </xsl:template>
+
+<!--
+<xsl:template match="author">
+ <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="firstname">
+ <xsl:element name="text:variable-set">
+ <xsl:attribute name="text:name">
+ <xsl:if test="ancestor::articleinfo/author">
+ <xsl:text disable-output-escaping="yes">articleinfo.author</xsl:text><xsl:value-of select="count(parent::author[preceding-sibling::author])"/><xsl:text disable-output-escaping="yes">.firstname</xsl:text><xsl:value-of select="count(preceding-sibling::firstname)"/>
+ </xsl:if>
+ </xsl:attribute>
+ <xsl:apply-templates/>
+ </xsl:element>
+
+</xsl:template>-->
+
+ <xsl:template match="articleinfo/title">
+ <!-- <xsl:element name="text:variable-decls">
+ <xsl:element name="text:variable-decl">
+ <xsl:attribute name="text:value-type">
+ <xsl:text>string</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute name="text:name">
+ <xsl:text disable-output-escaping="yes">articleinfo.title</xsl:text>
+ </xsl:attribute>
+ </xsl:element>
+
+ </xsl:element>
+ <xsl:element name="text:p">
+ <xsl:element name="text:variable-set">
+ <xsl:attribute name="text:value-type">
+ <xsl:text>string</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute name="text:name">
+ <xsl:text disable-output-escaping="yes">articleinfo.title</xsl:text>
+ </xsl:attribute>
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:element>--></xsl:template>
+
+ <xsl:template match="articleinfo/subtitle">
+ <xsl:element name="text:variable-decls">
+ <xsl:element name="text:variable-decl">
+ <xsl:attribute name="text:value-type">
+ <xsl:text>string</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute name="text:name">
+ <xsl:text disable-output-escaping="yes">articleinfo.subtitle</xsl:text>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:element>
+ <xsl:element name="text:p">
+ <xsl:element name="text:variable-set">
+ <xsl:attribute name="text:value-type">
+ <xsl:text>string</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute name="text:name">
+ <xsl:text disable-output-escaping="yes">articleinfo.subtitle</xsl:text>
+ </xsl:attribute>
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="articleinfo/edition">
+ <xsl:element name="text:variable-decls">
+ <xsl:element name="text:variable-decl">
+ <xsl:attribute name="text:value-type">
+ <xsl:text>string</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute name="text:name">
+ <xsl:text disable-output-escaping="yes">articleinfo.edition</xsl:text>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:element>
+ <xsl:element name="text:p">
+ <xsl:element name="text:variable-set">
+ <xsl:attribute name="text:value-type">
+ <xsl:text>string</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute name="text:name">
+ <xsl:text disable-output-escaping="yes">articleinfo.edition</xsl:text>
+ </xsl:attribute>
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="articleinfo/releaseinfo">
+ <xsl:element name="text:variable-decls">
+ <xsl:element name="text:variable-decl">
+ <xsl:attribute name="text:value-type">
+ <xsl:text>string</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute name="text:name">
+ <xsl:text disable-output-escaping="yes">articleinfo.releaseinfo_</xsl:text>
+ <xsl:value-of select="count(preceding-sibling::releaseinfo)"/>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:element>
+ <xsl:element name="text:p">
+ <xsl:element name="text:variable-set">
+ <xsl:attribute name="text:value-type">
+ <xsl:text>string</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute name="text:name">
+ <xsl:text disable-output-escaping="yes">articleinfo.releaseinfo_</xsl:text>
+ <xsl:value-of select="count(preceding-sibling::releaseinfo)"/>
+ </xsl:attribute>
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+
+
+ <xsl:template match="author/firstname">
+ <xsl:element name="text:variable-decls">
+ <xsl:element name="text:variable-decl">
+ <xsl:attribute name="text:value-type">
+ <xsl:text>string</xsl:text>
+ </xsl:attribute>
+
+ <xsl:attribute name="text:name">
+ <xsl:if test="ancestor::articleinfo">
+ <xsl:text disable-output-escaping="yes">articleinfo.author_</xsl:text>
+ <xsl:value-of select="count(parent::author[preceding-sibling::author])"/>
+ <xsl:text disable-output-escaping="yes">.firstname_</xsl:text>
+ <xsl:value-of select="count(preceding-sibling::firstname)"/>
+ </xsl:if>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:element>
+ <xsl:element name="text:p">
+ <xsl:element name="text:variable-set">
+ <xsl:attribute name="text:value-type">
+ <xsl:text>string</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute name="text:name">
+ <xsl:if test="ancestor::articleinfo">
+ <xsl:text disable-output-escaping="yes">articleinfo.author_</xsl:text>
+ <xsl:value-of select="count(parent::author[preceding-sibling::author])"/>
+ <xsl:text disable-output-escaping="yes">.firstname_</xsl:text>
+ <xsl:value-of select="count(preceding-sibling::firstname)"/>
+ </xsl:if>
+ </xsl:attribute>
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+
+
+
+ <xsl:template match="articleinfo/copyright/year">
+ <xsl:element name="text:variable-decls">
+ <xsl:element name="text:variable-decl">
+ <xsl:attribute name="text:value-type">
+ <xsl:text>string</xsl:text>
+ </xsl:attribute>
+
+ <xsl:attribute name="text:name">
+ <xsl:if test="ancestor::articleinfo/copyright">
+ <xsl:text disable-output-escaping="yes">articleinfo.copyright_</xsl:text>
+ <xsl:value-of select="count(parent::copyright[preceding-sibling::copyright])"/>
+ <xsl:text disable-output-escaping="yes">.year_</xsl:text>
+ <xsl:value-of select="count(preceding-sibling::year)"/>
+ </xsl:if>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:element>
+ <xsl:element name="text:p">
+ <xsl:element name="text:variable-set">
+ <xsl:attribute name="text:value-type">
+ <xsl:text>string</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute name="text:name">
+ <xsl:if test="ancestor::articleinfo/copyright">
+ <xsl:text disable-output-escaping="yes">articleinfo.copyright_</xsl:text>
+ <xsl:value-of select="count(parent::copyright[preceding-sibling::copyright])"/>
+ <xsl:text disable-output-escaping="yes">.year_</xsl:text>
+ <xsl:value-of select="count(preceding-sibling::year)"/>
+ </xsl:if>
+ </xsl:attribute>
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="authorgroup">
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <xsl:template match="articleinfo/copyright/holder">
+ <xsl:element name="text:variable-decls">
+ <xsl:element name="text:variable-decl">
+ <xsl:attribute name="text:value-type">
+ <xsl:text>string</xsl:text>
+ </xsl:attribute>
+
+ <xsl:attribute name="text:name">
+ <xsl:if test="ancestor::articleinfo/copyright">
+ <xsl:text disable-output-escaping="yes">articleinfo.copyright_</xsl:text>
+ <xsl:value-of select="count(parent::copyright[preceding-sibling::copyright])"/>
+ <xsl:text disable-output-escaping="yes">.holder_</xsl:text>
+ <xsl:value-of select="count(preceding-sibling::holder)"/>
+ </xsl:if>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:element>
+ <xsl:element name="text:p">
+ <xsl:element name="text:variable-set">
+ <xsl:attribute name="text:value-type">
+ <xsl:text>string</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute name="text:name">
+ <xsl:if test="ancestor::articleinfo/copyright">
+ <xsl:text disable-output-escaping="yes">articleinfo.copyright_</xsl:text>
+ <xsl:value-of select="count(parent::copyright[preceding-sibling::copyright])"/>
+ <xsl:text disable-output-escaping="yes">.holder_</xsl:text>
+ <xsl:value-of select="count(preceding-sibling::holder)"/>
+ </xsl:if>
+ </xsl:attribute>
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+
+
+
+
+ <xsl:template name="affiliation">
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <xsl:template match="author/affiliation/address">
+ <xsl:element name="text:variable-decls">
+ <xsl:element name="text:variable-decl">
+ <xsl:attribute name="text:value-type">
+ <xsl:text>string</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute name="text:name">
+ <xsl:text disable-output-escaping="yes">articleinfo.author_</xsl:text>
+ <xsl:value-of select="count(ancestor::author[preceding-sibling::author])"/>
+ <xsl:text disable-output-escaping="yes">.affiliation_</xsl:text>
+ <xsl:value-of select="count(parent::affiliation[preceding-sibling::affiliation])"/>
+ <xsl:text disable-output-escaping="yes">.address_</xsl:text>
+ <xsl:value-of select="count(preceding-sibling::address)"/>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:element>
+ <xsl:element name="text:p">
+ <xsl:element name="text:variable-set">
+ <xsl:attribute name="text:value-type">
+ <xsl:text>string</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute name="text:name">
+ <xsl:text disable-output-escaping="yes">articleinfo.author_</xsl:text>
+ <xsl:value-of select="count(ancestor::author[preceding-sibling::author])"/>
+ <xsl:text disable-output-escaping="yes">.affiliation_</xsl:text>
+ <xsl:value-of select="count(parent::affiliation[preceding-sibling::affiliation])"/>
+ <xsl:text disable-output-escaping="yes">.address_</xsl:text>
+ <xsl:value-of select="count(preceding-sibling::address)"/>
+
+ </xsl:attribute>
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="author/affiliation/orgname">
+ <xsl:element name="text:variable-decls">
+ <xsl:element name="text:variable-decl">
+ <xsl:attribute name="text:value-type">
+ <xsl:text>string</xsl:text>
+ </xsl:attribute>
+ <xsl:if test="ancestor::articleinfo">
+ <xsl:attribute name="text:name">
+ <xsl:text disable-output-escaping="yes">articleinfo.author_</xsl:text>
+ <xsl:value-of select="count(ancestor::author[preceding-sibling::author])"/>
+ <xsl:text disable-output-escaping="yes">.affiliation_</xsl:text>
+ <xsl:value-of select="count(parent::affiliation[preceding-sibling::affiliation])"/>
+ <xsl:text disable-output-escaping="yes">.orgname_</xsl:text>
+ <xsl:value-of select="count(preceding-sibling::orgname)"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:element>
+ <xsl:element name="text:p">
+ <xsl:element name="text:variable-set">
+ <xsl:attribute name="text:value-type">
+ <xsl:text>string</xsl:text>
+ </xsl:attribute>
+ <xsl:if test="ancestor::articleinfo">
+ <xsl:attribute name="text:name">
+ <xsl:text disable-output-escaping="yes">articleinfo.author_</xsl:text>
+ <xsl:value-of select="count(ancestor::author[preceding-sibling::author])"/>
+ <xsl:text disable-output-escaping="yes">.affiliation_</xsl:text>
+ <xsl:value-of select="count(parent::affiliation[preceding-sibling::affiliation])"/>
+ <xsl:text disable-output-escaping="yes">.orgname_</xsl:text>
+ <xsl:value-of select="count(preceding-sibling::orgname)"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+
+
+
+ <xsl:template match="author/surname">
+ <xsl:element name="text:variable-decls">
+ <xsl:element name="text:variable-decl">
+ <xsl:attribute name="text:value-type">
+ <xsl:text>string</xsl:text>
+ </xsl:attribute>
+
+ <xsl:attribute name="text:name">
+ <xsl:text disable-output-escaping="yes">articleinfo.author_</xsl:text>
+ <xsl:value-of select="count(parent::author[preceding-sibling::author])"/>
+ <xsl:text disable-output-escaping="yes">.surname_</xsl:text>
+ <xsl:value-of select="count(preceding-sibling::surname)"/>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:element>
+ <xsl:element name="text:p">
+ <xsl:element name="text:variable-set">
+ <xsl:attribute name="text:value-type">
+ <xsl:text>string</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute name="text:name">
+ <xsl:text disable-output-escaping="yes">articleinfo.author_</xsl:text>
+ <xsl:value-of select="count(parent::author[preceding-sibling::author])"/>
+ <xsl:text disable-output-escaping="yes">.surname_</xsl:text>
+ <xsl:value-of select="count(preceding-sibling::surname)"/>
+
+
+ </xsl:attribute>
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+
+
+
+
+
+ <xsl:template match="para">
+
+ <xsl:element name="text:p">
+
+ <xsl:choose>
+ <xsl:when test="ancestor-or-self::footnote">
+ <xsl:attribute name="text:style-name">Footnote</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="ancestor-or-self::listitem">
+ <xsl:attribute name="text:style-name">VarList Item</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="ancestor-or-self::informaltable">
+ <xsl:if test="ancestor-or-self::informaltable">
+ <xsl:attribute name="text:style-name">Table Contents</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="ancestor-or-self::thead">
+ <xsl:attribute name="text:style-name">Table Heading</xsl:attribute>
+ </xsl:if>
+ </xsl:when>
+ <xsl:when test="ancestor-or-self::table">
+ <xsl:if test="ancestor-or-self::table">
+ <xsl:attribute name="text:style-name">Table Contents</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="ancestor-or-self::thead">
+ <xsl:attribute name="text:style-name">Table Heading</xsl:attribute>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="text:style-name">Text body</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ <xsl:apply-templates/>
+ </xsl:element>
+
+ </xsl:template>
+
+ <xsl:template match="section">
+ <xsl:element name="text:h">
+ <xsl:attribute name="text:level">
+ <xsl:value-of select="count(ancestor-or-self::section)"/>
+ </xsl:attribute>
+ <xsl:value-of select="child::title"/>
+ </xsl:element>
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <xsl:template match="abstract">
+ <xsl:element name="text:h">
+ <xsl:attribute name="text:level">1</xsl:attribute>
+ <xsl:text>abstract</xsl:text>
+ </xsl:element>
+ <xsl:apply-templates/>
+ </xsl:template>
+
+
+ <xsl:template match="appendix">
+ <xsl:element name="text:h">
+ <xsl:attribute name="text:level">1</xsl:attribute>
+ <xsl:text>appendix</xsl:text>
+ </xsl:element>
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <xsl:template match="sect1">
+ <xsl:element name="text:h">
+ <xsl:attribute name="text:level">1</xsl:attribute>
+ <xsl:attribute name="text:style-name">Heading 1</xsl:attribute>
+ <xsl:value-of select="child::title"/>
+ </xsl:element>
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <xsl:template match="sect2">
+ <xsl:element name="text:h">
+ <xsl:attribute name="text:level">2</xsl:attribute>
+ <xsl:attribute name="text:style-name">Heading 2</xsl:attribute>
+ <xsl:value-of select="child::title"/>
+ </xsl:element>
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <xsl:template match="sect3">
+ <xsl:element name="text:h">
+ <xsl:attribute name="text:level">3</xsl:attribute>
+ <xsl:attribute name="text:style-name">Heading 3</xsl:attribute>
+ <xsl:value-of select="child::title"/>
+ </xsl:element>
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <xsl:template match="sect4">
+ <xsl:element name="text:h">
+ <xsl:attribute name="text:level">4</xsl:attribute>
+ <xsl:attribute name="text:style-name">Heading 4</xsl:attribute>
+ <xsl:value-of select="child::title"/>
+ </xsl:element>
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <xsl:template match="sect5">
+ <xsl:element name="text:h">
+ <xsl:attribute name="text:level">5</xsl:attribute>
+ <xsl:value-of select="child::title"/>
+ </xsl:element>
+ <xsl:apply-templates/>
+ </xsl:template>
+
+<!--<xsl:template match="sect5">
+ <xsl:element name="text:section">
+ <xsl:attribute name="text:style-name">Sect1</xsl:attribute>
+ <xsl:attribute name="text:name"><xsl:value-of select="@id"/></xsl:attribute>
+ <xsl:apply-templates/>
+ </xsl:element>
+</xsl:template>-->
+
+
+ <xsl:template match="informaltable">
+ <xsl:element name="table:table">
+ <xsl:attribute name="table:name"></xsl:attribute>
+ <xsl:attribute name="table:style-name">Table1</xsl:attribute>
+ <xsl:attribute name="table:name">
+ <xsl:value-of select="@id"/>
+ </xsl:attribute>
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:template>
+
+
+ <xsl:template match="table">
+ <xsl:variable name="tabletitle">
+ <xsl:value-of select="title"/>
+ </xsl:variable>
+ <xsl:element name="table:table">
+ <xsl:attribute name="table:name"></xsl:attribute>
+ <xsl:attribute name="table:style-name">Table1</xsl:attribute>
+ <xsl:attribute name="table:name">
+ <xsl:value-of select="@id"/>
+ </xsl:attribute>
+ <xsl:apply-templates/>
+ </xsl:element>
+ <xsl:if test="not($tabletitle='')">
+ <xsl:element name="text:p">
+ <xsl:attribute name="text:style-name">Table</xsl:attribute>
+ <xsl:value-of select="$tabletitle"/>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template match="tgroup">
+ <xsl:element name="table:table-column">
+ <xsl:attribute name="table:style-name">Table1.A</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="@cols >0">
+ <xsl:attribute name="table:number-columns-repeated">
+ <xsl:value-of select="@cols"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="table:number-columns-repeated">
+ <xsl:value-of select="count(child::tbody/row/entry) div count(child::tbody/row)"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:apply-templates/>
+ </xsl:template>
+
+
+ <xsl:template match="indexterm"></xsl:template>
+
+ <xsl:template match="thead">
+ <xsl:element name="table:table-header-rows">
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="tbody">
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <xsl:template match="row">
+ <xsl:element name="table:table-row">
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="entry">
+ <xsl:element name="table:table-cell">
+ <xsl:if test="ancestor-or-self::thead">
+ <xsl:attribute name="table:style-name">Table1.A1</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="not(ancestor-or-self::thead)">
+ <xsl:attribute name="table:style-name">Table1.A2</xsl:attribute>
+ </xsl:if>
+
+ <xsl:choose>
+ <xsl:when test="@spanname">
+ <!--<xsl:if test="@spanname">-->
+ <xsl:variable name="sname">
+ <xsl:value-of select="@spanname"/>
+ </xsl:variable>
+ <xsl:attribute name="table:number-columns-spanned">
+ <xsl:variable name="colnamestart">
+ <xsl:value-of select="ancestor::tgroup/spanspec[@spanname=$sname]/@namest"/>
+ </xsl:variable>
+ <xsl:variable name="colnameend">
+ <xsl:value-of select="ancestor::tgroup/spanspec[@spanname=$sname]/@nameend"/>
+ </xsl:variable>
+ <xsl:variable name="colnumstart">
+ <xsl:value-of select="ancestor::tgroup/colspec[@colname=$colnamestart]/@colnum"/>
+ </xsl:variable>
+ <xsl:variable name="colnumend">
+ <xsl:value-of select="ancestor::tgroup/colspec[@colname=$colnameend]/@colnum"/>
+ </xsl:variable>
+ <xsl:value-of select="$colnumend - $colnumstart + 1"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@namest and @nameend">
+ <!--<xsl:if test="@namest and @nameend">-->
+ <xsl:variable name="colnamestart">
+ <xsl:value-of select="@namest"/>
+ </xsl:variable>
+ <xsl:variable name="colnameend">
+ <xsl:value-of select="@nameend"/>
+ </xsl:variable>
+
+ <xsl:attribute name="table:number-columns-spanned">
+ <xsl:variable name="colnumstart">
+ <xsl:value-of select="ancestor::tgroup/colspec[@colname=$colnamestart]/@colnum"/>
+ </xsl:variable>
+ <xsl:variable name="colnumend">
+ <xsl:value-of select="ancestor::tgroup/colspec[@colname=$colnameend]/@colnum"/>
+ </xsl:variable>
+ <xsl:value-of select="$colnumend - $colnumstart + 1"/>
+
+ </xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <!--
+ <xsl:if test="not(@namest = '' ) ">
+ <xsl:attribute name="table:number-columns-spanned">
+ <xsl:value-of select="(substring-after(@nameend,'c')-substring-after(@namest,'c'))+1"/>
+
+ </xsl:attribute>
+ </xsl:if>
+ -->
+ <xsl:choose>
+ <xsl:when test="not(child::para)">
+ <xsl:element name="text:p">
+ <xsl:if test="ancestor-or-self::thead">
+ <xsl:attribute name="text:style-name">Table Heading</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="ancestor-or-self::tbody">
+ <xsl:attribute name="text:style-name">Table Contents</xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:template>
+
+
+
+
+
+
+ <xsl:template match="figure">
+ <xsl:apply-templates/>
+ </xsl:template>
+
+<!-- lists Section -->
+
+ <xsl:template match="itemizedlist">
+ <xsl:element name="text:unordered-list">
+ <xsl:if test="not(ancestor::itemizedlist)">
+ <xsl:attribute name="text:style-name">L1</xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="variablelist">
+ <xsl:element name="text:unordered-list">
+ <xsl:attribute name="text:style-name">Var List</xsl:attribute>
+ <xsl:attribute name="text:continue-numbering">false</xsl:attribute>
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="orderedlist">
+ <xsl:element name="text:ordered-list">
+ <xsl:attribute name="text:style-name">Ordered List</xsl:attribute>
+ <xsl:attribute name="text:continue-numbering">false</xsl:attribute>
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="term">
+ <xsl:if test="parent::varlistentry">
+ <text:list-item>
+ <xsl:element name="text:p">
+ <xsl:attribute name="text:style-name">VarList Term</xsl:attribute>
+ <xsl:apply-templates/>
+ </xsl:element>
+ </text:list-item>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template match="listitem">
+ <text:list-item>
+ <xsl:apply-templates/>
+ </text:list-item>
+ </xsl:template>
+
+<!-- end of lists-->
+
+ <xsl:template match="menuchoice">
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <xsl:template match="guimenuitem">
+ <xsl:element name="text:span">
+ <xsl:attribute name="text:style-name">GuiMenuItem</xsl:attribute>
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="guibutton">
+ <xsl:element name="text:span">
+ <xsl:attribute name="text:style-name">GuiButton</xsl:attribute>
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="guisubmenu">
+ <xsl:element name="text:span">
+ <xsl:attribute name="text:style-name">GuiSubMenu</xsl:attribute>
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="emphasis">
+ <xsl:element name="text:span">
+ <xsl:attribute name="text:style-name">Emphasis</xsl:attribute>
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:template>
+
+
+ <xsl:template match="guimenu">
+ <xsl:element name="text:span">
+ <xsl:attribute name="text:style-name">GuiMenu</xsl:attribute>
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="guisubmenu">
+ <xsl:element name="text:span">
+ <xsl:attribute name="text:style-name">GuiSubMenu</xsl:attribute>
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:template>
+
+
+ <xsl:template match="guilabel">
+ <xsl:element name="text:span">
+ <xsl:attribute name="text:style-name">GuiLabel</xsl:attribute>
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="guibutton">
+ <xsl:element name="text:span">
+ <xsl:attribute name="text:style-name">GuiButton</xsl:attribute>
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="keycap">
+ <xsl:element name="text:span">
+ <xsl:attribute name="text:style-name">KeyCap</xsl:attribute>
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:template>
+
+
+ <xsl:template match="keysym">
+ <xsl:element name="text:span">
+ <xsl:attribute name="text:style-name">KeySym</xsl:attribute>
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:template>
+
+
+ <xsl:template match="keycombo">
+ <xsl:element name="text:span">
+ <xsl:attribute name="text:style-name">KeyCombo</xsl:attribute>
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="command">
+ <xsl:element name="text:span">
+ <xsl:attribute name="text:style-name">Command</xsl:attribute>
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="application">
+ <xsl:element name="text:span">
+ <xsl:attribute name="text:style-name">Application</xsl:attribute>
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="filename">
+ <xsl:element name="text:span">
+ <xsl:attribute name="text:style-name">FileName</xsl:attribute>
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="systemitem">
+ <xsl:element name="text:span">
+ <xsl:attribute name="text:style-name">SystemItem</xsl:attribute>
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="computeroutput">
+ <xsl:element name="text:span">
+ <xsl:attribute name="text:style-name">ComputerOutput</xsl:attribute>
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="inlinegraphic">
+ <xsl:element name="draw:image">
+ <xsl:attribute name="draw:style-name">fr1</xsl:attribute>
+ <xsl:attribute name="draw:name"></xsl:attribute>
+ <xsl:attribute name="text:anchor-type"></xsl:attribute>
+ <xsl:attribute name="draw:z-index"></xsl:attribute>
+ <xsl:attribute name="xlink:href">
+ <xsl:value-of select="@fileref"/>
+ </xsl:attribute>
+ <xsl:attribute name="xlink:type"></xsl:attribute>
+ <xsl:attribute name="svg:width">
+ <!--<xsl:value-of select="@width"/>-->
+ <xsl:text>1cm</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute name="svg:height">
+ <xsl:text>1cm</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute name="xlink:show">
+ <xsl:text>embed</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute name="xlink:actuate">
+ <xsl:text>onLoad</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute name="draw:filter-name">
+ <xsl:text disable-output-escaping="yes">&lt;All formats&gt;</xsl:text>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:template>
+
+
+ <xsl:template match="footnote">
+ <xsl:element name="text:footnote">
+ <!--<xsl:element name="text:footnote-citation">Aidan</xsl:element>-->
+ <xsl:element name="text:footnote-body">
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="highlight">
+ <xsl:element name="text:span">
+ <xsl:attribute name="text:style-name">Highlight</xsl:attribute>
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="ulink">
+ <xsl:element name="text:a">
+ <xsl:attribute name="xlink:type">
+ <xsl:text>simple</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute name="xlink:href">
+ <xsl:value-of select="@url"/>
+ </xsl:attribute>
+ <xsl:apply-templates/>
+ </xsl:element>
+
+ </xsl:template>
+
+ <xsl:template match="link">
+ <xsl:element name="text:a">
+ <xsl:attribute name="xlink:type">
+ <xsl:text>simple</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute name="xlink:href">
+ <xsl:text>#</xsl:text>
+ <xsl:value-of select="@linkend"/>
+ <xsl:text>%7Cregion</xsl:text>
+ </xsl:attribute>
+ <xsl:apply-templates/>
+ </xsl:element>
+
+ </xsl:template>
+
+ <xsl:template match="olink">
+ <xsl:element name="text:a">
+ <xsl:attribute name="xlink:type">
+ <xsl:text>simple</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute name="xlink:href">
+ <xsl:value-of select="@targetdocent"/>
+ </xsl:attribute>
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="note">
+ <office:annotation>
+ <text:p>
+ <xsl:apply-templates/>
+ </text:p>
+ </office:annotation>
+ </xsl:template>
+
+ <xsl:template match="imageobject">
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <xsl:template match="textobject"></xsl:template>
+
+ <xsl:template match="caption">
+ <xsl:apply-templates/>
+ </xsl:template>
+
+
+ <xsl:template match="imagedata">
+ <xsl:element name="draw:image">
+ <xsl:attribute name="draw:style-name">fr1</xsl:attribute>
+ <xsl:attribute name="draw:name"></xsl:attribute>
+ <xsl:attribute name="text:anchor-type"></xsl:attribute>
+ <xsl:attribute name="draw:z-index"></xsl:attribute>
+ <xsl:attribute name="xlink:href">
+ <xsl:value-of select="@fileref"/>
+ </xsl:attribute>
+ <xsl:attribute name="xlink:type"></xsl:attribute>
+ <xsl:attribute name="svg:width">
+ <!--<xsl:value-of select="@width"/>-->
+ <xsl:text>1cm</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute name="svg:height">
+ <xsl:text>1cm</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute name="xlink:show">
+ <xsl:text>embed</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute name="xlink:actuate">
+ <xsl:text>onLoad</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute name="draw:filter-name">
+ <xsl:text disable-output-escaping="yes">&lt;All formats&gt;</xsl:text>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="audioobject">
+ <xsl:element name="draw:plugin">
+ <xsl:attribute name="draw:style-name">fr1</xsl:attribute>
+ <xsl:attribute name="draw:name"></xsl:attribute>
+ <xsl:attribute name="text:anchor-type"></xsl:attribute>
+ <xsl:attribute name="draw:z-index"></xsl:attribute>
+ <xsl:attribute name="xlink:href">
+ <xsl:value-of select="@fileref"/>
+ </xsl:attribute>
+ <xsl:attribute name="xlink:type"></xsl:attribute>
+ <xsl:attribute name="svg:width">
+ <!--<xsl:value-of select="@width"/>-->
+ <xsl:text>1cm</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute name="svg:height">
+ <xsl:text>1cm</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute name="xlink:show">
+ <xsl:text>embed</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute name="xlink:actuate">
+ <xsl:text>onLoad</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute name="draw:filter-name">
+ <xsl:text disable-output-escaping="yes">&lt;All formats&gt;</xsl:text>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="remark">
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <xsl:template match="mediaobject">
+ <xsl:element name="text:p">
+ <xsl:attribute name="text:style-name">Mediaobject</xsl:attribute>
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="superscript">
+ <xsl:element name="text:span">
+ <xsl:attribute name="text:style-name">SuperScript</xsl:attribute>
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="subscript">
+ <xsl:element name="text:span">
+ <xsl:attribute name="text:style-name">SubScript</xsl:attribute>
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="anchor">
+ <xsl:element name="text:bookmark">
+ <xsl:attribute name="text:name"><xsl:value-of select="@id"/></xsl:attribute>
+ </xsl:element>
+ </xsl:template>
+
+<!-- Change Made By Kevin Fowlks (fowlks@msu.edu) July 2nd, 2003 -->
+ <xsl:template match="example">
+ <xsl:element name="text:p">
+ <xsl:attribute name="text:style-name">Example</xsl:attribute>
+ <xsl:value-of select="programlisting"/>
+ </xsl:element>
+ </xsl:template>
+</xsl:stylesheet> \ No newline at end of file
diff --git a/filter/source/docbook/makefile.mk b/filter/source/docbook/makefile.mk
new file mode 100644
index 000000000000..b3b43d5cbd02
--- /dev/null
+++ b/filter/source/docbook/makefile.mk
@@ -0,0 +1,51 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ=..$/..
+PRJNAME=filter
+TARGET=fl_javafilter_binaries
+
+.INCLUDE: settings.mk
+
+all: \
+ $(BIN)$/docbooktosoffheadings.xsl \
+ $(BIN)$/sofftodocbookheadings.xsl \
+ $(BIN)$/DocBookTemplate.stw
+
+
+
+$(OUT)$/bin$/docbooktosoffheadings.xsl: docbooktosoffheadings.xsl
+ $(COPY) docbooktosoffheadings.xsl $(OUT)$/bin$/docbooktosoffheadings.xsl
+
+$(OUT)$/bin$/sofftodocbookheadings.xsl: sofftodocbookheadings.xsl
+ $(COPY) sofftodocbookheadings.xsl $(OUT)$/bin$/sofftodocbookheadings.xsl
+
+$(OUT)$/bin$/DocBookTemplate.stw: DocBookTemplate.stw
+ $(COPY) DocBookTemplate.stw $(OUT)$/bin$/DocBookTemplate.stw
+
+.INCLUDE: target.mk
+
diff --git a/filter/source/docbook/sofftodocbookheadings.xsl b/filter/source/docbook/sofftodocbookheadings.xsl
new file mode 100644
index 000000000000..bc9b67a9a340
--- /dev/null
+++ b/filter/source/docbook/sofftodocbookheadings.xsl
@@ -0,0 +1,1185 @@
+<?xml version='1.0' encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<xsl:stylesheet version="1.0" xmlns:style="http://openoffice.org/2000/style" xmlns:text="http://openoffice.org/2000/text" xmlns:office="http://openoffice.org/2000/office" xmlns:table="http://openoffice.org/2000/table" xmlns:draw="http://openoffice.org/2000/drawing" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="http://openoffice.org/2000/meta" xmlns:number="http://openoffice.org/2000/datastyle" xmlns:svg="http://www.w3.org/2000/svg" xmlns:chart="http://openoffice.org/2000/chart" xmlns:dr3d="http://openoffice.org/2000/dr3d" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="http://openoffice.org/2000/form" xmlns:script="http://openoffice.org/2000/script" xmlns:config="http://openoffice.org/2001/config" office:class="text" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="office meta table number dc fo xlink chart math script xsl draw svg dr3d form config text style">
+ <xsl:output method="xml" indent="yes" omit-xml-declaration="no" version="1.0" encoding="UTF-8" doctype-public="-//OASIS//DTD DocBook XML V4.1.2//EN" doctype-system="http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"/>
+
+
+ <!-- Heading will be mapped to sections.
+ In OpenDocument headings are not nested, they do not embrace their related content, the XML hierarchy has to be restructured.
+
+ Example of OpenDocument content:
+
+ <office:body>
+ <text:h text:style-name="Heading 1" text:level="1">Heading 1</text:h>
+ <text:p text:style-name="Text body">Heading 1 Content</text:p>
+ <text:h text:style-name="Heading 2" text:level="2">Heading 2</text:h>
+ <text:p text:style-name="Text body">Heading 2 Content</text:p>
+ <office:body>
+
+ Example of DocBook content:
+
+ <article lang="en-US">
+ <sect1>
+ <title>Heading 1</title>
+ <para>Heading 1 Content</para>
+ <sect2>
+ <title>Heading 2</title>
+ <para>Heading 2 Content</para>
+ </sect2>
+ </sect1>
+ </article>
+ -->
+
+ <!-- The key function "nestedContent" returns all ODF elements that are children of the current heading (i.e. text:h) or their parent office:body in case there is no text:h.
+ It works by matching all ODF elements, that text:h refer to (it's sibling or office:body childring)
+ Various keyed element sets of these matched elements are being generated. A set is identified by having the same last (closest) preceding text:h or if none exisitent the parent document.
+ All those elements, that have the current heading as last preceding heading (text:h) are returned as a nodeset.
+ -->
+ <xsl:key name="nestedContent"
+ match="text:p | table:table | text:span | text:ordered-list | office:annotation | text:unordered-list | text:footnote | text:a | text:list-item | draw:plugin | draw:text-box | text:footnote-body | text:section"
+ use="generate-id((.. | preceding::text:h)[last()])"/>
+
+ <!-- The key function "nestedHeadings" returns a nodeset of all heading (text:h) elements, which belong to this heading (follow and have a higher outline number than the current text:h, which ID is given to the function) -->
+ <xsl:key name="nestedHeadings"
+ match="text:h"
+ use="generate-id(preceding::text:h[@text:level &lt; current()/@text:level][1])"/>
+
+ <!-- All those headings have not the lowest outline level (mapped to section1), but come before the first heading mapped to section1 -->
+ <xsl:key name="preludingHeadings"
+ match="text:h"
+ use="generate-id(following::text:h[@text:level = $section1_OutlineLevel][1])"/>
+
+ <!-- The key function "getHeadingsByOutline" returns all headings of a certain outline level -->
+ <xsl:key name="getHeadingsByOutline"
+ match="text:h"
+ use="@text:level"/>
+
+ <!-- A further problem during mapping of Heading to sections is the quantity of levels. In OpenDocument there can exist more than 4 hierarchies (outline levels).
+ Furthermore an OpenDocument have not to start with heading outline level 1 nor does a outline level 2 have to follow.
+ Therefore all possible existing heading outline levels from 1 to 10 have to be mapped to the section1 to section4 in DocBook.
+ The lowest outline number is mapped section1, second is section2... until fourth and higher are all mapped to section4 -->
+
+ <!-- Each global variable hold the outline level which has been mapped to one of the four sections in DocBook -->
+ <xsl:variable name="section1_OutlineLevel">
+ <xsl:call-template name="findOutlineLevel">
+ <xsl:with-param name="candidateOutlineLevel" select="1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="section2_OutlineLevel">
+ <xsl:call-template name="findOutlineLevel">
+ <xsl:with-param name="candidateOutlineLevel" select="$section1_OutlineLevel + 1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="section3_OutlineLevel">
+ <xsl:call-template name="findOutlineLevel">
+ <xsl:with-param name="candidateOutlineLevel" select="$section2_OutlineLevel + 1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="section4_OutlineLevel">
+ <xsl:call-template name="findOutlineLevel">
+ <xsl:with-param name="candidateOutlineLevel" select="$section3_OutlineLevel + 1"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <!-- get the minimum available heading outline level (usually '1') -->
+ <xsl:template name="findOutlineLevel">
+ <xsl:param name="candidateOutlineLevel"/>
+ <xsl:choose>
+ <xsl:when test="key('getHeadingsByOutline', $candidateOutlineLevel)[1]/@text:level != ''">
+ <xsl:value-of select="$candidateOutlineLevel"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="$candidateOutlineLevel &lt; 11">
+ <xsl:call-template name="findOutlineLevel">
+ <xsl:with-param name="candidateOutlineLevel" select="$candidateOutlineLevel + 1"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <!-- START -->
+ <xsl:template match="/*">
+ <xsl:element name="article">
+ <xsl:attribute name="lang">
+ <xsl:value-of select="/*/office:meta/dc:language"/>
+ </xsl:attribute>
+ <!-- page style header -->
+ <xsl:call-template name="page-style">
+ <xsl:with-param name="area" select="'header'"/>
+ </xsl:call-template>
+ <xsl:apply-templates select="office:body"/>
+ <!-- page style footer -->
+ <xsl:call-template name="page-style"/>
+ </xsl:element>
+ </xsl:template>
+
+
+ <xsl:key match="style:master-page" name="styleMasterPage" use="@style:name" />
+ <!-- using a simple heuristic for "standard" page-style heading/footer from page styles -->
+ <xsl:template name="page-style">
+ <xsl:param name="area"/>
+
+ <xsl:variable name="defaultPageStyle" select="key('styleMasterPage', 'Standard')"/>
+ <xsl:choose>
+ <xsl:when test="$area = 'header'">
+ <xsl:apply-templates select="$defaultPageStyle/style:header/*"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="$defaultPageStyle/style:footer/*"/>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ </xsl:template>
+
+ <xsl:template match="office:body">
+ <!-- here all children of office:body before the first heading are matched -->
+ <xsl:apply-templates select="key('nestedContent', generate-id())"/>
+ <!-- have to be descendant as text:h can be in a list:item in some list -->
+ <xsl:variable name="firstHeading" select="descendant::text:h[1]"/>
+ <!-- changing the context node from office:body to text:h as required for used key functions -->
+ <xsl:for-each select="descendant::text:h[@text:level=$section1_OutlineLevel][1]">
+ <!-- if the first heading is not of the section1 level -->
+ <xsl:if test="generate-id(.) != generate-id($firstHeading)">
+ <!-- create an anonymous section1 and embrace all headings preceding the first real existent section1 -->
+ <xsl:text disable-output-escaping="yes">&lt;sect1&gt;</xsl:text>
+ <title></title>
+ <!-- create sections for all the first section1 preluding headings -->
+ <xsl:for-each select="key('preludingHeadings', generate-id())">
+ <xsl:call-template name="make-section">
+ <xsl:with-param name="previousSectionLevel" select="$section1_OutlineLevel"/>
+ <xsl:with-param name="currentSectionLevel">
+ <xsl:call-template name="getSectionLevel">
+ <xsl:with-param name="outlineLevel" select="@text:level"/>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:for-each>
+ <xsl:text disable-output-escaping="yes">&lt;/sect1&gt;</xsl:text>
+ </xsl:if>
+ </xsl:for-each>
+ <!-- match all headings, which are mapped to section1 to create a nested section structure used in docbook (see first comment after copyright) -->
+ <xsl:apply-templates mode="recreateStructure" select="descendant::text:h[@text:level = $section1_OutlineLevel]"/>
+ </xsl:template>
+
+ <xsl:template match="text:h" mode="recreateStructure">
+ <!-- relate the current ODF outline level of the heading to one of the four docbook section levels-->
+ <xsl:variable name="currentSectionLevel">
+ <xsl:call-template name="getSectionLevel">
+ <xsl:with-param name="outlineLevel" select="@text:level"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <!-- heading with outline level 1 might be an Abstract -->
+ <xsl:when test="$currentSectionLevel = 1">
+ <xsl:choose>
+ <!-- when the content of a level 1 heading is 'Abstract' the <abstract> docbook element is used instead of <section1> -->
+ <xsl:when test=".='Abstract'">
+ <abstract>
+ <xsl:apply-templates select="key('nestedContent', generate-id())"/>
+ <xsl:apply-templates select="key('nestedHeadings', generate-id())" mode="recreateStructure"/>
+ </abstract>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="make-section">
+ <xsl:with-param name="currentSectionLevel" select="$currentSectionLevel"/>
+ <xsl:with-param name="previousSectionLevel" select="$currentSectionLevel"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="previousHeading" select="preceding::text:h[@text:level &lt; current()/@text:level][1]"/>
+ <xsl:choose>
+ <xsl:when test="$previousHeading/@text:level != ''">
+ <xsl:call-template name="make-section">
+ <xsl:with-param name="currentSectionLevel" select="$currentSectionLevel"/>
+ <xsl:with-param name="previousSectionLevel">
+ <xsl:call-template name="getSectionLevel">
+ <xsl:with-param name="outlineLevel" select="$previousHeading/@text:level"/>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="make-section">
+ <xsl:with-param name="currentSectionLevel" select="$currentSectionLevel"/>
+ <xsl:with-param name="previousSectionLevel" select="$currentSectionLevel"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="text:bookmark | text:bookmark-start">
+ <xsl:element name="anchor">
+ <xsl:attribute name="id">
+ <!-- ID have to be an NCName which have to start with a letter or '_'
+ in case of the frequent starting number a '_' will be added as prefix -->
+ <xsl:choose>
+ <xsl:when test="(starts-with(@text:name, '0') or
+ starts-with(@text:name, '1') or
+ starts-with(@text:name, '2') or
+ starts-with(@text:name, '3') or
+ starts-with(@text:name, '4') or
+ starts-with(@text:name, '5') or
+ starts-with(@text:name, '6') or
+ starts-with(@text:name, '7') or
+ starts-with(@text:name, '8') or
+ starts-with(@text:name, '9'))">
+ <xsl:value-of select="concat('_', @text:name)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="@text:name"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template name="getSectionLevel">
+ <xsl:param name="outlineLevel"/>
+ <xsl:choose>
+ <xsl:when test="$outlineLevel = $section1_OutlineLevel">1</xsl:when>
+ <xsl:when test="$outlineLevel = $section2_OutlineLevel">2</xsl:when>
+ <xsl:when test="$outlineLevel = $section3_OutlineLevel">3</xsl:when>
+ <xsl:otherwise>4</xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- make-section creates the nested section hierarchy and
+ in case the difference between the parent section and the new section is higher than one
+ a section is inserted to keep the output format valid -->
+ <xsl:template name="make-section">
+ <xsl:param name="currentSectionLevel"/>
+ <xsl:param name="previousSectionLevel"/>
+ <xsl:choose>
+ <!-- empty title as it is an empty section between two headings with an outline level difference higher than 1 -->
+ <xsl:when test="$currentSectionLevel &gt; $previousSectionLevel+1">
+ <xsl:text disable-output-escaping="yes">&lt;sect</xsl:text>
+ <xsl:value-of select="$previousSectionLevel +1"/>
+ <xsl:text disable-output-escaping="yes">&gt;</xsl:text>
+ <title></title>
+ <xsl:call-template name="make-section">
+ <xsl:with-param name="currentSectionLevel" select="$currentSectionLevel"/>
+ <xsl:with-param name="previousSectionLevel" select="$previousSectionLevel +1"/>
+ </xsl:call-template>
+ <xsl:text disable-output-escaping="yes">&lt;/sect</xsl:text>
+ <xsl:value-of select="$previousSectionLevel +1"/>
+ <xsl:text disable-output-escaping="yes">&gt;</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text disable-output-escaping="yes">&lt;sect</xsl:text>
+ <xsl:value-of select="$currentSectionLevel"/>
+ <xsl:text disable-output-escaping="yes">&gt;</xsl:text>
+ <title>
+ <xsl:apply-templates/>
+ </title>
+ <xsl:apply-templates select="key('nestedContent', generate-id())"/>
+ <xsl:apply-templates select="key('nestedHeadings', generate-id())" mode="recreateStructure"/>
+ <xsl:text disable-output-escaping="yes">&lt;/sect</xsl:text>
+ <xsl:value-of select="$currentSectionLevel"/>
+ <xsl:text disable-output-escaping="yes">&gt;</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <xsl:template match="office:meta">
+ <!--<xsl:apply-templates/>--></xsl:template>
+
+ <xsl:template match="meta:editing-cycles"></xsl:template>
+
+ <xsl:template match="meta:user-defined"></xsl:template>
+
+ <xsl:template match="meta:editing-duration"></xsl:template>
+
+ <xsl:template match="dc:language"></xsl:template>
+
+ <xsl:template match="dc:date">
+ <!--<pubdate>
+ <xsl:value-of select="substring-before(.,'T')"/>
+ </pubdate>--></xsl:template>
+
+ <xsl:template match="meta:creation-date"></xsl:template>
+
+ <xsl:template match="office:styles">
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <xsl:template match="office:script"></xsl:template>
+
+
+ <xsl:template match="office:settings"></xsl:template>
+
+ <xsl:template match="office:font-decls"></xsl:template>
+
+ <xsl:template match="text:section">
+ <xsl:choose>
+ <xsl:when test="@text:name='ArticleInfo'">
+ <articleinfo>
+ <title>
+ <xsl:value-of select="text:p[@text:style-name='Document Title']"/>
+ </title>
+ <subtitle>
+ <xsl:value-of select="text:p[@text:style-name='Document SubTitle']"/>
+ </subtitle>
+ <edition>
+ <xsl:value-of select="text:p/text:variable-set[@text:name='articleinfo.edition']"/>
+ </edition>
+ <xsl:for-each select="text:p/text:variable-set[substring-after(@text:name,'articleinfo.releaseinfo')]">
+ <releaseinfo>
+ <xsl:value-of select="."/>
+ </releaseinfo>
+ </xsl:for-each>
+ <xsl:call-template name="ArticleInfo">
+ <xsl:with-param name="level" select="0"/>
+ </xsl:call-template>
+ </articleinfo>
+ </xsl:when>
+ <xsl:when test="@text:name='Abstract'">
+ <abstract>
+ <xsl:apply-templates/>
+ </abstract>
+ </xsl:when>
+ <xsl:when test="@text:name='Appendix'">
+ <appendix>
+ <xsl:apply-templates/>
+ </appendix>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="sectvar">
+ <xsl:text>sect</xsl:text>
+ <xsl:value-of select="count(ancestor::text:section)+1"/>
+ </xsl:variable>
+ <xsl:variable name="idvar">
+ <xsl:text> id="</xsl:text>
+ <xsl:value-of select="@text:name"/>
+ <xsl:text>"</xsl:text>
+ </xsl:variable>
+ <xsl:text disable-output-escaping="yes">&lt;</xsl:text>
+ <xsl:value-of select="$sectvar"/>
+ <xsl:value-of select="$idvar"/>
+ <xsl:text disable-output-escaping="yes">&gt;</xsl:text>
+ <xsl:apply-templates/>
+ <xsl:text disable-output-escaping="yes">&lt;/</xsl:text>
+ <xsl:value-of select="$sectvar"/>
+ <xsl:text disable-output-escaping="yes">&gt;</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="ArticleInfo">
+ <xsl:param name="level"/>
+ <xsl:variable name="author">
+ <xsl:value-of select="concat('articleinfo.author_','', $level)"/>
+ </xsl:variable>
+ <xsl:if test="text:p/text:variable-set[contains(@text:name, $author )]">
+ <xsl:call-template name="Author">
+ <xsl:with-param name="AuthorLevel" select="0"/>
+ </xsl:call-template>
+ <xsl:call-template name="Copyright">
+ <xsl:with-param name="CopyrightLevel" select="0"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template name="Copyright">
+ <xsl:param name="CopyrightLevel"/>
+
+ <xsl:variable name="Copyright">
+ <xsl:value-of select="concat('articleinfo.copyright_','', $CopyrightLevel)"/>
+ </xsl:variable>
+
+ <xsl:if test="text:p/text:variable-set[contains(@text:name,$Copyright)]">
+ <copyright>
+ <xsl:call-template name="Year">
+ <xsl:with-param name="CopyrightLevel" select="$CopyrightLevel"/>
+ <xsl:with-param name="YearlLevel" select="0"/>
+ </xsl:call-template>
+ <xsl:call-template name="Holder">
+ <xsl:with-param name="CopyrightLevel" select="$CopyrightLevel"/>
+ <xsl:with-param name="HolderlLevel" select="0"/>
+
+ </xsl:call-template>
+ </copyright>
+ </xsl:if>
+ </xsl:template>
+
+
+ <xsl:template name="Year">
+ <xsl:param name="CopyrightLevel"/>
+ <xsl:param name="YearLevel"/>
+ <xsl:variable name="Copyright">
+ <xsl:value-of select="concat('articleinfo.copyright_','', $CopyrightLevel)"/>
+ </xsl:variable>
+ <xsl:variable name="Year">
+ <xsl:value-of select="concat($Copyright,'',concat('.year_','',$YearLevel))"/>
+ </xsl:variable>
+
+ <xsl:if test="text:p/text:variable-set[@text:name=$Year]">
+ <orgname>
+ <xsl:value-of select="text:p/text:variable-set[@text:name=$Year]"/>
+ </orgname>
+ </xsl:if>
+ </xsl:template>
+
+
+ <xsl:template name="Holder">
+ <xsl:param name="CopyrightLevel"/>
+ <xsl:param name="HolderLevel"/>
+ <xsl:variable name="Copyright">
+ <xsl:value-of select="concat('articleinfo.copyright_','', $CopyrightLevel)"/>
+ </xsl:variable>
+ <xsl:variable name="Holder">
+ <xsl:value-of select="concat($Copyright,'',concat('.holder_','',$HolderLevel))"/>
+ </xsl:variable>
+
+ <xsl:if test="text:p/text:variable-set[@text:name=$Holder]">
+ <orgname>
+ <xsl:value-of select="text:p/text:variable-set[@text:name=$Holder]"/>
+ </orgname>
+ </xsl:if>
+ </xsl:template>
+
+
+
+ <xsl:template name="Author">
+ <xsl:param name="AuthorLevel"/>
+ <xsl:variable name="Author">
+ <xsl:value-of select="concat('articleinfo.author_','', $AuthorLevel)"/>
+ </xsl:variable>
+ <xsl:if test="text:p/text:variable-set[contains(@text:name, $Author )]">
+ <author>
+ <xsl:call-template name="Surname">
+ <xsl:with-param name="AuthorLevel" select="$AuthorLevel"/>
+ <xsl:with-param name="SurnameLevel" select="0"/>
+ </xsl:call-template>
+ <xsl:call-template name="Firstname">
+ <xsl:with-param name="AuthorLevel" select="$AuthorLevel"/>
+ <xsl:with-param name="FirstnameLevel" select="0"/>
+ </xsl:call-template>
+ <xsl:call-template name="Affiliation">
+ <xsl:with-param name="AuthorLevel" select="$AuthorLevel"/>
+ <xsl:with-param name="AffilLevel" select="0"/>
+ </xsl:call-template>
+ </author>
+ <xsl:call-template name="Author">
+ <xsl:with-param name="AuthorLevel" select="$AuthorLevel+1"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+
+
+ <xsl:template name="Surname">
+ <xsl:param name="AuthorLevel"/>
+ <xsl:param name="SurnameLevel"/>
+ <xsl:variable name="Author">
+ <xsl:value-of select="concat('articleinfo.author_','', $AuthorLevel)"/>
+ </xsl:variable>
+ <xsl:variable name="Surname">
+ <xsl:value-of select="concat($Author,'',concat('.surname_','',$SurnameLevel))"/>
+ </xsl:variable>
+ <xsl:if test="text:p/text:variable-set[@text:name=$Surname]">
+ <surname>
+ <xsl:value-of select="text:p/text:variable-set[@text:name=$Surname]"/>
+ </surname>
+ <xsl:call-template name="Surname">
+ <xsl:with-param name="AuthorLevel" select="$AuthorLevel"/>
+ <xsl:with-param name="SurnameLevel" select="SurnameLevel+1"/>
+ </xsl:call-template>
+
+ </xsl:if>
+ </xsl:template>
+
+
+
+
+ <xsl:template name="Firstname">
+ <xsl:param name="AuthorLevel"/>
+ <xsl:param name="FirstnameLevel"/>
+ <xsl:variable name="Author">
+ <xsl:value-of select="concat('articleinfo.author_','', $AuthorLevel)"/>
+ </xsl:variable>
+ <xsl:variable name="Firstname">
+ <xsl:value-of select="concat($Author,'',concat('.firstname_','',$FirstnameLevel))"/>
+ </xsl:variable>
+ <xsl:if test="text:p/text:variable-set[@text:name=$Firstname]">
+ <firstname>
+ <xsl:value-of select="text:p/text:variable-set[@text:name=$Firstname]"/>
+ </firstname>
+ <xsl:call-template name="Surname">
+ <xsl:with-param name="AuthorLevel" select="$AuthorLevel"/>
+ <xsl:with-param name="FirstnameLevel" select="FirstnameLevel+1"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+
+
+
+ <xsl:template name="Affiliation">
+ <xsl:param name="AuthorLevel"/>
+ <xsl:param name="AffilLevel"/>
+ <xsl:variable name="Author">
+ <xsl:value-of select="concat('articleinfo.author_','', $AuthorLevel)"/>
+ </xsl:variable>
+ <xsl:variable name="Affil">
+ <xsl:value-of select="concat($Author,'',concat('.affiliation_','',$AffilLevel))"/>
+ </xsl:variable>
+ <xsl:if test="text:p/text:variable-set[contains(@text:name,$Affil)]">
+ <affiliation>
+ <xsl:call-template name="Orgname">
+ <xsl:with-param name="AuthorLevel" select="$AuthorLevel"/>
+ <xsl:with-param name="AffilLevel" select="$AffilLevel"/>
+ <xsl:with-param name="OrgLevel" select="0"/>
+ </xsl:call-template>
+ <xsl:call-template name="Address">
+ <xsl:with-param name="AuthorLevel" select="$AuthorLevel"/>
+ <xsl:with-param name="AffilLevel" select="$AffilLevel"/>
+ <xsl:with-param name="AddressLevel" select="0"/>
+
+ </xsl:call-template>
+ </affiliation>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template name="Orgname">
+ <xsl:param name="AuthorLevel"/>
+ <xsl:param name="AffilLevel"/>
+ <xsl:param name="OrgLevel"/>
+
+ <xsl:variable name="Author">
+ <xsl:value-of select="concat('articleinfo.author_','', $AuthorLevel)"/>
+ </xsl:variable>
+ <xsl:variable name="Affil">
+ <xsl:value-of select="concat($Author,'',concat('.affiliation_','',$AffilLevel))"/>
+ </xsl:variable>
+ <xsl:variable name="Org">
+ <xsl:value-of select="concat($Affil,'',concat('.orgname_','',$OrgLevel))"/>
+ </xsl:variable>
+
+ <xsl:if test="text:p/text:variable-set[@text:name=$Org]">
+ <orgname>
+ <xsl:value-of select="text:p/text:variable-set[@text:name=$Org]"/>
+ </orgname>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template name="Address">
+ <xsl:param name="AuthorLevel"/>
+ <xsl:param name="AffilLevel"/>
+ <xsl:param name="AddressLevel"/>
+
+ <xsl:variable name="Author">
+ <xsl:value-of select="concat('articleinfo.author_','', $AuthorLevel)"/>
+ </xsl:variable>
+ <xsl:variable name="Affil">
+ <xsl:value-of select="concat($Author,'',concat('.affiliation_','',$AffilLevel))"/>
+ </xsl:variable>
+ <xsl:variable name="Address">
+ <xsl:value-of select="concat($Affil,'',concat('.address_','',$AddressLevel))"/>
+ </xsl:variable>
+
+ <xsl:if test="text:p/text:variable-set[@text:name=$Address]">
+ <address>
+ <xsl:value-of select="text:p/text:variable-set[@text:name=$Address]"/>
+ </address>
+ </xsl:if>
+ </xsl:template>
+
+
+
+
+ <xsl:template match="text:p[@text:style-name='Document Title']"></xsl:template>
+
+ <xsl:template match="text:p[@text:style-name='Document SubTitle']"></xsl:template>
+
+
+ <xsl:template match="text:p[@text:style-name='Section Title']">
+ <xsl:element name="title">
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="text:p[@text:style-name='Appendix Title']">
+ <xsl:element name="title">
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:template>
+
+
+<!--<xsl:template match="text:p[@text:style-name='VarList Item']">
+ <xsl:if test="not(preceding-sibling::text:p[@text:style-name='VarList Item'])">
+ <xsl:text disable-output-escaping="yes">&lt;listitem&gt;</xsl:text>
+ </xsl:if>
+ <para>
+ <xsl:apply-templates/>
+ </para>
+ <xsl:if test="not(following-sibling::text:p[@text:style-name='VarList Item'])">
+ <xsl:text disable-output-escaping="yes">&lt;/listitem&gt;</xsl:text>
+ </xsl:if>
+</xsl:template>-->
+
+
+ <xsl:template match="text:p[@text:style-name='Section1 Title']">
+ <xsl:element name="title">
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:template>
+
+
+ <xsl:template match="text:p[@text:style-name='Section2 Title']">
+ <xsl:element name="title">
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:template>
+
+
+ <xsl:template match="text:p[@text:style-name='Section3 Title']">
+ <xsl:element name="title">
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="text:footnote-citation"></xsl:template>
+
+ <xsl:template match="text:p[@text:style-name='Mediaobject']">
+ <mediaobject>
+ <xsl:apply-templates/>
+ </mediaobject>
+ </xsl:template>
+
+ <xsl:template match="office:annotation/text:p">
+ <note>
+ <remark>
+ <xsl:apply-templates/>
+ </remark>
+ </note>
+ </xsl:template>
+
+<!--<xsl:template match="meta:initial-creator">
+ <author>
+ <xsl:apply-templates />
+ </author>
+</xsl:template>-->
+
+ <xsl:template match="table:table">
+ <xsl:choose>
+ <xsl:when test="following-sibling::text:p[@text:style-name='Table']">
+ <table frame="all">
+ <xsl:attribute name="id">
+ <xsl:value-of select="@table:name"/>
+ </xsl:attribute>
+ <title>
+ <xsl:value-of select="following-sibling::text:p[@text:style-name='Table']"/>
+ </title>
+ <xsl:call-template name="generictable"/>
+ </table>
+ </xsl:when>
+ <xsl:otherwise>
+ <informaltable frame="all">
+ <xsl:call-template name="generictable"/>
+ </informaltable>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <xsl:template name="generictable">
+ <xsl:variable name="cells" select="count(descendant::table:table-cell)"></xsl:variable>
+ <xsl:variable name="rows">
+ <xsl:value-of select="count(descendant::table:table-row)"/>
+ </xsl:variable>
+ <xsl:variable name="cols">
+ <xsl:value-of select="$cells div $rows"/>
+ </xsl:variable>
+ <xsl:variable name="numcols">
+ <xsl:choose>
+ <xsl:when test="child::table:table-column/@table:number-columns-repeated">
+ <xsl:value-of select="number(table:table-column/@table:number-columns-repeated+1)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$cols"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:element name="tgroup">
+ <xsl:attribute name="cols">
+ <xsl:value-of select="$numcols"/>
+ </xsl:attribute>
+ <xsl:call-template name="colspec">
+ <xsl:with-param name="left" select="1"/>
+ </xsl:call-template>
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template name="colspec">
+ <xsl:param name="left"/>
+ <xsl:if test="number($left &lt; ( table:table-column/@table:number-columns-repeated +2) )">
+ <xsl:element name="colspec">
+ <xsl:attribute name="colnum">
+ <xsl:value-of select="$left"/>
+ </xsl:attribute>
+ <xsl:attribute name="colname">c<xsl:value-of select="$left"/>
+ </xsl:attribute>
+ </xsl:element>
+ <xsl:call-template name="colspec">
+ <xsl:with-param name="left" select="$left+1"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template match="table:table-column">
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <xsl:template match="table:table-header-rows">
+ <thead>
+ <xsl:apply-templates/>
+ </thead>
+ </xsl:template>
+
+ <xsl:template match="table:table-header-rows/table:table-row">
+ <row>
+ <xsl:apply-templates/>
+ </row>
+ </xsl:template>
+
+ <xsl:template match="table:table/table:table-row">
+ <xsl:if test="not(preceding-sibling::table:table-row)">
+ <xsl:text disable-output-escaping="yes">&lt;tbody&gt;</xsl:text>
+ </xsl:if>
+ <row>
+ <xsl:apply-templates/>
+ </row>
+ <xsl:if test="not(following-sibling::table:table-row)">
+ <xsl:text disable-output-escaping="yes">&lt;/tbody&gt;</xsl:text>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template match="table:table-cell">
+ <xsl:element name="entry">
+ <xsl:if test="@table:number-columns-spanned >'1'">
+ <xsl:attribute name="namest">
+ <xsl:value-of select="concat('c',count(preceding-sibling::table:table-cell[not(@table:number-columns-spanned)]) +sum(preceding-sibling::table:table-cell/@table:number-columns-spanned)+1)"/>
+ </xsl:attribute>
+ <xsl:attribute name="nameend">
+ <xsl:value-of select="concat('c',count(preceding-sibling::table:table-cell[not(@table:number-columns-spanned)]) +sum(preceding-sibling::table:table-cell/@table:number-columns-spanned)+ @table:number-columns-spanned)"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="text:p">
+ <xsl:choose>
+ <xsl:when test="@text:style-name='Table'"></xsl:when>
+ <xsl:otherwise>
+ <para>
+ <xsl:apply-templates/>
+ </para>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:key match="text:list-style" name="getListStyle" use="@style:name"/>
+
+ <xsl:template match="text:ordered-list">
+ <xsl:param name="outlineLevel" select="1"/>
+
+ <xsl:variable name="listStyle" select="key('getListStyle', @text:style-name)/*[@text:level = $outlineLevel]"/>
+
+ <!-- if the list is not recognizable as a list (e.g. no indent, number/bullet, etc.) the list will be ignored -->
+ <xsl:if test="$listStyle/style:properties/@*">
+ <orderedlist>
+ <xsl:apply-templates>
+ <xsl:with-param name="itemType" select="'listitem'"/>
+ <xsl:with-param name="outlineLevel" select="$outlineLevel + 1"/>
+ </xsl:apply-templates>
+ </orderedlist>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template match="text:unordered-list">
+ <xsl:param name="outlineLevel" select="1"/>
+
+ <xsl:variable name="listStyle" select="key('getListStyle', @text:style-name)/*[@text:level = $outlineLevel]"/>
+ <!-- if the list is not recognizable as a list (e.g. no indent, number/bullet, etc.) the list will be ignored -->
+ <xsl:if test="$listStyle/style:properties/@*">
+ <xsl:choose>
+ <xsl:when test="@text:style-name='Var List'">
+ <variablelist>
+ <xsl:apply-templates>
+ <xsl:with-param name="itemType" select="'varlist'"/>
+ <xsl:with-param name="outlineLevel" select="$outlineLevel + 1"/>
+ </xsl:apply-templates>
+ </variablelist>
+ </xsl:when>
+ <xsl:otherwise>
+ <itemizedlist>
+ <xsl:apply-templates>
+ <xsl:with-param name="itemType" select="'listitem'"/>
+ <xsl:with-param name="outlineLevel" select="$outlineLevel + 1"/>
+ </xsl:apply-templates>
+ </itemizedlist>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template match="text:list-item | text:list-header">
+ <xsl:param name="listType"/>
+ <xsl:param name="outlineLevel"/>
+
+ <xsl:choose>
+ <xsl:when test="$listType='Var List'">
+ <xsl:element name="varlistentry">
+ <xsl:apply-templates>
+ <xsl:with-param name="outlineLevel" select="$outlineLevel"/>
+ </xsl:apply-templates>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="listitem">
+ <xsl:apply-templates>
+ <xsl:with-param name="outlineLevel" select="$outlineLevel"/>
+ </xsl:apply-templates>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="text:p[@text:style-name='VarList Term']">
+ <xsl:element name="term">
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="text:p[@text:style-name='VarList Item']">
+ <xsl:element name="para">
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:template>
+
+ <!-- text headings should only be matched once, when creating a nested docbook section structure, but might be as well become as part of a list a title -->
+ <xsl:template match="text:h">
+ <title>
+ <xsl:apply-templates/>
+ </title>
+ </xsl:template>
+
+ <xsl:template match="dc:title"></xsl:template>
+
+ <xsl:template match="dc:description">
+ <abstract>
+ <para>
+ <xsl:apply-templates/>
+ </para>
+ </abstract>
+ </xsl:template>
+
+ <xsl:template match="dc:subject"></xsl:template>
+
+
+ <xsl:template match="meta:generator"></xsl:template>
+
+ <xsl:template match="draw:plugin">
+ <xsl:element name="audioobject">
+ <xsl:attribute name="fileref">
+ <xsl:value-of select="@xlink:href"/>
+ </xsl:attribute>
+ <xsl:attribute name="width"></xsl:attribute>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="text:footnote">
+ <footnote>
+ <xsl:apply-templates/>
+ </footnote>
+ </xsl:template>
+
+ <xsl:template match="text:footnote-body">
+ <xsl:apply-templates/>
+ </xsl:template>
+
+
+ <xsl:template match="draw:text-box"></xsl:template>
+
+
+
+ <xsl:template match="draw:image">
+ <xsl:choose>
+ <xsl:when test="parent::text:p[@text:style-name='Mediaobject']">
+ <xsl:element name="imageobject">
+ <xsl:element name="imagedata">
+ <xsl:attribute name="fileref">
+ <xsl:value-of select="@xlink:href"/>
+ </xsl:attribute>
+ </xsl:element>
+ <xsl:element name="caption">
+ <xsl:value-of select="."/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="inlinegraphic">
+ <xsl:attribute name="fileref">
+ <xsl:choose>
+ <xsl:when test="@xlink:href != ''">
+ <xsl:value-of select="@xlink:href"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>embedded:</xsl:text>
+ <xsl:value-of select="@draw:name"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:attribute name="width">
+ <xsl:value-of select="@svg:width"/>
+ </xsl:attribute>
+ <xsl:attribute name="depth">
+ <xsl:value-of select="@svg:height"/>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <xsl:template match="text:span">
+ <xsl:choose>
+ <xsl:when test="./@text:style-name='GuiMenu'">
+ <xsl:element name="guimenu">
+ <xsl:value-of select="."/>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="./@text:style-name='GuiSubMenu'">
+ <xsl:element name="guisubmenu">
+ <xsl:value-of select="."/>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="@text:style-name='GuiMenuItem'">
+ <xsl:element name="guimenuitem">
+ <xsl:value-of select="."/>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="@text:style-name='GuiButton'">
+ <xsl:element name="guibutton">
+ <xsl:value-of select="."/>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="@text:style-name='GuiButton'">
+ <xsl:element name="guibutton">
+ <xsl:value-of select="."/>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="@text:style-name='GuiLabel'">
+ <xsl:element name="guilabel">
+ <xsl:value-of select="."/>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="@text:style-name='Emphasis'">
+ <xsl:element name="emphasis">
+ <xsl:value-of select="."/>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="@text:style-name='FileName'">
+ <xsl:element name="filename">
+ <xsl:value-of select="."/>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="@text:style-name='Application'">
+ <xsl:element name="application">
+ <xsl:value-of select="."/>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="@text:style-name='Command'">
+ <command>
+ <xsl:apply-templates/>
+ </command>
+ </xsl:when>
+ <xsl:when test="@text:style-name='SubScript'">
+ <subscript>
+ <xsl:apply-templates/>
+ </subscript>
+ </xsl:when>
+ <xsl:when test="@text:style-name='SuperScript'">
+ <superscript>
+ <xsl:apply-templates/>
+ </superscript>
+ </xsl:when>
+ <xsl:when test="@text:style-name='SystemItem'">
+ <systemitem>
+ <xsl:apply-templates/>
+ </systemitem>
+ </xsl:when>
+ <xsl:when test="@text:style-name='ComputerOutput'">
+ <computeroutput>
+ <xsl:apply-templates/>
+ </computeroutput>
+ </xsl:when>
+ <xsl:when test="@text:style-name='Highlight'">
+ <highlight>
+ <xsl:apply-templates/>
+ </highlight>
+ </xsl:when>
+ <xsl:when test="@text:style-name='KeyCap'">
+ <keycap>
+ <xsl:apply-templates/>
+ </keycap>
+ </xsl:when>
+ <xsl:when test="@text:style-name='KeySym'">
+ <xsl:element name="keysym">
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="@text:style-name='KeyCombo'">
+ <keycombo>
+ <xsl:apply-templates/>
+ </keycombo>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates/>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ </xsl:template>
+
+
+ <xsl:template match="text:a">
+ <xsl:choose>
+ <xsl:when test="contains(@xlink:href,'://')">
+ <xsl:element name="ulink">
+ <xsl:attribute name="url">
+ <xsl:value-of select="@xlink:href"/>
+ </xsl:attribute>
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="contains(@xlink:href,'mailto:')">
+ <xsl:element name="ulink">
+ <xsl:attribute name="url">
+ <xsl:value-of select="@xlink:href"/>
+ </xsl:attribute>
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="not(contains(@xlink:href,'#'))">
+ <xsl:element name="olink">
+ <xsl:attribute name="targetdocent">
+ <xsl:value-of select="@xlink:href"/>
+ </xsl:attribute>
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="linkvar" select="substring-after(@xlink:href,'#')"/>
+ <xsl:element name="link">
+ <xsl:attribute name="linkend">
+ <xsl:value-of select="substring-before($linkvar,'%')"/>
+ </xsl:attribute>
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+<!--
+ Change Made By Kevin Fowlks (fowlks@msu.edu) July 2nd, 2003
+ This allows users to create example code in DocBook.
+
+ Note: This type of grouping could also be implemented for
+ <notes>,<literallayout>, <blockquote> or any other tag that requires text to be treated as blocked.
+-->
+ <xsl:template match="text:p[@text:style-name='Example']">
+ <xsl:if test="not(preceding-sibling::*[1][self::text:p[@text:style-name='Example']])">
+ <xsl:element name="example">
+ <xsl:element name="title"></xsl:element>
+ <xsl:element name="programlisting">
+ <xsl:value-of select="."/>
+ <xsl:text disable-output-escaping="no">&#xD;</xsl:text>
+ <xsl:apply-templates mode="in-list" select="following-sibling::*[1][self::text:p[@text:style-name='Example']]"/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template match="text:p[@text:style-name='Example']" mode="in-list">
+ <xsl:value-of select="."/>
+ <xsl:text disable-output-escaping="no">&#xD;</xsl:text>
+ <xsl:apply-templates mode="in-list" select="following-sibling::*[1][self::text:p[@text:style-name='Example']]"/>
+ </xsl:template>
+
+ <!-- ****************** -->
+ <!-- *** Whitespace *** -->
+ <!-- ****************** -->
+
+ <xsl:template match="text:s">
+ <xsl:call-template name="write-breakable-whitespace">
+ <xsl:with-param name="whitespaces" select="@text:c"/>
+ </xsl:call-template>
+ </xsl:template>
+
+
+ <!--write the number of 'whitespaces' -->
+ <xsl:template name="write-breakable-whitespace">
+ <xsl:param name="whitespaces"/>
+
+ <!--write two space chars as the normal white space character will be stripped
+ and the other is able to break -->
+ <xsl:text>&#160;</xsl:text>
+ <xsl:if test="$whitespaces >= 2">
+ <xsl:call-template name="write-breakable-whitespace-2">
+ <xsl:with-param name="whitespaces" select="$whitespaces - 1"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+
+
+ <!--write the number of 'whitespaces' -->
+ <xsl:template name="write-breakable-whitespace-2">
+ <xsl:param name="whitespaces"/>
+ <!--write two space chars as the normal white space character will be stripped
+ and the other is able to break -->
+ <xsl:text> </xsl:text>
+ <xsl:if test="$whitespaces >= 2">
+ <xsl:call-template name="write-breakable-whitespace">
+ <xsl:with-param name="whitespaces" select="$whitespaces - 1"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template match="text:tab-stop">
+ <xsl:call-template name="write-breakable-whitespace">
+ <xsl:with-param name="whitespaces" select="8"/>
+ </xsl:call-template>
+ </xsl:template>
+</xsl:stylesheet> \ No newline at end of file
diff --git a/filter/source/filtertracer/exports.dxp b/filter/source/filtertracer/exports.dxp
new file mode 100644
index 000000000000..0c2e3e7cddd7
--- /dev/null
+++ b/filter/source/filtertracer/exports.dxp
@@ -0,0 +1,3 @@
+component_getImplementationEnvironment
+component_writeInfo
+component_getFactory \ No newline at end of file
diff --git a/filter/source/filtertracer/filtertracer.cxx b/filter/source/filtertracer/filtertracer.cxx
new file mode 100644
index 000000000000..328917c24036
--- /dev/null
+++ b/filter/source/filtertracer/filtertracer.cxx
@@ -0,0 +1,256 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+#include "filtertracer.hxx"
+#include <uno/mapping.hxx>
+#include <unotools/streamwrap.hxx>
+#include <unotools/ucbstreamhelper.hxx>
+// ----------------
+// - FILTERTRACER -
+// ----------------
+
+rtl::OUString FilterTracer_getImplementationName()
+ throw( NMSP_UNO::RuntimeException )
+{
+ return B2UCONST( "com.sun.star.util.FilterTracer" );
+}
+sal_Bool SAL_CALL FilterTracer_supportsService( const rtl::OUString& ServiceName )
+ throw( NMSP_UNO::RuntimeException )
+{
+ return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.util.logging.Logger" ) );
+}
+SEQ( rtl::OUString ) SAL_CALL FilterTracer_getSupportedServiceNames()
+ throw( NMSP_UNO::RuntimeException )
+{
+ SEQ( rtl::OUString ) aRet(1);
+ rtl::OUString* pArray = aRet.getArray();
+ pArray[0] = B2UCONST( "com.sun.star.util.logging.Logger" );
+ return aRet;
+}
+
+// -----------------------------------------------------------------------------
+
+FilterTracer::FilterTracer( const REF( NMSP_LANG::XMultiServiceFactory )& rxMgr ) :
+ xFact ( rxMgr ),
+ mpStream ( NULL ),
+ mnLogLevel ( NMSP_LOGGING::LogLevel::ALL )
+{
+ REF( NMSP_UNO::XInterface ) xObj( rxMgr->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.util.TextSearch" ) ) );
+ mxTextSearch = REF( NMSP_UTIL::XTextSearch )( xObj, ::com::sun::star::uno::UNO_QUERY );
+}
+FilterTracer::~FilterTracer()
+{
+ if ( mpStream )
+ {
+ mxOutputStream = NULL;
+ delete mpStream;
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+// XInterface
+void SAL_CALL FilterTracer::acquire() throw()
+{
+ OWeakObject::acquire();
+}
+void SAL_CALL FilterTracer::release() throw()
+{
+ OWeakObject::release();
+}
+
+// -----------------------------------------------------------------------------
+
+// checks if the tokens of rFilter can be found in rString
+sal_Bool FilterTracer::ImplFilter( const rtl::OUString& rFilter, const rtl::OUString& rString )
+{
+ sal_Bool bFilter = sal_False;
+ if ( mxTextSearch.is() )
+ {
+ maSearchOptions.searchString = rFilter;
+ mxTextSearch->setOptions( maSearchOptions );
+ NMSP_UTIL::SearchResult aSearchResult = mxTextSearch->searchForward( rString, 0, rString.getLength() );
+ bFilter = aSearchResult.subRegExpressions != 0;
+ }
+ return bFilter;
+}
+
+// -----------------------------------------------------------------------------
+
+// XInitialization
+void SAL_CALL FilterTracer::initialize( const SEQ( NMSP_UNO::Any )& aArguments )
+ throw ( NMSP_UNO::Exception, NMSP_UNO::RuntimeException )
+{
+ sal_Int32 i;
+ SEQ( NMSP_BEANS::PropertyValue ) aParameter;
+ for ( i = 0; i < aArguments.getLength(); i++ )
+ {
+ if ( aArguments[ i ] >>= aParameter )
+ break;
+ }
+ for ( i = 0; i < aParameter.getLength(); i++ )
+ {
+ const NMSP_BEANS::PropertyValue& rProp = aParameter[ i ];
+ if ( rProp.Name.equalsAscii( "LogLevel" ) )
+ rProp.Value >>= mnLogLevel;
+ else if ( rProp.Name.equalsAscii( "ClassFilter" ) )
+ rProp.Value >>= msClassFilter;
+ else if ( rProp.Name.equalsAscii( "MethodFilter" ) )
+ rProp.Value >>= msMethodFilter;
+ else if ( rProp.Name.equalsAscii( "MessageFilter" ) )
+ rProp.Value >>= msMessageFilter;
+ else if ( rProp.Name.equalsAscii( "OutputStream" ) )
+ rProp.Value >>= mxOutputStream;
+ else if ( rProp.Name.equalsAscii( "URL" ) )
+ rProp.Value >>= msURL;
+ else if ( rProp.Name.equalsAscii( "DocumentHandler" ) )
+ rProp.Value >>= mxDocumentHandler;
+ }
+
+ // check if we have to create the XOutputStream
+ if ( !mxOutputStream.is() && msURL.getLength() )
+ {
+ mpStream = ::utl::UcbStreamHelper::CreateStream( msURL, STREAM_WRITE | STREAM_TRUNC | STREAM_SHARE_DENYNONE );
+ if ( mpStream )
+ {
+ ::utl::OOutputStreamWrapper* pHelper = new ::utl::OOutputStreamWrapper( *mpStream );
+ mxOutputStream = pHelper;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+// XServiceInfo
+rtl::OUString SAL_CALL FilterTracer::getImplementationName()
+ throw( NMSP_UNO::RuntimeException )
+{
+ return FilterTracer_getImplementationName();
+}
+sal_Bool SAL_CALL FilterTracer::supportsService( const rtl::OUString& rServiceName )
+ throw( NMSP_UNO::RuntimeException )
+{
+ return FilterTracer_supportsService( rServiceName );
+}
+SEQ( rtl::OUString ) SAL_CALL FilterTracer::getSupportedServiceNames()
+ throw ( NMSP_UNO::RuntimeException )
+{
+ return FilterTracer_getSupportedServiceNames();
+}
+
+// -----------------------------------------------------------------------------
+
+// XLogger
+REF( NMSP_LOGGING::XLogger ) SAL_CALL FilterTracer::getLogger( const rtl::OUString& /* rName */ )
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ REF( NMSP_LOGGING::XLogger ) xLog( this );
+ return xLog;
+}
+sal_Int32 SAL_CALL FilterTracer::getLevel() throw (::com::sun::star::uno::RuntimeException)
+{
+ return mnLogLevel;
+}
+rtl::OUString SAL_CALL FilterTracer::getName() throw (::com::sun::star::uno::RuntimeException)
+{
+ rtl::OUString aName;
+ return aName;
+}
+sal_Bool SAL_CALL FilterTracer::isLoggable( sal_Int32 nLevel )
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ return mnLogLevel <= nLevel;
+}
+void SAL_CALL FilterTracer::logp( sal_Int32 /* nLevel */, const rtl::OUString& rSourceClass,
+ const rtl::OUString& rSourceMethod, const rtl::OUString& rMessage )
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ if ( mxOutputStream.is() || mxDocumentHandler.is() )
+ {
+ if ( ! ( ImplFilter( msClassFilter, rSourceClass ) || ImplFilter( msMethodFilter, rSourceMethod )
+ || ImplFilter( msMessageFilter, rMessage ) ) )
+ {
+ rtl::OString sClass( rtl::OUStringToOString( rSourceClass, RTL_TEXTENCODING_UTF8 ) );
+ rtl::OString sMethod( rtl::OUStringToOString( rSourceMethod, RTL_TEXTENCODING_UTF8 ) );
+ rtl::OString sMessage( rtl::OUStringToOString( rMessage, RTL_TEXTENCODING_UTF8 ) );
+ try
+ {
+ SEQ( sal_Int8 ) aData( sClass.getLength() + sMethod.getLength() + sMessage.getLength() );
+ sal_Int8* pPtr = aData.getArray();
+ memcpy( pPtr, sClass.getStr(), sClass.getLength() );
+ pPtr += sClass.getLength();
+ memcpy( pPtr, sMethod.getStr(), sMethod.getLength() );
+ pPtr += sMethod.getLength();
+ memcpy( pPtr, sMessage.getStr(), sMessage.getLength() );
+ pPtr += sMessage.getLength();
+ if ( mxOutputStream.is() )
+ mxOutputStream->writeBytes( aData );
+ if ( mxDocumentHandler.is() )
+ mxDocumentHandler->characters( ::rtl::OUString( (sal_Char*)aData.getArray(), aData.getLength(), RTL_TEXTENCODING_UTF8 ) );
+ }
+ catch ( ... )
+ {
+
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+// XTextSearch
+void SAL_CALL FilterTracer::setOptions( const NMSP_UTIL::SearchOptions& rSearchOptions )
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ maSearchOptions = rSearchOptions;
+}
+
+// -----------------------------------------------------------------------------
+
+NMSP_UTIL::SearchResult SAL_CALL FilterTracer::searchForward( const rtl::OUString& rSearchStr,
+ sal_Int32 nStartPos, sal_Int32 nEndPos ) throw (::com::sun::star::uno::RuntimeException)
+{
+ NMSP_UTIL::SearchResult nSearchResult;
+ if ( mxTextSearch.is() )
+ mxTextSearch->searchForward( rSearchStr, nStartPos, nEndPos );
+ return nSearchResult;
+}
+
+// -----------------------------------------------------------------------------
+
+NMSP_UTIL::SearchResult SAL_CALL FilterTracer::searchBackward( const rtl::OUString& rSearchStr,
+ sal_Int32 nStartPos, sal_Int32 nEndPos ) throw (::com::sun::star::uno::RuntimeException)
+{
+ NMSP_UTIL::SearchResult nSearchResult;
+ if ( mxTextSearch.is() )
+ mxTextSearch->searchBackward( rSearchStr, nStartPos, nEndPos );
+ return nSearchResult;
+}
+
+
diff --git a/filter/source/filtertracer/filtertracer.hxx b/filter/source/filtertracer/filtertracer.hxx
new file mode 100644
index 000000000000..65e5677f2478
--- /dev/null
+++ b/filter/source/filtertracer/filtertracer.hxx
@@ -0,0 +1,186 @@
+/*************************************************************************
+ *
+ * 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 _FILTERTRACER_HXX
+#define _FILTERTRACER_HXX
+
+#include <rtl/ustring.hxx>
+#include <tools/debug.hxx>
+#include <tools/stream.hxx>
+#include <tools/string.hxx>
+#include <tools/urlobj.hxx>
+#include <tools/stack.hxx>
+
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/registry/XRegistryKey.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/implbase4.hxx>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/util/logging/XLogger.hpp>
+#include <com/sun/star/util/logging/LogLevel.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/util/XTextSearch.hpp>
+#include <com/sun/star/util/SearchResult.hpp>
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+
+// -----------------------------------------------------------------------------
+
+#define NMSP_IO com::sun::star::io
+#define NMSP_UNO com::sun::star::uno
+#define NMSP_BEANS com::sun::star::beans
+#define NMSP_LANG com::sun::star::lang
+#define NMSP_UTIL com::sun::star::util
+#define NMSP_SAX com::sun::star::xml::sax
+#define NMSP_LOGGING NMSP_UTIL::logging
+
+
+#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 )))
+
+// ----------------
+// - FILTERTRACER -
+// ----------------
+//
+
+/** Some options of the FilterTracer can be initialized
+ via XInitialization interface.
+
+ Therefore the first sequence of PropertyValues that
+ is given in the argument list is used.
+
+ Following Properties are supported:
+
+ OutputStream com.sun.star.io.XOutputStream Defines the output stream. Optional it is possible to provide
+ the URL property, then the corresponding output stream will
+ be generated automatically.
+
+ URL string Defines the URL, which is used to create an output stream.
+ This property is used only, if there is no valid
+ OutputStream property available.
+
+ DocumentHandler com.sun.star.xml.sax.XDocumentHandler The output can also be written to a DocumentHandler,
+ then the "characters" method of the handler is used.
+
+ LogLevel long Defines the LogLevel for the FilterTracer.
+ Using logp with a LogLevel that is higher as the LogLevel
+ for the FilterTracer component will generate no output.
+ LogLevel constants are defined in sun::star::util::logging::LogLevel
+ The default LogLevel com::sun::star::logging::LogLevel::ALL
+
+ ClassFilter string This property defines a filter for the SourceClass string of logp.
+ The ClassFilter string can be separated into multiple tokens using
+ a semicolon. If one of the ClassFilter token is part of the
+ SourceClass string of the logp method then there will be no output.
+
+ MethodFilter string This property defines a filter for the SourceMethod string of logp.
+ The MethodFilter string can be separated into multiple tokens using
+ a semicolon. If one of the MethodFilter token is part of the
+ SourceMethod string of the logp method then there will be no output.
+
+ MessageFilter string This property defines a filter for the Message string of logp.
+ The MessageFilter string can be separated into multiple tokens using
+ a semicolon. If one of the MessageFilter token is part of the
+ Message string of the logp method then there will be no output.
+
+*/
+
+class FilterTracer : public cppu::WeakImplHelper4
+<
+ NMSP_LOGGING::XLogger,
+ NMSP_LANG::XInitialization,
+ NMSP_LANG::XServiceInfo,
+ NMSP_UTIL::XTextSearch
+>
+{
+ REF( NMSP_LANG::XMultiServiceFactory ) xFact;
+ SvStream* mpStream;
+
+ sal_Int32 mnLogLevel;
+ rtl::OUString msClassFilter;
+ rtl::OUString msMethodFilter;
+ rtl::OUString msMessageFilter;
+ rtl::OUString msURL;
+
+ REF( NMSP_IO::XOutputStream ) mxOutputStream;
+ REF( NMSP_SAX::XDocumentHandler) mxDocumentHandler;
+
+ REF( NMSP_UTIL::XTextSearch ) mxTextSearch;
+ NMSP_UTIL::SearchOptions maSearchOptions;
+
+ sal_Bool ImplFilter( const rtl::OUString& rFilter, const rtl::OUString& rString );
+
+public:
+ FilterTracer( const REF( NMSP_LANG::XMultiServiceFactory )& rxMgr );
+ virtual ~FilterTracer();
+
+ // XInterface
+ virtual void SAL_CALL acquire() throw();
+ virtual void SAL_CALL release() throw();
+
+ // XInitialization
+ virtual void SAL_CALL initialize( const SEQ( NMSP_UNO::Any )& aArguments )
+ throw ( NMSP_UNO::Exception, NMSP_UNO::RuntimeException );
+
+ // XServiceInfo
+ virtual rtl::OUString SAL_CALL getImplementationName()
+ throw ( NMSP_UNO::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService( const rtl::OUString& rServiceName )
+ throw ( NMSP_UNO::RuntimeException );
+ virtual SEQ( rtl::OUString ) SAL_CALL getSupportedServiceNames()
+ throw ( NMSP_UNO::RuntimeException );
+
+ // XLogger
+ virtual REF( NMSP_LOGGING::XLogger ) SAL_CALL getLogger( const rtl::OUString& rName ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getLevel() throw (::com::sun::star::uno::RuntimeException);
+ virtual rtl::OUString SAL_CALL getName() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isLoggable( sal_Int32 nLevel ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL logp( sal_Int32 nLevel, const rtl::OUString& rSourceClass,
+ const rtl::OUString& rSourceMethod, const rtl::OUString& rMessage ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XTextSearch
+ virtual void SAL_CALL setOptions( const NMSP_UTIL::SearchOptions& ) throw (::com::sun::star::uno::RuntimeException);
+ virtual NMSP_UTIL::SearchResult SAL_CALL searchForward( const rtl::OUString& rSearchStr,
+ sal_Int32 nStartPos, sal_Int32 nEndPos ) throw (::com::sun::star::uno::RuntimeException);
+ virtual NMSP_UTIL::SearchResult SAL_CALL searchBackward( const rtl::OUString& rSearchStr,
+ sal_Int32 nStartPos, sal_Int32 nEndPos ) throw (::com::sun::star::uno::RuntimeException);
+};
+
+rtl::OUString FilterTracer_getImplementationName()
+ throw ( NMSP_UNO::RuntimeException );
+sal_Bool SAL_CALL FilterTracer_supportsService( const rtl::OUString& rServiceName )
+ throw( NMSP_UNO::RuntimeException );
+SEQ( rtl::OUString ) SAL_CALL FilterTracer_getSupportedServiceNames()
+ throw( NMSP_UNO::RuntimeException );
+
+#endif
diff --git a/filter/source/filtertracer/filtertraceruno.cxx b/filter/source/filtertracer/filtertraceruno.cxx
new file mode 100644
index 000000000000..f2254c8256f9
--- /dev/null
+++ b/filter/source/filtertracer/filtertraceruno.cxx
@@ -0,0 +1,110 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include "filtertracer.hxx"
+
+#include <cppuhelper/factory.hxx>
+#include <uno/mapping.hxx>
+
+// -------------------
+// - factory methods -
+// -------------------
+
+static REF( NMSP_UNO::XInterface ) SAL_CALL create_FilterTracer( const REF( NMSP_LANG::XMultiServiceFactory )& rxFact )
+{
+ return REF( NMSP_UNO::XInterface )( *new FilterTracer( rxFact ) );
+}
+
+// ------------------------------------------
+// - component_getImplementationEnvironment -
+// ------------------------------------------
+
+extern "C" void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */ )
+{
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+
+// -----------------------
+// - component_writeInfo -
+// -----------------------
+
+extern "C" sal_Bool SAL_CALL component_writeInfo( void* /* pServiceManager */, void* pRegistryKey )
+{
+ sal_Bool bRet = sal_False;
+
+ if( pRegistryKey )
+ {
+ try
+ {
+ NMSP_UNO::Reference< com::sun::star::registry::XRegistryKey > xNewKey(
+ reinterpret_cast< com::sun::star::registry::XRegistryKey * >( pRegistryKey )->createKey(
+ FilterTracer_getImplementationName() ) );
+ xNewKey = xNewKey->createKey( B2UCONST( "/UNO/SERVICES" ) );
+ const SEQ( rtl::OUString )& rSNL = FilterTracer_getSupportedServiceNames();
+ const rtl::OUString * pArray = rSNL.getConstArray();
+ for ( sal_Int32 nPos = rSNL.getLength(); nPos--; )
+ xNewKey->createKey( pArray[nPos] );
+ bRet = sal_True;
+ }
+ catch( com::sun::star::registry::InvalidRegistryException& )
+ {
+ OSL_ENSURE( sal_False, "### InvalidRegistryException!" );
+ }
+ }
+
+ return bRet;
+}
+
+// ------------------------
+// - component_getFactory -
+// ------------------------
+
+extern "C" void* SAL_CALL component_getFactory( const sal_Char* pImplName, void* pServiceManager, void* /* pRegistryKey */ )
+{
+ REF( NMSP_LANG::XSingleServiceFactory ) xFactory;
+ void* pRet = 0;
+
+ if( rtl_str_compare( pImplName, "com.sun.star.util.FilterTracer" ) == 0 )
+ {
+ const rtl::OUString aServiceName( B2UCONST( "com.sun.star.util.FilterTracer" ) );
+
+ xFactory = REF( NMSP_LANG::XSingleServiceFactory )( cppu::createSingleFactory(
+ reinterpret_cast< NMSP_LANG::XMultiServiceFactory* >( pServiceManager ),
+ B2UCONST( "com.sun.star.util.FilterTracer" ),
+ create_FilterTracer, SEQ( rtl::OUString )( &aServiceName, 1 ) ) );
+ }
+ if( xFactory.is() )
+ {
+ xFactory->acquire();
+ pRet = xFactory.get();
+ }
+
+ return pRet;
+}
diff --git a/filter/source/filtertracer/makefile.mk b/filter/source/filtertracer/makefile.mk
new file mode 100644
index 000000000000..4a4c143c4a4a
--- /dev/null
+++ b/filter/source/filtertracer/makefile.mk
@@ -0,0 +1,63 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ=..$/..
+PRJNAME=filter
+TARGET=filtertracer
+
+ENABLE_EXCEPTIONS=TRUE
+USE_DEFFILE=TRUE
+
+# --- Settings ----------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Files -------------------------------------
+
+SLOFILES= $(SLO)$/filtertracer.obj \
+ $(SLO)$/filtertraceruno.obj
+
+# --- Library -----------------------------------
+
+SHL1TARGET=$(TARGET)$(DLLPOSTFIX)
+SHL1STDLIBS=$(CPPULIB) \
+ $(CPPUHELPERLIB) \
+ $(SALLIB) \
+ $(TOOLSLIB) \
+ $(UNOTOOLSLIB)
+
+SHL1DEPN=
+SHL1IMPLIB= i$(SHL1TARGET)
+SHL1LIBS= $(SLB)$/$(TARGET).lib
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+
+DEF1NAME=$(SHL1TARGET)
+DEF1EXPORTFILE=exports.dxp
+
+# --- Targets ----------------------------------
+
+.INCLUDE : target.mk
diff --git a/filter/source/flash/impswfdialog.cxx b/filter/source/flash/impswfdialog.cxx
new file mode 100644
index 000000000000..0efde8182448
--- /dev/null
+++ b/filter/source/flash/impswfdialog.cxx
@@ -0,0 +1,125 @@
+ /*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include "impswfdialog.hxx"
+#include "impswfdialog.hrc"
+
+using namespace rtl;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::beans;
+
+// ----------------
+// - ImpPDFDialog -
+// ----------------
+
+ImpSWFDialog::ImpSWFDialog( Window* pParent, ResMgr& rResMgr, Sequence< PropertyValue >& rFilterData ) :
+ ModalDialog( pParent, ResId( DLG_OPTIONS, rResMgr ) ),
+ maFiDescr( this, ResId( FI_DESCR, rResMgr ) ),
+ maNumFldQuality( this, ResId( NUM_FLD_QUALITY, rResMgr ) ),
+ maFiExportAllDescr( this, ResId( FI_EXPORT_ALL_DESCR, rResMgr ) ),
+ maCheckExportAll( this, ResId( BOOL_EXPORT_ALL, rResMgr ) ),
+ maFiExportBackgroundsDescr( this, ResId( FI_EXPORT_BACKGROUNDS_DESCR, rResMgr ) ),
+ maCheckExportBackgrounds( this, ResId( BOOL_EXPORT_BACKGROUNDS, rResMgr ) ),
+ maFiExportBackgroundObjectsDescr( this, ResId( FI_EXPORT_BACKGROUND_OBJECTS_DESCR, rResMgr ) ),
+ maCheckExportBackgroundObjects( this, ResId( BOOL_EXPORT_BACKGROUND_OBJECTS, rResMgr ) ),
+ maFiExportSlideContentsDescr( this, ResId( FI_EXPORT_SLIDE_CONTENTS_DESCR, rResMgr ) ),
+ maCheckExportSlideContents( this, ResId( BOOL_EXPORT_SLIDE_CONTENTS, rResMgr ) ),
+ maFiExportSoundDescr( this, ResId( FI_EXPORT_SOUND_DESCR, rResMgr ) ),
+ maCheckExportSound( this, ResId( BOOL_EXPORT_SOUND, rResMgr ) ),
+ maFiExportOLEAsJPEGDescr( this, ResId( FI_EXPORT_OLE_AS_JPEG_DESCR, rResMgr ) ),
+ maCheckExportOLEAsJPEG( this, ResId( BOOL_EXPORT_OLE_AS_JPEG, rResMgr ) ),
+ maFiExportMultipleFilesDescr( this, ResId( FI_EXPORT_MULTIPLE_FILES_DESCR, rResMgr ) ),
+ maCheckExportMultipleFiles( this, ResId( BOOL_EXPORT_MULTIPLE_FILES, rResMgr ) ),
+
+ maBtnOK( this, ResId( BTN_OK, rResMgr ) ),
+ maBtnCancel( this, ResId( BTN_CANCEL, rResMgr ) ),
+ maBtnHelp( this, ResId( BTN_HELP, rResMgr ) ),
+ maConfigItem( String( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Filter/Flash/Export/" ) ), &rFilterData )
+{
+ const ULONG nCompressMode = maConfigItem.ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "CompressMode" ) ), 75 );
+ maNumFldQuality.SetValue( nCompressMode );
+
+ maCheckExportAll.Check();
+ maCheckExportSlideContents.Check();
+ maCheckExportSound.Check();
+
+ maCheckExportAll.SetToggleHdl( LINK( this, ImpSWFDialog, OnToggleCheckbox ) );
+
+ maCheckExportBackgrounds.Disable(); maFiExportBackgroundsDescr.Disable();
+ maCheckExportBackgroundObjects.Disable(); maFiExportBackgroundObjectsDescr.Disable();
+ maCheckExportSlideContents.Disable(); maFiExportSlideContentsDescr.Disable();
+
+#ifdef AUGUSTUS
+ maCheckExportMultipleFiles.Check();
+#endif
+
+ FreeResource();
+}
+
+// -----------------------------------------------------------------------------
+
+ImpSWFDialog::~ImpSWFDialog()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+Sequence< PropertyValue > ImpSWFDialog::GetFilterData()
+{
+ sal_Int32 nCompressMode = (sal_Int32)maNumFldQuality.GetValue();
+ maConfigItem.WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "CompressMode" ) ), nCompressMode );
+ maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportAll" ) ), maCheckExportAll.IsChecked() );
+ maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportBackgrounds" ) ), maCheckExportBackgrounds.IsChecked() );
+ maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportBackgroundObjects" ) ), maCheckExportBackgroundObjects.IsChecked() );
+ maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportSlideContents" ) ), maCheckExportSlideContents.IsChecked() );
+ maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportSound" ) ), maCheckExportSound.IsChecked() );
+ maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportOLEAsJPEG" ) ), maCheckExportOLEAsJPEG.IsChecked() );
+ maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportMultipleFiles" ) ), maCheckExportMultipleFiles.IsChecked() );
+
+ Sequence< PropertyValue > aRet( maConfigItem.GetFilterData() );
+
+ return aRet;
+}
+
+// AS: This is called whenever the user toggles one of the checkboxes
+IMPL_LINK( ImpSWFDialog, OnToggleCheckbox, CheckBox*, pBox )
+{
+ if (pBox == &maCheckExportAll)
+ {
+ maCheckExportBackgrounds.Enable(!maCheckExportBackgrounds.IsEnabled());
+ maFiExportBackgroundsDescr.Enable(!maFiExportBackgroundsDescr.IsEnabled());
+ maCheckExportBackgroundObjects.Enable(!maCheckExportBackgroundObjects.IsEnabled());
+ maFiExportBackgroundObjectsDescr.Enable(!maFiExportBackgroundObjectsDescr.IsEnabled());
+ maCheckExportSlideContents.Enable(!maCheckExportSlideContents.IsEnabled());
+ maFiExportSlideContentsDescr.Enable(!maFiExportSlideContentsDescr.IsEnabled());
+ }
+
+ return 0;
+}
diff --git a/filter/source/flash/impswfdialog.hrc b/filter/source/flash/impswfdialog.hrc
new file mode 100644
index 000000000000..7683af33a4c4
--- /dev/null
+++ b/filter/source/flash/impswfdialog.hrc
@@ -0,0 +1,48 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#define DLG_OPTIONS 1024
+
+#define BTN_OK 1
+#define BTN_CANCEL 1
+#define BTN_HELP 1
+#define FI_DESCR 1
+#define FI_EXPORT_ALL_DESCR 2
+#define FI_EXPORT_BACKGROUNDS_DESCR 3
+#define FI_EXPORT_BACKGROUND_OBJECTS_DESCR 4
+#define FI_EXPORT_SLIDE_CONTENTS_DESCR 5
+#define FI_EXPORT_SOUND_DESCR 6
+#define FI_EXPORT_OLE_AS_JPEG_DESCR 7
+#define FI_EXPORT_MULTIPLE_FILES_DESCR 8
+#define NUM_FLD_QUALITY 1
+#define BOOL_EXPORT_ALL 1
+#define BOOL_EXPORT_BACKGROUNDS 2
+#define BOOL_EXPORT_BACKGROUND_OBJECTS 3
+#define BOOL_EXPORT_SLIDE_CONTENTS 4
+#define BOOL_EXPORT_SOUND 5
+#define BOOL_EXPORT_OLE_AS_JPEG 6
+#define BOOL_EXPORT_MULTIPLE_FILES 7
diff --git a/filter/source/flash/impswfdialog.hxx b/filter/source/flash/impswfdialog.hxx
new file mode 100644
index 000000000000..2b32bb935863
--- /dev/null
+++ b/filter/source/flash/impswfdialog.hxx
@@ -0,0 +1,85 @@
+/*************************************************************************
+ *
+ * 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 IMPSWFDIALOG_HXX
+#define IMPSWFDIALOG_HXX
+
+#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <svtools/stdctrl.hxx>
+
+#include <vcl/dialog.hxx>
+#include <vcl/button.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/field.hxx>
+
+#include <svtools/FilterConfigItem.hxx>
+
+// ----------------
+// - ImpSWFDialog -
+// ----------------
+
+class ResMgr;
+class Window;
+
+class ImpSWFDialog : public ModalDialog
+{
+private:
+ FixedInfo maFiDescr;
+ NumericField maNumFldQuality;
+ FixedInfo maFiExportAllDescr;
+ CheckBox maCheckExportAll;
+ FixedInfo maFiExportBackgroundsDescr;
+ CheckBox maCheckExportBackgrounds;
+ FixedInfo maFiExportBackgroundObjectsDescr;
+ CheckBox maCheckExportBackgroundObjects;
+ FixedInfo maFiExportSlideContentsDescr;
+ CheckBox maCheckExportSlideContents;
+ FixedInfo maFiExportSoundDescr;
+ CheckBox maCheckExportSound;
+ FixedInfo maFiExportOLEAsJPEGDescr;
+ CheckBox maCheckExportOLEAsJPEG;
+ FixedInfo maFiExportMultipleFilesDescr;
+ CheckBox maCheckExportMultipleFiles;
+
+ OKButton maBtnOK;
+ CancelButton maBtnCancel;
+ HelpButton maBtnHelp;
+
+ FilterConfigItem maConfigItem;
+
+ DECL_LINK( OnToggleCheckbox, CheckBox* );
+
+public:
+ ImpSWFDialog( Window* pParent, ResMgr& rResMgr,
+ com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& rFilterData );
+ ~ImpSWFDialog();
+
+ com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > GetFilterData();
+};
+
+#endif // IMPDIALOG_HXX
diff --git a/filter/source/flash/impswfdialog.src b/filter/source/flash/impswfdialog.src
new file mode 100644
index 000000000000..3e38dde68441
--- /dev/null
+++ b/filter/source/flash/impswfdialog.src
@@ -0,0 +1,182 @@
+/*************************************************************************
+ *
+ * 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 "impswfdialog.hrc"
+
+ModalDialog DLG_OPTIONS
+{
+ Size = MAP_APPFONT ( 200 , 200 ) ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ Text [ en-US ] = "Macromedia Flash (SWF) Options" ;
+
+ FixedText FI_DESCR
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 81 , 16 ) ;
+ Text [ en-US ] = "1: min. quality\n100: max. quality" ;
+ };
+ NumericField NUM_FLD_QUALITY
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 33 ) ;
+ Size = MAP_APPFONT ( 50 , 12 ) ;
+ TabStop = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1;
+ Maximum = 100 ;
+ StrictFormat = TRUE ;
+ Last = 100 ;
+ Repeat = TRUE ;
+ };
+ CheckBox BOOL_EXPORT_ALL
+ {
+ Pos = MAP_APPFONT ( 12 , 65 ) ;
+ Size = MAP_APPFONT ( 10 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ FixedText FI_EXPORT_ALL_DESCR
+ {
+ Pos = MAP_APPFONT ( 25 , 65 ) ;
+ Size = MAP_APPFONT ( 150 , 16 ) ;
+ Text = "Export All Slides (Uncheck exports current slide)" ;
+ };
+ CheckBox BOOL_EXPORT_MULTIPLE_FILES
+ {
+ Pos = MAP_APPFONT ( 12 , 80 ) ;
+ Size = MAP_APPFONT ( 10 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ FixedText FI_EXPORT_MULTIPLE_FILES_DESCR
+ {
+ Pos = MAP_APPFONT ( 25 , 80 ) ;
+ Size = MAP_APPFONT ( 150 , 16 ) ;
+ Text = "Export As Multiple Files" ;
+ };
+ CheckBox BOOL_EXPORT_BACKGROUNDS
+ {
+ Pos = MAP_APPFONT ( 22 , 95 ) ;
+ Size = MAP_APPFONT ( 10 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ FixedText FI_EXPORT_BACKGROUNDS_DESCR
+ {
+ Pos = MAP_APPFONT ( 35 , 95 ) ;
+ Size = MAP_APPFONT ( 100 , 16 ) ;
+ Text = "Export Backgrounds" ;
+ };
+ CheckBox BOOL_EXPORT_BACKGROUND_OBJECTS
+ {
+ Pos = MAP_APPFONT ( 22 , 107) ;
+ Size = MAP_APPFONT ( 10 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ FixedText FI_EXPORT_BACKGROUND_OBJECTS_DESCR
+ {
+ Pos = MAP_APPFONT ( 35 , 107) ;
+ Size = MAP_APPFONT ( 100 , 16 ) ;
+ Text = "Export Background Objects" ;
+ };
+ CheckBox BOOL_EXPORT_SLIDE_CONTENTS
+ {
+ Pos = MAP_APPFONT ( 22 , 119 ) ;
+ Size = MAP_APPFONT ( 10 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ FixedText FI_EXPORT_SLIDE_CONTENTS_DESCR
+ {
+ Pos = MAP_APPFONT ( 35 , 119 ) ;
+ Size = MAP_APPFONT ( 100 , 16 ) ;
+ Text = "Export Slide Contents" ;
+ };
+ CheckBox BOOL_EXPORT_SOUND
+ {
+ Pos = MAP_APPFONT ( 12 , 134 ) ;
+ Size = MAP_APPFONT ( 10 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ FixedText FI_EXPORT_SOUND_DESCR
+ {
+ Pos = MAP_APPFONT ( 25 , 134 ) ;
+ Size = MAP_APPFONT ( 100 , 16 ) ;
+ Text = "Export Verilogix Slide Annotations" ;
+ };
+ CheckBox BOOL_EXPORT_OLE_AS_JPEG
+ {
+ Pos = MAP_APPFONT ( 12 , 146 ) ;
+ Size = MAP_APPFONT ( 10 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ FixedText FI_EXPORT_OLE_AS_JPEG_DESCR
+ {
+ Pos = MAP_APPFONT ( 25 , 146 ) ;
+ Size = MAP_APPFONT ( 100 , 16 ) ;
+ Text = "Export OLE Objects as JPEG images" ;
+ };
+
+
+ OKButton BTN_OK
+ {
+ Pos = MAP_APPFONT ( 12 , 180 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( 70 , 180 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton BTN_HELP
+ {
+ Pos = MAP_APPFONT ( 140 , 180 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/filter/source/flash/makefile.mk b/filter/source/flash/makefile.mk
new file mode 100644
index 000000000000..e5ff1bf21c5e
--- /dev/null
+++ b/filter/source/flash/makefile.mk
@@ -0,0 +1,98 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ=..$/..
+PRJNAME=filter
+TARGET=flash
+
+ENABLE_EXCEPTIONS=TRUE
+VISIBILITY_HIDDEN=TRUE
+
+# --- Settings ----------------------------------
+
+.INCLUDE : settings.mk
+
+.IF "$(SYSTEM_ZLIB)" == "YES"
+CFLAGS+=-DSYSTEM_ZLIB
+.ENDIF
+
+SRS1NAME=$(TARGET)
+SRC1FILES = impswfdialog.src
+
+SLOFILES= $(SLO)$/swffilter.obj \
+ $(SLO)$/swfwriter.obj \
+ $(SLO)$/swfwriter1.obj \
+ $(SLO)$/swfwriter2.obj \
+ $(SLO)$/swfuno.obj \
+ $(SLO)$/swfexporter.obj \
+ $(SLO)$/swfdialog.obj \
+ $(SLO)$/impswfdialog.obj
+
+# --- Library -----------------------------------
+
+RESLIB1NAME=$(TARGET)
+RESLIB1SRSFILES= $(SRS)$/$(TARGET).srs
+
+SHL1TARGET=$(TARGET)$(DLLPOSTFIX)
+
+# static libraries must come at the end for MACOSX
+.IF "$(OS)" != "MACOSX"
+SHL1STDLIBS+=\
+ $(ZLIB3RDLIB)
+.ENDIF
+
+
+# dynamic libraries
+SHL1STDLIBS+=\
+ $(SVTOOLLIB) \
+ $(BASEGFXLIB) \
+ $(VCLLIB) \
+ $(UNOTOOLSLIB) \
+ $(TOOLSLIB) \
+ $(COMPHELPERLIB) \
+ $(CPPUHELPERLIB) \
+ $(CPPULIB) \
+ $(SALLIB)
+
+# static libraries must come at the end for MACOSX
+.IF "$(OS)" == "MACOSX"
+SHL1STDLIBS+=\
+ $(ZLIB3RDLIB)
+.ENDIF
+
+SHL1DEPN=
+SHL1IMPLIB= i$(SHL1TARGET)
+SHL1VERSIONMAP=$(SOLARENV)/src/component.map
+SHL1LIBS= $(SLB)$/$(TARGET).lib
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+
+DEF1NAME=$(SHL1TARGET)
+
+# --- Targets ----------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/filter/source/flash/swfdialog.cxx b/filter/source/flash/swfdialog.cxx
new file mode 100644
index 000000000000..20a541564445
--- /dev/null
+++ b/filter/source/flash/swfdialog.cxx
@@ -0,0 +1,283 @@
+ /*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include "swfdialog.hxx"
+#include "impswfdialog.hxx"
+#include <vcl/svapp.hxx>
+#include <vcl/dialog.hxx>
+#include <svl/solar.hrc>
+#include <com/sun/star/view/XRenderable.hpp>
+#include <com/sun/star/frame/XController.hpp>
+#include <com/sun/star/view/XSelectionSupplier.hpp>
+
+using namespace ::rtl;
+using namespace ::vcl;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::view;
+using namespace ::com::sun::star::document;
+
+// -----------------------
+// - PDFDialog functions -
+// -----------------------
+
+#define SERVICE_NAME "com.sun.star.Impress.FlashExportDialog"
+
+// -----------------------------------------------------------------------------
+
+OUString SWFDialog_getImplementationName ()
+ throw (RuntimeException)
+{
+ return OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME ) );
+}
+
+// -----------------------------------------------------------------------------
+
+Sequence< sal_Int8 > SAL_CALL SWFDialog_getImplementationId()
+ throw(RuntimeException)
+{
+ static ::cppu::OImplementationId aId;
+ return aId.getImplementationId();
+}
+
+// -----------------------------------------------------------------------------
+
+Sequence< OUString > SAL_CALL SWFDialog_getSupportedServiceNames()
+ throw (RuntimeException)
+{
+ Sequence < OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME ) );
+ return aRet;
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XInterface > SAL_CALL SWFDialog_createInstance( const Reference< XMultiServiceFactory > & rSMgr)
+ throw( Exception )
+{
+ return (cppu::OWeakObject*) new SWFDialog( rSMgr );
+}
+
+// -----------------------------------------------------------------------------
+
+#undef SERVICE_NAME
+
+// -------------
+// - SWFDialog -
+// -------------
+
+SWFDialog::SWFDialog( const Reference< XMultiServiceFactory > &rxMSF ) :
+ OGenericUnoDialog( rxMSF )
+{
+ ByteString aResMgrName( "flash" );
+
+ mpResMgr = ResMgr::CreateResMgr( aResMgrName.GetBuffer(), Application::GetSettings().GetUILocale() );
+}
+
+// -----------------------------------------------------------------------------
+
+SWFDialog::~SWFDialog()
+{
+ delete mpResMgr;
+}
+
+// -----------------------------------------------------------------------------
+
+Any SAL_CALL SWFDialog::queryInterface( const Type& rType )
+ throw (RuntimeException)
+{
+ Any aReturn = OGenericUnoDialog::queryInterface( rType );
+
+ if( !aReturn.hasValue() )
+ aReturn = ::cppu::queryInterface( rType,
+ static_cast< XPropertyAccess* >( this ),
+ static_cast< XExporter* >( this ) );
+
+ return aReturn;
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL SWFDialog::acquire()
+ throw ()
+{
+ OWeakObject::acquire();
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL SWFDialog::release()
+ throw ()
+{
+ OWeakObject::release();
+}
+
+// -----------------------------------------------------------------------------
+
+Sequence< sal_Int8 > SAL_CALL SWFDialog::getImplementationId()
+ throw(RuntimeException)
+{
+ return SWFDialog_getImplementationId();
+}
+
+// -----------------------------------------------------------------------------
+
+OUString SAL_CALL SWFDialog::getImplementationName()
+ throw (RuntimeException)
+{
+ return SWFDialog_getImplementationName();
+}
+
+// -----------------------------------------------------------------------------
+
+Sequence< OUString > SAL_CALL SWFDialog::getSupportedServiceNames()
+ throw (RuntimeException)
+{
+ return SWFDialog_getSupportedServiceNames();
+}
+
+// -----------------------------------------------------------------------------
+
+Dialog* SWFDialog::createDialog( Window* pParent )
+{
+ Dialog* pRet = NULL;
+
+ if( mpResMgr && mxSrcDoc.is() )
+ {
+/* TODO: From the controler we may get information what page is visible and what shapes
+ are selected, if we optionaly want to limit output to that
+ Any aSelection;
+
+ try
+ {
+ Reference< XController > xController( Reference< XModel >( mxSrcDoc, UNO_QUERY )->getCurrentController() );
+
+ if( xController.is() )
+ {
+ Reference< XSelectionSupplier > xView( xController, UNO_QUERY );
+
+ if( xView.is() )
+ xView->getSelection() >>= aSelection;
+ }
+ }
+ catch( RuntimeException )
+ {
+ }
+*/
+ ImpSWFDialog* pDlg = new ImpSWFDialog( pParent, *mpResMgr, maFilterData );
+ pRet = pDlg;
+ }
+
+ return pRet;
+}
+
+// -----------------------------------------------------------------------------
+
+void SWFDialog::executedDialog( sal_Int16 nExecutionResult )
+{
+ if( nExecutionResult && m_pDialog )
+ maFilterData = static_cast< ImpSWFDialog* >( m_pDialog )->GetFilterData();
+
+ destroyDialog();
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XPropertySetInfo > SAL_CALL SWFDialog::getPropertySetInfo()
+ throw(RuntimeException)
+{
+ Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+//-------------------------------------------------------------------------
+::cppu::IPropertyArrayHelper& SWFDialog::getInfoHelper()
+{
+ return *const_cast<SWFDialog*>(this)->getArrayHelper();
+}
+
+//------------------------------------------------------------------------------
+::cppu::IPropertyArrayHelper* SWFDialog::createArrayHelper() const
+{
+ Sequence< Property > aProps;
+ describeProperties(aProps);
+ return new ::cppu::OPropertyArrayHelper( aProps );
+}
+
+// -----------------------------------------------------------------------------
+
+Sequence< PropertyValue > SAL_CALL SWFDialog::getPropertyValues()
+ throw ( RuntimeException )
+{
+ sal_Int32 i, nCount;
+
+ for( i = 0, nCount = maMediaDescriptor.getLength(); i < nCount; i++ )
+ {
+ if( maMediaDescriptor[ i ].Name.equalsAscii( "FilterData" ) )
+ break;
+ }
+
+ if( i == nCount )
+ maMediaDescriptor.realloc( ++nCount );
+
+ maMediaDescriptor[ i ].Name = String( RTL_CONSTASCII_USTRINGPARAM( "FilterData" ) );
+ maMediaDescriptor[ i ].Value <<= maFilterData;
+
+ return maMediaDescriptor;
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL SWFDialog::setPropertyValues( const Sequence< PropertyValue >& rProps )
+ throw ( UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException )
+{
+ maMediaDescriptor = rProps;
+
+ for( sal_Int32 i = 0, nCount = maMediaDescriptor.getLength(); i < nCount; i++ )
+ {
+ if( maMediaDescriptor[ i ].Name.equalsAscii( "FilterData" ) )
+ {
+ maMediaDescriptor[ i ].Value >>= maFilterData;
+ break;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL SWFDialog::setSourceDocument( const Reference< XComponent >& xDoc )
+ throw(IllegalArgumentException, RuntimeException)
+{
+ mxSrcDoc = xDoc;
+}
diff --git a/filter/source/flash/swfdialog.hxx b/filter/source/flash/swfdialog.hxx
new file mode 100644
index 000000000000..fd0ead0a58c2
--- /dev/null
+++ b/filter/source/flash/swfdialog.hxx
@@ -0,0 +1,89 @@
+/*************************************************************************
+ *
+ * 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 SWFDIALOG_HXX
+#define SWFDIALOG_HXX
+
+#include <com/sun/star/beans/XPropertyAccess.hpp>
+#include <com/sun/star/document/XExporter.hpp>
+
+#include <svtools/genericunodialog.hxx>
+
+// -------------
+// - SWFDialog -
+// -------------
+
+class Window;
+class ResMgr;
+
+class SWFDialog : public ::svt::OGenericUnoDialog,
+ public ::comphelper::OPropertyArrayUsageHelper< SWFDialog >,
+ public ::com::sun::star::beans::XPropertyAccess,
+ public ::com::sun::star::document::XExporter
+{
+private:
+
+ ResMgr* mpResMgr;
+ com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > maMediaDescriptor;
+ com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > maFilterData;
+ com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > mxSrcDoc;
+
+protected:
+
+ // XInterface
+ virtual com::sun::star::uno::Any SAL_CALL queryInterface( const com::sun::star::uno::Type& aType ) throw (com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire() throw ();
+ virtual void SAL_CALL release() throw ();
+
+ // OGenericUnoDialog
+ virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(com::sun::star::uno::RuntimeException);
+ virtual rtl::OUString SAL_CALL getImplementationName() throw (com::sun::star::uno::RuntimeException);
+ virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames() throw (com::sun::star::uno::RuntimeException);
+ virtual Dialog* createDialog( Window* pParent );
+ virtual void executedDialog( sal_Int16 nExecutionResult );
+ virtual com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(com::sun::star::uno::RuntimeException);
+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
+
+ // XPropertyAccess
+ using ::cppu::OPropertySetHelper::getPropertyValues;
+ using ::cppu::OPropertySetHelper::setPropertyValues;
+ virtual com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getPropertyValues( ) throw (com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValues( const com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aProps ) throw (com::sun::star::beans::UnknownPropertyException, com::sun::star::beans::PropertyVetoException, com::sun::star::lang::IllegalArgumentException, com::sun::star::lang::WrappedTargetException, com::sun::star::uno::RuntimeException);
+
+ // XExporter
+ virtual void SAL_CALL setSourceDocument( const com::sun::star::uno::Reference< com::sun::star::lang::XComponent >& xDoc ) throw(com::sun::star::lang::IllegalArgumentException, com::sun::star::uno::RuntimeException);
+
+public:
+
+ SWFDialog( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rxMSF );
+ virtual ~SWFDialog();
+};
+
+// -----------------------------------------------------------------------------
+
+#endif // SWFDialog_HXX
diff --git a/filter/source/flash/swfexporter.cxx b/filter/source/flash/swfexporter.cxx
new file mode 100644
index 000000000000..7157a9c85c06
--- /dev/null
+++ b/filter/source/flash/swfexporter.cxx
@@ -0,0 +1,768 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+#include <com/sun/star/awt/Rectangle.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/drawing/XMasterPageTarget.hpp>
+#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
+#include <com/sun/star/document/XFilter.hpp>
+#include <com/sun/star/document/XExporter.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/task/XStatusIndicatorFactory.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <vcl/gdimtf.hxx>
+#include <unotools/tempfile.hxx>
+#include <osl/diagnose.h>
+#include <osl/file.hxx>
+#include <vcl/metaact.hxx>
+#include <svtools/wmf.hxx>
+#include <svtools/filter.hxx>
+
+#include "swfexporter.hxx"
+#include "swfwriter.hxx"
+
+using rtl::OUString;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::presentation;
+using namespace ::com::sun::star::task;
+using namespace ::std;
+using namespace ::swf;
+
+using com::sun::star::lang::XMultiServiceFactory;
+using com::sun::star::io::XOutputStream;
+using com::sun::star::beans::PropertyValue;
+using com::sun::star::container::XIndexAccess;
+using com::sun::star::beans::XPropertySet;
+using com::sun::star::lang::XComponent;
+using com::sun::star::lang::IllegalArgumentException;
+using com::sun::star::document::XExporter;
+using com::sun::star::document::XFilter;
+using com::sun::star::frame::XModel;
+using com::sun::star::lang::XServiceInfo;
+
+// -----------------------------------------------------------------------------
+
+PageInfo::PageInfo()
+: meFadeEffect( FadeEffect_NONE ),
+ meFadeSpeed( AnimationSpeed_MEDIUM ),
+ mnDuration( 0 ),
+ mnChange( 0 )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+PageInfo::~PageInfo()
+{
+ vector<ShapeInfo*>::iterator aIter( maShapesVector.begin() );
+ const vector<ShapeInfo*>::iterator aEnd( maShapesVector.end() );
+ while( aIter != aEnd )
+ {
+ delete (*aIter++);
+ }
+}
+
+#ifdef THEFUTURE
+// -----------------------------------------------------------------------------
+
+void PageInfo::addShape( ShapeInfo* pShapeInfo )
+{
+ maShapesVector.push_back( pShapeInfo );
+}
+#endif
+
+// -----------------------------------------------------------------------------
+
+FlashExporter::FlashExporter(const Reference< XMultiServiceFactory > &rxMSF, sal_Int32 nJPEGCompressMode, sal_Bool bExportOLEAsJPEG)
+: mxMSF( rxMSF ),
+ mpWriter( NULL ),
+ mnJPEGcompressMode(nJPEGCompressMode),
+ mbExportOLEAsJPEG(bExportOLEAsJPEG),
+ mbPresentation(true),
+ mnPageNumber( - 1 )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+FlashExporter::~FlashExporter()
+{
+ Flush();
+}
+
+void FlashExporter::Flush()
+{
+ delete mpWriter;
+ mpWriter = NULL;
+
+ maPagesMap.clear();
+}
+
+// -----------------------------------------------------------------------------
+
+const sal_uInt16 cBackgroundDepth = 2;
+const sal_uInt16 cBackgroundObjectsDepth = 3;
+const sal_uInt16 cPageObjectsDepth = 4;
+const sal_uInt16 cWaitButtonDepth = 10;
+
+sal_Bool FlashExporter::exportAll( Reference< XComponent > xDoc, Reference< XOutputStream > &xOutputStream, Reference< XStatusIndicator> &xStatusIndicator )
+{
+ Reference< XServiceInfo > xDocServInfo( xDoc, UNO_QUERY );
+ if( xDocServInfo.is() )
+ mbPresentation = xDocServInfo->supportsService( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.PresentationDocument"))) ;
+
+ Reference< XDrawPagesSupplier > xDrawPagesSupplier(xDoc, UNO_QUERY);
+ if(!xDrawPagesSupplier.is())
+ return sal_False;
+
+ Reference< XIndexAccess > xDrawPages( xDrawPagesSupplier->getDrawPages(), UNO_QUERY );
+ if(!xDrawPages.is())
+ return sal_False;
+
+ Reference< XDrawPage > xDrawPage;
+ xDrawPages->getByIndex(0) >>= xDrawPage;
+
+ Reference< XPropertySet > xProp( xDrawPage, UNO_QUERY );
+ try
+ {
+ xProp->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Width") ) ) >>= mnDocWidth;
+ xProp->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Height") ) ) >>= mnDocHeight;
+
+ sal_Int32 nOutputWidth = 14400;
+ sal_Int32 nOutputHeight = (nOutputWidth * mnDocHeight ) / mnDocWidth;
+ delete mpWriter;
+ mpWriter = new Writer( nOutputWidth, nOutputHeight, mnDocWidth, mnDocHeight, mnJPEGcompressMode );
+ }
+ catch( Exception& )
+ {
+ OSL_ASSERT( false );
+ return false; // no writer, no cookies
+ }
+
+ const sal_Int32 nPageCount = xDrawPages->getCount();
+ sal_uInt16 nPage;
+ if ( xStatusIndicator.is() )
+ xStatusIndicator->start(OUString( RTL_CONSTASCII_USTRINGPARAM( "Macromedia Flash (SWF)" )), nPageCount);
+ for( nPage = 0; nPage < nPageCount; nPage++)
+ {
+ mnPageNumber = nPage + 1;
+
+ if ( xStatusIndicator.is() )
+ xStatusIndicator->setValue( nPage );
+ xDrawPages->getByIndex(nPage) >>= xDrawPage;
+
+ if( !xDrawPage.is())
+ continue;
+
+ Reference< XPropertySet > xPropSet( xDrawPage, UNO_QUERY );
+ if( mbPresentation )
+ {
+ sal_Bool bVisible = sal_False;
+ xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Visible") ) ) >>= bVisible;
+ if( !bVisible )
+ continue;
+ }
+
+ exportBackgrounds( xDrawPage, nPage, false );
+ exportBackgrounds( xDrawPage, nPage, true );
+
+ maPagesMap[nPage].mnForegroundID = mpWriter->startSprite();
+ exportDrawPageContents( xDrawPage, false, false );
+ mpWriter->endSprite();
+
+ // AS: If the background is different than the previous slide,
+ // we have to remove the old one and place the new one.
+ if (nPage)
+ {
+ if (maPagesMap[nPage].mnBackgroundID != maPagesMap[nPage-1].mnBackgroundID)
+ {
+ mpWriter->removeShape(cBackgroundDepth);
+ mpWriter->placeShape( maPagesMap[nPage].mnBackgroundID, cBackgroundDepth, 0, 0 );
+ }
+
+ if (maPagesMap[nPage].mnObjectsID != maPagesMap[nPage-1].mnObjectsID)
+ {
+ mpWriter->removeShape(cBackgroundObjectsDepth);
+ mpWriter->placeShape( maPagesMap[nPage].mnObjectsID, cBackgroundObjectsDepth, 0, 0 );
+ }
+
+ // AS: Remove the Foreground of the previous slide.
+ mpWriter->removeShape(cPageObjectsDepth);
+ }
+ else
+ {
+ mpWriter->placeShape( maPagesMap[nPage].mnBackgroundID, cBackgroundDepth, 0, 0 );
+ mpWriter->placeShape( maPagesMap[nPage].mnObjectsID, cBackgroundObjectsDepth, 0, 0 );
+ }
+
+ mpWriter->placeShape( maPagesMap[nPage].mnForegroundID, cPageObjectsDepth, 0, 0 );
+
+ mpWriter->waitOnClick( cWaitButtonDepth );
+ mpWriter->showFrame();
+ }
+
+ mpWriter->removeShape( cBackgroundDepth );
+ mpWriter->removeShape( cBackgroundObjectsDepth );
+ mpWriter->removeShape( cPageObjectsDepth );
+ mpWriter->gotoFrame( 0 );
+ mpWriter->showFrame();
+
+ mpWriter->storeTo( xOutputStream );
+
+ return sal_True;
+}
+
+
+sal_Bool FlashExporter::exportSlides( Reference< XDrawPage > xDrawPage, Reference< XOutputStream > &xOutputStream, sal_uInt16 /* nPage */ )
+{
+ Reference< XPropertySet > xPropSet( xDrawPage, UNO_QUERY );
+ if( !xDrawPage.is() || !xPropSet.is() )
+ return sal_False;
+
+ try
+ {
+ if( NULL == mpWriter )
+ {
+ xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Width") ) ) >>= mnDocWidth;
+ xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Height") ) ) >>= mnDocHeight;
+
+ mpWriter = new Writer( 14400, 10800, mnDocWidth, mnDocHeight, mnJPEGcompressMode );
+ }
+
+ if( mbPresentation )
+ {
+ sal_Bool bVisible = sal_False;
+ xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Visible") ) ) >>= bVisible;
+ if( !bVisible )
+ return sal_False;
+ }
+ }
+ catch( Exception& )
+ {
+ OSL_ASSERT( false );
+ }
+
+ exportDrawPageContents(xDrawPage, true, false);
+
+ mpWriter->storeTo( xOutputStream );
+
+ return sal_True;
+}
+
+sal_uInt16 FlashExporter::exportBackgrounds( Reference< XDrawPage > xDrawPage, Reference< XOutputStream > &xOutputStream, sal_uInt16 nPage, sal_Bool bExportObjects )
+{
+ Reference< XPropertySet > xPropSet( xDrawPage, UNO_QUERY );
+ if( !xDrawPage.is() || !xPropSet.is() )
+ return sal_False;
+
+ if( NULL == mpWriter )
+ {
+ xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Width") ) ) >>= mnDocWidth;
+ xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Height") ) ) >>= mnDocHeight;
+
+ mpWriter = new Writer( 14400, 10800, mnDocWidth, mnDocHeight, mnJPEGcompressMode );
+ }
+
+ sal_uInt16 ret = exportBackgrounds(xDrawPage, nPage, bExportObjects);
+
+ if (ret != nPage)
+ return ret;
+
+ if (bExportObjects)
+ mpWriter->placeShape( maPagesMap[nPage].mnObjectsID, _uInt16(1), 0, 0 );
+ else
+ mpWriter->placeShape( maPagesMap[nPage].mnBackgroundID, _uInt16(0), 0, 0 );
+
+ mpWriter->storeTo( xOutputStream );
+
+ return nPage;
+}
+
+sal_uInt16 FlashExporter::exportBackgrounds( Reference< XDrawPage > xDrawPage, sal_uInt16 nPage, sal_Bool bExportObjects )
+{
+ Reference< XPropertySet > xPropSet( xDrawPage, UNO_QUERY );
+ if( !xDrawPage.is() || !xPropSet.is() )
+ return sal_False;
+
+ sal_Bool bBackgroundVisible = true;
+ sal_Bool bBackgroundObjectsVisible = true;
+
+ if( mbPresentation )
+ {
+ xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("IsBackgroundVisible") ) ) >>= bBackgroundVisible;
+ xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("IsBackgroundObjectsVisible") ) ) >>= bBackgroundObjectsVisible;
+ }
+
+
+ if (bExportObjects)
+ {
+ if (bBackgroundObjectsVisible)
+ {
+ Reference< XMasterPageTarget > xMasterPageTarget( xDrawPage, UNO_QUERY );
+ if( !xMasterPageTarget.is() )
+ {
+ maPagesMap[nPage].mnObjectsID = 0xffff;
+ return 0xffff;
+ }
+ Reference<XDrawPage> aTemp = xMasterPageTarget->getMasterPage();
+ sal_uInt16 ret = exportMasterPageObjects(nPage, aTemp);
+ if (ret != nPage)
+ return ret;
+ }
+ else
+ {
+ maPagesMap[nPage].mnObjectsID = 0xffff;
+ return 0xffff;
+ }
+ }
+ else
+ {
+ if (bBackgroundVisible)
+ {
+ sal_uInt16 ret = exportDrawPageBackground(nPage, xDrawPage);
+
+ if (ret != nPage)
+ return ret;
+ }
+ else
+ {
+ maPagesMap[nPage].mnBackgroundID = 0xffff;
+ return 0xffff;
+ }
+ }
+
+ return nPage;
+}
+
+#ifdef AUGUSTUS
+sal_Bool FlashExporter::exportSound( Reference< XOutputStream > &xOutputStream, const char* wavfilename )
+{
+ try
+ {
+ delete mpWriter;
+ mpWriter = new Writer( 0, 0, 0, 0 );
+ }
+ catch( Exception& )
+ {
+ OSL_ASSERT( false );
+ }
+
+ if (!mpWriter->streamSound(wavfilename))
+ return sal_False;
+ else
+ mpWriter->storeTo( xOutputStream );
+
+ return sal_True;
+}
+#endif // defined AUGUSTUS
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 nPlaceDepth;
+// AS: A Slide can have a private background or use its masterpage's background.
+// We use the checksums on the metafiles to tell if backgrounds are the same and
+// should be reused. The return value indicates which slide's background to use.
+// If the return value != nPage, then there is no background (if == -1) or the
+// background has already been exported.
+sal_uInt16 FlashExporter::exportDrawPageBackground(sal_uInt16 nPage, Reference< XDrawPage >& xPage)
+{
+ sal_uInt16 rBackgroundID;
+
+ GDIMetaFile aMtfPrivate, aMtfMaster;
+ Reference< XComponent > xComponent( xPage, UNO_QUERY );
+
+ Reference< XMasterPageTarget > xMasterPageTarget( xPage, UNO_QUERY );
+ if( !xMasterPageTarget.is() )
+ return 0xffff;
+
+ Reference< XDrawPage > xMasterPage = xMasterPageTarget->getMasterPage();
+ if( !xMasterPage.is())
+ return 0xffff;
+
+ Reference< XComponent > xCompMaster( xMasterPage, UNO_QUERY );
+
+ getMetaFile( xCompMaster, aMtfMaster, true );
+ getMetaFile( xComponent, aMtfPrivate, true );
+
+ sal_uInt32 masterchecksum = aMtfMaster.GetChecksum();
+ sal_uInt32 privatechecksum = aMtfPrivate.GetChecksum();
+
+ // AS: If the slide has its own background
+ if (privatechecksum)
+ {
+ ChecksumCache::iterator it = gPrivateCache.find(privatechecksum);
+
+ // AS: and we've previously encountered this background, just return
+ // the previous index.
+ if (gPrivateCache.end() != it)
+ {
+ maPagesMap[nPage].mnBackgroundID =
+ maPagesMap[it->second].mnBackgroundID;
+ return it->second;
+ }
+ else
+ {
+ // AS: Otherwise, cache this checksum.
+ gPrivateCache[privatechecksum] = nPage;
+
+ rBackgroundID = mpWriter->defineShape( aMtfPrivate );
+
+ maPagesMap[nPage].mnBackgroundID = rBackgroundID;
+ return nPage;
+ }
+ }
+
+ // AS: Ok, no private background. Use the master page's.
+ // AS: Have we already exported this master page?
+ ChecksumCache::iterator it = gMasterCache.find(masterchecksum);
+
+ if (gMasterCache.end() != it)
+ {
+ maPagesMap[nPage].mnBackgroundID =
+ maPagesMap[it->second].mnBackgroundID;
+
+ return it->second; // AS: Yes, so don't export it again.
+ }
+
+ gMasterCache[masterchecksum] = nPage;
+
+ rBackgroundID = mpWriter->defineShape( aMtfMaster );
+
+ maPagesMap[nPage].mnBackgroundID = rBackgroundID;
+
+ return nPage;
+}
+
+sal_uInt16 FlashExporter::exportMasterPageObjects(sal_uInt16 nPage, Reference< XDrawPage >& xMasterPage)
+{
+ Reference< XShapes > xShapes( xMasterPage, UNO_QUERY );
+
+ sal_uInt32 shapesum = ActionSummer(xShapes);
+
+ ChecksumCache::iterator it = gObjectCache.find(shapesum);
+
+ if (gObjectCache.end() != it)
+ {
+ maPagesMap[nPage].mnObjectsID =
+ maPagesMap[it->second].mnObjectsID;
+
+ return it->second; // AS: Yes, so don't export it again.
+ }
+
+ gObjectCache[shapesum] = nPage;
+
+ sal_uInt16 rObjectsID = mpWriter->startSprite();
+ exportDrawPageContents( xMasterPage, false, true );
+ mpWriter->endSprite();
+
+ maPagesMap[nPage].mnObjectsID = rObjectsID;
+
+ return nPage;
+}
+
+// -----------------------------------------------------------------------------
+
+/** export's the definition of the shapes inside this drawing page and adds the
+ shape infos to the current PageInfo */
+void FlashExporter::exportDrawPageContents( Reference< XDrawPage >& xPage, bool bStream, bool bMaster )
+{
+ Reference< XShapes > xShapes( xPage, UNO_QUERY );
+ exportShapes(xShapes, bStream, bMaster);
+}
+
+// -----------------------------------------------------------------------------
+
+/** export's the definition of the shapes inside this XShapes container and adds the
+ shape infos to the current PageInfo */
+void FlashExporter::exportShapes( Reference< XShapes >& xShapes, bool bStream, bool bMaster )
+{
+ OSL_ENSURE( (xShapes->getCount() <= 0xffff), "overflow in FlashExporter::exportDrawPageContents()" );
+
+ sal_uInt16 nShapeCount = (sal_uInt16)min( xShapes->getCount(), (sal_Int32)0xffff );
+ sal_uInt16 nShape;
+
+ Reference< XShape > xShape;
+
+ for( nShape = 0; nShape < nShapeCount; nShape++ )
+ {
+ xShapes->getByIndex( nShape ) >>= xShape;
+
+ if( xShape.is() )
+ {
+ Reference< XShapes > xShapes2( xShape, UNO_QUERY );
+ if( xShapes2.is() && xShape->getShapeType().equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.GroupShape")))
+ // export the contents of group shapes, but we only ever stream at the top
+ // recursive level anyway, so pass false for streaming.
+ exportShapes( xShapes2, false, bMaster);
+ else
+ exportShape( xShape, bMaster);
+ }
+
+ if (bStream)
+ mpWriter->showFrame();
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+/** export this shape definition and adds it's info to the current PageInfo */
+void FlashExporter::exportShape( Reference< XShape >& xShape, bool bMaster )
+{
+ Reference< XPropertySet > xPropSet( xShape, UNO_QUERY );
+ if( !xPropSet.is() )
+ return;
+
+ if( mbPresentation )
+ {
+ try
+ {
+ // skip empty presentation objects
+ sal_Bool bEmpty = sal_False;
+ xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") ) ) >>= bEmpty;
+ if( bEmpty )
+ return;
+
+ // don't export presentation placeholders on masterpage
+ // they can be non empty when user edits the default texts
+ if( bMaster )
+ {
+ OUString aShapeType( xShape->getShapeType() );
+ if( (0 == aShapeType.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.presentation.TitleTextShape" ))) ||
+ (0 == aShapeType.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.presentation.OutlinerShape" ))) ||
+ (0 == aShapeType.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.presentation.HeaderShape" ))) ||
+ (0 == aShapeType.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.presentation.FooterShape" ))) ||
+ (0 == aShapeType.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.presentation.SlideNumberShape" ))) ||
+ (0 == aShapeType.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.presentation.DateTimeShape" ))))
+ return;
+ }
+ }
+ catch( Exception& )
+ {
+ // TODO: If we are exporting a draw, this property is not available
+ }
+ }
+
+ try
+ {
+ com::sun::star::awt::Point aPosition( xShape->getPosition() );
+ com::sun::star::awt::Size aSize( xShape->getSize() );
+
+ com::sun::star::awt::Rectangle aBoundRect;//(aPosition.X, aPosition.Y, aSize.Width, aSize.Height);
+ xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("BoundRect") ) ) >>= aBoundRect;
+
+ ShapeInfo* pShapeInfo = new ShapeInfo();
+ pShapeInfo->mnX = aBoundRect.X;
+ pShapeInfo->mnY = aBoundRect.Y;
+ pShapeInfo->mnWidth = aBoundRect.Width;
+ pShapeInfo->mnHeight = aBoundRect.Height;
+
+ if( mbPresentation )
+ {
+ xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Bookmark") ) ) >>= pShapeInfo->maBookmark;
+ xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("DimColor") ) ) >>= pShapeInfo->mnDimColor;
+ xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("DimHide") ) ) >>= pShapeInfo->mbDimHide;
+ xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("DimPrevious") ) ) >>= pShapeInfo->mbDimPrev;
+ xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Effect") ) ) >>= pShapeInfo->meEffect;
+ xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("PlayFull") ) ) >>= pShapeInfo->mbPlayFull;
+ xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("PresentationOrder") ) ) >>= pShapeInfo->mnPresOrder;
+ xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Sound") ) ) >>= pShapeInfo->maSoundURL;
+ xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("SoundOn") ) ) >>= pShapeInfo->mbSoundOn;
+ xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Speed") ) ) >>= pShapeInfo->meEffectSpeed;
+ xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("TextEffect") ) ) >>= pShapeInfo->meTextEffect;
+ xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("TransparentColor") ) ) >>= pShapeInfo->mnBlueScreenColor;
+ }
+
+// long ZOrder;
+// xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("ZOrder") ) ) >>= ZOrder;
+
+ GDIMetaFile aMtf;
+ Reference< XComponent > xComponent( xShape, UNO_QUERY );
+
+ bool bIsOleObject = xShape->getShapeType().equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.OLE2Shape"))
+ || xShape->getShapeType().equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.OLE2Shape"));
+
+ getMetaFile( xComponent, aMtf );
+
+ // AS: If it's an OLE object, then export a JPEG if the user requested.
+ // In this case, we use the bounding rect info generated in the first getMetaFile
+ // call, and then clear the metafile and add a BMP action. This may be turned into
+ // a JPEG, depending on what gives the best compression.
+ if (bIsOleObject && mbExportOLEAsJPEG)
+ getMetaFile( xComponent, aMtf, false, true );
+
+ sal_uInt16 nID;
+ sal_uInt32 checksum = aMtf.GetChecksum();
+
+ ChecksumCache::iterator it = gMetafileCache.find(checksum);
+
+ if (gMetafileCache.end() != it)
+ nID = it->second;
+ else
+ {
+ nID = mpWriter->defineShape( aMtf );
+ gMetafileCache[checksum] = nID;
+ }
+
+ if (!nID)
+ return;
+
+ pShapeInfo->mnID = nID;
+
+// pPageInfo->addShape( pShapeInfo );
+
+ mpWriter->placeShape( pShapeInfo->mnID, _uInt16(nPlaceDepth++), pShapeInfo->mnX, pShapeInfo->mnY );
+
+ delete pShapeInfo;
+ }
+ catch( Exception& )
+ {
+ OSL_ASSERT(false);
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+bool FlashExporter::getMetaFile( Reference< XComponent >&xComponent, GDIMetaFile& rMtf, bool bOnlyBackground /* = false */, bool bExportAsJPEG /* = false */)
+{
+ if( !mxGraphicExporter.is() )
+ mxGraphicExporter = Reference< XExporter >::query( mxMSF->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.GraphicExportFilter") ) ) );
+
+ Reference< XFilter > xFilter( mxGraphicExporter, UNO_QUERY );
+
+ utl::TempFile aFile;
+ aFile.EnableKillingFile();
+
+ Sequence< PropertyValue > aFilterData(bExportAsJPEG ? 3 : 2);
+ aFilterData[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM("Version") );
+ aFilterData[0].Value <<= (sal_Int32)6000;
+ aFilterData[1].Name = OUString( RTL_CONSTASCII_USTRINGPARAM("PageNumber") );
+ aFilterData[1].Value <<= mnPageNumber;
+
+ if(bExportAsJPEG)
+ {
+ aFilterData[2].Name = OUString( RTL_CONSTASCII_USTRINGPARAM("Translucent") );
+ aFilterData[2].Value <<= (sal_Bool)sal_True;
+ }
+
+ Sequence< PropertyValue > aDescriptor( bOnlyBackground ? 4 : 3 );
+ aDescriptor[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM("FilterName") );
+
+ // AS: If we've been asked to export as an image, then use the BMP filter.
+ // Otherwise, use SVM. This is useful for things that don't convert well as
+ // metafiles, like the occasional OLE object.
+ aDescriptor[0].Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM(bExportAsJPEG ? "PNG" : "SVM") );
+
+ aDescriptor[1].Name = OUString( RTL_CONSTASCII_USTRINGPARAM("URL") );
+ aDescriptor[1].Value <<= OUString( aFile.GetURL() );
+ aDescriptor[2].Name = OUString( RTL_CONSTASCII_USTRINGPARAM("FilterData") );
+ aDescriptor[2].Value <<= aFilterData;
+ if( bOnlyBackground )
+ {
+ aDescriptor[3].Name = OUString( RTL_CONSTASCII_USTRINGPARAM("ExportOnlyBackground") );
+ aDescriptor[3].Value <<= (sal_Bool)bOnlyBackground;
+ }
+ mxGraphicExporter->setSourceDocument( xComponent );
+ xFilter->filter( aDescriptor );
+
+ if (bExportAsJPEG)
+ {
+ Graphic aGraphic;
+ GraphicFilter aFilter(false);
+
+ aFilter.ImportGraphic( aGraphic, String(aFile.GetURL()), *aFile.GetStream( STREAM_READ ) );
+ BitmapEx rBitmapEx( aGraphic.GetBitmap(), Color(255,255,255) );
+
+ Rectangle clipRect;
+ for( ULONG i = 0, nCount = rMtf.GetActionCount(); i < nCount; i++ )
+ {
+ const MetaAction* pAction = rMtf.GetAction( i );
+ const USHORT nType = pAction->GetType();
+
+ switch( nType )
+ {
+ case( META_ISECTRECTCLIPREGION_ACTION ):
+ {
+ const MetaISectRectClipRegionAction* pA = (const MetaISectRectClipRegionAction*) pAction;
+ clipRect = pA->GetRect();
+ i = nCount;
+ break;
+ }
+ }
+ }
+ MetaBmpExScaleAction *pmetaAct = new MetaBmpExScaleAction(Point(clipRect.Left(), clipRect.Top()), Size(clipRect.GetWidth(), clipRect.GetHeight()), rBitmapEx);
+
+ rMtf.Clear();
+ rMtf.AddAction(pmetaAct);
+
+ }
+ else
+ rMtf.Read( *aFile.GetStream( STREAM_READ ) );
+
+ int icount = rMtf.GetActionCount();
+ return icount != 0;
+}
+
+sal_uInt32 FlashExporter::ActionSummer(Reference< XShape >& xShape)
+{
+ Reference< XShapes > xShapes( xShape, UNO_QUERY );
+
+ if( xShapes.is() )
+ {
+ return ActionSummer(xShapes);
+ }
+ else
+ {
+ Reference< XComponent > xComponentShape( xShape, UNO_QUERY );
+
+ GDIMetaFile aMtf;
+ getMetaFile( xComponentShape, aMtf);
+
+ return aMtf.GetChecksum();
+ }
+}
+
+sal_uInt32 FlashExporter::ActionSummer(Reference< XShapes >& xShapes)
+{
+ sal_uInt32 nShapeCount = xShapes->getCount();
+ sal_uInt32 shapecount = 0;
+
+ Reference< XShape > xShape2;
+
+ for( sal_uInt16 nShape = 0; nShape < nShapeCount; nShape++ )
+ {
+ xShapes->getByIndex( nShape ) >>= xShape2;
+
+ shapecount += ActionSummer(xShape2);
+ }
+
+ return shapecount;
+}
diff --git a/filter/source/flash/swfexporter.hxx b/filter/source/flash/swfexporter.hxx
new file mode 100644
index 000000000000..356eaa1954e1
--- /dev/null
+++ b/filter/source/flash/swfexporter.hxx
@@ -0,0 +1,218 @@
+/*************************************************************************
+ *
+ * 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 _FLASH_EXPORTER_HXX
+#define _FLASH_EXPORTER_HXX
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/document/XExporter.hpp>
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <com/sun/star/presentation/AnimationEffect.hpp>
+#include <com/sun/star/presentation/AnimationSpeed.hpp>
+#include <com/sun/star/presentation/ClickAction.hpp>
+#include <com/sun/star/presentation/FadeEffect.hpp>
+#include <osl/file.hxx>
+
+#include <vector>
+#include <map>
+
+#include <stdio.h>
+
+typedef ::std::map<sal_uInt32, sal_uInt16> ChecksumCache;
+
+class GDIMetaFile;
+
+inline ::rtl::OUString STR(const sal_Char * in)
+{
+ return ::rtl::OUString::createFromAscii(in);
+}
+
+inline ::rtl::OUString VAL(sal_Int32 in)
+{
+ return ::rtl::OUString::valueOf(in);
+}
+
+namespace swf {
+
+class Writer;
+// -----------------------------------------------------------------------------
+
+class ShapeInfo
+{
+public:
+ sal_uInt16 mnID; // the character id for the sprite definition of this shape
+
+ sal_Int32 mnX;
+ sal_Int32 mnY;
+
+ sal_Int32 mnWidth;
+ sal_Int32 mnHeight;
+
+ ::com::sun::star::presentation::AnimationEffect meEffect;
+ ::com::sun::star::presentation::AnimationEffect meTextEffect;
+ ::com::sun::star::presentation::AnimationSpeed meEffectSpeed;
+
+ sal_Int32 mnPresOrder;
+
+ ::com::sun::star::presentation::ClickAction meClickAction;
+ ::rtl::OUString maBookmark;
+
+ sal_Int32 mnDimColor;
+ sal_Bool mbDimHide;
+ sal_Bool mbDimPrev;
+
+ sal_Bool mbSoundOn;
+ sal_Bool mbPlayFull;
+ ::rtl::OUString maSoundURL;
+
+ sal_Int32 mnBlueScreenColor;
+
+ ShapeInfo() :
+ mnID(0), mnX(0), mnY(0),
+ meEffect( ::com::sun::star::presentation::AnimationEffect_NONE ),
+ meTextEffect( ::com::sun::star::presentation::AnimationEffect_NONE ),
+ meEffectSpeed( ::com::sun::star::presentation::AnimationSpeed_MEDIUM ),
+ mnPresOrder( 0 ),
+ meClickAction( ::com::sun::star::presentation::ClickAction_NONE ),
+ mnDimColor( 0 ),
+ mbDimHide( false ),
+ mbDimPrev( false ),
+ mbSoundOn( false ),
+ mbPlayFull( false ),
+ mnBlueScreenColor( 0 ) {}
+};
+
+typedef ::std::vector<ShapeInfo*> ShapeInfoVector;
+
+// -----------------------------------------------------------------------------
+
+struct ShapeAnimationInfo
+{
+ ShapeInfo* mpShapeInfo;
+ sal_uInt16 mnDepth;
+
+ ShapeAnimationInfo( ShapeInfo* pShapeInfo, sal_uInt16 nDepth ) : mpShapeInfo( pShapeInfo ), mnDepth( nDepth ) {}
+};
+
+typedef std::vector<ShapeAnimationInfo> ShapeAnimationInfoVector;
+
+// -----------------------------------------------------------------------------
+
+struct PageInfo
+{
+ ::com::sun::star::presentation::FadeEffect meFadeEffect;
+ ::com::sun::star::presentation::AnimationSpeed meFadeSpeed;
+
+ sal_Int32 mnDuration;
+ sal_Int32 mnChange;
+
+ sal_uInt16 mnBackgroundID;
+ sal_uInt16 mnObjectsID;
+ sal_uInt16 mnForegroundID;
+
+ sal_Bool mbBackgroundVisible;
+ sal_Bool mbBackgroundObjectsVisible;
+
+ ShapeInfoVector maShapesVector;
+
+ PageInfo();
+ ~PageInfo();
+
+#ifdef THEFUTURE
+ void addShape( ShapeInfo* pShapeInfo );
+#endif
+
+};
+
+// -----------------------------------------------------------------------------
+
+typedef ::std::map<sal_uInt32, PageInfo> PageInfoMap;
+
+// -----------------------------------------------------------------------------
+
+class FlashExporter
+{
+public:
+ FlashExporter( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxMSF, sal_Int32 nJPEGCompressMode = -1, sal_Bool bExportOLEAsJPEG = false);
+ ~FlashExporter();
+
+ void Flush();
+
+ sal_Bool exportAll( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > xDoc, com::sun::star::uno::Reference< com::sun::star::io::XOutputStream > &xOutputStream, ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator> &xStatusIndicator );
+ sal_Bool exportSlides( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > xDrawPage, com::sun::star::uno::Reference< com::sun::star::io::XOutputStream > &xOutputStream, sal_uInt16 nPage);
+ sal_uInt16 exportBackgrounds( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > xDrawPage, com::sun::star::uno::Reference< com::sun::star::io::XOutputStream > &xOutputStream, sal_uInt16 nPage, sal_Bool bExportObjects );
+ sal_uInt16 exportBackgrounds( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > xDrawPage, sal_uInt16 nPage, sal_Bool bExportObjects );
+
+#ifdef AUGUSTUS
+ sal_Bool exportSound( com::sun::star::uno::Reference< com::sun::star::io::XOutputStream > &xOutputStream, const char* wavfilename );
+#endif
+
+ ChecksumCache gMasterCache;
+ ChecksumCache gPrivateCache;
+ ChecksumCache gObjectCache;
+ ChecksumCache gMetafileCache;
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF;
+ ::com::sun::star::uno::Reference< ::com::sun::star::document::XExporter > mxGraphicExporter;
+
+ PageInfoMap maPagesMap;
+
+ sal_uInt16 exportDrawPageBackground(sal_uInt16 nPage, ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xPage);
+ sal_uInt16 exportMasterPageObjects(sal_uInt16 nPage, ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xMasterPage);
+
+ void exportDrawPageContents( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xPage, bool bStream, bool bMaster );
+ void exportShapes( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xShapes, bool bStream, bool bMaster );
+ void exportShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape, bool bMaster);
+
+ sal_uInt32 ActionSummer(::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape);
+ sal_uInt32 ActionSummer(::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xShapes);
+
+ void animateShape( ShapeAnimationInfo& rAnimInfo );
+ void animatePage( PageInfo* pPageInfo );
+
+ bool getMetaFile( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >&xComponent, GDIMetaFile& rMtf, bool bOnlyBackground = false, bool bExportAsJPEG = false );
+
+ Writer* mpWriter;
+
+ sal_Int32 mnDocWidth;
+ sal_Int32 mnDocHeight;
+
+ sal_Int32 mnJPEGcompressMode;
+
+ sal_Bool mbExportOLEAsJPEG;
+
+ sal_Bool mbPresentation;
+
+ sal_Int32 mnPageNumber;
+};
+
+}
+
+#endif
diff --git a/filter/source/flash/swffilter.cxx b/filter/source/flash/swffilter.cxx
new file mode 100644
index 000000000000..03d9d003c30d
--- /dev/null
+++ b/filter/source/flash/swffilter.cxx
@@ -0,0 +1,526 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+#include <com/sun/star/frame/XDesktop.hpp>
+#include <com/sun/star/frame/XStorable.hpp>
+#include <com/sun/star/document/XFilter.hpp>
+#include <com/sun/star/document/XExporter.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
+#include <com/sun/star/drawing/XDrawView.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/task/XStatusIndicatorFactory.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/implbase4.hxx>
+#include <osl/file.hxx>
+
+#include "swfexporter.hxx"
+
+//#include <stdlib.h>
+//#include <windows.h>
+#include <string.h>
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::presentation;
+using namespace ::com::sun::star::task;
+
+using ::rtl::OUString;
+using ::rtl::OString;
+using ::com::sun::star::lang::XComponent;
+using ::com::sun::star::beans::PropertyValue;
+using ::com::sun::star::io::XOutputStream;
+using ::com::sun::star::container::XIndexAccess;
+using ::osl::FileBase;
+using ::com::sun::star::frame::XModel;
+
+namespace swf {
+
+typedef ::cppu::WeakImplHelper1<com::sun::star::io::XOutputStream> OslOutputStreamWrapper_Base;
+ // needed for some compilers
+class OslOutputStreamWrapper : public OslOutputStreamWrapper_Base
+{
+ osl::File mrFile;
+
+public:
+ OslOutputStreamWrapper(const OUString& sFileName) : mrFile(sFileName)
+ {
+ osl_removeFile(sFileName.pData);
+ mrFile.open(OpenFlag_Create|OpenFlag_Write);
+ }
+
+ // stario::XOutputStream
+ virtual void SAL_CALL writeBytes( const ::com::sun::star::uno::Sequence< sal_Int8 >& aData ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL flush( ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL closeOutput( ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+};
+
+void SAL_CALL OslOutputStreamWrapper::writeBytes( const ::com::sun::star::uno::Sequence< sal_Int8 >& aData ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
+{
+ sal_uInt64 uBytesToWrite = aData.getLength();
+ sal_uInt64 uBytesWritten = 0;
+
+ sal_Int8 const * pBuffer = aData.getConstArray();
+
+ while( uBytesToWrite )
+ {
+ osl::File::RC eRC = mrFile.write( pBuffer, uBytesToWrite, uBytesWritten);
+
+ switch( eRC )
+ {
+ case osl::File::E_INVAL: // the format of the parameters was not valid
+ case osl::File::E_FBIG: // File too large
+
+ case osl::File::E_AGAIN: // Operation would block
+ case osl::File::E_BADF: // Bad file
+ case osl::File::E_FAULT: // Bad address
+ case osl::File::E_INTR: // function call was interrupted
+ case osl::File::E_IO: // I/O error
+ case osl::File::E_NOLCK: // No record locks available
+ case osl::File::E_NOLINK: // Link has been severed
+ case osl::File::E_NOSPC: // No space left on device
+ case osl::File::E_NXIO: // No such device or address
+ throw com::sun::star::io::IOException(); // TODO: Better error handling
+ default: break;
+ }
+
+ uBytesToWrite -= uBytesWritten;
+ pBuffer += uBytesWritten;
+ }
+}
+
+void SAL_CALL OslOutputStreamWrapper::flush( ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
+{
+}
+
+void SAL_CALL OslOutputStreamWrapper::closeOutput( ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
+{
+ osl::File::RC eRC = mrFile.close();
+
+ switch( eRC )
+ {
+ case osl::File::E_INVAL: // the format of the parameters was not valid
+
+ case osl::File::E_BADF: // Bad file
+ case osl::File::E_INTR: // function call was interrupted
+ case osl::File::E_NOLINK: // Link has been severed
+ case osl::File::E_NOSPC: // No space left on device
+ case osl::File::E_IO: // I/O error
+ throw com::sun::star::io::IOException(); // TODO: Better error handling
+ default: break;
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+class FlashExportFilter : public cppu::WeakImplHelper4
+<
+ com::sun::star::document::XFilter,
+ com::sun::star::document::XExporter,
+ com::sun::star::lang::XInitialization,
+ com::sun::star::lang::XServiceInfo
+>
+{
+ Reference< XComponent > mxDoc;
+ Reference< XMultiServiceFactory > mxMSF;
+ Reference< XStatusIndicator> mxStatusIndicator;
+
+ osl::File* mpFile;
+
+public:
+ FlashExportFilter( const Reference< XMultiServiceFactory > &rxMSF);
+
+ // XFilter
+ virtual sal_Bool SAL_CALL filter( const Sequence< PropertyValue >& aDescriptor ) throw(RuntimeException);
+
+ sal_Bool ExportAsMultipleFiles( const Sequence< PropertyValue >& aDescriptor );
+ sal_Bool ExportAsSingleFile( const Sequence< PropertyValue >& aDescriptor );
+
+ virtual void SAL_CALL cancel( ) throw (RuntimeException);
+
+ // XExporter
+ virtual void SAL_CALL setSourceDocument( const Reference< XComponent >& xDoc ) throw(IllegalArgumentException, RuntimeException);
+
+ // XInitialization
+ virtual void SAL_CALL initialize( const Sequence< Any >& aArguments ) throw(Exception, RuntimeException);
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() throw(RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(RuntimeException);
+ virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(RuntimeException);
+};
+
+// -----------------------------------------------------------------------------
+
+FlashExportFilter::FlashExportFilter(const Reference< XMultiServiceFactory > &rxMSF)
+: mxMSF( rxMSF )
+{
+}
+
+
+// -----------------------------------------------------------------------------
+
+OUString exportBackground(FlashExporter &aFlashExporter, Reference< XDrawPage > xDrawPage, OUString sPath, sal_uInt32 nPage, const char* suffix)
+{
+ OUString filename = STR("slide") + VAL(nPage+1) + STR(suffix) + STR(".swf");
+ OUString fullpath = sPath + STR("/") + filename;
+
+ // AS: If suffix is "o" then the last paramter is true (for exporting objects).
+ Reference<XOutputStream> xOutputStreamWrap(*(new OslOutputStreamWrapper(fullpath)), UNO_QUERY);
+ sal_uInt16 nCached = aFlashExporter.exportBackgrounds( xDrawPage, xOutputStreamWrap, sal::static_int_cast<sal_uInt16>( nPage ), *suffix == 'o' );
+ aFlashExporter.Flush();
+ xOutputStreamWrap.clear();
+
+ if (nCached != nPage)
+ {
+ osl_removeFile(fullpath.pData);
+ if ( 0xffff == nCached )
+ return STR("NULL");
+ else
+ return STR("slide") + VAL(nCached+1) + STR(suffix) + STR(".swf");
+ }
+
+ return filename;
+}
+
+template <typename TYPE>
+TYPE findPropertyValue(const Sequence< PropertyValue >& aPropertySequence, const sal_Char* name, TYPE def)
+{
+ TYPE temp = TYPE();
+
+ sal_Int32 nLength = aPropertySequence.getLength();
+ const PropertyValue * pValue = aPropertySequence.getConstArray();
+
+ for ( sal_Int32 i = 0 ; i < nLength; i++)
+ {
+ if ( pValue[i].Name.equalsAsciiL ( name, strlen(name) ) )
+ {
+ pValue[i].Value >>= temp;
+ return temp;
+ }
+ }
+
+ return def;
+}
+
+sal_Bool SAL_CALL FlashExportFilter::filter( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor )
+ throw (RuntimeException)
+{
+ mxStatusIndicator = findPropertyValue<Reference<XStatusIndicator> >(aDescriptor, "StatusIndicator", mxStatusIndicator);
+
+ Sequence< PropertyValue > aFilterData;
+ aFilterData = findPropertyValue<Sequence< PropertyValue > >(aDescriptor, "FilterData", aFilterData);
+
+ if (findPropertyValue<sal_Bool>(aFilterData, "ExportMultipleFiles", false ))
+ {
+ ExportAsMultipleFiles(aDescriptor);
+ }
+ else
+ {
+ ExportAsSingleFile(aDescriptor);
+ }
+
+ if( mxStatusIndicator.is() )
+ mxStatusIndicator->end();
+
+ return sal_True;
+}
+
+
+// AS: When exporting as multiple files, each background, object layer, and slide gets its own
+// file. Additionally, a file called BackgroundConfig.txt is generated, indicating which
+// background and objects (if any) go with each slide. The files are named slideNb.swf,
+// slideNo.swf, and slideNp.swf, where N is the slide number, and b=background, o=objects, and
+// p=slide contents. Note that under normal circumstances, there will be very few b and o files.
+
+// AS: HACK! Right now, I create a directory as a sibling to the swf file selected in the Export
+// dialog. This directory is called presentation.sxi-swf-files. The name of the swf file selected
+// in the Export dialog has no impact on this. All files created are placed in this directory.
+sal_Bool FlashExportFilter::ExportAsMultipleFiles(const Sequence< PropertyValue >& aDescriptor)
+{
+ Reference< XDrawPagesSupplier > xDrawPagesSupplier(mxDoc, UNO_QUERY);
+ if(!xDrawPagesSupplier.is())
+ return sal_False;
+
+ Reference< XIndexAccess > xDrawPages( xDrawPagesSupplier->getDrawPages(), UNO_QUERY );
+ if(!xDrawPages.is())
+ return sal_False;
+
+ Reference< XDesktop > rDesktop( mxMSF->createInstance(OUString::createFromAscii("com.sun.star.frame.Desktop")), UNO_QUERY);
+ if (!rDesktop.is())
+ return sal_False;
+
+ Reference< XStorable > xStorable(rDesktop->getCurrentComponent(), UNO_QUERY);
+ if (!xStorable.is())
+ return sal_False;
+
+ Reference< XDrawPage > xDrawPage;
+
+ Reference< XFrame > rFrame = rDesktop->getCurrentFrame();
+ Reference< XDrawView > rDrawView = Reference< XDrawView >( rFrame->getController(), UNO_QUERY );
+
+ Reference< XDrawPage > rCurrentPage = rDrawView->getCurrentPage();
+
+ Sequence< PropertyValue > aFilterData;
+
+ aFilterData = findPropertyValue<Sequence< PropertyValue > >(aDescriptor, "FilterData", aFilterData);
+
+ //AS: Do a bunch of path mangling to figure out where to put the files.
+
+ OUString sOriginalPath = findPropertyValue<OUString>(aDescriptor, "URL", OUString());
+
+ // AS: sPath is the parent directory, where everything else exists (like the sxi,
+ // the -swf-files folder, the -audio files, etc.
+ int lastslash = sOriginalPath.lastIndexOf('/');
+ OUString sPath( sOriginalPath.copy(0, lastslash) );
+
+ OUString sPresentation(xStorable->getLocation());
+
+ lastslash = sPresentation.lastIndexOf('/') + 1;
+ int lastdot = sPresentation.lastIndexOf('.');
+
+ // AS: The name of the presentation, without 3 character extension.
+ OUString sPresentationName = sPresentation.copy(lastslash, lastdot - lastslash);
+
+ OUString fullpath, swfdirpath, backgroundfilename, objectsfilename;
+
+ swfdirpath = sPath + STR("/") + sPresentationName + STR(".sxi-swf-files");
+
+ oslFileError err;
+ err = osl_createDirectory( swfdirpath.pData );
+
+ fullpath = swfdirpath + STR("/backgroundconfig.txt");
+
+ oslFileHandle xBackgroundConfig( 0 );
+
+ // AS: Only export the background config if we're exporting all of the pages, otherwise we'll
+ // screw it up.
+ sal_Bool bExportAll = findPropertyValue<sal_Bool>(aFilterData, "ExportAll", true);
+ if (bExportAll)
+ {
+ osl_removeFile(fullpath.pData);
+ osl_openFile( fullpath.pData, &xBackgroundConfig, osl_File_OpenFlag_Create | osl_File_OpenFlag_Write );
+
+ sal_uInt64 bytesWritten;
+ err = osl_writeFile(xBackgroundConfig, "slides=", strlen("slides="), &bytesWritten);
+ }
+
+ FlashExporter aFlashExporter( mxMSF, findPropertyValue<sal_Int32>(aFilterData, "CompressMode", 75),
+ findPropertyValue<sal_Bool>(aFilterData, "ExportOLEAsJPEG", false));
+
+ const sal_Int32 nPageCount = xDrawPages->getCount();
+ if ( mxStatusIndicator.is() )
+ mxStatusIndicator->start(OUString( RTL_CONSTASCII_USTRINGPARAM( "Saving :" )), nPageCount);
+
+ for(sal_Int32 nPage = 0; nPage < nPageCount; nPage++)
+ {
+ if ( mxStatusIndicator.is() )
+ mxStatusIndicator->setValue( nPage );
+ xDrawPages->getByIndex(nPage) >>= xDrawPage;
+
+ // AS: If we're only exporting the current page, then skip the rest.
+ if (!bExportAll && xDrawPage != rCurrentPage)
+ continue;
+
+ // AS: Export the background, the background objects, and then the slide contents.
+ if (bExportAll || findPropertyValue<sal_Bool>(aFilterData, "ExportBackgrounds", true))
+ {
+ backgroundfilename = exportBackground(aFlashExporter, xDrawPage, swfdirpath, nPage, "b");
+ }
+
+ if (bExportAll || findPropertyValue<sal_Bool>(aFilterData, "ExportBackgroundObjects", true))
+ {
+ objectsfilename = exportBackground(aFlashExporter, xDrawPage, swfdirpath, nPage, "o");
+ }
+
+ if (bExportAll || findPropertyValue<sal_Bool>(aFilterData, "ExportSlideContents", true))
+ {
+ fullpath = swfdirpath + STR("/slide") + VAL(nPage+1) + STR("p.swf");
+
+ Reference<XOutputStream> xOutputStreamWrap(*(new OslOutputStreamWrapper(fullpath)), UNO_QUERY);
+ sal_Bool ret = aFlashExporter.exportSlides( xDrawPage, xOutputStreamWrap, sal::static_int_cast<sal_uInt16>( nPage ) );
+ aFlashExporter.Flush();
+ xOutputStreamWrap.clear();
+
+ if (!ret)
+ osl_removeFile(fullpath.pData);
+ }
+
+ // AS: Write out to the background config what backgrounds and objects this
+ // slide used.
+ if (bExportAll)
+ {
+ OUString temp = backgroundfilename + STR("|") + objectsfilename;
+ OString ASCIItemp(temp.getStr(), temp.getLength(), RTL_TEXTENCODING_ASCII_US);
+
+ sal_uInt64 bytesWritten;
+ osl_writeFile(xBackgroundConfig, ASCIItemp.getStr(), ASCIItemp.getLength(), &bytesWritten);
+
+ if (nPage < nPageCount - 1)
+ osl_writeFile(xBackgroundConfig, "|", 1, &bytesWritten);
+ }
+
+#ifdef AUGUSTUS
+ if (findPropertyValue<sal_Bool>(aFilterData, "ExportSound", true))
+ {
+ fullpath = swfdirpath + STR("/slide") + VAL(nPage+1) + STR("s.swf");
+
+ OUString wavpath = sPath + STR("/") + sPresentationName + STR(".ppt-audio/slide") + VAL(nPage+1) + STR(".wav");
+ FileBase::getSystemPathFromFileURL(wavpath, wavpath);
+ OString sASCIIPath(wavpath.getStr(), wavpath.getLength(), RTL_TEXTENCODING_ASCII_US);
+
+ Reference<XOutputStream> xOutputStreamWrap(*(new OslOutputStreamWrapper(fullpath)), UNO_QUERY);
+ sal_Bool ret = aFlashExporter.exportSound(xOutputStreamWrap, sASCIIPath.getStr());
+ aFlashExporter.Flush();
+ xOutputStreamWrap.clear();
+
+ if (!ret)
+ osl_removeFile(fullpath.pData);
+ }
+#endif // defined AUGUSTUS
+ }
+
+ if (bExportAll)
+ osl_closeFile(xBackgroundConfig);
+
+ return sal_True;
+}
+
+sal_Bool FlashExportFilter::ExportAsSingleFile(const Sequence< PropertyValue >& aDescriptor)
+{
+ Reference < XOutputStream > xOutputStream = findPropertyValue<Reference<XOutputStream> >(aDescriptor, "OutputStream", 0);
+ Sequence< PropertyValue > aFilterData;
+
+ if (!xOutputStream.is() )
+ {
+ OSL_ASSERT ( 0 );
+ return sal_False;
+ }
+
+ FlashExporter aFlashExporter( mxMSF, findPropertyValue<sal_Int32>(aFilterData, "CompressMode", 75),
+ findPropertyValue<sal_Bool>(aFilterData, "ExportOLEAsJPEG", false));
+
+ return aFlashExporter.exportAll( mxDoc, xOutputStream, mxStatusIndicator );
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL FlashExportFilter::cancel( )
+ throw (RuntimeException)
+{
+}
+
+// -----------------------------------------------------------------------------
+
+// XExporter
+void SAL_CALL FlashExportFilter::setSourceDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xDoc )
+ throw (::com::sun::star::lang::IllegalArgumentException, RuntimeException)
+{
+ mxDoc = xDoc;
+}
+
+// -----------------------------------------------------------------------------
+
+// XInitialization
+void SAL_CALL FlashExportFilter::initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& /* aArguments */ )
+ throw (Exception, RuntimeException)
+{
+}
+
+// -----------------------------------------------------------------------------
+
+OUString FlashExportFilter_getImplementationName ()
+ throw (RuntimeException)
+{
+ return OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Impress.FlashExportFilter" ) );
+}
+
+// -----------------------------------------------------------------------------
+
+#define SERVICE_NAME "com.sun.star.document.ExportFilter"
+
+sal_Bool SAL_CALL FlashExportFilter_supportsService( const OUString& ServiceName )
+ throw (RuntimeException)
+{
+ return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SERVICE_NAME ) );
+}
+
+// -----------------------------------------------------------------------------
+
+Sequence< OUString > SAL_CALL FlashExportFilter_getSupportedServiceNames( )
+ throw (RuntimeException)
+{
+ Sequence < OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME ) );
+ return aRet;
+}
+#undef SERVICE_NAME
+
+// -----------------------------------------------------------------------------
+
+Reference< XInterface > SAL_CALL FlashExportFilter_createInstance( const Reference< XMultiServiceFactory > & rSMgr)
+ throw( Exception )
+{
+ return (cppu::OWeakObject*) new FlashExportFilter( rSMgr );
+}
+
+// -----------------------------------------------------------------------------
+
+// XServiceInfo
+OUString SAL_CALL FlashExportFilter::getImplementationName( )
+ throw (RuntimeException)
+{
+ return FlashExportFilter_getImplementationName();
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SAL_CALL FlashExportFilter::supportsService( const OUString& rServiceName )
+ throw (RuntimeException)
+{
+ return FlashExportFilter_supportsService( rServiceName );
+}
+
+// -----------------------------------------------------------------------------
+
+::com::sun::star::uno::Sequence< OUString > SAL_CALL FlashExportFilter::getSupportedServiceNames( )
+ throw (RuntimeException)
+{
+ return FlashExportFilter_getSupportedServiceNames();
+}
+
+// -----------------------------------------------------------------------------
+
+}
diff --git a/filter/source/flash/swfuno.cxx b/filter/source/flash/swfuno.cxx
new file mode 100644
index 000000000000..d4a11ebb921b
--- /dev/null
+++ b/filter/source/flash/swfuno.cxx
@@ -0,0 +1,136 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+#include <stdio.h>
+
+#include <osl/mutex.hxx>
+#include <osl/thread.h>
+#include <cppuhelper/factory.hxx>
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+
+using namespace ::rtl;
+using namespace ::cppu;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::registry;
+
+namespace swf {
+extern OUString FlashExportFilter_getImplementationName() throw ( RuntimeException );
+extern sal_Bool SAL_CALL FlashExportFilter_supportsService( const OUString& ServiceName ) throw ( RuntimeException );
+extern Sequence< OUString > SAL_CALL FlashExportFilter_getSupportedServiceNames() throw ( RuntimeException );
+extern Reference< XInterface > SAL_CALL FlashExportFilter_createInstance( const Reference< XMultiServiceFactory > & rSMgr) throw ( Exception );
+}
+
+extern rtl::OUString SWFDialog_getImplementationName () throw (com::sun::star::uno::RuntimeException);
+extern com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL SWFDialog_getSupportedServiceNames() throw (com::sun::star::uno::RuntimeException);
+extern com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL SWFDialog_createInstance( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > & rSMgr) throw( com::sun::star::uno::Exception );
+
+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;
+}
+//==================================================================================================
+
+void singlecomponent_writeInfo( Reference< XRegistryKey >& xNewKey, const Sequence< OUString > & rSNL )
+{
+ const OUString * pArray = rSNL.getConstArray();
+ for ( sal_Int32 nPos = rSNL.getLength(); nPos--; )
+ xNewKey->createKey( pArray[nPos] );
+}
+
+SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo(
+ void * /* pServiceManager */, void * pRegistryKey )
+{
+ if (pRegistryKey)
+ {
+ try
+ {
+ Reference< XRegistryKey > xNewKey(
+ reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( FlashExportFilter_getImplementationName() ) );
+ xNewKey = xNewKey->createKey( OUString::createFromAscii( "/UNO/SERVICES" ) );
+
+ singlecomponent_writeInfo( xNewKey, FlashExportFilter_getSupportedServiceNames() );
+
+ xNewKey = reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( SWFDialog_getImplementationName() );
+ xNewKey = xNewKey->createKey( OUString::createFromAscii( "/UNO/SERVICES" ) );
+
+ singlecomponent_writeInfo( xNewKey, SWFDialog_getSupportedServiceNames() );
+
+ return sal_True;
+ }
+ catch (InvalidRegistryException &)
+ {
+ OSL_ENSURE( sal_False, "### InvalidRegistryException!" );
+ }
+ }
+ return sal_False;
+}
+//==================================================================================================
+SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
+ const sal_Char * pImplName, void * pServiceManager, void * /* pRegistryKey */ )
+{
+ void * pRet = 0;
+
+ if( pServiceManager )
+ {
+ Reference< XSingleServiceFactory > xFactory;
+
+ OUString implName = OUString::createFromAscii( pImplName );
+ if ( implName.equals(FlashExportFilter_getImplementationName()) )
+ {
+ xFactory = createSingleFactory(
+ reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
+ OUString::createFromAscii( pImplName ),
+ FlashExportFilter_createInstance, FlashExportFilter_getSupportedServiceNames() );
+
+ }
+ else if ( implName.equals(SWFDialog_getImplementationName()) )
+ {
+ xFactory = createSingleFactory(
+ reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
+ OUString::createFromAscii( pImplName ),
+ SWFDialog_createInstance, SWFDialog_getSupportedServiceNames() );
+ }
+
+ if (xFactory.is())
+ {
+ xFactory->acquire();
+ pRet = xFactory.get();
+ }
+ }
+
+ return pRet;
+}
+}
diff --git a/filter/source/flash/swfwriter.cxx b/filter/source/flash/swfwriter.cxx
new file mode 100644
index 000000000000..dcb6ff76721d
--- /dev/null
+++ b/filter/source/flash/swfwriter.cxx
@@ -0,0 +1,640 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+#include "swfwriter.hxx"
+#include <vcl/virdev.hxx>
+#include <vcl/gdimtf.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
+
+using namespace ::swf;
+using namespace ::std;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::io;
+
+// -----------------------------------------------------------------------------
+
+static MapMode aTWIPSMode( MAP_TWIP );
+static MapMode a100thmmMode( MAP_100TH_MM );
+
+static sal_Int32 map100thmm( sal_Int32 n100thMM )
+{
+ Point aPoint( n100thMM, n100thMM );
+ sal_Int32 nX = OutputDevice::LogicToLogic( aPoint, a100thmmMode, aTWIPSMode ).X();
+ return nX;
+}
+
+// -----------------------------------------------------------------------------
+
+Writer::Writer( sal_Int32 nTWIPWidthOutput, sal_Int32 nTWIPHeightOutput, sal_Int32 nDocWidthInput, sal_Int32 nDocHeightInput, sal_Int32 nJPEGcompressMode )
+: mpClipPolyPolygon( NULL ),
+ mpTag( NULL ),
+ mpSprite( NULL ),
+ mnNextId( 1 ),
+ mnGlobalTransparency(0),
+ mnJPEGCompressMode(nJPEGcompressMode)
+{
+ mpVDev = new VirtualDevice;
+ mpVDev->EnableOutput( sal_False );
+
+ maMovieTempFile.EnableKillingFile();
+ maFontsTempFile.EnableKillingFile();
+
+ mpMovieStream = maMovieTempFile.GetStream( STREAM_WRITE|STREAM_TRUNC );
+ mpFontsStream = maFontsTempFile.GetStream( STREAM_WRITE|STREAM_TRUNC );
+
+ mnFrames = 0;
+
+ mnDocWidth = map100thmm( nDocWidthInput );
+ mnDocHeight = map100thmm( nDocHeightInput );
+
+ mnDocXScale = (double)nTWIPWidthOutput / mnDocWidth;
+ mnDocYScale = (double)nTWIPHeightOutput / mnDocHeight;
+
+#ifndef AUGUSTUS
+ // define an invisible button with the size of a page
+ Rectangle aRect( 0, 0, (long)( mnDocWidth * mnDocXScale ), (long)( mnDocHeight * mnDocYScale ) );
+ Polygon aPoly( aRect );
+ FillStyle aFill = FillStyle( Color(COL_WHITE) );
+ mnWhiteBackgroundShapeId = defineShape( aPoly, aFill );
+
+ ::basegfx::B2DHomMatrix m; // #i73264#
+ mnPageButtonId = createID();
+ startTag( TAG_DEFINEBUTTON );
+ mpTag->addUI16( mnPageButtonId ); // character id for button
+
+ // button records
+ mpTag->addUI8( 0x08 ); // only hit state
+ mpTag->addUI16( mnWhiteBackgroundShapeId ); // shape id of background rectangle
+ mpTag->addUI16( 0 ); // depth for button DANGER!
+ mpTag->addMatrix( m ); // identity matrix
+ mpTag->addUI8( 0 ); // empty color transform
+
+// mpTag->addUI8( 0 ); // end of button records
+
+ // action records
+ mpTag->addUI8( 0x06 ); // ActionPlay
+ mpTag->addUI8( 0 ); // end of action records
+
+ endTag();
+
+ // place a shape that clips shapes depth 2-3 to document boundaries
+// placeShape( mnWhiteBackgroundShapeId, 1, 0, 0, 4 );
+#endif
+}
+
+// -----------------------------------------------------------------------------
+
+Writer::~Writer()
+{
+ delete mpVDev;
+ delete mpSprite;
+ delete mpTag;
+}
+
+// -----------------------------------------------------------------------------
+
+void ImplCopySvStreamToXOutputStream( SvStream& rIn, Reference< XOutputStream > &xOut )
+{
+ sal_uInt32 nBufferSize = 64*1024;
+
+ rIn.Seek( STREAM_SEEK_TO_END );
+ sal_uInt32 nSize = rIn.Tell();
+ rIn.Seek( STREAM_SEEK_TO_BEGIN );
+
+ Sequence< sal_Int8 > aBuffer( min( nBufferSize, nSize ) );
+
+ while( nSize )
+ {
+ if( nSize < nBufferSize )
+ {
+ nBufferSize = nSize;
+ aBuffer.realloc( nSize );
+ }
+
+ sal_uInt32 nRead = rIn.Read( aBuffer.getArray(), nBufferSize );
+ DBG_ASSERT( nRead == nBufferSize, "ImplCopySvStreamToXOutputStream failed!" );
+ xOut->writeBytes( aBuffer );
+
+ if( nRead == 0 )
+ break;
+
+ nSize -= nRead;
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void Writer::storeTo( Reference< XOutputStream > &xOutStream )
+{
+ for(FontMap::iterator i = maFonts.begin(); i != maFonts.end(); i++)
+ {
+ FlashFont* pFont = (*i);
+ pFont->write( *mpFontsStream );
+ delete pFont;
+ }
+
+ // Endtag
+ *mpMovieStream << (sal_uInt16)0;
+
+ Tag aHeader( 0xff );
+
+ aHeader.addUI8( 'F' );
+ aHeader.addUI8( 'W' );
+ aHeader.addUI8( 'S' );
+ aHeader.addUI8( 5 );
+
+ sal_uInt32 nSizePos = aHeader.Tell();
+
+ aHeader << (sal_uInt32)0;
+
+ Rectangle aDocRect( 0, 0, static_cast<long>(mnDocWidth*mnDocXScale), static_cast<long>(mnDocHeight*mnDocYScale) );
+
+ aHeader.addRect( aDocRect );
+
+ // frame delay in 8.8 fixed number of frames per second
+ aHeader.addUI8( 0 );
+ aHeader.addUI8( 12 );
+
+ aHeader.addUI16( _uInt16(mnFrames) );
+
+ const sal_uInt32 nSize = aHeader.Tell() + mpFontsStream->Tell() + mpMovieStream->Tell();
+
+ aHeader.Seek( nSizePos );
+ aHeader << (sal_uInt32)nSize;
+
+ ImplCopySvStreamToXOutputStream( aHeader, xOutStream );
+ ImplCopySvStreamToXOutputStream( *mpFontsStream, xOutStream );
+ ImplCopySvStreamToXOutputStream( *mpMovieStream, xOutStream );
+}
+
+// -----------------------------------------------------------------------------
+
+sal_uInt16 Writer::startSprite()
+{
+ sal_uInt16 nShapeId = createID();
+ mvSpriteStack.push(mpSprite);
+ mpSprite = new Sprite( nShapeId );
+ return nShapeId;
+}
+
+// -----------------------------------------------------------------------------
+
+void Writer::endSprite()
+{
+ if( mpSprite )
+ {
+ startTag( TAG_END );
+ endTag();
+
+ mpSprite->write( *mpMovieStream );
+ delete mpSprite;
+
+ if (mvSpriteStack.size() > 0)
+ {
+ mpSprite = mvSpriteStack.top();
+ mvSpriteStack.pop();
+ }
+ else
+ mpSprite = NULL;
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void Writer::placeShape( sal_uInt16 nID, sal_uInt16 nDepth, sal_Int32 x, sal_Int32 y, sal_uInt16 nClip, const char* pName )
+{
+ startTag( TAG_PLACEOBJECT2 );
+
+ BitStream aBits;
+
+ aBits.writeUB( nClip != 0, 1 ); // Has Clip Actions?
+ aBits.writeUB( 0, 1 ); // reserved
+ aBits.writeUB( pName != NULL, 1 ); // has a name
+ aBits.writeUB( 0, 1 ); // no ratio
+ aBits.writeUB( 0, 1 ); // no color transform
+ aBits.writeUB( 1, 1 ); // has a matrix
+ aBits.writeUB( 1, 1 ); // places a character
+ aBits.writeUB( 0, 1 ); // does not define a character to be moved
+
+ mpTag->addBits( aBits );
+ mpTag->addUI16( nDepth ); // depth
+ mpTag->addUI16( nID ); // character Id
+
+ // #i73264#
+ const basegfx::B2DHomMatrix aMatrix(basegfx::tools::createTranslateB2DHomMatrix(
+ _Int16(static_cast<long>(map100thmm(x)*mnDocXScale)),
+ _Int16(static_cast<long>(map100thmm(y)*mnDocYScale))));
+ mpTag->addMatrix( aMatrix ); // transformation matrix
+
+ if( pName )
+ mpTag->addString( pName );
+
+ if( nClip != 0 )
+ mpTag->addUI16( nClip );
+
+ endTag();
+}
+
+#ifdef THEFUTURE
+// -----------------------------------------------------------------------------
+
+void Writer::moveShape( sal_uInt16 nDepth, sal_Int32 x, sal_Int32 y )
+{
+ startTag( TAG_PLACEOBJECT2 );
+
+ BitStream aBits;
+ aBits.writeUB( 0, 1 ); // Has no Clip Actions
+ aBits.writeUB( 0, 1 ); // reserved
+ aBits.writeUB( 0, 1 ); // has no name
+ aBits.writeUB( 0, 1 ); // no ratio
+ aBits.writeUB( 0, 1 ); // no color transform
+ aBits.writeUB( 1, 1 ); // has a matrix
+ aBits.writeUB( 0, 1 ); // places a character
+ aBits.writeUB( 1, 1 ); // defines a character to be moved
+
+ mpTag->addBits( aBits );
+ mpTag->addUI16( nDepth ); // depth
+
+ // #i73264#
+ const basegfx::B2DHomMatrix aMatrix(basegfx::tools::createTranslateB2DHomMatrix(
+ _Int16(static_cast<long>(map100thmm(x)*mnDocXScale)),
+ _Int16(static_cast<long>(map100thmm(y)*mnDocYScale))));
+ mpTag->addMatrix( aMatrix ); // transformation matrix
+
+ endTag();
+}
+#endif
+
+// -----------------------------------------------------------------------------
+
+void Writer::removeShape( sal_uInt16 nDepth )
+{
+ startTag( TAG_REMOVEOBJECT2 );
+ mpTag->addUI16( nDepth ); // depth
+ endTag();
+}
+
+// -----------------------------------------------------------------------------
+
+void Writer::startTag( sal_uInt8 nTagId )
+{
+ DBG_ASSERT( mpTag == NULL, "Last tag was not ended");
+
+ mpTag = new Tag( nTagId );
+}
+
+// -----------------------------------------------------------------------------
+
+void Writer::endTag()
+{
+ sal_uInt8 nTag = mpTag->getTagId();
+
+ if( mpSprite && ( (nTag == TAG_END) || (nTag == TAG_SHOWFRAME) || (nTag == TAG_DOACTION) || (nTag == TAG_STARTSOUND) || (nTag == TAG_PLACEOBJECT) || (nTag == TAG_PLACEOBJECT2) || (nTag == TAG_REMOVEOBJECT2) || (nTag == TAG_FRAMELABEL) ) )
+ {
+ mpSprite->addTag( mpTag );
+ mpTag = NULL;
+ }
+ else
+ {
+ mpTag->write( *mpMovieStream );
+ delete mpTag;
+ mpTag = NULL;
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+sal_uInt16 Writer::createID()
+{
+ return mnNextId++;
+}
+
+// -----------------------------------------------------------------------------
+
+void Writer::showFrame()
+{
+ startTag( TAG_SHOWFRAME );
+ endTag();
+
+ if(NULL == mpSprite)
+ mnFrames++;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_uInt16 Writer::defineShape( const GDIMetaFile& rMtf, sal_Int16 x, sal_Int16 y )
+{
+ mpVDev->SetMapMode( rMtf.GetPrefMapMode() );
+ Impl_writeActions( rMtf );
+
+ sal_uInt16 nId = 0;
+ sal_uInt16 iDepth = 1;
+ {
+ CharacterIdVector::iterator aIter( maShapeIds.begin() );
+ const CharacterIdVector::iterator aEnd( maShapeIds.end() );
+
+ sal_Bool bHaveShapes = aIter != aEnd;
+
+ if (bHaveShapes)
+ {
+ nId = startSprite();
+
+ while( aIter != aEnd )
+ {
+ placeShape( *aIter, iDepth++, x, y );
+ aIter++;
+ }
+
+ endSprite();
+ }
+ }
+
+ maShapeIds.clear();
+
+ return nId;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_uInt16 Writer::defineShape( const Polygon& rPoly, const FillStyle& rFillStyle )
+{
+ const PolyPolygon aPolyPoly( rPoly );
+ return defineShape( aPolyPoly, rFillStyle );
+}
+
+// -----------------------------------------------------------------------------
+
+sal_uInt16 Writer::defineShape( const PolyPolygon& rPolyPoly, const FillStyle& rFillStyle )
+{
+ sal_uInt16 nShapeId = createID();
+
+ // start a DefineShape3 tag
+ startTag( TAG_DEFINESHAPE3 );
+
+ mpTag->addUI16( nShapeId );
+ mpTag->addRect( rPolyPoly.GetBoundRect() );
+
+
+ // FILLSTYLEARRAY
+ mpTag->addUI8( 1 ); // FillStyleCount
+
+ // FILLSTYLE
+ rFillStyle.addTo( mpTag );
+
+ // LINESTYLEARRAY
+ mpTag->addUI8( 0 ); // LineStyleCount
+
+ // Number of fill and line index bits to 1
+ mpTag->addUI8( 0x11 );
+
+ BitStream aBits;
+
+ const sal_uInt16 nCount = rPolyPoly.Count();
+ sal_uInt16 i;
+ for( i = 0; i < nCount; i++ )
+ {
+ const Polygon& rPoly = rPolyPoly[ i ];
+ if( rPoly.GetSize() )
+ Impl_addPolygon( aBits, rPoly, true );
+ }
+
+ Impl_addEndShapeRecord( aBits );
+
+ mpTag->addBits( aBits );
+ endTag();
+
+ return nShapeId;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_uInt16 Writer::defineShape( const PolyPolygon& rPolyPoly, sal_uInt16 nLineWidth, const Color& rLineColor )
+{
+ sal_uInt16 nShapeId = createID();
+
+ // start a DefineShape3 tag
+ startTag( TAG_DEFINESHAPE3 );
+
+ mpTag->addUI16( nShapeId );
+ mpTag->addRect( rPolyPoly.GetBoundRect() );
+
+
+ // FILLSTYLEARRAY
+ mpTag->addUI8( 0 ); // FillStyleCount
+
+ // LINESTYLEARRAY
+ mpTag->addUI8( 1 ); // LineStyleCount
+
+ // LINESTYLE
+ mpTag->addUI16( nLineWidth ); // Width of line in twips
+ mpTag->addRGBA( rLineColor ); // Color
+
+ // Number of fill and line index bits to 1
+ mpTag->addUI8( 0x11 );
+
+ BitStream aBits;
+
+ const sal_uInt16 nCount = rPolyPoly.Count();
+ sal_uInt16 i;
+ for( i = 0; i < nCount; i++ )
+ {
+ const Polygon& rPoly = rPolyPoly[ i ];
+ if( rPoly.GetSize() )
+ Impl_addPolygon( aBits, rPoly, false );
+ }
+
+ Impl_addEndShapeRecord( aBits );
+
+ mpTag->addBits( aBits );
+ endTag();
+
+ return nShapeId;
+}
+
+#ifdef AUGUSTUS
+enum {NO_COMPRESSION, ADPCM_COMPRESSION, MP3_COMPRESSION } COMPRESSION_TYPE;
+sal_Bool Writer::streamSound( const char * filename )
+{
+ SF_INFO info;
+ SNDFILE *sf = sf_open(filename, SFM_READ, &info);
+
+ if (NULL == sf)
+ return sal_False;
+ else
+ {
+ // AS: Start up lame.
+ m_lame_flags = lame_init();
+
+ // The default (if you set nothing) is a a J-Stereo, 44.1khz
+ // 128kbps CBR mp3 file at quality 5. Override various default settings
+ // as necessary, for example:
+
+ lame_set_num_channels(m_lame_flags,1);
+ lame_set_in_samplerate(m_lame_flags,22050);
+ lame_set_brate(m_lame_flags,48);
+ lame_set_mode(m_lame_flags,MONO);
+ lame_set_quality(m_lame_flags,2); /* 2=high 5 = medium 7=low */
+
+ // See lame.h for the complete list of options. Note that there are
+ // some lame_set_*() calls not documented in lame.h. These functions
+ // are experimental and for testing only. They may be removed in
+ // the future.
+
+ //4. Set more internal configuration based on data provided above,
+ // as well as checking for problems. Check that ret_code >= 0.
+
+ int ret_code = lame_init_params(m_lame_flags);
+
+ if (ret_code < 0)
+ throw 0;
+
+ int lame_frame_size = lame_get_framesize(m_lame_flags);
+ int samples_per_frame = 22050 / 12; // AS: (samples/sec) / (frames/sec) = samples/frame
+ int mp3buffer_size = static_cast<int>(samples_per_frame*1.25 + 7200 + 7200);
+
+
+ startTag(TAG_SOUNDSTREAMHEAD2);
+
+ mpTag->addUI8(2<<2 | 1<<1 | 0<<0); // Preferred mixer format ??
+
+ BitStream bs;
+
+ bs.writeUB(MP3_COMPRESSION,4);
+ bs.writeUB(2, 2); // AS: Reserved zero bits.
+ bs.writeUB(1, 1); // AS: 16 Bit
+ bs.writeUB(0, 1); // AS: Mono.
+
+ mpTag->addBits(bs);
+
+ mpTag->addUI16(samples_per_frame);
+ endTag();
+
+ short *sample_buff = new short[static_cast<int>(info.frames)];
+ sf_readf_short(sf, sample_buff, info.frames);
+
+ unsigned char* mp3buffer = new unsigned char[mp3buffer_size];
+
+// 5. Encode some data. input pcm data, output (maybe) mp3 frames.
+// This routine handles all buffering, resampling and filtering for you.
+// The required mp3buffer_size can be computed from num_samples,
+// samplerate and encoding rate, but here is a worst case estimate:
+// mp3buffer_size (in bytes) = 1.25*num_samples + 7200.
+// num_samples = the number of PCM samples in each channel. It is
+// not the sum of the number of samples in the L and R channels.
+//
+// The return code = number of bytes output in mp3buffer. This can be 0.
+// If it is <0, an error occured.
+
+
+ for (int samples_written = 0; samples_written < info.frames; samples_written += samples_per_frame)
+ {
+ startTag(TAG_SOUNDSTREAMBLOCK);
+
+ int samples_to_write = std::min((int)info.frames - samples_written, samples_per_frame);
+
+ // AS: Since we're mono, left and right sample buffs are the same
+ // ie, samplebuff (which is why we pass it twice).
+ int ret = lame_encode_buffer(m_lame_flags, sample_buff + samples_written,
+ sample_buff + samples_written,
+ samples_to_write, mp3buffer, mp3buffer_size);
+
+ if (ret < 0)
+ throw 0;
+
+// 6. lame_encode_flush will flush the buffers and may return a
+// final few mp3 frames. mp3buffer should be at least 7200 bytes.
+// return code = number of bytes output to mp3buffer. This can be 0.
+
+ if (mp3buffer_size - ret < 7200)
+ throw 0;
+
+ int ret2 = lame_encode_flush(m_lame_flags, mp3buffer + ret, mp3buffer_size - ret);
+
+ if (ret2 < 0)
+ throw 0;
+
+
+ SvMemoryStream strm(mp3buffer, ret + ret2, STREAM_READWRITE);
+
+ mpTag->addUI16(samples_to_write); //lame_frame_size);
+ mpTag->addUI16(0);
+ mpTag->addStream(strm);
+
+ endTag();
+
+ showFrame();
+ }
+
+
+ delete[] mp3buffer;
+
+ delete[] sample_buff;
+ int err = sf_close(sf);
+
+ // 8. free the internal data structures.
+ lame_close(m_lame_flags);
+ }
+
+ return sal_True;
+}
+#endif // AUGUSTUS
+
+
+// -----------------------------------------------------------------------------
+
+void Writer::stop()
+{
+ startTag( TAG_DOACTION );
+ mpTag->addUI8( 0x07 );
+ mpTag->addUI8( 0 );
+ endTag();
+}
+
+// -----------------------------------------------------------------------------
+
+void Writer::waitOnClick( sal_uInt16 nDepth )
+{
+ placeShape( _uInt16( mnPageButtonId ), nDepth, 0, 0 );
+ stop();
+ showFrame();
+ removeShape( nDepth );
+}
+
+// -----------------------------------------------------------------------------
+
+/** inserts a doaction tag with an ActionGotoFrame */
+void Writer::gotoFrame( sal_uInt16 nFrame )
+{
+ startTag( TAG_DOACTION );
+ mpTag->addUI8( 0x81 );
+ mpTag->addUI16( 2 );
+ mpTag->addUI16( nFrame );
+ mpTag->addUI8( 0 );
+ endTag();
+}
diff --git a/filter/source/flash/swfwriter.hxx b/filter/source/flash/swfwriter.hxx
new file mode 100644
index 000000000000..b3a5621b54e2
--- /dev/null
+++ b/filter/source/flash/swfwriter.hxx
@@ -0,0 +1,462 @@
+/*************************************************************************
+ *
+ * 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 _SWF_WRITER_HXX_
+#define _SWF_WRITER_HXX_
+
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/i18n/XBreakIterator.hpp>
+#include <vcl/font.hxx>
+#include <vcl/gradient.hxx>
+#include <unotools/tempfile.hxx>
+#include <tools/color.hxx>
+#include <tools/poly.hxx>
+#include <tools/gen.hxx>
+#include <tools/stream.hxx>
+
+// #i73264#
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <osl/file.hxx>
+
+#include <vector>
+#include <stack>
+#include <map>
+
+#ifdef AUGUSTUS
+#include "lame.h"
+#include "sndfile.h"
+#endif
+
+#include <stdio.h>
+
+class GDIMetaFile;
+class BitmapEx;
+class PolyPolygon;
+class Gradient;
+class SvtGraphicFill;
+class SvtGraphicStroke;
+class LineInfo;
+namespace basegfx { class B2DPolygon; }
+
+inline sal_uInt16 _uInt16( sal_Int32 nValue )
+{
+ OSL_ENSURE( (nValue >= 0) && ((sal_uInt32)nValue <= 0xffff), "overflow while converting sal_Int32 to sal_uInt16" );
+ return (sal_uInt16)nValue;
+}
+
+inline sal_Int16 _Int16( sal_Int32 nValue )
+{
+ OSL_ENSURE( (nValue >= -32768) && (nValue <= 32767), "overflow while converting sal_Int32 to sal_Int16" );
+ return (sal_Int16)nValue;
+}
+
+class VirtualDevice;
+
+namespace swf {
+
+const sal_uInt8 TAG_END = 0;
+const sal_uInt8 TAG_SHOWFRAME = 1;
+
+const sal_uInt8 TAG_DEFINEBUTTON = 7;
+
+const sal_uInt8 TAG_BACKGROUNDCOLOR = 9;
+
+const sal_uInt8 TAG_DOACTION = 12;
+const sal_uInt8 TAG_STARTSOUND = 15;
+
+const sal_uInt8 TAG_SOUNDSTREAMBLOCK = 19;
+const sal_uInt8 TAG_SOUNDSTREAMHEAD = 18;
+const sal_uInt8 TAG_SOUNDSTREAMHEAD2 = 45;
+
+const sal_uInt8 TAG_JPEGTABLES = 8;
+const sal_uInt8 TAG_DEFINEBITS = 6;
+const sal_uInt8 TAG_DEFINEBITSLOSSLESS = 20;
+const sal_uInt8 TAG_DEFINEBITSJPEG2 = 21;
+const sal_uInt8 TAG_DEFINEBITSJPEG3 = 35;
+const sal_uInt8 TAG_DEFINEBITSLOSSLESS2 = 36;
+const sal_uInt8 TAG_DEFINEEDITTEXT= 37;
+const sal_uInt8 TAG_PLACEOBJECT = 4;
+const sal_uInt8 TAG_PLACEOBJECT2 = 26;
+const sal_uInt8 TAG_REMOVEOBJECT2 = 28;
+
+const sal_uInt8 TAG_DEFINEFONT = 10;
+const sal_uInt8 TAG_DEFINETEXT = 11;
+const sal_uInt8 TAG_DEFINESHAPE3 = 32;
+const sal_uInt8 TAG_DEFINESPRITE = 39;
+
+const sal_uInt8 TAG_FRAMELABEL = 43;
+
+const sal_uInt8 TAG_HEADER = 0xff;
+
+///////////////////////////////////////////////////////////////////////
+
+/** converts a double to a 16.16 flash fixed value */
+sal_uInt32 getFixed( double fValue );
+
+///////////////////////////////////////////////////////////////////////
+
+typedef ::std::map<sal_uInt32, sal_uInt16> ChecksumCache;
+
+/** unsigned int 16 compare operation for stl */
+struct ltuint16
+{
+ bool operator()(sal_uInt16 s1, sal_uInt16 s2) const
+ {
+ return s1 < s2;
+ }
+};
+
+///////////////////////////////////////////////////////////////////////
+
+/** container class to create bit structures */
+class BitStream
+{
+public:
+ BitStream();
+
+ void writeUB( sal_uInt32 nValue, sal_uInt16 nBits );
+ void writeSB( sal_Int32 nValue, sal_uInt16 nBits );
+ void writeFB( sal_uInt32 nValue, sal_uInt16 nBits );
+
+ void pad();
+ void writeTo( SvStream& out );
+
+ sal_uInt32 getOffset() const;
+private:
+
+ std::vector< sal_uInt8 > maData;
+ sal_uInt8 mnBitPos;
+ sal_uInt8 mnCurrentByte;
+};
+
+///////////////////////////////////////////////////////////////////////
+
+/** this class collects all used glyphs for a given fonts and maps
+ characters to glyph ids.
+*/
+class FlashFont
+{
+public:
+ FlashFont( const Font& rFont, sal_uInt16 nId );
+ ~FlashFont();
+
+ sal_uInt16 getGlyph( sal_uInt16 nChar, VirtualDevice* pVDev );
+
+ void write( SvStream& out );
+
+ sal_uInt16 getID() const { return mnId; }
+ const Font& getFont() { return maFont; }
+
+private:
+ const Font maFont;
+ std::map<sal_uInt16, sal_uInt16, ltuint16> maGlyphIndex;
+ sal_uInt16 mnNextIndex;
+ sal_uInt16 mnId;
+ BitStream maGlyphData;
+ std::vector< sal_uInt16 > maGlyphOffsets;
+};
+
+typedef std::vector<FlashFont*> FontMap;
+
+///////////////////////////////////////////////////////////////////////
+
+/** this class helps creating flash tags */
+class Tag : public SvMemoryStream
+{
+public:
+ Tag( sal_uInt8 nTagId );
+
+ sal_uInt8 getTagId() const { return mnTagId; }
+
+ void write( SvStream& out );
+
+ void addUI32( sal_uInt32 nValue );
+ //unused as of yet void addI32( sal_Int32 nValue );
+ void addUI16( sal_uInt16 nValue );
+ //unused as of yet void addI16( sal_Int16 nValue );
+ void addUI8( sal_uInt8 nValue );
+ void addBits( BitStream& rIn );
+
+ void addRGBA( const Color& rColor );
+ void addRGB( const Color& rColor );
+ void addRect( const Rectangle& rRect );
+ void addMatrix( const ::basegfx::B2DHomMatrix& rMatrix ); // #i73264#
+ void addString( const char* pString );
+ void addStream( SvStream& rIn );
+
+ static void writeMatrix( SvStream& rOut, const ::basegfx::B2DHomMatrix& rMatrix ); // #i73264#
+ static void writeRect( SvStream& rOut, const Rectangle& rRect );
+
+private:
+ sal_uInt8 mnTagId;
+};
+
+///////////////////////////////////////////////////////////////////////
+
+/** this class helps to define flash sprites */
+class Sprite
+{
+public:
+ Sprite( sal_uInt16 nId );
+ ~Sprite();
+
+ void write( SvStream& out );
+
+ sal_uInt16 getId() const { return mnId; }
+
+ void addTag( Tag* pNewTag );
+
+private:
+ std::vector< Tag* > maTags;
+ sal_uInt16 mnId;
+ sal_uInt32 mnFrames;
+};
+
+///////////////////////////////////////////////////////////////////////
+
+/** this class stores a flash fill style for shapes */
+class FillStyle
+{
+public:
+ enum FillStyleType { solid = 0x00, linear_gradient = 0x10, radial_gradient = 0x12, tiled_bitmap = 0x40, clipped_bitmap = 0x41 };
+
+ /** this c'tor creates a solid fill style */
+ FillStyle( const Color& rSolidColor );
+
+ /** this c'tor creates a linear or radial gradient fill style */
+ FillStyle( const Rectangle& rBoundRect, const Gradient& rGradient );
+
+ /** this c'tor creates a tiled or clipped bitmap fill style */
+ FillStyle( sal_uInt16 nBitmapId, bool bClipped, const ::basegfx::B2DHomMatrix& rMatrix ); // #i73264#
+
+ void addTo( Tag* pTag ) const;
+
+private:
+ void Impl_addGradient( Tag* pTag ) const;
+
+ FillStyleType meType;
+ ::basegfx::B2DHomMatrix maMatrix; // #i73264#
+ sal_uInt16 mnBitmapId;
+ Color maColor;
+ Gradient maGradient;
+ Rectangle maBoundRect;
+};
+
+///////////////////////////////////////////////////////////////////////
+
+/** this class creates a flash movie from vcl geometry */
+class Writer
+{
+ friend class FlashFont;
+
+public:
+ /** creates a writer for a new flash movie.
+ nDocWidth and nDocHeight are the dimensions of the movie.
+ They must be in 100th/mm.
+
+ An invisible shape with the size of the document is placed at depth 1
+ and it clips all shapes on depth 2 and 3.
+ */
+ Writer( sal_Int32 nDocWidthInput, sal_Int32 nDocHeightInput, sal_Int32 nDocWidth, sal_Int32 nDocHeight, sal_Int32 nJPEGcompressMode = -1 );
+ ~Writer();
+
+ void storeTo( com::sun::star::uno::Reference< com::sun::star::io::XOutputStream > &xOutStream );
+
+ // geometry
+ void setClipping( const PolyPolygon* pClipPolyPolygon );
+
+ /** defines a flash shape from a filled polygon.
+ The coordinates must be in twips */
+ sal_uInt16 defineShape( const Polygon& rPoly, const FillStyle& rFillStyle );
+
+ /** defines a flash shape from a filled polypolygon.
+ The coordinates must be in twips */
+ sal_uInt16 defineShape( const PolyPolygon& rPolyPoly, const FillStyle& rFillStyle );
+
+ /** defines a flash shape from a outlined polypolygon.
+ The coordinates must be in twips */
+ sal_uInt16 defineShape( const PolyPolygon& rPolyPoly, sal_uInt16 nLineWidth, const Color& rLineColor );
+
+ /** defines a flash shape from a vcl metafile.
+ The mapmode of the metafile is used to map all coordinates to twips.
+ A character id of a flash sprite is returned that contains all geometry
+ from the metafile.
+ */
+ sal_uInt16 defineShape( const GDIMetaFile& rMtf, sal_Int16 x = 0, sal_Int16 y = 0 );
+
+ /** defines a bitmap and returns its flash id.
+ */
+ sal_uInt16 defineBitmap( const BitmapEx& bmpSource, sal_Int32 nJPEGQualityLevel );
+
+ // control tags
+
+ /** inserts a place shape tag into the movie stream or the current sprite */
+ void placeShape( sal_uInt16 nID, sal_uInt16 nDepth, sal_Int32 x, sal_Int32 y, sal_uInt16 nClipDepth = 0, const char* pName = NULL );
+
+#ifdef THEFUTURE
+ /** inserts a move shape tag into the movie stream or the current sprite */
+ void moveShape( sal_uInt16 nDepth, sal_Int32 x, sal_Int32 y );
+#endif
+
+ /** inserts a remove shape tag into the movie stream or the current sprite */
+ void removeShape( sal_uInt16 nDepth );
+
+ /** inserts a show frame tag into the movie stream or the current sprite */
+ void showFrame();
+
+ /** creates a new sprite and sets it as the current sprite for editing.
+ Only one sprite can be edited at one time */
+ sal_uInt16 startSprite();
+
+ /** ends editing of the curent sprites and adds it to the movie stream */
+ void endSprite();
+
+ /** inserts a doaction tag with an ActionStop */
+ void stop();
+
+ /** inserts a doaction tag with an ActionStop, place a button on depth nDepth that
+ continues playback on click */
+ void waitOnClick( sal_uInt16 nDepth );
+
+ /** inserts a doaction tag with an ActionGotoFrame */
+ void gotoFrame( sal_uInt16 nFrame );
+
+#ifdef AUGUSTUS
+ /** stream out a sound. Should make it more intelligent so it interleaves with other items.*/
+ sal_Bool streamSound( const char * filename );
+#endif
+
+private:
+ Point map( const Point& rPoint ) const;
+ Size map( const Size& rSize ) const;
+ void map( PolyPolygon& rPolyPolygon ) const;
+ sal_Int32 mapRelative( sal_Int32 n100thMM ) const;
+
+ void startTag( sal_uInt8 nTagId );
+ void endTag();
+ sal_uInt16 createID();
+
+ void Impl_writeBmp( sal_uInt16 nBitmapId, sal_uInt32 width, sal_uInt32 height, sal_uInt8 *pCompressed, sal_uInt32 compressed_size );
+ void Impl_writeImage( const BitmapEx& rBmpEx, const Point& rPt, const Size& rSz, const Point& rSrcPt, const Size& rSrcSz, const Rectangle& rClipRect, bool bMap );
+ void Impl_writeJPEG(sal_uInt16 nBitmapId, const sal_uInt8* pJpgData, sal_uInt32 nJpgDataLength, sal_uInt8 *pCompressed, sal_uInt32 compressed_size );
+ void Impl_handleLineInfoPolyPolygons(const LineInfo& rInfo, const basegfx::B2DPolygon& rLinePolygon);
+ void Impl_writeActions( const GDIMetaFile& rMtf );
+ void Impl_writePolygon( const Polygon& rPoly, sal_Bool bFilled );
+ void Impl_writePolygon( const Polygon& rPoly, sal_Bool bFilled, const Color& rFillColor, const Color& rLineColor );
+ void Impl_writePolyPolygon( const PolyPolygon& rPolyPoly, sal_Bool bFilled, sal_uInt8 nTransparence = 0);
+ void Impl_writePolyPolygon( const PolyPolygon& rPolyPoly, sal_Bool bFilled, const Color& rFillColor, const Color& rLineColor );
+ void Impl_writeText( const Point& rPos, const String& rText, const sal_Int32* pDXArray, long nWidth );
+ void Impl_writeText( const Point& rPos, const String& rText, const sal_Int32* pDXArray, long nWidth, Color aTextColor );
+ void Impl_writeGradientEx( const PolyPolygon& rPolyPoly, const Gradient& rGradient );
+ void Impl_writeLine( const Point& rPt1, const Point& rPt2, const Color* pLineColor = NULL );
+ void Impl_writeRect( const Rectangle& rRect, long nRadX, long nRadY );
+ void Impl_writeEllipse( const Point& rCenter, long nRadX, long nRadY );
+ bool Impl_writeFilling( SvtGraphicFill& rFilling );
+ bool Impl_writeStroke( SvtGraphicStroke& rStroke );
+
+ FlashFont& Impl_getFont( const Font& rFont );
+
+ static void Impl_addPolygon( BitStream& rBits, const Polygon& rPoly, sal_Bool bFilled );
+
+ static void Impl_addShapeRecordChange( BitStream& rBits, sal_Int16 dx, sal_Int16 dy, sal_Bool bFilled );
+ static void Impl_addStraightEdgeRecord( BitStream& rBits, sal_Int16 dx, sal_Int16 dy );
+ static void Impl_addCurvedEdgeRecord( BitStream& rBits, sal_Int16 control_dx, sal_Int16 control_dy, sal_Int16 anchor_dx, sal_Int16 anchor_dy );
+ static void Impl_addEndShapeRecord( BitStream& rBits );
+
+ static void Impl_addStraightLine( BitStream& rBits,
+ Point& rLastPoint,
+ const double P2x, const double P2y );
+ static void Impl_addQuadBezier( BitStream& rBits,
+ Point& rLastPoint,
+ const double P2x, const double P2y,
+ const double P3x, const double P3y );
+ static void Impl_quadBezierApprox( BitStream& rBits,
+ Point& rLastPoint,
+ const double d2,
+ const double P1x, const double P1y,
+ const double P2x, const double P2y,
+ const double P3x, const double P3y,
+ const double P4x, const double P4y );
+
+ com::sun::star::uno::Reference < com::sun::star::i18n::XBreakIterator > Impl_GetBreakIterator();
+
+private:
+ com::sun::star::uno::Reference< com::sun::star::i18n::XBreakIterator > mxBreakIterator;
+
+ FontMap maFonts;
+
+ sal_Int32 mnDocWidth;
+ sal_Int32 mnDocHeight;
+
+ // AS: Scaling factor for output.
+ double mnDocXScale;
+ double mnDocYScale;
+
+ sal_uInt16 mnWhiteBackgroundShapeId;
+ sal_uInt16 mnPageButtonId;
+
+ VirtualDevice* mpVDev;
+
+ const PolyPolygon* mpClipPolyPolygon;
+
+ /** holds the informations of the objects defined in the movie stream
+ while executing defineShape
+ */
+ typedef std::vector<sal_uInt16> CharacterIdVector;
+ CharacterIdVector maShapeIds;
+
+ Tag* mpTag;
+ Sprite* mpSprite;
+ std::stack<Sprite*> mvSpriteStack;
+ ChecksumCache mBitmapCache;
+
+ sal_uInt16 mnNextId;
+ sal_uInt32 mnFrames;
+
+// com::sun::star::uno::Reference< com::sun::star::io::XOutputStream > mxOutStream;
+ oslFileHandle mxOutStream;
+
+ utl::TempFile maMovieTempFile;
+ utl::TempFile maFontsTempFile;
+
+ SvStream* mpMovieStream;
+ SvStream* mpFontsStream;
+
+#ifdef AUGUSTUS
+ lame_global_flags *m_lame_flags;
+#endif
+
+ sal_uInt8 mnGlobalTransparency;
+ sal_Int32 mnJPEGCompressMode;
+};
+
+///////////////////////////////////////////////////////////////////////
+
+}
+
+#endif
diff --git a/filter/source/flash/swfwriter1.cxx b/filter/source/flash/swfwriter1.cxx
new file mode 100644
index 000000000000..cce0314436f8
--- /dev/null
+++ b/filter/source/flash/swfwriter1.cxx
@@ -0,0 +1,2126 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include <com/sun/star/i18n/ScriptType.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <comphelper/processfactory.hxx>
+#include "swfwriter.hxx"
+#include <vcl/metaact.hxx>
+#include <vcl/gdimtf.hxx>
+#include <vcl/bmpacc.hxx>
+#include <vcl/virdev.hxx>
+#include <vcl/metric.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
+#include <svtools/filter.hxx>
+#include <vcl/graphictools.hxx>
+
+#ifndef _ZLIB_H
+#ifdef SYSTEM_ZLIB
+#include <zlib.h>
+#else
+#include <external/zlib/zlib.h>
+#endif
+#endif
+
+#include <vcl/salbtype.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+
+using namespace ::swf;
+using namespace ::std;
+using namespace ::rtl;
+using namespace ::com::sun::star::i18n;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::io;
+using namespace ::com::sun::star::beans;
+
+extern sal_uInt16 getMaxBitsUnsigned( sal_uInt32 nValue );
+extern sal_uInt16 getMaxBitsSigned( sal_Int32 nValue );
+
+static MapMode aTWIPSMode( MAP_TWIP );
+static MapMode a100thmmMode( MAP_100TH_MM );
+
+// -----------------------------------------------------------------------------
+
+Point Writer::map( const Point& rPoint ) const
+{
+ const MapMode& aSourceMapMode = mpVDev->GetMapMode();
+
+ Point retPoint = mpVDev->LogicToLogic( rPoint, &aSourceMapMode, &aTWIPSMode );
+
+ // AS: Produces a 'possible loss of data' warning that we can't fix without
+ // hurting code readability.
+ retPoint.X() = (long)( retPoint.X() * mnDocXScale );
+ retPoint.Y() = (long)( retPoint.Y() * mnDocYScale );
+
+ return retPoint;
+}
+
+// -----------------------------------------------------------------------------
+
+Size Writer::map( const Size& rSize ) const
+{
+ const MapMode& aSourceMapMode = mpVDev->GetMapMode();
+
+ Size retSize = mpVDev->LogicToLogic( rSize, &aSourceMapMode, &aTWIPSMode );
+
+ // AS: Produces a 'possible loss of data' warning that we can't fix without
+ // hurting code readability.
+ retSize.Width() = (long)( retSize.Width() * mnDocXScale );
+ retSize.Height() = (long)( retSize.Height() * mnDocYScale );
+
+ return retSize;
+}
+
+// -----------------------------------------------------------------------------
+
+void Writer::map( PolyPolygon& rPolyPolygon ) const
+{
+ const sal_uInt16 nPolyCount = rPolyPolygon.Count();
+ if( nPolyCount )
+ {
+ sal_uInt16 nPoly, nPoint, nPointCount;
+ for( nPoly = 0; nPoly < nPolyCount; nPoly++ )
+ {
+ Polygon& rPoly = rPolyPolygon[nPoly];
+ nPointCount = rPoly.GetSize();
+
+ for( nPoint = 0; nPoint < nPointCount; nPoint++ )
+ {
+ rPoly[nPoint] = map( rPoly[nPoint] );
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 Writer::mapRelative( sal_Int32 n100thMM ) const
+{
+ MapMode aSourceMapMode( mpVDev->GetMapMode() );
+ aSourceMapMode.SetOrigin( Point() );
+
+ sal_Int32 nTwips = mpVDev->LogicToLogic( Point( n100thMM, n100thMM ), &aSourceMapMode, &aTWIPSMode ).X();
+ return nTwips;
+}
+
+// -----------------------------------------------------------------------------
+
+/**
+*/
+void Writer::Impl_addPolygon( BitStream& rBits, const Polygon& rPoly, sal_Bool bFilled )
+{
+ Point aLastPoint( rPoly[0] );
+
+ Impl_addShapeRecordChange( rBits, _Int16(aLastPoint.X()),_Int16(aLastPoint.Y()), bFilled );
+
+ USHORT i = 0, nSize = rPoly.GetSize();
+
+ double d = 16.0f;
+
+ // points
+ while( ( i + 1 ) < nSize )
+ {
+ if( ( i + 3 ) < nSize )
+ {
+ PolyFlags P1( rPoly.GetFlags( i ) );
+ PolyFlags P4( rPoly.GetFlags( i + 3 ) );
+
+ if( ( POLY_NORMAL == P1 || POLY_SMOOTH == P1 || POLY_SYMMTR == P1 ) &&
+ ( POLY_CONTROL == rPoly.GetFlags( i + 1 ) ) &&
+ ( POLY_CONTROL == rPoly.GetFlags( i + 2 ) ) &&
+ ( POLY_NORMAL == P4 || POLY_SMOOTH == P4 || POLY_SYMMTR == P4 ) )
+ {
+ Impl_quadBezierApprox( rBits, aLastPoint, d*d,
+ rPoly.GetPoint( i ).X(), rPoly.GetPoint( i ).Y(),
+ rPoly.GetPoint( i+1 ).X(), rPoly.GetPoint( i+1 ).Y(),
+ rPoly.GetPoint( i+2 ).X(), rPoly.GetPoint( i+2 ).Y(),
+ rPoly.GetPoint( i+3 ).X(), rPoly.GetPoint( i+3 ).Y() );
+ i += 3;
+ continue;
+ }
+ }
+
+ ++i;
+
+ const Point aPolyPoint( rPoly[ i ] );
+ if( aPolyPoint != aLastPoint )
+ {
+ Impl_addStraightEdgeRecord( rBits, _Int16(aPolyPoint.X() - aLastPoint.X()),_Int16(aPolyPoint.Y() - aLastPoint.Y()));
+ aLastPoint = aPolyPoint;
+ }
+ }
+
+ if( bFilled && (rPoly[0] != rPoly[nSize-1]))
+ {
+ const Point aPolyPoint( rPoly[ 0 ] );
+ if( aPolyPoint != aLastPoint )
+ {
+ Impl_addStraightEdgeRecord( rBits, _Int16(aPolyPoint.X() - aLastPoint.X()),_Int16(aPolyPoint.Y() - aLastPoint.Y()));
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+/** exports a style change record with a move to (x,y) and depending on bFilled a line style 1 or fill style 1
+*/
+void Writer::Impl_addShapeRecordChange( BitStream& rBits, sal_Int16 dx, sal_Int16 dy, sal_Bool bFilled )
+{
+ rBits.writeUB( 0, 1 ); // TypeFlag
+ rBits.writeUB( 0, 1 ); // StateNewStyles
+ rBits.writeUB( !bFilled, 1 ); // StateLineStyle
+ rBits.writeUB( 0, 1 ); // StateFillStyle0
+ rBits.writeUB( bFilled, 1 ); // StateFillStyle1
+ rBits.writeUB( 1, 1 ); // StateMoveTo
+
+ sal_uInt16 nMoveBits = max( getMaxBitsSigned( dx ), getMaxBitsSigned( dy ) );
+
+ rBits.writeUB( nMoveBits, 5 ); // Number of bits per value
+ // TODO: Optimize horizontal and vertical lines
+ rBits.writeSB( dx, nMoveBits ); // DeltaX
+ rBits.writeSB( dy, nMoveBits ); // DeltaY
+
+ rBits.writeUB( 1, 1 ); // set FillStyle1 or LineStyle to 1
+}
+
+// -----------------------------------------------------------------------------
+
+/** exports a straight edge record
+*/
+void Writer::Impl_addStraightEdgeRecord( BitStream& rBits, sal_Int16 dx, sal_Int16 dy )
+{
+ rBits.writeUB( 1, 1 ); // TypeFlag
+ rBits.writeUB( 1, 1 ); // StraightFlag
+
+ sal_uInt16 nBits = max( getMaxBitsSigned( dx ), getMaxBitsSigned( dy ) );
+
+ rBits.writeUB( nBits - 2, 4 ); // Number of bits per value
+
+ if( (dx != 0) && (dy != 0) )
+ {
+ rBits.writeUB( 1, 1 ); // GeneralLineFlag
+ rBits.writeSB( dx, nBits ); // DeltaX
+ rBits.writeSB( dy, nBits ); // DeltaY
+ }
+ else
+ {
+ rBits.writeUB( 0, 1 );
+ rBits.writeUB( ( dx == 0 ), 1 );
+ if( dx == 0 )
+ {
+ rBits.writeSB( dy, nBits ); // DeltaY
+ }
+ else
+ {
+ rBits.writeSB( dx, nBits ); // DeltaX
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+/** exports a curved edge record
+*/
+void Writer::Impl_addCurvedEdgeRecord( BitStream& rBits, sal_Int16 control_dx, sal_Int16 control_dy, sal_Int16 anchor_dx, sal_Int16 anchor_dy )
+{
+ rBits.writeUB( 1, 1 ); // TypeFlag
+ rBits.writeUB( 0, 1 ); // CurvedFlag
+
+ sal_uInt8 nBits = static_cast<sal_uInt8>(
+ max( getMaxBitsSigned( control_dx ),
+ max( getMaxBitsSigned( control_dy ),
+ max( getMaxBitsSigned( anchor_dx ),
+ max( getMaxBitsSigned( anchor_dy ), (sal_uInt16)3 ) ) ) ) );
+
+ rBits.writeUB( nBits - 2, 4 ); // Number of bits per value
+
+ rBits.writeSB( control_dx, nBits ); // DeltaX
+ rBits.writeSB( control_dy, nBits ); // DeltaY
+ rBits.writeSB( anchor_dx, nBits ); // DeltaX
+ rBits.writeSB( anchor_dy, nBits ); // DeltaY
+}
+
+// -----------------------------------------------------------------------------
+
+/** exports a end shape record
+*/
+void Writer::Impl_addEndShapeRecord( BitStream& rBits )
+{
+ rBits.writeUB( 0, 6 );
+}
+
+// -----------------------------------------------------------------------------
+
+void Writer::Impl_writePolygon( const Polygon& rPoly, sal_Bool bFilled )
+{
+ PolyPolygon aPolyPoly( rPoly );
+ Impl_writePolyPolygon( aPolyPoly, bFilled );
+}
+
+// -----------------------------------------------------------------------------
+
+void Writer::Impl_writePolygon( const Polygon& rPoly, sal_Bool bFilled, const Color& rFillColor, const Color& rLineColor )
+{
+ PolyPolygon aPolyPoly( rPoly );
+ Impl_writePolyPolygon( aPolyPoly, bFilled, rFillColor, rLineColor );
+}
+
+// -----------------------------------------------------------------------------
+
+void Writer::Impl_writePolyPolygon( const PolyPolygon& rPolyPoly, sal_Bool bFilled, sal_uInt8 nTransparence /* = 0 */ )
+{
+ Color aLineColor( mpVDev->GetLineColor() );
+ if( 0 == aLineColor.GetTransparency() )
+ aLineColor.SetTransparency( nTransparence );
+ Color aFillColor( mpVDev->GetFillColor() );
+ if( 0 == aFillColor.GetTransparency() )
+ aFillColor.SetTransparency( nTransparence );
+ Impl_writePolyPolygon(rPolyPoly, bFilled, aFillColor, aLineColor );
+}
+
+// -----------------------------------------------------------------------------
+
+void Writer::Impl_writePolyPolygon( const PolyPolygon& rPolyPoly, sal_Bool bFilled, const Color& rFillColor, const Color& rLineColor )
+{
+ PolyPolygon aPolyPoly( rPolyPoly );
+
+ if( aPolyPoly.Count() )
+ {
+ map( aPolyPoly );
+
+ if( mpClipPolyPolygon )
+ rPolyPoly.GetIntersection( *mpClipPolyPolygon, aPolyPoly );
+
+ sal_uInt16 nID;
+ if( bFilled )
+ {
+ Color aFillColor( rFillColor );
+ if( 0 != mnGlobalTransparency )
+ aFillColor.SetTransparency( mnGlobalTransparency );
+
+ FillStyle aStyle( aFillColor );
+ nID = defineShape( aPolyPoly, aStyle );
+ }
+ else
+ {
+ Color aLineColor( rLineColor );
+ if( 0 != mnGlobalTransparency )
+ aLineColor.SetTransparency( mnGlobalTransparency );
+
+ nID = defineShape( aPolyPoly, 1, aLineColor );
+ }
+ maShapeIds.push_back( nID );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+/** a gradient is a transition from one color to another, rendered inside a given polypolygon */
+void Writer::Impl_writeGradientEx( const PolyPolygon& rPolyPoly, const Gradient& rGradient )
+{
+ if( rPolyPoly.Count() )
+ {
+ PolyPolygon aPolyPolygon( rPolyPoly );
+ map( aPolyPolygon );
+
+ if( (rGradient.GetStyle() == GRADIENT_LINEAR && rGradient.GetAngle() == 900) || (rGradient.GetStyle() == GRADIENT_RADIAL) )
+ {
+ const Rectangle aBoundRect( aPolyPolygon.GetBoundRect() );
+
+ FillStyle aFillStyle( aBoundRect, rGradient );
+
+ sal_uInt16 nShapeId = defineShape( aPolyPolygon, aFillStyle );
+ maShapeIds.push_back( nShapeId );
+ }
+ else
+ {
+ setClipping( &aPolyPolygon );
+
+ // render the gradient filling to simple polygons
+ {
+ GDIMetaFile aTmpMtf;
+ mpVDev->AddGradientActions( aPolyPolygon.GetBoundRect(), rGradient, aTmpMtf );
+ Impl_writeActions( aTmpMtf );
+ }
+
+ setClipping( NULL );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void Writer::setClipping( const PolyPolygon* pClipPolyPolygon )
+{
+ mpClipPolyPolygon = pClipPolyPolygon;
+}
+
+// -----------------------------------------------------------------------------
+
+// AS: Just comparing fonts straight up is too literal. There are some
+// differences in font that actually require different glyphs to be defined,
+// and some that don't. This function is meant to capture all the differences
+// that we care about.
+bool compare_fonts_for_me(const Font& rFont1, const Font& rFont2)
+{
+ return rFont1.GetName() == rFont2.GetName() &&
+ rFont1.GetWeight() == rFont2.GetWeight() &&
+ rFont1.GetItalic() == rFont2.GetItalic() &&
+ rFont1.IsOutline() == rFont2.IsOutline() &&
+ rFont1.IsShadow() == rFont2.IsShadow() &&
+ rFont1.GetRelief() == rFont2.GetRelief();
+}
+
+// -----------------------------------------------------------------------------
+
+FlashFont& Writer::Impl_getFont( const Font& rFont )
+{
+ FontMap::iterator aIter( maFonts.begin() );
+ const FontMap::iterator aEnd( maFonts.end() );
+
+ while( aIter != aEnd )
+ {
+ const Font tempFont = (*aIter)->getFont();
+ if( compare_fonts_for_me(tempFont, rFont) )
+ {
+ return **aIter;
+ }
+
+ aIter++;
+ }
+
+ FlashFont* pFont = new FlashFont( rFont, createID() );
+ maFonts.push_back( pFont );
+ return *pFont;
+}
+
+// -----------------------------------------------------------------------------
+
+void Writer::Impl_writeText( const Point& rPos, const String& rText, const sal_Int32* pDXArray, long nWidth )
+{
+ const FontMetric aMetric( mpVDev->GetFontMetric() );
+
+ bool bTextSpecial = aMetric.IsShadow() || aMetric.IsOutline() || (aMetric.GetRelief() != RELIEF_NONE);
+
+ if( !bTextSpecial )
+ {
+ Impl_writeText( rPos, rText, pDXArray, nWidth, mpVDev->GetTextColor() );
+ }
+ else
+ {
+ if( aMetric.GetRelief() != RELIEF_NONE )
+ {
+ Color aReliefColor( COL_LIGHTGRAY );
+ Color aTextColor( mpVDev->GetTextColor() );
+
+ if ( aTextColor.GetColor() == COL_BLACK )
+ aTextColor = Color( COL_WHITE );
+
+ if ( aTextColor.GetColor() == COL_WHITE )
+ aReliefColor = Color( COL_BLACK );
+
+
+ Point aPos( rPos );
+ Point aOffset( 6,6 );
+
+ if ( aMetric.GetRelief() == RELIEF_ENGRAVED )
+ {
+ aPos -= aOffset;
+ }
+ else
+ {
+ aPos += aOffset;
+ }
+
+ Impl_writeText( aPos, rText, pDXArray, nWidth, aReliefColor );
+ Impl_writeText( rPos, rText, pDXArray, nWidth, aTextColor );
+ }
+ else
+ {
+ if( aMetric.IsShadow() )
+ {
+ long nOff = 1 + ((aMetric.GetLineHeight()-24)/24);
+ if ( aMetric.IsOutline() )
+ nOff += 6;
+
+ Color aTextColor( mpVDev->GetTextColor() );
+ Color aShadowColor = Color( COL_BLACK );
+
+ if ( (aTextColor.GetColor() == COL_BLACK) || (aTextColor.GetLuminance() < 8) )
+ aShadowColor = Color( COL_LIGHTGRAY );
+
+ Point aPos( rPos );
+ aPos += Point( nOff, nOff );
+ Impl_writeText( aPos, rText, pDXArray, nWidth, aShadowColor );
+
+ if( !aMetric.IsOutline() )
+ {
+ Impl_writeText( rPos, rText, pDXArray, nWidth, aTextColor );
+ }
+ }
+
+ if( aMetric.IsOutline() )
+ {
+ Point aPos = rPos + Point( -6, -6 );
+ Impl_writeText( aPos, rText, pDXArray, nWidth, mpVDev->GetTextColor() );
+ aPos = rPos + Point(+6,+6);
+ Impl_writeText( aPos, rText, pDXArray, nWidth, mpVDev->GetTextColor() );
+ aPos = rPos + Point(-6,+0);
+ Impl_writeText( aPos, rText, pDXArray, nWidth, mpVDev->GetTextColor() );
+ aPos = rPos + Point(-6,+6);
+ Impl_writeText( aPos, rText, pDXArray, nWidth, mpVDev->GetTextColor() );
+ aPos = rPos + Point(+0,+6);
+ Impl_writeText( aPos, rText, pDXArray, nWidth, mpVDev->GetTextColor() );
+ aPos = rPos + Point(+0,-6);
+ Impl_writeText( aPos, rText, pDXArray, nWidth, mpVDev->GetTextColor() );
+ aPos = rPos + Point(+6,-1);
+ Impl_writeText( aPos, rText, pDXArray, nWidth, mpVDev->GetTextColor() );
+ aPos = rPos + Point(+6,+0);
+ Impl_writeText( aPos, rText, pDXArray, nWidth, mpVDev->GetTextColor() );
+
+ Impl_writeText( rPos, rText, pDXArray, nWidth, Color( COL_WHITE ) );
+ }
+ }
+ }
+}
+
+void Writer::Impl_writeText( const Point& rPos, const String& rText, const sal_Int32* pDXArray, long nWidth, Color aTextColor )
+{
+ sal_uInt32 nLen = rText.Len();
+
+ if( !nLen )
+ return;
+
+ const bool bRTL = (mpVDev->GetLayoutMode() & TEXT_LAYOUT_BIDI_RTL) != 0;
+
+ sal_Int16 nScriptType = ScriptType::LATIN;
+ Reference < XBreakIterator > xBI( Impl_GetBreakIterator() );
+ if( xBI.is() )
+ {
+ const OUString oText( rText );
+ nScriptType = xBI->getScriptType( oText, 0 );
+ }
+
+ // if the text is either right to left or complex or asian, we
+ // ask the output device for a polygon representation.
+ // On complex and asian text, each unicode character can have
+ // different glyph representation, based on context. Also positioning
+ // is not trivial so we let the output device do it for us.
+ if( bRTL || (nScriptType != ScriptType::LATIN) )
+ {
+ // todo: optimize me as this will generate a huge amount of duplicate polygons
+ PolyPolygon aPolyPoygon;
+ mpVDev->GetTextOutline( aPolyPoygon, rText, 0, 0, (USHORT)nLen, TRUE, nWidth, pDXArray );
+ aPolyPoygon.Translate( rPos );
+ Impl_writePolyPolygon( aPolyPoygon, sal_True, aTextColor, aTextColor );
+ }
+ else
+ {
+ Size aNormSize;
+ sal_Int32* pOwnArray;
+ sal_Int32* pDX;
+
+ // get text sizes
+ if( pDXArray )
+ {
+ pOwnArray = NULL;
+ aNormSize = Size( mpVDev->GetTextWidth( rText ), 0 );
+ pDX = (sal_Int32*) pDXArray;
+ }
+ else
+ {
+ pOwnArray = new sal_Int32[ nLen ];
+ aNormSize = Size( mpVDev->GetTextArray( rText, pOwnArray ), 0 );
+ pDX = pOwnArray;
+ }
+
+ if( nLen > 1 )
+ {
+ aNormSize.Width() = pDX[ nLen - 2 ] + mpVDev->GetTextWidth( rText.GetChar( (USHORT) nLen - 1 ) );
+
+ if( nWidth && aNormSize.Width() && ( nWidth != aNormSize.Width() ) )
+ {
+ const double fFactor = (double) nWidth / aNormSize.Width();
+
+ sal_uInt32 i;
+ for( i = 0; i < ( nLen - 1 ); i++ )
+ pDX[ i ] = FRound( pDX[ i ] * fFactor );
+ }
+ }
+
+ Font aOldFont( mpVDev->GetFont() );
+ Point aBaseLinePos( rPos );
+
+ Font aFont(aOldFont);
+ short nOrientation = aFont.GetOrientation();
+ aFont.SetOrientation( 0 );
+ aFont.SetUnderline(UNDERLINE_NONE);
+ aFont.SetStrikeout(STRIKEOUT_NONE);
+ mpVDev->SetFont( aFont );
+
+ const FontMetric aMetric( mpVDev->GetFontMetric() );
+
+ FlashFont& rFlashFont = Impl_getFont( aFont );
+
+ // always adjust text position to match baseline alignment
+ switch( aOldFont.GetAlign() )
+ {
+ case( ALIGN_TOP ):
+ aBaseLinePos.Y() += aMetric.GetAscent();
+ break;
+
+ case( ALIGN_BOTTOM ):
+ aBaseLinePos.Y() -= aMetric.GetDescent();
+ break;
+
+ default:
+ break;
+ }
+
+ // get mapped text position
+ const Point aPt( map( aBaseLinePos ) );
+
+ // write text element
+
+/* test code to create a bound rect, not realy working for rotated text
+ Size aTextSize( map( Size( mpVDev->GetTextWidth( rText ), mpVDev->GetTextHeight() ) ) );
+ Point aMetricPoint( map( Point( aMetric.GetLeading(), aMetric.GetAscent() ) ) );
+
+ Point aTmpPoint( map( Point( - aMetric.GetLeading(), - aMetric.GetAscent() ) ) ); ;
+ Rectangle aTmpRectangle(aTmpPoint, aTextSize );
+ Polygon aPoly( aTmpRectangle );
+
+ aPoly.Rotate( aTmpPoint, (USHORT) nOrientation );
+
+ Rectangle aTextBoundRect( aPoly.GetBoundRect() );
+
+ aPoly.Move( aPt.X(), aPt.Y() - map( Size( 0, aMetric.GetDescent() ) ).Height() );
+
+*/
+
+#if 0 // makes the calculated bound rect visible for debuging
+{
+ Polygon aTmpPoly( aPoly );
+ sal_uInt16 nID = FlashGeometryExporter::writePolygonShape( aMovieStream, aTmpPoly, false, Color(COL_MAGENTA), Color(COL_MAGENTA), mpClipPolyPolygon );
+ ImplPlaceObject( nID );
+}
+#endif
+
+ // CL: This is still a hack until we figure out how to calculate a correct bound rect
+ // for rotatet text
+ Rectangle textBounds( 0, 0, static_cast<long>(mnDocWidth*mnDocXScale), static_cast<long>(mnDocHeight*mnDocYScale) );
+ double scale = 1.0;
+
+ // scale width if we have a stretched text
+ if( 0 != aFont.GetSize().Width() )
+ {
+ Font aTmpFont( aFont );
+ aTmpFont.SetWidth(0);
+ mpVDev->SetFont( aTmpFont );
+
+ const FontMetric aMetric2( mpVDev->GetFontMetric() );
+ mpVDev->SetFont( aFont );
+
+ const long n1 = aFont.GetSize().Width();
+ const long n2 = aMetric2.GetSize().Width();
+ scale = (double)n1 / (double)n2;
+ }
+
+ basegfx::B2DHomMatrix m(basegfx::tools::createRotateB2DHomMatrix(static_cast<double>(nOrientation) * F_PI1800));
+ m.translate( double(aPt.X() / scale), double(aPt.Y()) );
+ m.scale( scale, scale );
+
+ sal_Int16 nHeight = _Int16( map( Size( 0, aFont.GetHeight() ) ).Height() );
+
+ startTag( TAG_DEFINETEXT );
+
+ sal_uInt16 nTextId = createID();
+
+ mpTag->addUI16( nTextId );
+ mpTag->addRect( textBounds );
+ mpTag->addMatrix( m );
+
+ sal_uInt8 nGlyphBits = 16;
+ sal_uInt8 nAdvanceBits = 16;
+
+ mpTag->addUI8( nGlyphBits );
+ mpTag->addUI8( nAdvanceBits );
+
+ // text style change record
+ mpTag->addUI8( 0x8c );
+ mpTag->addUI16( rFlashFont.getID() );
+ mpTag->addRGB( aTextColor );
+ mpTag->addUI16( _uInt16( nHeight ) );
+
+ DBG_ASSERT( nLen <= 127, "TODO: handle text with more than 127 characters" );
+
+ // Glyph record
+ mpTag->addUI8( (sal_uInt8) nLen );
+
+ BitStream aBits;
+
+ sal_Int32 nLastDX = 0;
+ sal_Int32 nAdvance;
+ sal_uInt32 i;
+ for( i = 0; i < nLen; i++ )
+ {
+ if( i < (nLen-1) )
+ {
+ nAdvance = pDX[i] - nLastDX;
+ nLastDX = pDX[i];
+ }
+ else
+ {
+ nAdvance = 0;
+ }
+
+ aBits.writeUB( rFlashFont.getGlyph(rText.GetChar(_uInt16(i)),mpVDev), nGlyphBits );
+ aBits.writeSB( _Int16(map( Size( (long)( nAdvance / scale ), 0 ) ).Width() ), nAdvanceBits );
+ }
+
+ mpTag->addBits( aBits );
+ mpTag->addUI8( 0 );
+
+ endTag();
+
+ maShapeIds.push_back( nTextId );
+
+ // AS: Write strikeout and underline, if neccessary. This code was originally taken from the SVG
+ // export facility, although the positioning had to be tweaked a little. I can't explain the
+ // numbers, but the flash lines up very well with the original OOo document. All of this should
+ // probably be converted to polygons as part of the meta file, though, as we don't handle any
+ // fancy lines (like dashes).
+ if( ( aOldFont.GetStrikeout() != STRIKEOUT_NONE ) || ( aOldFont.GetUnderline() != UNDERLINE_NONE ) )
+ {
+ Polygon aPoly( 4 );
+ const long nLineHeight = Max( (long) FRound( aMetric.GetLineHeight() * 0.05 ), (long) 1 );
+
+ if( aOldFont.GetStrikeout() != STRIKEOUT_NONE )
+ {
+ aPoly[ 0 ].X() = aBaseLinePos.X();
+ aPoly[ 0 ].Y() = aBaseLinePos.Y() - FRound( aMetric.GetAscent() * 0.26 ) - nLineHeight;
+ aPoly[ 1 ].X() = aPoly[ 0 ].X() + aNormSize.Width() - 1;
+ aPoly[ 1 ].Y() = aPoly[ 0 ].Y();
+ aPoly[ 2 ].X() = aPoly[ 1 ].X();
+ aPoly[ 2 ].Y() = aPoly[ 1 ].Y() + nLineHeight - 1;
+ aPoly[ 3 ].X() = aPoly[ 0 ].X();
+ aPoly[ 3 ].Y() = aPoly[ 2 ].Y();
+
+ Impl_writePolygon( aPoly, sal_True, aTextColor, aTextColor );
+ }
+
+ // AS: The factor of 1.5 on the nLineHeight is a magic number. I'm not sure why it works,
+ // but it looks good to me.
+ if( aOldFont.GetUnderline() != UNDERLINE_NONE )
+ {
+ aPoly[ 0 ].X() = aBaseLinePos.X();
+ aPoly[ 0 ].Y() = static_cast<long>(aBaseLinePos.Y() + 1.5*nLineHeight);
+ aPoly[ 1 ].X() = aPoly[ 0 ].X() + aNormSize.Width() - 1;
+ aPoly[ 1 ].Y() = aPoly[ 0 ].Y();
+ aPoly[ 2 ].X() = aPoly[ 1 ].X();
+ aPoly[ 2 ].Y() = aPoly[ 1 ].Y() + nLineHeight - 1;
+ aPoly[ 3 ].X() = aPoly[ 0 ].X();
+ aPoly[ 3 ].Y() = aPoly[ 2 ].Y();
+
+ Impl_writePolygon( aPoly, sal_True, aTextColor, aTextColor );
+ }
+ }
+
+ mpVDev->SetFont( aOldFont );
+ delete[] pOwnArray;
+ }
+}
+
+// -----------------------------------------------------------------------------
+// AS: Because JPEGs require the alpha channel provided seperately (JPEG does not
+// natively support alpha channel, but SWF lets you provide it seperately), we
+// extract the alpha channel into a seperate array here.
+void getBitmapData( const BitmapEx& aBmpEx, sal_uInt8*& tgadata, sal_uInt8*& tgaAlphadata, sal_uInt32& nWidth, sal_uInt32& nHeight )
+{
+ if( !aBmpEx.IsEmpty() )
+ {
+ Bitmap aBmp( aBmpEx.GetBitmap() );
+ BitmapReadAccess* pRAcc = aBmp.AcquireReadAccess();
+
+ if( pRAcc )
+ {
+ AlphaMask aAlpha;
+ nWidth = pRAcc->Width();
+ nHeight = pRAcc->Height();
+ tgadata = new sal_uInt8[nWidth*nHeight*4];
+ tgaAlphadata = new sal_uInt8[nWidth*nHeight];
+ sal_uInt8* p = tgadata, *pAlpha = tgaAlphadata;
+
+
+ if( aBmpEx.IsAlpha() )
+ aAlpha = aBmpEx.GetAlpha();
+ else if( aBmpEx.IsTransparent() )
+ aAlpha = aBmpEx.GetMask();
+ else
+ {
+ sal_uInt8 cAlphaVal = 0;
+ aAlpha = AlphaMask( aBmp.GetSizePixel(), &cAlphaVal );
+ }
+
+ BitmapReadAccess* pAAcc = aAlpha.AcquireReadAccess();
+
+ if( pAAcc )
+ {
+ for( sal_uInt32 nY = 0; nY < nHeight; nY++ )
+ {
+ for( sal_uInt32 nX = 0; nX < nWidth; nX++ )
+ {
+ const sal_uInt8 nAlpha = pAAcc->GetPixel( nY, nX ).GetIndex();
+ const BitmapColor aPixelColor( pRAcc->GetColor( nY, nX ) );
+
+ if( nAlpha == 0xff )
+ {
+ *p++ = 0;
+ *p++ = 0;
+ *p++ = 0;
+ *p++ = 0;
+ }
+ else
+ {
+ *p++ = 0xff-nAlpha;
+ *p++ = aPixelColor.GetRed();
+ *p++ = aPixelColor.GetGreen();
+ *p++ = aPixelColor.GetBlue();
+ }
+ *pAlpha++ = 0xff - nAlpha;
+ }
+ }
+
+ aAlpha.ReleaseAccess( pAAcc );
+ }
+
+ aBmp.ReleaseAccess( pRAcc );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+sal_uInt16 Writer::defineBitmap( const BitmapEx &bmpSource, sal_Int32 nJPEGQualityLevel )
+{
+ ULONG bmpChecksum = bmpSource.GetChecksum();
+
+ ChecksumCache::iterator it = mBitmapCache.find(bmpChecksum);
+
+ // AS: We already exported this bitmap, so just return its ID.
+ if (mBitmapCache.end() != it)
+ return it->second;
+
+ sal_uInt16 nBitmapId = createID();
+ mBitmapCache[bmpChecksum] = nBitmapId;
+
+ // AS: OK, we have a good image, so now we decide whether or not to JPEG it or
+ // or Lossless compress it.
+
+ //Figure out lossless size
+ sal_uInt8 *pImageData, *pAlphaData;
+ sal_uInt32 width, height;
+
+ getBitmapData( bmpSource, pImageData, pAlphaData, width, height );
+ sal_uInt32 raw_size = width * height * 4;
+ uLongf compressed_size = raw_size + (sal_uInt32)(raw_size/100) + 12;
+ sal_uInt8 *pCompressed = new sal_uInt8[ compressed_size ];
+
+#ifdef DBG_UTIL
+ if(compress2(pCompressed, &compressed_size, pImageData, raw_size, Z_BEST_COMPRESSION) != Z_OK)
+ {
+ DBG_ASSERT( false, "compress2 failed!" ); ((void)0);
+ }
+#else
+ compress2(pCompressed, &compressed_size, pImageData, raw_size, Z_BEST_COMPRESSION);
+#endif
+
+ // AS: SWF files let you provide an Alpha mask for JPEG images, but we have
+ // to ZLIB compress the alpha channel seperately.
+ uLong alpha_compressed_size = 0;
+ sal_uInt8 *pAlphaCompressed = NULL;
+ if (bmpSource.IsAlpha() || bmpSource.IsTransparent())
+ {
+ alpha_compressed_size = uLongf(width * height + (sal_uInt32)(raw_size/100) + 12);
+ pAlphaCompressed = new sal_uInt8[ compressed_size ];
+
+#ifdef DBG_UTIL
+ if(compress2(pAlphaCompressed, &alpha_compressed_size, pAlphaData, width * height, Z_BEST_COMPRESSION) != Z_OK)
+ {
+ DBG_ASSERT( false, "compress2 failed!" ); ((void)0);
+ }
+#else
+ compress2(pAlphaCompressed, &alpha_compressed_size, pAlphaData, width * height, Z_BEST_COMPRESSION);
+#endif
+ }
+
+ //Figure out JPEG size
+ const sal_uInt8* pJpgData = NULL;;
+ sal_uInt32 nJpgDataLength = 0xffffffff;
+
+ Graphic aGraphic( bmpSource );
+ SvMemoryStream aDstStm( 65535, 65535 );
+
+ GraphicFilter aFilter;
+
+ Sequence< PropertyValue > aFilterData(nJPEGQualityLevel != -1);
+ if( nJPEGQualityLevel != -1 )
+ {
+ aFilterData[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM("Quality"));
+ aFilterData[0].Value <<= nJPEGQualityLevel;
+ }
+
+#if 0
+ // Debug code to see what we export to swf
+ {
+ SvFileStream aDstStm( String( RTL_CONSTASCII_USTRINGPARAM("e:\\test.jpg") ), STREAM_READ | STREAM_WRITE | STREAM_TRUNC );
+ aFilter.ExportGraphic( aGraphic, String(), aDstStm,
+ aFilter.GetExportFormatNumberForShortName( OUString( RTL_CONSTASCII_USTRINGPARAM( JPG_SHORTNAME ) ) ), &aFilterData );
+ }
+#endif
+
+ if( aFilter.ExportGraphic( aGraphic, String(), aDstStm,
+ aFilter.GetExportFormatNumberForShortName( OUString( RTL_CONSTASCII_USTRINGPARAM( JPG_SHORTNAME ) ) ), &aFilterData ) == ERRCODE_NONE )
+ {
+ pJpgData = reinterpret_cast<const sal_uInt8*>(aDstStm.GetData());
+ nJpgDataLength = aDstStm.Seek( STREAM_SEEK_TO_END );
+ }
+
+ // AS: Ok, now go ahead and use whichever is smaller. If JPEG is smaller, then
+ // we have to export as TAG_DEFINEBITSJPEG3 in the case that there is alpha
+ // channel data.
+ if ( pJpgData && ( nJpgDataLength + alpha_compressed_size < compressed_size) )
+ Impl_writeJPEG(nBitmapId, pJpgData, nJpgDataLength, pAlphaCompressed, alpha_compressed_size );
+ else
+ Impl_writeBmp( nBitmapId, width, height, pCompressed, compressed_size );
+
+ delete[] pCompressed;
+ delete[] pAlphaCompressed;
+ delete[] pImageData;
+ delete[] pAlphaData;
+
+ return nBitmapId;
+}
+
+// -----------------------------------------------------------------------------
+
+void Writer::Impl_writeImage( const BitmapEx& rBmpEx, const Point& rPt, const Size& rSz, const Point& /* rSrcPt */, const Size& /* rSrcSz */, const Rectangle& rClipRect, bool bNeedToMapClipRect )
+{
+ if( !!rBmpEx )
+ {
+ BitmapEx bmpSource( rBmpEx );
+
+ Rectangle originalPixelRect = Rectangle(Point(), bmpSource.GetSizePixel());
+
+ Point srcPt( map(rPt) );
+ Size srcSize( map(rSz) );
+ Rectangle destRect( srcPt, srcSize );
+
+ // AS: Christian, my scaling factors are different than yours, and work better for me.
+ // However, I can't explain why exactly. I got some of this by trial and error.
+ double XScale = static_cast<double>(originalPixelRect.GetWidth())/destRect.GetWidth();
+ double YScale = static_cast<double>(originalPixelRect.GetHeight())/destRect.GetHeight();
+
+ // AS: If rClipRect has a value set, then we need to crop the bmp appropriately.
+ // If a map event already occurred in the metafile, then we do not need to map
+ // the clip rect as it's already been done.
+ if (!rClipRect.IsEmpty())
+ {
+ // AS: Christian, I also don't understand why bNeedToMapClipRect is necessary, but it
+ // works like a charm. Usually, the map event in the meta file does not cause the
+ // clipping rectangle to get mapped. However, sometimes there are multiple layers
+ // of mapping which eventually do cause the clipping rect to be mapped.
+ Size clipSize( bNeedToMapClipRect ? map(rClipRect.GetSize()) : rClipRect.GetSize() );
+ Rectangle clipRect = Rectangle(Point(), clipSize);
+ destRect.Intersection( clipRect );
+
+ Rectangle cropRect(destRect);
+
+ // AS: The bmp origion is always 0,0 so we have to adjust before we crop.
+ cropRect.Move(-srcPt.X(), -srcPt.Y());
+ // AS: Rectangle has no scale function (?!) so I do it manually...
+ Rectangle cropPixelRect(static_cast<long>(cropRect.Left()*XScale),
+ static_cast<long>(cropRect.Top()*YScale),
+ static_cast<long>(cropRect.Right()*XScale),
+ static_cast<long>(cropRect.Bottom()*YScale));
+
+ bmpSource.Crop(cropPixelRect);
+ }
+
+ if( !!bmpSource )
+ {
+ // #105949# fix images that are under 16 pixels width or height by
+ // expanding them. Some swf players can't display such small
+ // bitmaps
+ const Size& rSizePixel = bmpSource.GetSizePixel();
+ if( (rSizePixel.Width() < 16) || (rSizePixel.Height() < 16) )
+ {
+ const sal_uInt32 nDX = rSizePixel.Width() < 16 ? 16 - rSizePixel.Width() : 0;
+ const sal_uInt32 nDY = rSizePixel.Height() < 16 ? 16 - rSizePixel.Height() : 0;
+ bmpSource.Expand( nDX, nDY );
+ }
+
+ sal_Int32 nJPEGQuality = mnJPEGCompressMode;
+
+ Size szDestPixel = mpVDev->LogicToPixel(srcSize, aTWIPSMode);
+
+ double pixXScale = static_cast<double>(szDestPixel.Width()) / originalPixelRect.GetWidth();
+ double pixYScale = static_cast<double>(szDestPixel.Height()) / originalPixelRect.GetHeight();
+
+ // AS: If the image has been scaled down, then scale down the quality
+ // that we use for JPEG compression.
+ if (pixXScale < 1.0 && pixYScale < 1.0)
+ {
+
+ double qualityScale = (pixXScale + pixYScale)/2;
+
+ nJPEGQuality = (sal_Int32)( nJPEGQuality * qualityScale );
+
+ if (nJPEGQuality < 10)
+ nJPEGQuality += 3;
+ }
+
+ sal_uInt16 nBitmapId = defineBitmap(bmpSource, nJPEGQuality);
+
+ Polygon aPoly( destRect );
+
+ // AS: Since images are being cropped now, no translation is normally necessary.
+ // However, some things like graphical bullet points are still get translated.
+ ::basegfx::B2DHomMatrix m; // #i73264#
+ m.scale(1.0/XScale, 1.0/YScale );
+ if (destRect.Left() || destRect.Top())
+ m.translate(destRect.Left(), destRect.Top());
+
+ FillStyle aFillStyle( nBitmapId, true, m );
+
+ sal_uInt16 nShapeId = defineShape( aPoly, aFillStyle );
+
+ maShapeIds.push_back( nShapeId );
+ }
+ }
+}
+// -----------------------------------------------------------------------------
+
+void Writer::Impl_writeBmp( sal_uInt16 nBitmapId, sal_uInt32 width, sal_uInt32 height, sal_uInt8 *pCompressed, sal_uInt32 compressed_size )
+{
+ startTag( TAG_DEFINEBITSLOSSLESS2 );
+
+ mpTag->addUI16( nBitmapId );
+ mpTag->addUI8( 5 );
+ mpTag->addUI16( _uInt16(width) );
+ mpTag->addUI16( _uInt16(height) );
+
+ mpTag->Write( pCompressed, compressed_size );
+
+ endTag();
+}
+
+// -----------------------------------------------------------------------------
+
+void Writer::Impl_writeJPEG(sal_uInt16 nBitmapId, const sal_uInt8* pJpgData, sal_uInt32 nJpgDataLength, sal_uInt8 *pAlphaCompressed, sal_uInt32 alpha_compressed_size )
+{
+ // AS: Go through the actuall JPEG bits, seperating out the
+ // header fields from the actual image fields. Fields are
+ // identifed by 0xFFXX where XX is the field type. Both
+ // the header and the image need start and stop (D8 and D9),
+ // so that's why you see those written to both. I don't
+ // really know what the rest of these are, I got it to work
+ // kind of by trial and error and by comparing with known
+ // good SWF files.
+ sal_uInt8 cType = 0x01;
+ const sal_uInt8* pJpgSearch = pJpgData;
+
+ int nLength = 0;
+
+ SvMemoryStream EncodingTableStream;
+ SvMemoryStream ImageBitsStream;
+ for (;pJpgSearch < pJpgData + nJpgDataLength; pJpgSearch += nLength)
+ {
+
+#ifdef DBG_UTIL
+ if (0xFF != *pJpgSearch)
+ {
+ DBG_ERROR( "Expected JPEG marker." ); ((void)0);
+ }
+#endif
+
+ cType = *(pJpgSearch + 1);
+
+ if (0xD8 == cType || 0xD9 == cType)
+ {
+ nLength = 2;
+ }
+ else if (0xDA == cType)
+ {
+ //AS: This is the actual image data, and runs to the
+ // end of the file (as best I know), minus 2 bytes
+ // for the closing 0xFFD9.
+ nLength = nJpgDataLength - (pJpgSearch - pJpgData) - 2;
+ }
+ else
+ {
+ // AS: Lengths are big endian.
+
+ // Beware. pJpgSearch is not necessarily word-aligned,
+ // so we access it byte-wise.
+
+ // AS: Add 2 to the length to include the 0xFFXX itself.
+ nLength = 2 + (pJpgSearch[2]<<8) + pJpgSearch[3];
+ }
+
+ // AS: I'm refering to libjpeg for a list of what these
+ // markers are. See jdmarker.c for a list.
+ // AS: I'm ignoring application specific markers 0xE1...0xEF
+ // and comments 0xFE. I don't know what
+ // 0xF0 or 0xFD are for, and they don't come up.
+ // Additionally, 0xDE and 0xDF aren't clear to me.
+ switch(cType)
+ {
+ case 0xD8:
+ case 0xD9:
+ EncodingTableStream.Write( pJpgSearch, nLength );
+ ImageBitsStream.Write( pJpgSearch, nLength );
+ break;
+
+ case 0x01:
+ case 0xDB:
+ case 0xDC:
+ case 0xDD:
+ case 0xC4:
+ EncodingTableStream.Write( pJpgSearch, nLength );
+ break;
+
+ case 0xC0:
+ case 0xC1:
+ case 0xC2:
+ case 0xC3:
+ case 0xC5:
+ case 0xC6:
+ case 0xC7:
+// case 0xC8: Apparently reserved for JPEG extensions?
+ case 0xC9:
+ case 0xCA:
+ case 0xCB:
+ case 0xCD:
+ case 0xCE:
+ case 0xCF:
+ case 0xDA:
+ case 0xE0:
+ ImageBitsStream.Write( pJpgSearch, nLength );
+ break;
+
+ default:
+ DBG_ERROR( "JPEG marker I didn't handle!" );
+
+ }
+ }
+
+ EncodingTableStream.Seek( STREAM_SEEK_TO_END );
+ sal_uInt32 nEncodingTableSize = EncodingTableStream.Tell();
+ EncodingTableStream.Seek( STREAM_SEEK_TO_BEGIN );
+
+ ImageBitsStream.Seek( STREAM_SEEK_TO_END );
+ sal_uInt32 nImageBitsSize = ImageBitsStream.Tell();
+ ImageBitsStream.Seek( STREAM_SEEK_TO_BEGIN );
+
+ // AS: If we need alpha support, use TAG_DEFINEBITSJPEG3.
+ if (alpha_compressed_size > 0)
+ {
+ startTag( TAG_DEFINEBITSJPEG3 );
+
+ mpTag->addUI16( nBitmapId );
+
+ mpTag->addUI32( nEncodingTableSize + nImageBitsSize );
+
+ mpTag->Write(EncodingTableStream.GetData(), nEncodingTableSize);
+ mpTag->Write(ImageBitsStream.GetData(), nImageBitsSize);
+
+ mpTag->Write( pAlphaCompressed, alpha_compressed_size );
+
+ endTag();
+ }
+ else
+ {
+ startTag( TAG_DEFINEBITSJPEG2 );
+
+ mpTag->addUI16( nBitmapId );
+
+ mpTag->Write(EncodingTableStream.GetData(), nEncodingTableSize);
+ mpTag->Write(ImageBitsStream.GetData(), nImageBitsSize);
+
+ endTag();
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void Writer::Impl_writeLine( const Point& rPt1, const Point& rPt2, const Color* pLineColor )
+{
+ Color aOldColor( mpVDev->GetLineColor() );
+ if( pLineColor )
+ mpVDev->SetLineColor( *pLineColor );
+
+ const Point aPtAry[2] = { rPt1, rPt2 };
+ Polygon aPoly( 2, aPtAry );
+ Impl_writePolyPolygon( aPoly, false );
+
+ mpVDev->SetLineColor( aOldColor );
+}
+
+// -----------------------------------------------------------------------------
+
+void Writer::Impl_writeRect( const Rectangle& rRect, long nRadX, long nRadY )
+{
+ if( (rRect.nTop == rRect.nBottom) || (rRect.nLeft == rRect.nRight) )
+ {
+ Color aColor( mpVDev->GetFillColor() );
+ Impl_writeLine( rRect.TopLeft(), rRect.BottomRight(), &aColor );
+ }
+ else
+ {
+ Polygon aPoly( rRect, nRadX, nRadY );
+ Impl_writePolyPolygon( aPoly, true );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void Writer::Impl_writeEllipse( const Point& rCenter, long nRadX, long nRadY )
+{
+ Polygon aPoly( rCenter, nRadX, nRadY );
+ Impl_writePolyPolygon( aPoly, false );
+}
+
+
+/** writes the stroke defined by SvtGraphicStroke and returns true or it returns
+ false if it can't handle this stroke.
+*/
+bool Writer::Impl_writeStroke( SvtGraphicStroke& rStroke )
+{
+ Polygon aPolygon;
+ rStroke.getPath( aPolygon );
+ PolyPolygon aPolyPolygon( aPolygon );
+
+ Rectangle aOldRect( aPolyPolygon.GetBoundRect() );
+
+ map( aPolyPolygon );
+
+ Rectangle aNewRect( aPolyPolygon.GetBoundRect() );
+
+ // as log as not LINESTYLE2 and DefineShape4 is used (which
+ // added support for LineJoin), only round LineJoins are
+ // supported. Fallback to META_POLYLINE_ACTION and META_LINE_ACTION
+ if(SvtGraphicStroke::joinRound != rStroke.getJoinType())
+ return false;
+
+ PolyPolygon aStartArrow;
+ rStroke.getStartArrow( aStartArrow );
+ if( 0 != aStartArrow.Count() )
+ return false; // todo: Implement line ends
+
+ PolyPolygon aEndArrow;
+ rStroke.getEndArrow( aEndArrow );
+ if( 0 != aEndArrow.Count() )
+ return false; // todo: Implement line ends
+
+ SvtGraphicStroke::DashArray aDashArray;
+ rStroke.getDashArray( aDashArray );
+ if( 0 != aDashArray.size() )
+ return false; // todo: implement dashes
+
+ Color aColor( mpVDev->GetLineColor() );
+
+ if( 0.0 != rStroke.getTransparency() )
+ aColor.SetTransparency( sal::static_int_cast<UINT8>( MinMax( (long int)( rStroke.getTransparency() * 0xff ), 0, 0xff ) ) );
+
+ sal_uInt16 nShapeId = defineShape( aPolyPolygon, sal::static_int_cast<sal_uInt16>( mapRelative( (sal_Int32)( rStroke.getStrokeWidth() ) ) ), aColor );
+ maShapeIds.push_back( nShapeId );
+ return true;
+}
+
+// -----------------------------------------------------------------------------
+
+/** writes the filling defined by SvtGraphicFill and returns true or it returns
+ false if it can't handle this filling.
+*/
+bool Writer::Impl_writeFilling( SvtGraphicFill& rFilling )
+{
+ PolyPolygon aPolyPolygon;
+ rFilling.getPath( aPolyPolygon );
+
+ Rectangle aOldRect( aPolyPolygon.GetBoundRect() );
+
+ map( aPolyPolygon );
+
+ Rectangle aNewRect( aPolyPolygon.GetBoundRect() );
+
+ switch( rFilling.getFillType() )
+ {
+ case SvtGraphicFill::fillSolid:
+ {
+ Color aColor( rFilling.getFillColor() );
+
+ if( 0.0 != rFilling.getTransparency() )
+ aColor.SetTransparency( sal::static_int_cast<UINT8>( MinMax( (long int)( rFilling.getTransparency() * 0xff ) , 0, 0xff ) ) );
+
+ FillStyle aFillStyle( aColor );
+
+ sal_uInt16 nShapeId = defineShape( aPolyPolygon, aFillStyle );
+ maShapeIds.push_back( nShapeId );
+ }
+ break;
+ case SvtGraphicFill::fillGradient:
+ return false;
+ case SvtGraphicFill::fillHatch:
+ return false;
+ case SvtGraphicFill::fillTexture:
+ {
+ Graphic aGraphic;
+ rFilling.getGraphic( aGraphic );
+
+ // CL->AS: Should we also scale down the quality here depending on image scale?
+ sal_uInt16 nBitmapId = defineBitmap( aGraphic.GetBitmapEx(), mnJPEGCompressMode );
+
+ ::basegfx::B2DHomMatrix aMatrix; // #i73264#
+
+ SvtGraphicFill::Transform aTransform;
+
+ rFilling.getTransform( aTransform );
+
+ sal_uInt16 a,b;
+ for( a = 0; a < 2; a++ )
+ {
+ for( b = 0; b < 3; b++ )
+ {
+ aMatrix.set(a, b, aTransform.matrix[a*3+b]);
+ }
+ }
+ aMatrix.set(2, 0, 0.0);
+ aMatrix.set(2, 1, 0.0);
+ aMatrix.set(2, 2, 1.0);
+
+ // scale bitmap
+ Rectangle originalPixelRect = Rectangle(Point(), aGraphic.GetBitmapEx().GetSizePixel());
+
+ double XScale = (double)aNewRect.GetWidth()/aOldRect.GetWidth();
+ double YScale = (double)aNewRect.GetHeight()/aOldRect.GetHeight();
+
+ aMatrix.scale( XScale, YScale );
+
+ FillStyle aFillStyle( nBitmapId, !rFilling.IsTiling(), aMatrix );
+
+ sal_uInt16 nShapeId = defineShape( aPolyPolygon, aFillStyle );
+ maShapeIds.push_back( nShapeId );
+ }
+ break;
+ }
+ return true;
+}
+
+// -----------------------------------------------------------------------------
+
+/* CL: The idea was to export page fields as text fields that get theire
+ string from a variable set with actionscript by each page. This didn't
+ work out since the formating is always wrong when text follows the
+ page number field since pages greater one may require more space than
+ page 1
+*/
+#if 0
+bool Writer::Impl_writePageField( Rectangle& rTextBounds )
+{
+ startTag( TAG_DEFINEEDITTEXT );
+
+ sal_uInt16 nTextId = createID();
+
+ mpTag->addUI16( nTextId );
+ mpTag->addRect( rTextBounds );
+
+ BitStream aBits;
+ aBits.writeUB( 1, 1 ); // HasText
+ aBits.writeUB( 0, 1 ); // WordWrap
+ aBits.writeUB( 0, 1 ); // MultiLine
+ aBits.writeUB( 0, 1 ); // Password
+ aBits.writeUB( 1, 1 ); // HasTextColor
+ aBits.writeUB( 0, 1 ); // HasMaxLength
+ aBits.writeUB( 0, 1 ); // HasFont
+ aBits.writeUB( 0, 1 ); // Reserved
+ aBits.writeUB( 0, 1 ); // AutoSize
+ aBits.writeUB( 0, 1 ); // HasLayout
+ aBits.writeUB( 1, 1 ); // NoSelect
+ aBits.writeUB( 1, 1 ); // Border
+ aBits.writeUB( 0, 1 ); // Reserved
+ aBits.writeUB( 0, 1 ); // HTML
+ aBits.writeUB( 0, 1 ); // UseOutlines
+ mpTag->addBits( aBits );
+
+ Color aColor( COL_BLACK );
+ mpTag->addRGB( aColor );
+ mpTag->addString( "PageNumber" );
+ mpTag->addString( "XXX" );
+
+ endTag();
+
+ maShapeIds.push_back( nTextId );
+
+ return true;
+}
+#endif
+
+// -----------------------------------------------------------------------------
+
+void Writer::Impl_handleLineInfoPolyPolygons(const LineInfo& rInfo, const basegfx::B2DPolygon& rLinePolygon)
+{
+ if(rLinePolygon.count())
+ {
+ basegfx::B2DPolyPolygon aLinePolyPolygon(rLinePolygon);
+ basegfx::B2DPolyPolygon aFillPolyPolygon;
+
+ rInfo.applyToB2DPolyPolygon(aLinePolyPolygon, aFillPolyPolygon);
+
+ if(aLinePolyPolygon.count())
+ {
+ for(sal_uInt32 a(0); a < aLinePolyPolygon.count(); a++)
+ {
+ const basegfx::B2DPolygon aCandidate(aLinePolyPolygon.getB2DPolygon(a));
+ Impl_writePolygon(Polygon(aCandidate), sal_False );
+ }
+ }
+
+ if(aFillPolyPolygon.count())
+ {
+ const Color aOldLineColor(mpVDev->GetLineColor());
+ const Color aOldFillColor(mpVDev->GetFillColor());
+
+ mpVDev->SetLineColor();
+ mpVDev->SetFillColor(aOldLineColor);
+
+ for(sal_uInt32 a(0); a < aFillPolyPolygon.count(); a++)
+ {
+ const Polygon aPolygon(aFillPolyPolygon.getB2DPolygon(a));
+ Impl_writePolyPolygon(PolyPolygon(Polygon(aPolygon)), sal_True );
+ }
+
+ mpVDev->SetLineColor(aOldLineColor);
+ mpVDev->SetFillColor(aOldFillColor);
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void Writer::Impl_writeActions( const GDIMetaFile& rMtf )
+{
+ Rectangle clipRect;
+ int bMap = 0;
+ for( ULONG i = 0, nCount = rMtf.GetActionCount(); i < nCount; i++ )
+ {
+ const MetaAction* pAction = rMtf.GetAction( i );
+ const USHORT nType = pAction->GetType();
+
+ switch( nType )
+ {
+ case( META_PIXEL_ACTION ):
+ {
+ const MetaPixelAction* pA = (const MetaPixelAction*) pAction;
+
+ Impl_writeLine( pA->GetPoint(), pA->GetPoint(), &pA->GetColor() );
+ }
+ break;
+
+ case( META_POINT_ACTION ):
+ {
+ const MetaPointAction* pA = (const MetaPointAction*) pAction;
+
+ Impl_writeLine( pA->GetPoint(), pA->GetPoint() );
+ }
+ break;
+
+ case( META_LINE_ACTION ):
+ {
+ const MetaLineAction* pA = (const MetaLineAction*) pAction;
+
+ if(pA->GetLineInfo().IsDefault())
+ {
+ Impl_writeLine( pA->GetStartPoint(), pA->GetEndPoint() );
+ }
+ else
+ {
+ // LineInfo used; handle Dash/Dot and fat lines
+ basegfx::B2DPolygon aPolygon;
+ aPolygon.append(basegfx::B2DPoint(pA->GetStartPoint().X(), pA->GetStartPoint().Y()));
+ aPolygon.append(basegfx::B2DPoint(pA->GetEndPoint().X(), pA->GetEndPoint().Y()));
+ Impl_handleLineInfoPolyPolygons(pA->GetLineInfo(), aPolygon);
+ }
+ }
+ break;
+
+ case( META_RECT_ACTION ):
+ {
+ Impl_writeRect( ( (const MetaRectAction*) pAction )->GetRect(), 0, 0 );
+ }
+ break;
+
+ case( META_ROUNDRECT_ACTION ):
+ {
+ const MetaRoundRectAction* pA = (const MetaRoundRectAction*) pAction;
+
+ Impl_writeRect( pA->GetRect(), pA->GetHorzRound(), pA->GetVertRound() );
+ }
+ break;
+
+ case( META_ELLIPSE_ACTION ):
+ {
+ const MetaEllipseAction* pA = (const MetaEllipseAction*) pAction;
+ const Rectangle& rRect = pA->GetRect();
+
+ Impl_writeEllipse( rRect.Center(), rRect.GetWidth() >> 1, rRect.GetHeight() >> 1 );
+ }
+ break;
+
+ case( META_ARC_ACTION ):
+ case( META_PIE_ACTION ):
+ case( META_CHORD_ACTION ):
+ case( META_POLYGON_ACTION ):
+ {
+ Polygon aPoly;
+
+ switch( nType )
+ {
+ case( META_ARC_ACTION ):
+ {
+ const MetaArcAction* pA = (const MetaArcAction*) pAction;
+ aPoly = Polygon( pA->GetRect(), pA->GetStartPoint(), pA->GetEndPoint(), POLY_ARC );
+ }
+ break;
+
+ case( META_PIE_ACTION ):
+ {
+ const MetaPieAction* pA = (const MetaPieAction*) pAction;
+ aPoly = Polygon( pA->GetRect(), pA->GetStartPoint(), pA->GetEndPoint(), POLY_PIE );
+ }
+ break;
+
+ case( META_CHORD_ACTION ):
+ {
+ const MetaChordAction* pA = (const MetaChordAction*) pAction;
+ aPoly = Polygon( pA->GetRect(), pA->GetStartPoint(), pA->GetEndPoint(), POLY_CHORD );
+ }
+ break;
+
+ case( META_POLYGON_ACTION ):
+ aPoly = ( (const MetaPolygonAction*) pAction )->GetPolygon();
+ break;
+ }
+
+ if( aPoly.GetSize() )
+ {
+ Impl_writePolygon( aPoly, sal_True );
+ }
+ }
+ break;
+
+ case( META_POLYLINE_ACTION ):
+ {
+ const MetaPolyLineAction* pA = (const MetaPolyLineAction*) pAction;
+ const Polygon& rPoly = pA->GetPolygon();
+
+ if( rPoly.GetSize() )
+ {
+ if(pA->GetLineInfo().IsDefault())
+ {
+ Impl_writePolygon( rPoly, sal_False );
+ }
+ else
+ {
+ // LineInfo used; handle Dash/Dot and fat lines
+ Impl_handleLineInfoPolyPolygons(pA->GetLineInfo(), rPoly.getB2DPolygon());
+ }
+ }
+ }
+ break;
+
+ case( META_POLYPOLYGON_ACTION ):
+ {
+ const MetaPolyPolygonAction* pA = (const MetaPolyPolygonAction*) pAction;
+ const PolyPolygon& rPolyPoly = pA->GetPolyPolygon();
+
+ if( rPolyPoly.Count() )
+ Impl_writePolyPolygon( rPolyPoly, sal_True );
+ }
+ break;
+
+ case( META_GRADIENT_ACTION ):
+ {
+ const MetaGradientAction* pA = (const MetaGradientAction*) pAction;
+
+ Polygon aPoly( pA->GetRect() );
+ Impl_writeGradientEx( aPoly, pA->GetGradient() );
+ }
+ break;
+
+ case( META_GRADIENTEX_ACTION ):
+ {
+ const MetaGradientExAction* pA = (const MetaGradientExAction*) pAction;
+ Impl_writeGradientEx( pA->GetPolyPolygon(), pA->GetGradient() );
+ }
+ break;
+
+ case META_HATCH_ACTION:
+ {
+ const MetaHatchAction* pA = (const MetaHatchAction*) pAction;
+ GDIMetaFile aTmpMtf;
+
+ mpVDev->AddHatchActions( pA->GetPolyPolygon(), pA->GetHatch(), aTmpMtf );
+ Impl_writeActions( aTmpMtf );
+ }
+ break;
+
+ case( META_TRANSPARENT_ACTION ):
+ {
+ const MetaTransparentAction* pA = (const MetaTransparentAction*) pAction;
+ const PolyPolygon& rPolyPoly = pA->GetPolyPolygon();
+
+ if( rPolyPoly.Count() )
+ {
+ // convert transparence from percent into 0x00 - 0xff
+ sal_uInt8 nTransparence = (sal_uInt8) MinMax( FRound( pA->GetTransparence() * 2.55 ), 0, 255 );
+ Impl_writePolyPolygon( rPolyPoly, sal_True, nTransparence );
+ }
+ }
+ break;
+
+ case( META_FLOATTRANSPARENT_ACTION ):
+ {
+ const MetaFloatTransparentAction* pA = (const MetaFloatTransparentAction*) pAction;
+ GDIMetaFile aTmpMtf( pA->GetGDIMetaFile() );
+ Point aSrcPt( aTmpMtf.GetPrefMapMode().GetOrigin() );
+ const Size aSrcSize( aTmpMtf.GetPrefSize() );
+ const Point aDestPt( pA->GetPoint() );
+ const Size aDestSize( pA->GetSize() );
+ const double fScaleX = aSrcSize.Width() ? (double) aDestSize.Width() / aSrcSize.Width() : 1.0;
+ const double fScaleY = aSrcSize.Height() ? (double) aDestSize.Height() / aSrcSize.Height() : 1.0;
+ long nMoveX, nMoveY;
+
+ if( fScaleX != 1.0 || fScaleY != 1.0 )
+ {
+ aTmpMtf.Scale( fScaleX, fScaleY );
+ aSrcPt.X() = FRound( aSrcPt.X() * fScaleX );
+ aSrcPt.Y() = FRound( aSrcPt.Y() * fScaleY );
+ }
+
+ nMoveX = aDestPt.X() - aSrcPt.X(), nMoveY = aDestPt.Y() - aSrcPt.Y();
+
+ if( nMoveX || nMoveY )
+ aTmpMtf.Move( nMoveX, nMoveY );
+
+ const Gradient& rGradient = pA->GetGradient();
+ sal_uInt32 nLuminance = ((sal_Int32)rGradient.GetStartColor().GetLuminance() + (sal_Int32)rGradient.GetEndColor().GetLuminance() ) >> 1;
+
+ sal_uInt8 nOldGlobalTransparency = mnGlobalTransparency;
+ mnGlobalTransparency = (sal_uInt8)MinMax( nLuminance, 0, 0xff );
+
+ mpVDev->Push();
+ Impl_writeActions( aTmpMtf );
+ mpVDev->Pop();
+
+ mnGlobalTransparency = nOldGlobalTransparency;
+ }
+ break;
+
+ case( META_EPS_ACTION ):
+ {
+ const MetaEPSAction* pA = (const MetaEPSAction*) pAction;
+ const GDIMetaFile aGDIMetaFile( pA->GetSubstitute() );
+ sal_Bool bFound = sal_False;
+
+ for( ULONG j = 0, nC = aGDIMetaFile.GetActionCount(); ( j < nC ) && !bFound; j++ )
+ {
+ const MetaAction* pSubstAct = aGDIMetaFile.GetAction( j );
+
+ if( pSubstAct->GetType() == META_BMPSCALE_ACTION )
+ {
+ bFound = sal_True;
+ const MetaBmpScaleAction* pBmpScaleAction = (const MetaBmpScaleAction*) pSubstAct;
+ Impl_writeImage( pBmpScaleAction->GetBitmap(),
+ pA->GetPoint(), pA->GetSize(),
+ Point(), pBmpScaleAction->GetBitmap().GetSizePixel(), clipRect, 1 == bMap );
+ }
+ }
+ }
+ break;
+
+ case( META_COMMENT_ACTION ):
+ {
+ const MetaCommentAction* pA = (const MetaCommentAction*) pAction;
+ const BYTE* pData = pA->GetData();
+ String aSkipComment;
+
+ if( pA->GetComment().CompareIgnoreCaseToAscii( "XGRAD_SEQ_BEGIN" ) == COMPARE_EQUAL )
+ {
+ const MetaGradientExAction* pGradAction = NULL;
+ sal_Bool bDone = sal_False;
+
+ while( !bDone && ( ++i < nCount ) )
+ {
+ pAction = rMtf.GetAction( i );
+
+ if( pAction->GetType() == META_GRADIENTEX_ACTION )
+ pGradAction = (const MetaGradientExAction*) pAction;
+ else if( ( pAction->GetType() == META_COMMENT_ACTION ) &&
+ ( ( (const MetaCommentAction*) pAction )->GetComment().CompareIgnoreCaseToAscii( "XGRAD_SEQ_END" ) == COMPARE_EQUAL ) )
+ {
+ bDone = sal_True;
+ }
+ }
+
+ if( pGradAction )
+ Impl_writeGradientEx( pGradAction->GetPolyPolygon(), pGradAction->GetGradient());
+ }
+ else if( pA->GetComment().CompareIgnoreCaseToAscii( "XPATHFILL_SEQ_BEGIN" ) == COMPARE_EQUAL &&
+ pData )
+ {
+
+ // this comment encapsulates all high level information for a filling that caused
+ // the meta actions between the "XPATHFILL_SEQ_BEGIN" and "XPATHFILL_SEQ_END" comment.
+
+ SvtGraphicFill aFilling;
+ SvMemoryStream aMemStm( (void*)pData, pA->GetDataSize(), STREAM_READ );
+
+ // read the fill info
+ aMemStm >> aFilling;
+
+ // if impl_writeFilling can handle this high level filling, it returns true and we
+ // skip all meta actions until "XPATHFILL_SEQ_END"
+ if( Impl_writeFilling( aFilling ) )
+ {
+ bool bDone = sal_False;
+
+ while( !bDone && ( ++i < nCount ) )
+ {
+ pAction = rMtf.GetAction( i );
+
+ if( ( pAction->GetType() == META_COMMENT_ACTION ) &&
+ ( ( (const MetaCommentAction*) pAction )->GetComment().CompareIgnoreCaseToAscii( "XPATHFILL_SEQ_END" ) == COMPARE_EQUAL ) )
+ {
+ bDone = sal_True;
+ }
+ }
+ }
+ }
+ else if( pA->GetComment().CompareIgnoreCaseToAscii( "XPATHSTROKE_SEQ_BEGIN" ) == COMPARE_EQUAL &&
+ pData )
+ {
+
+ // this comment encapsulates all high level information for a filling that caused
+ // the meta actions between the "XPATHFILL_SEQ_BEGIN" and "XPATHFILL_SEQ_END" comment.
+
+ SvtGraphicStroke aStroke;
+ SvMemoryStream aMemStm( (void*)pData, pA->GetDataSize(), STREAM_READ );
+
+ // read the fill info
+ aMemStm >> aStroke;
+
+ // if impl_writeStroke can handle this high level stroke, it returns true and we
+ // skip all meta actions until "XPATHSTROKE_SEQ_END"
+ if( Impl_writeStroke( aStroke ) )
+ {
+ bool bDone = sal_False;
+
+ while( !bDone && ( ++i < nCount ) )
+ {
+ pAction = rMtf.GetAction( i );
+
+ if( ( pAction->GetType() == META_COMMENT_ACTION ) &&
+ ( ( (const MetaCommentAction*) pAction )->GetComment().CompareIgnoreCaseToAscii( "XPATHSTROKE_SEQ_END" ) == COMPARE_EQUAL ) )
+ {
+ bDone = sal_True;
+ }
+ }
+ }
+ }
+#if 0
+ else if( pA->GetComment().CompareIgnoreCaseToAscii( "FIELD_SEQ_BEGIN;PageField" ) == COMPARE_EQUAL )
+ {
+ bool bDone = sal_False;
+
+ while( !bDone && ( ++i < nCount ) )
+ {
+ pAction = rMtf.GetAction( i );
+
+ if( pAction->GetType() == META_TEXTARRAY_ACTION )
+ {
+ const MetaTextArrayAction* pA = (const MetaTextArrayAction*) pAction;
+ Rectangle aRect( pA->GetPoint(), Size( 100, 100 ) );
+ Impl_writePageField( aRect );
+ }
+
+ if( ( pAction->GetType() == META_COMMENT_ACTION ) &&
+ ( ( (const MetaCommentAction*) pAction )->GetComment().CompareIgnoreCaseToAscii( "FIELD_SEQ_END" ) == COMPARE_EQUAL ) )
+ {
+ bDone = sal_True;
+ }
+ }
+ }
+#endif
+ }
+ break;
+
+ case( META_BMPSCALE_ACTION ):
+ {
+ const MetaBmpScaleAction* pA = (const MetaBmpScaleAction*) pAction;
+
+ Impl_writeImage( pA->GetBitmap(),
+ pA->GetPoint(), pA->GetSize(),
+ Point(), pA->GetBitmap().GetSizePixel(), clipRect, 1 == bMap );
+ }
+ break;
+
+ case( META_BMP_ACTION ):
+ {
+ const MetaBmpAction* pA = (const MetaBmpAction*) pAction;
+ Impl_writeImage( pA->GetBitmap(),
+ pA->GetPoint(), mpVDev->PixelToLogic( pA->GetBitmap().GetSizePixel()),
+ Point(), pA->GetBitmap().GetSizePixel(), clipRect, 1 ==bMap );
+ }
+ break;
+
+ case( META_BMPSCALEPART_ACTION ):
+ {
+ const MetaBmpScalePartAction* pA = (const MetaBmpScalePartAction*) pAction;
+ Impl_writeImage( pA->GetBitmap(),
+ pA->GetDestPoint(), pA->GetDestSize(),
+ pA->GetSrcPoint(), pA->GetSrcSize(), clipRect, 1 == bMap );
+ }
+ break;
+
+ case( META_BMPEX_ACTION ):
+ {
+ const MetaBmpExAction* pA = (const MetaBmpExAction*) pAction;
+ Impl_writeImage( pA->GetBitmapEx(),
+ pA->GetPoint(), mpVDev->PixelToLogic( pA->GetBitmapEx().GetSizePixel() ),
+ Point(), pA->GetBitmapEx().GetSizePixel(), clipRect, 1 == bMap );
+ }
+ break;
+
+ case( META_BMPEXSCALE_ACTION ):
+ {
+ const MetaBmpExScaleAction* pA = (const MetaBmpExScaleAction*) pAction;
+ Impl_writeImage( pA->GetBitmapEx(),
+ pA->GetPoint(), pA->GetSize(),
+ Point(), pA->GetBitmapEx().GetSizePixel(), clipRect, 1 == bMap );
+ }
+ break;
+
+ case( META_BMPEXSCALEPART_ACTION ):
+ {
+ const MetaBmpExScalePartAction* pA = (const MetaBmpExScalePartAction*) pAction;
+ Impl_writeImage( pA->GetBitmapEx(),
+ pA->GetDestPoint(), pA->GetDestSize(),
+ pA->GetSrcPoint(), pA->GetSrcSize(), clipRect, 1 == bMap );
+ }
+ break;
+
+ case( META_TEXT_ACTION ):
+ {
+ const MetaTextAction* pA = (const MetaTextAction*) pAction;
+ Impl_writeText( pA->GetPoint(), String( pA->GetText(), pA->GetIndex(), pA->GetLen() ), NULL, 0);
+ }
+ break;
+
+ case( META_TEXTRECT_ACTION ):
+ {
+ const MetaTextRectAction* pA = (const MetaTextRectAction*) pAction;
+ Impl_writeText( pA->GetRect().TopLeft(), pA->GetText(), NULL, 0 );
+ }
+ break;
+
+ case( META_TEXTARRAY_ACTION ):
+ {
+ const MetaTextArrayAction* pA = (const MetaTextArrayAction*) pAction;
+ Impl_writeText( pA->GetPoint(), String( pA->GetText(), pA->GetIndex(), pA->GetLen() ), pA->GetDXArray(), 0 );
+ }
+ break;
+
+ case( META_STRETCHTEXT_ACTION ):
+ {
+ const MetaStretchTextAction* pA = (const MetaStretchTextAction*) pAction;
+ Impl_writeText( pA->GetPoint(), String( pA->GetText(), pA->GetIndex(), pA->GetLen() ), NULL, pA->GetWidth() );
+ }
+ break;
+
+ case( META_ISECTRECTCLIPREGION_ACTION ):
+ {
+ const MetaISectRectClipRegionAction* pA = (const MetaISectRectClipRegionAction*) pAction;
+ clipRect = pA->GetRect();
+ }
+ case( META_CLIPREGION_ACTION ):
+ case( META_ISECTREGIONCLIPREGION_ACTION ):
+ case( META_MOVECLIPREGION_ACTION ):
+ {
+ ( (MetaAction*) pAction )->Execute( mpVDev );
+// mbClipAttrChanged = sal_True;
+ }
+ break;
+
+ case( META_MAPMODE_ACTION ):
+ {
+// const MetaMapModeAction *pA = (const MetaMapModeAction*) pAction;
+// MapMode mm = pA->GetMapMode();
+// MapUnit mu = mm.GetMapUnit();
+//
+// Point pt = mm.GetOrigin();
+// Fraction fx = mm.GetScaleX();
+// Fraction fy = mm.GetScaleY();
+
+ bMap++;
+ }
+ case( META_REFPOINT_ACTION ):
+ case( META_LINECOLOR_ACTION ):
+ case( META_FILLCOLOR_ACTION ):
+ case( META_TEXTLINECOLOR_ACTION ):
+ case( META_TEXTFILLCOLOR_ACTION ):
+ case( META_TEXTCOLOR_ACTION ):
+ case( META_TEXTALIGN_ACTION ):
+ case( META_FONT_ACTION ):
+ case( META_PUSH_ACTION ):
+ case( META_POP_ACTION ):
+ case( META_LAYOUTMODE_ACTION ):
+ {
+ ( (MetaAction*) pAction )->Execute( mpVDev );
+ }
+ break;
+
+ case( META_RASTEROP_ACTION ):
+ case( META_MASK_ACTION ):
+ case( META_MASKSCALE_ACTION ):
+ case( META_MASKSCALEPART_ACTION ):
+ case( META_WALLPAPER_ACTION ):
+ case( META_TEXTLINE_ACTION ):
+ {
+ // !!! >>> we don't want to support these actions
+ }
+ break;
+
+ default:
+ //DBG_ERROR( "FlashActionWriter::ImplWriteActions: unsupported MetaAction #" );
+ break;
+ }
+ }
+}
+
+
+/////////////////////////////////////////////////////////////////////////
+
+
+void Writer::Impl_addStraightLine( BitStream& rBits, Point& rLastPoint,
+ const double P2x, const double P2y )
+{
+ Point aPoint( FRound(P2x), FRound(P2y) );
+
+ Impl_addStraightEdgeRecord( rBits, _Int16(aPoint.X() - rLastPoint.X()),_Int16(aPoint.Y() - rLastPoint.Y()));
+ rLastPoint = aPoint;
+
+}
+
+// -----------------------------------------------------------------------------
+
+void Writer::Impl_addQuadBezier( BitStream& rBits, Point& rLastPoint,
+ const double P2x, const double P2y,
+ const double P3x, const double P3y )
+{
+
+ Point aControlPoint( FRound(P2x), FRound(P2y) );
+ Point aAnchorPoint( FRound(P3x), FRound(P3y) );
+
+ Impl_addCurvedEdgeRecord( rBits,
+ _Int16(aControlPoint.X() - rLastPoint.X()),_Int16(aControlPoint.Y() - rLastPoint.Y()),
+ _Int16(aAnchorPoint.X() - aControlPoint.X()),_Int16(aAnchorPoint.Y() - aControlPoint.Y()) );
+ rLastPoint = aAnchorPoint;
+}
+
+// -----------------------------------------------------------------------------
+
+/* Approximate given cubic bezier curve by quadratic bezier segments */
+void Writer::Impl_quadBezierApprox( BitStream& rBits,
+ Point& rLastPoint,
+ const double d2,
+ const double P1x, const double P1y,
+ const double P2x, const double P2y,
+ const double P3x, const double P3y,
+ const double P4x, const double P4y )
+{
+ // Check for degenerate case, where the given cubic bezier curve
+ // is already quadratic: P4 == 3P3 - 3P2 + P1
+ if( P4x == 3.0*P3x - 3.0*P2x + P1x &&
+ P4y == 3.0*P3y - 3.0*P2y + P1y )
+ {
+ Impl_addQuadBezier( rBits, rLastPoint,
+ 3.0/2.0*P2x - 1.0/2.0*P1x, 3.0/2.0*P2y - 1.0/2.0*P1y,
+ P4x, P4y);
+ }
+ else
+ {
+ // Create quadratic segment for given cubic:
+ // Start and end point must coincide, determine quadratic control
+ // point in such a way that it lies on the intersection of the
+ // tangents at start and end point, resp. Thus, both cubic and
+ // quadratic curve segments will match in 0th and 1st derivative
+ // at the start and end points
+
+ // Intersection of P2P1 and P4P3
+ // (P2y-P4y)(P3x-P4x)-(P2x-P4x)(P3y-P4y)
+ // lambda = -------------------------------------
+ // (P1x-P2x)(P3y-P4y)-(P1y-P2y)(P3x-P4x)
+ //
+ // Intersection point IP is now
+ // IP = P2 + lambda(P1-P2)
+ //
+ const double nominator( (P2y-P4y)*(P3x-P4x) - (P2x-P4x)*(P3y-P4y) );
+ const double denominator( (P1x-P2x)*(P3y-P4y) - (P1y-P2y)*(P3x-P4x) );
+ const double lambda( nominator / denominator );
+
+ const double IPx( P2x + lambda*( P1x - P2x) );
+ const double IPy( P2y + lambda*( P1y - P2y) );
+
+ // Introduce some alias names: quadratic start point is P1, end
+ // point is P4, control point is IP
+ const double QP1x( P1x );
+ const double QP1y( P1y );
+ const double QP2x( IPx );
+ const double QP2y( IPy );
+ const double QP3x( P4x );
+ const double QP3y( P4y );
+
+ // Adapted bezier flatness test (lecture notes from R. Schaback,
+ // Mathematics of Computer-Aided Design, Uni Goettingen, 2000)
+ //
+ // ||C(t) - Q(t)|| <= max ||c_j - q_j||
+ // 0<=j<=n
+ //
+ // In this case, we don't need the distance from the cubic bezier
+ // to a straight line, but to a quadratic bezier. The c_j's are
+ // the cubic bezier's bernstein coefficients, the q_j's the
+ // quadratic bezier's. We have the c_j's given, the q_j's can be
+ // calculated from QPi like this (sorry, mixed index notation, we
+ // use [1,n], formulas use [0,n-1]):
+ //
+ // q_0 = QP1 = P1
+ // q_1 = 1/3 QP1 + 2/3 QP2
+ // q_2 = 2/3 QP2 + 1/3 QP3
+ // q_3 = QP3 = P4
+ //
+ // We can drop case 0 and 3, since there the curves coincide
+ // (distance is zero)
+
+ // calculate argument of max for j=1 and j=2
+ const double fJ1x( P2x - 1.0/3.0*QP1x - 2.0/3.0*QP2x );
+ const double fJ1y( P2y - 1.0/3.0*QP1y - 2.0/3.0*QP2y );
+ const double fJ2x( P3x - 2.0/3.0*QP2x - 1.0/3.0*QP3x );
+ const double fJ2y( P3y - 2.0/3.0*QP2y - 1.0/3.0*QP3y );
+
+ // stop if distance from cubic curve is guaranteed to be bounded by d
+ // Should denominator be 0: then P1P2 and P3P4 are parallel (P1P2^T R[90,P3P4] = 0.0),
+ // meaning that either we have a straight line or an inflexion point (see else block below)
+ if( 0.0 != denominator &&
+ ::std::max( fJ1x*fJ1x + fJ1y*fJ1y,
+ fJ2x*fJ2x + fJ2y*fJ2y) < d2 )
+ {
+ // requested resolution reached.
+ // Add end points to output file.
+ // order is preserved, since this is so to say depth first traversal.
+ Impl_addQuadBezier( rBits, rLastPoint,
+ QP2x, QP2y,
+ QP3x, QP3y);
+ }
+ else
+ {
+ // Maybe subdivide further
+
+ // This is for robustness reasons, since the line intersection
+ // method below gets instable if the curve gets closer to a
+ // straight line. If the given cubic bezier does not deviate by
+ // more than d/4 from a straight line, either:
+ // - take the line (that's what we do here)
+ // - express the line by a quadratic bezier
+
+ // Perform bezier flatness test (lecture notes from R. Schaback,
+ // Mathematics of Computer-Aided Design, Uni Goettingen, 2000)
+ //
+ // ||P(t) - L(t)|| <= max ||b_j - b_0 - j/n(b_n - b_0)||
+ // 0<=j<=n
+ //
+ // What is calculated here is an upper bound to the distance from
+ // a line through b_0 and b_3 (P1 and P4 in our notation) and the
+ // curve. We can drop 0 and n from the running indices, since the
+ // argument of max becomes zero for those cases.
+ const double fJ1x2( P2x - P1x - 1.0/3.0*(P4x - P1x) );
+ const double fJ1y2( P2y - P1y - 1.0/3.0*(P4y - P1y) );
+ const double fJ2x2( P3x - P1x - 2.0/3.0*(P4x - P1x) );
+ const double fJ2y2( P3y - P1y - 2.0/3.0*(P4y - P1y) );
+
+ // stop if distance from line is guaranteed to be bounded by d/4
+ if( ::std::max( fJ1x2*fJ1x2 + fJ1y2*fJ1y2,
+ fJ2x2*fJ2x2 + fJ2y2*fJ2y2) < d2/16.0 )
+ {
+ // do not subdivide further, add straight line instead
+ Impl_addStraightLine( rBits, rLastPoint, P4x, P4y);
+ }
+ else
+ {
+ // deCasteljau bezier arc, split at t=0.5
+ // Foley/vanDam, p. 508
+ const double L1x( P1x ), L1y( P1y );
+ const double L2x( (P1x + P2x)*0.5 ), L2y( (P1y + P2y)*0.5 );
+ const double Hx ( (P2x + P3x)*0.5 ), Hy ( (P2y + P3y)*0.5 );
+ const double L3x( (L2x + Hx)*0.5 ), L3y( (L2y + Hy)*0.5 );
+ const double R4x( P4x ), R4y( P4y );
+ const double R3x( (P3x + P4x)*0.5 ), R3y( (P3y + P4y)*0.5 );
+ const double R2x( (Hx + R3x)*0.5 ), R2y( (Hy + R3y)*0.5 );
+ const double R1x( (L3x + R2x)*0.5 ), R1y( (L3y + R2y)*0.5 );
+ const double L4x( R1x ), L4y( R1y );
+
+ // subdivide further
+ Impl_quadBezierApprox(rBits, rLastPoint, d2, L1x, L1y, L2x, L2y, L3x, L3y, L4x, L4y);
+ Impl_quadBezierApprox(rBits, rLastPoint, d2, R1x, R1y, R2x, R2y, R3x, R3y, R4x, R4y);
+ }
+ }
+ }
+}
+
+Reference < XBreakIterator > Writer::Impl_GetBreakIterator()
+{
+ if ( !mxBreakIterator.is() )
+ {
+ Reference< XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory() );
+ mxBreakIterator.set( xMSF->createInstance( OUString::createFromAscii( "com.sun.star.i18n.BreakIterator" ) ), UNO_QUERY );
+ }
+ return mxBreakIterator;
+}
diff --git a/filter/source/flash/swfwriter2.cxx b/filter/source/flash/swfwriter2.cxx
new file mode 100644
index 000000000000..a2638b13e629
--- /dev/null
+++ b/filter/source/flash/swfwriter2.cxx
@@ -0,0 +1,692 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+#include "swfwriter.hxx"
+#include <vcl/virdev.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
+
+#include <math.h>
+
+using namespace ::swf;
+using namespace ::std;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::io;
+using ::rtl::OUString;
+using ::rtl::OString;
+
+// -----------------------------------------------------------------------------
+
+sal_uInt16 getMaxBitsUnsigned( sal_uInt32 nValue )
+{
+ sal_uInt16 nBits = 0;
+
+ while( nValue )
+ {
+ nBits++;
+ nValue >>= 1;
+ }
+
+ return nBits;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_uInt16 getMaxBitsSigned( sal_Int32 nValue )
+{
+ if( nValue < 0 )
+ nValue *= -1;
+
+ return getMaxBitsUnsigned( static_cast< sal_uInt32 >(nValue) ) + 1;
+}
+
+// -----------------------------------------------------------------------------
+
+BitStream::BitStream()
+{
+ mnBitPos = 8;
+ mnCurrentByte = 0;
+}
+
+// -----------------------------------------------------------------------------
+
+void BitStream::writeUB( sal_uInt32 nValue, sal_uInt16 nBits )
+{
+ while( nBits != 0 )
+ {
+ mnCurrentByte |= nValue << (32 - nBits) >> (32 - mnBitPos);
+
+ if ( nBits > mnBitPos )
+ {
+ nBits = nBits - mnBitPos;
+ mnBitPos = 0;
+ }
+ else
+ {
+ mnBitPos = sal::static_int_cast<sal_uInt8>( mnBitPos - nBits );
+ nBits = 0;
+ }
+
+ if( 0 == mnBitPos )
+ pad();
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void BitStream::writeSB( sal_Int32 nValue, sal_uInt16 nBits )
+{
+ writeUB( static_cast< sal_uInt32 >(nValue), nBits );
+}
+
+// -----------------------------------------------------------------------------
+
+void BitStream::writeFB( sal_uInt32 nValue, sal_uInt16 nBits )
+{
+ writeUB( nValue, nBits );
+}
+
+// -----------------------------------------------------------------------------
+
+void BitStream::pad()
+{
+ if( 8 != mnBitPos )
+ {
+ maData.push_back( mnCurrentByte );
+ mnCurrentByte = 0;
+ mnBitPos = 8;
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void BitStream::writeTo( SvStream& out )
+{
+ pad();
+
+ vector< sal_uInt8 >::iterator aIter( maData.begin() );
+ const vector< sal_uInt8>::iterator aEnd( maData.end() );
+ while(aIter != aEnd)
+ {
+ out << (*aIter++);
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+sal_uInt32 BitStream::getOffset() const
+{
+ return maData.size();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
+Tag::Tag( sal_uInt8 nTagId )
+{
+ mnTagId = nTagId;
+}
+
+// -----------------------------------------------------------------------------
+
+void Tag::write( SvStream &out )
+{
+ Seek( STREAM_SEEK_TO_END );
+ sal_uInt32 nSz = Tell();
+ Seek( STREAM_SEEK_TO_BEGIN );
+
+ if( mnTagId != 0xff )
+ {
+ bool bLarge = nSz > 62;
+
+ sal_uInt16 nCode = ( mnTagId << 6 ) | ( bLarge ? 0x3f : _uInt16(nSz) );
+
+ out << (sal_uInt8)nCode;
+ out << (sal_uInt8)(nCode >> 8);
+
+ if( bLarge )
+ {
+ sal_uInt32 nTmp = nSz;
+
+ out << (sal_uInt8)nTmp;
+ nTmp >>= 8;
+ out << (sal_uInt8)nTmp;
+ nTmp >>= 8;
+ out << (sal_uInt8)nTmp;
+ nTmp >>= 8;
+ out << (sal_uInt8)nTmp;
+ }
+ }
+
+ out.Write( GetData(), nSz );
+}
+#if 0
+// -----------------------------------------------------------------------------
+
+void Tag::addI32( sal_Int32 nValue )
+{
+ addUI32( static_cast<sal_uInt32>( nValue ) );
+}
+#endif
+// -----------------------------------------------------------------------------
+
+void Tag::addUI32( sal_uInt32 nValue )
+{
+ *this << nValue;
+}
+#if 0
+// -----------------------------------------------------------------------------
+
+void Tag::addI16( sal_Int16 nValue )
+{
+ addUI16( static_cast<sal_uInt16>( nValue ) );
+}
+#endif
+// -----------------------------------------------------------------------------
+
+void Tag::addUI16( sal_uInt16 nValue )
+{
+ *this << (sal_uInt8)nValue;
+ *this << (sal_uInt8)(nValue >> 8);
+}
+
+// -----------------------------------------------------------------------------
+
+void Tag::addUI8( sal_uInt8 nValue )
+{
+ *this << (sal_uInt8)nValue;
+}
+
+// -----------------------------------------------------------------------------
+
+void Tag::addBits( BitStream& rIn )
+{
+ rIn.writeTo( *this );
+}
+
+// -----------------------------------------------------------------------------
+
+void Tag::addRGBA( const Color& rColor )
+{
+ addUI8( rColor.GetRed() );
+ addUI8( rColor.GetGreen() );
+ addUI8( rColor.GetBlue() );
+ addUI8( 0xff - rColor.GetTransparency() );
+}
+
+// -----------------------------------------------------------------------------
+
+void Tag::addRGB( const Color& rColor )
+{
+ addUI8( rColor.GetRed() );
+ addUI8( rColor.GetGreen() );
+ addUI8( rColor.GetBlue() );
+}
+
+// -----------------------------------------------------------------------------
+
+void Tag::addRect( const Rectangle& rRect )
+{
+ writeRect( *this, rRect );
+}
+
+// -----------------------------------------------------------------------------
+
+void Tag::writeRect( SvStream& rOut, const Rectangle& rRect )
+{
+ BitStream aBits;
+
+ sal_Int32 minX, minY, maxX, maxY;
+
+ if( rRect.nLeft < rRect.nRight )
+ {
+ minX = rRect.nLeft; maxX = rRect.nRight;
+ }
+ else
+ {
+ maxX = rRect.nLeft; minX = rRect.nRight;
+ }
+
+
+ if( rRect.nTop < rRect.nBottom )
+ {
+ minY = rRect.nTop; maxY = rRect.nBottom;
+ }
+ else
+ {
+ maxY = rRect.nTop; minY = rRect.nBottom;
+ }
+
+ // AS: Figure out the maximum nubmer of bits required to represent any of the
+ // rectangle coordinates. Since minX or minY could be negative, they could
+ // actually require more bits than maxX or maxY.
+ // AS: Christian, can they be negative, or is that a wasted check?
+ // CL: I think so, f.e. for shapes that have the top and/or left edge outside
+ // the page origin
+ sal_uInt8 nBits1 = sal::static_int_cast<sal_uInt8>( max( getMaxBitsSigned( minX ), getMaxBitsSigned( minY ) ) );
+ sal_uInt8 nBits2 = sal::static_int_cast<sal_uInt8>( max( getMaxBitsSigned( maxX ), getMaxBitsSigned( maxY ) ) );
+ sal_uInt8 nBitsMax = max( nBits1, nBits2 );
+
+ aBits.writeUB( nBitsMax, 5 );
+ aBits.writeSB( minX, nBitsMax );
+ aBits.writeSB( maxX, nBitsMax );
+ aBits.writeSB( minY, nBitsMax );
+ aBits.writeSB( maxY, nBitsMax );
+
+ aBits.writeTo( rOut );
+}
+
+// -----------------------------------------------------------------------------
+
+void Tag::addMatrix( const ::basegfx::B2DHomMatrix& rMatrix ) // #i73264#
+{
+ writeMatrix( *this, rMatrix );
+}
+
+// -----------------------------------------------------------------------------
+
+void Tag::writeMatrix( SvStream& rOut, const ::basegfx::B2DHomMatrix& rMatrix ) // #i73264#
+{
+
+ BitStream aBits;
+
+ const sal_uInt8 bHasScale = rMatrix.get(0, 0) != 1.0 || rMatrix.get(1, 1) != 1.0;
+
+ aBits.writeUB( bHasScale, 1 );
+
+ if( bHasScale )
+ {
+ sal_uInt8 nScaleBits = 31;
+
+ aBits.writeUB( nScaleBits, 5 );
+ aBits.writeFB( getFixed( rMatrix.get(0, 0) ), nScaleBits ); // Scale X
+ aBits.writeFB( getFixed( rMatrix.get(1, 1) ), nScaleBits ); // Scale Y
+ }
+
+ const sal_uInt8 bHasRotate = rMatrix.get(0, 1) != 0.0 || rMatrix.get(1, 0) != 0.0;
+
+ aBits.writeUB( bHasRotate, 1 );
+
+ if( bHasRotate )
+ {
+ sal_uInt8 nRotateBits = 31;
+
+ aBits.writeUB( nRotateBits, 5 );
+ aBits.writeFB( getFixed( rMatrix.get(0, 1) ), nRotateBits ); // RotateSkew0
+ aBits.writeFB( getFixed( rMatrix.get(1, 0) ), nRotateBits ); // RotateSkew1
+ }
+
+ sal_uInt8 nTranslateBits = 16;
+
+ aBits.writeUB( nTranslateBits, 5 );
+ aBits.writeSB( (sal_Int16)rMatrix.get(0, 2), nTranslateBits ); // Translate X
+ aBits.writeSB( (sal_Int16)rMatrix.get(1, 2), nTranslateBits ); // Translate Y
+
+ aBits.writeTo( rOut );
+}
+
+// -----------------------------------------------------------------------------
+
+void Tag::addString( const char* pString )
+{
+ if( pString )
+ {
+ while( *pString )
+ addUI8( *pString++ );
+ }
+
+ addUI8( 0 );
+}
+
+// -----------------------------------------------------------------------------
+
+void Tag::addStream( SvStream& rIn )
+{
+ *this << rIn;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
+Sprite::Sprite( sal_uInt16 nId )
+: mnId( nId ), mnFrames(0)
+{
+}
+
+// -----------------------------------------------------------------------------
+
+Sprite::~Sprite()
+{
+ for(vector< Tag* >::iterator i = maTags.begin(); i != maTags.end(); i++)
+ delete *i;
+}
+
+// -----------------------------------------------------------------------------
+
+void Sprite::write( SvStream& out )
+{
+ SvMemoryStream aTmp;
+ for(vector< Tag* >::iterator i = maTags.begin(); i != maTags.end(); i++)
+ (*i)->write( aTmp );
+
+ if( !mnFrames )
+ mnFrames = 1;
+
+ aTmp.Seek(0);
+
+ Tag aTag( TAG_DEFINESPRITE );
+ aTag.addUI16( mnId );
+ aTag.addUI16( _uInt16( mnFrames ) );
+ aTag.addStream( aTmp );
+ aTag.write( out );
+}
+
+// -----------------------------------------------------------------------------
+
+void Sprite::addTag( Tag* pNewTag )
+{
+ if( pNewTag )
+ {
+ if( pNewTag->getTagId() == TAG_SHOWFRAME )
+ mnFrames++;
+
+ maTags.push_back( pNewTag );
+ }
+}
+
+/////////////////////////////////////////////////////////////////////////////////
+
+sal_uInt32 swf::getFixed( double fValue )
+{
+ sal_Int16 nUpper = (sal_Int16)floor(fValue);
+ sal_uInt16 nLower = (sal_uInt16)((fValue - floor(fValue))*0x10000);
+
+ sal_uInt32 temp = ((sal_Int32)nUpper)<<16;
+ temp |= nLower;
+
+ return temp;
+}
+
+/////////////////////////////////////////////////////////////////////////////////
+
+/** constructs a new flash font for the given VCL Font */
+FlashFont::FlashFont( const Font& rFont, sal_uInt16 nId )
+: maFont( rFont ), mnNextIndex(0), mnId( nId )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+FlashFont::~FlashFont()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+/** gets the glyph id for the given character. The glyphs are created on demand */
+sal_uInt16 FlashFont::getGlyph( sal_uInt16 nChar, VirtualDevice* pVDev )
+{
+ // see if we already created a glyph for this character
+ std::map<sal_uInt16, sal_uInt16, ltuint16>::iterator aIter( maGlyphIndex.find(nChar) );
+ if( aIter != maGlyphIndex.end() )
+ {
+ return aIter->second;
+ }
+
+ // if not, we create one now
+
+ maGlyphIndex[nChar] = mnNextIndex;
+
+ Font aOldFont( pVDev->GetFont() );
+ Font aNewFont( aOldFont );
+ aNewFont.SetAlign( ALIGN_BASELINE );
+ pVDev->SetFont( aNewFont );
+ aOldFont.SetOrientation(0);
+
+ // let the virtual device convert the character to polygons
+ PolyPolygon aPolyPoly;
+ pVDev->GetTextOutline( aPolyPoly, nChar );
+
+ maGlyphOffsets.push_back( _uInt16( maGlyphData.getOffset() ) );
+
+ // Number of fill and line index bits set to 1
+ maGlyphData.writeUB( 0x11, 8 );
+
+ const sal_uInt16 nCount = aPolyPoly.Count();
+ sal_uInt16 i,n;
+ for( i = 0; i < nCount; i++ )
+ {
+ Polygon& rPoly = aPolyPoly[ i ];
+
+ const USHORT nSize = rPoly.GetSize();
+ if( nSize )
+ {
+ // convert polygon to flash EM_SQUARE (1024x1024)
+ for( n = 0; n < nSize; n++ )
+ {
+ Point aPoint( rPoly[n] );
+ aPoint.X() = static_cast<long>((double(aPoint.X()) * 1024.0 ) / double(aOldFont.GetHeight()));
+ aPoint.Y() = static_cast<long>((double(aPoint.Y()) * 1024.0 ) / double(aOldFont.GetHeight()));
+ rPoly[n] = aPoint;
+ }
+ Writer::Impl_addPolygon( maGlyphData, rPoly, true );
+ }
+ }
+ Writer::Impl_addEndShapeRecord( maGlyphData );
+
+ maGlyphData.pad();
+
+ pVDev->SetFont( aOldFont );
+
+ return mnNextIndex++;
+}
+
+// -----------------------------------------------------------------------------
+
+void FlashFont::write( SvStream& out )
+{
+ Tag aTag( TAG_DEFINEFONT );
+
+ aTag.addUI16( mnId );
+
+ sal_uInt16 nGlyphs = _uInt16( maGlyphOffsets.size() );
+ sal_uInt16 nOffset = nGlyphs * sizeof( sal_uInt16 );
+
+ for(vector< sal_uInt16 >::iterator i = maGlyphOffsets.begin(); i != maGlyphOffsets.end(); i++)
+ aTag.addUI16( nOffset + (*i) );
+
+ aTag.addBits( maGlyphData );
+
+ aTag.write( out );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
+/** this c'tor creates a solid fill style */
+FillStyle::FillStyle( const Color& rSolidColor )
+: meType( solid ),
+ maColor( rSolidColor )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+/** this c'tor creates a tiled or clipped bitmap fill style */
+FillStyle::FillStyle( sal_uInt16 nBitmapId, bool bClipped, const ::basegfx::B2DHomMatrix& rMatrix ) // #i73264#
+: meType( bClipped ? clipped_bitmap : tiled_bitmap ),
+ maMatrix( rMatrix ),
+ mnBitmapId( nBitmapId )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+FillStyle::FillStyleType Impl_getFillStyleType( const Gradient& rGradient )
+{
+ switch( rGradient.GetStyle() )
+ {
+ case GradientStyle_ELLIPTICAL:
+ case GradientStyle_RADIAL:
+ return FillStyle::radial_gradient;
+// case GradientStyle_AXIAL:
+// case GradientStyle_SQUARE:
+// case GradientStyle_RECT:
+// case GradientStyle_LINEAR:
+ default:
+ return FillStyle::linear_gradient;
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+/** this c'tor creates a linear or radial gradient fill style */
+FillStyle::FillStyle( const Rectangle& rBoundRect, const Gradient& rGradient )
+: meType( Impl_getFillStyleType( rGradient ) ),
+ maGradient( rGradient ),
+ maBoundRect( rBoundRect )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+void FillStyle::addTo( Tag* pTag ) const
+{
+ pTag->addUI8( sal::static_int_cast<sal_uInt8>( meType ) );
+ switch( meType )
+ {
+ case solid:
+ pTag->addRGBA( maColor );
+ break;
+ case linear_gradient:
+ case radial_gradient:
+ Impl_addGradient( pTag );
+ break;
+ case tiled_bitmap:
+ case clipped_bitmap:
+ pTag->addUI16( mnBitmapId );
+ pTag->addMatrix( maMatrix );
+ break;
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+struct GradRecord
+{
+ sal_uInt8 mnRatio;
+ Color maColor;
+
+ GradRecord( sal_uInt8 nRatio, const Color& rColor ) : mnRatio( nRatio ), maColor( rColor ) {}
+};
+
+// TODO: better emulation of our gradients
+void FillStyle::Impl_addGradient( Tag* pTag ) const
+{
+ vector< struct GradRecord > aGradientRecords;
+ basegfx::B2DHomMatrix m(basegfx::tools::createRotateB2DHomMatrix((maGradient.GetAngle() - 900) * F_PI1800));
+
+ switch( maGradient.GetStyle() )
+ {
+ case GradientStyle_ELLIPTICAL:
+ case GradientStyle_RADIAL:
+ {
+ aGradientRecords.push_back( GradRecord( 0x00, maGradient.GetEndColor() ) );
+ aGradientRecords.push_back( GradRecord( 0xff, maGradient.GetStartColor() ) );
+
+ double tx = ( maGradient.GetOfsX() * 32768.0 ) / 100.0;
+ double ty = ( maGradient.GetOfsY() * 32768.0 ) / 100.0;
+ double scalex = (double)maBoundRect.GetWidth() / 32768.0;
+ double scaley = (double)maBoundRect.GetHeight() / 32768.0;
+
+ m.scale( 1.2, 1.2 );
+
+ if( scalex > scaley )
+ {
+ double scale_move = scaley / scalex;
+
+ m.translate( tx, scale_move * ty );
+
+
+ m.scale( scalex, scalex );
+ }
+ else
+ {
+ double scale_move = scalex / scaley;
+
+ m.translate( scale_move * tx, ty );
+
+
+ m.scale( scaley, scaley );
+ }
+
+ }
+ break;
+ case GradientStyle_AXIAL:
+ {
+ aGradientRecords.push_back( GradRecord( 0x00, maGradient.GetEndColor() ) );
+ aGradientRecords.push_back( GradRecord( 0x80, maGradient.GetStartColor() ) );
+ aGradientRecords.push_back( GradRecord( 0xff, maGradient.GetEndColor() ) );
+ double tx = ( 32768.0 / 2.0 );
+ double ty = ( 32768.0 / 2.0 );
+ double scalex = (double)maBoundRect.GetWidth() / 32768.0;
+ double scaley = (double)maBoundRect.GetHeight() / 32768.0;
+
+ m.translate( tx, ty );
+ m.scale( scalex, scaley );
+ }
+ break;
+ case GradientStyle_SQUARE:
+ case GradientStyle_RECT:
+ case GradientStyle_LINEAR:
+ {
+ aGradientRecords.push_back( GradRecord( 0x00, maGradient.GetStartColor() ) );
+ aGradientRecords.push_back( GradRecord( 0xff, maGradient.GetEndColor() ) );
+ double scalex = (double)maBoundRect.GetWidth() / 32768.0;
+ double scaley = (double)maBoundRect.GetHeight() / 32768.0;
+
+ m.scale( scalex, scaley );
+
+ m.translate( maBoundRect.GetWidth() / 2.0, maBoundRect.GetHeight() / 2.0 );
+ }
+ break;
+ case GradientStyle_FORCE_EQUAL_SIZE: break;
+ }
+
+ m.translate( maBoundRect.nLeft, maBoundRect.nTop );
+
+ pTag->addMatrix( m );
+
+ DBG_ASSERT( aGradientRecords.size() < 8, "Illegal FlashGradient!" );
+
+ pTag->addUI8( static_cast<sal_uInt8>( aGradientRecords.size() ) );
+
+ for(std::vector< GradRecord >::iterator i = aGradientRecords.begin(); i != aGradientRecords.end(); i++)
+ {
+ pTag->addUI8( (*i).mnRatio );
+ pTag->addRGBA( (*i).maColor );
+ }
+}
+
diff --git a/filter/source/graphicfilter/egif/dlgegif.cxx b/filter/source/graphicfilter/egif/dlgegif.cxx
new file mode 100644
index 000000000000..a9f1e60708b2
--- /dev/null
+++ b/filter/source/graphicfilter/egif/dlgegif.cxx
@@ -0,0 +1,108 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+#ifndef GCC
+#endif
+#include <tools/ref.hxx>
+#include <svtools/FilterConfigItem.hxx>
+#include <vcl/msgbox.hxx>
+#include "dlgegif.hxx"
+#include "dlgegif.hrc"
+#include "strings.hrc"
+
+/*************************************************************************
+|*
+|* Ctor
+|*
+\************************************************************************/
+
+DlgExportEGIF::DlgExportEGIF( FltCallDialogParameter& rPara ) :
+ ModalDialog ( rPara.pWindow, ResId( DLG_EXPORT_GIF, *rPara.pResMgr ) ),
+ rFltCallPara ( rPara ),
+ aCbxInterlaced ( this, ResId( CBX_INTERLACED, *rPara.pResMgr ) ),
+ aCbxTranslucent ( this, ResId( CBX_TRANSLUCENT, *rPara.pResMgr ) ),
+ aGrpMode ( this, ResId( GRP_MODE, *rPara.pResMgr ) ),
+ aGrpDraw ( this, ResId( GRP_DRAW, *rPara.pResMgr ) ),
+ aBtnOK ( this, ResId( BTN_OK, *rPara.pResMgr ) ),
+ aBtnCancel ( this, ResId( BTN_CANCEL, *rPara.pResMgr ) ),
+ aBtnHelp ( this, ResId( BTN_HELP, *rPara.pResMgr ) ),
+ pMgr ( rPara.pResMgr )
+{
+ FreeResource();
+
+ String aFilterConfigPath( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Filter/Graphic/Export/GIF" ) );
+ pConfigItem = new FilterConfigItem( aFilterConfigPath, &rPara.aFilterData );
+
+ String aInterlaceStr( ResId( KEY_INTER, *pMgr ) );
+ String aTranslucentStr( ResId( KEY_TRANS, *pMgr ) );
+ // Config-Parameter lesen
+ sal_Bool bInterlaced = pConfigItem->ReadInt32( aInterlaceStr, 1 ) != 0;
+ sal_Bool bTranslucent = pConfigItem->ReadInt32( aTranslucentStr, 1 ) != 0;
+
+ aCbxInterlaced.Check( bInterlaced );
+ aCbxTranslucent.Check( bTranslucent );
+
+ aBtnOK.SetClickHdl( LINK( this, DlgExportEGIF, OK ) );
+}
+
+DlgExportEGIF::~DlgExportEGIF()
+{
+ delete pConfigItem;
+}
+
+/*************************************************************************
+|*
+|* Speichert eingestellte Werte in ini-Datei
+|*
+\************************************************************************/
+
+IMPL_LINK( DlgExportEGIF, OK, void *, EMPTYARG )
+{
+
+ // Config-Parameter schreiben
+ String aInterlaceStr( ResId( KEY_INTER, *pMgr ) );
+ String aTranslucentStr( ResId( KEY_TRANS, *pMgr ) );
+
+ sal_Int32 nValue = 0;
+ if ( aCbxInterlaced.IsChecked() )
+ nValue++;
+ pConfigItem->WriteInt32( aInterlaceStr, nValue );
+
+ nValue = 0;
+ if ( aCbxTranslucent.IsChecked() )
+ nValue++;
+ pConfigItem->WriteInt32( aTranslucentStr, nValue );
+ rFltCallPara.aFilterData = pConfigItem->GetFilterData();
+ EndDialog( RET_OK );
+
+ return 0;
+}
+
+
+
diff --git a/filter/source/graphicfilter/egif/dlgegif.hrc b/filter/source/graphicfilter/egif/dlgegif.hrc
new file mode 100644
index 000000000000..a2f9f4feb488
--- /dev/null
+++ b/filter/source/graphicfilter/egif/dlgegif.hrc
@@ -0,0 +1,36 @@
+/*************************************************************************
+ *
+ * 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 "filter.hrc"
+
+#define BTN_OK 1
+#define BTN_CANCEL 1
+#define BTN_HELP 1
+#define FI_DESCR 1
+#define GRP_MODE 1
+#define GRP_DRAW 2
+#define CBX_INTERLACED 1
+#define CBX_TRANSLUCENT 2
diff --git a/filter/source/graphicfilter/egif/dlgegif.hxx b/filter/source/graphicfilter/egif/dlgegif.hxx
new file mode 100644
index 000000000000..0dbe48a065a3
--- /dev/null
+++ b/filter/source/graphicfilter/egif/dlgegif.hxx
@@ -0,0 +1,71 @@
+/*************************************************************************
+ *
+ * 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 _DLGEGIF_HXX_
+#define _DLGEGIF_HXX_
+
+#include <svtools/fltcall.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/button.hxx>
+#include <vcl/fixed.hxx>
+
+/*************************************************************************
+|*
+|* Dialog zum Einstellen von Filteroptionen
+|*
+\************************************************************************/
+
+class FilterConfigItem;
+class ResMgr;
+
+class DlgExportEGIF : public ModalDialog
+{
+private:
+
+ FltCallDialogParameter& rFltCallPara;
+
+ CheckBox aCbxInterlaced;
+ CheckBox aCbxTranslucent;
+ FixedLine aGrpMode;
+ FixedLine aGrpDraw;
+ OKButton aBtnOK;
+ CancelButton aBtnCancel;
+ HelpButton aBtnHelp;
+
+ FilterConfigItem* pConfigItem;
+ ResMgr* pMgr;
+
+ DECL_LINK( OK, void * );
+
+public:
+ DlgExportEGIF( FltCallDialogParameter& rPara );
+ ~DlgExportEGIF();
+};
+
+#endif // _DLGEGIF_HXX_
+
diff --git a/filter/source/graphicfilter/egif/dlgegif.src b/filter/source/graphicfilter/egif/dlgegif.src
new file mode 100644
index 000000000000..39f96bb7ac7a
--- /dev/null
+++ b/filter/source/graphicfilter/egif/dlgegif.src
@@ -0,0 +1,118 @@
+/*************************************************************************
+ *
+ * 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 "dlgegif.hrc"
+ModalDialog DLG_EXPORT_GIF
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 169 , 70 ) ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ Text [ en-US ] = "GIF Options" ;
+ OKButton BTN_OK
+ {
+ Pos = MAP_APPFONT ( 113 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( 113 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton BTN_HELP
+ {
+ Pos = MAP_APPFONT ( 113 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ FixedLine GRP_MODE
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 100 , 8 ) ;
+ Text [ en-US ] = "Mode" ;
+ };
+ CheckBox CBX_INTERLACED
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 86 , 12 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Interlaced" ;
+ };
+ FixedLine GRP_DRAW
+ {
+ Pos = MAP_APPFONT ( 6 , 32 ) ;
+ Size = MAP_APPFONT ( 100 , 8 ) ;
+ Text [ en-US ] = "Drawing objects" ;
+ };
+ CheckBox CBX_TRANSLUCENT
+ {
+ Pos = MAP_APPFONT ( 12 , 43 ) ;
+ Size = MAP_APPFONT ( 86 , 12 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Save ~transparency" ;
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/filter/source/graphicfilter/egif/egif.cxx b/filter/source/graphicfilter/egif/egif.cxx
new file mode 100644
index 000000000000..93f9f5ec0b15
--- /dev/null
+++ b/filter/source/graphicfilter/egif/egif.cxx
@@ -0,0 +1,629 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include <vcl/graph.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/window.hxx>
+#include <svl/solar.hrc>
+#include <svtools/fltcall.hxx>
+#include <svtools/FilterConfigItem.hxx>
+#include "giflzwc.hxx"
+#include "strings.hrc"
+#include "dlgegif.hrc"
+#include "dlgegif.hxx"
+
+// -------------
+// - GIFWriter -
+// -------------
+
+class GIFWriter
+{
+ Bitmap aAccBmp;
+ BitmapReadAccess* pAcc;
+ SvStream* pGIF;
+ ULONG nMinPercent;
+ ULONG nMaxPercent;
+ ULONG nLastPercent;
+ long nActX;
+ long nActY;
+ sal_Int32 nInterlaced;
+ BOOL bStatus;
+ BOOL bTransparent;
+
+ void MayCallback( ULONG nPercent );
+ void WriteSignature( BOOL bGIF89a );
+ void WriteGlobalHeader( const Size& rSize );
+ void WriteLoopExtension( const Animation& rAnimation );
+ void WriteLogSizeExtension( const Size& rSize100 );
+ void WriteImageExtension( long nTimer, Disposal eDisposal );
+ void WriteLocalHeader();
+ void WritePalette();
+ void WriteAccess();
+ void WriteTerminator();
+
+ BOOL CreateAccess( const BitmapEx& rBmpEx );
+ void DestroyAccess();
+
+ void WriteAnimation( const Animation& rAnimation );
+ void WriteBitmapEx( const BitmapEx& rBmpEx, const Point& rPoint, BOOL bExtended,
+ long nTimer = 0, Disposal eDisposal = DISPOSE_NOT );
+
+ com::sun::star::uno::Reference< com::sun::star::task::XStatusIndicator > xStatusIndicator;
+
+public:
+
+ GIFWriter() {}
+ ~GIFWriter() {}
+
+ BOOL WriteGIF( const Graphic& rGraphic, SvStream& rGIF,
+ FilterConfigItem* pConfigItem );
+};
+
+// ------------------------------------------------------------------------
+
+BOOL GIFWriter::WriteGIF( const Graphic& rGraphic, SvStream& rGIF,
+ FilterConfigItem* pFilterConfigItem )
+{
+ if ( pFilterConfigItem )
+ {
+ xStatusIndicator = pFilterConfigItem->GetStatusIndicator();
+ if ( xStatusIndicator.is() )
+ {
+ rtl::OUString aMsg;
+ xStatusIndicator->start( aMsg, 100 );
+ }
+ }
+
+ Size aSize100;
+ const MapMode aMap( rGraphic.GetPrefMapMode() );
+ BOOL bLogSize = ( aMap.GetMapUnit() != MAP_PIXEL );
+
+ if( bLogSize )
+ aSize100 = Application::GetDefaultDevice()->LogicToLogic( rGraphic.GetPrefSize(), aMap, MAP_100TH_MM );
+
+ pGIF = &rGIF;
+ bStatus = TRUE;
+ nLastPercent = 0;
+ nInterlaced = 0;
+ pAcc = NULL;
+
+ if ( pFilterConfigItem )
+ nInterlaced = pFilterConfigItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Interlaced" ) ), 0 );
+
+ pGIF->SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
+
+ if( rGraphic.IsAnimated() )
+ {
+ const Animation& rAnimation = rGraphic.GetAnimation();
+
+ WriteSignature( TRUE );
+
+ if ( bStatus )
+ {
+ WriteGlobalHeader( rAnimation.GetDisplaySizePixel() );
+
+ if( bStatus )
+ {
+ WriteLoopExtension( rAnimation );
+
+ if( bStatus )
+ WriteAnimation( rAnimation );
+ }
+ }
+ }
+ else
+ {
+ const BOOL bGrafTrans = rGraphic.IsTransparent();
+
+ BitmapEx aBmpEx;
+
+ if( bGrafTrans )
+ aBmpEx = rGraphic.GetBitmapEx();
+ else
+ aBmpEx = BitmapEx( rGraphic.GetBitmap() );
+
+ nMinPercent = 0;
+ nMaxPercent = 100;
+
+ WriteSignature( bGrafTrans || bLogSize );
+
+ if( bStatus )
+ {
+ WriteGlobalHeader( aBmpEx.GetSizePixel() );
+
+ if( bStatus )
+ WriteBitmapEx( aBmpEx, Point(), bGrafTrans );
+ }
+ }
+
+ if( bStatus )
+ {
+ if( bLogSize )
+ WriteLogSizeExtension( aSize100 );
+
+ WriteTerminator();
+ }
+
+ if ( xStatusIndicator.is() )
+ xStatusIndicator->end();
+
+ return bStatus;
+}
+
+// ------------------------------------------------------------------------
+
+void GIFWriter::WriteBitmapEx( const BitmapEx& rBmpEx, const Point& rPoint,
+ BOOL bExtended, long nTimer, Disposal eDisposal )
+{
+ if( CreateAccess( rBmpEx ) )
+ {
+ nActX = rPoint.X();
+ nActY = rPoint.Y();
+
+ if( bExtended )
+ WriteImageExtension( nTimer, eDisposal );
+
+ if( bStatus )
+ {
+ WriteLocalHeader();
+
+ if( bStatus )
+ {
+ WritePalette();
+
+ if( bStatus )
+ WriteAccess();
+ }
+ }
+
+ DestroyAccess();
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void GIFWriter::WriteAnimation( const Animation& rAnimation )
+{
+ const USHORT nCount = rAnimation.Count();
+
+ if( nCount )
+ {
+ const double fStep = 100. / nCount;
+
+ nMinPercent = 0L;
+ nMaxPercent = (ULONG) fStep;
+
+ for( USHORT i = 0; i < nCount; i++ )
+ {
+ const AnimationBitmap& rAnimBmp = rAnimation.Get( i );
+
+ WriteBitmapEx( rAnimBmp.aBmpEx, rAnimBmp.aPosPix, TRUE,
+ rAnimBmp.nWait, rAnimBmp.eDisposal );
+ nMinPercent = nMaxPercent;
+ nMaxPercent = (ULONG) ( nMaxPercent + fStep );
+ }
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void GIFWriter::MayCallback( ULONG nPercent )
+{
+ if ( xStatusIndicator.is() )
+ {
+ if( nPercent >= nLastPercent + 3 )
+ {
+ nLastPercent = nPercent;
+ if ( nPercent <= 100 )
+ xStatusIndicator->setValue( nPercent );
+ }
+ }
+}
+
+// ------------------------------------------------------------------------
+
+BOOL GIFWriter::CreateAccess( const BitmapEx& rBmpEx )
+{
+ if( bStatus )
+ {
+ Bitmap aMask( rBmpEx.GetMask() );
+
+ aAccBmp = rBmpEx.GetBitmap();
+ bTransparent = FALSE;
+
+ if( !!aMask )
+ {
+ if( aAccBmp.Convert( BMP_CONVERSION_8BIT_TRANS ) )
+ {
+ aMask.Convert( BMP_CONVERSION_1BIT_THRESHOLD );
+ aAccBmp.Replace( aMask, BMP_COL_TRANS );
+ bTransparent = TRUE;
+ }
+ else
+ aAccBmp.Convert( BMP_CONVERSION_8BIT_COLORS );
+ }
+ else
+ aAccBmp.Convert( BMP_CONVERSION_8BIT_COLORS );
+
+ pAcc = aAccBmp.AcquireReadAccess();
+
+ if( !pAcc )
+ bStatus = FALSE;
+ }
+
+ return bStatus;
+}
+
+// ------------------------------------------------------------------------
+
+void GIFWriter::DestroyAccess()
+{
+ aAccBmp.ReleaseAccess( pAcc );
+ pAcc = NULL;
+}
+
+// ------------------------------------------------------------------------
+
+void GIFWriter::WriteSignature( BOOL bGIF89a )
+{
+ if( bStatus )
+ {
+ pGIF->Write( bGIF89a ? "GIF89a" : "GIF87a" , 6 );
+
+ if( pGIF->GetError() )
+ bStatus = FALSE;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void GIFWriter::WriteGlobalHeader( const Size& rSize )
+{
+ if( bStatus )
+ {
+ // 256 Farben
+ const UINT16 nWidth = (UINT16) rSize.Width();
+ const UINT16 nHeight = (UINT16) rSize.Height();
+ const BYTE cFlags = 128 | ( 7 << 4 );
+
+ // Werte rausschreiben
+ *pGIF << nWidth;
+ *pGIF << nHeight;
+ *pGIF << cFlags;
+ *pGIF << (BYTE) 0x00;
+ *pGIF << (BYTE) 0x00;
+
+ // Dummy-Palette mit zwei Eintraegen (Schwarz/Weiss) schreiben;
+ // dieses nur wegen Photoshop-Bug, da die keine Bilder ohne
+ // globale Farbpalette lesen koennen
+ *pGIF << (UINT16) 0;
+ *pGIF << (UINT16) 255;
+ *pGIF << (UINT16) 65535;
+
+ if( pGIF->GetError() )
+ bStatus = FALSE;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void GIFWriter::WriteLoopExtension( const Animation& rAnimation )
+{
+ DBG_ASSERT( rAnimation.Count() > 0, "Animation has no bitmaps!" );
+
+ USHORT nLoopCount = (USHORT) rAnimation.GetLoopCount();
+
+ // falls nur ein Durchlauf stattfinden soll,
+ // wird keine LoopExtension geschrieben;
+ // Default ist dann immer ein Durchlauf
+ if( nLoopCount != 1 )
+ {
+ // Netscape interpretiert den LoopCount
+ // als reine Anzahl der _Wiederholungen_
+ if( nLoopCount )
+ nLoopCount--;
+
+ const BYTE cLoByte = (const BYTE) nLoopCount;
+ const BYTE cHiByte = (const BYTE) ( nLoopCount >> 8 );
+
+ *pGIF << (BYTE) 0x21;
+ *pGIF << (BYTE) 0xff;
+ *pGIF << (BYTE) 0x0b;
+ pGIF->Write( "NETSCAPE2.0", 11 );
+ *pGIF << (BYTE) 0x03;
+ *pGIF << (BYTE) 0x01;
+ *pGIF << cLoByte;
+ *pGIF << cHiByte;
+ *pGIF << (BYTE) 0x00;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void GIFWriter::WriteLogSizeExtension( const Size& rSize100 )
+{
+ // PrefSize in 100th-mm als ApplicationExtension schreiben
+ if( rSize100.Width() && rSize100.Height() )
+ {
+ *pGIF << (BYTE) 0x21;
+ *pGIF << (BYTE) 0xff;
+ *pGIF << (BYTE) 0x0b;
+ pGIF->Write( "STARDIV 5.0", 11 );
+ *pGIF << (BYTE) 0x09;
+ *pGIF << (BYTE) 0x01;
+ *pGIF << (UINT32) rSize100.Width();
+ *pGIF << (UINT32) rSize100.Height();
+ *pGIF << (BYTE) 0x00;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void GIFWriter::WriteImageExtension( long nTimer, Disposal eDisposal )
+{
+ if( bStatus )
+ {
+ const UINT16 nDelay = (UINT16) nTimer;
+ BYTE cFlags = 0;
+
+ // Transparent-Flag setzen
+ if( bTransparent )
+ cFlags |= 1;
+
+ // Disposal-Wert setzen
+ if( eDisposal == DISPOSE_BACK )
+ cFlags |= ( 2 << 2 );
+ else if( eDisposal == DISPOSE_PREVIOUS )
+ cFlags |= ( 3 << 2 );
+
+ *pGIF << (BYTE) 0x21;
+ *pGIF << (BYTE) 0xf9;
+ *pGIF << (BYTE) 0x04;
+ *pGIF << cFlags;
+ *pGIF << nDelay;
+ *pGIF << (BYTE) pAcc->GetBestPaletteIndex( BMP_COL_TRANS );
+ *pGIF << (BYTE) 0x00;
+
+ if( pGIF->GetError() )
+ bStatus = FALSE;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void GIFWriter::WriteLocalHeader()
+{
+ if( bStatus )
+ {
+ const UINT16 nPosX = (UINT16) nActX;
+ const UINT16 nPosY = (UINT16) nActY;
+ const UINT16 nWidth = (UINT16) pAcc->Width();
+ const UINT16 nHeight = (UINT16) pAcc->Height();
+ BYTE cFlags = (BYTE) ( pAcc->GetBitCount() - 1 );
+
+ // Interlaced-Flag setzen
+ if( nInterlaced )
+ cFlags |= 0x40;
+
+ // Flag fuer lokale Farbpalette setzen
+ cFlags |= 0x80;
+
+ // alles rausschreiben
+ *pGIF << (BYTE) 0x2c;
+ *pGIF << nPosX;
+ *pGIF << nPosY;
+ *pGIF << nWidth;
+ *pGIF << nHeight;
+ *pGIF << cFlags;
+
+ if( pGIF->GetError() )
+ bStatus = FALSE;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void GIFWriter::WritePalette()
+{
+ if( bStatus && pAcc->HasPalette() )
+ {
+ const USHORT nCount = pAcc->GetPaletteEntryCount();
+ const USHORT nMaxCount = ( 1 << pAcc->GetBitCount() );
+
+ for ( USHORT i = 0; i < nCount; i++ )
+ {
+ const BitmapColor& rColor = pAcc->GetPaletteColor( i );
+
+ *pGIF << rColor.GetRed();
+ *pGIF << rColor.GetGreen();
+ *pGIF << rColor.GetBlue();
+ }
+
+ // Rest mit 0 auffuellen
+ if( nCount < nMaxCount )
+ pGIF->SeekRel( ( nMaxCount - nCount ) * 3 );
+
+ if( pGIF->GetError() )
+ bStatus = FALSE;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void GIFWriter::WriteAccess()
+{
+ GIFLZWCompressor aCompressor;
+ const long nWidth = pAcc->Width();
+ const long nHeight = pAcc->Height();
+ BYTE* pBuffer = NULL;
+ const ULONG nFormat = pAcc->GetScanlineFormat();
+ long nY;
+ long nT;
+ long i;
+ BOOL bNative = ( BMP_FORMAT_8BIT_PAL == nFormat );
+
+ if( !bNative )
+ pBuffer = new BYTE[ nWidth ];
+
+ if( bStatus && ( 8 == pAcc->GetBitCount() ) && pAcc->HasPalette() )
+ {
+ aCompressor.StartCompression( *pGIF, pAcc->GetBitCount() );
+
+ for( i = 0; i < nHeight; i++ )
+ {
+ if( nInterlaced )
+ {
+ nY = i << 3;
+
+ if( nY >= nHeight )
+ {
+ nT = i - ( ( nHeight + 7 ) >> 3 );
+ nY= ( nT << 3 ) + 4;
+
+ if( nY >= nHeight )
+ {
+ nT -= ( nHeight + 3 ) >> 3;
+ nY = ( nT << 2 ) + 2;
+
+ if ( nY >= nHeight )
+ {
+ nT -= ( ( nHeight + 1 ) >> 2 );
+ nY = ( nT << 1 ) + 1;
+ }
+ }
+ }
+ }
+ else
+ nY = i;
+
+ if( bNative )
+ aCompressor.Compress( pAcc->GetScanline( nY ), nWidth );
+ else
+ {
+ for( long nX = 0L; nX < nWidth; nX++ )
+ pBuffer[ nX ] = (BYTE) pAcc->GetPixel( nY, nX );
+
+ aCompressor.Compress( pBuffer, nWidth );
+ }
+
+ if ( pGIF->GetError() )
+ bStatus = FALSE;
+
+ MayCallback( nMinPercent + ( nMaxPercent - nMinPercent ) * i / nHeight );
+
+ if( !bStatus )
+ break;
+ }
+
+ aCompressor.EndCompression();
+
+ if ( pGIF->GetError() )
+ bStatus = FALSE;
+ }
+
+ delete[] pBuffer;
+}
+
+// ------------------------------------------------------------------------
+
+void GIFWriter::WriteTerminator()
+{
+ if( bStatus )
+ {
+ *pGIF << (BYTE) 0x3b;
+
+ if( pGIF->GetError() )
+ bStatus = FALSE;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+extern "C" BOOL __LOADONCALLAPI GraphicExport( SvStream& rStream, Graphic& rGraphic,
+ FilterConfigItem* pConfigItem, BOOL )
+{
+ return GIFWriter().WriteGIF( rGraphic, rStream, pConfigItem );
+}
+
+// ------------------------------------------------------------------------
+
+extern "C" BOOL __LOADONCALLAPI DoExportDialog( FltCallDialogParameter& rPara )
+{
+ BOOL bRet = FALSE;
+
+ if ( rPara.pWindow )
+ {
+ ByteString aResMgrName( "egi" );
+ ResMgr* pResMgr;
+
+ pResMgr = ResMgr::CreateResMgr( aResMgrName.GetBuffer(), Application::GetSettings().GetUILocale() );
+
+ if( pResMgr )
+ {
+ rPara.pResMgr = pResMgr;
+ bRet = ( DlgExportEGIF( rPara ).Execute() == RET_OK );
+ delete pResMgr;
+ }
+ else
+ bRet = TRUE;
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+#ifndef GCC
+#endif
+
+#ifdef WIN
+
+static HINSTANCE hDLLInst = 0;
+
+extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR )
+{
+#ifndef WNT
+ if ( nHeap )
+ UnlockData( 0 );
+#endif
+
+ hDLLInst = hDLL;
+
+ return TRUE;
+}
+
+// ------------------------------------------------------------------------
+
+extern "C" int CALLBACK WEP( int )
+{
+ return 1;
+}
+
+#endif
diff --git a/filter/source/graphicfilter/egif/egifstr.src b/filter/source/graphicfilter/egif/egifstr.src
new file mode 100644
index 000000000000..ea258019d543
--- /dev/null
+++ b/filter/source/graphicfilter/egif/egifstr.src
@@ -0,0 +1,39 @@
+/*************************************************************************
+ *
+ * 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 "strings.hrc"
+
+// Key fuer den Dialog
+String KEY_INTER
+{
+ Text = "Interlaced";
+};
+String KEY_TRANS
+{
+ Text = "Translucent";
+};
diff --git a/filter/source/graphicfilter/egif/exports.map b/filter/source/graphicfilter/egif/exports.map
new file mode 100644
index 000000000000..61e4682c6551
--- /dev/null
+++ b/filter/source/graphicfilter/egif/exports.map
@@ -0,0 +1,8 @@
+UDK_3_0_0 {
+ global:
+ GraphicExport;
+ DoExportDialog;
+
+ local:
+ *;
+};
diff --git a/filter/source/graphicfilter/egif/giflzwc.cxx b/filter/source/graphicfilter/egif/giflzwc.cxx
new file mode 100644
index 000000000000..5438aa46017b
--- /dev/null
+++ b/filter/source/graphicfilter/egif/giflzwc.cxx
@@ -0,0 +1,256 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include <tools/stream.hxx>
+#include "giflzwc.hxx"
+
+// ----------------------------
+// - GIFImageDataOutputStream -
+// ----------------------------
+
+class GIFImageDataOutputStream
+{
+private:
+
+ void FlushBlockBuf();
+ inline void FlushBitsBufsFullBytes();
+
+ SvStream& rStream;
+ BYTE* pBlockBuf;
+ BYTE nBlockBufSize;
+ ULONG nBitsBuf;
+ USHORT nBitsBufSize;
+
+public:
+
+ GIFImageDataOutputStream( SvStream & rGIF, BYTE nLZWDataSize );
+ ~GIFImageDataOutputStream();
+
+ inline void WriteBits( USHORT nCode, USHORT nCodeLen );
+};
+
+// ------------------------------------------------------------------------
+
+inline void GIFImageDataOutputStream::FlushBitsBufsFullBytes()
+{
+ while (nBitsBufSize>=8)
+ {
+ if( nBlockBufSize==255 )
+ FlushBlockBuf();
+
+ pBlockBuf[nBlockBufSize++] = (BYTE) nBitsBuf;
+ nBitsBuf >>= 8;
+ nBitsBufSize -= 8;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+inline void GIFImageDataOutputStream::WriteBits( USHORT nCode, USHORT nCodeLen )
+{
+ if( nBitsBufSize+nCodeLen>32 )
+ FlushBitsBufsFullBytes();
+
+ nBitsBuf |= (ULONG) nCode << nBitsBufSize;
+ nBitsBufSize = nBitsBufSize + nCodeLen;
+}
+
+// ------------------------------------------------------------------------
+
+GIFImageDataOutputStream::GIFImageDataOutputStream( SvStream & rGIF, BYTE nLZWDataSize ) :
+ rStream(rGIF)
+{
+ pBlockBuf = new BYTE[ 255 ];
+ nBlockBufSize = 0;
+ nBitsBufSize = 0;
+ nBitsBuf = 0;
+ rStream << nLZWDataSize;
+}
+
+// ------------------------------------------------------------------------
+
+
+GIFImageDataOutputStream::~GIFImageDataOutputStream()
+{
+ WriteBits(0,7);
+ FlushBitsBufsFullBytes();
+ FlushBlockBuf();
+ rStream << (BYTE)0;
+ delete[] pBlockBuf;
+}
+
+// ------------------------------------------------------------------------
+
+void GIFImageDataOutputStream::FlushBlockBuf()
+{
+ if( nBlockBufSize )
+ {
+ rStream << (BYTE) nBlockBufSize;
+ rStream.Write( pBlockBuf,nBlockBufSize );
+ nBlockBufSize = 0;
+ }
+}
+
+// -------------------
+// - GIFLZWCTreeNode -
+// -------------------
+
+struct GIFLZWCTreeNode
+{
+
+ GIFLZWCTreeNode* pBrother; // naechster Knoten, der den selben Vater hat
+ GIFLZWCTreeNode* pFirstChild; // erster Sohn
+ USHORT nCode; // Der Code fuer den String von Pixelwerten, der sich ergibt, wenn
+ USHORT nValue; // Der Pixelwert
+};
+
+// --------------------
+// - GIFLZWCompressor -
+// --------------------
+
+GIFLZWCompressor::GIFLZWCompressor()
+{
+ pIDOS=NULL;
+}
+
+// ------------------------------------------------------------------------
+
+GIFLZWCompressor::~GIFLZWCompressor()
+{
+ if (pIDOS!=NULL) EndCompression();
+}
+
+// ------------------------------------------------------------------------
+
+void GIFLZWCompressor::StartCompression( SvStream& rGIF, USHORT nPixelSize )
+{
+ if( !pIDOS )
+ {
+ USHORT i;
+
+ nDataSize = nPixelSize;
+
+ if( nDataSize < 2 )
+ nDataSize=2;
+
+ nClearCode=1<<nDataSize;
+ nEOICode=nClearCode+1;
+ nTableSize=nEOICode+1;
+ nCodeSize=nDataSize+1;
+
+ pIDOS=new GIFImageDataOutputStream(rGIF,(BYTE)nDataSize);
+ pTable=new GIFLZWCTreeNode[4096];
+
+ for (i=0; i<4096; i++)
+ {
+ pTable[i].pBrother = pTable[i].pFirstChild = NULL;
+ pTable[i].nValue = (BYTE) ( pTable[i].nCode = i );
+ }
+
+ pPrefix = NULL;
+ pIDOS->WriteBits( nClearCode,nCodeSize );
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void GIFLZWCompressor::Compress( HPBYTE pSrc, ULONG nSize )
+{
+ if( pIDOS )
+ {
+ GIFLZWCTreeNode* p;
+ USHORT i;
+ BYTE nV;
+
+ if( !pPrefix && nSize )
+ {
+ pPrefix=pTable+(*pSrc++);
+ nSize--;
+ }
+
+ while( nSize )
+ {
+ nSize--;
+ nV=*pSrc++;
+ for( p=pPrefix->pFirstChild; p!=NULL; p=p->pBrother )
+ {
+ if (p->nValue==nV)
+ break;
+ }
+
+ if( p)
+ pPrefix=p;
+ else
+ {
+ pIDOS->WriteBits(pPrefix->nCode,nCodeSize);
+
+ if (nTableSize==4096)
+ {
+ pIDOS->WriteBits(nClearCode,nCodeSize);
+
+ for (i=0; i<nClearCode; i++)
+ pTable[i].pFirstChild=NULL;
+
+ nCodeSize=nDataSize+1;
+ nTableSize=nEOICode+1;
+ }
+ else
+ {
+ if(nTableSize==(USHORT)(1<<nCodeSize))
+ nCodeSize++;
+
+ p=pTable+(nTableSize++);
+ p->pBrother=pPrefix->pFirstChild;
+ pPrefix->pFirstChild=p;
+ p->nValue=nV;
+ p->pFirstChild=NULL;
+ }
+
+ pPrefix=pTable+nV;
+ }
+ }
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void GIFLZWCompressor::EndCompression()
+{
+ if( pIDOS )
+ {
+ if( pPrefix )
+ pIDOS->WriteBits(pPrefix->nCode,nCodeSize);
+
+ pIDOS->WriteBits( nEOICode,nCodeSize );
+ delete[] pTable;
+ delete pIDOS;
+ pIDOS=NULL;
+ }
+}
diff --git a/filter/source/graphicfilter/egif/giflzwc.hxx b/filter/source/graphicfilter/egif/giflzwc.hxx
new file mode 100644
index 000000000000..75048b0f8ff5
--- /dev/null
+++ b/filter/source/graphicfilter/egif/giflzwc.hxx
@@ -0,0 +1,65 @@
+/*************************************************************************
+ *
+ * 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 _GIFLZWC_HXX
+#define _GIFLZWC_HXX
+
+#ifndef _BMPACC_HXX
+#include <vcl/bmpacc.hxx>
+#endif
+
+// --------------------
+// - GIFLZWCompressor -
+// --------------------
+
+class GIFImageDataOutputStream;
+struct GIFLZWCTreeNode;
+
+class GIFLZWCompressor
+{
+private:
+
+ GIFImageDataOutputStream* pIDOS;
+ GIFLZWCTreeNode* pTable;
+ GIFLZWCTreeNode* pPrefix;
+ USHORT nDataSize;
+ USHORT nClearCode;
+ USHORT nEOICode;
+ USHORT nTableSize;
+ USHORT nCodeSize;
+
+public:
+
+ GIFLZWCompressor();
+ ~GIFLZWCompressor();
+
+ void StartCompression( SvStream& rGIF, USHORT nPixelSize );
+ void Compress( HPBYTE pSrc, ULONG nSize );
+ void EndCompression();
+};
+
+#endif // _GIFLZWC_HXX
diff --git a/filter/source/graphicfilter/egif/makefile.mk b/filter/source/graphicfilter/egif/makefile.mk
new file mode 100644
index 000000000000..27dae4906046
--- /dev/null
+++ b/filter/source/graphicfilter/egif/makefile.mk
@@ -0,0 +1,78 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=filter
+TARGET=egif
+TARGET2=egi
+DEPTARGET=vegif
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Files --------------------------------------------------------
+
+.IF "$(editdebug)"!="" || "$(EDITDEBUG)"!=""
+CDEFS+= -DEDITDEBUG
+.ENDIF
+
+SRS1NAME=$(TARGET)
+SRC1FILES = dlgegif.src \
+ egifstr.src
+.IF "$(L10N_framework)"==""
+SLOFILES= $(SLO)$/egif.obj \
+ $(SLO)$/dlgegif.obj \
+ $(SLO)$/giflzwc.obj
+.ENDIF
+
+# ==========================================================================
+
+RESLIB1NAME=$(TARGET2)
+RESLIB1SRSFILES=$(SRS)$/$(TARGET).srs
+
+.IF "$(L10N_framework)"==""
+SHL1TARGET= egi$(DLLPOSTFIX)
+SHL1IMPLIB= egif
+SHL1STDLIBS= $(TOOLSLIB) $(VCLLIB) $(CPPULIB) $(SVTOOLLIB) $(SALLIB)
+
+SHL1LIBS= $(SLB)$/egif.lib
+
+.IF "$(GUI)" != "UNX"
+.IF "$(COM)" != "GCC"
+SHL1OBJS= $(SLO)$/egif.obj
+.ENDIF
+.ENDIF
+
+SHL1VERSIONMAP=exports.map
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+DEF1NAME=$(SHL1TARGET)
+.ENDIF
+# ==========================================================================
+
+.INCLUDE : target.mk
diff --git a/filter/source/graphicfilter/egif/strings.hrc b/filter/source/graphicfilter/egif/strings.hrc
new file mode 100644
index 000000000000..1566c0dfee81
--- /dev/null
+++ b/filter/source/graphicfilter/egif/strings.hrc
@@ -0,0 +1,28 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+#define KEY_INTER 256
+#define KEY_TRANS 257
diff --git a/filter/source/graphicfilter/eos2met/dlgeos2.cxx b/filter/source/graphicfilter/eos2met/dlgeos2.cxx
new file mode 100644
index 000000000000..4c5bf1b0a429
--- /dev/null
+++ b/filter/source/graphicfilter/eos2met/dlgeos2.cxx
@@ -0,0 +1,179 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+#ifndef GCC
+#endif
+#include <com/sun/star/awt/Size.hpp>
+#include <vcl/msgbox.hxx>
+#include <svtools/FilterConfigItem.hxx>
+#include "dlgeos2.hxx"
+#include "dlgeos2.hrc"
+#include "strings.hrc"
+
+/*************************************************************************
+|*
+|* Ctor
+|*
+\************************************************************************/
+
+DlgExportEMET::DlgExportEMET( FltCallDialogParameter& rPara ) :
+ ModalDialog ( rPara.pWindow, ResId( DLG_EXPORT_EMET, *rPara.pResMgr ) ),
+ rFltCallPara ( rPara ),
+ aBtnOK ( this, ResId( BTN_OK, *rPara.pResMgr ) ),
+ aBtnCancel ( this, ResId( BTN_CANCEL, *rPara.pResMgr ) ),
+ aBtnHelp ( this, ResId( BTN_HELP, *rPara.pResMgr ) ),
+ aRbOriginal ( this, ResId( RB_ORIGINAL, *rPara.pResMgr ) ),
+ aRbSize ( this, ResId( RB_SIZE, *rPara.pResMgr ) ),
+ aGrpMode ( this, ResId( GRP_MODE, *rPara.pResMgr ) ),
+ aFtSizeX ( this, ResId( FT_SIZEX, *rPara.pResMgr ) ),
+ aMtfSizeX ( this, ResId( MTF_SIZEX, *rPara.pResMgr ) ),
+ aFtSizeY ( this, ResId( FT_SIZEY, *rPara.pResMgr ) ),
+ aMtfSizeY ( this, ResId( MTF_SIZEY, *rPara.pResMgr ) ),
+ aGrpSize ( this, ResId( GRP_SIZE, *rPara.pResMgr ) ),
+ pMgr ( rPara.pResMgr )
+{
+ FreeResource();
+
+ String aFilterConfigPath( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Filter/Graphic/Export/MET" ) );
+ pConfigItem = new FilterConfigItem( aFilterConfigPath, &rPara.aFilterData );
+
+ aBtnOK.SetClickHdl( LINK( this, DlgExportEMET, OK ) );
+ aRbOriginal.SetClickHdl( LINK( this, DlgExportEMET, ClickRbOriginal ) );
+ aRbSize.SetClickHdl( LINK( this, DlgExportEMET, ClickRbSize ) );
+
+ // Config-Parameter lesen
+ sal_Int32 nMode = pConfigItem->ReadInt32( String( ResId( KEY_MODE, *pMgr ) ), 0 );
+ ::com::sun::star::awt::Size aDefault( 10000, 10000 );
+ ::com::sun::star::awt::Size aSize;
+ aSize = pConfigItem->ReadSize( String( ResId( KEY_SIZE, *pMgr ) ), aDefault );
+
+ aMtfSizeX.SetDefaultUnit( FUNIT_MM );
+ aMtfSizeY.SetDefaultUnit( FUNIT_MM );
+
+ aMtfSizeX.SetValue( aSize.Width );
+ aMtfSizeY.SetValue( aSize.Height );
+
+ switch ( rPara.eFieldUnit )
+ {
+// case FUNIT_NONE :
+// case FUNIT_KM :
+// case FUNIT_PERCENT :
+// case FUNIT_CUSTOM :
+// case FUNIT_MILE :
+// case FUNIT_FOOT :
+// case FUNIT_M :
+ case FUNIT_MM :
+ case FUNIT_CM :
+ case FUNIT_TWIP :
+ case FUNIT_POINT :
+ case FUNIT_PICA :
+ case FUNIT_INCH :
+ case FUNIT_100TH_MM :
+ {
+ aMtfSizeX.SetUnit( rPara.eFieldUnit );
+ aMtfSizeY.SetUnit( rPara.eFieldUnit );
+ }
+ break;
+ default:
+ break; // multiple other value not handled -Wall
+ }
+ if ( nMode == 1 )
+ {
+ aRbSize.Check( TRUE );
+ ClickRbSize( NULL );
+ }
+ else
+ {
+ aRbOriginal.Check( TRUE );
+ ClickRbOriginal( NULL );
+ }
+}
+
+DlgExportEMET::~DlgExportEMET()
+{
+ delete pConfigItem;
+}
+
+/*************************************************************************
+|*
+|* Speichert eingestellte Werte in ini-Datei
+|*
+\************************************************************************/
+
+IMPL_LINK( DlgExportEMET, OK, void *, EMPTYARG )
+{
+ // Config-Parameter schreiben
+ ::com::sun::star::awt::Size aSize(
+ (sal_Int32)MetricField::ConvertDoubleValue( aMtfSizeX.GetValue(), 2, aMtfSizeX.GetUnit(), MAP_100TH_MM ),
+ (sal_Int32)MetricField::ConvertDoubleValue( aMtfSizeY.GetValue(), 2, aMtfSizeY.GetUnit(), MAP_100TH_MM ) );
+ sal_Int32 nStrMode = ( aRbSize.IsChecked() ) ? 1 : 0;
+
+ pConfigItem->WriteInt32( String( ResId( KEY_MODE, *pMgr ) ), nStrMode );
+ pConfigItem->WriteSize( String( ResId( KEY_SIZE, *pMgr ) ), aSize );
+ rFltCallPara.aFilterData = pConfigItem->GetFilterData();
+ EndDialog( RET_OK );
+
+ return 0;
+}
+
+/*************************************************************************
+|*
+|* Enabled/Disabled Controls
+|*
+\************************************************************************/
+
+IMPL_LINK( DlgExportEMET, ClickRbOriginal, void*, EMPTYARG )
+{
+ aGrpSize.Disable();
+ aFtSizeX.Disable();
+ aMtfSizeX.Disable();
+ aFtSizeY.Disable();
+ aMtfSizeY.Disable();
+
+ return 0;
+}
+
+
+/*************************************************************************
+|*
+|* Enabled/Disabled Controls
+|*
+\************************************************************************/
+
+IMPL_LINK( DlgExportEMET, ClickRbSize, void*, EMPTYARG )
+{
+ aGrpSize.Enable();
+ aFtSizeX.Enable();
+ aMtfSizeX.Enable();
+ aFtSizeY.Enable();
+ aMtfSizeY.Enable();
+
+ return 0;
+}
+
diff --git a/filter/source/graphicfilter/eos2met/dlgeos2.hrc b/filter/source/graphicfilter/eos2met/dlgeos2.hrc
new file mode 100644
index 000000000000..5e4ec5b160fc
--- /dev/null
+++ b/filter/source/graphicfilter/eos2met/dlgeos2.hrc
@@ -0,0 +1,41 @@
+/*************************************************************************
+ *
+ * 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 "filter.hrc"
+
+#define BTN_OK 1
+#define BTN_CANCEL 1
+#define BTN_HELP 1
+#define CBX_SIZE 2
+#define MTF_SIZEX 1
+#define MTF_SIZEY 2
+#define FT_SIZEX 1
+#define FT_SIZEY 2
+#define GRP_SIZE 1
+#define GRP_MODE 2
+#define RB_ORIGINAL 1
+#define RB_SIZE 2
+
diff --git a/filter/source/graphicfilter/eos2met/dlgeos2.hxx b/filter/source/graphicfilter/eos2met/dlgeos2.hxx
new file mode 100644
index 000000000000..6387be453494
--- /dev/null
+++ b/filter/source/graphicfilter/eos2met/dlgeos2.hxx
@@ -0,0 +1,80 @@
+/*************************************************************************
+ *
+ * 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 _DLGEOS2_HXX_
+#define _DLGEOS2_HXX_
+#include <svtools/fltcall.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/button.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/field.hxx>
+
+/*************************************************************************
+|*
+|* Dialog zum Einstellen von Filteroptionen bei Vektorformaten
+|*
+\************************************************************************/
+
+class FilterConfigItem;
+class ResMgr;
+
+class DlgExportEMET : public ModalDialog
+{
+private:
+
+ FltCallDialogParameter& rFltCallPara;
+
+ OKButton aBtnOK;
+ CancelButton aBtnCancel;
+ HelpButton aBtnHelp;
+
+ RadioButton aRbOriginal;
+ RadioButton aRbSize;
+ FixedLine aGrpMode;
+
+ FixedText aFtSizeX;
+ MetricField aMtfSizeX;
+ FixedText aFtSizeY;
+ MetricField aMtfSizeY;
+ FixedLine aGrpSize;
+
+ FilterConfigItem* pConfigItem;
+ ResMgr* pMgr;
+
+ DECL_LINK( OK, void* p );
+ DECL_LINK( ClickRbOriginal,void* p );
+ DECL_LINK( ClickRbSize,void* p );
+
+public:
+ DlgExportEMET( FltCallDialogParameter& rPara );
+ ~DlgExportEMET();
+};
+
+
+#endif // _DLGEMET_HXX_
+
diff --git a/filter/source/graphicfilter/eos2met/dlgeos2.src b/filter/source/graphicfilter/eos2met/dlgeos2.src
new file mode 100644
index 000000000000..6c9e474e25db
--- /dev/null
+++ b/filter/source/graphicfilter/eos2met/dlgeos2.src
@@ -0,0 +1,162 @@
+/*************************************************************************
+ *
+ * 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 "dlgeos2.hrc"
+
+ModalDialog DLG_EXPORT_EMET
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 178 , 89 ) ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ Text [ en-US ] = "MET Options" ;
+ MetricField MTF_SIZEX
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 60 , 55 ) ;
+ Size = MAP_APPFONT ( 50 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 100 ;
+ Maximum = 99999 ;
+ StrictFormat = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_MM ;
+ First = 100 ;
+ Last = 99999 ;
+ SpinSize = 100 ;
+ };
+ MetricField MTF_SIZEY
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 60 , 71 ) ;
+ Size = MAP_APPFONT ( 50 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 100 ;
+ Maximum = 99999 ;
+ StrictFormat = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_MM ;
+ First = 100 ;
+ Last = 99999 ;
+ SpinSize = 100 ;
+ };
+ FixedLine GRP_SIZE
+ {
+ Pos = MAP_APPFONT ( 6 , 44 ) ;
+ Size = MAP_APPFONT ( 110 , 8 ) ;
+ Text [ en-US ] = "Size" ;
+ };
+ FixedText FT_SIZEX
+ {
+ Pos = MAP_APPFONT ( 12 , 56 ) ;
+ Size = MAP_APPFONT ( 45 , 10 ) ;
+ Text [ en-US ] = "Width" ;
+ };
+ FixedText FT_SIZEY
+ {
+ Pos = MAP_APPFONT ( 12 , 72 ) ;
+ Size = MAP_APPFONT ( 45 , 10 ) ;
+ Text [ en-US ] = "Height" ;
+ };
+ OKButton BTN_OK
+ {
+ Pos = MAP_APPFONT ( 122 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( 122 , 24 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton BTN_HELP
+ {
+ Pos = MAP_APPFONT ( 122 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ RadioButton RB_ORIGINAL
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 98 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Original" ;
+ };
+ RadioButton RB_SIZE
+ {
+ Pos = MAP_APPFONT ( 12 , 28 ) ;
+ Size = MAP_APPFONT ( 98 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Size" ;
+ };
+ FixedLine GRP_MODE
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 110 , 8 ) ;
+ Text [ en-US ] = "Mode" ;
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/filter/source/graphicfilter/eos2met/eos2met.cxx b/filter/source/graphicfilter/eos2met/eos2met.cxx
new file mode 100644
index 000000000000..5ef86b9c1b98
--- /dev/null
+++ b/filter/source/graphicfilter/eos2met/eos2met.cxx
@@ -0,0 +1,2648 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include <svtools/fltcall.hxx>
+
+#include <math.h>
+#include <tools/stream.hxx>
+#include <tools/bigint.hxx>
+#include <vcl/metaact.hxx>
+#include <vcl/salbtype.hxx>
+#include <tools/poly.hxx>
+#include <vcl/graph.hxx>
+#include <vcl/gradient.hxx>
+#include <vcl/hatch.hxx>
+#include <vcl/metric.hxx>
+#include <vcl/font.hxx>
+#include <vcl/virdev.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/msgbox.hxx>
+#include <svl/solar.hrc>
+#include "strings.hrc"
+#include "dlgeos2.hxx"
+
+// -----------------------------Feld-Typen-------------------------------
+
+#define BegDocumnMagic 0xA8A8 /* Begin Document */
+#define EndDocumnMagic 0xA8A9 /* End Document */
+
+#define BegResGrpMagic 0xC6A8 /* Begin Resource Group */
+#define EndResGrpMagic 0xC6A9 /* End Resource Group */
+
+#define BegColAtrMagic 0x77A8 /* Begin Color Attribute Table */
+#define EndColAtrMagic 0x77A9 /* End Color Attribute Table */
+#define BlkColAtrMagic 0x77B0 /* Color Attribute Table */
+#define MapColAtrMagic 0x77AB /* Map Color Attribute Table */
+
+#define BegImgObjMagic 0xFBA8 /* Begin Image Object */
+#define EndImgObjMagic 0xFBA9 /* End Image Object */
+#define DscImgObjMagic 0xFBA6 /* Image Data Descriptor */
+#define DatImgObjMagic 0xFBEE /* Image Picture Data */
+
+#define BegObjEnvMagic 0xC7A8 /* Begin Object Environment Group */
+#define EndObjEnvMagic 0xC7A9 /* End Object Environment Group */
+
+#define BegGrfObjMagic 0xBBA8 /* Begin Graphics Object */
+#define EndGrfObjMagic 0xBBA9 /* End Graphics Object */
+#define DscGrfObjMagic 0xBBA6 /* Graphics Data Descritor */
+#define DatGrfObjMagic 0xBBEE /* Graphics Data */
+
+#define MapCodFntMagic 0x8AAB /* Map Coded Font */
+#define MapDatResMagic 0xC3AB /* Map Data Resource */
+
+// Struktur des Metafiles
+// BegDocumn
+// BegResGrp
+// BegColAtr
+// BlkColAtr
+// EndColAtr
+// BegImgObj[0..n]
+// BegResGrp[]
+// BegColAtr[]
+// BlkColAtr
+// EndColAtr
+// EndResGrp
+// BegObjEnv[]
+// MapColAtr
+// EndObjEnv
+// DscImgObj
+// DatImgOb1
+// DatImgOb2[1..n]
+// EndImgObj
+// BegGrfObj
+// BegObjEnv[]
+// MapColAtr
+// MapCodFnt1
+// MapCodFnt2[0..n]
+// MapDatRes[0..n]
+// EndObjEnv
+// DscGrfObj
+// DatGrfObj[0..n]
+// EndGrfObj
+// EndResGrp
+// EndDocumn
+
+//============================== METWriter ===================================
+
+struct METChrSet
+{
+ struct METChrSet * pSucc;
+ BYTE nSet;
+ String aName;
+ FontWeight eWeight;
+};
+
+struct METGDIStackMember
+{
+ struct METGDIStackMember * pSucc;
+ Color aLineColor;
+ Color aFillColor;
+ RasterOp eRasterOp;
+ Font aFont;
+ MapMode aMapMode;
+ Rectangle aClipRect;
+};
+
+class METWriter
+{
+private:
+
+ BOOL bStatus;
+ ULONG nLastPercent; // Mit welcher Zahl pCallback zuletzt aufgerufen wurde.
+ SvStream* pMET;
+ Rectangle aPictureRect;
+ MapMode aPictureMapMode;
+ MapMode aTargetMapMode;
+ ULONG nActualFieldStartPos; // Anfangs-Position des aktuellen 'Field'
+ ULONG nNumberOfDataFields; // Anzahl der angefangenen 'Graphcis Data Fields'
+ Color aGDILineColor;
+ Color aGDIFillColor;
+ RasterOp eGDIRasterOp;
+ Font aGDIFont;
+ MapMode aGDIMapMode; // derzeit unbenutzt!
+ Rectangle aGDIClipRect; // derzeit unbenutzt!
+ METGDIStackMember* pGDIStack;
+ Color aMETColor;
+ Color aMETBackgroundColor;
+ Color aMETPatternSymbol;
+ RasterOp eMETMix ;
+ long nMETStrokeLineWidth;
+ Size aMETChrCellSize;
+ short nMETChrAngle;
+ BYTE nMETChrSet;
+ METChrSet* pChrSetList; // Liste der Character-Sets
+ BYTE nNextChrSetId; // die erste unbenutzte ChrSet-Id
+ ULONG nActBitmapId; // Field-Id der naechsten Bitmap
+ ULONG nNumberOfActions; // Anzahl der Actions im GDIMetafile
+ ULONG nNumberOfBitmaps; // Anzahl der Bitmaps
+ ULONG nWrittenActions; // Anzahl der bereits verarbeiteten Actions beim Schreiben der Orders
+ ULONG nWrittenBitmaps; // Anzahl der bereits geschriebenen Bitmaps
+ ULONG nActBitmapPercent; // Wieviel Prozent die naechste Bitmap schon geschrieben ist.
+
+ com::sun::star::uno::Reference< com::sun::star::task::XStatusIndicator > xStatusIndicator;
+
+ void MayCallback();
+ // Berechnet anhand der obigen 5 Parameter eine Prozentzahl
+ // und macht dann ggf. einen Callback. Setzt bStatus auf FALSE wenn User abbrechen
+ // moechte.
+
+ void CountActionsAndBitmaps(const GDIMetaFile * pMTF);
+ // Zaehlt die Bitmaps und Actions (nNumberOfActions und nNumberOfBitmaps muessen
+ // zu Anfang auf 0 gesetzt werden, weil diese Methode rekursiv ist)
+
+ void WriteBigEndianShort(USHORT nWord);
+ void WriteBigEndianLong(ULONG nLong);
+
+ void WritePoint(Point aPt);
+ void WriteClipRect( const Rectangle& rRect );
+ void WriteFieldIntroducer(USHORT nFieldSize, USHORT nFieldType,
+ BYTE nFlags, USHORT nSegSeqNum);
+ void UpdateFieldSize();
+
+ void WriteFieldId(ULONG nId);
+
+ void CreateChrSets(const GDIMetaFile * pMTF);
+ void CreateChrSet(const Font & rFont);
+ void WriteChrSets();
+ BYTE FindChrSet(const Font & rFont);
+
+ void WriteColorAttributeTable(ULONG nFieldId=4, BitmapPalette* pPalette=NULL,
+ BYTE nBasePartFlags=0x40, BYTE nBasePartLCTID=0);
+
+ void WriteImageObject(const Bitmap & rBitmap);
+ void WriteImageObjects(const GDIMetaFile * pMTF);
+
+ void WriteDataDescriptor(const GDIMetaFile * pMTF);
+
+ void WillWriteOrder(ULONG nNextOrderMaximumLength);
+
+ void METSetAndPushLineInfo( const LineInfo& rLineInfo );
+ void METPopLineInfo( const LineInfo& rLineInfo );
+ void METBitBlt(Point aPt, Size aSize, const Bitmap & rBitmap);
+ void METBeginArea(BOOL bBoundaryLine);
+ void METEndArea();
+ void METBeginPath(sal_uInt32 nPathId);
+ void METEndPath();
+ void METFillPath(sal_uInt32 nPathId);
+ void METOutlinePath(sal_uInt32 nPathId);
+ void METCloseFigure();
+ void METMove(Point aPt);
+ void METLine(Point aPt1, Point aPt2);
+ void METLine(const Polygon & rPolygon);
+ void METLine(const PolyPolygon & rPolyPolygon);
+ void METLineAtCurPos(Point aPt);
+ void METBox(BOOL bFill, BOOL bBoundary,
+ Rectangle aRect, sal_uInt32 nHAxis, sal_uInt32 nVAxis);
+ void METFullArc(Point aCenter, double fMultiplier);
+ void METPartialArcAtCurPos(Point aCenter, double fMultiplier,
+ double fStartAngle, double fSweepAngle);
+ void METChrStr(Point aPt, String aStr);
+ void METSetArcParams(long nP, long nQ, long nR, long nS);
+ void METSetColor(Color aColor);
+ void METSetBackgroundColor(Color aColor);
+ void METSetMix(RasterOp eROP);
+ void METSetChrCellSize(Size aSize);
+ void METSetChrAngle(short nAngle);
+ void METSetChrSet(BYTE nSet);
+
+ void WriteOrders(const GDIMetaFile * pMTF);
+
+ void WriteObjectEnvironmentGroup(const GDIMetaFile * pMTF);
+
+ void WriteGraphicsObject(const GDIMetaFile * pMTF);
+
+ void WriteResourceGroup(const GDIMetaFile * pMTF);
+
+ void WriteDocument(const GDIMetaFile * pMTF);
+
+public:
+
+ METWriter() {}
+
+ BOOL WriteMET( const GDIMetaFile & rMTF, SvStream & rTargetStream,
+ FilterConfigItem* pConfigItem );
+};
+
+
+//========================== Methoden von METWriter ==========================
+
+void METWriter::MayCallback()
+{
+ if ( xStatusIndicator.is() )
+ {
+ ULONG nPercent;
+ nPercent=((nWrittenBitmaps<<14)+(nActBitmapPercent<<14)/100+nWrittenActions)
+ *100/((nNumberOfBitmaps<<14)+nNumberOfActions);
+
+ if (nPercent>=nLastPercent+3)
+ {
+ nLastPercent = nPercent;
+ if ( nPercent <= 100 )
+ xStatusIndicator->setValue( nPercent );
+ }
+ }
+}
+
+void METWriter::WriteClipRect( const Rectangle& rRect )
+{
+ aGDIClipRect = rRect;
+ sal_uInt32 nPathId = ( rRect.IsEmpty() ) ? 0 : 1;
+ if ( nPathId )
+ {
+ Polygon aPoly( rRect );
+ METBeginPath( nPathId );
+ METLine( aPoly );
+ METEndPath();
+ }
+ WillWriteOrder(8);
+ *pMET << (BYTE)0xb4 << (BYTE)6
+ << (BYTE)0x00 << (BYTE)0 << nPathId;
+}
+
+void METWriter::CountActionsAndBitmaps(const GDIMetaFile * pMTF)
+{
+ const MetaAction* pMA;
+
+ for( ULONG nAction = 0, nActionCount=pMTF->GetActionCount(); nAction < nActionCount; nAction++ )
+ {
+ pMA = pMTF->GetAction(nAction);
+
+ switch (pMA->GetType())
+ {
+ case META_EPS_ACTION :
+ {
+ const GDIMetaFile aGDIMetaFile( ((const MetaEPSAction*)pMA)->GetSubstitute() );
+ INT32 nCount = aGDIMetaFile.GetActionCount();
+ INT32 i;
+ for ( i = 0; i < nCount; i++ )
+ if ( ((const MetaAction*)aGDIMetaFile.GetAction( i ))->GetType() == META_BMPSCALE_ACTION )
+ break;
+ if ( i == nCount)
+ break;
+ }
+ case META_BMP_ACTION:
+ case META_BMPSCALE_ACTION:
+ case META_BMPSCALEPART_ACTION:
+ case META_BMPEX_ACTION:
+ case META_BMPEXSCALE_ACTION:
+ case META_BMPEXSCALEPART_ACTION:
+ nNumberOfBitmaps++;
+ break;
+ }
+ nNumberOfActions++;
+ }
+}
+
+
+void METWriter::WriteBigEndianShort(USHORT nWord)
+{
+ *pMET << ((BYTE)(nWord>>8)) << ((BYTE)(nWord&0x00ff));
+}
+
+
+void METWriter::WriteBigEndianLong(ULONG nLong)
+{
+ WriteBigEndianShort((USHORT)(nLong>>16));
+ WriteBigEndianShort((USHORT)(nLong&0x0000ffff));
+}
+
+
+void METWriter::WritePoint(Point aPt)
+{
+ Point aNewPt = OutputDevice::LogicToLogic( aPt, aPictureMapMode, aTargetMapMode );
+
+ *pMET << (long) ( aNewPt.X() - aPictureRect.Left() )
+ << (long) ( aPictureRect.Bottom() - aNewPt.Y() );
+}
+
+
+void METWriter::WriteFieldIntroducer(USHORT nFieldSize, USHORT nFieldType,
+ BYTE nFlags, USHORT nSegSeqNum)
+{
+ nActualFieldStartPos=pMET->Tell();
+ WriteBigEndianShort(nFieldSize);
+ *pMET << (BYTE)0xd3 << nFieldType << nFlags << nSegSeqNum;
+}
+
+
+void METWriter::UpdateFieldSize()
+{
+ ULONG nPos;
+
+ nPos=pMET->Tell();
+ pMET->Seek(nActualFieldStartPos);
+ WriteBigEndianShort((USHORT)(nPos-nActualFieldStartPos));
+ pMET->Seek(nPos);
+}
+
+
+void METWriter::WriteFieldId(ULONG nId)
+{
+ BYTE nbyte;
+ short i;
+
+ for (i=1; i<=8; i++) {
+ nbyte= '0' + (BYTE)((nId >> (32-i*4)) & 0x0f);
+ *pMET << nbyte;
+ }
+}
+
+
+void METWriter::CreateChrSets(const GDIMetaFile * pMTF)
+{
+ ULONG nAction, nActionCount;
+ const MetaAction * pMA;
+
+ if (bStatus==FALSE)
+ return;
+
+ nActionCount=pMTF->GetActionCount();
+
+ for (nAction=0; nAction<nActionCount; nAction++)
+ {
+ pMA = pMTF->GetAction(nAction);
+
+ switch (pMA->GetType())
+ {
+ case META_FONT_ACTION:
+ {
+ const MetaFontAction* pA = (const MetaFontAction*) pMA;
+ CreateChrSet( pA->GetFont() );
+ }
+ break;
+ }
+ }
+}
+
+
+void METWriter::CreateChrSet(const Font & rFont)
+{
+ METChrSet * pCS;
+
+ if ( FindChrSet( rFont ) == 0 )
+ {
+ pCS = new METChrSet;
+ pCS->pSucc = pChrSetList; pChrSetList=pCS;
+ pCS->nSet = nNextChrSetId++;
+ pCS->aName = rFont.GetName();
+ pCS->eWeight = rFont.GetWeight();
+ }
+}
+
+
+BYTE METWriter::FindChrSet(const Font & rFont)
+{
+ METChrSet* pCS;
+
+ for (pCS=pChrSetList; pCS!=NULL; pCS=pCS->pSucc)
+ {
+ if (pCS->aName==rFont.GetName() && pCS->eWeight==rFont.GetWeight() )
+ return pCS->nSet;
+ }
+
+ return 0;
+}
+
+
+void METWriter::WriteChrSets()
+{
+ USHORT i;
+ char c = 0;
+ METChrSet * pCS;
+ BYTE nbyte;
+
+ for (pCS=pChrSetList; pCS!=NULL; pCS=pCS->pSucc)
+ {
+
+ WriteFieldIntroducer(0x58,MapCodFntMagic,0,0);
+
+ WriteBigEndianShort(0x0050);
+
+ *pMET << (BYTE)0x0c << (BYTE)0x02 << (BYTE)0x84 << (BYTE)0x00;
+ *pMET << (BYTE)0xa4 << (BYTE)0x00 << (BYTE)0x00 << (BYTE)0x01;
+ *pMET << (BYTE)0x01 << (BYTE)0x00 << (BYTE)0x00 << (BYTE)0x00;
+
+ *pMET << (BYTE)0x04 << (BYTE)0x24 << (BYTE)0x05 << (BYTE)pCS->nSet;
+
+ *pMET << (BYTE)0x14 << (BYTE)0x1f;
+ switch (pCS->eWeight)
+ {
+ case WEIGHT_THIN: nbyte=1; break;
+ case WEIGHT_ULTRALIGHT: nbyte=2; break;
+ case WEIGHT_LIGHT: nbyte=3; break;
+ case WEIGHT_SEMILIGHT: nbyte=4; break;
+ case WEIGHT_NORMAL: nbyte=5; break;
+ case WEIGHT_SEMIBOLD: nbyte=6; break;
+ case WEIGHT_BOLD: nbyte=7; break;
+ case WEIGHT_ULTRABOLD: nbyte=8; break;
+ case WEIGHT_BLACK: nbyte=9; break;
+ default: nbyte=5;
+ }
+ *pMET << nbyte;
+ *pMET << (BYTE)0x05;
+ *pMET << (BYTE)0x00 << (BYTE)0x00 << (BYTE)0x00 << (BYTE)0x00;
+ *pMET << (BYTE)0x00 << (BYTE)0x00 << (BYTE)0x00 << (BYTE)0x00;
+ *pMET << (BYTE)0x00 << (BYTE)0x00 << (BYTE)0x00 << (BYTE)0x00;
+ *pMET << (BYTE)0x00 << (BYTE)0x00 << (BYTE)0x00 << (BYTE)0x0c;
+
+ *pMET << (BYTE)0x06 << (BYTE)0x20 << (BYTE)0x03 << (BYTE)0xd4;
+ *pMET << (BYTE)0x03 << (BYTE)0x52;
+
+ *pMET << (BYTE)0x24 << (BYTE)0x02 << (BYTE)0x08 << (BYTE)0x00;
+ ByteString n(pCS->aName, gsl_getSystemTextEncoding());
+ for (i=0; i<32; i++)
+ {
+ if ( i == 0 || c != 0 )
+ c = n.GetChar( i );
+ *pMET << c;
+ }
+ }
+}
+
+
+void METWriter::WriteColorAttributeTable(ULONG nFieldId, BitmapPalette* pPalette, BYTE nBasePartFlags, BYTE nBasePartLCTID)
+{
+ USHORT nIndex,nNumI,i;
+
+ if (bStatus==FALSE) return;
+
+ //--- Das Feld 'Begin Color Attribute Table':
+ WriteFieldIntroducer(16,BegColAtrMagic,0,0);
+ WriteFieldId(nFieldId);
+
+ //--- Das Feld 'Color Attribute Table':
+ WriteFieldIntroducer(0,BlkColAtrMagic,0,0);
+ *pMET << nBasePartFlags << (BYTE)0x00 << nBasePartLCTID; // 'Base Part'
+ if (pPalette!=NULL)
+ {
+ nIndex=0;
+ while (nIndex<pPalette->GetEntryCount())
+ {
+ nNumI=pPalette->GetEntryCount()-nIndex;
+ if (nNumI>81) nNumI=81;
+ *pMET << (BYTE)(11+nNumI*3); // Laenge des Parameters
+ *pMET << (BYTE)1 << (BYTE)0 << (BYTE)1; // typ: element list, Reserved, Format: RGB
+ *pMET << (BYTE)0; WriteBigEndianShort(nIndex); // Start-Index (3 Bytes)
+ *pMET << (BYTE)8 << (BYTE)8 << (BYTE)8; // Bits je Komponente R,G,B
+ *pMET << (BYTE)3; // Anzahl Bytes je Eintrag
+ for (i=0; i<nNumI; i++)
+ {
+ const BitmapColor& rCol = (*pPalette)[ nIndex ];
+
+ *pMET << (BYTE) rCol.GetRed();
+ *pMET << (BYTE) rCol.GetGreen();
+ *pMET << (BYTE) rCol.GetBlue();
+ nIndex++;
+ }
+ }
+ }
+ else
+ {
+ // 'Trible Generating'
+ *pMET << (BYTE)0x0a << (BYTE)0x02 << (BYTE)0x00 << (BYTE)0x01 << (BYTE)0x00;
+ *pMET << (BYTE)0x00 << (BYTE)0x00 << (BYTE)0x08 << (BYTE)0x08 << (BYTE)0x08;
+ }
+ UpdateFieldSize();
+
+ //--- Das Feld 'End Color Attribute Table':
+ WriteFieldIntroducer(16,EndColAtrMagic,0,0);
+ WriteFieldId(nFieldId);
+
+ if (pMET->GetError())
+ bStatus=FALSE;
+}
+
+
+void METWriter::WriteImageObject(const Bitmap & rBitmap)
+{
+ SvMemoryStream aTemp(0x00010000,0x00010000);
+ sal_uInt32 nWidth,nHeight,nResX,nResY;
+ ULONG nBytesPerLine,i,j,nNumColors,ny,nLines;
+ ULONG nActColMapId;
+ USHORT nBitsPerPixel;
+ BYTE nbyte, * pBuf;
+
+ if (bStatus==FALSE)
+ return;
+
+ nActColMapId=((nActBitmapId>>24)&0x000000ff) | ((nActBitmapId>> 8)&0x0000ff00) |
+ ((nActBitmapId<< 8)&0x00ff0000) | ((nActBitmapId<<24)&0xff000000);
+
+ //--- Das Feld 'Begin Image Object':
+ WriteFieldIntroducer(16,BegImgObjMagic,0,0);
+ WriteFieldId(nActBitmapId);
+
+ // Windows-BMP-Datei erzeugen:
+ aTemp << rBitmap;
+
+ // Header der Windows-BMP-Datei einlesen:
+ aTemp.SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN);
+ aTemp.Seek(18);
+ aTemp >> nWidth >> nHeight;
+ aTemp.SeekRel(2);
+ aTemp >> nBitsPerPixel;
+ aTemp.SeekRel(8);
+ aTemp >> nResX >> nResY;
+ aTemp.SeekRel(8);
+
+ nNumColors=1<<nBitsPerPixel;
+ nBytesPerLine=((nWidth*nBitsPerPixel+0x0000001f) & 0xffffffe0 ) >> 3;
+
+ // ggf. Farbpalette einlesen und in die MET-Datei schreiben:
+ if (nBitsPerPixel<=8)
+ {
+ BitmapPalette aPal( (USHORT) nNumColors );
+ BYTE nr,ng,nb;
+
+ for (i=0; i<nNumColors; i++)
+ {
+ aTemp >> nb >> ng >> nr; aTemp.SeekRel(1);
+ aPal[ (USHORT) i ] = BitmapColor( nr, ng, nb );
+ }
+
+ //--- Das Feld 'Begin Resource Group':
+ WriteFieldIntroducer(16,BegResGrpMagic,0,0);
+ WriteFieldId(nActColMapId);
+
+ //--- Farbtabelle schreiben:
+ WriteColorAttributeTable(nActColMapId,&aPal,0,1);
+
+ //--- Das Feld 'End Resource Group':
+ WriteFieldIntroducer(16,EndResGrpMagic,0,0);
+ WriteFieldId(nActColMapId);
+
+ //--- Das Feld 'Begin Object Environment Group':
+ WriteFieldIntroducer(16,BegObjEnvMagic,0,0);
+ WriteFieldId(nActBitmapId);
+
+ //--- Das Feld 'Map Color Attribute Table':
+ WriteFieldIntroducer(26,MapColAtrMagic,0,0);
+ WriteBigEndianShort(0x0012);
+ *pMET << (BYTE)0x0c << (BYTE)0x02 << (BYTE)0x84 << (BYTE)0x00;
+ WriteFieldId(nActColMapId);
+ *pMET << (BYTE)0x04 << (BYTE)0x24 << (BYTE)0x07 << (BYTE)0x01;
+
+ //--- Das Feld 'End Object Environment Group':
+ WriteFieldIntroducer(16,EndObjEnvMagic,0,0);
+ WriteFieldId(nActBitmapId);
+ }
+
+ //--- Das Feld 'Image Data Descriptor':
+ WriteFieldIntroducer(17,DscImgObjMagic,0,0);
+ *pMET << (BYTE)0x01; // Unit of measure: tens of centimeters
+ WriteBigEndianShort((USHORT)nResX);
+ WriteBigEndianShort((USHORT)nResY);
+ WriteBigEndianShort((USHORT)nWidth);
+ WriteBigEndianShort((USHORT)nHeight);
+
+ //--- Das erste Feld 'Image Picture Data':
+ WriteFieldIntroducer(0,DatImgObjMagic,0,0);
+
+ // Begin Segment:
+ *pMET << (BYTE)0x70 << (BYTE)0x00;
+
+ // Begin Image Content:
+ *pMET << (BYTE)0x91 << (BYTE)0x01 << (BYTE)0xff;
+
+ // Image Size:
+ *pMET << (BYTE)0x94 << (BYTE)0x09 << (BYTE)0x02;
+ *pMET << (USHORT) 0 << (USHORT) 0;
+ WriteBigEndianShort((USHORT)nHeight);
+ WriteBigEndianShort((USHORT)nWidth);
+
+ // Image Encoding:
+ *pMET << (BYTE)0x95 << (BYTE)0x02 << (BYTE)0x03 << (BYTE)0x03;
+
+ // Image IDE-Size:
+ *pMET << (BYTE)0x96 << (BYTE)0x01 << (BYTE)nBitsPerPixel;
+
+ if (nBitsPerPixel<=8) {
+ // Image LUT-ID
+ *pMET << (BYTE)0x97 << (BYTE)0x01 << (BYTE)0x01;
+ }
+ else {
+ // IDE Structure
+ *pMET << (BYTE)0x9b << (BYTE)0x08 << (BYTE)0x00 << (BYTE)0x01;
+ *pMET << (BYTE)0x00 << (BYTE)0x00 << (BYTE)0x00 << (BYTE)0x08;
+ *pMET << (BYTE)0x08 << (BYTE)0x08;
+ }
+
+ pBuf=new BYTE[nBytesPerLine];
+ ny=0;
+ while (ny<nHeight) {
+
+ // Abschliessen des vorherigen Feldes 'Image Picture Data':
+ UpdateFieldSize();
+
+ // Und ein neues Feld 'Image Picture Data' anfangen:
+ WriteFieldIntroducer(0,DatImgObjMagic,0,0);
+
+ // Einige Scanlines lesen und schreiben:
+ nLines=nHeight-ny;
+ if (nLines*nBytesPerLine>30000) nLines=30000/nBytesPerLine;
+ if (nLines<1) nLines=1;
+ WriteBigEndianShort(0xfe92);
+ WriteBigEndianShort((USHORT)(nLines*nBytesPerLine));
+ for (i=0; i<nLines; i++) {
+ aTemp.Read(pBuf,nBytesPerLine);
+ if (nBitsPerPixel==24) {
+ for (j=2; j<nBytesPerLine; j+=3) {
+ nbyte=pBuf[j]; pBuf[j]=pBuf[j-2]; pBuf[j-2]=nbyte;
+ }
+ }
+ pMET->Write(pBuf,nBytesPerLine);
+ ny++;
+ }
+ if (aTemp.GetError() || pMET->GetError()) bStatus=FALSE;
+ nActBitmapPercent=(ny+1)*100/nHeight;
+ MayCallback();
+ if (bStatus==FALSE) { delete[] pBuf; return; }
+ }
+ delete[] pBuf;
+
+ // End Image Content:
+ *pMET << (BYTE)0x93 << (BYTE)0x00;
+
+ // End Segment:
+ *pMET << (BYTE)0x71 << (BYTE)0x00;
+
+ // Abschliessen des letzten Feldes 'Image Picture Data':
+ UpdateFieldSize();
+
+ //--- Das Feld 'End Image Object':
+ WriteFieldIntroducer(16,EndImgObjMagic,0,0);
+ WriteFieldId(nActBitmapId);
+
+ // Ids erhoehen:
+ nActBitmapId++;
+
+ // Bitmaps zaehlen:
+ nWrittenBitmaps++;
+ nActBitmapPercent=0;
+
+ if (pMET->GetError()) bStatus=FALSE;
+}
+
+
+void METWriter::WriteImageObjects(const GDIMetaFile * pMTF)
+{
+ const MetaAction* pMA;
+
+ if (bStatus==FALSE)
+ return;
+
+ for ( ULONG nAction = 0, nActionCount = pMTF->GetActionCount(); nAction < nActionCount; nAction++)
+ {
+ pMA = pMTF->GetAction(nAction);
+
+ switch (pMA->GetType())
+ {
+ case META_BMP_ACTION:
+ {
+ METSetMix( eGDIRasterOp );
+ WriteImageObject( ( (MetaBmpAction*) pMA )->GetBitmap() );
+ }
+ break;
+
+ case META_BMPSCALE_ACTION:
+ {
+ METSetMix( eGDIRasterOp );
+ WriteImageObject( ( (MetaBmpScaleAction*) pMA )->GetBitmap() );
+ }
+ break;
+
+ case META_BMPSCALEPART_ACTION:
+ {
+ METSetMix( eGDIRasterOp );
+ WriteImageObject( ( (MetaBmpScalePartAction*) pMA )->GetBitmap() );
+ }
+ break;
+
+ case META_BMPEX_ACTION:
+ {
+ METSetMix( eGDIRasterOp );
+ WriteImageObject( Graphic( ( (MetaBmpExAction*) pMA )->GetBitmapEx() ).GetBitmap() );
+ }
+ break;
+
+ case META_BMPEXSCALE_ACTION:
+ {
+ METSetMix( eGDIRasterOp );
+ WriteImageObject( Graphic( ( (MetaBmpExScaleAction*) pMA )->GetBitmapEx() ).GetBitmap() );
+ }
+ break;
+
+ case META_BMPEXSCALEPART_ACTION:
+ {
+ METSetMix( eGDIRasterOp );
+ WriteImageObject( Graphic( ( (MetaBmpExScalePartAction*) pMA )->GetBitmapEx() ).GetBitmap() );
+ }
+ break;
+
+ case META_EPS_ACTION :
+ {
+ const MetaEPSAction* pA = (const MetaEPSAction*)pMA;
+ const GDIMetaFile aGDIMetaFile( pA->GetSubstitute() );
+
+ INT32 nCount = aGDIMetaFile.GetActionCount();
+ for ( INT32 i = 0; i < nCount; i++ )
+ {
+ const MetaAction* pMetaAct = aGDIMetaFile.GetAction( i );
+ if ( pMetaAct->GetType() == META_BMPSCALE_ACTION )
+ {
+ const MetaBmpScaleAction* pBmpScaleAction = (const MetaBmpScaleAction*)pMetaAct;
+ METSetMix( eGDIRasterOp );
+ WriteImageObject( pBmpScaleAction->GetBitmap() );
+ break;
+ }
+ }
+ }
+ break;
+ }
+
+ if (bStatus==FALSE)
+ break;
+ }
+
+ if (pMET->GetError())
+ bStatus=FALSE;
+}
+
+void METWriter::WriteDataDescriptor(const GDIMetaFile *)
+{
+ if (bStatus==FALSE)
+ return;
+
+ WriteFieldIntroducer(0,DscGrfObjMagic,0,0);
+
+ //------------------------------------------------------------------------------
+ // Im Folgenden die OS2-Orginal-Dokumentation und die Implementation dazu (uff)
+ //------------------------------------------------------------------------------
+
+ // Parameters (all required and in this order)
+
+ // 0 0xF7 Specify GVM Subset
+ // 1 Length of following data 0x07
+ // 2 0xB0 drawing order subset
+ // 3-4 0x0000
+ // 5 0x23 Level 3.2
+ // 6 0x01 Version 1
+ // 7 Length of following field 0x01
+ // 8 Coordinate types in data
+ // 0x04Intel16
+ // 0x05Intel32
+ *pMET << (BYTE)0xf7 << (BYTE)0x07 << (BYTE)0xb0 << (BYTE)0x00
+ << (BYTE)0x00 << (BYTE)0x23 << (BYTE)0x01 << (BYTE)0x01
+ << (BYTE)0x05;
+
+ // 0 0xF6 Set Picture Descriptor
+ // 1 Length of following data
+ // 2 Flags
+ // 0 B'0' Picture in 2D
+ // 1 Picture Dimensions
+ // B'0' Not absolute (PU_ARBITRARY PS)
+ // B'1' Absolute (example: PU_TWIPS PS)
+ // 2 Picture Elements
+ // B'0' Not pels
+ // B'1' Pels (PU_PELS PS)
+ // (Bit 1 must also be set)
+ // 3-7 B'00000'
+ // 3 0x00 Reserved
+ // 4 Picture frame size coordinate type
+ // 0x04 Intel16
+ // 0x05 Intel32
+ // 5 UnitsOfMeasure
+ // 0x00 Ten inches
+ // 0x01 Decimeter
+ // 6-11 or 6-17(2 or 4 bytes) Resolution.
+ // GPS Units / UOM on x axis
+ // GPS Units / UOM on y axis
+ // GPS Units / UOM on z axis
+ // 12-23 or 18-41(2 or 4 bytes) Window Size.
+ // GPS X left, X right
+ // GPS Y bottom, Y top
+ // GPS Z near, Z far
+ Size aUnitsPerDecimeter=OutputDevice::LogicToLogic(Size(10,10),MapMode(MAP_CM),aPictureMapMode);
+ *pMET << (BYTE)0xf6 << (BYTE)0x28 << (BYTE)0x40 << (BYTE)0x00
+ << (BYTE)0x05 << (BYTE)0x01
+ << (sal_uInt32)(aUnitsPerDecimeter.Width())
+ << (sal_uInt32)(aUnitsPerDecimeter.Height())
+ << (sal_uInt32)0
+ << (sal_uInt32)0 << (sal_uInt32)aPictureRect.GetWidth()
+ << (sal_uInt32)0 << (sal_uInt32)aPictureRect.GetHeight()
+ << (sal_uInt32)0 << (sal_uInt32)0;
+
+ // 0 0x21 Set Current Defaults
+ // 1 Length of following data
+ // 2 Set Default Parameter Format 0x08
+ // 3-4 Mask 0xE000
+ // 5 Names 0x8F
+ // 6 Coordinates
+ // 0x00 Picture in 2D
+ // 7 Transforms
+ // 0x04 Intel16
+ // 0x05 Intel32
+ // 8 Geometrics
+ // 0x04 Intel16
+ // 0x05 Intel32
+ *pMET << (BYTE)0x21 << (BYTE)0x07 << (BYTE)0x08 << (BYTE)0xe0
+ << (BYTE)0x00 << (BYTE)0x8f << (BYTE)0x00 << (BYTE)0x05
+ << (BYTE)0x05;
+
+ // 0 0x21 Set Current Defaults
+ // 1 Length of following data
+ // 2 Set default viewing transform 0x07
+ // 3-4 Mask 0xCC0C
+ // 5 Names 0x8F
+ // 6-n M11, M12, M21, M22, M41, M42 Matrix elements
+ *pMET << (BYTE)0x21 << (BYTE)0x1c << (BYTE)0x07 << (BYTE)0xcc
+ << (BYTE)0x0c << (BYTE)0x8f
+ << (sal_uInt32)0x00010000 << (sal_uInt32)0x00000000 << (sal_uInt32)0x00000000
+ << (sal_uInt32)0x00010000 << (sal_uInt32)0x00000000 << (sal_uInt32)0x00000000;
+
+ // 0 0x21 Set Current Defaults
+ // 1 Length of following data
+ // 2 Set default line attributes 0x01
+ // 3-4 Mask - OR of as many of the following bits as are required:
+ // 0x8000 Line type
+ // 0x4000 Line width
+ // 0x2000 Line end
+ // 0x1000 Line join
+ // 0x0800 Stroke width
+ // 0x0008 Line color
+ // 0x0002 Line mix
+ // 5 Flags
+ //
+ // 0x0F Set indicated default attributes to initial values. (Data field is not present in this
+ // instance).
+ // 0x8F Set indicated default attributes to specified values.
+ // 6-n Data - data values as required, in the following order if present.
+ // No space is reserved for attributes for which the corresponding mask flag was not
+ // set.
+ //
+ // (1 byte) - Line type
+ // (1 byte) - Line width
+ // (1 byte) - Line end
+ // (1 byte) - Line join
+ // (G bytes) - Stroke width
+ // (4 bytes) - Line color
+ // (1 byte) - Line mix (G=2 or 4 depending on the Geometrics parameter of Set Default
+ // Parameter Format)
+ // Nanu! witziger-weise fehlt obiger Abschnitt in den Metadateien. Also lassen wir ihn auch weg
+
+ // 0 0x21 Set Current Defaults
+ // 1 Length of following data
+ // 2 Set Default Character Attributes 0x02
+ // 3-4 Mask - OR of as many of the following bits as are required:
+ //
+ // 0x8000 Character angle
+ // 0x4000 Character box
+ // 0x2000 Character direction
+ // 0x1000 Character precision
+ // 0x0800 Character set
+ // 0x0400 Character shear
+ // 0x0040 Character break extra
+ // 0x0020 Character extra
+ // 0x0008 Character color
+ // 0x0004 Character background color
+ // 0x0002 Character mix
+ // 0x0001 Character background mix
+ // 5 Flags
+ // 0x0FSet indicated default attributes to initial values. (Data field is not present in this
+ // case).
+ // 0x8FSet indicated default attributes to specified values.
+ // 6-n Data - data values as required, in the following order if present.
+ // No space is reserved for attributes for which the corresponding Mask flag was not
+ // set.
+ // (2*G bytes) - Character angle
+ // (2*G + 4 bytes)- Character box
+ // (1 byte) - Character direction
+ // (1 byte) - Character precision
+ // (1 byte) - Character set
+ // (2*G bytes) - Character shear
+ // (4 bytes) - Character break extra
+ // (4 bytes) - Character extra
+ // (4 bytes) - Character color
+ // (4 bytes) - Character background color
+ // (1 byte) - Character mix
+ // (1 byte) - Character background mix (G=2 or 4 depending on the Geometrics
+ // parameter of Set Default Parameter Format)
+ *pMET << (BYTE)0x21 << (BYTE)0x10 << (BYTE)0x02 << (BYTE)0x40
+ << (BYTE)0x00 << (BYTE)0x8f
+ << (BYTE)0xaa << (BYTE)0x02 << (BYTE)0x00 << (BYTE)0x00
+ << (BYTE)0x44 << (BYTE)0x04 << (BYTE)0x00 << (BYTE)0x00
+ << (BYTE)0xa8 << (BYTE)0xaa << (BYTE)0x40 << (BYTE)0x44;
+
+ // 0 0x21 Set Current Defaults
+ // 1 Length of following data
+ // 2 Set Default Marker Attributes 0x03
+ // 3-4 Mask - OR of as many of the following bits as are required:
+ // 0x4000 Marker box
+ // 0x1000 Marker precision
+ // 0x0800 Marker set
+ // 0x0100 Marker symbol
+ // 0x0008 Marker color
+ // 0x0004 Marker background color
+ // 0x0002 Marker mix
+ // 0x0001 Marker background mix
+ // 5 Flags
+ // 0x0F Set indicated default attributes to initial values.
+ // (Data field is not present in this instance)
+ // 0x8F Set indicated default attributes to specified values.
+ // 6-n Data - data values as required, in this order if present.
+ // No space is reserved for attributes for which the corresponding Mask flag was not
+ // set.
+ // (2*G bytes) - Marker box
+ // (1 byte) - Marker precision
+ // (1 byte) - Marker set
+ // (1 byte) - Marker symbol
+ // (4 bytes) - Marker color
+ // (4 bytes) - Marker background color
+ // (1 byte) - Marker mix
+ // (1 byte) - Marker background mix (G=2 or 4 depending on the Geometrics
+ // parameter of Set Default Parameter Format)
+ *pMET << (BYTE)0x21 << (BYTE)0x0c << (BYTE)0x03 << (BYTE)0x40
+ << (BYTE)0x00 << (BYTE)0x8f
+ << (BYTE)0x66 << (BYTE)0x02 << (BYTE)0x00 << (BYTE)0x00
+ << (BYTE)0x66 << (BYTE)0x02 << (BYTE)0x00 << (BYTE)0x00;
+
+ // 0 0x21 Set Current Defaults
+ // 1 Length of following data
+ // 2 Set Default Pattern Attributes 0x04
+ // 3-4 Mask - OR of as many of the following bits as are required:
+ // 0x0800 Pattern set
+ // 0x0100 Pattern symbol
+ // 0x0080 Pattern reference point
+ // 0x0008 Pattern color
+ // 0x0004 Pattern background color
+ // 0x0002 Pattern mix
+ // 0x0001 Pattern background mix
+ // 5 Flags
+ //
+ // 0x0F Set indicated default attributes to initial values.
+ // (Data field is not present in this instance)
+ // 0x8F Set indicated default attributes to specified values.
+ // 6-n Data - data values as required, in this order if present.
+ // No space is reserved for attributes for which the corresponding Mask flag was
+ // not set.
+ //
+ // (1 byte) - Pattern set
+ // (1 byte) - Pattern symbol
+ // (2*G bytes) - Pattern reference point
+ // (4 bytes) - Pattern color
+ // (4 bytes) - Pattern background color
+ // (1 byte) - Pattern mix
+ // (1 byte) - Pattern background mix (G=2 or 4 depending on the Geometrics
+ // parameter of Set Default Parameter Format)
+ // 0 0x21 Set Current Defaults
+ // 1 Length of following data
+ // 2 Set Default Image Attributes 0x06
+ // 3-4 Mask - OR of as many of these bits as are required:
+ // 0x0008 Image color
+ // 0x0004 Image background color
+ // 0x0002 Image mix
+ // 0x0001 Image background mix
+ // 5 Flags
+ // 0x0F Set indicated default attributes to initial values. (Data field is not present in
+ // this instance)
+ // 0x8F Set indicated default attributes to specified values.
+ // 6-n Data - data values as required, in this order if present.
+ // No space is reserved for attributes for which the corresponding Mask flag was
+ // not set.
+ // (4 bytes) - Image color
+ // (4 bytes) - Image background color
+ // (1 byte) - Image mix
+ // (1 byte) - Image background mix
+ // 0 0x21 Set Current Defaults
+ // 1 Length of following data
+ // 2 Set Default Viewing Window 0x05
+ // 3-4 Mask - OR of as many of the following bits as are required:
+ // 0x8000 x left limit
+ // 0x4000 x right limit
+ // 0x2000 y bottom limit
+ // 0x1000 y top limit
+ // 5 Flags
+ // 0x0F Set indicated default attributes to initial values.
+ // (Data field is not present in this case).
+ // 0x8F Set indicated default attributes to specified values.
+ // 6-n Data - data values as required, in the following order if present.
+ // No space is reserved for attributes for which the corresponding Mask flag was
+ // not set.
+ // (2*G bytes) - x left limit
+ // (2*G bytes) - x right limit
+ // (2*G bytes) - y bottom limit
+ // (2*G bytes) - y top limit (G=2 or 4 depending on the Geometrics parameter of Set
+ // Default Parameter Format)
+ // 0 0x21 Set Current Defaults
+ // 1 Length of following data
+ // 2 Set Default Arc Parameters 0x0B
+ // 3-4 Mask - OR of as many of the following bits as are required:
+ // 0x8000 P value
+ // 0x4000 Q value
+ // 0x2000 R value
+ // 0x1000 S value
+ // 5 Flags
+ // 0x0F Set indicated default attributes to initial values.
+ // (Data field is not present in this case).
+ // 0x8F Set indicated default attributes to specified values.
+ // 6-n Data - data values as required, in the following order if present.
+ // No space is reserved for attributes for which the corresponding Mask flag was
+ // not set.
+ // (G bytes) - P value
+ // (G bytes) - Q value
+ // (G bytes) - R value
+ // (G bytes) - S value (G=2 or 4 depending on the Geometrics parameter of Set
+ // Default Parameter Format)
+ // 0 0x21 Set Current Defaults
+ // 1 Length of following data
+ // 2 Set Default Pick Identifier 0x0C
+ // 3-4 Mask - OR of as many of the following bits as are required:
+ // 0x8000 Pick identifier
+ // 5 Flags
+ // 0x0F Set indicated default attributes to initial values.
+ // (Data field is not present in this case).
+ // 0x8F Set indicated default attributes to specified values.
+ // 6-n Data - data values as required, in the following order if present.
+ // No space is reserved for attributes for which the corresponding Mask flag was
+ // not set.
+ // (4 bytes) - Pick identifier
+
+ // 0 0xE7 Set Bit-map Identifier
+ // 1 Length of following data 0x07
+ // 2-3 Usage Flags 0x8000
+ // 4-7 Bit-map handle
+ // 8 Lcid
+ if (nNumberOfBitmaps>0) {
+ *pMET << (BYTE)0xe7 << (BYTE)0x07 << (BYTE)0x80 << (BYTE)0x00;
+ WriteBigEndianLong(nActBitmapId);
+ *pMET << (BYTE)0xfe;
+ }
+
+ UpdateFieldSize();
+
+ if (pMET->GetError()) bStatus=FALSE;
+}
+
+
+void METWriter::WillWriteOrder(ULONG nNextOrderMaximumLength)
+{
+ // Die Parameter eines 'Graphics Data Fields' duerfen (laut OS2-Doku)
+ // hoechstens 32759 Bytes umfassen. Gemeint ist die Laenge des Feldes minus
+ // dem 'Structured Field Introducer' (groesse: 8). Also darf die Groesse
+ // des ganzen Fields hoechstens 8+32759=32767=0x7fff sein.
+ // Zur Sicherheit nehmen wir lieber 30000 als Grenze.
+
+ if (pMET->Tell()-nActualFieldStartPos+nNextOrderMaximumLength>30000)
+ {
+ UpdateFieldSize();
+ WriteFieldIntroducer(0,DatGrfObjMagic,0,0);
+ nNumberOfDataFields++;
+ }
+}
+
+
+
+void METWriter::METBitBlt(Point aPt, Size aSize, const Bitmap & rBitmap)
+{
+ WillWriteOrder(46);
+ *pMET << (BYTE)0xd6 << (BYTE)44 << (USHORT)0 << (USHORT) 0x00cc;
+ WriteBigEndianLong(nActBitmapId++);
+ *pMET << (BYTE)0x02 << (BYTE)0x00 << (BYTE)0x00 << (BYTE)0x00;
+ WritePoint(Point(aPt.X(),aPt.Y()+aSize.Height()));
+ WritePoint(Point(aPt.X()+aSize.Width(),aPt.Y()));
+ *pMET << (sal_uInt32)0 << (sal_uInt32)0
+ << (sal_uInt32)(rBitmap.GetSizePixel().Width())
+ << (sal_uInt32)(rBitmap.GetSizePixel().Height());
+}
+
+void METWriter::METSetAndPushLineInfo( const LineInfo& rLineInfo )
+{
+ INT32 nWidth = OutputDevice::LogicToLogic( Size( rLineInfo.GetWidth(),0 ), aPictureMapMode, aTargetMapMode ).Width();
+
+ WillWriteOrder( 8 ); // set stroke linewidth
+ *pMET << (BYTE)0x15
+ << (BYTE)6
+ << (BYTE)0 // Flags
+ << (BYTE)0
+ << nWidth;
+
+ if ( rLineInfo.GetStyle() != LINE_SOLID )
+ {
+ BYTE nStyle = 0; // LineDefault;
+
+ switch ( rLineInfo.GetStyle() )
+ {
+ case LINE_NONE :
+ nStyle = 8;
+ break;
+
+ case LINE_DASH :
+ {
+ if ( rLineInfo.GetDotCount() )
+ {
+ if ( !rLineInfo.GetDashCount() )
+ nStyle = 1; // LINE_DOT
+ else
+ nStyle = 3; // LINE_DASH_DOT
+ }
+ else
+ nStyle = 2; // LINE_DASH
+ }
+ break;
+ case LineStyle_SOLID:
+ case LineStyle_FORCE_EQUAL_SIZE:
+ break; // not handled -Wall
+ }
+ WillWriteOrder( 2 );
+ *pMET << (BYTE)0x18 << nStyle; // set LineType
+ }
+}
+
+void METWriter::METPopLineInfo( const LineInfo& rLineInfo )
+{
+ WillWriteOrder( 8 ); // set stroke linewidth
+ *pMET << (BYTE)0x15
+ << (BYTE)6
+ << (BYTE)0 // Flags
+ << (BYTE)0
+ << (UINT32)1;
+
+ if ( rLineInfo.GetStyle() != LINE_SOLID )
+ {
+ WillWriteOrder( 2 );
+ *pMET << (BYTE)0x18 << (BYTE)0; // set LineType
+ }
+}
+
+void METWriter::METBeginArea(BOOL bBoundaryLine)
+{
+ WillWriteOrder(2);
+ *pMET << (BYTE)0x68;
+ if (bBoundaryLine) *pMET << (BYTE)0xc0;
+ else *pMET << (BYTE)0x80;
+}
+
+
+void METWriter::METEndArea()
+{
+ WillWriteOrder(2);
+ *pMET << (BYTE)0x60 << (BYTE)0;
+}
+
+
+void METWriter::METBeginPath(sal_uInt32 nPathId)
+{
+ WillWriteOrder(8);
+ *pMET << (BYTE)0xd0 << (BYTE)6 << (USHORT) 0 << nPathId;
+}
+
+
+void METWriter::METEndPath()
+{
+ WillWriteOrder(2);
+ *pMET << (BYTE)0x7f << (BYTE)0;
+}
+
+
+void METWriter::METFillPath(sal_uInt32 nPathId)
+{
+ WillWriteOrder(8);
+ *pMET << (BYTE)0xd7 << (BYTE)6
+ << (BYTE)0x00 << (BYTE)0 << nPathId;
+}
+
+
+void METWriter::METOutlinePath(sal_uInt32 nPathId)
+{
+ WillWriteOrder(8);
+ *pMET << (BYTE)0xd4 << (BYTE)6
+ << (BYTE)0 << (BYTE)0 << nPathId;
+}
+
+
+void METWriter::METCloseFigure()
+{
+ WillWriteOrder(2);
+ *pMET << (BYTE)0x7d << (BYTE)0;
+}
+
+
+void METWriter::METMove(Point aPt)
+{
+ WillWriteOrder(10);
+ *pMET << (BYTE)0x21 << (BYTE)8;
+ WritePoint(aPt);
+}
+
+
+void METWriter::METLine(Point aPt1, Point aPt2)
+{
+ WillWriteOrder(18);
+ *pMET << (BYTE)0xc1 << (BYTE)16;
+ WritePoint(aPt1); WritePoint(aPt2);
+}
+
+
+void METWriter::METLine(const Polygon & rPolygon)
+{
+ USHORT nNumPoints,i,j,nOrderPoints;
+ BOOL bFirstOrder;
+
+ bFirstOrder=TRUE;
+ i=0; nNumPoints=rPolygon.GetSize();
+ while (i<nNumPoints) {
+ nOrderPoints=nNumPoints-i;
+ if (nOrderPoints>30) nOrderPoints=30;
+ WillWriteOrder(nOrderPoints*8+2);
+ if (bFirstOrder==TRUE) {
+ *pMET << (BYTE)0xc1; // Line at given pos
+ bFirstOrder=FALSE;
+ }
+ else {
+ *pMET << (BYTE)0x81; // Line at current pos
+ }
+ *pMET << (BYTE)(nOrderPoints*8);
+ for (j=0; j<nOrderPoints; j++) WritePoint(rPolygon.GetPoint(i++));
+ }
+}
+
+
+void METWriter::METLine(const PolyPolygon & rPolyPolygon)
+{
+ USHORT i,nCount;
+ nCount=rPolyPolygon.Count();
+ for (i=0; i<nCount; i++) {
+ METLine(rPolyPolygon.GetObject(i));
+ METCloseFigure();
+ }
+}
+
+
+void METWriter::METLineAtCurPos(Point aPt)
+{
+ WillWriteOrder(10);
+ *pMET << (BYTE)0x81 << (BYTE)8;
+ WritePoint(aPt);
+}
+
+
+void METWriter::METBox(BOOL bFill, BOOL bBoundary,
+ Rectangle aRect, sal_uInt32 nHAxis, sal_uInt32 nVAxis)
+{
+ BYTE nFlags=0;
+ if (bFill) nFlags|=0x40;
+ if (bBoundary) nFlags|=0x20;
+
+ WillWriteOrder(28);
+ *pMET << (BYTE)0xc0 << (BYTE)26 << nFlags << (BYTE)0;
+ WritePoint(aRect.BottomLeft());
+ WritePoint(aRect.TopRight());
+ *pMET << nHAxis << nVAxis;
+}
+
+
+void METWriter::METFullArc(Point aCenter, double fMultiplier)
+{
+ WillWriteOrder(14);
+ *pMET << (BYTE)0xc7 << (BYTE)12;
+ WritePoint(aCenter);
+ *pMET << (long)(fMultiplier*65536.0+0.5);
+}
+
+
+void METWriter::METPartialArcAtCurPos(Point aCenter, double fMultiplier,
+ double fStartAngle, double fSweepAngle)
+{
+ fStartAngle*=180.0/3.14159265359;
+ while (fStartAngle>360.0) fStartAngle-=360.0;
+ while (fStartAngle<0.0) fStartAngle+=360.0;
+ fSweepAngle*=180.0/3.14159265359;
+ while (fSweepAngle>360.0) fSweepAngle-=360.0;
+ while (fSweepAngle<.00) fSweepAngle+=360.0;
+ WillWriteOrder(22);
+ *pMET << (BYTE)0xa3 << (BYTE)20;
+ WritePoint(aCenter);
+ *pMET << (long)(fMultiplier*65536.0+0.5);
+ *pMET << (long)(fStartAngle*65536.0+0.5);
+ *pMET << (long)(fSweepAngle*65536.0+0.5);
+}
+
+
+void METWriter::METChrStr( Point aPt, String aUniStr )
+{
+ USHORT nLen,i;
+ ByteString aStr( aUniStr, gsl_getSystemTextEncoding() );
+ nLen = aStr.Len();
+ WillWriteOrder( 11 + nLen );
+ *pMET << (BYTE)0xc3 << (BYTE)( 9 + nLen );
+ WritePoint(aPt);
+ for ( i = 0; i < nLen; i++ )
+ *pMET << aStr.GetChar( i );
+ *pMET << (BYTE)0;
+}
+
+
+void METWriter::METSetArcParams(long nP, long nQ, long nR, long nS)
+{
+ WillWriteOrder(18);
+ *pMET << (BYTE)0x22 << (BYTE)16 << nP << nQ << nR << nS;
+}
+
+
+void METWriter::METSetColor(Color aColor)
+{
+ if (aColor==aMETColor) return;
+ aMETColor=aColor;
+
+ WillWriteOrder(6);
+ *pMET << (BYTE)0xa6 << (BYTE)4 << (BYTE)0
+ << (BYTE)(aColor.GetBlue())
+ << (BYTE)(aColor.GetGreen())
+ << (BYTE)(aColor.GetRed());
+}
+
+
+void METWriter::METSetBackgroundColor(Color aColor)
+{
+ if (aColor==aMETBackgroundColor) return;
+ aMETBackgroundColor=aColor;
+
+ WillWriteOrder(6);
+ *pMET << (BYTE)0xa7 << (BYTE)4 << (BYTE)0
+ << (BYTE)(aColor.GetBlue())
+ << (BYTE)(aColor.GetGreen())
+ << (BYTE)(aColor.GetRed());
+}
+
+void METWriter::METSetMix(RasterOp eROP)
+{
+ BYTE nMix;
+
+ if (eMETMix==eROP)
+ return;
+
+ eMETMix=eROP;
+
+ switch (eROP)
+ {
+ case ROP_INVERT: nMix=0x0c; break;
+ case ROP_XOR: nMix=0x04; break;
+ default: nMix=0x02;
+ }
+
+ WillWriteOrder(2);
+ *pMET << (BYTE)0x0c << nMix;
+}
+
+
+void METWriter::METSetChrCellSize(Size aSize)
+{
+ if (aMETChrCellSize==aSize)
+ return;
+
+ aMETChrCellSize=aSize;
+ WillWriteOrder(10);
+ if (aSize.Width()==0) aSize.Width()=aSize.Height();
+ *pMET << (BYTE)0x33 << (BYTE)8 << (long)aSize.Width() << (long)aSize.Height();
+}
+
+
+void METWriter::METSetChrAngle(short nAngle)
+{
+ double fa;
+ long nax,nay;
+
+ if (nMETChrAngle==nAngle) return;
+ nMETChrAngle=nAngle;
+
+ if (nAngle==0)
+ {
+ nax=256;
+ nay=0;
+ }
+ else
+ {
+ fa=((double)nAngle)/1800.0*3.14159265359;
+ nax=(long)(256.0*cos(fa)+0.5);
+ nay=(long)(256.0*sin(fa)+0.5);
+ }
+
+ WillWriteOrder(10);
+ *pMET << (BYTE)0x34 << (BYTE)8 << nax << nay;
+}
+
+
+void METWriter::METSetChrSet(BYTE nSet)
+{
+ if (nMETChrSet==nSet)
+ return;
+
+ nMETChrSet=nSet;
+ WillWriteOrder(2);
+ *pMET << (BYTE)0x38 << nSet;
+}
+
+
+void METWriter::WriteOrders( const GDIMetaFile* pMTF )
+{
+ if(bStatus==FALSE)
+ return;
+
+ for( ULONG nA = 0, nACount = pMTF->GetActionCount(); nA < nACount; nA++ )
+ {
+ const MetaAction* pMA = pMTF->GetAction( nA );
+
+ switch (pMA->GetType())
+ {
+ case META_PIXEL_ACTION:
+ {
+ const MetaPixelAction* pA = (const MetaPixelAction*) pMA;
+ METSetMix( eGDIRasterOp );
+ METSetColor( pA->GetColor() );
+ METLine( pA->GetPoint(),pA->GetPoint() );
+ }
+ break;
+
+ case META_POINT_ACTION:
+ {
+ const MetaPointAction* pA = (const MetaPointAction*) pMA;
+
+ METSetArcParams(1,1,0,0);
+ METSetMix(eGDIRasterOp);
+ METSetColor(aGDILineColor);
+ METBeginArea(FALSE);
+ METFullArc(pA->GetPoint(),0.5);
+ METEndArea();
+ }
+ break;
+
+ case META_LINE_ACTION:
+ {
+ const MetaLineAction* pA = (const MetaLineAction*) pMA;
+
+ if( aGDILineColor != Color( COL_TRANSPARENT ) )
+ {
+ LineInfo aLineInfo( pA->GetLineInfo() );
+ if ( ! ( aLineInfo.IsDefault() ) )
+ METSetAndPushLineInfo( aLineInfo );
+
+ METSetMix( eGDIRasterOp );
+ METSetColor(aGDILineColor);
+ METBeginPath( 1 );
+ METLine( pA->GetStartPoint(), pA->GetEndPoint() );
+ METEndPath();
+ METOutlinePath( 1 );
+
+ if ( ! ( aLineInfo.IsDefault() ) )
+ METPopLineInfo( aLineInfo );
+ }
+ }
+ break;
+
+ case META_RECT_ACTION:
+ {
+ const MetaRectAction* pA = (const MetaRectAction*) pMA;
+
+ if( aGDIFillColor != Color( COL_TRANSPARENT ) )
+ {
+ METSetMix( eGDIRasterOp );
+ METSetColor( aGDIFillColor );
+ METSetBackgroundColor( aGDIFillColor );
+ METBox( TRUE, FALSE, pA->GetRect(), 0, 0 );
+ }
+
+ if( aGDILineColor != Color( COL_TRANSPARENT ) )
+ {
+ METSetMix( eGDIRasterOp );
+ METSetColor( aGDILineColor );
+ METBox( FALSE, TRUE, pA->GetRect(), 0, 0 );
+ }
+ }
+ break;
+
+ case META_ROUNDRECT_ACTION:
+ {
+ const MetaRoundRectAction* pA = (const MetaRoundRectAction*) pMA;
+
+ if( aGDIFillColor != Color( COL_TRANSPARENT ) )
+ {
+ METSetMix( eGDIRasterOp );
+ METSetColor( aGDIFillColor );
+ METSetBackgroundColor( aGDIFillColor );
+ METBox( TRUE, FALSE, pA->GetRect(), pA->GetHorzRound(), pA->GetVertRound() );
+ }
+
+ if( aGDILineColor != Color( COL_TRANSPARENT ) )
+ {
+ METSetMix( eGDIRasterOp );
+ METSetColor( aGDILineColor );
+ METBox( FALSE, TRUE, pA->GetRect(), pA->GetHorzRound(), pA->GetVertRound() );
+ }
+ }
+ break;
+
+ case META_ELLIPSE_ACTION:
+ {
+ const MetaEllipseAction* pA = (const MetaEllipseAction*) pMA;
+ Point aCenter;
+
+ aCenter.X()=(pA->GetRect().Left()+pA->GetRect().Right())/2;
+ aCenter.Y()=(pA->GetRect().Top()+pA->GetRect().Bottom())/2;
+
+ METSetArcParams(pA->GetRect().GetWidth(), pA->GetRect().GetHeight(),0,0);
+
+ if( aGDIFillColor != Color( COL_TRANSPARENT ) )
+ {
+ METSetMix( eGDIRasterOp );
+ METSetColor( aGDIFillColor );
+ METSetBackgroundColor( aGDIFillColor );
+ METBeginArea(FALSE);
+ METFullArc(aCenter,0.5);
+ METEndArea();
+ }
+
+ if( aGDILineColor != Color( COL_TRANSPARENT ) )
+ {
+ METSetMix( eGDIRasterOp );
+ METSetColor( aGDILineColor );
+ METFullArc( aCenter,0.5 );
+ }
+ }
+ break;
+
+ case META_ARC_ACTION:
+ {
+ const MetaArcAction* pA = (const MetaArcAction*) pMA;
+ Point aStartPos,aCenter;
+ double fdx,fdy,fa1,fa2;
+
+ aCenter.X()=(pA->GetRect().Left()+pA->GetRect().Right())/2;
+ aCenter.Y()=(pA->GetRect().Top()+pA->GetRect().Bottom())/2;
+ fdx=(double)(pA->GetStartPoint().X()-aCenter.X());
+ fdy=(double)(pA->GetStartPoint().Y()-aCenter.Y());
+ fdx*=(double)pA->GetRect().GetHeight();
+ fdy*=(double)pA->GetRect().GetWidth();
+ if (fdx==0.0 && fdy==0.0) fdx=1.0;
+ fa1=atan2(-fdy,fdx);
+ fdx=(double)(pA->GetEndPoint().X()-aCenter.X());
+ fdy=(double)(pA->GetEndPoint().Y()-aCenter.Y());
+ fdx*=(double)pA->GetRect().GetHeight();
+ fdy*=(double)pA->GetRect().GetWidth();
+ if (fdx==0.0 && fdy==0.0) fdx=1.0;
+ fa2=atan2(-fdy,fdx);
+ aStartPos.X()=aCenter.X()+(long)(((double)pA->GetRect().GetWidth())*cos(fa1)/2.0+0.5);
+ aStartPos.Y()=aCenter.Y()-(long)(((double)pA->GetRect().GetHeight())*sin(fa1)/2.0+0.5);
+
+ if( aGDILineColor != Color( COL_TRANSPARENT ) )
+ {
+ METSetMix( eGDIRasterOp );
+ METSetColor( aGDILineColor );
+ METSetArcParams(pA->GetRect().GetWidth(), pA->GetRect().GetHeight(),0,0);
+ METBeginPath(1);
+ METMove(aStartPos);
+ METPartialArcAtCurPos(aCenter,0.5,fa1,fa2-fa1);
+ METEndPath();
+ METOutlinePath(1);
+ }
+ }
+ break;
+
+ case META_PIE_ACTION:
+ {
+ const MetaPieAction* pA = (const MetaPieAction*) pMA;
+ Point aCenter;
+ double fdx,fdy,fa1,fa2;
+
+ aCenter.X()=(pA->GetRect().Left()+pA->GetRect().Right())/2;
+ aCenter.Y()=(pA->GetRect().Top()+pA->GetRect().Bottom())/2;
+ fdx=(double)(pA->GetStartPoint().X()-aCenter.X());
+ fdy=(double)(pA->GetStartPoint().Y()-aCenter.Y());
+ fdx*=(double)pA->GetRect().GetHeight();
+ fdy*=(double)pA->GetRect().GetWidth();
+ if (fdx==0.0 && fdy==0.0) fdx=1.0;
+ fa1=atan2(-fdy,fdx);
+ fdx=(double)(pA->GetEndPoint().X()-aCenter.X());
+ fdy=(double)(pA->GetEndPoint().Y()-aCenter.Y());
+ fdx*=(double)pA->GetRect().GetHeight();
+ fdy*=(double)pA->GetRect().GetWidth();
+ if (fdx==0.0 && fdy==0.0) fdx=1.0;
+ fa2=atan2(-fdy,fdx);
+
+ METSetArcParams(pA->GetRect().GetWidth(), pA->GetRect().GetHeight(),0,0);
+
+ if( aGDIFillColor != Color( COL_TRANSPARENT ) )
+ {
+ METSetMix( eGDIRasterOp );
+ METSetColor( aGDIFillColor );
+ METSetBackgroundColor( aGDIFillColor );
+ METBeginPath(1);
+ METMove(aCenter);
+ METPartialArcAtCurPos(aCenter,0.5,fa1,fa2-fa1);
+ METLineAtCurPos(aCenter);
+ METEndPath();
+ METFillPath(1);
+ }
+
+ if( aGDILineColor != Color( COL_TRANSPARENT ) )
+ {
+ METSetMix( eGDIRasterOp );
+ METSetColor( aGDILineColor );
+ METBeginPath(1);
+ METMove(aCenter);
+ METPartialArcAtCurPos(aCenter,0.5,fa1,fa2-fa1);
+ METLineAtCurPos(aCenter);
+ METEndPath();
+ METOutlinePath(1);
+ }
+ }
+ break;
+
+ case META_CHORD_ACTION:
+ {
+ const MetaChordAction* pA = (const MetaChordAction*) pMA;
+ Point aStartPos,aCenter;
+ double fdx,fdy,fa1,fa2;
+
+ aCenter.X()=(pA->GetRect().Left()+pA->GetRect().Right())/2;
+ aCenter.Y()=(pA->GetRect().Top()+pA->GetRect().Bottom())/2;
+ fdx=(double)(pA->GetStartPoint().X()-aCenter.X());
+ fdy=(double)(pA->GetStartPoint().Y()-aCenter.Y());
+ fdx*=(double)pA->GetRect().GetHeight();
+ fdy*=(double)pA->GetRect().GetWidth();
+ if (fdx==0.0 && fdy==0.0) fdx=1.0;
+ fa1=atan2(-fdy,fdx);
+ fdx=(double)(pA->GetEndPoint().X()-aCenter.X());
+ fdy=(double)(pA->GetEndPoint().Y()-aCenter.Y());
+ fdx*=(double)pA->GetRect().GetHeight();
+ fdy*=(double)pA->GetRect().GetWidth();
+ if (fdx==0.0 && fdy==0.0) fdx=1.0;
+ fa2=atan2(-fdy,fdx);
+ aStartPos.X()=aCenter.X()+(long)(((double)pA->GetRect().GetWidth())*cos(fa1)/2.0+0.5);
+ aStartPos.Y()=aCenter.Y()-(long)(((double)pA->GetRect().GetHeight())*sin(fa1)/2.0+0.5);
+
+ if( aGDIFillColor != Color( COL_TRANSPARENT ) )
+ {
+ METSetMix( eGDIRasterOp );
+ METSetColor( aGDIFillColor );
+ METSetBackgroundColor( aGDIFillColor );
+ METBeginPath(1);
+ METMove(aStartPos);
+ METPartialArcAtCurPos(aCenter,0.5,fa1,fa2-fa1);
+ METLineAtCurPos(aStartPos);
+ METEndPath();
+ METFillPath(1);
+ }
+
+ if( aGDILineColor != Color( COL_TRANSPARENT ) )
+ {
+ METSetMix( eGDIRasterOp );
+ METSetColor( aGDILineColor );
+ METBeginPath(1);
+ METMove(aStartPos);
+ METPartialArcAtCurPos(aCenter,0.5,fa1,fa2-fa1);
+ METLineAtCurPos(aStartPos);
+ METEndPath();
+ METOutlinePath(1);
+ }
+ }
+ break;
+
+ case META_POLYLINE_ACTION:
+ {
+ const MetaPolyLineAction* pA = (const MetaPolyLineAction*) pMA;
+
+ if( aGDILineColor != Color( COL_TRANSPARENT ) )
+ {
+ LineInfo aLineInfo( pA->GetLineInfo() );
+ if ( ! ( aLineInfo.IsDefault() ) )
+ METSetAndPushLineInfo( aLineInfo );
+
+ METSetMix(eGDIRasterOp);
+ METSetColor(aGDILineColor);
+ METBeginPath(1);
+ Polygon aSimplePoly;
+ const Polygon& rPoly = pA->GetPolygon();
+ if ( rPoly.HasFlags() )
+ rPoly.AdaptiveSubdivide( aSimplePoly );
+ else
+ aSimplePoly = rPoly;
+ METLine( aSimplePoly );
+ METEndPath();
+ METOutlinePath(1);
+
+ if ( ! ( aLineInfo.IsDefault() ) )
+ METPopLineInfo( aLineInfo );
+ }
+ }
+ break;
+
+ case META_POLYGON_ACTION:
+ {
+ const MetaPolygonAction* pA = (const MetaPolygonAction*) pMA;
+ Polygon aSimplePoly;
+ const Polygon& rPoly = pA->GetPolygon();
+ if ( rPoly.HasFlags() )
+ rPoly.AdaptiveSubdivide( aSimplePoly );
+ else
+ aSimplePoly = rPoly;
+ if( aGDIFillColor != Color( COL_TRANSPARENT ) )
+ {
+ METSetMix(eGDIRasterOp);
+ METSetColor(aGDIFillColor );
+ METSetBackgroundColor(aGDIFillColor );
+ METBeginPath(1);
+ METLine( aSimplePoly );
+ METEndPath();
+ METFillPath(1);
+ }
+
+ if( aGDILineColor != Color( COL_TRANSPARENT ) )
+ {
+ METSetMix(eGDIRasterOp);
+ METSetColor(aGDILineColor );
+ METBeginPath(1);
+ METLine( aSimplePoly );
+ METEndPath();
+ METOutlinePath(1);
+ }
+ }
+ break;
+
+ case META_POLYPOLYGON_ACTION:
+ {
+ const MetaPolyPolygonAction* pA = (const MetaPolyPolygonAction*) pMA;
+
+ PolyPolygon aSimplePolyPoly( pA->GetPolyPolygon() );
+ sal_uInt16 i, nCount = aSimplePolyPoly.Count();
+ for ( i = 0; i < nCount; i++ )
+ {
+ if ( aSimplePolyPoly[ i ].HasFlags() )
+ {
+ Polygon aSimplePoly;
+ aSimplePolyPoly[ i ].AdaptiveSubdivide( aSimplePoly );
+ aSimplePolyPoly[ i ] = aSimplePoly;
+ }
+ }
+ if( aGDIFillColor != Color( COL_TRANSPARENT ) )
+ {
+ METSetMix(eGDIRasterOp);
+ METSetColor(aGDIFillColor);
+ METSetBackgroundColor(aGDIFillColor);
+ METBeginPath(1);
+ METLine( aSimplePolyPoly );
+ METEndPath();
+ METFillPath(1);
+ }
+
+ if( aGDILineColor != Color( COL_TRANSPARENT ) )
+ {
+ METSetMix(eGDIRasterOp);
+ METSetColor(aGDILineColor);
+ METBeginPath(1);
+ METLine( aSimplePolyPoly );
+ METEndPath();
+ METOutlinePath(1);
+ }
+ }
+ break;
+
+ case META_TEXT_ACTION:
+ {
+ const MetaTextAction* pA = (const MetaTextAction*) pMA;
+ Point aPt( pA->GetPoint() );
+
+ if( aGDIFont.GetAlign() != ALIGN_BASELINE)
+ {
+ VirtualDevice aVDev;
+
+ if( aGDIFont.GetAlign()==ALIGN_TOP )
+ aPt.Y()+=(long)aVDev.GetFontMetric( aGDIFont ).GetAscent();
+ else
+ aPt.Y()-=(long)aVDev.GetFontMetric( aGDIFont ).GetDescent();
+ }
+
+ METSetMix(eGDIRasterOp);
+ METSetColor(aGDIFont.GetColor());
+ METSetBackgroundColor(aGDIFont.GetFillColor());
+ METSetChrCellSize(aGDIFont.GetSize());
+ METSetChrAngle(aGDIFont.GetOrientation());
+ METSetChrSet(FindChrSet(aGDIFont));
+ METChrStr(aPt, String(pA->GetText(),pA->GetIndex(),pA->GetLen()));
+ }
+ break;
+
+ case META_TEXTARRAY_ACTION:
+ {
+ const MetaTextArrayAction* pA = (const MetaTextArrayAction*) pMA;
+ USHORT i;
+ String aStr;
+ Polygon aPolyDummy(1);
+ short nOrientation;
+ Point aPt( pA->GetPoint() );
+
+ if( aGDIFont.GetAlign() != ALIGN_BASELINE )
+ {
+ VirtualDevice aVDev;
+ if( aGDIFont.GetAlign() == ALIGN_TOP )
+ aPt.Y()+=(long)aVDev.GetFontMetric(aGDIFont).GetAscent();
+ else
+ aPt.Y()-=(long)aVDev.GetFontMetric(aGDIFont).GetDescent();
+ }
+
+ METSetMix(eGDIRasterOp);
+ METSetColor(aGDIFont.GetColor());
+ METSetBackgroundColor(aGDIFont.GetFillColor());
+ METSetChrCellSize(aGDIFont.GetSize());
+ METSetChrAngle( nOrientation = aGDIFont.GetOrientation() );
+ METSetChrSet(FindChrSet(aGDIFont));
+ aStr=String(pA->GetText(),pA->GetIndex(),pA->GetLen());
+
+ if( pA->GetDXArray()!=NULL )
+ {
+ Point aPt2;
+
+ for( i=0; i < aStr.Len(); i++ )
+ {
+ aPt2 = aPt;
+ if ( i > 0 )
+ {
+ aPt2.X() += pA->GetDXArray()[i-1];
+ if ( nOrientation )
+ {
+ aPolyDummy.SetPoint( aPt2, 0 );
+ aPolyDummy.Rotate( aPt, nOrientation );
+ aPt2 = aPolyDummy.GetPoint( 0 );
+ }
+ }
+ METChrStr( aPt2, String( aStr.GetChar( i ) ) );
+ }
+ }
+ else
+ METChrStr( aPt, aStr );
+ }
+ break;
+
+ case META_STRETCHTEXT_ACTION:
+ {
+ const MetaStretchTextAction* pA = (const MetaStretchTextAction*) pMA;
+ VirtualDevice aVDev;
+ USHORT i;
+ sal_Int32* pDXAry;
+ sal_Int32 nNormSize;
+ String aStr;
+ Polygon aPolyDummy(1);
+ short nOrientation;
+ Point aPt( pA->GetPoint() );
+ Point aPt2;
+
+ aVDev.SetFont( aGDIFont );
+
+ if( aGDIFont.GetAlign() != ALIGN_BASELINE)
+ {
+ if( aGDIFont.GetAlign() == ALIGN_TOP )
+ aPt.Y()+=(long)aVDev.GetFontMetric().GetAscent();
+ else
+ aPt.Y()-=(long)aVDev.GetFontMetric().GetDescent();
+ }
+
+ METSetMix(eGDIRasterOp);
+ METSetColor(aGDIFont.GetColor());
+ METSetBackgroundColor(aGDIFont.GetFillColor());
+ METSetChrCellSize(aGDIFont.GetSize());
+ METSetChrAngle( nOrientation = aGDIFont.GetOrientation() );
+ METSetChrSet(FindChrSet(aGDIFont));
+ aStr=String(pA->GetText(),pA->GetIndex(),pA->GetLen());
+ pDXAry=new sal_Int32[aStr.Len()];
+ nNormSize = aVDev.GetTextArray( aStr, pDXAry );
+
+ for ( i = 0; i < aStr.Len(); i++ )
+ {
+ aPt2 = aPt;
+ if ( i > 0 )
+ {
+ aPt2.X() += pDXAry[i-1]*((long)pA->GetWidth())/ nNormSize;
+ if ( nOrientation )
+ {
+ aPolyDummy.SetPoint( aPt2, 0 );
+ aPolyDummy.Rotate( aPt, nOrientation );
+ aPt2 = aPolyDummy.GetPoint( 0 );
+ }
+ }
+ METChrStr( aPt2, String( aStr.GetChar( i ) ) );
+ }
+
+ delete[] pDXAry;
+ }
+ break;
+
+ case META_TEXTRECT_ACTION:
+ {
+// DBG_ERROR( "Unsupported MET-Action: META_TEXTRECT_ACTION!" );
+ }
+ break;
+
+ case META_BMP_ACTION:
+ {
+ const MetaBmpAction* pA = (const MetaBmpAction*) pMA;
+
+ METSetMix(eGDIRasterOp);
+ METBitBlt( pA->GetPoint(), pA->GetBitmap().GetSizePixel(), pA->GetBitmap() );
+ }
+ break;
+
+ case META_BMPSCALE_ACTION:
+ {
+ const MetaBmpScaleAction* pA = (const MetaBmpScaleAction*) pMA;
+
+ METSetMix(eGDIRasterOp);
+ METBitBlt( pA->GetPoint(), pA->GetSize(), pA->GetBitmap() );
+ }
+ break;
+
+ case META_BMPSCALEPART_ACTION:
+ {
+ const MetaBmpScalePartAction* pA = (const MetaBmpScalePartAction*) pMA;
+ Bitmap aTmp( pA->GetBitmap() );
+
+ aTmp.Crop( Rectangle( pA->GetSrcPoint(), pA->GetSrcSize() ) );
+ METSetMix( eGDIRasterOp );
+ METBitBlt( pA->GetDestPoint(), pA->GetDestSize(), aTmp );
+ }
+ break;
+
+ case META_BMPEX_ACTION:
+ {
+ const MetaBmpExAction* pA = (const MetaBmpExAction*) pMA;
+ Bitmap aTmp( Graphic( pA->GetBitmapEx() ).GetBitmap() );
+
+ METSetMix(eGDIRasterOp);
+ METBitBlt( pA->GetPoint(), aTmp.GetSizePixel(), aTmp );
+ }
+ break;
+
+ case META_BMPEXSCALE_ACTION:
+ {
+ const MetaBmpExScaleAction* pA = (const MetaBmpExScaleAction*) pMA;
+ Bitmap aTmp( Graphic( pA->GetBitmapEx() ).GetBitmap() );
+
+ METSetMix(eGDIRasterOp);
+ METBitBlt( pA->GetPoint(), pA->GetSize(), aTmp );
+ }
+ break;
+
+ case META_BMPEXSCALEPART_ACTION:
+ {
+ const MetaBmpExScalePartAction* pA = (const MetaBmpExScalePartAction*) pMA;
+ Bitmap aTmp( Graphic( pA->GetBitmapEx() ).GetBitmap() );
+
+ aTmp.Crop( Rectangle( pA->GetSrcPoint(), pA->GetSrcSize() ) );
+ METSetMix(eGDIRasterOp);
+ METBitBlt( pA->GetDestPoint(), pA->GetDestSize(), aTmp );
+ }
+ break;
+
+ case META_EPS_ACTION :
+ {
+ const MetaEPSAction* pA = (const MetaEPSAction*)pMA;
+ const GDIMetaFile aGDIMetaFile( pA->GetSubstitute() );
+
+ INT32 nCount = aGDIMetaFile.GetActionCount();
+ for ( INT32 i = 0; i < nCount; i++ )
+ {
+ const MetaAction* pMetaAct = aGDIMetaFile.GetAction( i );
+ if ( pMetaAct->GetType() == META_BMPSCALE_ACTION )
+ {
+ const MetaBmpScaleAction* pBmpScaleAction = (const MetaBmpScaleAction*)pMetaAct;
+ METSetMix(eGDIRasterOp);
+ METBitBlt( pA->GetPoint(), pA->GetSize(), pBmpScaleAction->GetBitmap() );
+ break;
+ }
+ }
+ }
+ break;
+
+ case META_MASK_ACTION:
+ {
+// DBG_ERROR( "Unsupported MET-Action: META_MASK_ACTION!" );
+ }
+ break;
+
+ case META_MASKSCALE_ACTION:
+ {
+// DBG_ERROR( "Unsupported MET-Action: META_MASKSCALE_ACTION!" );
+ }
+ break;
+
+ case META_MASKSCALEPART_ACTION:
+ {
+// DBG_ERROR( "Unsupported MET-Action: META_MASKSCALEPART_ACTION!" );
+ }
+ break;
+
+ case META_GRADIENT_ACTION:
+ {
+ VirtualDevice aVDev;
+ GDIMetaFile aTmpMtf;
+ const MetaGradientAction* pA = (const MetaGradientAction*) pMA;
+
+ aVDev.SetMapMode( aTargetMapMode );
+ aVDev.AddGradientActions( pA->GetRect(), pA->GetGradient(), aTmpMtf );
+ WriteOrders( &aTmpMtf );
+ }
+ break;
+
+ case META_HATCH_ACTION:
+ {
+ VirtualDevice aVDev;
+ GDIMetaFile aTmpMtf;
+ const MetaHatchAction* pA = (const MetaHatchAction*) pMA;
+
+ aVDev.SetMapMode( aTargetMapMode );
+ aVDev.AddHatchActions( pA->GetPolyPolygon(), pA->GetHatch(), aTmpMtf );
+ WriteOrders( &aTmpMtf );
+ }
+ break;
+
+ case META_WALLPAPER_ACTION:
+ {
+// DBG_ERROR( "Unsupported MET-Action: META_WALLPAPER_ACTION!" );
+ }
+ break;
+
+ case META_CLIPREGION_ACTION:
+ {
+// DBG_ERROR( "Unsupported MET-Action: META_CLIPREGION_ACTION!" );
+ }
+ break;
+
+ case META_ISECTRECTCLIPREGION_ACTION:
+ {
+ const MetaISectRectClipRegionAction* pA = (const MetaISectRectClipRegionAction*) pMA;
+ WriteClipRect( pA->GetRect() );
+ }
+ break;
+
+ case META_ISECTREGIONCLIPREGION_ACTION:
+ {
+// DBG_ERROR( "Unsupported MET-Action: META_ISECTREGIONCLIPREGION_ACTION!" );
+ }
+ break;
+
+ case META_MOVECLIPREGION_ACTION:
+ {
+// DBG_ERROR( "Unsupported MET-Action: META_MOVECLIPREGION_ACTION!" );
+ }
+ break;
+
+ case META_LINECOLOR_ACTION:
+ {
+ const MetaLineColorAction* pA = (const MetaLineColorAction*) pMA;
+
+ if( pA->IsSetting() )
+ aGDILineColor = pA->GetColor();
+ else
+ aGDILineColor = Color( COL_TRANSPARENT );
+ }
+ break;
+
+ case META_FILLCOLOR_ACTION:
+ {
+ const MetaFillColorAction* pA = (const MetaFillColorAction*) pMA;
+
+ if( pA->IsSetting() )
+ aGDIFillColor = pA->GetColor();
+ else
+ aGDIFillColor = Color( COL_TRANSPARENT );
+ }
+ break;
+
+ case META_TEXTCOLOR_ACTION:
+ {
+ const MetaTextColorAction* pA = (const MetaTextColorAction*) pMA;
+ aGDIFont.SetColor( pA->GetColor() );
+ }
+ break;
+
+ case META_TEXTFILLCOLOR_ACTION:
+ {
+ const MetaTextFillColorAction* pA = (const MetaTextFillColorAction*) pMA;
+
+ if( pA->IsSetting() )
+ aGDIFont.SetFillColor( pA->GetColor() );
+ else
+ aGDIFont.SetFillColor( Color( COL_TRANSPARENT ) );
+ }
+ break;
+
+ case META_TEXTALIGN_ACTION:
+ {
+// DBG_ERROR( "Unsupported MET-Action: META_TEXTALIGN_ACTION!" );
+ }
+ break;
+
+ case META_MAPMODE_ACTION:
+ {
+ const MetaMapModeAction* pA = (const MetaMapModeAction*) pMA;
+
+ if( aPictureMapMode != pA->GetMapMode() )
+ {
+ if ( pA->GetMapMode().GetMapUnit() == MAP_RELATIVE )
+ {
+ MapMode aMM = pA->GetMapMode();
+ Fraction aScaleX = aMM.GetScaleX();
+ Fraction aScaleY = aMM.GetScaleY();
+
+ Point aOrigin = aPictureMapMode.GetOrigin();
+ BigInt aX( aOrigin.X() );
+ aX *= BigInt( aScaleX.GetDenominator() );
+
+ if( aOrigin.X() >= 0 )
+ {
+ if( aScaleX.GetNumerator() >= 0 )
+ aX += BigInt( aScaleX.GetNumerator()/2 );
+ else
+ aX -= BigInt( (aScaleX.GetNumerator()+1)/2 );
+ }
+ else
+ {
+ if( aScaleX.GetNumerator() >= 0 )
+ aX -= BigInt( (aScaleX.GetNumerator()-1)/2 );
+ else
+ aX += BigInt( aScaleX.GetNumerator()/2 );
+ }
+
+ aX /= BigInt( aScaleX.GetNumerator() );
+ aOrigin.X() = (long) aX + aMM.GetOrigin().X();
+
+ BigInt aY( aOrigin.Y() );
+ aY *= BigInt( aScaleY.GetDenominator() );
+
+ if( aOrigin.Y() >= 0 )
+ {
+ if( aScaleY.GetNumerator() >= 0 )
+ aY += BigInt( aScaleY.GetNumerator()/2 );
+ else
+ aY -= BigInt( (aScaleY.GetNumerator()+1)/2 );
+ }
+ else
+ {
+ if( aScaleY.GetNumerator() >= 0 )
+ aY -= BigInt( (aScaleY.GetNumerator()-1)/2 );
+ else
+ aY += BigInt( aScaleY.GetNumerator()/2 );
+ }
+
+ aY /= BigInt( aScaleY.GetNumerator() );
+ aOrigin.Y() = (long)aY + aMM.GetOrigin().Y();
+ aPictureMapMode.SetOrigin( aOrigin );
+
+ aScaleX *= aPictureMapMode.GetScaleX();
+ aScaleY *= aPictureMapMode.GetScaleY();
+ aPictureMapMode.SetScaleX( aScaleX );
+ aPictureMapMode.SetScaleY( aScaleY );
+ }
+ else
+ aPictureMapMode=pA->GetMapMode();
+ }
+ }
+ break;
+
+ case META_FONT_ACTION:
+ {
+ aGDIFont = ( (const MetaFontAction*) pMA )->GetFont();
+ }
+ break;
+
+ case META_PUSH_ACTION:
+ {
+ METGDIStackMember* pGS = new METGDIStackMember;
+
+ pGS->pSucc=pGDIStack; pGDIStack=pGS;
+ pGS->aLineColor=aGDILineColor;
+ pGS->aFillColor=aGDIFillColor;
+ pGS->eRasterOp=eGDIRasterOp;
+ pGS->aFont=aGDIFont;
+ pGS->aMapMode=aPictureMapMode;
+ pGS->aClipRect=aGDIClipRect;
+ }
+ break;
+
+ case META_POP_ACTION:
+ {
+ METGDIStackMember* pGS;
+
+ if( pGDIStack )
+ {
+ pGS=pGDIStack; pGDIStack=pGS->pSucc;
+ aGDILineColor=pGS->aLineColor;
+ aGDIFillColor=pGS->aFillColor;
+ eGDIRasterOp=pGS->eRasterOp;
+ aGDIFont=pGS->aFont;
+ if ( pGS->aClipRect != aGDIClipRect )
+ WriteClipRect( pGS->aClipRect );
+ aPictureMapMode=pGS->aMapMode;
+ delete pGS;
+ }
+ }
+ break;
+
+ case META_RASTEROP_ACTION:
+ {
+ eGDIRasterOp = ( (const MetaRasterOpAction*) pMA )->GetRasterOp();
+ }
+ break;
+
+ case META_TRANSPARENT_ACTION:
+ {
+ if( aGDIFillColor != Color( COL_TRANSPARENT ) )
+ {
+ METSetMix(eGDIRasterOp);
+ METSetColor(aGDIFillColor);
+ METSetBackgroundColor(aGDIFillColor);
+ METBeginPath(1);
+ METLine(( (const MetaTransparentAction*) pMA )->GetPolyPolygon());
+ METEndPath();
+ METFillPath(1);
+ }
+
+ if( aGDILineColor != Color( COL_TRANSPARENT ) )
+ {
+ METSetMix(eGDIRasterOp);
+ METSetColor(aGDILineColor);
+ METBeginPath(1);
+ METLine(( (const MetaTransparentAction*) pMA )->GetPolyPolygon());
+ METEndPath();
+ METOutlinePath(1);
+ }
+ }
+ break;
+
+ case META_FLOATTRANSPARENT_ACTION:
+ {
+ const MetaFloatTransparentAction* pA = (const MetaFloatTransparentAction*) pMA;
+
+ GDIMetaFile aTmpMtf( pA->GetGDIMetaFile() );
+ Point aSrcPt( aTmpMtf.GetPrefMapMode().GetOrigin() );
+ const Size aSrcSize( aTmpMtf.GetPrefSize() );
+ const Point aDestPt( pA->GetPoint() );
+ const Size aDestSize( pA->GetSize() );
+ const double fScaleX = aSrcSize.Width() ? (double) aDestSize.Width() / aSrcSize.Width() : 1.0;
+ const double fScaleY = aSrcSize.Height() ? (double) aDestSize.Height() / aSrcSize.Height() : 1.0;
+ long nMoveX, nMoveY;
+
+ if( fScaleX != 1.0 || fScaleY != 1.0 )
+ {
+ aTmpMtf.Scale( fScaleX, fScaleY );
+ aSrcPt.X() = FRound( aSrcPt.X() * fScaleX ), aSrcPt.Y() = FRound( aSrcPt.Y() * fScaleY );
+ }
+
+ nMoveX = aDestPt.X() - aSrcPt.X(), nMoveY = aDestPt.Y() - aSrcPt.Y();
+
+ if( nMoveX || nMoveY )
+ aTmpMtf.Move( nMoveX, nMoveY );
+
+ WriteOrders( &aTmpMtf );
+ }
+ break;
+ }
+
+ nWrittenActions++;
+ MayCallback();
+
+ if( pMET->GetError() )
+ bStatus=FALSE;
+
+ if( bStatus == FALSE )
+ break;
+ }
+}
+
+void METWriter::WriteObjectEnvironmentGroup(const GDIMetaFile * pMTF)
+{
+ ULONG i, nId;
+
+ //--- Das Feld 'Begin Object Environment Group':
+ WriteFieldIntroducer(16,BegObjEnvMagic,0,0);
+ WriteFieldId(7);
+
+ //--- Das Feld 'Map Color Attribute Table':
+ WriteFieldIntroducer(22,MapColAtrMagic,0,0);
+ WriteBigEndianShort(0x000e);
+ *pMET << (BYTE)0x0c << (BYTE)0x02 << (BYTE)0x84 << (BYTE)0x00;
+ WriteFieldId(4);
+
+ //--- Das erste Feld 'Map Coded Font':
+ WriteFieldIntroducer(32,MapCodFntMagic,0,0);
+ WriteBigEndianShort(0x0018);
+ *pMET << (BYTE)0x0c << (BYTE)0x02 << (BYTE)0x84 << (BYTE)0x00;
+ *pMET << (BYTE)0xff << (BYTE)0x00 << (BYTE)0x00 << (BYTE)0x00;
+ *pMET << (BYTE)0x00 << (BYTE)0x00 << (BYTE)0x00 << (BYTE)0x00;
+ *pMET << (BYTE)0x04 << (BYTE)0x24 << (BYTE)0x05 << (BYTE)0x00;
+ *pMET << (BYTE)0x06 << (BYTE)0x20;
+ *pMET << (BYTE)0x03 << (BYTE)0x97 << (BYTE)0x01 << (BYTE)0xb5;
+
+ //--- Die weiteren Felder 'Map Coded Font':
+ CreateChrSets(pMTF);
+ WriteChrSets();
+
+ //--- Die Felder 'Map Data Resource':
+ nId=nActBitmapId;
+ for (i=0; i<nNumberOfBitmaps; i++)
+ {
+ WriteFieldIntroducer(29,MapDatResMagic,0,0);
+ WriteBigEndianShort(0x0015);
+ *pMET << (BYTE)0x0c << (BYTE)0x02 << (BYTE)0x84 << (BYTE)0x00;
+ WriteFieldId(nId);
+ *pMET << (BYTE)0x07 << (BYTE)0x22 << (BYTE)0x10;
+ *pMET << (sal_uInt32)nId;
+ nId++;
+ }
+
+ //--- Das Feld 'End Object Environment Group':
+ WriteFieldIntroducer(16,EndObjEnvMagic,0,0);
+ WriteFieldId(7);
+}
+
+
+void METWriter::WriteGraphicsObject(const GDIMetaFile * pMTF)
+{
+ ULONG nSegmentSize,nPos,nDataFieldsStartPos;
+
+ if( bStatus==FALSE )
+ return;
+
+ //--- Das Feld 'Begin Graphics Object':
+ WriteFieldIntroducer(16,BegGrfObjMagic,0,0);
+ WriteFieldId(7);
+
+ // Map Color Attribute Table, Fonts und anderes:
+ WriteObjectEnvironmentGroup(pMTF);
+
+ //--- Das Feld 'Graphics Data Descriptor':
+ WriteDataDescriptor(pMTF);
+
+ // Zaehler fuer Data Fields initialisieren:
+ nNumberOfDataFields=0;
+
+ // Und Position des ersten Data Fields merken:
+ nDataFieldsStartPos=pMET->Tell();
+
+ //--- Anfang des ersten Feldes 'Graphics Data'
+ WriteFieldIntroducer(0,DatGrfObjMagic,0,0);
+ nNumberOfDataFields++;
+
+ // Nun schreiben wir zunaechst den Kopf des Segments:
+ *pMET << (BYTE)0x70 << (BYTE)0x0e << (sal_uInt32)0;
+ *pMET << (BYTE)0x70 << (BYTE)0x10; // Flags
+ *pMET << (USHORT)0; // Lo-Wort der Laenge der Segementdaten (Big Endian)
+ *pMET << (sal_uInt32)0; // Reserved
+ *pMET << (USHORT)0; // Hi-Wort der Laenge der Segementdaten (Big Endian) (Ohh Ohh OS2)
+ // Anmerkung: die richtige Daten-Laenge schreiben wir weiter unten nochmal
+
+ // Jetzt werden alle Orders rausgeschrieben:
+ // (wobei die Sache ggf. in mehrere 'Graphics Data Fields' aufgeteilt
+ // wird, per Methode WillWriteOrder(..))
+ WriteOrders(pMTF);
+
+ //--- Das letzte Feld 'Graphic Data' beenden:
+ UpdateFieldSize();
+
+ //--- Und schliesslich die Segmentgroesse richtigstellen:
+ nPos=pMET->Tell();
+ nSegmentSize=nPos-nDataFieldsStartPos;
+ nSegmentSize-=nNumberOfDataFields*8; // Structured Field Introducers zaehlen nicht mit
+ pMET->Seek(nDataFieldsStartPos+16); // Zum Lo-Wort der Segmentgroesse seeken
+ WriteBigEndianShort((USHORT)(nSegmentSize&0x0000ffff)); // Und schreiben
+ pMET->Seek(nDataFieldsStartPos+22); // Zum Hi-Wort der Segmentgroesse seeken
+ WriteBigEndianShort((USHORT)(nSegmentSize>>16)); // Und schreiben
+ pMET->Seek(nPos); // Zurueck zur Tagesordnung
+
+ //--- Das Feld 'End Graphic Objects':
+ WriteFieldIntroducer(16,EndGrfObjMagic,0,0);
+ WriteFieldId(7);
+
+ if( pMET->GetError() )
+ bStatus=FALSE;
+}
+
+
+void METWriter::WriteResourceGroup(const GDIMetaFile * pMTF)
+{
+ if( bStatus==FALSE )
+ return;
+
+ //--- Das Feld 'Begin Resource Group':
+ WriteFieldIntroducer(16,BegResGrpMagic,0,0);
+ WriteFieldId(2);
+
+ //--- Der Inhalt:
+ WriteColorAttributeTable();
+ nActBitmapId=0x77777700;
+ WriteImageObjects(pMTF);
+ nActBitmapId=0x77777700;
+ WriteGraphicsObject(pMTF);
+
+ //--- Das Feld 'End Resource Group':
+ WriteFieldIntroducer(16,EndResGrpMagic,0,0);
+ WriteFieldId(2);
+
+ if( pMET->GetError() )
+ bStatus=FALSE;
+}
+
+
+void METWriter::WriteDocument(const GDIMetaFile * pMTF)
+{
+ if( bStatus==FALSE )
+ return;
+
+ //--- Das Feld 'Begin Document':
+ WriteFieldIntroducer(0,BegDocumnMagic,0,0);
+ WriteFieldId(1);
+ *pMET << (BYTE)0x00 << (BYTE)0x00;
+ *pMET << (BYTE)0x05 << (BYTE)0x18 << (BYTE)0x03 << (BYTE)0x0c << (BYTE)0x00;
+ *pMET << (BYTE)0x06 << (BYTE)0x01 << (BYTE)0x03 << (BYTE)0xd4 << (BYTE)0x03 << (BYTE)0x52;
+ *pMET << (BYTE)0x03 << (BYTE)0x65 << (BYTE)0x00;
+ UpdateFieldSize();
+
+ //--- Der Inhalt:
+ WriteResourceGroup(pMTF);
+
+ //--- Das Feld 'End Document':
+ WriteFieldIntroducer(16,EndDocumnMagic,0,0);
+ WriteFieldId(1);
+
+ if( pMET->GetError() )
+ bStatus=FALSE;
+}
+
+BOOL METWriter::WriteMET( const GDIMetaFile& rMTF, SvStream& rTargetStream, FilterConfigItem* pFilterConfigItem )
+{
+ if ( pFilterConfigItem )
+ {
+ xStatusIndicator = pFilterConfigItem->GetStatusIndicator();
+ if ( xStatusIndicator.is() )
+ {
+ rtl::OUString aMsg;
+ xStatusIndicator->start( aMsg, 100 );
+ }
+ }
+
+ METChrSet* pCS;
+ METGDIStackMember* pGS;
+
+ bStatus=TRUE;
+ nLastPercent=0;
+
+ pMET=&rTargetStream;
+ pMET->SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN);
+
+ aPictureRect = Rectangle( Point(), rMTF.GetPrefSize() );
+ aTargetMapMode = aPictureMapMode = rMTF.GetPrefMapMode();
+
+ aGDILineColor=Color( COL_BLACK );
+ aGDIFillColor=Color( COL_WHITE );
+ eGDIRasterOp=ROP_OVERPAINT;
+ aGDIFont=Font();
+ aGDIMapMode=MapMode();
+ aGDIClipRect=Rectangle();
+ pGDIStack=NULL;
+ aMETColor=Color(COL_BLACK);
+ aMETBackgroundColor=Color(COL_WHITE);
+ eMETMix=ROP_OVERPAINT;
+ nMETStrokeLineWidth=1;
+ aMETChrCellSize=Size(0,0);
+ nMETChrAngle=0;
+ nMETChrSet=0x00;
+ pChrSetList=NULL;
+ nNextChrSetId=1;
+ nNumberOfActions=0;
+ nNumberOfBitmaps=0;
+ nWrittenActions=0;
+ nWrittenBitmaps=0;
+ nActBitmapPercent=0;
+
+ CountActionsAndBitmaps(&rMTF);
+
+ WriteDocument(&rMTF);
+
+ while( pChrSetList )
+ {
+ pCS=pChrSetList;
+ pChrSetList=pCS->pSucc;
+ delete pCS;
+ }
+
+ while( pGDIStack )
+ {
+ pGS=pGDIStack;
+ pGDIStack=pGS->pSucc;
+ delete pGS;
+ }
+
+ if ( xStatusIndicator.is() )
+ xStatusIndicator->end();
+
+ return bStatus;
+}
+
+//================== GraphicExport - die exportierte Funktion ================
+
+extern "C" BOOL __LOADONCALLAPI GraphicExport( SvStream & rStream, Graphic & rGraphic, FilterConfigItem* pFilterConfigItem, BOOL )
+{ METWriter aMETWriter;
+
+ if ( rGraphic.GetType() == GRAPHIC_GDIMETAFILE )
+ return aMETWriter.WriteMET( rGraphic.GetGDIMetaFile(), rStream, pFilterConfigItem );
+ else
+ {
+ Bitmap aBmp=rGraphic.GetBitmap();
+ GDIMetaFile aMTF;
+ VirtualDevice aVirDev;
+
+ aMTF.Record(&aVirDev);
+ aVirDev.DrawBitmap(Point(),aBmp);
+ aMTF.Stop();
+ aMTF.SetPrefSize(aBmp.GetSizePixel());
+ return aMETWriter.WriteMET( aMTF, rStream, pFilterConfigItem );
+ }
+}
+
+//================== GraphicDialog - die exportierte Funktion ================
+
+extern "C" BOOL SAL_CALL DoExportDialog( FltCallDialogParameter& rPara )
+{
+ BOOL bRet = FALSE;
+
+ if ( rPara.pWindow )
+ {
+ ByteString aResMgrName( "eme" );
+ ResMgr* pResMgr;
+
+ pResMgr = ResMgr::CreateResMgr( aResMgrName.GetBuffer(), Application::GetSettings().GetUILocale() );
+
+ if( pResMgr )
+ {
+ rPara.pResMgr = pResMgr;
+ bRet = ( DlgExportEMET( rPara ).Execute() == RET_OK );
+ delete pResMgr;
+ }
+ else
+ bRet = TRUE;
+ }
+
+ return bRet;
+}
+
+//================== ein bischen Muell fuer Windows ==========================
+#ifndef GCC
+#endif
+
+#ifdef WIN
+
+static HINSTANCE hDLLInst = 0; // HANDLE der DLL
+
+extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR )
+{
+#ifndef WNT
+ if ( nHeap )
+ UnlockData( 0 );
+#endif
+
+ hDLLInst = hDLL;
+
+ return TRUE;
+}
+
+extern "C" int CALLBACK WEP( int )
+{
+ return 1;
+}
+
+#endif
diff --git a/filter/source/graphicfilter/eos2met/eos2mstr.src b/filter/source/graphicfilter/eos2met/eos2mstr.src
new file mode 100644
index 000000000000..8afebcb7564c
--- /dev/null
+++ b/filter/source/graphicfilter/eos2met/eos2mstr.src
@@ -0,0 +1,38 @@
+/*************************************************************************
+ *
+ * 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 "strings.hrc"
+
+String KEY_MODE
+{
+ Text = "ExportMode";
+};
+
+String KEY_SIZE
+{
+ Text = "Size";
+};
diff --git a/filter/source/graphicfilter/eos2met/exports.map b/filter/source/graphicfilter/eos2met/exports.map
new file mode 100644
index 000000000000..61e4682c6551
--- /dev/null
+++ b/filter/source/graphicfilter/eos2met/exports.map
@@ -0,0 +1,8 @@
+UDK_3_0_0 {
+ global:
+ GraphicExport;
+ DoExportDialog;
+
+ local:
+ *;
+};
diff --git a/filter/source/graphicfilter/eos2met/makefile.mk b/filter/source/graphicfilter/eos2met/makefile.mk
new file mode 100644
index 000000000000..9f8deb74c7ca
--- /dev/null
+++ b/filter/source/graphicfilter/eos2met/makefile.mk
@@ -0,0 +1,74 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=filter
+TARGET=eos2met
+TARGET2=eme
+DEPTARGET=veos2met
+
+# --- Settings -----------------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Allgemein ----------------------------------------------------------
+
+.IF "$(editdebug)"!="" || "$(EDITDEBUG)"!=""
+CDEFS+= -DEDITDEBUG
+.ENDIF
+
+SRS1NAME=$(TARGET)
+SRC1FILES= dlgeos2.src \
+ eos2mstr.src
+.IF "$(L10N_framework)"==""
+SLOFILES = $(SLO)$/eos2met.obj \
+ $(SLO)$/dlgeos2.obj
+.ENDIF
+# ==========================================================================
+
+RESLIB1NAME=$(TARGET2)
+RESLIB1SRSFILES=$(SRS)$/$(TARGET).srs
+.IF "$(L10N_framework)"==""
+SHL1TARGET= eme$(DLLPOSTFIX)
+SHL1IMPLIB= eos2met
+SHL1STDLIBS= $(TOOLSLIB) $(VCLLIB) $(SVTOOLLIB) $(CPPULIB) $(SALLIB)
+
+SHL1LIBS= $(SLB)$/eos2met.lib
+.IF "$(GUI)" != "UNX"
+.IF "$(COM)" != "GCC"
+SHL1OBJS= $(SLO)$/eos2met.obj
+.ENDIF
+.ENDIF
+
+SHL1VERSIONMAP=exports.map
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+DEF1NAME=$(SHL1TARGET)
+.ENDIF
+# ==========================================================================
+
+.INCLUDE : target.mk
diff --git a/filter/source/graphicfilter/eos2met/strings.hrc b/filter/source/graphicfilter/eos2met/strings.hrc
new file mode 100644
index 000000000000..7834e3ea2bc0
--- /dev/null
+++ b/filter/source/graphicfilter/eos2met/strings.hrc
@@ -0,0 +1,29 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+#define KEY_MODE 260
+#define KEY_SIZE 261
+
diff --git a/filter/source/graphicfilter/epbm/dlgepbm.cxx b/filter/source/graphicfilter/epbm/dlgepbm.cxx
new file mode 100644
index 000000000000..932fb7ff5bb9
--- /dev/null
+++ b/filter/source/graphicfilter/epbm/dlgepbm.cxx
@@ -0,0 +1,99 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+#ifndef GCC
+#endif
+
+#include <tools/ref.hxx>
+#include <svtools/FilterConfigItem.hxx>
+#include <vcl/msgbox.hxx>
+#include "dlgepbm.hxx"
+#include "dlgepbm.hrc"
+#include "strings.hrc"
+
+/*************************************************************************
+|*
+|* Ctor
+|*
+\************************************************************************/
+
+DlgExportEPBM::DlgExportEPBM( FltCallDialogParameter& rPara ) :
+ ModalDialog ( rPara.pWindow, ResId( DLG_EXPORT_EPBM, *rPara.pResMgr ) ),
+ rFltCallPara ( rPara ),
+ aGrpFormat ( this, ResId( GRP_FORMAT, *rPara.pResMgr ) ),
+ aRBRaw ( this, ResId( RB_RAW, *rPara.pResMgr ) ),
+ aRBASCII ( this, ResId( RB_ASCII, *rPara.pResMgr ) ),
+ aBtnOK ( this, ResId( BTN_OK, *rPara.pResMgr ) ),
+ aBtnCancel ( this, ResId( BTN_CANCEL, *rPara.pResMgr ) ),
+ aBtnHelp ( this, ResId( BTN_HELP, *rPara.pResMgr ) ),
+ pMgr ( rPara.pResMgr )
+{
+ FreeResource();
+
+ // Config-Parameter lesen
+
+ String aFilterConfigPath( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Filter/Graphic/Export/PBM" ) );
+ pConfigItem = new FilterConfigItem( aFilterConfigPath, &rPara.aFilterData );
+ sal_Int32 nFormat = pConfigItem->ReadInt32( String( ResId( KEY_FORMAT, *pMgr ) ), 1 );
+
+ BOOL bCheck = FALSE;
+ if ( !nFormat )
+ bCheck ^= TRUE;
+
+ aRBRaw.Check( bCheck );
+ bCheck ^= TRUE;
+ aRBASCII.Check( bCheck );
+
+ aBtnOK.SetClickHdl( LINK( this, DlgExportEPBM, OK ) );
+}
+
+DlgExportEPBM::~DlgExportEPBM()
+{
+ delete pConfigItem;
+}
+
+/*************************************************************************
+|*
+|* Speichert eingestellte Werte in ini-Datei
+|*
+\************************************************************************/
+
+IMPL_LINK( DlgExportEPBM, OK, void *, EMPTYARG )
+{
+
+ // Config-Parameter schreiben
+ sal_Int32 nFormat = 0;
+ if ( aRBASCII.IsChecked() )
+ nFormat++;
+ pConfigItem->WriteInt32( String( ResId( KEY_FORMAT, *pMgr ) ), nFormat );
+ rFltCallPara.aFilterData = pConfigItem->GetFilterData();
+ EndDialog( RET_OK );
+
+ return 0;
+}
diff --git a/filter/source/graphicfilter/epbm/dlgepbm.hrc b/filter/source/graphicfilter/epbm/dlgepbm.hrc
new file mode 100644
index 000000000000..876dfa840997
--- /dev/null
+++ b/filter/source/graphicfilter/epbm/dlgepbm.hrc
@@ -0,0 +1,34 @@
+/*************************************************************************
+ *
+ * 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 "filter.hrc"
+
+#define BTN_OK 1
+#define BTN_CANCEL 1
+#define BTN_HELP 1
+#define GRP_FORMAT 1
+#define RB_RAW 1
+#define RB_ASCII 2
diff --git a/filter/source/graphicfilter/epbm/dlgepbm.hxx b/filter/source/graphicfilter/epbm/dlgepbm.hxx
new file mode 100644
index 000000000000..780eac366020
--- /dev/null
+++ b/filter/source/graphicfilter/epbm/dlgepbm.hxx
@@ -0,0 +1,71 @@
+/*************************************************************************
+ *
+ * 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 _DLGEPBM_HXX_
+#define _DLGEPBM_HXX_
+#include <svtools/fltcall.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/button.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/field.hxx>
+#include <svtools/stdctrl.hxx>
+
+
+/*************************************************************************
+|*
+|* Dialog zum Einstellen von Filteroptionen
+|*
+\************************************************************************/
+
+class ResMgr;
+
+class FilterConfigItem;
+class DlgExportEPBM : public ModalDialog
+{
+private:
+
+ FltCallDialogParameter& rFltCallPara;
+
+ FixedLine aGrpFormat;
+ RadioButton aRBRaw;
+ RadioButton aRBASCII;
+ OKButton aBtnOK;
+ CancelButton aBtnCancel;
+ HelpButton aBtnHelp;
+
+ FilterConfigItem* pConfigItem;
+ ResMgr* pMgr;
+
+ DECL_LINK( OK, void * );
+
+public:
+ DlgExportEPBM( FltCallDialogParameter& rPara );
+ ~DlgExportEPBM();
+};
+
+#endif // _DLGEPBM_HXX_
diff --git a/filter/source/graphicfilter/epbm/dlgepbm.src b/filter/source/graphicfilter/epbm/dlgepbm.src
new file mode 100644
index 000000000000..b4e6eb2decf2
--- /dev/null
+++ b/filter/source/graphicfilter/epbm/dlgepbm.src
@@ -0,0 +1,106 @@
+/*************************************************************************
+ *
+ * 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 "dlgepbm.hrc"
+ModalDialog DLG_EXPORT_EPBM
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 133 , 63 ) ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ Text [ en-US ] = "PBM Options" ;
+ OKButton BTN_OK
+ {
+ Pos = MAP_APPFONT ( 73 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( 73 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton BTN_HELP
+ {
+ Pos = MAP_APPFONT ( 73 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ FixedLine GRP_FORMAT
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 60 , 8 ) ;
+ Text [ en-US ] = "File format";
+ };
+ RadioButton RB_RAW
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 45 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Binary";
+ };
+ RadioButton RB_ASCII
+ {
+ Pos = MAP_APPFONT ( 12 , 28 ) ;
+ Size = MAP_APPFONT ( 45 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Text";
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/filter/source/graphicfilter/epbm/epbm.cxx b/filter/source/graphicfilter/epbm/epbm.cxx
new file mode 100644
index 000000000000..fe8dc77fc704
--- /dev/null
+++ b/filter/source/graphicfilter/epbm/epbm.cxx
@@ -0,0 +1,272 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include <vcl/svapp.hxx>
+#include <vcl/graph.hxx>
+#include <vcl/bmpacc.hxx>
+#include <vcl/msgbox.hxx>
+#include <svl/solar.hrc>
+#include <svtools/fltcall.hxx>
+#include <svtools/FilterConfigItem.hxx>
+#include "strings.hrc"
+#include "dlgepbm.hrc"
+#include "dlgepbm.hxx"
+
+//============================ PBMWriter ==================================
+
+class PBMWriter {
+
+private:
+
+ SvStream* mpOStm; // Die auszugebende PBM-Datei
+ USHORT mpOStmOldModus;
+
+ BOOL mbStatus;
+ sal_Int32 mnMode; // 0 -> raw, 1-> ascii
+ BitmapReadAccess* mpAcc;
+ ULONG mnWidth, mnHeight; // Bildausmass in Pixeln
+
+ BOOL ImplWriteHeader();
+ void ImplWriteBody();
+ void ImplWriteNumber( sal_Int32 );
+
+ com::sun::star::uno::Reference< com::sun::star::task::XStatusIndicator > xStatusIndicator;
+
+public:
+ PBMWriter();
+ ~PBMWriter();
+
+ BOOL WritePBM( const Graphic& rGraphic, SvStream& rPBM, FilterConfigItem* pFilterConfigItem );
+};
+
+//=================== Methoden von PBMWriter ==============================
+
+PBMWriter::PBMWriter() :
+ mbStatus ( TRUE ),
+ mpAcc ( NULL )
+{
+}
+
+// ------------------------------------------------------------------------
+
+PBMWriter::~PBMWriter()
+{
+}
+
+// ------------------------------------------------------------------------
+
+BOOL PBMWriter::WritePBM( const Graphic& rGraphic, SvStream& rPBM, FilterConfigItem* pFilterConfigItem )
+{
+
+ mpOStm = &rPBM;
+
+ if ( pFilterConfigItem )
+ {
+ mnMode = pFilterConfigItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "FileFormat" ) ), 0 );
+
+ xStatusIndicator = pFilterConfigItem->GetStatusIndicator();
+ if ( xStatusIndicator.is() )
+ {
+ rtl::OUString aMsg;
+ xStatusIndicator->start( aMsg, 100 );
+ }
+ }
+
+ BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
+ Bitmap aBmp = aBmpEx.GetBitmap();
+ aBmp.Convert( BMP_CONVERSION_1BIT_THRESHOLD );
+
+ mpOStmOldModus = mpOStm->GetNumberFormatInt();
+ mpOStm->SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN );
+
+ mpAcc = aBmp.AcquireReadAccess();
+ if( mpAcc )
+ {
+ if ( ImplWriteHeader() )
+ ImplWriteBody();
+
+ aBmp.ReleaseAccess( mpAcc );
+ }
+ else
+ mbStatus = FALSE;
+
+ mpOStm->SetNumberFormatInt( mpOStmOldModus );
+
+ if ( xStatusIndicator.is() )
+ xStatusIndicator->end();
+
+ return mbStatus;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL PBMWriter::ImplWriteHeader()
+{
+ mnWidth = mpAcc->Width();
+ mnHeight = mpAcc->Height();
+ if ( mnWidth && mnHeight )
+ {
+ if ( mnMode == 0 )
+ *mpOStm << "P4\x0a";
+ else
+ *mpOStm << "P1\x0a";
+
+ ImplWriteNumber( mnWidth );
+ *mpOStm << (BYTE)32;
+ ImplWriteNumber( mnHeight );
+ *mpOStm << (BYTE)10;
+ }
+ else mbStatus = FALSE;
+ return mbStatus;
+}
+
+// ------------------------------------------------------------------------
+
+void PBMWriter::ImplWriteBody()
+{
+ if ( mnMode == 0 )
+ {
+ BYTE nBYTE = 0;
+ for ( ULONG y = 0; y < mnHeight; y++ )
+ {
+ ULONG x;
+ for ( x = 0; x < mnWidth; x++ )
+ {
+ nBYTE <<= 1;
+ if (!(mpAcc->GetPixel( y, x ) & 1 ) )
+ nBYTE++;
+ if ( ( x & 7 ) == 7 )
+ *mpOStm << nBYTE;
+ }
+ if ( ( x & 7 ) != 0 )
+ *mpOStm << (BYTE)( nBYTE << ( ( x ^ 7 ) + 1 ) );
+ }
+ }
+ else
+ {
+ int nxCount;
+ for ( ULONG y = 0; y < mnHeight; y++ )
+ {
+ nxCount = 70;
+ for ( ULONG x = 0; x < mnWidth; x++ )
+ {
+ if (!( --nxCount ) )
+ {
+ nxCount = 69;
+ *mpOStm << (BYTE)10;
+ }
+ *mpOStm << (BYTE)( ( mpAcc->GetPixel( y, x ) ^ 1 ) + '0' ) ;
+ }
+ *mpOStm << (BYTE)10;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------
+// eine Dezimalzahl im ASCII format wird in den Stream geschrieben
+
+void PBMWriter::ImplWriteNumber( sal_Int32 nNumber )
+{
+ const ByteString aNum( ByteString::CreateFromInt32( nNumber ) );
+
+ for( sal_Int16 n = 0, nLen = aNum.Len(); n < nLen; n++ )
+ *mpOStm << aNum.GetChar( n );
+
+}
+
+// ------------------------------------------------------------------------
+
+// ---------------------
+// - exported function -
+// ---------------------
+
+extern "C" BOOL __LOADONCALLAPI GraphicExport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pFilterConfigItem, BOOL )
+{
+ PBMWriter aPBMWriter;
+
+ return aPBMWriter.WritePBM( rGraphic, rStream, pFilterConfigItem );
+}
+
+// ------------------------------------------------------------------------
+
+extern "C" BOOL __LOADONCALLAPI DoExportDialog( FltCallDialogParameter& rPara )
+{
+ BOOL bRet = FALSE;
+
+ if ( rPara.pWindow )
+ {
+ ByteString aResMgrName( "epb" );
+ ResMgr* pResMgr;
+
+ pResMgr = ResMgr::CreateResMgr( aResMgrName.GetBuffer(), Application::GetSettings().GetUILocale() );
+
+ if( pResMgr )
+ {
+ rPara.pResMgr = pResMgr;
+ bRet = ( DlgExportEPBM( rPara ).Execute() == RET_OK );
+ delete pResMgr;
+ }
+ else
+ bRet = TRUE;
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+#ifndef GCC
+#endif
+
+// ---------------
+// - Win16 trash -
+// ---------------
+
+#ifdef WIN
+
+static HINSTANCE hDLLInst = 0;
+
+extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR )
+{
+ if ( nHeap )
+ UnlockData( 0 );
+
+ hDLLInst = hDLL;
+
+ return TRUE;
+}
+
+// ------------------------------------------------------------------------
+
+extern "C" int CALLBACK WEP( int )
+{
+ return 1;
+}
+
+#endif
diff --git a/filter/source/graphicfilter/epbm/epbmstr.src b/filter/source/graphicfilter/epbm/epbmstr.src
new file mode 100644
index 000000000000..8424505dbcd1
--- /dev/null
+++ b/filter/source/graphicfilter/epbm/epbmstr.src
@@ -0,0 +1,35 @@
+/*************************************************************************
+ *
+ * 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 "strings.hrc"
+
+// Key fuer den Dialog
+String KEY_FORMAT
+{
+ Text = "FileFormat";
+};
diff --git a/filter/source/graphicfilter/epbm/exports.map b/filter/source/graphicfilter/epbm/exports.map
new file mode 100644
index 000000000000..61e4682c6551
--- /dev/null
+++ b/filter/source/graphicfilter/epbm/exports.map
@@ -0,0 +1,8 @@
+UDK_3_0_0 {
+ global:
+ GraphicExport;
+ DoExportDialog;
+
+ local:
+ *;
+};
diff --git a/filter/source/graphicfilter/epbm/makefile.mk b/filter/source/graphicfilter/epbm/makefile.mk
new file mode 100644
index 000000000000..3b248222cda1
--- /dev/null
+++ b/filter/source/graphicfilter/epbm/makefile.mk
@@ -0,0 +1,75 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=filter
+TARGET=epbm
+TARGET2=epb
+DEPTARGET=vepbm
+
+# --- Settings -----------------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Allgemein ----------------------------------------------------------
+
+.IF "$(editdebug)"!="" || "$(EDITDEBUG)"!=""
+CDEFS+= -DEDITDEBUG
+.ENDIF
+
+SRS1NAME=$(TARGET)
+SRC1FILES= dlgepbm.src \
+ epbmstr.src
+.IF "$(L10N_framework)"==""
+SLOFILES = $(SLO)$/epbm.obj \
+ $(SLO)$/dlgepbm.obj
+.ENDIF
+# ==========================================================================
+
+RESLIB1NAME=$(TARGET2)
+RESLIB1SRSFILES=$(SRS)$/$(TARGET).srs
+.IF "$(L10N_framework)"==""
+SHL1TARGET= epb$(DLLPOSTFIX)
+SHL1IMPLIB= epbm
+SHL1STDLIBS= $(TOOLSLIB) $(VCLLIB) $(CPPULIB) $(SVTOOLLIB) $(SALLIB)
+
+SHL1LIBS= $(SLB)$/epbm.lib
+
+.IF "$(GUI)" != "UNX"
+.IF "$(COM)" != "GCC"
+SHL1OBJS= $(SLO)$/epbm.obj
+.ENDIF
+.ENDIF
+
+SHL1VERSIONMAP=exports.map
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+DEF1NAME=$(SHL1TARGET)
+.ENDIF
+# ==========================================================================
+
+.INCLUDE : target.mk
diff --git a/filter/source/graphicfilter/epbm/strings.hrc b/filter/source/graphicfilter/epbm/strings.hrc
new file mode 100644
index 000000000000..122719e87d4b
--- /dev/null
+++ b/filter/source/graphicfilter/epbm/strings.hrc
@@ -0,0 +1,27 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+#define KEY_FORMAT 256
diff --git a/filter/source/graphicfilter/epgm/dlgepgm.cxx b/filter/source/graphicfilter/epgm/dlgepgm.cxx
new file mode 100644
index 000000000000..3aa960b25a26
--- /dev/null
+++ b/filter/source/graphicfilter/epgm/dlgepgm.cxx
@@ -0,0 +1,97 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+#ifndef GCC
+#endif
+
+#include <tools/ref.hxx>
+#include <svtools/FilterConfigItem.hxx>
+#include <vcl/msgbox.hxx>
+#include "dlgepgm.hxx"
+#include "dlgepgm.hrc"
+#include "strings.hrc"
+
+/*************************************************************************
+|*
+|* Ctor
+|*
+\************************************************************************/
+
+DlgExportEPGM::DlgExportEPGM( FltCallDialogParameter& rPara ) :
+ ModalDialog ( rPara.pWindow, ResId( DLG_EXPORT_EPGM, *rPara.pResMgr ) ),
+ rFltCallPara ( rPara ),
+ aGrpFormat ( this, ResId( GRP_FORMAT, *rPara.pResMgr ) ),
+ aRBRaw ( this, ResId( RB_RAW, *rPara.pResMgr ) ),
+ aRBASCII ( this, ResId( RB_ASCII, *rPara.pResMgr ) ),
+ aBtnOK ( this, ResId( BTN_OK, *rPara.pResMgr ) ),
+ aBtnCancel ( this, ResId( BTN_CANCEL, *rPara.pResMgr ) ),
+ aBtnHelp ( this, ResId( BTN_HELP, *rPara.pResMgr ) ),
+ pMgr ( rPara.pResMgr )
+{
+ FreeResource();
+
+ // Config-Parameter lesen
+
+ String aFilterConfigPath( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Filter/Graphic/Export/PGM" ) );
+ pConfigItem = new FilterConfigItem( aFilterConfigPath, &rPara.aFilterData );
+ sal_Int32 nFormat = pConfigItem->ReadInt32( String( ResId( KEY_FORMAT, *pMgr ) ), 0 );
+
+ BOOL bCheck = FALSE;
+ if ( !nFormat )
+ bCheck ^= TRUE;
+ aRBRaw.Check( bCheck );
+ bCheck ^= TRUE;
+ aRBASCII.Check( bCheck );
+
+ aBtnOK.SetClickHdl( LINK( this, DlgExportEPGM, OK ) );
+}
+
+DlgExportEPGM::~DlgExportEPGM()
+{
+ delete pConfigItem;
+}
+
+/*************************************************************************
+|*
+|* Speichert eingestellte Werte in ini-Datei
+|*
+\************************************************************************/
+
+IMPL_LINK( DlgExportEPGM, OK, void *, EMPTYARG )
+{
+ // Config-Parameter schreiben
+ sal_Int32 nFormat = 0;
+ if ( aRBASCII.IsChecked() )
+ nFormat++;
+ pConfigItem->WriteInt32( String( ResId( KEY_FORMAT, *pMgr ) ), nFormat );
+ rFltCallPara.aFilterData = pConfigItem->GetFilterData();
+ EndDialog( RET_OK );
+
+ return 0;
+}
diff --git a/filter/source/graphicfilter/epgm/dlgepgm.hrc b/filter/source/graphicfilter/epgm/dlgepgm.hrc
new file mode 100644
index 000000000000..876dfa840997
--- /dev/null
+++ b/filter/source/graphicfilter/epgm/dlgepgm.hrc
@@ -0,0 +1,34 @@
+/*************************************************************************
+ *
+ * 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 "filter.hrc"
+
+#define BTN_OK 1
+#define BTN_CANCEL 1
+#define BTN_HELP 1
+#define GRP_FORMAT 1
+#define RB_RAW 1
+#define RB_ASCII 2
diff --git a/filter/source/graphicfilter/epgm/dlgepgm.hxx b/filter/source/graphicfilter/epgm/dlgepgm.hxx
new file mode 100644
index 000000000000..3eb91bdb5fc6
--- /dev/null
+++ b/filter/source/graphicfilter/epgm/dlgepgm.hxx
@@ -0,0 +1,71 @@
+/*************************************************************************
+ *
+ * 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 _DLGEPGM_HXX_
+#define _DLGEPGM_HXX_
+#include <svtools/fltcall.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/button.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/field.hxx>
+#include <svtools/stdctrl.hxx>
+
+
+/*************************************************************************
+|*
+|* Dialog zum Einstellen von Filteroptionen
+|*
+\************************************************************************/
+
+class FilterConfigItem;
+class ResMgr;
+
+class DlgExportEPGM : public ModalDialog
+{
+private:
+
+ FltCallDialogParameter& rFltCallPara;
+
+ FixedLine aGrpFormat;
+ RadioButton aRBRaw;
+ RadioButton aRBASCII;
+ OKButton aBtnOK;
+ CancelButton aBtnCancel;
+ HelpButton aBtnHelp;
+
+ FilterConfigItem* pConfigItem;
+ ResMgr* pMgr;
+
+ DECL_LINK( OK, void * );
+
+public:
+ DlgExportEPGM( FltCallDialogParameter& rPara );
+ ~DlgExportEPGM();
+};
+
+#endif // _DLGEPGM_HXX_
diff --git a/filter/source/graphicfilter/epgm/dlgepgm.src b/filter/source/graphicfilter/epgm/dlgepgm.src
new file mode 100644
index 000000000000..39e91d29fdf5
--- /dev/null
+++ b/filter/source/graphicfilter/epgm/dlgepgm.src
@@ -0,0 +1,105 @@
+/*************************************************************************
+ *
+ * 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 "dlgepgm.hrc"
+ModalDialog DLG_EXPORT_EPGM
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 133 , 63 ) ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ Text [ en-US ] = "PGM Options" ;
+ OKButton BTN_OK
+ {
+ Pos = MAP_APPFONT ( 73 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( 73 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton BTN_HELP
+ {
+ Pos = MAP_APPFONT ( 73 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ FixedLine GRP_FORMAT
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 60 , 8 ) ;
+ Text [ en-US ] = "File format";
+ };
+ RadioButton RB_RAW
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 45 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Binary";
+ };
+ RadioButton RB_ASCII
+ {
+ Pos = MAP_APPFONT ( 12 , 28 ) ;
+ Size = MAP_APPFONT ( 45 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Text";
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/filter/source/graphicfilter/epgm/epgm.cxx b/filter/source/graphicfilter/epgm/epgm.cxx
new file mode 100644
index 000000000000..89fbc9929ab0
--- /dev/null
+++ b/filter/source/graphicfilter/epgm/epgm.cxx
@@ -0,0 +1,297 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include <vcl/svapp.hxx>
+#include <vcl/graph.hxx>
+#include <vcl/bmpacc.hxx>
+#include <vcl/msgbox.hxx>
+#include <svl/solar.hrc>
+#include <svtools/fltcall.hxx>
+#include <svtools/FilterConfigItem.hxx>
+#include "strings.hrc"
+#include "dlgepgm.hrc"
+#include "dlgepgm.hxx"
+
+//============================ PGMWriter ==================================
+
+class PGMWriter {
+
+private:
+
+ SvStream* mpOStm; // Die auszugebende PGM-Datei
+ USHORT mpOStmOldModus;
+
+ BOOL mbStatus;
+ UINT32 mnMode;
+ BitmapReadAccess* mpAcc;
+ ULONG mnWidth, mnHeight; // Bildausmass in Pixeln
+
+ BOOL ImplWriteHeader();
+ void ImplWriteBody();
+ void ImplWriteNumber( sal_Int32 );
+
+ com::sun::star::uno::Reference< com::sun::star::task::XStatusIndicator > xStatusIndicator;
+
+public:
+ PGMWriter();
+ ~PGMWriter();
+
+ BOOL WritePGM( const Graphic& rGraphic, SvStream& rPGM, FilterConfigItem* pFilterConfigItem );
+};
+
+//=================== Methoden von PGMWriter ==============================
+
+PGMWriter::PGMWriter() :
+ mbStatus ( TRUE ),
+ mpAcc ( NULL )
+{
+}
+
+// ------------------------------------------------------------------------
+
+PGMWriter::~PGMWriter()
+{
+}
+
+// ------------------------------------------------------------------------
+
+BOOL PGMWriter::WritePGM( const Graphic& rGraphic, SvStream& rPGM, FilterConfigItem* pFilterConfigItem )
+{
+
+ mpOStm = &rPGM;
+
+ if ( pFilterConfigItem )
+ {
+ mnMode = pFilterConfigItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "FileFormat" ) ), 0 );
+
+ xStatusIndicator = pFilterConfigItem->GetStatusIndicator();
+ if ( xStatusIndicator.is() )
+ {
+ rtl::OUString aMsg;
+ xStatusIndicator->start( aMsg, 100 );
+ }
+ }
+
+ BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
+ Bitmap aBmp = aBmpEx.GetBitmap();
+ aBmp.Convert( BMP_CONVERSION_8BIT_GREYS );
+
+ mpOStmOldModus = mpOStm->GetNumberFormatInt();
+ mpOStm->SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN );
+
+ mpAcc = aBmp.AcquireReadAccess();
+ if( mpAcc )
+ {
+ if ( ImplWriteHeader() )
+ {
+ ImplWriteBody();
+ }
+ aBmp.ReleaseAccess( mpAcc );
+ }
+ else
+ mbStatus = FALSE;
+
+ mpOStm->SetNumberFormatInt( mpOStmOldModus );
+
+ if ( xStatusIndicator.is() )
+ xStatusIndicator->end();
+
+ return mbStatus;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL PGMWriter::ImplWriteHeader()
+{
+ mnWidth = mpAcc->Width();
+ mnHeight = mpAcc->Height();
+ if ( mnWidth && mnHeight )
+ {
+ if ( mnMode == 0 )
+ *mpOStm << "P5\x0a";
+ else
+ *mpOStm << "P2\x0a";
+
+ ImplWriteNumber( mnWidth );
+ *mpOStm << (BYTE)32;
+ ImplWriteNumber( mnHeight );
+ *mpOStm << (BYTE)32;
+ ImplWriteNumber( 255 ); // max. gray value
+ *mpOStm << (BYTE)10;
+ }
+ else
+ mbStatus = FALSE;
+
+ return mbStatus;
+}
+
+// ------------------------------------------------------------------------
+
+void PGMWriter::ImplWriteBody()
+{
+ if ( mnMode == 0 )
+ {
+ for ( ULONG y = 0; y < mnHeight; y++ )
+ {
+ for ( ULONG x = 0; x < mnWidth; x++ )
+ {
+ *mpOStm << (BYTE)( mpAcc->GetPixel( y, x ) );
+ }
+ }
+ }
+ else
+ {
+ for ( ULONG y = 0; y < mnHeight; y++ )
+ {
+ int nCount = 70;
+ for ( ULONG x = 0; x < mnWidth; x++ )
+ {
+ BYTE nDat, nNumb;
+ if ( nCount < 0 )
+ {
+ nCount = 69;
+ *mpOStm << (BYTE)10;
+ }
+ nDat = (BYTE)mpAcc->GetPixel( y, x );
+ nNumb = nDat / 100;
+ if ( nNumb )
+ {
+ *mpOStm << (BYTE)( nNumb + '0' );
+ nDat -= ( nNumb * 100 );
+ nNumb = nDat / 10;
+ *mpOStm << (BYTE)( nNumb + '0' );
+ nDat -= ( nNumb * 10 );
+ *mpOStm << (BYTE)( nDat + '0' );
+ nCount -= 4;
+ }
+ else
+ {
+ nNumb = nDat / 10;
+ if ( nNumb )
+ {
+ *mpOStm << (BYTE)( nNumb + '0' );
+ nDat -= ( nNumb * 10 );
+ *mpOStm << (BYTE)( nDat + '0' );
+ nCount -= 3;
+ }
+ else
+ {
+ *mpOStm << (BYTE)( nDat + '0' );
+ nCount -= 2;
+ }
+ }
+ *mpOStm << (BYTE)' ';
+ }
+ *mpOStm << (BYTE)10;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------
+// eine Dezimalzahl im ASCII format wird in den Stream geschrieben
+
+void PGMWriter::ImplWriteNumber( sal_Int32 nNumber )
+{
+ const ByteString aNum( ByteString::CreateFromInt32( nNumber ) );
+
+ for( sal_Int16 n = 0UL, nLen = aNum.Len(); n < nLen; n++ )
+ *mpOStm << aNum.GetChar( n );
+
+}
+
+// ------------------------------------------------------------------------
+
+// ---------------------
+// - exported function -
+// ---------------------
+
+extern "C" BOOL __LOADONCALLAPI GraphicExport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pFilterConfigItem, BOOL )
+{
+ PGMWriter aPGMWriter;
+
+ return aPGMWriter.WritePGM( rGraphic, rStream, pFilterConfigItem );
+}
+
+// ------------------------------------------------------------------------
+
+extern "C" BOOL __LOADONCALLAPI DoExportDialog( FltCallDialogParameter& rPara )
+{
+ BOOL bRet = FALSE;
+
+ if ( rPara.pWindow )
+ {
+ ByteString aResMgrName( "epg" );
+ ResMgr* pResMgr;
+
+ pResMgr = ResMgr::CreateResMgr( aResMgrName.GetBuffer(), Application::GetSettings().GetUILocale() );
+
+ if( pResMgr )
+ {
+ rPara.pResMgr = pResMgr;
+ bRet = ( DlgExportEPGM( rPara ).Execute() == RET_OK );
+ delete pResMgr;
+ }
+ else
+ bRet = TRUE;
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+#ifndef GCC
+#endif
+
+// ---------------
+// - Win16 trash -
+// ---------------
+
+#ifdef WIN
+
+static HINSTANCE hDLLInst = 0;
+
+extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR )
+{
+ if ( nHeap )
+ UnlockData( 0 );
+
+ hDLLInst = hDLL;
+
+ return TRUE;
+}
+
+// ------------------------------------------------------------------------
+
+extern "C" int CALLBACK WEP( int )
+{
+ return 1;
+}
+
+#endif
diff --git a/filter/source/graphicfilter/epgm/epgmstr.src b/filter/source/graphicfilter/epgm/epgmstr.src
new file mode 100644
index 000000000000..8424505dbcd1
--- /dev/null
+++ b/filter/source/graphicfilter/epgm/epgmstr.src
@@ -0,0 +1,35 @@
+/*************************************************************************
+ *
+ * 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 "strings.hrc"
+
+// Key fuer den Dialog
+String KEY_FORMAT
+{
+ Text = "FileFormat";
+};
diff --git a/filter/source/graphicfilter/epgm/exports.map b/filter/source/graphicfilter/epgm/exports.map
new file mode 100644
index 000000000000..61e4682c6551
--- /dev/null
+++ b/filter/source/graphicfilter/epgm/exports.map
@@ -0,0 +1,8 @@
+UDK_3_0_0 {
+ global:
+ GraphicExport;
+ DoExportDialog;
+
+ local:
+ *;
+};
diff --git a/filter/source/graphicfilter/epgm/makefile.mk b/filter/source/graphicfilter/epgm/makefile.mk
new file mode 100644
index 000000000000..70ab5ec93c68
--- /dev/null
+++ b/filter/source/graphicfilter/epgm/makefile.mk
@@ -0,0 +1,76 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=filter
+TARGET=epgm
+TARGET2=epg
+DEPTARGET=vepgm
+
+
+# --- Settings -----------------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Allgemein ----------------------------------------------------------
+
+.IF "$(editdebug)"!="" || "$(EDITDEBUG)"!=""
+CDEFS+= -DEDITDEBUG
+.ENDIF
+
+SRS1NAME=$(TARGET)
+SRC1FILES= dlgepgm.src \
+ epgmstr.src
+.IF "$(L10N_framework)"==""
+SLOFILES = $(SLO)$/epgm.obj \
+ $(SLO)$/dlgepgm.obj
+.ENDIF
+# ==========================================================================
+
+RESLIB1NAME=$(TARGET2)
+RESLIB1SRSFILES=$(SRS)$/$(TARGET).srs
+.IF "$(L10N_framework)"==""
+SHL1TARGET= epg$(DLLPOSTFIX)
+SHL1IMPLIB= epgm
+SHL1STDLIBS= $(TOOLSLIB) $(VCLLIB) $(CPPULIB) $(SVTOOLLIB) $(SALLIB)
+
+SHL1LIBS= $(SLB)$/epgm.lib
+
+.IF "$(GUI)" != "UNX"
+.IF "$(COM)" != "GCC"
+SHL1OBJS= $(SLO)$/epgm.obj
+.ENDIF
+.ENDIF
+
+SHL1VERSIONMAP=exports.map
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+DEF1NAME=$(SHL1TARGET)
+.ENDIF
+# ==========================================================================
+
+.INCLUDE : target.mk
diff --git a/filter/source/graphicfilter/epgm/strings.hrc b/filter/source/graphicfilter/epgm/strings.hrc
new file mode 100644
index 000000000000..122719e87d4b
--- /dev/null
+++ b/filter/source/graphicfilter/epgm/strings.hrc
@@ -0,0 +1,27 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+#define KEY_FORMAT 256
diff --git a/filter/source/graphicfilter/epict/dlgepct.cxx b/filter/source/graphicfilter/epict/dlgepct.cxx
new file mode 100644
index 000000000000..c274dc873560
--- /dev/null
+++ b/filter/source/graphicfilter/epict/dlgepct.cxx
@@ -0,0 +1,183 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+#ifndef GCC
+#endif
+
+#include <vcl/msgbox.hxx>
+#include <svtools/FilterConfigItem.hxx>
+#include <com/sun/star/awt/Size.hpp>
+#include "dlgepct.hxx"
+#include "dlgepct.hrc"
+#include "strings.hrc"
+
+/*************************************************************************
+|*
+|* Ctor
+|*
+\************************************************************************/
+
+DlgExportEPCT::DlgExportEPCT( FltCallDialogParameter& rPara ) :
+ ModalDialog ( rPara.pWindow, ResId( DLG_EXPORT_EPCT, *rPara.pResMgr ) ),
+ rFltCallPara ( rPara ),
+ aBtnOK ( this, ResId( BTN_OK, *rPara.pResMgr ) ),
+ aBtnCancel ( this, ResId( BTN_CANCEL, *rPara.pResMgr ) ),
+ aBtnHelp ( this, ResId( BTN_HELP, *rPara.pResMgr ) ),
+ aRbOriginal ( this, ResId( RB_ORIGINAL, *rPara.pResMgr ) ),
+ aRbSize ( this, ResId( RB_SIZE, *rPara.pResMgr ) ),
+ aGrpMode ( this, ResId( GRP_MODE, *rPara.pResMgr ) ),
+ aFtSizeX ( this, ResId( FT_SIZEX, *rPara.pResMgr ) ),
+ aMtfSizeX ( this, ResId( MTF_SIZEX, *rPara.pResMgr ) ),
+ aFtSizeY ( this, ResId( FT_SIZEY, *rPara.pResMgr ) ),
+ aMtfSizeY ( this, ResId( MTF_SIZEY, *rPara.pResMgr ) ),
+ aGrpSize ( this, ResId( GRP_SIZE, *rPara.pResMgr ) ),
+ pMgr ( rPara.pResMgr )
+{
+ FreeResource();
+
+ String aFilterConfigPath( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Filter/Graphic/Export/PCT" ) );
+ pConfigItem = new FilterConfigItem( aFilterConfigPath, &rPara.aFilterData );
+
+ aBtnOK.SetClickHdl( LINK( this, DlgExportEPCT, OK ) );
+ aRbOriginal.SetClickHdl( LINK( this, DlgExportEPCT, ClickRbOriginal ) );
+ aRbSize.SetClickHdl( LINK( this, DlgExportEPCT, ClickRbSize ) );
+
+ // Config-Parameter lesen
+ sal_Int32 nStrMode = pConfigItem->ReadInt32( String( ResId( KEY_MODE, *pMgr ) ), 0 );
+ ::com::sun::star::awt::Size aDefault( 10000, 10000 );
+ ::com::sun::star::awt::Size aSize;
+ aSize = pConfigItem->ReadSize( String( ResId( KEY_SIZE, *pMgr ) ), aDefault );
+
+ aMtfSizeX.SetDefaultUnit( FUNIT_MM );
+ aMtfSizeY.SetDefaultUnit( FUNIT_MM );
+ aMtfSizeX.SetValue( aSize.Width );
+ aMtfSizeY.SetValue( aSize.Height );
+
+ switch ( rPara.eFieldUnit )
+ {
+ case FUNIT_NONE :
+ case FUNIT_KM :
+ case FUNIT_PERCENT :
+ case FUNIT_CUSTOM :
+ case FUNIT_MILE :
+ case FUNIT_FOOT :
+ case FUNIT_M :
+ break; // -Wall not handled.
+ case FUNIT_MM :
+ case FUNIT_CM :
+ case FUNIT_TWIP :
+ case FUNIT_POINT :
+ case FUNIT_PICA :
+ case FUNIT_INCH :
+ case FUNIT_100TH_MM :
+ {
+ aMtfSizeX.SetUnit( rPara.eFieldUnit );
+ aMtfSizeY.SetUnit( rPara.eFieldUnit );
+ }
+ break;
+ }
+ if ( nStrMode == 1 )
+ {
+ aRbSize.Check( TRUE );
+ ClickRbSize( NULL );
+ }
+ else
+ {
+ aRbOriginal.Check( TRUE );
+ ClickRbOriginal( NULL );
+ }
+}
+
+DlgExportEPCT::~DlgExportEPCT()
+{
+ delete pConfigItem;
+}
+
+/*************************************************************************
+|*
+|* Speichert eingestellte Werte in ini-Datei
+|*
+\**************************************** ********************************/
+
+IMPL_LINK( DlgExportEPCT, OK, void *, EMPTYARG )
+{
+ // Config-Parameter schreiben
+ ::com::sun::star::awt::Size aSize(
+ (sal_Int32)MetricField::ConvertDoubleValue( aMtfSizeX.GetValue(), 2, aMtfSizeX.GetUnit(), MAP_100TH_MM ),
+ (sal_Int32)MetricField::ConvertDoubleValue( aMtfSizeY.GetValue(), 2, aMtfSizeY.GetUnit(), MAP_100TH_MM ) );
+
+ sal_Int32 nStrMode = 0;
+ if ( aRbSize.IsChecked() )
+ nStrMode++;
+
+ pConfigItem->WriteInt32( String( ResId( KEY_MODE, *pMgr ) ), nStrMode );
+ pConfigItem->WriteSize( String( ResId( KEY_SIZE, *pMgr ) ), aSize );
+ rFltCallPara.aFilterData = pConfigItem->GetFilterData();
+ EndDialog( RET_OK );
+
+ return 0;
+}
+
+/*************************************************************************
+|*
+|* Enabled/Disabled Controls
+|*
+\************************************************************************/
+
+IMPL_LINK( DlgExportEPCT, ClickRbOriginal, void*, EMPTYARG )
+{
+ aGrpSize.Disable();
+ aFtSizeX.Disable();
+ aMtfSizeX.Disable();
+ aFtSizeY.Disable();
+ aMtfSizeY.Disable();
+
+ return 0;
+}
+
+
+/*************************************************************************
+|*
+|* Enabled/Disabled Controls
+|*
+\************************************************************************/
+
+IMPL_LINK( DlgExportEPCT, ClickRbSize, void*, EMPTYARG )
+{
+ aGrpSize.Enable();
+ aFtSizeX.Enable();
+ aMtfSizeX.Enable();
+ aFtSizeY.Enable();
+ aMtfSizeY.Enable();
+
+ return 0;
+}
+
+
+
diff --git a/filter/source/graphicfilter/epict/dlgepct.hrc b/filter/source/graphicfilter/epict/dlgepct.hrc
new file mode 100644
index 000000000000..0f92aa9bda3c
--- /dev/null
+++ b/filter/source/graphicfilter/epict/dlgepct.hrc
@@ -0,0 +1,41 @@
+/*************************************************************************
+ *
+ * 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 <filter.hrc>
+
+#define BTN_OK 1
+#define BTN_CANCEL 1
+#define BTN_HELP 1
+#define CBX_SIZE 2
+#define MTF_SIZEX 1
+#define MTF_SIZEY 2
+#define FT_SIZEX 1
+#define FT_SIZEY 2
+#define GRP_SIZE 1
+#define GRP_MODE 2
+#define RB_ORIGINAL 1
+#define RB_SIZE 2
+
diff --git a/filter/source/graphicfilter/epict/dlgepct.hxx b/filter/source/graphicfilter/epict/dlgepct.hxx
new file mode 100644
index 000000000000..e879822ab1f5
--- /dev/null
+++ b/filter/source/graphicfilter/epict/dlgepct.hxx
@@ -0,0 +1,80 @@
+/*************************************************************************
+ *
+ * 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 _DLGEPCT_HXX_
+#define _DLGEPCT_HXX_
+
+#include <vcl/dialog.hxx>
+#include <vcl/button.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/field.hxx>
+#include <svtools/fltcall.hxx>
+
+/*************************************************************************
+|*
+|* Dialog zum Einstellen von Filteroptionen bei Vektorformaten
+|*
+\************************************************************************/
+
+class FilterConfigItem;
+class ResMgr;
+
+class DlgExportEPCT : public ModalDialog
+{
+private:
+
+ FltCallDialogParameter& rFltCallPara;
+
+ OKButton aBtnOK;
+ CancelButton aBtnCancel;
+ HelpButton aBtnHelp;
+
+ RadioButton aRbOriginal;
+ RadioButton aRbSize;
+ FixedLine aGrpMode;
+
+ FixedText aFtSizeX;
+ MetricField aMtfSizeX;
+ FixedText aFtSizeY;
+ MetricField aMtfSizeY;
+ FixedLine aGrpSize;
+
+ FilterConfigItem* pConfigItem;
+ ResMgr* pMgr;
+
+ DECL_LINK( OK, void* p );
+ DECL_LINK( ClickRbOriginal,void* p );
+ DECL_LINK( ClickRbSize,void* p );
+
+public:
+ DlgExportEPCT( FltCallDialogParameter& rPara );
+ ~DlgExportEPCT();
+};
+
+#endif // _DLGEPCT_HXX_
+
diff --git a/filter/source/graphicfilter/epict/dlgepct.src b/filter/source/graphicfilter/epict/dlgepct.src
new file mode 100644
index 000000000000..d503c53cf89c
--- /dev/null
+++ b/filter/source/graphicfilter/epict/dlgepct.src
@@ -0,0 +1,163 @@
+/*************************************************************************
+ *
+ * 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 "dlgepct.hrc"
+
+ModalDialog DLG_EXPORT_EPCT
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 178 , 89 ) ;
+ Text [ en-US ] = "PICT Options" ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ MetricField MTF_SIZEX
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 60 , 55 ) ;
+ Size = MAP_APPFONT ( 50 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 100 ;
+ Maximum = 99999 ;
+ StrictFormat = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_MM ;
+ First = 100 ;
+ Last = 99999 ;
+ SpinSize = 100 ;
+ };
+ MetricField MTF_SIZEY
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 60 , 71 ) ;
+ Size = MAP_APPFONT ( 50 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 100 ;
+ Maximum = 99999 ;
+ StrictFormat = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_MM ;
+ First = 100 ;
+ Last = 99999 ;
+ SpinSize = 100 ;
+ };
+ FixedLine GRP_SIZE
+ {
+ Pos = MAP_APPFONT ( 6 , 44 ) ;
+ Size = MAP_APPFONT ( 110 , 8 ) ;
+ Text [ en-US ] = "Size" ;
+ };
+ FixedText FT_SIZEX
+ {
+ Pos = MAP_APPFONT ( 12 , 57 ) ;
+ Size = MAP_APPFONT ( 45 , 8 ) ;
+ Text [ en-US ] = "Width" ;
+ };
+ FixedText FT_SIZEY
+ {
+ Pos = MAP_APPFONT ( 12 , 73 ) ;
+ Size = MAP_APPFONT ( 45 , 8 ) ;
+ Text [ en-US ] = "Height" ;
+ };
+ OKButton BTN_OK
+ {
+ Pos = MAP_APPFONT ( 122 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( 122 , 24 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton BTN_HELP
+ {
+ Pos = MAP_APPFONT ( 122 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ RadioButton RB_ORIGINAL
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 98 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Original" ;
+ };
+ RadioButton RB_SIZE
+ {
+ Pos = MAP_APPFONT ( 12 , 28 ) ;
+ Size = MAP_APPFONT ( 98 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Size" ;
+ };
+ FixedLine GRP_MODE
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 110 , 8 ) ;
+ Text [ en-US ] = "Mode" ;
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/filter/source/graphicfilter/epict/epict.cxx b/filter/source/graphicfilter/epict/epict.cxx
new file mode 100644
index 000000000000..7e81077e3810
--- /dev/null
+++ b/filter/source/graphicfilter/epict/epict.cxx
@@ -0,0 +1,2387 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include <vcl/metaact.hxx>
+#include <svtools/filter.hxx>
+#include <svl/solar.hrc>
+#include <svtools/fltcall.hxx>
+
+#include <math.h>
+#include <vcl/bmpacc.hxx>
+#include <vcl/metaact.hxx>
+#include <vcl/graph.hxx>
+#include <vcl/bmpacc.hxx>
+#include <vcl/gradient.hxx>
+#include <vcl/hatch.hxx>
+#include <vcl/metric.hxx>
+#include <vcl/font.hxx>
+#include <vcl/virdev.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/gdimtf.hxx>
+
+#include <tools/bigint.hxx>
+#include "strings.hrc"
+#include "dlgepct.hrc"
+#include "dlgepct.hxx"
+
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+
+//============================== PictWriter ===================================
+
+struct PictWriterAttrStackMember {
+ struct PictWriterAttrStackMember * pSucc;
+ Color aLineColor;
+ Color aFillColor;
+ RasterOp eRasterOp;
+ Font aFont;
+ MapMode aMapMode;
+ Rectangle aClipRect;
+};
+
+
+enum PictDrawingMethod {
+ PDM_FRAME, PDM_PAINT, PDM_ERASE, PDM_INVERT, PDM_FILL
+};
+
+
+struct PictPattern {
+ sal_uInt32 nLo, nHi;
+};
+
+class PictWriter {
+
+private:
+
+ BOOL bStatus;
+ ULONG nLastPercent; // Mit welcher Zahl pCallback zuletzt aufgerufen wurde.
+ com::sun::star::uno::Reference< com::sun::star::task::XStatusIndicator > xStatusIndicator;
+
+ SvStream * pPict;
+
+ // Aktuelle Attribute im Quell-Metafile:
+ Color aLineColor;
+ Color aFillColor;
+ RasterOp eSrcRasterOp;
+ Font aSrcFont;
+ MapMode aSrcMapMode;
+ MapMode aTargetMapMode;
+ Rectangle aClipRect;
+ PictWriterAttrStackMember * pAttrStack;
+
+ // Aktuelle Attribute im Ziel-Metafile, und ob sie gueltig sind
+ BOOL bDstBkPatVisible; BOOL bDstBkPatValid;
+ BYTE nDstTxFace; BOOL bDstTxFaceValid;
+ RasterOp eDstTxMode; BOOL bDstTxModeValid;
+ USHORT nDstPnSize; BOOL bDstPnSizeValid;
+ RasterOp eDstPnMode; BOOL bDstPnModeValid;
+ PictPattern aDstPnPat; BOOL bDstPnPatValid;
+ BOOL bDstFillPatVisible; BOOL bDstFillPatValid;
+ USHORT nDstTxSize; BOOL bDstTxSizeValid;
+ Color aDstFgCol; BOOL bDstFgColValid;
+ Color aDstBkCol; BOOL bDstBkColValid;
+ Point aDstPenPosition; BOOL bDstPenPositionValid;
+ Point aDstTextPosition; BOOL bDstTextPositionValid;
+ String aDstFontName; USHORT nDstFontNameId; BOOL bDstFontNameValid;
+
+ ULONG nNumberOfActions; // Anzahl der Actions im GDIMetafile
+ ULONG nNumberOfBitmaps; // Anzahl der Bitmaps
+ ULONG nWrittenActions; // Anzahl der bereits verarbeiteten Actions beim Schreiben der Opcodes
+ ULONG nWrittenBitmaps; // Anzahl der bereits geschriebenen Bitmaps
+ ULONG nActBitmapPercent; // Wieviel Prozent die naechste Bitmap schon geschrieben ist.
+
+ void MayCallback();
+ // Berechnet anhand der obigen 5 Parameter eine Prozentzahl
+ // und macht dann ggf. einen Callback. Setzt bStatus auf FALSE wenn User abbrechen
+ // moechte.
+
+ void CountActionsAndBitmaps(const GDIMetaFile & rMTF);
+ // Zaehlt die Bitmaps und Actions (nNumberOfActions und nNumberOfBitmaps muessen
+ // zu Anfang auf 0 gesetzt werden, weil diese Methode rekursiv ist)
+
+ Polygon PolyPolygonToPolygon(const PolyPolygon & rPoly);
+ // Macht aus einem PolyPolygon ein halbwegs vernuenftiges Polygon
+
+ Rectangle MapRectangle( const Rectangle& rRect );
+ void WritePoint(const Point & rPoint);
+ void WriteSize(const Size & rSize);
+ void WriteRGBColor(const Color & rColor);
+ void WriteString( const String & rString );
+ void WriteRectangle(const Rectangle & rRect);
+ void WritePolygon(const Polygon & rPoly);
+ void WriteArcAngles(const Rectangle & rRect, const Point & rStartPt, const Point & rEndPt);
+
+ void ConvertLinePattern(PictPattern & rPat, BOOL bVisible);
+ void ConvertFillPattern(PictPattern & rPat, BOOL bVisible);
+
+ void WriteOpcode_TxFace(const Font & rFont);
+ void WriteOpcode_TxMode(RasterOp eMode);
+ void WriteOpcode_PnSize(USHORT nSize);
+ void WriteOpcode_PnMode(RasterOp eMode);
+ void WriteOpcode_PnLinePat(BOOL bVisible);
+ void WriteOpcode_PnFillPat(BOOL bVisible);
+ void WriteOpcode_OvSize(const Size & rSize);
+ void WriteOpcode_TxSize(USHORT nSize);
+ void WriteOpcode_RGBFgCol(const Color & rColor);
+ void WriteOpcode_RGBBkCol(const Color & rColor);
+ void WriteOpcode_Line(const Point & rLocPt, const Point & rNewPt);
+ void WriteOpcode_LineFrom(const Point & rNewPt);
+ void WriteOpcode_Text(const Point & rPoint, const String& rString, BOOL bDelta);
+ void WriteOpcode_FontName(const Font & rFont);
+ void WriteOpcode_ClipRect( const Rectangle& rRect );
+ void WriteOpcode_Rect(PictDrawingMethod eMethod, const Rectangle & rRect);
+ void WriteOpcode_SameRect(PictDrawingMethod eMethod);
+ void WriteOpcode_RRect(PictDrawingMethod eMethod, const Rectangle & rRect);
+ void WriteOpcode_SameRRect(PictDrawingMethod eMethod);
+ void WriteOpcode_Oval(PictDrawingMethod eMethod, const Rectangle & rRect);
+ void WriteOpcode_SameOval(PictDrawingMethod eMethod);
+ void WriteOpcode_Arc(PictDrawingMethod eMethod, const Rectangle & rRect,
+ const Point & rStartPt, const Point & rEndPt);
+ void WriteOpcode_SameArc(PictDrawingMethod eMethod, const Rectangle & rRect,
+ const Point & rStartPt, const Point & rEndPt);
+ void WriteOpcode_Poly(PictDrawingMethod eMethod, const Polygon & rPoly);
+ void WriteOpcode_BitsRect(const Point & rPoint, const Size & rSize, const Bitmap & rBitmap);
+ void WriteOpcode_EndOfFile();
+
+ void SetAttrForPaint();
+ void SetAttrForFrame();
+ void SetAttrForText();
+
+ void WriteTextArray(Point & rPoint, const String& rString, const sal_Int32 * pDXAry);
+
+ void HandleLineInfoPolyPolygons(const LineInfo& rInfo, const basegfx::B2DPolygon& rLinePolygon);
+ void WriteOpcodes(const GDIMetaFile & rMTF);
+
+ void WriteHeader(const GDIMetaFile & rMTF);
+ void UpdateHeader();
+
+public:
+
+ BOOL WritePict( const GDIMetaFile & rMTF, SvStream & rTargetStream, FilterConfigItem* pFilterConfigItem );
+};
+
+
+//========================== Methoden von PictWriter ==========================
+
+
+void PictWriter::MayCallback()
+{
+ if ( xStatusIndicator.is() )
+ {
+ ULONG nPercent;
+ nPercent=((nWrittenBitmaps<<14)+(nActBitmapPercent<<14)/100+nWrittenActions)
+ *100
+ /((nNumberOfBitmaps<<14)+nNumberOfActions);
+
+ if (nPercent>=nLastPercent+3)
+ {
+ nLastPercent=nPercent;
+ if( nPercent<=100 )
+ xStatusIndicator->setValue( nPercent );
+ }
+ }
+}
+
+void PictWriter::CountActionsAndBitmaps(const GDIMetaFile & rMTF)
+{
+ ULONG nAction, nActionCount;
+ const MetaAction* pMA;
+
+ nActionCount = rMTF.GetActionCount();
+
+ for (nAction=0; nAction<nActionCount; nAction++)
+ {
+ pMA = rMTF.GetAction( nAction );
+
+ switch( pMA->GetType() )
+ {
+ case META_BMP_ACTION:
+ case META_BMPSCALE_ACTION:
+ case META_BMPSCALEPART_ACTION:
+ case META_BMPEX_ACTION:
+ case META_BMPEXSCALE_ACTION:
+ case META_BMPEXSCALEPART_ACTION:
+ nNumberOfBitmaps++;
+ break;
+ }
+
+ nNumberOfActions++;
+ }
+}
+
+
+Polygon PictWriter::PolyPolygonToPolygon(const PolyPolygon & rPolyPoly)
+{
+ USHORT nCount,nSize1,nSize2,np,i1,i2,i3,nBestIdx1,nBestIdx2;
+ long nDistSqr,nBestDistSqr, nCountdownTests;
+ Point aP1,aPRel;
+ Polygon aPoly1, aPoly2, aPoly3;
+
+ nCount=rPolyPoly.Count();
+ if (nCount==0) return Polygon(0);
+
+ aPoly1=rPolyPoly.GetObject(0);
+ for (np=1; np<nCount; np++) {
+ aPoly2=rPolyPoly.GetObject(np);
+
+ //-----------------Folgendes verschmilzt aPoly1 und aPoly2 zu aPoly1-----------------
+
+ nSize1=aPoly1.GetSize();
+ nSize2=aPoly2.GetSize();
+
+ // Zunaechst werden ein Punkt in aPoly1 (referenziert durch nBestIdx1) und ein
+ // Punkt in aPoly2 (referenziert durch nBestIdx2) gesucht, die moeglichst dicht
+ // beieinander liegen. Da dies mit quadratischem Aufwand einher geht, und somit
+ // manche Bilder Ewigkeiten benoetigen, um exportiert zu werden, begrenzen wir
+ // die Anzahl der Tests auf 1000, und brechen die Suche ggf. schon vorher ab.
+ // Dadruch wird das Ergebnis nicht falsch, sondern eventuell nicht so schoen.
+ nCountdownTests=1000;
+ nBestDistSqr=0x7fffffff;
+ nBestIdx1=0;
+ nBestIdx2=0;
+ for (i1=0; i1<nSize1; i1++) {
+ aP1=aPoly1.GetPoint(i1);
+ for (i2=0; i2<nSize2; i2++) {
+ aPRel=aPoly2.GetPoint(i2); aPRel-=aP1;
+ nDistSqr=aPRel.X()*aPRel.X()+aPRel.Y()*aPRel.Y();
+ if (nDistSqr<nBestDistSqr) {
+ nBestIdx1=i1;
+ nBestIdx2=i2;
+ nBestDistSqr=nDistSqr;
+ }
+ if (nCountdownTests<=0) break;
+ nCountdownTests--;
+ }
+ if (nCountdownTests<=0) break;
+ }
+
+ // Nun werden aPoly1 und aPoly2 zu einem Polygon aPoly3 (spaeter aPoly1) zusammengefuegt.
+ // Die beiden Polygone werden verbunden durch zwei zusaetzliche Kanten zwischen den oben
+ // gefundenen Punkten.
+ aPoly3.Clear();
+ aPoly3.SetSize(nSize1+nSize2+2);
+ i3=0;
+ for (i1=nBestIdx1; i1<nSize1; i1++) aPoly3.SetPoint(aPoly1.GetPoint(i1),i3++);
+ for (i1=0; i1<=nBestIdx1; i1++) aPoly3.SetPoint(aPoly1.GetPoint(i1),i3++);
+ for (i2=nBestIdx2; i2<nSize2; i2++) aPoly3.SetPoint(aPoly2.GetPoint(i2),i3++);
+ for (i2=0; i2<=nBestIdx2; i2++) aPoly3.SetPoint(aPoly2.GetPoint(i2),i3++);
+
+ aPoly1=aPoly3;
+
+ //-----------------------------------------------------------------------------------
+
+ }
+ return aPoly1;
+}
+
+
+void PictWriter::WritePoint(const Point & rPoint)
+{
+ Point aPoint = OutputDevice::LogicToLogic( rPoint, aSrcMapMode, aTargetMapMode );
+ *pPict << ((short)aPoint.Y()) << ((short)aPoint.X());
+}
+
+
+void PictWriter::WriteSize(const Size & rSize)
+{
+ OutputDevice::LogicToLogic( rSize, aSrcMapMode, aTargetMapMode ); // -Wall is this needed.
+ *pPict << ((short)rSize.Height()) << ((short)rSize.Width());
+}
+
+
+void PictWriter::WriteRGBColor(const Color & rColor)
+{
+ const UINT16 nR = ( (UINT16) rColor.GetRed() << 8 ) | (UINT16) rColor.GetRed();
+ const UINT16 nG = ( (UINT16) rColor.GetGreen() << 8 ) | (UINT16) rColor.GetGreen();
+ const UINT16 nB = ( (UINT16) rColor.GetBlue() << 8 ) | (UINT16) rColor.GetBlue();
+
+ *pPict << nR << nG << nB;
+}
+
+
+void PictWriter::WriteString( const String & rString )
+{
+ USHORT i,nLen;
+
+ ByteString aByteString( rString, gsl_getSystemTextEncoding() );
+ nLen = aByteString.Len();
+ if ( nLen > 255 )
+ nLen = 255;
+ *pPict << ( (BYTE)nLen );
+ for ( i = 0; i < nLen; i++ )
+ *pPict << aByteString.GetChar( i );
+}
+
+Rectangle PictWriter::MapRectangle( const Rectangle& rRect )
+{
+ Point aPoint = OutputDevice::LogicToLogic( rRect.TopLeft(), aSrcMapMode, aTargetMapMode );
+ Size aSize = OutputDevice::LogicToLogic( rRect.GetSize(), aSrcMapMode, aTargetMapMode );
+ Rectangle aRect( aPoint, aSize );
+ aRect.Justify();
+ aRect.nBottom++;
+ aRect.nRight++;
+ return aRect;
+}
+
+void PictWriter::WriteRectangle(const Rectangle & rRect)
+{
+ Rectangle aRect( MapRectangle( rRect ) );
+ *pPict << (sal_Int16)aRect.Top() << (sal_Int16)aRect.Left()
+ << (sal_Int16)aRect.Bottom() << (sal_Int16)aRect.Right();
+}
+
+void PictWriter::WritePolygon(const Polygon & rPoly)
+{
+ USHORT nDataSize,i,nSize;
+ short nMinX = 0, nMinY = 0, nMaxX = 0, nMaxY = 0;
+ short nx,ny;
+ Polygon aPoly(rPoly);
+
+ nSize=aPoly.GetSize();
+
+ if (aPoly.GetPoint(0) != aPoly.GetPoint(nSize-1))
+ {
+ nSize++;
+ aPoly.SetSize(nSize);
+ aPoly.SetPoint(aPoly.GetPoint(0),nSize-1);
+ }
+
+ nDataSize=nSize*4+10;
+ for (i=0; i<nSize; i++)
+ {
+ Point aPoint = OutputDevice::LogicToLogic( aPoly.GetPoint( i ),
+ aSrcMapMode,
+ aTargetMapMode );
+
+ nx = (short) aPoint.X();
+ ny = (short) aPoint.Y();
+
+ if ( i==0 || nMinX>nx )
+ nMinX=nx;
+ if ( i==0 || nMinY>ny )
+ nMinY=ny;
+ if ( i==0 || nMaxX<nx )
+ nMaxX=nx;
+ if ( i==0 || nMaxY<ny )
+ nMaxY=ny;
+ }
+
+ *pPict << nDataSize << nMinY << nMinX << nMaxY << nMaxX;
+
+ for (i=0; i<nSize; i++)
+ WritePoint( aPoly.GetPoint(i) );
+}
+
+
+void PictWriter::WriteArcAngles(const Rectangle & rRect, const Point & rStartPt, const Point & rEndPt)
+{
+ Point aStartPt = OutputDevice::LogicToLogic( rStartPt,
+ aSrcMapMode,
+ aTargetMapMode );
+ Point aEndPt = OutputDevice::LogicToLogic( rEndPt,
+ aSrcMapMode,
+ aTargetMapMode );
+ Rectangle aRect( OutputDevice::LogicToLogic( rRect.TopLeft(),
+ aSrcMapMode,
+ aTargetMapMode ),
+ OutputDevice::LogicToLogic( rRect.GetSize(),
+ aSrcMapMode,
+ aTargetMapMode ) );
+ Point aCenter;
+ double fAngS, fAngE, fdx, fdy;
+ short nStartAngle, nArcAngle;
+
+
+ aCenter=Point( ( aRect.Left() + aRect.Right() ) >> 1,
+ ( aRect.Top() + aRect.Bottom() ) >> 1 );
+
+ fdx=(double)(aStartPt.X()-aCenter.X());
+ fdy=(double)(aStartPt.Y()-aCenter.Y());
+ if ( fdx==0.0 && fdy==0.0 )
+ fdx=1.0;
+ fAngE=atan2(fdx,-fdy);
+
+ fdx=(double)(aEndPt.X()-aCenter.X());
+ fdy=(double)(aEndPt.Y()-aCenter.Y());
+ if ( fdx==0.0 && fdy==0.0 )
+ fdx=1.0;
+ fAngS=atan2(fdx,-fdy);
+
+ nStartAngle=(short)(fAngS*180.0/3.14159265359);
+ nArcAngle=((short)(fAngE*180.0/3.14159265359))-nStartAngle;
+ if (nArcAngle<0)
+ nArcAngle += 360;
+ *pPict << nStartAngle << nArcAngle;
+}
+
+
+void PictWriter::ConvertLinePattern(PictPattern & rPat, BOOL bVisible)
+{
+ if( bVisible )
+ {
+ rPat.nHi=0xffffffff;
+ rPat.nLo=0xffffffff;
+ }
+ else
+ {
+ rPat.nHi=0x00000000;
+ rPat.nLo=0x00000000;
+ }
+}
+
+void PictWriter::ConvertFillPattern(PictPattern & rPat, BOOL bVisible)
+{
+ if( bVisible )
+ {
+ rPat.nHi=0xffffffff;
+ rPat.nLo=0xffffffff;
+ }
+ else
+ {
+ rPat.nHi=0x00000000;
+ rPat.nLo=0x00000000;
+ }
+}
+
+
+void PictWriter::WriteOpcode_TxFace(const Font & rFont)
+{
+ BYTE nFace;
+ FontWeight eWeight;
+
+ nFace=0;
+ eWeight=rFont.GetWeight();
+ if (eWeight==WEIGHT_BOLD ||
+ eWeight==WEIGHT_SEMIBOLD ||
+ eWeight==WEIGHT_ULTRABOLD ||
+ eWeight==WEIGHT_BLACK) nFace|=0x01;
+ if (rFont.GetItalic()!=ITALIC_NONE) nFace|=0x02;
+ if (rFont.GetUnderline()!=UNDERLINE_NONE) nFace|=0x04;
+ if (rFont.IsOutline()==TRUE) nFace|=0x08;
+ if (rFont.IsShadow()==TRUE) nFace|=0x10;
+
+ if (bDstTxFaceValid==FALSE || nDstTxFace!=nFace) {
+ *pPict << (USHORT)0x0004 << nFace << (BYTE)0;
+ nDstTxFace=nFace;
+ bDstTxFaceValid=TRUE;
+ }
+}
+
+
+void PictWriter::WriteOpcode_TxMode(RasterOp eMode)
+{
+ USHORT nVal;
+
+ if (bDstTxModeValid==FALSE || eDstTxMode!=eMode) {
+ switch (eMode) {
+ case ROP_INVERT: nVal=0x000c; break;
+ case ROP_XOR: nVal=0x000a; break;
+ default: nVal=0x0008;
+ }
+ *pPict << (USHORT)0x0005 << nVal;
+ eDstTxMode=eMode;
+ bDstTxModeValid=TRUE;
+ }
+}
+
+
+void PictWriter::WriteOpcode_PnSize(USHORT nSize)
+{
+ if (nSize==0) nSize=1;
+ if (bDstPnSizeValid==FALSE || nDstPnSize!=nSize) {
+ *pPict << (USHORT)0x0007 << nSize << nSize;
+ nDstPnSize=nSize;
+ bDstPnSizeValid=TRUE;
+ }
+}
+
+
+void PictWriter::WriteOpcode_PnMode(RasterOp eMode)
+{
+ USHORT nVal;
+
+ if (bDstPnModeValid==FALSE || eDstPnMode!=eMode) {
+ switch (eMode)
+ {
+ case ROP_INVERT: nVal=0x000c; break;
+ case ROP_XOR: nVal=0x000a; break;
+ default: nVal=0x0008;
+ }
+ *pPict << (USHORT)0x0008 << nVal;
+ eDstPnMode=eMode;
+ bDstPnModeValid=TRUE;
+ }
+}
+
+
+void PictWriter::WriteOpcode_PnLinePat(BOOL bVisible)
+{
+ PictPattern aPat;
+
+ ConvertLinePattern(aPat,bVisible);
+ if (bDstPnPatValid==FALSE || aDstPnPat.nHi!=aPat.nHi || aDstPnPat.nLo!=aPat.nLo) {
+ *pPict << (USHORT)0x0009 << aPat.nHi << aPat.nLo;
+ aDstPnPat=aPat;
+ bDstPnPatValid=TRUE;
+ }
+}
+
+
+void PictWriter::WriteOpcode_PnFillPat(BOOL bVisible)
+{
+ PictPattern aPat;
+
+ ConvertFillPattern(aPat,bVisible);
+ if (bDstPnPatValid==FALSE || aDstPnPat.nHi!=aPat.nHi || aDstPnPat.nLo!=aPat.nLo) {
+ *pPict << (USHORT)0x0009 << aPat.nHi << aPat.nLo;
+ aDstPnPat=aPat;
+ bDstPnPatValid=TRUE;
+ }
+}
+
+
+void PictWriter::WriteOpcode_OvSize(const Size & rSize)
+{
+ *pPict << (USHORT)0x000b;
+ WriteSize(rSize);
+}
+
+
+void PictWriter::WriteOpcode_TxSize(USHORT nSize)
+{
+ if (bDstTxSizeValid==FALSE || nDstTxSize!=nSize) {
+
+ nDstTxSize = (USHORT) OutputDevice::LogicToLogic( Size( 0, nSize ),
+ aSrcMapMode, aTargetMapMode ).Height();
+
+ *pPict << (USHORT)0x000d << nDstTxSize;
+ bDstTxSizeValid=TRUE;
+ }
+}
+
+
+void PictWriter::WriteOpcode_RGBFgCol(const Color & rColor)
+{
+ if (bDstFgColValid==FALSE || aDstFgCol!=rColor) {
+ *pPict << (USHORT)0x001a;
+ WriteRGBColor(rColor);
+ aDstFgCol=rColor;
+ bDstFgColValid=TRUE;
+ }
+}
+
+
+void PictWriter::WriteOpcode_RGBBkCol(const Color & rColor)
+{
+ if (bDstBkColValid==FALSE || aDstBkCol!=rColor) {
+ *pPict << (USHORT)0x001b;
+ WriteRGBColor(rColor);
+ aDstBkCol=rColor;
+ bDstBkColValid=TRUE;
+ }
+}
+
+
+void PictWriter::WriteOpcode_Line(const Point & rLocPt, const Point & rNewPt)
+{
+ Point aLocPt = OutputDevice::LogicToLogic( rLocPt,
+ aSrcMapMode,
+ aTargetMapMode );
+ Point aNewPt = OutputDevice::LogicToLogic( rNewPt,
+ aSrcMapMode,
+ aTargetMapMode );
+ long dh,dv;
+
+ dh=aNewPt.X()-aLocPt.X();
+ dv=aNewPt.Y()-aLocPt.Y();
+ if (dh<=127 && dh>=-128 && dv<=127 && dv>=-128)
+ { // ShortLine
+ *pPict << (USHORT)0x0022;
+ WritePoint(rLocPt);
+ *pPict << (char)dh << (char)dv;
+ }
+ else
+ {
+ *pPict << (USHORT)0x0020;
+ WritePoint(rLocPt);
+ WritePoint(rNewPt);
+ }
+ aDstPenPosition=rNewPt;
+ bDstPenPositionValid=TRUE;
+}
+
+
+void PictWriter::WriteOpcode_LineFrom(const Point & rNewPt)
+{
+ Point aNewPt = OutputDevice::LogicToLogic( rNewPt,
+ aSrcMapMode,
+ aTargetMapMode );
+ long dh,dv;
+
+ dh = aNewPt.X()-aDstPenPosition.X();
+ dv = aNewPt.Y()-aDstPenPosition.Y();
+
+ if (dh<=127 && dh>=-128 && dv<=127 && dv>=-128)
+ { // ShortLine
+ *pPict << (USHORT)0x0023;
+ *pPict << (char)dh << (char)dv;
+ }
+ else
+ {
+ *pPict << (USHORT)0x0021;
+ WritePoint(rNewPt);
+ }
+ aDstPenPosition=rNewPt;
+ bDstPenPositionValid=TRUE;
+}
+
+
+void PictWriter::WriteOpcode_Text(const Point & rPoint, const String& rString, BOOL bDelta)
+{
+ Point aPoint = OutputDevice::LogicToLogic( rPoint,
+ aSrcMapMode,
+ aTargetMapMode );
+ long dh,dv;
+ ULONG nPos;
+
+ nPos = pPict->Tell();
+ dh = aPoint.X()-aDstTextPosition.X();
+ dv = aPoint.Y()-aDstTextPosition.Y();
+
+ if (bDstTextPositionValid==FALSE || dh<0 || dh>255 || dv<0 || dv>0 || bDelta==FALSE)
+ {
+ *pPict << (USHORT)0x0028;
+ WritePoint(rPoint);
+ }
+ else if (dv==0)
+ {
+ *pPict << (USHORT)0x0029 << (BYTE)dh;
+ }
+ else if (dh==0)
+ {
+ *pPict << (USHORT)0x002a << (BYTE)dv;
+ }
+ else
+ {
+ *pPict << (USHORT)0x002b << (BYTE)dh << (BYTE)dv;
+ }
+
+ WriteString( rString );
+ if (((pPict->Tell()-nPos)&1)!=0)
+ *pPict << (BYTE)0;
+
+ aDstTextPosition = aPoint;
+ bDstTextPositionValid=TRUE;
+}
+
+
+void PictWriter::WriteOpcode_FontName(const Font & rFont)
+{
+ USHORT nDataLen,nFontId;
+
+ switch (rFont.GetFamily()) {
+ case FAMILY_MODERN: nFontId=22; break;
+ case FAMILY_ROMAN: nFontId=20; break;
+ case FAMILY_SWISS: nFontId=21; break;
+ default: nFontId=1;
+ }
+
+ if (bDstFontNameValid==FALSE || nDstFontNameId!=nFontId || aDstFontName!=rFont.GetName())
+ {
+ ByteString aByteString( rFont.GetName(), gsl_getSystemTextEncoding() );
+ sal_uInt16 nFontNameLen = aByteString.Len();
+ if ( nFontNameLen )
+ {
+ nDataLen = 3 + nFontNameLen;
+ *pPict << (USHORT)0x002c << nDataLen << nFontId;
+ WriteString( rFont.GetName() );
+ if ( ( nFontNameLen & 1 ) == 0 )
+ *pPict << (BYTE)0;
+ }
+ *pPict << (USHORT)0x0003 << nFontId;
+ aDstFontName=rFont.GetName();
+ nDstFontNameId=nFontId;
+ bDstFontNameValid=TRUE;
+ }
+}
+
+void PictWriter::WriteOpcode_ClipRect( const Rectangle& rRect )
+{
+ Rectangle aRect( MapRectangle( rRect ) );
+ aRect.nBottom++;
+ aRect.nRight++;
+ *pPict << (sal_uInt16)1 // opcode 1
+ << (sal_uInt16)10 // data size
+ << (sal_Int16)aRect.Top() << (sal_Int16)aRect.Left()
+ << (sal_Int16)aRect.Bottom() << (sal_Int16)aRect.Right();
+ aClipRect = aRect;
+}
+
+void PictWriter::WriteOpcode_Rect(PictDrawingMethod eMethod, const Rectangle & rRect)
+{
+ USHORT oc;
+ switch (eMethod) {
+ case PDM_FRAME: oc=0x0030; break;
+ case PDM_PAINT: oc=0x0031; break;
+ case PDM_ERASE: oc=0x0032; break;
+ case PDM_INVERT: oc=0x0033; break;
+ case PDM_FILL: oc=0x0034; break;
+ default: oc=0; break; // -Wall a default for oc...
+ }
+ *pPict << oc;
+ WriteRectangle(rRect);
+}
+
+
+void PictWriter::WriteOpcode_SameRect(PictDrawingMethod eMethod)
+{
+ USHORT oc;
+ switch (eMethod) {
+ case PDM_FRAME: oc=0x0038; break;
+ case PDM_PAINT: oc=0x0039; break;
+ case PDM_ERASE: oc=0x003a; break;
+ case PDM_INVERT: oc=0x003b; break;
+ case PDM_FILL: oc=0x003c; break;
+ default: oc=0; break; // -Wall a default for oc...
+ }
+ *pPict << oc;
+}
+
+
+void PictWriter::WriteOpcode_RRect(PictDrawingMethod eMethod, const Rectangle & rRect)
+{
+ USHORT oc;
+ switch (eMethod) {
+ case PDM_FRAME: oc=0x0040; break;
+ case PDM_PAINT: oc=0x0041; break;
+ case PDM_ERASE: oc=0x0042; break;
+ case PDM_INVERT: oc=0x0043; break;
+ case PDM_FILL: oc=0x0044; break;
+ default: oc=0; break; // -Wall a default for oc...
+ }
+ *pPict << oc;
+ WriteRectangle(rRect);
+}
+
+
+void PictWriter::WriteOpcode_SameRRect(PictDrawingMethod eMethod)
+{
+ USHORT oc;
+ switch (eMethod) {
+ case PDM_FRAME: oc=0x0048; break;
+ case PDM_PAINT: oc=0x0049; break;
+ case PDM_ERASE: oc=0x004a; break;
+ case PDM_INVERT: oc=0x004b; break;
+ case PDM_FILL: oc=0x004c; break;
+ default: oc=0; break; // -Wall a default for oc...
+ }
+ *pPict << oc;
+}
+
+
+void PictWriter::WriteOpcode_Oval(PictDrawingMethod eMethod, const Rectangle & rRect)
+{
+ USHORT oc;
+ switch (eMethod) {
+ case PDM_FRAME: oc=0x0050; break;
+ case PDM_PAINT: oc=0x0051; break;
+ case PDM_ERASE: oc=0x0052; break;
+ case PDM_INVERT: oc=0x0053; break;
+ case PDM_FILL: oc=0x0054; break;
+ default: oc=0; break; // -Wall a default for oc...
+ }
+ *pPict << oc;
+ WriteRectangle(rRect);
+}
+
+
+void PictWriter::WriteOpcode_SameOval(PictDrawingMethod eMethod)
+{
+ USHORT oc;
+ switch (eMethod) {
+ case PDM_FRAME: oc=0x0058; break;
+ case PDM_PAINT: oc=0x0059; break;
+ case PDM_ERASE: oc=0x005a; break;
+ case PDM_INVERT: oc=0x005b; break;
+ case PDM_FILL: oc=0x005c; break;
+ default: oc=0; break; // -Wall a default for oc...
+ }
+ *pPict << oc;
+}
+
+
+void PictWriter::WriteOpcode_Arc(PictDrawingMethod eMethod, const Rectangle & rRect,
+ const Point & rStartPt, const Point & rEndPt)
+{
+ USHORT oc;
+ switch (eMethod) {
+ case PDM_FRAME: oc=0x0060; break;
+ case PDM_PAINT: oc=0x0061; break;
+ case PDM_ERASE: oc=0x0062; break;
+ case PDM_INVERT: oc=0x0063; break;
+ case PDM_FILL: oc=0x0064; break;
+ default: oc=0; break; // -Wall a default for oc...
+ }
+ *pPict << oc;
+ WriteRectangle(rRect);
+ WriteArcAngles(rRect,rStartPt,rEndPt);
+}
+
+
+void PictWriter::WriteOpcode_SameArc(PictDrawingMethod eMethod, const Rectangle & rRect,
+ const Point & rStartPt, const Point & rEndPt)
+{
+ USHORT oc;
+ switch (eMethod) {
+ case PDM_FRAME: oc=0x0068; break;
+ case PDM_PAINT: oc=0x0069; break;
+ case PDM_ERASE: oc=0x006a; break;
+ case PDM_INVERT: oc=0x006b; break;
+ case PDM_FILL: oc=0x006c; break;
+ default: oc=0; break; // -Wall a default for oc...
+ }
+ *pPict << oc;
+ WriteArcAngles(rRect,rStartPt,rEndPt);
+}
+
+
+void PictWriter::WriteOpcode_Poly(PictDrawingMethod eMethod, const Polygon & rPoly)
+{
+ USHORT oc;
+
+ if (rPoly.GetSize()<3) return;
+ switch (eMethod) {
+ case PDM_FRAME: oc=0x0070; break;
+ case PDM_PAINT: oc=0x0071; break;
+ case PDM_ERASE: oc=0x0072; break;
+ case PDM_INVERT: oc=0x0073; break;
+ case PDM_FILL: oc=0x0074; break;
+ default: oc=0; break; // -Wall a default for oc...
+ }
+ *pPict << oc;
+ WritePolygon(rPoly);
+}
+
+
+void PictWriter::WriteOpcode_BitsRect(const Point & rPoint, const Size & rSize, const Bitmap & rBitmap)
+{
+ BitmapReadAccess* pAcc = NULL;
+ Bitmap aBitmap( rBitmap );
+
+ ULONG nWidth, nHeight, nDstRowBytes, nx, nc, ny, nCount, nColTabSize, i;
+ ULONG nDstRowPos, nSrcRowBytes, nEqu3, nPos, nDstMapPos;
+ USHORT nBitsPerPixel, nPackType;
+ BYTE *pComp[4], *pPix, *pTemp;
+ BYTE nEquData = 0;
+ BYTE nFlagCounterByte, nRed, nGreen, nBlue;
+
+ SetAttrForPaint();
+
+ // temopraere Windows-BMP-Datei erzeugen:
+ nActBitmapPercent=30;
+ MayCallback();
+
+ if ( bStatus == FALSE )
+ return;
+ if ( ( pAcc = aBitmap.AcquireReadAccess() ) == NULL )
+ return;
+
+ nBitsPerPixel = aBitmap.GetBitCount();
+
+ // export code below only handles four discrete cases
+ nBitsPerPixel =
+ nBitsPerPixel <= 1 ? 1 : nBitsPerPixel <= 4 ? 4 : nBitsPerPixel <= 8 ? 8 : 24;
+
+ nWidth = pAcc->Width();
+ nHeight = pAcc->Height();
+
+ // Wenn 24-Bit, dann den Opcode 'DirectBitsRect' erzeugen:
+ if ( nBitsPerPixel == 24 )
+ {
+
+ // Anzahl Bytes einer (ungepackten) Zeile in Quelle und Ziel berechnen:
+ nSrcRowBytes =( ( 3 * nWidth ) + 0x0003 ) & 0xfffc;
+ nDstRowBytes = nWidth * 4;
+
+ // Opcode und BaseAddr (?) schreiben:
+ *pPict << (USHORT)0x009a << (sal_uInt32)0x000000ff;
+
+ // Normalerweise wollen wir den Packing-Type 4 (Run length encoding
+ // for 32-Bit Pixels) erzeugen. Wenn aber RowBytes<8 gilt, sind die Daten
+ // grundsaetzlich ungepackt, auch wenn der Packing-Type 4 angegeben ist,
+ // was etwas komisch erscheint. Daher wollen wir in so einem Fall lieber
+ // gleich den Packing-Type 1 (ungepackt) angeben:
+
+ if ( nDstRowBytes < 8 )
+ nPackType = 1;
+ else
+ nPackType = 4;
+
+ // PixMap-Struktur schreiben:
+ *pPict << (USHORT)(nDstRowBytes|0x8000) // Bytes pro Zeile und dass es eine 'PixMap' ist
+ << (USHORT)0x0000 // Y1-Position der Bitmap in der Quelle
+ << (USHORT)0x0000 // X1-Position der Bitmap in der Quelle
+ << (USHORT)nHeight // Y2-Position der Bitmap in der Quelle
+ << (USHORT)nWidth // X2-Position der Bitmap in der Quelle
+ << (USHORT)0x0000 // Version
+ << (USHORT)nPackType // Packing type
+ << (sal_uInt32) 0x00000000 // Packing size (?)
+ << (sal_uInt32) 0x00480000 // H-Res
+ << (sal_uInt32) 0x00480000 // V-Res
+ << (USHORT)0x0010 // Pixel type (?)
+ << (USHORT)0x0020 // Pixel size: 32 bit
+ << (USHORT)0x0004 // CmpCount: 4 Komponenten
+ << (USHORT)0x0008 // CmpSize: 8 Bits
+ << (sal_uInt32) 0x00000000 // PlaneBytes (?)
+ << (sal_uInt32) 0x00000000 // (?)
+ << (sal_uInt32) 0x00000000; // (?)
+
+ // Source-Rectangle schreiben:
+ *pPict << (USHORT)0x0000 // Y1-Position auf der Bitmap
+ << (USHORT)0x0000 // X1-Position auf der Bitmap
+ << (USHORT)nHeight // Y2-Position auf der Bitmap
+ << (USHORT)nWidth; // X2-Position auf der Bitmap
+
+ // Destination-Rectangle schreiben:
+ WritePoint( rPoint );
+ WritePoint( Point( rPoint.X() + rSize.Width(), rPoint.Y() + rSize.Height() ) );
+
+ // Transfer mode schreiben:
+ *pPict << (USHORT)0x0000; // (?)
+
+ // Position der Map-Daten in Ziel merken:
+ nDstMapPos=pPict->Tell();
+
+ if ( nPackType == 1 ) // bei 24 bits nWidth == 1 !!
+ { // nicht packen
+ for ( ny = 0; ny < nHeight; ny++ )
+ {
+ *pPict << (BYTE)0;
+ *pPict << (BYTE)pAcc->GetPixel( ny, 0 ).GetRed();
+ *pPict << (BYTE)pAcc->GetPixel( ny, 0 ).GetGreen();
+ *pPict << (BYTE)pAcc->GetPixel( ny, 0 ).GetBlue();
+ // Prozente zaehlen, Callback, Fehler pruefen:
+ nActBitmapPercent = ( ny * 70 / nHeight ) + 30; // (30% machten schon das Schreiben der Win-BMP-Datei aus)
+ MayCallback();
+ }
+ }
+ else // packen ( PackType == 4 )
+ {
+ // Speicher fuer Zeilen-Zwischen-Datenstruktur allozieren:
+ for ( nc = 0; nc < 4; nc++ )
+ pComp[ nc ] = new BYTE[ nWidth ];
+
+ // Schleife ueber Zeilen:
+ for ( ny = 0; ny < nHeight; ny++ )
+ {
+ // Zeil ny der Quelle in die Zwischen-Datenstrktur einlesen:
+
+ for ( nx = 0; nx < nWidth; nx++ )
+ {
+ pComp[ 1 ][ nx ] = (BYTE)pAcc->GetPixel( ny, nx ) .GetRed();
+ pComp[ 2 ][ nx ] = (BYTE)pAcc->GetPixel( ny, nx ) .GetGreen();
+ pComp[ 3 ][ nx ] = (BYTE)pAcc->GetPixel( ny, nx ) .GetBlue();
+ pComp[ 0 ][ nx ] = 0;
+ }
+
+ // Anfang der Zeile im Ziel merken:
+ nDstRowPos = pPict->Tell();
+
+ // ByteCount (das ist die Groesse der gepackten Zeile) zunaechst 0 (wird spaeter berichtigt):
+ if ( nDstRowBytes > 250 )
+ *pPict << (USHORT)0;
+ else
+ *pPict << (BYTE)0;
+
+ // Schleife ueber Componenten:
+ for ( nc = 0; nc < 4; nc++ )
+ {
+ // Schleife ueber x:
+ nx = 0;
+ while ( nx < nWidth )
+ {
+ // Die Position von 3 gleichen Bytes suchen und in nEqu3 merken.
+ // wenn nicht gefunden, dann nEqu3=nWidth setzten.
+ // Wenn doch gefunden, dann in nEquData den Wert der Bytes merken.
+ nEqu3 = nx;
+ for (;;)
+ {
+ if ( nEqu3 + 2 >= nWidth )
+ {
+ nEqu3 = nWidth;
+ break;
+ }
+ nEquData = pComp[nc][nEqu3];
+ if ( nEquData == pComp[nc][nEqu3+1] && nEquData==pComp[nc][nEqu3+2] )
+ break;
+ nEqu3++;
+ }
+
+ // Die Daten von nx bis nEqu3 unkomprimiert schreiben (ggf. in mehreren Records):
+ while ( nEqu3 > nx )
+ {
+ nCount = nEqu3 - nx;
+ if ( nCount > 128 )
+ nCount=128;
+ nFlagCounterByte = (BYTE)(nCount-1);
+ *pPict << nFlagCounterByte;
+ do
+ {
+ *pPict << pComp[nc][nx++];
+ nCount--;
+ }
+ while ( nCount > 0 );
+ }
+
+ // Jetzt einen Komprimierungs-Record erzeugen (falls oben mindestens 3
+ // gleiche Bytes gefunden):
+ if ( nx < nWidth )
+ { // Hinweis: es gilt nx==nEqu3 (hoffentlich)
+ nCount=3; // Drei Bytes sind gleich, wie weiter oben herausgefunden.
+ // Pruefen, ob es weitere gleiche Bytes gibts (dabei Max.-Record-Groesse beachten):
+ while ( nx + nCount < nWidth && nCount < 128 )
+ {
+ if ( nEquData != pComp[ nc ][ nx + nCount ] )
+ break;
+ nCount++;
+ }
+ // nCount gleiche Bytes komprimiert schreiben:
+ nFlagCounterByte = (BYTE)( 1 - (long)nCount );
+ *pPict << nFlagCounterByte << nEquData;
+ nx += nCount;
+ }
+ }
+ }
+ // ByteCount berichtigen:
+ nPos = pPict->Tell();
+ pPict->Seek( nDstRowPos );
+ if ( nDstRowBytes > 250 )
+ *pPict << ( (USHORT)( nPos - nDstRowPos - 2 ) );
+ else
+ *pPict << ( (BYTE)( nPos - nDstRowPos - 1 ) );
+ pPict->Seek( nPos );
+
+ // Prozente zaehlen, Callback, Fehler pruefen:
+ nActBitmapPercent = ( ny * 70 / nHeight ) + 30; // (30% machten schon das Schreiben der Win-BMP-Datei aus)
+ MayCallback();
+ }
+ // Aufraeumen:
+ for ( nc = 0; nc < 4; nc++ )
+ delete pComp[ nc ];
+ }
+ }
+ else
+ { // nicht 24-Bit also Opcode 'PackBitsRect' erzeugen:
+
+ // Bei 1-Bit-Bildern ignorieren manche Import-Filter die Palette und nehmen statt
+ // dessen die Vorder- und Hintergrundfarbe:
+ if ( nBitsPerPixel == 1 )
+ {
+ WriteOpcode_RGBBkCol( pAcc->GetPaletteColor( 0 ) );
+ WriteOpcode_RGBFgCol( pAcc->GetPaletteColor( 1 ) );
+ }
+ else
+ {
+ WriteOpcode_RGBBkCol( Color( COL_BLACK ) );
+ WriteOpcode_RGBFgCol( Color( COL_WHITE ) );
+ }
+
+ // Anzahl Bytes einer (ungepackten) Zeile in Ziel und Quelle berechnen:
+ nDstRowBytes = ( nWidth * nBitsPerPixel + 7 ) >> 3;
+ nSrcRowBytes = ( nDstRowBytes + 3 ) & 0xfffffffc;
+
+ // Opcode schreiben:
+ *pPict << (USHORT)0x0098;
+
+ // Normalerweise wollen wir den Packing-Type 0 (default Packing) erzeugen.
+ // Wenn aber RowBytes<8 gilt, sind die Daten grundsaetzlich ungepackt,
+ // auch wenn der Packing-Type 0 angegeben ist, was etwas komisch erscheint.
+ // Daher wollen wir in so einem Fall lieber gleich den Packing-Type 1 (ungepackt)
+ // angeben:
+ if ( nDstRowBytes < 8 )
+ nPackType = 1;
+ else
+ nPackType = 0;
+
+ // PixMap-Struktur schreiben:
+ *pPict << (USHORT)(nDstRowBytes|0x8000) // Bytes pro Zeile und dass es eine 'PixMap' ist
+ << (USHORT)0x0000 // Y1-Position der Bitmap in der Quelle
+ << (USHORT)0x0000 // X1-Position der Bitmap in der Quelle
+ << (USHORT)nHeight // Y2-Position der Bitmap in der Quelle
+ << (USHORT)nWidth // X2-Position der Bitmap in der Quelle
+ << (USHORT)0x0000 // Version
+ << (USHORT)nPackType // Packing type
+ << (sal_uInt32) 0x00000000 // Packing size (?)
+ << (sal_uInt32) 0x00480000 // H-Res
+ << (sal_uInt32) 0x00480000 // V-Res
+ << (USHORT)0x0000 // Pixel type (?)
+ << (USHORT)nBitsPerPixel // Pixel size
+ << (USHORT)0x0001 // CmpCount: 1 Komponente
+ << (USHORT)nBitsPerPixel // CmpSize
+ << (sal_uInt32) 0x00000000 // PlaneBytes (?)
+ << (sal_uInt32) 0x00000000 // (?)
+ << (sal_uInt32) 0x00000000; // (?)
+
+ // Palette lesen und schreiben:
+ nColTabSize = pAcc->GetPaletteEntryCount();
+ *pPict << (sal_uInt32)0 << (USHORT)0x8000 << (USHORT)( nColTabSize - 1 );
+
+ for ( i = 0; i < nColTabSize; i++ )
+ {
+ nRed = (BYTE)pAcc->GetPaletteColor( (USHORT)i ).GetRed();
+ nGreen = (BYTE)pAcc->GetPaletteColor( (USHORT)i ).GetGreen();
+ nBlue = (BYTE)pAcc->GetPaletteColor( (USHORT)i ).GetBlue();
+ *pPict << (UINT16)0 << nRed << nRed << nGreen << nGreen << nBlue << nBlue;
+ }
+
+ // Source-Rectangle schreiben:
+ *pPict << (USHORT)0 << (USHORT)0 << (USHORT)nHeight << (USHORT)nWidth;
+
+ // Destination-Rectangle schreiben:
+ WritePoint( rPoint );
+ WritePoint( Point( rPoint.X() + rSize.Width(), rPoint.Y() + rSize.Height() ) );
+
+ // Transfer mode schreiben:
+ *pPict << (USHORT)0; // (?)
+
+ // Speicher fuer eine Zeile allozieren:
+ pPix = new BYTE[ nSrcRowBytes ];
+
+ // Position der Map-Daten in Ziel merken:
+ nDstMapPos=pPict->Tell();
+
+ // Schleife ueber Zeilen:
+ for ( ny = 0; ny < nHeight; ny++ )
+ {
+
+ // Zeile ny der Quelle in den Zwischenspeicher einlesen:
+
+ switch ( nBitsPerPixel )
+ {
+ case 1 :
+ for ( pTemp = pPix, i = 0; i < nSrcRowBytes; i++ )
+ *pTemp++ = (BYTE)0;
+ for ( i = 0; i < nWidth; i++ )
+ pPix[ ( i >> 3 ) ] |= (BYTE)( pAcc->GetPixel( ny, i ) & 1 ) << ( ( i & 7 ) ^ 7 );
+ break;
+ case 4 :
+ for ( pTemp = pPix, i = 0; i < nSrcRowBytes; i++ )
+ *pTemp++ = (BYTE)0;
+ for ( i = 0; i < nWidth; i++ )
+ pPix[ ( i >> 1 ) ] |= (BYTE)( pAcc->GetPixel( ny, i ) & 15 ) << ( ( i & 1 ) << 2 ) ;
+ break;
+ case 8 :
+ for ( i = 0; i < nWidth; i++ )
+ pPix[ i ] = (BYTE)pAcc->GetPixel( ny, i );
+ break;
+ }
+
+ if ( nPackType == 1 )
+ { // nicht packen
+ pPict->Write( pPix, nDstRowBytes );
+ }
+ else
+ { // Packen (nPackType==0)
+
+ // Anfang der Zeile im Ziel merken:
+ nDstRowPos = pPict->Tell();
+
+ // ByteCount (das ist die Groesse der gepackten Zeile) zunaechst 0 (wird spaeter berichtigt):
+ if ( nDstRowBytes > 250 )
+ *pPict << (USHORT)0;
+ else
+ *pPict << (BYTE)0;
+
+ // Schleife ueber Bytes der Zeile:
+ nx=0;
+ while ( nx < nDstRowBytes && bStatus )
+ {
+ // Die Position von 3 gleichen Bytes suchen und in nEqu3 merken.
+ // wenn nicht gefunden, dann nEqu3=nDstRowBytes setzten.
+ // Wenn doch gefunden, dann in nEquData den Wert der Bytes merken.
+ nEqu3 = nx;
+ for (;;)
+ {
+ if ( nEqu3 + 2 >= nDstRowBytes )
+ {
+ nEqu3 = nDstRowBytes;
+ break;
+ }
+ nEquData = pPix[ nEqu3 ];
+ if ( nEquData == pPix[ nEqu3 + 1 ] && nEquData == pPix[ nEqu3 + 2 ] )
+ break;
+ nEqu3++;
+ }
+
+ // Die Daten von nx bis nEqu3 unkomprimiert schreiben (ggf. in mehreren Records):
+ while ( nEqu3 > nx )
+ {
+ nCount = nEqu3 - nx;
+ if ( nCount > 128 )
+ nCount = 128;
+ nFlagCounterByte = (BYTE)( nCount - 1 );
+ *pPict << nFlagCounterByte;
+ do
+ {
+ *pPict << pPix[ nx++ ];
+ nCount--;
+ } while ( nCount > 0 );
+ }
+
+ // Jetzt einen Komprimierungs-Record erzeugen (falls oben mindestens 3
+ // gleiche Bytes gefunden):
+ if ( nx < nDstRowBytes )
+ { // Hinweis: es gilt nx==nEqu3 (hoffentlich)
+ nCount = 3; // Drei Bytes sind gleich, wie weiter oben herausgefunden.
+ // Pruefen, ob es weitere gleiche Bytes gibts (dabei Max.-Record-Groesse beachten):
+ while ( nx + nCount < nDstRowBytes && nCount < 128 )
+ {
+ if ( nEquData != pPix[ nx + nCount ] )
+ break;
+ nCount++;
+ }
+ // nCount gleiche Bytes komprimiert schreiben:
+ nFlagCounterByte = (BYTE)( 1 - (long)nCount );
+ *pPict << nFlagCounterByte << nEquData;
+ nx += nCount;
+ }
+ }
+
+ // ByteCount berichtigen:
+ nPos = pPict->Tell();
+ pPict->Seek( nDstRowPos );
+ if ( nDstRowBytes > 250 )
+ *pPict << ( (USHORT)( nPos - nDstRowPos - 2 ) );
+ else
+ *pPict << ( (BYTE)( nPos - nDstRowPos - 1 ) );
+ pPict->Seek( nPos );
+ }
+
+ // Prozente zaehlen, Callback, Fehler pruefen:
+ nActBitmapPercent =( ny * 70 / nHeight ) + 30; // (30% machten schon das Schreiben der Win-BMP-Datei aus)
+ MayCallback();
+ if ( pPict->GetError() )
+ bStatus = FALSE;
+ }
+ // Aufraeumen:
+ delete[] pPix;
+ }
+
+ // Map-Daten muessen gerade Anzahl von Bytes sein:
+ if ( ( ( pPict->Tell() - nDstMapPos ) & 1 ) != 0 )
+ *pPict << (BYTE)0;
+
+ // Bitmaps zaehlen:
+ nWrittenBitmaps++;
+ nActBitmapPercent = 0;
+ if ( pAcc )
+ aBitmap.ReleaseAccess( pAcc );
+}
+
+void PictWriter::WriteOpcode_EndOfFile()
+{
+ *pPict << (USHORT)0x00ff;
+}
+
+
+void PictWriter::SetAttrForPaint()
+{
+ WriteOpcode_PnMode(eSrcRasterOp);
+ WriteOpcode_RGBFgCol(aFillColor);
+ WriteOpcode_RGBBkCol(aFillColor);
+ WriteOpcode_PnFillPat(aFillColor!=Color( COL_TRANSPARENT ));
+}
+
+
+void PictWriter::SetAttrForFrame()
+{
+ WriteOpcode_PnMode(eSrcRasterOp);
+ WriteOpcode_PnSize(0);
+ WriteOpcode_RGBFgCol(aLineColor);
+ WriteOpcode_PnLinePat(aLineColor!=Color( COL_TRANSPARENT ));
+}
+
+
+void PictWriter::SetAttrForText()
+{
+ WriteOpcode_RGBFgCol(aSrcFont.GetColor());
+ WriteOpcode_RGBBkCol(aSrcFont.GetFillColor());
+ WriteOpcode_PnLinePat(TRUE);
+ WriteOpcode_FontName(aSrcFont);
+ WriteOpcode_TxSize((USHORT)(aSrcFont.GetSize().Height()));
+ WriteOpcode_TxMode(eSrcRasterOp);
+ WriteOpcode_TxFace(aSrcFont);
+}
+
+
+void PictWriter::WriteTextArray(Point & rPoint, const String& rString, const sal_Int32 * pDXAry)
+{
+ USHORT i,nLen;
+ sal_Unicode c;
+ BOOL bDelta;
+ Point aPt;
+
+ if ( pDXAry == NULL )
+ WriteOpcode_Text( rPoint, rString, FALSE );
+ else
+ {
+ bDelta = FALSE;
+ nLen = rString.Len();
+ for ( i = 0; i < nLen; i++ )
+ {
+ c = rString.GetChar( i );
+ if ( c && ( c != 0x20 ) )
+ {
+ aPt = rPoint;
+ if ( i > 0 )
+ aPt.X() += pDXAry[ i - 1 ];
+
+ WriteOpcode_Text( aPt, String( c ), bDelta );
+ bDelta = TRUE;
+ }
+ }
+ }
+}
+
+void PictWriter::HandleLineInfoPolyPolygons(const LineInfo& rInfo, const basegfx::B2DPolygon& rLinePolygon)
+{
+ if(rLinePolygon.count())
+ {
+ basegfx::B2DPolyPolygon aLinePolyPolygon(rLinePolygon);
+ basegfx::B2DPolyPolygon aFillPolyPolygon;
+
+ rInfo.applyToB2DPolyPolygon(aLinePolyPolygon, aFillPolyPolygon);
+
+ if(aLinePolyPolygon.count())
+ {
+ aLinePolyPolygon = aLinePolyPolygon.getDefaultAdaptiveSubdivision();
+ const sal_uInt32 nPolyCount(aLinePolyPolygon.count());
+ SetAttrForFrame();
+
+ for(sal_uInt32 a(0); a < nPolyCount; a++)
+ {
+ const basegfx::B2DPolygon aCandidate(aLinePolyPolygon.getB2DPolygon(a));
+ const sal_uInt32 nPointCount(aCandidate.count());
+
+ if(nPointCount)
+ {
+ const sal_uInt32 nEdgeCount(aCandidate.isClosed() ? nPointCount + 1 : nPointCount);
+ const basegfx::B2DPoint aCurr(aCandidate.getB2DPoint(0));
+ Point nCurr(basegfx::fround(aCurr.getX()), basegfx::fround(aCurr.getY()));
+
+ for(sal_uInt32 b(0); b < nEdgeCount; b++)
+ {
+ const sal_uInt32 nNextIndex((b + 1) % nPointCount);
+ const basegfx::B2DPoint aNext(aCandidate.getB2DPoint(nNextIndex));
+ const Point nNext(basegfx::fround(aNext.getX()), basegfx::fround(aNext.getY()));
+
+ WriteOpcode_Line(nCurr, nNext);
+ nCurr = nNext;
+ }
+ }
+ }
+ }
+
+ if(aFillPolyPolygon.count())
+ {
+ const Color aOldLineColor(aLineColor);
+ const Color aOldFillColor(aFillColor);
+
+ aLineColor = Color( COL_TRANSPARENT );
+ aFillColor = aOldLineColor;
+ SetAttrForPaint();
+
+ for(sal_uInt32 a(0); a < aFillPolyPolygon.count(); a++)
+ {
+ const Polygon aPolygon(aFillPolyPolygon.getB2DPolygon(a).getDefaultAdaptiveSubdivision());
+ WriteOpcode_Poly(PDM_PAINT, aPolygon);
+ }
+
+ aLineColor = aOldLineColor;
+ aFillColor = aOldFillColor;
+ }
+ }
+}
+
+void PictWriter::WriteOpcodes( const GDIMetaFile & rMTF )
+{
+ ULONG nA, nACount;
+ const MetaAction* pMA;
+
+ if( !bStatus)
+ return;
+
+ nACount=rMTF.GetActionCount();
+
+ for (nA=0; nA<nACount; nA++)
+ {
+ pMA = rMTF.GetAction(nA);
+
+ switch (pMA->GetType())
+ {
+ case META_PIXEL_ACTION:
+ {
+ const MetaPixelAction* pA = (const MetaPixelAction*) pMA;
+ WriteOpcode_PnMode(eSrcRasterOp);
+ WriteOpcode_PnSize(1);
+ WriteOpcode_RGBFgCol(pA->GetColor());
+ WriteOpcode_PnLinePat(TRUE);
+ WriteOpcode_Line(pA->GetPoint(),pA->GetPoint());
+ }
+ break;
+
+ case META_POINT_ACTION:
+ {
+ const MetaPointAction* pA = (const MetaPointAction*) pMA;
+
+ if( aLineColor != Color( COL_TRANSPARENT ) )
+ {
+ SetAttrForFrame();
+ WriteOpcode_Line( pA->GetPoint(),pA->GetPoint() );
+ }
+ }
+ break;
+
+ case META_LINE_ACTION:
+ {
+ const MetaLineAction* pA = (const MetaLineAction*) pMA;
+
+ if( aLineColor != Color( COL_TRANSPARENT ) )
+ {
+ if(pA->GetLineInfo().IsDefault())
+ {
+ SetAttrForFrame();
+ WriteOpcode_Line( pA->GetStartPoint(),pA->GetEndPoint() );
+ }
+ else
+ {
+ // LineInfo used; handle Dash/Dot and fat lines
+ basegfx::B2DPolygon aPolygon;
+ aPolygon.append(basegfx::B2DPoint(pA->GetStartPoint().X(), pA->GetStartPoint().Y()));
+ aPolygon.append(basegfx::B2DPoint(pA->GetEndPoint().X(), pA->GetEndPoint().Y()));
+ HandleLineInfoPolyPolygons(pA->GetLineInfo(), aPolygon);
+ }
+ }
+ break;
+ }
+
+ case META_RECT_ACTION:
+ {
+ const MetaRectAction* pA = (const MetaRectAction*) pMA;
+
+ if (aFillColor!=Color( COL_TRANSPARENT ))
+ {
+ SetAttrForPaint();
+ WriteOpcode_Rect(PDM_PAINT,pA->GetRect());
+ if (aLineColor!=Color( COL_TRANSPARENT ))
+ {
+ SetAttrForFrame();
+ WriteOpcode_SameRect(PDM_FRAME);
+ }
+ }
+ else if (aLineColor!=Color( COL_TRANSPARENT ))
+ {
+ SetAttrForFrame();
+ WriteOpcode_Rect(PDM_FRAME,pA->GetRect());
+ }
+ }
+ break;
+
+ case META_ROUNDRECT_ACTION:
+ {
+ const MetaRoundRectAction* pA = (const MetaRoundRectAction*) pMA;
+
+ WriteOpcode_OvSize( Size( pA->GetHorzRound(), pA->GetVertRound() ) );
+
+ if (aFillColor!=Color( COL_TRANSPARENT ))
+ {
+ SetAttrForPaint();
+ WriteOpcode_RRect(PDM_PAINT,pA->GetRect());
+ if (aLineColor!=Color( COL_TRANSPARENT ))
+ {
+ SetAttrForFrame();
+ WriteOpcode_SameRRect(PDM_FRAME);
+ }
+ }
+ else if (aLineColor!=Color( COL_TRANSPARENT ))
+ {
+ SetAttrForFrame();
+ WriteOpcode_RRect(PDM_FRAME,pA->GetRect());
+ }
+ }
+ break;
+
+ case META_ELLIPSE_ACTION:
+ {
+ const MetaEllipseAction* pA = (const MetaEllipseAction*) pMA;
+
+ if (aFillColor!=Color( COL_TRANSPARENT ))
+ {
+ SetAttrForPaint();
+ WriteOpcode_Oval(PDM_PAINT,pA->GetRect());
+ if (aLineColor!=Color( COL_TRANSPARENT ))
+ {
+ SetAttrForFrame();
+ WriteOpcode_SameOval(PDM_FRAME);
+ }
+ }
+ else if (aLineColor!=Color( COL_TRANSPARENT ))
+ {
+ SetAttrForFrame();
+ WriteOpcode_Oval(PDM_FRAME,pA->GetRect());
+ }
+ }
+ break;
+
+ case META_ARC_ACTION:
+ {
+ const MetaArcAction* pA = (const MetaArcAction*) pMA;
+
+ if (aLineColor!=Color( COL_TRANSPARENT ))
+ {
+ SetAttrForFrame();
+ WriteOpcode_Arc(PDM_FRAME,pA->GetRect(),pA->GetStartPoint(),pA->GetEndPoint());
+ }
+ }
+ break;
+
+ case META_PIE_ACTION:
+ {
+ const MetaPieAction* pA = (const MetaPieAction *) pMA;
+
+ if (aFillColor!=Color( COL_TRANSPARENT ))
+ {
+ SetAttrForPaint();
+ WriteOpcode_Arc(PDM_PAINT,pA->GetRect(),pA->GetStartPoint(),pA->GetEndPoint());
+
+ if (aLineColor!=Color( COL_TRANSPARENT ))
+ {
+ SetAttrForFrame();
+ WriteOpcode_SameArc(PDM_FRAME,pA->GetRect(),pA->GetStartPoint(),pA->GetEndPoint());
+ }
+ }
+ else if (aLineColor!=Color( COL_TRANSPARENT ))
+ {
+ SetAttrForFrame();
+ WriteOpcode_Arc(PDM_FRAME,pA->GetRect(),pA->GetStartPoint(),pA->GetEndPoint());
+ }
+
+ if (aLineColor!=Color( COL_TRANSPARENT ))
+ {
+ double fxc,fyc,fxr,fyr,fx1,fy1,fx2,fy2,l1,l2;
+
+ fxc=((double)(pA->GetRect().Left()+pA->GetRect().Right()))/2.0;
+ fyc=((double)(pA->GetRect().Top()+pA->GetRect().Bottom()))/2.0;
+ fxr=((double)pA->GetRect().GetWidth())/2.0;
+ fyr=((double)pA->GetRect().GetHeight())/2.0;
+ fx1=((double)pA->GetStartPoint().X())-fxc;
+ fy1=((double)pA->GetStartPoint().Y())-fyc;
+ fx2=((double)pA->GetEndPoint().X())-fxc;
+ fy2=((double)pA->GetEndPoint().Y())-fyc;
+ l1=sqrt(fx1*fx1+fy1*fy1);
+ l2=sqrt(fx2*fx2+fy2*fy2);
+
+ if (l1>0)
+ {
+ fx1=fx1/l1*fxr;
+ fy1=fy1/l1*fyr;
+ }
+
+ if (l2>0)
+ {
+ fx2=fx2/l2*fxr;
+ fy2=fy2/l2*fyr;
+ }
+ fx1+=fxc; fy1+=fyc; fx2+=fxc; fy2+=fyc;
+ WriteOpcode_Line(Point((long)(fx1+0.5),(long)(fy1+0.5)), Point((long)(fxc+0.5),(long)(fyc+0.5)));
+ WriteOpcode_LineFrom(Point((long)(fx2+0.5),(long)(fy2+0.5)));
+ }
+ }
+ break;
+
+ case META_CHORD_ACTION:
+ {
+// DBG_ERROR( "Unsupported PICT-Action: META_CHORD_ACTION!" );
+ }
+ break;
+
+ case META_POLYLINE_ACTION:
+ {
+ const MetaPolyLineAction* pA = (const MetaPolyLineAction*) pMA;
+
+ if( aLineColor!=Color( COL_TRANSPARENT ) )
+ {
+ const Polygon& rPoly = pA->GetPolygon();
+
+ if( rPoly.GetSize() )
+ {
+ if(pA->GetLineInfo().IsDefault())
+ {
+ Polygon aSimplePoly;
+ if ( rPoly.HasFlags() )
+ rPoly.AdaptiveSubdivide( aSimplePoly );
+ else
+ aSimplePoly = rPoly;
+
+ const USHORT nSize = aSimplePoly.GetSize();
+ Point aLast;
+
+ if ( nSize )
+ {
+ SetAttrForFrame();
+ aLast = aSimplePoly[0];
+
+ for ( USHORT i = 1; i < nSize; i++ )
+ {
+ WriteOpcode_Line( aLast, aSimplePoly[i] );
+ aLast = aSimplePoly[i];
+ }
+ }
+ }
+ else
+ {
+ // LineInfo used; handle Dash/Dot and fat lines
+ HandleLineInfoPolyPolygons(pA->GetLineInfo(), rPoly.getB2DPolygon());
+ }
+ }
+ }
+ }
+ break;
+
+ case META_POLYGON_ACTION:
+ {
+ const MetaPolygonAction* pA = (const MetaPolygonAction*) pMA;
+
+ const Polygon& rPoly = pA->GetPolygon();
+
+ Polygon aSimplePoly;
+ if ( rPoly.HasFlags() )
+ rPoly.AdaptiveSubdivide( aSimplePoly );
+ else
+ aSimplePoly = rPoly;
+
+ if (aFillColor!=Color( COL_TRANSPARENT ))
+ {
+ SetAttrForPaint();
+ WriteOpcode_Poly( PDM_PAINT, aSimplePoly );
+ }
+ if (aLineColor!=Color( COL_TRANSPARENT ))
+ {
+ SetAttrForFrame();
+ WriteOpcode_Poly( PDM_FRAME, aSimplePoly );
+ }
+ }
+ break;
+
+ case META_POLYPOLYGON_ACTION:
+ {
+ const MetaPolyPolygonAction* pA = (const MetaPolyPolygonAction*) pMA;
+
+ const PolyPolygon& rPolyPoly = pA->GetPolyPolygon();
+ sal_uInt16 nPolyCount = rPolyPoly.Count();
+ PolyPolygon aSimplePolyPoly( rPolyPoly );
+ for ( sal_uInt16 i = 0; i < nPolyCount; i++ )
+ {
+ if ( aSimplePolyPoly[ i ].HasFlags() )
+ {
+ Polygon aSimplePoly;
+ aSimplePolyPoly[ i ].AdaptiveSubdivide( aSimplePoly );
+ aSimplePolyPoly[ i ] = aSimplePoly;
+ }
+ }
+ if (aFillColor!=Color( COL_TRANSPARENT ))
+ {
+ SetAttrForPaint();
+ WriteOpcode_Poly( PDM_PAINT, PolyPolygonToPolygon( aSimplePolyPoly ));
+ }
+
+ if (aLineColor!=Color( COL_TRANSPARENT ))
+ {
+ USHORT nCount,i;
+ SetAttrForFrame();
+ nCount = aSimplePolyPoly.Count();
+ for ( i = 0; i < nCount; i++ )
+ WriteOpcode_Poly( PDM_FRAME, aSimplePolyPoly.GetObject( i ) );
+ }
+ }
+ break;
+
+ case META_TEXT_ACTION:
+ {
+ const MetaTextAction* pA = (const MetaTextAction*) pMA;
+ Point aPt( pA->GetPoint() );
+
+ if ( aSrcFont.GetAlign() != ALIGN_BASELINE )
+ {
+ VirtualDevice aVirDev;
+
+ if (aSrcFont.GetAlign()==ALIGN_TOP)
+ aPt.Y()+=(long)aVirDev.GetFontMetric(aSrcFont).GetAscent();
+ else
+ aPt.Y()-=(long)aVirDev.GetFontMetric(aSrcFont).GetDescent();
+ }
+
+ SetAttrForText();
+ String aStr( pA->GetText(),pA->GetIndex(),pA->GetLen() );
+ WriteOpcode_Text( aPt, aStr, FALSE );
+ }
+ break;
+
+ case META_TEXTARRAY_ACTION:
+ {
+ const MetaTextArrayAction* pA = (const MetaTextArrayAction*) pMA;
+ Point aPt( pA->GetPoint() );
+
+ if (aSrcFont.GetAlign()!=ALIGN_BASELINE)
+ {
+ VirtualDevice aVirDev;
+
+ if (aSrcFont.GetAlign()==ALIGN_TOP)
+ aPt.Y()+=(long)aVirDev.GetFontMetric(aSrcFont).GetAscent();
+ else
+ aPt.Y()-=(long)aVirDev.GetFontMetric(aSrcFont).GetDescent();
+ }
+ SetAttrForText();
+ String aStr( pA->GetText(),pA->GetIndex(),pA->GetLen() );
+ WriteTextArray( aPt, aStr, pA->GetDXArray() );
+ break;
+ }
+
+ case META_STRETCHTEXT_ACTION:
+ {
+ const MetaStretchTextAction* pA = (const MetaStretchTextAction*) pMA;
+ Point aPt( pA->GetPoint() );
+ String aStr( pA->GetText(),pA->GetIndex(),pA->GetLen() );
+ VirtualDevice aVirDev;
+ sal_Int32* pDXAry = new sal_Int32[ aStr.Len() ];
+ sal_Int32 nNormSize( aVirDev.GetTextArray( aStr,pDXAry ) );
+ USHORT i;
+
+ if (aSrcFont.GetAlign()!=ALIGN_BASELINE)
+ {
+ if (aSrcFont.GetAlign()==ALIGN_TOP)
+ aPt.Y()+=(long)aVirDev.GetFontMetric(aSrcFont).GetAscent();
+ else
+ aPt.Y()-=(long)aVirDev.GetFontMetric(aSrcFont).GetDescent();
+ }
+
+ for ( i = 0; i < aStr.Len() - 1; i++ )
+ pDXAry[ i ] = pDXAry[ i ] * ( (long)pA->GetWidth() ) / nNormSize;
+
+ SetAttrForText();
+ WriteTextArray( aPt, aStr, pDXAry );
+ delete[] pDXAry;
+ }
+ break;
+
+ case META_TEXTRECT_ACTION:
+ {
+// DBG_ERROR( "Unsupported PICT-Action: META_TEXTRECT_ACTION!" );
+ }
+ break;
+
+ case META_BMP_ACTION:
+ {
+ const MetaBmpAction* pA = (const MetaBmpAction*) pMA;
+ WriteOpcode_BitsRect( pA->GetPoint(),pA->GetBitmap().GetSizePixel(), pA->GetBitmap() );
+ }
+ break;
+
+ case META_BMPSCALE_ACTION:
+ {
+ const MetaBmpScaleAction* pA = (const MetaBmpScaleAction*) pMA;
+ WriteOpcode_BitsRect( pA->GetPoint(), pA->GetSize(), pA->GetBitmap() );
+ }
+ break;
+
+ case META_BMPSCALEPART_ACTION:
+ {
+ const MetaBmpScalePartAction* pA = (const MetaBmpScalePartAction*) pMA;
+ Bitmap aBmp( pA->GetBitmap() );
+
+ aBmp.Crop( Rectangle( pA->GetSrcPoint(), pA->GetSrcSize() ) );
+ WriteOpcode_BitsRect( pA->GetDestPoint(), pA->GetDestSize(), aBmp );
+ }
+ break;
+
+ case META_BMPEX_ACTION:
+ {
+ const MetaBmpExAction* pA = (const MetaBmpExAction*) pMA;
+ const Bitmap aBmp( Graphic( pA->GetBitmapEx() ).GetBitmap() );
+
+ WriteOpcode_BitsRect( pA->GetPoint(), aBmp.GetSizePixel(), aBmp );
+ }
+ break;
+
+ case META_BMPEXSCALE_ACTION:
+ {
+ const MetaBmpExScaleAction* pA = (const MetaBmpExScaleAction*) pMA;
+ const Bitmap aBmp( Graphic( pA->GetBitmapEx() ).GetBitmap() );
+
+ WriteOpcode_BitsRect( pA->GetPoint(), pA->GetSize(), aBmp );
+ }
+ break;
+
+ case META_BMPEXSCALEPART_ACTION:
+ {
+ const MetaBmpExScalePartAction* pA = (const MetaBmpExScalePartAction*) pMA;
+ Bitmap aBmp( Graphic( pA->GetBitmapEx() ).GetBitmap() );
+
+ aBmp.Crop( Rectangle( pA->GetSrcPoint(), pA->GetSrcSize() ) );
+ WriteOpcode_BitsRect( pA->GetDestPoint(), pA->GetDestSize(), aBmp );
+ }
+ break;
+
+ case META_EPS_ACTION :
+ {
+ const MetaEPSAction* pA = (const MetaEPSAction*)pMA;
+ const GDIMetaFile aGDIMetaFile( pA->GetSubstitute() );
+
+ INT32 nCount = aGDIMetaFile.GetActionCount();
+ for ( INT32 i = 0; i < nCount; i++ )
+ {
+ const MetaAction* pMetaAct = aGDIMetaFile.GetAction( i );
+ if ( pMetaAct->GetType() == META_BMPSCALE_ACTION )
+ {
+ const MetaBmpScaleAction* pBmpScaleAction = (const MetaBmpScaleAction*)pMetaAct;
+ WriteOpcode_BitsRect( pA->GetPoint(), pA->GetSize(), pBmpScaleAction->GetBitmap() );
+ break;
+ }
+ }
+ }
+ break;
+
+ case META_MASK_ACTION:
+ case META_MASKSCALE_ACTION:
+ case META_MASKSCALEPART_ACTION:
+ {
+// DBG_ERROR( "Unsupported PICT-Action: META_MASK..._ACTION!" );
+ }
+ break;
+
+ case META_GRADIENT_ACTION:
+ {
+ VirtualDevice aVDev;
+ GDIMetaFile aTmpMtf;
+ const MetaGradientAction* pA = (const MetaGradientAction*) pMA;
+
+ aVDev.SetMapMode( aTargetMapMode );
+ aVDev.AddGradientActions( pA->GetRect(), pA->GetGradient(), aTmpMtf );
+ WriteOpcodes( aTmpMtf );
+ }
+ break;
+
+ case META_HATCH_ACTION:
+ {
+ VirtualDevice aVDev;
+ GDIMetaFile aTmpMtf;
+ const MetaHatchAction* pA = (const MetaHatchAction*) pMA;
+
+ aVDev.SetMapMode( aTargetMapMode );
+ aVDev.AddHatchActions( pA->GetPolyPolygon(), pA->GetHatch(), aTmpMtf );
+ WriteOpcodes( aTmpMtf );
+ }
+ break;
+
+ case META_WALLPAPER_ACTION:
+ {
+// DBG_ERROR( "Unsupported PICT-Action: META_WALLPAPER_ACTION!" );
+ }
+ break;
+
+ case META_CLIPREGION_ACTION:
+ {
+// DBG_ERROR( "Unsupported PICT-Action: META_CLIPREGION_ACTION!" );
+ }
+ break;
+
+ case META_ISECTRECTCLIPREGION_ACTION:
+ {
+ const MetaISectRectClipRegionAction* pA = (const MetaISectRectClipRegionAction*) pMA;
+ WriteOpcode_ClipRect( pA->GetRect() );
+ }
+ break;
+
+ case META_ISECTREGIONCLIPREGION_ACTION:
+ {
+// DBG_ERROR( "Unsupported PICT-Action: META_ISECTREGIONCLIPREGION_ACTION!" );
+ }
+ break;
+
+ case META_MOVECLIPREGION_ACTION:
+ {
+// DBG_ERROR( "Unsupported PICT-Action: META_MOVECLIPREGION_ACTION!" );
+ }
+ break;
+
+ case META_LINECOLOR_ACTION:
+ {
+ const MetaLineColorAction* pA = (const MetaLineColorAction*) pMA;
+
+ if( pA->IsSetting() )
+ aLineColor = pA->GetColor();
+ else
+ aLineColor = Color( COL_TRANSPARENT );
+ }
+ break;
+
+ case META_FILLCOLOR_ACTION:
+ {
+ const MetaFillColorAction* pA = (const MetaFillColorAction*) pMA;
+
+ if( pA->IsSetting() )
+ aFillColor = pA->GetColor();
+ else
+ aFillColor = Color( COL_TRANSPARENT );
+ }
+ break;
+
+ case META_TEXTCOLOR_ACTION:
+ {
+ const MetaTextColorAction* pA = (const MetaTextColorAction*) pMA;
+ aSrcFont.SetColor( pA->GetColor() );
+ }
+ break;
+
+ case META_TEXTFILLCOLOR_ACTION:
+ {
+ const MetaTextFillColorAction* pA = (const MetaTextFillColorAction*) pMA;
+
+ if( pA->IsSetting() )
+ aSrcFont.SetFillColor( pA->GetColor() );
+ else
+ aSrcFont.SetFillColor( Color( COL_TRANSPARENT ) );
+ }
+ break;
+
+ case META_TEXTALIGN_ACTION:
+ {
+// DBG_ERROR( "Unsupported PICT-Action: META_TEXTALIGN_ACTION!" );
+ }
+ break;
+
+ case META_MAPMODE_ACTION:
+ {
+ const MetaMapModeAction* pA = (const MetaMapModeAction*) pMA;
+
+ if (aSrcMapMode!=pA->GetMapMode())
+ {
+ if( pA->GetMapMode().GetMapUnit() == MAP_RELATIVE )
+ {
+ MapMode aMM = pA->GetMapMode();
+ Fraction aScaleX = aMM.GetScaleX();
+ Fraction aScaleY = aMM.GetScaleY();
+
+ Point aOrigin = aSrcMapMode.GetOrigin();
+ BigInt aX( aOrigin.X() );
+ aX *= BigInt( aScaleX.GetDenominator() );
+ if( aOrigin.X() >= 0 )
+ {
+ if( aScaleX.GetNumerator() >= 0 )
+ aX += BigInt( aScaleX.GetNumerator()/2 );
+ else
+ aX -= BigInt( (aScaleX.GetNumerator()+1)/2 );
+ }
+ else
+ {
+ if( aScaleX.GetNumerator() >= 0 )
+ aX -= BigInt( (aScaleX.GetNumerator()-1)/2 );
+ else
+ aX += BigInt( aScaleX.GetNumerator()/2 );
+ }
+
+ aX /= BigInt( aScaleX.GetNumerator() );
+ aOrigin.X() = (long)aX + aMM.GetOrigin().X();
+ BigInt aY( aOrigin.Y() );
+ aY *= BigInt( aScaleY.GetDenominator() );
+
+ if( aOrigin.Y() >= 0 )
+ {
+ if( aScaleY.GetNumerator() >= 0 )
+ aY += BigInt( aScaleY.GetNumerator()/2 );
+ else
+ aY -= BigInt( (aScaleY.GetNumerator()+1)/2 );
+ }
+ else
+ {
+ if( aScaleY.GetNumerator() >= 0 )
+ aY -= BigInt( (aScaleY.GetNumerator()-1)/2 );
+ else
+ aY += BigInt( aScaleY.GetNumerator()/2 );
+ }
+
+ aY /= BigInt( aScaleY.GetNumerator() );
+ aOrigin.Y() = (long)aY + aMM.GetOrigin().Y();
+ aSrcMapMode.SetOrigin( aOrigin );
+
+ aScaleX *= aSrcMapMode.GetScaleX();
+ aScaleY *= aSrcMapMode.GetScaleY();
+ aSrcMapMode.SetScaleX( aScaleX );
+ aSrcMapMode.SetScaleY( aScaleY );
+ }
+ else
+ aSrcMapMode = pA->GetMapMode();
+ }
+ }
+ break;
+
+ case META_FONT_ACTION:
+ {
+ const MetaFontAction* pA = (const MetaFontAction*) pMA;
+ aSrcFont=pA->GetFont();
+ }
+ break;
+
+ case META_PUSH_ACTION:
+ {
+ PictWriterAttrStackMember * pAt = new PictWriterAttrStackMember;
+ pAt->aLineColor=aLineColor;
+ pAt->aFillColor=aFillColor;
+ pAt->eRasterOp=eSrcRasterOp;
+ pAt->aFont=aSrcFont;
+ pAt->aMapMode=aSrcMapMode;
+ pAt->aClipRect=aClipRect;
+ pAt->pSucc=pAttrStack;
+ pAttrStack=pAt;
+ }
+ break;
+
+ case META_POP_ACTION:
+ {
+ PictWriterAttrStackMember* pAt=pAttrStack;
+
+ if( pAt )
+ {
+ aLineColor=pAt->aLineColor;
+ aFillColor=pAt->aFillColor;
+ eSrcRasterOp=pAt->eRasterOp;
+ aSrcFont=pAt->aFont;
+ aSrcMapMode=pAt->aMapMode;
+ if ( pAt->aClipRect != aClipRect )
+ {
+ Rectangle aRect( pAt->aClipRect );
+ *pPict << (sal_uInt16)1 // opcode 1
+ << (sal_uInt16)10 // data size
+ << (sal_Int16)aRect.Top() << (sal_Int16)aRect.Left()
+ << (sal_Int16)aRect.Bottom() << (sal_Int16)aRect.Right();
+ }
+ aClipRect=pAt->aClipRect;
+ pAttrStack=pAt->pSucc;
+ delete pAt;
+ }
+ }
+ break;
+
+ case META_RASTEROP_ACTION:
+ {
+ const MetaRasterOpAction* pA = (const MetaRasterOpAction*) pMA;
+ eSrcRasterOp=pA->GetRasterOp();
+ }
+ break;
+
+ case META_TRANSPARENT_ACTION:
+ {
+ const PolyPolygon& rPolyPoly = ( (const MetaTransparentAction*) pMA )->GetPolyPolygon();
+
+ if (aFillColor!=Color( COL_TRANSPARENT ))
+ {
+ SetAttrForPaint();
+ WriteOpcode_Poly( PDM_PAINT, PolyPolygonToPolygon( rPolyPoly ) );
+ }
+
+ if (aLineColor!=Color( COL_TRANSPARENT ))
+ {
+ SetAttrForFrame();
+ for( USHORT i = 0, nCount = rPolyPoly.Count(); i < nCount; i++ )
+ WriteOpcode_Poly( PDM_FRAME, rPolyPoly.GetObject( i ) );
+ }
+ }
+ break;
+
+ case META_FLOATTRANSPARENT_ACTION:
+ {
+ const MetaFloatTransparentAction* pA = (const MetaFloatTransparentAction*) pMA;
+
+ GDIMetaFile aTmpMtf( pA->GetGDIMetaFile() );
+ Point aSrcPt( aTmpMtf.GetPrefMapMode().GetOrigin() );
+ const Size aSrcSize( aTmpMtf.GetPrefSize() );
+ const Point aDestPt( pA->GetPoint() );
+ const Size aDestSize( pA->GetSize() );
+ const double fScaleX = aSrcSize.Width() ? (double) aDestSize.Width() / aSrcSize.Width() : 1.0;
+ const double fScaleY = aSrcSize.Height() ? (double) aDestSize.Height() / aSrcSize.Height() : 1.0;
+ long nMoveX, nMoveY;
+
+ if( fScaleX != 1.0 || fScaleY != 1.0 )
+ {
+ aTmpMtf.Scale( fScaleX, fScaleY );
+ aSrcPt.X() = FRound( aSrcPt.X() * fScaleX ), aSrcPt.Y() = FRound( aSrcPt.Y() * fScaleY );
+ }
+
+ nMoveX = aDestPt.X() - aSrcPt.X(), nMoveY = aDestPt.Y() - aSrcPt.Y();
+
+ if( nMoveX || nMoveY )
+ aTmpMtf.Move( nMoveX, nMoveY );
+
+ WriteOpcodes( aTmpMtf );
+ }
+ break;
+ }
+
+ nWrittenActions++;
+ MayCallback();
+
+ if (pPict->GetError())
+ bStatus=FALSE;
+
+ if (bStatus==FALSE)
+ break;
+ }
+}
+
+
+void PictWriter::WriteHeader(const GDIMetaFile & rMTF)
+{
+ USHORT i;
+ Size aSize( rMTF.GetPrefSize() );
+ Point aPoint;
+ Rectangle aRect( aPoint, aSize );
+
+ // 512 Bytes "Muell" am Anfang:
+ for (i=0;i<128;i++) *pPict << (sal_uInt32)0;
+
+ // Lo-16-Bits der Groesse der Datei ohne die 512 Bytes Muell:
+ *pPict << (USHORT)0; // wird spaeter durch UpdateHeader() berichtigt
+
+ // Das Bounding-Rectangle (y1,x1,y2,x2 !):
+ WriteRectangle( aRect );
+
+ // Version 2:
+ *pPict << (sal_uInt32)0x001102ff;
+
+ // Extended-Version-2-Header:
+ *pPict << (USHORT)0x0c00 // Opcode
+ << (USHORT)0xfffe // Version (?)
+ << (USHORT)0x0000 // Reserved
+ << (sal_uInt32) 0x00480000 // hRes
+ << (sal_uInt32) 0x00480000;
+ WriteRectangle( aRect );
+ *pPict << (sal_uInt32)0x00000000; // Reserved
+
+ // viele Import-Filter verlangen die Angabe eines
+ // Clipping-Bereichs am Anfang
+
+ WriteOpcode_ClipRect( aRect );
+}
+
+
+void PictWriter::UpdateHeader()
+{
+ ULONG nPos;
+
+ // Lo-16-Bits der Groesse der Datei ohne die 512 Bytes Muell berichtigen:
+ nPos=pPict->Tell();
+ pPict->Seek(512);
+ *pPict << (USHORT)((nPos-512)&0x0000ffff);
+ pPict->Seek(nPos);
+}
+
+
+BOOL PictWriter::WritePict(const GDIMetaFile & rMTF, SvStream & rTargetStream, FilterConfigItem* pFilterConfigItem )
+{
+ PictWriterAttrStackMember* pAt;
+ MapMode aMap72( MAP_INCH );
+ Fraction aDPIFrac( 1, 72 );
+
+ bStatus=TRUE;
+ nLastPercent=0;
+
+ if ( pFilterConfigItem )
+ {
+ xStatusIndicator = pFilterConfigItem->GetStatusIndicator();
+ if ( xStatusIndicator.is() )
+ {
+ rtl::OUString aMsg;
+ xStatusIndicator->start( aMsg, 100 );
+ }
+ }
+
+ pPict=&rTargetStream;
+ pPict->SetNumberFormatInt(NUMBERFORMAT_INT_BIGENDIAN);
+
+ aLineColor=Color( COL_BLACK );
+ aFillColor=Color( COL_WHITE );
+ eSrcRasterOp=ROP_OVERPAINT;
+ aSrcFont=Font();
+ aSrcMapMode = rMTF.GetPrefMapMode();
+
+ aMap72.SetScaleX( aDPIFrac );
+ aMap72.SetScaleY( aDPIFrac );
+ aTargetMapMode = aMap72;
+
+ pAttrStack=NULL;
+
+ bDstBkPatValid=FALSE;
+ bDstTxFaceValid=FALSE;
+ bDstTxModeValid=FALSE;
+ bDstPnSizeValid=FALSE;
+ bDstPnModeValid=FALSE;
+ bDstPnPatValid=FALSE;
+ bDstFillPatValid=FALSE;
+ bDstTxSizeValid=FALSE;
+ bDstFgColValid=FALSE;
+ bDstBkColValid=FALSE;
+ bDstPenPositionValid=FALSE;
+ bDstTextPositionValid=FALSE;
+ bDstFontNameValid=FALSE;
+
+ nNumberOfActions=0;
+ nNumberOfBitmaps=0;
+ nWrittenActions=0;
+ nWrittenBitmaps=0;
+ nActBitmapPercent=0;
+
+ CountActionsAndBitmaps(rMTF);
+
+ WriteHeader(rMTF);
+ WriteOpcodes(rMTF);
+ WriteOpcode_EndOfFile();
+ UpdateHeader();
+
+ while (pAttrStack!=NULL) {
+ pAt=pAttrStack;
+ pAttrStack=pAt->pSucc;
+ delete pAt;
+ }
+
+ if ( xStatusIndicator.is() )
+ xStatusIndicator->end();
+
+ return bStatus;
+}
+
+//================== GraphicExport - die exportierte Funktion ================
+
+extern "C" BOOL __LOADONCALLAPI GraphicExport(SvStream & rStream, Graphic & rGraphic, FilterConfigItem* pFilterConfigItem, BOOL)
+{
+ PictWriter aPictWriter;
+
+ if (rGraphic.GetType()==GRAPHIC_GDIMETAFILE)
+ {
+ GDIMetaFile aScaledMtf( rGraphic.GetGDIMetaFile() );
+
+/*
+ MapMode aMap72( MAP_INCH );
+ Fraction aDPIFrac( 1, 72 );
+ Size aOldSize = aScaledMtf.GetPrefSize();
+
+ aMap72.SetScaleX( aDPIFrac );
+ aMap72.SetScaleY( aDPIFrac );
+
+ Size aNewSize = OutputDevice::LogicToLogic( aOldSize,
+ aScaledMtf.GetPrefMapMode(),
+ aMap72 );
+
+ aScaledMtf.Scale( Fraction( aNewSize.Width(), aOldSize.Width() ),
+ Fraction( aNewSize.Height(), aOldSize.Height() ) );
+ aScaledMtf.SetPrefMapMode( aMap72 );
+ aScaledMtf.SetPrefSize( aNewSize );
+*/
+
+ return aPictWriter.WritePict( aScaledMtf, rStream, pFilterConfigItem );
+ }
+ else
+ {
+ Bitmap aBmp=rGraphic.GetBitmap();
+ GDIMetaFile aMTF;
+ VirtualDevice aVirDev;
+
+ aMTF.Record(&aVirDev);
+ aVirDev.DrawBitmap(Point(),aBmp);
+ aMTF.Stop();
+ aMTF.SetPrefSize(aBmp.GetSizePixel());
+ return aPictWriter.WritePict( aMTF, rStream, pFilterConfigItem );
+ }
+}
+
+//================== GraphicDialog - die exportierte Funktion ================
+
+extern "C" BOOL SAL_CALL DoExportDialog( FltCallDialogParameter& rPara )
+{
+ BOOL bRet = FALSE;
+
+ if ( rPara.pWindow )
+ {
+ ByteString aResMgrName( "ept" );
+ ResMgr* pResMgr;
+
+ pResMgr = ResMgr::CreateResMgr( aResMgrName.GetBuffer(), Application::GetSettings().GetUILocale() );
+
+ if( pResMgr )
+ {
+ rPara.pResMgr = pResMgr;
+ bRet = ( DlgExportEPCT( rPara ).Execute() == RET_OK );
+ delete pResMgr;
+ }
+ else
+ bRet = TRUE;
+ }
+
+ return bRet;
+}
+
+
+//=============================== fuer Windows ==============================
+#ifndef GCC
+#endif
+
+#ifdef WIN
+
+static HINSTANCE hDLLInst = 0; // HANDLE der DLL
+
+extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR )
+{
+#ifndef WNT
+ if ( nHeap )
+ UnlockData( 0 );
+#endif
+
+ hDLLInst = hDLL;
+
+ return TRUE;
+}
+
+extern "C" int CALLBACK WEP( int )
+{
+ return 1;
+}
+
+#endif
+
diff --git a/filter/source/graphicfilter/epict/epictstr.src b/filter/source/graphicfilter/epict/epictstr.src
new file mode 100644
index 000000000000..8afebcb7564c
--- /dev/null
+++ b/filter/source/graphicfilter/epict/epictstr.src
@@ -0,0 +1,38 @@
+/*************************************************************************
+ *
+ * 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 "strings.hrc"
+
+String KEY_MODE
+{
+ Text = "ExportMode";
+};
+
+String KEY_SIZE
+{
+ Text = "Size";
+};
diff --git a/filter/source/graphicfilter/epict/exports.map b/filter/source/graphicfilter/epict/exports.map
new file mode 100644
index 000000000000..61e4682c6551
--- /dev/null
+++ b/filter/source/graphicfilter/epict/exports.map
@@ -0,0 +1,8 @@
+UDK_3_0_0 {
+ global:
+ GraphicExport;
+ DoExportDialog;
+
+ local:
+ *;
+};
diff --git a/filter/source/graphicfilter/epict/makefile.mk b/filter/source/graphicfilter/epict/makefile.mk
new file mode 100644
index 000000000000..a7c99eb3f732
--- /dev/null
+++ b/filter/source/graphicfilter/epict/makefile.mk
@@ -0,0 +1,76 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=filter
+TARGET=epict
+TARGET2=ept
+DEPTARGET=vepict
+
+
+# --- Settings -----------------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Allgemein ----------------------------------------------------------
+
+.IF "$(editdebug)"!="" || "$(EDITDEBUG)"!=""
+CDEFS+= -DEDITDEBUG
+.ENDIF
+
+SRS1NAME=$(TARGET)
+SRC1FILES = dlgepct.src \
+ epictstr.src
+.IF "$(L10N_framework)"==""
+SLOFILES = $(SLO)$/epict.obj \
+ $(SLO)$/dlgepct.obj
+.ENDIF
+# ==========================================================================
+
+RESLIB1NAME=$(TARGET2)
+RESLIB1SRSFILES=$(SRS)$/$(TARGET).srs
+.IF "$(L10N_framework)"==""
+SHL1TARGET= ept$(DLLPOSTFIX)
+SHL1IMPLIB= epict
+SHL1STDLIBS= $(TOOLSLIB) $(VCLLIB) $(SVTOOLLIB) $(CPPULIB) $(SALLIB) $(BASEGFXLIB)
+
+SHL1LIBS= $(SLB)$/epict.lib
+
+.IF "$(GUI)" != "UNX"
+.IF "$(COM)" != "GCC"
+SHL1OBJS= $(SLO)$/epict.obj
+.ENDIF
+.ENDIF
+
+SHL1VERSIONMAP=exports.map
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+DEF1NAME=$(SHL1TARGET)
+.ENDIF
+# ==========================================================================
+
+.INCLUDE : target.mk
diff --git a/filter/source/graphicfilter/epict/strings.hrc b/filter/source/graphicfilter/epict/strings.hrc
new file mode 100644
index 000000000000..7834e3ea2bc0
--- /dev/null
+++ b/filter/source/graphicfilter/epict/strings.hrc
@@ -0,0 +1,29 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+#define KEY_MODE 260
+#define KEY_SIZE 261
+
diff --git a/filter/source/graphicfilter/eppm/dlgeppm.cxx b/filter/source/graphicfilter/eppm/dlgeppm.cxx
new file mode 100644
index 000000000000..23822bfebf7c
--- /dev/null
+++ b/filter/source/graphicfilter/eppm/dlgeppm.cxx
@@ -0,0 +1,96 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+#ifndef GCC
+#endif
+#include <tools/ref.hxx>
+#include <svtools/FilterConfigItem.hxx>
+#include <vcl/msgbox.hxx>
+#include "dlgeppm.hxx"
+#include "dlgeppm.hrc"
+#include "strings.hrc"
+
+/*************************************************************************
+|*
+|* Ctor
+|*
+\************************************************************************/
+
+DlgExportEPPM::DlgExportEPPM( FltCallDialogParameter& rPara ) :
+ ModalDialog ( rPara.pWindow, ResId( DLG_EXPORT_EPPM, *rPara.pResMgr ) ),
+ rFltCallPara ( rPara ),
+ aGrpFormat ( this, ResId( GRP_FORMAT, *rPara.pResMgr ) ),
+ aRBRaw ( this, ResId( RB_RAW, *rPara.pResMgr ) ),
+ aRBASCII ( this, ResId( RB_ASCII, *rPara.pResMgr ) ),
+ aBtnOK ( this, ResId( BTN_OK, *rPara.pResMgr ) ),
+ aBtnCancel ( this, ResId( BTN_CANCEL, *rPara.pResMgr ) ),
+ aBtnHelp ( this, ResId( BTN_HELP, *rPara.pResMgr ) ),
+ pMgr ( rPara.pResMgr )
+{
+ FreeResource();
+
+ // Config-Parameter lesen
+
+ String aFilterConfigPath( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Filter/Graphic/Export/PPM" ) );
+ pConfigItem = new FilterConfigItem( aFilterConfigPath, &rPara.aFilterData );
+ sal_Int32 nFormat = pConfigItem->ReadInt32( String( ResId( KEY_FORMAT, *pMgr ) ), 0 );
+
+ BOOL bCheck = FALSE;
+ if ( !nFormat )
+ bCheck ^= TRUE;
+ aRBRaw.Check( bCheck );
+ bCheck ^= TRUE;
+ aRBASCII.Check( bCheck );
+
+ aBtnOK.SetClickHdl( LINK( this, DlgExportEPPM, OK ) );
+}
+
+DlgExportEPPM::~DlgExportEPPM()
+{
+ delete pConfigItem;
+}
+
+/*************************************************************************
+|*
+|* Speichert eingestellte Werte in ini-Datei
+|*
+\************************************************************************/
+
+IMPL_LINK( DlgExportEPPM, OK, void *, EMPTYARG )
+{
+ // Config-Parameter schreiben
+ sal_Int32 nFormat = 0;
+ if ( aRBASCII.IsChecked() )
+ nFormat++;
+ pConfigItem->WriteInt32( String( ResId( KEY_FORMAT, *pMgr ) ), nFormat );
+ rFltCallPara.aFilterData = pConfigItem->GetFilterData();
+ EndDialog( RET_OK );
+
+ return 0;
+}
diff --git a/filter/source/graphicfilter/eppm/dlgeppm.hrc b/filter/source/graphicfilter/eppm/dlgeppm.hrc
new file mode 100644
index 000000000000..876dfa840997
--- /dev/null
+++ b/filter/source/graphicfilter/eppm/dlgeppm.hrc
@@ -0,0 +1,34 @@
+/*************************************************************************
+ *
+ * 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 "filter.hrc"
+
+#define BTN_OK 1
+#define BTN_CANCEL 1
+#define BTN_HELP 1
+#define GRP_FORMAT 1
+#define RB_RAW 1
+#define RB_ASCII 2
diff --git a/filter/source/graphicfilter/eppm/dlgeppm.hxx b/filter/source/graphicfilter/eppm/dlgeppm.hxx
new file mode 100644
index 000000000000..a03ca3ad24f0
--- /dev/null
+++ b/filter/source/graphicfilter/eppm/dlgeppm.hxx
@@ -0,0 +1,71 @@
+/*************************************************************************
+ *
+ * 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 _DLGEPPM_HXX_
+#define _DLGEPPM_HXX_
+#include <svtools/fltcall.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/button.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/field.hxx>
+#include <svtools/stdctrl.hxx>
+
+
+/*************************************************************************
+|*
+|* Dialog zum Einstellen von Filteroptionen
+|*
+\************************************************************************/
+
+class FilterConfigItem;
+class ResMgr;
+
+class DlgExportEPPM : public ModalDialog
+{
+private:
+
+ FltCallDialogParameter& rFltCallPara;
+
+ FixedLine aGrpFormat;
+ RadioButton aRBRaw;
+ RadioButton aRBASCII;
+ OKButton aBtnOK;
+ CancelButton aBtnCancel;
+ HelpButton aBtnHelp;
+
+ FilterConfigItem* pConfigItem;
+ ResMgr* pMgr;
+
+ DECL_LINK( OK, void * );
+
+public:
+ DlgExportEPPM( FltCallDialogParameter& rPara );
+ ~DlgExportEPPM();
+};
+
+#endif // _DLGEPPM_HXX_
diff --git a/filter/source/graphicfilter/eppm/dlgeppm.src b/filter/source/graphicfilter/eppm/dlgeppm.src
new file mode 100644
index 000000000000..bf6c6ec653cb
--- /dev/null
+++ b/filter/source/graphicfilter/eppm/dlgeppm.src
@@ -0,0 +1,106 @@
+/*************************************************************************
+ *
+ * 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 "dlgeppm.hrc"
+ModalDialog DLG_EXPORT_EPPM
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 133 , 63 ) ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ Text [ en-US ] = "PPM Options" ;
+ OKButton BTN_OK
+ {
+ Pos = MAP_APPFONT ( 73 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( 73 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton BTN_HELP
+ {
+ Pos = MAP_APPFONT ( 73 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ FixedLine GRP_FORMAT
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 60 , 8 ) ;
+ Text [ en-US ] = "File format";
+ };
+ RadioButton RB_RAW
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 45 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Binary";
+ };
+ RadioButton RB_ASCII
+ {
+ Pos = MAP_APPFONT ( 12 , 28 ) ;
+ Size = MAP_APPFONT ( 45 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Text";
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/filter/source/graphicfilter/eppm/eppm.cxx b/filter/source/graphicfilter/eppm/eppm.cxx
new file mode 100644
index 000000000000..bef9ce9d3077
--- /dev/null
+++ b/filter/source/graphicfilter/eppm/eppm.cxx
@@ -0,0 +1,305 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include <vcl/svapp.hxx>
+#include <vcl/graph.hxx>
+#include <vcl/bmpacc.hxx>
+#include <vcl/msgbox.hxx>
+#include <svl/solar.hrc>
+#include <svtools/fltcall.hxx>
+#include <svtools/FilterConfigItem.hxx>
+#include "strings.hrc"
+#include "dlgeppm.hrc"
+#include "dlgeppm.hxx"
+
+//============================ PPMWriter ==================================
+
+class PPMWriter {
+
+private:
+
+ SvStream* mpOStm; // Die auszugebende PPM-Datei
+ USHORT mpOStmOldModus;
+
+ BOOL mbStatus;
+ sal_Int32 mnMode;
+ BitmapReadAccess* mpAcc;
+ ULONG mnWidth, mnHeight; // Bildausmass in Pixeln
+
+ BOOL ImplWriteHeader();
+ void ImplWriteBody();
+ void ImplWriteNumber( sal_Int32 );
+
+ com::sun::star::uno::Reference< com::sun::star::task::XStatusIndicator > xStatusIndicator;
+
+public:
+ PPMWriter();
+ ~PPMWriter();
+
+ BOOL WritePPM( const Graphic& rGraphic, SvStream& rPPM, FilterConfigItem* pFilterConfigItem );
+};
+
+//=================== Methoden von PPMWriter ==============================
+
+PPMWriter::PPMWriter() :
+ mbStatus ( TRUE ),
+ mpAcc ( NULL )
+{
+}
+
+// ------------------------------------------------------------------------
+
+PPMWriter::~PPMWriter()
+{
+}
+
+// ------------------------------------------------------------------------
+
+BOOL PPMWriter::WritePPM( const Graphic& rGraphic, SvStream& rPPM, FilterConfigItem* pFilterConfigItem )
+{
+
+ mpOStm = &rPPM;
+
+ if ( pFilterConfigItem )
+ {
+ mnMode = pFilterConfigItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "FileFormat" ) ), 0 );
+
+ xStatusIndicator = pFilterConfigItem->GetStatusIndicator();
+ if ( xStatusIndicator.is() )
+ {
+ rtl::OUString aMsg;
+ xStatusIndicator->start( aMsg, 100 );
+ }
+ }
+
+ BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
+ Bitmap aBmp = aBmpEx.GetBitmap();
+ aBmp.Convert( BMP_CONVERSION_24BIT );
+
+ mpOStmOldModus = mpOStm->GetNumberFormatInt();
+ mpOStm->SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN );
+
+ mpAcc = aBmp.AcquireReadAccess();
+ if( mpAcc )
+ {
+ if ( ImplWriteHeader() )
+ {
+ ImplWriteBody();
+ }
+ aBmp.ReleaseAccess( mpAcc );
+ }
+ else
+ mbStatus = FALSE;
+
+ mpOStm->SetNumberFormatInt( mpOStmOldModus );
+
+ if ( xStatusIndicator.is() )
+ xStatusIndicator->end();
+
+ return mbStatus;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL PPMWriter::ImplWriteHeader()
+{
+ mnWidth = mpAcc->Width();
+ mnHeight = mpAcc->Height();
+ if ( mnWidth && mnHeight )
+ {
+ if ( mnMode == 0 )
+ *mpOStm << "P6\x0a";
+ else
+ *mpOStm << "P3\x0a";
+
+ ImplWriteNumber( mnWidth );
+ *mpOStm << (BYTE)32;
+ ImplWriteNumber( mnHeight );
+ *mpOStm << (BYTE)32;
+ ImplWriteNumber( 255 ); // max. col.
+ *mpOStm << (BYTE)10;
+ }
+ else
+ mbStatus = FALSE;
+
+ return mbStatus;
+}
+
+// ------------------------------------------------------------------------
+
+void PPMWriter::ImplWriteBody()
+{
+ if ( mnMode == 0 )
+ {
+ for ( ULONG y = 0; y < mnHeight; y++ )
+ {
+ for ( ULONG x = 0; x < mnWidth; x++ )
+ {
+ const BitmapColor& rColor = mpAcc->GetPixel( y, x );
+ *mpOStm << rColor.GetRed();
+ *mpOStm << rColor.GetGreen();
+ *mpOStm << rColor.GetBlue();
+ }
+ }
+ }
+ else
+ {
+ for ( ULONG y = 0; y < mnHeight; y++ )
+ {
+ int nCount = 70;
+ for ( ULONG x = 0; x < mnWidth; x++ )
+ {
+ BYTE i, nDat[3], nNumb;
+ if ( nCount < 0 )
+ {
+ nCount = 69;
+ *mpOStm << (BYTE)10;
+ }
+ nDat[0] = mpAcc->GetPixel( y, x ).GetRed();
+ nDat[1] = mpAcc->GetPixel( y, x ).GetGreen();
+ nDat[2] = mpAcc->GetPixel( y, x ).GetBlue();
+ for ( i = 0; i < 3; i++ )
+ {
+ nNumb = nDat[ i ] / 100;
+ if ( nNumb )
+ {
+ *mpOStm << (BYTE)( nNumb + '0' );
+ nDat[ i ] -= ( nNumb * 100 );
+ nNumb = nDat[ i ] / 10;
+ *mpOStm << (BYTE)( nNumb + '0' );
+ nDat[ i ] -= ( nNumb * 10 );
+ *mpOStm << (BYTE)( nDat[ i ] + '0' );
+ nCount -= 4;
+ }
+ else
+ {
+ nNumb = nDat[ i ] / 10;
+ if ( nNumb )
+ {
+ *mpOStm << (BYTE)( nNumb + '0' );
+ nDat[ i ] -= ( nNumb * 10 );
+ *mpOStm << (BYTE)( nDat[ i ] + '0' );
+ nCount -= 3;
+ }
+ else
+ {
+ *mpOStm << (BYTE)( nDat[ i ] + '0' );
+ nCount -= 2;
+ }
+ }
+ *mpOStm << (BYTE)' ';
+ }
+ }
+ *mpOStm << (BYTE)10;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------
+// eine Dezimalzahl im ASCII format wird in den Stream geschrieben
+
+void PPMWriter::ImplWriteNumber( sal_Int32 nNumber )
+{
+ const ByteString aNum( ByteString::CreateFromInt32( nNumber ) );
+
+ for( sal_Int16 n = 0, nLen = aNum.Len(); n < nLen; n++ )
+ *mpOStm << aNum.GetChar( n );
+
+}
+
+// ------------------------------------------------------------------------
+
+// ---------------------
+// - exported function -
+// ---------------------
+
+extern "C" BOOL __LOADONCALLAPI GraphicExport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pFilterConfigItem, BOOL )
+{
+ PPMWriter aPPMWriter;
+ return aPPMWriter.WritePPM( rGraphic, rStream, pFilterConfigItem );
+}
+
+// ------------------------------------------------------------------------
+
+extern "C" BOOL __LOADONCALLAPI DoExportDialog( FltCallDialogParameter& rPara )
+{
+ BOOL bRet = FALSE;
+
+ if ( rPara.pWindow )
+ {
+ ByteString aResMgrName( "epp" );
+ ResMgr* pResMgr;
+
+ pResMgr = ResMgr::CreateResMgr( aResMgrName.GetBuffer(), Application::GetSettings().GetUILocale() );
+
+ if( pResMgr )
+ {
+ rPara.pResMgr = pResMgr;
+ bRet = ( DlgExportEPPM( rPara ).Execute() == RET_OK );
+ delete pResMgr;
+ }
+ else
+ bRet = TRUE;
+ }
+
+ return bRet;
+}
+
+#ifndef GCC
+#endif
+
+// ------------------------------------------------------------------------
+
+// ---------------
+// - Win16 trash -
+// ---------------
+
+#ifdef WIN
+
+static HINSTANCE hDLLInst = 0;
+
+extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR )
+{
+ if ( nHeap )
+ UnlockData( 0 );
+
+ hDLLInst = hDLL;
+
+ return TRUE;
+}
+
+// ------------------------------------------------------------------------
+
+extern "C" int CALLBACK WEP( int )
+{
+ return 1;
+}
+
+#endif
diff --git a/filter/source/graphicfilter/eppm/eppmstr.src b/filter/source/graphicfilter/eppm/eppmstr.src
new file mode 100644
index 000000000000..8424505dbcd1
--- /dev/null
+++ b/filter/source/graphicfilter/eppm/eppmstr.src
@@ -0,0 +1,35 @@
+/*************************************************************************
+ *
+ * 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 "strings.hrc"
+
+// Key fuer den Dialog
+String KEY_FORMAT
+{
+ Text = "FileFormat";
+};
diff --git a/filter/source/graphicfilter/eppm/exports.map b/filter/source/graphicfilter/eppm/exports.map
new file mode 100644
index 000000000000..61e4682c6551
--- /dev/null
+++ b/filter/source/graphicfilter/eppm/exports.map
@@ -0,0 +1,8 @@
+UDK_3_0_0 {
+ global:
+ GraphicExport;
+ DoExportDialog;
+
+ local:
+ *;
+};
diff --git a/filter/source/graphicfilter/eppm/makefile.mk b/filter/source/graphicfilter/eppm/makefile.mk
new file mode 100644
index 000000000000..44e6ca11d34a
--- /dev/null
+++ b/filter/source/graphicfilter/eppm/makefile.mk
@@ -0,0 +1,76 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=filter
+TARGET=eppm
+TARGET2=epp
+DEPTARGET=veppm
+
+# --- Settings -----------------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Allgemein ----------------------------------------------------------
+
+.IF "$(editdebug)"!="" || "$(EDITDEBUG)"!=""
+CDEFS+= -DEDITDEBUG
+.ENDIF
+
+SRS1NAME=$(TARGET)
+SRC1FILES= dlgeppm.src \
+ eppmstr.src
+.IF "$(L10N_framework)"==""
+SLOFILES = $(SLO)$/eppm.obj \
+ $(SLO)$/dlgeppm.obj
+.ENDIF
+# ==========================================================================
+
+RESLIB1NAME=$(TARGET2)
+RESLIB1SRSFILES=$(SRS)$/$(TARGET).srs
+.IF "$(L10N_framework)"==""
+SHL1TARGET= epp$(DLLPOSTFIX)
+SHL1IMPLIB= eppm
+SHL1STDLIBS= $(TOOLSLIB) $(VCLLIB) $(CPPULIB) $(SVTOOLLIB) $(SALLIB)
+
+SHL1LIBS= $(SLB)$/eppm.lib
+
+.IF "$(GUI)" != "UNX"
+.IF "$(COM)" != "GCC"
+SHL1OBJS= $(SLO)$/eppm.obj
+.ENDIF
+.ENDIF
+
+SHL1VERSIONMAP=exports.map
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+DEF1NAME=$(SHL1TARGET)
+.ENDIF
+
+# ==========================================================================
+
+.INCLUDE : target.mk
diff --git a/filter/source/graphicfilter/eppm/strings.hrc b/filter/source/graphicfilter/eppm/strings.hrc
new file mode 100644
index 000000000000..122719e87d4b
--- /dev/null
+++ b/filter/source/graphicfilter/eppm/strings.hrc
@@ -0,0 +1,27 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+#define KEY_FORMAT 256
diff --git a/filter/source/graphicfilter/eps/dlgeps.cxx b/filter/source/graphicfilter/eps/dlgeps.cxx
new file mode 100644
index 000000000000..c6f2abba5912
--- /dev/null
+++ b/filter/source/graphicfilter/eps/dlgeps.cxx
@@ -0,0 +1,206 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+#ifndef GCC
+#endif
+
+#include <tools/ref.hxx>
+#include <vcl/msgbox.hxx>
+#include <svtools/FilterConfigItem.hxx>
+#include "dlgeps.hxx"
+#include "dlgeps.hrc"
+#include "strings.hrc"
+
+/*************************************************************************
+|*
+|* Ctor
+|*
+\************************************************************************/
+
+DlgExportEPS::DlgExportEPS( FltCallDialogParameter& rPara ) :
+ ModalDialog ( rPara.pWindow, ResId( DLG_EXPORT_EPS, *rPara.pResMgr ) ),
+ rFltCallPara ( rPara ),
+ aGrpPreview ( this, ResId( GRP_PREVIEW, *rPara.pResMgr ) ),
+ aCBPreviewTiff ( this, ResId( CB_PREVIEW_TIFF, *rPara.pResMgr ) ),
+ aCBPreviewEPSI ( this, ResId( CB_PREVIEW_EPSI, *rPara.pResMgr ) ),
+ aGrpVersion ( this, ResId( GRP_VERSION, *rPara.pResMgr ) ),
+ aRBLevel1 ( this, ResId( RB_LEVEL1, *rPara.pResMgr ) ),
+ aRBLevel2 ( this, ResId( RB_LEVEL2, *rPara.pResMgr ) ),
+ aGrpColor ( this, ResId( GRP_COLOR, *rPara.pResMgr ) ),
+ aRBColor ( this, ResId( RB_COLOR, *rPara.pResMgr ) ),
+ aRBGrayscale ( this, ResId( RB_GRAYSCALE, *rPara.pResMgr ) ),
+ aGrpCompression ( this, ResId( GRP_COMPRESSION, *rPara.pResMgr ) ),
+ aRBCompressionLZW ( this, ResId( RB_COMPRESSION_LZW, *rPara.pResMgr ) ),
+ aRBCompressionNone ( this, ResId( RB_COMPRESSION_NONE, *rPara.pResMgr ) ),
+ aBtnOK ( this, ResId( BTN_OK, *rPara.pResMgr ) ),
+ aBtnCancel ( this, ResId( BTN_CANCEL, *rPara.pResMgr ) ),
+ aBtnHelp ( this, ResId( BTN_HELP, *rPara.pResMgr ) ),
+ pMgr ( rPara.pResMgr )
+{
+ FreeResource();
+
+ String aFilterConfigPath( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Filter/Graphic/Export/EPS" ) );
+ pConfigItem = new FilterConfigItem( aFilterConfigPath, &rPara.aFilterData );
+
+ // Config-Parameter lesen
+ String sPreview( RTL_CONSTASCII_USTRINGPARAM( "Preview" ) );
+ String sVersion( RTL_CONSTASCII_USTRINGPARAM( "Version" ) );
+ String sColorFormat( RTL_CONSTASCII_USTRINGPARAM( "ColorFormat" ) );
+ String sCompressionMode( RTL_CONSTASCII_USTRINGPARAM( "CompressionMode" ) );
+ String sTextMode( RTL_CONSTASCII_USTRINGPARAM( "TextMode" ) );
+
+ sal_Int32 nPreview = pConfigItem->ReadInt32( sPreview, 0 );
+ sal_Int32 nVersion = pConfigItem->ReadInt32( sVersion, 2 );
+ sal_Int32 nColor = pConfigItem->ReadInt32( sColorFormat, 0 );
+ sal_Int32 nCompr = pConfigItem->ReadInt32( sCompressionMode, 2 );
+
+ /* SJ: The following line is not superfluous, reading the item will also #106652#
+ create the corresponding FilterData Property. Since all filter
+ are no longer accessing the configuration itself, we have fill the
+ FilterData sequence with all available configuration items */
+ pConfigItem->ReadInt32( sTextMode, 0 );
+
+ BOOL bCheck = FALSE;
+ if ( nPreview & 1 )
+ bCheck = TRUE;
+ aCBPreviewTiff.Check( bCheck );
+ if ( nPreview & 2 )
+ bCheck = TRUE;
+ aCBPreviewEPSI.Check( bCheck );
+
+ bCheck = FALSE;
+ if ( nVersion == 1 )
+ bCheck ^= TRUE;
+ aRBLevel1.Check( bCheck );
+ bCheck ^= TRUE;
+ aRBLevel2.Check( bCheck );
+
+ bCheck = FALSE;
+ if ( nColor == 1 )
+ bCheck ^= TRUE;
+ aRBColor.Check( bCheck );
+ bCheck ^= TRUE;
+ aRBGrayscale.Check( bCheck );
+
+ bCheck = FALSE;
+ if ( nCompr == 1 )
+ bCheck ^= TRUE;
+ aRBCompressionLZW.Check( bCheck );
+ bCheck ^= TRUE;
+ aRBCompressionNone.Check( bCheck );
+
+ if ( aRBLevel1.IsChecked() )
+ {
+ aRBColor.Disable();
+ aRBGrayscale.Disable();
+ aRBCompressionNone.Disable();
+ aRBCompressionLZW.Disable();
+ aRBCompressionNone.Disable();
+ }
+
+ aBtnOK.SetClickHdl( LINK( this, DlgExportEPS, OK ) );
+ aRBLevel1.SetClickHdl( LINK( this, DlgExportEPS, LEVEL1 ) );
+ aRBLevel2.SetClickHdl( LINK( this, DlgExportEPS, LEVEL2 ) );
+}
+
+DlgExportEPS::~DlgExportEPS()
+{
+ delete pConfigItem;
+}
+
+/*************************************************************************
+|*
+|* Speichert eingestellte Werte in ini-Datei
+|*
+\************************************************************************/
+
+IMPL_LINK( DlgExportEPS, OK, void *, EMPTYARG )
+{
+
+ // Config-Parameter schreiben
+ sal_Int32 nCheck = 0;
+ if ( aCBPreviewTiff.IsChecked() )
+ nCheck++;
+ if ( aCBPreviewEPSI.IsChecked() )
+ nCheck += 2;
+
+ String sPreview( RTL_CONSTASCII_USTRINGPARAM( "Preview" ) );
+ pConfigItem->WriteInt32( sPreview, nCheck );
+
+ nCheck = 1;
+ if ( aRBLevel2.IsChecked() )
+ nCheck++;
+ String sVersion( RTL_CONSTASCII_USTRINGPARAM( "Version" ) );
+ pConfigItem->WriteInt32( sVersion, nCheck );
+
+ nCheck = 1;
+ if ( aRBGrayscale.IsChecked() )
+ nCheck++;
+ String sColorFormat( RTL_CONSTASCII_USTRINGPARAM( "ColorFormat" ) );
+ pConfigItem->WriteInt32( sColorFormat, nCheck );
+
+ nCheck = 1;
+ if ( aRBCompressionNone.IsChecked() )
+ nCheck++;
+ String sCompressionMode( RTL_CONSTASCII_USTRINGPARAM( "CompressionMode" ) );
+ pConfigItem->WriteInt32( sCompressionMode, nCheck );
+
+ rFltCallPara.aFilterData = pConfigItem->GetFilterData();
+ EndDialog( RET_OK );
+
+ return 0;
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( DlgExportEPS, LEVEL1, void*, EMPTYARG )
+{
+ if ( aRBLevel1.IsChecked() )
+ {
+ aRBColor.Disable();
+ aRBGrayscale.Disable();
+ aRBCompressionLZW.Disable();
+ aRBCompressionNone.Disable();
+ }
+ return 0;
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( DlgExportEPS, LEVEL2, void*, EMPTYARG )
+{
+ if ( aRBLevel2.IsChecked() )
+ {
+ aRBColor.Enable();
+ aRBGrayscale.Enable();
+ aRBCompressionLZW.Enable();
+ aRBCompressionNone.Enable();
+ }
+ return 0;
+}
diff --git a/filter/source/graphicfilter/eps/dlgeps.hrc b/filter/source/graphicfilter/eps/dlgeps.hrc
new file mode 100644
index 000000000000..061c8b2db6cb
--- /dev/null
+++ b/filter/source/graphicfilter/eps/dlgeps.hrc
@@ -0,0 +1,43 @@
+/*************************************************************************
+ *
+ * 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 "filter.hrc"
+
+#define BTN_OK 1
+#define BTN_CANCEL 1
+#define BTN_HELP 1
+#define GRP_PREVIEW 1
+#define GRP_VERSION 2
+#define GRP_COLOR 3
+#define GRP_COMPRESSION 4
+#define CB_PREVIEW_TIFF 1
+#define CB_PREVIEW_EPSI 2
+#define RB_LEVEL1 1
+#define RB_LEVEL2 2
+#define RB_COLOR 3
+#define RB_GRAYSCALE 4
+#define RB_COMPRESSION_LZW 5
+#define RB_COMPRESSION_NONE 6
diff --git a/filter/source/graphicfilter/eps/dlgeps.hxx b/filter/source/graphicfilter/eps/dlgeps.hxx
new file mode 100644
index 000000000000..ada390b44e87
--- /dev/null
+++ b/filter/source/graphicfilter/eps/dlgeps.hxx
@@ -0,0 +1,82 @@
+/*************************************************************************
+ *
+ * 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 _DLGEPS_HXX_
+#define _DLGEPS_HXX_
+#include <svtools/fltcall.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/button.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/field.hxx>
+#include <vcl/lstbox.hxx>
+#include <svtools/stdctrl.hxx>
+
+
+/*************************************************************************
+|*
+|* Dialog zum Einstellen von Filteroptionen
+|*
+\************************************************************************/
+
+class FilterConfigItem;
+class ResMgr;
+
+class DlgExportEPS : public ModalDialog
+{
+private:
+
+ FltCallDialogParameter& rFltCallPara;
+
+ FixedLine aGrpPreview;
+ CheckBox aCBPreviewTiff;
+ CheckBox aCBPreviewEPSI;
+ FixedLine aGrpVersion;
+ RadioButton aRBLevel1;
+ RadioButton aRBLevel2;
+ FixedLine aGrpColor;
+ RadioButton aRBColor;
+ RadioButton aRBGrayscale;
+ FixedLine aGrpCompression;
+ RadioButton aRBCompressionLZW;
+ RadioButton aRBCompressionNone;
+ OKButton aBtnOK;
+ CancelButton aBtnCancel;
+ HelpButton aBtnHelp;
+
+ FilterConfigItem* pConfigItem;
+ ResMgr* pMgr;
+
+ DECL_LINK( OK, void * );
+ DECL_LINK( LEVEL1, void* );
+ DECL_LINK( LEVEL2, void* );
+
+public:
+ DlgExportEPS( FltCallDialogParameter& rPara );
+ ~DlgExportEPS();
+};
+
+#endif // _DLGEPS_HXX_
diff --git a/filter/source/graphicfilter/eps/dlgeps.src b/filter/source/graphicfilter/eps/dlgeps.src
new file mode 100644
index 000000000000..31ddccd5be4f
--- /dev/null
+++ b/filter/source/graphicfilter/eps/dlgeps.src
@@ -0,0 +1,160 @@
+/*************************************************************************
+ *
+ * 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 "dlgeps.hrc"
+ModalDialog DLG_EXPORT_EPS
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 230, 161 ) ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ Text [ en-US ] = "EPS Export Options";
+ OKButton BTN_OK
+ {
+ Pos = MAP_APPFONT ( 174 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( 174, 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton BTN_HELP
+ {
+ Pos = MAP_APPFONT ( 174 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+
+ FixedLine GRP_PREVIEW
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 162 , 8 ) ;
+ Text [ en-US ] = "Preview";
+ };
+ CheckBox CB_PREVIEW_TIFF
+ {
+ Pos = MAP_APPFONT ( 12, 14 ) ;
+ Size = MAP_APPFONT ( 150 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Image ~preview (TIFF)";
+ };
+ CheckBox CB_PREVIEW_EPSI
+ {
+ Pos = MAP_APPFONT ( 12 , 28 ) ;
+ Size = MAP_APPFONT ( 150, 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Interchange (EPSI)";
+ };
+ FixedLine GRP_VERSION
+ {
+ Pos = MAP_APPFONT ( 6, 41 ) ;
+ Size = MAP_APPFONT ( 162 , 8 ) ;
+ Text [ en-US ] = "Version";
+ };
+ RadioButton RB_LEVEL1
+ {
+ Pos = MAP_APPFONT ( 12 , 52 ) ;
+ Size = MAP_APPFONT ( 150 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Level ~1";
+ };
+ RadioButton RB_LEVEL2
+ {
+ Pos = MAP_APPFONT ( 12 , 66 ) ;
+ Size = MAP_APPFONT ( 150, 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Level ~2";
+ };
+
+ FixedLine GRP_COLOR
+ {
+ Pos = MAP_APPFONT ( 6 , 79 ) ;
+ Size = MAP_APPFONT ( 162 , 8 ) ;
+ Text [ en-US ] = "Color format";
+ };
+ RadioButton RB_COLOR
+ {
+ Pos = MAP_APPFONT ( 12 , 90 ) ;
+ Size = MAP_APPFONT ( 150, 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Color";
+ };
+ RadioButton RB_GRAYSCALE
+ {
+ Pos = MAP_APPFONT ( 12 , 104 ) ;
+ Size = MAP_APPFONT ( 150, 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Grayscale";
+ };
+
+ FixedLine GRP_COMPRESSION
+ {
+ Pos = MAP_APPFONT ( 6 , 117 ) ;
+ Size = MAP_APPFONT ( 162 , 8 ) ;
+ Text [ en-US ] = "Compression";
+ };
+ RadioButton RB_COMPRESSION_LZW
+ {
+ Pos = MAP_APPFONT ( 12, 128 );
+ Size = MAP_APPFONT ( 150, 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "LZW encoding";
+ };
+ RadioButton RB_COMPRESSION_NONE
+ {
+ Pos = MAP_APPFONT ( 12, 141 ) ;
+ Size = MAP_APPFONT ( 150, 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "None";
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/filter/source/graphicfilter/eps/eps.cxx b/filter/source/graphicfilter/eps/eps.cxx
new file mode 100644
index 000000000000..5e221b58c72e
--- /dev/null
+++ b/filter/source/graphicfilter/eps/eps.cxx
@@ -0,0 +1,2793 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include <vcl/sv.h>
+#include <tools/stream.hxx>
+#include <tools/bigint.hxx>
+#include <tools/poly.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/metaact.hxx>
+#include <vcl/graph.hxx>
+#include <vcl/bmpacc.hxx>
+#include <vcl/region.hxx>
+#include <vcl/metric.hxx>
+#include <vcl/font.hxx>
+#include <vcl/virdev.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/cvtgrf.hxx>
+#include <vcl/gradient.hxx>
+#include <svl/solar.hrc>
+#include <svtools/fltcall.hxx>
+#include <svtools/FilterConfigItem.hxx>
+#include <vcl/graphictools.hxx>
+#include "strings.hrc"
+#include "dlgeps.hrc"
+#include "dlgeps.hxx"
+
+#include <math.h>
+
+#define POSTSCRIPT_BOUNDINGSEARCH 0x1000 // we only try to get the BoundingBox
+ // in the first 4096 bytes
+
+#define EPS_PREVIEW_TIFF 1
+#define EPS_PREVIEW_EPSI 2
+
+#define PS_LINESIZE 70 // maximum number of characters a line in the output
+
+#define PS_NONE 0 // formating mode: action which is inserted behind the output
+#define PS_SPACE 1
+#define PS_RET 2
+#define PS_WRAP 4
+
+// -----------------------------Feld-Typen-------------------------------
+
+struct ChrSet
+{
+ struct ChrSet * pSucc;
+ BYTE nSet;
+ String aName;
+ FontWeight eWeight;
+};
+
+struct StackMember
+{
+ struct StackMember * pSucc;
+ Color aGlobalCol;
+ BOOL bLineCol;
+ Color aLineCol;
+ BOOL bFillCol;
+ Color aFillCol;
+ Color aTextCol;
+ BOOL bTextFillCol;
+ Color aTextFillCol;
+ Color aBackgroundCol;
+ Font aFont;
+ TextAlign eTextAlign;
+
+ double fLineWidth;
+ double fMiterLimit;
+ SvtGraphicStroke::CapType eLineCap;
+ SvtGraphicStroke::JoinType eJoinType;
+ SvtGraphicStroke::DashArray aDashArray;
+};
+
+struct PSLZWCTreeNode
+{
+
+ PSLZWCTreeNode* pBrother; // naechster Knoten, der den selben Vater hat
+ PSLZWCTreeNode* pFirstChild; // erster Sohn
+ USHORT nCode; // Der Code fuer den String von Pixelwerten, der sich ergibt, wenn
+ USHORT nValue; // Der Pixelwert
+};
+
+class PSWriter
+{
+private:
+ BOOL mbStatus;
+ ULONG mnLevelWarning; // number of embedded eps files which was not exported
+ ULONG mnLastPercent; // Mit welcher Zahl pCallback zuletzt aufgerufen wurde.
+ UINT32 mnLatestPush; // offset auf streamposition, an der zuletzt gepusht wurde
+
+ long mnLevel; // dialog options
+ sal_Bool mbGrayScale;
+ sal_Bool mbCompression;
+ sal_Int32 mnPreview;
+ sal_Int32 mnTextMode;
+
+ SvStream* mpPS;
+ const GDIMetaFile* pMTF;
+ GDIMetaFile* pAMTF; // only created if Graphics is not a Metafile
+ VirtualDevice aVDev;
+
+ double nBoundingX1; // this represents the bounding box
+ double nBoundingY1;
+ double nBoundingX2;
+ double nBoundingY2;
+ //
+ StackMember* pGDIStack;
+ ULONG mnCursorPos; // aktuelle Cursorposition im Output
+ Color aColor; // aktuelle Farbe die fuer den Output benutzt wird
+ BOOL bLineColor;
+ Color aLineColor; // aktuelle GDIMetafile Farbeinstellungen
+ BOOL bFillColor; //
+ Color aFillColor; //
+ Color aTextColor; //
+ BOOL bTextFillColor; //
+ Color aTextFillColor; //
+ Color aBackgroundColor; //
+ BOOL bRegionChanged;
+ TextAlign eTextAlign; //
+
+ double fLineWidth;
+ double fMiterLimit;
+ SvtGraphicStroke::CapType eLineCap;
+ SvtGraphicStroke::JoinType eJoinType;
+ SvtGraphicStroke::DashArray aDashArray;
+
+ Font maFont;
+ Font maLastFont;
+ BYTE nChrSet;
+ ChrSet* pChrSetList; // Liste der Character-Sets
+ BYTE nNextChrSetId; // die erste unbenutzte ChrSet-Id
+
+ PSLZWCTreeNode* pTable; // LZW compression data
+ PSLZWCTreeNode* pPrefix; // the compression is as same as the TIFF compression
+ USHORT nDataSize;
+ USHORT nClearCode;
+ USHORT nEOICode;
+ USHORT nTableSize;
+ USHORT nCodeSize;
+ ULONG nOffset;
+ ULONG dwShift;
+
+ com::sun::star::uno::Reference< com::sun::star::task::XStatusIndicator > xStatusIndicator;
+
+ void ImplWriteProlog( const Graphic* pPreviewEPSI = NULL );
+ void ImplWriteEpilog();
+ void ImplWriteActions( const GDIMetaFile& rMtf, VirtualDevice& rVDev );
+
+ // this method makes LF's, space inserting and word wrapping as used in all nMode
+ // parameters
+ inline void ImplExecMode( ULONG nMode );
+
+ // writes char[] + LF to stream
+ inline void ImplWriteLine( const char*, ULONG nMode = PS_RET );
+
+ // writes ( nNumb / 10^nCount ) in ASCII format to stream
+ void ImplWriteF( sal_Int32 nNumb, ULONG nCount = 3, ULONG nMode = PS_SPACE );
+
+ // writes a double in ASCII format to stream
+ void ImplWriteDouble( double, ULONG nMode = PS_SPACE );
+
+ // writes a long in ASCII format to stream
+ void ImplWriteLong( sal_Int32 nNumb, ULONG nMode = PS_SPACE );
+
+ // writes a byte in ASCII format to stream
+ void ImplWriteByte( BYTE nNumb, ULONG nMode = PS_SPACE );
+
+ // writes a byte in ASCII (hex) format to stream
+ void ImplWriteHexByte( BYTE nNumb, ULONG nMode = PS_WRAP );
+
+ // writes nNumb as number from 0.000 till 1.000 in ASCII format to stream
+ void ImplWriteB1( BYTE nNumb, ULONG nMode = PS_SPACE );
+
+ inline void ImplWritePoint( const Point&, sal_uInt32 nMode = PS_SPACE );
+ void ImplMoveTo( const Point&, sal_uInt32 nMode = PS_SPACE );
+ void ImplLineTo( const Point&, sal_uInt32 nMode = PS_SPACE );
+ void ImplCurveTo( const Point& rP1, const Point& rP2, const Point& rP3, sal_uInt32 nMode = PS_SPACE );
+ void ImplTranslate( const double& fX, const double& fY, sal_uInt32 nMode = PS_RET );
+ void ImplScale( const double& fX, const double& fY, sal_uInt32 nMode = PS_RET );
+
+ void ImplWriteLine( const Polygon & rPolygon );
+ void ImplAddPath( const Polygon & rPolygon );
+ void ImplWriteLineInfo( double fLineWidth, double fMiterLimit, SvtGraphicStroke::CapType eLineCap,
+ SvtGraphicStroke::JoinType eJoinType, SvtGraphicStroke::DashArray& rDashArray );
+ void ImplWriteLineInfo( const LineInfo& rLineInfo );
+ void ImplRect( const Rectangle & rRectangle );
+ void ImplRectFill ( const Rectangle & rRectangle );
+ void ImplWriteGradient( const PolyPolygon& rPolyPoly, const Gradient& rGradient, VirtualDevice& rVDev );
+ void ImplIntersect( const PolyPolygon& rPolyPoly );
+ void ImplPolyPoly( const PolyPolygon & rPolyPolygon, sal_Bool bTextOutline = sal_False );
+ void ImplPolyLine( const Polygon & rPolygon );
+
+ void ImplSetClipRegion( Region& rRegion );
+ void ImplBmp( Bitmap*, Bitmap*, const Point &, double nWidth, double nHeight );
+ void ImplText( const String& rUniString, const Point& rPos, const INT32* pDXArry, sal_Int32 nWidth, VirtualDevice& rVDev );
+ void ImplSetAttrForText( const Point & rPoint );
+ void ImplWriteCharacter( sal_Char );
+ void ImplWriteString( const ByteString&, VirtualDevice& rVDev, const INT32* pDXArry = NULL, BOOL bStretch = FALSE );
+ void ImplDefineFont( const char*, const char* );
+
+ void ImplClosePathDraw( ULONG nMode = PS_RET );
+ void ImplPathDraw();
+
+ inline void ImplWriteLineColor( ULONG nMode = PS_RET );
+ inline void ImplWriteFillColor( ULONG nMode = PS_RET );
+ inline void ImplWriteTextColor( ULONG nMode = PS_RET );
+ inline void ImplWriteTextFillColor( ULONG nMode = PS_RET );
+ void ImplWriteColor( ULONG nMode );
+
+ double ImplGetScaling( const MapMode& );
+ void ImplGetMapMode( const MapMode& );
+ BOOL ImplGetBoundingBox( double* nNumb, BYTE* pSource, ULONG nSize );
+ BYTE* ImplSearchEntry( BYTE* pSource, BYTE* pDest, ULONG nComp, ULONG nSize );
+ // LZW methods
+ void StartCompression();
+ void Compress( BYTE nSrc );
+ void EndCompression();
+ inline void WriteBits( USHORT nCode, USHORT nCodeLen );
+
+public:
+ BOOL WritePS( const Graphic& rGraphic, SvStream& rTargetStream, FilterConfigItem* );
+ PSWriter();
+ ~PSWriter();
+};
+
+//========================== Methoden von PSWriter ==========================
+
+//---------------------------------------------------------------------------------
+
+PSWriter::PSWriter()
+{
+ pAMTF = NULL;
+}
+
+
+PSWriter::~PSWriter()
+{
+ delete pAMTF;
+}
+
+//---------------------------------------------------------------------------------
+
+BOOL PSWriter::WritePS( const Graphic& rGraphic, SvStream& rTargetStream, FilterConfigItem* pFilterConfigItem )
+{
+ UINT32 nStreamPosition = 0, nPSPosition = 0; // -Wall warning, unset, check
+
+ mbStatus = TRUE;
+ mnPreview = 0;
+ mnLevelWarning = 0;
+ mnLastPercent = 0;
+ mnLatestPush = 0xEFFFFFFE;
+
+ if ( pFilterConfigItem )
+ {
+ xStatusIndicator = pFilterConfigItem->GetStatusIndicator();
+ if ( xStatusIndicator.is() )
+ {
+ rtl::OUString aMsg;
+ xStatusIndicator->start( aMsg, 100 );
+ }
+ }
+
+ mpPS = &rTargetStream;
+ mpPS->SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
+
+ // default values for the dialog options
+ mnLevel = 2;
+ mbGrayScale = FALSE;
+ mbCompression = TRUE;
+ mnTextMode = 0; // default0 : export glyph outlines
+
+ // try to get the dialog selection
+ if ( pFilterConfigItem )
+ {
+ ByteString aResMgrName( "eps" );
+ ResMgr* pResMgr;
+
+ pResMgr = ResMgr::CreateResMgr( aResMgrName.GetBuffer(), Application::GetSettings().GetUILocale() );
+
+ if( pResMgr )
+ {
+ String aPreviewStr( RTL_CONSTASCII_USTRINGPARAM( "Preview" ) );
+ String aVersionStr( RTL_CONSTASCII_USTRINGPARAM( "Version" ) );
+ String aColorStr( RTL_CONSTASCII_USTRINGPARAM( "ColorFormat" ) );
+ String aComprStr( RTL_CONSTASCII_USTRINGPARAM( "CompressionMode" ) );
+ mnPreview = pFilterConfigItem->ReadInt32( aPreviewStr, 1 );
+ mnLevel = pFilterConfigItem->ReadInt32( aVersionStr, 2 );
+ if ( mnLevel != 1 )
+ mnLevel = 2;
+ mbGrayScale = pFilterConfigItem->ReadInt32( aColorStr, 1 ) == 2;
+ mbCompression = pFilterConfigItem->ReadInt32( aComprStr, 1 ) == 1;
+ String sTextMode( RTL_CONSTASCII_USTRINGPARAM( "TextMode" ) );
+ mnTextMode = pFilterConfigItem->ReadInt32( sTextMode, 0 );
+ if ( mnTextMode > 2 )
+ mnTextMode = 0;
+ delete pResMgr;
+ }
+ }
+
+ // compression is not available for Level 1
+ if ( mnLevel == 1 )
+ {
+ mbGrayScale = TRUE;
+ mbCompression = FALSE;
+ }
+
+ if ( mnPreview & EPS_PREVIEW_TIFF )
+ {
+ rTargetStream << (UINT32)0xC6D3D0C5;
+ nStreamPosition = rTargetStream.Tell();
+ rTargetStream << (UINT32)0 << (UINT32)0 << (UINT32)0 << (UINT32)0
+ << nStreamPosition + 26 << (UINT32)0 << (UINT16)0xffff;
+
+ UINT32 nErrCode;
+ if ( mbGrayScale )
+ {
+ BitmapEx aTempBitmapEx( rGraphic.GetBitmapEx() );
+ aTempBitmapEx.Convert( BMP_CONVERSION_8BIT_GREYS );
+ nErrCode = GraphicConverter::Export( rTargetStream, aTempBitmapEx, CVT_TIF ) ;
+ }
+ else
+ nErrCode = GraphicConverter::Export( rTargetStream, rGraphic, CVT_TIF ) ;
+
+ if ( nErrCode == ERRCODE_NONE )
+ {
+ rTargetStream.Seek( STREAM_SEEK_TO_END );
+ nPSPosition = rTargetStream.Tell();
+ rTargetStream.Seek( nStreamPosition + 20 );
+ rTargetStream << nPSPosition - 30; // size of tiff gfx
+ rTargetStream.Seek( nPSPosition );
+ }
+ else
+ {
+ mnPreview &=~ EPS_PREVIEW_TIFF;
+ rTargetStream.Seek( nStreamPosition - 4 );
+ }
+ }
+
+ // global default value setting
+ ChrSet* pCS;
+ StackMember* pGS;
+
+ if ( rGraphic.GetType() == GRAPHIC_GDIMETAFILE )
+ pMTF = &rGraphic.GetGDIMetaFile();
+ else
+ pMTF = pAMTF = new GDIMetaFile( rGraphic.GetGDIMetaFile() );
+ aVDev.SetMapMode( pMTF->GetPrefMapMode() );
+ nBoundingX1 = nBoundingY1 = 0;
+ nBoundingX2 = pMTF->GetPrefSize().Width();
+ nBoundingY2 = pMTF->GetPrefSize().Height();
+
+ pGDIStack = NULL;
+ aColor = Color( COL_TRANSPARENT );
+ bLineColor = TRUE;
+ aLineColor = Color( COL_BLACK );
+ bFillColor = TRUE;
+ aFillColor = Color( COL_WHITE );
+ bTextFillColor = TRUE;
+ aTextFillColor = Color( COL_BLACK );
+ fLineWidth = 1;
+ fMiterLimit = 15; // use same limit as most graphic systems and basegfx
+ eLineCap = SvtGraphicStroke::capButt;
+ eJoinType = SvtGraphicStroke::joinMiter;
+ aBackgroundColor = Color( COL_WHITE );
+ eTextAlign = ALIGN_BASELINE;
+ bRegionChanged = FALSE;
+
+ nChrSet = 0x00;
+ pChrSetList = NULL;
+ nNextChrSetId = 1;
+
+ if( pMTF->GetActionCount() )
+ {
+ ImplWriteProlog( ( mnPreview & EPS_PREVIEW_EPSI ) ? &rGraphic : NULL );
+ mnCursorPos = 0;
+ ImplWriteActions( *pMTF, aVDev );
+ ImplWriteEpilog();
+ if ( mnPreview & EPS_PREVIEW_TIFF )
+ {
+ UINT32 nPosition = rTargetStream.Tell();
+ rTargetStream.Seek( nStreamPosition );
+ rTargetStream << nPSPosition;
+ rTargetStream << nPosition - nPSPosition;
+ rTargetStream.Seek( nPosition );
+ }
+ while( pChrSetList )
+ {
+ pCS=pChrSetList;
+ pChrSetList=pCS->pSucc;
+ delete pCS;
+ }
+ while( pGDIStack )
+ {
+ pGS=pGDIStack;
+ pGDIStack=pGS->pSucc;
+ delete pGS;
+ }
+ }
+ else
+ mbStatus = FALSE;
+
+ if ( mbStatus && mnLevelWarning && pFilterConfigItem )
+ {
+ ByteString aResMgrName( "eps" );
+ ResMgr* pResMgr;
+ pResMgr = ResMgr::CreateResMgr( aResMgrName.GetBuffer(), Application::GetSettings().GetUILocale() );
+ if( pResMgr )
+ {
+ InfoBox aInfoBox( NULL, String( ResId( KEY_VERSION_CHECK, *pResMgr ) ) );
+ aInfoBox.Execute();
+ delete pResMgr;
+ }
+ }
+
+ if ( xStatusIndicator.is() )
+ xStatusIndicator->end();
+
+ return mbStatus;
+}
+
+//---------------------------------------------------------------------------------
+
+void PSWriter::ImplWriteProlog( const Graphic* pPreview )
+{
+ ImplWriteLine( "%!PS-Adobe-3.0 EPSF-3.0 " );
+ *mpPS << "%%BoundingBox: "; // BoundingBox
+ ImplWriteLong( 0 );
+ ImplWriteLong( 0 );
+ Size aSizePoint = Application::GetDefaultDevice()->LogicToLogic( pMTF->GetPrefSize(),
+ pMTF->GetPrefMapMode(), MAP_POINT );
+ ImplWriteLong( aSizePoint.Width() );
+ ImplWriteLong( aSizePoint.Height() ,PS_RET );
+ ImplWriteLine( "%%Pages: 0" );
+ ImplWriteLine( "%%Creator: Sun Microsystems, Inc." );
+ ImplWriteLine( "%%Title: none" );
+ ImplWriteLine( "%%CreationDate: none" );
+
+// defaults
+
+ *mpPS << "%%LanguageLevel: "; // Language level
+ ImplWriteLong( mnLevel, PS_RET );
+ if ( !mbGrayScale && mnLevel == 1 )
+ ImplWriteLine( "%%Extensions: CMYK" ); // CMYK extension is to set in color mode in level 1
+ ImplWriteLine( "%%EndComments" );
+ if ( pPreview && aSizePoint.Width() && aSizePoint.Height() )
+ {
+ Size aSizeBitmap( ( aSizePoint.Width() + 7 ) & ~7, aSizePoint.Height() );
+ Bitmap aTmpBitmap( pPreview->GetBitmap() );
+ aTmpBitmap.Scale( aSizeBitmap, BMP_SCALE_INTERPOLATE );
+ aTmpBitmap.Convert( BMP_CONVERSION_1BIT_THRESHOLD );
+ BitmapReadAccess* pAcc = aTmpBitmap.AcquireReadAccess();
+ if ( pAcc )
+ {
+ *mpPS << "%%BeginPreview: "; // BoundingBox
+ ImplWriteLong( aSizeBitmap.Width() );
+ ImplWriteLong( aSizeBitmap.Height() );
+ *mpPS << "1 ";
+ INT32 nLines = aSizeBitmap.Width() / 312;
+ if ( ( nLines * 312 ) != aSizeBitmap.Width() )
+ nLines++;
+ nLines *= aSizeBitmap.Height();
+ ImplWriteLong( nLines );
+ char nVal;
+ INT32 nX, nY, nCount2, nCount = 4;
+ const BitmapColor aBlack( pAcc->GetBestMatchingColor( Color( COL_BLACK ) ) );
+ for ( nY = 0; nY < aSizeBitmap.Height(); nY++ )
+ {
+ nCount2 = 0;
+ nVal = 0;
+ for ( nX = 0; nX < aSizeBitmap.Width(); nX++ )
+ {
+ if ( !nCount2 )
+ {
+ ImplExecMode( PS_RET );
+ *mpPS << "%";
+ nCount2 = 312;
+ }
+ nVal <<= 1;
+ if ( pAcc->GetPixel( nY, nX ) == aBlack )
+ nVal |= 1;
+ if ( ! ( --nCount ) )
+ {
+ if ( nVal > 9 )
+ nVal += 'A' - 10;
+ else
+ nVal += '0';
+ *mpPS << nVal;
+ nVal = 0;
+ nCount += 4;
+ }
+ nCount2--;
+ }
+ }
+ aTmpBitmap.ReleaseAccess( pAcc );
+ ImplExecMode( PS_RET );
+ ImplWriteLine( "%%EndPreview" );
+ }
+ }
+ ImplWriteLine( "%%BeginProlog" );
+ ImplWriteLine( "%%BeginResource: procset SDRes-Prolog 1.0 0" );
+
+// BEGIN EPSF
+ ImplWriteLine( "/b4_inc_state save def\n/dict_count countdictstack def\n/op_count count 1 sub def\nuserdict begin" );
+ ImplWriteLine( "0 setgray 0 setlinecap 1 setlinewidth 0 setlinejoin 10 setmiterlimit[] 0 setdash newpath" );
+ ImplWriteLine( "/languagelevel where {pop languagelevel 1 ne {false setstrokeadjust false setoverprint} if} if" );
+
+ ImplWriteLine( "/bdef {bind def} bind def" ); // der neue operator bdef wird erzeugt
+ if ( mbGrayScale )
+ ImplWriteLine( "/c {setgray} bdef" );
+ else
+ ImplWriteLine( "/c {setrgbcolor} bdef" );
+ ImplWriteLine( "/l {neg lineto} bdef" );
+ ImplWriteLine( "/rl {neg rlineto} bdef" );
+ ImplWriteLine( "/lc {setlinecap} bdef" );
+ ImplWriteLine( "/lj {setlinejoin} bdef" );
+ ImplWriteLine( "/lw {setlinewidth} bdef" );
+ ImplWriteLine( "/ml {setmiterlimit} bdef" );
+ ImplWriteLine( "/ld {setdash} bdef" );
+ ImplWriteLine( "/m {neg moveto} bdef" );
+ ImplWriteLine( "/ct {6 2 roll neg 6 2 roll neg 6 2 roll neg curveto} bdef" );
+ ImplWriteLine( "/r {rotate} bdef" );
+ ImplWriteLine( "/t {neg translate} bdef" );
+ ImplWriteLine( "/s {scale} bdef" );
+ ImplWriteLine( "/sw {show} bdef" );
+ ImplWriteLine( "/gs {gsave} bdef" );
+ ImplWriteLine( "/gr {grestore} bdef" );
+
+ ImplWriteLine( "/f {findfont dup length dict begin" ); // Setfont
+ ImplWriteLine( "{1 index /FID ne {def} {pop pop} ifelse} forall /Encoding ISOLatin1Encoding def" );
+ ImplWriteLine( "currentdict end /NFont exch definefont pop /NFont findfont} bdef" );
+
+ ImplWriteLine( "/p {closepath} bdef" );
+ ImplWriteLine( "/sf {scalefont setfont} bdef" );
+
+ ImplWriteLine( "/ef {eofill}bdef" ); // close path and fill
+ ImplWriteLine( "/pc {closepath stroke}bdef" ); // close path and draw
+ ImplWriteLine( "/ps {stroke}bdef" ); // draw current path
+ ImplWriteLine( "/pum {matrix currentmatrix}bdef" ); // pushes the current matrix
+ ImplWriteLine( "/pom {setmatrix}bdef" ); // pops the matrix
+ ImplWriteLine( "/bs {/aString exch def /nXOfs exch def /nWidth exch def currentpoint nXOfs 0 rmoveto pum nWidth aString stringwidth pop div 1 scale aString show pom moveto} bdef" );
+ ImplWriteLine( "%%EndResource" );
+ ImplWriteLine( "%%EndProlog" );
+ ImplWriteLine( "%%BeginSetup" );
+ ImplWriteLine( "%%EndSetup" );
+ ImplWriteLine( "%%Page: 1 1" );
+ ImplWriteLine( "%%BeginPageSetup" );
+ ImplWriteLine( "%%EndPageSetup" );
+ ImplWriteLine( "pum" );
+ ImplScale( (double)aSizePoint.Width() / (double)pMTF->GetPrefSize().Width(), (double)aSizePoint.Height() / (double)pMTF->GetPrefSize().Height() );
+ ImplWriteDouble( 0 );
+ ImplWriteDouble( -pMTF->GetPrefSize().Height() );
+ ImplWriteLine( "t" );
+ ImplWriteLine( "/tm matrix currentmatrix def" );
+}
+
+//---------------------------------------------------------------------------------
+
+void PSWriter::ImplWriteEpilog()
+{
+ ImplTranslate( 0, nBoundingY2 );
+ ImplWriteLine( "pom" );
+ ImplWriteLine( "count op_count sub {pop} repeat countdictstack dict_count sub {end} repeat b4_inc_state restore" );
+
+ ImplWriteLine( "%%PageTrailer" );
+ ImplWriteLine( "%%Trailer" );
+
+ ImplWriteLine( "%%EOF" );
+}
+
+//---------------------------------------------------------------------------------
+//---------------------------------------------------------------------------------
+//---------------------------------------------------------------------------------
+
+void PSWriter::ImplWriteActions( const GDIMetaFile& rMtf, VirtualDevice& rVDev )
+{
+ PolyPolygon aFillPath;
+
+ for( ULONG nCurAction = 0, nCount = rMtf.GetActionCount(); nCurAction < nCount; nCurAction++ )
+ {
+ MetaAction* pMA = rMtf.GetAction( nCurAction );
+
+ switch( pMA->GetType() )
+ {
+ case META_NULL_ACTION :
+ break;
+
+ case META_PIXEL_ACTION :
+ {
+ Color aOldLineColor( aLineColor );
+ aLineColor = ( (const MetaPixelAction*) pMA )->GetColor();
+ ImplWriteLineColor( PS_SPACE );
+ ImplMoveTo( ( (const MetaPixelAction*)pMA )->GetPoint() );
+ ImplLineTo( ( (const MetaPixelAction*)pMA )->GetPoint() );
+ ImplPathDraw();
+ aLineColor = aOldLineColor;
+ }
+ break;
+
+ case META_POINT_ACTION :
+ {
+ ImplWriteLineColor( PS_SPACE );
+ ImplMoveTo( ( (const MetaPointAction*)pMA )->GetPoint() );
+ ImplLineTo( ( (const MetaPointAction*)pMA )->GetPoint() );
+ ImplPathDraw();
+ }
+ break;
+
+ case META_LINE_ACTION :
+ {
+ const LineInfo& rLineInfo = ( ( const MetaLineAction*)pMA )->GetLineInfo();
+ ImplWriteLineInfo( rLineInfo );
+ if ( bLineColor )
+ {
+ ImplWriteLineColor( PS_SPACE );
+ ImplMoveTo( ( (const MetaLineAction*) pMA )->GetStartPoint() );
+ ImplLineTo( ( (const MetaLineAction*) pMA )->GetEndPoint() );
+ ImplPathDraw();
+ }
+ }
+ break;
+
+ case META_RECT_ACTION :
+ {
+ ImplRect( ( (const MetaRectAction*) pMA )->GetRect() );
+ }
+ break;
+
+ case META_ROUNDRECT_ACTION :
+ ImplRect( ( (const MetaRoundRectAction*) pMA )->GetRect() );
+ break;
+
+ case META_ELLIPSE_ACTION :
+ {
+ Rectangle aRect = ( ( (const MetaEllipseAction*) pMA )->GetRect() );
+ Point aCenter = aRect.Center();
+ Polygon aPoly( aCenter, aRect.GetWidth() / 2, aRect.GetHeight() / 2 );
+ PolyPolygon aPolyPoly( aPoly );
+ ImplPolyPoly( aPolyPoly );
+ }
+ break;
+
+ case META_ARC_ACTION :
+ {
+ Polygon aPoly( ( (const MetaArcAction*)pMA )->GetRect(), ( (const MetaArcAction*)pMA )->GetStartPoint(),
+ ( (const MetaArcAction*)pMA )->GetEndPoint(), POLY_ARC );
+ PolyPolygon aPolyPoly( aPoly );
+ ImplPolyPoly( aPolyPoly );
+ }
+ break;
+
+ case META_PIE_ACTION :
+ {
+ Polygon aPoly( ( (const MetaPieAction*)pMA )->GetRect(), ( (const MetaPieAction*)pMA )->GetStartPoint(),
+ ( (const MetaPieAction*)pMA )->GetEndPoint(), POLY_PIE );
+ PolyPolygon aPolyPoly( aPoly );
+ ImplPolyPoly( aPolyPoly );
+ }
+ break;
+
+ case META_CHORD_ACTION :
+ {
+ Polygon aPoly( ( (const MetaChordAction*)pMA )->GetRect(), ( (const MetaChordAction*)pMA )->GetStartPoint(),
+ ( (const MetaChordAction*)pMA )->GetEndPoint(), POLY_CHORD );
+ PolyPolygon aPolyPoly( aPoly );
+ ImplPolyPoly( aPolyPoly );
+ }
+ break;
+
+ case META_POLYLINE_ACTION :
+ {
+ Polygon aPoly( ( (const MetaPolyLineAction*) pMA )->GetPolygon() );
+ const LineInfo& rLineInfo = ( ( const MetaPolyLineAction*)pMA )->GetLineInfo();
+ ImplWriteLineInfo( rLineInfo );
+
+ if(basegfx::B2DLINEJOIN_NONE == rLineInfo.GetLineJoin()
+ && rLineInfo.GetWidth() > 1)
+ {
+ // emulate B2DLINEJOIN_NONE by creating single edges
+ const sal_uInt16 nPoints(aPoly.GetSize());
+ const bool bCurve(aPoly.HasFlags());
+
+ for(sal_uInt16 a(0); a + 1 < nPoints; a++)
+ {
+ if(bCurve
+ && POLY_NORMAL != aPoly.GetFlags(a + 1)
+ && a + 2 < nPoints
+ && POLY_NORMAL != aPoly.GetFlags(a + 2)
+ && a + 3 < nPoints)
+ {
+ const Polygon aSnippet(4,
+ aPoly.GetConstPointAry() + a,
+ aPoly.GetConstFlagAry() + a);
+ ImplPolyLine(aSnippet);
+ a += 2;
+ }
+ else
+ {
+ const Polygon aSnippet(2,
+ aPoly.GetConstPointAry() + a);
+ ImplPolyLine(aSnippet);
+ }
+ }
+ }
+ else
+ {
+ ImplPolyLine( aPoly );
+ }
+ }
+ break;
+
+ case META_POLYGON_ACTION :
+ {
+ PolyPolygon aPolyPoly( ( (const MetaPolygonAction*) pMA )->GetPolygon() );
+ ImplPolyPoly( aPolyPoly );
+ }
+ break;
+
+ case META_POLYPOLYGON_ACTION :
+ {
+ ImplPolyPoly( ( (const MetaPolyPolygonAction*) pMA )->GetPolyPolygon() );
+ }
+ break;
+
+ case META_TEXT_ACTION:
+ {
+ const MetaTextAction * pA = (const MetaTextAction*) pMA;
+
+ String aUniStr( pA->GetText(), pA->GetIndex(), pA->GetLen() );
+ Point aPoint( pA->GetPoint() );
+
+ ImplText( aUniStr, aPoint, NULL, 0, rVDev );
+ }
+ break;
+
+ case META_TEXTRECT_ACTION:
+ {
+ DBG_ERROR( "Unsupported action: TextRect...Action!" );
+ }
+ break;
+
+ case META_STRETCHTEXT_ACTION :
+ {
+ const MetaStretchTextAction* pA = (const MetaStretchTextAction*)pMA;
+ String aUniStr( pA->GetText(), pA->GetIndex(), pA->GetLen() );
+ Point aPoint( pA->GetPoint() );
+
+ ImplText( aUniStr, aPoint, NULL, pA->GetWidth(), rVDev );
+ }
+ break;
+
+ case META_TEXTARRAY_ACTION:
+ {
+ const MetaTextArrayAction* pA = (const MetaTextArrayAction*)pMA;
+ String aUniStr( pA->GetText(), pA->GetIndex(), pA->GetLen() );
+ Point aPoint( pA->GetPoint() );
+
+ ImplText( aUniStr, aPoint, pA->GetDXArray(), 0, rVDev );
+ }
+ break;
+
+ case META_BMP_ACTION :
+ {
+ Bitmap aBitmap = ( (const MetaBmpAction*)pMA )->GetBitmap();
+ if ( mbGrayScale )
+ aBitmap.Convert( BMP_CONVERSION_8BIT_GREYS );
+ Point aPoint = ( (const MetaBmpAction*) pMA )->GetPoint();
+ Size aSize = aBitmap.GetSizePixel();
+ ImplBmp( &aBitmap, NULL, aPoint, aSize.Width(), aSize.Height() );
+ }
+ break;
+
+ case META_BMPSCALE_ACTION :
+ {
+ Bitmap aBitmap = ( (const MetaBmpScaleAction*)pMA )->GetBitmap();
+ if ( mbGrayScale )
+ aBitmap.Convert( BMP_CONVERSION_8BIT_GREYS );
+ Point aPoint = ( (const MetaBmpScaleAction*) pMA )->GetPoint();
+ Size aSize = ( (const MetaBmpScaleAction*)pMA )->GetSize();
+ ImplBmp( &aBitmap, NULL, aPoint, aSize.Width(), aSize.Height() );
+ }
+ break;
+
+ case META_BMPSCALEPART_ACTION :
+ {
+ Bitmap aBitmap( ( (const MetaBmpScalePartAction*)pMA )->GetBitmap() );
+ aBitmap.Crop( Rectangle( ( (const MetaBmpScalePartAction*)pMA )->GetSrcPoint(),
+ ( (const MetaBmpScalePartAction*)pMA )->GetSrcSize() ) );
+ if ( mbGrayScale )
+ aBitmap.Convert( BMP_CONVERSION_8BIT_GREYS );
+ Point aPoint = ( (const MetaBmpScalePartAction*) pMA)->GetDestPoint();
+ Size aSize = ( (const MetaBmpScalePartAction*)pMA )->GetDestSize();
+ ImplBmp( &aBitmap, NULL, aPoint, aSize.Width(), aSize.Height() );
+ }
+ break;
+
+ case META_BMPEX_ACTION :
+ {
+ BitmapEx aBitmapEx( ( (MetaBmpExAction*)pMA)->GetBitmapEx() );
+ Bitmap aBitmap( aBitmapEx.GetBitmap() );
+ if ( mbGrayScale )
+ aBitmap.Convert( BMP_CONVERSION_8BIT_GREYS );
+ Bitmap aMask( aBitmapEx.GetMask() );
+ Point aPoint = ( (const MetaBmpExAction*) pMA)->GetPoint();
+ Size aSize = ( aBitmap.GetSizePixel() );
+ ImplBmp( &aBitmap, &aMask, aPoint, aSize.Width(), aSize.Height() );
+ }
+ break;
+
+ case META_BMPEXSCALE_ACTION :
+ {
+ BitmapEx aBitmapEx( ( (MetaBmpExScaleAction*)pMA)->GetBitmapEx() );
+ Bitmap aBitmap( aBitmapEx.GetBitmap() );
+ if ( mbGrayScale )
+ aBitmap.Convert( BMP_CONVERSION_8BIT_GREYS );
+ Bitmap aMask( aBitmapEx.GetMask() );
+ Point aPoint = ( (const MetaBmpExScaleAction*) pMA)->GetPoint();
+ Size aSize( ( (const MetaBmpExScaleAction*)pMA )->GetSize() );
+ ImplBmp( &aBitmap, &aMask, aPoint, aSize.Width(), aSize.Height() );
+ }
+ break;
+
+ case META_BMPEXSCALEPART_ACTION :
+ {
+ BitmapEx aBitmapEx( ( (const MetaBmpExScalePartAction*)pMA )->GetBitmapEx() );
+ aBitmapEx.Crop( Rectangle( ( (const MetaBmpExScalePartAction*)pMA )->GetSrcPoint(),
+ ( (const MetaBmpExScalePartAction*)pMA )->GetSrcSize() ) );
+ Bitmap aBitmap( aBitmapEx.GetBitmap() );
+ if ( mbGrayScale )
+ aBitmap.Convert( BMP_CONVERSION_8BIT_GREYS );
+ Bitmap aMask( aBitmapEx.GetMask() );
+ Point aPoint = ( (const MetaBmpExScalePartAction*) pMA)->GetDestPoint();
+ Size aSize = ( (const MetaBmpExScalePartAction*)pMA )->GetDestSize();
+ ImplBmp( &aBitmap, &aMask, aPoint, aSize.Width(), aSize.Height() );
+ }
+ break;
+
+ // Unsupported Actions
+ case META_MASK_ACTION:
+ case META_MASKSCALE_ACTION:
+ case META_MASKSCALEPART_ACTION:
+ {
+ DBG_ERROR( "Unsupported action: MetaMask...Action!" );
+ }
+ break;
+
+ case META_GRADIENT_ACTION :
+ {
+ PolyPolygon aPolyPoly( ( (const MetaGradientAction*)pMA)->GetRect() );
+ ImplWriteGradient( aPolyPoly, ( (const MetaGradientAction*) pMA )->GetGradient(), rVDev );
+ }
+ break;
+
+ case META_GRADIENTEX_ACTION :
+ {
+ PolyPolygon aPolyPoly( ( (const MetaGradientExAction*)pMA)->GetPolyPolygon() );
+ ImplWriteGradient( aPolyPoly, ( (const MetaGradientExAction*) pMA )->GetGradient(), rVDev );
+ }
+ break;
+
+ case META_HATCH_ACTION :
+ {
+ VirtualDevice l_aVDev;
+ GDIMetaFile aTmpMtf;
+
+ l_aVDev.SetMapMode( rVDev.GetMapMode() );
+ l_aVDev.AddHatchActions( ( (const MetaHatchAction*)pMA)->GetPolyPolygon(),
+ ( (const MetaHatchAction*)pMA )->GetHatch(), aTmpMtf );
+ ImplWriteActions( aTmpMtf, rVDev );
+ }
+ break;
+
+ case META_WALLPAPER_ACTION :
+ {
+ const MetaWallpaperAction* pA = (const MetaWallpaperAction*)pMA;
+ Rectangle aRect = pA->GetRect();
+ Wallpaper aWallpaper = pA->GetWallpaper();
+
+ if ( aWallpaper.IsBitmap() )
+ {
+ BitmapEx aBitmapEx = aWallpaper.GetBitmap();
+ Bitmap aBitmap( aBitmapEx.GetBitmap() );
+ if ( aBitmapEx.IsTransparent() )
+ {
+ if ( aWallpaper.IsGradient() )
+ {
+
+ // gradient action
+
+ }
+ Bitmap aMask( aBitmapEx.GetMask() );
+ ImplBmp( &aBitmap, &aMask, Point( aRect.Left(), aRect.Top() ), aRect.GetWidth(), aRect.GetHeight() );
+ }
+ else
+ ImplBmp( &aBitmap, NULL, Point( aRect.Left(), aRect.Top() ), aRect.GetWidth(), aRect.GetHeight() );
+
+ // wallpaper Style
+
+ }
+ else if ( aWallpaper.IsGradient() )
+ {
+
+ // gradient action
+
+ }
+ else
+ {
+ aColor = aWallpaper.GetColor();
+ ImplRectFill( aRect );
+ }
+ }
+ break;
+
+ case META_ISECTRECTCLIPREGION_ACTION:
+ {
+ const MetaISectRectClipRegionAction* pA = (const MetaISectRectClipRegionAction*) pMA;
+ Region aRegion( pA->GetRect() );
+ ImplSetClipRegion( aRegion );
+ }
+ break;
+
+ case META_CLIPREGION_ACTION:
+ {
+ const MetaClipRegionAction* pA = (const MetaClipRegionAction*) pMA;
+ Region aRegion( pA->GetRegion() );
+ ImplSetClipRegion( aRegion );
+ }
+ break;
+
+ case META_ISECTREGIONCLIPREGION_ACTION:
+ {
+ const MetaISectRegionClipRegionAction* pA = (const MetaISectRegionClipRegionAction*) pMA;
+ Region aRegion( pA->GetRegion() );
+ ImplSetClipRegion( aRegion );
+ }
+ break;
+
+ case META_MOVECLIPREGION_ACTION:
+ {
+/*
+ if ( !aClipRegion.IsEmpty() )
+ {
+ const MetaMoveClipRegionAction* pA = (const MetaMoveClipRegionAction*) pMA;
+ aClipRegion.Move( pA->GetHorzMove(), pA->GetVertMove() );
+ ImplSetClipRegion();
+ }
+*/
+ }
+ break;
+
+ case META_LINECOLOR_ACTION :
+ {
+ if ( ( (const MetaLineColorAction*) pMA)->IsSetting() )
+ {
+ bLineColor = TRUE;
+ aLineColor = ( (const MetaLineColorAction*) pMA )->GetColor();
+ }
+ else
+ bLineColor = FALSE;
+ }
+ break;
+
+ case META_FILLCOLOR_ACTION :
+ {
+ if ( ( (const MetaFillColorAction*) pMA )->IsSetting() )
+ {
+ bFillColor = TRUE;
+ aFillColor = ( (const MetaFillColorAction*) pMA )->GetColor();
+ }
+ else
+ bFillColor = FALSE;
+ }
+ break;
+
+ case META_TEXTCOLOR_ACTION :
+ {
+ aTextColor = ( (const MetaTextColorAction*) pMA )->GetColor();
+ }
+ break;
+
+ case META_TEXTFILLCOLOR_ACTION :
+ {
+ if ( ( (const MetaTextFillColorAction*) pMA )->IsSetting() )
+ {
+ bTextFillColor = TRUE;
+ aTextFillColor = ( (const MetaTextFillColorAction*) pMA )->GetColor();
+ }
+ else
+ bTextFillColor = FALSE;
+ }
+ break;
+
+ case META_TEXTALIGN_ACTION :
+ {
+ eTextAlign = ( (const MetaTextAlignAction*) pMA )->GetTextAlign();
+ }
+ break;
+
+ case META_MAPMODE_ACTION :
+ {
+ pMA->Execute( &rVDev );
+ ImplGetMapMode( rVDev.GetMapMode() );
+ }
+ break;
+
+ case META_FONT_ACTION :
+ {
+ maFont = ((const MetaFontAction*)pMA)->GetFont();
+ rVDev.SetFont( maFont );
+ }
+ break;
+
+ case META_PUSH_ACTION :
+ {
+ rVDev.Push(((const MetaPushAction*)pMA)->GetFlags() );
+ StackMember* pGS = new StackMember;
+ pGS->pSucc = pGDIStack;
+ pGDIStack = pGS;
+ pGS->aDashArray = aDashArray;
+ pGS->eJoinType = eJoinType;
+ pGS->eLineCap = eLineCap;
+ pGS->fLineWidth = fLineWidth;
+ pGS->fMiterLimit = fMiterLimit;
+ pGS->eTextAlign = eTextAlign;
+ pGS->aGlobalCol = aColor;
+ pGS->bLineCol = bLineColor;
+ pGS->aLineCol = aLineColor;
+ pGS->bFillCol = bFillColor;
+ pGS->aFillCol = aFillColor;
+ pGS->aTextCol = aTextColor;
+ pGS->bTextFillCol = bTextFillColor;
+ pGS->aTextFillCol = aTextFillColor;
+ pGS->aBackgroundCol = aBackgroundColor;
+ bRegionChanged = FALSE;
+ pGS->aFont = maFont;
+ mnLatestPush = mpPS->Tell();
+ ImplWriteLine( "gs" );
+ }
+ break;
+
+ case META_POP_ACTION :
+ {
+ rVDev.Pop();
+ StackMember* pGS;
+ if( pGDIStack )
+ {
+ pGS = pGDIStack;
+ pGDIStack = pGS->pSucc;
+ aDashArray = pGS->aDashArray;
+ eJoinType = pGS->eJoinType;
+ eLineCap = pGS->eLineCap;
+ fLineWidth = pGS->fLineWidth;
+ fMiterLimit = pGS->fMiterLimit;
+ eTextAlign = pGS->eTextAlign;
+ aColor = pGS->aGlobalCol;
+ bLineColor = pGS->bLineCol;
+ aLineColor = pGS->aLineCol;
+ bFillColor = pGS->bFillCol;
+ aFillColor = pGS->aFillCol;
+ aTextColor = pGS->aTextCol;
+ bTextFillColor = pGS->bTextFillCol;
+ aTextFillColor = pGS->aTextFillCol;
+ aBackgroundColor = pGS->aBackgroundCol;
+ maFont = pGS->aFont;
+ maLastFont = Font(); // set maLastFont != maFont -> so that
+ delete pGS;
+ sal_uInt32 nCurrentPos = mpPS->Tell();
+ if ( nCurrentPos - 3 == mnLatestPush )
+ {
+ mpPS->Seek( mnLatestPush );
+ ImplWriteLine( " " );
+ mpPS->Seek( mnLatestPush );
+ }
+ else
+ ImplWriteLine( "gr" );
+ }
+ }
+ break;
+
+ case META_EPS_ACTION :
+ {
+ GfxLink aGfxLink = ( (const MetaEPSAction*) pMA )->GetLink();
+ const GDIMetaFile aSubstitute( ( ( const MetaEPSAction*) pMA )->GetSubstitute() );
+
+ BOOL bLevelConflict = FALSE;
+ BYTE* pSource = (BYTE*) aGfxLink.GetData();
+ ULONG nSize = aGfxLink.GetDataSize();
+ ULONG nParseThis = POSTSCRIPT_BOUNDINGSEARCH;
+ if ( nSize < 64 ) // assuming eps is larger than 64 bytes
+ pSource = NULL;
+ if ( nParseThis > nSize )
+ nParseThis = nSize;
+
+ if ( pSource && ( mnLevel == 1 ) )
+ {
+ BYTE* pFound = ImplSearchEntry( pSource, (BYTE*)"%%LanguageLevel:", nParseThis - 10, 16 );
+ if ( pFound )
+ {
+ BYTE k, i = 10;
+ pFound += 16;
+ while ( --i )
+ {
+ k = *pFound++;
+ if ( ( k > '0' ) && ( k <= '9' ) )
+ {
+ if ( k != '1' )
+ {
+ bLevelConflict = TRUE;
+ mnLevelWarning++;
+ }
+ break;
+ }
+ }
+ }
+ }
+ if ( !bLevelConflict )
+ {
+ double nBoundingBox[4];
+ if ( pSource && ImplGetBoundingBox( nBoundingBox, pSource, nParseThis ) )
+ {
+ Point aPoint = ( (const MetaEPSAction*) pMA )->GetPoint();
+ Size aSize = ( (const MetaEPSAction*) pMA )->GetSize();
+
+ MapMode aMapMode( aSubstitute.GetPrefMapMode() );
+ Size aOutSize( rVDev.LogicToLogic( aSize, rVDev.GetMapMode(), aMapMode ) );
+ Point aOrigin( rVDev.LogicToLogic( aPoint, rVDev.GetMapMode(), aMapMode ) );
+ aOrigin.Y() += aOutSize.Height();
+ aMapMode.SetOrigin( aOrigin );
+ aMapMode.SetScaleX( aOutSize.Width() / ( nBoundingBox[ 2 ] - nBoundingBox[ 0 ] ) );
+ aMapMode.SetScaleY( aOutSize.Height() / ( nBoundingBox[ 3 ] - nBoundingBox[ 1 ] ) );
+ ImplWriteLine( "gs" );
+ ImplGetMapMode( aMapMode );
+ ImplWriteLine( "%%BeginDocument:" );
+ mpPS->Write( pSource, aGfxLink.GetDataSize() );
+ ImplWriteLine( "%%EndDocument\ngr" );
+ }
+ }
+ }
+ break;
+
+ case META_TRANSPARENT_ACTION:
+ {
+// ImplLine( ( (const MetaTransparentAction*) pMA )->GetPolyPolygon() );
+ }
+ break;
+
+ case META_RASTEROP_ACTION:
+ {
+ pMA->Execute( &rVDev );
+ }
+ break;
+
+ case META_FLOATTRANSPARENT_ACTION:
+ {
+ const MetaFloatTransparentAction* pA = (const MetaFloatTransparentAction*) pMA;
+
+ GDIMetaFile aTmpMtf( pA->GetGDIMetaFile() );
+ Point aSrcPt( aTmpMtf.GetPrefMapMode().GetOrigin() );
+ const Size aSrcSize( aTmpMtf.GetPrefSize() );
+ const Point aDestPt( pA->GetPoint() );
+ const Size aDestSize( pA->GetSize() );
+ const double fScaleX = aSrcSize.Width() ? (double) aDestSize.Width() / aSrcSize.Width() : 1.0;
+ const double fScaleY = aSrcSize.Height() ? (double) aDestSize.Height() / aSrcSize.Height() : 1.0;
+ long nMoveX, nMoveY;
+
+ if( fScaleX != 1.0 || fScaleY != 1.0 )
+ {
+ aTmpMtf.Scale( fScaleX, fScaleY );
+ aSrcPt.X() = FRound( aSrcPt.X() * fScaleX ), aSrcPt.Y() = FRound( aSrcPt.Y() * fScaleY );
+ }
+
+ nMoveX = aDestPt.X() - aSrcPt.X(), nMoveY = aDestPt.Y() - aSrcPt.Y();
+
+ if( nMoveX || nMoveY )
+ aTmpMtf.Move( nMoveX, nMoveY );
+
+ ImplWriteActions( aTmpMtf, rVDev );
+ }
+ break;
+
+ case META_COMMENT_ACTION:
+ {
+ const MetaCommentAction* pA = (const MetaCommentAction*) pMA;
+ if ( pA->GetComment().CompareIgnoreCaseToAscii( "XGRAD_SEQ_BEGIN" ) == COMPARE_EQUAL )
+ {
+ const MetaGradientExAction* pGradAction = NULL;
+ while( ++nCurAction < nCount )
+ {
+ MetaAction* pAction = rMtf.GetAction( nCurAction );
+ if( pAction->GetType() == META_GRADIENTEX_ACTION )
+ pGradAction = (const MetaGradientExAction*) pAction;
+ else if( ( pAction->GetType() == META_COMMENT_ACTION ) &&
+ ( ( (const MetaCommentAction*) pAction )->GetComment().CompareIgnoreCaseToAscii( "XGRAD_SEQ_END" ) == COMPARE_EQUAL ) )
+ {
+ break;
+ }
+ }
+ if( pGradAction )
+ ImplWriteGradient( pGradAction->GetPolyPolygon(), pGradAction->GetGradient(), rVDev );
+ }
+ else if ( pA->GetComment().Equals( "XPATHFILL_SEQ_END" ) )
+ {
+ if ( aFillPath.Count() )
+ {
+ aFillPath = PolyPolygon();
+ ImplWriteLine( "gr" );
+ }
+ }
+ else
+ {
+ const BYTE* pData = pA->GetData();
+ if ( pData )
+ {
+ SvMemoryStream aMemStm( (void*)pData, pA->GetDataSize(), STREAM_READ );
+ sal_Bool bSkipSequence = sal_False;
+ ByteString sSeqEnd;
+
+ if( pA->GetComment().Equals( "XPATHSTROKE_SEQ_BEGIN" ) )
+ {
+ sSeqEnd = ByteString( "XPATHSTROKE_SEQ_END" );
+ SvtGraphicStroke aStroke;
+ aMemStm >> aStroke;
+
+ Polygon aPath;
+ aStroke.getPath( aPath );
+
+ PolyPolygon aStartArrow;
+ PolyPolygon aEndArrow;
+// double fTransparency( aStroke.getTransparency() );
+ double fStrokeWidth( aStroke.getStrokeWidth() );
+ SvtGraphicStroke::JoinType eJT( aStroke.getJoinType() );
+ SvtGraphicStroke::DashArray l_aDashArray;
+
+ aStroke.getStartArrow( aStartArrow );
+ aStroke.getEndArrow( aEndArrow );
+ aStroke.getDashArray( l_aDashArray );
+
+ bSkipSequence = sal_True;
+ if ( l_aDashArray.size() > 11 ) // ps dasharray limit is 11
+ bSkipSequence = sal_False;
+ if ( aStartArrow.Count() || aEndArrow.Count() )
+ bSkipSequence = sal_False;
+ if ( (sal_uInt32)eJT > 2 )
+ bSkipSequence = sal_False;
+ if ( l_aDashArray.size() && ( fStrokeWidth != 0.0 ) )
+ bSkipSequence = sal_False;
+ if ( bSkipSequence )
+ {
+ ImplWriteLineInfo( fStrokeWidth, aStroke.getMiterLimit(),
+ aStroke.getCapType(), eJT, l_aDashArray );
+ ImplPolyLine( aPath );
+ }
+ }
+ else if( pA->GetComment().Equals( "XPATHFILL_SEQ_BEGIN" ) )
+ {
+ sSeqEnd = ByteString( "XPATHFILL_SEQ_END" );
+ SvtGraphicFill aFill;
+ aMemStm >> aFill;
+ switch( aFill.getFillType() )
+ {
+ case SvtGraphicFill::fillSolid :
+ {
+ bSkipSequence = sal_True;
+ PolyPolygon aPolyPoly;
+ aFill.getPath( aPolyPoly );
+ sal_uInt16 i, nPolyCount = aPolyPoly.Count();
+ if ( nPolyCount )
+ {
+ aFillColor = aFill.getFillColor();
+ ImplWriteFillColor( PS_SPACE );
+ for ( i = 0; i < nPolyCount; )
+ {
+ ImplAddPath( aPolyPoly.GetObject( i ) );
+ if ( ++i < nPolyCount )
+ {
+ *mpPS << "p";
+ mnCursorPos += 2;
+ ImplExecMode( PS_RET );
+ }
+ }
+ *mpPS << "p ef";
+ mnCursorPos += 4;
+ ImplExecMode( PS_RET );
+ }
+ }
+ break;
+
+ case SvtGraphicFill::fillTexture :
+ {
+ aFill.getPath( aFillPath );
+
+ /* normally an object filling is consisting of three MetaActions:
+ MetaBitmapAction using RasterOp xor,
+ MetaPolyPolygonAction using RasterOp rop_0
+ MetaBitmapAction using RasterOp xor
+
+ Because RasterOps cannot been used in Postscript, we have to
+ replace these actions. The MetaComment "XPATHFILL_SEQ_BEGIN" is
+ providing the clippath of the object. The following loop is
+ trying to find the bitmap that is matching the clippath, so that
+ only one bitmap is exported, otherwise if the bitmap is not
+ locatable, all metaactions are played normally.
+ */
+ sal_uInt32 nCommentStartAction = nCurAction;
+ sal_uInt32 nBitmapCount = 0;
+ sal_uInt32 nBitmapAction = 0;
+
+ sal_Bool bOk = sal_True;
+ while( bOk && ( ++nCurAction < nCount ) )
+ {
+ MetaAction* pAction = rMtf.GetAction( nCurAction );
+ switch( pAction->GetType() )
+ {
+ case META_BMPSCALE_ACTION :
+ case META_BMPSCALEPART_ACTION :
+ case META_BMPEXSCALE_ACTION :
+ case META_BMPEXSCALEPART_ACTION :
+ {
+ nBitmapCount++;
+ nBitmapAction = nCurAction;
+ }
+ break;
+ case META_COMMENT_ACTION :
+ {
+ if (((const MetaCommentAction*)pAction)->GetComment().Equals( "XPATHFILL_SEQ_END" ))
+ bOk = sal_False;
+ }
+ break;
+ }
+ }
+ if( nBitmapCount == 2 )
+ {
+ ImplWriteLine( "gs" );
+ ImplIntersect( aFillPath );
+ GDIMetaFile aTempMtf;
+ aTempMtf.AddAction( rMtf.GetAction( nBitmapAction )->Clone() );
+ ImplWriteActions( aTempMtf, rVDev );
+ ImplWriteLine( "gr" );
+ aFillPath = PolyPolygon();
+ }
+ else
+ nCurAction = nCommentStartAction + 1;
+ }
+ break;
+
+ case SvtGraphicFill::fillGradient :
+ aFill.getPath( aFillPath );
+ break;
+
+ case SvtGraphicFill::fillHatch :
+ break;
+ }
+ if ( aFillPath.Count() )
+ {
+ ImplWriteLine( "gs" );
+ ImplIntersect( aFillPath );
+ }
+ }
+ if ( bSkipSequence )
+ {
+ while( ++nCurAction < nCount )
+ {
+ pMA = rMtf.GetAction( nCurAction );
+ if ( pMA->GetType() == META_COMMENT_ACTION )
+ {
+ ByteString sComment( ((MetaCommentAction*)pMA)->GetComment() );
+ if ( sComment.Equals( sSeqEnd ) )
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ break;
+ }
+ }
+}
+
+
+
+//---------------------------------------------------------------------------------
+
+inline void PSWriter::ImplWritePoint( const Point& rPoint, sal_uInt32 nMode )
+{
+ ImplWriteDouble( rPoint.X() );
+ ImplWriteDouble( rPoint.Y(), nMode );
+}
+
+//---------------------------------------------------------------------------------
+
+void PSWriter::ImplMoveTo( const Point& rPoint, sal_uInt32 nMode )
+{
+ ImplWritePoint( rPoint );
+ ImplWriteByte( 'm' );
+ ImplExecMode( nMode );
+}
+
+//---------------------------------------------------------------------------------
+
+void PSWriter::ImplLineTo( const Point& rPoint, sal_uInt32 nMode )
+{
+ ImplWritePoint( rPoint );
+ ImplWriteByte( 'l' );
+ ImplExecMode( nMode );
+}
+
+//---------------------------------------------------------------------------------
+
+void PSWriter::ImplCurveTo( const Point& rP1, const Point& rP2, const Point& rP3, sal_uInt32 nMode )
+{
+ ImplWritePoint( rP1 );
+ ImplWritePoint( rP2 );
+ ImplWritePoint( rP3 );
+ *mpPS << "ct ";
+ ImplExecMode( nMode );
+}
+
+//---------------------------------------------------------------------------------
+
+void PSWriter::ImplTranslate( const double& fX, const double& fY, sal_uInt32 nMode )
+{
+ ImplWriteDouble( fX );
+ ImplWriteDouble( fY );
+ ImplWriteByte( 't' );
+ ImplExecMode( nMode );
+}
+
+//---------------------------------------------------------------------------------
+
+void PSWriter::ImplScale( const double& fX, const double& fY, sal_uInt32 nMode )
+{
+ ImplWriteDouble( fX );
+ ImplWriteDouble( fY );
+ ImplWriteByte( 's' );
+ ImplExecMode( nMode );
+}
+
+//---------------------------------------------------------------------------------
+
+void PSWriter::ImplRect( const Rectangle & rRect )
+{
+ if ( bFillColor )
+ ImplRectFill( rRect );
+ if ( bLineColor )
+ {
+ double nWidth = rRect.GetWidth();
+ double nHeight = rRect.GetHeight();
+
+ ImplWriteLineColor( PS_SPACE );
+ ImplMoveTo( rRect.TopLeft() );
+ ImplWriteDouble( nWidth );
+ *mpPS << "0 rl 0 ";
+ ImplWriteDouble( nHeight );
+ *mpPS << "rl ";
+ ImplWriteDouble( nWidth );
+ *mpPS << "neg 0 rl ";
+ ImplClosePathDraw();
+ }
+ *mpPS << (BYTE)10;
+ mnCursorPos = 0;
+}
+
+//---------------------------------------------------------------------------------
+
+void PSWriter::ImplRectFill( const Rectangle & rRect )
+{
+ double nWidth = rRect.GetWidth();
+ double nHeight = rRect.GetHeight();
+
+ ImplWriteFillColor( PS_SPACE );
+ ImplMoveTo( rRect.TopLeft() );
+ ImplWriteDouble( nWidth );
+ *mpPS << "0 rl 0 ";
+ ImplWriteDouble( nHeight );
+ *mpPS << "rl ";
+ ImplWriteDouble( nWidth );
+ *mpPS << "neg 0 rl ef ";
+ *mpPS << "p ef";
+ mnCursorPos += 2;
+ ImplExecMode( PS_RET );
+}
+
+//---------------------------------------------------------------------------------
+
+void PSWriter::ImplAddPath( const Polygon & rPolygon )
+{
+ USHORT i = 1;
+ USHORT nPointCount = rPolygon.GetSize();
+ if ( nPointCount > 1 )
+ {
+ ImplMoveTo( rPolygon.GetPoint( 0 ) );
+ while ( i < nPointCount )
+ {
+ if ( ( rPolygon.GetFlags( i ) == POLY_CONTROL )
+ && ( ( i + 2 ) < nPointCount )
+ && ( rPolygon.GetFlags( i + 1 ) == POLY_CONTROL )
+ && ( rPolygon.GetFlags( i + 2 ) != POLY_CONTROL ) )
+ {
+ ImplCurveTo( rPolygon[ i ], rPolygon[ i + 1 ], rPolygon[ i + 2 ], PS_WRAP );
+ i += 3;
+ }
+ else
+ ImplLineTo( rPolygon.GetPoint( i++ ), PS_SPACE | PS_WRAP );
+ }
+ }
+}
+
+//---------------------------------------------------------------------------------
+
+void PSWriter::ImplIntersect( const PolyPolygon& rPolyPoly )
+{
+ sal_uInt16 i, nPolyCount = rPolyPoly.Count();
+ for ( i = 0; i < nPolyCount; )
+ {
+ ImplAddPath( rPolyPoly.GetObject( i ) );
+ if ( ++i < nPolyCount )
+ {
+ *mpPS << "p";
+ mnCursorPos += 2;
+ ImplExecMode( PS_RET );
+ }
+ }
+ ImplWriteLine( "eoclip newpath" );
+}
+
+//---------------------------------------------------------------------------------
+
+void PSWriter::ImplWriteGradient( const PolyPolygon& rPolyPoly, const Gradient& rGradient, VirtualDevice& rVDev )
+{
+ VirtualDevice l_aVDev;
+ GDIMetaFile aTmpMtf;
+ l_aVDev.SetMapMode( rVDev.GetMapMode() );
+ l_aVDev.AddGradientActions( rPolyPoly.GetBoundRect(), rGradient, aTmpMtf );
+ ImplWriteActions( aTmpMtf, rVDev );
+}
+
+//---------------------------------------------------------------------------------
+
+void PSWriter::ImplPolyPoly( const PolyPolygon & rPolyPoly, sal_Bool bTextOutline )
+{
+ sal_uInt16 i, nPolyCount = rPolyPoly.Count();
+ if ( nPolyCount )
+ {
+ if ( bFillColor || bTextOutline )
+ {
+ if ( bTextOutline )
+ ImplWriteTextColor( PS_SPACE );
+ else
+ ImplWriteFillColor( PS_SPACE );
+ for ( i = 0; i < nPolyCount; )
+ {
+ ImplAddPath( rPolyPoly.GetObject( i ) );
+ if ( ++i < nPolyCount )
+ {
+ *mpPS << "p";
+ mnCursorPos += 2;
+ ImplExecMode( PS_RET );
+ }
+ }
+ *mpPS << "p ef";
+ mnCursorPos += 4;
+ ImplExecMode( PS_RET );
+ }
+ if ( bLineColor )
+ {
+ ImplWriteLineColor( PS_SPACE );
+ for ( i = 0; i < nPolyCount; i++ )
+ ImplAddPath( rPolyPoly.GetObject( i ) );
+ ImplClosePathDraw( PS_RET );
+ }
+ }
+}
+
+//---------------------------------------------------------------------------------
+
+void PSWriter::ImplPolyLine( const Polygon & rPoly )
+{
+ if ( bLineColor )
+ {
+ ImplWriteLineColor( PS_SPACE );
+ sal_uInt16 i, nPointCount = rPoly.GetSize();
+ if ( nPointCount )
+ {
+ if ( nPointCount > 1 )
+ {
+ ImplMoveTo( rPoly.GetPoint( 0 ) );
+ i = 1;
+ while ( i < nPointCount )
+ {
+ if ( ( rPoly.GetFlags( i ) == POLY_CONTROL )
+ && ( ( i + 2 ) < nPointCount )
+ && ( rPoly.GetFlags( i + 1 ) == POLY_CONTROL )
+ && ( rPoly.GetFlags( i + 2 ) != POLY_CONTROL ) )
+ {
+ ImplCurveTo( rPoly[ i ], rPoly[ i + 1 ], rPoly[ i + 2 ], PS_WRAP );
+ i += 3;
+ }
+ else
+ ImplLineTo( rPoly.GetPoint( i++ ), PS_SPACE | PS_WRAP );
+ }
+ }
+
+ // #104645# explicitely close path if polygon is closed
+ if( rPoly[ 0 ] == rPoly[ nPointCount-1 ] )
+ ImplClosePathDraw( PS_RET );
+ else
+ ImplPathDraw();
+ }
+ }
+}
+
+//---------------------------------------------------------------------------------
+
+void PSWriter::ImplSetClipRegion( Region& rClipRegion )
+{
+ if ( !rClipRegion.IsEmpty() )
+ {
+ Rectangle aRect;
+ RegionHandle hRegionHandle = rClipRegion.BeginEnumRects();
+
+ while ( rClipRegion.GetNextEnumRect( hRegionHandle, aRect ) )
+ {
+ double nX1 = aRect.Left();
+ double nY1 = aRect.Top();
+ double nX2 = aRect.Right();
+ double nY2 = aRect.Bottom();
+ ImplWriteDouble( nX1 );
+ ImplWriteDouble( nY1 );
+ ImplWriteByte( 'm' );
+ ImplWriteDouble( nX2 );
+ ImplWriteDouble( nY1 );
+ ImplWriteByte( 'l' );
+ ImplWriteDouble( nX2 );
+ ImplWriteDouble( nY2 );
+ ImplWriteByte( 'l' );
+ ImplWriteDouble( nX1 );
+ ImplWriteDouble( nY2 );
+ ImplWriteByte( 'l' );
+ ImplWriteDouble( nX1 );
+ ImplWriteDouble( nY1 );
+ ImplWriteByte( 'l', PS_SPACE | PS_WRAP );
+ };
+ rClipRegion.EndEnumRects( hRegionHandle );
+ ImplWriteLine( "eoclip newpath" );
+ }
+}
+
+//---------------------------------------------------------------------------------
+// possible gfx formats:
+//
+// level 1: grayscale 8 bit
+// color 24 bit
+//
+// level 2: grayscale 8 bit
+// color 1(pal), 4(pal), 8(pal), 24 Bit
+//
+
+void PSWriter::ImplBmp( Bitmap* pBitmap, Bitmap* pMaskBitmap, const Point & rPoint, double nXWidth, double nYHeightOrg )
+{
+ if ( !pBitmap )
+ return;
+
+ INT32 nHeightOrg = pBitmap->GetSizePixel().Height();
+ INT32 nHeightLeft = nHeightOrg;
+ long nWidth = pBitmap->GetSizePixel().Width();
+ Point aSourcePos( rPoint );
+
+ while ( nHeightLeft )
+ {
+ Bitmap aTileBitmap( *pBitmap );
+ long nHeight = nHeightLeft;
+ double nYHeight = nYHeightOrg;
+
+ BOOL bDoTrans = FALSE;
+
+ Rectangle aRect;
+ Region aRegion;
+
+ if ( pMaskBitmap )
+ {
+ bDoTrans = TRUE;
+ while (TRUE)
+ {
+ if ( mnLevel == 1 )
+ {
+ if ( nHeight > 10 )
+ nHeight = 8;
+ }
+ aRect = Rectangle( Point( 0, nHeightOrg - nHeightLeft ), Size( (long)nWidth, (long)nHeight ) );
+ aRegion = Region( pMaskBitmap->CreateRegion( COL_BLACK, aRect ) );
+
+ if ( ( mnLevel == 1 ) && ( aRegion.GetRectCount() * 5 > 1000 ) )
+ {
+ nHeight >>= 1;
+ if ( nHeight < 2 )
+ return;
+ continue;
+ }
+ break;
+ }
+ }
+ if ( nHeight != nHeightOrg )
+ {
+ nYHeight = nYHeightOrg * nHeight / nHeightOrg;
+ aTileBitmap.Crop( Rectangle( Point( 0, nHeightOrg - nHeightLeft ), Size( nWidth, nHeight ) ) );
+ }
+ if ( bDoTrans )
+ {
+ ImplWriteLine( "gs\npum" );
+ ImplTranslate( aSourcePos.X(), aSourcePos.Y() );
+ ImplScale( nXWidth / nWidth, nYHeight / nHeight );
+ RegionHandle hRegionHandle = aRegion.BeginEnumRects();
+
+ while ( aRegion.GetNextEnumRect( hRegionHandle, aRect ) )
+ {
+ aRect.Move( 0, - ( nHeightOrg - nHeightLeft ) );
+ ImplWriteLong( aRect.Left() );
+ ImplWriteLong( aRect.Top() );
+ ImplWriteByte( 'm' );
+ ImplWriteLong( aRect.Right() + 1 );
+ ImplWriteLong( aRect.Top() );
+ ImplWriteByte( 'l' );
+ ImplWriteLong( aRect.Right() + 1 );
+ ImplWriteLong( aRect.Bottom() + 1 );
+ ImplWriteByte( 'l' );
+ ImplWriteLong( aRect.Left() );
+ ImplWriteLong( aRect.Bottom() + 1 );
+ ImplWriteByte( 'l' );
+ ImplWriteByte( 'p', PS_SPACE | PS_WRAP );
+ };
+ aRegion.EndEnumRects( hRegionHandle );
+ ImplWriteLine( "eoclip newpath" );
+ ImplWriteLine( "pom" );
+ }
+ BitmapReadAccess* pAcc = aTileBitmap.AcquireReadAccess();
+
+ if (!bDoTrans )
+ ImplWriteLine( "pum" );
+
+ ImplTranslate( aSourcePos.X(), aSourcePos.Y() + nYHeight );
+ ImplScale( nXWidth, nYHeight );
+ if ( mnLevel == 1 ) // level 1 is always grayscale !!!
+ {
+ ImplWriteLong( nWidth );
+ ImplWriteLong( nHeight );
+ *mpPS << "8 [";
+ ImplWriteLong( nWidth );
+ *mpPS << "0 0 ";
+ ImplWriteLong( -nHeight );
+ ImplWriteLong( 0 );
+ ImplWriteLong( nHeight );
+ ImplWriteLine( "]" );
+ *mpPS << "{currentfile ";
+ ImplWriteLong( nWidth );
+ ImplWriteLine( "string readhexstring pop}" );
+ ImplWriteLine( "image" );
+ for ( long y = 0; y < nHeight; y++ )
+ {
+ for ( long x = 0; x < nWidth; x++ )
+ {
+ ImplWriteHexByte( (BYTE)pAcc->GetPixel( y, x ) );
+ }
+ }
+ *mpPS << (BYTE)10;
+ }
+ else // Level 2
+ {
+ if ( mbGrayScale )
+ {
+ ImplWriteLine( "/DeviceGray setcolorspace" );
+ ImplWriteLine( "<<" );
+ ImplWriteLine( "/ImageType 1" );
+ *mpPS << "/Width ";
+ ImplWriteLong( nWidth, PS_RET );
+ *mpPS << "/Height ";
+ ImplWriteLong( nHeight, PS_RET );
+ ImplWriteLine( "/BitsPerComponent 8" );
+ ImplWriteLine( "/Decode[0 1]" );
+ *mpPS << "/ImageMatrix[";
+ ImplWriteLong( nWidth );
+ *mpPS << "0 0 ";
+ ImplWriteLong( -nHeight );
+ ImplWriteLong( 0 );
+ ImplWriteLong( nHeight, PS_NONE );
+ ImplWriteByte( ']', PS_RET );
+ ImplWriteLine( "/DataSource currentfile" );
+ ImplWriteLine( "/ASCIIHexDecode filter" );
+ if ( mbCompression )
+ ImplWriteLine( "/LZWDecode filter" );
+ ImplWriteLine( ">>" );
+ ImplWriteLine( "image" );
+ if ( mbCompression )
+ {
+ StartCompression();
+ for ( long y = 0; y < nHeight; y++ )
+ {
+ for ( long x = 0; x < nWidth; x++ )
+ {
+ Compress( (BYTE)pAcc->GetPixel( y, x ) );
+ }
+ }
+ EndCompression();
+ }
+ else
+ {
+ for ( long y = 0; y < nHeight; y++ )
+ {
+ for ( long x = 0; x < nWidth; x++ )
+ {
+ ImplWriteHexByte( (BYTE)pAcc->GetPixel( y, x ) );
+ }
+ }
+ }
+ }
+ else
+ {
+ // have we to write a palette ?
+
+ if ( pAcc->HasPalette() )
+ {
+ ImplWriteLine( "[/Indexed /DeviceRGB " );
+ ImplWriteLong( pAcc->GetPaletteEntryCount() - 1, PS_RET );
+ ImplWriteByte( '<', PS_NONE );
+ for ( USHORT i = 0; i < pAcc->GetPaletteEntryCount(); i++ )
+ {
+ BitmapColor aBitmapColor = pAcc->GetPaletteColor( i );
+ ImplWriteHexByte( aBitmapColor.GetRed(), PS_NONE );
+ ImplWriteHexByte( aBitmapColor.GetGreen(), PS_NONE );
+ ImplWriteHexByte( aBitmapColor.GetBlue(), PS_SPACE | PS_WRAP );
+ }
+ ImplWriteByte( '>', PS_RET );
+
+ ImplWriteLine( "] setcolorspace" );
+ ImplWriteLine( "<<" );
+ ImplWriteLine( "/ImageType 1" );
+ *mpPS << "/Width ";
+ ImplWriteLong( nWidth, PS_RET );
+ *mpPS << "/Height ";
+ ImplWriteLong( nHeight, PS_RET );
+ ImplWriteLine( "/BitsPerComponent 8" );
+ ImplWriteLine( "/Decode[0 255]" );
+ *mpPS << "/ImageMatrix[";
+ ImplWriteLong( nWidth );
+ *mpPS << "0 0 ";
+ ImplWriteLong( -nHeight );
+ ImplWriteLong( 0);
+ ImplWriteLong( nHeight, PS_NONE );
+ ImplWriteByte( ']', PS_RET );
+ ImplWriteLine( "/DataSource currentfile" );
+ ImplWriteLine( "/ASCIIHexDecode filter" );
+ if ( mbCompression )
+ ImplWriteLine( "/LZWDecode filter" );
+ ImplWriteLine( ">>" );
+ ImplWriteLine( "image" );
+ if ( mbCompression )
+ {
+ StartCompression();
+ for ( long y = 0; y < nHeight; y++ )
+ {
+ for ( long x = 0; x < nWidth; x++ )
+ {
+ Compress( (BYTE)pAcc->GetPixel( y, x ) );
+ }
+ }
+ EndCompression();
+ }
+ else
+ {
+ for ( long y = 0; y < nHeight; y++ )
+ {
+ for ( long x = 0; x < nWidth; x++ )
+ {
+ ImplWriteHexByte( (BYTE)pAcc->GetPixel( y, x ) );
+ }
+ }
+ }
+ }
+ else // 24 bit color
+ {
+ ImplWriteLine( "/DeviceRGB setcolorspace" );
+ ImplWriteLine( "<<" );
+ ImplWriteLine( "/ImageType 1" );
+ *mpPS << "/Width ";
+ ImplWriteLong( nWidth, PS_RET );
+ *mpPS << "/Height ";
+ ImplWriteLong( nHeight, PS_RET );
+ ImplWriteLine( "/BitsPerComponent 8" );
+ ImplWriteLine( "/Decode[0 1 0 1 0 1]" );
+ *mpPS << "/ImageMatrix[";
+ ImplWriteLong( nWidth );
+ *mpPS << "0 0 ";
+ ImplWriteLong( -nHeight );
+ ImplWriteLong( 0 );
+ ImplWriteLong( nHeight, PS_NONE );
+ ImplWriteByte( ']', PS_RET );
+ ImplWriteLine( "/DataSource currentfile" );
+ ImplWriteLine( "/ASCIIHexDecode filter" );
+ if ( mbCompression )
+ ImplWriteLine( "/LZWDecode filter" );
+ ImplWriteLine( ">>" );
+ ImplWriteLine( "image" );
+ if ( mbCompression )
+ {
+ StartCompression();
+ for ( long y = 0; y < nHeight; y++ )
+ {
+ for ( long x = 0; x < nWidth; x++ )
+ {
+ const BitmapColor aBitmapColor( pAcc->GetPixel( y, x ) );
+ Compress( aBitmapColor.GetRed() );
+ Compress( aBitmapColor.GetGreen() );
+ Compress( aBitmapColor.GetBlue() );
+ }
+ }
+ EndCompression();
+ }
+ else
+ {
+ for ( long y = 0; y < nHeight; y++ )
+ {
+ for ( long x = 0; x < nWidth; x++ )
+ {
+ const BitmapColor aBitmapColor( pAcc->GetPixel( y, x ) );
+ ImplWriteHexByte( aBitmapColor.GetRed() );
+ ImplWriteHexByte( aBitmapColor.GetGreen() );
+ ImplWriteHexByte( aBitmapColor.GetBlue() );
+ }
+ }
+ }
+ }
+ }
+ ImplWriteLine( ">" ); // in Level 2 the dictionary needs to be closed (eod)
+ }
+ if ( bDoTrans )
+ ImplWriteLine( "gr" );
+ else
+ ImplWriteLine( "pom" );
+
+ aTileBitmap.ReleaseAccess( pAcc );
+ nHeightLeft -= nHeight;
+ if ( nHeightLeft )
+ {
+ nHeightLeft++;
+ aSourcePos.Y() = (long) ( rPoint.Y() + ( nYHeightOrg * ( nHeightOrg - nHeightLeft ) ) / nHeightOrg );
+ }
+ }
+}
+
+//---------------------------------------------------------------------------------
+
+void PSWriter::ImplWriteCharacter( sal_Char nChar )
+{
+ switch( nChar )
+ {
+ case '(' :
+ case ')' :
+ case '\\' :
+ ImplWriteByte( (BYTE)'\\', PS_NONE );
+ }
+ ImplWriteByte( (BYTE)nChar, PS_NONE );
+}
+
+//---------------------------------------------------------------------------------
+
+void PSWriter::ImplWriteString( const ByteString& rString, VirtualDevice& rVDev, const INT32* pDXArry, BOOL bStretch )
+{
+ USHORT nLen = rString.Len();
+ if ( nLen )
+ {
+ USHORT i;
+ if ( pDXArry )
+ {
+ double nx = 0;
+
+ for( i = 0; i < nLen; i++ )
+ {
+ if ( i > 0 )
+ nx = pDXArry[ i - 1 ];
+ ImplWriteDouble( ( bStretch ) ? nx : rVDev.GetTextWidth( rString.GetChar( i ) ) );
+ ImplWriteDouble( nx );
+ ImplWriteLine( "(", PS_NONE );
+ ImplWriteCharacter( rString.GetChar( i ) );
+ ImplWriteLine( ") bs" );
+ }
+ }
+ else
+ {
+ ImplWriteByte( '(', PS_NONE );
+ for ( i = 0; i < nLen; i++ )
+ ImplWriteCharacter( rString.GetChar( i ) );
+ ImplWriteLine( ") sw" );
+ }
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void PSWriter::ImplText( const String& rUniString, const Point& rPos, const INT32* pDXArry, sal_Int32 nWidth, VirtualDevice& rVDev )
+{
+ sal_uInt16 nLen = rUniString.Len();
+ if ( !nLen )
+ return;
+ if ( mnTextMode == 0 ) // using glpyh outlines
+ {
+ Font aNotRotatedFont( maFont );
+ aNotRotatedFont.SetOrientation( 0 );
+
+ VirtualDevice aVirDev( 1 );
+ aVirDev.SetMapMode( rVDev.GetMapMode() );
+ aVirDev.SetFont( aNotRotatedFont );
+ aVirDev.SetTextAlign( eTextAlign );
+
+ sal_Int16 nRotation = maFont.GetOrientation();
+ Polygon aPolyDummy( 1 );
+
+ PolyPolygon aPolyPoly;
+ Point aPos( rPos );
+ if ( nRotation )
+ {
+ aPolyDummy.SetPoint( aPos, 0 );
+ aPolyDummy.Rotate( rPos, nRotation );
+ aPos = aPolyDummy.GetPoint( 0 );
+ }
+ sal_Bool bOldLineColor = bLineColor;
+ bLineColor = sal_False;
+ std::vector<PolyPolygon> aPolyPolyVec;
+ if ( aVirDev.GetTextOutlines( aPolyPolyVec, rUniString, 0, 0, STRING_LEN, TRUE, nWidth, pDXArry ) )
+ {
+ // always adjust text position to match baseline alignment
+ ImplWriteLine( "pum" );
+ ImplWriteDouble( aPos.X() );
+ ImplWriteDouble( aPos.Y() );
+ ImplWriteLine( "t" );
+ if ( nRotation )
+ {
+ ImplWriteF( nRotation, 1 );
+ *mpPS << "r ";
+ }
+ std::vector<PolyPolygon>::iterator aIter( aPolyPolyVec.begin() );
+ while ( aIter != aPolyPolyVec.end() )
+ ImplPolyPoly( *aIter++, sal_True );
+ ImplWriteLine( "pom" );
+ }
+ bLineColor = bOldLineColor;
+ }
+ else if ( ( mnTextMode == 1 ) || ( mnTextMode == 2 ) ) // normal text output
+ {
+ if ( mnTextMode == 2 ) // forcing output one complete text packet, by
+ pDXArry = NULL; // ignoring the kerning array
+ ImplSetAttrForText( rPos );
+ ByteString aStr( rUniString, maFont.GetCharSet() );
+ ImplWriteString( aStr, rVDev, pDXArry, nWidth != 0 );
+ if ( maFont.GetOrientation() )
+ ImplWriteLine( "gr" );
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void PSWriter::ImplSetAttrForText( const Point& rPoint )
+{
+ Point aPoint( rPoint );
+
+ long nRotation = maFont.GetOrientation();
+ ImplWriteTextColor();
+
+ Size aSize = maFont.GetSize();
+
+ if ( maLastFont != maFont )
+ {
+ if ( maFont.GetPitch() == PITCH_FIXED ) // a little bit font selection
+ ImplDefineFont( "Courier", "Oblique" );
+ else if ( maFont.GetCharSet() == RTL_TEXTENCODING_SYMBOL )
+ ImplWriteLine( "/Symbol findfont" );
+ else if ( maFont.GetFamily() == FAMILY_SWISS )
+ ImplDefineFont( "Helvetica", "Oblique" );
+ else
+ ImplDefineFont( "Times", "Italic" );
+
+ maLastFont = maFont;
+ aSize = maFont.GetSize();
+ ImplWriteDouble( aSize.Height() );
+ *mpPS << "sf ";
+ }
+ if ( eTextAlign != ALIGN_BASELINE )
+ { // PostScript kennt kein FontAlignment
+ if ( eTextAlign == ALIGN_TOP ) // -> ich gehe daher davon aus, dass
+ aPoint.Y() += ( aSize.Height() * 4 / 5 ); // der Bereich unter der Baseline
+ else if ( eTextAlign == ALIGN_BOTTOM ) // in etwa 20% der Fontsize ausmacht
+ aPoint.Y() -= ( aSize.Height() / 5 );
+ }
+ ImplMoveTo( aPoint );
+ if ( nRotation )
+ {
+ *mpPS << "gs ";
+ ImplWriteF( nRotation, 1 );
+ *mpPS << "r ";
+ }
+}
+
+//---------------------------------------------------------------------------------
+
+void PSWriter::ImplDefineFont( const char* pOriginalName, const char* pItalic )
+{
+ *mpPS << (BYTE)'/'; //convert the font pOriginalName using ISOLatin1Encoding
+ *mpPS << pOriginalName;
+ switch ( maFont.GetWeight() )
+ {
+ case WEIGHT_SEMIBOLD :
+ case WEIGHT_BOLD :
+ case WEIGHT_ULTRABOLD :
+ case WEIGHT_BLACK :
+ *mpPS << "-Bold";
+ if ( maFont.GetItalic() != ITALIC_NONE )
+ *mpPS << pItalic;
+ break;
+ default:
+ if ( maFont.GetItalic() != ITALIC_NONE )
+ *mpPS << pItalic;
+ break;
+ }
+ ImplWriteLine( " f" );
+}
+
+//---------------------------------------------------------------------------------
+//---------------------------------------------------------------------------------
+//---------------------------------------------------------------------------------
+
+void PSWriter::ImplClosePathDraw( ULONG nMode )
+{
+ *mpPS << "pc";
+ mnCursorPos += 2;
+ ImplExecMode( nMode );
+}
+
+void PSWriter::ImplPathDraw()
+{
+ *mpPS << "ps";
+ mnCursorPos += 2;
+ ImplExecMode( PS_RET );
+}
+
+//---------------------------------------------------------------------------------
+
+inline void PSWriter::ImplWriteLineColor( ULONG nMode )
+{
+ if ( aColor != aLineColor )
+ {
+ aColor = aLineColor;
+ ImplWriteColor( nMode );
+ }
+}
+inline void PSWriter::ImplWriteFillColor( ULONG nMode )
+{
+ if ( aColor != aFillColor )
+ {
+ aColor = aFillColor;
+ ImplWriteColor( nMode );
+ }
+}
+inline void PSWriter::ImplWriteTextColor( ULONG nMode )
+{
+ if ( aColor != aTextColor )
+ {
+ aColor = aTextColor;
+ ImplWriteColor( nMode );
+ }
+}
+inline void PSWriter::ImplWriteTextFillColor( ULONG nMode )
+{
+ if ( aColor != aTextFillColor )
+ {
+ aColor = aTextFillColor;
+ ImplWriteColor( nMode );
+ }
+}
+
+//---------------------------------------------------------------------------------
+
+void PSWriter::ImplWriteColor( ULONG nMode )
+{
+ if ( mbGrayScale )
+ {
+ // writes the Color (grayscale) as a Number from 0.000 up to 1.000
+
+ ImplWriteF( 1000 * ( (BYTE)aColor.GetRed() * 77 + (BYTE)aColor.GetGreen() * 151 +
+ (BYTE)aColor.GetBlue() * 28 + 1 ) / 65536, 3, nMode );
+ }
+ else
+ {
+ ImplWriteB1 ( (BYTE)aColor.GetRed() );
+ ImplWriteB1 ( (BYTE)aColor.GetGreen() );
+ ImplWriteB1 ( (BYTE)aColor.GetBlue() );
+ }
+ *mpPS << "c"; // ( c is defined as setrgbcolor or setgray )
+ ImplExecMode( nMode );
+}
+
+//---------------------------------------------------------------------------------
+
+double PSWriter::ImplGetScaling( const MapMode& rMapMode )
+{
+ double nMul;
+ switch ( rMapMode.GetMapUnit() )
+ {
+ case MAP_PIXEL :
+ case MAP_SYSFONT :
+ case MAP_APPFONT :
+
+ case MAP_100TH_MM :
+ nMul = 1;
+ break;
+ case MAP_10TH_MM :
+ nMul = 10;
+ break;
+ case MAP_MM :
+ nMul = 100;
+ break;
+ case MAP_CM :
+ nMul = 1000;
+ break;
+ case MAP_1000TH_INCH :
+ nMul = 2.54;
+ break;
+ case MAP_100TH_INCH :
+ nMul = 25.4;
+ break;
+ case MAP_10TH_INCH :
+ nMul = 254;
+ break;
+ case MAP_INCH :
+ nMul = 2540;
+ break;
+ case MAP_TWIP :
+ nMul = 1.76388889;
+ break;
+ case MAP_POINT :
+ nMul = 35.27777778;
+ break;
+ default:
+ nMul = 1.0;
+ break;
+ }
+ return nMul;
+}
+
+//---------------------------------------------------------------------------------
+
+void PSWriter::ImplGetMapMode( const MapMode& rMapMode )
+{
+ ImplWriteLine( "tm setmatrix" );
+ double fMul = ImplGetScaling( rMapMode );
+ double fScaleX = (double)rMapMode.GetScaleX() * fMul;
+ double fScaleY = (double)rMapMode.GetScaleY() * fMul;
+ ImplTranslate( rMapMode.GetOrigin().X() * fScaleX, rMapMode.GetOrigin().Y() * fScaleY );
+ ImplScale( fScaleX, fScaleY );
+}
+
+//---------------------------------------------------------------------------------
+
+inline void PSWriter::ImplExecMode( ULONG nMode )
+{
+ if ( nMode & PS_WRAP )
+ {
+ if ( mnCursorPos >= PS_LINESIZE )
+ {
+ mnCursorPos = 0;
+ *mpPS << (BYTE)0xa;
+ return;
+ }
+ }
+ if ( nMode & PS_SPACE )
+ {
+ *mpPS << (BYTE)32;
+ mnCursorPos++;
+ }
+ if ( nMode & PS_RET )
+ {
+ *mpPS << (BYTE)0xa;
+ mnCursorPos = 0;
+ }
+}
+
+//---------------------------------------------------------------------------------
+
+inline void PSWriter::ImplWriteLine( const char* pString, ULONG nMode )
+{
+ ULONG i = 0;
+ while ( pString[ i ] )
+ {
+ *mpPS << (BYTE)pString[ i++ ];
+ }
+ mnCursorPos += i;
+ ImplExecMode( nMode );
+}
+
+//---------------------------------------------------------------------------------
+
+void PSWriter::ImplWriteLineInfo( double fLWidth, double fMLimit,
+ SvtGraphicStroke::CapType eLCap,
+ SvtGraphicStroke::JoinType eJoin,
+ SvtGraphicStroke::DashArray& rLDash )
+{
+ if ( fLineWidth != fLWidth )
+ {
+ fLineWidth = fLWidth;
+ ImplWriteDouble( fLineWidth );
+ ImplWriteLine( "lw", PS_SPACE );
+ }
+ if ( eLineCap != eLCap )
+ {
+ eLineCap = eLCap;
+ ImplWriteLong( (sal_Int32)eLineCap, PS_SPACE );
+ ImplWriteLine( "lc", PS_SPACE );
+ }
+ if ( eJoinType != eJoin )
+ {
+ eJoinType = eJoin;
+ ImplWriteLong( (sal_Int32)eJoinType, PS_SPACE );
+ ImplWriteLine( "lj", PS_SPACE );
+ }
+ if ( eJoinType == SvtGraphicStroke::joinMiter )
+ {
+ if ( fMiterLimit != fMLimit )
+ {
+ fMiterLimit = fMLimit;
+ ImplWriteDouble( fMiterLimit );
+ ImplWriteLine( "ml", PS_SPACE );
+ }
+ }
+ if ( aDashArray != rLDash )
+ {
+ aDashArray = rLDash;
+ sal_uInt32 j, i = aDashArray.size();
+ ImplWriteLine( "[", PS_SPACE );
+ for ( j = 0; j < i; j++ )
+ ImplWriteDouble( aDashArray[ j ] );
+ ImplWriteLine( "] 0 ld" );
+ }
+}
+
+//---------------------------------------------------------------------------------
+
+void PSWriter::ImplWriteLineInfo( const LineInfo& rLineInfo )
+{
+ SvtGraphicStroke::DashArray l_aDashArray;
+ if ( rLineInfo.GetStyle() == LINE_DASH )
+ l_aDashArray.push_back( 2 );
+ const double fLWidth(( ( rLineInfo.GetWidth() + 1 ) + ( rLineInfo.GetWidth() + 1 ) ) * 0.5);
+ SvtGraphicStroke::JoinType aJoinType(SvtGraphicStroke::joinMiter);
+
+ switch(rLineInfo.GetLineJoin())
+ {
+ default: // B2DLINEJOIN_NONE, B2DLINEJOIN_MIDDLE
+ // do NOT use SvtGraphicStroke::joinNone here
+ // since it will be written as numerical value directly
+ // and is NOT a valid EPS value
+ break;
+ case basegfx::B2DLINEJOIN_MITER:
+ aJoinType = SvtGraphicStroke::joinMiter;
+ break;
+ case basegfx::B2DLINEJOIN_BEVEL:
+ aJoinType = SvtGraphicStroke::joinBevel;
+ break;
+ case basegfx::B2DLINEJOIN_ROUND:
+ aJoinType = SvtGraphicStroke::joinRound;
+ break;
+ }
+
+ ImplWriteLineInfo( fLWidth, fMiterLimit, SvtGraphicStroke::capButt, aJoinType, l_aDashArray );
+}
+
+//---------------------------------------------------------------------------------
+
+void PSWriter::ImplWriteLong( sal_Int32 nNumber, ULONG nMode )
+{
+ const ByteString aNumber( ByteString::CreateFromInt32( nNumber ) );
+ ULONG nLen = aNumber.Len();
+ mnCursorPos += nLen;
+ for ( USHORT n = 0; n < nLen; n++ )
+ *mpPS << aNumber.GetChar( n );
+ ImplExecMode( nMode );
+}
+
+//---------------------------------------------------------------------------------
+
+void PSWriter::ImplWriteDouble( double fNumber, 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 );
+
+ int zCount = 0;
+ if ( nATemp )
+ {
+ *mpPS << (BYTE)'.';
+ mnCursorPos++;
+ const ByteString aNumber2( ByteString::CreateFromInt32( nATemp ) );
+
+ sal_Int16 n, nLen = aNumber2.Len();
+ if ( nLen < 8 )
+ {
+ mnCursorPos += 6 - nLen;
+ for ( n = 0; n < ( 5 - nLen ); n++ )
+ {
+ *mpPS << (BYTE)'0';
+ }
+ }
+ mnCursorPos += nLen;
+ for ( n = 0; n < nLen; n++ )
+ {
+ *mpPS << aNumber2.GetChar( n );
+ zCount--;
+ if ( aNumber2.GetChar( n ) != '0' )
+ zCount = 0;
+ }
+ if ( zCount )
+ mpPS->SeekRel( zCount );
+ }
+ ImplExecMode( nMode );
+}
+
+//---------------------------------------------------------------------------------
+
+// writes the number to stream: nNumber / ( 10^nCount )
+
+void PSWriter::ImplWriteF( sal_Int32 nNumber, ULONG nCount, ULONG nMode )
+{
+ if ( nNumber < 0 )
+ {
+ *mpPS << (BYTE)'-';
+ nNumber = -nNumber;
+ mnCursorPos++;
+ }
+ const ByteString aScaleFactor( ByteString::CreateFromInt32( nNumber ) );
+ ULONG nLen = aScaleFactor.Len();
+ long nStSize = ( nCount + 1 ) - nLen;
+ if ( nStSize >= 1 )
+ {
+ *mpPS << (BYTE)'0';
+ mnCursorPos++;
+ }
+ if ( nStSize >= 2 )
+ {
+ *mpPS << (BYTE)'.';
+ for ( long i = 1; i < nStSize; i++ )
+ {
+ *mpPS << (BYTE)'0';
+ mnCursorPos++;
+ }
+ }
+ mnCursorPos += nLen;
+ for( USHORT n = 0UL; n < nLen; n++ )
+ {
+ if ( n == nLen - nCount )
+ {
+ *mpPS << (BYTE)'.';
+ mnCursorPos++;
+ }
+ *mpPS << aScaleFactor.GetChar( n );
+ }
+ ImplExecMode( nMode );
+}
+
+//---------------------------------------------------------------------------------
+
+void PSWriter::ImplWriteByte( BYTE nNumb, ULONG nMode )
+{
+ *mpPS << ( nNumb );
+ mnCursorPos++;
+ ImplExecMode( nMode );
+}
+
+//---------------------------------------------------------------------------------
+
+void PSWriter::ImplWriteHexByte( BYTE nNumb, ULONG nMode )
+{
+ if ( ( nNumb >> 4 ) > 9 )
+ *mpPS << (BYTE)( ( nNumb >> 4 ) + 'A' - 10 );
+ else
+ *mpPS << (BYTE)( ( nNumb >> 4 ) + '0' );
+
+ if ( ( nNumb & 0xf ) > 9 )
+ *mpPS << (BYTE)( ( nNumb & 0xf ) + 'A' - 10 );
+ else
+ *mpPS << (BYTE)( ( nNumb & 0xf ) + '0' );
+ mnCursorPos += 2;
+ ImplExecMode( nMode );
+}
+
+//---------------------------------------------------------------------------------
+
+// writes the BYTE nNumb as a Number from 0.000 up to 1.000
+
+void PSWriter::ImplWriteB1( BYTE nNumb, ULONG nMode )
+{
+ ImplWriteF( 1000 * ( nNumb + 1 ) / 256 , 3, nMode );
+}
+
+
+// ------------------------------------------------------------------------
+
+inline void PSWriter::WriteBits( USHORT nCode, USHORT nCodeLen )
+{
+ dwShift |= ( nCode << ( nOffset - nCodeLen ) );
+ nOffset -= nCodeLen;
+ while ( nOffset < 24 )
+ {
+ ImplWriteHexByte( (BYTE)( dwShift >> 24 ) );
+ dwShift <<= 8;
+ nOffset += 8;
+ }
+ if ( nCode == 257 && nOffset != 32 )
+ ImplWriteHexByte( (BYTE)( dwShift >> 24 ) );
+}
+
+// ------------------------------------------------------------------------
+
+void PSWriter::StartCompression()
+{
+ USHORT i;
+ nDataSize = 8;
+
+ nClearCode = 1 << nDataSize;
+ nEOICode = nClearCode + 1;
+ nTableSize = nEOICode + 1;
+ nCodeSize = nDataSize + 1;
+
+ nOffset = 32; // anzahl freier bits in dwShift
+ dwShift = 0;
+
+ pTable = new PSLZWCTreeNode[ 4096 ];
+
+ for ( i = 0; i < 4096; i++ )
+ {
+ pTable[ i ].pBrother = pTable[ i ].pFirstChild = NULL;
+ pTable[ i ].nValue = (BYTE)( pTable[ i ].nCode = i );
+ }
+ pPrefix = NULL;
+ WriteBits( nClearCode, nCodeSize );
+}
+
+// ------------------------------------------------------------------------
+
+void PSWriter::Compress( BYTE nCompThis )
+{
+ PSLZWCTreeNode* p;
+ USHORT i;
+ BYTE nV;
+
+ if( !pPrefix )
+ {
+ pPrefix = pTable + nCompThis;
+ }
+ else
+ {
+ nV = nCompThis;
+ for( p = pPrefix->pFirstChild; p != NULL; p = p->pBrother )
+ {
+ if ( p->nValue == nV )
+ break;
+ }
+
+ if( p )
+ pPrefix = p;
+ else
+ {
+ WriteBits( pPrefix->nCode, nCodeSize );
+
+ if ( nTableSize == 409 )
+ {
+ WriteBits( nClearCode, nCodeSize );
+
+ for ( i = 0; i < nClearCode; i++ )
+ pTable[ i ].pFirstChild = NULL;
+
+ nCodeSize = nDataSize + 1;
+ nTableSize = nEOICode + 1;
+ }
+ else
+ {
+ if( nTableSize == (USHORT)( ( 1 << nCodeSize ) - 1 ) )
+ nCodeSize++;
+
+ p = pTable + ( nTableSize++ );
+ p->pBrother = pPrefix->pFirstChild;
+ pPrefix->pFirstChild = p;
+ p->nValue = nV;
+ p->pFirstChild = NULL;
+ }
+
+ pPrefix = pTable + nV;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void PSWriter::EndCompression()
+{
+ if( pPrefix )
+ WriteBits( pPrefix->nCode, nCodeSize );
+
+ WriteBits( nEOICode, nCodeSize );
+ delete[] pTable;
+}
+
+// ------------------------------------------------------------------------
+
+BYTE* PSWriter::ImplSearchEntry( BYTE* pSource, BYTE* pDest, ULONG nComp, ULONG nSize )
+{
+ while ( nComp-- >= nSize )
+ {
+ ULONG i;
+ for ( i = 0; i < nSize; i++ )
+ {
+ if ( ( pSource[i]&~0x20 ) != ( pDest[i]&~0x20 ) )
+ break;
+ }
+ if ( i == nSize )
+ return pSource;
+ pSource++;
+ }
+ return NULL;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL PSWriter::ImplGetBoundingBox( double* nNumb, BYTE* pSource, ULONG nSize )
+{
+ BOOL bRetValue = FALSE;
+ ULONG nBytesRead;
+
+ if ( nSize < 256 ) // we assume that the file is greater than 256 bytes
+ return FALSE;
+
+ if ( nSize < POSTSCRIPT_BOUNDINGSEARCH )
+ nBytesRead = nSize;
+ else
+ nBytesRead = POSTSCRIPT_BOUNDINGSEARCH;
+
+ BYTE* pDest = ImplSearchEntry( pSource, (BYTE*)"%%BoundingBox:", nBytesRead, 14 );
+ if ( pDest )
+ {
+ int nSecurityCount = 100; // only 100 bytes following the bounding box will be checked
+ nNumb[0] = nNumb[1] = nNumb[2] = nNumb[3] = 0;
+ pDest += 14;
+ for ( int i = 0; ( i < 4 ) && nSecurityCount; i++ )
+ {
+ int nDivision = 1;
+ BOOL bDivision = FALSE;
+ BOOL bNegative = FALSE;
+ BOOL bValid = TRUE;
+
+ while ( ( --nSecurityCount ) && ( ( *pDest == ' ' ) || ( *pDest == 0x9 ) ) )
+ pDest++;
+ BYTE nByte = *pDest;
+ while ( nSecurityCount && ( nByte != ' ' ) && ( nByte != 0x9 ) && ( nByte != 0xd ) && ( nByte != 0xa ) )
+ {
+ switch ( nByte )
+ {
+ case '.' :
+ if ( bDivision )
+ bValid = FALSE;
+ else
+ bDivision = TRUE;
+ break;
+ case '-' :
+ bNegative = TRUE;
+ break;
+ default :
+ if ( ( nByte < '0' ) || ( nByte > '9' ) )
+ nSecurityCount = 1; // error parsing the bounding box values
+ else if ( bValid )
+ {
+ if ( bDivision )
+ nDivision*=10;
+ nNumb[i] *= 10;
+ nNumb[i] += nByte - '0';
+ }
+ break;
+ }
+ nSecurityCount--;
+ nByte = *(++pDest);
+ }
+ if ( bNegative )
+ nNumb[i] = -nNumb[i];
+ if ( bDivision && ( nDivision != 1 ) )
+ nNumb[i] /= nDivision;
+ }
+ if ( nSecurityCount)
+ bRetValue = TRUE;
+ }
+ return bRetValue;
+}
+
+//================== GraphicExport - die exportierte Funktion ================
+
+extern "C" BOOL __LOADONCALLAPI GraphicExport( SvStream & rStream, Graphic & rGraphic, FilterConfigItem* pFilterConfigItem, BOOL)
+{
+ PSWriter aPSWriter;
+ return aPSWriter.WritePS( rGraphic, rStream, pFilterConfigItem );
+}
+
+//---------------------------------------------------------------------------------
+
+extern "C" BOOL __LOADONCALLAPI DoExportDialog( FltCallDialogParameter& rPara )
+{
+ BOOL bRet = FALSE;
+
+ if ( rPara.pWindow )
+ {
+ ByteString aResMgrName( "eps" );
+ ResMgr* pResMgr;
+
+ pResMgr = ResMgr::CreateResMgr( aResMgrName.GetBuffer(), Application::GetSettings().GetUILocale() );
+
+ if( pResMgr )
+ {
+ rPara.pResMgr = pResMgr;
+ bRet = ( DlgExportEPS( rPara ).Execute() == RET_OK );
+ delete pResMgr;
+ }
+ else
+ bRet = TRUE;
+ }
+
+ return bRet;
+}
+
+//================== ein bischen Muell fuer Windows ==========================
+#ifndef GCC
+#endif
+
+#ifdef WIN
+
+static HINSTANCE hDLLInst = 0; // HANDLE der DLL
+
+extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR )
+{
+#ifndef WNT
+ if ( nHeap )
+ UnlockData( 0 );
+#endif
+
+ hDLLInst = hDLL;
+
+ return TRUE;
+}
+
+extern "C" int CALLBACK WEP( int )
+{
+ return 1;
+}
+
+#endif
diff --git a/filter/source/graphicfilter/eps/epsstr.src b/filter/source/graphicfilter/eps/epsstr.src
new file mode 100644
index 000000000000..5f456cbf8027
--- /dev/null
+++ b/filter/source/graphicfilter/eps/epsstr.src
@@ -0,0 +1,70 @@
+/*************************************************************************
+ *
+ * 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 "strings.hrc"
+
+String KEY_VERSION_CHECK
+{
+ Text [ en-US ] = "Warning: Not all of the imported EPS graphics could be saved at level1\nas some are at a higher level!";
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/filter/source/graphicfilter/eps/exports.map b/filter/source/graphicfilter/eps/exports.map
new file mode 100644
index 000000000000..61e4682c6551
--- /dev/null
+++ b/filter/source/graphicfilter/eps/exports.map
@@ -0,0 +1,8 @@
+UDK_3_0_0 {
+ global:
+ GraphicExport;
+ DoExportDialog;
+
+ local:
+ *;
+};
diff --git a/filter/source/graphicfilter/eps/makefile.mk b/filter/source/graphicfilter/eps/makefile.mk
new file mode 100644
index 000000000000..189972e80e6e
--- /dev/null
+++ b/filter/source/graphicfilter/eps/makefile.mk
@@ -0,0 +1,79 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=filter
+TARGET=eps
+DEPTARGET=veps
+
+#GEN_HID=TRUE
+
+# --- Settings -----------------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Allgemein ----------------------------------------------------------
+
+.IF "$(editdebug)"!="" || "$(EDITDEBUG)"!=""
+CDEFS+= -DEDITDEBUG
+.ENDIF
+
+SRS1NAME=$(TARGET)
+SRC1FILES = dlgeps.src \
+ epsstr.src
+.IF "$(L10N_framework)"==""
+EXCEPTIONSFILES=$(SLO)$/eps.obj
+SLOFILES = $(SLO)$/eps.obj \
+ $(SLO)$/dlgeps.obj
+.ENDIF
+
+# ==========================================================================
+
+RESLIB1NAME=$(TARGET)
+RESLIB1SRSFILES=$(SRS)$/$(TARGET).srs
+.IF "$(L10N_framework)"==""
+SHL1TARGET= eps$(DLLPOSTFIX)
+SHL1IMPLIB= eps
+SHL1STDLIBS= $(TOOLSLIB) $(VCLLIB) $(VCLLIB) $(SVTOOLLIB) $(CPPULIB) $(SALLIB)
+
+SHL1LIBS= $(SLB)$/eps.lib
+
+.IF "$(GUI)" != "UNX"
+.IF "$(COM)" != "GCC"
+SHL1OBJS= $(SLO)$/eps.obj
+.ENDIF
+.ENDIF
+
+SHL1VERSIONMAP=exports.map
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+DEF1NAME=$(SHL1TARGET)
+.ENDIF
+
+# ==========================================================================
+
+.INCLUDE : target.mk
diff --git a/filter/source/graphicfilter/eps/strings.hrc b/filter/source/graphicfilter/eps/strings.hrc
new file mode 100644
index 000000000000..8628c16b1e94
--- /dev/null
+++ b/filter/source/graphicfilter/eps/strings.hrc
@@ -0,0 +1,29 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#define KEY_VERSION_CHECK 260
+
diff --git a/filter/source/graphicfilter/eras/eras.cxx b/filter/source/graphicfilter/eras/eras.cxx
new file mode 100644
index 000000000000..845dbf6ff83a
--- /dev/null
+++ b/filter/source/graphicfilter/eras/eras.cxx
@@ -0,0 +1,317 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include <vcl/graph.hxx>
+#include <vcl/bmpacc.hxx>
+#include <svtools/fltcall.hxx>
+#include <svtools/FilterConfigItem.hxx>
+
+//============================ RASWriter ==================================
+
+class RASWriter {
+
+private:
+
+ SvStream* mpOStm;
+ USHORT mpOStmOldModus;
+
+ BOOL mbStatus;
+ BitmapReadAccess* mpAcc;
+
+ ULONG mnWidth, mnHeight;
+ USHORT mnColors, mnDepth;
+
+ ULONG mnRepCount;
+ BYTE mnRepVal;
+
+ com::sun::star::uno::Reference< com::sun::star::task::XStatusIndicator > xStatusIndicator;
+
+ void ImplCallback( ULONG nCurrentYPos );
+ BOOL ImplWriteHeader();
+ void ImplWritePalette();
+ void ImplWriteBody();
+ void ImplPutByte( BYTE ); // RLE decoding
+
+public:
+ RASWriter();
+ ~RASWriter();
+
+ BOOL WriteRAS( const Graphic& rGraphic, SvStream& rRAS, FilterConfigItem* pFilterConfigItem );
+};
+
+//=================== Methoden von RASWriter ==============================
+
+RASWriter::RASWriter() :
+ mbStatus ( TRUE ),
+ mpAcc ( NULL ),
+ mnRepCount ( 0xffffffff )
+{
+}
+
+// ------------------------------------------------------------------------
+
+RASWriter::~RASWriter()
+{
+}
+
+// ------------------------------------------------------------------------
+
+void RASWriter::ImplCallback( ULONG nYPos )
+{
+ if ( xStatusIndicator.is() )
+ xStatusIndicator->setValue( (USHORT)( ( 100 * nYPos ) / mnHeight ) );
+}
+
+// ------------------------------------------------------------------------
+
+BOOL RASWriter::WriteRAS( const Graphic& rGraphic, SvStream& rRAS, FilterConfigItem* pFilterConfigItem)
+{
+ Bitmap aBmp;
+
+ mpOStm = &rRAS;
+
+ if ( pFilterConfigItem )
+ {
+ xStatusIndicator = pFilterConfigItem->GetStatusIndicator();
+ if ( xStatusIndicator.is() )
+ {
+ rtl::OUString aMsg;
+ xStatusIndicator->start( aMsg, 100 );
+ }
+ }
+
+ BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
+ aBmp = aBmpEx.GetBitmap();
+
+ if ( aBmp.GetBitCount() == 4 )
+ aBmp.Convert( BMP_CONVERSION_8BIT_COLORS );
+
+ mnDepth = aBmp.GetBitCount();
+
+ // export code below only handles three discrete cases
+ mnDepth = mnDepth <= 1 ? 1 : mnDepth <= 8 ? 8 : 24;
+
+ mpAcc = aBmp.AcquireReadAccess();
+ if ( mpAcc )
+ {
+ mpOStmOldModus = mpOStm->GetNumberFormatInt();
+ mpOStm->SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN );
+
+ if ( ImplWriteHeader() )
+ {
+ if ( mnDepth <= 8 )
+ ImplWritePalette();
+ ImplWriteBody();
+ }
+ aBmp.ReleaseAccess( mpAcc );
+ }
+ else
+ mbStatus = FALSE;
+
+ mpOStm->SetNumberFormatInt( mpOStmOldModus );
+
+ if ( xStatusIndicator.is() )
+ xStatusIndicator->end();
+
+ return mbStatus;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL RASWriter::ImplWriteHeader()
+{
+ mnWidth = mpAcc->Width();
+ mnHeight = mpAcc->Height();
+ if ( mnDepth <= 8 )
+ {
+ mnColors = mpAcc->GetPaletteEntryCount();
+ if (mnColors == 0)
+ mbStatus = FALSE;
+ }
+ if ( mbStatus && mnWidth && mnHeight && mnDepth )
+ {
+ *mpOStm << (UINT32)0x59a66a95 << (UINT32)mnWidth << (UINT32)mnHeight
+ << (UINT32)mnDepth
+ << (UINT32)(( ( ( ( mnWidth * mnDepth ) + 15 ) >> 4 ) << 1 ) * mnHeight)
+ << (UINT32)2;
+
+ if ( mnDepth > 8 )
+ *mpOStm << (UINT32)0 << (UINT32)0;
+ else
+ {
+
+ *mpOStm << (UINT32)1 << (UINT32)( mnColors * 3 );
+ }
+ }
+ else mbStatus = FALSE;
+
+ return mbStatus;
+}
+
+// ------------------------------------------------------------------------
+
+void RASWriter::ImplWritePalette()
+{
+ USHORT i;
+
+ for ( i = 0; i < mnColors; *mpOStm << mpAcc->GetPaletteColor( i++ ).GetRed() ) ;
+ for ( i = 0; i < mnColors; *mpOStm << mpAcc->GetPaletteColor( i++ ).GetGreen() ) ;
+ for ( i = 0; i < mnColors; *mpOStm << mpAcc->GetPaletteColor( i++ ).GetBlue() ) ;
+}
+
+// ------------------------------------------------------------------------
+
+void RASWriter::ImplWriteBody()
+{
+ ULONG x, y;
+
+ if ( mnDepth == 24 )
+ {
+ for ( y = 0; y < mnHeight; y++ )
+ {
+ ImplCallback( y ); // processing output
+ for ( x = 0; x < mnWidth; x++ )
+ {
+ BitmapColor aColor( mpAcc->GetPixel( y, x ) );
+ ImplPutByte( aColor.GetBlue() ); // Format ist BGR
+ ImplPutByte( aColor.GetGreen() );
+ ImplPutByte( aColor.GetRed() );
+ }
+ if ( x & 1 ) ImplPutByte( 0 ); // WORD ALIGNMENT ???
+ }
+ }
+ else if ( mnDepth == 8 )
+ {
+ for ( y = 0; y < mnHeight; y++ )
+ {
+ ImplCallback( y ); // processing output
+ for ( x = 0; x < mnWidth; x++ )
+ {
+ ImplPutByte ( mpAcc->GetPixel( y, x ) );
+ }
+ if ( x & 1 ) ImplPutByte( 0 ); // WORD ALIGNMENT ???
+ }
+ }
+ else if ( mnDepth == 1 )
+ {
+ BYTE nDat = 0;
+
+ for ( y = 0; y < mnHeight; y++ )
+ {
+ ImplCallback( y ); // processing output
+ for ( x = 0; x < mnWidth; x++ )
+ {
+ nDat = ( ( nDat << 1 ) | ( mpAcc->GetPixel ( y, x ) & 1 ) );
+ if ( ( x & 7 ) == 7 )
+ ImplPutByte( nDat );
+ }
+ if ( x & 7 )
+ ImplPutByte( sal::static_int_cast< BYTE >(nDat << ( ( ( x & 7 ) ^ 7 ) + 1)) );// write remaining bits
+ if (!( ( x - 1 ) & 0x8 ) )
+ ImplPutByte( 0 ); // WORD ALIGNMENT ???
+ }
+ }
+ ImplPutByte( mnRepVal + 1 ); // end of RLE decoding
+}
+
+// ------------------------------------------------------------------------
+
+void RASWriter::ImplPutByte( BYTE nPutThis )
+{
+ if ( mnRepCount == 0xffffffff )
+ {
+ mnRepCount = 0;
+ mnRepVal = nPutThis;
+ }
+ else
+ {
+ if ( ( nPutThis == mnRepVal ) && ( mnRepCount != 0xff ) )
+ mnRepCount++;
+ else
+ {
+ if ( mnRepCount == 0 )
+ {
+ *mpOStm << (BYTE)mnRepVal;
+ if ( mnRepVal == 0x80 )
+ *mpOStm << (BYTE)0;
+ }
+ else
+ {
+ *mpOStm << (BYTE)0x80;
+ *mpOStm << (BYTE)mnRepCount;
+ *mpOStm << (BYTE)mnRepVal;
+ }
+ mnRepVal = nPutThis;
+ mnRepCount = 0;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------
+
+// ---------------------
+// - exported function -
+// ---------------------
+
+extern "C" BOOL __LOADONCALLAPI GraphicExport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pFilterConfigItem, BOOL )
+{
+ RASWriter aRASWriter;
+
+ return aRASWriter.WriteRAS( rGraphic, rStream, pFilterConfigItem );
+}
+#ifndef GCC
+#endif
+
+// ---------------
+// - Win16 trash -
+// ---------------
+
+#ifdef WIN
+
+static HINSTANCE hDLLInst = 0;
+
+extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR )
+{
+ if ( nHeap )
+ UnlockData( 0 );
+
+ hDLLInst = hDLL;
+
+ return TRUE;
+}
+
+// ------------------------------------------------------------------------
+
+extern "C" int CALLBACK WEP( int )
+{
+ return 1;
+}
+
+#endif
diff --git a/filter/source/graphicfilter/eras/exports.map b/filter/source/graphicfilter/eras/exports.map
new file mode 100644
index 000000000000..d4e28c44700c
--- /dev/null
+++ b/filter/source/graphicfilter/eras/exports.map
@@ -0,0 +1,7 @@
+UDK_3_0_0 {
+ global:
+ GraphicExport;
+
+ local:
+ *;
+};
diff --git a/filter/source/graphicfilter/eras/makefile.mk b/filter/source/graphicfilter/eras/makefile.mk
new file mode 100644
index 000000000000..051c70699595
--- /dev/null
+++ b/filter/source/graphicfilter/eras/makefile.mk
@@ -0,0 +1,67 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=filter
+TARGET=eras
+DEPTARGET=veras
+
+# --- Settings -----------------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Allgemein ----------------------------------------------------------
+.IF "$(L10N_framework)"==""
+.IF "$(editdebug)"!="" || "$(EDITDEBUG)"!=""
+CDEFS+= -DEDITDEBUG
+.ENDIF
+
+SLOFILES = $(SLO)$/eras.obj
+
+# ==========================================================================
+
+SHL1TARGET= era$(DLLPOSTFIX)
+SHL1IMPLIB= eras
+SHL1STDLIBS= $(VCLLIB) $(TOOLSLIB) $(SALLIB) $(SVTOOLLIB)
+SHL1LIBS= $(SLB)$/eras.lib
+
+.IF "$(GUI)" != "UNX"
+.IF "$(COM)" != "GCC"
+SHL1OBJS= $(SLO)$/eras.obj
+.ENDIF
+.ENDIF
+
+SHL1VERSIONMAP=exports.map
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+DEF1NAME=$(SHL1TARGET)
+.ENDIF
+
+# ==========================================================================
+
+.INCLUDE : target.mk
+
diff --git a/filter/source/graphicfilter/etiff/etiff.cxx b/filter/source/graphicfilter/etiff/etiff.cxx
new file mode 100644
index 000000000000..0e71141eb812
--- /dev/null
+++ b/filter/source/graphicfilter/etiff/etiff.cxx
@@ -0,0 +1,648 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include <vcl/graph.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/bmpacc.hxx>
+#include <svl/solar.hrc>
+#include <svtools/fltcall.hxx>
+#include <svtools/FilterConfigItem.hxx>
+
+#define NewSubfileType 254
+#define ImageWidth 256
+#define ImageLength 257
+#define BitsPerSample 258
+#define Compression 259
+#define PhotometricInterpretation 262
+#define StripOffsets 273
+#define SamplesPerPixel 277
+#define RowsPerStrip 278
+#define StripByteCounts 279
+#define XResolution 282
+#define YResolution 283
+#define PlanarConfiguration 284
+#define ResolutionUnit 296
+#define ColorMap 320
+#define ReferenceBlackWhite 532
+
+// -------------
+// - TIFFWriter -
+// -------------
+
+struct TIFFLZWCTreeNode
+{
+
+ TIFFLZWCTreeNode* pBrother; // naechster Knoten, der den selben Vater hat
+ TIFFLZWCTreeNode* pFirstChild; // erster Sohn
+ USHORT nCode; // Der Code fuer den String von Pixelwerten, der sich ergibt, wenn
+ USHORT nValue; // Der Pixelwert
+};
+
+class TIFFWriter
+{
+private:
+
+ SvStream* mpOStm;
+ UINT32 mnStreamOfs;
+
+ BOOL mbStatus;
+ BitmapReadAccess* mpAcc;
+
+ UINT32 mnWidth, mnHeight, mnColors;
+ UINT32 mnCurAllPictHeight;
+ UINT32 mnSumOfAllPictHeight;
+ UINT32 mnBitsPerPixel;
+ UINT32 mnLastPercent;
+
+ UINT32 mnLatestIfdPos;
+ UINT16 mnTagCount; // number of tags already written
+ UINT32 mnCurrentTagCountPos; // offset to the position where the current
+ // tag count is to insert
+
+ UINT32 mnXResPos; // if != 0 this DWORDs stores the
+ UINT32 mnYResPos; // actual streamposition of the
+ UINT32 mnPalPos; // Tag Entry
+ UINT32 mnBitmapPos;
+ UINT32 mnStripByteCountPos;
+
+ TIFFLZWCTreeNode* pTable;
+ TIFFLZWCTreeNode* pPrefix;
+ USHORT nDataSize;
+ USHORT nClearCode;
+ USHORT nEOICode;
+ USHORT nTableSize;
+ USHORT nCodeSize;
+ ULONG nOffset;
+ ULONG dwShift;
+
+ com::sun::star::uno::Reference< com::sun::star::task::XStatusIndicator > xStatusIndicator;
+
+ void ImplCallback( UINT32 nPercent );
+ BOOL ImplWriteHeader( BOOL bMultiPage );
+ void ImplWritePalette();
+ BOOL ImplWriteBody();
+ void ImplWriteTag( UINT16 TagID, UINT16 DataType, UINT32 NumberOfItems, UINT32 Value);
+ void ImplWriteResolution( ULONG nStreamPos, sal_uInt32 nResolutionUnit );
+ void StartCompression();
+ void Compress( BYTE nSrc );
+ void EndCompression();
+ inline void WriteBits( USHORT nCode, USHORT nCodeLen );
+
+public:
+
+ TIFFWriter();
+ ~TIFFWriter();
+
+ BOOL WriteTIFF( const Graphic& rGraphic, SvStream& rTIFF, FilterConfigItem* pFilterConfigItem );
+};
+
+// ------------------------------------------------------------------------
+
+TIFFWriter::TIFFWriter() :
+ mbStatus ( TRUE ),
+ mpAcc ( NULL ),
+ mnCurAllPictHeight ( 0 ),
+ mnSumOfAllPictHeight( 0 ),
+ mnLastPercent ( 0 ),
+ mnXResPos ( 0 ),
+ mnYResPos ( 0 ),
+ mnBitmapPos ( 0 ),
+ mnStripByteCountPos ( 0 )
+{
+}
+
+// ------------------------------------------------------------------------
+
+TIFFWriter::~TIFFWriter()
+{
+}
+
+// ------------------------------------------------------------------------
+
+BOOL TIFFWriter::WriteTIFF( const Graphic& rGraphic, SvStream& rTIFF, FilterConfigItem* pFilterConfigItem)
+{
+ ULONG* pDummy = new ULONG; delete pDummy; // damit unter OS/2
+ // das richtige (Tools-)new
+ // verwendet wird, da es sonst
+ // in dieser DLL nur Vector-news
+ // gibt;
+
+ if ( pFilterConfigItem )
+ {
+ xStatusIndicator = pFilterConfigItem->GetStatusIndicator();
+ if ( xStatusIndicator.is() )
+ {
+ rtl::OUString aMsg;
+ xStatusIndicator->start( aMsg, 100 );
+ }
+ }
+
+ // #i69169# copy stream
+ mpOStm = &rTIFF;
+
+ const UINT16 nOldFormat = mpOStm->GetNumberFormatInt();
+ mnStreamOfs = mpOStm->Tell();
+
+ // we will use the BIG Endian Mode
+ // TIFF header
+ mpOStm->SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN );
+ *mpOStm << (UINT32)0x4d4d002a; // TIFF identifier
+ mnLatestIfdPos = mpOStm->Tell();
+ *mpOStm << (UINT32)0;
+
+ Animation aAnimation;
+ Bitmap aBmp;
+
+ if( mbStatus )
+ {
+ if ( rGraphic.IsAnimated() )
+ aAnimation = rGraphic.GetAnimation();
+ else
+ {
+ AnimationBitmap aAnimationBitmap( rGraphic.GetBitmap(), Point(), Size() );
+ aAnimation.Insert( aAnimationBitmap );
+ }
+
+ USHORT i;
+ for ( i = 0; i < aAnimation.Count(); i++ )
+ mnSumOfAllPictHeight += aAnimation.Get( i ).aBmpEx.GetSizePixel().Height();
+
+ for ( i = 0; mbStatus && ( i < aAnimation.Count() ); i++ )
+ {
+ mnPalPos = 0;
+ const AnimationBitmap& rAnimationBitmap = aAnimation.Get( i );
+ aBmp = rAnimationBitmap.aBmpEx.GetBitmap();
+ mpAcc = aBmp.AcquireReadAccess();
+ if ( mpAcc )
+ {
+ mnBitsPerPixel = aBmp.GetBitCount();
+
+ // export code below only handles four discrete cases
+ mnBitsPerPixel =
+ mnBitsPerPixel <= 1 ? 1 : mnBitsPerPixel <= 4 ? 4 : mnBitsPerPixel <= 8 ? 8 : 24;
+
+ if ( ImplWriteHeader( ( aAnimation.Count() > 0 ) ) )
+ {
+ Size aDestMapSize( 300, 300 );
+ const MapMode aMapMode( aBmp.GetPrefMapMode() );
+ if ( aMapMode.GetMapUnit() != MAP_PIXEL )
+ {
+ const Size aPrefSize( rGraphic.GetPrefSize() );
+ aDestMapSize = OutputDevice::LogicToLogic( aPrefSize, aMapMode, MAP_INCH );
+ }
+ ImplWriteResolution( mnXResPos, aDestMapSize.Width() );
+ ImplWriteResolution( mnYResPos, aDestMapSize.Height() );
+ if ( mnPalPos )
+ ImplWritePalette();
+ ImplWriteBody();
+ }
+ UINT32 nCurPos = mpOStm->Tell();
+ mpOStm->Seek( mnCurrentTagCountPos );
+ *mpOStm << mnTagCount;
+ mpOStm->Seek( nCurPos );
+
+ aBmp.ReleaseAccess( mpAcc );
+ }
+ else
+ mbStatus = FALSE;
+ }
+ }
+ mpOStm->SetNumberFormatInt( nOldFormat );
+
+ if ( xStatusIndicator.is() )
+ xStatusIndicator->end();
+
+ return mbStatus;
+}
+
+// ------------------------------------------------------------------------
+
+void TIFFWriter::ImplCallback( UINT32 nPercent )
+{
+ if ( xStatusIndicator.is() )
+ {
+ if( nPercent >= mnLastPercent + 3 )
+ {
+ mnLastPercent = nPercent;
+ if ( nPercent <= 100 )
+ xStatusIndicator->setValue( nPercent );
+ }
+ }
+}
+
+
+// ------------------------------------------------------------------------
+
+BOOL TIFFWriter::ImplWriteHeader( BOOL bMultiPage )
+{
+ mnTagCount = 0;
+ mnWidth = mpAcc->Width();
+ mnHeight = mpAcc->Height();
+
+ if ( mnWidth && mnHeight && mnBitsPerPixel && mbStatus )
+ {
+ UINT32 nCurrentPos = mpOStm->Tell();
+ mpOStm->Seek( mnLatestIfdPos );
+ *mpOStm << (UINT32)( nCurrentPos - mnStreamOfs ); // offset to the IFD
+ mpOStm->Seek( nCurrentPos );
+
+ // (OFS8) TIFF image file directory (IFD)
+ mnCurrentTagCountPos = mpOStm->Tell();
+ *mpOStm << (UINT16)0; // the number of tagentrys is to insert later
+
+ UINT32 nSubFileFlags = 0;
+ if ( bMultiPage )
+ nSubFileFlags |= 2;
+ ImplWriteTag( NewSubfileType, 4, 1, nSubFileFlags );
+ ImplWriteTag( ImageWidth, 4, 1, mnWidth );
+ ImplWriteTag( ImageLength, 4, 1, mnHeight);
+ ImplWriteTag( BitsPerSample, 3, 1, ( mnBitsPerPixel == 24 ) ? 8 : mnBitsPerPixel );
+ ImplWriteTag( Compression, 3, 1, 5 );
+ BYTE nTemp;
+ switch ( mnBitsPerPixel )
+ {
+ case 1 :
+ nTemp = 1;
+ break;
+ case 4 :
+ case 8 :
+ nTemp = 3;
+ break;
+ case 24:
+ nTemp = 2;
+ break;
+ default:
+ nTemp = 0; // -Wall set a default...
+ break;
+ }
+ ImplWriteTag( PhotometricInterpretation, 3, 1, nTemp );
+ mnBitmapPos = mpOStm->Tell();
+ ImplWriteTag( StripOffsets, 4, 1, 0 );
+ ImplWriteTag( SamplesPerPixel, 3, 1, ( mnBitsPerPixel == 24 ) ? 3 : 1 );
+ ImplWriteTag( RowsPerStrip, 4, 1, mnHeight ); //0xffffffff );
+ mnStripByteCountPos = mpOStm->Tell();
+ ImplWriteTag( StripByteCounts, 4, 1, ( ( mnWidth * mnBitsPerPixel * mnHeight ) + 7 ) >> 3 );
+ mnXResPos = mpOStm->Tell();
+ ImplWriteTag( XResolution, 5, 1, 0 );
+ mnYResPos = mpOStm->Tell();
+ ImplWriteTag( YResolution, 5, 1, 0 );
+ if ( mnBitsPerPixel != 1 )
+ ImplWriteTag( PlanarConfiguration, 3, 1, 1 ); // ( RGB ORDER )
+ ImplWriteTag( ResolutionUnit, 3, 1, 2); // Resolution Unit is Inch
+ if ( ( mnBitsPerPixel == 4 ) || ( mnBitsPerPixel == 8 ) )
+ {
+ mnColors = mpAcc->GetPaletteEntryCount();
+ mnPalPos = mpOStm->Tell();
+ ImplWriteTag( ColorMap, 3, 3 * mnColors, 0 );
+ }
+
+ // and last we write zero to close the num dir entries list
+ mnLatestIfdPos = mpOStm->Tell();
+ *mpOStm << (UINT32)0; // there are no more IFD
+ }
+ else
+ mbStatus = FALSE;
+
+ return mbStatus;
+}
+
+// ------------------------------------------------------------------------
+
+void TIFFWriter::ImplWritePalette()
+{
+ USHORT i;
+ ULONG nCurrentPos = mpOStm->Tell();
+ mpOStm->Seek( mnPalPos + 8 ); // the palette tag entry needs the offset
+ *mpOStm << static_cast<sal_uInt32>(nCurrentPos - mnStreamOfs); // to the palette colors
+ mpOStm->Seek( nCurrentPos );
+
+ for ( i = 0; i < mnColors; i++ )
+ {
+ const BitmapColor& rColor = mpAcc->GetPaletteColor( i );
+ *mpOStm << (UINT16)( rColor.GetRed() << 8 );
+ }
+ for ( i = 0; i < mnColors; i++ )
+ {
+ const BitmapColor& rColor = mpAcc->GetPaletteColor( i );
+ *mpOStm << (UINT16)( rColor.GetGreen() << 8 );
+ }
+ for ( i = 0; i < mnColors; i++ )
+ {
+ const BitmapColor& rColor = mpAcc->GetPaletteColor( i );
+ *mpOStm << (UINT16)( rColor.GetBlue() << 8 );
+ }
+}
+
+// ------------------------------------------------------------------------
+
+BOOL TIFFWriter::ImplWriteBody()
+{
+ BYTE nTemp = 0;
+ BYTE nShift;
+ ULONG j, x, y;
+
+ ULONG nGfxBegin = mpOStm->Tell();
+ mpOStm->Seek( mnBitmapPos + 8 ); // the strip offset tag entry needs the offset
+ *mpOStm << static_cast<sal_uInt32>(nGfxBegin - mnStreamOfs); // to the bitmap data
+ mpOStm->Seek( nGfxBegin );
+
+ StartCompression();
+
+ switch( mnBitsPerPixel )
+ {
+ case 24 :
+ {
+ for ( y = 0; y < mnHeight; y++, mnCurAllPictHeight++ )
+ {
+ ImplCallback( 100 * mnCurAllPictHeight / mnSumOfAllPictHeight );
+ for ( x = 0; x < mnWidth; x++ )
+ {
+ const BitmapColor& rColor = mpAcc->GetPixel( y, x );
+ Compress( rColor.GetRed() );
+ Compress( rColor.GetGreen() );
+ Compress( rColor.GetBlue() );
+ }
+ }
+ }
+ break;
+
+ case 8 :
+ {
+ for ( y = 0; y < mnHeight; y++, mnCurAllPictHeight++ )
+ {
+ ImplCallback( 100 * mnCurAllPictHeight / mnSumOfAllPictHeight );
+ for ( x = 0; x < mnWidth; x++ )
+ {
+ Compress( mpAcc->GetPixel( y, x ) );
+ }
+ }
+ }
+ break;
+
+ case 4 :
+ {
+ for ( nShift = 0, y = 0; y < mnHeight; y++, mnCurAllPictHeight++ )
+ {
+ ImplCallback( 100 * mnCurAllPictHeight / mnSumOfAllPictHeight );
+ for ( x = 0; x < mnWidth; x++, nShift++ )
+ {
+ if (!( nShift & 1 ))
+ nTemp = ( (BYTE)mpAcc->GetPixel( y, x ) << 4 );
+ else
+ Compress( (BYTE)( nTemp | ( mpAcc->GetPixel( y, x ) & 0xf ) ) );
+ }
+ if ( nShift & 1 )
+ Compress( nTemp );
+ }
+ }
+ break;
+
+ case 1 :
+ {
+ j = 1;
+ for ( y = 0; y < mnHeight; y++, mnCurAllPictHeight++ )
+ {
+ ImplCallback( 100 * mnCurAllPictHeight / mnSumOfAllPictHeight );
+ for ( x = 0; x < mnWidth; x++)
+ {
+ j <<= 1;
+ j |= ( ( ~mpAcc->GetPixel( y, x ) ) & 1 );
+ if ( j & 0x100 )
+ {
+ Compress( (BYTE)j );
+ j = 1;
+ }
+ }
+ if ( j != 1 )
+ {
+ Compress( (BYTE)(j << ( ( ( x & 7) ^ 7 ) + 1 ) ) );
+ j = 1;
+ }
+ }
+ }
+ break;
+
+ default:
+ {
+ mbStatus = FALSE;
+ }
+ break;
+ }
+
+ EndCompression();
+
+ if ( mnStripByteCountPos && mbStatus )
+ {
+ ULONG nGfxEnd = mpOStm->Tell();
+ mpOStm->Seek( mnStripByteCountPos + 8 );
+ *mpOStm << static_cast<sal_uInt32>( nGfxEnd - nGfxBegin ); // mnStripByteCountPos needs the size of the compression data
+ mpOStm->Seek( nGfxEnd );
+ }
+ return mbStatus;
+}
+
+// ------------------------------------------------------------------------
+
+void TIFFWriter::ImplWriteResolution( ULONG nStreamPos, sal_uInt32 nResolutionUnit )
+{
+ ULONG nCurrentPos = mpOStm->Tell();
+ mpOStm->Seek( nStreamPos + 8 );
+ *mpOStm << (UINT32)nCurrentPos - mnStreamOfs;
+ mpOStm->Seek( nCurrentPos );
+ *mpOStm << (UINT32)1;
+ *mpOStm << nResolutionUnit;
+}
+
+// ------------------------------------------------------------------------
+
+void TIFFWriter::ImplWriteTag( UINT16 nTagID, UINT16 nDataType, UINT32 nNumberOfItems, UINT32 nValue)
+{
+ mnTagCount++;
+
+ *mpOStm << nTagID;
+ *mpOStm << nDataType;
+ *mpOStm << nNumberOfItems;
+ if ( nDataType == 3 )
+ nValue <<=16; // in Big Endian Mode WORDS needed to be shifted to a DWORD
+ *mpOStm << nValue;
+}
+
+// ------------------------------------------------------------------------
+
+inline void TIFFWriter::WriteBits( USHORT nCode, USHORT nCodeLen )
+{
+ dwShift |= ( nCode << ( nOffset - nCodeLen ) );
+ nOffset -= nCodeLen;
+ while ( nOffset < 24 )
+ {
+ *mpOStm << (BYTE)( dwShift >> 24 );
+ dwShift <<= 8;
+ nOffset += 8;
+ }
+ if ( nCode == 257 && nOffset != 32 )
+ {
+ *mpOStm << (BYTE)( dwShift >> 24 );
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void TIFFWriter::StartCompression()
+{
+ USHORT i;
+ nDataSize = 8;
+
+ nClearCode = 1 << nDataSize;
+ nEOICode = nClearCode + 1;
+ nTableSize = nEOICode + 1;
+ nCodeSize = nDataSize + 1;
+
+ nOffset = 32; // anzahl freier bits in dwShift
+ dwShift = 0;
+
+ pTable = new TIFFLZWCTreeNode[ 4096 ];
+
+ for ( i = 0; i < 4096; i++)
+ {
+ pTable[ i ].pBrother = pTable[ i ].pFirstChild = NULL;
+ pTable[ i ].nValue = (BYTE)( pTable[ i ].nCode = i );
+ }
+
+ pPrefix = NULL;
+ WriteBits( nClearCode, nCodeSize );
+}
+
+// ------------------------------------------------------------------------
+
+void TIFFWriter::Compress( BYTE nCompThis )
+{
+ TIFFLZWCTreeNode* p;
+ USHORT i;
+ BYTE nV;
+
+ if( !pPrefix )
+ {
+ pPrefix = pTable + nCompThis;
+ }
+ else
+ {
+ nV = nCompThis;
+ for( p = pPrefix->pFirstChild; p != NULL; p = p->pBrother )
+ {
+ if ( p->nValue == nV )
+ break;
+ }
+
+ if( p )
+ pPrefix = p;
+ else
+ {
+ WriteBits( pPrefix->nCode, nCodeSize );
+
+ if ( nTableSize == 409 )
+ {
+ WriteBits( nClearCode, nCodeSize );
+
+ for ( i = 0; i < nClearCode; i++ )
+ pTable[ i ].pFirstChild = NULL;
+
+ nCodeSize = nDataSize + 1;
+ nTableSize = nEOICode + 1;
+ }
+ else
+ {
+ if( nTableSize == (USHORT)( ( 1 << nCodeSize ) - 1 ) )
+ nCodeSize++;
+
+ p = pTable + ( nTableSize++ );
+ p->pBrother = pPrefix->pFirstChild;
+ pPrefix->pFirstChild = p;
+ p->nValue = nV;
+ p->pFirstChild = NULL;
+ }
+
+ pPrefix = pTable + nV;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void TIFFWriter::EndCompression()
+{
+ if( pPrefix )
+ WriteBits( pPrefix->nCode, nCodeSize );
+
+ WriteBits( nEOICode, nCodeSize );
+ delete[] pTable;
+}
+
+// ------------------------------------------------------------------------
+
+// ---------------------
+// - exported function -
+// ---------------------
+
+extern "C" BOOL __LOADONCALLAPI GraphicExport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pFilterConfigItem, BOOL )
+{
+ return TIFFWriter().WriteTIFF( rGraphic, rStream, pFilterConfigItem );
+}
+
+#ifndef GCC
+#endif
+
+// ---------------
+// - Win16 trash -
+// ---------------
+
+#ifdef WIN
+
+static HINSTANCE hDLLInst = 0;
+
+extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR )
+{
+ if ( nHeap )
+ UnlockData( 0 );
+
+ hDLLInst = hDLL;
+
+ return TRUE;
+}
+
+// ------------------------------------------------------------------------
+
+extern "C" int CALLBACK WEP( int )
+{
+ return 1;
+}
+
+#endif
+
diff --git a/filter/source/graphicfilter/etiff/exports.map b/filter/source/graphicfilter/etiff/exports.map
new file mode 100644
index 000000000000..d4e28c44700c
--- /dev/null
+++ b/filter/source/graphicfilter/etiff/exports.map
@@ -0,0 +1,7 @@
+UDK_3_0_0 {
+ global:
+ GraphicExport;
+
+ local:
+ *;
+};
diff --git a/filter/source/graphicfilter/etiff/makefile.mk b/filter/source/graphicfilter/etiff/makefile.mk
new file mode 100644
index 000000000000..a3f52199513d
--- /dev/null
+++ b/filter/source/graphicfilter/etiff/makefile.mk
@@ -0,0 +1,65 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=filter
+TARGET=etiff
+DEPTARGET=vetiff
+
+# --- Settings -----------------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Allgemein ----------------------------------------------------------
+
+.IF "$(editdebug)"!="" || "$(EDITDEBUG)"!=""
+CDEFS+= -DEDITDEBUG
+.ENDIF
+.IF "$(L10N_framework)"==""
+SLOFILES = $(SLO)$/etiff.obj
+
+# ==========================================================================
+
+SHL1TARGET= eti$(DLLPOSTFIX)
+SHL1IMPLIB= etiff
+SHL1STDLIBS= $(VCLLIB) $(TOOLSLIB) $(SALLIB) $(SVTOOLLIB)
+SHL1LIBS= $(SLB)$/etiff.lib
+
+.IF "$(GUI)" != "UNX"
+.IF "$(COM)" != "GCC"
+SHL1OBJS= $(SLO)$/etiff.obj
+.ENDIF
+.ENDIF
+
+SHL1VERSIONMAP=exports.map
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+DEF1NAME=$(SHL1TARGET)
+.ENDIF
+# ==========================================================================
+
+.INCLUDE : target.mk
diff --git a/filter/source/graphicfilter/expm/expm.cxx b/filter/source/graphicfilter/expm/expm.cxx
new file mode 100644
index 000000000000..cd05331e5ade
--- /dev/null
+++ b/filter/source/graphicfilter/expm/expm.cxx
@@ -0,0 +1,302 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include <vcl/graph.hxx>
+#include <vcl/bmpacc.hxx>
+#include <svtools/fltcall.hxx>
+
+//============================ XPMWriter ==================================
+
+class XPMWriter {
+
+private:
+
+ SvStream* mpOStm; // Die auszugebende XPM-Datei
+ USHORT mpOStmOldModus;
+
+ BOOL mbStatus;
+ BOOL mbTrans;
+ BitmapReadAccess* mpAcc;
+ ULONG mnWidth, mnHeight; // Bildausmass in Pixeln
+ USHORT mnColors;
+
+ com::sun::star::uno::Reference< com::sun::star::task::XStatusIndicator > xStatusIndicator;
+
+ void ImplCallback( USHORT nPercent );
+ BOOL ImplWriteHeader();
+ void ImplWritePalette();
+ void ImplWriteColor( USHORT );
+ void ImplWriteBody();
+ void ImplWriteNumber( sal_Int32 );
+ void ImplWritePixel( ULONG );
+
+public:
+ XPMWriter();
+ ~XPMWriter();
+
+ BOOL WriteXPM( const Graphic& rGraphic, SvStream& rXPM, FilterConfigItem* pFilterConfigItem );
+};
+
+//=================== Methoden von XPMWriter ==============================
+
+XPMWriter::XPMWriter() :
+ mbStatus ( TRUE ),
+ mbTrans ( FALSE ),
+ mpAcc ( NULL )
+{
+}
+
+// ------------------------------------------------------------------------
+
+XPMWriter::~XPMWriter()
+{
+}
+
+// ------------------------------------------------------------------------
+
+void XPMWriter::ImplCallback( USHORT nPercent )
+{
+ if ( xStatusIndicator.is() )
+ {
+ if ( nPercent <= 100 )
+ xStatusIndicator->setValue( nPercent );
+ }
+}
+
+// ------------------------------------------------------------------------
+
+BOOL XPMWriter::WriteXPM( const Graphic& rGraphic, SvStream& rXPM, FilterConfigItem* pFilterConfigItem)
+{
+ Bitmap aBmp;
+
+ mpOStm = &rXPM;
+
+ if ( pFilterConfigItem )
+ {
+ xStatusIndicator = pFilterConfigItem->GetStatusIndicator();
+ if ( xStatusIndicator.is() )
+ {
+ rtl::OUString aMsg;
+ xStatusIndicator->start( aMsg, 100 );
+ }
+ }
+
+ BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
+ aBmp = aBmpEx.GetBitmap();
+
+ if ( rGraphic.IsTransparent() ) // event. transparente Farbe erzeugen
+ {
+ mbTrans = TRUE;
+ if ( aBmp.GetBitCount() >= 8 ) // wenn noetig Bild auf 8 bit konvertieren
+ aBmp.Convert( BMP_CONVERSION_8BIT_TRANS );
+ else
+ aBmp.Convert( BMP_CONVERSION_4BIT_TRANS );
+ aBmp.Replace( aBmpEx.GetMask(), BMP_COL_TRANS );
+ }
+ else
+ {
+ if ( aBmp.GetBitCount() > 8 ) // wenn noetig Bild auf 8 bit konvertieren
+ aBmp.Convert( BMP_CONVERSION_8BIT_COLORS );
+ }
+ mpAcc = aBmp.AcquireReadAccess();
+ if ( mpAcc )
+ {
+ mnColors = mpAcc->GetPaletteEntryCount();
+ mpOStmOldModus = mpOStm->GetNumberFormatInt();
+ mpOStm->SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN );
+
+ if ( ImplWriteHeader() )
+ {
+ ImplWritePalette();
+ ImplWriteBody();
+ *mpOStm << "\x22XPMENDEXT\x22\x0a};";
+ }
+ aBmp.ReleaseAccess( mpAcc );
+ }
+ else
+ mbStatus = FALSE;
+
+ mpOStm->SetNumberFormatInt( mpOStmOldModus );
+
+ if ( xStatusIndicator.is() )
+ xStatusIndicator->end();
+
+ return mbStatus;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL XPMWriter::ImplWriteHeader()
+{
+ mnWidth = mpAcc->Width();
+ mnHeight = mpAcc->Height();
+ if ( mnWidth && mnHeight && mnColors )
+ {
+ *mpOStm << "/* XPM */\x0astatic char * image[] = \x0a{\x0a\x22";
+ ImplWriteNumber( mnWidth );
+ *mpOStm << (BYTE)32;
+ ImplWriteNumber( mnHeight );
+ *mpOStm << (BYTE)32;
+ ImplWriteNumber( mnColors );
+ *mpOStm << (BYTE)32;
+ ImplWriteNumber( ( mnColors > 26 ) ? 2 : 1 );
+ *mpOStm << "\x22,\x0a";
+ }
+ else mbStatus = FALSE;
+ return mbStatus;
+}
+
+// ------------------------------------------------------------------------
+
+void XPMWriter::ImplWritePalette()
+{
+ USHORT nTransIndex = 0xffff;
+
+ if ( mbTrans )
+ nTransIndex = mpAcc->GetBestMatchingColor( BMP_COL_TRANS );
+ for ( USHORT i = 0; i < mnColors; i++ )
+ {
+ *mpOStm << "\x22";
+ ImplWritePixel( i );
+ *mpOStm << (BYTE)32;
+ if ( nTransIndex != i )
+ {
+ ImplWriteColor( i );
+ *mpOStm << "\x22,\x0a";
+ }
+ else
+ *mpOStm << "c none\x22,\x0a";
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void XPMWriter::ImplWriteBody()
+{
+ for ( ULONG y = 0; y < mnHeight; y++ )
+ {
+ ImplCallback( (USHORT)( ( 100 * y ) / mnHeight ) ); // processing output in percent
+ *mpOStm << (BYTE)0x22;
+ for ( ULONG x = 0; x < mnWidth; x++ )
+ {
+ ImplWritePixel( (BYTE)(mpAcc->GetPixel( y, x ) ) );
+ }
+ *mpOStm << "\x22,\x0a";
+ }
+}
+
+// ------------------------------------------------------------------------
+// eine Dezimalzahl im ASCII format wird in den Stream geschrieben
+
+void XPMWriter::ImplWriteNumber( sal_Int32 nNumber )
+{
+ const ByteString aNum( ByteString::CreateFromInt32( nNumber ) );
+
+ for( sal_Int16 n = 0UL, nLen = aNum.Len(); n < nLen; n++ )
+ *mpOStm << aNum.GetChar( n );
+
+}
+
+// ------------------------------------------------------------------------
+
+void XPMWriter::ImplWritePixel( ULONG nCol )
+{
+ if ( mnColors > 26 )
+ {
+ BYTE nDiff = (BYTE) ( nCol / 26 );
+ *mpOStm << (BYTE)( nDiff + 'A' );
+ *mpOStm << (BYTE)( nCol - ( nDiff*26 ) + 'A' );
+ }
+ else
+ *mpOStm << (BYTE)( nCol + 'A' );
+}
+
+// ------------------------------------------------------------------------
+// ein Farbwert wird im Hexadezimalzahlformat in den Stream geschrieben
+void XPMWriter::ImplWriteColor( USHORT nNumber )
+{
+ ULONG nTmp;
+ BYTE j;
+
+ *mpOStm << "c #"; // # zeigt einen folgenden Hexwert an
+ const BitmapColor& rColor = mpAcc->GetPaletteColor( nNumber );
+ nTmp = ( rColor.GetRed() << 16 ) | ( rColor.GetGreen() << 8 ) | rColor.GetBlue();
+ for ( signed char i = 20; i >= 0 ; i-=4 )
+ {
+ if ( ( j = (BYTE)( nTmp >> i ) & 0xf ) > 9 )
+ j += 'A' - 10;
+ else
+ j += '0';
+ *mpOStm << j;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+// ---------------------
+// - exported function -
+// ---------------------
+
+extern "C" BOOL __LOADONCALLAPI GraphicExport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pFilterConfigItem, BOOL )
+{
+ XPMWriter aXPMWriter;
+
+ return aXPMWriter.WriteXPM( rGraphic, rStream, pFilterConfigItem );
+}
+
+#ifndef GCC
+#endif
+
+// ---------------
+// - Win16 trash -
+// ---------------
+
+#ifdef WIN
+
+static HINSTANCE hDLLInst = 0;
+
+extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR )
+{
+ if ( nHeap )
+ UnlockData( 0 );
+
+ hDLLInst = hDLL;
+
+ return TRUE;
+}
+
+// ------------------------------------------------------------------------
+
+extern "C" int CALLBACK WEP( int )
+{
+ return 1;
+}
+
+#endif
diff --git a/filter/source/graphicfilter/expm/exports.map b/filter/source/graphicfilter/expm/exports.map
new file mode 100644
index 000000000000..d4e28c44700c
--- /dev/null
+++ b/filter/source/graphicfilter/expm/exports.map
@@ -0,0 +1,7 @@
+UDK_3_0_0 {
+ global:
+ GraphicExport;
+
+ local:
+ *;
+};
diff --git a/filter/source/graphicfilter/expm/makefile.mk b/filter/source/graphicfilter/expm/makefile.mk
new file mode 100644
index 000000000000..743149712620
--- /dev/null
+++ b/filter/source/graphicfilter/expm/makefile.mk
@@ -0,0 +1,66 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=filter
+TARGET=expm
+DEPTARGET=vexpm
+
+
+# --- Settings -----------------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Allgemein ----------------------------------------------------------
+
+.IF "$(editdebug)"!="" || "$(EDITDEBUG)"!=""
+CDEFS+= -DEDITDEBUG
+.ENDIF
+.IF "$(L10N_framework)"==""
+SLOFILES = $(SLO)$/expm.obj
+
+# ==========================================================================
+
+SHL1TARGET= exp$(DLLPOSTFIX)
+SHL1IMPLIB= expm
+SHL1STDLIBS= $(VCLLIB) $(TOOLSLIB) $(SALLIB) $(SVTOOLLIB)
+SHL1LIBS= $(SLB)$/expm.lib
+
+.IF "$(GUI)" != "UNX"
+.IF "$(COM)" != "GCC"
+SHL1OBJS= $(SLO)$/expm.obj
+.ENDIF
+.ENDIF
+
+SHL1VERSIONMAP=exports.map
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+DEF1NAME=$(SHL1TARGET)
+.ENDIF
+# ==========================================================================
+
+.INCLUDE : target.mk
diff --git a/filter/source/graphicfilter/icgm/actimpr.cxx b/filter/source/graphicfilter/icgm/actimpr.cxx
new file mode 100644
index 000000000000..ccc9eb8c93d9
--- /dev/null
+++ b/filter/source/graphicfilter/icgm/actimpr.cxx
@@ -0,0 +1,1134 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+#include <vcl/bitmapex.hxx>
+#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
+#include <com/sun/star/drawing/LineStyle.hpp>
+#include <com/sun/star/drawing/LineDash.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
+#include <com/sun/star/drawing/Hatch.hpp>
+#include <com/sun/star/awt/FontDescriptor.hpp>
+#include <com/sun/star/awt/FontWeight.hpp>
+#include <com/sun/star/awt/FontUnderline.hpp>
+#include <com/sun/star/drawing/XShapeGrouper.hpp>
+#include <com/sun/star/drawing/CircleKind.hpp>
+#include <com/sun/star/awt/XBitmap.hpp>
+#include <com/sun/star/drawing/PointSequenceSequence.hpp>
+#include <com/sun/star/drawing/PointSequence.hpp>
+#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
+#include <com/sun/star/drawing/FlagSequence.hpp>
+#include <com/sun/star/drawing/TextAdjust.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/text/XTextRange.hpp>
+#include <com/sun/star/style/HorizontalAlignment.hpp>
+
+#include <unotools/processfactory.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+
+//#include <toolkit/unohlp.hxx>
+
+#include "main.hxx"
+#include "outact.hxx"
+
+using namespace ::com::sun::star;
+
+// ---------------------------------------------------------------
+// ---------------------------------------------------------------
+// ---------------------------------------------------------------
+// ---------------------------------------------------------------
+
+CGMImpressOutAct::CGMImpressOutAct( CGM& rCGM, const uno::Reference< frame::XModel > & rModel ) :
+ CGMOutAct ( rCGM ),
+ nFinalTextCount ( 0 )
+{
+ sal_Bool bStatRet = sal_False;
+
+ if ( mpCGM->mbStatus )
+ {
+ uno::Reference< drawing::XDrawPagesSupplier > aDrawPageSup( rModel, uno::UNO_QUERY );
+ if( aDrawPageSup.is() )
+ {
+ maXDrawPages = aDrawPageSup->getDrawPages();
+ if ( maXDrawPages.is() )
+ {
+ maXServiceManagerSC = utl::getProcessServiceFactory();
+ if ( maXServiceManagerSC.is() )
+ {
+ uno::Any aAny( rModel->queryInterface( ::getCppuType((const uno::Reference< lang::XMultiServiceFactory >*)0) ));
+ if( aAny >>= maXMultiServiceFactory )
+ {
+ maXDrawPage = *(uno::Reference< drawing::XDrawPage > *)maXDrawPages->getByIndex( 0 ).getValue();
+ if ( ImplInitPage() )
+ bStatRet = sal_True;
+ }
+ }
+ }
+ }
+ mpCGM->mbStatus = bStatRet;
+ }
+};
+
+// ---------------------------------------------------------------
+
+sal_Bool CGMImpressOutAct::ImplInitPage()
+{
+ sal_Bool bStatRet = sal_False;
+ if( maXDrawPage.is() )
+ {
+ maXShapes = uno::Reference< drawing::XShapes >( maXDrawPage, uno::UNO_QUERY );
+ if ( maXShapes.is() )
+ {
+ bStatRet = sal_True;
+ }
+ }
+ return bStatRet;
+}
+
+// ---------------------------------------------------------------
+
+sal_Bool CGMImpressOutAct::ImplCreateShape( const ::rtl::OUString& rType )
+{
+ uno::Reference< uno::XInterface > xNewShape( maXMultiServiceFactory->createInstance( rType ) );
+ maXShape = uno::Reference< drawing::XShape >( xNewShape, uno::UNO_QUERY );
+ maXPropSet = uno::Reference< beans::XPropertySet >( xNewShape, uno::UNO_QUERY );
+ if ( maXShape.is() && maXPropSet.is() )
+ {
+ maXShapes->add( maXShape );
+ return sal_True;
+ }
+ return sal_False;
+}
+
+// ---------------------------------------------------------------
+
+void CGMImpressOutAct::ImplSetOrientation( FloatPoint& rRefPoint, double& rOrientation )
+{
+ uno::Any aAny;
+ aAny <<= (sal_Int32)rRefPoint.X;
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("RotationPointX"), aAny );
+ aAny <<= (sal_Int32)rRefPoint.Y;
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("RotationPointY"), aAny );
+ aAny <<= (sal_Int32)( rOrientation * 100.0 );
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("RotateAngle"), aAny );
+}
+
+// ---------------------------------------------------------------
+
+void CGMImpressOutAct::ImplSetLineBundle()
+{
+ uno::Any aAny;
+ drawing::LineStyle eLS;
+
+ sal_uInt32 nLineColor;
+ LineType eLineType;
+ double fLineWidth;
+
+ if ( mpCGM->pElement->nAspectSourceFlags & ASF_LINECOLOR )
+ nLineColor = mpCGM->pElement->pLineBundle->GetColor();
+ else
+ nLineColor = mpCGM->pElement->aLineBundle.GetColor();
+ if ( mpCGM->pElement->nAspectSourceFlags & ASF_LINETYPE )
+ eLineType = mpCGM->pElement->pLineBundle->eLineType;
+ else
+ eLineType = mpCGM->pElement->aLineBundle.eLineType;
+ if ( mpCGM->pElement->nAspectSourceFlags & ASF_LINEWIDTH )
+ fLineWidth = mpCGM->pElement->pLineBundle->nLineWidth;
+ else
+ fLineWidth = mpCGM->pElement->aLineBundle.nLineWidth;
+
+ aAny <<= (sal_Int32)nLineColor;
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("LineColor"), aAny );
+
+ aAny <<= (sal_Int32)fLineWidth;
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("LineWidth"), aAny );
+
+ switch( eLineType )
+ {
+ case LT_NONE :
+ eLS = drawing::LineStyle_NONE;
+ break;
+ case LT_DASH :
+ case LT_DOT :
+ case LT_DASHDOT :
+ case LT_DOTDOTSPACE :
+ case LT_LONGDASH :
+ case LT_DASHDASHDOT :
+ eLS = drawing::LineStyle_DASH;
+ break;
+ case LT_SOLID :
+ default:
+ eLS = drawing::LineStyle_SOLID;
+ break;
+ }
+ aAny <<= eLS;
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("LineStyle"), aAny );
+ if ( eLS == drawing::LineStyle_DASH )
+ {
+ drawing::LineDash aLineDash( drawing::DashStyle_RECTRELATIVE, 1, 50, 3, 33, 100 );
+ aAny <<= aLineDash;
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("LineDash"), aAny );
+ }
+};
+
+// ---------------------------------------------------------------
+
+void CGMImpressOutAct::ImplSetFillBundle()
+{
+
+ uno::Any aAny;
+ drawing::LineStyle eLS;
+ drawing::FillStyle eFS;
+
+ sal_uInt32 nEdgeColor = 0;
+ EdgeType eEdgeType;
+ double fEdgeWidth = 0;
+
+ sal_uInt32 nFillColor;
+ FillInteriorStyle eFillStyle;
+ long nPatternIndex;
+ sal_uInt32 nHatchIndex;
+
+ if ( mpCGM->pElement->eEdgeVisibility == EV_ON )
+ {
+ if ( mpCGM->pElement->nAspectSourceFlags & ASF_EDGETYPE )
+ eEdgeType = mpCGM->pElement->pEdgeBundle->eEdgeType;
+ else
+ eEdgeType = mpCGM->pElement->aEdgeBundle.eEdgeType;
+ if ( mpCGM->pElement->nAspectSourceFlags & ASF_EDGEWIDTH )
+ fEdgeWidth = mpCGM->pElement->pEdgeBundle->nEdgeWidth;
+ else
+ fEdgeWidth = mpCGM->pElement->aEdgeBundle.nEdgeWidth;
+ if ( mpCGM->pElement->nAspectSourceFlags & ASF_EDGECOLOR )
+ nEdgeColor = mpCGM->pElement->pEdgeBundle->GetColor();
+ else
+ nEdgeColor = mpCGM->pElement->aEdgeBundle.GetColor();
+ }
+ else
+ eEdgeType = ET_NONE;
+
+ if ( mpCGM->pElement->nAspectSourceFlags & ASF_FILLINTERIORSTYLE )
+ eFillStyle = mpCGM->pElement->pFillBundle->eFillInteriorStyle;
+ else
+ eFillStyle = mpCGM->pElement->aFillBundle.eFillInteriorStyle;
+ if ( mpCGM->pElement->nAspectSourceFlags & ASF_FILLCOLOR )
+ nFillColor = mpCGM->pElement->pFillBundle->GetColor();
+ else
+ nFillColor = mpCGM->pElement->aFillBundle.GetColor();
+ if ( mpCGM->pElement->nAspectSourceFlags & ASF_HATCHINDEX )
+ nHatchIndex = (sal_uInt32)mpCGM->pElement->pFillBundle->nFillHatchIndex;
+ else
+ nHatchIndex = (sal_uInt32)mpCGM->pElement->aFillBundle.nFillHatchIndex;
+ if ( mpCGM->pElement->nAspectSourceFlags & ASF_PATTERNINDEX )
+ nPatternIndex = mpCGM->pElement->pFillBundle->nFillPatternIndex;
+ else
+ nPatternIndex = mpCGM->pElement->aFillBundle.nFillPatternIndex;
+
+ aAny <<= (sal_Int32)nFillColor;
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("FillColor"), aAny );
+
+ switch ( eFillStyle )
+ {
+ case FIS_HATCH :
+ {
+ if ( nHatchIndex == 0 )
+ eFS = drawing::FillStyle_NONE;
+ else
+ eFS = drawing::FillStyle_HATCH;
+ }
+ break;
+ case FIS_PATTERN :
+ case FIS_SOLID :
+ {
+ eFS = drawing::FillStyle_SOLID;
+ }
+ break;
+
+ case FIS_GEOPATTERN :
+ {
+ if ( mpCGM->pElement->eTransparency == T_ON )
+ nFillColor = mpCGM->pElement->nAuxiliaryColor;
+ eFS = drawing::FillStyle_NONE;
+ }
+ break;
+
+ case FIS_INTERPOLATED :
+ case FIS_GRADIENT :
+ {
+ eFS = drawing::FillStyle_GRADIENT;
+ }
+ break;
+
+ case FIS_HOLLOW :
+ case FIS_EMPTY :
+ default:
+ {
+ eFS = drawing::FillStyle_NONE;
+ }
+ }
+
+ if ( mpCGM->mnAct4PostReset & ACT4_GRADIENT_ACTION )
+ eFS = drawing::FillStyle_GRADIENT;
+
+ if ( eFS == drawing::FillStyle_GRADIENT )
+ {
+ aAny <<= *mpGradient;
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("FillGradient"), aAny );
+ }
+ aAny <<= eFS;
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("FillStyle"), aAny );
+
+ eLS = drawing::LineStyle_NONE;
+ if ( eFillStyle == FIS_HOLLOW )
+ {
+ eLS = drawing::LineStyle_SOLID;
+ aAny <<= (sal_Int32)nFillColor;
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("LineColor"), aAny );
+ aAny <<= (sal_Int32)0;
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("LineWidth"), aAny );
+ }
+ else if ( eEdgeType != ET_NONE )
+ {
+ aAny <<= (sal_Int32)nEdgeColor;
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("LineColor"), aAny );
+
+ aAny <<= (sal_Int32)fEdgeWidth;
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("LineWidth"), aAny );
+
+ switch( eEdgeType )
+ {
+ case ET_DASH :
+ case ET_DOT :
+ case ET_DASHDOT :
+ case ET_DASHDOTDOT :
+ case ET_DOTDOTSPACE :
+ case ET_LONGDASH :
+ case ET_DASHDASHDOT :
+// {
+// eLS = LineStyle_DASH;
+// aAny.setValue( &eLS, ::getCppuType((const drawing::LineStyle*)0) );
+// maXPropSet->setPropertyValue( L"LineStyle", aAny );
+// drawing::LineDash aLineDash( DashStyle_RECTRELATIVE, 1, 160, 1, 160, 190 );
+// aAny.setValue( &aLineDash, ::getCppuType((const drawing::LineDash*)0) );
+// maXPropSet->setPropertyValue( L"DashStyle", aAny );
+// }
+// break;
+ default: // case ET_SOLID :
+ {
+ eLS = drawing::LineStyle_SOLID;
+ }
+ break;
+ }
+ }
+
+ aAny <<= eLS;
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("LineStyle"), aAny );
+
+ if ( eFS == drawing::FillStyle_HATCH )
+ {
+ drawing::Hatch aHatch;
+
+ if ( mpCGM->pElement->nAspectSourceFlags & ASF_LINECOLOR )
+ aHatch.Color = nFillColor;
+ else
+ aHatch.Color = nFillColor;
+ HatchEntry* pHatchEntry = (HatchEntry*)mpCGM->pElement->aHatchTable.Get( nHatchIndex );
+ if ( pHatchEntry )
+ {
+ switch ( pHatchEntry->HatchStyle )
+ {
+ case 0 : aHatch.Style = drawing::HatchStyle_SINGLE; break;
+ case 1 : aHatch.Style = drawing::HatchStyle_DOUBLE; break;
+ case 2 : aHatch.Style = drawing::HatchStyle_TRIPLE; break;
+ }
+ aHatch.Distance = pHatchEntry->HatchDistance;
+ aHatch.Angle = pHatchEntry->HatchAngle;
+ }
+ else
+ {
+ aHatch.Style = drawing::HatchStyle_TRIPLE;
+ aHatch.Distance = 10 * ( nHatchIndex & 0x1f ) | 100;
+ aHatch.Angle = 15 * ( ( nHatchIndex & 0x1f ) - 5 );
+ }
+ aAny <<= aHatch;
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("FillHatch"), aAny );
+ }
+};
+
+// ---------------------------------------------------------------
+
+void CGMImpressOutAct::ImplSetTextBundle( const uno::Reference< beans::XPropertySet > & rProperty )
+{
+ uno::Any aAny;
+ TextPrecision eTextPrecision;
+ sal_uInt32 nTextFontIndex;
+ sal_uInt32 nTextColor;
+ double fCharacterExpansion;
+ double fCharacterSpacing;
+
+ if ( mpCGM->pElement->nAspectSourceFlags & ASF_TEXTFONTINDEX )
+ nTextFontIndex = mpCGM->pElement->pTextBundle->nTextFontIndex;
+ else
+ nTextFontIndex = mpCGM->pElement->aTextBundle.nTextFontIndex;
+ if ( mpCGM->pElement->nAspectSourceFlags & ASF_TEXTPRECISION )
+ eTextPrecision = mpCGM->pElement->pTextBundle->eTextPrecision;
+ else
+ eTextPrecision = mpCGM->pElement->aTextBundle.eTextPrecision;
+ if ( mpCGM->pElement->nAspectSourceFlags & ASF_CHARACTEREXPANSION )
+ fCharacterExpansion = mpCGM->pElement->pTextBundle->nCharacterExpansion;
+ else
+ fCharacterExpansion = mpCGM->pElement->aTextBundle.nCharacterExpansion;
+ if ( mpCGM->pElement->nAspectSourceFlags & ASF_CHARACTERSPACING )
+ fCharacterSpacing = mpCGM->pElement->pTextBundle->nCharacterSpacing;
+ else
+ fCharacterSpacing = mpCGM->pElement->aTextBundle.nCharacterSpacing;
+ if ( mpCGM->pElement->nAspectSourceFlags & ASF_TEXTCOLOR )
+ nTextColor = mpCGM->pElement->pTextBundle->GetColor();
+ else
+ nTextColor = mpCGM->pElement->aTextBundle.GetColor();
+
+ aAny <<= (sal_Int32)nTextColor;
+ rProperty->setPropertyValue( rtl::OUString::createFromAscii("CharColor"), aAny );
+
+ sal_uInt32 nFontType = 0;
+ awt::FontDescriptor aFontDescriptor;
+ FontEntry* pFontEntry = mpCGM->pElement->aFontList.GetFontEntry( nTextFontIndex );
+ if ( pFontEntry )
+ {
+ nFontType = pFontEntry->nFontType;
+ aFontDescriptor.Name = String::CreateFromAscii( (char*)pFontEntry->pFontName );
+ }
+ aFontDescriptor.Height = ( sal_Int16 )( ( mpCGM->pElement->nCharacterHeight * (double)1.50 ) );
+ if ( nFontType & 1 )
+ aFontDescriptor.Slant = awt::FontSlant_ITALIC;
+ if ( nFontType & 2 )
+ aFontDescriptor.Weight = awt::FontWeight::BOLD;
+ else
+ aFontDescriptor.Weight = awt::FontWeight::NORMAL;
+
+ if ( mpCGM->pElement->eUnderlineMode != UM_OFF )
+ {
+ aFontDescriptor.Underline = awt::FontUnderline::SINGLE;
+ }
+ aAny <<= aFontDescriptor;
+ rProperty->setPropertyValue( rtl::OUString::createFromAscii("FontDescriptor"), aAny );
+};
+
+// ---------------------------------------------------------------
+
+void CGMImpressOutAct::InsertPage()
+{
+ if ( mnCurrentPage ) // eine seite ist immer vorhanden, deshalb wird die erste Seite ausgelassen
+ {
+ uno::Reference< drawing::XDrawPage > xPage( maXDrawPages->insertNewByIndex( 0xffff ), uno::UNO_QUERY );
+ maXDrawPage = xPage;
+ if ( ImplInitPage() == sal_False )
+ mpCGM->mbStatus = sal_False;
+ }
+ mnCurrentPage++;
+};
+
+// ---------------------------------------------------------------
+
+void CGMImpressOutAct::BeginGroup()
+{
+ if ( mnGroupLevel < CGM_OUTACT_MAX_GROUP_LEVEL )
+ {
+ mpGroupLevel[ mnGroupLevel ] = maXShapes->getCount();
+ }
+ mnGroupLevel++;
+ mnGroupActCount = mpCGM->mnActCount;
+};
+
+// ---------------------------------------------------------------
+
+void CGMImpressOutAct::EndGroup()
+{
+ if ( mnGroupLevel ) // preserve overflow
+ mnGroupLevel--;
+ if ( mnGroupLevel < CGM_OUTACT_MAX_GROUP_LEVEL )
+ {
+ sal_uInt32 mnFirstIndex = mpGroupLevel[ mnGroupLevel ];
+ if ( mnFirstIndex == 0xffffffff )
+ mnFirstIndex = 0;
+ sal_uInt32 mnCurrentCount = maXShapes->getCount();
+ if ( ( mnCurrentCount - mnFirstIndex ) > 1 )
+ {
+ uno::Reference< drawing::XShapeGrouper > aXShapeGrouper;
+ uno::Any aAny( maXDrawPage->queryInterface( ::getCppuType(((const uno::Reference< drawing::XShapeGrouper >*)0) )));
+ if( aAny >>= aXShapeGrouper )
+ {
+ uno::Reference< drawing::XShapes > aXShapes;
+// if ( maXServiceManagerSC->createInstance( L"stardiv.one.drawing.ShapeCollection" )->queryInterface( ::getCppuType((const Reference< drawing::XShapes >*)0), aXShapes ) )
+
+ uno::Reference< drawing::XShape > aXShapeCollection( maXServiceManagerSC->createInstance( rtl::OUString::createFromAscii("com.sun.star.drawing.ShapeCollection") ), uno::UNO_QUERY );
+ if ( aXShapeCollection.is() )
+ {
+ aXShapes = uno::Reference< drawing::XShapes >( aXShapeCollection, uno::UNO_QUERY );
+ if( aXShapes.is() )
+ {
+ for ( sal_uInt32 i = mnFirstIndex; i < mnCurrentCount; i++ )
+ {
+ uno::Reference< drawing::XShape > aXShape = *(uno::Reference< drawing::XShape > *)maXShapes->getByIndex( i ).getValue();
+ if (aXShape.is() )
+ {
+ aXShapes->add( aXShape );
+ }
+ }
+ }
+ }
+ uno::Reference< drawing::XShapeGroup > aXShapeGroup = aXShapeGrouper->group( aXShapes );
+ }
+ }
+ }
+};
+
+// ---------------------------------------------------------------
+
+void CGMImpressOutAct::EndGrouping()
+{
+ while ( mnGroupLevel )
+ {
+ EndGroup();
+ }
+}
+
+// ---------------------------------------------------------------
+
+void CGMImpressOutAct::DrawRectangle( FloatRect& rFloatRect )
+{
+ if ( mnGroupActCount != ( mpCGM->mnActCount - 1 ) ) // POWERPOINT HACK !!!
+ {
+ if ( ImplCreateShape( rtl::OUString::createFromAscii("com.sun.star.drawing.RectangleShape") ) )
+ {
+ awt::Size aSize( (long)(rFloatRect.Right - rFloatRect.Left ), (long)(rFloatRect.Bottom-rFloatRect.Top ) );
+ maXShape->setSize( aSize );
+ maXShape->setPosition( awt::Point( (long)rFloatRect.Left, (long)rFloatRect.Top ) );
+ ImplSetFillBundle();
+ }
+ }
+};
+
+// ---------------------------------------------------------------
+
+void CGMImpressOutAct::DrawEllipse( FloatPoint& rCenter, FloatPoint& rSize, double& rOrientation )
+{
+ if ( ImplCreateShape( rtl::OUString::createFromAscii("com.sun.star.drawing.EllipseShape") ) )
+ {
+ drawing::CircleKind eCircleKind = drawing::CircleKind_FULL;
+ uno::Any aAny( &eCircleKind, ::getCppuType((const drawing::CircleKind*)0) );
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("CircleKind"), aAny );
+
+ long nXSize = (long)( rSize.X * 2.0 ); // Merkwuerdigkes Verhalten bei einer awt::Size von 0
+ long nYSize = (long)( rSize.Y * 2.0 );
+ if ( nXSize < 1 )
+ nXSize = 1;
+ if ( nYSize < 1 )
+ nYSize = 1;
+ maXShape->setSize( awt::Size( nXSize, nYSize ) );
+ maXShape->setPosition( awt::Point( (long)( rCenter.X - rSize.X ), (long)( rCenter.Y - rSize.Y ) ) );
+
+ if ( rOrientation != 0 )
+ {
+ ImplSetOrientation( rCenter, rOrientation );
+ }
+ ImplSetFillBundle();
+ }
+};
+
+// ---------------------------------------------------------------
+
+void CGMImpressOutAct::DrawEllipticalArc( FloatPoint& rCenter, FloatPoint& rSize, double& rOrientation,
+ sal_uInt32 nType, double& fStartAngle, double& fEndAngle )
+{
+ if ( ImplCreateShape( rtl::OUString::createFromAscii("com.sun.star.drawing.EllipseShape") ) )
+ {
+ uno::Any aAny;
+ drawing::CircleKind eCircleKind;
+
+
+ long nXSize = (long)( rSize.X * 2.0 ); // Merkwuerdigkes Verhalten bei einer awt::Size von 0
+ long nYSize = (long)( rSize.Y * 2.0 );
+ if ( nXSize < 1 )
+ nXSize = 1;
+ if ( nYSize < 1 )
+ nYSize = 1;
+
+ maXShape->setSize( awt::Size ( nXSize, nYSize ) );
+
+ if ( rOrientation != 0 )
+ {
+ fStartAngle += rOrientation;
+ if ( fStartAngle >= 360 )
+ fStartAngle -= 360;
+ fEndAngle += rOrientation;
+ if ( fEndAngle >= 360 )
+ fEndAngle -= 360;
+ }
+ switch( nType )
+ {
+ case 0 : eCircleKind = drawing::CircleKind_SECTION; break;
+ case 1 : eCircleKind = drawing::CircleKind_CUT; break;
+ case 2 : eCircleKind = drawing::CircleKind_ARC; break;
+ default : eCircleKind = drawing::CircleKind_FULL; break;
+ }
+ if ( (long)fStartAngle == (long)fEndAngle )
+ {
+ eCircleKind = drawing::CircleKind_FULL;
+ aAny.setValue( &eCircleKind, ::getCppuType((const drawing::CircleKind*)0) );
+ }
+ else
+ {
+ aAny.setValue( &eCircleKind, ::getCppuType((const drawing::CircleKind*)0) );
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("CircleKind"), aAny );
+ aAny <<= (sal_Int32)( (long)( fStartAngle * 100 ) );
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("CircleStartAngle"), aAny );
+ aAny <<= (sal_Int32)( (long)( fEndAngle * 100 ) );
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("CircleEndAngle"), aAny );
+ }
+ maXShape->setPosition( awt::Point( (long)( rCenter.X - rSize.X ), (long)( rCenter.Y - rSize.Y ) ) );
+ if ( rOrientation != 0 )
+ {
+ ImplSetOrientation( rCenter, rOrientation );
+ }
+ if ( eCircleKind == drawing::CircleKind_ARC )
+ {
+ ImplSetLineBundle();
+ }
+ else
+ {
+ ImplSetFillBundle();
+ if ( nType == 2 )
+ {
+ ImplSetLineBundle();
+ drawing::FillStyle eFillStyle = drawing::FillStyle_NONE;
+ aAny.setValue( &eFillStyle, ::getCppuType((const drawing::FillStyle*)0) );
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("FillStyle"), aAny );
+ }
+ }
+ }
+};
+
+// ---------------------------------------------------------------
+
+void CGMImpressOutAct::DrawBitmap( CGMBitmapDescriptor* pBmpDesc )
+{
+ if ( pBmpDesc->mbStatus && pBmpDesc->mpBitmap )
+ {
+ FloatPoint aOrigin = pBmpDesc->mnOrigin;
+ double fdx = pBmpDesc->mndx;
+ double fdy = pBmpDesc->mndy;
+
+ sal_uInt32 nMirr = BMP_MIRROR_NONE;
+ if ( pBmpDesc->mbVMirror )
+ nMirr |= BMP_MIRROR_VERT;
+ if ( pBmpDesc->mbHMirror )
+ nMirr |= BMP_MIRROR_HORZ;
+ if ( nMirr != BMP_MIRROR_NONE )
+ pBmpDesc->mpBitmap->Mirror( nMirr );
+
+ mpCGM->ImplMapPoint( aOrigin );
+ mpCGM->ImplMapX( fdx );
+ mpCGM->ImplMapY( fdy );
+
+ if ( ImplCreateShape( rtl::OUString::createFromAscii("com.sun.star.drawing.GraphicObjectShape") ) )
+ {
+ maXShape->setSize( awt::Size( (long)fdx, (long)fdy ) );
+ maXShape->setPosition( awt::Point( (long)aOrigin.X, (long)aOrigin.Y ) );
+
+ if ( pBmpDesc->mnOrientation != 0 )
+ {
+ ImplSetOrientation( aOrigin, pBmpDesc->mnOrientation );
+ }
+
+ uno::Reference< awt::XBitmap > xBitmap( VCLUnoHelper::CreateBitmap( BitmapEx( *( pBmpDesc->mpBitmap ) ) ) );
+ uno::Any aAny;
+ aAny <<= xBitmap;
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("GraphicObjectFillBitmap"), aAny );
+
+ }
+ }
+};
+
+// ---------------------------------------------------------------
+
+void CGMImpressOutAct::DrawPolygon( Polygon& rPoly )
+{
+ sal_uInt16 nPoints = rPoly.GetSize();
+
+ if ( ( nPoints > 1 ) && ImplCreateShape( rtl::OUString::createFromAscii("com.sun.star.drawing.PolyPolygonShape") ) )
+ {
+ drawing::PointSequenceSequence aRetval;
+
+ // Polygone innerhalb vrobereiten
+ aRetval.realloc( 1 );
+
+ // Zeiger auf aeussere Arrays holen
+ drawing::PointSequence* pOuterSequence = aRetval.getArray();
+
+ // Platz in Arrays schaffen
+ pOuterSequence->realloc((sal_Int32)nPoints);
+
+ // Pointer auf arrays holen
+ awt::Point* pInnerSequence = pOuterSequence->getArray();
+
+ for( sal_uInt16 n = 0; n < nPoints; n++ )
+ *pInnerSequence++ = awt::Point( rPoly[ n ].X(), rPoly[n].Y() );
+
+ uno::Any aParam;
+ aParam <<= aRetval;
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("PolyPolygon"), aParam );
+ ImplSetFillBundle();
+ }
+};
+
+
+// ---------------------------------------------------------------
+
+void CGMImpressOutAct::DrawPolyLine( Polygon& rPoly )
+{
+ sal_uInt16 nPoints = rPoly.GetSize();
+
+ if ( ( nPoints > 1 ) && ImplCreateShape( rtl::OUString::createFromAscii("com.sun.star.drawing.PolyLineShape") ) )
+ {
+ drawing::PointSequenceSequence aRetval;
+
+ // Polygone innerhalb vrobereiten
+ aRetval.realloc( 1 );
+
+ // Zeiger auf aeussere Arrays holen
+ drawing::PointSequence* pOuterSequence = aRetval.getArray();
+
+ // Platz in Arrays schaffen
+ pOuterSequence->realloc((sal_Int32)nPoints);
+
+ // Pointer auf arrays holen
+ awt::Point* pInnerSequence = pOuterSequence->getArray();
+
+ for( sal_uInt16 n = 0; n < nPoints; n++ )
+ *pInnerSequence++ = awt::Point( rPoly[ n ].X(), rPoly[n].Y() );
+
+ uno::Any aParam;
+ aParam <<= aRetval;
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("PolyPolygon"), aParam );
+ ImplSetLineBundle();
+ }
+};
+
+// ---------------------------------------------------------------
+
+void CGMImpressOutAct::DrawPolybezier( Polygon& rPolygon )
+{
+ USHORT nPoints = rPolygon.GetSize();
+ if ( ( nPoints > 1 ) && ImplCreateShape( rtl::OUString::createFromAscii("com.sun.star.drawing.OpenBezierShape") ) )
+ {
+ drawing::PolyPolygonBezierCoords aRetval;
+
+ aRetval.Coordinates.realloc( 1 );
+ aRetval.Flags.realloc( 1 );
+
+ // Zeiger auf aeussere Arrays holen
+ drawing::PointSequence* pOuterSequence = aRetval.Coordinates.getArray();
+ drawing::FlagSequence* pOuterFlags = aRetval.Flags.getArray();
+
+ // Platz in Arrays schaffen
+ pOuterSequence->realloc( nPoints );
+ pOuterFlags->realloc( nPoints );
+
+ awt::Point* pInnerSequence = pOuterSequence->getArray();
+ drawing::PolygonFlags* pInnerFlags = pOuterFlags->getArray();
+
+ for( USHORT i = 0; i < nPoints; i++ )
+ {
+ *pInnerSequence++ = awt::Point( rPolygon[ i ].X(), rPolygon[ i ].Y() );
+ *pInnerFlags++ = (drawing::PolygonFlags)rPolygon.GetFlags( i );
+ }
+ uno::Any aParam;
+ aParam <<= aRetval;
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("PolyPolygonBezier"), aParam );
+ ImplSetLineBundle();
+ }
+};
+
+// ---------------------------------------------------------------
+
+void CGMImpressOutAct::DrawPolyPolygon( PolyPolygon& rPolyPolygon )
+{
+ sal_uInt32 nNumPolys = rPolyPolygon.Count();
+ if ( nNumPolys && ImplCreateShape( rtl::OUString::createFromAscii("com.sun.star.drawing.ClosedBezierShape") ) )
+ {
+ drawing::PolyPolygonBezierCoords aRetval;
+
+ // Polygone innerhalb vrobereiten
+ aRetval.Coordinates.realloc((sal_Int32)nNumPolys);
+ aRetval.Flags.realloc((sal_Int32)nNumPolys);
+
+ // Zeiger auf aeussere Arrays holen
+ drawing::PointSequence* pOuterSequence = aRetval.Coordinates.getArray();
+ drawing::FlagSequence* pOuterFlags = aRetval.Flags.getArray();
+
+ for( sal_uInt16 a = 0; a < nNumPolys; a++ )
+ {
+ Polygon aPolygon( rPolyPolygon.GetObject( a ) );
+ sal_uInt32 nNumPoints = aPolygon.GetSize();
+
+ // Platz in Arrays schaffen
+ pOuterSequence->realloc((sal_Int32)nNumPoints);
+ pOuterFlags->realloc((sal_Int32)nNumPoints);
+
+ // Pointer auf arrays holen
+ awt::Point* pInnerSequence = pOuterSequence->getArray();
+ drawing::PolygonFlags* pInnerFlags = pOuterFlags->getArray();
+
+ for( sal_uInt16 b = 0; b < nNumPoints; b++ )
+ {
+ *pInnerSequence++ = awt::Point( aPolygon.GetPoint( b ).X(), aPolygon.GetPoint( b ).Y() ) ;
+ *pInnerFlags++ = (drawing::PolygonFlags)aPolygon.GetFlags( b );
+ }
+ pOuterSequence++;
+ pOuterFlags++;
+ }
+ uno::Any aParam;
+ aParam <<= aRetval;
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("PolyPolygonBezier"), aParam);
+ ImplSetFillBundle();
+ }
+};
+
+// ---------------------------------------------------------------
+
+void CGMImpressOutAct::DrawText( awt::Point& rTextPos, awt::Size& rTextSize, char* pString, sal_uInt32 /*nSize*/, FinalFlag eFlag )
+{
+ if ( ImplCreateShape( rtl::OUString::createFromAscii("com.sun.star.drawing.TextShape") ) )
+ {
+ uno::Any aAny;
+ long nWidth = rTextSize.Width;
+ long nHeight = rTextSize.Height;
+
+ awt::Point aTextPos( rTextPos );
+ switch ( mpCGM->pElement->eTextAlignmentV )
+ {
+ case TAV_HALF :
+ {
+ aTextPos.Y -= static_cast<sal_Int32>( ( mpCGM->pElement->nCharacterHeight * 1.5 ) / 2 );
+ }
+ break;
+
+ case TAV_BASE :
+ case TAV_BOTTOM :
+ case TAV_NORMAL :
+ aTextPos.Y -= static_cast<sal_Int32>( mpCGM->pElement->nCharacterHeight * 1.5 );
+ case TAV_TOP :
+ break;
+ case TAV_CAP:
+ case TAV_CONT:
+ break; // -Wall these two were not here.
+ }
+
+ if ( nWidth < 0 )
+ {
+ nWidth = -nWidth;
+ }
+ else if ( nWidth == 0 )
+ {
+ nWidth = -1;
+ }
+ if ( nHeight < 0 )
+ {
+ nHeight = -nHeight;
+ }
+ else if ( nHeight == 0 )
+ {
+ nHeight = -1;
+ }
+ maXShape->setPosition( aTextPos );
+ maXShape->setSize( awt::Size( nWidth, nHeight ) );
+ double nX = mpCGM->pElement->nCharacterOrientation[ 2 ];
+ double nY = mpCGM->pElement->nCharacterOrientation[ 3 ];
+ double nOrientation = acos( nX / sqrt( nX * nX + nY * nY ) ) * 57.29577951308;
+ if ( nY < 0 )
+ nOrientation = 360 - nOrientation;
+
+ if ( nOrientation )
+ {
+ aAny <<= (sal_Int32)( aTextPos.X );
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("RotationPointX"), aAny );
+ aAny <<= (sal_Int32)( aTextPos.Y + nHeight );
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("RotationPointY"), aAny );
+ aAny <<= (sal_Int32)( (sal_Int32)( nOrientation * 100 ) );
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("RotateAngle"), aAny );
+ }
+ if ( nWidth == -1 )
+ {
+ sal_Bool bTrue( sal_True );
+ aAny.setValue( &bTrue, ::getCppuType((const sal_Bool*)0 ));
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("TextAutoGrowWidth"), aAny );
+
+ drawing::TextAdjust eTextAdjust;
+ switch ( mpCGM->pElement->eTextAlignmentH )
+ {
+ case TAH_RIGHT :
+ eTextAdjust = drawing::TextAdjust_RIGHT;
+ break;
+ case TAH_LEFT :
+ case TAH_CONT :
+ case TAH_NORMAL :
+ eTextAdjust = drawing::TextAdjust_LEFT;
+ break;
+ case TAH_CENTER :
+ eTextAdjust = drawing::TextAdjust_CENTER;
+ break;
+ }
+ aAny <<= eTextAdjust;
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("TextHorizontalAdjust"), aAny );
+ }
+ if ( nHeight == -1 )
+ {
+ sal_Bool bTrue = sal_True;
+ aAny.setValue( &bTrue, ::getCppuType((const sal_Bool*)0) );
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("TextAutoGrowHeight"), aAny );
+ }
+ uno::Reference< text::XText > xText;
+ uno::Any aFirstQuery( maXShape->queryInterface( ::getCppuType((const uno::Reference< text::XText >*)0) ));
+ if( aFirstQuery >>= xText )
+ {
+ String aStr( String::CreateFromAscii( pString ) );
+
+ uno::Reference< text::XTextCursor > aXTextCursor( xText->createTextCursor() );
+ {
+ aXTextCursor->gotoEnd( sal_False );
+ uno::Reference< text::XTextRange > aCursorText;
+ uno::Any aSecondQuery( aXTextCursor->queryInterface( ::getCppuType((const uno::Reference< text::XTextRange >*)0) ));
+ if ( aSecondQuery >>= aCursorText )
+ {
+ uno::Reference< beans::XPropertySet > aCursorPropSet;
+
+ uno::Any aQuery( aCursorText->queryInterface( ::getCppuType((const uno::Reference< beans::XPropertySet >*)0) ));
+ if( aQuery >>= aCursorPropSet )
+ {
+ if ( nWidth != -1 ) // paragraph adjusting in a valid textbox ?
+ {
+ switch ( mpCGM->pElement->eTextAlignmentH )
+ {
+ case TAH_RIGHT :
+ aAny <<= (sal_Int16)style::HorizontalAlignment_RIGHT;
+ break;
+ case TAH_LEFT :
+ case TAH_CONT :
+ case TAH_NORMAL :
+ aAny <<= (sal_Int16)style::HorizontalAlignment_LEFT;
+ break;
+ case TAH_CENTER :
+ aAny <<= (sal_Int16)style::HorizontalAlignment_CENTER;
+ break;
+ }
+ aCursorPropSet->setPropertyValue( rtl::OUString::createFromAscii("ParaAdjust"), aAny );
+ }
+ if ( nWidth > 0 && nHeight > 0 ) // restricted text
+ {
+ sal_Bool bTrue = sal_True;
+ aAny.setValue( &bTrue, ::getCppuType((const sal_Bool*)0));
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("TextFitToSize"), aAny );
+ }
+ aCursorText->setString( aStr );
+ aXTextCursor->gotoEnd( sal_True );
+ ImplSetTextBundle( aCursorPropSet );
+ }
+ }
+ }
+ }
+ if ( eFlag == FF_NOT_FINAL )
+ {
+ nFinalTextCount = maXShapes->getCount();
+ }
+ }
+};
+
+// ---------------------------------------------------------------
+
+void CGMImpressOutAct::AppendText( char* pString, sal_uInt32 /*nSize*/, FinalFlag /*eFlag*/ )
+{
+ if ( nFinalTextCount )
+ {
+ uno::Reference< drawing::XShape > aShape = *(uno::Reference< drawing::XShape > *)maXShapes->getByIndex( nFinalTextCount - 1 ).getValue();
+ if ( aShape.is() )
+ {
+ uno::Reference< text::XText > xText;
+ uno::Any aFirstQuery( aShape->queryInterface( ::getCppuType((const uno::Reference< text::XText >*)0)) );
+ if( aFirstQuery >>= xText )
+ {
+ String aStr( String::CreateFromAscii( pString ) );
+
+ uno::Reference< text::XTextCursor > aXTextCursor( xText->createTextCursor() );
+ if ( aXTextCursor.is() )
+ {
+ aXTextCursor->gotoEnd( sal_False );
+ uno::Reference< text::XTextRange > aCursorText;
+ uno::Any aSecondQuery(aXTextCursor->queryInterface( ::getCppuType((const uno::Reference< text::XTextRange >*)0) ));
+ if ( aSecondQuery >>= aCursorText )
+ {
+ uno::Reference< beans::XPropertySet > aPropSet;
+ uno::Any aQuery(aCursorText->queryInterface( ::getCppuType((const uno::Reference< beans::XPropertySet >*)0) ));
+ if( aQuery >>= aPropSet )
+ {
+ aCursorText->setString( aStr );
+ aXTextCursor->gotoEnd( sal_True );
+ ImplSetTextBundle( aPropSet );
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+// ---------------------------------------------------------------
+// nCount != 0 -> Append Text
+sal_uInt32 CGMImpressOutAct::DrawText( TextEntry* /*pTextEntry*/, NodeFrameSet& /*rNodeFrameSet*/, sal_uInt32 /*nObjCount*/ )
+{
+
+return 0;
+
+/*
+ uno::Reference< drawing::XShape > aShape;
+
+ if ( nObjCount )
+ {
+ aShape = (drawing::XShape*) maXShapes->getElementByIndex( nObjCount - 1 )->queryInterface( ::getCppuType((const Reference< drawing::XShape >*)0) );
+ }
+ else
+ {
+ aShape = maXShapes->insertShape( maXShapeFactory->createShape( L"ShapeText", rNodeFrameSet.nSize ), rNodeFrameSet.nTopLeft );
+ }
+ if ( aShape.is() )
+ {
+ uno::Reference< text::XText > xText = (text::XText*)aShape->queryInterface( ::getCppuType((const Reference< text::XText >*)0) );
+ if ( xText.is() )
+ {
+ uno::Reference< text::XTextCursor > aXTextCursor = (text::XTextCursor*)xText->createTextCursor()->queryInterface( ::getCppuType((const Reference< text::XTextCursor >*)0) );
+ if ( aXTextCursor.is() )
+ {
+ uno::Any aAny;
+ sal_uInt32 nTextOfs = 0;
+ TextAttribute* pTAttr = pTextEntry->pAttribute;
+ do
+ {
+ if ( pTAttr->nTextAttribSize > 0.3 ) // is text readable
+ {
+ aXTextCursor->gotoEnd( sal_False );
+ char nPushedChar = pTextEntry->pText[ nTextOfs + pTAttr->nTextAttribCount ];
+ pTextEntry->pText[ nTextOfs + pTAttr->nTextAttribCount ] = 0;
+ UString aStr( StringToOUString( pTextEntry->pText + nTextOfs, CHARSET_SYSTEM ) );
+
+ uno::Reference< text::XText > aCursorText = (text::XText*)aXTextCursor->queryInterface( ::getCppuType((const Reference< text::XText >*)0) );
+ if ( aCursorText.is() )
+ {
+ uno::Reference< beans::XPropertySet > aPropSet = (beans::XPropertySet*)aCursorText->queryInterface( ::getCppuType((const Reference< beans::XPropertySet >*)0) );
+ if ( aPropSet.is() )
+ {
+ if ( pTextEntry->nRowOrLineNum )
+ {
+ uno::Reference< XControlCharacterInsertable > aCRef = (XControlCharacterInsertable*)aXTextCursor->queryInterface( ::getCppuType((const Reference< XControlCharacterInsertable >*)0) );
+ if ( aCRef.is() )
+ {
+ aCRef->insertControlCharacter( TEXTCONTROLCHAR_PARAGRAPH_BREAK );
+ }
+ }
+ aCursorText->setText( aStr );
+ aXTextCursor->gotoEnd( sal_True );
+ double nSize = mpCGM->mnOutdx;
+ if ( mpCGM->mnOutdx < mpCGM->mnOutdy )
+ nSize = mpCGM->mnOutdy;
+ nSize = ( nSize * (double)pTAttr->nTextAttribSize * (double)1.5 ) / 100;
+
+ aAny <<= (sal_Int32)( (sal_Int32)nSize );
+ aPropSet->setPropertyValue( L"CharHeight", aAny );
+
+ sal_uInt32 nTextColor = pTAttr->nTextColorIndex;
+ if ( nTextColor == 0xff )
+ {
+ nTextColor = ( pTAttr->nTextColorBlue << 16 ) + ( pTAttr->nTextColorGreen << 8 ) + pTAttr->nTextColorRed;
+ }
+ else
+ {
+ nTextColor = mpCGM->pElement->aColorTable[ nTextColor ];
+ }
+
+ sal_uInt32 nFontType = 0;
+
+ if ( pTAttr->nTextFontType == 0xff )
+ {
+ FontEntry* pFontEntry = mpCGM->pElement->aFontList.GetFontEntry( pTAttr->nTextFontFamily );
+ if ( pFontEntry )
+ {
+ nFontType = pFontEntry->nFontType;
+ if ( mpCGM->pElement->nAspectSourceFlags & ASF_TEXTCOLOR )
+ nTextColor = mpCGM->pElement->pTextBundle->GetColor();
+ else
+ nTextColor = mpCGM->pElement->aTextBundle.GetColor();
+ }
+ FontItalic eFontItalic = ITALIC_NONE;
+ if ( nFontType & 1 )
+ eFontItalic = ITALIC_NORMAL;
+ aAny.setValue( &eFontItalic, ::getCppuType((const FontItalic*)0) );
+ aPropSet->setPropertyValue( L"CharPosture", aAny );
+ }
+ aAny <<= (sal_Int32)( (sal_Int32)nTextColor );
+ aPropSet->setPropertyValue( L"CharColor", aAny );
+
+ awt::FontWeight eFontWeight = WEIGHT_NORMAL;
+ if ( nFontType & 2 )
+ eFontWeight = WEIGHT_BOLD;
+ aAny.setValue( &eFontWeight, ::getCppuType((const awt::FontWeight*)0) );
+ aPropSet->setPropertyValue( L"CharWeight", aAny );
+
+ if ( pTAttr->nTextAttribBits & 0x4000 )
+ {
+ awt::FontUnderline eUnderline = UNDERLINE_SINGLE;
+ aAny.setValue( &eUnderline, ::getCppuType((const awt::FontUnderline*)0) );
+ aPropSet->setPropertyValue( L"CharUnderline", aAny );
+ }
+ }
+ }
+ pTextEntry->pText[ nTextOfs + pTAttr->nTextAttribCount ] = nPushedChar;
+ }
+ nTextOfs += pTAttr->nTextAttribCount;
+ }
+ while ( ( ( pTAttr = pTAttr->pNextAttribute ) != NULL ) );
+ }
+ }
+ }
+ return ( nObjCount ) ? nObjCount : maXShapes->getCount();
+*/
+}
+
+// ---------------------------------------------------------------
+
+void CGMImpressOutAct::DrawChart()
+{
+}
diff --git a/filter/source/graphicfilter/icgm/bitmap.cxx b/filter/source/graphicfilter/icgm/bitmap.cxx
new file mode 100644
index 000000000000..c971c87e54e3
--- /dev/null
+++ b/filter/source/graphicfilter/icgm/bitmap.cxx
@@ -0,0 +1,410 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include "main.hxx"
+
+// ---------------------------------------------------------------
+
+CGMBitmap::CGMBitmap( CGM& rCGM ) :
+ mpCGM ( &rCGM ),
+ pCGMBitmapDescriptor ( new CGMBitmapDescriptor )
+{
+ ImplGetBitmap( *pCGMBitmapDescriptor );
+};
+
+// ---------------------------------------------------------------
+
+CGMBitmap::~CGMBitmap()
+{
+ delete pCGMBitmapDescriptor;
+}
+
+// ---------------------------------------------------------------
+
+void CGMBitmap::ImplGetBitmap( CGMBitmapDescriptor& rDesc )
+{
+ rDesc.mbStatus = sal_True;
+ long nx, ny, nxC, nxCount, nyCount;
+
+ if ( ImplGetDimensions( rDesc ) && rDesc.mpBuf )
+ {
+ if ( ( rDesc.mpBitmap = new Bitmap( Size( rDesc.mnX, rDesc.mnY ), (sal_uInt16)rDesc.mnDstBitsPerPixel ) ) != NULL )
+ {
+ if ( ( rDesc.mpAcc = rDesc.mpBitmap->AcquireWriteAccess() ) != NULL )
+ {
+
+ // the picture may either be read from left to right or right to left, from top to bottom ...
+
+ nxCount = rDesc.mnX + 1; // +1 because we are using prefix decreasing
+ nyCount = rDesc.mnY + 1;
+
+ switch ( rDesc.mnDstBitsPerPixel )
+ {
+ case 1 :
+ {
+ if ( rDesc.mnLocalColorPrecision == 1 )
+ ImplSetCurrentPalette( rDesc );
+ else
+ {
+ rDesc.mpAcc->SetPaletteEntryCount( 2 );
+ rDesc.mpAcc->SetPaletteColor( 0, BMCOL( mpCGM->pElement->nBackGroundColor ) );
+ rDesc.mpAcc->SetPaletteColor( 1,
+ ( mpCGM->pElement->nAspectSourceFlags & ASF_FILLINTERIORSTYLE )
+ ? BMCOL( mpCGM->pElement->pFillBundle->GetColor() )
+ : BMCOL( mpCGM->pElement->aFillBundle.GetColor() ) ) ;
+ }
+ for ( ny = 0; --nyCount ; ny++, rDesc.mpBuf += rDesc.mnScanSize )
+ {
+ nxC = nxCount;
+ for ( nx = 0; --nxC; nx++ )
+ { // this is not fast, but a one bit/pixel format is rarely used
+ rDesc.mpAcc->SetPixel( ny, nx, (sal_Int8)( (*( rDesc.mpBuf + ( nx >> 3 ) ) >> ( ( nx & 7 ) ^ 7 ) ) ) & 1 );
+ }
+ }
+ }
+ break;
+
+ case 2 :
+ {
+ ImplSetCurrentPalette( rDesc );
+ for ( ny = 0; --nyCount; ny++, rDesc.mpBuf += rDesc.mnScanSize )
+ {
+ nxC = nxCount;
+ for ( nx = 0; --nxC; nx++ )
+ { // this is not fast, but a two bits/pixel format is rarely used
+ rDesc.mpAcc->SetPixel( ny, nx, (sal_Int8)( (*( rDesc.mpBuf + ( nx >> 2 ) ) >> ( ( ( nx & 3 ) ^ 3 ) << 1 ) ) ) & 3 );
+ }
+ }
+ }
+ break;
+
+ case 4 :
+ {
+ ImplSetCurrentPalette( rDesc );
+ for ( ny = 0; --nyCount; ny++, rDesc.mpBuf += rDesc.mnScanSize )
+ {
+ nxC = nxCount;
+ sal_Int8 nDat;
+ sal_uInt8* pTemp = rDesc.mpBuf;
+ for ( nx = 0; --nxC; nx++ )
+ {
+ nDat = *pTemp++;
+ rDesc.mpAcc->SetPixel( ny, nx, (sal_Int8)( nDat >> 4 ) );
+ if ( --nxC )
+ {
+ nx ++;
+ rDesc.mpAcc->SetPixel( ny, nx, (sal_Int8)( nDat & 15 ) );
+ }
+ else
+ break;
+ }
+ }
+ }
+ break;
+
+ case 8 :
+ {
+ ImplSetCurrentPalette( rDesc );
+ for ( ny = 0; --nyCount; ny++, rDesc.mpBuf += rDesc.mnScanSize )
+ {
+ sal_uInt8* pTemp = rDesc.mpBuf;
+ nxC = nxCount;
+ for ( nx = 0; --nxC; nx++ )
+ {
+ rDesc.mpAcc->SetPixel( ny, nx, (sal_Int8)( *pTemp++ ) );
+ }
+ }
+ }
+ break;
+
+ case 24 :
+ {
+ {
+ BitmapColor aBitmapColor;
+ for ( ny = 0; --nyCount; ny++, rDesc.mpBuf += rDesc.mnScanSize )
+ {
+ sal_uInt8* pTemp = rDesc.mpBuf;
+ nxC = nxCount;
+ for ( nx = 0; --nxC; nx++ )
+ {
+ aBitmapColor.SetRed( (sal_Int8)*pTemp++ );
+ aBitmapColor.SetGreen( (sal_Int8)*pTemp++ );
+ aBitmapColor.SetBlue( (sal_Int8)*pTemp++ );
+ rDesc.mpAcc->SetPixel( ny, nx, aBitmapColor );
+ }
+ }
+ }
+ }
+ break;
+ };
+ double nX = rDesc.mnR.X - rDesc.mnQ.X;
+ double nY = rDesc.mnR.Y - rDesc.mnQ.Y;
+
+ rDesc.mndy = sqrt( nX * nX + nY * nY );
+
+ nX = rDesc.mnR.X - rDesc.mnP.X;
+ nY = rDesc.mnR.Y - rDesc.mnP.Y;
+
+ rDesc.mndx = sqrt( nX * nX + nY * nY );
+
+ nX = rDesc.mnR.X - rDesc.mnP.X;
+ nY = rDesc.mnR.Y - rDesc.mnP.Y;
+
+ rDesc.mnOrientation = acos( nX / sqrt( nX * nX + nY * nY ) ) * 57.29577951308;
+ if ( nY > 0 )
+ rDesc.mnOrientation = 360 - rDesc.mnOrientation;
+
+ nX = rDesc.mnQ.X - rDesc.mnR.X;
+ nY = rDesc.mnQ.Y - rDesc.mnR.Y;
+
+ double fAngle = 0.01745329251994 * ( 360 - rDesc.mnOrientation );
+ double fSin = sin(fAngle);
+ double fCos = cos(fAngle);
+ nX = fCos * nX + fSin * nY;
+ nY = -( fSin * nX - fCos * nY );
+
+ fAngle = acos( nX / sqrt( nX * nX + nY * nY ) ) * 57.29577951308;
+ if ( nY > 0 )
+ fAngle = 360 - fAngle;
+
+ if ( fAngle > 180 ) // wird das bild nach oben oder unten aufgebaut ?
+ {
+ rDesc.mnOrigin = rDesc.mnP;
+ }
+ else
+ {
+ rDesc.mbVMirror = sal_True;
+ rDesc.mnOrigin = rDesc.mnP;
+ rDesc.mnOrigin.X += rDesc.mnQ.X - rDesc.mnR.X;
+ rDesc.mnOrigin.Y += rDesc.mnQ.Y - rDesc.mnR.Y;
+ }
+ }
+ else
+ rDesc.mbStatus = sal_False;
+ }
+ else
+ rDesc.mbStatus = sal_False;
+ }
+ else
+ rDesc.mbStatus = sal_False;
+
+ if ( rDesc.mpAcc )
+ {
+ rDesc.mpBitmap->ReleaseAccess( rDesc.mpAcc );
+ rDesc.mpAcc = NULL;
+ }
+ if ( rDesc.mbStatus == sal_False )
+ {
+ if ( rDesc.mpBitmap )
+ {
+ delete rDesc.mpBitmap;
+ rDesc.mpBitmap = NULL;
+ }
+ }
+}
+
+// ---------------------------------------------------------------
+
+void CGMBitmap::ImplSetCurrentPalette( CGMBitmapDescriptor& rDesc )
+{
+ sal_uInt16 nColors = sal::static_int_cast< sal_uInt16 >(
+ 1 << rDesc.mnDstBitsPerPixel);
+ rDesc.mpAcc->SetPaletteEntryCount( nColors );
+ for ( sal_uInt16 i = 0; i < nColors; i++ )
+ {
+ rDesc.mpAcc->SetPaletteColor( i, BMCOL( mpCGM->pElement->aLatestColorTable[ i ] ) );
+ }
+}
+
+// ---------------------------------------------------------------
+
+sal_Bool CGMBitmap::ImplGetDimensions( CGMBitmapDescriptor& rDesc )
+{
+ mpCGM->ImplGetPoint( rDesc.mnP ); // parallelogram p < - > r
+ mpCGM->ImplGetPoint( rDesc.mnQ ); // |
+ mpCGM->ImplGetPoint( rDesc.mnR ); // q
+ sal_uInt32 nPrecision = mpCGM->pElement->nIntegerPrecision;
+ rDesc.mnX = mpCGM->ImplGetUI( nPrecision );
+ rDesc.mnY = mpCGM->ImplGetUI( nPrecision );
+ rDesc.mnLocalColorPrecision = mpCGM->ImplGetI( nPrecision );
+ rDesc.mnScanSize = 0;
+ switch( rDesc.mnLocalColorPrecision )
+ {
+ case 0x80000001 : // monochrome ( bit = 0->backgroundcolor )
+ case 0 : // bit = 1->fillcolor
+ rDesc.mnDstBitsPerPixel = 1;
+ break;
+ case 1 : // 2 color indexed ( monochrome )
+ case -1 :
+ rDesc.mnDstBitsPerPixel = 1;
+ break;
+ case 2 : // 4 color indexed
+ case -2 :
+ rDesc.mnDstBitsPerPixel = 2;
+ break;
+ case 4 : // 16 color indexed
+ case -4 :
+ rDesc.mnDstBitsPerPixel = 4;
+ break;
+ case 8 : // 256 color indexed
+ case -8 :
+ rDesc.mnDstBitsPerPixel = 8;
+ rDesc.mnScanSize = rDesc.mnX;
+ break;
+ case 16 : // NS
+ case -16 :
+ rDesc.mbStatus = sal_False;
+ break;
+ case 24 : // 24 bit directColor ( 8 bits each component )
+ case -24 :
+ rDesc.mnDstBitsPerPixel = 24;
+ break;
+ case 32 : // NS
+ case -32 :
+ rDesc.mbStatus = sal_False;
+ break;
+
+ }
+ // mnCompressionMode == 0 : CCOMP_RUNLENGTH
+ // == 1 : CCOMP_PACKED ( no compression. each row starts on a 4 byte boundary )
+ if ( ( rDesc.mnCompressionMode = mpCGM->ImplGetUI16() ) != 1 )
+ rDesc.mbStatus = sal_False;
+
+ if ( ( rDesc.mnX || rDesc.mnY ) == 0 )
+ rDesc.mbStatus = sal_False;
+
+ sal_uInt32 nHeaderSize = 2 + 3 * nPrecision + 3 * mpCGM->ImplGetPointSize();
+ rDesc.mnScanSize = ( ( rDesc.mnX * rDesc.mnDstBitsPerPixel + 7 ) >> 3 );
+
+ sal_uInt32 nScanSize;
+ nScanSize = rDesc.mnScanSize;
+ if ( ( nScanSize * rDesc.mnY + nHeaderSize ) != mpCGM->mnElementSize ) // try a scansize without dw alignment
+ {
+ nScanSize = ( rDesc.mnScanSize + 1 ) & ~1;
+ if ( ( nScanSize * rDesc.mnY + nHeaderSize ) != mpCGM->mnElementSize ) // then we'll try word alignment
+ {
+ nScanSize = ( rDesc.mnScanSize + 3 ) & ~3;
+ if ( ( nScanSize * rDesc.mnY + nHeaderSize ) != mpCGM->mnElementSize ) // and last we'll try dword alignment
+ {
+ nScanSize = ( rDesc.mnScanSize + 1 ) & ~1; // and LAST BUT NOT LEAST we'll try word alignment without aligning the last line
+ if ( ( nScanSize * ( rDesc.mnY - 1 ) + rDesc.mnScanSize + nHeaderSize ) != mpCGM->mnElementSize )
+ {
+ nScanSize = ( rDesc.mnScanSize + 3 ) & ~3;
+ if ( ( nScanSize * ( rDesc.mnY - 1 ) + rDesc.mnScanSize + nHeaderSize ) != mpCGM->mnElementSize )
+ {
+ mpCGM->mnParaSize = 0; // this format is corrupt
+ rDesc.mbStatus = sal_False;
+ }
+ }
+ }
+ }
+ }
+ rDesc.mnScanSize = nScanSize;
+ if ( rDesc.mbStatus )
+ {
+ rDesc.mpBuf = mpCGM->mpSource + mpCGM->mnParaSize; // mpBuf now points to the first scanline
+ mpCGM->mnParaSize += rDesc.mnScanSize * rDesc.mnY;
+ }
+ return rDesc.mbStatus;
+}
+
+// ---------------------------------------------------------------
+
+void CGMBitmap::ImplInsert( CGMBitmapDescriptor& rSource, CGMBitmapDescriptor& rDest )
+{
+ if ( ( rSource.mnR.Y == rDest.mnQ.Y ) && ( rSource.mnR.X == rDest.mnQ.X ) )
+ { // Insert on Bottom
+ if ( mpCGM->mnVDCYmul == -1 )
+ rDest.mnOrigin = rSource.mnOrigin; // neuer origin
+ rDest.mpBitmap->Expand( 0, rSource.mnY );
+ rDest.mpBitmap->CopyPixel( Rectangle( Point( 0, rDest.mnY ), Size( rSource.mnX, rSource.mnY ) ),
+ Rectangle( Point( 0, 0 ), Size( rSource.mnX, rSource.mnY ) ), rSource.mpBitmap );
+ FloatPoint aFloatPoint;
+ aFloatPoint.X = rSource.mnQ.X - rSource.mnR.X;
+ aFloatPoint.Y = rSource.mnQ.Y - rSource.mnR.Y;
+ rDest.mnQ.X += aFloatPoint.X;
+ rDest.mnQ.Y += aFloatPoint.Y;
+ rDest.mnP = rSource.mnP;
+ rDest.mnR = rSource.mnR;
+ }
+ else
+ { // Insert on Top
+ if ( mpCGM->mnVDCYmul == 1 )
+ rDest.mnOrigin = rSource.mnOrigin; // neuer origin
+ rDest.mpBitmap->Expand( 0, rSource.mnY );
+ rDest.mpBitmap->CopyPixel( Rectangle( Point( 0, rDest.mnY ), Size( rSource.mnX, rSource.mnY ) ),
+ Rectangle( Point( 0, 0 ), Size( rSource.mnX, rSource.mnY ) ), rSource.mpBitmap );
+ rDest.mnP = rSource.mnP;
+ rDest.mnR = rSource.mnR;
+ }
+ rDest.mnY += rSource.mnY;
+ rDest.mndy += rSource.mndy;
+};
+
+// ---------------------------------------------------------------
+
+CGMBitmap* CGMBitmap::GetNext()
+{
+ if ( pCGMBitmapDescriptor->mpBitmap && pCGMBitmapDescriptor->mbStatus )
+ {
+ CGMBitmap* pCGMTempBitmap = new CGMBitmap( *mpCGM );
+ if ( pCGMTempBitmap )
+ {
+ if ( ( (long)pCGMTempBitmap->pCGMBitmapDescriptor->mnOrientation == (long)pCGMBitmapDescriptor->mnOrientation ) &&
+ ( ( ( pCGMTempBitmap->pCGMBitmapDescriptor->mnR.X == pCGMBitmapDescriptor->mnQ.X ) &&
+ ( pCGMTempBitmap->pCGMBitmapDescriptor->mnR.Y == pCGMBitmapDescriptor->mnQ.Y ) ) ||
+ ( ( pCGMTempBitmap->pCGMBitmapDescriptor->mnQ.X == pCGMBitmapDescriptor->mnR.X ) &&
+ ( pCGMTempBitmap->pCGMBitmapDescriptor->mnQ.Y == pCGMBitmapDescriptor->mnR.Y ) ) ) )
+ {
+ ImplInsert( *(pCGMTempBitmap->pCGMBitmapDescriptor), *(pCGMBitmapDescriptor) );
+ delete pCGMTempBitmap;
+ return NULL;
+ }
+ else // we'll replace the pointers and return the old one
+ {
+ CGMBitmapDescriptor* pTempBD = pCGMBitmapDescriptor;
+ pCGMBitmapDescriptor = pCGMTempBitmap->pCGMBitmapDescriptor;
+ pCGMTempBitmap->pCGMBitmapDescriptor = pTempBD;
+ return pCGMTempBitmap;
+ }
+ }
+ return NULL;
+ }
+ else
+ return NULL;
+}
+
+// ---------------------------------------------------------------
+
+CGMBitmapDescriptor* CGMBitmap::GetBitmap()
+{
+ return pCGMBitmapDescriptor;
+}
+
diff --git a/filter/source/graphicfilter/icgm/bitmap.hxx b/filter/source/graphicfilter/icgm/bitmap.hxx
new file mode 100644
index 000000000000..151c668f5d36
--- /dev/null
+++ b/filter/source/graphicfilter/icgm/bitmap.hxx
@@ -0,0 +1,87 @@
+/*************************************************************************
+ *
+ * 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 CGM_BITMAP_HXX_
+#define CGM_BITMAP_HXX_
+
+#include "cgm.hxx"
+#include <vcl/bmpacc.hxx>
+
+class CGM;
+
+class CGMBitmapDescriptor
+{
+ public:
+ sal_uInt8* mpBuf;
+ Bitmap* mpBitmap;
+ BitmapWriteAccess* mpAcc;
+ sal_Bool mbStatus;
+ sal_Bool mbVMirror;
+ sal_Bool mbHMirror;
+ sal_uInt32 mnDstBitsPerPixel;
+ sal_uInt32 mnScanSize; // bytes per line
+ FloatPoint mnP, mnQ, mnR;
+
+ FloatPoint mnOrigin;
+ double mndx, mndy;
+ double mnOrientation;
+
+ sal_uInt32 mnX, mnY;
+ long mnLocalColorPrecision;
+ sal_uInt32 mnCompressionMode;
+ CGMBitmapDescriptor() :
+ mpBuf ( NULL ),
+ mpBitmap ( NULL ),
+ mpAcc ( NULL ),
+ mbStatus ( sal_False ),
+ mbVMirror ( sal_False ),
+ mbHMirror ( sal_False ) { };
+ ~CGMBitmapDescriptor()
+ {
+ if ( mpAcc )
+ mpBitmap->ReleaseAccess( mpAcc );
+ if ( mpBitmap )
+ delete mpBitmap;
+ };
+};
+
+class CGMBitmap
+{
+ CGM* mpCGM;
+ CGMBitmapDescriptor* pCGMBitmapDescriptor;
+ sal_Bool ImplGetDimensions( CGMBitmapDescriptor& );
+ void ImplSetCurrentPalette( CGMBitmapDescriptor& );
+ void ImplGetBitmap( CGMBitmapDescriptor& );
+ void ImplInsert( CGMBitmapDescriptor& rSource, CGMBitmapDescriptor& rDest );
+ public:
+ CGMBitmap( CGM& rCGM );
+ ~CGMBitmap();
+ CGMBitmapDescriptor* GetBitmap();
+ CGMBitmap* GetNext();
+};
+#endif
+
diff --git a/filter/source/graphicfilter/icgm/bundles.cxx b/filter/source/graphicfilter/icgm/bundles.cxx
new file mode 100644
index 000000000000..f948f6549115
--- /dev/null
+++ b/filter/source/graphicfilter/icgm/bundles.cxx
@@ -0,0 +1,288 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include "bundles.hxx"
+
+#include <vcl/salbtype.hxx>
+#include <tools/stream.hxx>
+#include <tools/list.hxx>
+
+Bundle& Bundle::operator=( Bundle& rSource )
+{
+ mnColor = rSource.mnColor;
+ mnBundleIndex = rSource.mnBundleIndex;
+ return *this;
+};
+
+// ---------------------------------------------------------------
+
+void Bundle::SetColor( sal_uInt32 nColor )
+{
+ mnColor = nColor;
+}
+
+sal_uInt32 Bundle::GetColor()
+{
+ return mnColor;
+}
+
+// ---------------------------------------------------------------
+
+LineBundle& LineBundle::operator=( LineBundle& rSource )
+{
+ SetIndex( rSource.GetIndex() );
+ eLineType = rSource.eLineType;
+ nLineWidth = rSource.nLineWidth;
+ return *this;
+};
+
+MarkerBundle& MarkerBundle::operator=( MarkerBundle& rSource )
+{
+ SetIndex( rSource.GetIndex() );
+ eMarkerType = rSource.eMarkerType;
+ nMarkerSize = rSource.nMarkerSize;
+ return *this;
+};
+
+EdgeBundle& EdgeBundle::operator=( EdgeBundle& rSource )
+{
+ SetIndex( rSource.GetIndex() );
+ eEdgeType = rSource.eEdgeType;
+ nEdgeWidth = rSource.nEdgeWidth;
+ return *this;
+};
+
+TextBundle& TextBundle::operator=( TextBundle& rSource )
+{
+ SetIndex( rSource.GetIndex() );
+ nTextFontIndex = rSource.nTextFontIndex;
+ eTextPrecision = rSource.eTextPrecision;
+ nCharacterExpansion = rSource.nCharacterExpansion;
+ nCharacterSpacing = rSource.nCharacterSpacing;
+ return *this;
+};
+
+FillBundle& FillBundle::operator=( FillBundle& rSource )
+{
+ SetIndex( rSource.GetIndex() );
+ eFillInteriorStyle = rSource.eFillInteriorStyle;
+ nFillPatternIndex = rSource.nFillPatternIndex;
+ nFillHatchIndex = rSource.nFillHatchIndex;
+ return *this;
+};
+
+// ---------------------------------------------------------------
+
+FontEntry::FontEntry() :
+ pFontName ( NULL ),
+ eCharSetType ( CST_CCOMPLETE ),
+ pCharSetValue ( NULL ),
+ nFontType ( 0 )
+{
+}
+
+FontEntry::~FontEntry()
+{
+ delete pFontName;
+ delete pCharSetValue;
+}
+
+// ---------------------------------------------------------------
+
+CGMFList::CGMFList() :
+ nFontNameCount ( 0 ),
+ nCharSetCount ( 0 ),
+ nFontsAvailable ( 0 )
+{
+ aFontEntryList.Clear();
+}
+
+CGMFList::~CGMFList()
+{
+ ImplDeleteList();
+}
+
+// ---------------------------------------------------------------
+
+CGMFList& CGMFList::operator=( CGMFList& rSource )
+{
+ ImplDeleteList();
+ nFontsAvailable = rSource.nFontsAvailable;
+ nFontNameCount = rSource.nFontNameCount;
+ nCharSetCount = rSource.nCharSetCount;
+ FontEntry* pPtr = (FontEntry*)rSource.aFontEntryList.First();
+ while( pPtr )
+ {
+ FontEntry* pCFontEntry = new FontEntry;
+ if ( pPtr->pFontName )
+ {
+ sal_uInt32 nSize = strlen( (const char*)pPtr->pFontName ) + 1;
+ pCFontEntry->pFontName = new sal_Int8[ nSize ];
+ memcpy( pCFontEntry->pFontName, pPtr->pFontName, nSize );
+ }
+ if ( pPtr->pCharSetValue )
+ {
+ sal_uInt32 nSize = strlen( (const char*)pPtr->pCharSetValue ) + 1;
+ pCFontEntry->pCharSetValue = new sal_Int8[ nSize ];
+ memcpy( pCFontEntry->pCharSetValue, pPtr->pCharSetValue, nSize );
+ }
+ pCFontEntry->eCharSetType = pPtr->eCharSetType;
+ pCFontEntry->nFontType = pPtr->nFontType;
+ aFontEntryList.Insert( pCFontEntry, LIST_APPEND );
+ pPtr = (FontEntry*)rSource.aFontEntryList.Next();
+ }
+ return *this;
+}
+
+// ---------------------------------------------------------------
+
+FontEntry* CGMFList::GetFontEntry( sal_uInt32 nIndex )
+{
+ sal_uInt32 nInd = nIndex;
+ if ( nInd )
+ nInd--;
+ return (FontEntry*)aFontEntryList.GetObject( nInd );
+}
+
+// ---------------------------------------------------------------
+
+static sal_Int8* ImplSearchEntry( sal_Int8* pSource, sal_Int8* pDest, sal_uInt32 nComp, sal_uInt32 nSize )
+{
+ while ( nComp-- >= nSize )
+ {
+ sal_uInt32 i;
+ for ( i = 0; i < nSize; i++ )
+ {
+ if ( ( pSource[i]&~0x20 ) != ( pDest[i]&~0x20 ) )
+ break;
+ }
+ if ( i == nSize )
+ return pSource;
+ pSource++;
+ }
+ return NULL;
+}
+
+void CGMFList::InsertName( sal_uInt8* pSource, sal_uInt32 nSize )
+{
+ FontEntry* pFontEntry;
+ if ( nFontsAvailable == nFontNameCount )
+ {
+ nFontsAvailable++;
+ pFontEntry = new FontEntry;
+ aFontEntryList.Insert( pFontEntry, LIST_APPEND );
+ }
+ else
+ {
+ pFontEntry = (FontEntry*)aFontEntryList.GetObject( nFontNameCount );
+ }
+ nFontNameCount++;
+ sal_Int8* pBuf = new sal_Int8[ nSize ];
+ memcpy( pBuf, pSource, nSize );
+ sal_Int8* pFound = ImplSearchEntry( pBuf, (sal_Int8*)"ITALIC", nSize, 6 );
+ if ( pFound )
+ {
+ pFontEntry->nFontType |= 1;
+ sal_uInt32 nPrev = ( pFound - pBuf );
+ sal_uInt32 nToCopyOfs = 6;
+ if ( nPrev && ( pFound[ -1 ] == '-' || pFound[ -1 ] == ' ' ) )
+ {
+ nPrev--;
+ pFound--;
+ nToCopyOfs++;
+ }
+ sal_uInt32 nToCopy = nSize - nToCopyOfs - nPrev;
+ if ( nToCopy )
+ {
+ memcpy( pFound, pFound + nToCopyOfs, nToCopy );
+ }
+ nSize -= nToCopyOfs;
+ }
+ pFound = ImplSearchEntry( pBuf, (sal_Int8*)"BOLD", nSize, 4 );
+ if ( pFound )
+ {
+ pFontEntry->nFontType |= 2;
+
+ sal_uInt32 nPrev = ( pFound - pBuf );
+ sal_uInt32 nToCopyOfs = 4;
+ if ( nPrev && ( pFound[ -1 ] == '-' || pFound[ -1 ] == ' ' ) )
+ {
+ nPrev--;
+ pFound--;
+ nToCopyOfs++;
+ }
+ sal_uInt32 nToCopy = nSize - nToCopyOfs - nPrev;
+ if ( nToCopy )
+ {
+ memcpy( pFound, pFound + nToCopyOfs, nToCopy );
+ }
+ nSize -= nToCopyOfs;
+ }
+ pFontEntry->pFontName = new sal_Int8[ nSize + 1 ];
+ pFontEntry->pFontName[ nSize ] = 0;
+ memcpy( pFontEntry->pFontName, pBuf, nSize );
+ delete[] pBuf;
+}
+
+//--------------------------------------------------------------------------
+
+void CGMFList::InsertCharSet( CharSetType eCharSetType, sal_uInt8* pSource, sal_uInt32 nSize )
+{
+ FontEntry* pFontEntry;
+ if ( nFontsAvailable == nCharSetCount )
+ {
+ nFontsAvailable++;
+ pFontEntry = new FontEntry;
+ aFontEntryList.Insert( pFontEntry, LIST_APPEND );
+ }
+ else
+ {
+ pFontEntry = (FontEntry*)aFontEntryList.GetObject( nCharSetCount );
+ }
+ nCharSetCount++;
+ pFontEntry->eCharSetType = eCharSetType;
+ pFontEntry->pCharSetValue = new sal_Int8[ nSize + 1 ];
+ pFontEntry->pCharSetValue[ nSize ] = 0;
+ memcpy( pFontEntry->pCharSetValue, pSource , nSize );
+}
+
+// ---------------------------------------------------------------
+
+void CGMFList::ImplDeleteList()
+{
+ FontEntry* pFontEntry = (FontEntry*)aFontEntryList.First();
+ while( pFontEntry )
+ {
+ delete pFontEntry;
+ pFontEntry = (FontEntry*)aFontEntryList.Next();
+ }
+ aFontEntryList.Clear();
+}
+
diff --git a/filter/source/graphicfilter/icgm/bundles.hxx b/filter/source/graphicfilter/icgm/bundles.hxx
new file mode 100644
index 000000000000..5185553055cb
--- /dev/null
+++ b/filter/source/graphicfilter/icgm/bundles.hxx
@@ -0,0 +1,173 @@
+/*************************************************************************
+ *
+ * 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 CGM_BUNDLES_HXX_
+#define CGM_BUNDLES_HXX_
+
+#include <sal/types.h>
+#include "cgmtypes.hxx"
+#include <tools/list.hxx>
+#include <vcl/salbtype.hxx>
+
+// ---------------------------------------------------------------
+
+class CGM;
+
+class Bundle
+{
+
+ long mnBundleIndex;
+ sal_uInt32 mnColor;
+
+public:
+ void SetColor( sal_uInt32 nColor ) ;
+ sal_uInt32 GetColor() ;
+ long GetIndex() const { return mnBundleIndex; } ;
+ void SetIndex( long nBundleIndex ) { mnBundleIndex = nBundleIndex; } ;
+
+ Bundle() {};
+ virtual Bundle* Clone() { return new Bundle( *this ); };
+ Bundle& operator=( Bundle& rBundle );
+
+ virtual ~Bundle() {} ;
+};
+
+// ---------------------------------------------------------------
+
+class LineBundle : public Bundle
+{
+public:
+
+ LineType eLineType;
+ double nLineWidth;
+
+ LineBundle() {};
+ virtual Bundle* Clone() { return new LineBundle( *this ); };
+ LineBundle& operator=( LineBundle& rLineBundle );
+ virtual ~LineBundle() {};
+};
+
+// ---------------------------------------------------------------
+
+class MarkerBundle : public Bundle
+{
+public:
+
+ MarkerType eMarkerType;
+ double nMarkerSize;
+
+ MarkerBundle() {};
+ virtual Bundle* Clone() { return new MarkerBundle( *this ); } ;
+ MarkerBundle& operator=( MarkerBundle& rMarkerBundle );
+ virtual ~MarkerBundle() {};
+};
+
+// ---------------------------------------------------------------
+
+class EdgeBundle : public Bundle
+{
+public:
+
+ EdgeType eEdgeType;
+ double nEdgeWidth;
+
+ EdgeBundle() {};
+ virtual Bundle* Clone() { return new EdgeBundle( *this ); } ;
+ EdgeBundle& operator=( EdgeBundle& rEdgeBundle );
+ virtual ~EdgeBundle() {};
+};
+
+// ---------------------------------------------------------------
+
+class TextBundle : public Bundle
+{
+public:
+
+ sal_uInt32 nTextFontIndex;
+ TextPrecision eTextPrecision;
+ double nCharacterExpansion;
+ double nCharacterSpacing;
+
+ TextBundle() {};
+ virtual Bundle* Clone() { return new TextBundle( *this ); } ;
+ TextBundle& operator=( TextBundle& rTextBundle );
+ virtual ~TextBundle() {};
+};
+
+// ---------------------------------------------------------------
+
+class FillBundle : public Bundle
+{
+public:
+
+ FillInteriorStyle eFillInteriorStyle;
+ long nFillPatternIndex;
+ long nFillHatchIndex;
+
+ FillBundle() {};
+ virtual Bundle* Clone() { return new FillBundle( *this ); } ;
+ FillBundle& operator=( FillBundle& rFillBundle );
+ virtual ~FillBundle() {};
+};
+
+
+// ---------------------------------------------------------------
+
+class FontEntry
+{
+public:
+ sal_Int8* pFontName;
+ CharSetType eCharSetType;
+ sal_Int8* pCharSetValue;
+ sal_uInt32 nFontType; // bit 0 = 1 -> Italic,
+ // bit 1 = 1 -> Bold
+
+ FontEntry();
+ FontEntry* Clone() { return new FontEntry( *this ); } ;
+ ~FontEntry();
+};
+
+// ---------------------------------------------------------------
+
+class CGMFList
+{
+ sal_uInt32 nFontNameCount;
+ sal_uInt32 nCharSetCount;
+ List aFontEntryList;
+ void ImplDeleteList();
+public:
+ sal_uInt32 nFontsAvailable;
+ FontEntry* GetFontEntry( sal_uInt32 );
+ void InsertName( sal_uInt8* pSource, sal_uInt32 nSize );
+ void InsertCharSet( CharSetType, sal_uInt8* pSource, sal_uInt32 nSize );
+ CGMFList();
+ CGMFList& operator=( CGMFList& rFontList );
+ ~CGMFList();
+};
+
+
+#endif
diff --git a/filter/source/graphicfilter/icgm/cgm.cxx b/filter/source/graphicfilter/icgm/cgm.cxx
new file mode 100644
index 000000000000..ea474a160e36
--- /dev/null
+++ b/filter/source/graphicfilter/icgm/cgm.cxx
@@ -0,0 +1,927 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+#include <com/sun/star/task/XStatusIndicator.hpp>
+#include <unotools/ucbstreamhelper.hxx>
+
+#define CGM_BREAK_ACTION 0xffffffff
+#include <osl/endian.h>
+#include <vcl/virdev.hxx>
+#include <vcl/graph.hxx>
+#include <tools/stream.hxx>
+#include <chart.hxx>
+#include <main.hxx>
+#include <elements.hxx>
+#include <outact.hxx>
+
+using namespace ::com::sun::star;
+
+// ---------------------------------------------------------------
+
+void CGM::ImplCGMInit()
+{
+ mbIsFinished = mbPicture = mbMetaFile = mbPictureBody = sal_False;
+
+ mnActCount = 0;
+ mnOutdx = 28000;
+ mnOutdy = 21000;
+
+ mpBuf = NULL;
+ mpChart = NULL;
+ mpBitmapInUse = NULL;
+
+ pCopyOfE = new CGMElements( *this );
+ pElement = new CGMElements( *this );
+}
+
+// ---------------------------------------------------------------
+
+#ifdef CGM_EXPORT_IMPRESS
+
+CGM::CGM( sal_uInt32 nMode, uno::Reference< frame::XModel > & rModel ) :
+ mpGraphic ( NULL ),
+ mpCommentOut ( NULL ),
+ mbStatus ( sal_True ),
+ mpOutAct ( new CGMImpressOutAct( *this, rModel ) ),
+ mnMode ( nMode )
+{
+ mnMode |= CGM_EXPORT_IMPRESS;
+ ImplCGMInit();
+}
+#endif
+
+// ---------------------------------------------------------------
+
+void CGM::ImplComment( sal_uInt32 Level, const char* Description )
+{
+ if ( mpCommentOut )
+ {
+ if ( Level == CGM_DESCRIPTION )
+ {
+ *mpCommentOut << " " << Description << "\n";
+ }
+ else
+ {
+ sal_Int8 nFirst, nSecond, i, nCount = 0;
+ if ( mnActCount < 10000 )
+ nCount++;
+ if ( mnActCount < 1000 )
+ nCount++;
+ if ( mnActCount < 100 )
+ nCount++;
+ if ( mnActCount < 10 )
+ nCount++;
+ for ( i = 0; i <= nCount; i++ )
+ *mpCommentOut << " ";
+ mpCommentOut->WriteNumber( mnActCount );
+
+ switch( Level & 0xff )
+ {
+ case CGM_UNKNOWN_LEVEL :
+ *mpCommentOut << " L?";
+ break;
+ case CGM_UNKNOWN_COMMAND :
+ *mpCommentOut << " UNKNOWN COMMAND";
+ break;
+ case CGM_GDSF_ONLY :
+ *mpCommentOut << " LI";
+ break;
+ default:
+ *mpCommentOut << " L";
+ mpCommentOut->WriteNumber( Level & 0xff );
+ break;
+ }
+ *mpCommentOut << " C";
+ mpCommentOut->WriteNumber( mnElementClass );
+ *mpCommentOut << " ID-0x";
+ nFirst = ( mnElementID > 0x9F ) ? (sal_Int8)( mnElementID >> 4 ) + 'A' - 10: (sal_Int8)( mnElementID >> 4 ) + '0';
+ nSecond = ( ( mnElementID & 15 ) > 9 ) ? (sal_Int8)( mnElementID & 15 ) + 'A' - 10 : (sal_Int8)( mnElementID & 15 ) + '0';
+ *mpCommentOut << nFirst << nSecond;
+ *mpCommentOut << " Size";
+ nCount = 1;
+ if ( mnElementSize < 1000000 )
+ nCount++;
+ if ( mnElementSize < 100000 )
+ nCount++;
+ if ( mnElementSize < 10000 )
+ nCount++;
+ if ( mnElementSize < 1000 )
+ nCount++;
+ if ( mnElementSize < 100 )
+ nCount++;
+ if ( mnElementSize < 10 )
+ nCount++;
+ for ( i = 0; i < nCount; i++ )
+ *mpCommentOut << " ";
+ mpCommentOut->WriteNumber( mnElementSize );
+ *mpCommentOut << " " << Description << "\n";
+ }
+ }
+}
+
+// ---------------------------------------------------------------
+
+CGM::~CGM()
+{
+
+#ifdef CGM_EXPORT_META
+ if ( mpGraphic )
+ {
+ mpGDIMetaFile->Stop();
+ mpGDIMetaFile->SetPrefMapMode( MapMode() );
+ mpGDIMetaFile->SetPrefSize( Size( static_cast< long >( mnOutdx ), static_cast< long >( mnOutdy ) ) );
+ delete mpVirDev;
+ *mpGraphic = Graphic( *mpGDIMetaFile );
+ }
+#endif
+ sal_Int8* pBuf = (sal_Int8*)maDefRepList.First();
+ while( pBuf )
+ {
+ delete pBuf;
+ pBuf = (sal_Int8*)maDefRepList.Next();
+ }
+ maDefRepList.Clear();
+ delete mpBitmapInUse;
+ delete mpCommentOut;
+ delete mpChart;
+ delete mpOutAct;
+ delete pCopyOfE;
+ delete pElement;
+ delete [] mpBuf;
+};
+
+// ---------------------------------------------------------------
+
+sal_uInt32 CGM::GetBackGroundColor()
+{
+ return ( pElement ) ? pElement->aColorTable[ 0 ] : 0;
+}
+
+// ---------------------------------------------------------------
+
+sal_uInt32 CGM::ImplGetUI16( sal_uInt32 /*nAlign*/ )
+{
+ sal_uInt8* pSource = mpSource + mnParaSize;
+ mnParaSize += 2;
+ return ( pSource[ 0 ] << 8 ) + pSource[ 1 ];
+};
+
+// ---------------------------------------------------------------
+
+sal_uInt8 CGM::ImplGetByte( sal_uInt32 nSource, sal_uInt32 nPrecision )
+{
+ return (sal_uInt8)( nSource >> ( ( nPrecision - 1 ) << 3 ) );
+};
+
+// ---------------------------------------------------------------
+
+long CGM::ImplGetI( sal_uInt32 nPrecision )
+{
+ sal_uInt8* pSource = mpSource + mnParaSize;
+ mnParaSize += nPrecision;
+ switch( nPrecision )
+ {
+ case 1 :
+ {
+ return (char)*pSource;
+ }
+
+ case 2 :
+ {
+ return (sal_Int16)( ( pSource[ 0 ] << 8 ) | pSource[ 1 ] );
+ }
+
+ case 3 :
+ {
+ return ( ( pSource[ 0 ] << 24 ) | ( pSource[ 1 ] << 16 ) | pSource[ 2 ] << 8 ) >> 8;
+ }
+ case 4:
+ {
+ return (sal_Int32)( ( pSource[ 0 ] << 24 ) | ( pSource[ 1 ] << 16 ) | ( pSource[ 2 ] << 8 ) | ( pSource[ 3 ] ) );
+ }
+ default:
+ mbStatus = sal_False;
+ return 0;
+ }
+}
+
+// ---------------------------------------------------------------
+
+sal_uInt32 CGM::ImplGetUI( sal_uInt32 nPrecision )
+{
+ sal_uInt8* pSource = mpSource + mnParaSize;
+ mnParaSize += nPrecision;
+ switch( nPrecision )
+ {
+ case 1 :
+ return (sal_Int8)*pSource;
+ case 2 :
+ {
+ return (sal_uInt16)( ( pSource[ 0 ] << 8 ) | pSource[ 1 ] );
+ }
+ case 3 :
+ {
+ return ( pSource[ 0 ] << 16 ) | ( pSource[ 1 ] << 8 ) | pSource[ 2 ];
+ }
+ case 4:
+ {
+ return (sal_uInt32)( ( pSource[ 0 ] << 24 ) | ( pSource[ 1 ] << 16 ) | ( pSource[ 2 ] << 8 ) | ( pSource[ 3 ] ) );
+ }
+ default:
+ mbStatus = sal_False;
+ return 0;
+ }
+}
+
+// ---------------------------------------------------------------
+
+void CGM::ImplGetSwitch4( sal_uInt8* pSource, sal_uInt8* pDest )
+{
+ for ( int i = 0; i < 4; i++ )
+ {
+ pDest[ i ] = pSource[ i ^ 3 ]; // Little Endian <-> Big Endian switch
+ }
+}
+
+// ---------------------------------------------------------------
+
+void CGM::ImplGetSwitch8( sal_uInt8* pSource, sal_uInt8* pDest )
+{
+ for ( int i = 0; i < 8; i++ )
+ {
+ pDest[ i ] = pSource[ i ^ 7 ]; // Little Endian <-> Big Endian switch
+ }
+}
+
+// ---------------------------------------------------------------
+
+double CGM::ImplGetFloat( RealPrecision eRealPrecision, sal_uInt32 nRealSize )
+{
+ void* pPtr;
+ sal_uInt8 aBuf[8];
+ sal_Bool bCompatible;
+ double nRetValue;
+ double fDoubleBuf;
+ float fFloatBuf;
+
+#ifdef OSL_BIGENDIAN
+ bCompatible = sal_True;
+#else
+ bCompatible = sal_False;
+#endif
+ if ( bCompatible )
+ pPtr = mpSource + mnParaSize;
+ else
+ {
+ if ( nRealSize == 4 )
+ ImplGetSwitch4( mpSource + mnParaSize, &aBuf[0] );
+ else
+ ImplGetSwitch8( mpSource + mnParaSize, &aBuf[0] );
+ pPtr = &aBuf;
+ }
+ if ( eRealPrecision == RP_FLOAT )
+ {
+ if ( nRealSize == 4 )
+ {
+ memcpy( (void*)&fFloatBuf, pPtr, 4 );
+ nRetValue = (double)fFloatBuf;
+ }
+ else
+ {
+ memcpy( (void*)&fDoubleBuf, pPtr, 8 );
+ nRetValue = fDoubleBuf;
+ }
+ }
+ else // ->RP_FIXED
+ {
+ long nVal;
+ int nSwitch = ( bCompatible ) ? 0 : 1 ;
+ if ( nRealSize == 4 )
+ {
+ sal_uInt16* pShort = (sal_uInt16*)pPtr;
+ nVal = pShort[ nSwitch ];
+ nVal <<= 16;
+ nVal |= pShort[ nSwitch ^ 1 ];
+ nRetValue = (double)nVal;
+ nRetValue /= 65536;
+ }
+ else
+ {
+ long* pLong = (long*)pPtr;
+ nRetValue = (double)abs( pLong[ nSwitch ] );
+ nRetValue *= 65536;
+ nVal = (sal_uInt32)( pLong[ nSwitch ^ 1 ] );
+ nVal >>= 16;
+ nRetValue += (double)nVal;
+ if ( pLong[ nSwitch ] < 0 )
+ {
+ nRetValue -= nRetValue;
+ }
+ nRetValue /= 65536;
+ }
+ }
+ mnParaSize += nRealSize;
+ return nRetValue;
+}
+
+// ---------------------------------------------------------------
+
+sal_uInt32 CGM::ImplGetPointSize()
+{
+ if ( pElement->eVDCType == VDC_INTEGER )
+ return pElement->nVDCIntegerPrecision << 1;
+ else
+ return pElement->nVDCRealSize << 1;
+}
+
+// ---------------------------------------------------------------
+
+inline double CGM::ImplGetIX()
+{
+ return ( ( ImplGetI( pElement->nVDCIntegerPrecision ) + mnVDCXadd ) * mnVDCXmul );
+}
+
+// ---------------------------------------------------------------
+
+inline double CGM::ImplGetFX()
+{
+ return ( ( ImplGetFloat( pElement->eVDCRealPrecision, pElement->nVDCRealSize ) + mnVDCXadd ) * mnVDCXmul );
+}
+
+// ---------------------------------------------------------------
+
+inline double CGM::ImplGetIY()
+{
+ return ( ( ImplGetI( pElement->nVDCIntegerPrecision ) + mnVDCYadd ) * mnVDCYmul );
+}
+
+// ---------------------------------------------------------------
+
+inline double CGM::ImplGetFY()
+{
+ return ( ( ImplGetFloat( pElement->eVDCRealPrecision, pElement->nVDCRealSize ) + mnVDCYadd ) * mnVDCYmul );
+}
+
+// ---------------------------------------------------------------
+
+void CGM::ImplGetPoint( FloatPoint& rFloatPoint, sal_Bool bMap )
+{
+ if ( pElement->eVDCType == VDC_INTEGER )
+ {
+ rFloatPoint.X = ImplGetIX();
+ rFloatPoint.Y = ImplGetIY();
+ }
+ else // ->floating points
+ {
+ rFloatPoint.X = ImplGetFX();
+ rFloatPoint.Y = ImplGetFY();
+ }
+ if ( bMap )
+ ImplMapPoint( rFloatPoint );
+}
+
+// ---------------------------------------------------------------
+
+void CGM::ImplGetRectangle( FloatRect& rFloatRect, sal_Bool bMap )
+{
+ if ( pElement->eVDCType == VDC_INTEGER )
+ {
+ rFloatRect.Left = ImplGetIX();
+ rFloatRect.Bottom = ImplGetIY();
+ rFloatRect.Right = ImplGetIX();
+ rFloatRect.Top = ImplGetIY();
+ }
+ else // ->floating points
+ {
+ rFloatRect.Left = ImplGetFX();
+ rFloatRect.Bottom = ImplGetFY();
+ rFloatRect.Right = ImplGetFX();
+ rFloatRect.Top = ImplGetFY();
+ }
+ if ( bMap )
+ {
+ ImplMapX( rFloatRect.Left );
+ ImplMapX( rFloatRect.Right );
+ ImplMapY( rFloatRect.Top );
+ ImplMapY( rFloatRect.Bottom );
+ rFloatRect.Justify();
+ }
+}
+
+// ---------------------------------------------------------------
+
+void CGM::ImplGetRectangleNS( FloatRect& rFloatRect )
+{
+ if ( pElement->eVDCType == VDC_INTEGER )
+ {
+ rFloatRect.Left = ImplGetI( pElement->nVDCIntegerPrecision );
+ rFloatRect.Bottom = ImplGetI( pElement->nVDCIntegerPrecision );
+ rFloatRect.Right = ImplGetI( pElement->nVDCIntegerPrecision );
+ rFloatRect.Top = ImplGetI( pElement->nVDCIntegerPrecision );
+ }
+ else // ->floating points
+ {
+ rFloatRect.Left = ImplGetFloat( pElement->eVDCRealPrecision, pElement->nVDCRealSize );
+ rFloatRect.Bottom = ImplGetFloat( pElement->eVDCRealPrecision, pElement->nVDCRealSize );
+ rFloatRect.Right = ImplGetFloat( pElement->eVDCRealPrecision, pElement->nVDCRealSize );
+ rFloatRect.Top = ImplGetFloat( pElement->eVDCRealPrecision, pElement->nVDCRealSize );
+ }
+}
+
+// ---------------------------------------------------------------
+
+sal_uInt32 CGM::ImplGetBitmapColor( sal_Bool bDirect )
+{
+ // the background color is always a direct color
+
+ sal_uInt32 nTmp;
+ if ( ( pElement->eColorSelectionMode == CSM_DIRECT ) || bDirect )
+ {
+ sal_uInt32 nColor = ImplGetByte( ImplGetUI( pElement->nColorPrecision ), 1 );
+ sal_uInt32 nDiff = pElement->nColorValueExtent[ 3 ] - pElement->nColorValueExtent[ 0 ] + 1;
+
+ if ( !nDiff )
+ nDiff++;
+ nColor = ( ( nColor - pElement->nColorValueExtent[ 0 ] ) << 8 ) / nDiff;
+ nTmp = nColor << 16 & 0xff0000;
+
+ nColor = ImplGetByte( ImplGetUI( pElement->nColorPrecision ), 1 );
+ nDiff = pElement->nColorValueExtent[ 4 ] - pElement->nColorValueExtent[ 1 ] + 1;
+ if ( !nDiff )
+ nDiff++;
+ nColor = ( ( nColor - pElement->nColorValueExtent[ 1 ] ) << 8 ) / nDiff;
+ nTmp |= nColor << 8 & 0xff00;
+
+ nColor = ImplGetByte( ImplGetUI( pElement->nColorPrecision ), 1 );
+ nDiff = pElement->nColorValueExtent[ 5 ] - pElement->nColorValueExtent[ 2 ] + 1;
+ if ( !nDiff )
+ nDiff++;
+ nColor = ( ( nColor - pElement->nColorValueExtent[ 2 ] ) << 8 ) / nDiff;
+ nTmp |= (sal_uInt8)nColor;
+ }
+ else
+ {
+ sal_uInt32 nIndex = ImplGetUI( pElement->nColorIndexPrecision );
+ nTmp = pElement->aColorTable[ (sal_uInt8)( nIndex ) ] ;
+ }
+ return nTmp;
+}
+
+// ---------------------------------------------------------------
+
+// call this function each time after the mapmode settings has been changed
+void CGM::ImplSetMapMode()
+{
+ int nAngReverse = 1;
+ mnVDCdx = pElement->aVDCExtent.Right - pElement->aVDCExtent.Left;
+
+ mnVDCXadd = -pElement->aVDCExtent.Left;
+ mnVDCXmul = 1;
+ if ( mnVDCdx < 0 )
+ {
+ nAngReverse ^= 1;
+ mnVDCdx = -mnVDCdx;
+ mnVDCXmul = -1;
+ }
+
+ mnVDCdy = pElement->aVDCExtent.Bottom - pElement->aVDCExtent.Top;
+ mnVDCYadd = -pElement->aVDCExtent.Top;
+ mnVDCYmul = 1;
+ if ( mnVDCdy < 0 )
+ {
+ nAngReverse ^= 1;
+ mnVDCdy = -mnVDCdy;
+ mnVDCYmul = -1;
+ }
+ if ( nAngReverse )
+ mbAngReverse = sal_True;
+ else
+ mbAngReverse = sal_False;
+
+ double fQuo1 = mnVDCdx / mnVDCdy;
+ double fQuo2 = mnOutdx / mnOutdy;
+ if ( fQuo2 < fQuo1 )
+ {
+ mnXFraction = mnOutdx / mnVDCdx;
+ mnYFraction = mnOutdy * ( fQuo2 / fQuo1 ) / mnVDCdy;
+ }
+ else
+ {
+ mnXFraction = mnOutdx * ( fQuo1 / fQuo2 ) / mnVDCdx;
+ mnYFraction = mnOutdy / mnVDCdy;
+ }
+}
+
+// ---------------------------------------------------------------
+
+void CGM::ImplMapDouble( double& nNumb )
+{
+ if ( pElement->eDeviceViewPortMap == DVPM_FORCED )
+ {
+ // point is 1mm * ScalingFactor
+ switch ( pElement->eDeviceViewPortMode )
+ {
+ case DVPM_FRACTION :
+ {
+ nNumb *= ( mnXFraction + mnYFraction ) / 2;
+ }
+ break;
+
+ case DVPM_METRIC :
+ {
+// nNumb *= ( 100 * pElement->nDeviceViewPortScale );
+ nNumb *= ( mnXFraction + mnYFraction ) / 2;
+ if ( pElement->nDeviceViewPortScale < 0 )
+ nNumb = -nNumb;
+ }
+ break;
+
+ case DVPM_DEVICE :
+ {
+
+ }
+ break;
+
+ default:
+
+ break;
+ }
+ }
+ else
+ {
+
+
+ }
+}
+
+// ---------------------------------------------------------------
+
+void CGM::ImplMapX( double& nNumb )
+{
+ if ( pElement->eDeviceViewPortMap == DVPM_FORCED )
+ {
+ // point is 1mm * ScalingFactor
+ switch ( pElement->eDeviceViewPortMode )
+ {
+ case DVPM_FRACTION :
+ {
+ nNumb *= mnXFraction;
+ }
+ break;
+
+ case DVPM_METRIC :
+ {
+// nNumb *= ( 100 * pElement->nDeviceViewPortScale );
+ nNumb *= mnXFraction;
+ if ( pElement->nDeviceViewPortScale < 0 )
+ nNumb = -nNumb;
+ }
+ break;
+
+ case DVPM_DEVICE :
+ {
+
+ }
+ break;
+
+ default:
+
+ break;
+ }
+ }
+ else
+ {
+
+
+ }
+}
+
+
+// ---------------------------------------------------------------
+
+void CGM::ImplMapY( double& nNumb )
+{
+ if ( pElement->eDeviceViewPortMap == DVPM_FORCED )
+ {
+ // point is 1mm * ScalingFactor
+ switch ( pElement->eDeviceViewPortMode )
+ {
+ case DVPM_FRACTION :
+ {
+ nNumb *= mnYFraction;
+ }
+ break;
+
+ case DVPM_METRIC :
+ {
+// nNumb *= ( 100 * pElement->nDeviceViewPortScale );
+ nNumb *= mnYFraction;
+ if ( pElement->nDeviceViewPortScale < 0 )
+ nNumb = -nNumb;
+ }
+ break;
+
+ case DVPM_DEVICE :
+ {
+
+ }
+ break;
+
+ default:
+
+ break;
+ }
+ }
+ else
+ {
+
+
+ }
+}
+
+
+// ---------------------------------------------------------------
+
+// convert a point to the current VC mapmode (1/100TH mm)
+void CGM::ImplMapPoint( FloatPoint& rFloatPoint )
+{
+ if ( pElement->eDeviceViewPortMap == DVPM_FORCED )
+ {
+ // point is 1mm * ScalingFactor
+ switch ( pElement->eDeviceViewPortMode )
+ {
+ case DVPM_FRACTION :
+ {
+ rFloatPoint.X *= mnXFraction;
+ rFloatPoint.Y *= mnYFraction;
+ }
+ break;
+
+ case DVPM_METRIC :
+ {
+ rFloatPoint.X *= mnXFraction;
+ rFloatPoint.Y *= mnYFraction;
+ if ( pElement->nDeviceViewPortScale < 0 )
+ {
+ rFloatPoint.X = -rFloatPoint.X;
+ rFloatPoint.Y = -rFloatPoint.Y;
+ }
+ }
+ break;
+
+ case DVPM_DEVICE :
+ {
+
+ }
+ break;
+
+ default:
+
+ break;
+ }
+ }
+ else
+ {
+
+
+ }
+}
+
+// ---------------------------------------------------------------
+
+void CGM::ImplDoClass()
+{
+#ifdef CGM_USER_BREAKPOINT
+#ifdef WNT
+ if ( mnActCount == CGM_BREAK_ACTION )
+ _asm int 0x3;
+#endif
+#endif
+ switch ( mnElementClass )
+ {
+ case 0 : ImplDoClass0(); break;
+ case 1 : ImplDoClass1(); break;
+ case 2 : ImplDoClass2(); break;
+ case 3 : ImplDoClass3(); break;
+ case 4 :
+ {
+ ImplDoClass4();
+ mnAct4PostReset = 0;
+ }
+ break;
+ case 5 : ImplDoClass5(); break;
+ case 6 : ImplDoClass6(); break;
+ case 7 : ImplDoClass7(); break;
+ case 8 : ImplDoClass8(); break;
+ case 9 : ImplDoClass9(); break;
+ case 15 :ImplDoClass15(); break;
+ default : ComOut( CGM_UNKNOWN_COMMAND, "" ); break;
+ }
+ mnActCount++;
+};
+
+// ---------------------------------------------------------------
+
+void CGM::ImplDefaultReplacement()
+{
+ sal_uInt8* pBuf = (sal_uInt8*)maDefRepList.First();
+ if ( pBuf )
+ {
+ sal_uInt32 nElementSize = (sal_uInt32)(sal_uIntPtr)maDefRepSizeList.First();
+ sal_uInt32 nOldEscape = mnEscape;
+ sal_uInt32 nOldElementClass = mnElementClass;
+ sal_uInt32 nOldElementID = mnElementID;
+ sal_uInt32 nOldElementSize = mnElementSize;
+ sal_uInt8* pOldBuf = mpSource;
+ while( pBuf )
+ {
+ sal_uInt32 nCount = 0;
+ while ( mbStatus && ( nCount < nElementSize ) )
+ {
+ mpSource = pBuf + nCount;
+ mnParaSize = 0;
+ mnEscape = ImplGetUI16();
+ mnElementClass = mnEscape >> 12;
+ mnElementID = ( mnEscape & 0x0fe0 ) >> 5;
+ mnElementSize = mnEscape & 0x1f;
+ if ( mnElementSize == 31 )
+ {
+ mnElementSize = ImplGetUI16();
+ }
+ nCount += mnParaSize;
+ mnParaSize = 0;
+ mpSource = pBuf + nCount;
+ if ( mnElementSize & 1 )
+ nCount++;
+ nCount += mnElementSize;
+ if ( ( mnElementClass != 1 ) || ( mnElementID != 0xc ) ) // rekursion hier nicht moeglich!!
+ ImplDoClass();
+ }
+ nElementSize = (sal_uInt32)(sal_uIntPtr)maDefRepSizeList.Next();
+ pBuf = (sal_uInt8*)maDefRepList.Next();
+ }
+ mnEscape = nOldEscape;
+ mnElementClass = nOldElementClass;
+ mnElementID = nOldElementID;
+ mnParaSize = mnElementSize = nOldElementSize;
+ mpSource = pOldBuf;
+ }
+}
+
+// ---------------------------------------------------------------
+
+sal_Bool CGM::Write( SvStream& rIStm )
+{
+ if ( !mpBuf )
+ mpBuf = new sal_uInt8[ 0xffff ];
+
+ mnParaSize = 0;
+ mpSource = mpBuf;
+ rIStm.Read( mpSource, 2 );
+ mnEscape = ImplGetUI16();
+ mnElementClass = mnEscape >> 12;
+ mnElementID = ( mnEscape & 0x0fe0 ) >> 5;
+ mnElementSize = mnEscape & 0x1f;
+
+ if ( mnElementSize == 31 )
+ {
+ rIStm.Read( mpSource + mnParaSize, 2 );
+ mnElementSize = ImplGetUI16();
+ }
+ mnParaSize = 0;
+ if ( mnElementSize )
+ rIStm.Read( mpSource + mnParaSize, mnElementSize );
+
+ if ( mnElementSize & 1 )
+ rIStm.SeekRel( 1 );
+ ImplDoClass();
+
+
+#ifdef CGM_USER_BREAKPOINT
+#ifdef WNT
+ if ( !mbStatus || mnParaSize && ( mnElementSize != mnParaSize ) )
+ _asm int 0x3;
+#endif
+#endif
+
+ return mbStatus;
+};
+
+// ---------------------------------------------------------------
+
+SvStream& operator>>( SvStream& rOStm, CGM& /*rCGM*/ )
+{
+
+ return rOStm;
+};
+
+// ---------------------------------------------------------------
+
+
+
+//================== GraphicImport - die exportierte Funktion ================
+
+extern "C" sal_uInt32 __LOADONCALLAPI ImportCGM( String& rFileName, uno::Reference< frame::XModel > & rXModel, sal_uInt32 nMode, void* pProgressBar )
+{
+
+ sal_uInt32 nStatus = 0; // retvalue == 0 -> ERROR
+ // == 0xffrrggbb -> background color in the lower 24 bits
+ sal_Bool bProgressBar = sal_False;
+
+ if( rXModel.is() )
+ {
+ CGM* pCGM= NULL;
+
+ try
+ {
+ pCGM = new CGM( nMode, rXModel );
+ if ( pCGM && pCGM->IsValid() )
+ {
+ if ( nMode & CGM_IMPORT_CGM )
+ {
+ SvStream* pIn = ::utl::UcbStreamHelper::CreateStream( rFileName, STREAM_READ );
+ if ( pIn )
+ {
+ pIn->SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN );
+ pIn->Seek( STREAM_SEEK_TO_END );
+ sal_uInt32 nInSize = pIn->Tell();
+ pIn->Seek( 0 );
+
+#ifdef CGM_EXPORT_IMPRESS
+ uno::Reference< task::XStatusIndicator > aXStatInd;
+ sal_uInt32 nNext = 0;
+ sal_uInt32 nAdd = nInSize / 20;
+ if ( pProgressBar )
+ aXStatInd = *(uno::Reference< task::XStatusIndicator > *)pProgressBar;
+ bProgressBar = aXStatInd.is();
+ if ( bProgressBar )
+ aXStatInd->start( rtl::OUString::createFromAscii("CGM Import"), nInSize );
+#endif
+
+ while ( pCGM->IsValid() && ( pIn->Tell() < nInSize ) && !pCGM->IsFinished() )
+ {
+
+#ifdef CGM_EXPORT_IMPRESS
+
+
+ if ( bProgressBar )
+ {
+ sal_uInt32 nCurrentPos = pIn->Tell();
+ if ( nCurrentPos >= nNext )
+ {
+ aXStatInd->setValue( nCurrentPos );
+ nNext = nCurrentPos + nAdd;
+ }
+ }
+#endif
+
+ if ( pCGM->Write( *pIn ) == sal_False )
+ break;
+ }
+ if ( pCGM->IsValid() )
+ {
+ nStatus = pCGM->GetBackGroundColor() | 0xff000000;
+ }
+#ifdef CGM_EXPORT_IMPRESS
+ if ( bProgressBar )
+ aXStatInd->end();
+#endif
+ delete pIn;
+ }
+ }
+ }
+ }
+ catch( ::com::sun::star::uno::Exception& )
+ {
+ nStatus = 0;
+ }
+ delete pCGM;
+ }
+ return nStatus;
+}
diff --git a/filter/source/graphicfilter/icgm/cgm.hxx b/filter/source/graphicfilter/icgm/cgm.hxx
new file mode 100644
index 000000000000..980fc93fb34e
--- /dev/null
+++ b/filter/source/graphicfilter/icgm/cgm.hxx
@@ -0,0 +1,178 @@
+/*************************************************************************
+ *
+ * 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 CGM_HXX_
+#define CGM_HXX_
+
+#include <com/sun/star/frame/XModel.hpp>
+
+// ---------------------------------------------------------------
+#undef CGM_USER_BREAKPOINT
+
+#define CGM_IMPORT_CGM 0x00000001
+
+#define CGM_EXPORT_IMPRESS 0x00000100
+#define CGM_EXPORT_META 0x00000200
+//#define CGM_EXPORT_COMMENT 0x00000400
+
+// ---------------------------------------------------------------
+
+#include <tools/solar.h>
+#include <rtl/ustring.hxx>
+#include <tools/list.hxx>
+#include "cgmtypes.hxx"
+
+// ---------------------------------------------------------------
+
+class List;
+class Bundle;
+class Graphic;
+class SvStream;
+class CGMChart;
+class CGMBitmap;
+class CGMOutAct;
+class CGMElements;
+class BitmapColor;
+class GDIMetaFile;
+class VirtualDevice;
+class CGMBitmapDescriptor;
+
+class CGM
+{
+ friend class CGMChart;
+ friend class CGMBitmap;
+ friend class CGMElements;
+ friend class CGMOutAct;
+ friend class CGMImpressOutAct;
+
+ double mnOutdx; // Ausgabe Groesse in 1/100TH mm
+ double mnOutdy; // auf das gemappt wird
+ double mnVDCXadd;
+ double mnVDCYadd;
+ double mnVDCXmul;
+ double mnVDCYmul;
+ double mnVDCdx;
+ double mnVDCdy;
+ double mnXFraction;
+ double mnYFraction;
+ sal_Bool mbAngReverse; // AngularDirection
+
+ Graphic* mpGraphic; // ifdef CGM_EXPORT_META
+ SvStream* mpCommentOut; // ifdef CGM_EXPORT_COMMENT
+
+ sal_Bool mbStatus;
+ sal_Bool mbMetaFile;
+ sal_Bool mbIsFinished;
+ sal_Bool mbPicture;
+ sal_Bool mbPictureBody;
+ sal_Bool mbFigure;
+ sal_Bool mbFirstOutPut;
+ sal_uInt32 mnAct4PostReset;
+ CGMBitmap* mpBitmapInUse;
+ CGMChart* mpChart; // if sal_True->"SHWSLIDEREC"
+ // otherwise "BEGINPIC" commands
+ // controlls page inserting
+ CGMElements* pElement;
+ CGMElements* pCopyOfE;
+ CGMOutAct* mpOutAct;
+ List maDefRepList;
+ List maDefRepSizeList;
+
+ sal_uInt8* mpSource; // source buffer that is not increased
+ // ( instead use mnParaCount to index )
+ sal_uInt32 mnParaSize; // actual parameter size which has been done so far
+ sal_uInt32 mnActCount; // increased by each action
+ sal_uInt8* mpBuf; // source stream operation -> then this is allocated for
+ // the temp input buffer
+
+ sal_uInt32 mnMode; // source description
+ sal_uInt32 mnEscape; //
+ sal_uInt32 mnElementClass; //
+ sal_uInt32 mnElementID; //
+ sal_uInt32 mnElementSize; // full parameter size for the latest action
+
+ void ImplCGMInit();
+ sal_uInt32 ImplGetUI16( sal_uInt32 nAlign = 0 );
+ sal_uInt8 ImplGetByte( sal_uInt32 nSource, sal_uInt32 nPrecision );
+ long ImplGetI( sal_uInt32 nPrecision );
+ sal_uInt32 ImplGetUI( sal_uInt32 nPrecision );
+ void ImplGetSwitch4( sal_uInt8* pSource, sal_uInt8* pDest );
+ void ImplGetSwitch8( sal_uInt8* pSource, sal_uInt8* pDest );
+ double ImplGetFloat( RealPrecision, sal_uInt32 nRealSize );
+ sal_uInt32 ImplGetBitmapColor( sal_Bool bDirectColor = sal_False );
+ void ImplSetMapMode();
+ void ImplMapDouble( double& );
+ void ImplMapX( double& );
+ void ImplMapY( double& );
+ void ImplMapPoint( FloatPoint& );
+ inline double ImplGetIY();
+ inline double ImplGetFY();
+ inline double ImplGetIX();
+ inline double ImplGetFX();
+ sal_uInt32 ImplGetPointSize();
+ void ImplGetPoint( FloatPoint& rFloatPoint, sal_Bool bMap = sal_False );
+ void ImplGetRectangle( FloatRect&, sal_Bool bMap = sal_False );
+ void ImplGetRectangleNS( FloatRect& );
+ void ImplGetVector( double* );
+ double ImplGetOrientation( FloatPoint& rCenter, FloatPoint& rPoint );
+ void ImplSwitchStartEndAngle( double& rStartAngle, double& rEndAngle );
+ sal_Bool ImplGetEllipse( FloatPoint& rCenter, FloatPoint& rRadius, double& rOrientation );
+
+ void ImplDefaultReplacement();
+ void ImplDoClass();
+ void ImplDoClass0();
+ void ImplDoClass1();
+ void ImplDoClass2();
+ void ImplDoClass3();
+ void ImplDoClass4();
+ void ImplDoClass5();
+ void ImplDoClass6();
+ void ImplDoClass7();
+ void ImplDoClass8();
+ void ImplDoClass9();
+ void ImplDoClass15();
+
+ public:
+
+ ~CGM();
+
+ CGM( sal_uInt32 nMode, ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & rModel );
+#ifdef CGM_EXPORT_META
+ VirtualDevice* mpVirDev;
+ GDIMetaFile* mpGDIMetaFile;
+#endif
+ void ImplComment( sal_uInt32, const char* );
+ sal_uInt32 GetBackGroundColor();
+ sal_Bool IsValid() { return mbStatus; };
+ sal_Bool IsFinished() { return mbIsFinished; };
+ sal_Bool Write( SvStream& rIStm );
+
+ friend SvStream& operator>>( SvStream& rOStm, CGM& rCGM );
+
+};
+#endif
+
diff --git a/filter/source/graphicfilter/icgm/cgmres.hrc b/filter/source/graphicfilter/icgm/cgmres.hrc
new file mode 100644
index 000000000000..420f1ff8fe1b
--- /dev/null
+++ b/filter/source/graphicfilter/icgm/cgmres.hrc
@@ -0,0 +1,28 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+#define MB_CGM 1
+#define MID_TEST 1
diff --git a/filter/source/graphicfilter/icgm/cgmtypes.hxx b/filter/source/graphicfilter/icgm/cgmtypes.hxx
new file mode 100644
index 000000000000..a3541d786e34
--- /dev/null
+++ b/filter/source/graphicfilter/icgm/cgmtypes.hxx
@@ -0,0 +1,145 @@
+/*************************************************************************
+ *
+ * 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 CGM_TYPES_HXX_
+#define CGM_TYPES_HXX_
+
+struct FloatPoint
+{
+ double X;
+ double Y;
+ FloatPoint(){};
+ FloatPoint( const double& rX, const double& rY ) { X = rX, Y = rY; };
+};
+
+struct FloatRect
+{
+ double Left;
+ double Top;
+ double Right;
+ double Bottom;
+ FloatRect(){};
+ FloatRect( const FloatPoint& rTopLeft, const FloatPoint& rBottomRight )
+ {
+ Left = rTopLeft.X;
+ Top = rTopLeft.Y;
+ Right = rBottomRight.X;
+ Bottom = rBottomRight.Y;
+ }
+ void Justify()
+ {
+ double fTemp;
+ if ( Left > Right )
+ {
+ fTemp = Left;
+ Left = Right;
+ Right = fTemp;
+ }
+ if ( Top > Bottom )
+ {
+ fTemp = Top;
+ Top = Bottom;
+ Bottom = fTemp;
+ }
+ }
+};
+
+struct HatchEntry
+{
+ int HatchStyle;
+ long HatchDistance;
+ long HatchAngle;
+};
+
+#define ASF_LINETYPE 0x00000001UL
+#define ASF_LINEWIDTH 0x00000002UL
+#define ASF_LINECOLOR 0x00000004UL
+#define ASF_MARKERTYPE 0x00000008UL
+#define ASF_MARKERSIZE 0x00000010UL
+#define ASF_MARKERCOLOR 0x00000020UL // NS
+#define ASF_FILLINTERIORSTYLE 0x00000040UL
+#define ASF_HATCHINDEX 0x00000080UL
+#define ASF_PATTERNINDEX 0x00000100UL
+#define ASF_BITMAPINDEX 0x00000200UL // NS
+#define ASF_FILLCOLOR 0x00000400UL
+#define ASF_EDGETYPE 0x00000800UL
+#define ASF_EDGEWIDTH 0x00001000UL
+#define ASF_EDGECOLOR 0x00002000UL
+#define ASF_TEXTFONTINDEX 0x00004000UL
+#define ASF_TEXTPRECISION 0x00008000UL
+#define ASF_CHARACTEREXPANSION 0x00010000UL
+#define ASF_CHARACTERSPACING 0x00020000UL
+#define ASF_TEXTCOLOR 0x00040000UL
+
+#define ACT4_GRADIENT_ACTION 0x00000001UL
+
+enum RealPrecision { RP_FLOAT = 0, RP_FIXED = 1 };
+
+enum ScalingMode { SM_ABSTRACT = 0, SM_METRIC = 1 };
+
+enum VDCType { VDC_INTEGER = 0, VDC_REAL = 1 };
+enum DeviceViewPortMode { DVPM_FRACTION = 0, DVPM_METRIC = 1, DVPM_DEVICE = 2 };
+enum DeviceViewPortMap { DVPM_NOT_FORCED = 0, DVPM_FORCED = 1 };
+enum DeviceViewPortMapH { DVPMH_LEFT = 0, DVPMH_CENTER = 1, CVPMH_RIGHT = 2 };
+enum DeviceViewPortMapV { DVPMV_BOTTOM = 0, DVPMV_CENTER = 1, DVPMV_TOP = 2 };
+
+enum ClipIndicator { CI_OFF = 0, CI_ON = 1 };
+
+enum ColorSelectionMode { CSM_INDEXED = 0, CSM_DIRECT = 1 };
+enum ColorModel { CM_RGB = 0, CM_CYMK = 1 };
+
+enum CharacterCodingA { CCA_BASIC_7 = 0, CCA_BASIC_8 = 1, CCA_EXT_7 = 2, CCA_EXT_8 = 3 };
+enum CharSetType { CST_CBYTE_94 = 0, CST_CBYTE_96 = 1, CST_MULT94 = 2, CST_MULT96 = 3, CST_CCOMPLETE = 4 };
+enum TextPrecision { TPR_STRING = 0, TPR_CHARACTER = 1, TPR_STROKE = 2, TPR_UNDEFINED = 0xffff };
+enum TextPath { TPR_RIGHT = 0, TPR_LEFT = 1, TPR_UP = 2, TPR_DOWN = 3 };
+enum TextAlignmentH { TAH_NORMAL = 0, TAH_LEFT = 1, TAH_CENTER = 2, TAH_RIGHT = 3, TAH_CONT = 4 };
+enum TextAlignmentV { TAV_NORMAL = 0, TAV_TOP = 1, TAV_CAP = 2, TAV_HALF = 3, TAV_BASE = 4, TAV_BOTTOM = 5, TAV_CONT = 6 };
+enum UnderlineMode { UM_OFF = 0, UM_LOW = 1, UM_HIGH = 2, UM_STRIKEOUT = 4, UM_OVERSCORE = 8 };
+enum FinalFlag { FF_NOT_FINAL = 0, FF_FINAL = 1 };
+
+enum LineType { LT_SOLID = 1, LT_DASH = 2, LT_DOT = 3, LT_DASHDOT = 4, LT_DASHDOTDOT = 5, // Standart
+ LT_NONE = -4, LT_DOTDOTSPACE = -3, LT_LONGDASH = -2, LT_DASHDASHDOT = -1 }; // GDSF Styles
+enum SpecMode { SM_ABSOLUTE = 0, SM_SCALED = 1 };
+enum LineCapType { LCT_BUTT = 0, LCT_ROUND = 1, LCT_SQUARE = 2, LCT_TRIANGLE = 3, LCT_ARROW = 4, LCT_NONE = -1 };
+enum LineJoinType { LJT_MITER = 0, LJT_ROUND = 1, LJT_BEVEL = 2, LJT_NONE = -1 };
+
+
+enum EdgeType { ET_SOLID = 1, ET_DASH = 2, ET_DOT = 3, ET_DASHDOT = 4, ET_DASHDOTDOT = 5, // Standart
+ ET_NONE = -4, ET_DOTDOTSPACE = -3, ET_LONGDASH = -2, ET_DASHDASHDOT = -1 }; // GDSF Styles
+enum EdgeVisibility { EV_OFF = 0, EV_ON = 1 };
+
+enum MarkerType { MT_POINT = 1, MT_PLUS = 2, MT_STAR = 3, MT_CIRCLE = 4, MT_CROSS = 5 };
+
+enum Transparency { T_OFF = 0, T_ON = 1 };
+
+enum FillInteriorStyle { FIS_HOLLOW = 0, FIS_SOLID = 1, FIS_PATTERN = 2, FIS_HATCH = 3, FIS_EMPTY = 4, FIS_GEOPATTERN = 5,
+ FIS_INTERPOLATED = 6, FIS_GRADIENT = 7 };
+
+
+
+
+#endif
diff --git a/filter/source/graphicfilter/icgm/chart.cxx b/filter/source/graphicfilter/icgm/chart.cxx
new file mode 100644
index 000000000000..f62c62028e11
--- /dev/null
+++ b/filter/source/graphicfilter/icgm/chart.cxx
@@ -0,0 +1,100 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include <main.hxx>
+#include <chart.hxx>
+
+// ---------------------------------------------------------------
+
+CGMChart::CGMChart( CGM& rCGM ) :
+ mpCGM ( &rCGM )
+{
+ for ( sal_Int8 i = 0; i < 7; i++ )
+ {
+ mDataNode[ i ].nBoxX1 = mDataNode[ i ].nBoxY1 = 0 ;
+ mDataNode[ i ].nBoxX2 = mDataNode[ i ].nBoxY2 = 0 ;
+
+ mDataNode[ i ].nZoneEnum = i;
+ }
+};
+
+// ---------------------------------------------------------------
+
+CGMChart::~CGMChart()
+{
+ // delete the whole textentry structure
+
+ TextEntry* pTextEntry;
+ while( ( pTextEntry = (TextEntry*)maTextEntryList.First() ) != NULL )
+ {
+ DeleteTextEntry( pTextEntry );
+ }
+};
+
+// ---------------------------------------------------------------
+
+void CGMChart::DeleteTextEntry( TextEntry* pTextEntry )
+{
+ if ( pTextEntry )
+ {
+ delete pTextEntry->pText;
+ for ( TextAttribute* pTAttr = pTextEntry->pAttribute; pTAttr != NULL ; )
+ {
+ TextAttribute* pTempTAttr = pTAttr;
+ pTAttr = pTAttr->pNextAttribute;
+ delete pTempTAttr;
+ }
+ delete pTextEntry;
+ maTextEntryList.Remove( pTextEntry );
+ }
+};
+
+// ---------------------------------------------------------------
+
+void CGMChart::InsertTextEntry( TextEntry* pTextEntry )
+{
+ maTextEntryList.Insert( pTextEntry );
+};
+
+// ---------------------------------------------------------------
+
+// ---------------------------------------------------------------
+void CGMChart::ResetAnnotation()
+{
+ mDataNode[ 0 ].nZoneEnum = 0;
+}
+
+// ---------------------------------------------------------------
+
+sal_Bool CGMChart::IsAnnotation()
+{
+ return ( mDataNode[ 0 ].nZoneEnum == 0 );
+};
+
diff --git a/filter/source/graphicfilter/icgm/chart.hxx b/filter/source/graphicfilter/icgm/chart.hxx
new file mode 100644
index 000000000000..b1b5e53d81eb
--- /dev/null
+++ b/filter/source/graphicfilter/icgm/chart.hxx
@@ -0,0 +1,214 @@
+/*************************************************************************
+ *
+ * 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 CGM_CHART_HXX_
+#define CGM_CHART_HXX_
+
+#include <tools/list.hxx>
+
+/* FILE TYPE CONSTANTS: */
+#define NOCHART 0 /* Undefined chart. */
+#define XYCHART 1 /* Standard XY chart. */
+#define PIECHART 21 /* Standard pie chart file. */
+#define ORGCHART 26 /* Standard org chart file. */
+#define TTLCHART 31 /* Title chart file. */
+#define BULCHART 32 /* Bullet chart file. */
+#define TABCHART 33 /* Table chart file. */
+#define DRWCHART 41 /* Chart with drawings only.*/
+#define MLTCHART 42 /* Multiple chart file. */
+#define LASTCHART 45 /* The largest chart type. */
+#define SHWFILE 46 /* Slide show file. */
+#define SYMFILE 47 /* Symbol file. */
+/* the following were added although SPC doesn't have a #define */
+/* for them... */
+#define AUTOTTLCHT 95 /* Autobuild TTL CHT */
+#define AUTOBULCHT 96 /* Autobuild BUL CHT */
+#define AUTOTABCHT 97 /* Autobuild TAB CHT */
+
+/* FNC 10/11/93: for the chart stream, ALLCHART was added. */
+/* It is used specifically by PPT in its Template to let */
+/* us know that the template applies to all charts, not to */
+/* one specific chart type. */
+#define ALLCHART 127 /* Applies to all chart types */
+#define ALLCHART_TPL 255 /* Applies to all chart types */
+
+#define IOC_CHTTITLE 1 /* Title for any chart. */
+#define IOC_CHTFOOTNOTE 2 /* ::com::sun::star::text::Footnote for any chart. */
+#define IOC_XYAXIS 3 /* Axis title for XY charts. */
+#define IOC_XYSERIESLEGEND 4 /* Series legend titles for XY charts. */
+#define IOC_PIETITLE 5 /* Title for pie charts. */
+#define IOC_TABLEBODY 6 /* Table chart text element. */
+#define IOC_TITLEBODY 7 /* Title chart text element. */
+#define IOC_BULLETBODY 8 /* Bullet chart text element. */
+#define IOC_XYLEGENDTITLE 9 /* Legend title for XY charts. */
+#define IOC_PIELEGENDTITLE 10 /* Legend title for pie charts. */
+#define IOC_TABLEGENDTITLE 11 /* Legend title for table charts. */
+
+typedef struct TextAttribute
+{
+ sal_uInt16 nTextAttribCount;
+ sal_Int8 nTextColorIndex;
+ sal_Int8 nTextColorRed;
+ sal_Int8 nTextColorGreen;
+ sal_Int8 nTextColorBlue;
+ sal_Int8 nShadowColorIndex;
+ sal_Int8 nShadowColorRed;
+ sal_Int8 nShadowColorGreen;
+ sal_Int8 nShadowColorBlue;
+ float nTextAttribSize;
+ sal_uInt16 nTextAttribBits;
+ sal_Int8 nTextFontType; // font identifiers
+ sal_Int8 nTextCharPage;
+ sal_uInt16 nTextFontFamily;
+ sal_Int8 nTextFontMemberID;
+ sal_Int8 nTextFontVendorID;
+ TextAttribute* pNextAttribute; // zero or pointer to next TextAttribute
+} TextAttribute;
+
+typedef struct TextEntry
+{
+ sal_uInt16 nTypeOfText;
+ sal_uInt16 nRowOrLineNum;
+ sal_uInt16 nColumnNum;
+ sal_uInt16 nZoneSize; // textzone attributes
+ sal_uInt16 nLineType;
+ sal_uInt16 nAttributes;
+ char* pText; // null terminated text
+ TextAttribute* pAttribute;
+} TextEntry;
+
+typedef struct ZoneOption
+{
+ char nOverTitle;
+ char nOverBody;
+ char nOverFoot;
+ char nFStyle_Title;
+ char nFStyle_Body;
+ char nFStyle_Foot;
+ char nFOutc_Title;
+ char nFOutc_Body;
+ char nFOutc_Foot;
+ char nFFillc_Title;
+ char nFFillc_Body;
+ char nFFillc_Foot;
+} ZoneOption;
+
+typedef struct BulletOption
+{
+ char nBType;
+ char nBSize;
+ char nBColor;
+ sal_Int16 nBStart;
+ double nTMargin;
+ double nBSpace;
+ char nCPlace;
+} BulletOption;
+
+typedef struct BulDef
+{
+ char btype;
+ char bsize;
+ char bcolor;
+ char bnumber;
+} BulDef;
+
+typedef struct BulletLines
+{
+ BulDef nBulDef[ 48 ];
+} BulletLines;
+
+typedef struct IntSettings
+{
+ sal_uInt16 nCountry;
+ sal_uInt16 nDateFormat;
+ sal_uInt16 nDateSep;
+ sal_uInt16 nTimeFormat;
+ sal_uInt16 nTimeSep;
+ sal_uInt16 nNumSeps;
+ sal_uInt16 nCurrencyFormat;
+ char nCurrencySymbol[ 5 ];
+} IntSettings;
+
+typedef struct PageOrientDim
+{
+ char nOrientation;
+ char nDimension;
+ float nPageX;
+ float nPageY;
+} PageOrientDim;
+
+typedef struct DataNode
+{
+ sal_Int16 nBoxX1;
+ sal_Int16 nBoxY1;
+ sal_Int16 nBoxX2;
+ sal_Int16 nBoxY2;
+ sal_Int8 nZoneEnum;
+} DataNode;
+
+typedef struct ChartZone
+{
+ sal_Int16 nMinX;
+ sal_Int16 nMinY;
+ sal_Int16 nMaxX;
+ sal_Int16 nMaxY;
+ char nUserDef;
+ char nPad1;
+} ChartZone;
+
+class CGM;
+class CGMImpressOutAct;
+class CGMChart
+{
+ friend class CGM;
+ friend class CGMImpressOutAct;
+
+ protected:
+ CGM* mpCGM;
+ sal_Int8 mnCurrentFileType;
+ List maTextEntryList;
+ DataNode mDataNode[ 7 ];
+ ChartZone mChartZone;
+ PageOrientDim mPageOrientDim;
+ BulletOption mBulletOption;
+ BulletLines mBulletLines;
+ ZoneOption mZoneOption;
+ IntSettings mIntSettings;
+
+ public:
+ CGMChart( CGM& rCGM );
+ ~CGMChart();
+
+ void DeleteTextEntry( TextEntry* );
+ void InsertTextEntry( TextEntry* );
+
+ void ResetAnnotation();
+ sal_Bool IsAnnotation();
+};
+
+#endif
+
diff --git a/filter/source/graphicfilter/icgm/class0.cxx b/filter/source/graphicfilter/icgm/class0.cxx
new file mode 100644
index 000000000000..8ec31f03258c
--- /dev/null
+++ b/filter/source/graphicfilter/icgm/class0.cxx
@@ -0,0 +1,138 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+#include <main.hxx>
+#include <outact.hxx>
+
+// ---------------------------------------------------------------
+
+void CGM::ImplDoClass0()
+{
+ switch ( mnElementID )
+ {
+ case 0x01 : ComOut( CGM_LEVEL1, "Begin Metafile" )
+ {
+ ImplSetMapMode();
+ mbMetaFile = sal_True;
+ }
+ break;
+ case 0x02 : ComOut( CGM_LEVEL1, "End MetaFile" )
+ {
+ if ( mpBitmapInUse ) // vorhandene grafik verarbeiten,
+ {
+ CGMBitmapDescriptor* pBmpDesc = mpBitmapInUse->GetBitmap();
+ // irgendetwas mit der Bitmap anfangen
+ mpOutAct->DrawBitmap( pBmpDesc );
+ delete mpBitmapInUse;
+ mpBitmapInUse = NULL;
+ }
+ mbIsFinished = sal_True;
+ mbPictureBody = sal_False;
+ mbMetaFile = sal_False;
+ }
+ break;
+ case 0x03 : ComOut( CGM_LEVEL1, "Begin Picture" )
+ {
+ ImplDefaultReplacement();
+ ImplSetMapMode();
+ if ( mbPicture )
+ mbStatus = sal_False;
+ else
+ {
+ *pCopyOfE = *pElement;
+ mbPicture = mbFirstOutPut = sal_True;
+ mbFigure = sal_False;
+ mnAct4PostReset = 0;
+ if ( mpChart == NULL ) // normal CGM Files determines "BeginPic"
+ mpOutAct->InsertPage(); // as the next slide
+ }
+ }
+ break;
+ case 0x04 : ComOut( CGM_LEVEL1, "Begin Picture Body" )
+ mbPictureBody = sal_True;
+ break;
+ case 0x05 : ComOut( CGM_LEVEL1, " End Picture" )
+ {
+ if ( mbPicture )
+ {
+ if ( mpBitmapInUse ) // vorhandene grafik verarbeiten,
+ {
+ CGMBitmapDescriptor* pBmpDesc = mpBitmapInUse->GetBitmap();
+ // irgendetwas mit der Bitmap anfangen
+ mpOutAct->DrawBitmap( pBmpDesc );
+ delete mpBitmapInUse;
+ mpBitmapInUse = NULL;
+ }
+ mpOutAct->EndFigure(); // eventuelle figuren schliessen
+ mpOutAct->EndGrouping(); // eventuelle gruppierungen noch abschliessen
+ *pElement = *pCopyOfE;
+ mbFigure = mbFirstOutPut = mbPicture = mbPictureBody = sal_False;
+ }
+ else
+ mbStatus = sal_False;
+ }
+ break;
+ case 0x06 : ComOut( CGM_LEVEL2, "Begin Segment" )
+ pElement->bSegmentCount = sal_True;
+ break;
+ case 0x07 : ComOut( CGM_LEVEL2, "End Segment" )
+ pElement->bSegmentCount = sal_True;
+ break;
+ case 0x08 : ComOut( CGM_LEVEL2, "Begin Figure" )
+ mbFigure = sal_True;
+ mpOutAct->BeginFigure();
+ break;
+ case 0x09 : ComOut( CGM_LEVEL2, "End Figure" )
+ mpOutAct->EndFigure();
+ mbFigure = sal_False;
+ break;
+ case 0x0d : ComOut( CGM_LEVEL3, "Begin Protection Region" ) break;
+ case 0x0e : ComOut( CGM_LEVEL3, "End Protection Region" ) break;
+ case 0x0f : ComOut( CGM_LEVEL3, "Begin Compound Line" ) break;
+ case 0x10 : ComOut( CGM_LEVEL3, "End Compound Line" ) break;
+ case 0x11 : ComOut( CGM_LEVEL3, "Begin Compound Text Path" ) break;
+ case 0x12 : ComOut( CGM_LEVEL3, "End Compound Text Path" ) break;
+ case 0x13 : ComOut( CGM_LEVEL3, "Begin Tile Array" ) break; // NS
+ case 0x14 : ComOut( CGM_LEVEL3, "End Tile Array" ) break; // NS
+ case 0xff : ComOut( CGM_GDSF_ONLY, "Filter Setup" ) break;
+ case 0xfe : ComOut( CGM_GDSF_ONLY, "Begin Block Text Region" ) break;
+ case 0xfd : ComOut( CGM_GDSF_ONLY, "End Block Text Region" ) break;
+ case 0xfc : ComOut( CGM_GDSF_ONLY, "Begin Group" )
+ mpOutAct->BeginGroup();
+ break;
+ case 0xfb : ComOut( CGM_GDSF_ONLY, "End Group" )
+ mpOutAct->EndGroup();
+ break;
+ case 0xfa : ComOut( CGM_GDSF_ONLY, "Begin Patch" ) break;
+ case 0xf9 : ComOut( CGM_GDSF_ONLY, "Begin Patch" ) break;
+ default: ComOut( CGM_UNKNOWN_COMMAND, "" ) break;
+ }
+};
+
+
diff --git a/filter/source/graphicfilter/icgm/class1.cxx b/filter/source/graphicfilter/icgm/class1.cxx
new file mode 100644
index 000000000000..33c62f5e2c6e
--- /dev/null
+++ b/filter/source/graphicfilter/icgm/class1.cxx
@@ -0,0 +1,231 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include <main.hxx>
+
+// ---------------------------------------------------------------
+
+void CGM::ImplDoClass1()
+{
+ long nInteger, nI0, nI1;
+ sal_uInt32 nUInteger;
+
+ switch ( mnElementID )
+ {
+ case 0x01 : ComOut( CGM_LEVEL1, "Metafile Version" )
+ pElement->nMetaFileVersion = ImplGetI( pElement->nIntegerPrecision );
+ break;
+ case 0x02 : ComOut( CGM_LEVEL1, "Metafile Description" ) break;
+ case 0x03 : ComOut( CGM_LEVEL1, "VDC Type" )
+ {
+ nUInteger = ImplGetUI16();
+ switch( nUInteger )
+ {
+ case 0 : pElement->eVDCType = VDC_INTEGER; break;
+ case 1 : pElement->eVDCType = VDC_REAL; break;
+ default: mbStatus = sal_False; break;
+ }
+ }
+ break;
+ case 0x04 : ComOut( CGM_LEVEL1 | CGM_DRAWING_PLUS_CONTROL_SET, "Integer Precision" )
+ {
+ nInteger = ImplGetI( pElement->nIntegerPrecision );
+ switch ( nInteger )
+ {
+ case 32 :
+ case 24 :
+ case 16 :
+ case 8 : pElement->nIntegerPrecision = nInteger >> 3; break;
+ default : mbStatus = sal_False; break;
+ }
+ }
+ break;
+ case 0x05 : ComOut( CGM_LEVEL1 | CGM_DRAWING_PLUS_CONTROL_SET, "Real Precision" )
+ {
+ nUInteger = ImplGetUI16( 4 );
+ nI0 = ImplGetI( pElement->nIntegerPrecision ); // exponent
+ nI1 = ImplGetI( pElement->nIntegerPrecision ); // mantisse
+ switch( nUInteger )
+ {
+ case 0 :
+ pElement->eRealPrecision = RP_FLOAT;
+ switch ( nI0 )
+ {
+ case 9 :
+ if ( nI1 != 23 )
+ mbStatus = sal_False;
+ pElement->nRealSize = 4;
+ break;
+ case 12 :
+ if ( nI1 != 52 )
+ mbStatus =sal_False;
+ pElement->nRealSize = 8;
+ break;
+ default:
+ mbStatus = sal_False;
+ break;
+ }
+ break;
+ case 1 :
+ pElement->eRealPrecision = RP_FIXED;
+ if ( nI0 != nI1 )
+ mbStatus = sal_False;
+ if ( nI0 == 16 )
+ pElement->nRealSize = 4;
+ else if ( nI0 == 32 )
+ pElement->nRealSize = 8;
+ else
+ mbStatus = sal_False;
+ break;
+ default :
+ mbStatus = sal_False; break;
+ }
+ }
+ break;
+ case 0x06 : ComOut( CGM_LEVEL1 | CGM_DRAWING_PLUS_CONTROL_SET, "Index Precision" )
+ {
+ nInteger = ImplGetI( pElement->nIntegerPrecision );
+ switch ( nInteger )
+ {
+ case 32 :
+ case 24 :
+ case 16 :
+ case 8 : pElement->nIndexPrecision = nInteger >> 3; break;
+ default : mbStatus = sal_False; break;
+ }
+ }
+ break;
+ case 0x07 : ComOut( CGM_LEVEL1 | CGM_DRAWING_PLUS_CONTROL_SET, "Color Precision" )
+ {
+ nInteger = ImplGetI( pElement->nIntegerPrecision );
+ switch ( nInteger )
+ {
+ case 32 :
+ case 24 :
+ case 16 :
+ case 8 : pElement->nColorPrecision = nInteger >> 3; break;
+ default : mbStatus = sal_False; break;
+ }
+ }
+ break;
+ case 0x08 : ComOut( CGM_LEVEL1 | CGM_DRAWING_PLUS_CONTROL_SET, "Color Index Precision" )
+ {
+ nInteger = ImplGetI( pElement->nIntegerPrecision );
+ switch ( nInteger )
+ {
+ case 32 :
+ case 24 :
+ case 16 :
+ case 8 : pElement->nColorIndexPrecision = nInteger >> 3; break;
+ default : mbStatus = sal_False; break;
+ }
+ }
+ break;
+ case 0x09 : ComOut( CGM_LEVEL1 | CGM_DRAWING_PLUS_CONTROL_SET, "Maximum Colour Index" )
+ {
+ pElement->nColorMaximumIndex = ImplGetUI( pElement->nColorIndexPrecision );
+ if ( ( pElement->nColorMaximumIndex > 256 /*255*/ ) || ( pElement->nColorMaximumIndex == 0 ) )
+ mbStatus = sal_False;
+ }
+ break;
+ case 0x0a : ComOut( CGM_LEVEL1 | CGM_DRAWING_PLUS_CONTROL_SET, "Color Value Extent" )
+ {
+ if ( pElement->eColorModel == CM_RGB )
+ nI1 = 6;
+ else
+ {
+ nI1 = 8;
+ mbStatus = sal_False; // CMYK is not supported
+ }
+ for ( nI0 = 0; nI0 < nI1; nI0++ )
+ {
+ pElement->nColorValueExtent[ nI0 ] = (sal_uInt8)ImplGetUI( pElement->nColorPrecision );
+ }
+ }
+ break;
+ case 0x0b : ComOut( CGM_LEVEL1, "MetaFile Element List" ) break;
+ case 0x0c : ComOut( CGM_LEVEL1 | CGM_DRAWING_PLUS_CONTROL_SET, "MetaFile Default Replacement" )
+ {
+ if ( mnElementSize > 1 )
+ {
+ sal_Int8* pBuf = new sal_Int8[ mnElementSize ];
+ if ( pBuf )
+ {
+ memcpy( pBuf, mpSource, mnElementSize );
+ maDefRepList.Insert( pBuf, LIST_APPEND );
+ maDefRepSizeList.Insert( (void*)mnElementSize, LIST_APPEND );
+ }
+ }
+ mnParaSize = mnElementSize;
+ }
+ break;
+ case 0x0d : ComOut( CGM_LEVEL1 | CGM_DRAWING_PLUS_CONTROL_SET, "Font List" )
+ {
+ while ( mnParaSize < mnElementSize )
+ {
+ sal_uInt32 nSize;
+ nSize = ImplGetUI( 1 );
+ pElement->aFontList.InsertName( mpSource + mnParaSize, nSize );
+ mnParaSize += nSize;
+ }
+ }
+ break;
+ case 0x0e : ComOut( CGM_LEVEL1 | CGM_DRAWING_PLUS_CONTROL_SET, "Character Set List" )
+ {
+ while ( mnParaSize < mnElementSize )
+ {
+ sal_uInt32 nCharSetType;
+ sal_uInt32 nSize;
+ nCharSetType = ImplGetUI16();
+ nSize = ImplGetUI( 1 );
+ pElement->aFontList.InsertCharSet( (CharSetType)nCharSetType, mpSource + mnParaSize, nSize );
+ mnParaSize += nSize;
+ }
+ }
+ break;
+ case 0x0f : ComOut( CGM_LEVEL1 | CGM_DRAWING_PLUS_CONTROL_SET, "Character Coding Announcer" )
+ pElement->eCharacterCodingA = (CharacterCodingA)ImplGetUI16();
+ break;
+ case 0x10 : ComOut( CGM_LEVEL2, "Name Precision" ) break; // NS
+ case 0x11 : ComOut( CGM_LEVEL2, "Maximum VDC Extent" ) break; // NS
+ case 0x12 : ComOut( CGM_LEVEL2, "Segment Priority Extent" ) break; // NS
+ case 0x13 : ComOut( CGM_LEVEL3, "Color Model" ) break; // NS
+ case 0x14 : ComOut( CGM_LEVEL3, "Color Calibration" ) break; // NS
+ case 0x15 : ComOut( CGM_LEVEL3, "Font Properties" ) break; // NS
+ case 0x16 : ComOut( CGM_LEVEL3, "Glyph Mapping" ) break; // NS
+ case 0x17 : ComOut( CGM_LEVEL3, "Symbol Library List" ) break; // NS
+ case 0xfc : ComOut( CGM_GDSF_ONLY, "Inquire Function Support" ) break;
+ case 0xfa : ComOut( CGM_GDSF_ONLY, "End Metafile Defaults Replacement" ) break;
+ case 0xf8 : ComOut( CGM_GDSF_ONLY, "Set Color Value Desc Extent" ) break;
+ default: ComOut( CGM_UNKNOWN_COMMAND, "" ) break;
+ }
+};
+
+
diff --git a/filter/source/graphicfilter/icgm/class2.cxx b/filter/source/graphicfilter/icgm/class2.cxx
new file mode 100644
index 000000000000..8b4722b0f19c
--- /dev/null
+++ b/filter/source/graphicfilter/icgm/class2.cxx
@@ -0,0 +1,227 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include <main.hxx>
+
+// ---------------------------------------------------------------
+
+void CGM::ImplDoClass2()
+{
+ sal_uInt32 nUInteger;
+ switch ( mnElementID )
+ {
+ case 0x01 : ComOut( CGM_LEVEL1 | CGM_DRAWING_PLUS_CONTROL_SET, "Scaling Mode" )
+ {
+ if ( mnElementSize ) // HACK (NASA.CGM)
+ {
+ switch( ImplGetUI16() )
+ {
+ case 0 : pElement->eScalingMode = SM_ABSTRACT; break;
+ case 1 : pElement->eScalingMode = SM_METRIC; break;
+ default : mbStatus = sal_False; break;
+ }
+ pElement->nScalingFactor = ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize );
+ ImplSetMapMode();
+ }
+ }
+ break;
+ case 0x02 : ComOut( CGM_LEVEL1, "Color Selection Mode" )
+ {
+ nUInteger = ImplGetUI16();
+ switch( nUInteger )
+ {
+ case 0 : pElement->eColorSelectionMode = CSM_INDEXED; break;
+ case 1 : pElement->eColorSelectionMode = CSM_DIRECT; break;
+ default : mbStatus = sal_False; break;
+ }
+ }
+ break;
+ case 0x03 : ComOut( CGM_LEVEL1 | CGM_DRAWING_PLUS_CONTROL_SET, "Line Width Specification Mode" )
+ {
+ nUInteger = ImplGetUI16();
+ switch( nUInteger )
+ {
+ case 0 : pElement->eLineWidthSpecMode = SM_ABSOLUTE; break;
+ case 1 : pElement->eLineWidthSpecMode = SM_SCALED; break;
+ default : mbStatus = sal_False; break;
+ }
+ }
+ break;
+ case 0x04 : ComOut( CGM_LEVEL1 | CGM_DRAWING_PLUS_CONTROL_SET, "Marker Size Specification Mode" )
+ {
+ nUInteger = ImplGetUI16();
+ switch( nUInteger )
+ {
+ case 0 : pElement->eMarkerSizeSpecMode = SM_ABSOLUTE; break;
+ case 1 : pElement->eMarkerSizeSpecMode = SM_SCALED; break;
+ default : mbStatus = sal_False; break;
+ }
+ }
+ break;
+ case 0x05 : ComOut( CGM_LEVEL1 | CGM_DRAWING_PLUS_CONTROL_SET, "Edge Width Specification Mode" )
+ {
+ nUInteger = ImplGetUI16();
+ switch( nUInteger )
+ {
+ case 0 : pElement->eEdgeWidthSpecMode = SM_ABSOLUTE; break;
+ case 1 : pElement->eEdgeWidthSpecMode = SM_SCALED; break;
+ default : mbStatus = sal_False; break;
+ }
+ }
+ break;
+ case 0x06 : ComOut( CGM_LEVEL1, "VDC Extent" )
+ {
+ ImplGetRectangleNS( pElement->aVDCExtent );
+ ImplSetMapMode();
+ }
+ break;
+ case 0x07 : ComOut( CGM_LEVEL1, "Background Color" )
+ pElement->nBackGroundColor = ImplGetBitmapColor( sal_True );
+ break;
+ case 0x08 : ComOut( CGM_LEVEL2, "Device Viewport" )
+ {
+ if ( pElement->eVDCType == VDC_INTEGER )
+ ImplGetRectangle( pElement->aDeviceViewPort );
+ ImplSetMapMode();
+ }
+ break;
+ case 0x09 : ComOut( CGM_LEVEL2, "Device Viewport Specification Mode" )
+ {
+ nUInteger = ImplGetUI16( 8 );
+ switch( nUInteger )
+ {
+ case 0 : pElement->eDeviceViewPortMode = DVPM_FRACTION; break;
+ case 1 : pElement->eDeviceViewPortMode = DVPM_METRIC; break;
+ case 2 : pElement->eDeviceViewPortMode = DVPM_DEVICE; break;
+ default : mbStatus = sal_False; break;
+ }
+ pElement->nDeviceViewPortScale = ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize );
+ ImplSetMapMode();
+ }
+ break;
+ case 0x0a : ComOut( CGM_LEVEL2, "Device Viewport Mapping" )
+ {
+ switch( ImplGetUI16() )
+ {
+ case 0 : pElement->eDeviceViewPortMap = DVPM_NOT_FORCED; break;
+ case 1 : pElement->eDeviceViewPortMap = DVPM_FORCED; break;
+ default : mbStatus = sal_False; break;
+ }
+ switch( ImplGetUI16() )
+ {
+ case 0 : pElement->eDeviceViewPortMapH = DVPMH_LEFT; break;
+ case 1 : pElement->eDeviceViewPortMapH = DVPMH_CENTER; break;
+ case 2 : pElement->eDeviceViewPortMapH = CVPMH_RIGHT; break;
+ default : mbStatus = sal_False; break;
+ }
+ switch( ImplGetUI16() )
+ {
+ case 0 : pElement->eDeviceViewPortMapV = DVPMV_BOTTOM; break;
+ case 1 : pElement->eDeviceViewPortMapV = DVPMV_CENTER; break;
+ case 2 : pElement->eDeviceViewPortMapV = DVPMV_TOP; break;
+ default : mbStatus = sal_False; break;
+ }
+ ImplSetMapMode();
+ }
+ break;
+ case 0x0b : ComOut( CGM_LEVEL2, "Line Representation" )
+ {
+ LineBundle aTempLineBundle;
+ aTempLineBundle.SetIndex( ImplGetI( pElement->nIndexPrecision ) );
+ aTempLineBundle.eLineType = (LineType)ImplGetI( pElement->nIndexPrecision );
+ aTempLineBundle.nLineWidth = ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize );
+ aTempLineBundle.SetColor( ImplGetBitmapColor() );
+ pElement->InsertBundle( pElement->aLineList, aTempLineBundle );
+ }
+ break;
+ case 0x0c : ComOut( CGM_LEVEL2, "Marker Representation" )
+ {
+ MarkerBundle aTempMarkerBundle;
+ aTempMarkerBundle.SetIndex( ImplGetI( pElement->nIndexPrecision ) );
+ aTempMarkerBundle.eMarkerType = (MarkerType)ImplGetI( pElement->nIndexPrecision );
+ aTempMarkerBundle.nMarkerSize = ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize );
+ aTempMarkerBundle.SetColor( ImplGetBitmapColor() );
+ pElement->InsertBundle( pElement->aMarkerList, aTempMarkerBundle );
+ }
+ break;
+ case 0x0d : ComOut( CGM_LEVEL2, "Text Representation" )
+ {
+ TextBundle aTempTextBundle;
+ aTempTextBundle.SetIndex( ImplGetI( pElement->nIndexPrecision ) );
+ aTempTextBundle.nTextFontIndex = ImplGetI( pElement->nIndexPrecision );
+ aTempTextBundle.eTextPrecision = (TextPrecision)ImplGetI( pElement->nIndexPrecision );
+ aTempTextBundle.nCharacterSpacing = ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize );
+ aTempTextBundle.nCharacterExpansion = ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize );
+ aTempTextBundle.SetColor( ImplGetBitmapColor() );
+ pElement->InsertBundle( pElement->aTextList, aTempTextBundle );
+ }
+ break;
+ case 0x0e : ComOut( CGM_LEVEL2, "Fill Representation" )
+ {
+ FillBundle aTempFillBundle;
+ aTempFillBundle.SetIndex( ImplGetI( pElement->nIndexPrecision ) );
+ aTempFillBundle.eFillInteriorStyle = (FillInteriorStyle)ImplGetI( pElement->nIndexPrecision );
+ aTempFillBundle.SetColor( ImplGetBitmapColor() );
+ aTempFillBundle.nFillPatternIndex = ImplGetI( pElement->nIndexPrecision );
+ aTempFillBundle.nFillHatchIndex = ImplGetI( pElement->nIndexPrecision );
+ pElement->InsertBundle( pElement->aFillList, aTempFillBundle );
+ }
+ break;
+ case 0x0f : ComOut( CGM_LEVEL2, "Edge Representation" )
+ {
+ EdgeBundle aTempEdgeBundle;
+ aTempEdgeBundle.SetIndex( ImplGetI( pElement->nIndexPrecision ) );
+ aTempEdgeBundle.eEdgeType = (EdgeType)ImplGetI( pElement->nIndexPrecision );
+ aTempEdgeBundle.nEdgeWidth = ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize );
+ aTempEdgeBundle.SetColor( ImplGetBitmapColor() );
+ pElement->InsertBundle( pElement->aEdgeList, aTempEdgeBundle );
+ }
+ break;
+ case 0x10 : ComOut( CGM_LEVEL3, "Interior Style Specification Mode" ) break; // NS
+ case 0x11 : ComOut( CGM_LEVEL3, "Line and Edge Type Definition" ) break;
+ case 0x12 : ComOut( CGM_LEVEL3, "Hatch Style Definition" ) break; // NS
+ case 0x13 : ComOut( CGM_LEVEL3, "Geometric Pattern Definition" ) break; // NS
+ case 0xff : ComOut( CGM_GDSF_ONLY, "inquire VDC EXTENT" ) break;
+ case 0xfe : ComOut( CGM_GDSF_ONLY, "inquire Background Color" ) break;
+ case 0xfd : ComOut( CGM_GDSF_ONLY, "inquire Device Viewport" ) break;
+ case 0xfc : ComOut( CGM_GDSF_ONLY, "set Font Selection Mode" ) break;
+ case 0xfb : ComOut( CGM_GDSF_ONLY, "inquire Color Selection Mode" ) break;
+ case 0xfa : ComOut( CGM_GDSF_ONLY, "inquire Font Selection Mode" ) break;
+ case 0xf9 : ComOut( CGM_GDSF_ONLY, "set Char Height Spec Mode" )
+ {
+ ImplGetUI16(); // -Wall is this really needed?
+ }
+ break;
+ case 0xf8 : ComOut( CGM_GDSF_ONLY, "set Background Style" ) break;
+ default: ComOut( CGM_UNKNOWN_COMMAND, "" ) break;
+ }
+};
+
+
diff --git a/filter/source/graphicfilter/icgm/class3.cxx b/filter/source/graphicfilter/icgm/class3.cxx
new file mode 100644
index 000000000000..d64b3456624c
--- /dev/null
+++ b/filter/source/graphicfilter/icgm/class3.cxx
@@ -0,0 +1,144 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include <main.hxx>
+#include <outact.hxx>
+
+// ---------------------------------------------------------------
+
+void CGM::ImplDoClass3()
+{
+ sal_uInt32 nUInteger;
+ long nI0, nI1;
+ switch ( mnElementID )
+ {
+ case 0x01 : ComOut( CGM_LEVEL1, "VDC Integer Precision" )
+ {
+ switch( ImplGetI( pElement->nIntegerPrecision ) )
+ {
+ case 16 : pElement->nVDCIntegerPrecision = 2; break;
+ case 32 : pElement->nVDCIntegerPrecision = 4; break;
+ default : mbStatus = sal_False; break;
+ }
+ }
+ break;
+ case 0x02 : ComOut( CGM_LEVEL1, "VDC Real Precision" )
+ {
+ nUInteger = ImplGetUI16();
+ nI0 = ImplGetI( pElement->nIntegerPrecision ); // exponent
+ nI1 = ImplGetI( pElement->nIntegerPrecision ); // mantisse
+ switch( nUInteger )
+ {
+ case 0 :
+ pElement->eVDCRealPrecision = RP_FLOAT;
+ switch ( nI0 )
+ {
+ case 9 :
+ if ( nI1 != 23 )
+ mbStatus = sal_False;
+ pElement->nVDCRealSize = 4;
+ break;
+ case 12 :
+ if ( nI1 != 52 )
+ mbStatus =sal_False;
+ pElement->nVDCRealSize = 8;
+ break;
+ default:
+ mbStatus = sal_False;
+ break;
+ }
+ break;
+ case 1 :
+ pElement->eVDCRealPrecision = RP_FIXED;
+ if ( nI0 != nI1 )
+ mbStatus = sal_False;
+ if ( nI0 == 16 )
+ pElement->nVDCRealSize = 4;
+ else if ( nI0 == 32 )
+ pElement->nVDCRealSize = 8;
+ else
+ mbStatus = sal_False;
+ break;
+ default :
+ mbStatus = sal_False; break;
+ }
+ }
+ break;
+ case 0x03 : ComOut( CGM_LEVEL1, "Auxiliary Colour" )
+ {
+ pElement->nAuxiliaryColor = ImplGetBitmapColor();
+ }
+ break;
+ case 0x04 : ComOut( CGM_LEVEL1, "Transparency" )
+ {
+ switch( ImplGetUI16() )
+ {
+ case 0 : pElement->eTransparency = T_OFF; break;
+ case 1 : pElement->eTransparency = T_ON; break;
+ default : mbStatus = sal_False; break;
+ }
+ }
+ break;
+ case 0x05 : ComOut( CGM_LEVEL1, "Clip Rectangle" )
+ ImplGetRectangle( pElement->aClipRect );
+ break;
+ case 0x06 : ComOut( CGM_LEVEL1, "Clip Indicator" )
+ {
+ switch( ImplGetUI16() )
+ {
+ case 0 : pElement->eClipIndicator = CI_OFF; break;
+ case 1 : pElement->eClipIndicator = CI_ON; break;
+ default : mbStatus = sal_False; break;
+ }
+ }
+ break;
+ case 0x07 : ComOut( CGM_LEVEL2, "Line Clipping Mode" ) break; // NS
+ case 0x08 : ComOut( CGM_LEVEL2, "Marker Clipping Mode" ) break; // NS
+ case 0x09 : ComOut( CGM_LEVEL2, "Edge Clipping Mode" ) break; // NS
+ case 0x0a : ComOut( CGM_LEVEL2, "New Region" )
+ mpOutAct->NewRegion();
+ break;
+ case 0x0b : ComOut( CGM_LEVEL2, "Save Primitive Context" ) break; // NS
+ case 0x0c : ComOut( CGM_LEVEL2, "Restore Primitive Context" ) break; // NS
+ case 0x11 : ComOut( CGM_LEVEL3, "Protection Region Indicator" ) break;
+ case 0x12 : ComOut( CGM_LEVEL3, "Generalized Text Path Mode" ) break; // NS
+ case 0x13 : ComOut( CGM_LEVEL3, "Mitre Limit" )
+ pElement->nMitreLimit = ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize );
+ break; // NS
+ case 0x14 : ComOut( CGM_LEVEL3, "Transparent Cell Color" ) break; // NS
+ case 0xfc : ComOut( CGM_GDSF_ONLY, "Text Path Alignment Modes" ) break;
+ case 0xfd : ComOut( CGM_GDSF_ONLY, "Pop Transformation Stack" ) break;
+ case 0xfe : ComOut( CGM_GDSF_ONLY, "Push Transformation Stack" ) break;
+ case 0xff : ComOut( CGM_GDSF_ONLY, "Set Patch ID" ) break;
+ default: ComOut( CGM_UNKNOWN_COMMAND, "" ) break;
+ }
+};
+
+
diff --git a/filter/source/graphicfilter/icgm/class4.cxx b/filter/source/graphicfilter/icgm/class4.cxx
new file mode 100644
index 000000000000..ee8aaef531d5
--- /dev/null
+++ b/filter/source/graphicfilter/icgm/class4.cxx
@@ -0,0 +1,861 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include <main.hxx>
+#include <chart.hxx>
+#include <outact.hxx>
+#include <math.h>
+
+using namespace ::com::sun::star;
+
+double CGM::ImplGetOrientation( FloatPoint& rCenter, FloatPoint& rPoint )
+{
+ double fOrientation;
+
+ double nX = rPoint.X - rCenter.X;
+ double nY = rPoint.Y - rCenter.Y;
+
+ fOrientation = acos( nX / sqrt( nX * nX + nY * nY ) ) * 57.29577951308;
+ if ( nY > 0 )
+ fOrientation = 360 - fOrientation;
+
+ return fOrientation;
+}
+
+// ---------------------------------------------------------------
+
+void CGM::ImplSwitchStartEndAngle( double& rStartAngle, double& rEndAngle )
+{
+ double nTemp;
+ nTemp = rStartAngle;
+ rStartAngle = rEndAngle;
+ rEndAngle = nTemp;
+}
+
+// ---------------------------------------------------------------
+
+void CGM::ImplGetVector( double* pVector )
+{
+ if ( pElement->eVDCType == VDC_REAL )
+ {
+ for ( sal_uInt32 i = 0; i < 4; i++ )
+ {
+ pVector[ i ] = (double)ImplGetFloat( pElement->eVDCRealPrecision, pElement->nVDCRealSize );
+ }
+ }
+ else
+ {
+ for ( sal_uInt32 i = 0; i < 4; i++ )
+ {
+ pVector[ i ] = (double)ImplGetI( pElement->nVDCIntegerPrecision );
+ }
+ }
+ pVector[ 0 ] *= mnVDCXmul;
+ pVector[ 2 ] *= mnVDCXmul;
+ pVector[ 1 ] *= mnVDCYmul;
+ pVector[ 3 ] *= mnVDCYmul;
+}
+
+// ---------------------------------------------------------------
+sal_Bool CGM::ImplGetEllipse( FloatPoint& rCenter, FloatPoint& rRadius, double& rAngle )
+{
+ FloatPoint aPoint1, aPoint2;
+ double fRot1, fRot2;
+ ImplGetPoint( rCenter, sal_True );
+ ImplGetPoint( aPoint1, sal_True );
+ ImplGetPoint( aPoint2, sal_True );
+ fRot1 = ImplGetOrientation( rCenter, aPoint1 );
+ fRot2 = ImplGetOrientation( rCenter, aPoint2 );
+ rAngle = ImplGetOrientation( rCenter, aPoint1 );
+ aPoint1.X -= rCenter.X;
+ aPoint1.Y -= rCenter.Y;
+ rRadius.X = sqrt( aPoint1.X * aPoint1.X + aPoint1.Y * aPoint1.Y );
+ aPoint2.X -= rCenter.X;
+ aPoint2.Y -= rCenter.Y;
+ rRadius.Y = sqrt( aPoint2.X * aPoint2.X + aPoint2.Y * aPoint2.Y );
+
+ if ( fRot1 > fRot2 )
+ {
+ if ( ( fRot1 - fRot2 ) < 180 )
+ return sal_False;
+ }
+ else
+ {
+ if ( ( fRot2 - fRot1 ) > 180 )
+ return sal_False;
+ }
+ return sal_True;
+}
+
+void CGM::ImplDoClass4()
+{
+ if ( mbFirstOutPut )
+ mpOutAct->FirstOutPut();
+
+ if ( mpBitmapInUse && ( mnElementID != 9 ) ) // vorhandene grafik verarbeiten,
+ { // da jetzt nicht bitmap actions anstehen
+ CGMBitmapDescriptor* pBmpDesc = mpBitmapInUse->GetBitmap();
+ // irgendetwas mit der Bitmap anfangen
+ mpOutAct->DrawBitmap( pBmpDesc );
+ delete mpBitmapInUse;
+ mpBitmapInUse = NULL;
+ }
+
+ if ( ( mpChart == NULL ) || mpChart->IsAnnotation() )
+ {
+ switch ( mnElementID )
+ {
+ case 0x01 : ComOut( CGM_LEVEL1, "PolyLine" )
+ {
+ sal_uInt32 nPoints = mnElementSize / ImplGetPointSize();
+ Polygon aPolygon( (sal_uInt16)nPoints );
+ for ( sal_uInt16 i = 0; i < nPoints; i++)
+ {
+ FloatPoint aFloatPoint;
+ ImplGetPoint( aFloatPoint, sal_True );
+ aPolygon.SetPoint( Point( (long)aFloatPoint.X, (long)aFloatPoint.Y ), i );
+ }
+ if ( mbFigure )
+ mpOutAct->RegPolyLine( aPolygon );
+ else
+ mpOutAct->DrawPolyLine( aPolygon );
+ }
+ break;
+
+ case 0x02 : ComOut( CGM_LEVEL1 | CGM_EXTENDED_PRIMITIVES_SET, "Disjoint PolyLine" )
+ {
+ USHORT nPoints = sal::static_int_cast< USHORT >(
+ mnElementSize / ImplGetPointSize());
+ if ( ! ( nPoints & 1 ) )
+ {
+ nPoints >>= 1;
+ FloatPoint aFloatPoint;
+ if ( mbFigure )
+ {
+ Polygon aPolygon( nPoints );
+ for ( sal_uInt16 i = 0; i < nPoints; i++ )
+ {
+ ImplGetPoint( aFloatPoint, sal_True );
+ aPolygon.SetPoint( Point( (long)aFloatPoint.X, (long)aFloatPoint.Y ), 0 );
+ }
+ mpOutAct->RegPolyLine( aPolygon );
+ }
+ else
+ {
+ mpOutAct->BeginGroup();
+ Polygon aPolygon( (sal_uInt16)2 );
+ for ( sal_uInt16 i = 0; i < nPoints; i++ )
+ {
+ ImplGetPoint( aFloatPoint, sal_True );
+ aPolygon.SetPoint( Point( (long)aFloatPoint.X, (long)aFloatPoint.Y ), 0 );
+ ImplGetPoint( aFloatPoint, sal_True );
+ aPolygon.SetPoint( Point( (long)aFloatPoint.X, (long)aFloatPoint.Y ), 1);
+ mpOutAct->DrawPolyLine( aPolygon );
+ }
+ mpOutAct->EndGroup();
+ }
+ }
+ }
+ break;
+
+ case 0x03 : ComOut( CGM_LEVEL1, "PolyMarker" ) break;
+ case 0x04 : ComOut( CGM_LEVEL1, "Text" )
+ {
+ FloatPoint aFloatPoint;
+ sal_uInt32 nType, nSize;
+
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+
+ ImplGetPoint ( aFloatPoint, sal_True );
+ nType = ImplGetUI16( 4 );
+ nSize = ImplGetUI( 1 );
+ mpSource[ mnParaSize + nSize ] = 0;
+
+ ComOut( CGM_DESCRIPTION, (char*)mpSource + mnParaSize );
+
+ awt::Size aSize;
+ awt::Point aPoint( (long)aFloatPoint.X, (long)aFloatPoint.Y );
+ mpOutAct->DrawText( aPoint, aSize,
+ (char*)mpSource + mnParaSize, nSize, (FinalFlag)nType );
+// mnParaSize += nSize;
+ mnParaSize = mnElementSize;
+ }
+ break;
+
+ case 0x05 : ComOut( CGM_LEVEL1 | CGM_EXTENDED_PRIMITIVES_SET, "Restricted Text" )
+ {
+ double dx, dy;
+ FloatPoint aFloatPoint;
+ sal_uInt32 nType, nSize;
+
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+
+ if ( pElement->eVDCType == VDC_REAL )
+ {
+ dx = ImplGetFloat( pElement->eVDCRealPrecision, pElement->nVDCRealSize );
+ dy = ImplGetFloat( pElement->eVDCRealPrecision, pElement->nVDCRealSize );
+ }
+ else
+ {
+ dx = (double)ImplGetI( pElement->nVDCIntegerPrecision );
+ dy = (double)ImplGetI( pElement->nVDCIntegerPrecision );
+ }
+ ImplMapDouble( dx );
+ ImplMapDouble( dy );
+
+ ImplGetPoint ( aFloatPoint, sal_True );
+ nType = ImplGetUI16( 4 );
+ nSize = ImplGetUI( 1 );
+
+ mpSource[ mnParaSize + nSize ] = 0;
+
+ ComOut( CGM_DESCRIPTION, (char*)mpSource + mnParaSize );
+
+ awt::Point aPoint( (long)aFloatPoint.X, (long)aFloatPoint.Y );
+ awt::Size aSize((long)dx, (long)dy);
+ mpOutAct->DrawText( aPoint, aSize ,
+ (char*)mpSource + mnParaSize, nSize, (FinalFlag)nType );
+// mnParaSize += nSize;
+ mnParaSize = mnElementSize;
+ }
+ break;
+
+ case 0x06 : ComOut( CGM_LEVEL1 | CGM_EXTENDED_PRIMITIVES_SET, "Append Text" )
+ {
+ sal_uInt32 nSize;
+ sal_uInt32 nType = ImplGetUI16( 4 );
+
+ nSize = ImplGetUI( 1 );
+ mpSource[ mnParaSize + nSize ] = 0;
+
+ ComOut( CGM_DESCRIPTION, (char*)mpSource + mnParaSize );
+
+ mpOutAct->AppendText( (char*)mpSource + mnParaSize, nSize, (FinalFlag)nType );
+// mnParaSize += nSize;
+ mnParaSize = mnElementSize;
+ }
+ break;
+
+ case 0x07 : ComOut( CGM_LEVEL1, "Polygon" )
+ {
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+
+ USHORT nPoints = sal::static_int_cast< USHORT >(
+ mnElementSize / ImplGetPointSize());
+ Polygon aPolygon( nPoints );
+ for ( USHORT i = 0; i < nPoints; i++)
+ {
+ FloatPoint aFloatPoint;
+ ImplGetPoint( aFloatPoint, sal_True );
+ aPolygon.SetPoint( Point ( (long)( aFloatPoint.X ), (long)( aFloatPoint.Y ) ), i );
+ }
+ mpOutAct->DrawPolygon( aPolygon );
+ }
+ break;
+
+ case 0x08 : ComOut( CGM_LEVEL1 | CGM_EXTENDED_PRIMITIVES_SET, "Polygon Set" )
+ {
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+
+ USHORT nPoints = 0;
+ Point* pPoints = new Point[ 0x4000 ];
+
+ PolyPolygon aPolyPolygon;
+ FloatPoint aFloatPoint;
+ sal_uInt32 nEdgeFlag;
+ while ( mnParaSize < mnElementSize )
+ {
+ ImplGetPoint( aFloatPoint, sal_True );
+ nEdgeFlag = ImplGetUI16();
+ pPoints[ nPoints++ ] = Point( (long)aFloatPoint.X, (long)aFloatPoint.Y );
+ if ( ( nEdgeFlag & 2 ) || ( mnParaSize == mnElementSize ) )
+ {
+ Polygon aPolygon( nPoints );
+ for ( USHORT i = 0; i < nPoints; i++ )
+ {
+ aPolygon.SetPoint( pPoints[ i ], i );
+ }
+ aPolyPolygon.Insert( aPolygon, POLYPOLY_APPEND );
+ nPoints = 0;
+ }
+ }
+ delete[] pPoints;
+ mpOutAct->DrawPolyPolygon( aPolyPolygon );
+ }
+ break;
+
+ case 0x09 : ComOut( CGM_LEVEL1, "Cell Array" )
+ {
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+
+ if ( mpBitmapInUse )
+ {
+ CGMBitmap* pBmpDesc = mpBitmapInUse->GetNext();
+ if ( pBmpDesc ) // eventuell bekommen wir eine bitmap zurück, die nicht
+ { // zur vorherigen paßt -> diese müssen wir dann auch löschen
+ mpOutAct->DrawBitmap( pBmpDesc->GetBitmap() );
+ delete pBmpDesc;
+ }
+ }
+ else
+ {
+ mpBitmapInUse = new CGMBitmap( *this );
+ }
+ }
+ break;
+
+ case 0x0a : ComOut( CGM_LEVEL1, "Generalized Drawing Primitive" )
+ {
+ ImplGetI( pElement->nIntegerPrecision ); //-Wall is this needed
+ ImplGetUI( pElement->nIntegerPrecision ); //-Wall is this needed
+ mnParaSize = mnElementSize;
+ }
+ break;
+
+ case 0x0b : ComOut( CGM_LEVEL1 | CGM_EXTENDED_PRIMITIVES_SET, "Rectangle" )
+ {
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+
+ FloatRect aFloatRect;
+ ImplGetRectangle( aFloatRect, sal_True );
+ mpOutAct->DrawRectangle( aFloatRect );
+ }
+ break;
+
+ case 0x0c : ComOut( CGM_LEVEL1 | CGM_EXTENDED_PRIMITIVES_SET, "Circle" )
+ {
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+
+ double fRotation = 0;
+ FloatPoint aCenter, aRadius;
+ ImplGetPoint( aCenter, sal_True );
+ if ( pElement->eVDCType == VDC_REAL )
+ aRadius.X = ImplGetFloat( pElement->eVDCRealPrecision, pElement->nVDCRealSize );
+ else
+ aRadius.X = (double)ImplGetI( pElement->nVDCIntegerPrecision );
+ ImplMapDouble( aRadius.X );
+ aRadius.Y = aRadius.X;
+ mpOutAct->DrawEllipse( aCenter, aRadius, fRotation );
+ }
+ break;
+
+ case 0x0d : ComOut( CGM_LEVEL1 | CGM_EXTENDED_PRIMITIVES_SET, "Circular Arc 3 Point" )
+ {
+ int nSwitch = 0;
+
+ FloatPoint aStartingPoint, aIntermediatePoint, aEndingPoint, aCenterPoint;
+ ImplGetPoint( aStartingPoint, sal_True );
+ ImplGetPoint( aIntermediatePoint, sal_True );
+ ImplGetPoint( aEndingPoint, sal_True );
+
+ double fA = aIntermediatePoint.X - aStartingPoint.X;
+ double fB = aIntermediatePoint.Y - aStartingPoint.Y;
+ double fC = aEndingPoint.X - aStartingPoint.X;
+ double fD = aEndingPoint.Y - aStartingPoint.Y;
+
+ double fE = fA * ( aStartingPoint.X + aIntermediatePoint.X ) + fB * ( aStartingPoint.Y + aIntermediatePoint.Y );
+ double fF = fC * ( aStartingPoint.X + aEndingPoint.X ) + fD * ( aStartingPoint.Y + aEndingPoint.Y );
+
+ double fG = 2.0 * ( fA * ( aEndingPoint.Y - aIntermediatePoint.Y ) - fB * ( aEndingPoint.X - aIntermediatePoint.X ) );
+
+ aCenterPoint.X = ( fD * fE - fB * fF ) / fG;
+ aCenterPoint.Y = ( fA * fF - fC * fE ) / fG;
+
+ if ( fG != 0 )
+ {
+ double fStartAngle = ImplGetOrientation( aCenterPoint, aStartingPoint );
+ double fInterAngle = ImplGetOrientation( aCenterPoint, aIntermediatePoint );
+ double fEndAngle = ImplGetOrientation( aCenterPoint, aEndingPoint );
+
+ if ( fStartAngle > fEndAngle )
+ {
+ nSwitch ^=1;
+ aIntermediatePoint = aEndingPoint;
+ aEndingPoint = aStartingPoint;
+ aStartingPoint = aIntermediatePoint;
+ fG = fStartAngle;
+ fStartAngle = fEndAngle;
+ fEndAngle = fG;
+ }
+ if ( ! ( fInterAngle > fStartAngle ) && ( fInterAngle < fEndAngle ) )
+ {
+ nSwitch ^=1;
+ aIntermediatePoint = aEndingPoint;
+ aEndingPoint = aStartingPoint;
+ aStartingPoint = aIntermediatePoint;
+ fG = fStartAngle;
+ fStartAngle = fEndAngle;
+ fEndAngle = fG;
+ }
+ double fRadius = sqrt( pow( ( aStartingPoint.X - aCenterPoint.X ), 2 ) + pow( ( aStartingPoint.Y - aCenterPoint.Y ), 2 ) ) ;
+
+ if ( mbFigure )
+ {
+ Rectangle aBoundingBox( Point( (long)( aCenterPoint.X - fRadius ), long( aCenterPoint.Y - fRadius ) ),
+ Size( ( static_cast< long >( 2 * fRadius ) ), (long)( 2 * fRadius) ) );
+ Polygon aPolygon( aBoundingBox, Point( (long)aStartingPoint.X, (long)aStartingPoint.Y ) ,Point( (long)aEndingPoint.X, (long)aEndingPoint.Y ), POLY_ARC );
+ if ( nSwitch )
+ mpOutAct->RegPolyLine( aPolygon, sal_True );
+ else
+ mpOutAct->RegPolyLine( aPolygon );
+ }
+ else
+ {
+ fG = 0;
+ FloatPoint aRadius;
+ aRadius.X = aRadius.Y = fRadius;
+ mpOutAct->DrawEllipticalArc( aCenterPoint, aRadius, fG, 2, fStartAngle, fEndAngle );
+ }
+ }
+ }
+ break;
+
+ case 0x0e : ComOut( CGM_LEVEL1 | CGM_EXTENDED_PRIMITIVES_SET, "Circular Arc 3 Point Close" )
+ {
+ int nSwitch = 0;
+
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+
+ FloatPoint aStartingPoint, aIntermediatePoint, aEndingPoint, aCenterPoint;
+ ImplGetPoint( aStartingPoint );
+ ImplGetPoint( aIntermediatePoint );
+ ImplGetPoint( aEndingPoint );
+
+ double fA = aIntermediatePoint.X - aStartingPoint.X;
+ double fB = aIntermediatePoint.Y - aStartingPoint.Y;
+ double fC = aEndingPoint.X - aStartingPoint.X;
+ double fD = aEndingPoint.Y - aStartingPoint.Y;
+
+ double fE = fA * ( aStartingPoint.X + aIntermediatePoint.X ) + fB * ( aStartingPoint.Y + aIntermediatePoint.Y );
+ double fF = fC * ( aStartingPoint.X + aEndingPoint.X ) + fD * ( aStartingPoint.Y + aEndingPoint.Y );
+
+ double fG = 2.0 * ( fA * ( aEndingPoint.Y - aIntermediatePoint.Y ) - fB * ( aEndingPoint.X - aIntermediatePoint.X ) );
+
+ aCenterPoint.X = ( fD * fE - fB * fF ) / fG;
+ aCenterPoint.Y = ( fA * fF - fC * fE ) / fG;
+
+ if ( fG != 0 )
+ {
+ double fStartAngle = ImplGetOrientation( aCenterPoint, aStartingPoint );
+ double fInterAngle = ImplGetOrientation( aCenterPoint, aIntermediatePoint );
+ double fEndAngle = ImplGetOrientation( aCenterPoint, aEndingPoint );
+
+ if ( fStartAngle > fEndAngle )
+ {
+ nSwitch ^=1;
+ aIntermediatePoint = aEndingPoint;
+ aEndingPoint = aStartingPoint;
+ aStartingPoint = aIntermediatePoint;
+ fG = fStartAngle;
+ fStartAngle = fEndAngle;
+ fEndAngle = fG;
+ }
+ if ( ! ( fInterAngle > fStartAngle ) && ( fInterAngle < fEndAngle ) )
+ {
+ nSwitch ^=1;
+ aIntermediatePoint = aEndingPoint;
+ aEndingPoint = aStartingPoint;
+ aStartingPoint = aIntermediatePoint;
+ fG = fStartAngle;
+ fStartAngle = fEndAngle;
+ fEndAngle = fG;
+ }
+ FloatPoint fRadius;
+ fRadius.Y = fRadius.X = sqrt( pow( ( aStartingPoint.X - aCenterPoint.X ), 2 ) + pow( ( aStartingPoint.Y - aCenterPoint.Y ), 2 ) ) ;
+
+ sal_uInt32 nType = ImplGetUI16();
+ if ( nType == 0 )
+ nType = 0; // is PIE
+ else
+ nType = 1; // is CHORD
+
+ double fOrientation = 0;
+ mpOutAct->DrawEllipticalArc( aCenterPoint, fRadius, fOrientation, nType, fStartAngle, fEndAngle );
+ }
+ }
+ break;
+
+ case 0x0f : ComOut( CGM_LEVEL1 | CGM_EXTENDED_PRIMITIVES_SET, "Circular Arc Centre" )
+ {
+ double fOrientation, fStartAngle, fEndAngle, vector[ 4 ];
+ FloatPoint aCenter, aRadius;
+
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+
+ ImplGetPoint( aCenter, sal_True );
+ ImplGetVector( &vector[ 0 ] );
+
+ if ( pElement->eVDCType == VDC_REAL )
+ {
+ aRadius.X = (double)ImplGetFloat( pElement->eVDCRealPrecision, pElement->nVDCRealSize );
+ }
+ else
+ {
+ aRadius.X = (double)ImplGetI( pElement->nVDCIntegerPrecision );
+ }
+
+ ImplMapDouble( aRadius.X );
+ aRadius.Y = aRadius.X;
+
+ fStartAngle = acos( vector[ 0 ] / sqrt( vector[ 0 ] * vector[ 0 ] + vector[ 1 ] * vector[ 1 ] ) ) * 57.29577951308;
+ fEndAngle = acos( vector[ 2 ] / sqrt( vector[ 2 ] * vector[ 2 ] + vector[ 3 ] * vector[ 3 ] ) ) * 57.29577951308;
+
+ if ( vector[ 1 ] > 0 )
+ fStartAngle = 360 - fStartAngle;
+ if ( vector[ 3 ] > 0 )
+ fEndAngle = 360 - fEndAngle;
+
+ if ( mbAngReverse )
+ ImplSwitchStartEndAngle( fStartAngle, fEndAngle );
+
+ if ( mbFigure )
+ {
+ Rectangle aBoundingBox(
+ Point( (long)( aCenter.X - aRadius.X ), long( aCenter.Y - aRadius.X ) ),
+ Size( static_cast< long >( 2 * aRadius.X ), (long)( 2 * aRadius.X ) ) );
+ Polygon aPolygon( aBoundingBox,
+ Point( (long)vector[ 0 ], (long)vector[ 1 ] ),
+ Point( (long)vector[ 2 ], (long)vector[ 3 ] ), POLY_ARC );
+ mpOutAct->RegPolyLine( aPolygon );
+ }
+ else
+ {
+ fOrientation = 0;
+ mpOutAct->DrawEllipticalArc( aCenter, aRadius, fOrientation, 2, fStartAngle, fEndAngle );
+ }
+ mnParaSize = mnElementSize;
+
+ }
+ break;
+
+ case 0x10 : ComOut( CGM_LEVEL1 | CGM_EXTENDED_PRIMITIVES_SET, "Circular Arc Centre Close" )
+ {
+ double fOrientation, fStartAngle, fEndAngle, vector[ 4 ];
+ FloatPoint aCenter, aRadius;
+
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+
+ ImplGetPoint( aCenter, sal_True );
+ ImplGetVector( &vector[ 0 ] );
+ if ( pElement->eVDCType == VDC_REAL )
+ {
+ aRadius.X = (double)ImplGetFloat( pElement->eVDCRealPrecision, pElement->nVDCRealSize );
+ }
+ else
+ {
+ aRadius.X = (double)ImplGetI( pElement->nVDCIntegerPrecision );
+ }
+ ImplMapDouble( aRadius.X );
+ aRadius.Y = aRadius.X;
+ fStartAngle = acos( vector[ 0 ] / sqrt( vector[ 0 ] * vector[ 0 ] + vector[ 1 ] * vector[ 1 ] ) ) * 57.29577951308;
+ fEndAngle = acos( vector[ 2 ] / sqrt( vector[ 2 ] * vector[ 2 ] + vector[ 3 ] * vector[ 3 ] ) ) * 57.29577951308;
+
+ if ( vector[ 1 ] > 0 )
+ fStartAngle = 360 - fStartAngle;
+ if ( vector[ 3 ] > 0 )
+ fEndAngle = 360 - fEndAngle;
+
+ if ( mbAngReverse )
+ ImplSwitchStartEndAngle( fStartAngle, fEndAngle );
+
+
+ sal_uInt32 nType = ImplGetUI16();
+ if ( nType == 0 )
+ nType = 0; // is PIE
+ else
+ nType = 1; // is CHORD
+ fOrientation = 0;
+
+ mpOutAct->DrawEllipticalArc( aCenter, aRadius, fOrientation,
+ nType, fStartAngle, fEndAngle );
+ mnParaSize = mnElementSize;
+ }
+ break;
+
+ case 0x11 : ComOut( CGM_LEVEL1 | CGM_EXTENDED_PRIMITIVES_SET, "Ellipse" )
+ {
+ double fOrientation;
+ FloatPoint aCenter, aRadius;
+
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+
+ ImplGetEllipse( aCenter, aRadius, fOrientation ) ;
+ mpOutAct->DrawEllipse( aCenter, aRadius, fOrientation ) ;
+ }
+ break;
+
+ case 0x12 : ComOut( CGM_LEVEL1 | CGM_EXTENDED_PRIMITIVES_SET, "Elliptical Arc" )
+ {
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+
+ double fOrientation, fStartAngle, fEndAngle, vector[ 4 ];
+ FloatPoint aCenter, aRadius;
+
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+
+ sal_Bool bDirection = ImplGetEllipse( aCenter, aRadius, fOrientation );
+ ImplGetVector( &vector[ 0 ] );
+
+ fStartAngle = acos( vector[ 0 ] / sqrt( vector[ 0 ] * vector[ 0 ] + vector[ 1 ] * vector[ 1 ] ) ) * 57.29577951308;
+ fEndAngle = acos( vector[ 2 ] / sqrt( vector[ 2 ] * vector[ 2 ] + vector[ 3 ] * vector[ 3 ] ) ) * 57.29577951308;
+
+ if ( vector[ 1 ] > 0 )
+ fStartAngle = 360 - fStartAngle;
+ if ( vector[ 3 ] > 0 )
+ fEndAngle = 360 - fEndAngle;
+
+ if ( bDirection )
+ mpOutAct->DrawEllipticalArc( aCenter, aRadius, fOrientation,
+ 2, fStartAngle, fEndAngle );
+ else
+ mpOutAct->DrawEllipticalArc( aCenter, aRadius, fOrientation,
+ 2, fEndAngle, fStartAngle);
+ }
+ break;
+
+ case 0x13 : ComOut( CGM_LEVEL1 | CGM_EXTENDED_PRIMITIVES_SET, "Elliptical Arc Close" )
+ {
+ double fOrientation, fStartAngle, fEndAngle, vector[ 4 ];
+ FloatPoint aCenter, aRadius;
+
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+
+ sal_Bool bDirection = ImplGetEllipse( aCenter, aRadius, fOrientation );
+ ImplGetVector( &vector[ 0 ] );
+
+ fStartAngle = acos( vector[ 0 ] / sqrt( vector[ 0 ] * vector[ 0 ] + vector[ 1 ] * vector[ 1 ] ) ) * 57.29577951308;
+ fEndAngle = acos( vector[ 2 ] / sqrt( vector[ 2 ] * vector[ 2 ] + vector[ 3 ] * vector[ 3 ] ) ) * 57.29577951308;
+
+ if ( vector[ 1 ] > 0 )
+ fStartAngle = 360 - fStartAngle;
+ if ( vector[ 3 ] > 0 )
+ fEndAngle = 360 - fEndAngle;
+
+ sal_uInt32 nType = ImplGetUI16();
+ if ( nType == 0 )
+ nType = 0; // is PIE
+ else
+ nType = 1; // is CHORD
+
+ if ( bDirection )
+ mpOutAct->DrawEllipticalArc( aCenter, aRadius, fOrientation,
+ nType, fStartAngle, fEndAngle );
+ else
+ mpOutAct->DrawEllipticalArc( aCenter, aRadius, fOrientation,
+ nType, fEndAngle, fStartAngle);
+ }
+ break;
+ case 0x14 : ComOut( CGM_LEVEL2, "Circular Arc Centre Reversed" )
+ {
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+ }
+ break;
+ case 0x15 : ComOut( CGM_LEVEL2, "Connection Edge" ) // NS
+ {
+// if ( mbFigure )
+// mpOutAct->CloseRegion();
+ }
+ break;
+ case 0x16 : ComOut( CGM_LEVEL3, "Hyperbolic Arc" ) // NS
+ {
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+ }
+ break;
+ case 0x17 : ComOut( CGM_LEVEL3, "Parabolic Arc" ) // NS
+ {
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+ }
+ break;
+ case 0x18 : ComOut( CGM_LEVEL3, "Non Uniform B-Spline" ) // NS
+ {
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+ }
+ break;
+ case 0x19 : ComOut( CGM_LEVEL3, "Non Uniform Rational B-Spline" ) // NS
+ {
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+ }
+ break;
+ case 0x1a : ComOut( CGM_LEVEL3, "Polybezier" )
+ {
+ sal_uInt32 nOrder = ImplGetI( pElement->nIntegerPrecision );
+
+ USHORT nNumberOfPoints = sal::static_int_cast< USHORT >(( mnElementSize - pElement->nIntegerPrecision ) / ImplGetPointSize());
+
+ Polygon aPolygon( nNumberOfPoints );
+
+ for ( USHORT i = 0; i < nNumberOfPoints; i++)
+ {
+ FloatPoint aFloatPoint;
+ ImplGetPoint( aFloatPoint, sal_True );
+ aPolygon.SetPoint( Point ( (long)( aFloatPoint.X ), (long)( aFloatPoint.Y ) ), i );
+ }
+ if ( nOrder & 4 )
+ {
+ for ( USHORT i = 0; i < nNumberOfPoints; i++ )
+ {
+ if ( ( i % 3 ) == 0 )
+ aPolygon.SetFlags( i, POLY_NORMAL );
+ else
+ aPolygon.SetFlags( i, POLY_CONTROL );
+ }
+ }
+ else
+ {
+ for ( USHORT i = 0; i < nNumberOfPoints; i++ )
+ {
+ switch ( i & 3 )
+ {
+ case 0 :
+ case 3 : aPolygon.SetFlags( i, POLY_NORMAL ); break;
+ default : aPolygon.SetFlags( i, POLY_CONTROL ); break;
+ }
+ }
+ }
+ if ( mbFigure )
+ mpOutAct->RegPolyLine( aPolygon );
+ else
+ mpOutAct->DrawPolybezier( aPolygon );
+ mnParaSize = mnElementSize;
+ }
+ break;
+
+ case 0x1b : ComOut( CGM_LEVEL3, "Polysymbol" ) // NS
+ {
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+ }
+ break;
+ case 0x1c : ComOut( CGM_LEVEL3, "Bitonal Tile" ) // NS
+ {
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+ }
+ break;
+ case 0x1d : ComOut( CGM_LEVEL3, "Tile" ) // NS
+ {
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+ }
+ break;
+ case 0x1e : ComOut( CGM_UNKNOWN_LEVEL, "Insert Object" )
+ {
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+ }
+ break;
+ case 0xff : ComOut( CGM_GDSF_ONLY, "Polybezier" )
+ {
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+ }
+ break;
+ case 0xfe : ComOut( CGM_GDSF_ONLY, "Sharp Polybezier" )
+ {
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+ }
+ break;
+ case 0xfd : ComOut( CGM_GDSF_ONLY, "Polyspline" )
+ {
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+ }
+ break;
+ case 0xfc : ComOut( CGM_GDSF_ONLY, "Reounded Rectangle" )
+ {
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+ }
+ break;
+ case 0xfb : ComOut( CGM_GDSF_ONLY, "Begin Cell Array" )
+ {
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+ }
+ break;
+ case 0xfa : ComOut( CGM_GDSF_ONLY, "End Cell Array" )
+ {
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+ }
+ break;
+ case 0xf9 : ComOut( CGM_GDSF_ONLY, "Insert File" )
+ {
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+ }
+ break;
+ case 0xf8 : ComOut( CGM_GDSF_ONLY, "Block Text" )
+ {
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+ }
+ break;
+ case 0xf7 : ComOut( CGM_GDSF_ONLY, "Variable Width Polyline" )
+ {
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+ }
+ break;
+ case 0xf6 : ComOut( CGM_GDSF_ONLY, "Elliptical Arc 3 Point" )
+ {
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+ }
+ break;
+ case 0xf1 : ComOut( CGM_GDSF_ONLY, "Hyperlink Definition" ) break;
+ default: ComOut( CGM_UNKNOWN_COMMAND, "" ) break;
+ }
+ }
+ else
+ mnParaSize = mnElementSize;
+};
+
+
diff --git a/filter/source/graphicfilter/icgm/class5.cxx b/filter/source/graphicfilter/icgm/class5.cxx
new file mode 100644
index 000000000000..6d570a0b7baf
--- /dev/null
+++ b/filter/source/graphicfilter/icgm/class5.cxx
@@ -0,0 +1,524 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+//#define VCL_NEED_BASETSD
+
+#include <main.hxx>
+#include <outact.hxx>
+
+
+// ---------------------------------------------------------------
+
+void CGM::ImplDoClass5()
+{
+ switch ( mnElementID )
+ {
+ case 0x01 : ComOut( CGM_LEVEL1, "Line Bundle Index" )
+ pElement->pLineBundle = (LineBundle*)pElement->GetBundleIndex( ImplGetI( pElement->nIndexPrecision ), pElement->aLineList, pElement->aLineBundle );
+ break;
+ case 0x02 : ComOut( CGM_LEVEL1, "Line Type" )
+ {
+ if ( pElement->nAspectSourceFlags & ASF_LINETYPE )
+ pElement->pLineBundle->eLineType = (LineType)ImplGetI( pElement->nIndexPrecision );
+ else
+ pElement->aLineBundle.eLineType = (LineType)ImplGetI( pElement->nIndexPrecision );
+ }
+ break;
+ case 0x03 : ComOut( CGM_LEVEL1, "Line Width" )
+ {
+ double nWidth;
+ if ( pElement->eLineWidthSpecMode == SM_ABSOLUTE )
+ {
+ if ( pElement->eVDCType == VDC_REAL )
+ nWidth = ImplGetFloat( pElement->eVDCRealPrecision, pElement->nVDCRealSize );
+ else
+ nWidth = (double)ImplGetI( pElement->nVDCIntegerPrecision );
+
+ ImplMapDouble( nWidth );
+ }
+ else
+ nWidth = (sal_uInt32)ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize ) * 25; // scaling in 1/4 mm
+
+ ( pElement->nAspectSourceFlags & ASF_LINEWIDTH )
+ ? pElement->aLineBundle.nLineWidth = nWidth
+ : pElement->aLineBundle.nLineWidth = nWidth;
+ }
+ break;
+ case 0x04 : ComOut( CGM_LEVEL1, "Line Color" )
+ {
+ if ( pElement->nAspectSourceFlags & ASF_LINECOLOR )
+ pElement->pLineBundle->SetColor( ImplGetBitmapColor() );
+ else
+ pElement->aLineBundle.SetColor( ImplGetBitmapColor() );
+ }
+ break;
+ case 0x05 : ComOut( CGM_LEVEL1, "Marker Bundle Index" )
+ pElement->pMarkerBundle = (MarkerBundle*)pElement->GetBundleIndex( ImplGetI( pElement->nIndexPrecision ), pElement->aMarkerList, pElement->aMarkerBundle );
+ break;
+ case 0x06 : ComOut( CGM_LEVEL1, "Marker Type" )
+ {
+ if ( pElement->nAspectSourceFlags & ASF_MARKERTYPE )
+ pElement->pMarkerBundle->eMarkerType = (MarkerType)ImplGetI( pElement->nIndexPrecision );
+ else
+ pElement->aMarkerBundle.eMarkerType = (MarkerType)ImplGetI( pElement->nIndexPrecision );
+ }
+ break;
+ case 0x07 : ComOut( CGM_LEVEL1, "Marker Size" )
+ {
+ double nWidth;
+ if ( pElement->eMarkerSizeSpecMode == SM_ABSOLUTE )
+ {
+ if ( pElement->eVDCType == VDC_REAL )
+ nWidth = ImplGetFloat( pElement->eVDCRealPrecision, pElement->nVDCRealSize );
+ else
+ nWidth = (double)ImplGetI( pElement->nVDCIntegerPrecision );
+ ImplMapDouble( nWidth );
+ }
+ else
+ nWidth = (sal_uInt32)ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize ) * 25;
+ ( pElement->nAspectSourceFlags & ASF_MARKERSIZE )
+ ? pElement->aMarkerBundle.nMarkerSize = nWidth
+ : pElement->aMarkerBundle.nMarkerSize = nWidth;
+ }
+ break;
+ case 0x08 : ComOut( CGM_LEVEL1, "Marker Color" )
+ {
+ if ( pElement->nAspectSourceFlags & ASF_MARKERCOLOR )
+ pElement->pMarkerBundle->SetColor( ImplGetBitmapColor() );
+ else
+ pElement->aMarkerBundle.SetColor( ImplGetBitmapColor() );
+ }
+ break;
+ case 0x09 : ComOut( CGM_LEVEL1, "Text Bundle Index" )
+ pElement->pTextBundle = (TextBundle*)pElement->GetBundleIndex( ImplGetI( pElement->nIndexPrecision ), pElement->aTextList, pElement->aTextBundle );
+ break;
+ case 0x0a : ComOut( CGM_LEVEL1, "Text Font Index" )
+ {
+ if ( pElement->nAspectSourceFlags & ASF_TEXTFONTINDEX )
+ pElement->pTextBundle->nTextFontIndex = ImplGetI( pElement->nIndexPrecision );
+ else
+ pElement->aTextBundle.nTextFontIndex = ImplGetI( pElement->nIndexPrecision );
+ }
+ break;
+ case 0x0b : ComOut( CGM_LEVEL1, "Text Precision" )
+ {
+ TextBundle* pBundle;
+ if ( pElement->nAspectSourceFlags & ASF_TEXTPRECISION )
+ pBundle = pElement->pTextBundle;
+ else
+ pBundle = &pElement->aTextBundle;
+ switch( ImplGetUI16() )
+ {
+ case 0 : pBundle->eTextPrecision = TPR_STRING; break;
+ case 1 : pBundle->eTextPrecision = TPR_CHARACTER; break;
+ case 2 : pBundle->eTextPrecision = TPR_STROKE; break;
+ default : pBundle->eTextPrecision = TPR_UNDEFINED; break;
+ }
+ }
+ break;
+ case 0x0c : ComOut( CGM_LEVEL1, "Character Expansion Factor" )
+ {
+ if ( pElement->nAspectSourceFlags & ASF_CHARACTEREXPANSION )
+ pElement->pTextBundle->nCharacterExpansion = ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize );
+ else
+ pElement->aTextBundle.nCharacterExpansion = ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize );
+ }
+ break;
+ case 0x0d : ComOut( CGM_LEVEL1, "Character Spacing" )
+ {
+ if ( pElement->nAspectSourceFlags & ASF_CHARACTERSPACING )
+ pElement->pTextBundle->nCharacterSpacing = ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize );
+ else
+ pElement->aTextBundle.nCharacterSpacing = ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize );
+ }
+ break;
+ case 0x0e : ComOut( CGM_LEVEL1, "Text Color" )
+ {
+ if ( pElement->nAspectSourceFlags & ASF_TEXTCOLOR )
+ pElement->pTextBundle->SetColor( ImplGetBitmapColor() );
+ else
+ pElement->aTextBundle.SetColor( ImplGetBitmapColor() );
+ }
+ break;
+ case 0x0f : ComOut( CGM_LEVEL1, "Character Height" )
+ {
+ if ( pElement->eVDCType == VDC_INTEGER )
+ pElement->nCharacterHeight = ImplGetI( pElement->nVDCIntegerPrecision );
+ else // ->floating points
+ pElement->nCharacterHeight = ImplGetFloat( pElement->eVDCRealPrecision, pElement->nVDCRealSize );
+ ImplMapDouble( pElement->nCharacterHeight );
+ pElement->nCharacterHeight /= 18.0;
+ }
+ break;
+ case 0x10 : ComOut( CGM_LEVEL1, "Character Orientation" )
+ {
+ if ( pElement->eVDCType == VDC_INTEGER )
+ {
+ pElement->nCharacterOrientation[0] = ImplGetI( pElement->nVDCIntegerPrecision );
+ pElement->nCharacterOrientation[1] = ImplGetI( pElement->nVDCIntegerPrecision );
+ pElement->nCharacterOrientation[2] = ImplGetI( pElement->nVDCIntegerPrecision );
+ pElement->nCharacterOrientation[3] = ImplGetI( pElement->nVDCIntegerPrecision );
+ }
+ else // ->floating points
+ {
+ pElement->nCharacterOrientation[0] = ImplGetFloat( pElement->eVDCRealPrecision, pElement->nVDCRealSize );
+ pElement->nCharacterOrientation[1] = ImplGetFloat( pElement->eVDCRealPrecision, pElement->nVDCRealSize );
+ pElement->nCharacterOrientation[2] = ImplGetFloat( pElement->eVDCRealPrecision, pElement->nVDCRealSize );
+ pElement->nCharacterOrientation[3] = ImplGetFloat( pElement->eVDCRealPrecision, pElement->nVDCRealSize );
+ }
+ }
+ break;
+ case 0x11 : ComOut( CGM_LEVEL1, "Text Path" )
+ {
+ switch( ImplGetUI16() )
+ {
+ case 0 : pElement->eTextPath = TPR_RIGHT; break;
+ case 1 : pElement->eTextPath = TPR_LEFT; break;
+ case 2 : pElement->eTextPath = TPR_UP; break;
+ case 3 : pElement->eTextPath = TPR_DOWN; break;
+ default : mbStatus = sal_False; break;
+ }
+ }
+ break;
+ case 0x12 : ComOut( CGM_LEVEL1, "Text Alignment" )
+ {
+ pElement->eTextAlignmentH = (TextAlignmentH)ImplGetUI16();
+ pElement->eTextAlignmentV = (TextAlignmentV)ImplGetUI16( 8 );
+ pElement->nTextAlignmentHCont = ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize );
+ pElement->nTextAlignmentVCont = ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize );
+ }
+ break;
+ case 0x13 : ComOut( CGM_LEVEL1 | CGM_DRAWING_PLUS_CONTROL_SET, "Character Set Index" )
+ pElement->nCharacterSetIndex = ImplGetI( pElement->nIndexPrecision );
+ break;
+ case 0x14 : ComOut( CGM_LEVEL1 | CGM_DRAWING_PLUS_CONTROL_SET, "Alternate Character Set Index" )
+ pElement->nAlternateCharacterSetIndex = ImplGetI( pElement->nIndexPrecision );
+ break;
+ case 0x15 : ComOut( CGM_LEVEL1, "Fill Bundle Index" )
+ pElement->pFillBundle = (FillBundle*)pElement->GetBundleIndex( ImplGetI( pElement->nIndexPrecision ), pElement->aFillList, pElement->aFillBundle );
+ break;
+ case 0x16 : ComOut( CGM_LEVEL1, "Fill Interior Style" )
+ {
+ if ( pElement->nAspectSourceFlags & ASF_FILLINTERIORSTYLE )
+ pElement->pFillBundle->eFillInteriorStyle = (FillInteriorStyle)ImplGetUI16();
+ else
+ pElement->aFillBundle.eFillInteriorStyle = (FillInteriorStyle)ImplGetUI16();
+ }
+ break;
+ case 0x17 : ComOut( CGM_LEVEL1, "Fill Color" )
+ {
+ if ( pElement->nAspectSourceFlags & ASF_FILLCOLOR )
+ pElement->pFillBundle->SetColor( ImplGetBitmapColor() );
+ else
+ pElement->aFillBundle.SetColor( ImplGetBitmapColor() );
+ }
+ break;
+ case 0x18 : ComOut( CGM_LEVEL1, "Fill Hatch Index" )
+ {
+ if ( pElement->nAspectSourceFlags & ASF_HATCHINDEX )
+ pElement->pFillBundle->nFillHatchIndex = ImplGetI( pElement->nIndexPrecision );
+ else
+ pElement->aFillBundle.nFillHatchIndex = ImplGetI( pElement->nIndexPrecision );
+ }
+ break;
+ case 0x19 : ComOut( CGM_LEVEL1, "Fill Pattern Index" )
+ {
+ if ( pElement->nAspectSourceFlags & ASF_PATTERNINDEX )
+ pElement->pFillBundle->nFillPatternIndex = ImplGetI( pElement->nIndexPrecision );
+ else
+ pElement->aFillBundle.nFillPatternIndex = ImplGetI( pElement->nIndexPrecision );
+ }
+ break;
+ case 0x1a : ComOut( CGM_LEVEL1, "Edge Bundle Index" )
+ pElement->pEdgeBundle = (EdgeBundle*)pElement->GetBundleIndex( ImplGetI( pElement->nIndexPrecision ), pElement->aEdgeList, pElement->aEdgeBundle );
+ break;
+ case 0x1b : ComOut( CGM_LEVEL1, "Edge Type" )
+ {
+ if ( pElement->nAspectSourceFlags & ASF_EDGETYPE )
+ pElement->pEdgeBundle->eEdgeType = (EdgeType)ImplGetI( pElement->nIndexPrecision );
+ else
+ pElement->aEdgeBundle.eEdgeType = (EdgeType)ImplGetI( pElement->nIndexPrecision );
+ }
+ break;
+ case 0x1c : ComOut( CGM_LEVEL1, "Edge Width" )
+ {
+ double nWidth;
+ if ( pElement->eEdgeWidthSpecMode == SM_ABSOLUTE )
+ {
+ if ( pElement->eVDCType == VDC_REAL )
+ nWidth = ImplGetFloat( pElement->eVDCRealPrecision, pElement->nVDCRealSize );
+ else
+ nWidth = (double)ImplGetI( pElement->nVDCIntegerPrecision );
+
+ ImplMapDouble( nWidth );
+ }
+ else
+ nWidth = (sal_uInt32)ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize ) * 25;
+ ( pElement->nAspectSourceFlags & ASF_EDGEWIDTH )
+ ? pElement->aEdgeBundle.nEdgeWidth = nWidth
+ : pElement->aEdgeBundle.nEdgeWidth = nWidth;
+ }
+ break;
+ case 0x1d : ComOut( CGM_LEVEL1, "Edge Color" )
+ {
+ if ( pElement->nAspectSourceFlags & ASF_EDGECOLOR )
+ pElement->pEdgeBundle->SetColor( ImplGetBitmapColor() );
+ else
+ pElement->aEdgeBundle.SetColor( ImplGetBitmapColor() );
+ }
+ break;
+ case 0x1e : ComOut( CGM_LEVEL1, "Edge Visibility" )
+ {
+ switch( ImplGetUI16() )
+ {
+ case 0 : pElement->eEdgeVisibility = EV_OFF; break;
+ case 1 : pElement->eEdgeVisibility = EV_ON; break;
+ default : mbStatus = sal_False;
+ }
+ }
+ break;
+ case 0x1f : ComOut( CGM_LEVEL1, "Fill Reference Point" )
+ ImplGetPoint( pElement->aFillRefPoint );
+ break;
+ case 0x20 : ComOut( CGM_LEVEL1, "Pattern Table" ) break;
+ case 0x21 : ComOut( CGM_LEVEL1, "Pattern Size" ) break;
+ case 0x22 : ComOut( CGM_LEVEL1, "Color Table" )
+ {
+ sal_uInt32 nColorStartIndex = ImplGetUI( pElement->nColorIndexPrecision );
+ if ( ( nColorStartIndex > 255 ) ||
+ ( ( ( mnElementSize - pElement->nColorIndexPrecision ) % ( pElement->nColorPrecision * 3 ) ) != 0 ) )
+ {
+ mbStatus = sal_False;
+ }
+ else
+ {
+ sal_uInt32 nColors = ( mnElementSize - pElement->nColorIndexPrecision ) / ( 3 * pElement->nColorPrecision );
+ if ( nColors )
+ {
+ sal_uInt32 nMaxColorIndex = nColorStartIndex + nColors - 1;
+ sal_uInt32 nIndex;
+ if ( nMaxColorIndex > 255 )
+ {
+ mbStatus = sal_False;
+ }
+ else
+ {
+ if ( pElement->nLatestColorMaximumIndex < nMaxColorIndex )
+ pElement->nLatestColorMaximumIndex = nMaxColorIndex;
+
+ for ( nIndex = nColorStartIndex; nIndex <= nMaxColorIndex; nIndex++ )
+ {
+ pElement->aLatestColorTable[ nIndex ] = ImplGetBitmapColor( sal_True );
+ }
+ }
+ pElement->nColorMaximumIndex = pElement->nLatestColorMaximumIndex;
+ for ( nIndex = nColorStartIndex; nIndex <= nMaxColorIndex; nIndex++ )
+ {
+ if ( !pElement->aColorTableEntryIs[ nIndex ] )
+ {
+ pElement->aColorTableEntryIs[ nIndex ] = 1;
+ pElement->aColorTable[ nIndex ] = pElement->aLatestColorTable[ nIndex ];
+ }
+ }
+ }
+ }
+ }
+ break;
+ case 0x23 : ComOut( CGM_LEVEL1, "Aspect Source Flags" )
+ {
+ int nFlags = mnElementSize >> 2;
+ while ( nFlags-- > 0 )
+ {
+ sal_uInt32 nFlag = 0;
+ switch( ImplGetUI16() )
+ {
+ case 0 : nFlag = ASF_LINETYPE; break;
+ case 1 : nFlag = ASF_LINEWIDTH; break;
+ case 2 : nFlag = ASF_LINECOLOR; break;
+ case 3 : nFlag = ASF_MARKERTYPE; break;
+ case 4 : nFlag = ASF_MARKERSIZE; break;
+ case 5 : nFlag = ASF_MARKERCOLOR; break;
+ case 6 : nFlag = ASF_FILLINTERIORSTYLE; break;
+ case 7 : nFlag = ASF_HATCHINDEX; break;
+ case 8 : nFlag = ASF_PATTERNINDEX; break;
+ case 9 : nFlag = ASF_BITMAPINDEX; break;
+ case 10 : nFlag = ASF_FILLCOLOR; break;
+ case 11 : nFlag = ASF_EDGETYPE; break;
+ case 12 : nFlag = ASF_EDGEWIDTH; break;
+ case 13 : nFlag = ASF_EDGECOLOR; break;
+ case 14 : nFlag = ASF_TEXTFONTINDEX; break;
+ case 15 : nFlag = ASF_TEXTPRECISION; break;
+ case 16 : nFlag = ASF_CHARACTEREXPANSION; break;
+ case 17 : nFlag = ASF_CHARACTERSPACING; break;
+ case 18 : nFlag = ASF_TEXTCOLOR; break;
+ default : mbStatus = sal_False; break;
+ }
+ sal_uInt32 nASF = ImplGetUI16();
+ switch ( nASF )
+ {
+ case 0 : pElement->nAspectSourceFlags &= ~nFlag; break; // INDIVIDUAL
+ case 1 : pElement->nAspectSourceFlags |= nFlag; break; // BUNDLED
+ default : mbStatus = sal_False; break;
+ }
+ }
+ }
+ break;
+ case 0x24 : ComOut( CGM_LEVEL2, "Pick Identifier" ) break;
+ case 0x25 : ComOut( CGM_LEVEL3, "Line Cap" )
+ {
+ switch( ImplGetUI16() )
+ {
+ case 0 : pElement->eLineCapType = LCT_BUTT; break;
+ case 1 : pElement->eLineCapType = LCT_ROUND; break;
+ case 2 : pElement->eLineCapType = LCT_SQUARE; break;
+ case 3 : pElement->eLineCapType = LCT_TRIANGLE; break;
+ case 4 : pElement->eLineCapType = LCT_ARROW; break;
+ default : pElement->eLineCapType = LCT_NONE; break;
+ }
+ }
+ break;
+ case 0x26 : ComOut( CGM_LEVEL3, "Line Join" )
+ {
+ switch( ImplGetUI16() )
+ {
+ case 0 : pElement->eLineJoinType = LJT_MITER; break;
+ case 1 : pElement->eLineJoinType = LJT_ROUND; break;
+ case 2 : pElement->eLineJoinType = LJT_BEVEL; break;
+ default : pElement->eLineJoinType = LJT_NONE; break;
+ }
+ }
+ break;
+ case 0x27 : ComOut( CGM_LEVEL3, "Line Type Continuation" ) break; // NS
+ case 0x28 : ComOut( CGM_LEVEL3, "Line Type Initial Offset" ) break; // NS
+ case 0x29 : ComOut( CGM_LEVEL3, "Text Score Type" ) break;
+ case 0x2a : ComOut( CGM_LEVEL3, "Restricted Text Type" ) break;
+ case 0x2b : ComOut( CGM_LEVEL3, "Interpolated interior" ) break;
+ case 0x2c : ComOut( CGM_LEVEL3, "Edge Cap" ) break; // NS
+ case 0x2d : ComOut( CGM_LEVEL3, "Edge Join" ) break;
+ case 0x2e : ComOut( CGM_LEVEL3, "Edge Type Continuation" ) break; // NS
+ case 0x2f : ComOut( CGM_LEVEL3, "Edge Type Initial Offset" ) break; // NS
+ case 0x30 : ComOut( CGM_LEVEL3, "Symbol Library Index" ) break; // NS
+ case 0x31 : ComOut( CGM_LEVEL3, "Symbol Color" ) break; // NS
+ case 0x32 : ComOut( CGM_LEVEL3, "Symbol Size" ) break; // NS
+ case 0x33 : ComOut( CGM_LEVEL3, "Symbol Orientation" ) break; // NS
+ case 0x50 : ComOut( CGM_UNKNOWN_LEVEL, "Block Text Region Margins" ) break;
+ case 0x51 : ComOut( CGM_UNKNOWN_LEVEL, "Block Text Region Expansion" ) break;
+ case 0x52 : ComOut( CGM_UNKNOWN_LEVEL, "Block Text Region Anchor" ) break;
+ case 0x53 : ComOut( CGM_UNKNOWN_LEVEL, "Block Text Paragraph Horizontal Alignment" ) break;
+ case 0x54 : ComOut( CGM_UNKNOWN_LEVEL, "Block Text Paragraph Vertical Alignment" ) break;
+ case 0x55 : ComOut( CGM_UNKNOWN_LEVEL, "Block Text Line Flow" ) break;
+ case 0x60 : ComOut( CGM_UNKNOWN_LEVEL, "Block Text Paragraph Spacing" ) break;
+ case 0x61 : ComOut( CGM_UNKNOWN_LEVEL, "Block Text Paragraph Indent" ) break;
+ case 0x62 : ComOut( CGM_UNKNOWN_LEVEL, "Block Text Paragraph Tabs" ) break;
+ case 0x63 : ComOut( CGM_UNKNOWN_LEVEL, "Block Text Paragraph Bullets" ) break;
+ case 0x64 : ComOut( CGM_UNKNOWN_LEVEL, "Block Text Paragraph Bullet Level" ) break;
+ case 0x65 : ComOut( CGM_UNKNOWN_LEVEL, "Block Text Paragraph Line Horizontal Alignment" ) break;
+ case 0x66 : ComOut( CGM_UNKNOWN_LEVEL, "Block Text Paragraph Line Vertical Alignment" ) break;
+ case 0x67 : ComOut( CGM_UNKNOWN_LEVEL, "Block Text Paragragh Line Spacing" ) break;
+ case 0x68 : ComOut( CGM_UNKNOWN_LEVEL, "Block Text Paragraph Word Wrap" ) break;
+ case 0x70 : ComOut( CGM_UNKNOWN_LEVEL, "Block Text Forward Advance Distance" ) break;
+ case 0x71 : ComOut( CGM_UNKNOWN_LEVEL, "Word Spacing" ) break;
+ case 0x72 : ComOut( CGM_UNKNOWN_LEVEL, "External Leading" ) break;
+ case 0x7a : ComOut( CGM_UNKNOWN_LEVEL, "set Gradient Offset" )
+ {
+ long nHorzOffset = ImplGetI( pElement->nIndexPrecision );
+ long nVertOffset = ImplGetI( pElement->nIndexPrecision );
+ sal_uInt32 nType = ImplGetUI16();
+ mpOutAct->SetGradientOffset( nHorzOffset, nVertOffset, nType );
+ mnAct4PostReset |= ACT4_GRADIENT_ACTION;
+ }
+ break;
+ case 0x7b : ComOut( CGM_UNKNOWN_LEVEL, "set Gradient Edge" )
+ {
+ mnAct4PostReset |= ACT4_GRADIENT_ACTION;
+ }
+ break;
+ case 0x7c : ComOut( CGM_UNKNOWN_LEVEL, "set Gradient Angle" )
+ {
+ mpOutAct->SetGradientAngle( ImplGetI( pElement->nIndexPrecision ) );
+ mnAct4PostReset |= ACT4_GRADIENT_ACTION;
+ }
+ break;
+ case 0x7d : ComOut( CGM_UNKNOWN_LEVEL, "set Gradient Description" )
+ {
+ ImplGetI( pElement->nIndexPrecision ); // -Wall is this needed?
+ sal_uInt32 nNumberOfStages = ImplGetI( pElement->nIndexPrecision );
+ sal_uInt32 i, nColorFrom = 0;
+ sal_uInt32 nColorTo = 0xffffff;
+
+ //FIXME, does this loop actually do anything?
+ for ( i = 0; i < nNumberOfStages; i++ )
+ {
+ ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize ); // -Wall is this needed
+ }
+
+ for ( i = 0; i <= nNumberOfStages; i++ )
+ {
+ sal_uInt32 nPara = mnParaSize + 24;
+ if ( i == 0 )
+ {
+ nColorTo = ImplGetBitmapColor();
+ nColorFrom = nColorTo ^ 0xffffff;
+ }
+ else if ( i == 1 )
+ nColorFrom = ImplGetBitmapColor();
+ mnParaSize = nPara;
+ }
+ if ( nNumberOfStages > 1 )
+ mpOutAct->SetGradientStyle( 0xff, 1 );
+
+ mpOutAct->SetGradientDescriptor( nColorFrom, nColorTo );
+ mnAct4PostReset |= ACT4_GRADIENT_ACTION;
+ }
+ break;
+ case 0x7e : ComOut( CGM_UNKNOWN_LEVEL, "set Gradient Style" )
+ {
+ sal_uInt32 nStyle = ImplGetUI16( 8 );
+ double fRatio = ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize );
+ mpOutAct->SetGradientStyle( nStyle, fRatio );
+ mnAct4PostReset |= ACT4_GRADIENT_ACTION;
+ }
+ break;
+ case 0xff : ComOut( CGM_GDSF_ONLY, "inquire Font metrics" ) break;
+ case 0xfe : ComOut( CGM_GDSF_ONLY, "inquire character widths" ) break;
+ case 0xfd : ComOut( CGM_GDSF_ONLY, "set Text Font" ) break;
+ case 0xfc : ComOut( CGM_GDSF_ONLY, "set current position" ) break;
+ case 0xfb : ComOut( CGM_GDSF_ONLY, "set current position mode" ) break;
+ case 0xfa : ComOut( CGM_GDSF_ONLY, "set character height mode" ) break;
+ case 0xf9 : ComOut( CGM_GDSF_ONLY, "set Transform matrix 2D" ) break;
+ case 0xf8 : ComOut( CGM_GDSF_ONLY, "set Transform matrix 3D" ) break;
+ case 0xf7 : ComOut( CGM_GDSF_ONLY, "pop transformation state" ) break;
+ case 0xf6 : ComOut( CGM_GDSF_ONLY, "clear transformation state" ) break;
+ case 0xf5 : ComOut( CGM_GDSF_ONLY, "set character widths" ) break;
+ case 0xf4 : ComOut( CGM_GDSF_ONLY, "set color name - for Pantone support" ) break;
+ default: ComOut( CGM_UNKNOWN_COMMAND, "" ) break;
+ }
+};
+
+
diff --git a/filter/source/graphicfilter/icgm/class7.cxx b/filter/source/graphicfilter/icgm/class7.cxx
new file mode 100644
index 000000000000..21c67bf9c161
--- /dev/null
+++ b/filter/source/graphicfilter/icgm/class7.cxx
@@ -0,0 +1,237 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include <main.hxx>
+#include <chart.hxx>
+#include <outact.hxx>
+
+// ---------------------------------------------------------------
+
+void CGM::ImplDoClass7()
+{
+ switch ( mnElementID )
+ {
+ case 0x01 : ComOut( CGM_LEVEL1, "Message" ) break;
+ case 0x02 :
+ {
+ sal_uInt8* pAppData = mpSource + 12;
+ sal_uInt16* pTemp = (sal_uInt16*)mpSource;
+ sal_uInt16 nOpcode = pTemp[ 4 ];
+
+ if ( mpChart || ( nOpcode == 0 ) )
+ {
+ switch ( nOpcode )
+ {
+ case 0x000 : ComOut( CGM_LEVEL1, "AppData - Beginning of File Opcodes" )
+ {
+ if ( mpChart == NULL )
+ mpChart = new CGMChart( *this );
+ mpChart->mnCurrentFileType = pAppData[ 3 ];
+ }
+ break;
+ case 0x001 : ComOut( CGM_LEVEL1, "AppData - End of File Opcodes" ) break;
+ case 0x190 : ComOut( CGM_LEVEL1, "AppData - FDESC" ) break;
+ case 0x192 : ComOut( CGM_LEVEL1, "AppData - FNOTES" ) break;
+ case 0x1F4 : ComOut( CGM_LEVEL1, "AppData - BOGENFILE" ) break;
+ case 0x1F5 : ComOut( CGM_LEVEL1, "AppData - EOGENFILE" ) break;
+ case 0x1F8 : ComOut( CGM_LEVEL1, "AppData - BOCHTGROUP" ) break;
+ case 0x1F9 : ComOut( CGM_LEVEL1, "AppData - EOCHTGROUP" ) break;
+ case 0x1FC : ComOut( CGM_LEVEL1, "AppData - BOCHTDATA" ) break;
+ case 0x1FD : ComOut( CGM_LEVEL1, "AppData - EOCHTDATA" )
+ {
+ mpOutAct->DrawChart();
+ }
+ break;
+ case 0x200 : ComOut( CGM_LEVEL1, "AppData - BOSYMGROUP" ) break;
+ case 0x201 : ComOut( CGM_LEVEL1, "AppData - EOSYMGROUP" ) break;
+ case 0x204 : ComOut( CGM_LEVEL1, "AppData - BEGSYMBOL" ) break;
+ case 0x205 : ComOut( CGM_LEVEL1, "AppData - ENDSYMBOL" ) break;
+ case 0x208 : ComOut( CGM_LEVEL1, "AppData - BOSHWGROUP" ) break;
+ case 0x209 : ComOut( CGM_LEVEL1, "AppData - EOSHWGROUP" ) break;
+ case 0x260 : ComOut( CGM_LEVEL1, "AppData - BEGGROUP" ) break;
+ case 0x262 : ComOut( CGM_LEVEL1, "AppData - ENDGROUP" ) break;
+ case 0x264 : ComOut( CGM_LEVEL1, "AppData - DATANODE" )
+ {
+ mpChart->mDataNode[ 0 ] = *(DataNode*)( pAppData );
+ sal_Int8 nZoneEnum = mpChart->mDataNode[ 0 ].nZoneEnum;
+ if ( nZoneEnum && ( nZoneEnum <= 6 ) )
+ mpChart->mDataNode[ nZoneEnum ] = *(DataNode*)( pAppData );
+ }
+ break;
+ case 0x2BE : ComOut( CGM_LEVEL1, "AppData - SHWSLIDEREC" )
+ {
+ if ( mnMode & CGM_EXPORT_IMPRESS )
+ {
+ if ( pAppData[ 16 ] == 0 ) // a blank template ?
+ {
+ if ( pAppData[ 2 ] == 46 )
+ {
+ // this starts the document -> maybe we could insert a new document
+ }
+ else if ( pAppData[ 2 ] & 0x80 )
+ {
+ // this is a template
+ }
+ else
+ {
+ mpOutAct->InsertPage();
+ }
+ }
+ mpChart->ResetAnnotation();
+ }
+ }
+ break;
+ case 0x2C0 : ComOut( CGM_LEVEL1, "AppData - SHWKEYTABLE" ) break;
+ case 0x2C2 : ComOut( CGM_LEVEL1, "AppData - SHWBUTTONTAB" ) break;
+ case 0x2C4 : ComOut( CGM_LEVEL1, "AppData - SHWGLOBAL" ) break;
+ case 0x2C6 : ComOut( CGM_LEVEL1, "AppData - SHWTITLE" ) break;
+ case 0x2CA : ComOut( CGM_LEVEL1, "AppData - SHWAPP" ) break;
+ case 0x320 : ComOut( CGM_LEVEL1, "AppData - TEXT" )
+ {
+ TextEntry* pTextEntry = new TextEntry;
+ pTextEntry->nTypeOfText = *((sal_uInt16*)( pAppData ) );
+ pTextEntry->nRowOrLineNum = *((sal_uInt16*)( pAppData + 2 ) );
+ pTextEntry->nColumnNum = *((sal_uInt16*)( pAppData + 4 ) );
+ sal_uInt16 nAttributes = *( (sal_uInt16*)( pAppData + 6 ) );
+ pTextEntry->nZoneSize = nAttributes & 0xff;
+ pTextEntry->nLineType = ( nAttributes >> 8 ) & 0xf;
+ nAttributes >>= 12;
+ pTextEntry->nAttributes = nAttributes;
+ pAppData += 8;
+ sal_uInt32 nLen = strlen( (char*)( pAppData ) ) + 1;
+ pTextEntry->pText = new char[ nLen ];
+ memcpy( pTextEntry->pText, pAppData, nLen );
+ pAppData += nLen;
+
+ TextAttribute* pTextOld = 0;
+ for ( sal_uInt16 i = 0; i < nAttributes; i++ )
+ {
+ TextAttribute* pTextAttr = new TextAttribute;
+
+ *pTextAttr = *(TextAttribute*)( pAppData );
+
+ pTextAttr->pNextAttribute = NULL;
+ if ( i == 0 )
+ pTextEntry->pAttribute = pTextAttr;
+ else
+ pTextOld->pNextAttribute = pTextAttr;
+
+ pAppData += sizeof( TextAttribute ) - 4;
+ pTextOld = pTextAttr;
+ }
+ mpChart->InsertTextEntry( pTextEntry );
+ }
+ break;
+ case 0x321 : ComOut( CGM_LEVEL1, "AppData - IOC_TABS" ) break;
+ case 0x322 : ComOut( CGM_LEVEL1, "AppData - CHARTZONE" )
+ {
+ mpChart->mChartZone = *( ChartZone* )( pAppData );
+ }
+ break;
+ case 0x324 : ComOut( CGM_LEVEL1, "AppData - TITLEZONE" ) break;
+ case 0x328 : ComOut( CGM_LEVEL1, "AppData - FOOTNOTEZONE" ) break;
+ case 0x32A : ComOut( CGM_LEVEL1, "AppData - LEGENDZONE" ) break;
+ case 0x330 : ComOut( CGM_LEVEL1, "AppData - PAGEORIENTDIM" )
+ {
+ mpChart->mPageOrientDim = *( PageOrientDim*)( pAppData );
+ }
+ break;
+ case 0x334 : ComOut( CGM_LEVEL1, "AppData - CHTZONEOPTN" )
+ {
+ mpChart->mZoneOption = *( ZoneOption*)( pAppData );
+ }
+ break;
+ case 0x336 : ComOut( CGM_LEVEL1, "AppData - CHTINTL" )
+ {
+ mpChart->mIntSettings = *( IntSettings*)( pAppData );
+ }
+ break;
+ case 0x338 : ComOut( CGM_LEVEL1, "AppData - CHTLINESPC" ) break;
+ case 0x384 : ComOut( CGM_LEVEL1, "AppData - ORGGRIDSTATE" ) break;
+ case 0x386 : ComOut( CGM_LEVEL1, "AppData - ORGSCRSTATE" ) break;
+ case 0x388 : ComOut( CGM_LEVEL1, "AppData - ORGTREESTATE" ) break;
+ case 0x38A : ComOut( CGM_LEVEL1, "AppData - ORGTEXTOPTN" ) break;
+ case 0x38E : ComOut( CGM_LEVEL1, "AppData - ORGBOXOPTN" ) break;
+ case 0x390 : ComOut( CGM_LEVEL1, "AppData - ORGBOXDIM" ) break;
+ case 0x392 : ComOut( CGM_LEVEL1, "AppData - ORGBOX" ) break;
+ case 0x3EA : ComOut( CGM_LEVEL1, "AppData - TTLTEXTOPTN" ) break;
+ case 0x3EE : ComOut( CGM_LEVEL1, "AppData - TTLAUTOBUILD" ) break;
+ case 0x44E : ComOut( CGM_LEVEL1, "AppData - BULTEXTOPTN" ) break;
+ case 0x452 : ComOut( CGM_LEVEL1, "AppData - BULLETOPTN" )
+ {
+ mpChart->mBulletOption = *( BulletOption*)( pAppData );
+ }
+ break;
+ case 0x454 : ComOut( CGM_LEVEL1, "AppData - BULLETLINES" )
+ {
+ mpChart->mBulletLines = *( BulletLines*)( pAppData );
+ }
+ break;
+ case 0x456 : ComOut( CGM_LEVEL1, "AppData - BULAUTOBUILD" ) break;
+ case 0x4B2 : ComOut( CGM_LEVEL1, "AppData - TBLTEXTOPTN" ) break;
+ case 0x4B6 : ComOut( CGM_LEVEL1, "AppData - TBLOPTN" ) break;
+ case 0x4B8 : ComOut( CGM_LEVEL1, "AppData - TBLCOLOPTN" ) break;
+ case 0x4BA : ComOut( CGM_LEVEL1, "AppData - TBLLEGENDOPTN" ) break;
+ case 0x4BC : ComOut( CGM_LEVEL1, "AppData - TBLRANGEOPTN" ) break;
+ case 0x4BE : ComOut( CGM_LEVEL1, "AppData - TBLROWOPTN" ) break;
+ case 0x4C0 : ComOut( CGM_LEVEL1, "AppData - TBLAUTOBUILD" ) break;
+ case 0x518 : ComOut( CGM_LEVEL1, "AppData - PIECHARTOPTN" ) break;
+ case 0x51A : ComOut( CGM_LEVEL1, "AppData - PIELEGENDOPTN" ) break;
+ case 0x51C : ComOut( CGM_LEVEL1, "AppData - PIETEXTOPTN" ) break;
+ case 0x51E : ComOut( CGM_LEVEL1, "AppData - PIEOPTN" ) break;
+ case 0x520 : ComOut( CGM_LEVEL1, "AppData - PIEPCTLABOPTN" ) break;
+ case 0x522 : ComOut( CGM_LEVEL1, "AppData - PIEVALLABOPTN" ) break;
+ case 0x524 : ComOut( CGM_LEVEL1, "AppData - PIESLICE" ) break;
+ case 0x57A : ComOut( CGM_LEVEL1, "AppData - XYAXISOPTN" ) break;
+ case 0x57C : ComOut( CGM_LEVEL1, "AppData - XYGRIDOPTN" ) break;
+ case 0x57D : ComOut( CGM_LEVEL1, "AppData - XYGRIDSHOWFILL" ) break;
+ case 0x57E : ComOut( CGM_LEVEL1, "AppData - XYSERIESOPTN" ) break;
+ case 0x580 : ComOut( CGM_LEVEL1, "AppData - XYSTYLEOPTN" ) break;
+ case 0x582 : ComOut( CGM_LEVEL1, "AppData - XYTABLEOPTN" ) break;
+ case 0x584 : ComOut( CGM_LEVEL1, "AppData - XYTEXTOPTN" ) break;
+ case 0x586 : ComOut( CGM_LEVEL1, "AppData - XYDATAOPTN" ) break;
+ case 0x58A : ComOut( CGM_LEVEL1, "AppData - XYLEGENDOPN" ) break;
+ case 0x58C : ComOut( CGM_LEVEL1, "AppData - XYCALCULATION" ) break;
+ case 0x58E : ComOut( CGM_LEVEL1, "AppData - XYXVALUE" ) break;
+ case 0x590 : ComOut( CGM_LEVEL1, "AppData - XYYVALUE" ) break;
+ case 0x592 : ComOut( CGM_LEVEL1, "AppData - XYXEXTVALUE" ) break;
+ case 0x618 : ComOut( CGM_LEVEL1, "AppData - IOC_CHTCOLRTAB" ) break;
+ case 0x619 : ComOut( CGM_LEVEL1, "AppData - IOC_CHTFONTTAB" ) break;
+ case 0x1fff : ComOut( CGM_LEVEL1, "AppData - 0x1fff" ) break;
+ default : ComOut( CGM_LEVEL1, "UNKNOWN Application Data" ) break;
+ }
+ }
+ mnParaSize = mnElementSize;
+ break;
+ }
+ default: ComOut( CGM_UNKNOWN_COMMAND, "" ) break;
+ }
+};
+
diff --git a/filter/source/graphicfilter/icgm/classx.cxx b/filter/source/graphicfilter/icgm/classx.cxx
new file mode 100644
index 000000000000..a63c41d545b9
--- /dev/null
+++ b/filter/source/graphicfilter/icgm/classx.cxx
@@ -0,0 +1,262 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include <main.hxx>
+#include <outact.hxx>
+
+// ---------------------------------------------------------------
+
+#define ImplSetUnderlineMode() \
+ \
+ sal_uInt32 nMode = ImplGetUI16(); \
+ switch ( nMode ) \
+ { \
+ case 1 : pElement->eUnderlineMode = UM_LOW; break; \
+ case 2 : pElement->eUnderlineMode = UM_HIGH; break; \
+ case 4 : pElement->eUnderlineMode = UM_STRIKEOUT; break;\
+ case 8 : pElement->eUnderlineMode = UM_OVERSCORE; break;\
+ default: pElement->eUnderlineMode = UM_OFF; break; \
+ } \
+ pElement->nUnderlineColor = ImplGetBitmapColor();
+
+// ---------------------------------------------------------------
+
+void CGM::ImplDoClass6()
+{
+ switch ( mnElementID )
+ {
+ case 0x01 : ComOut( CGM_LEVEL1, "Escape" )
+ {
+ long nIdentifier = ImplGetI( pElement->nIntegerPrecision );
+ switch ( nIdentifier )
+ {
+ case 0 : ComOut( CGM_DESCRIPTION, "inquire function support" ) break;
+ case -1 : ComOut( CGM_DESCRIPTION, "set underline mode" )
+ {
+ ImplSetUnderlineMode()
+ }
+ break;
+ case -2 : ComOut( CGM_DESCRIPTION, "set script mode" ) break;
+ case -3 : ComOut( CGM_DESCRIPTION, "set shadow mode" ) break;
+ case -6 : ComOut( CGM_DESCRIPTION, "inquire origin offset" ) break;
+ case -8 : ComOut( CGM_DESCRIPTION, "set media size" ) break;
+ case -10 : ComOut( CGM_DESCRIPTION, "set character mode" ) break;
+ case -14 : ComOut( CGM_DESCRIPTION, "resolution mode" ) break;
+ case -17 : ComOut( CGM_DESCRIPTION, "line cap" ) break;
+ case -18 : ComOut( CGM_DESCRIPTION, "line join" ) break;
+ case -19 : ComOut( CGM_DESCRIPTION, "edge join" ) break;
+ case -30 : ComOut( CGM_DESCRIPTION, "media type" ) break;
+ case -31 : ComOut( CGM_DESCRIPTION, "number of copies" ) break;
+ case -32 : ComOut( CGM_DESCRIPTION, "orientation" ) break;
+ case -33 : ComOut( CGM_DESCRIPTION, "device color representation" ) break;
+ case -34 : ComOut( CGM_DESCRIPTION, "device font list" ) break;
+ case -35 : ComOut( CGM_DESCRIPTION, "color reversal mode" ) break;
+ case -36 : ComOut( CGM_DESCRIPTION, "line cap attributes" ) break;
+ case -37 : ComOut( CGM_DESCRIPTION, "begin effect" ) break;
+ case -38 : ComOut( CGM_DESCRIPTION, "end effect" ) break;
+ case -39 : ComOut( CGM_DESCRIPTION, "begin effect definition" ) break;
+ case -40 : ComOut( CGM_DESCRIPTION, "end effect definition" ) break;
+ case -41 : ComOut( CGM_DESCRIPTION, "end style definition" ) break;
+ case -42 : ComOut( CGM_DESCRIPTION, "begin eps data" ) break;
+ case -43 : ComOut( CGM_DESCRIPTION, "eps data" ) break;
+ case -44 : ComOut( CGM_DESCRIPTION, "end eps data" ) break;
+ case -45 : ComOut( CGM_DESCRIPTION, "set background style" ) break;
+ case -46 : ComOut( CGM_DESCRIPTION, "set eps mode" ) break;
+ case -47 : ComOut( CGM_DESCRIPTION, "fill mode" ) break;
+ case -48 : ComOut( CGM_DESCRIPTION, "begin symbol" ) break;
+ case -49 : ComOut( CGM_DESCRIPTION, "end symbol" ) break;
+ case -50 : ComOut( CGM_DESCRIPTION, "begin layer" ) break;
+ case -51 : ComOut( CGM_DESCRIPTION, "end layer" ) break;
+ case -52 : ComOut( CGM_DESCRIPTION, "layer visibility" ) break;
+ case -53 : ComOut( CGM_DESCRIPTION, "inquire foreign data" ) break;
+ case -54 : ComOut( CGM_DESCRIPTION, "set text offset" ) break;
+ case -55 : ComOut( CGM_DESCRIPTION, "begin group" ) break;
+ case -56 : ComOut( CGM_DESCRIPTION, "end group" ) break;
+ case -100 : ComOut( CGM_DESCRIPTION, "begin patch" ) break;
+ case -101 : ComOut( CGM_DESCRIPTION, "end patch" ) break;
+ case -102 : ComOut( CGM_DESCRIPTION, "begin block text region" ) break;
+ case -103 : ComOut( CGM_DESCRIPTION, "end block text region" ) break;
+ case -120 : ComOut( CGM_DESCRIPTION, "region margins" ) break;
+ case -121 : ComOut( CGM_DESCRIPTION, "region expansions" ) break;
+ case -122 : ComOut( CGM_DESCRIPTION, "region anchor" ) break;
+ case -123 : ComOut( CGM_DESCRIPTION, "paragraph horizontal align" ) break;
+ case -124 : ComOut( CGM_DESCRIPTION, "paragraph vertical align" ) break;
+ case -125 : ComOut( CGM_DESCRIPTION, "region line flow" ) break;
+ case -130 : ComOut( CGM_DESCRIPTION, "paragraph spacing" ) break;
+ case -131 : ComOut( CGM_DESCRIPTION, "paragraph identation" ) break;
+ case -132 : ComOut( CGM_DESCRIPTION, "paragraph tabs" ) break;
+ case -133 : ComOut( CGM_DESCRIPTION, "paragraph bullet" ) break;
+ case -134 : ComOut( CGM_DESCRIPTION, "paragraph bulet level" ) break;
+ case -135 : ComOut( CGM_DESCRIPTION, "line horuzontal align" ) break;
+ case -136 : ComOut( CGM_DESCRIPTION, "line vertical align" ) break;
+ case -137 : ComOut( CGM_DESCRIPTION, "line spacing" ) break;
+ case -138 : ComOut( CGM_DESCRIPTION, "word wrap" ) break;
+ case -150 : ComOut( CGM_DESCRIPTION, "forward advance distance" ) break;
+ case -151 : ComOut( CGM_DESCRIPTION, "word spacing" ) break;
+ case -152 : ComOut( CGM_DESCRIPTION, "external leading" ) break;
+ case -160 : ComOut( CGM_DESCRIPTION, "set gradient offset" ) break;
+ case -161 : ComOut( CGM_DESCRIPTION, "set gradient edge" ) break;
+ case -162 : ComOut( CGM_DESCRIPTION, "set gradient angle" ) break;
+ case -163 : ComOut( CGM_DESCRIPTION, "set gradient description" ) break;
+ case -164 : ComOut( CGM_DESCRIPTION, "set gradient style" ) break;
+ case -165 : ComOut( CGM_DESCRIPTION, "set back ground style" ) break;
+ case -170 : ComOut( CGM_DESCRIPTION, "geometric pattern draw style" ) break;
+ case -190 : ComOut( CGM_DESCRIPTION, "set character width" ) break;
+ case -191 : ComOut( CGM_DESCRIPTION, "hyperlink definitions" ) break;
+ case -192 : ComOut( CGM_DESCRIPTION, "set color name for pantone" ) break;
+ case -32746 : ComOut( CGM_DESCRIPTION, "set text font" ) break;
+ case -32747 : ComOut( CGM_DESCRIPTION, "font selection mode" ) break;
+ case -32752 : ComOut( CGM_DESCRIPTION, "connecting edge" ) break;
+ case -32753 : ComOut( CGM_DESCRIPTION, "set drawing mode" ) break;
+ case -32754 : ComOut( CGM_DESCRIPTION, "inquire clip rectangle" ) break;
+ case -32755 : ComOut( CGM_DESCRIPTION, "protection region indicator" ) break;
+ case -32756 : ComOut( CGM_DESCRIPTION, "end protection region" ) break;
+ case -32757 : ComOut( CGM_DESCRIPTION, "begin protection region" ) break;
+ case -32758 : ComOut( CGM_DESCRIPTION, "geometric pattern definition" ) break;
+ case -32759 : ComOut( CGM_DESCRIPTION, "hatch style definition" ) break;
+ case -32760 : ComOut( CGM_DESCRIPTION, "close figure" ) break;
+ case -32761 : ComOut( CGM_DESCRIPTION, "end figure" )
+ {
+ mpOutAct->EndFigure();
+ mbFigure = sal_False;
+ }
+ break;
+ case -32762 : ComOut( CGM_DESCRIPTION, "begin figure" )
+ {
+ mbFigure = sal_True;
+ mpOutAct->BeginFigure();
+ }
+ break;
+ case -32763 : ComOut( CGM_DESCRIPTION, "pop transformatin" ) break;
+ case -32764 : ComOut( CGM_DESCRIPTION, "push transformation" ) break;
+ case -32765 : ComOut( CGM_DESCRIPTION, "copy segment" ) break;
+ case -32766 : ComOut( CGM_DESCRIPTION, "endseg" ) break;
+ case -32767 : ComOut( CGM_DESCRIPTION, "begin segment" ) break;
+ default : ComOut( CGM_DESCRIPTION, "????????????????????????????????" ) break;
+ }
+ mnParaSize = mnElementSize;
+ }
+ break;
+ case 0x02 : ComOut( CGM_LEVEL1, "Get Escape" ) break;
+ case 0x11 : ComOut( CGM_GDSF_ONLY, "Set Underline Mode" )
+ {
+ ImplSetUnderlineMode();
+ }
+ break;
+ case 0x12 : ComOut( CGM_GDSF_ONLY, "Set Script Mode" ) break;
+ case 0x13 : ComOut( CGM_GDSF_ONLY, "Set Shadow Mode" ) break;
+ case 0x18 : ComOut( CGM_GDSF_ONLY, "Set Media Size" ) break;
+ case 0x20 : ComOut( CGM_GDSF_ONLY, "Set Character Mode" ) break;
+ case 0x24 : ComOut( CGM_GDSF_ONLY, "Resolution Mode" ) break;
+ case 0x27 : ComOut( CGM_GDSF_ONLY, "Line Cap" ) break;
+ case 0x28 : ComOut( CGM_GDSF_ONLY, "Line Join" ) break;
+ case 0x29 : ComOut( CGM_GDSF_ONLY, "Edge Join" ) break;
+ case 0x40 : ComOut( CGM_GDSF_ONLY, "Media Type" ) break;
+ case 0x41 : ComOut( CGM_GDSF_ONLY, "Number of Copies" ) break;
+ case 0x42 : ComOut( CGM_GDSF_ONLY, "Origin" ) break;
+ case 0x45 : ComOut( CGM_GDSF_ONLY, "Color Reversal Mode" ) break;
+ case 0x46 : ComOut( CGM_GDSF_ONLY, "Line Cap Attributes" ) break;
+ case 0x49 : ComOut( CGM_GDSF_ONLY, "Begin Effect Definition" ) break;
+ case 0x50 : ComOut( CGM_GDSF_ONLY, "End Effect Definition" ) break;
+ case 0x51 : ComOut( CGM_GDSF_ONLY, "Line End Style Attributes" ) break;
+ case 0x52 : ComOut( CGM_GDSF_ONLY, "Begin Data" ) break;
+ case 0x53 : ComOut( CGM_GDSF_ONLY, "Data" ) break;
+ case 0x54 : ComOut( CGM_GDSF_ONLY, "End Data" ) break;
+ case 0x55 : ComOut( CGM_GDSF_ONLY, "Set Background Style" ) break;
+ case 0x56 : ComOut( CGM_GDSF_ONLY, "Set EPS Mode" ) break;
+ case 0x57 : ComOut( CGM_GDSF_ONLY, "Fill Mode" ) break;
+ case 0x58 : ComOut( CGM_GDSF_ONLY, "Begin Symbol" ) break;
+ case 0x59 : ComOut( CGM_GDSF_ONLY, "End Symbol" ) break;
+ case 0x60 : ComOut( CGM_GDSF_ONLY, "Begin Layer" ) break;
+ case 0x61 : ComOut( CGM_GDSF_ONLY, "End Layer" ) break;
+ case 0x62 : ComOut( CGM_GDSF_ONLY, "Layer Visibility" ) break;
+ case 0x64 : ComOut( CGM_GDSF_ONLY, "Set Text Offset" ) break;
+ case 0xFF : ComOut( CGM_GDSF_ONLY, "Inquire Function Support" ) break;
+ case 0xFE : ComOut( CGM_GDSF_ONLY, "Inquire Origin" ) break;
+ case 0xFD : ComOut( CGM_GDSF_ONLY, "Inquire Foreign Data Mode" ) break;
+ case 0xFC : ComOut( CGM_GDSF_ONLY, "Inquire Text Extent" ) break;
+ case 0xFB : ComOut( CGM_GDSF_ONLY, "Inquire DPI" ) break;
+ default: ComOut( CGM_UNKNOWN_COMMAND, "" ) break;
+ }
+};
+
+// ---------------------------------------------------------------
+
+void CGM::ImplDoClass8()
+{
+ switch ( mnElementID )
+ {
+ case 0x01 : ComOut( CGM_LEVEL2, "Copy Segment" ) break; // NS
+ case 0x02 : ComOut( CGM_LEVEL2, "Inheritance Filter" ) break; // NS
+ case 0x03 : ComOut( CGM_LEVEL2, "Clip Inheritance" ) break; // NS
+ case 0x04 : ComOut( CGM_LEVEL2, "Segment Transformation" ) break;
+ case 0x05 : ComOut( CGM_LEVEL2, "Segment HighLighting" ) break; // NS
+ case 0x06 : ComOut( CGM_LEVEL2, "Segment Display Priority" ) break; // NS
+ case 0x07 : ComOut( CGM_LEVEL2, "Segment Pick Priority" ) break; // NS
+ case 0xfe : ComOut( CGM_GDSF_ONLY, "INQ Current Position" ) break;
+ case 0xff : ComOut( CGM_GDSF_ONLY, "INQ Inserted Object Extent" ) break;
+ default: ComOut( CGM_UNKNOWN_COMMAND, "" ) break; // NS
+ }
+};
+
+// ---------------------------------------------------------------
+
+void CGM::ImplDoClass9()
+{
+ switch ( mnElementID )
+ {
+ case 0x01 : ComOut( CGM_UNKNOWN_LEVEL, "Pixel Array" ) break; // NS
+ case 0x02 : ComOut( CGM_UNKNOWN_LEVEL, "Create Bitmap" ) break; // NS
+ case 0x03 : ComOut( CGM_UNKNOWN_LEVEL, "Delete Bitmap" ) break; // NS
+ case 0x04 : ComOut( CGM_UNKNOWN_LEVEL, "Select Drawing Bitmap" ) break; // NS
+ case 0x05 : ComOut( CGM_UNKNOWN_LEVEL, "Display Bitmap" ) break; // NS
+ case 0x06 : ComOut( CGM_UNKNOWN_LEVEL, "Drawing Mode" ) break;
+ case 0x07 : ComOut( CGM_UNKNOWN_LEVEL, "Mapped Bitmap ForeGrnd Color" ) break; // NS
+ case 0x08 : ComOut( CGM_UNKNOWN_LEVEL, "Fill Bitmap" ) break; // NS
+ case 0x09 : ComOut( CGM_UNKNOWN_LEVEL, "Two Operand BitBlt" ) break; // NS
+ case 0x0a : ComOut( CGM_UNKNOWN_LEVEL, "Three Operand BitBlt" ) break; // NS
+ default: ComOut( CGM_UNKNOWN_COMMAND, "" ) break;
+ }
+};
+
+// ---------------------------------------------------------------
+
+void CGM::ImplDoClass15()
+{
+ switch ( mnElementID )
+ {
+ case 0x01 : ComOut( CGM_UNKNOWN_LEVEL, "Inquire Error Stack" ) break;
+ case 0x02 : ComOut( CGM_UNKNOWN_LEVEL, "Pop Error Stack" ) break;
+ case 0x03 : ComOut( CGM_UNKNOWN_LEVEL, "Empty Error Stack" ) break;
+ default: ComOut( CGM_UNKNOWN_COMMAND, "" ) break;
+ }
+};
+
+// ---------------------------------------------------------------
diff --git a/filter/source/graphicfilter/icgm/elements.cxx b/filter/source/graphicfilter/icgm/elements.cxx
new file mode 100644
index 000000000000..305ca1d73834
--- /dev/null
+++ b/filter/source/graphicfilter/icgm/elements.cxx
@@ -0,0 +1,395 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include "elements.hxx"
+
+// ---------------------------------------------------------------
+
+
+CGMElements::CGMElements( CGM& rCGM ) :
+ mpCGM ( &rCGM )
+{
+ Init();
+};
+
+// ---------------------------------------------------------------
+
+CGMElements::~CGMElements()
+{
+ DeleteTable( aHatchTable );
+ DeleteAllBundles( aLineList );
+ DeleteAllBundles( aMarkerList );
+ DeleteAllBundles( aEdgeList );
+ DeleteAllBundles( aTextList );
+ DeleteAllBundles( aFillList );
+}
+
+// ---------------------------------------------------------------
+
+CGMElements& CGMElements::operator=( CGMElements& rSource )
+{
+ sal_uInt32 nIndex;
+
+ nVDCIntegerPrecision = rSource.nVDCIntegerPrecision;
+ nIntegerPrecision = rSource.nIntegerPrecision;
+ eRealPrecision = rSource.eRealPrecision;
+ nRealSize = rSource.nRealSize;
+ nIndexPrecision = rSource.nIndexPrecision;
+ nColorPrecision = rSource.nColorPrecision;
+ nColorIndexPrecision = rSource.nColorIndexPrecision;
+
+ nMetaFileVersion = rSource.nMetaFileVersion;
+ eScalingMode = rSource.eScalingMode;
+ nScalingFactor = rSource.nScalingFactor;
+ eVDCType = rSource.eVDCType;
+ eVDCRealPrecision = rSource.eVDCRealPrecision;
+ nVDCRealSize = rSource.nVDCRealSize;
+ aVDCExtent = rSource.aVDCExtent;
+ aVDCExtentMaximum = rSource.aVDCExtentMaximum;
+ eDeviceViewPortMode = rSource.eDeviceViewPortMode;
+ nDeviceViewPortScale = rSource.nDeviceViewPortScale;
+ eDeviceViewPortMap = rSource.eDeviceViewPortMap;
+ eDeviceViewPortMapH = rSource.eDeviceViewPortMapH;
+ eDeviceViewPortMapV = rSource.eDeviceViewPortMapV;
+ aDeviceViewPort = rSource.aDeviceViewPort;
+ nMitreLimit = rSource.nMitreLimit;
+ eClipIndicator = rSource.eClipIndicator;
+ aClipRect = rSource.aClipRect;
+ eColorSelectionMode = rSource.eColorSelectionMode;
+ eColorModel = rSource.eColorModel;
+ nColorMaximumIndex = rSource.nColorMaximumIndex;
+ nLatestColorMaximumIndex = rSource.nLatestColorMaximumIndex;
+
+ for ( nIndex = 1; nIndex < 256; nIndex++ ) // do not overwrite the background color
+ {
+ aColorTableEntryIs[ nIndex ] = rSource.aColorTableEntryIs[ nIndex ];
+ aColorTable[ nIndex ] = rSource.aColorTable[ nIndex ];
+ aLatestColorTable[ nIndex ] = rSource.aColorTable[ nIndex ];
+ }
+
+ for ( nIndex = 0; nIndex < 8; nIndex++ )
+ {
+ nColorValueExtent[ nIndex ] = rSource.nColorValueExtent[ nIndex ];
+ }
+ nAspectSourceFlags = rSource.nAspectSourceFlags;
+
+ CopyAllBundles( rSource.aLineList, aLineList );
+ aLineBundle = rSource.aLineBundle;
+ pLineBundle = (LineBundle*)GetBundle( aLineList, rSource.pLineBundle->GetIndex() );
+ eLineWidthSpecMode = rSource.eLineWidthSpecMode;
+ eLineCapType = rSource.eLineCapType;
+ eLineJoinType = rSource.eLineJoinType;
+
+ CopyAllBundles( rSource.aMarkerList, aMarkerList );
+ aMarkerBundle = rSource.aMarkerBundle;
+ pMarkerBundle = (MarkerBundle*)GetBundle( aMarkerList, rSource.pMarkerBundle->GetIndex() );
+ eMarkerSizeSpecMode = rSource.eMarkerSizeSpecMode;
+
+ CopyAllBundles( rSource.aEdgeList, aEdgeList );
+ aEdgeBundle = rSource.aEdgeBundle;
+ pEdgeBundle = (EdgeBundle*)GetBundle( aEdgeList, rSource.pEdgeBundle->GetIndex() );
+ eEdgeVisibility = rSource.eEdgeVisibility;
+ eEdgeWidthSpecMode = rSource.eEdgeWidthSpecMode;
+
+ CopyAllBundles( rSource.aTextList, aTextList );
+ aTextBundle = rSource.aTextBundle;
+ pTextBundle = (TextBundle*)GetBundle( aTextList, rSource.pTextBundle->GetIndex() );
+ nCharacterHeight = rSource.nCharacterHeight;
+ nCharacterOrientation[ 0 ] = rSource.nCharacterOrientation[ 0 ];
+ nCharacterOrientation[ 1 ] = rSource.nCharacterOrientation[ 1 ];
+ nCharacterOrientation[ 2 ] = rSource.nCharacterOrientation[ 2 ];
+ nCharacterOrientation[ 3 ] = rSource.nCharacterOrientation[ 3 ];
+ eUnderlineMode = rSource.eUnderlineMode;
+ nUnderlineColor = rSource.nUnderlineColor;
+ eTextPath = rSource.eTextPath;
+ eTextAlignmentH = rSource.eTextAlignmentH;
+ eTextAlignmentV = rSource.eTextAlignmentV;
+ nTextAlignmentHCont = rSource.nTextAlignmentHCont;
+ nTextAlignmentVCont = rSource.nTextAlignmentVCont;
+ nCharacterSetIndex = rSource.nCharacterSetIndex;
+ nAlternateCharacterSetIndex = rSource.nAlternateCharacterSetIndex;
+ aFontList = rSource.aFontList;
+ eCharacterCodingA = rSource.eCharacterCodingA;
+
+ CopyAllBundles( rSource.aFillList, aFillList );
+ aFillBundle = rSource.aFillBundle;
+ pFillBundle = (FillBundle*)GetBundle( aFillList, rSource.pFillBundle->GetIndex() );
+ aFillRefPoint = rSource.aFillRefPoint;
+ eTransparency = rSource.eTransparency;
+ nAuxiliaryColor = rSource.nAuxiliaryColor;
+
+ DeleteTable( aHatchTable );
+ HatchEntry* pSource = (HatchEntry*)rSource.aHatchTable.First();
+ while ( pSource )
+ {
+ sal_uInt32 nKey = rSource.aHatchTable.GetKey( pSource );
+ aHatchTable.Insert( nKey, new HatchEntry( *pSource ) );
+ pSource = (HatchEntry*)rSource.aHatchTable.Next();
+ }
+ bSegmentCount = rSource.bSegmentCount;
+ return (*this);
+}
+
+// ---------------------------------------------------------------
+
+void CGMElements::Init()
+{
+
+ nIntegerPrecision = nIndexPrecision = 2;
+ nRealSize = nVDCRealSize = 4;
+ nColorIndexPrecision = 1;
+ nColorPrecision = 1;
+ nVDCIntegerPrecision = 2;
+ eRealPrecision = eVDCRealPrecision = RP_FIXED; //RP_FLOAT;
+
+ nMetaFileVersion = 1;
+ eScalingMode = SM_ABSTRACT;
+ eVDCType = VDC_INTEGER;
+ aVDCExtent.Left = aVDCExtent.Bottom = 0;
+// aVDCExtent.Right = aVDCExtent.Top = 32767;
+ aVDCExtent.Right = aVDCExtent.Top = 1.0;
+ aVDCExtentMaximum.Left = aVDCExtentMaximum.Bottom = 0;
+// aVDCExtentMaximum.Right = aVDCExtentMaximum.Top = 32767;
+ aVDCExtentMaximum.Right = aVDCExtentMaximum.Top = 1.0;
+
+ eDeviceViewPortMode = DVPM_FRACTION;
+ nDeviceViewPortScale = 1;
+ eDeviceViewPortMap = DVPM_FORCED;
+ eDeviceViewPortMapH = DVPMH_LEFT;
+ eDeviceViewPortMapV = DVPMV_BOTTOM;
+ aDeviceViewPort.Left = 0;
+ aDeviceViewPort.Top = 1;
+ aDeviceViewPort.Right = 0;
+ aDeviceViewPort.Bottom = 1;
+
+ nMitreLimit = 32767;
+ eClipIndicator = CI_ON;
+ aClipRect = aVDCExtent;
+
+ eColorSelectionMode = CSM_INDEXED;
+ eColorModel = CM_RGB;
+ nColorMaximumIndex = 63;
+ int i;
+ for ( i = 0; i < 256; aColorTableEntryIs[ i++ ] = 0 ) ;
+ aColorTable[ 0 ] = 0;
+ for ( i = 1; i < 256; aColorTable[ i++ ] = 0xffffff ) ;
+ nLatestColorMaximumIndex = 63;
+ aLatestColorTable[ 0 ] = 0;
+ for ( i = 1; i < 256; aLatestColorTable[ i++ ] = 0xffffff ) ;
+ nColorValueExtent[ 0 ] = nColorValueExtent[ 1 ] = nColorValueExtent[ 2 ] = 0;
+ nColorValueExtent[ 3 ] = nColorValueExtent[ 4 ] = nColorValueExtent[ 5 ] = 255;
+
+ nAspectSourceFlags = 0; // all flags are individual
+
+ eLineWidthSpecMode = SM_SCALED; // line parameter
+ eLineCapType = LCT_NONE;
+ eLineJoinType = LJT_NONE;
+ pLineBundle = &aLineBundle; // line bundle parameter
+ aLineBundle.SetIndex( 1 );
+ aLineBundle.eLineType = LT_SOLID;
+ aLineBundle.nLineWidth = 1;
+ aLineBundle.SetColor( 0xffffff );
+ InsertBundle( aLineList, aLineBundle );
+
+ eMarkerSizeSpecMode = SM_SCALED; // marker parameter
+ pMarkerBundle = &aMarkerBundle; // marker bundle parameter
+ aMarkerBundle.SetIndex( 1 );
+ aMarkerBundle.eMarkerType = MT_STAR;
+ aMarkerBundle.nMarkerSize = 1;
+ aMarkerBundle.SetColor( 0xffffff );
+ InsertBundle( aMarkerList, aMarkerBundle );
+
+ eEdgeVisibility = EV_OFF; // edge parameter
+ eEdgeWidthSpecMode = SM_SCALED;
+ pEdgeBundle = &aEdgeBundle; // edge bundle parameter
+ aEdgeBundle.SetIndex( 1 );
+ aEdgeBundle.eEdgeType = ET_SOLID;
+ aEdgeBundle.nEdgeWidth = 1;
+ aEdgeBundle.SetColor( 0xffffff );
+ InsertBundle( aEdgeList, aEdgeBundle );
+
+ nCharacterHeight = 327; // text parameter
+ nCharacterOrientation[0] = 0;
+ nCharacterOrientation[1] = 1;
+ nCharacterOrientation[2] = 1;
+ nCharacterOrientation[3] = 0;
+ eUnderlineMode = UM_OFF;
+ nUnderlineColor = 0xffffff;
+ eTextPath = TPR_RIGHT;
+ eTextAlignmentH = TAH_NORMAL;
+ eTextAlignmentV = TAV_NORMAL;
+ nCharacterSetIndex = nAlternateCharacterSetIndex = 1;
+ eCharacterCodingA = CCA_BASIC_7;
+ pTextBundle = &aTextBundle; // text bundle parameter
+ aTextBundle.SetIndex( 1 );
+ aTextBundle.nTextFontIndex = 1;
+ aTextBundle.eTextPrecision = TPR_STRING;
+ aTextBundle.nCharacterExpansion = 1;
+ aTextBundle.nCharacterSpacing = 0;
+ aTextBundle.SetColor( 0xffffff );
+ InsertBundle( aTextList, aTextBundle );
+
+ pFillBundle = &aFillBundle; // fill bundle parameter
+ aFillBundle.SetIndex( 1 );
+ aFillBundle.eFillInteriorStyle = FIS_HOLLOW;
+ aFillBundle.nFillHatchIndex = 1;
+ aFillBundle.nFillPatternIndex = 1;
+ aFillBundle.SetColor( 0xffffff );
+ InsertBundle( aFillList, aFillBundle );
+
+ ImplInsertHatch( 0, 0, 0, 0 );
+ ImplInsertHatch( 1, 0, 125, 0 );
+ ImplInsertHatch( 2, 0, 125, 900 );
+ ImplInsertHatch( 3, 0, 125, 450 );
+ ImplInsertHatch( 4, 0, 125, 1350 );
+ ImplInsertHatch( 5, 1, 125, 0 );
+ ImplInsertHatch( 6, 1, 125, 450 );
+ ImplInsertHatch( -1, 0, 75, 0 );
+ ImplInsertHatch( -2, 0, 75, 900 );
+ ImplInsertHatch( -3, 0, 75, 450 );
+ ImplInsertHatch( -4, 0, 75, 1350 );
+ ImplInsertHatch( -5, 1, 75, 0 );
+ ImplInsertHatch( -6, 1, 75, 450 );
+ ImplInsertHatch( -7, 2, 125, 0 );
+ ImplInsertHatch( -8, 2, 125, 900 );
+ ImplInsertHatch( -9, 2, 125, 450 );
+ ImplInsertHatch( -10, 2, 125, 1350 );
+ ImplInsertHatch( -11, 0, 40, 0 );
+ ImplInsertHatch( -12, 0, 40, 900 );
+ ImplInsertHatch( -13, 0, 40, 450 );
+ ImplInsertHatch( -14, 0, 40, 1350 );
+ ImplInsertHatch( -15, 1, 40, 0 );
+ ImplInsertHatch( -16, 1, 40, 900 );
+ ImplInsertHatch( -21, 0, 250, 0 );
+ ImplInsertHatch( -22, 0, 250, 900 );
+ ImplInsertHatch( -23, 0, 250, 450 );
+ ImplInsertHatch( -24, 0, 250, 1350 );
+ ImplInsertHatch( -25, 1, 250, 0 );
+ ImplInsertHatch( -26, 1, 250, 450 );
+
+ eTransparency = T_ON;
+
+ nBackGroundColor = nAuxiliaryColor = 0;
+
+ bSegmentCount = sal_False;
+}
+
+// ---------------------------------------------------------------
+
+void CGMElements::ImplInsertHatch( sal_Int32 nKey, int nStyle, long nDistance, long nAngle )
+{
+ HatchEntry* pHatchEntry;
+ pHatchEntry = new HatchEntry;
+ aHatchTable.Insert( (sal_uInt32)nKey, pHatchEntry );
+ pHatchEntry->HatchStyle = nStyle;
+ pHatchEntry->HatchDistance = nDistance;
+ pHatchEntry->HatchAngle = nAngle;
+}
+
+// ---------------------------------------------------------------
+
+void CGMElements::DeleteTable( Table& rTable )
+{
+ HatchEntry* pPtr = (HatchEntry*)rTable.First();
+ while ( pPtr )
+ {
+ delete pPtr;
+ pPtr = (HatchEntry*)rTable.Next();
+ }
+ rTable.Clear();
+}
+
+// ---------------------------------------------------------------
+
+void CGMElements::DeleteAllBundles( List& rList )
+{
+ void* pPtr = rList.First();
+ while( pPtr )
+ {
+ delete (Bundle*)pPtr;
+ pPtr = rList.Next();
+ }
+};
+
+
+// ---------------------------------------------------------------
+
+void CGMElements::CopyAllBundles( List& rSource, List& rDest )
+{
+ DeleteAllBundles( rDest );
+ rDest.Clear();
+
+ void* pPtr = rSource.First();
+ while( pPtr )
+ {
+ Bundle* pTempBundle = ( (Bundle*)pPtr)->Clone();
+ rDest.Insert( pTempBundle, LIST_APPEND );
+ pPtr = rSource.Next();
+ }
+};
+
+// ---------------------------------------------------------------
+
+Bundle* CGMElements::GetBundleIndex( sal_uInt32 nIndex, List& rList, Bundle& rBundle )
+{
+ rBundle.SetIndex( nIndex );
+ Bundle* pBundle = GetBundle( rList, nIndex );
+ if ( !pBundle )
+ pBundle = InsertBundle( rList, rBundle );
+ return pBundle;
+}
+
+// ---------------------------------------------------------------
+
+Bundle* CGMElements::GetBundle( List& rList, long nIndex )
+{
+ Bundle* pBundle = (Bundle*)rList.First();
+ while( pBundle && ( pBundle->GetIndex() != nIndex ) )
+ {
+ pBundle = (Bundle*)rList.Next();
+ }
+ return pBundle;
+}
+
+// ---------------------------------------------------------------
+
+Bundle* CGMElements::InsertBundle( List& rList, Bundle& rBundle )
+{
+ Bundle* pBundle = GetBundle( rList, rBundle.GetIndex() );
+ if ( pBundle )
+ {
+ rList.Remove( pBundle );
+ delete pBundle;
+ }
+ pBundle = rBundle.Clone();
+ rList.Insert( pBundle, LIST_APPEND );
+ return pBundle;
+};
+
diff --git a/filter/source/graphicfilter/icgm/elements.hxx b/filter/source/graphicfilter/icgm/elements.hxx
new file mode 100644
index 000000000000..32614ef2590e
--- /dev/null
+++ b/filter/source/graphicfilter/icgm/elements.hxx
@@ -0,0 +1,145 @@
+/*************************************************************************
+ *
+ * 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 CGM_ELEMENTS_HXX_
+#define CGM_ELEMENTS_HXX_
+
+#include "main.hxx"
+#include <tools/table.hxx>
+
+#define nBackGroundColor aColorTable[ 0 ]
+
+class CGMElements
+{
+ void ImplInsertHatch( sal_Int32 Key, int Style, long Distance, long Angle );
+ public:
+ CGM* mpCGM;
+ long nMetaFileVersion;
+
+ sal_uInt32 nIntegerPrecision; // maybe 1, 2, 4 Bytes
+ sal_uInt32 nIndexPrecision; // " " "
+ RealPrecision eRealPrecision;
+ sal_uInt32 nRealSize; // maybe 4 or 8 bytes
+ sal_uInt32 nColorPrecision; // " " "
+ sal_uInt32 nColorIndexPrecision;// " " "
+
+ ScalingMode eScalingMode;
+ double nScalingFactor;
+
+ VDCType eVDCType; // Integer / Real
+ sal_uInt32 nVDCIntegerPrecision;
+ RealPrecision eVDCRealPrecision;
+ sal_uInt32 nVDCRealSize;
+ FloatRect aVDCExtent;
+ FloatRect aVDCExtentMaximum;
+
+ DeviceViewPortMode eDeviceViewPortMode;
+ double nDeviceViewPortScale;
+ DeviceViewPortMap eDeviceViewPortMap;
+ DeviceViewPortMapH eDeviceViewPortMapH;
+ DeviceViewPortMapV eDeviceViewPortMapV;
+ FloatRect aDeviceViewPort;
+
+ double nMitreLimit;
+
+ ClipIndicator eClipIndicator;
+ FloatRect aClipRect;
+
+ ColorSelectionMode eColorSelectionMode;
+ ColorModel eColorModel;
+ sal_uInt32 nColorMaximumIndex; // default 63
+ sal_uInt32 nLatestColorMaximumIndex; // default 63
+ sal_Int8 aColorTableEntryIs[ 256 ];
+ sal_uInt32 aColorTable[ 256 ];
+ sal_uInt32 aLatestColorTable[ 256 ];
+ sal_uInt32 nColorValueExtent[ 8 ]; // RGB, CMYK
+
+ // ASPECT SOURCE FLAGS
+ sal_uInt32 nAspectSourceFlags; // bit = 0 -> INDIVIDUAL
+ // 1 -> BUNDLED
+
+ LineBundle* pLineBundle; // Pointer to the current LineBundleIndex
+ LineBundle aLineBundle;
+ List aLineList;
+ SpecMode eLineWidthSpecMode;
+ LineCapType eLineCapType;
+ LineJoinType eLineJoinType;
+
+ MarkerBundle* pMarkerBundle; // Pointer to the current MarkerBundleIndex
+ MarkerBundle aMarkerBundle;
+ List aMarkerList;
+ SpecMode eMarkerSizeSpecMode;
+
+ EdgeBundle* pEdgeBundle; // Pointer to the current EdgeBundleIndex
+ EdgeBundle aEdgeBundle;
+ List aEdgeList;
+ EdgeVisibility eEdgeVisibility;
+ SpecMode eEdgeWidthSpecMode;
+
+ TextBundle* pTextBundle; // Pointer to the current TextBundleIndex
+ TextBundle aTextBundle;
+ List aTextList;
+ double nCharacterHeight;
+ double nCharacterOrientation[ 4 ];
+ UnderlineMode eUnderlineMode;
+ sal_uInt32 nUnderlineColor;
+ TextPath eTextPath;
+ TextAlignmentH eTextAlignmentH;
+ TextAlignmentV eTextAlignmentV;
+ double nTextAlignmentHCont;
+ double nTextAlignmentVCont;
+ long nCharacterSetIndex;
+ long nAlternateCharacterSetIndex;
+ CharacterCodingA eCharacterCodingA;
+ CGMFList aFontList;
+
+ FillBundle* pFillBundle; // Pointer to the current EdgeBundleIndex
+ FillBundle aFillBundle;
+ List aFillList;
+ FloatPoint aFillRefPoint;
+ Table aHatchTable;
+
+ Transparency eTransparency;
+
+ sal_uInt32 nAuxiliaryColor;
+
+ // Delimiter Counts -> which will be increased by each 'begin' operation
+ // and decreased by each 'end' operation
+ sal_Bool bSegmentCount;
+ CGMElements( CGM& rCGM );
+ ~CGMElements();
+ CGMElements& operator=( CGMElements& );
+ void Init();
+ void DeleteTable( Table& );
+ Bundle* GetBundleIndex( sal_uInt32 nIndex, List&, Bundle& );
+ Bundle* GetBundle( List& rList, long nIndex );
+ Bundle* InsertBundle( List&, Bundle& );
+ void DeleteAllBundles( List& );
+ void CopyAllBundles( List& Source, List& Dest );
+};
+
+#endif
+
diff --git a/filter/source/graphicfilter/icgm/exports.map b/filter/source/graphicfilter/icgm/exports.map
new file mode 100644
index 000000000000..cc7f07dd1112
--- /dev/null
+++ b/filter/source/graphicfilter/icgm/exports.map
@@ -0,0 +1,7 @@
+UDK_3_0_0 {
+ global:
+ ImportCGM;
+
+ local:
+ *;
+};
diff --git a/filter/source/graphicfilter/icgm/main.hxx b/filter/source/graphicfilter/icgm/main.hxx
new file mode 100644
index 000000000000..675d7149d12e
--- /dev/null
+++ b/filter/source/graphicfilter/icgm/main.hxx
@@ -0,0 +1,63 @@
+/*************************************************************************
+ *
+ * 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 CGM_MAIN_HXX
+#define CGM_MAIN_HXX
+
+#include "cgm.hxx"
+
+// ---------------------------------------------------------------
+
+#define CGM_LEVEL1 0x0001 // VERSION 1 METAFILE
+#define CGM_LEVEL2 0x0002
+#define CGM_LEVEL3 0x0003
+#define CGM_GDSF_ONLY 0x00F0
+#define CGM_UNKNOWN_LEVEL 0x00F1
+#define CGM_UNKNOWN_COMMAND 0x00F2
+#define CGM_DESCRIPTION 0x00F3
+
+#define CGM_EXTENDED_PRIMITIVES_SET 0x0100 // INDICATES PRIMITIVES WHICH ARE AVAILABLE IN
+ // LEVEL 1 BUT ARE NOT DEFINED IN ISO 7942(GKS)
+#define CGM_DRAWING_PLUS_CONTROL_SET 0x0200 // INDICATES THAT THIS IS AN ADDITIONAL LEVEL 1
+ // ELEMENT
+#define ComOut( Level, Description ) if ( mpCommentOut ) ImplComment( Level, Description );
+
+#define BMCOL( _col ) BitmapColor( (sal_Int8)(_col >> 16 ), (sal_Int8)( _col >> 8 ), (sal_Int8)_col )
+#define ALIGN2( _nElementSize ) { _nElementSize = ( _nElementSize + 1 ) & ~1; }
+#define ALIGN4( _nElementSize ) { _nElementSize = ( _nElementSize + 3 ) & ~3; }
+#define ALIGN8( _nElementSize ) { _nElementSize = ( _nElementSize + 7 ) & ~7; }
+
+#include <vcl/salbtype.hxx>
+#include <tools/stream.hxx>
+#include <tools/list.hxx>
+#include "bundles.hxx"
+#include "bitmap.hxx"
+#include "elements.hxx"
+
+
+#endif
+
diff --git a/filter/source/graphicfilter/icgm/makefile.mk b/filter/source/graphicfilter/icgm/makefile.mk
new file mode 100644
index 000000000000..f8dc889086f5
--- /dev/null
+++ b/filter/source/graphicfilter/icgm/makefile.mk
@@ -0,0 +1,80 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+PRJNAME=filter
+TARGET=icgm
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Files --------------------------------------------------------
+.IF "$(L10N_framework)"==""
+SLOFILES = $(SLO)$/cgm.obj \
+ $(SLO)$/chart.obj \
+ $(SLO)$/class0.obj \
+ $(SLO)$/class1.obj \
+ $(SLO)$/class2.obj \
+ $(SLO)$/class3.obj \
+ $(SLO)$/class4.obj \
+ $(SLO)$/class5.obj \
+ $(SLO)$/class7.obj \
+ $(SLO)$/classx.obj \
+ $(SLO)$/outact.obj \
+ $(SLO)$/actimpr.obj \
+ $(SLO)$/bundles.obj \
+ $(SLO)$/bitmap.obj \
+ $(SLO)$/elements.obj
+# $(SLO)$/svdem.obj
+
+SHL1TARGET = icg$(DLLPOSTFIX)
+SHL1IMPLIB = icgm
+SHL1VERSIONMAP=exports.map
+SHL1DEF = $(MISC)$/$(SHL1TARGET).def
+SHL1LIBS = $(SLB)$/icgm.lib
+
+DEF1NAME=$(SHL1TARGET)
+
+.IF "$(GUI)"=="OS2"
+SHL1OBJS = $(SLO)$/class0.obj
+.ENDIF
+
+SHL1STDLIBS = \
+ $(TKLIB) \
+ $(VCLLIB) \
+ $(UNOTOOLSLIB) \
+ $(TOOLSLIB) \
+ $(CPPULIB) \
+ $(SALLIB)
+.ENDIF
+
+# --- Targets --------------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/filter/source/graphicfilter/icgm/outact.cxx b/filter/source/graphicfilter/icgm/outact.cxx
new file mode 100644
index 000000000000..6e7e9959a4c7
--- /dev/null
+++ b/filter/source/graphicfilter/icgm/outact.cxx
@@ -0,0 +1,200 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include <outact.hxx>
+#include <vcl/gradient.hxx>
+
+using namespace ::com::sun::star;
+
+// ---------------------------------------------------------------
+
+CGMOutAct::CGMOutAct( CGM& rCGM )
+{
+ mpCGM = &rCGM;
+ mnCurrentPage = 0;
+ mnGroupActCount = mnGroupLevel = 0;
+ mpGroupLevel = new sal_uInt32[ CGM_OUTACT_MAX_GROUP_LEVEL ];
+ mpPoints = (Point*)new sal_Int8[ 0x2000 * sizeof( Point ) ];
+ mpFlags = new BYTE[ 0x2000 ];
+
+ mnIndex = 0;
+ mpGradient = NULL;
+};
+
+// ---------------------------------------------------------------
+
+CGMOutAct::~CGMOutAct()
+{
+ delete[] (sal_Int8*) mpPoints;
+ delete[] mpFlags;
+ delete[] mpGroupLevel;
+
+ if ( mpGradient )
+ delete mpGradient;
+};
+
+// ---------------------------------------------------------------
+
+void CGMOutAct::BeginFigure()
+{
+ if ( mnIndex )
+ EndFigure();
+
+ BeginGroup();
+ mnIndex = 0;
+}
+
+// ---------------------------------------------------------------
+
+void CGMOutAct::CloseRegion()
+{
+ if ( mnIndex > 2 )
+ {
+ NewRegion();
+ DrawPolyPolygon( maPolyPolygon );
+ maPolyPolygon.Clear();
+ }
+}
+
+// ---------------------------------------------------------------
+
+void CGMOutAct::NewRegion()
+{
+ if ( mnIndex > 2 )
+ {
+ Polygon aPolygon( mnIndex, mpPoints, mpFlags );
+ maPolyPolygon.Insert( aPolygon );
+ }
+ mnIndex = 0;
+}
+
+// ---------------------------------------------------------------
+
+void CGMOutAct::EndFigure()
+{
+ NewRegion();
+ DrawPolyPolygon( maPolyPolygon );
+ maPolyPolygon.Clear();
+ EndGroup();
+ mnIndex = 0;
+}
+
+// ---------------------------------------------------------------
+
+void CGMOutAct::RegPolyLine( Polygon& rPolygon, sal_Bool bReverse )
+{
+ USHORT nPoints = rPolygon.GetSize();
+ if ( nPoints )
+ {
+ if ( bReverse )
+ {
+ for ( USHORT i = 0; i < nPoints; i++ )
+ {
+ mpPoints[ mnIndex + i ] = rPolygon.GetPoint( nPoints - i - 1 );
+ mpFlags[ mnIndex + i ] = (sal_Int8)rPolygon.GetFlags( nPoints - i - 1 );
+ }
+ }
+ else
+ {
+ for ( USHORT i = 0; i < nPoints; i++ )
+ {
+ mpPoints[ mnIndex + i ] = rPolygon.GetPoint( i );
+ mpFlags[ mnIndex + i ] = (sal_Int8)rPolygon.GetFlags( i );
+ }
+ }
+ mnIndex = mnIndex + nPoints;
+ }
+}
+
+// ---------------------------------------------------------------
+
+void CGMOutAct::SetGradientOffset( long nHorzOfs, long nVertOfs, sal_uInt32 /*nType*/ )
+{
+ if ( !mpGradient )
+ mpGradient = new awt::Gradient;
+ mpGradient->XOffset = ( (sal_uInt16)nHorzOfs & 0x7f );
+ mpGradient->YOffset = ( (sal_uInt16)nVertOfs & 0x7f );
+}
+
+// ---------------------------------------------------------------
+
+void CGMOutAct::SetGradientAngle( long nAngle )
+{
+ if ( !mpGradient )
+ mpGradient = new awt::Gradient;
+ mpGradient->Angle = sal::static_int_cast< sal_Int16 >(nAngle);
+}
+
+// ---------------------------------------------------------------
+
+void CGMOutAct::SetGradientDescriptor( sal_uInt32 nColorFrom, sal_uInt32 nColorTo )
+{
+ if ( !mpGradient )
+ mpGradient = new awt::Gradient;
+ mpGradient->StartColor = nColorFrom;
+ mpGradient->EndColor = nColorTo;
+}
+
+// ---------------------------------------------------------------
+
+void CGMOutAct::SetGradientStyle( sal_uInt32 nStyle, double /*fRatio*/ )
+{
+ if ( !mpGradient )
+ mpGradient = new awt::Gradient;
+ switch ( nStyle )
+ {
+ case 0xff :
+ {
+ mpGradient->Style = awt::GradientStyle_AXIAL;
+ }
+ break;
+ case 4 :
+ {
+ mpGradient->Style = awt::GradientStyle_RADIAL; // CONICAL
+ }
+ break;
+ case 3 :
+ {
+ mpGradient->Style = awt::GradientStyle_RECT;
+ }
+ break;
+ case 2 :
+ {
+ mpGradient->Style = awt::GradientStyle_ELLIPTICAL;
+ }
+ break;
+ default :
+ {
+ mpGradient->Style = awt::GradientStyle_LINEAR;
+ }
+ }
+}
+
+
diff --git a/filter/source/graphicfilter/icgm/outact.hxx b/filter/source/graphicfilter/icgm/outact.hxx
new file mode 100644
index 000000000000..10c47dd14906
--- /dev/null
+++ b/filter/source/graphicfilter/icgm/outact.hxx
@@ -0,0 +1,148 @@
+/*************************************************************************
+ *
+ * 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 CGM_OUTACT_HXX_
+#define CGM_OUTACT_HXX_
+
+#include <com/sun/star/awt/Gradient.hpp>
+#include <com/sun/star/drawing/XDrawPages.hpp>
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+
+#define CGM_OUTACT_MAX_GROUP_LEVEL 64
+
+#include "cgm.hxx"
+#include <chart.hxx>
+#include <tools/poly.hxx>
+
+typedef struct NodeFrameSet
+{
+ Point nTopLeft;
+ Point nBottomRight;
+ ::com::sun::star::awt::Size nSize;
+} NodeFrameSet;
+
+class CGM;
+class VclGradient;
+class CGMOutAct
+{
+ protected:
+ sal_uInt16 mnCurrentPage; // defaulted to zero
+
+ sal_uInt32 mnGroupActCount; // grouping
+ sal_uInt32 mnGroupLevel;
+ sal_uInt32* mpGroupLevel;
+
+ USHORT mnIndex; // figure
+ BYTE* mpFlags;
+ Point* mpPoints;
+ PolyPolygon maPolyPolygon;
+ ::com::sun::star::awt::Gradient* mpGradient;
+
+ CGM* mpCGM;
+
+ public:
+ CGMOutAct( CGM& rCGM );
+ virtual ~CGMOutAct();
+ virtual void FirstOutPut() { mpCGM->mbFirstOutPut = sal_False; } ;
+ virtual void InsertPage() { mnCurrentPage++; } ;
+ virtual void BeginGroup() {} ;
+ virtual void EndGroup() {};
+ virtual void EndGrouping() {} ;
+ void BeginFigure() ;
+ void CloseRegion() ;
+ void NewRegion() ;
+ void EndFigure() ;
+ void RegPolyLine( Polygon&, sal_Bool bReverse = sal_False ) ;
+ void SetGradientOffset( long nHorzOfs, long nVertOfs, sal_uInt32 nType );
+ void SetGradientAngle( long nAngle );
+ void SetGradientDescriptor( sal_uInt32 nColorFrom, sal_uInt32 nColorTo );
+ void SetGradientStyle( sal_uInt32 nStyle, double fRatio );
+ virtual void DrawRectangle( FloatRect& ) {} ;
+ virtual void DrawEllipse( FloatPoint&, FloatPoint&, double& ) {} ;
+ virtual void DrawEllipticalArc( FloatPoint&, FloatPoint&, double&,
+ sal_uInt32, double&, double&) {} ;
+ virtual void DrawBitmap( CGMBitmapDescriptor* ) {} ;
+ virtual void DrawPolygon( Polygon& ) {} ;
+ virtual void DrawPolyLine( Polygon& ) {} ;
+ virtual void DrawPolybezier( Polygon& ) {} ;
+ virtual void DrawPolyPolygon( PolyPolygon& ) {} ;
+ virtual void DrawText( ::com::sun::star::awt::Point&, ::com::sun::star::awt::Size&, char*, sal_uInt32, FinalFlag ) {} ;
+ virtual void AppendText( char*, sal_uInt32, FinalFlag ) {} ;
+ virtual sal_uInt32 DrawText( TextEntry*, NodeFrameSet&, sal_uInt32 ) { return 0; } ;
+ virtual void DrawChart(){} ;
+};
+
+class CGMImpressOutAct : public CGMOutAct
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPages > maXDrawPages;
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > maXDrawPage;
+
+// ::com::sun::star::uno::Reference< XServiceRegistry > maXServiceRegistry;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > maXMultiServiceFactory;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > maXServiceManagerSC;
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > maXShape;
+ sal_Bool ImplCreateShape( const ::rtl::OUString& rType );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > maXPropSet;
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > maXShapes;
+
+ sal_uInt32 nFinalTextCount;
+
+ sal_Bool ImplInitPage();
+ void ImplSetOrientation( FloatPoint& RefPoint, double& Orientation ) ;
+ void ImplSetLineBundle() ;
+ void ImplSetFillBundle() ;
+ void ImplSetTextBundle( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & ) ;
+public:
+ CGMImpressOutAct( CGM&, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & ) ;
+ ~CGMImpressOutAct() {} ;
+ virtual void InsertPage() ;
+ virtual void BeginGroup() ;
+ virtual void EndGroup() ;
+ virtual void EndGrouping() ;
+ virtual void DrawRectangle( FloatRect& ) ;
+ virtual void DrawEllipse( FloatPoint& center, FloatPoint&, double& Orientation ) ;
+ virtual void DrawEllipticalArc( FloatPoint& center, FloatPoint& size, double& orientation,
+ sal_uInt32 etype, double& startangle, double& endangle ) ;
+ virtual void DrawBitmap( CGMBitmapDescriptor* ) ;
+ virtual void DrawPolygon( Polygon& ) ;
+ virtual void DrawPolyLine( Polygon& ) ;
+ virtual void DrawPolybezier( Polygon& ) ;
+ virtual void DrawPolyPolygon( PolyPolygon& ) ;
+ virtual void DrawText( ::com::sun::star::awt::Point& TextRectPos, ::com::sun::star::awt::Size& TextRectSize, char* String, sal_uInt32 StringSize, FinalFlag ) ;
+ virtual void AppendText( char* String, sal_uInt32 StringSize, FinalFlag ) ;
+ virtual sal_uInt32 DrawText( TextEntry*, NodeFrameSet&, sal_uInt32 ) ;
+ virtual void DrawChart();
+};
+
+
+#endif
+
diff --git a/filter/source/graphicfilter/idxf/dxf2mtf.cxx b/filter/source/graphicfilter/idxf/dxf2mtf.cxx
new file mode 100644
index 000000000000..11e82f97b328
--- /dev/null
+++ b/filter/source/graphicfilter/idxf/dxf2mtf.cxx
@@ -0,0 +1,980 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include <string.h>
+#include <vcl/gdimtf.hxx>
+#include <vcl/virdev.hxx>
+#include <tools/poly.hxx>
+#include "dxf2mtf.hxx"
+
+#include <math.h>
+
+
+ULONG DXF2GDIMetaFile::CountEntities(const DXFEntities & rEntities)
+{
+ const DXFBasicEntity * pBE;
+ ULONG nRes;
+
+ nRes=0;
+ for (pBE=rEntities.pFirst; pBE!=NULL; pBE=pBE->pSucc) nRes++;
+ return nRes;
+}
+
+
+void DXF2GDIMetaFile::MayCallback(ULONG /*nMainEntitiesProcessed*/)
+{
+ // ULONG nPercent;
+/*
+ if (pCallback!=NULL && nMainEntitiesCount!=0) {
+ nPercent=nMinPercent+(nMaxPercent-nMinPercent)*nMainEntitiesProcessed/nMainEntitiesCount;
+ if (nPercent>=nLastPercent+4) {
+ if (((*pCallback)(pCallerData,(USHORT)nPercent))==TRUE) bStatus=FALSE;
+ nLastPercent=nPercent;
+ }
+ }
+*/
+}
+
+Color DXF2GDIMetaFile::ConvertColor(BYTE nColor)
+{
+ return Color(
+ pDXF->aPalette.GetRed( nColor ),
+ pDXF->aPalette.GetGreen( nColor ),
+ pDXF->aPalette.GetBlue( nColor ) );
+}
+
+long DXF2GDIMetaFile::GetEntityColor(const DXFBasicEntity & rE)
+{
+ long nColor;
+ const DXFLayer * pLayer;
+
+ nColor=rE.nColor;
+ if (nColor==256) {
+ if (rE.sLayer[0]=='0' && rE.sLayer[1]==0) nColor=nParentLayerColor;
+ else {
+ pLayer=pDXF->aTables.SearchLayer(rE.sLayer);
+ if (pLayer!=NULL) nColor=pLayer->nColor;
+ else nColor=nParentLayerColor;
+ }
+ }
+ else if (nColor==0) nColor=nBlockColor;
+ return nColor;
+}
+
+DXFLineInfo DXF2GDIMetaFile::LTypeToDXFLineInfo(const char * sLineType)
+{
+ const DXFLType * pLT;
+ DXFLineInfo aDXFLineInfo;
+
+ pLT=pDXF->aTables.SearchLType(sLineType);
+ if (pLT==NULL || pLT->nDashCount == 0) {
+ aDXFLineInfo.eStyle = LINE_SOLID;
+ }
+ else {
+ sal_Int32 i;
+ double x;
+ aDXFLineInfo.eStyle = LINE_DASH;
+ for (i=0; i < (pLT->nDashCount); i++) {
+ x = pLT->fDash[i] * pDXF->getGlobalLineTypeScale();
+// ####
+ // x = (sal_Int32) rTransform.TransLineWidth( pLT->fDash[i] * pDXF->getGlobalLineTypeScale() );
+ if ( x >= 0.0 ) {
+ if ( aDXFLineInfo.nDotCount == 0 ) {
+ aDXFLineInfo.nDotCount ++;
+ aDXFLineInfo.fDotLen = x;
+ }
+ else if ( aDXFLineInfo.fDotLen == x ) {
+ aDXFLineInfo.nDotCount ++;
+ }
+ else if ( aDXFLineInfo.nDashCount == 0 ) {
+ aDXFLineInfo.nDashCount ++;
+ aDXFLineInfo.fDashLen = x;
+ }
+ else if ( aDXFLineInfo.fDashLen == x ) {
+ aDXFLineInfo.nDashCount ++;
+ }
+ else {
+ // It is impossible to be converted.
+ }
+ }
+ else {
+ if ( aDXFLineInfo.fDistance == 0 ) {
+ aDXFLineInfo.fDistance = -1 * x;
+ }
+ else {
+ // It is impossible to be converted.
+ }
+ }
+
+ }
+ }
+
+#if 0
+ if (aDXFLineInfo.DashCount > 0 && aDXFLineInfo.DashLen == 0.0)
+ aDXFLineInfo.DashLen ( 1 );
+ if (aDXFLineInfo.DotCount > 0 && aDXFLineInfo.DotLen() == 0.0)
+ aDXFLineInfo.SetDotLen( 1 );
+ if (aDXFLineInfo.GetDashCount > 0 || aDXFLineInfo.GetDotCount > 0)
+ if (aDXFLineInfo.GetDistance() == 0)
+ aDXFLineInfo.SetDistance( 1 );
+#endif
+
+ return aDXFLineInfo;
+}
+
+DXFLineInfo DXF2GDIMetaFile::GetEntityDXFLineInfo(const DXFBasicEntity & rE)
+{
+ DXFLineInfo aDXFLineInfo;
+ const DXFLayer * pLayer;
+
+ aDXFLineInfo.eStyle = LINE_SOLID;
+ aDXFLineInfo.fWidth = 0;
+ aDXFLineInfo.nDashCount = 0;
+ aDXFLineInfo.fDashLen = 0;
+ aDXFLineInfo.nDotCount = 0;
+ aDXFLineInfo.fDotLen = 0;
+ aDXFLineInfo.fDistance = 0;
+
+ if (strcmp(rE.sLineType,"BYLAYER")==0) {
+ if (rE.sLayer[0]=='0' && rE.sLayer[1]==0) aDXFLineInfo=aParentLayerDXFLineInfo;
+ else {
+ pLayer=pDXF->aTables.SearchLayer(rE.sLayer);
+ if (pLayer!=NULL) aDXFLineInfo=LTypeToDXFLineInfo(pLayer->sLineType);
+ else aDXFLineInfo=aParentLayerDXFLineInfo;
+ }
+ }
+ else if (strcmp(rE.sLineType,"BYBLOCK")==0) {
+ aDXFLineInfo=aBlockDXFLineInfo;
+ }
+ else aDXFLineInfo=LTypeToDXFLineInfo(rE.sLineType);
+ return aDXFLineInfo;
+}
+
+
+BOOL DXF2GDIMetaFile::SetLineAttribute(const DXFBasicEntity & rE, ULONG /*nWidth*/)
+{
+ long nColor;
+ Color aColor;
+
+ nColor=GetEntityColor(rE);
+ if (nColor<0) return FALSE;
+ aColor=ConvertColor((BYTE)nColor);
+
+ if (aActLineColor!=aColor) {
+ pVirDev->SetLineColor( aActLineColor = aColor );
+ }
+
+ if (aActFillColor!=Color( COL_TRANSPARENT )) {
+ pVirDev->SetFillColor(aActFillColor = Color( COL_TRANSPARENT ));
+ }
+ return TRUE;
+}
+
+
+BOOL DXF2GDIMetaFile::SetAreaAttribute(const DXFBasicEntity & rE)
+{
+ long nColor;
+ Color aColor;
+
+ nColor=GetEntityColor(rE);
+ if (nColor<0) return FALSE;
+ aColor=ConvertColor((BYTE)nColor);
+
+ if (aActLineColor!=aColor) {
+ pVirDev->SetLineColor( aActLineColor = aColor );
+ }
+
+ if ( aActFillColor == Color( COL_TRANSPARENT ) || aActFillColor != aColor) {
+ pVirDev->SetFillColor( aActFillColor = aColor );
+ }
+ return TRUE;
+}
+
+
+BOOL DXF2GDIMetaFile::SetFontAttribute(const DXFBasicEntity & rE, short nAngle, USHORT nHeight, double /*fWidthScale*/)
+{
+ long nColor;
+ Color aColor;
+ Font aFont;
+
+ nAngle=-nAngle;
+ while (nAngle>3600) nAngle-=3600;
+ while (nAngle<0) nAngle+=3600;
+
+ nColor=GetEntityColor(rE);
+ if (nColor<0) return FALSE;
+ aColor=ConvertColor((BYTE)nColor);
+
+ aFont.SetColor(aColor);
+ aFont.SetTransparent(TRUE);
+ aFont.SetFamily(FAMILY_SWISS);
+ aFont.SetSize(Size(0,nHeight));
+ aFont.SetAlign(ALIGN_BASELINE);
+ aFont.SetOrientation(nAngle);
+ if (aActFont!=aFont) {
+ aActFont=aFont;
+ pVirDev->SetFont(aActFont);
+ }
+
+ return TRUE;
+}
+
+
+void DXF2GDIMetaFile::DrawLineEntity(const DXFLineEntity & rE, const DXFTransform & rTransform)
+{
+ if (SetLineAttribute(rE)) {
+ Point aP0,aP1;
+ rTransform.Transform(rE.aP0,aP0);
+ rTransform.Transform(rE.aP1,aP1);
+
+ DXFLineInfo aDXFLineInfo;
+ aDXFLineInfo=GetEntityDXFLineInfo(rE);
+ LineInfo aLineInfo;
+ aLineInfo = rTransform.Transform(aDXFLineInfo);
+
+#if 0
+ printf("%f\n", rTransform.TransLineWidth(1000.0));
+
+ // LINE_NONE = 0, LINE_SOLID = 1, LINE_DASH = 2, LineStyle_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+ aLineInfo.SetStyle( LINE_DASH );
+ aLineInfo.SetWidth( 300 );
+ aLineInfo.SetDashCount( 2 );
+ aLineInfo.SetDashLen( 100 );
+ aLineInfo.SetDotCount( 1 );
+ aLineInfo.SetDotLen( 0 );
+ aLineInfo.SetDistance( 500 );
+#endif
+
+ pVirDev->DrawLine(aP0,aP1,aLineInfo);
+ if (rE.fThickness!=0) {
+ Point aP2,aP3;
+ rTransform.Transform(rE.aP0+DXFVector(0,0,rE.fThickness),aP2);
+ rTransform.Transform(rE.aP1+DXFVector(0,0,rE.fThickness),aP3);
+ pVirDev->DrawLine(aP2,aP3);
+ pVirDev->DrawLine(aP0,aP2);
+ pVirDev->DrawLine(aP1,aP3);
+ }
+ }
+}
+
+
+void DXF2GDIMetaFile::DrawPointEntity(const DXFPointEntity & rE, const DXFTransform & rTransform)
+{
+
+ if (SetLineAttribute(rE)) {
+ Point aP0;
+ rTransform.Transform(rE.aP0,aP0);
+ if (rE.fThickness==0) pVirDev->DrawPixel(aP0);
+ else {
+ Point aP1;
+ rTransform.Transform(rE.aP0+DXFVector(0,0,rE.fThickness),aP1);
+ pVirDev->DrawLine(aP0,aP1);
+ }
+ }
+}
+
+
+void DXF2GDIMetaFile::DrawCircleEntity(const DXFCircleEntity & rE, const DXFTransform & rTransform)
+{
+ double frx,fry,fAng;
+ USHORT nPoints,i;
+ DXFVector aC;
+
+ if (SetLineAttribute(rE)==FALSE) return;
+ rTransform.Transform(rE.aP0,aC);
+ if (rE.fThickness==0 && rTransform.TransCircleToEllipse(rE.fRadius,frx,fry)==TRUE) {
+ pVirDev->DrawEllipse(
+ Rectangle((long)(aC.fx-frx+0.5),(long)(aC.fy-fry+0.5),
+ (long)(aC.fx+frx+0.5),(long)(aC.fy+fry+0.5)));
+ }
+ else {
+ nPoints=OptPointsPerCircle;
+ Polygon aPoly(nPoints);
+ for (i=0; i<nPoints; i++) {
+ fAng=2*3.14159265359/(double)(nPoints-1)*(double)i;
+ rTransform.Transform(
+ rE.aP0+DXFVector(rE.fRadius*cos(fAng),rE.fRadius*sin(fAng),0),
+ aPoly[i]
+ );
+ }
+ pVirDev->DrawPolyLine(aPoly);
+ if (rE.fThickness!=0) {
+ Polygon aPoly2(nPoints);
+ for (i=0; i<nPoints; i++) {
+ fAng=2*3.14159265359/(double)(nPoints-1)*(double)i;
+ rTransform.Transform(
+ rE.aP0+DXFVector(rE.fRadius*cos(fAng),rE.fRadius*sin(fAng),rE.fThickness),
+ aPoly2[i]
+ );
+
+ }
+ pVirDev->DrawPolyLine(aPoly2);
+ for (i=0; i<nPoints-1; i++) pVirDev->DrawLine(aPoly[i],aPoly2[i]);
+ }
+ }
+}
+
+
+void DXF2GDIMetaFile::DrawArcEntity(const DXFArcEntity & rE, const DXFTransform & rTransform)
+{
+ double frx,fry,fA1,fdA,fAng;
+ USHORT nPoints,i;
+ DXFVector aC;
+ Point aPS,aPE;
+
+ if (SetLineAttribute(rE)==FALSE) return;
+ fA1=rE.fStart;
+ fdA=rE.fEnd-fA1;
+ while (fdA>=360.0) fdA-=360.0;
+ while (fdA<=0) fdA+=360.0;
+ rTransform.Transform(rE.aP0,aC);
+ if (rE.fThickness==0 && fdA>5.0 && rTransform.TransCircleToEllipse(rE.fRadius,frx,fry)==TRUE) {
+ DXFVector aVS(cos(fA1/180.0*3.14159265359),sin(fA1/180.0*3.14159265359),0.0);
+ aVS*=rE.fRadius;
+ aVS+=rE.aP0;
+ DXFVector aVE(cos((fA1+fdA)/180.0*3.14159265359),sin((fA1+fdA)/180.0*3.14159265359),0.0);
+ aVE*=rE.fRadius;
+ aVE+=rE.aP0;
+ if (rTransform.Mirror()==TRUE) {
+ rTransform.Transform(aVS,aPS);
+ rTransform.Transform(aVE,aPE);
+ }
+ else {
+ rTransform.Transform(aVS,aPE);
+ rTransform.Transform(aVE,aPS);
+ }
+ pVirDev->DrawArc(
+ Rectangle((long)(aC.fx-frx+0.5),(long)(aC.fy-fry+0.5),
+ (long)(aC.fx+frx+0.5),(long)(aC.fy+fry+0.5)),
+ aPS,aPE
+ );
+ }
+ else {
+ nPoints=(USHORT)(fdA/360.0*(double)OptPointsPerCircle+0.5);
+ if (nPoints<2) nPoints=2;
+ Polygon aPoly(nPoints);
+ for (i=0; i<nPoints; i++) {
+ fAng=3.14159265359/180.0 * ( fA1 + fdA/(double)(nPoints-1)*(double)i );
+ rTransform.Transform(
+ rE.aP0+DXFVector(rE.fRadius*cos(fAng),rE.fRadius*sin(fAng),0),
+ aPoly[i]
+ );
+ }
+ pVirDev->DrawPolyLine(aPoly);
+ if (rE.fThickness!=0) {
+ Polygon aPoly2(nPoints);
+ for (i=0; i<nPoints; i++) {
+ fAng=3.14159265359/180.0 * ( fA1 + fdA/(double)(nPoints-1)*(double)i );
+ rTransform.Transform(
+ rE.aP0+DXFVector(rE.fRadius*cos(fAng),rE.fRadius*sin(fAng),rE.fThickness),
+ aPoly2[i]
+ );
+ }
+ pVirDev->DrawPolyLine(aPoly2);
+ for (i=0; i<nPoints; i++) pVirDev->DrawLine(aPoly[i],aPoly2[i]);
+ }
+ }
+}
+
+
+void DXF2GDIMetaFile::DrawTraceEntity(const DXFTraceEntity & rE, const DXFTransform & rTransform)
+{
+ if (SetLineAttribute(rE)) {
+ Polygon aPoly(4);
+ rTransform.Transform(rE.aP0,aPoly[0]);
+ rTransform.Transform(rE.aP1,aPoly[1]);
+ rTransform.Transform(rE.aP3,aPoly[2]);
+ rTransform.Transform(rE.aP2,aPoly[3]);
+ pVirDev->DrawPolygon(aPoly);
+ if (rE.fThickness!=0) {
+ USHORT i;
+ Polygon aPoly2(4);
+ DXFVector aVAdd(0,0,rE.fThickness);
+ rTransform.Transform(rE.aP0+aVAdd,aPoly2[0]);
+ rTransform.Transform(rE.aP1+aVAdd,aPoly2[1]);
+ rTransform.Transform(rE.aP3+aVAdd,aPoly2[2]);
+ rTransform.Transform(rE.aP2+aVAdd,aPoly2[3]);
+ pVirDev->DrawPolygon(aPoly2);
+ for (i=0; i<4; i++) pVirDev->DrawLine(aPoly[i],aPoly2[i]);
+ }
+ }
+}
+
+
+void DXF2GDIMetaFile::DrawSolidEntity(const DXFSolidEntity & rE, const DXFTransform & rTransform)
+{
+ if (SetAreaAttribute(rE)) {
+ USHORT nN;
+ if (rE.aP2==rE.aP3) nN=3; else nN=4;
+ Polygon aPoly(nN);
+ rTransform.Transform(rE.aP0,aPoly[0]);
+ rTransform.Transform(rE.aP1,aPoly[1]);
+ rTransform.Transform(rE.aP3,aPoly[2]);
+ if (nN>3) rTransform.Transform(rE.aP2,aPoly[3]);
+ pVirDev->DrawPolygon(aPoly);
+ if (rE.fThickness!=0) {
+ Polygon aPoly2(nN);
+ DXFVector aVAdd(0,0,rE.fThickness);
+ rTransform.Transform(rE.aP0+aVAdd,aPoly2[0]);
+ rTransform.Transform(rE.aP1+aVAdd,aPoly2[1]);
+ rTransform.Transform(rE.aP3+aVAdd,aPoly2[2]);
+ if (nN>3) rTransform.Transform(rE.aP2+aVAdd,aPoly2[3]);
+ pVirDev->DrawPolygon(aPoly2);
+ if (SetLineAttribute(rE)) {
+ USHORT i;
+ for (i=0; i<nN; i++) pVirDev->DrawLine(aPoly[i],aPoly2[i]);
+ }
+ }
+ }
+}
+
+
+void DXF2GDIMetaFile::DrawTextEntity(const DXFTextEntity & rE, const DXFTransform & rTransform)
+{
+ DXFVector aV;
+ Point aPt;
+ double fA;
+ USHORT nHeight;
+ short nAng;
+ ByteString aStr( rE.sText );
+ DXFTransform aT( DXFTransform(rE.fXScale,rE.fHeight,1.0,rE.fRotAngle,rE.aP0), rTransform );
+ aT.TransDir(DXFVector(0,1,0),aV);
+ nHeight=(USHORT)(aV.Abs()+0.5);
+ fA=aT.CalcRotAngle();
+ nAng=(short)(fA*10.0+0.5);
+ aT.TransDir(DXFVector(1,0,0),aV);
+ if ( SetFontAttribute( rE,nAng, nHeight, aV. Abs() ) )
+ {
+ String aUString( aStr, pDXF->getTextEncoding() );
+ aT.Transform( DXFVector( 0, 0, 0 ), aPt );
+ pVirDev->DrawText( aPt, aUString );
+ }
+}
+
+
+void DXF2GDIMetaFile::DrawInsertEntity(const DXFInsertEntity & rE, const DXFTransform & rTransform)
+{
+ const DXFBlock * pB;
+ pB=pDXF->aBlocks.Search(rE.sName);
+ if (pB!=NULL) {
+ DXFTransform aDXFTransform1(1.0,1.0,1.0,DXFVector(0.0,0.0,0.0)-pB->aBasePoint);
+ DXFTransform aDXFTransform2(rE.fXScale,rE.fYScale,rE.fZScale,rE.fRotAngle,rE.aP0);
+ DXFTransform aT(
+ DXFTransform( aDXFTransform1, aDXFTransform2 ),
+ rTransform
+ );
+ long nSavedBlockColor, nSavedParentLayerColor;
+ DXFLineInfo aSavedBlockDXFLineInfo, aSavedParentLayerDXFLineInfo;
+ nSavedBlockColor=nBlockColor;
+ nSavedParentLayerColor=nParentLayerColor;
+ aSavedBlockDXFLineInfo=aBlockDXFLineInfo;
+ aSavedParentLayerDXFLineInfo=aParentLayerDXFLineInfo;
+ nBlockColor=GetEntityColor(rE);
+ aBlockDXFLineInfo=GetEntityDXFLineInfo(rE);
+ if (rE.sLayer[0]!='0' || rE.sLayer[1]!=0) {
+ DXFLayer * pLayer=pDXF->aTables.SearchLayer(rE.sLayer);
+ if (pLayer!=NULL) {
+ nParentLayerColor=pLayer->nColor;
+ aParentLayerDXFLineInfo=LTypeToDXFLineInfo(pLayer->sLineType);
+ }
+ }
+ DrawEntities(*pB,aT,FALSE);
+ aBlockDXFLineInfo=aSavedBlockDXFLineInfo;
+ aParentLayerDXFLineInfo=aSavedParentLayerDXFLineInfo;
+ nBlockColor=nSavedBlockColor;
+ nParentLayerColor=nSavedParentLayerColor;
+ }
+}
+
+
+void DXF2GDIMetaFile::DrawAttribEntity(const DXFAttribEntity & rE, const DXFTransform & rTransform)
+{
+ if ((rE.nAttrFlags&1)==0) {
+ DXFVector aV;
+ Point aPt;
+ double fA;
+ USHORT nHeight;
+ short nAng;
+ ByteString aStr( rE.sText );
+ DXFTransform aT( DXFTransform( rE.fXScale, rE.fHeight, 1.0, rE.fRotAngle, rE.aP0 ), rTransform );
+ aT.TransDir(DXFVector(0,1,0),aV);
+ nHeight=(USHORT)(aV.Abs()+0.5);
+ fA=aT.CalcRotAngle();
+ nAng=(short)(fA*10.0+0.5);
+ aT.TransDir(DXFVector(1,0,0),aV);
+ if (SetFontAttribute(rE,nAng,nHeight,aV.Abs()))
+ {
+ String aUString( aStr, pDXF->getTextEncoding() );
+ aT.Transform( DXFVector( 0, 0, 0 ), aPt );
+ pVirDev->DrawText( aPt, aUString );
+ }
+ }
+}
+
+
+void DXF2GDIMetaFile::DrawPolyLineEntity(const DXFPolyLineEntity & rE, const DXFTransform & rTransform)
+{
+ USHORT i,nPolySize;
+ double fW;
+ const DXFBasicEntity * pBE;
+
+ nPolySize=0;
+ pBE=rE.pSucc;
+ while (pBE!=NULL && pBE->eType==DXF_VERTEX) {
+ nPolySize++;
+ pBE=pBE->pSucc;
+ }
+ if (nPolySize<2) return;
+ Polygon aPoly(nPolySize);
+ fW=0.0;
+ pBE=rE.pSucc;
+ for (i=0; i<nPolySize; i++) {
+ rTransform.Transform(((DXFVertexEntity*)pBE)->aP0,aPoly[i]);
+ if (i+1<nPolySize || (rE.nFlags&1)!=0) {
+ if (((DXFVertexEntity*)pBE)->fSWidth>=0.0) fW+=((DXFVertexEntity*)pBE)->fSWidth;
+ else fW+=rE.fSWidth;
+ if (((DXFVertexEntity*)pBE)->fEWidth>=0.0) fW+=((DXFVertexEntity*)pBE)->fEWidth;
+ else fW+=rE.fEWidth;
+ }
+ pBE=pBE->pSucc;
+ }
+ fW/=2.0;
+ if ((rE.nFlags&1)!=0) fW/=(double)nPolySize;
+ else fW/=(double)(nPolySize-1);
+ if (SetLineAttribute(rE,rTransform.TransLineWidth(fW))) {
+ if ((rE.nFlags&1)!=0) pVirDev->DrawPolygon(aPoly);
+ else pVirDev->DrawPolyLine(aPoly);
+ if (rE.fThickness!=0) {
+ Polygon aPoly2(nPolySize);
+ pBE=rE.pSucc;
+ for (i=0; i<nPolySize; i++) {
+ rTransform.Transform(
+ (((DXFVertexEntity*)pBE)->aP0)+DXFVector(0,0,rE.fThickness),
+ aPoly2[i]
+ );
+ pBE=pBE->pSucc;
+ }
+ if ((rE.nFlags&1)!=0) pVirDev->DrawPolygon(aPoly2);
+ else pVirDev->DrawPolyLine(aPoly2);
+ for (i=0; i<nPolySize; i++) pVirDev->DrawLine(aPoly[i],aPoly2[i]);
+ }
+ }
+}
+
+void DXF2GDIMetaFile::DrawLWPolyLineEntity(const DXFLWPolyLineEntity & rE, const DXFTransform & rTransform )
+{
+ sal_Int32 i, nPolySize = rE.nCount;
+ if ( nPolySize && rE.pP )
+ {
+ Polygon aPoly( (sal_uInt16)nPolySize);
+ for ( i = 0; i < nPolySize; i++ )
+ {
+ rTransform.Transform( rE.pP[ (sal_uInt16)i ], aPoly[ (sal_uInt16)i ] );
+ }
+ double fW = rE.fConstantWidth;
+ if ( SetLineAttribute( rE, rTransform.TransLineWidth( fW ) ) )
+ {
+ if ( ( rE.nFlags & 1 ) != 0 )
+ pVirDev->DrawPolygon( aPoly );
+ else
+ pVirDev->DrawPolyLine( aPoly );
+ // ####
+ //pVirDev->DrawPolyLine( aPoly, aDXFLineInfo );
+ }
+ }
+}
+
+void DXF2GDIMetaFile::DrawHatchEntity(const DXFHatchEntity & rE, const DXFTransform & rTransform )
+{
+ if ( rE.nBoundaryPathCount )
+ {
+ SetAreaAttribute( rE );
+ sal_Int32 j = 0;
+ PolyPolygon aPolyPoly;
+ for ( j = 0; j < rE.nBoundaryPathCount; j++ )
+ {
+ DXFPointArray aPtAry;
+ const DXFBoundaryPathData& rPathData = rE.pBoundaryPathData[ j ];
+ if ( rPathData.bIsPolyLine )
+ {
+ sal_Int32 i;
+ for( i = 0; i < rPathData.nPointCount; i++ )
+ {
+ Point aPt;
+ rTransform.Transform( rPathData.pP[ i ], aPt );
+ aPtAry.push_back( aPt );
+ }
+ }
+ else
+ {
+ sal_uInt32 i;
+ for ( i = 0; i < rPathData.aEdges.size(); i++ )
+ {
+ const DXFEdgeType* pEdge = rPathData.aEdges[ i ];
+ switch( pEdge->nEdgeType )
+ {
+ case 1 :
+ {
+ Point aPt;
+ rTransform.Transform( ((DXFEdgeTypeLine*)pEdge)->aStartPoint, aPt );
+ aPtAry.push_back( aPt );
+ rTransform.Transform( ((DXFEdgeTypeLine*)pEdge)->aEndPoint, aPt );
+ aPtAry.push_back( aPt );
+ }
+ break;
+ case 2 :
+ {
+/*
+ double frx,fry,fA1,fdA,fAng;
+ USHORT nPoints,i;
+ DXFVector aC;
+ Point aPS,aPE;
+ fA1=((DXFEdgeTypeCircularArc*)pEdge)->fStartAngle;
+ fdA=((DXFEdgeTypeCircularArc*)pEdge)->fEndAngle - fA1;
+ while ( fdA >= 360.0 )
+ fdA -= 360.0;
+ while ( fdA <= 0 )
+ fdA += 360.0;
+ rTransform.Transform(((DXFEdgeTypeCircularArc*)pEdge)->aCenter, aC);
+ if ( fdA > 5.0 && rTransform.TransCircleToEllipse(((DXFEdgeTypeCircularArc*)pEdge)->fRadius,frx,fry ) == TRUE )
+ {
+ DXFVector aVS(cos(fA1/180.0*3.14159265359),sin(fA1/180.0*3.14159265359),0.0);
+ aVS*=((DXFEdgeTypeCircularArc*)pEdge)->fRadius;
+ aVS+=((DXFEdgeTypeCircularArc*)pEdge)->aCenter;
+ DXFVector aVE(cos((fA1+fdA)/180.0*3.14159265359),sin((fA1+fdA)/180.0*3.14159265359),0.0);
+ aVE*=((DXFEdgeTypeCircularArc*)pEdge)->fRadius;
+ aVE+=((DXFEdgeTypeCircularArc*)pEdge)->aCenter;
+ if ( rTransform.Mirror() == TRUE )
+ {
+ rTransform.Transform(aVS,aPS);
+ rTransform.Transform(aVE,aPE);
+ }
+ else
+ {
+ rTransform.Transform(aVS,aPE);
+ rTransform.Transform(aVE,aPS);
+ }
+ pVirDev->DrawArc(
+ Rectangle((long)(aC.fx-frx+0.5),(long)(aC.fy-fry+0.5),
+ (long)(aC.fx+frx+0.5),(long)(aC.fy+fry+0.5)),
+ aPS,aPE
+ );
+ }
+*/
+ }
+ break;
+ case 3 :
+ case 4 :
+ break;
+ }
+ }
+ }
+ sal_uInt16 i, nSize = (sal_uInt16)aPtAry.size();
+ if ( nSize )
+ {
+ Polygon aPoly( nSize );
+ for ( i = 0; i < nSize; i++ )
+ aPoly[ i ] = aPtAry[ i ];
+ aPolyPoly.Insert( aPoly, POLYPOLY_APPEND );
+ }
+ }
+ if ( aPolyPoly.Count() )
+ pVirDev->DrawPolyPolygon( aPolyPoly );
+ }
+}
+
+void DXF2GDIMetaFile::Draw3DFaceEntity(const DXF3DFaceEntity & rE, const DXFTransform & rTransform)
+{
+ USHORT nN,i;
+ if (SetLineAttribute(rE)) {
+ if (rE.aP2==rE.aP3) nN=3; else nN=4;
+ Polygon aPoly(nN);
+ rTransform.Transform(rE.aP0,aPoly[0]);
+ rTransform.Transform(rE.aP1,aPoly[1]);
+ rTransform.Transform(rE.aP2,aPoly[2]);
+ if (nN>3) rTransform.Transform(rE.aP3,aPoly[3]);
+ if ((rE.nIEFlags&0x0f)==0) pVirDev->DrawPolygon(aPoly);
+ else {
+ for (i=0; i<nN; i++) {
+ if ( (rE.nIEFlags & (1<<i)) == 0 ) {
+ pVirDev->DrawLine(aPoly[i],aPoly[(i+1)%nN]);
+ }
+ }
+ }
+ }
+}
+
+
+void DXF2GDIMetaFile::DrawDimensionEntity(const DXFDimensionEntity & rE, const DXFTransform & rTransform)
+{
+ const DXFBlock * pB;
+ pB=pDXF->aBlocks.Search(rE.sPseudoBlock);
+ if (pB!=NULL) {
+ DXFTransform aT(
+ DXFTransform(1.0,1.0,1.0,DXFVector(0.0,0.0,0.0)-pB->aBasePoint),
+ rTransform
+ );
+ long nSavedBlockColor, nSavedParentLayerColor;
+ DXFLineInfo aSavedBlockDXFLineInfo, aSavedParentLayerDXFLineInfo;
+ nSavedBlockColor=nBlockColor;
+ nSavedParentLayerColor=nParentLayerColor;
+ aSavedBlockDXFLineInfo=aBlockDXFLineInfo;
+ aSavedParentLayerDXFLineInfo=aParentLayerDXFLineInfo;
+ nBlockColor=GetEntityColor(rE);
+ aBlockDXFLineInfo=GetEntityDXFLineInfo(rE);
+ if (rE.sLayer[0]!='0' || rE.sLayer[1]!=0) {
+ DXFLayer * pLayer=pDXF->aTables.SearchLayer(rE.sLayer);
+ if (pLayer!=NULL) {
+ nParentLayerColor=pLayer->nColor;
+ aParentLayerDXFLineInfo=LTypeToDXFLineInfo(pLayer->sLineType);
+ }
+ }
+ DrawEntities(*pB,aT,FALSE);
+ aBlockDXFLineInfo=aSavedBlockDXFLineInfo;
+ aParentLayerDXFLineInfo=aSavedParentLayerDXFLineInfo;
+ nBlockColor=nSavedBlockColor;
+ nParentLayerColor=nSavedParentLayerColor;
+ }
+}
+
+
+void DXF2GDIMetaFile::DrawEntities(const DXFEntities & rEntities,
+ const DXFTransform & rTransform,
+ BOOL bTopEntities)
+{
+ ULONG nCount=0;
+ DXFTransform aET;
+ const DXFTransform * pT;
+
+ const DXFBasicEntity * pE=rEntities.pFirst;
+
+ while (pE!=NULL && bStatus==TRUE) {
+ if (pE->nSpace==0) {
+ if (pE->aExtrusion.fz==1.0) {
+ pT=&rTransform;
+ }
+ else {
+ aET=DXFTransform(DXFTransform(pE->aExtrusion),rTransform);
+ pT=&aET;
+ }
+ switch (pE->eType) {
+ case DXF_LINE:
+ DrawLineEntity((DXFLineEntity&)*pE,*pT);
+ break;
+ case DXF_POINT:
+ DrawPointEntity((DXFPointEntity&)*pE,*pT);
+ break;
+ case DXF_CIRCLE:
+ DrawCircleEntity((DXFCircleEntity&)*pE,*pT);
+ break;
+ case DXF_ARC:
+ DrawArcEntity((DXFArcEntity&)*pE,*pT);
+ break;
+ case DXF_TRACE:
+ DrawTraceEntity((DXFTraceEntity&)*pE,*pT);
+ break;
+ case DXF_SOLID:
+ DrawSolidEntity((DXFSolidEntity&)*pE,*pT);
+ break;
+ case DXF_TEXT:
+ DrawTextEntity((DXFTextEntity&)*pE,*pT);
+ break;
+ case DXF_INSERT:
+ DrawInsertEntity((DXFInsertEntity&)*pE,*pT);
+ break;
+ case DXF_ATTRIB:
+ DrawAttribEntity((DXFAttribEntity&)*pE,*pT);
+ break;
+ case DXF_POLYLINE:
+ DrawPolyLineEntity((DXFPolyLineEntity&)*pE,*pT);
+ break;
+ case DXF_LWPOLYLINE :
+ DrawLWPolyLineEntity((DXFLWPolyLineEntity&)*pE, *pT);
+ break;
+ case DXF_HATCH :
+ DrawHatchEntity((DXFHatchEntity&)*pE, *pT);
+ break;
+ case DXF_3DFACE:
+ Draw3DFaceEntity((DXF3DFaceEntity&)*pE,*pT);
+ break;
+ case DXF_DIMENSION:
+ DrawDimensionEntity((DXFDimensionEntity&)*pE,*pT);
+ break;
+ default:
+ break; // four other values not handled -Wall
+ }
+ }
+ pE=pE->pSucc;
+ nCount++;
+ if (bTopEntities) MayCallback(nCount);
+ }
+}
+
+
+DXF2GDIMetaFile::DXF2GDIMetaFile()
+{
+}
+
+
+DXF2GDIMetaFile::~DXF2GDIMetaFile()
+{
+}
+
+
+BOOL DXF2GDIMetaFile::Convert(const DXFRepresentation & rDXF, GDIMetaFile & rMTF, USHORT nminpercent, USHORT nmaxpercent)
+{
+ double fWidth,fHeight,fScale;
+ DXFTransform aTransform;
+ Size aPrefSize;
+ const DXFLayer * pLayer;
+ const DXFVPort * pVPort;
+
+ pVirDev = new VirtualDevice;
+ pDXF = &rDXF;
+ bStatus = TRUE;
+
+ OptPointsPerCircle=50;
+
+ nMinPercent=(ULONG)nminpercent;
+ nMaxPercent=(ULONG)nmaxpercent;
+ nLastPercent=nMinPercent;
+ nMainEntitiesCount=CountEntities(pDXF->aEntities);
+
+ nBlockColor=7;
+ aBlockDXFLineInfo.eStyle = LINE_SOLID;
+ aBlockDXFLineInfo.fWidth = 0;
+ aBlockDXFLineInfo.nDashCount = 0;
+ aBlockDXFLineInfo.fDashLen = 0;
+ aBlockDXFLineInfo.nDotCount = 0;
+ aBlockDXFLineInfo.fDotLen = 0;
+ aBlockDXFLineInfo.fDistance = 0;
+
+ pLayer=pDXF->aTables.SearchLayer("0");
+ if (pLayer!=NULL) {
+ nParentLayerColor=pLayer->nColor & 0xff;
+ aParentLayerDXFLineInfo=LTypeToDXFLineInfo(pLayer->sLineType);
+ }
+ else {
+ nParentLayerColor=7;
+ aParentLayerDXFLineInfo.eStyle = LINE_SOLID;
+ aParentLayerDXFLineInfo.fWidth = 0;
+ aParentLayerDXFLineInfo.nDashCount = 0;
+ aParentLayerDXFLineInfo.fDashLen = 0;
+ aParentLayerDXFLineInfo.nDotCount = 0;
+ aParentLayerDXFLineInfo.fDotLen = 0;
+ aParentLayerDXFLineInfo.fDistance = 0;
+ }
+
+ pVirDev->EnableOutput(FALSE);
+ rMTF.Record(pVirDev);
+
+ aActLineColor = pVirDev->GetLineColor();
+ aActFillColor = pVirDev->GetFillColor();
+ aActFont = pVirDev->GetFont();
+
+ pVPort=pDXF->aTables.SearchVPort("*ACTIVE");
+ if (pVPort!=NULL) {
+ if (pVPort->aDirection.fx==0 && pVPort->aDirection.fy==0)
+ pVPort=NULL;
+ }
+
+ if (pVPort==NULL) {
+ if (pDXF->aBoundingBox.bEmpty==TRUE)
+ bStatus=FALSE;
+ else {
+ fWidth=pDXF->aBoundingBox.fMaxX-pDXF->aBoundingBox.fMinX;
+ fHeight=pDXF->aBoundingBox.fMaxY-pDXF->aBoundingBox.fMinY;
+ if (fWidth<=0 || fHeight<=0) {
+ bStatus=FALSE;
+ fScale = 0; // -Wall added this...
+ }
+ else {
+// if (fWidth<500.0 || fHeight<500.0 || fWidth>32767.0 || fHeight>32767.0) {
+ if (fWidth>fHeight)
+ fScale=10000.0/fWidth;
+ else
+ fScale=10000.0/fHeight;
+// }
+// else
+// fScale=1.0;
+ aTransform=DXFTransform(fScale,-fScale,fScale,
+ DXFVector(-pDXF->aBoundingBox.fMinX*fScale,
+ pDXF->aBoundingBox.fMaxY*fScale,
+ -pDXF->aBoundingBox.fMinZ*fScale));
+ }
+ aPrefSize.Width() =(long)(fWidth*fScale+1.5);
+ aPrefSize.Height()=(long)(fHeight*fScale+1.5);
+ }
+ }
+ else {
+ fHeight=pVPort->fHeight;
+ fWidth=fHeight*pVPort->fAspectRatio;
+// if (fWidth<500.0 || fHeight<500.0 || fWidth>32767.0 || fHeight>32767.0) {
+ if (fWidth>fHeight)
+ fScale=10000.0/fWidth;
+ else
+ fScale=10000.0/fHeight;
+// }
+// else
+// fScale=1.0;
+ aTransform=DXFTransform(
+ DXFTransform(pVPort->aDirection,pVPort->aTarget),
+ DXFTransform(
+ DXFTransform(1.0,-1.0,1.0,DXFVector(fWidth/2-pVPort->fCenterX,fHeight/2+pVPort->fCenterY,0)),
+ DXFTransform(fScale,fScale,fScale,DXFVector(0,0,0))
+ )
+ );
+ aPrefSize.Width() =(long)(fWidth*fScale+1.5);
+ aPrefSize.Height()=(long)(fHeight*fScale+1.5);
+ }
+
+ if (bStatus==TRUE)
+ DrawEntities(pDXF->aEntities,aTransform,TRUE);
+
+ rMTF.Stop();
+
+ if ( bStatus==TRUE )
+ {
+ rMTF.SetPrefSize( aPrefSize );
+
+ // MapMode einfach, falls Grafik dann nicht zu klein wird (<0,5cm),
+ // auf 1/100-mm (1/10-mm) setzen
+ if( ( aPrefSize.Width() < 500 ) && ( aPrefSize.Height() < 500 ) )
+ rMTF.SetPrefMapMode( MapMode( MAP_10TH_MM ) );
+ else
+ rMTF.SetPrefMapMode( MapMode( MAP_100TH_MM ) );
+ }
+
+ delete pVirDev;
+ return bStatus;
+}
+
+
+
diff --git a/filter/source/graphicfilter/idxf/dxf2mtf.hxx b/filter/source/graphicfilter/idxf/dxf2mtf.hxx
new file mode 100644
index 000000000000..cb03c47429fc
--- /dev/null
+++ b/filter/source/graphicfilter/idxf/dxf2mtf.hxx
@@ -0,0 +1,128 @@
+/*************************************************************************
+ *
+ * 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 _DXF2MTF_HXX
+#define _DXF2MTF_HXX
+
+#include "dxfreprd.hxx"
+#include <vcl/font.hxx>
+#include <vcl/lineinfo.hxx>
+
+// MT: NOOLDSV, someone should change the code...
+enum PenStyle { PEN_NULL, PEN_SOLID, PEN_DOT, PEN_DASH, PEN_DASHDOT };
+enum BrushStyle { BRUSH_NULL, BRUSH_SOLID, BRUSH_HORZ, BRUSH_VERT,
+ BRUSH_CROSS, BRUSH_DIAGCROSS, BRUSH_UPDIAG, BRUSH_DOWNDIAG,
+ BRUSH_25, BRUSH_50, BRUSH_75,
+ BRUSH_BITMAP };
+
+
+class DXF2GDIMetaFile {
+private:
+
+ VirtualDevice * pVirDev;
+ const DXFRepresentation * pDXF;
+ BOOL bStatus;
+
+ USHORT OptPointsPerCircle;
+
+ ULONG nMinPercent;
+ ULONG nMaxPercent;
+ ULONG nLastPercent;
+ ULONG nMainEntitiesCount;
+
+ long nBlockColor;
+ DXFLineInfo aBlockDXFLineInfo;
+ long nParentLayerColor;
+ DXFLineInfo aParentLayerDXFLineInfo;
+ Color aActLineColor;
+ Color aActFillColor;
+ Font aActFont;
+
+ ULONG CountEntities(const DXFEntities & rEntities);
+
+ void MayCallback(ULONG nMainEntitiesProcessed);
+
+ Color ConvertColor(BYTE nColor);
+
+ long GetEntityColor(const DXFBasicEntity & rE);
+
+ DXFLineInfo LTypeToDXFLineInfo(const char * sLineType);
+
+ DXFLineInfo GetEntityDXFLineInfo(const DXFBasicEntity & rE);
+
+ BOOL SetLineAttribute(const DXFBasicEntity & rE, ULONG nWidth=0);
+
+ BOOL SetAreaAttribute(const DXFBasicEntity & rE);
+
+ BOOL SetFontAttribute(const DXFBasicEntity & rE, short nAngle,
+ USHORT nHeight, double fWidthScale);
+
+ void DrawLineEntity(const DXFLineEntity & rE, const DXFTransform & rTransform);
+
+ void DrawPointEntity(const DXFPointEntity & rE, const DXFTransform & rTransform);
+
+ void DrawCircleEntity(const DXFCircleEntity & rE, const DXFTransform & rTransform);
+
+ void DrawArcEntity(const DXFArcEntity & rE, const DXFTransform & rTransform);
+
+ void DrawTraceEntity(const DXFTraceEntity & rE, const DXFTransform & rTransform);
+
+ void DrawSolidEntity(const DXFSolidEntity & rE, const DXFTransform & rTransform);
+
+ void DrawTextEntity(const DXFTextEntity & rE, const DXFTransform & rTransform);
+
+ void DrawInsertEntity(const DXFInsertEntity & rE, const DXFTransform & rTransform);
+
+ void DrawAttribEntity(const DXFAttribEntity & rE, const DXFTransform & rTransform);
+
+ void DrawPolyLineEntity(const DXFPolyLineEntity & rE, const DXFTransform & rTransform);
+
+ void Draw3DFaceEntity(const DXF3DFaceEntity & rE, const DXFTransform & rTransform);
+
+ void DrawDimensionEntity(const DXFDimensionEntity & rE, const DXFTransform & rTransform);
+
+ void DrawLWPolyLineEntity( const DXFLWPolyLineEntity & rE, const DXFTransform & rTransform );
+
+ void DrawHatchEntity( const DXFHatchEntity & rE, const DXFTransform & rTransform );
+
+ void DrawEntities(const DXFEntities & rEntities,
+ const DXFTransform & rTransform,
+ BOOL bTopEntities);
+
+public:
+
+ DXF2GDIMetaFile();
+ ~DXF2GDIMetaFile();
+
+ BOOL Convert( const DXFRepresentation & rDXF, GDIMetaFile & rMTF, USHORT nMinPercent, USHORT nMaxPercent);
+
+};
+
+
+#endif
+
+
diff --git a/filter/source/graphicfilter/idxf/dxfblkrd.cxx b/filter/source/graphicfilter/idxf/dxfblkrd.cxx
new file mode 100644
index 000000000000..da7753615bf3
--- /dev/null
+++ b/filter/source/graphicfilter/idxf/dxfblkrd.cxx
@@ -0,0 +1,139 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include <string.h>
+#include <dxfblkrd.hxx>
+
+
+//----------------------------------------------------------------------------
+//---------------- DXFBlock --------------------------------------------------
+//----------------------------------------------------------------------------
+
+
+DXFBlock::DXFBlock()
+{
+ pSucc=NULL;
+}
+
+
+DXFBlock::~DXFBlock()
+{
+}
+
+
+void DXFBlock::Read(DXFGroupReader & rDGR)
+{
+ sName[0]=0;
+ sAlsoName[0]=0;
+ aBasePoint.fx=0.0;
+ aBasePoint.fy=0.0;
+ aBasePoint.fz=0.0;
+ nFlags=0;
+ sXRef[0]=0;
+
+ while (rDGR.Read()!=0)
+ {
+ switch (rDGR.GetG())
+ {
+ case 2: strncpy( sName, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
+ case 3: strncpy( sAlsoName, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
+ case 70: nFlags=rDGR.GetI(); break;
+ case 10: aBasePoint.fx=rDGR.GetF(); break;
+ case 20: aBasePoint.fy=rDGR.GetF(); break;
+ case 30: aBasePoint.fz=rDGR.GetF(); break;
+ case 1: strncpy( sXRef, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
+ }
+ }
+ DXFEntities::Read(rDGR);
+}
+
+
+//----------------------------------------------------------------------------
+//---------------- DXFBlocks -------------------------------------------------
+//----------------------------------------------------------------------------
+
+
+DXFBlocks::DXFBlocks()
+{
+ pFirst=NULL;
+}
+
+
+DXFBlocks::~DXFBlocks()
+{
+ Clear();
+}
+
+
+void DXFBlocks::Read(DXFGroupReader & rDGR)
+{
+ DXFBlock * pB, * * ppSucc;
+
+ ppSucc=&pFirst;
+ while (*ppSucc!=NULL) ppSucc=&((*ppSucc)->pSucc);
+
+ for (;;) {
+ while (rDGR.GetG()!=0) rDGR.Read();
+ if (strcmp(rDGR.GetS(),"ENDSEC")==0 ||
+ strcmp(rDGR.GetS(),"EOF")==0) break;
+ if (strcmp(rDGR.GetS(),"BLOCK")==0) {
+ pB=new DXFBlock;
+ pB->Read(rDGR);
+ *ppSucc=pB;
+ ppSucc=&(pB->pSucc);
+ }
+ else rDGR.Read();
+ }
+}
+
+
+DXFBlock * DXFBlocks::Search(const char * sName) const
+{
+ DXFBlock * pB;
+ for (pB=pFirst; pB!=NULL; pB=pB->pSucc) {
+ if (strcmp(sName,pB->sName)==0) break;
+ }
+ return pB;
+}
+
+
+void DXFBlocks::Clear()
+{
+ DXFBlock * ptmp;
+
+ while (pFirst!=NULL) {
+ ptmp=pFirst;
+ pFirst=ptmp->pSucc;
+ delete ptmp;
+ }
+}
+
+
+
diff --git a/filter/source/graphicfilter/idxf/dxfblkrd.hxx b/filter/source/graphicfilter/idxf/dxfblkrd.hxx
new file mode 100644
index 000000000000..9f0d92e3fa6d
--- /dev/null
+++ b/filter/source/graphicfilter/idxf/dxfblkrd.hxx
@@ -0,0 +1,87 @@
+/*************************************************************************
+ *
+ * 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 _DXFBLKRD_HXX
+#define _DXFBLKRD_HXX
+
+#include <dxfentrd.hxx>
+
+//----------------------------------------------------------------------------
+//---------------- Ein Block (= Menge von Entities) --------------------------
+//----------------------------------------------------------------------------
+
+class DXFBlock : public DXFEntities {
+
+public:
+
+ DXFBlock * pSucc;
+ // Zeiger auf naechsten Block in der Liste DXFBlocks::pFirst
+
+ // Eigenschaften des Blocks, durch Gruppencodes kommentiert:
+ char sName[DXF_MAX_STRING_LEN+1]; // 2
+ char sAlsoName[DXF_MAX_STRING_LEN+1]; // 3
+ long nFlags; // 70
+ DXFVector aBasePoint; // 10,20,30
+ char sXRef[DXF_MAX_STRING_LEN+1]; // 1
+
+ DXFBlock();
+ ~DXFBlock();
+
+ void Read(DXFGroupReader & rDGR);
+ // Liest den Block (einschliesslich der Entities) per rGDR
+ // aus einer DXF-Datei bis zu einem ENDBLK, ENDSEC oder EOF.
+};
+
+
+//----------------------------------------------------------------------------
+//---------------- Eine Menge von Bloecken -----------------------------------
+//----------------------------------------------------------------------------
+
+class DXFBlocks {
+
+public:
+
+ DXFBlock * pFirst;
+ // Liste der Bloecke, READ ONLY!
+
+ DXFBlocks();
+ ~DXFBlocks();
+
+ void Read(DXFGroupReader & rDGR);
+ // Liesst alle Bloecke per rDGR bis zu einem ENDSEC oder EOF.
+
+ DXFBlock * Search(const char * sName) const;
+ // Sucht einen Block mit dem Namen, liefert NULL bei Misserfolg.
+
+ void Clear();
+ // Loescht alle Bloecke;
+
+};
+
+#endif
+
+
diff --git a/filter/source/graphicfilter/idxf/dxfentrd.cxx b/filter/source/graphicfilter/idxf/dxfentrd.cxx
new file mode 100644
index 000000000000..990594a90731
--- /dev/null
+++ b/filter/source/graphicfilter/idxf/dxfentrd.cxx
@@ -0,0 +1,871 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include <string.h>
+#include <dxfentrd.hxx>
+
+//--------------------------DXFBasicEntity--------------------------------------
+
+DXFBasicEntity::DXFBasicEntity(DXFEntityType eThisType)
+{
+ eType=eThisType;
+ pSucc=NULL;
+ strncpy(sLayer,"0", 2 );
+ strncpy(sLineType,"BYLAYER", 8 );
+ fElevation=0;
+ fThickness=0;
+ nColor=256;
+ nSpace=0;
+ aExtrusion.fx=0.0;
+ aExtrusion.fy=0.0;
+ aExtrusion.fz=1.0;
+}
+
+void DXFBasicEntity::Read(DXFGroupReader & rDGR)
+{
+ while (rDGR.Read()!=0) EvaluateGroup(rDGR);
+}
+
+void DXFBasicEntity::EvaluateGroup(DXFGroupReader & rDGR)
+{
+ switch (rDGR.GetG())
+ {
+ case 8: strncpy( sLayer, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
+ case 6: strncpy( sLineType, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
+ case 38: fElevation=rDGR.GetF(); break;
+ case 39: fThickness=rDGR.GetF(); break;
+ case 62: nColor=rDGR.GetI(); break;
+ case 67: nSpace=rDGR.GetI(); break;
+ case 210: aExtrusion.fx=rDGR.GetF(); break;
+ case 220: aExtrusion.fy=rDGR.GetF(); break;
+ case 230: aExtrusion.fz=rDGR.GetF(); break;
+ }
+}
+
+DXFBasicEntity::~DXFBasicEntity()
+{
+}
+
+//--------------------------DXFLineEntity---------------------------------------
+
+DXFLineEntity::DXFLineEntity() : DXFBasicEntity(DXF_LINE)
+{
+}
+
+void DXFLineEntity::EvaluateGroup(DXFGroupReader & rDGR)
+{
+ switch (rDGR.GetG()) {
+ case 10: aP0.fx=rDGR.GetF(); break;
+ case 20: aP0.fy=rDGR.GetF(); break;
+ case 30: aP0.fz=rDGR.GetF(); break;
+ case 11: aP1.fx=rDGR.GetF(); break;
+ case 21: aP1.fy=rDGR.GetF(); break;
+ case 31: aP1.fz=rDGR.GetF(); break;
+ default: DXFBasicEntity::EvaluateGroup(rDGR);
+ }
+}
+
+//--------------------------DXFPointEntity--------------------------------------
+
+DXFPointEntity::DXFPointEntity() : DXFBasicEntity(DXF_POINT)
+{
+}
+
+void DXFPointEntity::EvaluateGroup(DXFGroupReader & rDGR)
+{
+ switch (rDGR.GetG()) {
+ case 10: aP0.fx=rDGR.GetF(); break;
+ case 20: aP0.fy=rDGR.GetF(); break;
+ case 30: aP0.fz=rDGR.GetF(); break;
+ default: DXFBasicEntity::EvaluateGroup(rDGR);
+ }
+}
+
+//--------------------------DXFCircleEntity-------------------------------------
+
+DXFCircleEntity::DXFCircleEntity() : DXFBasicEntity(DXF_CIRCLE)
+{
+ fRadius=1.0;
+}
+
+void DXFCircleEntity::EvaluateGroup(DXFGroupReader & rDGR)
+{
+ switch (rDGR.GetG()) {
+ case 10: aP0.fx=rDGR.GetF(); break;
+ case 20: aP0.fy=rDGR.GetF(); break;
+ case 30: aP0.fz=rDGR.GetF(); break;
+ case 40: fRadius=rDGR.GetF(); break;
+ default: DXFBasicEntity::EvaluateGroup(rDGR);
+ }
+}
+
+//--------------------------DXFArcEntity----------------------------------------
+
+DXFArcEntity::DXFArcEntity() : DXFBasicEntity(DXF_ARC)
+{
+ fRadius=1.0;
+ fStart=0;
+ fEnd=360.0;
+}
+
+void DXFArcEntity::EvaluateGroup(DXFGroupReader & rDGR)
+{
+ switch (rDGR.GetG()) {
+ case 10: aP0.fx=rDGR.GetF(); break;
+ case 20: aP0.fy=rDGR.GetF(); break;
+ case 30: aP0.fz=rDGR.GetF(); break;
+ case 40: fRadius=rDGR.GetF(); break;
+ case 50: fStart=rDGR.GetF(); break;
+ case 51: fEnd=rDGR.GetF(); break;
+ default: DXFBasicEntity::EvaluateGroup(rDGR);
+ }
+}
+
+//--------------------------DXFTraceEntity--------------------------------------
+
+DXFTraceEntity::DXFTraceEntity() : DXFBasicEntity(DXF_TRACE)
+{
+}
+
+void DXFTraceEntity::EvaluateGroup(DXFGroupReader & rDGR)
+{
+ switch (rDGR.GetG()) {
+ case 10: aP0.fx=rDGR.GetF(); break;
+ case 20: aP0.fy=rDGR.GetF(); break;
+ case 30: aP0.fz=rDGR.GetF(); break;
+ case 11: aP1.fx=rDGR.GetF(); break;
+ case 21: aP1.fy=rDGR.GetF(); break;
+ case 31: aP1.fz=rDGR.GetF(); break;
+ case 12: aP2.fx=rDGR.GetF(); break;
+ case 22: aP2.fy=rDGR.GetF(); break;
+ case 32: aP2.fz=rDGR.GetF(); break;
+ case 13: aP3.fx=rDGR.GetF(); break;
+ case 23: aP3.fy=rDGR.GetF(); break;
+ case 33: aP3.fz=rDGR.GetF(); break;
+ default: DXFBasicEntity::EvaluateGroup(rDGR);
+ }
+}
+
+//--------------------------DXFSolidEntity--------------------------------------
+
+DXFSolidEntity::DXFSolidEntity() : DXFBasicEntity(DXF_SOLID)
+{
+}
+
+void DXFSolidEntity::EvaluateGroup(DXFGroupReader & rDGR)
+{
+ switch (rDGR.GetG()) {
+ case 10: aP0.fx=rDGR.GetF(); break;
+ case 20: aP0.fy=rDGR.GetF(); break;
+ case 30: aP0.fz=rDGR.GetF(); break;
+ case 11: aP1.fx=rDGR.GetF(); break;
+ case 21: aP1.fy=rDGR.GetF(); break;
+ case 31: aP1.fz=rDGR.GetF(); break;
+ case 12: aP2.fx=rDGR.GetF(); break;
+ case 22: aP2.fy=rDGR.GetF(); break;
+ case 32: aP2.fz=rDGR.GetF(); break;
+ case 13: aP3.fx=rDGR.GetF(); break;
+ case 23: aP3.fy=rDGR.GetF(); break;
+ case 33: aP3.fz=rDGR.GetF(); break;
+ default: DXFBasicEntity::EvaluateGroup(rDGR);
+ }
+}
+
+//--------------------------DXFTextEntity---------------------------------------
+
+DXFTextEntity::DXFTextEntity() : DXFBasicEntity(DXF_TEXT)
+{
+ fHeight=1.0;
+ sText[0]=0;
+ fRotAngle=0.0;
+ fXScale=1.0;
+ fOblAngle=0.0;
+ strncpy( sStyle, "STANDARD", 9 );
+ nGenFlags=0;
+ nHorzJust=0;
+ nVertJust=0;
+}
+
+void DXFTextEntity::EvaluateGroup(DXFGroupReader & rDGR)
+{
+ switch (rDGR.GetG()) {
+ case 10: aP0.fx=rDGR.GetF(); break;
+ case 20: aP0.fy=rDGR.GetF(); break;
+ case 30: aP0.fz=rDGR.GetF(); break;
+ case 40: fHeight=rDGR.GetF(); break;
+ case 1: strncpy( sText, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
+ case 50: fRotAngle=rDGR.GetF(); break;
+ case 41: fXScale=rDGR.GetF(); break;
+ case 42: fOblAngle=rDGR.GetF(); break;
+ case 7: strncpy( sStyle, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
+ case 71: nGenFlags=rDGR.GetI(); break;
+ case 72: nHorzJust=rDGR.GetI(); break;
+ case 73: nVertJust=rDGR.GetI(); break;
+ case 11: aAlign.fx=rDGR.GetF(); break;
+ case 21: aAlign.fy=rDGR.GetF(); break;
+ case 31: aAlign.fz=rDGR.GetF(); break;
+ default: DXFBasicEntity::EvaluateGroup(rDGR);
+ }
+}
+
+//--------------------------DXFShapeEntity--------------------------------------
+
+DXFShapeEntity::DXFShapeEntity() : DXFBasicEntity(DXF_SHAPE)
+{
+ fSize=1.0;
+ sName[0]=0;
+ fRotAngle=0;
+ fXScale=1.0;
+ fOblAngle=0;
+}
+
+void DXFShapeEntity::EvaluateGroup(DXFGroupReader & rDGR)
+{
+ switch (rDGR.GetG()) {
+ case 10: aP0.fx=rDGR.GetF(); break;
+ case 20: aP0.fy=rDGR.GetF(); break;
+ case 30: aP0.fz=rDGR.GetF(); break;
+ case 40: fSize=rDGR.GetF(); break;
+ case 2: strncpy( sName, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
+ case 50: fRotAngle=rDGR.GetF(); break;
+ case 41: fXScale=rDGR.GetF(); break;
+ case 51: fOblAngle=rDGR.GetF(); break;
+ default: DXFBasicEntity::EvaluateGroup(rDGR);
+ }
+}
+
+//--------------------------DXFInsertEntity-------------------------------------
+
+DXFInsertEntity::DXFInsertEntity() : DXFBasicEntity(DXF_INSERT)
+{
+ nAttrFlag=0;
+ sName[0]=0;
+ fXScale=1.0;
+ fYScale=1.0;
+ fZScale=1.0;
+ fRotAngle=0.0;
+ nColCount=1;
+ nRowCount=1;
+ fColSpace=0.0;
+ fRowSpace=0.0;
+}
+
+void DXFInsertEntity::EvaluateGroup(DXFGroupReader & rDGR)
+{
+ switch (rDGR.GetG()) {
+ case 66: nAttrFlag=rDGR.GetI(); break;
+ case 2: strncpy( sName, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
+ case 10: aP0.fx=rDGR.GetF(); break;
+ case 20: aP0.fy=rDGR.GetF(); break;
+ case 30: aP0.fz=rDGR.GetF(); break;
+ case 41: fXScale=rDGR.GetF(); break;
+ case 42: fYScale=rDGR.GetF(); break;
+ case 43: fZScale=rDGR.GetF(); break;
+ case 50: fRotAngle=rDGR.GetF(); break;
+ case 70: nColCount=rDGR.GetI(); break;
+ case 71: nRowCount=rDGR.GetI(); break;
+ case 44: fColSpace=rDGR.GetF(); break;
+ case 45: fRowSpace=rDGR.GetF(); break;
+ default: DXFBasicEntity::EvaluateGroup(rDGR);
+ }
+}
+
+//--------------------------DXFAttDefEntity-------------------------------------
+
+DXFAttDefEntity::DXFAttDefEntity() : DXFBasicEntity(DXF_ATTDEF)
+{
+ fHeight=1.0;
+ sDefVal[0]=0;
+ sPrompt[0]=0;
+ sTagStr[0]=0;
+ nAttrFlags=0;
+ nFieldLen=0;
+ fRotAngle=0.0;
+ fXScale=1.0;
+ fOblAngle=0.0;
+ strncpy( sStyle, "STANDARD", 9 );
+ nGenFlags=0;
+ nHorzJust=0;
+ nVertJust=0;
+}
+
+void DXFAttDefEntity::EvaluateGroup(DXFGroupReader & rDGR)
+{
+ switch (rDGR.GetG()) {
+ case 10: aP0.fx=rDGR.GetF(); break;
+ case 20: aP0.fy=rDGR.GetF(); break;
+ case 30: aP0.fz=rDGR.GetF(); break;
+ case 40: fHeight=rDGR.GetF(); break;
+ case 1: strncpy( sDefVal, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
+ case 3: strncpy( sPrompt, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
+ case 2: strncpy( sTagStr, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
+ case 70: nAttrFlags=rDGR.GetI(); break;
+ case 73: nFieldLen=rDGR.GetI(); break;
+ case 50: fRotAngle=rDGR.GetF(); break;
+ case 41: fXScale=rDGR.GetF(); break;
+ case 51: fOblAngle=rDGR.GetF(); break;
+ case 7: strncpy( sStyle, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
+ case 71: nGenFlags=rDGR.GetI(); break;
+ case 72: nHorzJust=rDGR.GetI(); break;
+ case 74: nVertJust=rDGR.GetI(); break;
+ case 11: aAlign.fx=rDGR.GetF(); break;
+ case 21: aAlign.fy=rDGR.GetF(); break;
+ case 31: aAlign.fz=rDGR.GetF(); break;
+ default: DXFBasicEntity::EvaluateGroup(rDGR);
+ }
+}
+
+//--------------------------DXFAttribEntity-------------------------------------
+
+DXFAttribEntity::DXFAttribEntity() : DXFBasicEntity(DXF_ATTRIB)
+{
+ fHeight=1.0;
+ sText[0]=0;
+ sTagStr[0]=0;
+ nAttrFlags=0;
+ nFieldLen=0;
+ fRotAngle=0.0;
+ fXScale=1.0;
+ fOblAngle=0.0;
+ strncpy( sStyle, "STANDARD", 9 );
+ nGenFlags=0;
+ nHorzJust=0;
+ nVertJust=0;
+}
+
+void DXFAttribEntity::EvaluateGroup(DXFGroupReader & rDGR)
+{
+ switch (rDGR.GetG()) {
+ case 10: aP0.fx=rDGR.GetF(); break;
+ case 20: aP0.fy=rDGR.GetF(); break;
+ case 30: aP0.fz=rDGR.GetF(); break;
+ case 40: fHeight=rDGR.GetF(); break;
+ case 1: strncpy( sText, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
+ case 2: strncpy( sTagStr, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
+ case 70: nAttrFlags=rDGR.GetI(); break;
+ case 73: nFieldLen=rDGR.GetI(); break;
+ case 50: fRotAngle=rDGR.GetF(); break;
+ case 41: fXScale=rDGR.GetF(); break;
+ case 51: fOblAngle=rDGR.GetF(); break;
+ case 7: strncpy( sStyle, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
+ case 71: nGenFlags=rDGR.GetI(); break;
+ case 72: nHorzJust=rDGR.GetI(); break;
+ case 74: nVertJust=rDGR.GetI(); break;
+ case 11: aAlign.fx=rDGR.GetF(); break;
+ case 21: aAlign.fy=rDGR.GetF(); break;
+ case 31: aAlign.fz=rDGR.GetF(); break;
+ default: DXFBasicEntity::EvaluateGroup(rDGR);
+ }
+}
+
+//--------------------------DXFPolyLine-----------------------------------------
+
+DXFPolyLineEntity::DXFPolyLineEntity() : DXFBasicEntity(DXF_POLYLINE)
+{
+ fElevation=0.0;
+ nFlags=0;
+ fSWidth=0.0;
+ fEWidth=0.0;
+ nMeshMCount=0;
+ nMeshNCount=0;
+ nMDensity=0;
+ nNDensity=0;
+ nCSSType=0;
+}
+
+void DXFPolyLineEntity::EvaluateGroup(DXFGroupReader & rDGR)
+{
+ switch (rDGR.GetG()) {
+ case 30: fElevation=rDGR.GetF(); break;
+ case 70: nFlags=rDGR.GetI(); break;
+ case 40: fSWidth=rDGR.GetF(); break;
+ case 41: fEWidth=rDGR.GetF(); break;
+ case 71: nMeshMCount=rDGR.GetI(); break;
+ case 72: nMeshNCount=rDGR.GetI(); break;
+ case 73: nMDensity=rDGR.GetI(); break;
+ case 74: nNDensity=rDGR.GetI(); break;
+ case 75: nCSSType=rDGR.GetI(); break;
+ default: DXFBasicEntity::EvaluateGroup(rDGR);
+ }
+}
+
+//--------------------------DXFLWPolyLine---------------------------------------
+
+DXFLWPolyLineEntity::DXFLWPolyLineEntity() :
+ DXFBasicEntity( DXF_LWPOLYLINE ),
+ nIndex( 0 ),
+ nCount( 0 ),
+ nFlags( 0 ),
+ fConstantWidth( 0.0 ),
+ fStartWidth( 0.0 ),
+ fEndWidth( 0.0 ),
+ pP( NULL )
+{
+}
+
+void DXFLWPolyLineEntity::EvaluateGroup( DXFGroupReader & rDGR )
+{
+ switch ( rDGR.GetG() )
+ {
+ case 90 :
+ {
+ nCount = rDGR.GetI();
+ if ( nCount )
+ pP = new DXFVector[ nCount ];
+ }
+ break;
+ case 70: nFlags = rDGR.GetI(); break;
+ case 43: fConstantWidth = rDGR.GetF(); break;
+ case 40: fStartWidth = rDGR.GetF(); break;
+ case 41: fEndWidth = rDGR.GetF(); break;
+ case 10:
+ {
+ if ( pP && ( nIndex < nCount ) )
+ pP[ nIndex ].fx = rDGR.GetF();
+ }
+ break;
+ case 20:
+ {
+ if ( pP && ( nIndex < nCount ) )
+ pP[ nIndex++ ].fy = rDGR.GetF();
+ }
+ break;
+ default: DXFBasicEntity::EvaluateGroup(rDGR);
+ }
+}
+
+DXFLWPolyLineEntity::~DXFLWPolyLineEntity()
+{
+ delete[] pP;
+}
+
+//--------------------------DXFHatchEntity-------------------------------------
+
+DXFEdgeTypeLine::DXFEdgeTypeLine() :
+ DXFEdgeType( 1 )
+{
+
+}
+DXFEdgeTypeLine::~DXFEdgeTypeLine()
+{
+
+}
+sal_Bool DXFEdgeTypeLine::EvaluateGroup( DXFGroupReader & rDGR )
+{
+ sal_Bool bExecutingGroupCode = sal_True;
+ switch ( rDGR.GetG() )
+ {
+ case 10 : aStartPoint.fx = rDGR.GetF(); break;
+ case 20 : aStartPoint.fy = rDGR.GetF(); break;
+ case 11 : aEndPoint.fx = rDGR.GetF(); break;
+ case 21 : aEndPoint.fy = rDGR.GetF(); break;
+ default : bExecutingGroupCode = sal_False; break;
+ }
+ return bExecutingGroupCode;
+}
+
+DXFEdgeTypeCircularArc::DXFEdgeTypeCircularArc() :
+ DXFEdgeType( 2 ),
+ fRadius( 0.0 ),
+ fStartAngle( 0.0 ),
+ fEndAngle( 0.0 ),
+ nIsCounterClockwiseFlag( 0 )
+{
+}
+DXFEdgeTypeCircularArc::~DXFEdgeTypeCircularArc()
+{
+}
+sal_Bool DXFEdgeTypeCircularArc::EvaluateGroup( DXFGroupReader & rDGR )
+{
+ sal_Bool bExecutingGroupCode = sal_True;
+ switch ( rDGR.GetG() )
+ {
+ case 10 : aCenter.fx = rDGR.GetF(); break;
+ case 20 : aCenter.fy = rDGR.GetF(); break;
+ case 40 : fRadius = rDGR.GetF(); break;
+ case 50 : fStartAngle = rDGR.GetF(); break;
+ case 51 : fEndAngle = rDGR.GetF(); break;
+ case 73 : nIsCounterClockwiseFlag = rDGR.GetI(); break;
+ default : bExecutingGroupCode = sal_False; break;
+ }
+ return bExecutingGroupCode;
+}
+
+DXFEdgeTypeEllipticalArc::DXFEdgeTypeEllipticalArc() :
+ DXFEdgeType( 3 ),
+ fLength( 0.0 ),
+ fStartAngle( 0.0 ),
+ fEndAngle( 0.0 ),
+ nIsCounterClockwiseFlag( 0 )
+{
+}
+DXFEdgeTypeEllipticalArc::~DXFEdgeTypeEllipticalArc()
+{
+
+}
+sal_Bool DXFEdgeTypeEllipticalArc::EvaluateGroup( DXFGroupReader & rDGR )
+{
+ sal_Bool bExecutingGroupCode = sal_True;
+ switch( rDGR.GetG() )
+ {
+ case 10 : aCenter.fx = rDGR.GetF(); break;
+ case 20 : aCenter.fy = rDGR.GetF(); break;
+ case 11 : aEndPoint.fx = rDGR.GetF(); break;
+ case 21 : aEndPoint.fy = rDGR.GetF(); break;
+ case 40 : fLength = rDGR.GetF(); break;
+ case 50 : fStartAngle = rDGR.GetF(); break;
+ case 51 : fEndAngle = rDGR.GetF(); break;
+ case 73 : nIsCounterClockwiseFlag = rDGR.GetI(); break;
+ default : bExecutingGroupCode = sal_False; break;
+ }
+ return bExecutingGroupCode;
+}
+
+DXFEdgeTypeSpline::DXFEdgeTypeSpline() :
+ DXFEdgeType( 4 ),
+ nDegree( 0 ),
+ nRational( 0 ),
+ nPeriodic( 0 ),
+ nKnotCount( 0 ),
+ nControlCount( 0 )
+{
+}
+DXFEdgeTypeSpline::~DXFEdgeTypeSpline()
+{
+
+}
+sal_Bool DXFEdgeTypeSpline::EvaluateGroup( DXFGroupReader & rDGR )
+{
+ sal_Bool bExecutingGroupCode = sal_True;
+ switch ( rDGR.GetG() )
+ {
+ case 94 : nDegree = rDGR.GetI(); break;
+ case 73 : nRational = rDGR.GetI(); break;
+ case 74 : nPeriodic = rDGR.GetI(); break;
+ case 95 : nKnotCount = rDGR.GetI(); break;
+ case 96 : nControlCount = rDGR.GetI(); break;
+ default : bExecutingGroupCode = sal_False; break;
+ }
+ return bExecutingGroupCode;
+}
+
+DXFBoundaryPathData::DXFBoundaryPathData() :
+ nFlags( 0 ),
+ nHasBulgeFlag( 0 ),
+ nIsClosedFlag( 0 ),
+ nPointCount( 0 ),
+ fBulge( 0.0 ),
+ nSourceBoundaryObjects( 0 ),
+ nEdgeCount( 0 ),
+ bIsPolyLine( sal_True ),
+ nPointIndex( 0 ),
+ pP( NULL )
+{
+}
+
+DXFBoundaryPathData::~DXFBoundaryPathData()
+{
+ sal_uInt32 i = 0;
+ for ( i = 0; i < aEdges.size(); i++ )
+ delete aEdges[ i ];
+ delete[] pP;
+}
+
+sal_Bool DXFBoundaryPathData::EvaluateGroup( DXFGroupReader & rDGR )
+{
+ sal_Bool bExecutingGroupCode = sal_True;
+ if ( bIsPolyLine )
+ {
+ switch( rDGR.GetG() )
+ {
+ case 92 :
+ {
+ nFlags = rDGR.GetI();
+ if ( ( nFlags & 2 ) == 0 )
+ bIsPolyLine = sal_False;
+ }
+ break;
+ case 93 :
+ {
+ nPointCount = rDGR.GetI();
+ if ( nPointCount )
+ pP = new DXFVector[ nPointCount ];
+ }
+ break;
+ case 72 : nHasBulgeFlag = rDGR.GetI(); break;
+ case 73 : nIsClosedFlag = rDGR.GetI(); break;
+ case 97 : nSourceBoundaryObjects = rDGR.GetI(); break;
+ case 42 : fBulge = rDGR.GetF(); break;
+ case 10:
+ {
+ if ( pP && ( nPointIndex < nPointCount ) )
+ pP[ nPointIndex ].fx = rDGR.GetF();
+ }
+ break;
+ case 20:
+ {
+ if ( pP && ( nPointIndex < nPointCount ) )
+ pP[ nPointIndex++ ].fy = rDGR.GetF();
+ }
+ break;
+
+ default : bExecutingGroupCode = sal_False; break;
+ }
+ }
+ else
+ {
+ if ( rDGR.GetG() == 93 )
+ nEdgeCount = rDGR.GetI();
+ else if ( rDGR.GetG() == 72 )
+ {
+ sal_Int32 nEdgeType = rDGR.GetI();
+ switch( nEdgeType )
+ {
+ case 1 : aEdges.push_back( new DXFEdgeTypeLine() ); break;
+ case 2 : aEdges.push_back( new DXFEdgeTypeCircularArc() ); break;
+ case 3 : aEdges.push_back( new DXFEdgeTypeEllipticalArc() ); break;
+ case 4 : aEdges.push_back( new DXFEdgeTypeSpline() ); break;
+ }
+ }
+ else if ( aEdges.size() )
+ aEdges[ aEdges.size() - 1 ]->EvaluateGroup( rDGR );
+ else
+ bExecutingGroupCode = sal_False;
+ }
+ return bExecutingGroupCode;
+}
+
+DXFHatchEntity::DXFHatchEntity() :
+ DXFBasicEntity( DXF_HATCH ),
+ bIsInBoundaryPathContext( sal_False ),
+ nCurrentBoundaryPathIndex( -1 ),
+ nFlags( 0 ),
+ nAssociativityFlag( 0 ),
+ nBoundaryPathCount( 0 ),
+ nHatchStyle( 0 ),
+ nHatchPatternType( 0 ),
+ fHatchPatternAngle( 0.0 ),
+ fHatchPatternScale( 1.0 ),
+ nHatchDoubleFlag( 0 ),
+ nHatchPatternDefinitionLines( 0 ),
+ fPixelSize( 1.0 ),
+ nNumberOfSeedPoints( 0 ),
+ pBoundaryPathData( NULL )
+{
+}
+
+void DXFHatchEntity::EvaluateGroup( DXFGroupReader & rDGR )
+{
+ switch ( rDGR.GetG() )
+ {
+// case 10 : aElevationPoint.fx = rDGR.GetF(); break;
+// case 20 : aElevationPoint.fy = rDGR.GetF(); break;
+// case 30 : aElevationPoint.fz = rDGR.GetF(); break;
+ case 70 : nFlags = rDGR.GetI(); break;
+ case 71 : nAssociativityFlag = rDGR.GetI(); break;
+ case 91 :
+ {
+ bIsInBoundaryPathContext = sal_True;
+ nBoundaryPathCount = rDGR.GetI();
+ if ( nBoundaryPathCount )
+ pBoundaryPathData = new DXFBoundaryPathData[ nBoundaryPathCount ];
+ }
+ break;
+ case 75 :
+ {
+ nHatchStyle = rDGR.GetI();
+ bIsInBoundaryPathContext = sal_False;
+ }
+ break;
+ case 76 : nHatchPatternType = rDGR.GetI(); break;
+ case 52 : fHatchPatternAngle = rDGR.GetF(); break;
+ case 41 : fHatchPatternScale = rDGR.GetF(); break;
+ case 77 : nHatchDoubleFlag = rDGR.GetI(); break;
+ case 78 : nHatchPatternDefinitionLines = rDGR.GetI(); break;
+ case 47 : fPixelSize = rDGR.GetF(); break;
+ case 98 : nNumberOfSeedPoints = rDGR.GetI(); break;
+
+ //!! passthrough !!
+ case 92 : nCurrentBoundaryPathIndex++;
+ default:
+ {
+ sal_Bool bExecutingGroupCode = sal_False;
+ if ( bIsInBoundaryPathContext )
+ {
+ if ( ( nCurrentBoundaryPathIndex >= 0 ) &&
+ ( nCurrentBoundaryPathIndex < nBoundaryPathCount ) )
+ bExecutingGroupCode = pBoundaryPathData[ nCurrentBoundaryPathIndex ].EvaluateGroup( rDGR );
+ }
+ if ( bExecutingGroupCode == sal_False )
+ DXFBasicEntity::EvaluateGroup(rDGR);
+ }
+ break;
+ }
+}
+
+DXFHatchEntity::~DXFHatchEntity()
+{
+ delete[] pBoundaryPathData;
+}
+
+//--------------------------DXFVertexEntity-------------------------------------
+
+DXFVertexEntity::DXFVertexEntity() : DXFBasicEntity(DXF_VERTEX)
+{
+ fSWidth=-1.0;
+ fEWidth=-1.0;
+ fBulge=0.0;
+ nFlags=0;
+ fCFTDir=0.0;
+
+}
+
+void DXFVertexEntity::EvaluateGroup(DXFGroupReader & rDGR)
+{
+ switch (rDGR.GetG()) {
+ case 10: aP0.fx=rDGR.GetF(); break;
+ case 20: aP0.fy=rDGR.GetF(); break;
+ case 30: aP0.fz=rDGR.GetF(); break;
+ case 40: fSWidth=rDGR.GetF(); break;
+ case 41: fEWidth=rDGR.GetF(); break;
+ case 42: fBulge=rDGR.GetF(); break;
+ case 70: nFlags=rDGR.GetI(); break;
+ case 50: fCFTDir=rDGR.GetF(); break;
+ default: DXFBasicEntity::EvaluateGroup(rDGR);
+ }
+}
+
+//--------------------------DXFSeqEndEntity-------------------------------------
+
+DXFSeqEndEntity::DXFSeqEndEntity() : DXFBasicEntity(DXF_SEQEND)
+{
+}
+
+//--------------------------DXF3DFace-------------------------------------------
+
+DXF3DFaceEntity::DXF3DFaceEntity() : DXFBasicEntity(DXF_3DFACE)
+{
+ nIEFlags=0;
+}
+
+void DXF3DFaceEntity::EvaluateGroup(DXFGroupReader & rDGR)
+{
+ switch (rDGR.GetG()) {
+ case 10: aP0.fx=rDGR.GetF(); break;
+ case 20: aP0.fy=rDGR.GetF(); break;
+ case 30: aP0.fz=rDGR.GetF(); break;
+ case 11: aP1.fx=rDGR.GetF(); break;
+ case 21: aP1.fy=rDGR.GetF(); break;
+ case 31: aP1.fz=rDGR.GetF(); break;
+ case 12: aP2.fx=rDGR.GetF(); break;
+ case 22: aP2.fy=rDGR.GetF(); break;
+ case 32: aP2.fz=rDGR.GetF(); break;
+ case 13: aP3.fx=rDGR.GetF(); break;
+ case 23: aP3.fy=rDGR.GetF(); break;
+ case 33: aP3.fz=rDGR.GetF(); break;
+ case 70: nIEFlags=rDGR.GetI(); break;
+ default: DXFBasicEntity::EvaluateGroup(rDGR);
+ }
+}
+
+
+//--------------------------DXFDimensionEntity----------------------------------
+
+DXFDimensionEntity::DXFDimensionEntity() : DXFBasicEntity(DXF_DIMENSION)
+{
+ sPseudoBlock[0]=0;
+}
+
+void DXFDimensionEntity::EvaluateGroup(DXFGroupReader & rDGR)
+{
+ switch (rDGR.GetG()) {
+ case 2: strncpy( sPseudoBlock, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
+ default: DXFBasicEntity::EvaluateGroup(rDGR);
+ }
+}
+
+//---------------------------- DXFEntites --------------------------------------
+
+void DXFEntities::Read(DXFGroupReader & rDGR)
+{
+ DXFBasicEntity * pE, * * ppSucc;
+
+ ppSucc=&pFirst;
+ while (*ppSucc!=NULL) ppSucc=&((*ppSucc)->pSucc);
+
+ while (rDGR.GetG()!=0) rDGR.Read();
+
+ while (strcmp(rDGR.GetS(),"ENDBLK")!=0 &&
+ strcmp(rDGR.GetS(),"ENDSEC")!=0 &&
+ strcmp(rDGR.GetS(),"EOF")!=0 )
+ {
+
+ if (strcmp(rDGR.GetS(),"LINE" )==0) pE=new DXFLineEntity;
+ else if (strcmp(rDGR.GetS(),"POINT" )==0) pE=new DXFPointEntity;
+ else if (strcmp(rDGR.GetS(),"CIRCLE" )==0) pE=new DXFCircleEntity;
+ else if (strcmp(rDGR.GetS(),"ARC" )==0) pE=new DXFArcEntity;
+ else if (strcmp(rDGR.GetS(),"TRACE" )==0) pE=new DXFTraceEntity;
+ else if (strcmp(rDGR.GetS(),"SOLID" )==0) pE=new DXFSolidEntity;
+ else if (strcmp(rDGR.GetS(),"TEXT" )==0) pE=new DXFTextEntity;
+ else if (strcmp(rDGR.GetS(),"SHAPE" )==0) pE=new DXFShapeEntity;
+ else if (strcmp(rDGR.GetS(),"INSERT" )==0) pE=new DXFInsertEntity;
+ else if (strcmp(rDGR.GetS(),"ATTDEF" )==0) pE=new DXFAttDefEntity;
+ else if (strcmp(rDGR.GetS(),"ATTRIB" )==0) pE=new DXFAttribEntity;
+ else if (strcmp(rDGR.GetS(),"POLYLINE" )==0) pE=new DXFPolyLineEntity;
+ else if (strcmp(rDGR.GetS(),"LWPOLYLINE")==0) pE=new DXFLWPolyLineEntity;
+ else if (strcmp(rDGR.GetS(),"VERTEX" )==0) pE=new DXFVertexEntity;
+ else if (strcmp(rDGR.GetS(),"SEQEND" )==0) pE=new DXFSeqEndEntity;
+ else if (strcmp(rDGR.GetS(),"3DFACE" )==0) pE=new DXF3DFaceEntity;
+ else if (strcmp(rDGR.GetS(),"DIMENSION" )==0) pE=new DXFDimensionEntity;
+ else if (strcmp(rDGR.GetS(),"HATCH" )==0) pE=new DXFHatchEntity;
+ else
+ {
+ do {
+ rDGR.Read();
+ } while (rDGR.GetG()!=0);
+ continue;
+ }
+ *ppSucc=pE;
+ ppSucc=&(pE->pSucc);
+ pE->Read(rDGR);
+ }
+}
+
+void DXFEntities::Clear()
+{
+ DXFBasicEntity * ptmp;
+
+ while (pFirst!=NULL) {
+ ptmp=pFirst;
+ pFirst=ptmp->pSucc;
+ delete ptmp;
+ }
+}
+
diff --git a/filter/source/graphicfilter/idxf/dxfentrd.hxx b/filter/source/graphicfilter/idxf/dxfentrd.hxx
new file mode 100644
index 000000000000..3ddcc8f3d7ea
--- /dev/null
+++ b/filter/source/graphicfilter/idxf/dxfentrd.hxx
@@ -0,0 +1,602 @@
+/*************************************************************************
+ *
+ * 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 _DXFENTRD_HXX
+#define _DXFENTRD_HXX
+
+#include <dxfgrprd.hxx>
+#include <dxfvec.hxx>
+
+#include <deque>
+
+typedef std::deque< Point > DXFPointArray;
+
+//------------------------------------------------------------------------------
+//------------------------- Art eines Entity -----------------------------------
+//------------------------------------------------------------------------------
+
+enum DXFEntityType {
+ DXF_LINE,
+ DXF_POINT,
+ DXF_CIRCLE,
+ DXF_ARC,
+ DXF_TRACE,
+ DXF_SOLID,
+ DXF_TEXT,
+ DXF_SHAPE,
+ DXF_INSERT,
+ DXF_ATTDEF,
+ DXF_ATTRIB,
+ DXF_POLYLINE,
+ DXF_VERTEX,
+ DXF_SEQEND,
+ DXF_3DFACE,
+ DXF_DIMENSION,
+ DXF_LWPOLYLINE,
+ DXF_HATCH
+};
+
+//------------------------------------------------------------------------------
+//---------------------- Basisklasse fuer ein Entity ---------------------------
+//------------------------------------------------------------------------------
+
+class DXFBasicEntity {
+
+public:
+
+ DXFBasicEntity * pSucc;
+ // Zeiger auf naechstes Entity (in der Liste DXFEntities.pFirst)
+
+ DXFEntityType eType;
+ // Art des Entitys (Linie oder Kreis oder was)
+
+ // Eigenschaftenm, die alle Entities besitzen, jeweils
+ // durch den Gruppencode kommentiert:
+ char sLayer[DXF_MAX_STRING_LEN+1]; // 8
+ char sLineType[DXF_MAX_STRING_LEN+1]; // 6
+ double fElevation; // 38
+ double fThickness; // 39
+ long nColor; // 62
+ long nSpace; // 67
+ DXFVector aExtrusion; // 210,220,230
+
+protected:
+
+ DXFBasicEntity(DXFEntityType eThisType);
+ // Konstruktoren der Entities initialiseren immer mit Defaultwerten.
+
+public:
+
+ virtual ~DXFBasicEntity();
+ virtual void Read(DXFGroupReader & rDGR);
+ // Liest die Prameter ein, bis zur naechten 0-Gruppe
+
+protected:
+
+ virtual void EvaluateGroup(DXFGroupReader & rDGR);
+ // Diese Methode wird durch Read() fuer jeden Parameter (bzw. fuer jede
+ // Gruppe) aufgerufen.
+ // Sofern der Gruppencode dem Entity bekannt ist, wird der entsprechende
+ // Parameter geholt.
+
+};
+
+//------------------------------------------------------------------------------
+//---------------- die verschiedenen Arten von Entyties ------------------------
+//------------------------------------------------------------------------------
+
+//--------------------------Line------------------------------------------------
+
+class DXFLineEntity : public DXFBasicEntity {
+
+public:
+
+ DXFVector aP0; // 10,20,30
+ DXFVector aP1; // 11,21,31
+
+ DXFLineEntity();
+
+protected:
+
+ virtual void EvaluateGroup(DXFGroupReader & rDGR);
+};
+
+//--------------------------Point-----------------------------------------------
+
+class DXFPointEntity : public DXFBasicEntity {
+
+public:
+
+ DXFVector aP0; // 10,20,30
+
+ DXFPointEntity();
+
+protected:
+
+ virtual void EvaluateGroup(DXFGroupReader & rDGR);
+};
+
+//--------------------------Circle----------------------------------------------
+
+class DXFCircleEntity : public DXFBasicEntity {
+
+public:
+
+ DXFVector aP0; // 10,20,30
+ double fRadius; // 40
+
+ DXFCircleEntity();
+
+protected:
+
+ virtual void EvaluateGroup(DXFGroupReader & rDGR);
+};
+
+//--------------------------Arc-------------------------------------------------
+
+class DXFArcEntity : public DXFBasicEntity {
+
+public:
+
+ DXFVector aP0; // 10,20,30
+ double fRadius; // 40
+ double fStart; // 50
+ double fEnd; // 51
+
+ DXFArcEntity();
+
+protected:
+
+ virtual void EvaluateGroup(DXFGroupReader & rDGR);
+};
+
+//--------------------------Trace-----------------------------------------------
+
+class DXFTraceEntity : public DXFBasicEntity {
+
+public:
+
+ DXFVector aP0; // 10,20,30
+ DXFVector aP1; // 11,21,31
+ DXFVector aP2; // 12,22,32
+ DXFVector aP3; // 13,23,33
+
+ DXFTraceEntity();
+
+protected:
+
+ virtual void EvaluateGroup(DXFGroupReader & rDGR);
+};
+
+//--------------------------Solid-----------------------------------------------
+
+class DXFSolidEntity : public DXFBasicEntity {
+
+public:
+
+ DXFVector aP0; // 10,20,30
+ DXFVector aP1; // 11,21,31
+ DXFVector aP2; // 12,22,32
+ DXFVector aP3; // 13,23,33
+
+ DXFSolidEntity();
+
+protected:
+
+ virtual void EvaluateGroup(DXFGroupReader & rDGR);
+};
+
+//--------------------------Text------------------------------------------------
+
+class DXFTextEntity : public DXFBasicEntity {
+
+public:
+
+ DXFVector aP0; // 10,20,30
+ double fHeight; // 40
+ char sText[DXF_MAX_STRING_LEN+1]; // 1
+ double fRotAngle; // 50
+ double fXScale; // 41
+ double fOblAngle; // 42
+ char sStyle[DXF_MAX_STRING_LEN+1]; // 7
+ long nGenFlags; // 71
+ long nHorzJust; // 72
+ long nVertJust; // 73
+ DXFVector aAlign; // 11,21,31
+
+ DXFTextEntity();
+
+protected:
+
+ virtual void EvaluateGroup(DXFGroupReader & rDGR);
+};
+
+//--------------------------Shape-----------------------------------------------
+
+class DXFShapeEntity : public DXFBasicEntity {
+
+public:
+
+ DXFVector aP0; // 10,20,30
+ double fSize; // 40
+ char sName[DXF_MAX_STRING_LEN+1]; // 2
+ double fRotAngle; // 50
+ double fXScale; // 41
+ double fOblAngle; // 51
+
+ DXFShapeEntity();
+
+protected:
+
+ virtual void EvaluateGroup(DXFGroupReader & rDGR);
+};
+
+//--------------------------Insert----------------------------------------------
+
+class DXFInsertEntity : public DXFBasicEntity {
+
+public:
+
+ long nAttrFlag; // 66
+ char sName[DXF_MAX_STRING_LEN+1]; // 2
+ DXFVector aP0; // 10,20,30
+ double fXScale; // 41
+ double fYScale; // 42
+ double fZScale; // 43
+ double fRotAngle; // 50
+ long nColCount; // 70
+ long nRowCount; // 71
+ double fColSpace; // 44
+ double fRowSpace; // 45
+
+ DXFInsertEntity();
+
+protected:
+
+ virtual void EvaluateGroup(DXFGroupReader & rDGR);
+};
+
+//--------------------------AttDef----------------------------------------------
+
+class DXFAttDefEntity : public DXFBasicEntity {
+
+public:
+
+ DXFVector aP0; // 10,20,30
+ double fHeight; // 40
+ char sDefVal[DXF_MAX_STRING_LEN+1]; // 1
+ char sPrompt[DXF_MAX_STRING_LEN+1]; // 3
+ char sTagStr[DXF_MAX_STRING_LEN+1]; // 2
+ long nAttrFlags; // 70
+ long nFieldLen; // 73
+ double fRotAngle; // 50
+ double fXScale; // 41
+ double fOblAngle; // 51
+ char sStyle[DXF_MAX_STRING_LEN+1]; // 7
+ long nGenFlags; // 71
+ long nHorzJust; // 72
+ long nVertJust; // 74
+ DXFVector aAlign; // 11,21,31
+
+ DXFAttDefEntity();
+
+protected:
+
+ virtual void EvaluateGroup(DXFGroupReader & rDGR);
+};
+
+//--------------------------Attrib----------------------------------------------
+
+class DXFAttribEntity : public DXFBasicEntity {
+
+public:
+
+ DXFVector aP0; // 10,20,30
+ double fHeight; // 40
+ char sText[DXF_MAX_STRING_LEN+1]; // 1
+ char sTagStr[DXF_MAX_STRING_LEN+1]; // 2
+ long nAttrFlags; // 70
+ long nFieldLen; // 73
+ double fRotAngle; // 50
+ double fXScale; // 41
+ double fOblAngle; // 51
+ char sStyle[DXF_MAX_STRING_LEN+1]; // 7
+ long nGenFlags; // 71
+ long nHorzJust; // 72
+ long nVertJust; // 74
+ DXFVector aAlign; // 11,21,31
+
+ DXFAttribEntity();
+
+protected:
+
+ virtual void EvaluateGroup(DXFGroupReader & rDGR);
+};
+
+//--------------------------PolyLine--------------------------------------------
+
+class DXFPolyLineEntity : public DXFBasicEntity {
+
+public:
+
+ double fElevation; // 30
+ long nFlags; // 70
+ double fSWidth; // 40
+ double fEWidth; // 41
+ long nMeshMCount; // 71
+ long nMeshNCount; // 72
+ long nMDensity; // 73
+ long nNDensity; // 74
+ long nCSSType; // 75
+
+ DXFPolyLineEntity();
+
+protected:
+
+ virtual void EvaluateGroup(DXFGroupReader & rDGR);
+};
+
+class DXFLWPolyLineEntity : public DXFBasicEntity
+{
+ sal_Int32 nIndex;
+
+ public :
+
+ sal_Int32 nCount; // 90
+ sal_Int32 nFlags; // 70 1 = closed, 128 = plinegen
+ double fConstantWidth; // 43 (optional - default: 0, not used if fStartWidth and/or fEndWidth is used)
+ double fStartWidth; // 40
+ double fEndWidth; // 41
+
+ DXFVector* pP;
+
+ DXFLWPolyLineEntity();
+ ~DXFLWPolyLineEntity();
+
+ protected :
+
+ virtual void EvaluateGroup( DXFGroupReader & rDGR );
+
+};
+
+//-------------------------- Hatch ---------------------------------------------
+
+struct DXFEdgeType
+{
+ sal_Int32 nEdgeType;
+
+ virtual ~DXFEdgeType(){};
+ virtual sal_Bool EvaluateGroup( DXFGroupReader & /*rDGR*/ ){ return sal_True; };
+
+ protected :
+
+ DXFEdgeType( sal_Int32 EdgeType ):nEdgeType(EdgeType){};
+};
+struct DXFEdgeTypeLine : public DXFEdgeType
+{
+ DXFVector aStartPoint; // 10,20
+ DXFVector aEndPoint; // 11,21
+ DXFEdgeTypeLine();
+ virtual ~DXFEdgeTypeLine();
+ virtual sal_Bool EvaluateGroup( DXFGroupReader & rDGR );
+};
+struct DXFEdgeTypeCircularArc : public DXFEdgeType
+{
+ DXFVector aCenter; // 10,20
+ double fRadius; // 40
+ double fStartAngle; // 50
+ double fEndAngle; // 51
+ sal_Int32 nIsCounterClockwiseFlag; // 73
+ DXFEdgeTypeCircularArc();
+ virtual ~DXFEdgeTypeCircularArc();
+ virtual sal_Bool EvaluateGroup( DXFGroupReader & rDGR );
+};
+struct DXFEdgeTypeEllipticalArc : public DXFEdgeType
+{
+ DXFVector aCenter; // 10,20
+ DXFVector aEndPoint; // 11,21
+ double fLength; // 40
+ double fStartAngle; // 50
+ double fEndAngle; // 51
+ sal_Int32 nIsCounterClockwiseFlag; // 73
+
+ DXFEdgeTypeEllipticalArc();
+ virtual ~DXFEdgeTypeEllipticalArc();
+ virtual sal_Bool EvaluateGroup( DXFGroupReader & rDGR );
+};
+struct DXFEdgeTypeSpline : public DXFEdgeType
+{
+ sal_Int32 nDegree; // 94
+ sal_Int32 nRational; // 73
+ sal_Int32 nPeriodic; // 74
+ sal_Int32 nKnotCount; // 75
+ sal_Int32 nControlCount; // 76
+
+ DXFEdgeTypeSpline();
+ virtual ~DXFEdgeTypeSpline();
+ virtual sal_Bool EvaluateGroup( DXFGroupReader & rDGR );
+};
+
+typedef std::deque< DXFEdgeType* > DXFEdgeTypeArray;
+
+struct DXFBoundaryPathData
+{
+ sal_Int32 nFlags; // 92
+ sal_Int32 nHasBulgeFlag; // 72
+ sal_Int32 nIsClosedFlag; // 73
+ sal_Int32 nPointCount; // 93
+ double fBulge; // 42
+ sal_Int32 nSourceBoundaryObjects; // 97
+ sal_Int32 nEdgeCount; // 93
+
+ sal_Bool bIsPolyLine;
+ sal_Int32 nPointIndex;
+
+ DXFVector* pP;
+ DXFEdgeTypeArray aEdges;
+
+ DXFBoundaryPathData();
+ ~DXFBoundaryPathData();
+
+ sal_Bool EvaluateGroup( DXFGroupReader & rDGR );
+};
+
+class DXFHatchEntity : public DXFBasicEntity
+{
+ sal_Bool bIsInBoundaryPathContext;
+ sal_Int32 nCurrentBoundaryPathIndex;
+
+ public :
+
+ DXFVector aElevationPoint;
+ sal_Int32 nFlags; // 70 (solid fill = 1, pattern fill = 0)
+ sal_Int32 nAssociativityFlag; // 71 (assoiciative = 1, non-associative = 0)
+ sal_Int32 nBoundaryPathCount; // 91
+ sal_Int32 nHatchStyle; // 75 (odd parity = 0, outmost area = 1, entire area = 2 )
+ sal_Int32 nHatchPatternType; // 76 (user defined = 0, predefined = 1, custom = 2)
+ double fHatchPatternAngle; // 52 (pattern fill only)
+ double fHatchPatternScale; // 41 (pattern fill only:scale or spacing)
+ sal_Int32 nHatchDoubleFlag; // 77 (pattern fill only:double = 1, not double = 0)
+ sal_Int32 nHatchPatternDefinitionLines; // 78
+ double fPixelSize; // 47
+ sal_Int32 nNumberOfSeedPoints; // 98
+
+ DXFBoundaryPathData* pBoundaryPathData;
+
+ DXFHatchEntity();
+ ~DXFHatchEntity();
+
+ protected :
+
+ virtual void EvaluateGroup( DXFGroupReader & rDGR );
+};
+
+
+//--------------------------Vertex----------------------------------------------
+
+class DXFVertexEntity : public DXFBasicEntity {
+
+public:
+
+ DXFVector aP0; // 10,20,30
+ double fSWidth; // 40 (Wenn <0.0, dann gilt DXFPolyLine::fSWidth)
+ double fEWidth; // 41 (Wenn <0.0, dann gilt DXFPolyLine::fEWidth)
+ double fBulge; // 42
+ long nFlags; // 70
+ double fCFTDir; // 50
+
+ DXFVertexEntity();
+
+protected:
+
+ virtual void EvaluateGroup(DXFGroupReader & rDGR);
+};
+
+//--------------------------SeqEnd----------------------------------------------
+
+class DXFSeqEndEntity : public DXFBasicEntity {
+
+public:
+
+ DXFSeqEndEntity();
+};
+
+//--------------------------3DFace----------------------------------------------
+
+class DXF3DFaceEntity : public DXFBasicEntity {
+
+public:
+
+ DXFVector aP0; // 10,20,30
+ DXFVector aP1; // 11,21,31
+ DXFVector aP2; // 12,22,32
+ DXFVector aP3; // 13,23,33
+ long nIEFlags; // 70
+
+ DXF3DFaceEntity();
+
+protected:
+
+ virtual void EvaluateGroup(DXFGroupReader & rDGR);
+};
+
+//--------------------------Dimension-------------------------------------------
+
+class DXFDimensionEntity : public DXFBasicEntity {
+
+public:
+
+ char sPseudoBlock[DXF_MAX_STRING_LEN+1]; // 2
+
+ DXFDimensionEntity();
+
+protected:
+
+ virtual void EvaluateGroup(DXFGroupReader & rDGR);
+};
+
+//------------------------------------------------------------------------------
+//----------- Eine Menge von Entities lesen und repraesentieren ----------------
+//------------------------------------------------------------------------------
+
+class DXFEntities {
+
+public:
+
+ DXFEntities();
+ ~DXFEntities();
+
+ DXFBasicEntity * pFirst; // Liste von Entities, READ ONLY!
+
+ void Read(DXFGroupReader & rDGR);
+ // Liest Entitis per rGDR aus einer DXF-Datei bis zu
+ // einem ENDBLK, ENDSEC oder EOF (der Gruppe 0).
+ // (Alle unbekannten Dinge werden uebersprungen)
+
+ void Clear();
+ // Loescht alle Entities
+};
+
+//------------------------------------------------------------------------------
+//--------------------------------- inlines ------------------------------------
+//------------------------------------------------------------------------------
+
+inline DXFEntities::DXFEntities()
+{
+ pFirst=NULL;
+}
+
+
+inline DXFEntities::~DXFEntities()
+{
+ Clear();
+}
+
+
+#endif
+
+
diff --git a/filter/source/graphicfilter/idxf/dxfgrprd.cxx b/filter/source/graphicfilter/idxf/dxfgrprd.cxx
new file mode 100644
index 000000000000..f09b17e80635
--- /dev/null
+++ b/filter/source/graphicfilter/idxf/dxfgrprd.cxx
@@ -0,0 +1,361 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include <string.h>
+#include <stdlib.h>
+#include <tools/stream.hxx>
+#include "dxfgrprd.hxx"
+
+// ----------------------------------------------------------------------------
+
+// we use an own ReadLine function, because Stream::ReadLine stops if
+// a 0-sign occurs; this functions converts 0-signs to blanks and reads
+// a complete line until a cr/lf is found
+
+BOOL DXFReadLine( SvStream& rIStm, ByteString& rStr )
+{
+ char buf[256 + 1];
+ BOOL bEnd = FALSE;
+ ULONG nOldFilePos = rIStm.Tell();
+ char c = 0;
+
+ rStr.Erase();
+
+ while( !bEnd && !rIStm.GetError() ) // !!! nicht auf EOF testen,
+ // !!! weil wir blockweise
+ // !!! lesen
+ {
+ USHORT nLen = (USHORT)rIStm.Read( buf, sizeof(buf)-1 );
+ if( !nLen )
+ {
+ if( rStr.Len() == 0 )
+ return FALSE;
+ else
+ break;
+ }
+
+ for( USHORT n = 0; n < nLen ; n++ )
+ {
+ c = buf[n];
+ if( c != '\n' && c != '\r' )
+ {
+ if( !c )
+ c = ' ';
+ rStr += c;
+ }
+ else
+ {
+ bEnd = TRUE;
+ break;
+ }
+ }
+ }
+
+ if( !bEnd && !rIStm.GetError() && rStr.Len() )
+ bEnd = TRUE;
+
+ nOldFilePos += rStr.Len();
+ if( rIStm.Tell() > nOldFilePos )
+ nOldFilePos++;
+ rIStm.Seek( nOldFilePos ); // seeken wg. obigem BlockRead!
+
+ if( bEnd && (c=='\r' || c=='\n')) // Sonderbehandlung DOS-Dateien
+ {
+ char cTemp;
+ rIStm.Read((char*)&cTemp , sizeof(cTemp) );
+ if( cTemp == c || (cTemp != '\n' && cTemp != '\r') )
+ rIStm.Seek( nOldFilePos );
+ }
+
+ return bEnd;
+}
+
+// ------------------
+
+DXFGroupReader::DXFGroupReader(SvStream & rIStream, USHORT nminpercent, USHORT nmaxpercent ) :
+ rIS(rIStream)
+{
+ USHORT i;
+
+ nIBuffPos=0;
+ nIBuffSize=0;
+ bStatus=TRUE;
+ nLastG=0;
+ nGCount=0;
+
+ nMinPercent=(ULONG)nminpercent;
+ nMaxPercent=(ULONG)nmaxpercent;
+ nLastPercent=nMinPercent;
+
+ rIS.Seek(STREAM_SEEK_TO_END);
+ nFileSize=rIS.Tell();
+ rIS.Seek(0);
+
+ for (i=0; i<10; i++) S0_9[i][0]=0;
+ S100[ 0 ] = S102[ 0 ] = 0;
+ for (i=0; i<50; i++) F10_59[i]=0.0;
+ for (i=0; i<20; i++) I60_79[i]=0;
+ for (i=0; i<10; i++) I90_99[i]=0;
+ for (i=0; i< 8; i++) F140_147[i]=0.0;
+ for (i=0; i< 6; i++) I170_175[i]=0;
+ for (i=0; i<30; i++) F210_239[i]=0.0;
+ for (i=0; i<11; i++) S999_1009[i][0]=0;
+ for (i=0; i<50; i++) F1010_1059[i]=0.0;
+ for (i=0; i<20; i++) I1060_1079[i]=0;
+
+}
+
+
+USHORT DXFGroupReader::Read()
+{
+ sal_uInt16 nG = 0;
+ if ( bStatus )
+ {
+ nGCount++;
+ nG = (sal_uInt16)ReadI();
+ if ( bStatus )
+ {
+ char aTmp[ DXF_MAX_STRING_LEN + 1 ];
+
+ if (nG< 10) ReadS(S0_9[nG]);
+ else if (nG< 60) F10_59[nG-10]=ReadF();
+ else if (nG< 80) I60_79[nG-60]=ReadI();
+ else if (nG< 90) ReadS( aTmp );
+ else if (nG< 99) I90_99[nG-90]=ReadI();
+ else if (nG==100) ReadS(S100);
+ else if (nG==102) ReadS(S102);
+ else if (nG==105) ReadS( aTmp );
+ else if (nG< 140) ReadS( aTmp );
+ else if (nG< 148) F140_147[nG-140]=ReadF();
+ else if (nG< 170) ReadS( aTmp );
+ else if (nG< 176) I170_175[nG-175]=ReadI();
+ else if (nG< 180) ReadI();
+ else if (nG< 210) ReadS( aTmp );
+ else if (nG< 240) F210_239[nG-210]=ReadF();
+ else if (nG<=369) ReadS( aTmp );
+ else if (nG< 999) ReadS( aTmp );
+ else if (nG<1010) ReadS(S999_1009[nG-999]);
+ else if (nG<1060) F1010_1059[nG-1010]=ReadF();
+ else if (nG<1080) I1060_1079[nG-1060]=ReadI();
+ else bStatus = sal_False;
+ }
+ }
+ if ( bStatus )
+ nLastG = nG;
+ else
+ {
+ nG = 0;
+ SetS( 0, "EOF" );
+ if ( nGCount != 0xffffffff )
+ {
+ // InfoBox(NULL,String("Fehler ab Gruppe Nr ")+String(nGCount)).Execute();
+ nGCount=0xffffffff;
+ }
+ }
+ nLastG = nG;
+ return nG;
+}
+
+
+long DXFGroupReader::GetI(USHORT nG)
+{
+ sal_Int32 nRetValue = 0;
+ if ( ( nG >= 60 ) && ( nG <= 79 ) )
+ nRetValue = I60_79[ nG - 60 ];
+ else if ( ( nG >= 90 ) && ( nG <= 99 ) )
+ nRetValue = I90_99[ nG - 90 ];
+ else if ( ( nG >= 170 ) && ( nG <= 175 ) )
+ nRetValue = I170_175[ nG - 170 ];
+ else if ( ( nG >= 1060 ) && ( nG <= 1079 ) )
+ nRetValue = I1060_1079[ nG - 1060 ];
+ return nRetValue;
+}
+
+double DXFGroupReader::GetF(USHORT nG)
+{
+ nG-=10;
+ if (nG<50) return F10_59[nG];
+ else {
+ nG-=130;
+ if (nG<8) return F140_147[nG];
+ else {
+ nG-=70;
+ if (nG<30) return F210_239[nG];
+ else {
+ nG-=800;
+ if (nG<50) return F1010_1059[nG];
+ else return 0;
+ }
+ }
+ }
+}
+
+const char * DXFGroupReader::GetS(USHORT nG)
+{
+ if (nG<10) return S0_9[nG];
+ else if ( nG == 100 )
+ return S100;
+ else if ( nG == 102 )
+ return S102;
+ else
+ {
+ nG-=999;
+ if (nG<11) return S999_1009[nG];
+ else return NULL;
+ }
+}
+
+void DXFGroupReader::SetF(USHORT nG, double fF)
+{
+ nG-=10;
+ if (nG<50) F10_59[nG]=fF;
+ else {
+ nG-=130;
+ if (nG<8) F140_147[nG]=fF;
+ else {
+ nG-=70;
+ if (nG<30) F210_239[nG]=fF;
+ else {
+ nG-=800;
+ if (nG<50) F1010_1059[nG]=fF;
+ }
+ }
+ }
+}
+
+
+void DXFGroupReader::SetS(USHORT nG, const char * sS)
+{
+ char* pPtr = NULL;
+ if ( nG < 10 )
+ pPtr = S0_9[ nG ];
+ else if ( nG == 100 )
+ pPtr = S100;
+ else if ( nG == 102 )
+ pPtr = S102;
+ else
+ {
+ nG -= 999;
+ if ( nG < 11 )
+ pPtr = S999_1009[ nG ];
+ }
+ if ( pPtr )
+ strncpy( pPtr, sS, DXF_MAX_STRING_LEN + 1 );
+}
+
+
+void DXFGroupReader::ReadLine(char * ptgt)
+{
+ ByteString aStr;
+ ULONG nLen;
+
+ DXFReadLine( rIS, aStr );
+
+ nLen = aStr.Len();
+ if ( nLen > DXF_MAX_STRING_LEN )
+ nLen = DXF_MAX_STRING_LEN;
+
+ memcpy( ptgt, aStr.GetBuffer(), nLen );
+ ptgt[ nLen ] = 0x00;
+/*
+ if ( pCallback )
+ {
+ const ULONG nPercent= nMinPercent + (nMaxPercent-nMinPercent)*rIS.Tell() / nFileSize;
+
+ if ( nPercent >= nLastPercent + 4 )
+ {
+ nLastPercent=nPercent;
+ if (((*pCallback)(pCallerData,(USHORT)nPercent))==TRUE)
+ bStatus=FALSE;
+ }
+ }
+*/
+}
+
+
+long DXFGroupReader::ReadI()
+{
+ char sl[DXF_MAX_STRING_LEN+1],*p;
+ long res,nv;
+
+ ReadLine(sl);
+
+ p=sl;
+
+ while(*p==0x20) p++;
+
+ if ((*p<'0' || *p>'9') && *p!='-') {
+ bStatus=FALSE;
+ return 0;
+ }
+
+ if (*p=='-') {
+ nv=-1;
+ p++;
+ }
+ else nv=1;
+
+ res=0;
+ do {
+ res=res*10+(long)(*p-'0');
+ p++;
+ } while (*p>='0' && *p<='9');
+
+ while (*p==0x20) p++;
+ if (*p!=0) {
+ bStatus=FALSE;
+ return 0;
+ }
+
+ return res*nv;
+}
+
+
+double DXFGroupReader::ReadF()
+{
+ char sl[DXF_MAX_STRING_LEN+1],*p;
+
+ ReadLine(sl);
+ p=sl;
+ while(*p==0x20) p++;
+ if ((*p<'0' || *p>'9') && *p!='.' && *p!='-') {
+ bStatus=FALSE;
+ return 0.0;
+ }
+ return atof(p);
+}
+
+
+void DXFGroupReader::ReadS(char * ptgt)
+{
+ ReadLine(ptgt);
+}
+
+
diff --git a/filter/source/graphicfilter/idxf/dxfgrprd.hxx b/filter/source/graphicfilter/idxf/dxfgrprd.hxx
new file mode 100644
index 000000000000..0b9a40ff6bf8
--- /dev/null
+++ b/filter/source/graphicfilter/idxf/dxfgrprd.hxx
@@ -0,0 +1,155 @@
+/*************************************************************************
+ *
+ * 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 _DXFGRPRD_HXX
+#define _DXFGRPRD_HXX
+
+#include <svtools/fltcall.hxx>
+
+#define DXF_MAX_STRING_LEN 256 // Max Stringlaenge (ohne die 0)
+
+
+class DXFGroupReader
+{
+
+public:
+
+ // Anmerkkung:
+ // sizeof(DXFGroupReader) ist gross, also nur dynamisch anlegen!
+
+ DXFGroupReader( SvStream & rIStream, USHORT nMinPercent, USHORT nMaxPercent );
+
+ BOOL GetStatus();
+
+ void SetError();
+
+ USHORT Read();
+ // Liesst die naechste Gruppe ein und liefert den Gruppencode zurueck.
+ // Im Falle eines Fehlers liefert GetStatus() FALSE, Gruppencode wird 0
+ // gesetzt, und es wird SetS(0,"EOF") ausgefuehrt.
+
+ USHORT GetG();
+ // Liefert den letzten Gruppencode (also was Read() zuletzt lieferte)
+
+ long GetI();
+ // Liefert den Integer-Wert zur Gruppe, die vorher mit Read() gelesen wurde.
+ // Dabei muss es sich um einen Gruppencode fuer den Datentyp Integer
+ // gehandelt haben, wenn nicht, wird 0 gelieferet.
+
+ double GetF();
+ // Liefert den Floatingpoint-Wert zur Gruppe, die vorher mit Read() gelesen wurde.
+ // Dabei muss es sich um einen Gruppencode fuer den Datentyp Floatingpoint
+ // gehandelt haben, wenn nicht, wird 0 geliefert.
+
+ const char * GetS();
+ // Liefert den String zur Gruppe, die vorher mit Read() gelesen wurde.
+ // Dabei muss es sich um einen Gruppencode fuer den Datentyp String
+ // gehandelt haben, wenn nicht, wird NULL geliefert.
+
+ // Folgende drei Methoden arbeiten wie die obigen, nur kann auch ein anderer als der
+ // aktuelle Gruppencode angegeben werden. (DXFGroupReader speichert die Parameter
+ // zu allen Gruppencodes. Dadurch ist es moeglich, dass zunaechst mit Read() einige
+ // verschiedene Gruppen eingelesen werden, bevor sie ausgewertet werden.)
+ long GetI(USHORT nG);
+ double GetF(USHORT nG);
+ const char * GetS(USHORT nG);
+
+ // Mit folgenden Methoden koennen die aktuell gespeicherten Werte zu den
+ // Gruppencodes veraendert werden. (z.B. um Defaultwerte zu setzen, bevor
+ // 'blind' eine Menge von Gruppen eingelesen wird.)
+ void SetF(USHORT nG, double fF);
+ void SetS(USHORT nG, const char * sS); // (wird kopiert)
+
+private:
+
+ void ReadLine(char * ptgt);
+ long ReadI();
+ double ReadF();
+ void ReadS(char * ptgt);
+
+ SvStream & rIS;
+ char sIBuff[1024];
+ USHORT nIBuffSize,nIBuffPos;
+ BOOL bStatus;
+ USHORT nLastG;
+ ULONG nGCount;
+
+ ULONG nMinPercent;
+ ULONG nMaxPercent;
+ ULONG nLastPercent;
+ ULONG nFileSize;
+
+ char S0_9 [10][DXF_MAX_STRING_LEN+1]; // Strings Gruppencodes 0..9
+ double F10_59 [50]; // Floats Gruppencodes 10..59
+ long I60_79 [20]; // Integers Gruppencodes 60..79
+ long I90_99 [10];
+ char S100 [DXF_MAX_STRING_LEN+1];
+ char S102 [DXF_MAX_STRING_LEN+1];
+ double F140_147 [ 8]; // Floats Gruppencodes 140..147
+ long I170_175 [ 6]; // Integers Gruppencodes 170..175
+ double F210_239 [30]; // Floats Gruppencodes 210..239
+ char S999_1009 [11][DXF_MAX_STRING_LEN+1]; // Strings Gruppencodes 999..1009
+ double F1010_1059[50]; // Floats Gruppencodes 1010..1059
+ long I1060_1079[20]; // Integers Gruppencodes 1060..1079
+
+};
+
+
+inline BOOL DXFGroupReader::GetStatus()
+{
+ return bStatus;
+}
+
+
+inline void DXFGroupReader::SetError()
+{
+ bStatus=FALSE;
+}
+
+inline USHORT DXFGroupReader::GetG()
+{
+ return nLastG;
+}
+
+inline long DXFGroupReader::GetI()
+{
+ return GetI(nLastG);
+}
+
+inline double DXFGroupReader::GetF()
+{
+ return GetF(nLastG);
+}
+
+inline const char * DXFGroupReader::GetS()
+{
+ return GetS(nLastG);
+}
+
+#endif
+
+
diff --git a/filter/source/graphicfilter/idxf/dxfreprd.cxx b/filter/source/graphicfilter/idxf/dxfreprd.cxx
new file mode 100644
index 000000000000..9d6494b87f9d
--- /dev/null
+++ b/filter/source/graphicfilter/idxf/dxfreprd.cxx
@@ -0,0 +1,385 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include <string.h>
+#include <dxfreprd.hxx>
+
+
+//------------------DXFBoundingBox--------------------------------------------
+
+
+void DXFBoundingBox::Union(const DXFVector & rVector)
+{
+ if (bEmpty==TRUE) {
+ fMinX=rVector.fx;
+ fMinY=rVector.fy;
+ fMinZ=rVector.fz;
+ fMaxX=rVector.fx;
+ fMaxY=rVector.fy;
+ fMaxZ=rVector.fz;
+ bEmpty=FALSE;
+ }
+ else {
+ if (fMinX>rVector.fx) fMinX=rVector.fx;
+ if (fMinY>rVector.fy) fMinY=rVector.fy;
+ if (fMinZ>rVector.fz) fMinZ=rVector.fz;
+ if (fMaxX<rVector.fx) fMaxX=rVector.fx;
+ if (fMaxY<rVector.fy) fMaxY=rVector.fy;
+ if (fMaxZ<rVector.fz) fMaxZ=rVector.fz;
+ }
+}
+
+
+//------------------DXFPalette------------------------------------------------
+
+
+DXFPalette::DXFPalette()
+{
+ short i,j,nHue,nNSat,nVal,nC[3],nmax,nmed,nmin;
+ BYTE nV;
+
+ pRed =new BYTE[256];
+ pGreen=new BYTE[256];
+ pBlue =new BYTE[256];
+
+ // Farben 0 - 9 (normale Farben)
+ SetColor(0, 0x00, 0x00, 0x00); // eigentlich nie benutzt
+ SetColor(1, 0xff, 0x00, 0x00);
+ SetColor(2, 0xff, 0xff, 0x00);
+ SetColor(3, 0x00, 0xff, 0x00);
+ SetColor(4, 0x00, 0xff, 0xff);
+ SetColor(5, 0x00, 0x00, 0xff);
+ SetColor(6, 0xff, 0x00, 0xff);
+ SetColor(7, 0x0f, 0x0f, 0x0f); // eigentlich weiss ???
+ SetColor(8, 0x80, 0x80, 0x80);
+ SetColor(9, 0xc0, 0xc0, 0xc0);
+
+ // Farben 10 - 249
+ // (Universal-Palette: 24 Farbtoene * 5 Helligkeiten * 2 Saettigungen )
+ i=10;
+ for (nHue=0; nHue<24; nHue++) {
+ for (nVal=5; nVal>=1; nVal--) {
+ for (nNSat=0; nNSat<2; nNSat++) {
+ nmax=((nHue+3)>>3)%3;
+ j=nHue-(nmax<<3); if (j>4) j=j-24;
+ if (j>=0) {
+ nmed=(nmax+1)%3;
+ nmin=(nmax+2)%3;
+ }
+ else {
+ nmed=(nmax+2)%3;
+ nmin=(nmax+1)%3;
+ j=-j;
+ }
+ nC[nmin]=0;
+ nC[nmed]=255*j/4;
+ nC[nmax]=255;
+ if (nNSat!=0) {
+ for (j=0; j<3; j++) nC[j]=(nC[j]>>1)+128;
+ }
+ for (j=0; j<3; j++) nC[j]=nC[j]*nVal/5;
+ SetColor((BYTE)(i++),(BYTE)nC[0],(BYTE)nC[1],(BYTE)nC[2]);
+ }
+ }
+ }
+
+ // Farben 250 - 255 (Grautoenne)
+ for (i=0; i<6; i++) {
+ nV=(BYTE)(i*38+65);
+ SetColor((BYTE)(250+i),nV,nV,nV);
+ }
+}
+
+
+DXFPalette::~DXFPalette()
+{
+ delete[] pBlue;
+ delete[] pGreen;
+ delete[] pRed;
+}
+
+
+void DXFPalette::SetColor(BYTE nIndex, BYTE nRed, BYTE nGreen, BYTE nBlue)
+{
+ pRed[nIndex]=nRed;
+ pGreen[nIndex]=nGreen;
+ pBlue[nIndex]=nBlue;
+}
+
+
+//------------------DXFRepresentation-----------------------------------------
+
+
+DXFRepresentation::DXFRepresentation()
+{
+ setTextEncoding(RTL_TEXTENCODING_IBM_437);
+ setGlobalLineTypeScale(1.0);
+}
+
+
+DXFRepresentation::~DXFRepresentation()
+{
+}
+
+
+BOOL DXFRepresentation::Read( SvStream & rIStream, USHORT nMinPercent, USHORT nMaxPercent)
+{
+ DXFGroupReader * pDGR;
+ BOOL bRes;
+
+ aTables.Clear();
+ aBlocks.Clear();
+ aEntities.Clear();
+
+ pDGR = new DXFGroupReader( rIStream, nMinPercent, nMaxPercent );
+
+ pDGR->Read();
+ while (pDGR->GetG()!=0 || strcmp(pDGR->GetS(),"EOF")!=0) {
+ if (pDGR->GetG()==0 && strcmp(pDGR->GetS(),"SECTION")==0) {
+ if (pDGR->Read()!=2) {
+ pDGR->SetError();
+ break;
+ }
+ if (strcmp(pDGR->GetS(),"HEADER" )==0) ReadHeader(*pDGR);
+ else if (strcmp(pDGR->GetS(),"TABLES" )==0) aTables.Read(*pDGR);
+ else if (strcmp(pDGR->GetS(),"BLOCKS" )==0) aBlocks.Read(*pDGR);
+ else if (strcmp(pDGR->GetS(),"ENTITIES")==0) aEntities.Read(*pDGR);
+ else pDGR->Read();
+ }
+ else pDGR->Read();
+ }
+
+ bRes=pDGR->GetStatus();
+
+ delete pDGR;
+
+ if (bRes==TRUE && aBoundingBox.bEmpty==TRUE)
+ CalcBoundingBox(aEntities,aBoundingBox);
+
+ return bRes;
+}
+
+
+void DXFRepresentation::ReadHeader(DXFGroupReader & rDGR)
+{
+
+ while (rDGR.GetG()!=0 || (strcmp(rDGR.GetS(),"EOF")!=0 && strcmp(rDGR.GetS(),"ENDSEC")!=0) )
+ {
+ if (rDGR.GetG()==9) {
+ if (strcmp(rDGR.GetS(),"$EXTMIN")==0 ||
+ strcmp(rDGR.GetS(),"$EXTMAX")==0)
+ {
+ DXFVector aVector;
+ rDGR.SetF(10,0.0);
+ rDGR.SetF(20,0.0);
+ rDGR.SetF(30,0.0);
+ do {
+ rDGR.Read();
+ } while (rDGR.GetG()!=9 && rDGR.GetG()!=0);
+ aVector.fx=rDGR.GetF(10);
+ aVector.fy=rDGR.GetF(20);
+ aVector.fz=rDGR.GetF(30);
+ aBoundingBox.Union(aVector);
+ } else {
+ if (strcmp(rDGR.GetS(),"$DWGCODEPAGE")==0)
+ {
+ rDGR.Read();
+
+ // FIXME: we really need a whole table of
+ // $DWGCODEPAGE to encodings mappings
+ if ( (strcmp(rDGR.GetS(),"ANSI_932")==0) ||
+ (strcmp(rDGR.GetS(),"ansi_932")==0) ||
+ (strcmp(rDGR.GetS(),"DOS932")==0) ||
+ (strcmp(rDGR.GetS(),"dos932")==0) )
+ {
+ setTextEncoding(RTL_TEXTENCODING_MS_932);
+ }
+ }
+ else if (strcmp(rDGR.GetS(),"$LTSCALE")==0)
+ {
+ rDGR.Read();
+ setGlobalLineTypeScale(getGlobalLineTypeScale() * rDGR.GetF());
+ }
+ else rDGR.Read();
+ }
+ }
+ else rDGR.Read();
+ }
+}
+
+
+void DXFRepresentation::CalcBoundingBox(const DXFEntities & rEntities,
+ DXFBoundingBox & rBox)
+{
+ DXFBasicEntity * pBE=rEntities.pFirst;
+ while (pBE!=NULL) {
+ switch (pBE->eType) {
+ case DXF_LINE: {
+ const DXFLineEntity * pE = (DXFLineEntity*)pBE;
+ rBox.Union(pE->aP0);
+ rBox.Union(pE->aP1);
+ break;
+ }
+ case DXF_POINT: {
+ const DXFPointEntity * pE = (DXFPointEntity*)pBE;
+ rBox.Union(pE->aP0);
+ break;
+ }
+ case DXF_CIRCLE: {
+ const DXFCircleEntity * pE = (DXFCircleEntity*)pBE;
+ DXFVector aP;
+ aP=pE->aP0;
+ aP.fx-=pE->fRadius;
+ aP.fy-=pE->fRadius;
+ rBox.Union(aP);
+ aP=pE->aP0;
+ aP.fx+=pE->fRadius;
+ aP.fy+=pE->fRadius;
+ rBox.Union(aP);
+ break;
+ }
+ case DXF_ARC: {
+ const DXFArcEntity * pE = (DXFArcEntity*)pBE;
+ DXFVector aP;
+ aP=pE->aP0;
+ aP.fx-=pE->fRadius;
+ aP.fy-=pE->fRadius;
+ rBox.Union(aP);
+ aP=pE->aP0;
+ aP.fx+=pE->fRadius;
+ aP.fy+=pE->fRadius;
+ rBox.Union(aP);
+ break;
+ }
+ case DXF_TRACE: {
+ const DXFTraceEntity * pE = (DXFTraceEntity*)pBE;
+ rBox.Union(pE->aP0);
+ rBox.Union(pE->aP1);
+ rBox.Union(pE->aP2);
+ rBox.Union(pE->aP3);
+ break;
+ }
+ case DXF_SOLID: {
+ const DXFSolidEntity * pE = (DXFSolidEntity*)pBE;
+ rBox.Union(pE->aP0);
+ rBox.Union(pE->aP1);
+ rBox.Union(pE->aP2);
+ rBox.Union(pE->aP3);
+ break;
+ }
+ case DXF_TEXT: {
+ //const DXFTextEntity * pE = (DXFTextEntity*)pBE;
+ //???
+ break;
+ }
+ case DXF_SHAPE: {
+ //const DXFShapeEntity * pE = (DXFShapeEntity*)pBE;
+ //???
+ break;
+ }
+ case DXF_INSERT: {
+ const DXFInsertEntity * pE = (DXFInsertEntity*)pBE;
+ DXFBlock * pB;
+ DXFBoundingBox aBox;
+ DXFVector aP;
+ pB=aBlocks.Search(pE->sName);
+ if (pB==NULL) break;
+ CalcBoundingBox(*pB,aBox);
+ if (aBox.bEmpty==TRUE) break;
+ aP.fx=(aBox.fMinX-pB->aBasePoint.fx)*pE->fXScale+pE->aP0.fx;
+ aP.fy=(aBox.fMinY-pB->aBasePoint.fy)*pE->fYScale+pE->aP0.fy;
+ aP.fz=(aBox.fMinZ-pB->aBasePoint.fz)*pE->fZScale+pE->aP0.fz;
+ rBox.Union(aP);
+ aP.fx=(aBox.fMaxX-pB->aBasePoint.fx)*pE->fXScale+pE->aP0.fx;
+ aP.fy=(aBox.fMaxY-pB->aBasePoint.fy)*pE->fYScale+pE->aP0.fy;
+ aP.fz=(aBox.fMaxZ-pB->aBasePoint.fz)*pE->fZScale+pE->aP0.fz;
+ rBox.Union(aP);
+ break;
+ }
+ case DXF_ATTDEF: {
+ //const DXFAttDefEntity * pE = (DXFAttDefEntity*)pBE;
+ //???
+ break;
+ }
+ case DXF_ATTRIB: {
+ //const DXFAttribEntity * pE = (DXFAttribEntity*)pBE;
+ //???
+ break;
+ }
+ case DXF_VERTEX: {
+ const DXFVertexEntity * pE = (DXFVertexEntity*)pBE;
+ rBox.Union(pE->aP0);
+ break;
+ }
+ case DXF_3DFACE: {
+ const DXF3DFaceEntity * pE = (DXF3DFaceEntity*)pBE;
+ rBox.Union(pE->aP0);
+ rBox.Union(pE->aP1);
+ rBox.Union(pE->aP2);
+ rBox.Union(pE->aP3);
+ break;
+ }
+ case DXF_DIMENSION: {
+ const DXFDimensionEntity * pE = (DXFDimensionEntity*)pBE;
+ DXFBlock * pB;
+ DXFBoundingBox aBox;
+ DXFVector aP;
+ pB=aBlocks.Search(pE->sPseudoBlock);
+ if (pB==NULL) break;
+ CalcBoundingBox(*pB,aBox);
+ if (aBox.bEmpty==TRUE) break;
+ aP.fx=aBox.fMinX-pB->aBasePoint.fx;
+ aP.fy=aBox.fMinY-pB->aBasePoint.fy;
+ aP.fz=aBox.fMinZ-pB->aBasePoint.fz;
+ rBox.Union(aP);
+ aP.fx=aBox.fMaxX-pB->aBasePoint.fx;
+ aP.fy=aBox.fMaxY-pB->aBasePoint.fy;
+ aP.fz=aBox.fMaxZ-pB->aBasePoint.fz;
+ rBox.Union(aP);
+ break;
+ }
+ case DXF_POLYLINE: {
+ //const DXFAttribEntity * pE = (DXFAttribEntity*)pBE;
+ //???
+ break;
+ }
+ case DXF_SEQEND: {
+ //const DXFAttribEntity * pE = (DXFAttribEntity*)pBE;
+ //???
+ break;
+ }
+ case DXF_HATCH :
+ break;
+ case DXF_LWPOLYLINE :
+ break;
+ }
+ pBE=pBE->pSucc;
+ }
+}
diff --git a/filter/source/graphicfilter/idxf/dxfreprd.hxx b/filter/source/graphicfilter/idxf/dxfreprd.hxx
new file mode 100644
index 000000000000..c95d65cfbe46
--- /dev/null
+++ b/filter/source/graphicfilter/idxf/dxfreprd.hxx
@@ -0,0 +1,138 @@
+/*************************************************************************
+ *
+ * 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 _DXFREPRD_HXX
+#define _DXFREPRD_HXX
+
+#include <dxfblkrd.hxx>
+#include <dxftblrd.hxx>
+
+
+//----------------------------------------------------------------------------
+//--------------------Nebensachen---------------------------------------------
+//----------------------------------------------------------------------------
+
+//-------------------Eine 3D-Min/Max-Box--------------------------------------
+
+class DXFBoundingBox {
+public:
+ BOOL bEmpty;
+ double fMinX;
+ double fMinY;
+ double fMinZ;
+ double fMaxX;
+ double fMaxY;
+ double fMaxZ;
+
+ DXFBoundingBox() { bEmpty=TRUE; }
+ void Union(const DXFVector & rVector);
+};
+
+
+//-------------------Die (konstante) Palette fuer DXF-------------------------
+
+class DXFPalette {
+
+public:
+
+ DXFPalette();
+ ~DXFPalette();
+
+ BYTE GetRed(BYTE nIndex) const;
+ BYTE GetGreen(BYTE nIndex) const;
+ BYTE GetBlue(BYTE nIndex) const;
+
+private:
+ BYTE * pRed;
+ BYTE * pGreen;
+ BYTE * pBlue;
+ void SetColor(BYTE nIndex, BYTE nRed, BYTE nGreen, BYTE nBlue);
+};
+
+
+//----------------------------------------------------------------------------
+//-----------------DXF Datei lesen und repraesentieren------------------------
+//----------------------------------------------------------------------------
+
+class DXFRepresentation {
+
+public:
+
+ DXFPalette aPalette;
+ // Die immer gleiche DXF-Farb-Palette
+
+ DXFBoundingBox aBoundingBox;
+ // Ist gleich den AutoCAD-Variablen EXTMIN, EXTMAX sofern in DXF-Datei
+ // vorhanden, anderenfalls wird die BoundingBox berechnet (in Read()).
+
+ DXFTables aTables;
+ // Die Tabellen der DXF-Datei
+
+ DXFBlocks aBlocks;
+ // Die Bloecke der DXF-Datei
+
+ DXFEntities aEntities;
+ // Die Entities (aus der Entities-Section) der DXF-Datei
+
+ rtl_TextEncoding mEnc; // $DWGCODEPAGE
+
+ double mfGlobalLineTypeScale; // $LTSCALE
+
+ DXFRepresentation();
+ ~DXFRepresentation();
+
+ rtl_TextEncoding getTextEncoding() const;
+ void setTextEncoding(rtl_TextEncoding aEnc);
+
+ double getGlobalLineTypeScale() const;
+ void setGlobalLineTypeScale(double fGlobalLineTypeScale);
+
+ BOOL Read( SvStream & rIStream, USHORT nMinPercent, USHORT nMaxPercent);
+ // Liesst die komplette DXF-Datei ein.
+
+private:
+
+ void ReadHeader(DXFGroupReader & rDGR);
+ void CalcBoundingBox(const DXFEntities & rEntities,
+ DXFBoundingBox & rBox);
+};
+
+//----------------------------------------------------------------------------
+//-------------------inlines--------------------------------------------------
+//----------------------------------------------------------------------------
+
+inline BYTE DXFPalette::GetRed(BYTE nIndex) const { return pRed[nIndex]; }
+inline BYTE DXFPalette::GetGreen(BYTE nIndex) const { return pGreen[nIndex]; }
+inline BYTE DXFPalette::GetBlue(BYTE nIndex) const { return pBlue[nIndex]; }
+inline rtl_TextEncoding DXFRepresentation::getTextEncoding() const { return mEnc; }
+inline void DXFRepresentation::setTextEncoding(rtl_TextEncoding aEnc) { mEnc = aEnc; }
+inline double DXFRepresentation::getGlobalLineTypeScale() const { return mfGlobalLineTypeScale; }
+inline void DXFRepresentation::setGlobalLineTypeScale(double fGlobalLineTypeScale) { mfGlobalLineTypeScale = fGlobalLineTypeScale; }
+
+#endif
+
+
diff --git a/filter/source/graphicfilter/idxf/dxftblrd.cxx b/filter/source/graphicfilter/idxf/dxftblrd.cxx
new file mode 100644
index 000000000000..337e43730cb6
--- /dev/null
+++ b/filter/source/graphicfilter/idxf/dxftblrd.cxx
@@ -0,0 +1,348 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include <string.h>
+#include <dxftblrd.hxx>
+
+//----------------------------------DXFLType-----------------------------------
+
+DXFLType::DXFLType()
+{
+ pSucc=NULL;
+ sName[0]=0;
+ nFlags=0;
+ sDescription[0]=0;
+ nDashCount=0;
+}
+
+void DXFLType::Read(DXFGroupReader & rDGR)
+{
+ long nDashIndex=-1;
+
+ while (rDGR.Read()!=0)
+ {
+ switch (rDGR.GetG())
+ {
+ case 2: strncpy( sName, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
+ case 70: nFlags=rDGR.GetI(); break;
+ case 3: strncpy( sDescription, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
+ case 73:
+ if (nDashIndex!=-1) {
+ rDGR.SetError();
+ return;
+ }
+ nDashCount=rDGR.GetI();
+ if (nDashCount>DXF_MAX_DASH_COUNT)
+ nDashCount=DXF_MAX_DASH_COUNT;
+ nDashIndex=0;
+ break;
+ case 40: fPatternLength=rDGR.GetF(); break;
+ case 49:
+ if (nDashCount==-1) {
+ rDGR.SetError();
+ return;
+ }
+ if (nDashIndex<nDashCount)
+ fDash[nDashIndex++]=rDGR.GetF();
+ break;
+ }
+ }
+}
+
+//----------------------------------DXFLayer-----------------------------------
+
+DXFLayer::DXFLayer()
+{
+ pSucc=NULL;
+ sName[0]=0;
+ nFlags=0;
+ nColor=-1;
+ sLineType[0]=0;
+}
+
+void DXFLayer::Read(DXFGroupReader & rDGR)
+{
+ while (rDGR.Read()!=0) {
+ switch(rDGR.GetG()) {
+ case 2: strncpy( sName, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
+ case 70: nFlags=rDGR.GetI(); break;
+ case 62: nColor=rDGR.GetI(); break;
+ case 6: strncpy( sLineType, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
+ }
+ }
+}
+
+//----------------------------------DXFStyle-----------------------------------
+
+DXFStyle::DXFStyle()
+{
+ pSucc=NULL;
+ sName[0]=0;
+ nFlags=0;
+ fHeight=0.0;
+ fWidthFak=1.0;
+ fOblAngle=0.0;
+ nTextGenFlags=0;
+ fLastHeightUsed=0.0;
+ sPrimFontFile[0]=0;
+ sBigFontFile[0]=0;
+}
+
+void DXFStyle::Read(DXFGroupReader & rDGR)
+{
+ while (rDGR.Read()!=0) {
+ switch(rDGR.GetG()) {
+ case 2: strncpy( sName, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
+ case 70: nFlags=rDGR.GetI(); break;
+ case 40: fHeight=rDGR.GetF(); break;
+ case 41: fWidthFak=rDGR.GetF(); break;
+ case 50: fOblAngle=rDGR.GetF(); break;
+ case 71: nTextGenFlags=rDGR.GetI(); break;
+ case 42: fLastHeightUsed=rDGR.GetF(); break;
+ case 3: strncpy( sPrimFontFile, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
+ case 4: strncpy( sBigFontFile, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
+ }
+ }
+}
+
+//----------------------------------DXFVPort-----------------------------------
+
+DXFVPort::DXFVPort()
+{
+ pSucc=NULL;
+
+ sName[0]=0;
+ nFlags=0;
+ fMinX=0;
+ fMinY=0;
+ fMaxX=0;
+ fMaxY=0;
+ fCenterX=0;
+ fCenterY=0;
+ fSnapBaseX=0;
+ fSnapBaseY=0;
+ fSnapSapcingX=0;
+ fSnapSpacingY=0;
+ fGridX=0;
+ fGridY=0;
+ aDirection=DXFVector(0,0,1);
+ aTarget=DXFVector(0,0,0);
+ fHeight=0;
+ fAspectRatio=0;
+ fLensLength=0;
+ fFrontClipPlane=0;
+ fBackClipPlane=0;
+ fTwistAngle=0;
+ nStatus=0;
+ nID=0;
+ nMode=0;
+ nCircleZoomPercent=0;
+ nFastZoom=0;
+ nUCSICON=0;
+ nSnap=0;
+ nGrid=0;
+ nSnapStyle=0;
+ nSnapIsopair=0;
+}
+
+void DXFVPort::Read(DXFGroupReader & rDGR)
+{
+ while (rDGR.Read()!=0) {
+ switch(rDGR.GetG()) {
+ case 2: strncpy( sName, rDGR.GetS(), DXF_MAX_STRING_LEN + 1); break;
+ case 70: nFlags=rDGR.GetI(); break;
+ case 10: fMinX=rDGR.GetF(); break;
+ case 20: fMinY=rDGR.GetF(); break;
+ case 11: fMaxX=rDGR.GetF(); break;
+ case 21: fMaxY=rDGR.GetF(); break;
+ case 12: fCenterX=rDGR.GetF(); break;
+ case 22: fCenterY=rDGR.GetF(); break;
+ case 13: fSnapBaseX=rDGR.GetF(); break;
+ case 23: fSnapBaseY=rDGR.GetF(); break;
+ case 14: fSnapSapcingX=rDGR.GetF(); break;
+ case 24: fSnapSpacingY=rDGR.GetF(); break;
+ case 15: fGridX=rDGR.GetF(); break;
+ case 25: fGridY=rDGR.GetF(); break;
+ case 16: aDirection.fx=rDGR.GetF(); break;
+ case 26: aDirection.fy=rDGR.GetF(); break;
+ case 36: aDirection.fz=rDGR.GetF(); break;
+ case 17: aTarget.fx=rDGR.GetF(); break;
+ case 27: aTarget.fy=rDGR.GetF(); break;
+ case 37: aTarget.fz=rDGR.GetF(); break;
+ case 40: fHeight=rDGR.GetF(); break;
+ case 41: fAspectRatio=rDGR.GetF(); break;
+ case 42: fLensLength=rDGR.GetF(); break;
+ case 43: fFrontClipPlane=rDGR.GetF(); break;
+ case 44: fBackClipPlane=rDGR.GetF(); break;
+ case 51: fTwistAngle=rDGR.GetF(); break;
+ case 68: nStatus=rDGR.GetI(); break;
+ case 69: nID=rDGR.GetI(); break;
+ case 71: nMode=rDGR.GetI(); break;
+ case 72: nCircleZoomPercent=rDGR.GetI(); break;
+ case 73: nFastZoom=rDGR.GetI(); break;
+ case 74: nUCSICON=rDGR.GetI(); break;
+ case 75: nSnap=rDGR.GetI(); break;
+ case 76: nGrid=rDGR.GetI(); break;
+ case 77: nSnapStyle=rDGR.GetI(); break;
+ case 78: nSnapIsopair=rDGR.GetI(); break;
+ }
+ }
+}
+
+//----------------------------------DXFTables----------------------------------
+
+
+DXFTables::DXFTables()
+{
+ pLTypes=NULL;
+ pLayers=NULL;
+ pStyles=NULL;
+ pVPorts=NULL;
+}
+
+
+DXFTables::~DXFTables()
+{
+ Clear();
+}
+
+
+void DXFTables::Read(DXFGroupReader & rDGR)
+{
+ DXFLType * * ppLT, * pLT;
+ DXFLayer * * ppLa, * pLa;
+ DXFStyle * * ppSt, * pSt;
+ DXFVPort * * ppVP, * pVP;
+
+ ppLT=&pLTypes;
+ while(*ppLT!=NULL) ppLT=&((*ppLT)->pSucc);
+
+ ppLa=&pLayers;
+ while(*ppLa!=NULL) ppLa=&((*ppLa)->pSucc);
+
+ ppSt=&pStyles;
+ while(*ppSt!=NULL) ppSt=&((*ppSt)->pSucc);
+
+ ppVP=&pVPorts;
+ while(*ppVP!=NULL) ppVP=&((*ppVP)->pSucc);
+
+ for (;;) {
+ while (rDGR.GetG()!=0) rDGR.Read();
+ if (strcmp(rDGR.GetS(),"EOF")==0 ||
+ strcmp(rDGR.GetS(),"ENDSEC")==0) break;
+ else if (strcmp(rDGR.GetS(),"LTYPE")==0) {
+ pLT=new DXFLType;
+ pLT->Read(rDGR);
+ *ppLT=pLT;
+ ppLT=&(pLT->pSucc);
+ }
+ else if (strcmp(rDGR.GetS(),"LAYER")==0) {
+ pLa=new DXFLayer;
+ pLa->Read(rDGR);
+ *ppLa=pLa;
+ ppLa=&(pLa->pSucc);
+ }
+ else if (strcmp(rDGR.GetS(),"STYLE")==0) {
+ pSt=new DXFStyle;
+ pSt->Read(rDGR);
+ *ppSt=pSt;
+ ppSt=&(pSt->pSucc);
+ }
+ else if (strcmp(rDGR.GetS(),"VPORT")==0) {
+ pVP=new DXFVPort;
+ pVP->Read(rDGR);
+ *ppVP=pVP;
+ ppVP=&(pVP->pSucc);
+ }
+ else rDGR.Read();
+ }
+}
+
+
+void DXFTables::Clear()
+{
+ DXFLType * pLT;
+ DXFLayer * pLa;
+ DXFStyle * pSt;
+ DXFVPort * pVP;
+
+ while (pStyles!=NULL) {
+ pSt=pStyles;
+ pStyles=pSt->pSucc;
+ delete pSt;
+ }
+ while (pLayers!=NULL) {
+ pLa=pLayers;
+ pLayers=pLa->pSucc;
+ delete pLa;
+ }
+ while (pLTypes!=NULL) {
+ pLT=pLTypes;
+ pLTypes=pLT->pSucc;
+ delete pLT;
+ }
+ while (pVPorts!=NULL) {
+ pVP=pVPorts;
+ pVPorts=pVP->pSucc;
+ delete pVP;
+ }
+}
+
+
+DXFLType * DXFTables::SearchLType(const char * pName) const
+{
+ DXFLType * p;
+ for (p=pLTypes; p!=NULL; p=p->pSucc) {
+ if (strcmp(pName,p->sName)==0) break;
+ }
+ return p;
+}
+
+
+DXFLayer * DXFTables::SearchLayer(const char * pName) const
+{
+ DXFLayer * p;
+ for (p=pLayers; p!=NULL; p=p->pSucc) {
+ if (strcmp(pName,p->sName)==0) break;
+ }
+ return p;
+}
+
+
+DXFVPort * DXFTables::SearchVPort(const char * pName) const
+{
+ DXFVPort * p;
+ for (p=pVPorts; p!=NULL; p=p->pSucc) {
+ if (strcmp(pName,p->sName)==0) break;
+ }
+ return p;
+}
+
+
diff --git a/filter/source/graphicfilter/idxf/dxftblrd.hxx b/filter/source/graphicfilter/idxf/dxftblrd.hxx
new file mode 100644
index 000000000000..afa6274bd6cc
--- /dev/null
+++ b/filter/source/graphicfilter/idxf/dxftblrd.hxx
@@ -0,0 +1,183 @@
+/*************************************************************************
+ *
+ * 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 _DXFTBLRD_HXX
+#define _DXFTBLRD_HXX
+
+#include <dxfgrprd.hxx>
+#include <dxfvec.hxx>
+
+
+//----------------------------------------------------------------------------
+//------------------ Linien-Typ ----------------------------------------------
+//----------------------------------------------------------------------------
+
+#define DXF_MAX_DASH_COUNT 32
+
+class DXFLType {
+
+public:
+
+ DXFLType * pSucc;
+
+ char sName[DXF_MAX_STRING_LEN+1]; // 2
+ long nFlags; // 70
+ char sDescription[DXF_MAX_STRING_LEN+1]; // 3
+ long nDashCount; // 73
+ double fPatternLength; // 40
+ double fDash[DXF_MAX_DASH_COUNT]; // 49,49,...
+
+ DXFLType();
+ void Read(DXFGroupReader & rDGR);
+};
+
+
+//----------------------------------------------------------------------------
+//------------------ Layer ---------------------------------------------------
+//----------------------------------------------------------------------------
+
+class DXFLayer {
+
+public:
+
+ DXFLayer * pSucc;
+
+ char sName[DXF_MAX_STRING_LEN+1]; // 2
+ long nFlags; // 70
+ long nColor; // 62
+ char sLineType[DXF_MAX_STRING_LEN+1]; // 6
+
+ DXFLayer();
+ void Read(DXFGroupReader & rDGR);
+};
+
+
+//----------------------------------------------------------------------------
+//------------------ Style ---------------------------------------------------
+//----------------------------------------------------------------------------
+
+class DXFStyle {
+
+public:
+
+ DXFStyle * pSucc;
+
+ char sName[DXF_MAX_STRING_LEN+1]; // 2
+ long nFlags; // 70
+ double fHeight; // 40
+ double fWidthFak; // 41
+ double fOblAngle; // 50
+ long nTextGenFlags; // 71
+ double fLastHeightUsed; // 42
+ char sPrimFontFile[DXF_MAX_STRING_LEN+1]; // 3
+ char sBigFontFile[DXF_MAX_STRING_LEN+1]; // 4
+
+ DXFStyle();
+ void Read(DXFGroupReader & rDGR);
+};
+
+
+//----------------------------------------------------------------------------
+//------------------ VPort ---------------------------------------------------
+//----------------------------------------------------------------------------
+
+class DXFVPort {
+
+public:
+
+ DXFVPort * pSucc;
+
+ char sName[DXF_MAX_STRING_LEN+1]; // 2
+ long nFlags; // 70
+ double fMinX; // 10
+ double fMinY; // 20
+ double fMaxX; // 11
+ double fMaxY; // 21
+ double fCenterX; // 12
+ double fCenterY; // 22
+ double fSnapBaseX; // 13
+ double fSnapBaseY; // 23
+ double fSnapSapcingX; // 14
+ double fSnapSpacingY; // 24
+ double fGridX; // 15
+ double fGridY; // 25
+ DXFVector aDirection; // 16,26,36
+ DXFVector aTarget; // 17,27,37
+ double fHeight; // 40
+ double fAspectRatio; // 41
+ double fLensLength; // 42
+ double fFrontClipPlane; // 43
+ double fBackClipPlane; // 44
+ double fTwistAngle; // 51
+ long nStatus; // 68
+ long nID; // 69
+ long nMode; // 71
+ long nCircleZoomPercent; // 72
+ long nFastZoom; // 73
+ long nUCSICON; // 74
+ long nSnap; // 75
+ long nGrid; // 76
+ long nSnapStyle; // 77
+ long nSnapIsopair; // 78
+
+ DXFVPort();
+ void Read(DXFGroupReader & rDGR);
+};
+
+
+//----------------------------------------------------------------------------
+//------------------ Tabellen ------------------------------------------------
+//----------------------------------------------------------------------------
+
+class DXFTables {
+
+public:
+
+ DXFLType * pLTypes; // Liste der Linientypen
+ DXFLayer * pLayers; // Liste der Layers
+ DXFStyle * pStyles; // Liste der Styles
+ DXFVPort * pVPorts; // Liste der Viewports
+
+ DXFTables();
+ ~DXFTables();
+
+ void Read(DXFGroupReader & rDGR);
+ // Liest die Tabellen ein bis zu einem ENDSEC oder EOF
+ // (unbekannte Dinge/Tabellen werden uebersprungen)
+
+ void Clear();
+
+ // Suche nach Tabelleneintraegen:
+ DXFLType * SearchLType(const char * pName) const;
+ DXFLayer * SearchLayer(const char * pName) const;
+ DXFVPort * SearchVPort(const char * pName) const;
+
+};
+
+#endif
+
+
diff --git a/filter/source/graphicfilter/idxf/dxfvec.cxx b/filter/source/graphicfilter/idxf/dxfvec.cxx
new file mode 100644
index 000000000000..d71100cdc6b1
--- /dev/null
+++ b/filter/source/graphicfilter/idxf/dxfvec.cxx
@@ -0,0 +1,254 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include <math.h>
+#include <dxfvec.hxx>
+
+
+//---------------------------- DXFVector ---------------------------------------
+
+
+double DXFVector::Abs() const
+{
+ return sqrt(SProd(*this));
+}
+
+
+DXFVector DXFVector::Unit() const
+{
+ double flen;
+
+ flen=Abs();
+ if (flen!=0) return (*this)*(1.0/flen);
+ else return DXFVector(1.0,0.0,0.0);
+}
+
+
+//---------------------------- DXFTransform ------------------------------------
+
+
+DXFTransform::DXFTransform() :
+ aMX(1.0, 0.0, 0.0),
+ aMY(0.0, 1.0, 0.0),
+ aMZ(0.0, 0.0, 1.0),
+ aMP(0.0, 0.0, 0.0)
+{
+}
+
+
+DXFTransform::DXFTransform(double fScaleX, double fScaleY, double fScaleZ,
+ const DXFVector & rShift) :
+ aMX(fScaleX, 0.0, 0.0),
+ aMY(0.0, fScaleY, 0.0),
+ aMZ(0.0, 0.0, fScaleZ),
+ aMP(rShift)
+{
+}
+
+
+DXFTransform::DXFTransform(double fScaleX, double fScaleY, double fScaleZ,
+ double fRotAngle,
+ const DXFVector & rShift) :
+ aMX(0.0, 0.0, 0.0),
+ aMY(0.0, 0.0, 0.0),
+ aMZ(0.0, 0.0, fScaleZ),
+ aMP(rShift)
+{
+ aMX.fx=cos(3.14159265359/180.0*fRotAngle);
+ aMX.fy=sin(3.14159265359/180.0*fRotAngle);
+ aMY.fx=-aMX.fy;
+ aMY.fy=aMX.fx;
+ aMX*=fScaleX;
+ aMY*=fScaleY;
+}
+
+
+DXFTransform::DXFTransform(const DXFVector & rExtrusion) :
+ aMX(), aMY(), aMZ(), aMP(0.0, 0.0, 0.0)
+{
+ // 'Arbitrary Axis Algorithm' (siehe DXF-Doku von Autodesk)
+ if ( fabs(rExtrusion.fx) < 1.0/64.0 && fabs(rExtrusion.fy) < 1.0/64.0) {
+ aMX = DXFVector(0.0, 1.0, 0.0) * rExtrusion;
+ }
+ else {
+ aMX = DXFVector(0.0, 0.0, 1.0) * rExtrusion;
+ }
+ aMX=aMX.Unit();
+ aMY=(rExtrusion*aMX).Unit();
+ aMZ=rExtrusion.Unit();
+}
+
+
+DXFTransform::DXFTransform(const DXFVector & rViewDir, const DXFVector & rViewTarget) :
+ aMX(), aMY(), aMZ(), aMP()
+{
+ DXFVector aV;
+
+ aV=rViewDir.Unit();
+ aMX.fz=aV.fx;
+ aMY.fz=aV.fy;
+ aMZ.fz=aV.fz;
+
+ aMZ.fx=0;
+ if (aV.fx==0) aMY.fx=0; else aMY.fx=sqrt(1/(1+aV.fy*aV.fy/(aV.fx*aV.fx)));
+ aMX.fx=sqrt(1-aMY.fx*aMY.fx);
+ if (aV.fx*aV.fy*aMY.fx>0) aMX.fx=-aMX.fx;
+
+ aV=aV*DXFVector(aMX.fx,aMY.fx,aMZ.fx);
+ aMX.fy=aV.fx;
+ aMY.fy=aV.fy;
+ aMZ.fy=aV.fz;
+
+ if (aMZ.fy<0) {
+ aMX.fy=-aMX.fy;
+ aMY.fy=-aMY.fy;
+ aMZ.fy=-aMZ.fy;
+ aMX.fx=-aMX.fx;
+ aMY.fx=-aMY.fx;
+ }
+
+ aV=DXFVector(0,0,0)-rViewTarget;
+ aMP.fx = aV.fx * aMX.fx + aV.fy * aMY.fx + aV.fz * aMZ.fx;
+ aMP.fy = aV.fx * aMX.fy + aV.fy * aMY.fy + aV.fz * aMZ.fy;
+ aMP.fz = aV.fx * aMX.fz + aV.fy * aMY.fz + aV.fz * aMZ.fz;
+}
+
+
+DXFTransform::DXFTransform(const DXFTransform & rT1, const DXFTransform & rT2) :
+ aMX(),aMY(),aMZ(),aMP()
+{
+ rT2.TransDir(rT1.aMX,aMX);
+ rT2.TransDir(rT1.aMY,aMY);
+ rT2.TransDir(rT1.aMZ,aMZ);
+ rT2.Transform(rT1.aMP,aMP);
+}
+
+
+void DXFTransform::Transform(const DXFVector & rSrc, DXFVector & rTgt) const
+{
+ rTgt.fx = rSrc.fx * aMX.fx + rSrc.fy * aMY.fx + rSrc.fz * aMZ.fx + aMP.fx;
+ rTgt.fy = rSrc.fx * aMX.fy + rSrc.fy * aMY.fy + rSrc.fz * aMZ.fy + aMP.fy;
+ rTgt.fz = rSrc.fx * aMX.fz + rSrc.fy * aMY.fz + rSrc.fz * aMZ.fz + aMP.fz;
+}
+
+
+void DXFTransform::Transform(const DXFVector & rSrc, Point & rTgt) const
+{
+ rTgt.X()=(long)( rSrc.fx * aMX.fx + rSrc.fy * aMY.fx + rSrc.fz * aMZ.fx + aMP.fx + 0.5 );
+ rTgt.Y()=(long)( rSrc.fx * aMX.fy + rSrc.fy * aMY.fy + rSrc.fz * aMZ.fy + aMP.fy + 0.5 );
+}
+
+
+void DXFTransform::TransDir(const DXFVector & rSrc, DXFVector & rTgt) const
+{
+ rTgt.fx = rSrc.fx * aMX.fx + rSrc.fy * aMY.fx + rSrc.fz * aMZ.fx;
+ rTgt.fy = rSrc.fx * aMX.fy + rSrc.fy * aMY.fy + rSrc.fz * aMZ.fy;
+ rTgt.fz = rSrc.fx * aMX.fz + rSrc.fy * aMY.fz + rSrc.fz * aMZ.fz;
+}
+
+
+BOOL DXFTransform::TransCircleToEllipse(double fRadius, double & rEx, double & rEy) const
+{
+ double fMXAbs=aMX.Abs();
+ double fMYAbs=aMY.Abs();
+ double fNearNull=(fMXAbs+fMYAbs)*0.001;
+
+ if (fabs(aMX.fy)<=fNearNull && fabs(aMX.fz)<=fNearNull &&
+ fabs(aMY.fx)<=fNearNull && fabs(aMY.fz)<=fNearNull)
+ {
+ rEx=fabs(aMX.fx*fRadius);
+ rEy=fabs(aMY.fy*fRadius);
+ return TRUE;
+ }
+ else if (fabs(aMX.fx)<=fNearNull && fabs(aMX.fz)<=fNearNull &&
+ fabs(aMY.fy)<=fNearNull && fabs(aMY.fz)<=fNearNull)
+ {
+ rEx=fabs(aMY.fx*fRadius);
+ rEy=fabs(aMX.fy*fRadius);
+ return TRUE;
+ }
+ else if (fabs(fMXAbs-fMYAbs)<=fNearNull &&
+ fabs(aMX.fz)<=fNearNull && fabs(aMY.fz)<=fNearNull)
+ {
+ rEx=rEy=fabs(((fMXAbs+fMYAbs)/2)*fRadius);
+ return TRUE;
+ }
+ else return FALSE;
+}
+
+LineInfo DXFTransform::Transform(const DXFLineInfo& aDXFLineInfo) const
+{
+ double fex,fey,scale;
+
+ fex=sqrt(aMX.fx*aMX.fx + aMX.fy*aMX.fy);
+ fey=sqrt(aMY.fx*aMY.fx + aMY.fy*aMY.fy);
+ scale = (fex+fey)/2.0;
+
+ LineInfo aLineInfo;
+
+ aLineInfo.SetStyle( aDXFLineInfo.eStyle );
+ aLineInfo.SetWidth( (sal_Int32) (aDXFLineInfo.fWidth * scale + 0.5) );
+ aLineInfo.SetDashCount( static_cast< USHORT >( aDXFLineInfo.nDashCount ) );
+ aLineInfo.SetDashLen( (sal_Int32) (aDXFLineInfo.fDashLen * scale + 0.5) );
+ aLineInfo.SetDotCount( static_cast< USHORT >( aDXFLineInfo.nDotCount ) );
+ aLineInfo.SetDotLen( (sal_Int32) (aDXFLineInfo.fDotLen * scale + 0.5) );
+ aLineInfo.SetDistance( (sal_Int32) (aDXFLineInfo.fDistance * scale + 0.5) );
+
+ if ( aLineInfo.GetDashCount() > 0 && aLineInfo.GetDashLen() == 0 )
+ aLineInfo.SetDashLen(1);
+
+ if ( aLineInfo.GetDotCount() > 0 && aLineInfo.GetDotLen() == 0 )
+ aLineInfo.SetDotLen(1);
+
+ return aLineInfo;
+}
+
+ULONG DXFTransform::TransLineWidth(double fW) const
+{
+ double fex,fey;
+
+ fex=sqrt(aMX.fx*aMX.fx + aMX.fy*aMX.fy);
+ fey=sqrt(aMY.fx*aMY.fx + aMY.fy*aMY.fy);
+ // ###
+ // printf("fex=%f fey=%f\n", fex, fey);
+ return (ULONG)(fabs(fW)*(fex+fey)/2.0+0.5);
+}
+
+
+double DXFTransform::CalcRotAngle() const
+{
+ return atan2(aMX.fy,aMX.fx)/3.14159265359*180.0;
+}
+
+BOOL DXFTransform::Mirror() const
+{
+ if (aMZ.SProd(aMX*aMY)<0) return TRUE; else return FALSE;
+}
+
diff --git a/filter/source/graphicfilter/idxf/dxfvec.hxx b/filter/source/graphicfilter/idxf/dxfvec.hxx
new file mode 100644
index 000000000000..2f7734e5277f
--- /dev/null
+++ b/filter/source/graphicfilter/idxf/dxfvec.hxx
@@ -0,0 +1,261 @@
+/*************************************************************************
+ *
+ * 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 _DXFVEC_HXX
+#define _DXFVEC_HXX
+
+#include <tools/gen.hxx>
+#include <vcl/lineinfo.hxx>
+
+class DXFLineInfo {
+public:
+ LineStyle eStyle;
+ double fWidth;
+ sal_Int32 nDashCount;
+ double fDashLen;
+ sal_Int32 nDotCount;
+ double fDotLen;
+ double fDistance;
+
+ DXFLineInfo() :
+ eStyle(LINE_SOLID),
+ fWidth(0),
+ nDashCount(0),
+ fDashLen(0),
+ nDotCount(0),
+ fDotLen(0),
+ fDistance(0) {}
+
+ DXFLineInfo(const DXFLineInfo& x) :
+ eStyle(x.eStyle),
+ fWidth(x.fWidth),
+ nDashCount(x.nDashCount),
+ fDashLen(x.fDashLen),
+ nDotCount(x.nDotCount),
+ fDotLen(x.fDotLen),
+ fDistance(x.fDistance) {}
+
+};
+
+
+//------------------------------------------------------------------------------
+//---------------------------- DXFVector ---------------------------------------
+//------------------------------------------------------------------------------
+// Allgemeiner 3D-Vektor mit double
+
+class DXFVector {
+
+public:
+
+ double fx,fy,fz; // public ! - Warum nicht ?
+
+ inline DXFVector(double fX=0.0, double fY=0.0, double fZ=0.0);
+ inline DXFVector(const DXFVector & rV);
+
+ // Addition/Subtraktion:
+ DXFVector & operator += (const DXFVector & rV);
+ DXFVector operator + (const DXFVector & rV) const;
+ DXFVector & operator -= (const DXFVector & rV);
+ DXFVector operator - (const DXFVector & rV) const;
+
+ // Vektorprodukt
+ DXFVector operator * (const DXFVector & rV) const;
+
+ // Skalarprodukt:
+ double SProd(const DXFVector & rV) const;
+
+ // Multiplikation mit Skalar:
+ DXFVector & operator *= (double fs);
+ DXFVector operator * (double fs) const;
+
+ // Laenge:
+ double Abs() const;
+
+ // Vektor gleicher Richtung und der Laenge 1:
+ DXFVector Unit() const;
+
+ // Aequivalenz oder nicht:
+ BOOL operator == (const DXFVector & rV) const;
+ BOOL operator != (const DXFVector & rV) const;
+};
+
+//------------------------------------------------------------------------------
+//---------------------------- DXFTransform ------------------------------------
+//------------------------------------------------------------------------------
+// Eine Transformationsmatrix, spezialisiert auf unser Problem
+
+class DXFTransform {
+
+public:
+
+ DXFTransform();
+ // Zielkoordinate = Quellkoordinate
+
+ DXFTransform(double fScaleX, double fScaleY, double fScaleZ,
+ const DXFVector & rShift);
+ // Zielkoordinate = Verschoben(Skaliert(Quellkoorinate))
+
+ DXFTransform(double fScaleX, double fScaleY, double fScaleZ,
+ double fRotAngle,
+ const DXFVector & rShift);
+ // Zielkoordinate = Verschoben(Gedreht(Skaliert(Quellkoorinate)))
+ // Drehung geshieht um die Z-Achse, fRotAngle in Grad.
+
+ DXFTransform(const DXFVector & rExtrusion);
+ // Transformation "ECS->WCS" per "Entity Extrusion Direction"
+ // und dem "Arbitrary Axis Algorithm"
+ // (Siehe DXF-Docu von AutoDesk)
+
+ DXFTransform(const DXFVector & rViewDir, const DXFVector & rViewTarget);
+ // Transformation Objektraum->Bildraum anhand von Richtung und
+ // Zielpunkt eines ViewPort.
+ // (siehe DXF-Docu von AutoDesk: VPORT)
+
+ DXFTransform(const DXFTransform & rT1, const DXFTransform & rT2);
+ // Zielkoordinate = rT2(rT1(Quellkoorinate))
+
+
+ void Transform(const DXFVector & rSrc, DXFVector & rTgt) const;
+ // Transformation DXFVector nach DXFVector
+
+ void Transform(const DXFVector & rSrc, Point & rTgt) const;
+ // Transformation DXFVector nach SvPoint
+
+ void TransDir(const DXFVector & rSrc, DXFVector & rTgt) const;
+ // Transformation eines relativen Vektors (also kein Verschiebung)
+
+ BOOL TransCircleToEllipse(double fRadius, double & rEx, double & rEy) const;
+ // Versucht, einen Kreis (in der XY-Ebene) zu transformieren, so dass eine
+ // ausgerichtete Ellipse entsteht. Wenn das nicht geht, weil Ellipse
+ // in belibieger Lage entstehen wuerde, wird FALSE geliefert.
+ // (Der Mittelpunkt wird hiermit nicht transformiert, nehme Transform(..))
+
+ ULONG TransLineWidth(double fW) const;
+ // Transformiert die Liniendicke (so gut es geht)
+
+ double CalcRotAngle() const;
+ // Ermittelt den Rotationswinkel um die Z-Achse (in Grad)
+
+ BOOL Mirror() const;
+ // Liefert TRUE, wenn die Matrix ein Linkssystem bildet
+
+ LineInfo Transform(const DXFLineInfo& aDXFLineInfo) const;
+ // Transform to LineInfo
+
+private:
+ DXFVector aMX;
+ DXFVector aMY;
+ DXFVector aMZ;
+ DXFVector aMP;
+};
+
+//------------------------------------------------------------------------------
+//------------------------------- inlines --------------------------------------
+//------------------------------------------------------------------------------
+
+
+inline DXFVector::DXFVector(double fX, double fY, double fZ)
+{
+ fx=fX; fy=fY; fz=fZ;
+}
+
+
+inline DXFVector::DXFVector(const DXFVector & rV)
+{
+ fx=rV.fx; fy=rV.fy; fz=rV.fz;
+}
+
+
+inline DXFVector & DXFVector::operator += (const DXFVector & rV)
+{
+ fx+=rV.fx; fy+=rV.fy; fz+=rV.fz;
+ return *this;
+}
+
+
+inline DXFVector DXFVector::operator + (const DXFVector & rV) const
+{
+ return DXFVector(fx+rV.fx, fy+rV.fy, fz+rV.fz);
+}
+
+
+inline DXFVector & DXFVector::operator -= (const DXFVector & rV)
+{
+ fx-=rV.fx; fy-=rV.fy; fz-=rV.fz;
+ return *this;
+}
+
+
+inline DXFVector DXFVector::operator - (const DXFVector & rV) const
+{
+ return DXFVector(fx-rV.fx, fy-rV.fy, fz-rV.fz);
+}
+
+
+inline DXFVector DXFVector::operator * (const DXFVector & rV) const
+{
+ return DXFVector(
+ fy * rV.fz - fz * rV.fy,
+ fz * rV.fx - fx * rV.fz,
+ fx * rV.fy - fy * rV.fx
+ );
+}
+
+
+inline double DXFVector::SProd(const DXFVector & rV) const
+{
+ return fx*rV.fx + fy*rV.fy + fz*rV.fz;
+}
+
+
+inline DXFVector & DXFVector::operator *= (double fs)
+{
+ fx*=fs; fy*=fs; fz*=fs;
+ return *this;
+}
+
+
+inline DXFVector DXFVector::operator * (double fs) const
+{
+ return DXFVector(fx*fs,fy*fs,fz*fs);
+}
+
+
+inline BOOL DXFVector::operator == (const DXFVector & rV) const
+{
+ if (fx==rV.fx && fy==rV.fy && fz==rV.fz) return TRUE;
+ else return FALSE;
+}
+
+
+inline BOOL DXFVector::operator != (const DXFVector & rV) const
+{
+ if (fx!=rV.fx || fy!=rV.fy || fz!=rV.fz) return TRUE;
+ else return FALSE;
+}
+
+#endif
diff --git a/filter/source/graphicfilter/idxf/exports.map b/filter/source/graphicfilter/idxf/exports.map
new file mode 100644
index 000000000000..941e4ab9bde8
--- /dev/null
+++ b/filter/source/graphicfilter/idxf/exports.map
@@ -0,0 +1,7 @@
+UDK_3_0_0 {
+ global:
+ GraphicImport;
+
+ local:
+ *;
+};
diff --git a/filter/source/graphicfilter/idxf/idxf.cxx b/filter/source/graphicfilter/idxf/idxf.cxx
new file mode 100644
index 000000000000..149f4c2feb78
--- /dev/null
+++ b/filter/source/graphicfilter/idxf/idxf.cxx
@@ -0,0 +1,82 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include <string.h>
+#include <vcl/gdimtf.hxx>
+#include <vcl/graph.hxx>
+#include <vcl/virdev.hxx>
+#include "dxf2mtf.hxx"
+#include <math.h>
+
+//================== GraphicImport - die exportierte Funktion ================
+
+extern "C" BOOL __LOADONCALLAPI GraphicImport(SvStream & rStream, Graphic & rGraphic, FilterConfigItem*, BOOL )
+{
+ DXFRepresentation aDXF;
+ DXF2GDIMetaFile aConverter;
+ GDIMetaFile aMTF;
+
+ if ( aDXF.Read( rStream, 0, 60 ) == FALSE )
+ return FALSE;
+ if ( aConverter.Convert( aDXF, aMTF, 60, 100 ) == FALSE )
+ return FALSE;
+ rGraphic=Graphic(aMTF);
+
+ return TRUE;
+}
+
+//============================= fuer Windows ==================================
+#ifndef GCC
+#endif
+
+#ifdef WIN
+
+static HINSTANCE hDLLInst = 0; // HANDLE der DLL
+
+extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR )
+{
+#ifndef WNT
+ if ( nHeap )
+ UnlockData( 0 );
+#endif
+
+ hDLLInst = hDLL;
+
+ return TRUE;
+}
+
+extern "C" int CALLBACK WEP( int )
+{
+ return 1;
+}
+
+#endif
+
+
diff --git a/filter/source/graphicfilter/idxf/makefile.mk b/filter/source/graphicfilter/idxf/makefile.mk
new file mode 100644
index 000000000000..046f0765a74e
--- /dev/null
+++ b/filter/source/graphicfilter/idxf/makefile.mk
@@ -0,0 +1,79 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=filter
+TARGET=idxf
+DEPTARGET=vidxf
+
+# --- Settings -----------------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Allgemein ----------------------------------------------------------
+
+.IF "$(editdebug)"!="" || "$(EDITDEBUG)"!=""
+CDEFS+= -DEDITDEBUG
+.ENDIF
+.IF "$(L10N_framework)"==""
+EXCEPTIONSFILES=\
+ $(SLO)$/dxfentrd.obj \
+ $(SLO)$/dxf2mtf.obj
+
+SLOFILES = $(SLO)$/dxfgrprd.obj \
+ $(SLO)$/dxfvec.obj \
+ $(SLO)$/dxfentrd.obj \
+ $(SLO)$/dxfblkrd.obj \
+ $(SLO)$/dxftblrd.obj \
+ $(SLO)$/dxfreprd.obj \
+ $(SLO)$/dxf2mtf.obj \
+ $(SLO)$/idxf.obj
+
+# ==========================================================================
+
+SHL1TARGET= idx$(DLLPOSTFIX)
+SHL1IMPLIB= idxf
+SHL1STDLIBS= $(VCLLIB) $(TOOLSLIB) $(SALLIB)
+
+SHL1LIBS= $(SLB)$/idxf.lib # $(LB)$/rtftoken.lib
+
+.IF "$(GUI)" != "UNX"
+.IF "$(COM)" != "GCC"
+SHL1OBJS= $(SLO)$/idxf.obj
+.ENDIF
+.ENDIF
+
+SHL1VERSIONMAP=exports.map
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+
+DEF1NAME=$(SHL1TARGET)
+.ENDIF
+
+# ==========================================================================
+
+.INCLUDE : target.mk
diff --git a/filter/source/graphicfilter/ieps/exports.map b/filter/source/graphicfilter/ieps/exports.map
new file mode 100644
index 000000000000..941e4ab9bde8
--- /dev/null
+++ b/filter/source/graphicfilter/ieps/exports.map
@@ -0,0 +1,7 @@
+UDK_3_0_0 {
+ global:
+ GraphicImport;
+
+ local:
+ *;
+};
diff --git a/filter/source/graphicfilter/ieps/ieps.cxx b/filter/source/graphicfilter/ieps/ieps.cxx
new file mode 100644
index 000000000000..097fc83e35fe
--- /dev/null
+++ b/filter/source/graphicfilter/ieps/ieps.cxx
@@ -0,0 +1,771 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include <stdio.h>
+
+//
+#include <vcl/sv.h>
+#include <vcl/svapp.hxx>
+#include <vcl/bitmap.hxx>
+#include <vcl/bitmapex.hxx>
+#include <vcl/animate.hxx>
+#include <vcl/gdimtf.hxx>
+#include <vcl/graph.h>
+#include <vcl/window.hxx>
+#include <vcl/graph.hxx>
+#include <vcl/metaact.hxx>
+#include <vcl/gdimtf.hxx>
+#include <vcl/virdev.hxx>
+#include <vcl/cvtgrf.hxx>
+#include <vcl/bmpacc.hxx>
+#include <svtools/fltcall.hxx>
+#include <tools/urlobj.hxx>
+#include <tools/tempfile.hxx>
+#include <osl/process.h>
+#include <osl/file.hxx>
+
+/*************************************************************************
+|*
+|* ImpSearchEntry()
+|*
+|* Beschreibung Prueft ob im Speicherbereich pSource der nComp Bytes
+|* gross ist eine Zeichenkette(pDest) mit der l�nge nSize
+|* liegt. Geprueft wird NON-CASE-SENSITIVE und der Rueck-
+|* gabewert ist die Adresse an der die Zeichekette gefunden
+|* wurde oder NULL
+|*
+|* Ersterstellung SJ 04.03.98 ( und das an meinem Geburtstag )
+|* Letzte Aenderung SJ 04.03.98
+|*
+*************************************************************************/
+
+static BYTE* ImplSearchEntry( BYTE* pSource, BYTE* pDest, ULONG nComp, ULONG nSize )
+{
+ while ( nComp-- >= nSize )
+ {
+ ULONG i;
+ for ( i = 0; i < nSize; i++ )
+ {
+ if ( ( pSource[i]&~0x20 ) != ( pDest[i]&~0x20 ) )
+ break;
+ }
+ if ( i == nSize )
+ return pSource;
+ pSource++;
+ }
+ return NULL;
+}
+
+//--------------------------------------------------------------------------
+// SecurityCount is the buffersize of the buffer in which we will parse for a number
+static long ImplGetNumber( BYTE **pBuf, int& nSecurityCount )
+{
+ BOOL bValid = TRUE;
+ BOOL bNegative = FALSE;
+ long nRetValue = 0;
+ while ( ( --nSecurityCount ) && ( ( **pBuf == ' ' ) || ( **pBuf == 0x9 ) ) )
+ (*pBuf)++;
+ BYTE nByte = **pBuf;
+ while ( nSecurityCount && ( nByte != ' ' ) && ( nByte != 0x9 ) && ( nByte != 0xd ) && ( nByte != 0xa ) )
+ {
+ switch ( nByte )
+ {
+ case '.' :
+ // we'll only use the integer format
+ bValid = FALSE;
+ break;
+ case '-' :
+ bNegative = TRUE;
+ break;
+ default :
+ if ( ( nByte < '0' ) || ( nByte > '9' ) )
+ nSecurityCount = 1; // error parsing the bounding box values
+ else if ( bValid )
+ {
+ nRetValue *= 10;
+ nRetValue += nByte - '0';
+ }
+ break;
+ }
+ nSecurityCount--;
+ nByte = *(++(*pBuf));
+ }
+ if ( bNegative )
+ nRetValue = -nRetValue;
+ return nRetValue;
+}
+
+//--------------------------------------------------------------------------
+
+static int ImplGetLen( BYTE* pBuf, int nMax )
+{
+ int nLen = 0;
+ while( nLen != nMax )
+ {
+ BYTE nDat = *pBuf++;
+ if ( nDat == 0x0a || nDat == 0x25 )
+ break;
+ nLen++;
+ }
+ return nLen;
+}
+
+static void MakeAsMeta(Graphic &rGraphic)
+{
+ VirtualDevice aVDev;
+ GDIMetaFile aMtf;
+ Bitmap aBmp( rGraphic.GetBitmap() );
+ Size aSize = aBmp.GetPrefSize();
+
+ if( !aSize.Width() || !aSize.Height() )
+ aSize = Application::GetDefaultDevice()->PixelToLogic(
+ aBmp.GetSizePixel(), MAP_100TH_MM );
+ else
+ aSize = Application::GetDefaultDevice()->LogicToLogic( aSize,
+ aBmp.GetPrefMapMode(), MAP_100TH_MM );
+
+ aVDev.EnableOutput( FALSE );
+ aMtf.Record( &aVDev );
+ aVDev.DrawBitmap( Point(), aSize, rGraphic.GetBitmap() );
+ aMtf.Stop();
+ aMtf.WindStart();
+ aMtf.SetPrefMapMode( MAP_100TH_MM );
+ aMtf.SetPrefSize( aSize );
+ rGraphic = aMtf;
+}
+
+static oslProcessError runProcessWithPathSearch(const rtl::OUString &rProgName,
+ rtl_uString* pArgs[], sal_uInt32 nArgs, oslProcess *pProcess,
+ oslFileHandle *pIn, oslFileHandle *pOut, oslFileHandle *pErr)
+{
+#ifdef WNT
+ /*
+ * ooo#72096
+ * On Window the underlying SearchPath searches in order of...
+ * The directory from which the application loaded.
+ * The current directory.
+ * The Windows system directory.
+ * The Windows directory.
+ * The directories that are listed in the PATH environment variable.
+ *
+ * Because one of our programs is called "convert" and there is a convert
+ * in the windows system directory, we want to explicitly search the PATH
+ * to avoid picking up on that one if ImageMagick's convert preceeds it in
+ * PATH.
+ *
+ */
+ rtl::OUString url;
+ rtl::OUString path(reinterpret_cast<const sal_Unicode*>(_wgetenv(L"PATH")));
+
+ oslFileError err = osl_searchFileURL(rProgName.pData, path.pData, &url.pData);
+ if (err != osl_File_E_None)
+ return osl_Process_E_NotFound;
+ return osl_executeProcess_WithRedirectedIO(url.pData,
+ pArgs, nArgs, osl_Process_HIDDEN,
+ osl_getCurrentSecurity(), 0, 0, 0, pProcess, pIn, pOut, pErr);
+#else
+ return osl_executeProcess_WithRedirectedIO(rProgName.pData,
+ pArgs, nArgs, osl_Process_SEARCHPATH | osl_Process_HIDDEN,
+ osl_getCurrentSecurity(), 0, 0, 0, pProcess, pIn, pOut, pErr);
+#endif
+}
+
+#if defined(WNT) || defined(OS2)
+# define EXESUFFIX ".exe"
+#else
+# define EXESUFFIX ""
+#endif
+
+static bool RenderAsEMF(const sal_uInt8* pBuf, sal_uInt32 nBytesRead, Graphic &rGraphic)
+{
+ TempFile aTemp;
+ aTemp.EnableKillingFile();
+ rtl::OUString fileName =
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("pstoedit"EXESUFFIX));
+ rtl::OUString arg1 =
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-f"));
+ rtl::OUString arg2 =
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("emf:-OO"));
+ rtl::OUString arg3 =
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-"));
+ rtl::OUString output;
+ osl::FileBase::getSystemPathFromFileURL(aTemp.GetName(), output);
+ rtl_uString *args[] =
+ {
+ arg1.pData, arg2.pData, arg3.pData, output.pData
+ };
+ oslProcess aProcess;
+ oslFileHandle pIn = NULL;
+ oslFileHandle pOut = NULL;
+ oslFileHandle pErr = NULL;
+ oslProcessError eErr = runProcessWithPathSearch(fileName,
+ args, sizeof(args)/sizeof(rtl_uString *),
+ &aProcess, &pIn, &pOut, &pErr);
+
+ if (eErr!=osl_Process_E_None)
+ return false;
+
+ bool bRet = false;
+ sal_uInt64 nCount;
+ osl_writeFile(pIn, pBuf, nBytesRead, &nCount);
+ if (pIn) osl_closeFile(pIn);
+ bool bEMFSupported=true;
+ if (pOut)
+ {
+ rtl::ByteSequence seq;
+ if (osl_File_E_None == osl_readLine(pOut, (sal_Sequence **)&seq))
+ {
+ rtl::OString line( (const sal_Char *) seq.getConstArray(), seq.getLength() );
+ if (line.indexOf(rtl::OString("Unsupported output format")) == 0)
+ bEMFSupported=false;
+ }
+ osl_closeFile(pOut);
+ }
+ if (pErr) osl_closeFile(pErr);
+ if (nCount == nBytesRead && bEMFSupported)
+ {
+ SvFileStream aFile(output, STREAM_READ);
+ if (GraphicConverter::Import(aFile, rGraphic, CVT_EMF) == ERRCODE_NONE)
+ bRet = true;
+ }
+ osl_joinProcess(aProcess);
+ osl_freeProcessHandle(aProcess);
+ return bRet;
+}
+
+static bool RenderAsPNGThroughHelper(const sal_uInt8* pBuf, sal_uInt32 nBytesRead,
+ Graphic &rGraphic, rtl::OUString &rProgName, rtl_uString *pArgs[], size_t nArgs)
+{
+ oslProcess aProcess;
+ oslFileHandle pIn = NULL;
+ oslFileHandle pOut = NULL;
+ oslFileHandle pErr = NULL;
+ oslProcessError eErr = runProcessWithPathSearch(rProgName,
+ pArgs, nArgs,
+ &aProcess, &pIn, &pOut, &pErr);
+ if (eErr!=osl_Process_E_None)
+ return false;
+
+ bool bRet = false;
+ sal_uInt64 nCount;
+ osl_writeFile(pIn, pBuf, nBytesRead, &nCount);
+ if (pIn) osl_closeFile(pIn);
+ if (nCount == nBytesRead)
+ {
+ SvMemoryStream aMemStm;
+ sal_uInt8 aBuf[32000];
+ oslFileError eFileErr = osl_readFile(pOut, aBuf, 32000, &nCount);
+ while (eFileErr == osl_File_E_None && nCount)
+ {
+ aMemStm.Write(aBuf, sal::static_int_cast< sal_Size >(nCount));
+ eFileErr = osl_readFile(pOut, aBuf, 32000, &nCount);
+ }
+
+ aMemStm.Seek(0);
+ if (
+ aMemStm.GetEndOfData() &&
+ GraphicConverter::Import(aMemStm, rGraphic, CVT_PNG) == ERRCODE_NONE
+ )
+ {
+ MakeAsMeta(rGraphic);
+ bRet = true;
+ }
+ }
+ if (pOut) osl_closeFile(pOut);
+ if (pErr) osl_closeFile(pErr);
+ osl_joinProcess(aProcess);
+ osl_freeProcessHandle(aProcess);
+ return bRet;
+}
+
+static bool RenderAsPNGThroughConvert(const sal_uInt8* pBuf, sal_uInt32 nBytesRead,
+ Graphic &rGraphic)
+{
+ rtl::OUString fileName =
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("convert"EXESUFFIX));
+ // density in pixel/inch
+ rtl::OUString arg1 = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-density"));
+ // since the preview is also used for PDF-Export & printing on non-PS-printers,
+ // use some better quality - 300x300 should allow some resizing as well
+ rtl::OUString arg2 = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("300x300"));
+ // read eps from STDIN
+ rtl::OUString arg3 = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("eps:-"));
+ // write png to STDOUT
+ rtl::OUString arg4 = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("png:-"));
+ rtl_uString *args[] =
+ {
+ arg1.pData, arg2.pData, arg3.pData, arg4.pData
+ };
+ return RenderAsPNGThroughHelper(pBuf, nBytesRead, rGraphic, fileName, args,
+ sizeof(args)/sizeof(rtl_uString *));
+}
+
+static bool RenderAsPNGThroughGS(const sal_uInt8* pBuf, sal_uInt32 nBytesRead,
+ Graphic &rGraphic)
+{
+#ifdef WNT
+ rtl::OUString fileName =
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("gswin32c"EXESUFFIX));
+#else
+ rtl::OUString fileName =
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("gs"EXESUFFIX));
+#endif
+ rtl::OUString arg1 =
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-q"));
+ rtl::OUString arg2 =
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-dBATCH"));
+ rtl::OUString arg3 =
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-dNOPAUSE"));
+ rtl::OUString arg4 =
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-dPARANOIDSAFER"));
+ rtl::OUString arg5 =
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-dEPSCrop"));
+ rtl::OUString arg6 =
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-dTextAlphaBits=4"));
+ rtl::OUString arg7 =
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-dGraphicsAlphaBits=4"));
+ rtl::OUString arg8 =
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-r300x300"));
+ rtl::OUString arg9 =
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-sDEVICE=png256"));
+ rtl::OUString arg10 =
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-sOutputFile=-"));
+ rtl::OUString arg11 =
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-"));
+ rtl_uString *args[] =
+ {
+ arg1.pData, arg2.pData, arg3.pData, arg4.pData, arg5.pData,
+ arg6.pData, arg7.pData, arg8.pData, arg9.pData, arg10.pData,
+ arg11.pData
+ };
+ return RenderAsPNGThroughHelper(pBuf, nBytesRead, rGraphic, fileName, args,
+ sizeof(args)/sizeof(rtl_uString *));
+}
+
+static bool RenderAsPNG(const sal_uInt8* pBuf, sal_uInt32 nBytesRead, Graphic &rGraphic)
+{
+ if (RenderAsPNGThroughConvert(pBuf, nBytesRead, rGraphic))
+ return true;
+ else
+ return RenderAsPNGThroughGS(pBuf, nBytesRead, rGraphic);
+}
+
+// this method adds a replacement action containing the original wmf or tiff replacement,
+// so the original eps can be written when storing to ODF.
+void CreateMtfReplacementAction( GDIMetaFile& rMtf, SvStream& rStrm, sal_uInt32 nOrigPos, sal_uInt32 nPSSize,
+ sal_uInt32 nPosWMF, sal_uInt32 nSizeWMF, sal_uInt32 nPosTIFF, sal_uInt32 nSizeTIFF )
+{
+ ByteString aComment( (const sal_Char*)"EPSReplacementGraphic" );
+ if ( nSizeWMF || nSizeTIFF )
+ {
+ SvMemoryStream aReplacement( nSizeWMF + nSizeTIFF + 28 );
+ sal_uInt32 nMagic = 0xc6d3d0c5;
+ sal_uInt32 nPPos = 28 + nSizeWMF + nSizeTIFF;
+ sal_uInt32 nWPos = nSizeWMF ? 28 : 0;
+ sal_uInt32 nTPos = nSizeTIFF ? 28 + nSizeWMF : 0;
+
+ aReplacement << nMagic << nPPos << nPSSize
+ << nWPos << nSizeWMF
+ << nTPos << nSizeTIFF;
+ if ( nSizeWMF )
+ {
+ sal_uInt8* pBuf = new sal_uInt8[ nSizeWMF ];
+ rStrm.Seek( nOrigPos + nPosWMF );
+ rStrm.Read( pBuf, nSizeWMF );
+ aReplacement.Write( pBuf, nSizeWMF );
+ delete[] pBuf;
+ }
+ if ( nSizeTIFF )
+ {
+ sal_uInt8* pBuf = new sal_uInt8[ nSizeTIFF ];
+ rStrm.Seek( nOrigPos + nPosTIFF );
+ rStrm.Read( pBuf, nSizeTIFF );
+ aReplacement.Write( pBuf, nSizeTIFF );
+ delete[] pBuf;
+ }
+ rMtf.AddAction( (MetaAction*)( new MetaCommentAction( aComment, 0, (const BYTE*)aReplacement.GetData(), aReplacement.Tell() ) ) );
+ }
+ else
+ rMtf.AddAction( (MetaAction*)( new MetaCommentAction( aComment, 0, NULL, 0 ) ) );
+}
+
+//there is no preview -> make a red box
+void MakePreview(sal_uInt8* pBuf, sal_uInt32 nBytesRead,
+ long nWidth, long nHeight, Graphic &rGraphic)
+{
+ GDIMetaFile aMtf;
+ VirtualDevice aVDev;
+ Font aFont;
+
+ aVDev.EnableOutput( FALSE );
+ aMtf.Record( &aVDev );
+ aVDev.SetLineColor( Color( COL_RED ) );
+ aVDev.SetFillColor();
+
+ aFont.SetColor( COL_LIGHTRED );
+// aFont.SetSize( Size( 0, 32 ) );
+
+ aVDev.Push( PUSH_FONT );
+ aVDev.SetFont( aFont );
+
+ Rectangle aRect( Point( 1, 1 ), Size( nWidth - 2, nHeight - 2 ) );
+ aVDev.DrawRect( aRect );
+
+ String aString;
+ int nLen;
+ BYTE* pDest = ImplSearchEntry( pBuf, (BYTE*)"%%Title:", nBytesRead - 32, 8 );
+ if ( pDest )
+ {
+ pDest += 8;
+ if ( *pDest == ' ' )
+ pDest++;
+ nLen = ImplGetLen( pDest, 32 );
+ BYTE aOldValue(pDest[ nLen ]); pDest[ nLen ] = 0;
+ if ( strcmp( (const char*)pDest, "none" ) != 0 )
+ {
+ aString.AppendAscii( " Title:" );
+ aString.AppendAscii( (char*)pDest );
+ aString.AppendAscii( "\n" );
+ }
+ pDest[ nLen ] = aOldValue;
+ }
+ pDest = ImplSearchEntry( pBuf, (BYTE*)"%%Creator:", nBytesRead - 32, 10 );
+ if ( pDest )
+ {
+ pDest += 10;
+ if ( *pDest == ' ' )
+ pDest++;
+ nLen = ImplGetLen( pDest, 32 );
+ BYTE aOldValue(pDest[ nLen ]); pDest[ nLen ] = 0;
+ aString.AppendAscii( " Creator:" );
+ aString.AppendAscii( (char*)pDest );
+ aString.AppendAscii( "\n" );
+ pDest[ nLen ] = aOldValue;
+ }
+ pDest = ImplSearchEntry( pBuf, (BYTE*)"%%CreationDate:", nBytesRead - 32, 15 );
+ if ( pDest )
+ {
+ pDest += 15;
+ if ( *pDest == ' ' )
+ pDest++;
+ nLen = ImplGetLen( pDest, 32 );
+ BYTE aOldValue(pDest[ nLen ]); pDest[ nLen ] = 0;
+ if ( strcmp( (const char*)pDest, "none" ) != 0 )
+ {
+ aString.AppendAscii( " CreationDate:" );
+ aString.AppendAscii( (char*)pDest );
+ aString.AppendAscii( "\n" );
+ }
+ pDest[ nLen ] = aOldValue;
+ }
+ pDest = ImplSearchEntry( pBuf, (BYTE*)"%%LanguageLevel:", nBytesRead - 4, 16 );
+ if ( pDest )
+ {
+ pDest += 16;
+ int nCount = 4;
+ long nNumber = ImplGetNumber( &pDest, nCount );
+ if ( nCount && ( (UINT32)nNumber < 10 ) )
+ {
+ aString.AppendAscii( " LanguageLevel:" );
+ aString.Append( UniString::CreateFromInt32( nNumber ) );
+ }
+ }
+ aVDev.DrawText( aRect, aString, TEXT_DRAW_CLIP | TEXT_DRAW_MULTILINE );
+ aVDev.Pop();
+ aMtf.Stop();
+ aMtf.WindStart();
+ aMtf.SetPrefMapMode( MAP_POINT );
+ aMtf.SetPrefSize( Size( nWidth, nHeight ) );
+ rGraphic = aMtf;
+}
+
+
+//================== GraphicImport - die exportierte Funktion ================
+
+#ifdef WNT
+extern "C" BOOL _cdecl GraphicImport(SvStream & rStream, Graphic & rGraphic, FilterConfigItem*, BOOL)
+#else
+extern "C" BOOL GraphicImport(SvStream & rStream, Graphic & rGraphic, FilterConfigItem*, BOOL)
+#endif
+{
+ if ( rStream.GetError() )
+ return FALSE;
+
+ Graphic aGraphic;
+ sal_Bool bRetValue = sal_False;
+ sal_Bool bHasPreview = sal_False;
+ sal_Bool bGraphicLinkCreated = sal_False;
+ sal_uInt32 nSignature, nPSStreamPos, nPSSize;
+ sal_uInt32 nSizeWMF = 0;
+ sal_uInt32 nPosWMF = 0;
+ sal_uInt32 nSizeTIFF = 0;
+ sal_uInt32 nPosTIFF = 0;
+ sal_uInt32 nOrigPos = nPSStreamPos = rStream.Tell();
+ sal_uInt16 nOldFormat = rStream.GetNumberFormatInt();
+ rStream.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
+ rStream >> nSignature;
+ if ( nSignature == 0xc6d3d0c5 )
+ {
+ rStream >> nPSStreamPos >> nPSSize >> nPosWMF >> nSizeWMF;
+
+ // first we try to get the metafile grafix
+
+ if ( nSizeWMF )
+ {
+ if ( nPosWMF != 0 )
+ {
+ rStream.Seek( nOrigPos + nPosWMF );
+ if ( GraphicConverter::Import( rStream, aGraphic, CVT_WMF ) == ERRCODE_NONE )
+ bHasPreview = bRetValue = TRUE;
+ }
+ }
+ else
+ {
+ rStream >> nPosTIFF >> nSizeTIFF;
+
+ // else we have to get the tiff grafix
+
+ if ( nPosTIFF && nSizeTIFF )
+ {
+ rStream.Seek( nOrigPos + nPosTIFF );
+ if ( GraphicConverter::Import( rStream, aGraphic, CVT_TIF ) == ERRCODE_NONE )
+ {
+ MakeAsMeta(aGraphic);
+ rStream.Seek( nOrigPos + nPosTIFF );
+ bHasPreview = bRetValue = TRUE;
+ }
+ }
+ }
+ }
+ else
+ {
+ nPSStreamPos = nOrigPos; // no preview available _>so we must get the size manually
+ nPSSize = rStream.Seek( STREAM_SEEK_TO_END ) - nOrigPos;
+ }
+ sal_uInt8* pHeader = new sal_uInt8[ 22 ];
+ rStream.Seek( nPSStreamPos );
+ rStream.Read( pHeader, 22 ); // check PostScript header
+ if ( ImplSearchEntry( pHeader, (BYTE*)"%!PS-Adobe", 10, 10 ) &&
+ ImplSearchEntry( &pHeader[ 15 ], (BYTE*)"EPS", 3, 3 ) )
+ {
+ rStream.Seek( nPSStreamPos );
+ sal_uInt8* pBuf = new sal_uInt8[ nPSSize ];
+ if ( pBuf )
+ {
+ sal_uInt32 nBufStartPos = rStream.Tell();
+ sal_uInt32 nBytesRead = rStream.Read( pBuf, nPSSize );
+ if ( nBytesRead == nPSSize )
+ {
+ int nSecurityCount = 32;
+ if ( !bHasPreview ) // if there is no tiff/wmf preview, we will parse for an preview in the eps prolog
+ {
+ BYTE* pDest = ImplSearchEntry( pBuf, (BYTE*)"%%BeginPreview:", nBytesRead - 32, 15 );
+ if ( pDest )
+ {
+ pDest += 15;
+ long nWidth = ImplGetNumber( &pDest, nSecurityCount );
+ long nHeight = ImplGetNumber( &pDest, nSecurityCount );
+ long nBitDepth = ImplGetNumber( &pDest, nSecurityCount );
+ long nScanLines = ImplGetNumber( &pDest, nSecurityCount );
+ pDest = ImplSearchEntry( pDest, (BYTE*)"%", 16, 1 ); // go to the first Scanline
+ if ( nSecurityCount && pDest && nWidth && nHeight && ( ( nBitDepth == 1 ) || ( nBitDepth == 8 ) ) && nScanLines )
+ {
+ rStream.Seek( nBufStartPos + ( pDest - pBuf ) );
+
+ Bitmap aBitmap( Size( nWidth, nHeight ), 1 );
+ BitmapWriteAccess* pAcc = aBitmap.AcquireWriteAccess();
+ if ( pAcc )
+ {
+ int nBitsLeft;
+ BOOL bIsValid = TRUE;
+ BYTE nDat = 0;
+ char nByte;
+ for ( long y = 0; bIsValid && ( y < nHeight ); y++ )
+ {
+ nBitsLeft = 0;
+ for ( long x = 0; x < nWidth; x++ )
+ {
+ if ( --nBitsLeft < 0 )
+ {
+ while ( bIsValid && ( nBitsLeft != 7 ) )
+ {
+ rStream >> nByte;
+ switch ( nByte )
+ {
+ case 0x0a :
+ if ( --nScanLines < 0 )
+ bIsValid = FALSE;
+ case 0x09 :
+ case 0x0d :
+ case 0x20 :
+ case 0x25 :
+ break;
+ default:
+ {
+ if ( nByte >= '0' )
+ {
+ if ( nByte > '9' )
+ {
+ nByte &=~0x20; // case none sensitive for hexadezimal values
+ nByte -= ( 'A' - 10 );
+ if ( nByte > 15 )
+ bIsValid = FALSE;
+ }
+ else
+ nByte -= '0';
+ nBitsLeft += 4;
+ nDat <<= 4;
+ nDat |= ( nByte ^ 0xf ); // in epsi a zero bit represents white color
+ }
+ else
+ bIsValid = FALSE;
+ }
+ break;
+ }
+ }
+ }
+ if ( nBitDepth == 1 )
+ pAcc->SetPixel( y, x, sal::static_int_cast< BYTE >(( nDat >> nBitsLeft ) & 1) );
+ else
+ {
+ pAcc->SetPixel( y, x, ( nDat ) ? 1 : 0 ); // nBitDepth == 8
+ nBitsLeft = 0;
+ }
+ }
+ }
+ if ( bIsValid )
+ {
+ VirtualDevice aVDev;
+ GDIMetaFile aMtf;
+ Size aSize;
+ aVDev.EnableOutput( FALSE );
+ aMtf.Record( &aVDev );
+ aSize = aBitmap.GetPrefSize();
+ if( !aSize.Width() || !aSize.Height() )
+ aSize = Application::GetDefaultDevice()->PixelToLogic( aBitmap.GetSizePixel(), MAP_100TH_MM );
+ else
+ aSize = Application::GetDefaultDevice()->LogicToLogic( aSize, aBitmap.GetPrefMapMode(), MAP_100TH_MM );
+ aVDev.DrawBitmap( Point(), aSize, aBitmap );
+ aMtf.Stop();
+ aMtf.WindStart();
+ aMtf.SetPrefMapMode( MAP_100TH_MM );
+ aMtf.SetPrefSize( aSize );
+ aGraphic = aMtf;
+ bHasPreview = bRetValue = TRUE;
+ }
+ aBitmap.ReleaseAccess( pAcc );
+ }
+ }
+ }
+ }
+
+ BYTE* pDest = ImplSearchEntry( pBuf, (BYTE*)"%%BoundingBox:", nBytesRead, 14 );
+ if ( pDest )
+ {
+ nSecurityCount = 100;
+ long nNumb[4];
+ nNumb[0] = nNumb[1] = nNumb[2] = nNumb[3] = 0;
+ pDest += 14;
+ for ( int i = 0; ( i < 4 ) && nSecurityCount; i++ )
+ {
+ nNumb[ i ] = ImplGetNumber( &pDest, nSecurityCount );
+ }
+ if ( nSecurityCount)
+ {
+ bGraphicLinkCreated = sal_True;
+ GfxLink aGfxLink( pBuf, nPSSize, GFX_LINK_TYPE_EPS_BUFFER, TRUE ) ;
+ GDIMetaFile aMtf;
+
+ long nWidth = nNumb[2] - nNumb[0] + 1;
+ long nHeight = nNumb[3] - nNumb[1] + 1;
+
+ // if there is no preview -> try with gs to make one
+ if( !bHasPreview )
+ {
+ bHasPreview = RenderAsEMF(pBuf, nBytesRead, aGraphic);
+ if (!bHasPreview)
+ bHasPreview = RenderAsPNG(pBuf, nBytesRead, aGraphic);
+ }
+
+ // if there is no preview -> make a red box
+ if( !bHasPreview )
+ {
+ MakePreview(pBuf, nBytesRead, nWidth, nHeight,
+ aGraphic);
+ }
+
+ aMtf.AddAction( (MetaAction*)( new MetaEPSAction( Point(), Size( nWidth, nHeight ),
+ aGfxLink, aGraphic.GetGDIMetaFile() ) ) );
+ CreateMtfReplacementAction( aMtf, rStream, nOrigPos, nPSSize, nPosWMF, nSizeWMF, nPosTIFF, nSizeTIFF );
+ aMtf.WindStart();
+ aMtf.SetPrefMapMode( MAP_POINT );
+ aMtf.SetPrefSize( Size( nWidth, nHeight ) );
+ rGraphic = aMtf;
+ bRetValue = sal_True;
+ }
+ }
+ }
+ }
+ if ( !bGraphicLinkCreated )
+ delete[] pBuf;
+ }
+ delete[] pHeader;
+ rStream.SetNumberFormatInt(nOldFormat);
+ rStream.Seek( nOrigPos );
+ return ( bRetValue );
+}
+
+//================== ein bischen Muell fuer Windows ==========================
+#ifndef GCC
+#endif
+
+#ifdef WIN
+
+static HINSTANCE hDLLInst = 0; // HANDLE der DLL
+
+extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR )
+{
+#ifndef WNT
+ if ( nHeap )
+ UnlockData( 0 );
+#endif
+
+ hDLLInst = hDLL;
+
+ return TRUE;
+}
+
+extern "C" int CALLBACK WEP( int )
+{
+ return 1;
+}
+
+#endif
+
diff --git a/filter/source/graphicfilter/ieps/makefile.mk b/filter/source/graphicfilter/ieps/makefile.mk
new file mode 100644
index 000000000000..7d8fdb6e5337
--- /dev/null
+++ b/filter/source/graphicfilter/ieps/makefile.mk
@@ -0,0 +1,66 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=filter
+TARGET=ieps
+DEPTARGET=vieps
+
+# --- Settings -----------------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Allgemein ----------------------------------------------------------
+
+.IF "$(editdebug)"!="" || "$(EDITDEBUG)"!=""
+CDEFS+= -DEDITDEBUG
+.ENDIF
+.IF "$(L10N_framework)"==""
+SLOFILES = $(SLO)$/ieps.obj
+
+# ==========================================================================
+
+SHL1TARGET= ips$(DLLPOSTFIX)
+SHL1IMPLIB= ieps
+SHL1STDLIBS= $(VCLLIB) $(TOOLSLIB) $(SALLIB)
+SHL1LIBS= $(SLB)$/ieps.lib
+
+.IF "$(GUI)" != "UNX"
+.IF "$(COM)" != "GCC"
+SHL1OBJS= $(SLO)$/ieps.obj
+.ENDIF
+.ENDIF
+
+SHL1VERSIONMAP=exports.map
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+
+DEF1NAME=$(SHL1TARGET)
+.ENDIF
+# ==========================================================================
+
+.INCLUDE : target.mk
diff --git a/filter/source/graphicfilter/ios2met/exports.map b/filter/source/graphicfilter/ios2met/exports.map
new file mode 100644
index 000000000000..941e4ab9bde8
--- /dev/null
+++ b/filter/source/graphicfilter/ios2met/exports.map
@@ -0,0 +1,7 @@
+UDK_3_0_0 {
+ global:
+ GraphicImport;
+
+ local:
+ *;
+};
diff --git a/filter/source/graphicfilter/ios2met/ios2met.cxx b/filter/source/graphicfilter/ios2met/ios2met.cxx
new file mode 100644
index 000000000000..6cab0cdc4e18
--- /dev/null
+++ b/filter/source/graphicfilter/ios2met/ios2met.cxx
@@ -0,0 +1,2784 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include <vcl/graph.hxx>
+#include <tools/poly.hxx>
+#include <vcl/virdev.hxx>
+#include <vcl/lineinfo.hxx>
+#include <svtools/fltcall.hxx>
+
+#include <math.h>
+
+// MT: NOOLDSV, someone should change the code...
+enum PenStyle { PEN_NULL, PEN_SOLID, PEN_DOT, PEN_DASH, PEN_DASHDOT };
+
+
+//============================== defines ===================================
+
+#define OOODEBUG(str,Num) //InfoBox(NULL,String(str)+String(" ")+String(Num)).Execute();
+
+// -----------------------------Feld-Typen-------------------------------
+
+#define BegDocumnMagic 0xA8A8 /* Begin Document */
+#define EndDocumnMagic 0xA8A9 /* End Document */
+
+#define BegResGrpMagic 0xC6A8 /* Begin Resource Group */
+#define EndResGrpMagic 0xC6A9 /* End Resource Group */
+
+#define BegColAtrMagic 0x77A8 /* Begin Color Attribute Table */
+#define EndColAtrMagic 0x77A9 /* End Color Attribute Table */
+#define BlkColAtrMagic 0x77B0 /* Color Attribute Table */
+#define MapColAtrMagic 0x77AB /* Map Color Attribute Table */
+
+#define BegImgObjMagic 0xFBA8 /* Begin Image Object */
+#define EndImgObjMagic 0xFBA9 /* End Image Object */
+#define DscImgObjMagic 0xFBA6 /* Image Data Descriptor */
+#define DatImgObjMagic 0xFBEE /* Image Picture Data */
+
+#define BegObEnv1Magic 0xC7A8 /* Begin Object Environment Group */
+#define EndObEnv1Magic 0xC7A9 /* End Object Environment Group */
+
+#define BegGrfObjMagic 0xBBA8 /* Begin Graphics Object */
+#define EndGrfObjMagic 0xBBA9 /* End Graphics Object */
+#define DscGrfObjMagic 0xBBA6 /* Graphics Data Descritor */
+#define DatGrfObjMagic 0xBBEE /* Graphics Data */
+
+#define MapCodFntMagic 0x8AAB /* Map Coded Font */
+#define MapDatResMagic 0xC3AB /* Map Data Resource */
+
+// -----------------------------Order-Typen-------------------------------
+
+#define GOrdGivArc 0xC6 /* 1 Arc at given position */
+#define GOrdCurArc 0x86 /* 1 Arc at current position */
+#define GOrdGivBzr 0xE5 /* 1 Beziercurve at given position */
+#define GOrdCurBzr 0xA5 /* 1 Beziercurve at current position */
+#define GOrdGivBox 0xC0 /* 1 Box at given position */
+#define GOrdCurBox 0x80 /* 1 Box at current position */
+#define GOrdGivFil 0xC5 /* 1 Fillet at given position */
+#define GOrdCurFil 0x85 /* 1 Fillet at current position */
+#define GOrdGivCrc 0xC7 /* 1 Full arc (circle) at given position */
+#define GOrdCurCrc 0x87 /* 1 Full arc (circle) at current position */
+#define GOrdGivLin 0xC1 /* 1 Line at given position */
+#define GOrdCurLin 0x81 /* 1 Line at current position */
+#define GOrdGivMrk 0xC2 /* 1 Marker at given position */
+#define GOrdCurMrk 0x82 /* 1 Marker at current position */
+#define GOrdGivArP 0xE3 /* 1 Partial arc at given position */
+#define GOrdCurArP 0xA3 /* 1 Partial arc at current position */
+#define GOrdGivRLn 0xE1 /* 1 Relative line at given position */
+#define GOrdCurRLn 0xA1 /* 1 Relative line at current position */
+#define GOrdGivSFl 0xE4 /* 1 Sharp fillet at given position */
+#define GOrdCurSFl 0xA4 /* 1 Sharp fillet at current position */
+
+#define GOrdGivStM 0xF1 /* 1 Character string move at given position */
+#define GOrdCurStM 0xB1 /* 1 Character string move at current position */
+#define GOrdGivStr 0xC3 /* 1 Character string at given position */
+#define GOrdCurStr 0x83 /* 1 Character string at current position */
+#define GOrdGivStx 0xFEF0 /* 2 Character string extended at given position */
+#define GOrdCurStx 0xFEB0 /* 2 Character string extended at current position */
+
+#define GOrdGivImg 0xD1 /* 1 Begin Image at given position */
+#define GOrdCurImg 0x91 /* 1 Begin Image at current position */
+#define GOrdImgDat 0x92 /* 1 Image data */
+#define GOrdEndImg 0x93 /* 1 End Image */
+#define GOrdBegAra 0x68 /* 0 1 Begin area */
+#define GOrdEndAra 0x60 /* 1 End area */
+#define GOrdBegElm 0xD2 /* 1 Begin element */
+#define GOrdEndElm 0x49 /* 0 1 End element */
+
+#define GOrdBegPth 0xD0 /* 1 Begin path */
+#define GOrdEndPth 0x7F /* 0 1 End path */
+#define GOrdFilPth 0xD7 /* 1 Fill path */
+#define GOrdModPth 0xD8 /* 1 Modify path */
+#define GOrdOutPth 0xD4 /* 1 Outline path */
+#define GOrdSClPth 0xB4 /* 1 Set clip path */
+
+#define GOrdNopNop 0x00 /* 0 0 No operation */
+#define GOrdRemark 0x01 /* 1 Comment */
+#define GOrdSegLab 0xD3 /* 1 Label */
+#define GOrdBitBlt 0xD6 /* 1 Bitblt */
+#define GOrdCalSeg 0x07 /* 1 Call Segment */
+#define GOrdSSgBnd 0x32 /* 1 Set segment boundary */
+#define GOrdSegChr 0x04 /* 1 Segment characteristics */
+#define GOrdCloFig 0x7D /* 0 1 Close Figure */
+#define GOrdEndSym 0xFF /* 0 0 End of symbol definition */
+#define GOrdEndPlg 0x3E /* 0 1 End prolog */
+#define GOrdEscape 0xD5 /* 1 Escape */
+#define GOrdExtEsc 0xFED5 /* 2 Extended Escape */
+#define GOrdPolygn 0xF3 /* 2 Polygons */
+
+#define GOrdStkPop 0x3F /* 0 1 Pop */
+
+#define GOrdSIvAtr 0x14 /* 1 Set individual attribute */
+#define GOrdPIvAtr 0x54 /* 1 Push and set individual attribute */
+#define GOrdSColor 0x0A /* 0 1 Set color */
+#define GOrdPColor 0x4A /* 0 1 Push and set color */
+#define GOrdSIxCol 0xA6 /* 1 Set indexed color */
+#define GOrdPIxCol 0xE6 /* 1 Push and set indexed color */
+#define GOrdSXtCol 0x26 /* 1 Set extended color */
+#define GOrdPXtCol 0x66 /* 1 Push and set extended color */
+#define GOrdSBgCol 0x25 /* 1 Set background color */
+#define GOrdPBgCol 0x65 /* 1 Push and set background color */
+#define GOrdSBxCol 0xA7 /* 1 Set background indexed color */
+#define GOrdPBxCol 0xE7 /* 1 Push and set background indexed color */
+#define GOrdSMixMd 0x0C /* 0 1 Set mix */
+#define GOrdPMixMd 0x4C /* 0 1 Push and set mix */
+#define GOrdSBgMix 0x0D /* 0 1 Set background mix */
+#define GOrdPBgMix 0x4D /* 0 1 Push and set background mix */
+
+#define GOrdSPtSet 0x08 /* 0 1 Set pattern set */
+#define GOrdPPtSet 0x48 /* 0 1 Push and set pattern set */
+#define GOrdSPtSym 0x28 /* 0 1 Set pattern symbol */
+#define GOrdPPtSym 0x09 /* 0 1 Push and set pattern symbol */
+#define GOrdSPtRef 0xA0 /* 1 Set model pattern reference */
+#define GOrdPPtRef 0xE0 /* 1 Push and set pattern reference point */
+
+#define GOrdSLnEnd 0x1A /* 0 1 Set line end */
+#define GOrdPLnEnd 0x5A /* 0 1 Push and set line end */
+#define GOrdSLnJoi 0x1B /* 0 1 Set line join */
+#define GOrdPLnJoi 0x5B /* 0 1 Push and set line join */
+#define GOrdSLnTyp 0x18 /* 0 1 Set line type */
+#define GOrdPLnTyp 0x58 /* 0 1 Push and set line type */
+#define GOrdSLnWdt 0x19 /* 0 1 Set line width */
+#define GOrdPLnWdt 0x59 /* 0 1 Push and set line width */
+#define GOrdSFrLWd 0x11 /* 1 Set fractional line width */
+#define GOrdPFrLWd 0x51 /* 1 Push and set fractional line width */
+#define GOrdSStLWd 0x15 /* 1 Set stroke line width */
+#define GOrdPStLWd 0x55 /* 1 Push and set stroke line width */
+
+#define GOrdSChDir 0x3A /* 0 1 Set character direction */
+#define GOrdPChDir 0x7A /* 0 1 Push and set character direction */
+#define GOrdSChPrc 0x39 /* 0 1 Set character precision */
+#define GOrdPChPrc 0x79 /* 0 1 Push and set character precision */
+#define GOrdSChSet 0x38 /* 0 1 Set character set */
+#define GOrdPChSet 0x78 /* 0 1 Push and set character set */
+#define GOrdSChAng 0x34 /* 1 Set character angle */
+#define GOrdPChAng 0x74 /* 1 Push and set character angle */
+#define GOrdSChBrx 0x05 /* 1 Set character break extra */
+#define GOrdPChBrx 0x45 /* 1 Push and set character break extra */
+#define GOrdSChCel 0x33 /* 1 Set character cell */
+#define GOrdPChCel 0x03 /* 1 Push and set character cell */
+#define GOrdSChXtr 0x17 /* 1 Set character extra */
+#define GOrdPChXtr 0x57 /* 1 Push and set character extra */
+#define GOrdSChShr 0x35 /* 1 Set character shear */
+#define GOrdPChShr 0x75 /* 1 Push and set character shear */
+#define GOrdSTxAlg 0x36 /* 0 2 Set text allingment */
+#define GOrdPTxAlg 0x76 /* 0 2 Push and set text allingment */
+
+#define GOrdSMkPrc 0x3B /* 0 1 Set marker precision */
+#define GOrdPMkPrc 0x7B /* 0 1 Push and set marker precision */
+#define GOrdSMkSet 0x3C /* 0 1 Set marker set */
+#define GOrdPMkSet 0x7C /* 0 1 Push and set marker set */
+#define GOrdSMkSym 0x29 /* 0 1 Set marker symbol */
+#define GOrdPMkSym 0x69 /* 0 1 Push and set marker symbol */
+#define GOrdSMkCel 0x37 /* 1 Set marker cell */
+#define GOrdPMkCel 0x77 /* 1 Push and set marker cell */
+
+#define GOrdSArcPa 0x22 /* 1 Set arc parameters */
+#define GOrdPArcPa 0x62 /* 1 Push and set arc parameters */
+
+#define GOrdSCrPos 0x21 /* 1 Set current position */
+#define GOrdPCrPos 0x61 /* 1 Push and set current position */
+
+#define GOrdSMdTrn 0x24 /* 1 Set model transform */
+#define GOrdPMdTrn 0x64 /* 1 Push and set model transform */
+#define GOrdSPkIdn 0x43 /* 1 Set pick identifier */
+#define GOrdPPkIdn 0x23 /* 1 Push and set pick identifier */
+#define GOrdSVwTrn 0x31 /* 1 Set viewing transform */
+#define GOrdSVwWin 0x27 /* 1 Set viewing window */
+#define GOrdPVwWin 0x67 /* 1 Push and set viewing window */
+
+//============================ OS2METReader ==================================
+
+struct OSPalette {
+ OSPalette * pSucc;
+ sal_uInt32 * p0RGB; // Darf auch NULL sein!
+ USHORT nSize;
+};
+
+struct OSArea {
+ OSArea * pSucc;
+ BYTE nFlags;
+ PolyPolygon aPPoly;
+ BOOL bClosed;
+ Color aCol;
+ Color aBgCol;
+ RasterOp eMix;
+ RasterOp eBgMix;
+ BOOL bFill;
+ OSArea(){} ~OSArea(){}
+};
+
+struct OSPath
+{
+ OSPath* pSucc;
+ sal_uInt32 nID;
+ PolyPolygon aPPoly;
+ BOOL bClosed;
+ BOOL bStroke;
+
+ OSPath(){}
+ ~OSPath(){}
+};
+
+struct OSFont {
+ OSFont * pSucc;
+ ULONG nID;
+ Font aFont;
+ OSFont(){} ~OSFont(){}
+};
+
+struct OSBitmap {
+ OSBitmap * pSucc;
+ ULONG nID;
+ Bitmap aBitmap;
+
+ // Waehrend des Lesens der Bitmap benoetigt:
+ SvStream * pBMP; // Zeiger auf temporaere Windows-BMP-Datei oder NULL
+ sal_uInt32 nWidth, nHeight;
+ USHORT nBitsPerPixel;
+ ULONG nMapPos;
+ OSBitmap(){} ~OSBitmap(){}
+};
+
+struct OSAttr {
+ OSAttr * pSucc;
+ USHORT nPushOrder;
+ BYTE nIvAttrA, nIvAttrP; // Spezialvariablen fuer den Order "GOrdPIvAtr"
+
+ Color aLinCol;
+ Color aLinBgCol;
+ RasterOp eLinMix;
+ RasterOp eLinBgMix;
+ Color aChrCol;
+ Color aChrBgCol;
+ RasterOp eChrMix;
+ RasterOp eChrBgMix;
+ Color aMrkCol;
+ Color aMrkBgCol;
+ RasterOp eMrkMix;
+ RasterOp eMrkBgMix;
+ Color aPatCol;
+ Color aPatBgCol;
+ RasterOp ePatMix;
+ RasterOp ePatBgMix;
+ Color aImgCol;
+ Color aImgBgCol;
+ RasterOp eImgMix;
+ RasterOp eImgBgMix;
+ long nArcP, nArcQ, nArcR, nArcS;
+ short nChrAng;
+// long nChrBreakExtra;
+ Size aChrCellSize;
+// BYTE nChrDir;
+// long nChrExtra;
+// BYTE nChrPrec;
+ ULONG nChrSet;
+// Size aChrShear;
+ Point aCurPos;
+// long nFracLinWidth;
+// BYTE nLinEnd;
+// BYTE nLinJoin;
+ PenStyle eLinStyle;
+ USHORT nLinWidth;
+ Size aMrkCellSize;
+ BYTE nMrkPrec;
+ BYTE nMrkSet;
+ BYTE nMrkSymbol;
+// //... aModTransform;
+// Point aPatRef;
+// BYTE nPatSet;
+ BOOL bFill;
+// ULONG nPickId;
+// //... aSegBound;
+ USHORT nStrLinWidth;
+// BYTE nTxtAlignHor,nTxtAlignVer;
+// //... aViewTransform;
+// //... aViewWindow;
+ OSAttr(){} ~OSAttr(){}
+};
+
+class OS2METReader {
+
+private:
+
+ long ErrorCode;
+
+ SvStream * pOS2MET; // Die einzulesende OS2MET-Datei
+ VirtualDevice * pVirDev; // Hier werden die Drawing-Methoden aufgerufen.
+ // Dabei findet ein Recording in das GDIMetaFile
+ // statt.
+ ULONG nOrigPos; // Anfaengliche Position in pOS2MET
+ UINT16 nOrigNumberFormat; // Anfaengliches Nummern-Format von pOS2MET
+ Rectangle aBoundingRect; // Boundingrectangle wie in Datei angegeben
+ Rectangle aCalcBndRect; // selbst ermitteltes Boundingrectangle
+ MapMode aGlobMapMode; // Aufloesung des Bildes
+ BOOL bCoord32;
+
+ OSPalette * pPaletteStack;
+
+ LineInfo aLineInfo;
+
+ OSArea * pAreaStack; // Areas, die in Arbeit sind
+
+ OSPath * pPathStack; // Paths, die in Arbeit sind
+ OSPath * pPathList; // Vollendete Paths
+
+ OSFont * pFontList;
+
+ OSBitmap * pBitmapList;
+
+ OSAttr aDefAttr;
+ OSAttr aAttr;
+ OSAttr * pAttrStack;
+
+ SvStream * pOrdFile;
+
+ BOOL Callback(USHORT nPercent);
+
+ void AddPointsToPath(const Polygon & rPoly);
+ void AddPointsToArea(const Polygon & rPoly);
+ void CloseFigure();
+ void PushAttr(USHORT nPushOrder);
+ void PopAttr();
+
+ void ChangeBrush( const Color& rPatColor, const Color& rBGColor, BOOL bFill );
+ void SetPen( const Color& rColor, USHORT nStrLinWidth = 0, PenStyle ePenStyle = PEN_SOLID );
+ void SetRasterOp(RasterOp eROP);
+
+ void SetPalette0RGB(USHORT nIndex, ULONG nCol);
+ sal_uInt32 GetPalette0RGB(sal_uInt32 nIndex);
+ // Holt Farbe aus der Palette, oder, wenn nicht vorhanden,
+ // interpretiert nIndex als direkten RGB-Wert.
+ Color GetPaletteColor(sal_uInt32 nIndex);
+
+
+ BOOL IsLineInfo();
+ void DrawPolyLine( const Polygon& rPolygon );
+ void DrawPolygon( const Polygon& rPolygon );
+ void DrawPolyPolygon( const PolyPolygon& rPolygon );
+ USHORT ReadBigEndianWord();
+ ULONG ReadBigEndian3BytesLong();
+ ULONG ReadLittleEndian3BytesLong();
+ long ReadCoord(BOOL b32);
+ Point ReadPoint( const BOOL bAdjustBoundRect = TRUE );
+ RasterOp OS2MixToRasterOp(BYTE nMix);
+ void ReadLine(BOOL bGivenPos, USHORT nOrderLen);
+ void ReadRelLine(BOOL bGivenPos, USHORT nOrderLen);
+ void ReadBox(BOOL bGivenPos);
+ void ReadBitBlt();
+ void ReadChrStr(BOOL bGivenPos, BOOL bMove, BOOL bExtra, USHORT nOrderLen);
+ void ReadArc(BOOL bGivenPos);
+ void ReadFullArc(BOOL bGivenPos, USHORT nOrderSize);
+ void ReadPartialArc(BOOL bGivenPos, USHORT nOrderSize);
+ void ReadPolygons();
+ void ReadBezier(BOOL bGivenPos, USHORT nOrderLen);
+ void ReadFillet(BOOL bGivenPos, USHORT nOrderLen);
+ void ReadFilletSharp(BOOL bGivenPos, USHORT nOrderLen);
+ void ReadMarker(BOOL bGivenPos, USHORT nOrderLen);
+ void ReadOrder(USHORT nOrderID, USHORT nOrderLen);
+ void ReadDsc(USHORT nDscID, USHORT nDscLen);
+ void ReadImageData(USHORT nDataID, USHORT nDataLen);
+ void ReadFont(USHORT nFieldSize);
+ void ReadField(USHORT nFieldType, USHORT nFieldSize);
+
+public:
+
+ OS2METReader();
+ ~OS2METReader();
+
+ void ReadOS2MET( SvStream & rStreamOS2MET, GDIMetaFile & rGDIMetaFile );
+ // Liesst aus dem Stream eine OS2MET-Datei und fuellt das GDIMetaFile
+
+};
+
+//=================== Methoden von OS2METReader ==============================
+
+BOOL OS2METReader::Callback(USHORT /*nPercent*/)
+{
+/*
+ if (pCallback!=NULL) {
+ if (((*pCallback)(pCallerData,nPercent))==TRUE) {
+ pOS2MET->SetError(SVSTREAM_FILEFORMAT_ERROR);
+ return TRUE;
+ }
+ }
+*/
+ return FALSE;
+}
+
+OS2METReader::OS2METReader()
+{
+}
+
+OS2METReader::~OS2METReader()
+{
+}
+
+BOOL OS2METReader::IsLineInfo()
+{
+ return ( ! ( aLineInfo.IsDefault() || ( aLineInfo.GetStyle() == LINE_NONE ) || ( pVirDev->GetLineColor() == COL_TRANSPARENT ) ) );
+}
+
+void OS2METReader::DrawPolyLine( const Polygon& rPolygon )
+{
+ if ( aLineInfo.GetStyle() == LINE_DASH || ( aLineInfo.GetWidth() > 1 ) )
+ pVirDev->DrawPolyLine( rPolygon, aLineInfo );
+ else
+ pVirDev->DrawPolyLine( rPolygon );
+}
+
+void OS2METReader::DrawPolygon( const Polygon& rPolygon )
+{
+ if ( IsLineInfo() )
+ {
+ pVirDev->Push( PUSH_LINECOLOR );
+ pVirDev->SetLineColor( COL_TRANSPARENT );
+ pVirDev->DrawPolygon( rPolygon );
+ pVirDev->Pop();
+ pVirDev->DrawPolyLine( rPolygon, aLineInfo );
+ }
+ else
+ pVirDev->DrawPolygon( rPolygon );
+}
+
+void OS2METReader::DrawPolyPolygon( const PolyPolygon& rPolyPolygon )
+{
+ if ( IsLineInfo() )
+ {
+ pVirDev->Push( PUSH_LINECOLOR );
+ pVirDev->SetLineColor( COL_TRANSPARENT );
+ pVirDev->DrawPolyPolygon( rPolyPolygon );
+ pVirDev->Pop();
+ for ( USHORT i = 0; i < rPolyPolygon.Count(); i++ )
+ pVirDev->DrawPolyLine( rPolyPolygon.GetObject( i ), aLineInfo );
+ }
+ else
+ pVirDev->DrawPolyPolygon( rPolyPolygon );
+}
+
+void OS2METReader::AddPointsToArea(const Polygon & rPoly)
+{
+ USHORT nOldSize, nNewSize,i;
+
+ if (pAreaStack==NULL || rPoly.GetSize()==0) return;
+ PolyPolygon * pPP=&(pAreaStack->aPPoly);
+ if (pPP->Count()==0 || pAreaStack->bClosed==TRUE) pPP->Insert(rPoly);
+ else {
+ Polygon aLastPoly(pPP->GetObject(pPP->Count()-1));
+ nOldSize=aLastPoly.GetSize();
+ if (aLastPoly.GetPoint(nOldSize-1)==rPoly.GetPoint(0)) nOldSize--;
+ nNewSize=nOldSize+rPoly.GetSize();
+ aLastPoly.SetSize(nNewSize);
+ for (i=nOldSize; i<nNewSize; i++) {
+ aLastPoly.SetPoint(rPoly.GetPoint(i-nOldSize),i);
+ }
+ pPP->Replace(aLastPoly,pPP->Count()-1);
+ }
+ pAreaStack->bClosed=FALSE;
+}
+
+void OS2METReader::AddPointsToPath(const Polygon & rPoly)
+{
+ USHORT nOldSize, nNewSize,i;
+
+ if (pPathStack==NULL || rPoly.GetSize()==0) return;
+ PolyPolygon * pPP=&(pPathStack->aPPoly);
+ if (pPP->Count()==0 /*|| pPathStack->bClosed==TRUE*/) pPP->Insert(rPoly);
+ else {
+ Polygon aLastPoly(pPP->GetObject(pPP->Count()-1));
+ nOldSize=aLastPoly.GetSize();
+ if (aLastPoly.GetPoint(nOldSize-1)!=rPoly.GetPoint(0)) pPP->Insert(rPoly);
+ else {
+ nOldSize--;
+ nNewSize=nOldSize+rPoly.GetSize();
+ aLastPoly.SetSize(nNewSize);
+ for (i=nOldSize; i<nNewSize; i++) {
+ aLastPoly.SetPoint(rPoly.GetPoint(i-nOldSize),i);
+ }
+ pPP->Replace(aLastPoly,pPP->Count()-1);
+ }
+ }
+ pPathStack->bClosed=FALSE;
+}
+
+void OS2METReader::CloseFigure()
+{
+ if (pAreaStack!=NULL) pAreaStack->bClosed=TRUE;
+ else if (pPathStack!=NULL) pPathStack->bClosed=TRUE;
+}
+
+void OS2METReader::PushAttr(USHORT nPushOrder)
+{
+ OSAttr * p;
+ p=new OSAttr;
+ *p=aAttr;
+ p->pSucc=pAttrStack; pAttrStack=p;
+ p->nPushOrder=nPushOrder;
+}
+
+void OS2METReader::PopAttr()
+{
+ OSAttr * p=pAttrStack;
+
+ if (p==NULL) return;
+ switch (p->nPushOrder) {
+
+ case GOrdPIvAtr:
+ switch (p->nIvAttrA) {
+ case 1: switch (p->nIvAttrP) {
+ case 1: aAttr.aLinCol=p->aLinCol; break;
+ case 2: aAttr.aChrCol=p->aChrCol; break;
+ case 3: aAttr.aMrkCol=p->aMrkCol; break;
+ case 4: aAttr.aPatCol=p->aPatCol; break;
+ case 5: aAttr.aImgCol=p->aImgCol; break;
+ } break;
+ case 2: switch (p->nIvAttrP) {
+ case 1: aAttr.aLinBgCol=p->aLinBgCol; break;
+ case 2: aAttr.aChrBgCol=p->aChrBgCol; break;
+ case 3: aAttr.aMrkBgCol=p->aMrkBgCol; break;
+ case 4: aAttr.aPatBgCol=p->aPatBgCol; break;
+ case 5: aAttr.aImgBgCol=p->aImgBgCol; break;
+ } break;
+ case 3: switch (p->nIvAttrP) {
+ case 1: aAttr.eLinMix=p->eLinMix; break;
+ case 2: aAttr.eChrMix=p->eChrMix; break;
+ case 3: aAttr.eMrkMix=p->eMrkMix; break;
+ case 4: aAttr.ePatMix=p->ePatMix; break;
+ case 5: aAttr.eImgMix=p->eImgMix; break;
+ } break;
+ case 4: switch (p->nIvAttrP) {
+ case 1: aAttr.eLinBgMix=p->eLinBgMix; break;
+ case 2: aAttr.eChrBgMix=p->eChrBgMix; break;
+ case 3: aAttr.eMrkBgMix=p->eMrkBgMix; break;
+ case 4: aAttr.ePatBgMix=p->ePatBgMix; break;
+ case 5: aAttr.eImgBgMix=p->eImgBgMix; break;
+ } break;
+ }
+ break;
+
+ case GOrdPLnTyp: aAttr.eLinStyle=p->eLinStyle; break;
+
+ case GOrdPLnWdt: aAttr.nLinWidth=p->nLinWidth; break;
+
+ case GOrdPStLWd: aAttr.nStrLinWidth=p->nStrLinWidth; break;
+
+ case GOrdPChSet: aAttr.nChrSet=p->nChrSet; break;
+
+ case GOrdPChAng: aAttr.nChrAng=p->nChrAng; break;
+
+ case GOrdPMixMd:
+ aAttr.eLinMix=p->eLinMix;
+ aAttr.eChrMix=p->eChrMix;
+ aAttr.eMrkMix=p->eMrkMix;
+ aAttr.ePatMix=p->ePatMix;
+ aAttr.eImgMix=p->eImgMix;
+ break;
+
+ case GOrdPBgMix:
+ aAttr.eLinBgMix=p->eLinBgMix;
+ aAttr.eChrBgMix=p->eChrBgMix;
+ aAttr.eMrkBgMix=p->eMrkBgMix;
+ aAttr.ePatBgMix=p->ePatBgMix;
+ aAttr.eImgBgMix=p->eImgBgMix;
+ break;
+
+ case GOrdPPtSym: aAttr.bFill = p->bFill; break;
+
+ case GOrdPColor:
+ case GOrdPIxCol:
+ case GOrdPXtCol:
+ aAttr.aLinCol=p->aLinCol;
+ aAttr.aChrCol=p->aChrCol;
+ aAttr.aMrkCol=p->aMrkCol;
+ aAttr.aPatCol=p->aPatCol;
+ aAttr.aImgCol=p->aImgCol;
+ break;
+
+ case GOrdPBgCol:
+ case GOrdPBxCol:
+ aAttr.aLinBgCol=p->aLinBgCol;
+ aAttr.aChrBgCol=p->aChrBgCol;
+ aAttr.aMrkBgCol=p->aMrkBgCol;
+ aAttr.aPatBgCol=p->aPatBgCol;
+ aAttr.aImgBgCol=p->aImgBgCol;
+ break;
+
+ case GOrdPMkPrc: aAttr.nMrkPrec=aDefAttr.nMrkPrec; break;
+
+ case GOrdPMkSet: aAttr.nMrkSet=aDefAttr.nMrkSet; break;
+
+ case GOrdPMkSym: aAttr.nMrkSymbol=aDefAttr.nMrkSymbol; break;
+
+ case GOrdPMkCel: aAttr.aMrkCellSize=aDefAttr.aMrkCellSize; break;
+
+ case GOrdPArcPa:
+ aAttr.nArcP=p->nArcP; aAttr.nArcQ=p->nArcQ;
+ aAttr.nArcR=p->nArcR; aAttr.nArcS=p->nArcS;
+ break;
+
+ case GOrdPCrPos:
+ aAttr.aCurPos=p->aCurPos;
+ break;
+ }
+ pAttrStack=p->pSucc;
+ delete p;
+}
+
+void OS2METReader::ChangeBrush(const Color& rPatColor, const Color& /*rBGColor*/, BOOL bFill )
+{
+ Color aColor;
+
+ if( bFill )
+ aColor = rPatColor;
+ else
+ aColor = Color( COL_TRANSPARENT );
+
+ if( pVirDev->GetFillColor() != aColor )
+ pVirDev->SetFillColor( aColor );
+}
+
+void OS2METReader::SetPen( const Color& rColor, USHORT nLineWidth, PenStyle ePenStyle )
+{
+ LineStyle eLineStyle( LINE_SOLID );
+
+ if ( pVirDev->GetLineColor() != rColor )
+ pVirDev->SetLineColor( rColor );
+ aLineInfo.SetWidth( nLineWidth );
+
+ USHORT nDotCount = 0;
+ USHORT nDashCount = 0;
+ switch ( ePenStyle )
+ {
+ case PEN_NULL :
+ eLineStyle = LINE_NONE;
+ break;
+ case PEN_DASHDOT :
+ nDashCount++;
+ case PEN_DOT :
+ nDotCount++;
+ nDashCount--;
+ case PEN_DASH :
+ nDashCount++;
+ aLineInfo.SetDotCount( nDotCount );
+ aLineInfo.SetDashCount( nDashCount );
+ aLineInfo.SetDistance( nLineWidth );
+ aLineInfo.SetDotLen( nLineWidth );
+ aLineInfo.SetDashLen( nLineWidth << 2 );
+ eLineStyle = LINE_DASH;
+ break;
+ case PEN_SOLID:
+ break; // -Wall not handled...
+ }
+ aLineInfo.SetStyle( eLineStyle );
+}
+
+void OS2METReader::SetRasterOp(RasterOp eROP)
+{
+ if (pVirDev->GetRasterOp()!=eROP) pVirDev->SetRasterOp(eROP);
+}
+
+
+void OS2METReader::SetPalette0RGB(USHORT nIndex, ULONG nCol)
+{
+ if (pPaletteStack==NULL) {
+ pPaletteStack=new OSPalette;
+ pPaletteStack->pSucc=NULL;
+ pPaletteStack->p0RGB=NULL;
+ pPaletteStack->nSize=0;
+ }
+ if (pPaletteStack->p0RGB==NULL || nIndex>=pPaletteStack->nSize) {
+ sal_uInt32 * pOld0RGB=pPaletteStack->p0RGB;
+ USHORT i,nOldSize=pPaletteStack->nSize;
+ if (pOld0RGB==NULL) nOldSize=0;
+ pPaletteStack->nSize=2*(nIndex+1);
+ if (pPaletteStack->nSize<256) pPaletteStack->nSize=256;
+ pPaletteStack->p0RGB = new sal_uInt32[pPaletteStack->nSize];
+ for (i=0; i<pPaletteStack->nSize; i++) {
+ if (i<nOldSize) pPaletteStack->p0RGB[i]=pOld0RGB[i];
+ else if (i==0) pPaletteStack->p0RGB[i]=0x00ffffff;
+ else pPaletteStack->p0RGB[i]=0;
+ }
+ if (pOld0RGB!=NULL) delete[] pOld0RGB;
+ }
+ pPaletteStack->p0RGB[nIndex]=nCol;
+}
+
+sal_uInt32 OS2METReader::GetPalette0RGB(sal_uInt32 nIndex)
+{
+ if (pPaletteStack!=NULL && pPaletteStack->p0RGB!=NULL &&
+ pPaletteStack->nSize>nIndex) nIndex=pPaletteStack->p0RGB[nIndex];
+ return nIndex;
+}
+
+Color OS2METReader::GetPaletteColor(sal_uInt32 nIndex)
+{
+ nIndex=GetPalette0RGB(nIndex);
+ return Color(sal::static_int_cast< UINT8 >((nIndex>>16)&0xff),
+ sal::static_int_cast< UINT8 >((nIndex>>8)&0xff),
+ sal::static_int_cast< UINT8 >(nIndex&0xff));
+}
+
+
+USHORT OS2METReader::ReadBigEndianWord()
+{
+ BYTE nLo,nHi;
+ *pOS2MET >> nHi >> nLo;
+ return (((USHORT)nHi)<<8)|(((USHORT)nLo)&0x00ff);
+}
+
+ULONG OS2METReader::ReadBigEndian3BytesLong()
+{
+ USHORT nLo;
+ BYTE nHi;
+ *pOS2MET >> nHi;
+ nLo=ReadBigEndianWord();
+ return ((((ULONG)nHi)<<16)&0x00ff0000)|((ULONG)nLo);
+}
+
+ULONG OS2METReader::ReadLittleEndian3BytesLong()
+{
+ BYTE nHi,nMed,nLo;
+
+ *pOS2MET >> nLo >> nMed >> nHi;
+ return ((((ULONG)nHi)&0xff)<<16)|((((ULONG)nMed)&0xff)<<8)|(((ULONG)nLo)&0xff);
+}
+
+long OS2METReader::ReadCoord(BOOL b32)
+{
+ long l;
+ short s;
+
+ if (b32) *pOS2MET >> l;
+ else { *pOS2MET >> s; l=(long)s; }
+ return l;
+}
+
+Point OS2METReader::ReadPoint( const BOOL bAdjustBoundRect )
+{
+ long x,y;
+
+ x=ReadCoord(bCoord32);
+ y=ReadCoord(bCoord32);
+ x=x-aBoundingRect.Left();
+ y=aBoundingRect.Bottom()-y;
+
+ if ( bAdjustBoundRect )
+ aCalcBndRect.Union(Rectangle(x,y,x+1,y+1));
+
+ return Point(x,y);
+}
+
+RasterOp OS2METReader::OS2MixToRasterOp(BYTE nMix)
+{
+ switch (nMix) {
+ case 0x0c: return ROP_INVERT;
+ case 0x04: return ROP_XOR;
+ case 0x0b: return ROP_XOR;
+ default: return ROP_OVERPAINT;
+ }
+}
+
+void OS2METReader::ReadLine(BOOL bGivenPos, USHORT nOrderLen)
+{
+ USHORT i,nPolySize;
+
+ if (bCoord32) nPolySize=nOrderLen/8; else nPolySize=nOrderLen/4;
+ if (!bGivenPos) nPolySize++;
+ if (nPolySize==0) return;
+ Polygon aPolygon(nPolySize);
+ for (i=0; i<nPolySize; i++) {
+ if (i==0 && !bGivenPos) aPolygon.SetPoint(aAttr.aCurPos,i);
+ else aPolygon.SetPoint(ReadPoint(),i);
+ }
+ aAttr.aCurPos=aPolygon.GetPoint(nPolySize-1);
+ if (pAreaStack!=NULL) AddPointsToArea(aPolygon);
+ else if (pPathStack!=NULL) AddPointsToPath(aPolygon);
+ else
+ {
+ SetPen( aAttr.aLinCol, aAttr.nStrLinWidth, aAttr.eLinStyle );
+ SetRasterOp(aAttr.eLinMix);
+ DrawPolyLine( aPolygon );
+ }
+}
+
+void OS2METReader::ReadRelLine(BOOL bGivenPos, USHORT nOrderLen)
+{
+ USHORT i,nPolySize;
+ Point aP0;
+
+
+ if (bGivenPos) {
+ aP0=ReadPoint();
+ if (bCoord32) nOrderLen-=8; else nOrderLen-=4;
+ }
+ else aP0=aAttr.aCurPos;
+ nPolySize=nOrderLen/2;
+ if (nPolySize==0) return;
+ Polygon aPolygon(nPolySize);
+ for (i=0; i<nPolySize; i++) {
+#if defined SOLARIS && defined PPC
+ UINT8 nunsignedbyte;
+ *pOS2MET >> nunsignedbyte; aP0.X()+=(INT8)nunsignedbyte;
+ *pOS2MET >> nunsignedbyte; aP0.Y()+=(INT8)nunsignedbyte;
+#else
+ INT8 nsignedbyte;
+ *pOS2MET >> nsignedbyte; aP0.X()+=(long)nsignedbyte;
+ *pOS2MET >> nsignedbyte; aP0.Y()-=(long)nsignedbyte;
+#endif
+ aCalcBndRect.Union(Rectangle(aP0,Size(1,1)));
+ aPolygon.SetPoint(aP0,i);
+ }
+ aAttr.aCurPos=aPolygon.GetPoint(nPolySize-1);
+ if (pAreaStack!=NULL) AddPointsToArea(aPolygon);
+ else if (pPathStack!=NULL) AddPointsToPath(aPolygon);
+ else
+ {
+ SetPen( aAttr.aLinCol, aAttr.nStrLinWidth, aAttr.eLinStyle );
+ SetRasterOp(aAttr.eLinMix);
+ DrawPolyLine( aPolygon );
+ }
+}
+
+void OS2METReader::ReadBox(BOOL bGivenPos)
+{
+ BYTE nFlags;
+ Point P0;
+ long nHRound,nVRound;
+
+ *pOS2MET >> nFlags;
+ pOS2MET->SeekRel(1);
+
+ if ( bGivenPos )
+ P0 = ReadPoint();
+ else
+ P0 = aAttr.aCurPos;
+
+ aAttr.aCurPos=ReadPoint();
+ nHRound=ReadCoord(bCoord32);
+ nVRound=ReadCoord(bCoord32);
+
+ Rectangle aBoxRect( P0, aAttr.aCurPos );
+
+ if ( pAreaStack )
+ AddPointsToArea( Polygon( aBoxRect ) );
+ else if ( pPathStack )
+ AddPointsToPath( Polygon( aBoxRect ) );
+ else
+ {
+ if ( nFlags & 0x20 )
+ SetPen( aAttr.aLinCol, aAttr.nStrLinWidth, aAttr.eLinStyle );
+ else
+ SetPen( COL_TRANSPARENT );
+
+ if ( nFlags & 0x40 )
+ {
+ ChangeBrush(aAttr.aPatCol,aAttr.aPatBgCol,aAttr.bFill);
+ SetRasterOp(aAttr.ePatMix);
+ }
+ else
+ {
+ ChangeBrush( Color( COL_TRANSPARENT ), Color( COL_TRANSPARENT ), FALSE );
+ SetRasterOp(aAttr.eLinMix);
+ }
+
+ if ( IsLineInfo() )
+ {
+ Polygon aPolygon( aBoxRect, nHRound, nVRound );
+ if ( nFlags & 0x40 )
+ {
+ pVirDev->Push( PUSH_LINECOLOR );
+ pVirDev->SetLineColor( COL_TRANSPARENT );
+ pVirDev->DrawRect( aBoxRect, nHRound, nVRound );
+ pVirDev->Pop();
+ }
+ pVirDev->DrawPolyLine( aPolygon, aLineInfo );
+ }
+ else
+ pVirDev->DrawRect( aBoxRect, nHRound, nVRound );
+ }
+}
+
+void OS2METReader::ReadBitBlt()
+{
+ Point aP1,aP2;
+ Size aSize;
+ sal_uInt32 nID;
+ OSBitmap * pB;
+ long nt;
+
+ pOS2MET->SeekRel(4);
+ *pOS2MET >> nID;
+ pOS2MET->SeekRel(4);
+ aP1=ReadPoint(); aP2=ReadPoint();
+ if (aP1.X() > aP2.X()) { nt=aP1.X(); aP1.X()=aP2.X(); aP2.X()=nt; }
+ if (aP1.Y() > aP2.Y()) { nt=aP1.Y(); aP1.Y()=aP2.Y(); aP2.Y()=nt; }
+ aSize=Size(aP2.X()-aP1.X(),aP2.Y()-aP1.Y());
+
+ pB=pBitmapList;
+ while (pB!=NULL && pB->nID!=nID) pB=pB->pSucc;
+ if (pB!=NULL) {
+ SetRasterOp(aAttr.ePatMix);
+ pVirDev->DrawBitmap(aP1,aSize,pB->aBitmap);
+ }
+}
+
+void OS2METReader::ReadChrStr(BOOL bGivenPos, BOOL bMove, BOOL bExtra, USHORT nOrderLen)
+{
+ Point aP0;
+ USHORT i, nLen;
+ char * pChr;
+ OSFont * pF;
+ Font aFont;
+ Size aSize;
+
+ pF = pFontList;
+ while (pF!=NULL && pF->nID!=aAttr.nChrSet) pF=pF->pSucc;
+ if (pF!=NULL)
+ aFont = pF->aFont;
+ aFont.SetColor(aAttr.aChrCol);
+ aFont.SetSize(Size(0,aAttr.aChrCellSize.Height()));
+ if ( aAttr.nChrAng != 0 )
+ aFont.SetOrientation(aAttr.nChrAng);
+
+ if (bGivenPos)
+ aP0 = ReadPoint();
+ else
+ aP0 = aAttr.aCurPos;
+ if (bExtra)
+ {
+ pOS2MET->SeekRel(2);
+ ReadPoint( FALSE );
+ ReadPoint( FALSE );
+ *pOS2MET >> nLen;
+ }
+ else
+ {
+ if ( !bGivenPos )
+ nLen = nOrderLen;
+ else if ( bCoord32 )
+ nLen = nOrderLen-8;
+ else
+ nLen = nOrderLen-4;
+ }
+ pChr = new char[nLen+1];
+ for (i=0; i<nLen; i++)
+ *pOS2MET >> pChr[i];
+ pChr[nLen] = 0;
+ String aStr( (const sal_Char*)pChr, gsl_getSystemTextEncoding() );
+ SetRasterOp(aAttr.eChrMix);
+ if (pVirDev->GetFont()!=aFont)
+ pVirDev->SetFont(aFont);
+ pVirDev->DrawText(aP0,aStr);
+
+ aSize = Size( pVirDev->GetTextWidth(aStr), pVirDev->GetTextHeight() );
+ if ( aAttr.nChrAng == 0 )
+ {
+ aCalcBndRect.Union(Rectangle( Point(aP0.X(),aP0.Y()-aSize.Height()),
+ Size(aSize.Width(),aSize.Height()*2)));
+ if (bMove)
+ aAttr.aCurPos = Point( aP0.X() + aSize.Width(), aP0.Y());
+ }
+ else
+ {
+ Polygon aDummyPoly(4);
+
+ aDummyPoly.SetPoint( Point( aP0.X(), aP0.Y() ), 0); // TOP LEFT
+ aDummyPoly.SetPoint( Point( aP0.X(), aP0.Y() - aSize.Height() ), 1); // BOTTOM LEFT
+ aDummyPoly.SetPoint( Point( aP0.X() + aSize.Width(), aP0.Y() ), 2); // TOP RIGHT
+ aDummyPoly.SetPoint( Point( aP0.X() + aSize.Width(), aP0.Y() - aSize.Height() ), 3);// BOTTOM RIGHT
+ aDummyPoly.Rotate( aP0, (short)aAttr.nChrAng );
+ if ( bMove )
+ aAttr.aCurPos = aDummyPoly.GetPoint( 0 );
+ aCalcBndRect.Union( Rectangle( aDummyPoly.GetPoint( 0 ), aDummyPoly.GetPoint( 3 ) ) );
+ aCalcBndRect.Union( Rectangle( aDummyPoly.GetPoint( 1 ), aDummyPoly.GetPoint( 2 ) ) );
+ }
+ delete[] pChr;
+}
+
+void OS2METReader::ReadArc(BOOL bGivenPos)
+{
+ Point aP1, aP2, aP3;
+ double x1,y1,x2,y2,x3,y3,p,q,cx,cy,ncx,ncy,r,rx,ry,w1,w3;
+ if (bGivenPos) aP1=ReadPoint(); else aP1=aAttr.aCurPos;
+ aP2=ReadPoint(); aP3=ReadPoint();
+ aAttr.aCurPos=aP3;
+ SetPen( aAttr.aLinCol, aAttr.nStrLinWidth, aAttr.eLinStyle );
+ SetRasterOp(aAttr.eLinMix);
+ // OK, gegeben sind 3 Punkte der Ellipse, und das Verhaeltnis
+ // Breite zu Hoehe (als p zu q):
+ x1=aP1.X(); y1=aP1.Y();
+ x2=aP2.X(); y2=aP2.Y();
+ x3=aP3.X(); y3=aP3.Y();
+ p=aAttr.nArcP;q=aAttr.nArcQ;
+ // Berechnet wird der Mittelpunkt cx,cy der Ellipse:
+ ncy=2*p*p*((y3-y1)*(x2-x1)-(y1-y2)*(x1-x3));
+ ncx=2*q*q*(x2-x1);
+ if ( (ncx<0.001 && ncx>-0.001) || (ncy<0.001 && ncy>-0.001) ) {
+ // Berechnung nicht moeglich, Punkte liegen auf einer Linie
+ pVirDev->DrawLine(aP1,aP2);
+ pVirDev->DrawLine(aP2,aP3);
+ return;
+ }
+ cy=( q*q*((x3*x3-x1*x1)*(x2-x1)+(x2*x2-x1*x1)*(x1-x3)) +
+ p*p*((y3*y3-y1*y1)*(x2-x1)+(y2*y2-y1*y1)*(x1-x3)) ) / ncy;
+ cx=( q*q*(x2*x2-x1*x1)+p*p*(y2*y2-y1*y1)+cy*2*p*p*(y1-y2) ) / ncx;
+ // Nun brauchen wir noch den Radius in x und y Richtung:
+ r=sqrt(q*q*(x1-cx)*(x1-cx)+p*p*(y1-cy)*(y1-cy));
+ rx=r/q; ry=r/p;
+ // Jetzt stellt sich "nur noch" die Frage, wie Start- und Endpunkt
+ // gewaehlt werden muessen, damit Punkt Nr. 2 innerhalb des
+ // gezeichneten Bogens liegt:
+ w1=fmod((atan2(x1-cx,y1-cy)-atan2(x2-cx,y2-cy)),6.28318530718); if (w1<0) w1+=6.28318530718;
+ w3=fmod((atan2(x3-cx,y3-cy)-atan2(x2-cx,y2-cy)),6.28318530718); if (w3<0) w3+=6.28318530718;
+ if (w3<w1) {
+ pVirDev->DrawArc(Rectangle((long)(cx-rx),(long)(cy-ry),
+ (long)(cx+rx),(long)(cy+ry)),aP1,aP3);
+ }
+ else {
+ pVirDev->DrawArc(Rectangle((long)(cx-rx),(long)(cy-ry),
+ (long)(cx+rx),(long)(cy+ry)),aP3,aP1);
+ }
+}
+
+void OS2METReader::ReadFullArc(BOOL bGivenPos, USHORT nOrderSize)
+{
+ Point aCenter;
+ long nP,nQ,nR,nS;
+ Rectangle aRect;
+ sal_uInt32 nMul; USHORT nMulS;
+
+ if (bGivenPos) {
+ aCenter=ReadPoint();
+ if (bCoord32) nOrderSize-=8; else nOrderSize-=4;
+ }
+ else aCenter=aAttr.aCurPos;
+
+ nP=aAttr.nArcP; nQ=aAttr.nArcQ; nR=aAttr.nArcR; nS=aAttr.nArcS;
+ if (nP<0) nP=-nP;
+ if (nQ<0) nQ=-nQ;
+ if (nR<0) nR=-nR;
+ if (nS<0) nS=-nS;
+ if (nOrderSize>=4) *pOS2MET >> nMul;
+ else { *pOS2MET >> nMulS; nMul=((ULONG)nMulS)<<8; }
+ if (nMul!=0x00010000) {
+ nP=(nP*nMul)>>16;
+ nQ=(nQ*nMul)>>16;
+ nR=(nR*nMul)>>16;
+ nS=(nS*nMul)>>16;
+ }
+
+ aRect=Rectangle(aCenter.X()-nP,aCenter.Y()-nQ,
+ aCenter.X()+nP,aCenter.Y()+nQ);
+ aCalcBndRect.Union(aRect);
+
+ if (pAreaStack!=NULL) {
+ ChangeBrush(aAttr.aPatCol,aAttr.aPatBgCol,aAttr.bFill);
+ SetRasterOp(aAttr.ePatMix);
+ if ((pAreaStack->nFlags&0x40)!=0)
+ SetPen( aAttr.aLinCol, aAttr.nStrLinWidth, aAttr.eLinStyle );
+ else
+ SetPen( COL_TRANSPARENT, 0, PEN_NULL );
+ }
+ else
+ {
+ SetPen( aAttr.aLinCol, aAttr.nStrLinWidth, aAttr.eLinStyle );
+ ChangeBrush(Color( COL_TRANSPARENT ),Color( COL_TRANSPARENT ),FALSE);
+ SetRasterOp(aAttr.eLinMix);
+ }
+ pVirDev->DrawEllipse(aRect);
+}
+
+void OS2METReader::ReadPartialArc(BOOL bGivenPos, USHORT nOrderSize)
+{
+ Point aP0, aCenter,aPStart,aPEnd;
+ long nP,nQ,nR,nS,nStart, nSweep;
+ Rectangle aRect;
+ sal_uInt32 nMul; USHORT nMulS;
+ double fStart, fEnd;
+
+ if (bGivenPos) {
+ aP0=ReadPoint();
+ if (bCoord32) nOrderSize-=8; else nOrderSize-=4;
+ }
+ else aP0=aAttr.aCurPos;
+ aCenter=ReadPoint();
+
+ nP=aAttr.nArcP; nQ=aAttr.nArcQ; nR=aAttr.nArcR; nS=aAttr.nArcS;
+ if (nP<0) nP=-nP;
+ if (nQ<0) nQ=-nQ;
+ if (nR<0) nR=-nR;
+ if (nS<0) nS=-nS;
+ if (nOrderSize>=12) *pOS2MET >> nMul;
+ else { *pOS2MET >> nMulS; nMul=((ULONG)nMulS)<<8; }
+ if (nMul!=0x00010000) {
+ nP=(nP*nMul)>>16;
+ nQ=(nQ*nMul)>>16;
+ nR=(nR*nMul)>>16;
+ nS=(nS*nMul)>>16;
+ }
+
+ *pOS2MET >> nStart >> nSweep;
+ fStart=((double)nStart)/65536.0/180.0*3.14159265359;
+ fEnd=fStart+((double)nSweep)/65536.0/180.0*3.14159265359;
+ aPStart=Point(aCenter.X()+(long)( cos(fStart)*nP),
+ aCenter.Y()+(long)(-sin(fStart)*nQ));
+ aPEnd= Point(aCenter.X()+(long)( cos(fEnd)*nP),
+ aCenter.Y()+(long)(-sin(fEnd)*nQ));
+
+ aRect=Rectangle(aCenter.X()-nP,aCenter.Y()-nQ,
+ aCenter.X()+nP,aCenter.Y()+nQ);
+ aCalcBndRect.Union(aRect);
+
+ SetPen( aAttr.aLinCol, aAttr.nStrLinWidth, aAttr.eLinStyle );
+ SetRasterOp(aAttr.eLinMix);
+
+ pVirDev->DrawLine(aP0,aPStart);
+ pVirDev->DrawArc(aRect,aPStart,aPEnd);
+ aAttr.aCurPos=aPEnd;
+}
+
+void OS2METReader::ReadPolygons()
+{
+ sal_uInt32 i,j,nNumPolys, nNumPoints;
+ PolyPolygon aPolyPoly;
+ Polygon aPoly;
+ Point aPoint;
+ BYTE nFlags;
+
+ *pOS2MET >> nFlags >> nNumPolys;
+ for (i=0; i<nNumPolys; i++) {
+ *pOS2MET >> nNumPoints;
+ if (i==0) nNumPoints++;
+ aPoly.SetSize((short)nNumPoints);
+ for (j=0; j<nNumPoints; j++) {
+ if (i==0 && j==0) aPoint=aAttr.aCurPos;
+ else aPoint=ReadPoint();
+ aPoly.SetPoint(aPoint,(short)j);
+ if (i==nNumPolys-1 && j==nNumPoints-1) aAttr.aCurPos=aPoint;
+ }
+ aPolyPoly.Insert(aPoly);
+ }
+
+ ChangeBrush(aAttr.aPatCol,aAttr.aPatBgCol,aAttr.bFill);
+ SetRasterOp(aAttr.ePatMix);
+ if ((nFlags&0x01)!=0)
+ SetPen( aAttr.aLinCol, aAttr.nStrLinWidth, aAttr.eLinStyle );
+ else
+ SetPen( COL_TRANSPARENT, 0, PEN_NULL );
+ DrawPolyPolygon( aPolyPoly );
+}
+
+void OS2METReader::ReadBezier(BOOL bGivenPos, USHORT nOrderLen)
+{
+ USHORT i, nNumPoints = nOrderLen / ( bCoord32 ? 8 : 4 );
+
+ if( !bGivenPos )
+ nNumPoints++;
+
+ if( !nNumPoints )
+ return;
+
+ Polygon aPolygon( nNumPoints );
+
+ for( i=0; i < nNumPoints; i++ )
+ {
+ if( i==0 && !bGivenPos)
+ aPolygon.SetPoint( aAttr.aCurPos, i );
+ else
+ aPolygon.SetPoint( ReadPoint(), i );
+ }
+
+ if( !( nNumPoints % 4 ) )
+ {
+ // create bezier polygon
+ const USHORT nSegPoints = 25;
+ const USHORT nSegments = aPolygon.GetSize() >> 2;
+ Polygon aBezPoly( nSegments * nSegPoints );
+
+ USHORT nSeg, nBezPos, nStartPos;
+ for( nSeg = 0, nBezPos = 0, nStartPos = 0; nSeg < nSegments; nSeg++, nStartPos += 4 )
+ {
+ const Polygon aSegPoly( aPolygon[ nStartPos ], aPolygon[ nStartPos + 1 ],
+ aPolygon[ nStartPos + 3 ], aPolygon[ nStartPos + 2 ],
+ nSegPoints );
+
+ for( USHORT nSegPos = 0; nSegPos < nSegPoints; )
+ aBezPoly[ nBezPos++ ] = aSegPoly[ nSegPos++ ];
+ }
+
+ nNumPoints = nBezPos;
+
+ if( nNumPoints != aBezPoly.GetSize() )
+ aBezPoly.SetSize( nNumPoints );
+
+ aPolygon = aBezPoly;
+ }
+
+ aAttr.aCurPos = aPolygon[ nNumPoints - 1 ];
+
+ if (pAreaStack!=NULL)
+ AddPointsToArea(aPolygon);
+ else if (pPathStack!=NULL)
+ AddPointsToPath(aPolygon);
+ else
+ {
+ SetPen( aAttr.aLinCol, aAttr.nStrLinWidth, aAttr.eLinStyle );
+ SetRasterOp(aAttr.eLinMix);
+ DrawPolyLine( aPolygon );
+ }
+}
+
+void OS2METReader::ReadFillet(BOOL bGivenPos, USHORT nOrderLen)
+{
+ USHORT i,nNumPoints;
+
+ if (bCoord32) nNumPoints=nOrderLen/8; else nNumPoints=nOrderLen/4;
+ if (!bGivenPos) nNumPoints++;
+ if (nNumPoints==0) return;
+ Polygon aPolygon(nNumPoints);
+ for (i=0; i<nNumPoints; i++) {
+ if (i==0 && !bGivenPos) aPolygon.SetPoint(aAttr.aCurPos,i);
+ else aPolygon.SetPoint(ReadPoint(),i);
+ }
+ aAttr.aCurPos=aPolygon.GetPoint(nNumPoints-1);
+ if (pAreaStack!=NULL) AddPointsToArea(aPolygon);
+ else if (pPathStack!=NULL) AddPointsToPath(aPolygon);
+ else {
+ SetPen( aAttr.aLinCol, aAttr.nStrLinWidth, aAttr.eLinStyle );
+ SetRasterOp(aAttr.eLinMix);
+ DrawPolyLine( aPolygon );
+ }
+}
+
+void OS2METReader::ReadFilletSharp(BOOL bGivenPos, USHORT nOrderLen)
+{
+ USHORT i,nNumPoints;
+
+ if (bGivenPos) {
+ aAttr.aCurPos=ReadPoint();
+ if (bCoord32) nOrderLen-=8; else nOrderLen-=4;
+ }
+ if (bCoord32) nNumPoints=1+nOrderLen/10;
+ else nNumPoints=1+nOrderLen/6;
+ Polygon aPolygon(nNumPoints);
+ aPolygon.SetPoint(aAttr.aCurPos,0);
+ for (i=1; i<nNumPoints; i++) aPolygon.SetPoint(ReadPoint(),i);
+ aAttr.aCurPos=aPolygon.GetPoint(nNumPoints-1);
+ if (pAreaStack!=NULL) AddPointsToArea(aPolygon);
+ else if (pPathStack!=NULL) AddPointsToPath(aPolygon);
+ else
+ {
+ SetPen( aAttr.aLinCol, aAttr.nStrLinWidth, aAttr.eLinStyle );
+ SetRasterOp(aAttr.eLinMix);
+ DrawPolyLine( aPolygon );
+ }
+}
+
+void OS2METReader::ReadMarker(BOOL bGivenPos, USHORT nOrderLen)
+{
+ USHORT i,nNumPoints;
+ long x,y;
+
+ SetPen( aAttr.aMrkCol );
+ SetRasterOp(aAttr.eMrkMix);
+ if (aAttr.nMrkSymbol>=5 && aAttr.nMrkSymbol<=9)
+ {
+ ChangeBrush(aAttr.aMrkCol,aAttr.aMrkCol,TRUE);
+ }
+ else
+ {
+ ChangeBrush(Color(COL_TRANSPARENT),Color(COL_TRANSPARENT),FALSE);
+ }
+ if (bCoord32) nNumPoints=nOrderLen/8; else nNumPoints=nOrderLen/4;
+ if (!bGivenPos) nNumPoints++;
+ for (i=0; i<nNumPoints; i++) {
+ if (i!=0 || bGivenPos) aAttr.aCurPos=ReadPoint();
+ x=aAttr.aCurPos.X(); y=aAttr.aCurPos.Y();
+ aCalcBndRect.Union(Rectangle(x-5,y-5,x+5,y+5));
+ switch (aAttr.nMrkSymbol) {
+ case 2: // PLUS
+ pVirDev->DrawLine(Point(x-4,y),Point(x+4,y));
+ pVirDev->DrawLine(Point(x,y-4),Point(x,y+4));
+ break;
+ case 3: // DIAMOND
+ case 7: { // SOLIDDIAMOND
+ Polygon aPoly(4);
+ aPoly.SetPoint(Point(x,y+4),0);
+ aPoly.SetPoint(Point(x+4,y),1);
+ aPoly.SetPoint(Point(x,y-4),2);
+ aPoly.SetPoint(Point(x-4,y),3);
+ pVirDev->DrawPolygon(aPoly);
+ break;
+ }
+ case 4: // SQARE
+ case 8: { // SOLIDSUARE
+ Polygon aPoly(4);
+ aPoly.SetPoint(Point(x+4,y+4),0);
+ aPoly.SetPoint(Point(x+4,y-4),1);
+ aPoly.SetPoint(Point(x-4,y-4),2);
+ aPoly.SetPoint(Point(x-4,y+4),3);
+ pVirDev->DrawPolygon(aPoly);
+ break;
+ }
+ case 5: { // SIXPOINTSTAR
+ Polygon aPoly(12);
+ aPoly.SetPoint(Point(x ,y-4),0);
+ aPoly.SetPoint(Point(x+2,y-2),1);
+ aPoly.SetPoint(Point(x+4,y-2),2);
+ aPoly.SetPoint(Point(x+2,y ),3);
+ aPoly.SetPoint(Point(x+4,y+2),4);
+ aPoly.SetPoint(Point(x+2,y+2),5);
+ aPoly.SetPoint(Point(x ,y+4),6);
+ aPoly.SetPoint(Point(x-2,y+2),7);
+ aPoly.SetPoint(Point(x-4,y+2),8);
+ aPoly.SetPoint(Point(x-2,y ),9);
+ aPoly.SetPoint(Point(x-4,y-2),10);
+ aPoly.SetPoint(Point(x-2,y-2),11);
+ pVirDev->DrawPolygon(aPoly);
+ break;
+ }
+ case 6: { // EIGHTPOINTSTAR
+ Polygon aPoly(16);
+ aPoly.SetPoint(Point(x ,y-4),0);
+ aPoly.SetPoint(Point(x+1,y-2),1);
+ aPoly.SetPoint(Point(x+3,y-3),2);
+ aPoly.SetPoint(Point(x+2,y-1),3);
+ aPoly.SetPoint(Point(x+4,y ),4);
+ aPoly.SetPoint(Point(x+2,y+1),5);
+ aPoly.SetPoint(Point(x+3,y+3),6);
+ aPoly.SetPoint(Point(x+1,y+2),7);
+ aPoly.SetPoint(Point(x ,y+4),8);
+ aPoly.SetPoint(Point(x-1,y+2),9);
+ aPoly.SetPoint(Point(x-3,y+3),10);
+ aPoly.SetPoint(Point(x-2,y+1),11);
+ aPoly.SetPoint(Point(x-4,y ),12);
+ aPoly.SetPoint(Point(x-2,y-1),13);
+ aPoly.SetPoint(Point(x-3,y-3),14);
+ aPoly.SetPoint(Point(x-1,y-2),15);
+ pVirDev->DrawPolygon(aPoly);
+ break;
+ }
+ case 9: // DOT
+ pVirDev->DrawEllipse(Rectangle(x-1,y-1,x+1,y+1));
+ break;
+ case 10: // SMALLCIRCLE
+ pVirDev->DrawEllipse(Rectangle(x-2,y-2,x+2,y+2));
+ break;
+ case 64: // BLANK
+ break;
+ default: // (=1) CROSS
+ pVirDev->DrawLine(Point(x-4,y-4),Point(x+4,y+4));
+ pVirDev->DrawLine(Point(x-4,y+4),Point(x+4,y-4));
+ break;
+ }
+ }
+}
+
+void OS2METReader::ReadOrder(USHORT nOrderID, USHORT nOrderLen)
+{
+ switch (nOrderID) {
+
+ case GOrdGivArc: ReadArc(TRUE); break;
+ case GOrdCurArc: ReadArc(FALSE); break;
+
+ case GOrdGivBzr: ReadBezier(TRUE,nOrderLen); break;
+ case GOrdCurBzr: ReadBezier(FALSE,nOrderLen); break;
+
+ case GOrdGivBox: ReadBox(TRUE); break;
+ case GOrdCurBox: ReadBox(FALSE); break;
+
+ case GOrdGivFil: ReadFillet(TRUE,nOrderLen); break;
+ case GOrdCurFil: ReadFillet(FALSE,nOrderLen); break;
+
+ case GOrdGivCrc: ReadFullArc(TRUE,nOrderLen); break;
+ case GOrdCurCrc: ReadFullArc(FALSE,nOrderLen); break;
+
+ case GOrdGivLin: ReadLine(TRUE, nOrderLen); break;
+ case GOrdCurLin: ReadLine(FALSE, nOrderLen); break;
+
+ case GOrdGivMrk: ReadMarker(TRUE, nOrderLen); break;
+ case GOrdCurMrk: ReadMarker(FALSE, nOrderLen); break;
+
+ case GOrdGivArP: ReadPartialArc(TRUE,nOrderLen); break;
+ case GOrdCurArP: ReadPartialArc(FALSE,nOrderLen); break;
+
+ case GOrdGivRLn: ReadRelLine(TRUE,nOrderLen); break;
+ case GOrdCurRLn: ReadRelLine(FALSE,nOrderLen); break;
+
+ case GOrdGivSFl: ReadFilletSharp(TRUE,nOrderLen); break;
+ case GOrdCurSFl: ReadFilletSharp(FALSE,nOrderLen); break;
+
+ case GOrdGivStM: ReadChrStr(TRUE , TRUE , FALSE, nOrderLen); break;
+ case GOrdCurStM: ReadChrStr(FALSE, TRUE , FALSE, nOrderLen); break;
+ case GOrdGivStr: ReadChrStr(TRUE , FALSE, FALSE, nOrderLen); break;
+ case GOrdCurStr: ReadChrStr(FALSE, FALSE, FALSE, nOrderLen); break;
+ case GOrdGivStx: ReadChrStr(TRUE , FALSE, TRUE , nOrderLen); break;
+ case GOrdCurStx: ReadChrStr(FALSE, FALSE, TRUE , nOrderLen); break;
+
+ case GOrdGivImg: OOODEBUG("GOrdGivImg",0);
+ break;
+ case GOrdCurImg: OOODEBUG("GOrdCurImg",0);
+ break;
+ case GOrdImgDat: OOODEBUG("GOrdImgDat",0);
+ break;
+ case GOrdEndImg: OOODEBUG("GOrdEndImg",0);
+ break;
+
+ case GOrdBegAra: {
+ OSArea * p=new OSArea;
+ p->bClosed=FALSE;
+ p->pSucc=pAreaStack; pAreaStack=p;
+ *pOS2MET >> (p->nFlags);
+ p->aCol=aAttr.aPatCol;
+ p->aBgCol=aAttr.aPatBgCol;
+ p->eMix=aAttr.ePatMix;
+ p->eBgMix=aAttr.ePatBgMix;
+ p->bFill=aAttr.bFill;
+ break;
+ }
+ case GOrdEndAra:
+ {
+ OSArea * p=pAreaStack;
+ if ( p )
+ {
+ pAreaStack = p->pSucc;
+ if ( pPathStack )
+ {
+ for ( USHORT i=0; i<p->aPPoly.Count(); i++ )
+ {
+ AddPointsToPath( p->aPPoly.GetObject( i ) );
+ CloseFigure();
+ }
+ }
+ else
+ {
+ if ( ( p->nFlags & 0x40 ) == 0 )
+ SetPen( COL_TRANSPARENT, 0, PEN_NULL );
+ else
+ SetPen( aAttr.aLinCol, aAttr.nStrLinWidth, aAttr.eLinStyle );
+
+ ChangeBrush(p->aCol,p->aBgCol,p->bFill);
+ SetRasterOp(p->eMix);
+ DrawPolyPolygon( p->aPPoly );
+ }
+ delete p;
+ }
+ }
+ break;
+
+ case GOrdBegElm:// OOODEBUG("GOrdBegElm",0);
+ break;
+ case GOrdEndElm:// OOODEBUG("GOrdEndElm",0);
+ break;
+
+ case GOrdBegPth: {
+ OSPath * p=new OSPath;
+ p->pSucc=pPathStack; pPathStack=p;
+ pOS2MET->SeekRel(2);
+ *pOS2MET >> p->nID;
+ p->bClosed=FALSE;
+ p->bStroke=FALSE;
+ break;
+ }
+ case GOrdEndPth: {
+ OSPath * p, * pprev, * psucc;
+ if (pPathStack==NULL) break;
+ p=pPathList; pprev=NULL;
+ while (p!=NULL) {
+ psucc=p->pSucc;
+ if (p->nID==pPathStack->nID) {
+ if (pprev==NULL) pPathList=psucc; else pprev->pSucc=psucc;
+ delete p;
+ }
+ else pprev=p;
+ p=psucc;
+ }
+ p=pPathStack;
+ pPathStack=p->pSucc;
+ p->pSucc=pPathList; pPathList=p;
+ break;
+ }
+ case GOrdFilPth:
+ {
+ sal_uInt32 nID;
+ UINT16 nDummy;
+ OSPath* p = pPathList;
+
+ *pOS2MET >> nDummy
+ >> nID;
+
+ if ( ! ( nDummy & 0x20 ) ) // #30933# i do not know the exact meaning of this bit,
+ { // but if set it seems to be better not to fill this path
+ while( p && p->nID != nID )
+ p = p->pSucc;
+
+ if( p )
+ {
+ if( p->bStroke )
+ {
+ SetPen( aAttr.aPatCol, aAttr.nStrLinWidth, PEN_SOLID );
+ ChangeBrush(Color(COL_TRANSPARENT),Color(COL_TRANSPARENT),FALSE);
+ SetRasterOp( aAttr.ePatMix );
+ if ( IsLineInfo() )
+ {
+ for ( USHORT i = 0; i < p->aPPoly.Count(); i++ )
+ pVirDev->DrawPolyLine( p->aPPoly.GetObject( i ), aLineInfo );
+ }
+ else
+ pVirDev->DrawPolyPolygon( p->aPPoly );
+ }
+ else
+ {
+ SetPen( COL_TRANSPARENT, 0, PEN_NULL );
+ ChangeBrush( aAttr.aPatCol, aAttr.aPatBgCol, aAttr.bFill );
+ SetRasterOp( aAttr.ePatMix );
+ pVirDev->DrawPolyPolygon( p->aPPoly );
+ }
+ }
+ }
+ }
+ break;
+
+ case GOrdModPth:
+ {
+ OSPath* p = pPathList;
+
+ while( p && p->nID != 1 )
+ p = p->pSucc;
+
+ if( p )
+ p->bStroke = TRUE;
+ }
+ break;
+
+ case GOrdOutPth:
+ {
+ sal_uInt32 nID;
+ USHORT i,nC;
+ OSPath* p=pPathList;
+ pOS2MET->SeekRel(2);
+ *pOS2MET >> nID;
+ while (p!=NULL && p->nID!=nID)
+ p=p->pSucc;
+
+ if( p!=NULL )
+ {
+ SetPen( aAttr.aLinCol, aAttr.nStrLinWidth, aAttr.eLinStyle );
+ SetRasterOp(aAttr.eLinMix);
+ ChangeBrush(Color(COL_TRANSPARENT),Color(COL_TRANSPARENT),FALSE);
+ nC=p->aPPoly.Count();
+ for (i=0; i<nC; i++)
+ {
+ if (i+1<nC || p->bClosed==TRUE)
+ DrawPolygon( p->aPPoly.GetObject( i ) );
+ else
+ DrawPolyLine( p->aPPoly.GetObject( i ) );
+ }
+ }
+ break;
+ }
+ case GOrdSClPth: { OOODEBUG("GOrdSClPth",0);
+ sal_uInt32 nID;
+ OSPath * p=pPathList;
+ pOS2MET->SeekRel(2);
+ *pOS2MET >> nID;
+ if (nID==0) p=NULL;
+ while (p!=NULL && p->nID!=nID) p=p->pSucc;
+ if (p!=NULL) pVirDev->SetClipRegion(Region(p->aPPoly));
+ else pVirDev->SetClipRegion();
+ break;
+ }
+ case GOrdNopNop:
+ break;
+ case GOrdRemark: //OOODEBUG("GOrdRemark",0);
+ break;
+ case GOrdSegLab: OOODEBUG("GOrdSegLab",0);
+ break;
+
+ case GOrdBitBlt: ReadBitBlt(); break;
+
+ case GOrdCalSeg: OOODEBUG("GOrdCalSeg",0);
+ break;
+ case GOrdSSgBnd: OOODEBUG("GOrdSSgBnd",0);
+ break;
+ case GOrdSegChr: OOODEBUG("GOrdSegChr",0);
+ break;
+ case GOrdCloFig:
+ CloseFigure();
+ break;
+ case GOrdEndSym: OOODEBUG("GOrdEndSym",0);
+ break;
+ case GOrdEndPlg: OOODEBUG("GOrdEndPlg",0);
+ break;
+ case GOrdEscape: OOODEBUG("GOrdEscape",0);
+ break;
+ case GOrdExtEsc: OOODEBUG("GOrdExtEsc",0);
+ break;
+
+ case GOrdPolygn: ReadPolygons(); break;
+
+ case GOrdStkPop: PopAttr(); break;
+
+ case GOrdPIvAtr: PushAttr(nOrderID);
+ case GOrdSIvAtr: {
+ BYTE nA, nP, nFlags, nMix;
+ ULONG nVal;
+ Color aCol;
+ RasterOp eROP;
+ *pOS2MET >> nA >> nP >> nFlags;
+ if (nOrderID==GOrdPIvAtr) {
+ pAttrStack->nIvAttrA=nA;
+ pAttrStack->nIvAttrP=nP;
+ }
+ if (nA<=2) {
+ if ((nFlags&0x80)!=0) {
+ if (nA==1) switch (nP) {
+ case 1: aAttr.aLinCol=aDefAttr.aLinCol; break;
+ case 2: aAttr.aChrCol=aDefAttr.aChrCol; break;
+ case 3: aAttr.aMrkCol=aDefAttr.aMrkCol; break;
+ case 4: aAttr.aPatCol=aDefAttr.aPatCol; break;
+ case 5: aAttr.aImgCol=aDefAttr.aImgCol; break;
+ }
+ else switch (nP) {
+ case 1: aAttr.aLinBgCol=aDefAttr.aLinBgCol; break;
+ case 2: aAttr.aChrBgCol=aDefAttr.aChrBgCol; break;
+ case 3: aAttr.aMrkBgCol=aDefAttr.aMrkBgCol; break;
+ case 4: aAttr.aPatBgCol=aDefAttr.aPatBgCol; break;
+ case 5: aAttr.aImgBgCol=aDefAttr.aImgBgCol; break;
+ }
+ }
+ else {
+ nVal=ReadLittleEndian3BytesLong();
+ if ((nFlags&0x40)!=0 && nVal==1) aCol=Color(COL_BLACK);
+ else if ((nFlags&0x40)!=0 && nVal==2) aCol=Color(COL_WHITE);
+ else if ((nFlags&0x40)!=0 && nVal==4) aCol=Color(COL_WHITE);
+ else if ((nFlags&0x40)!=0 && nVal==5) aCol=Color(COL_BLACK);
+ else aCol=GetPaletteColor(nVal);
+ if (nA==1) switch (nP) {
+ case 1: aAttr.aLinCol=aCol; break;
+ case 2: aAttr.aChrCol=aCol; break;
+ case 3: aAttr.aMrkCol=aCol; break;
+ case 4: aAttr.aPatCol=aCol; break;
+ case 5: aAttr.aImgCol=aCol; break;
+ }
+ else switch (nP) {
+ case 1: aAttr.aLinBgCol=aCol; break;
+ case 2: aAttr.aChrBgCol=aCol; break;
+ case 3: aAttr.aMrkBgCol=aCol; break;
+ case 4: aAttr.aPatBgCol=aCol; break;
+ case 5: aAttr.aImgBgCol=aCol; break;
+ }
+ }
+ }
+ else {
+ *pOS2MET >> nMix;
+ if (nMix==0) {
+ if (nA==1) switch (nP) {
+ case 1: aAttr.eLinMix=aDefAttr.eLinMix; break;
+ case 2: aAttr.eChrMix=aDefAttr.eChrMix; break;
+ case 3: aAttr.eMrkMix=aDefAttr.eMrkMix; break;
+ case 4: aAttr.ePatMix=aDefAttr.ePatMix; break;
+ case 5: aAttr.eImgMix=aDefAttr.eImgMix; break;
+ }
+ else switch (nP) {
+ case 1: aAttr.eLinBgMix=aDefAttr.eLinBgMix; break;
+ case 2: aAttr.eChrBgMix=aDefAttr.eChrBgMix; break;
+ case 3: aAttr.eMrkBgMix=aDefAttr.eMrkBgMix; break;
+ case 4: aAttr.ePatBgMix=aDefAttr.ePatBgMix; break;
+ case 5: aAttr.eImgBgMix=aDefAttr.eImgBgMix; break;
+ }
+ }
+ else {
+ eROP=OS2MixToRasterOp(nMix);
+ if (nA==1) switch (nP) {
+ case 1: aAttr.eLinMix=eROP; break;
+ case 2: aAttr.eChrMix=eROP; break;
+ case 3: aAttr.eMrkMix=eROP; break;
+ case 4: aAttr.ePatMix=eROP; break;
+ case 5: aAttr.eImgMix=eROP; break;
+ }
+ else switch (nP) {
+ case 1: aAttr.eLinBgMix=eROP; break;
+ case 2: aAttr.eChrBgMix=eROP; break;
+ case 3: aAttr.eMrkBgMix=eROP; break;
+ case 4: aAttr.ePatBgMix=eROP; break;
+ case 5: aAttr.eImgBgMix=eROP; break;
+ }
+ }
+ }
+ break;
+ }
+ case GOrdPIxCol: PushAttr(nOrderID);
+ case GOrdSIxCol: {
+ BYTE nFlags;
+ ULONG nVal;
+ Color aCol;
+ *pOS2MET >> nFlags;
+ if ((nFlags&0x80)!=0) {
+ aAttr.aLinCol=aDefAttr.aLinCol;
+ aAttr.aChrCol=aDefAttr.aChrCol;
+ aAttr.aMrkCol=aDefAttr.aMrkCol;
+ aAttr.aPatCol=aDefAttr.aPatCol;
+ aAttr.aImgCol=aDefAttr.aImgCol;
+ }
+ else {
+ nVal=ReadLittleEndian3BytesLong();
+ if ((nFlags&0x40)!=0 && nVal==1) aCol=Color(COL_BLACK);
+ else if ((nFlags&0x40)!=0 && nVal==2) aCol=Color(COL_WHITE);
+ else if ((nFlags&0x40)!=0 && nVal==4) aCol=Color(COL_WHITE);
+ else if ((nFlags&0x40)!=0 && nVal==5) aCol=Color(COL_BLACK);
+ else aCol=GetPaletteColor(nVal);
+ aAttr.aLinCol = aAttr.aChrCol = aAttr.aMrkCol = aAttr.aPatCol =
+ aAttr.aImgCol = aCol;
+ }
+ break;
+ }
+
+ case GOrdPColor:
+ case GOrdPXtCol: PushAttr(nOrderID);
+ case GOrdSColor:
+ case GOrdSXtCol: {
+ BYTE nbyte;
+ USHORT nVal;
+ Color aCol;
+ if (nOrderID==GOrdPColor || nOrderID==GOrdSColor) {
+ *pOS2MET >> nbyte; nVal=((USHORT)nbyte)|0xff00;
+ }
+ else *pOS2MET >> nVal;
+ if (nVal==0x0000 || nVal==0xff00) {
+ aAttr.aLinCol=aDefAttr.aLinCol;
+ aAttr.aChrCol=aDefAttr.aChrCol;
+ aAttr.aMrkCol=aDefAttr.aMrkCol;
+ aAttr.aPatCol=aDefAttr.aPatCol;
+ aAttr.aImgCol=aDefAttr.aImgCol;
+ }
+ else {
+ if (nVal==0x0007) aCol=Color(COL_WHITE);
+ else if (nVal==0x0008) aCol=Color(COL_BLACK);
+ else if (nVal==0xff08) aCol=GetPaletteColor(1);
+ else aCol=GetPaletteColor(((ULONG)nVal) & 0x000000ff);
+ aAttr.aLinCol = aAttr.aChrCol = aAttr.aMrkCol = aAttr.aPatCol =
+ aAttr.aImgCol = aCol;
+ }
+ break;
+ }
+
+ case GOrdPBgCol: PushAttr(nOrderID);
+ case GOrdSBgCol: {
+ USHORT nVal;
+ Color aCol;
+ *pOS2MET >> nVal;
+ if (nVal==0x0000 || nVal==0xff00) {
+ aAttr.aLinBgCol=aDefAttr.aLinBgCol;
+ aAttr.aChrBgCol=aDefAttr.aChrBgCol;
+ aAttr.aMrkBgCol=aDefAttr.aMrkBgCol;
+ aAttr.aPatBgCol=aDefAttr.aPatBgCol;
+ aAttr.aImgBgCol=aDefAttr.aImgBgCol;
+ }
+ else {
+ if (nVal==0x0007) aCol=Color(COL_WHITE);
+ else if (nVal==0x0008) aCol=Color(COL_BLACK);
+ else if (nVal==0xff08) aCol=GetPaletteColor(0);
+ else aCol=GetPaletteColor(((ULONG)nVal) & 0x000000ff);
+ aAttr.aLinBgCol = aAttr.aChrBgCol = aAttr.aMrkBgCol =
+ aAttr.aPatBgCol = aAttr.aImgBgCol = aCol;
+ }
+ break;
+ }
+ case GOrdPBxCol: PushAttr(nOrderID);
+ case GOrdSBxCol: {
+ BYTE nFlags;
+ ULONG nVal;
+ Color aCol;
+ *pOS2MET >> nFlags;
+ if ((nFlags&0x80)!=0) {
+ aAttr.aLinBgCol=aDefAttr.aLinBgCol;
+ aAttr.aChrBgCol=aDefAttr.aChrBgCol;
+ aAttr.aMrkBgCol=aDefAttr.aMrkBgCol;
+ aAttr.aPatBgCol=aDefAttr.aPatBgCol;
+ aAttr.aImgBgCol=aDefAttr.aImgBgCol;
+ }
+ else {
+ nVal=ReadLittleEndian3BytesLong();
+ if ((nFlags&0x40)!=0 && nVal==1) aCol=Color(COL_BLACK);
+ else if ((nFlags&0x40)!=0 && nVal==2) aCol=Color(COL_WHITE);
+ else if ((nFlags&0x40)!=0 && nVal==4) aCol=Color(COL_WHITE);
+ else if ((nFlags&0x40)!=0 && nVal==5) aCol=Color(COL_BLACK);
+ else aCol=GetPaletteColor(nVal);
+ aAttr.aLinBgCol = aAttr.aChrBgCol = aAttr.aMrkBgCol =
+ aAttr.aPatBgCol = aAttr.aImgBgCol = aCol;
+ }
+ break;
+ }
+
+ case GOrdPMixMd: PushAttr(nOrderID);
+ case GOrdSMixMd: {
+ BYTE nMix;
+ *pOS2MET >> nMix;
+ if (nMix==0) {
+ aAttr.eLinMix=aDefAttr.eLinMix;
+ aAttr.eChrMix=aDefAttr.eChrMix;
+ aAttr.eMrkMix=aDefAttr.eMrkMix;
+ aAttr.ePatMix=aDefAttr.ePatMix;
+ aAttr.eImgMix=aDefAttr.eImgMix;
+ }
+ else {
+ aAttr.eLinMix = aAttr.eChrMix = aAttr.eMrkMix =
+ aAttr.ePatMix = aAttr.eImgMix = OS2MixToRasterOp(nMix);
+ }
+ break;
+ }
+ case GOrdPBgMix: PushAttr(nOrderID);
+ case GOrdSBgMix: {
+ BYTE nMix;
+ *pOS2MET >> nMix;
+ if (nMix==0) {
+ aAttr.eLinBgMix=aDefAttr.eLinBgMix;
+ aAttr.eChrBgMix=aDefAttr.eChrBgMix;
+ aAttr.eMrkBgMix=aDefAttr.eMrkBgMix;
+ aAttr.ePatBgMix=aDefAttr.ePatBgMix;
+ aAttr.eImgBgMix=aDefAttr.eImgBgMix;
+ }
+ else {
+ aAttr.eLinBgMix = aAttr.eChrBgMix = aAttr.eMrkBgMix =
+ aAttr.ePatBgMix = aAttr.eImgBgMix = OS2MixToRasterOp(nMix);
+ }
+ break;
+ }
+ case GOrdPPtSet: PushAttr(nOrderID);
+ case GOrdSPtSet: OOODEBUG("GOrdSPtSet",0);
+ break;
+
+ case GOrdPPtSym: PushAttr(nOrderID);
+ case GOrdSPtSym: {
+ BYTE nPatt;
+ *pOS2MET >> nPatt;
+ aAttr.bFill = ( nPatt != 0x0f );
+ break;
+ }
+
+ case GOrdPPtRef: PushAttr(nOrderID);
+ case GOrdSPtRef: OOODEBUG("GOrdSPtRef",0);
+ break;
+
+ case GOrdPLnEnd: PushAttr(nOrderID);
+ case GOrdSLnEnd:
+ break;
+
+ case GOrdPLnJoi: PushAttr(nOrderID);
+ case GOrdSLnJoi:
+ break;
+
+ case GOrdPLnTyp: PushAttr(nOrderID);
+ case GOrdSLnTyp: {
+ BYTE nType;
+ *pOS2MET >> nType;
+ switch (nType) {
+ case 0: aAttr.eLinStyle=aDefAttr.eLinStyle; break;
+ case 1: case 4: aAttr.eLinStyle=PEN_DOT; break;
+ case 2: case 5: aAttr.eLinStyle=PEN_DASH; break;
+ case 3: case 6: aAttr.eLinStyle=PEN_DASHDOT; break;
+ case 8: aAttr.eLinStyle=PEN_NULL; break;
+ default: aAttr.eLinStyle=PEN_SOLID;
+ }
+ break;
+ }
+ case GOrdPLnWdt: PushAttr(nOrderID);
+ case GOrdSLnWdt: {
+ BYTE nbyte;
+ *pOS2MET >> nbyte;
+ if (nbyte==0) aAttr.nLinWidth=aDefAttr.nLinWidth;
+ else aAttr.nLinWidth=(USHORT)nbyte-1;
+ break;
+ }
+ case GOrdPFrLWd: PushAttr(nOrderID);
+ case GOrdSFrLWd:
+ break;
+
+ case GOrdPStLWd: PushAttr(nOrderID);
+ case GOrdSStLWd :
+ {
+ BYTE nFlags;
+ long nWd;
+
+ *pOS2MET >> nFlags;
+ if ( nFlags & 0x80 )
+ aAttr.nStrLinWidth = aDefAttr.nStrLinWidth;
+ else
+ {
+ pOS2MET->SeekRel( 1 );
+ nWd = ReadCoord( bCoord32 );
+ if ( nWd < 0 )
+ nWd = -nWd;
+ aAttr.nStrLinWidth = (USHORT)nWd;
+ }
+ break;
+ }
+ case GOrdPChDir: PushAttr(nOrderID);
+ case GOrdSChDir:
+ break;
+
+ case GOrdPChPrc: PushAttr(nOrderID);
+ case GOrdSChPrc:
+ break;
+
+ case GOrdPChSet: PushAttr(nOrderID);
+ case GOrdSChSet: {
+ BYTE nbyte; *pOS2MET >> nbyte;
+ aAttr.nChrSet=((ULONG)nbyte)&0xff;
+ break;
+ }
+ case GOrdPChAng: PushAttr(nOrderID);
+ case GOrdSChAng: {
+ long nX,nY;
+ nX=ReadCoord(bCoord32); nY=ReadCoord(bCoord32);
+ if (nX>=0 && nY==0) aAttr.nChrAng=0;
+ else {
+ aAttr.nChrAng=(short)(atan2((double)nY,(double)nX)/3.1415926539*1800.0);
+ while (aAttr.nChrAng<0) aAttr.nChrAng+=3600;
+ aAttr.nChrAng%=3600;
+ }
+ break;
+ }
+ case GOrdPChBrx: PushAttr(nOrderID);
+ case GOrdSChBrx:
+ break;
+
+ case GOrdPChCel: PushAttr(nOrderID);
+ case GOrdSChCel: {
+ BYTE nbyte;
+ USHORT nLen=nOrderLen;
+ aAttr.aChrCellSize.Width()=ReadCoord(bCoord32);
+ aAttr.aChrCellSize.Height()=ReadCoord(bCoord32);
+ if (bCoord32) nLen-=8; else nLen-=4;
+ if (nLen>=4) {
+ pOS2MET->SeekRel(4); nLen-=4;
+ }
+ if (nLen>=2) {
+ *pOS2MET >> nbyte;
+ if ((nbyte&0x80)==0 && aAttr.aChrCellSize==Size(0,0))
+ aAttr.aChrCellSize=aDefAttr.aChrCellSize;
+ }
+ break;
+ }
+ case GOrdPChXtr: PushAttr(nOrderID);
+ case GOrdSChXtr:
+ break;
+
+ case GOrdPChShr: PushAttr(nOrderID);
+ case GOrdSChShr:
+ break;
+
+ case GOrdPTxAlg: PushAttr(nOrderID);
+ case GOrdSTxAlg: OOODEBUG("GOrdSTxAlg",0);
+ break;
+
+ case GOrdPMkPrc: PushAttr(nOrderID);
+ case GOrdSMkPrc: {
+ BYTE nbyte;
+ *pOS2MET >> nbyte;
+ if (nbyte==0) aAttr.nMrkPrec=aDefAttr.nMrkPrec;
+ else aAttr.nMrkPrec=nbyte;
+ break;
+ }
+
+ case GOrdPMkSet: PushAttr(nOrderID);
+ case GOrdSMkSet: {
+ BYTE nbyte;
+ *pOS2MET >> nbyte;
+ if (nbyte==0) aAttr.nMrkSet=aDefAttr.nMrkSet;
+ else aAttr.nMrkSet=nbyte;
+ break;
+ }
+
+ case GOrdPMkSym: PushAttr(nOrderID);
+ case GOrdSMkSym: {
+ BYTE nbyte;
+ *pOS2MET >> nbyte;
+ if (nbyte==0) aAttr.nMrkSymbol=aDefAttr.nMrkSymbol;
+ else aAttr.nMrkSymbol=nbyte;
+ break;
+ }
+
+ case GOrdPMkCel: PushAttr(nOrderID);
+ case GOrdSMkCel: {
+ BYTE nbyte;
+ USHORT nLen=nOrderLen;
+ aAttr.aMrkCellSize.Width()=ReadCoord(bCoord32);
+ aAttr.aMrkCellSize.Height()=ReadCoord(bCoord32);
+ if (bCoord32) nLen-=8; else nLen-=4;
+ if (nLen>=2) {
+ *pOS2MET >> nbyte;
+ if ((nbyte&0x80)==0 && aAttr.aMrkCellSize==Size(0,0))
+ aAttr.aMrkCellSize=aDefAttr.aMrkCellSize;
+ }
+ break;
+ }
+
+ case GOrdPArcPa: PushAttr(nOrderID);
+ case GOrdSArcPa:
+ aAttr.nArcP=ReadCoord(bCoord32);
+ aAttr.nArcQ=ReadCoord(bCoord32);
+ aAttr.nArcR=ReadCoord(bCoord32);
+ aAttr.nArcS=ReadCoord(bCoord32);
+ break;
+
+ case GOrdPCrPos: PushAttr(nOrderID);
+ case GOrdSCrPos:
+ aAttr.aCurPos=ReadPoint();
+ break;
+
+ case GOrdPMdTrn: PushAttr(nOrderID);
+ case GOrdSMdTrn: OOODEBUG("GOrdSMdTrn",0);
+ break;
+
+ case GOrdPPkIdn: PushAttr(nOrderID);
+ case GOrdSPkIdn: OOODEBUG("GOrdSPkIdn",0);
+ break;
+
+ case GOrdSVwTrn: OOODEBUG("GOrdSVwTrn",0);
+ break;
+
+ case GOrdPVwWin: PushAttr(nOrderID);
+ case GOrdSVwWin: OOODEBUG("GOrdSVwWin",0);
+ break;
+ default: OOODEBUG("Order unbekannt:",nOrderID);
+ }
+}
+
+void OS2METReader::ReadDsc(USHORT nDscID, USHORT /*nDscLen*/)
+{
+ switch (nDscID) {
+ case 0x00f7: { // 'Specify GVM Subset'
+ BYTE nbyte;
+ pOS2MET->SeekRel(6);
+ *pOS2MET >> nbyte;
+ if (nbyte==0x05) bCoord32=TRUE;
+ else if (nbyte==0x04) bCoord32=FALSE;
+ else {
+ pOS2MET->SetError(SVSTREAM_FILEFORMAT_ERROR);
+ ErrorCode=1;
+ }
+ break;
+ }
+ case 0x00f6:
+ {
+ // 'Set Picture Descriptor'
+ BOOL b32;
+ BYTE nbyte,nUnitType;
+ long x1,y1,x2,y2,nt,xr,yr;
+
+ pOS2MET->SeekRel(2);
+ *pOS2MET >> nbyte;
+
+ if (nbyte==0x05)
+ b32=TRUE;
+ else if(nbyte==0x04)
+ b32=FALSE;
+ else
+ {
+ b32 = FALSE; // -Wall added the case.
+ pOS2MET->SetError(SVSTREAM_FILEFORMAT_ERROR);
+ ErrorCode=2;
+ }
+
+ *pOS2MET >> nUnitType;
+
+ xr=ReadCoord(b32);
+ yr=ReadCoord(b32);
+
+ ReadCoord(b32);
+
+ if (nUnitType==0x00 && xr>0 && yr>0)
+ aGlobMapMode=MapMode(MAP_INCH,Point(0,0),Fraction(10,xr),Fraction(10,yr));
+ else if (nUnitType==0x01 && xr>0 && yr>0)
+ aGlobMapMode=MapMode(MAP_CM,Point(0,0),Fraction(10,xr),Fraction(10,yr));
+ else
+ aGlobMapMode=MapMode();
+
+ x1=ReadCoord(b32);
+ x2=ReadCoord(b32);
+ y1=ReadCoord(b32);
+ y2=ReadCoord(b32);
+
+ if (x1>x2)
+ {
+ nt=x1;
+ x1=x2;
+ x2=nt;
+ }
+
+ if (y1>y2)
+ {
+ nt=y1;
+ y1=y2;
+ y2=nt;
+ }
+
+ aBoundingRect.Left() = x1;
+ aBoundingRect.Right() = x2;
+ aBoundingRect.Top() = y1;
+ aBoundingRect.Bottom() = y2;
+
+ // no output beside this bounding rect
+ pVirDev->IntersectClipRegion( Rectangle( Point(), aBoundingRect.GetSize() ) );
+
+ break;
+ }
+ case 0x0021: // 'Set Current Defaults'
+ break;
+ }
+}
+
+void OS2METReader::ReadImageData(USHORT nDataID, USHORT nDataLen)
+{
+ OSBitmap * p=pBitmapList; if (p==NULL) return; // Nanu ?
+
+ switch (nDataID) {
+
+ case 0x0070: // Begin Segment
+ break;
+
+ case 0x0091: // Begin Image Content
+ break;
+
+ case 0x0094: // Image Size
+ pOS2MET->SeekRel(5);
+ p->nHeight=ReadBigEndianWord();
+ p->nWidth=ReadBigEndianWord();
+ break;
+
+ case 0x0095: // Image Encoding
+ break;
+
+ case 0x0096: { // Image IDE-Size
+ BYTE nbyte;
+ *pOS2MET >> nbyte; p->nBitsPerPixel=nbyte;
+ break;
+ }
+
+ case 0x0097: // Image LUT-ID
+ break;
+
+ case 0x009b: // IDE Structure
+ break;
+
+ case 0xfe92: { // Image Data
+ // Spaetestens jetzt brauchen wir die temporaere BMP-Datei
+ // und darin mindestens den Header + Palette.
+ if (p->pBMP==NULL) {
+ p->pBMP=new SvMemoryStream();
+ p->pBMP->SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN);
+ if (p->nWidth==0 || p->nHeight==0 || p->nBitsPerPixel==0) {
+ pOS2MET->SetError(SVSTREAM_FILEFORMAT_ERROR);
+ ErrorCode=3;
+ return;
+ }
+ // Schreibe (Windows-)BITMAPINFOHEADER:
+ *(p->pBMP) << ((sal_uInt32)40) << p->nWidth << p->nHeight;
+ *(p->pBMP) << ((USHORT)1) << p->nBitsPerPixel;
+ *(p->pBMP) << ((sal_uInt32)0) << ((sal_uInt32)0) << ((sal_uInt32)0) << ((sal_uInt32)0);
+ *(p->pBMP) << ((sal_uInt32)0) << ((sal_uInt32)0);
+ // Schreibe Farbtabelle:
+ if (p->nBitsPerPixel<=8) {
+ USHORT i, nColTabSize=1<<(p->nBitsPerPixel);
+ for (i=0; i<nColTabSize; i++) *(p->pBMP) << GetPalette0RGB(i);
+ }
+ }
+ // OK, nun werden die Map-Daten ruebergeschoben. Leider haben OS2 und
+ // BMP eine unterschiedliche Reihenfolge von RGB bei 24-Bit.
+ BYTE * pBuf=new BYTE[nDataLen];
+ pOS2MET->Read(pBuf,nDataLen);
+ if (p->nBitsPerPixel==24) {
+ ULONG i, j, nAlign, nBytesPerLine;
+ BYTE nTemp;
+ nBytesPerLine=(p->nWidth*3+3)&0xfffffffc;
+ nAlign=p->nMapPos-(p->nMapPos % nBytesPerLine);
+ i=0;
+ while (nAlign+i+2<p->nMapPos+nDataLen) {
+ if (nAlign+i>=p->nMapPos) {
+ j=nAlign+i-p->nMapPos;
+ nTemp=pBuf[j]; pBuf[j]=pBuf[j+2]; pBuf[j+2]=nTemp;
+ }
+ i+=3; if (i+2>=nBytesPerLine) {
+ nAlign+=nBytesPerLine;
+ i=0;
+ }
+ }
+ }
+ p->pBMP->Write(pBuf,nDataLen);
+ p->nMapPos+=nDataLen;
+ delete[] pBuf;
+ break;
+ }
+ case 0x0093: // End Image Content
+ break;
+
+ case 0x0071: // End Segment
+ break;
+ }
+}
+
+void OS2METReader::ReadFont(USHORT nFieldSize)
+{
+ ULONG nPos, nMaxPos;
+ USHORT nLen;
+ BYTE nByte, nTripType, nTripType2;
+ OSFont * pF=new OSFont;
+ pF->pSucc=pFontList; pFontList=pF;
+ pF->nID=0;
+ pF->aFont.SetTransparent(TRUE);
+ pF->aFont.SetAlign(ALIGN_BASELINE);
+
+ nPos=pOS2MET->Tell();
+ nMaxPos=nPos+(ULONG)nFieldSize;
+ pOS2MET->SeekRel(2); nPos+=2;
+ while (nPos<nMaxPos && pOS2MET->GetError()==0) {
+ *pOS2MET >> nByte; nLen =((USHORT)nByte) & 0x00ff;
+ *pOS2MET >> nTripType;
+ switch (nTripType) {
+ case 0x02:
+ *pOS2MET >> nTripType2;
+ switch (nTripType2) {
+ case 0x84: // Font name
+ break;
+ case 0x08: { // Font Typeface
+ char str[33];
+ pOS2MET->SeekRel(1);
+ pOS2MET->Read( &str, 32 );
+ str[ 32 ] = 0;
+ String aStr( (const sal_Char*)str, gsl_getSystemTextEncoding() );
+ if ( aStr.CompareIgnoreCaseToAscii( "Helv" ) == COMPARE_EQUAL )
+ aStr = String::CreateFromAscii( "Helvetica" );
+ pF->aFont.SetName( aStr );
+ break;
+ }
+ }
+ break;
+ case 0x24: // Icid
+ *pOS2MET >> nTripType2;
+ switch (nTripType2) {
+ case 0x05: //Icid
+ *pOS2MET >> nByte;
+ pF->nID=((ULONG)nByte)&0xff;
+ break;
+ }
+ break;
+ case 0x20: // Font Binary GCID
+ break;
+ case 0x1f: { // Font Attributes
+ FontWeight eWeight;
+ BYTE nbyte;
+ *pOS2MET >> nbyte;
+ switch (nbyte) {
+ case 1: eWeight=WEIGHT_THIN; break;
+ case 2: eWeight=WEIGHT_ULTRALIGHT; break;
+ case 3: eWeight=WEIGHT_LIGHT; break;
+ case 4: eWeight=WEIGHT_SEMILIGHT; break;
+ case 5: eWeight=WEIGHT_NORMAL; break;
+ case 6: eWeight=WEIGHT_SEMIBOLD; break;
+ case 7: eWeight=WEIGHT_BOLD; break;
+ case 8: eWeight=WEIGHT_ULTRABOLD; break;
+ case 9: eWeight=WEIGHT_BLACK; break;
+ default: eWeight=WEIGHT_DONTKNOW;
+ }
+ pF->aFont.SetWeight(eWeight);
+ break;
+ }
+ }
+ nPos+=nLen; pOS2MET->Seek(nPos);
+ }
+}
+
+void OS2METReader::ReadField(USHORT nFieldType, USHORT nFieldSize)
+{
+ switch (nFieldType) {
+ case BegDocumnMagic:
+ break;
+ case EndDocumnMagic:
+ break;
+ case BegResGrpMagic:
+ break;
+ case EndResGrpMagic:
+ break;
+ case BegColAtrMagic:
+ break;
+ case EndColAtrMagic:
+ break;
+ case BlkColAtrMagic: {
+ ULONG nPos, nMaxPos;
+ BYTE nbyte;
+ ULONG nCol;
+ USHORT nStartIndex, nEndIndex, i, nElemLen, nBytesPerCol;
+
+ nPos=pOS2MET->Tell();
+ nMaxPos=nPos+(ULONG)nFieldSize;
+ pOS2MET->SeekRel(3); nPos+=3;
+ while (nPos<nMaxPos && pOS2MET->GetError()==0) {
+ *pOS2MET >> nbyte; nElemLen=((USHORT)nbyte) & 0x00ff;
+ if (nElemLen>11) {
+ pOS2MET->SeekRel(4);
+ nStartIndex=ReadBigEndianWord();
+ pOS2MET->SeekRel(3);
+ *pOS2MET >> nbyte; nBytesPerCol=((USHORT)nbyte) & 0x00ff;
+ nEndIndex=nStartIndex+(nElemLen-11)/nBytesPerCol;
+ for (i=nStartIndex; i<nEndIndex; i++) {
+ if (nBytesPerCol > 3) pOS2MET->SeekRel(nBytesPerCol-3);
+ nCol=ReadBigEndian3BytesLong();
+ SetPalette0RGB(i,nCol);
+ }
+ }
+ else if (nElemLen<10) {
+ pOS2MET->SetError(SVSTREAM_FILEFORMAT_ERROR);
+ ErrorCode=4;
+ }
+ nPos+=(ULONG)nElemLen;
+ pOS2MET->Seek(nPos);
+ }
+ break;
+ }
+ case MapColAtrMagic:
+ break;
+ case BegImgObjMagic: {
+ // neue Bitmap schonmal herstellen: (wird spaeter gefuellt)
+ OSBitmap * pB=new OSBitmap;
+ pB->pSucc=pBitmapList; pBitmapList=pB;
+ pB->pBMP=NULL; pB->nWidth=0; pB->nHeight=0; pB->nBitsPerPixel=0;
+ pB->nMapPos=0;
+ // ID der Bitmap ermitteln:
+ BYTE i,nbyte,nbyte2;
+ pB->nID=0;
+ for (i=0; i<4; i++) {
+ *pOS2MET >> nbyte >> nbyte2;
+ nbyte=((nbyte-0x30)<<4)|(nbyte2-0x30);
+ pB->nID=(pB->nID>>8)|(((ULONG)nbyte)<<24);
+ }
+ // neue Palette auf den Paletten-Stack bringen: (wird spaeter gefuellt)
+ OSPalette * pP=new OSPalette;
+ pP->pSucc=pPaletteStack; pPaletteStack=pP;
+ pP->p0RGB=NULL; pP->nSize=0;
+ break;
+ }
+ case EndImgObjMagic: {
+ // Temporaere Windows-BMP-Datei auslesen:
+ if (pBitmapList==NULL || pBitmapList->pBMP==NULL ||
+ pBitmapList->pBMP->GetError()!=0) {
+ pOS2MET->SetError(SVSTREAM_FILEFORMAT_ERROR);
+ ErrorCode=5;
+ return;
+ }
+ pBitmapList->pBMP->Seek(0);
+
+ pBitmapList->aBitmap.Read( *( pBitmapList->pBMP ), FALSE );
+
+ if (pBitmapList->pBMP->GetError()!=0) {
+ pOS2MET->SetError(SVSTREAM_FILEFORMAT_ERROR);
+ ErrorCode=6;
+ }
+ delete pBitmapList->pBMP; pBitmapList->pBMP=NULL;
+ // Palette vom Stack killen:
+ OSPalette * pP=pPaletteStack;
+ if (pP!=NULL) {
+ pPaletteStack=pP->pSucc;
+ if (pP->p0RGB!=NULL) delete[] pP->p0RGB;
+ delete pP;
+ }
+ break;
+ }
+ case DscImgObjMagic:
+ break;
+ case DatImgObjMagic: {
+ USHORT nDataID, nDataLen;
+ BYTE nbyte;
+ ULONG nPos, nMaxPos;
+
+ nPos=pOS2MET->Tell();
+ nMaxPos=nPos+(ULONG)nFieldSize;
+ while (nPos<nMaxPos && pOS2MET->GetError()==0) {
+ *pOS2MET >> nbyte; nDataID=((USHORT)nbyte)&0x00ff;
+ if (nDataID==0x00fe) {
+ *pOS2MET >> nbyte;
+ nDataID=(nDataID<<8)|(((USHORT)nbyte)&0x00ff);
+ nDataLen=ReadBigEndianWord();
+ nPos+=4;
+ }
+ else {
+ *pOS2MET >> nbyte; nDataLen=((USHORT)nbyte)&0x00ff;
+ nPos+=2;
+ }
+ ReadImageData(nDataID, nDataLen);
+ nPos+=(ULONG)nDataLen;
+ pOS2MET->Seek(nPos);
+ }
+ break;
+ }
+
+ case BegObEnv1Magic:
+ break;
+ case EndObEnv1Magic:
+ break;
+ case BegGrfObjMagic:
+ break;
+ case EndGrfObjMagic: {
+ SvStream * pSave;
+ ULONG nPos, nMaxPos;
+ USHORT nOrderID, nOrderLen;
+ BYTE nbyte;
+
+ if (pOrdFile==NULL) break;
+
+ // in pOrdFile wurden alle "DatGrfObj"-Felder gesammelt, so
+ // dass die darin enthaltnen "Orders" zusammenhangend und nicht durch
+ // "Fields" segmentiert sind. Um sie aus dem MemoryStream auszulesen,
+ // ohne grosse Umstaende deswegen zu haben (frueher wurden die "Orders"
+ // direkt aus pOS2MET gelesen), hier ein kleiner Trick:
+ pSave=pOS2MET;
+ pOS2MET=pOrdFile; //(!)
+ nMaxPos=pOS2MET->Tell();
+ pOS2MET->Seek(0);
+
+ // "Segmentheader":
+ *pOS2MET >> nbyte;
+ if (nbyte==0x70) { // Header vorhanden
+ pOS2MET->SeekRel(15); // brauchen wir aber nicht
+ }
+ else pOS2MET->SeekRel(-1); // Kein Header, Byte zurueck
+
+ // Schleife ueber Order:
+ while (pOS2MET->Tell()<nMaxPos && pOS2MET->GetError()==0) {
+ *pOS2MET >> nbyte; nOrderID=((USHORT)nbyte) & 0x00ff;
+ if (nOrderID==0x00fe) {
+ *pOS2MET >> nbyte;
+ nOrderID=(nOrderID << 8) | (((USHORT)nbyte) & 0x00ff);
+ }
+ if (nOrderID>0x00ff || nOrderID==GOrdPolygn) {
+ // ooo: Laut OS2-Doku sollte die Orderlaenge nun als Big-Endian-Word
+ // gegeben sein (Zitat: "Highorder byte precedes loworder byte").
+ // Tatsaechlich gibt es aber Dateien, die die Laenge als
+ // Little-Endian-Word angeben (zu mindestens fuer nOrderID==GOrdPolygn).
+ // Also werfen wir eine Muenze oder was ?
+ *pOS2MET >> nbyte; nOrderLen=(USHORT)nbyte&0x00ff;
+ *pOS2MET >> nbyte; if (nbyte!=0) nOrderLen=nOrderLen<<8|(((USHORT)nbyte)&0x00ff);
+ }
+ else if (nOrderID==GOrdSTxAlg || nOrderID==GOrdPTxAlg) nOrderLen=2;
+ else if ((nOrderID&0xff88)==0x0008) nOrderLen=1;
+ else if (nOrderID==0x0000 || nOrderID==0x00ff) nOrderLen=0;
+ else { *pOS2MET >> nbyte; nOrderLen=((USHORT)nbyte) & 0x00ff; }
+ nPos=pOS2MET->Tell();
+ ReadOrder(nOrderID, nOrderLen);
+ if (nPos+nOrderLen < pOS2MET->Tell()) {
+ OOODEBUG("Order kuerzer als er denkt! OrderID:",nOrderID);
+ OOODEBUG("...und zwar bei Position (Parameteranfang):",nPos);
+ }
+ else if (nPos+nOrderLen != pOS2MET->Tell()) {
+ OOODEBUG(String(nOrderID)+String(" Order nicht alles gelesen! bei:"),nPos);
+ }
+ pOS2MET->Seek(nPos+nOrderLen);
+ }
+
+ pOS2MET=pSave;
+ if (pOrdFile->GetError()) {
+ pOS2MET->SetError(SVSTREAM_FILEFORMAT_ERROR);
+ ErrorCode=10;
+ }
+ delete pOrdFile; pOrdFile=NULL;
+ break;
+ }
+ case DscGrfObjMagic: {
+ ULONG nPos, nMaxPos;
+ USHORT nDscID, nDscLen;
+ BYTE nbyte;
+
+ nMaxPos=pOS2MET->Tell()+(ULONG)nFieldSize;
+ while (pOS2MET->Tell()<nMaxPos && pOS2MET->GetError()==0) {
+ *pOS2MET >> nbyte; nDscID =((USHORT)nbyte) & 0x00ff;
+ *pOS2MET >> nbyte; nDscLen=((USHORT)nbyte) & 0x00ff;
+ nPos=pOS2MET->Tell();
+ ReadDsc(nDscID, nDscLen);
+ pOS2MET->Seek(nPos+nDscLen);
+ }
+ break;
+ }
+ case DatGrfObjMagic: {
+ if (pOrdFile==NULL) {
+ pOrdFile = new SvMemoryStream;
+ pOrdFile->SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN);
+ }
+ BYTE * pBuf; pBuf = new BYTE[nFieldSize];
+ pOS2MET->Read(pBuf,nFieldSize);
+ pOrdFile->Write(pBuf,nFieldSize);
+ delete[] pBuf;
+ break;
+ }
+ case MapCodFntMagic:
+ ReadFont(nFieldSize);
+ break;
+
+ case MapDatResMagic:
+ break;
+ }
+}
+
+void OS2METReader::ReadOS2MET( SvStream & rStreamOS2MET, GDIMetaFile & rGDIMetaFile )
+{
+ USHORT nFieldSize;
+ USHORT nFieldType;
+ ULONG nPos, nStartPos, nEndPos, nPercent, nLastPercent;
+ BYTE nMagicByte;
+
+ ErrorCode=0;
+
+ pOS2MET = &rStreamOS2MET;
+ nOrigPos = pOS2MET->Tell();
+ nOrigNumberFormat = pOS2MET->GetNumberFormatInt();
+
+ bCoord32 = TRUE;
+ pPaletteStack=NULL;
+ pAreaStack=NULL;
+ pPathStack=NULL;
+ pPathList=NULL;
+ pFontList=NULL;
+ pBitmapList=NULL;
+ pAttrStack=NULL;
+
+ aDefAttr.aLinCol =Color(COL_BLACK);
+ aDefAttr.aLinBgCol =Color(COL_WHITE);
+ aDefAttr.eLinMix =ROP_OVERPAINT;
+ aDefAttr.eLinBgMix =ROP_OVERPAINT;
+ aDefAttr.aChrCol =Color(COL_BLACK);
+ aDefAttr.aChrBgCol =Color(COL_WHITE);
+ aDefAttr.eChrMix =ROP_OVERPAINT;
+ aDefAttr.eChrBgMix =ROP_OVERPAINT;
+ aDefAttr.aMrkCol =Color(COL_BLACK);
+ aDefAttr.aMrkBgCol =Color(COL_WHITE);
+ aDefAttr.eMrkMix =ROP_OVERPAINT;
+ aDefAttr.eMrkBgMix =ROP_OVERPAINT;
+ aDefAttr.aPatCol =Color(COL_BLACK);
+ aDefAttr.aPatBgCol =Color(COL_WHITE);
+ aDefAttr.ePatMix =ROP_OVERPAINT;
+ aDefAttr.ePatBgMix =ROP_OVERPAINT;
+ aDefAttr.aImgCol =Color(COL_BLACK);
+ aDefAttr.aImgBgCol =Color(COL_WHITE);
+ aDefAttr.eImgMix =ROP_OVERPAINT;
+ aDefAttr.eImgBgMix =ROP_OVERPAINT;
+ aDefAttr.nArcP =1;
+ aDefAttr.nArcQ =1;
+ aDefAttr.nArcR =0;
+ aDefAttr.nArcS =0;
+ aDefAttr.nChrAng =0;
+ aDefAttr.aChrCellSize=Size(12,12);
+ aDefAttr.nChrSet =0;
+ aDefAttr.aCurPos =Point(0,0);
+ aDefAttr.eLinStyle =PEN_SOLID;
+ aDefAttr.nLinWidth =0;
+ aDefAttr.aMrkCellSize=Size(10,10);
+ aDefAttr.nMrkPrec =0x01;
+ aDefAttr.nMrkSet =0xff;
+ aDefAttr.nMrkSymbol =0x01;
+ aDefAttr.bFill =TRUE;
+ aDefAttr.nStrLinWidth=0;
+
+ aAttr=aDefAttr;
+
+ pOrdFile=NULL;
+
+ pVirDev = new VirtualDevice();
+ pVirDev->EnableOutput(FALSE);
+ rGDIMetaFile.Record(pVirDev);
+
+ pOS2MET->SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN);
+
+ nStartPos=pOS2MET->Tell();
+ nEndPos=pOS2MET->Seek(STREAM_SEEK_TO_END); pOS2MET->Seek(nStartPos);
+ Callback(0); nLastPercent=0;
+
+ nPos=pOS2MET->Tell();
+ if ( nStartPos == nEndPos )
+ {
+ nEndPos = 100;
+ nStartPos = 0;
+ }
+
+ for (;;) {
+
+ nPercent=(nPos-nStartPos)*100/(nEndPos-nStartPos);
+ if (nLastPercent+4<=nPercent) {
+ if (Callback((USHORT)nPercent)==TRUE) break;
+ nLastPercent=nPercent;
+ }
+
+ nFieldSize=ReadBigEndianWord();
+
+ *pOS2MET >> nMagicByte;
+ if (nMagicByte!=0xd3) {
+ pOS2MET->SetError(SVSTREAM_FILEFORMAT_ERROR);
+ ErrorCode=7;
+ break;
+ }
+ *pOS2MET >> nFieldType;
+
+ pOS2MET->SeekRel(3);
+ nPos+=8; nFieldSize-=8;
+
+ if (pOS2MET->GetError()) break;
+ if (pOS2MET->IsEof()) {
+ pOS2MET->SetError(SVSTREAM_FILEFORMAT_ERROR);
+ ErrorCode=8;
+ break;
+ }
+
+ if (nFieldType==EndDocumnMagic) break;
+
+ ReadField(nFieldType, nFieldSize);
+
+ nPos+=(ULONG)nFieldSize;
+ if (pOS2MET->Tell()>nPos) {
+ pOS2MET->SetError(SVSTREAM_FILEFORMAT_ERROR);
+ ErrorCode=9;
+ break;
+ }
+ pOS2MET->Seek(nPos);
+ }
+
+ rGDIMetaFile.Stop();
+ delete pVirDev;
+
+ rGDIMetaFile.SetPrefMapMode( aGlobMapMode );
+
+ if( aBoundingRect.GetWidth() && aBoundingRect.GetHeight() )
+ rGDIMetaFile.SetPrefSize( aBoundingRect.GetSize() );
+ else
+ {
+ if( aCalcBndRect.Left() || aCalcBndRect.Top() )
+ rGDIMetaFile.Move( -aCalcBndRect.Left(), -aCalcBndRect.Top() );
+
+ rGDIMetaFile.SetPrefSize( aCalcBndRect.GetSize() );
+ }
+
+ if (pOrdFile!=NULL) delete pOrdFile;
+
+ while (pAreaStack!=NULL) {
+ OSArea * p=pAreaStack;
+ pAreaStack=p->pSucc;
+ delete p;
+ }
+
+ while (pPathStack!=NULL) {
+ OSPath * p=pPathStack;
+ pPathStack=p->pSucc;
+ delete p;
+ }
+
+ while (pPathList!=NULL) {
+ OSPath * p=pPathList;
+ pPathList=p->pSucc;
+ delete p;
+ }
+
+ while (pFontList!=NULL) {
+ OSFont * p=pFontList;
+ pFontList=p->pSucc;
+ delete p;
+ }
+
+ while (pBitmapList!=NULL) {
+ OSBitmap * p=pBitmapList;
+ pBitmapList=p->pSucc;
+ if (p->pBMP!=NULL) delete p->pBMP;
+ delete p;
+ }
+
+ while (pAttrStack!=NULL) {
+ OSAttr * p=pAttrStack;
+ pAttrStack=p->pSucc;
+ delete p;
+ }
+
+ while (pPaletteStack!=NULL) {
+ OSPalette * p=pPaletteStack;
+ pPaletteStack=p->pSucc;
+ if (p->p0RGB!=NULL) delete[] p->p0RGB;
+ delete p;
+ }
+
+ pOS2MET->SetNumberFormatInt(nOrigNumberFormat);
+
+ if (pOS2MET->GetError()) {
+ OOODEBUG("Fehler Nr.:",ErrorCode);
+ pOS2MET->Seek(nOrigPos);
+ }
+}
+
+//================== GraphicImport - die exportierte Funktion ================
+
+extern "C" BOOL __LOADONCALLAPI GraphicImport(SvStream & rStream, Graphic & rGraphic, FilterConfigItem*, BOOL )
+{
+ OS2METReader aOS2METReader;
+ GDIMetaFile aMTF;
+ BOOL bRet = FALSE;
+
+ aOS2METReader.ReadOS2MET( rStream, aMTF );
+
+ if ( !rStream.GetError() )
+ {
+ rGraphic=Graphic( aMTF );
+ bRet = TRUE;
+ }
+
+ return bRet;
+}
+
+//================== ein bischen Muell fuer Windows ==========================
+#ifndef GCC
+#endif
+
+#ifdef WIN
+
+static HINSTANCE hDLLInst = 0; // HANDLE der DLL
+
+extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR )
+{
+#ifndef WNT
+ if ( nHeap )
+ UnlockData( 0 );
+#endif
+
+ hDLLInst = hDLL;
+
+ return TRUE;
+}
+
+extern "C" int CALLBACK WEP( int )
+{
+ return 1;
+}
+
+#endif
+
diff --git a/filter/source/graphicfilter/ios2met/makefile.mk b/filter/source/graphicfilter/ios2met/makefile.mk
new file mode 100644
index 000000000000..b3358eea7b4f
--- /dev/null
+++ b/filter/source/graphicfilter/ios2met/makefile.mk
@@ -0,0 +1,68 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=filter
+TARGET=ios2met
+DEPTARGET=vios2met
+
+# --- Settings -----------------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Allgemein ----------------------------------------------------------
+
+.IF "$(editdebug)"!="" || "$(EDITDEBUG)"!=""
+CDEFS+= -DEDITDEBUG
+.ENDIF
+.IF "$(L10N_framework)"==""
+SLOFILES = $(SLO)$/ios2met.obj
+
+# ==========================================================================
+
+SHL1TARGET= ime$(DLLPOSTFIX)
+SHL1IMPLIB= ios2met
+SHL1STDLIBS= $(VCLLIB) $(TOOLSLIB) $(SALLIB)
+
+SHL1LIBS= $(SLB)$/ios2met.lib # $(LB)$/rtftoken.lib
+
+.IF "$(GUI)" != "UNX"
+.IF "$(COM)" != "GCC"
+SHL1OBJS= $(SLO)$/ios2met.obj
+.ENDIF
+.ENDIF
+
+SHL1VERSIONMAP=exports.map
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+
+DEF1NAME=$(SHL1TARGET)
+.ENDIF
+# ==========================================================================
+
+.INCLUDE : target.mk
+
diff --git a/filter/source/graphicfilter/ipbm/exports.map b/filter/source/graphicfilter/ipbm/exports.map
new file mode 100644
index 000000000000..941e4ab9bde8
--- /dev/null
+++ b/filter/source/graphicfilter/ipbm/exports.map
@@ -0,0 +1,7 @@
+UDK_3_0_0 {
+ global:
+ GraphicImport;
+
+ local:
+ *;
+};
diff --git a/filter/source/graphicfilter/ipbm/ipbm.cxx b/filter/source/graphicfilter/ipbm/ipbm.cxx
new file mode 100644
index 000000000000..6b83fc1021c7
--- /dev/null
+++ b/filter/source/graphicfilter/ipbm/ipbm.cxx
@@ -0,0 +1,565 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include <vcl/graph.hxx>
+#include <vcl/bmpacc.hxx>
+#include <svtools/fltcall.hxx>
+
+//============================ PBMReader ==================================
+
+class PBMReader {
+
+private:
+
+ SvStream* mpPBM; // Die einzulesende PBM-Datei
+
+ BOOL mbStatus;
+ BOOL mbRemark; // FALSE wenn sich stream in einem Kommentar befindet
+ BOOL mbRaw; // RAW/ASCII MODE
+ ULONG mnMode; // 0->PBM, 1->PGM, 2->PPM
+ Bitmap maBmp;
+ BitmapWriteAccess* mpAcc;
+ ULONG mnWidth, mnHeight; // Bildausmass in Pixeln
+ ULONG mnCol;
+ ULONG mnMaxVal; // maximaler wert in den
+ BOOL ImplCallback( USHORT nPercent );
+ BOOL ImplReadBody();
+ BOOL ImplReadHeader();
+
+public:
+ PBMReader();
+ ~PBMReader();
+ BOOL ReadPBM( SvStream & rPBM, Graphic & rGraphic );
+};
+
+//=================== Methoden von PBMReader ==============================
+
+PBMReader::PBMReader() :
+ mbStatus ( TRUE ),
+ mbRemark ( FALSE ),
+ mbRaw ( TRUE ),
+ mpAcc ( NULL )
+{
+}
+
+PBMReader::~PBMReader()
+{
+}
+
+BOOL PBMReader::ImplCallback( USHORT /*nPercent*/ )
+{
+/*
+ if ( pCallback != NULL )
+ {
+ if ( ( (*pCallback)( pCallerData, nPercent ) ) == TRUE )
+ {
+ mpPBM->SetError( SVSTREAM_FILEFORMAT_ERROR );
+ return TRUE;
+ }
+ }
+*/
+ return FALSE;
+}
+
+BOOL PBMReader::ReadPBM( SvStream & rPBM, Graphic & rGraphic )
+{
+ USHORT i;
+
+ if ( rPBM.GetError() )
+ return FALSE;
+
+ mpPBM = &rPBM;
+ mpPBM->SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
+
+ // Kopf einlesen:
+
+ if ( ( mbStatus = ImplReadHeader() ) == FALSE )
+ return FALSE;
+
+ if ( ( mnMaxVal == 0 ) || ( mnWidth == 0 ) || ( mnHeight == 0 ) )
+ return FALSE;
+
+ // 0->PBM, 1->PGM, 2->PPM
+ switch ( mnMode )
+ {
+ case 0 :
+ maBmp = Bitmap( Size( mnWidth, mnHeight ), 1 );
+ if ( ( mpAcc = maBmp.AcquireWriteAccess() ) == FALSE )
+ return FALSE;
+ mpAcc->SetPaletteEntryCount( 2 );
+ mpAcc->SetPaletteColor( 0, BitmapColor( 0xff, 0xff, 0xff ) );
+ mpAcc->SetPaletteColor( 1, BitmapColor( 0x00, 0x00, 0x00 ) );
+ break;
+
+ case 1 :
+ if ( mnMaxVal <= 1 )
+ maBmp = Bitmap( Size( mnWidth, mnHeight ), 1);
+ else if ( mnMaxVal <= 15 )
+ maBmp = Bitmap( Size( mnWidth, mnHeight ), 4);
+ else
+ maBmp = Bitmap( Size( mnWidth, mnHeight ), 8);
+
+ if ( ( mpAcc = maBmp.AcquireWriteAccess() ) == FALSE )
+ return FALSE;
+ mnCol = (USHORT)mnMaxVal + 1;
+ if ( mnCol > 256 )
+ mnCol = 256;
+
+ mpAcc->SetPaletteEntryCount( 256 );
+ for ( i = 0; i < mnCol; i++ )
+ {
+ ULONG nCount = 255 * i / mnCol;
+ mpAcc->SetPaletteColor( i, BitmapColor( (BYTE)nCount, (BYTE)nCount, (BYTE)nCount ) );
+ }
+ break;
+ case 2 :
+ maBmp = Bitmap( Size( mnWidth, mnHeight ), 24 );
+ if ( ( mpAcc = maBmp.AcquireWriteAccess() ) == FALSE )
+ return FALSE;
+ break;
+ }
+
+ // Bitmap-Daten einlesen
+ mbStatus = ImplReadBody();
+
+ if ( mpAcc )
+ {
+ maBmp.ReleaseAccess( mpAcc ), mpAcc = NULL;
+ }
+ if ( mbStatus )
+ rGraphic = maBmp;
+
+ return mbStatus;
+}
+
+BOOL PBMReader::ImplReadHeader()
+{
+ BYTE nID[ 2 ];
+ BYTE nDat;
+ BYTE nMax, nCount = 0;
+ BOOL bFinished = FALSE;
+
+ *mpPBM >> nID[ 0 ] >> nID[ 1 ];
+ if ( nID[ 0 ] != 'P' )
+ return FALSE;
+ mnMaxVal = mnWidth = mnHeight = 0;
+ switch ( nID[ 1 ] )
+ {
+ case '1' :
+ mbRaw = FALSE;
+ case '4' :
+ mnMode = 0;
+ nMax = 2; // number of parameters in Header
+ mnMaxVal = 1;
+ break;
+ case '2' :
+ mbRaw = FALSE;
+ case '5' :
+ mnMode = 1;
+ nMax = 3;
+ break;
+ case '3' :
+ mbRaw = FALSE;
+ case '6' :
+ mnMode = 2;
+ nMax = 3;
+ break;
+ default:
+ return FALSE;
+ }
+ while ( bFinished == FALSE )
+ {
+ if ( mpPBM->GetError() )
+ return FALSE;
+
+ *mpPBM >> nDat;
+
+ if ( nDat == '#' )
+ {
+ mbRemark = TRUE;
+ continue;
+ }
+ else if ( ( nDat == 0x0d ) || ( nDat == 0x0a ) )
+ {
+ mbRemark = FALSE;
+ nDat = 0x20;
+ }
+ if ( mbRemark )
+ continue;
+
+ if ( ( nDat == 0x20 ) || ( nDat == 0x09 ) )
+ {
+ if ( ( nCount == 0 ) && mnWidth )
+ nCount++;
+ else if ( ( nCount == 1 ) && mnHeight )
+ {
+ if ( ++nCount == nMax )
+ bFinished = TRUE;
+ }
+ else if ( ( nCount == 2 ) && mnMaxVal )
+ {
+ bFinished = TRUE;
+ }
+ continue;
+ }
+ if ( ( nDat >= '0' ) && ( nDat <= '9' ) )
+ {
+ nDat -= '0';
+ if ( nCount == 0 )
+ {
+ mnWidth *= 10;
+ mnWidth += nDat;
+ }
+ else if ( nCount == 1 )
+ {
+ mnHeight *= 10;
+ mnHeight += nDat;
+ }
+ else if ( nCount == 2 )
+ {
+ mnMaxVal *= 10;
+ mnMaxVal += nDat;
+ }
+ }
+ else
+ return FALSE;
+ }
+ return mbStatus;
+}
+
+BOOL PBMReader::ImplReadBody()
+{
+ BOOL bPara, bFinished = FALSE;
+ BYTE nDat = 0, nCount;
+ ULONG nGrey, nRGB[3];
+ ULONG nWidth = 0;
+ ULONG nHeight = 0;
+ signed char nShift = 0;
+
+ if ( mbRaw )
+ {
+ switch ( mnMode )
+ {
+
+ // PBM
+ case 0 :
+ while ( nHeight != mnHeight )
+ {
+ if ( mpPBM->IsEof() || mpPBM->GetError() )
+ return FALSE;
+
+ if ( --nShift < 0 )
+ {
+ *mpPBM >> nDat;
+ nShift = 7;
+ }
+ mpAcc->SetPixel( nHeight, nWidth, nDat >> nShift );
+ if ( ++nWidth == mnWidth )
+ {
+ nShift = 0;
+ nWidth = 0;
+ nHeight++;
+ ImplCallback( (USHORT)( ( 100 * nHeight ) / mnHeight ) ); // processing output in percent
+ }
+ }
+ break;
+
+ // PGM
+ case 1 :
+ while ( nHeight != mnHeight )
+ {
+ if ( mpPBM->IsEof() || mpPBM->GetError() )
+ return FALSE;
+
+ *mpPBM >> nDat;
+ mpAcc->SetPixel( nHeight, nWidth++, nDat);
+
+ if ( nWidth == mnWidth )
+ {
+ nWidth = 0;
+ nHeight++;
+ ImplCallback( (USHORT)( ( 100 * nHeight ) / mnHeight ) ); // processing output in percent
+ }
+ }
+ break;
+
+ // PPM
+ case 2 :
+ while ( nHeight != mnHeight )
+ {
+ if ( mpPBM->IsEof() || mpPBM->GetError() )
+ return FALSE;
+
+ BYTE nR, nG, nB;
+ ULONG nRed, nGreen, nBlue;
+ *mpPBM >> nR >> nG >> nB;
+ nRed = 255 * nR / mnMaxVal;
+ nGreen = 255 * nG / mnMaxVal;
+ nBlue = 255 * nB / mnMaxVal;
+ mpAcc->SetPixel( nHeight, nWidth++, BitmapColor( (BYTE)nRed, (BYTE)nGreen, (BYTE)nBlue ) );
+ if ( nWidth == mnWidth )
+ {
+ nWidth = 0;
+ nHeight++;
+ ImplCallback( (USHORT) ( ( 100 * nHeight ) / mnHeight ) ); // processing output in percent
+ }
+ }
+ break;
+ }
+ }
+ else switch ( mnMode )
+ {
+ // PBM
+ case 0 :
+ while ( bFinished == FALSE )
+ {
+ if ( mpPBM->IsEof() || mpPBM->GetError() )
+ return FALSE;
+
+ *mpPBM >> nDat;
+
+ if ( nDat == '#' )
+ {
+ mbRemark = TRUE;
+ continue;
+ }
+ else if ( ( nDat == 0x0d ) || ( nDat == 0x0a ) )
+ {
+ mbRemark = FALSE;
+ continue;
+ }
+ if ( mbRemark || nDat == 0x20 || nDat == 0x09 )
+ continue;
+
+ if ( nDat == '0' || nDat == '1' )
+ {
+ mpAcc->SetPixel( nHeight, nWidth, (BYTE)nDat-'0' );
+ nWidth++;
+ if ( nWidth == mnWidth )
+ {
+ nWidth = 0;
+ if ( ++nHeight == mnHeight )
+ bFinished = TRUE;
+ ImplCallback( (USHORT) ( ( 100 * nHeight ) / mnHeight ) ); // processing output in percent
+ }
+ }
+ else
+ return FALSE;
+ }
+ break;
+
+ // PGM
+ case 1 :
+
+ bPara = FALSE;
+ nCount = 0;
+ nGrey = 0;
+
+ while ( bFinished == FALSE )
+ {
+ if ( nCount )
+ {
+ nCount--;
+ if ( nGrey <= mnMaxVal )
+ nGrey = 255 * nGrey / mnMaxVal;
+ mpAcc->SetPixel( nHeight, nWidth++, (BYTE)nGrey );
+ nGrey = 0;
+ if ( nWidth == mnWidth )
+ {
+ nWidth = 0;
+ if ( ++nHeight == mnHeight )
+ bFinished = TRUE;
+ ImplCallback( (USHORT) ( ( 100 * nHeight ) / mnHeight ) ); // processing output in percent
+ }
+ continue;
+ }
+
+ if ( mpPBM->IsEof() || mpPBM->GetError() )
+ return FALSE;
+
+ *mpPBM >> nDat;
+
+ if ( nDat == '#' )
+ {
+ mbRemark = TRUE;
+ if ( bPara )
+ {
+ bPara = FALSE;
+ nCount++;
+ }
+ continue;
+ }
+ else if ( ( nDat == 0x0d ) || ( nDat == 0x0a ) )
+ {
+ mbRemark = FALSE;
+ if ( bPara )
+ {
+ bPara = FALSE;
+ nCount++;
+ }
+ continue;
+ }
+
+ if ( nDat == 0x20 || nDat == 0x09 )
+ {
+ if ( bPara )
+ {
+ bPara = FALSE;
+ nCount++;
+ }
+ continue;
+ }
+ if ( nDat >= '0' && nDat <= '9' )
+ {
+ bPara = TRUE;
+ nGrey *= 10;
+ nGrey += nDat-'0';
+ continue;
+ }
+ else
+ return FALSE;
+ }
+ break;
+
+
+
+ // PPM
+ case 2 :
+
+ bPara = FALSE;
+ nCount = 0;
+ nRGB[ 0 ] = nRGB[ 1 ] = nRGB[ 2 ] = 0;
+
+ while ( bFinished == FALSE )
+ {
+ if ( nCount == 3 )
+ {
+ nCount = 0;
+ mpAcc->SetPixel( nHeight, nWidth++, BitmapColor( static_cast< BYTE >( ( nRGB[ 0 ] * 255 ) / mnMaxVal ),
+ static_cast< BYTE >( ( nRGB[ 1 ] * 255 ) / mnMaxVal ),
+ static_cast< BYTE >( ( nRGB[ 2 ] * 255 ) / mnMaxVal ) ) );
+ nCount = 0;
+ nRGB[ 0 ] = nRGB[ 1 ] = nRGB[ 2 ] = 0;
+ if ( nWidth == mnWidth )
+ {
+ nWidth = 0;
+ if ( ++nHeight == mnHeight )
+ bFinished = TRUE;
+ ImplCallback( (USHORT) ( ( 100 * nHeight ) / mnHeight ) ); // processing output in percent
+ }
+ continue;
+ }
+
+ if ( mpPBM->IsEof() || mpPBM->GetError() )
+ return FALSE;
+
+ *mpPBM >> nDat;
+
+ if ( nDat == '#' )
+ {
+ mbRemark = TRUE;
+ if ( bPara )
+ {
+ bPara = FALSE;
+ nCount++;
+ }
+ continue;
+ }
+ else if ( ( nDat == 0x0d ) || ( nDat == 0x0a ) )
+ {
+ mbRemark = FALSE;
+ if ( bPara )
+ {
+ bPara = FALSE;
+ nCount++;
+ }
+ continue;
+ }
+
+ if ( nDat == 0x20 || nDat == 0x09 )
+ {
+ if ( bPara )
+ {
+ bPara = FALSE;
+ nCount++;
+ }
+ continue;
+ }
+ if ( nDat >= '0' && nDat <= '9' )
+ {
+ bPara = TRUE;
+ nRGB[ nCount ] *= 10;
+ nRGB[ nCount ] += nDat-'0';
+ continue;
+ }
+ else
+ return FALSE;
+ }
+ break;
+ }
+ return mbStatus;
+}
+
+//================== GraphicImport - die exportierte Funktion ================
+
+extern "C" BOOL __LOADONCALLAPI GraphicImport(SvStream & rStream, Graphic & rGraphic, FilterConfigItem*, BOOL )
+{
+ PBMReader aPBMReader;
+
+ return aPBMReader.ReadPBM( rStream, rGraphic );
+}
+
+//================== ein bischen Muell fuer Windows ==========================
+#ifndef GCC
+#endif
+
+#ifdef WIN
+
+static HINSTANCE hDLLInst = 0; // HANDLE der DLL
+
+extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR )
+{
+#ifndef WNT
+ if ( nHeap )
+ UnlockData( 0 );
+#endif
+
+ hDLLInst = hDLL;
+
+ return TRUE;
+}
+
+extern "C" int CALLBACK WEP( int )
+{
+ return 1;
+}
+
+#endif
+
diff --git a/filter/source/graphicfilter/ipbm/makefile.mk b/filter/source/graphicfilter/ipbm/makefile.mk
new file mode 100644
index 000000000000..8f29b3a462a9
--- /dev/null
+++ b/filter/source/graphicfilter/ipbm/makefile.mk
@@ -0,0 +1,68 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=filter
+TARGET=ipbm
+DEPTARGET=vipbm
+
+# --- Settings -----------------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Allgemein ----------------------------------------------------------
+
+.IF "$(editdebug)"!="" || "$(EDITDEBUG)"!=""
+CDEFS+= -DEDITDEBUG
+.ENDIF
+.IF "$(L10N_framework)"==""
+SLOFILES = $(SLO)$/ipbm.obj
+
+# ==========================================================================
+
+SHL1TARGET= ipb$(DLLPOSTFIX)
+SHL1IMPLIB= ipbm
+SHL1STDLIBS= $(VCLLIB) $(TOOLSLIB) $(SALLIB)
+SHL1LIBS= $(SLB)$/ipbm.lib
+
+.IF "$(GUI)" != "UNX"
+.IF "$(COM)" != "GCC"
+SHL1OBJS= $(SLO)$/ipbm.obj
+.ENDIF
+.ENDIF
+
+SHL1VERSIONMAP=exports.map
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+
+DEF1NAME=$(SHL1TARGET)
+.ENDIF
+
+# ==========================================================================
+
+.INCLUDE : target.mk
+
diff --git a/filter/source/graphicfilter/ipcd/exports.map b/filter/source/graphicfilter/ipcd/exports.map
new file mode 100644
index 000000000000..941e4ab9bde8
--- /dev/null
+++ b/filter/source/graphicfilter/ipcd/exports.map
@@ -0,0 +1,7 @@
+UDK_3_0_0 {
+ global:
+ GraphicImport;
+
+ local:
+ *;
+};
diff --git a/filter/source/graphicfilter/ipcd/ipcd.cxx b/filter/source/graphicfilter/ipcd/ipcd.cxx
new file mode 100644
index 000000000000..0d44993c252d
--- /dev/null
+++ b/filter/source/graphicfilter/ipcd/ipcd.cxx
@@ -0,0 +1,422 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include "rtl/alloc.h"
+#include <vcl/graph.hxx>
+#include <vcl/bmpacc.hxx>
+#include <vcl/svapp.hxx>
+#include <svtools/fltcall.hxx>
+#include <svl/solar.hrc>
+#include <svtools/FilterConfigItem.hxx>
+
+//============================ PCDReader ==================================
+
+// Diese Aufloesungen sind in einer PCD-Datei enthalten:
+enum PCDResolution {
+ PCDRES_BASE16, // 192 x 128
+ PCDRES_BASE4, // 384 x 256
+ PCDRES_BASE, // 768 x 512
+ // Die folgenden sind komprimiert und koennen
+ // von uns NICHT gelesen werden:
+ PCDRES_4BASE, // 1536 x 1024
+ PCDRES_16BASE // 3072 x 3072
+};
+
+class PCDReader {
+
+private:
+
+ BOOL bStatus;
+
+ ULONG nLastPercent;
+
+ SvStream* pPCD;
+ BitmapWriteAccess* mpAcc;
+
+ BYTE nOrientation; // Ausrichtung des Bildes in der PCD-Datei:
+ // 0 - Turmspitze zeigt nach oben
+ // 1 - Turmspitze zeigt nach rechts
+ // 2 - Turmspitze zeigt nach unten
+ // 3 - Turmspitze zeigt nach links
+
+ PCDResolution eResolution; // Welche Aufloesung wir haben wollen
+
+ ULONG nWidth; // Breite des PCD-Bildes
+ ULONG nHeight; // Hoehe des PCD-Bildes
+ ULONG nImagePos; // Position des Bildes in der PCD-Datei
+
+ // Temporare BLue-Green-Red-Bitmap
+ ULONG nBMPWidth;
+ ULONG nBMPHeight;
+
+ void MayCallback(ULONG nPercent);
+
+ void CheckPCDImagePacFile();
+ // Prueft, ob es eine Photo-CD-Datei mit 'Image Pac' ist.
+
+ void ReadOrientation();
+ // Liest die Ausrichtung und setzt nOrientation
+
+ void ReadImage(ULONG nMinPercent, ULONG nMaxPercent);
+
+public:
+
+ PCDReader() {}
+ ~PCDReader() {}
+
+ BOOL ReadPCD( SvStream & rPCD, Graphic & rGraphic, FilterConfigItem* pConfigItem );
+};
+
+//=================== Methoden von PCDReader ==============================
+
+BOOL PCDReader::ReadPCD( SvStream & rPCD, Graphic & rGraphic, FilterConfigItem* pConfigItem )
+{
+ Bitmap aBmp;
+
+ bStatus = TRUE;
+ nLastPercent = 0;
+ pPCD = &rPCD;
+
+ MayCallback( 0 );
+
+ // Ist es eine PCD-Datei mit Bild ? ( setzt bStatus == FALSE, wenn nicht ):
+ CheckPCDImagePacFile();
+
+ // Orientierung des Bildes einlesen:
+ ReadOrientation();
+
+ // Welche Aufloesung wollen wir ?:
+ eResolution = PCDRES_BASE;
+ if ( pConfigItem )
+ {
+ sal_Int32 nResolution = pConfigItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Resolution" ) ), 2 );
+ if ( nResolution == 1 )
+ eResolution = PCDRES_BASE4;
+ else if ( nResolution == 0 )
+ eResolution = PCDRES_BASE16;
+ }
+ // Groesse und Position (Position in PCD-Datei) des Bildes bestimmen:
+ switch (eResolution)
+ {
+ case PCDRES_BASE16 :
+ nWidth = 192;
+ nHeight = 128;
+ nImagePos = 8192;
+ break;
+
+ case PCDRES_BASE4 :
+ nWidth = 384;
+ nHeight = 256;
+ nImagePos = 47104;
+ break;
+
+ case PCDRES_BASE :
+ nWidth = 768;
+ nHeight = 512;
+ nImagePos = 196608;
+ break;
+
+ default:
+ bStatus = FALSE;
+ }
+ if ( bStatus )
+ {
+ if ( ( nOrientation & 0x01 ) == 0 )
+ {
+ nBMPWidth = nWidth;
+ nBMPHeight = nHeight;
+ }
+ else
+ {
+ nBMPWidth = nHeight;
+ nBMPHeight = nWidth;
+ }
+ aBmp = Bitmap( Size( nBMPWidth, nBMPHeight ), 24 );
+ if ( ( mpAcc = aBmp.AcquireWriteAccess() ) == FALSE )
+ return FALSE;
+
+ ReadImage( 5 ,65 );
+
+ aBmp.ReleaseAccess( mpAcc ), mpAcc = NULL;
+ rGraphic = aBmp;
+ }
+ return bStatus;
+}
+
+// -------------------------------------------------------------------------------------------
+
+void PCDReader::MayCallback(ULONG /*nPercent*/)
+{
+/*
+ if ( nPercent >= nLastPercent + 3 )
+ {
+ nLastPercent=nPercent;
+ if ( pCallback != NULL && nPercent <= 100 && bStatus == TRUE )
+ {
+ if ( ( (*pCallback)( pCallerData, (USHORT)nPercent ) ) == TRUE )
+ bStatus = FALSE;
+ }
+ }
+*/
+}
+
+// -------------------------------------------------------------------------------------------
+
+void PCDReader::CheckPCDImagePacFile()
+{
+ char Buf[ 8 ];
+
+ pPCD->Seek( 2048 );
+ pPCD->Read( Buf, 7 );
+ Buf[ 7 ] = 0;
+ if ( ByteString( Buf ).CompareTo( "PCD_IPI" ) != COMPARE_EQUAL )
+ bStatus = FALSE;
+}
+
+// -------------------------------------------------------------------------------------------
+
+void PCDReader::ReadOrientation()
+{
+ if ( bStatus == FALSE )
+ return;
+ pPCD->Seek( 194635 );
+ *pPCD >> nOrientation;
+ nOrientation &= 0x03;
+}
+
+// -------------------------------------------------------------------------------------------
+
+void PCDReader::ReadImage(ULONG nMinPercent, ULONG nMaxPercent)
+{
+ ULONG nx,ny,nW2,nH2,nYPair,ndy,nXPair;
+ long nL,nCb,nCr,nRed,nGreen,nBlue;
+ BYTE * pt;
+ BYTE * pL0; // Luminanz fuer jeden Pixel der 1. Zeile des aktuellen Zeilen-Paars
+ BYTE * pL1; // Luminanz fuer jeden Pixel der 2. Zeile des aktuellen Zeilen-Paars
+ BYTE * pCb; // Blau-Chrominanz fuer je 2x2 Pixel des aktuellen Zeilen-Paars
+ BYTE * pCr; // Rot-Chrominanz fuer je 2x2 Pixel des aktuellen Zeilen-Paars
+ BYTE * pL0N, * pL1N, * pCbN, * pCrN; // wie oben, nur fuer das naechste Zeilen-Paar
+
+ if ( bStatus == FALSE )
+ return;
+
+ nW2=nWidth>>1;
+ nH2=nHeight>>1;
+
+ pL0 =(BYTE*)rtl_allocateMemory( nWidth );
+ pL1 =(BYTE*)rtl_allocateMemory( nWidth );
+ pCb =(BYTE*)rtl_allocateMemory( nW2+1 );
+ pCr =(BYTE*)rtl_allocateMemory( nW2+1 );
+ pL0N=(BYTE*)rtl_allocateMemory( nWidth );
+ pL1N=(BYTE*)rtl_allocateMemory( nWidth );
+ pCbN=(BYTE*)rtl_allocateMemory( nW2+1 );
+ pCrN=(BYTE*)rtl_allocateMemory( nW2+1 );
+
+ if ( pL0 == NULL || pL1 == NULL || pCb == NULL || pCr == NULL ||
+ pL0N == NULL || pL1N == NULL || pCbN == NULL || pCrN == NULL)
+ {
+ rtl_freeMemory((void*)pL0 );
+ rtl_freeMemory((void*)pL1 );
+ rtl_freeMemory((void*)pCb );
+ rtl_freeMemory((void*)pCr );
+ rtl_freeMemory((void*)pL0N);
+ rtl_freeMemory((void*)pL1N);
+ rtl_freeMemory((void*)pCbN);
+ rtl_freeMemory((void*)pCrN);
+ bStatus = FALSE;
+ return;
+ }
+
+ pPCD->Seek( nImagePos );
+
+ // naechstes Zeilen-Paar := erstes Zeile-Paar:
+ pPCD->Read( pL0N, nWidth );
+ pPCD->Read( pL1N, nWidth );
+ pPCD->Read( pCbN, nW2 );
+ pPCD->Read( pCrN, nW2 );
+ pCbN[ nW2 ] = pCbN[ nW2 - 1 ];
+ pCrN[ nW2 ] = pCrN[ nW2 - 1 ];
+
+ for ( nYPair = 0; nYPair < nH2; nYPair++ )
+ {
+ // aktuelles Zeilen-Paar := naechstes Zeilen-Paar
+ pt=pL0; pL0=pL0N; pL0N=pt;
+ pt=pL1; pL1=pL1N; pL1N=pt;
+ pt=pCb; pCb=pCbN; pCbN=pt;
+ pt=pCr; pCr=pCrN; pCrN=pt;
+
+ // naechstes Zeilen-Paar holen:
+ if ( nYPair < nH2 - 1 )
+ {
+ pPCD->Read( pL0N, nWidth );
+ pPCD->Read( pL1N, nWidth );
+ pPCD->Read( pCbN, nW2 );
+ pPCD->Read( pCrN, nW2 );
+ pCbN[nW2]=pCbN[ nW2 - 1 ];
+ pCrN[nW2]=pCrN[ nW2 - 1 ];
+ }
+ else
+ {
+ for ( nXPair = 0; nXPair < nW2; nXPair++ )
+ {
+ pCbN[ nXPair ] = pCb[ nXPair ];
+ pCrN[ nXPair ] = pCr[ nXPair ];
+ }
+ }
+
+ // Schleife uber die beiden Zeilen des Zeilen-Paars:
+ for ( ndy = 0; ndy < 2; ndy++ )
+ {
+ ny = ( nYPair << 1 ) + ndy;
+
+ // Schleife ueber X:
+ for ( nx = 0; nx < nWidth; nx++ )
+ {
+ // nL,nCb,nCr fuer den Pixel nx,ny holen/berechenen:
+ nXPair = nx >> 1;
+ if ( ndy == 0 )
+ {
+ nL = (long)pL0[ nx ];
+ if (( nx & 1 ) == 0 )
+ {
+ nCb = (long)pCb[ nXPair ];
+ nCr = (long)pCr[ nXPair ];
+ }
+ else
+ {
+ nCb = ( ( (long)pCb[ nXPair ] ) + ( (long)pCb[ nXPair + 1 ] ) ) >> 1;
+ nCr = ( ( (long)pCr[ nXPair ] ) + ( (long)pCr[ nXPair + 1 ] ) ) >> 1;
+ }
+ }
+ else {
+ nL = pL1[ nx ];
+ if ( ( nx & 1 ) == 0 )
+ {
+ nCb = ( ( (long)pCb[ nXPair ] ) + ( (long)pCbN[ nXPair ] ) ) >> 1;
+ nCr = ( ( (long)pCr[ nXPair ] ) + ( (long)pCrN[ nXPair ] ) ) >> 1;
+ }
+ else
+ {
+ nCb = ( ( (long)pCb[ nXPair ] ) + ( (long)pCb[ nXPair + 1 ] ) +
+ ( (long)pCbN[ nXPair ] ) + ( (long)pCbN[ nXPair + 1 ] ) ) >> 2;
+ nCr = ( ( (long)pCr[ nXPair ] ) + ( (long)pCr[ nXPair + 1] ) +
+ ( (long)pCrN[ nXPair ] ) + ( (long)pCrN[ nXPair + 1 ] ) ) >> 2;
+ }
+ }
+ // Umwandlung von nL,nCb,nCr in nRed,nGreen,nBlue:
+ nL *= 89024L;
+ nCb -= 156;
+ nCr -= 137;
+ nRed = ( nL + nCr * 119374L + 0x8000 ) >> 16;
+ if ( nRed < 0 )
+ nRed = 0;
+ if ( nRed > 255)
+ nRed = 255;
+ nGreen = ( nL - nCb * 28198L - nCr * 60761L + 0x8000 ) >> 16;
+ if ( nGreen < 0 )
+ nGreen = 0;
+ if ( nGreen > 255 )
+ nGreen = 255;
+ nBlue = ( nL + nCb * 145352L + 0x8000 ) >> 16;
+ if ( nBlue < 0 )
+ nBlue = 0;
+ if ( nBlue > 255 )
+ nBlue = 255;
+
+ // Farbwert in pBMPMap eintragen:
+ if ( nOrientation < 2 )
+ {
+ if ( nOrientation == 0 )
+ mpAcc->SetPixel( ny, nx, BitmapColor( (BYTE)nRed, (BYTE)nGreen, (BYTE)nBlue ) );
+ else
+ mpAcc->SetPixel( nWidth - 1 - nx, ny, BitmapColor( (BYTE)nRed, (BYTE)nGreen, (BYTE)nBlue ) );
+ }
+ else
+ {
+ if ( nOrientation == 2 )
+ mpAcc->SetPixel( nHeight - 1 - ny, ( nWidth - 1 - nx ), BitmapColor( (BYTE)nRed, (BYTE)nGreen, (BYTE)nBlue ) );
+ else
+ mpAcc->SetPixel( nx, ( nHeight - 1 - ny ), BitmapColor( (BYTE)nRed, (BYTE)nGreen, (BYTE)nBlue ) );
+ }
+ }
+ }
+
+ if ( pPCD->GetError() )
+ bStatus = FALSE;
+ MayCallback( nMinPercent + ( nMaxPercent - nMinPercent ) * nYPair / nH2 );
+ if ( bStatus == FALSE )
+ break;
+ }
+ rtl_freeMemory((void*)pL0 );
+ rtl_freeMemory((void*)pL1 );
+ rtl_freeMemory((void*)pCb );
+ rtl_freeMemory((void*)pCr );
+ rtl_freeMemory((void*)pL0N);
+ rtl_freeMemory((void*)pL1N);
+ rtl_freeMemory((void*)pCbN);
+ rtl_freeMemory((void*)pCrN);
+}
+
+//================== GraphicImport - die exportierte Funktion ================
+
+extern "C" BOOL __LOADONCALLAPI GraphicImport(SvStream & rStream, Graphic & rGraphic, FilterConfigItem* pConfigItem, BOOL )
+{
+ PCDReader aPCDReader;
+ return aPCDReader.ReadPCD( rStream, rGraphic, pConfigItem );
+}
+
+//============================= fuer Windows ==================================
+#ifndef GCC
+#endif
+
+#ifdef WIN
+
+static HINSTANCE hDLLInst = 0; // HANDLE der DLL
+
+extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR )
+{
+#ifndef WNT
+ if ( nHeap )
+ UnlockData( 0 );
+#endif
+
+ hDLLInst = hDLL;
+
+ return TRUE;
+}
+
+extern "C" int CALLBACK WEP( int )
+{
+ return 1;
+}
+
+#endif
+
+
diff --git a/filter/source/graphicfilter/ipcd/makefile.mk b/filter/source/graphicfilter/ipcd/makefile.mk
new file mode 100644
index 000000000000..5b43d9521cd5
--- /dev/null
+++ b/filter/source/graphicfilter/ipcd/makefile.mk
@@ -0,0 +1,67 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=filter
+TARGET=ipcd
+DEPTARGET=vipcd
+
+# --- Settings -----------------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Allgemein ----------------------------------------------------------
+
+.IF "$(editdebug)"!="" || "$(EDITDEBUG)"!=""
+CDEFS+= -DEDITDEBUG
+.ENDIF
+.IF "$(L10N_framework)"==""
+SLOFILES = $(SLO)$/ipcd.obj
+
+# ==========================================================================
+
+SHL1TARGET= icd$(DLLPOSTFIX)
+SHL1IMPLIB= ipcd
+SHL1STDLIBS= $(SVTOOLLIB) $(VCLLIB) $(TOOLSLIB) $(SALLIB)
+SHL1LIBS= $(SLB)$/ipcd.lib # $(LB)$/rtftoken.lib
+
+.IF "$(GUI)" != "UNX"
+.IF "$(COM)" != "GCC"
+SHL1OBJS= $(SLO)$/ipcd.obj
+.ENDIF
+.ENDIF
+
+SHL1VERSIONMAP=exports.map
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+
+DEF1NAME=$(SHL1TARGET)
+.ENDIF
+
+# ==========================================================================
+
+.INCLUDE : target.mk
diff --git a/filter/source/graphicfilter/ipcx/exports.map b/filter/source/graphicfilter/ipcx/exports.map
new file mode 100644
index 000000000000..941e4ab9bde8
--- /dev/null
+++ b/filter/source/graphicfilter/ipcx/exports.map
@@ -0,0 +1,7 @@
+UDK_3_0_0 {
+ global:
+ GraphicImport;
+
+ local:
+ *;
+};
diff --git a/filter/source/graphicfilter/ipcx/ipcx.cxx b/filter/source/graphicfilter/ipcx/ipcx.cxx
new file mode 100644
index 000000000000..02c552744299
--- /dev/null
+++ b/filter/source/graphicfilter/ipcx/ipcx.cxx
@@ -0,0 +1,458 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include <vcl/graph.hxx>
+#include <vcl/bmpacc.hxx>
+#include <svtools/fltcall.hxx>
+
+//============================ PCXReader ==================================
+
+class PCXReader {
+
+private:
+
+ SvStream* pPCX; // Die einzulesende PCX-Datei
+
+ Bitmap aBmp;
+ BitmapWriteAccess* pAcc;
+ BYTE nVersion; // PCX-Version
+ BYTE nEncoding; // Art der Komprimierung
+ ULONG nBitsPerPlanePix; // Bits Pro Ebene pro Pixel
+ ULONG nPlanes; // Anzahl Ebenen
+ ULONG nBytesPerPlaneLin; // Bytes in einer Ebenen pro Zeile
+ USHORT nPaletteInfo;
+
+ ULONG nWidth, nHeight; // Bildausmass in Pixeln
+ USHORT nResX, nResY; // Aufloesung in Pixel pro Inch oder 0,0
+ USHORT nDestBitsPerPixel; // Bits pro Pixel der Zielbitmap 1,4,8 oder 24
+ BYTE* pPalette; //
+ BOOL nStatus; // status nun nicht mehr am stream abfragen ( SJ )
+
+
+ BOOL Callback( USHORT nPercent );
+ void ImplReadBody();
+ void ImplReadPalette( ULONG nCol );
+ void ImplReadHeader();
+
+public:
+ PCXReader();
+ ~PCXReader();
+ BOOL ReadPCX( SvStream & rPCX, Graphic & rGraphic );
+ // Liesst aus dem Stream eine PCX-Datei und fuellt das GDIMetaFile
+};
+
+//=================== Methoden von PCXReader ==============================
+
+PCXReader::PCXReader() :
+ pAcc ( NULL )
+{
+ pPalette = new BYTE[ 768 ];
+}
+
+PCXReader::~PCXReader()
+{
+ delete[] pPalette;
+}
+
+BOOL PCXReader::Callback( USHORT /*nPercent*/ )
+{
+/*
+ if (pCallback!=NULL) {
+ if (((*pCallback)(pCallerData,nPercent))==TRUE) {
+ nStatus = FALSE;
+ return TRUE;
+ }
+ }
+*/
+ return FALSE;
+}
+
+BOOL PCXReader::ReadPCX( SvStream & rPCX, Graphic & rGraphic )
+{
+ if ( rPCX.GetError() )
+ return FALSE;
+
+ ULONG* pDummy = new ULONG; delete pDummy; // damit unter OS/2
+ // das richtige (Tools-)new
+ // verwendet wird, da es sonst
+ // in dieser DLL nur Vector-news
+ // gibt;
+
+ pPCX = &rPCX;
+ pPCX->SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN);
+
+ // Kopf einlesen:
+
+ nStatus = TRUE;
+
+ ImplReadHeader();
+
+ // BMP-Header und ggf. (eventuell zunaechst ungueltige) Farbpalette schreiben:
+ if ( nStatus )
+ {
+ aBmp = Bitmap( Size( nWidth, nHeight ), nDestBitsPerPixel );
+ if ( ( pAcc = aBmp.AcquireWriteAccess() ) == FALSE )
+ return FALSE;
+
+ if ( nDestBitsPerPixel <= 8 )
+ {
+ USHORT nColors = 1 << nDestBitsPerPixel;
+ BYTE* pPal = pPalette;
+ pAcc->SetPaletteEntryCount( nColors );
+ for ( USHORT i = 0; i < nColors; i++, pPal += 3 )
+ {
+ pAcc->SetPaletteColor( i, BitmapColor ( pPal[ 0 ], pPal[ 1 ], pPal[ 2 ] ) );
+ }
+ }
+ // Bitmap-Daten einlesen
+ ImplReadBody();
+
+ // Wenn erweiterte Farbpalette am Ende von PCX, dann diese einlesen, und nochmals
+ // in Palette schreiben:
+ if ( nDestBitsPerPixel == 8 && nStatus )
+ {
+ BYTE* pPal = pPalette;
+ pPCX->SeekRel(1);
+ ImplReadPalette(256);
+ pAcc->SetPaletteEntryCount( 256 );
+ for ( USHORT i = 0; i < 256; i++, pPal += 3 )
+ {
+ pAcc->SetPaletteColor( i, BitmapColor ( pPal[ 0 ], pPal[ 1 ], pPal[ 2 ] ) );
+ }
+ }
+ /*
+ // Aufloesung einstellen:
+ if (nResX!=0 && nResY!=0) {
+ MapMode aMapMode(MAP_INCH,Point(0,0),Fraction(1,nResX),Fraction(1,nResY));
+ rBitmap.SetPrefMapMode(aMapMode);
+ rBitmap.SetPrefSize(Size(nWidth,nHeight));
+ }
+ */ if ( nStatus && pAcc )
+ {
+ aBmp.ReleaseAccess( pAcc ), pAcc = NULL;
+ rGraphic = aBmp;
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+void PCXReader::ImplReadHeader()
+{
+ BYTE nbyte;
+ USHORT nushort;
+ USHORT nMinX,nMinY,nMaxX,nMaxY;
+
+ *pPCX >> nbyte >> nVersion >> nEncoding;
+ if ( nbyte!=0x0a || (nVersion != 0 && nVersion != 2 && nVersion != 3 && nVersion != 5) || nEncoding > 1 )
+ {
+ nStatus = FALSE;
+ return;
+ }
+
+ *pPCX >> nbyte; nBitsPerPlanePix = (ULONG)nbyte;
+ *pPCX >> nMinX >> nMinY >> nMaxX >> nMaxY;
+
+ if ((nMinX > nMaxX) || (nMinY > nMaxY))
+ {
+ nStatus = FALSE;
+ return;
+ }
+
+ nWidth = nMaxX-nMinX+1;
+ nHeight = nMaxY-nMinY+1;
+
+ *pPCX >> nResX;
+ *pPCX >> nResY;
+ if ( nResX >= nWidth || nResY >= nHeight || ( nResX != nResY ) )
+ nResX = nResY = 0;
+
+ ImplReadPalette( 16 );
+
+ pPCX->SeekRel( 1 );
+ *pPCX >> nbyte; nPlanes = (ULONG)nbyte;
+ *pPCX >> nushort; nBytesPerPlaneLin = (ULONG)nushort;
+ *pPCX >> nPaletteInfo;
+
+ pPCX->SeekRel( 58 );
+
+ nDestBitsPerPixel = (USHORT)( nBitsPerPlanePix * nPlanes );
+ if (nDestBitsPerPixel == 2 || nDestBitsPerPixel == 3) nDestBitsPerPixel = 4;
+
+ if ( ( nDestBitsPerPixel != 1 && nDestBitsPerPixel != 4 && nDestBitsPerPixel != 8 && nDestBitsPerPixel != 24 )
+ || nPlanes > 4 || nBytesPerPlaneLin < ( ( nWidth * nBitsPerPlanePix+7 ) >> 3 ) )
+ {
+ nStatus = FALSE;
+ return;
+ }
+
+ // Wenn das Bild nur 2 Farben hat, ist die Palette zumeist ungueltig, und es handelt sich
+ // immer (?) um ein schwarz-weiss-Bild:
+ if ( nPlanes == 1 && nBitsPerPlanePix == 1 )
+ {
+ pPalette[ 0 ] = pPalette[ 1 ] = pPalette[ 2 ] = 0x00;
+ pPalette[ 3 ] = pPalette[ 4 ] = pPalette[ 5 ] = 0xff;
+ }
+}
+
+void PCXReader::ImplReadBody()
+{
+ BYTE *pPlane[ 4 ], * pDest, * pSource1, * pSource2, * pSource3, *pSource4;
+ ULONG i, nx, ny, np, nCount, nUsedLineSize, nLineSize, nPercent;
+ ULONG nLastPercent = 0;
+ BYTE nDat = 0, nCol = 0;
+
+ nUsedLineSize = (ULONG)( ( ( nWidth * (ULONG)nDestBitsPerPixel ) + 7 ) >> 3 );
+ nLineSize = ( nUsedLineSize + 3 ) & 0xfffc;
+
+ for( np = 0; np < nPlanes; np++ )
+ pPlane[ np ] = new BYTE[ nBytesPerPlaneLin ];
+
+ nCount = 0;
+ for ( ny = 0; ny < nHeight; ny++ )
+ {
+ if (pPCX->GetError() || pPCX->IsEof())
+ {
+ nStatus = FALSE;
+ break;
+ }
+ nPercent = ny * 60 / nHeight + 10;
+ if ( ny == 0 || nLastPercent + 4 <= nPercent )
+ {
+ nLastPercent = nPercent;
+ if ( Callback( (USHORT)nPercent ) == TRUE )
+ break;
+ }
+ for ( np = 0; np < nPlanes; np++)
+ {
+ if ( nEncoding == 0)
+ pPCX->Read( (void *)pPlane[ np ], nBytesPerPlaneLin );
+ else
+ {
+ pDest = pPlane[ np ];
+ nx = nBytesPerPlaneLin;
+ while ( nCount > 0 && nx > 0)
+ {
+ *(pDest++) = nDat;
+ nx--;
+ nCount--;
+ }
+ while ( nx > 0 )
+ {
+ *pPCX >> nDat;
+ if ( ( nDat & 0xc0 ) == 0xc0 )
+ {
+ nCount =( (ULONG)nDat ) & 0x003f;
+ *pPCX >> nDat;
+ if ( nCount < nx )
+ {
+ nx -= nCount;
+ while ( nCount > 0)
+ {
+ *(pDest++) = nDat;
+ nCount--;
+ }
+ }
+ else
+ {
+ nCount -= nx;
+ do
+ {
+ *(pDest++) = nDat;
+ nx--;
+ }
+ while ( nx > 0 );
+ break;
+ }
+ }
+ else
+ {
+ *(pDest++) = nDat;
+ nx--;
+ }
+ }
+ }
+ }
+ pSource1 = pPlane[ 0 ];
+ pSource2 = pPlane[ 1 ];
+ pSource3 = pPlane[ 2 ];
+ pSource4 = pPlane[ 3 ];
+ switch ( nBitsPerPlanePix + ( nPlanes << 8 ) )
+ {
+ // 2 colors
+ case 0x101 :
+ for ( i = 0; i < nWidth; i++ )
+ {
+ ULONG nShift = ( i & 7 ) ^ 7;
+ if ( nShift == 0 )
+ pAcc->SetPixel( ny, i, ( *pSource1++ & 1 ) );
+ else
+ pAcc->SetPixel(
+ ny, i,
+ sal::static_int_cast< BYTE >(
+ ( *pSource1 >> nShift ) & 1) );
+ }
+ break;
+ // 4 colors
+ case 0x102 :
+ for ( i = 0; i < nWidth; i++ )
+ {
+ switch( i & 3 )
+ {
+ case 0 :
+ nCol = *pSource1 >> 6;
+ break;
+ case 1 :
+ nCol = ( *pSource1 >> 4 ) & 0x03 ;
+ break;
+ case 2 :
+ nCol = ( *pSource1 >> 2 ) & 0x03;
+ break;
+ case 3 :
+ nCol = ( *pSource1++ ) & 0x03;
+ break;
+ }
+ pAcc->SetPixel( ny, i, nCol );
+ }
+ break;
+ // 256 colors
+ case 0x108 :
+ for ( i = 0; i < nWidth; i++ )
+ {
+ pAcc->SetPixel( ny, i, *pSource1++ );
+ }
+ break;
+ // 8 colors
+ case 0x301 :
+ for ( i = 0; i < nWidth; i++ )
+ {
+ ULONG nShift = ( i & 7 ) ^ 7;
+ if ( nShift == 0 )
+ {
+ nCol = ( *pSource1++ & 1) + ( ( *pSource2++ << 1 ) & 2 ) + ( ( *pSource3++ << 2 ) & 4 );
+ pAcc->SetPixel( ny, i, nCol );
+ }
+ else
+ {
+ nCol = sal::static_int_cast< BYTE >(
+ ( ( *pSource1 >> nShift ) & 1) + ( ( ( *pSource2 >> nShift ) << 1 ) & 2 ) +
+ ( ( ( *pSource3 >> nShift ) << 2 ) & 4 ));
+ pAcc->SetPixel( ny, i, nCol );
+ }
+ }
+ break;
+ // 16 colors
+ case 0x401 :
+ for ( i = 0; i < nWidth; i++ )
+ {
+ ULONG nShift = ( i & 7 ) ^ 7;
+ if ( nShift == 0 )
+ {
+ nCol = ( *pSource1++ & 1) + ( ( *pSource2++ << 1 ) & 2 ) + ( ( *pSource3++ << 2 ) & 4 ) +
+ ( ( *pSource4++ << 3 ) & 8 );
+ pAcc->SetPixel( ny, i, nCol );
+ }
+ else
+ {
+ nCol = sal::static_int_cast< BYTE >(
+ ( ( *pSource1 >> nShift ) & 1) + ( ( ( *pSource2 >> nShift ) << 1 ) & 2 ) +
+ ( ( ( *pSource3 >> nShift ) << 2 ) & 4 ) + ( ( ( *pSource4 >> nShift ) << 3 ) & 8 ));
+ pAcc->SetPixel( ny, i, nCol );
+ }
+ }
+ break;
+ // 16m colors
+ case 0x308 :
+ for ( i = 0; i < nWidth; i++ )
+ {
+ pAcc->SetPixel( ny, i, Color( *pSource1++, *pSource2++, *pSource3++ ) );
+
+ }
+ break;
+ default :
+ nStatus = FALSE;
+ break;
+ }
+ }
+ for ( np = 0; np < nPlanes; np++ )
+ delete[] pPlane[ np ];
+}
+
+void PCXReader::ImplReadPalette( ULONG nCol )
+{
+ BYTE r, g, b;
+ BYTE* pPtr = pPalette;
+ for ( ULONG i = 0; i < nCol; i++ )
+ {
+ *pPCX >> r >> g >> b;
+ *pPtr++ = r;
+ *pPtr++ = g;
+ *pPtr++ = b;
+ }
+}
+
+//================== GraphicImport - die exportierte Funktion ================
+
+extern "C" BOOL __LOADONCALLAPI GraphicImport(SvStream & rStream, Graphic & rGraphic, FilterConfigItem*, BOOL )
+{
+ PCXReader aPCXReader;
+ BOOL nRetValue = aPCXReader.ReadPCX( rStream, rGraphic );
+ if ( nRetValue == FALSE )
+ rStream.SetError( SVSTREAM_FILEFORMAT_ERROR );
+ return nRetValue;
+}
+
+//================== ein bischen Muell fuer Windows ==========================
+#ifndef GCC
+#endif
+
+#ifdef WIN
+
+static HINSTANCE hDLLInst = 0; // HANDLE der DLL
+
+extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR )
+{
+#ifndef WNT
+ if ( nHeap )
+ UnlockData( 0 );
+#endif
+
+ hDLLInst = hDLL;
+
+ return TRUE;
+}
+
+extern "C" int CALLBACK WEP( int )
+{
+ return 1;
+}
+
+#endif
+
diff --git a/filter/source/graphicfilter/ipcx/makefile.mk b/filter/source/graphicfilter/ipcx/makefile.mk
new file mode 100644
index 000000000000..679ffd2a984a
--- /dev/null
+++ b/filter/source/graphicfilter/ipcx/makefile.mk
@@ -0,0 +1,67 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=filter
+TARGET=ipcx
+DEPTARGET=vipcx
+
+# --- Settings -----------------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Allgemein ----------------------------------------------------------
+
+.IF "$(editdebug)"!="" || "$(EDITDEBUG)"!=""
+CDEFS+= -DEDITDEBUG
+.ENDIF
+.IF "$(L10N_framework)"==""
+SLOFILES = $(SLO)$/ipcx.obj
+
+# ==========================================================================
+
+SHL1TARGET= ipx$(DLLPOSTFIX)
+SHL1IMPLIB= ipcx
+SHL1STDLIBS= $(VCLLIB) $(TOOLSLIB) $(SALLIB)
+SHL1LIBS= $(SLB)$/ipcx.lib
+
+.IF "$(GUI)" != "UNX"
+.IF "$(COM)" != "GCC"
+SHL1OBJS= $(SLO)$/ipcx.obj
+.ENDIF
+.ENDIF
+
+SHL1VERSIONMAP=exports.map
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+
+DEF1NAME=$(SHL1TARGET)
+.ENDIF
+
+# ==========================================================================
+
+.INCLUDE : target.mk
diff --git a/filter/source/graphicfilter/ipict/exports.map b/filter/source/graphicfilter/ipict/exports.map
new file mode 100644
index 000000000000..941e4ab9bde8
--- /dev/null
+++ b/filter/source/graphicfilter/ipict/exports.map
@@ -0,0 +1,7 @@
+UDK_3_0_0 {
+ global:
+ GraphicImport;
+
+ local:
+ *;
+};
diff --git a/filter/source/graphicfilter/ipict/ipict.cxx b/filter/source/graphicfilter/ipict/ipict.cxx
new file mode 100644
index 000000000000..d1af028149b7
--- /dev/null
+++ b/filter/source/graphicfilter/ipict/ipict.cxx
@@ -0,0 +1,1937 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include <string.h>
+#include <vcl/bmpacc.hxx>
+#include <vcl/graph.hxx>
+#include <tools/poly.hxx>
+#include <vcl/virdev.hxx>
+#include <svtools/fltcall.hxx>
+#include <math.h>
+
+// MT: NOOLDSV, someone should change the code...
+enum PenStyle { PEN_NULL, PEN_SOLID, PEN_DOT, PEN_DASH, PEN_DASHDOT };
+enum BrushStyle { BRUSH_NULL, BRUSH_SOLID, BRUSH_HORZ, BRUSH_VERT,
+ BRUSH_CROSS, BRUSH_DIAGCROSS, BRUSH_UPDIAG, BRUSH_DOWNDIAG,
+ BRUSH_25, BRUSH_50, BRUSH_75,
+ BRUSH_BITMAP };
+
+//============================ PictReader ==================================
+
+enum PictDrawingMethod {
+ PDM_FRAME, PDM_PAINT, PDM_ERASE, PDM_INVERT, PDM_FILL,
+ PDM_TEXT, PDM_UNDEFINED
+};
+
+class PictReader {
+
+private:
+
+ SvStream * pPict; // Die einzulesende Pict-Datei
+ VirtualDevice * pVirDev; // Hier werden die Drawing-Methoden aufgerufen.
+ // Dabei findet ein Recording in das GDIMetaFile
+ // statt.
+ ULONG nOrigPos; // Anfaengliche Position in pPict
+ UINT16 nOrigNumberFormat; // Anfaengliches Nummern-Format von pPict
+ BOOL IsVersion2; // Ob es ein Version 2 Pictfile ist.
+ Rectangle aBoundingRect; // Min/Max-Rechteck fuer die ganze Zeichnung
+
+ Point aPenPosition;
+ Point aTextPosition;
+ Color aActForeColor;
+ Color aActBackColor;
+ PenStyle eActPenPenStyle;
+ BrushStyle eActPenBrushStyle;
+ BrushStyle eActFillStyle;
+ BrushStyle eActBackStyle;
+ USHORT nActPenSize;
+ RasterOp eActROP;
+ PictDrawingMethod eActMethod;
+ Size aActOvalSize;
+ Font aActFont;
+
+ Fraction aHRes;
+ Fraction aVRes;
+
+ BOOL Callback(USHORT nPercent);
+
+ Point ReadPoint();
+
+ Point ReadDeltaH(Point aBase);
+ Point ReadDeltaV(Point aBase);
+
+ Point ReadUnsignedDeltaH(Point aBase);
+ Point ReadUnsignedDeltaV(Point aBase);
+
+ Size ReadSize();
+
+ Color ReadColor();
+
+ Color ReadRGBColor();
+
+ void ReadRectangle(Rectangle & rRect);
+
+ ULONG ReadPolygon(Polygon & rPoly);
+
+ ULONG ReadPattern(PenStyle * pPenStyle, BrushStyle * pBrushStyle);
+
+ ULONG ReadPixPattern(PenStyle * pPenStyle, BrushStyle * pBrushStyle);
+
+ Rectangle aLastRect;
+ ULONG ReadAndDrawRect(PictDrawingMethod eMethod);
+ ULONG ReadAndDrawSameRect(PictDrawingMethod eMethod);
+
+ Rectangle aLastRoundRect;
+ ULONG ReadAndDrawRoundRect(PictDrawingMethod eMethod);
+ ULONG ReadAndDrawSameRoundRect(PictDrawingMethod eMethod);
+
+ Rectangle aLastOval;
+ ULONG ReadAndDrawOval(PictDrawingMethod eMethod);
+ ULONG ReadAndDrawSameOval(PictDrawingMethod eMethod);
+
+ Polygon aLastPolygon;
+ ULONG ReadAndDrawPolygon(PictDrawingMethod eMethod);
+ ULONG ReadAndDrawSamePolygon(PictDrawingMethod eMethod);
+
+ Rectangle aLastArcRect;
+ ULONG ReadAndDrawArc(PictDrawingMethod eMethod);
+ ULONG ReadAndDrawSameArc(PictDrawingMethod eMethod);
+
+ ULONG ReadAndDrawRgn(PictDrawingMethod eMethod);
+ ULONG ReadAndDrawSameRgn(PictDrawingMethod eMethod);
+
+ void DrawingMethod(PictDrawingMethod eMethod);
+
+ ULONG ReadAndDrawText();
+
+ ULONG ReadPixMapEtc(Bitmap & rBitmap, BOOL bBaseAddr, BOOL bColorTable,
+ Rectangle * pSrcRect, Rectangle * pDestRect,
+ BOOL bMode, BOOL bMaskRgn);
+
+ void ReadHeader();
+ // Liesst den Kopf der Pict-Datei, setzt IsVersion2 und aBoundingRect
+
+ ULONG ReadData(USHORT nOpcode);
+ // Liesst die Daten eines Opcodes ein und fuehrt die Operation aus.
+ // Auf jeden Fall wird die Anzahl der Datenbytes zu dem Opcode
+ // zurueckgeliefert.
+
+ void SetLineColor( const Color& rColor );
+ void SetFillColor( const Color& rColor );
+
+public:
+
+ PictReader() {}
+
+ void ReadPict( SvStream & rStreamPict, GDIMetaFile & rGDIMetaFile );
+ // Liesst aus dem Stream eine Pict-Datei und fuellt das GDIMetaFile
+
+};
+
+//------------------------------------------------------------------------------------------------
+
+#define SETBYTE \
+ switch ( nPixelSize ) \
+ { \
+ case 1 : \
+ pAcc->SetPixel( ny, nx++, nDat >> 7 ); \
+ if ( nx == nWidth ) break; \
+ pAcc->SetPixel( ny, nx++, nDat >> 6 ); \
+ if ( nx == nWidth ) break; \
+ pAcc->SetPixel( ny, nx++, nDat >> 5 ); \
+ if ( nx == nWidth ) break; \
+ pAcc->SetPixel( ny, nx++, nDat >> 4 ); \
+ if ( nx == nWidth ) break; \
+ pAcc->SetPixel( ny, nx++, nDat >> 3 ); \
+ if ( nx == nWidth ) break; \
+ pAcc->SetPixel( ny, nx++, nDat >> 2 ); \
+ if ( nx == nWidth ) break; \
+ pAcc->SetPixel( ny, nx++, nDat >> 1 ); \
+ if ( nx == nWidth ) break; \
+ pAcc->SetPixel( ny, nx++, nDat ); \
+ break; \
+ case 2 : \
+ pAcc->SetPixel( ny, nx++, nDat >> 6 ); \
+ if ( nx == nWidth ) break; \
+ pAcc->SetPixel( ny, nx++, nDat >> 4 & 3); \
+ if ( nx == nWidth ) break; \
+ pAcc->SetPixel( ny, nx++, nDat >> 2 & 3 ); \
+ if ( nx == nWidth ) break; \
+ pAcc->SetPixel( ny, nx++, nDat & 3); \
+ break; \
+ case 4 : \
+ pAcc->SetPixel( ny, nx++, nDat >> 4 ); \
+ if ( nx == nWidth ) break; \
+ pAcc->SetPixel( ny, nx++, nDat ); \
+ break; \
+ case 8 : \
+ pAcc->SetPixel( ny, nx++, nDat ); \
+ break; \
+ }
+
+//------------------------------------------------------------------------------------------------
+
+#define BITMAPERROR \
+{ \
+ if ( pAcc ) \
+ aBitmap.ReleaseAccess( pAcc ); \
+ if ( pReadAcc ) \
+ aBitmap.ReleaseAccess( pReadAcc ); \
+ return 0xffffffff; \
+}
+
+//=================== Methoden von PictReader ==============================
+
+void PictReader::SetLineColor( const Color& rColor )
+{
+ pVirDev->SetLineColor( rColor );
+}
+
+void PictReader::SetFillColor( const Color& rColor )
+{
+ pVirDev->SetFillColor( rColor );
+}
+
+BOOL PictReader::Callback(USHORT /*nPercent*/)
+{
+/*
+ if (pCallback!=NULL) {
+ if (((*pCallback)(pCallerData,nPercent))==TRUE) {
+ pPict->SetError(SVSTREAM_FILEFORMAT_ERROR);
+ return TRUE;
+ }
+ }
+*/
+ return FALSE;
+}
+
+Point PictReader::ReadPoint()
+{
+ short nx,ny;
+
+ *pPict >> ny >> nx;
+
+ return Point( (long)nx - aBoundingRect.Left(),
+ (long)ny - aBoundingRect.Top() );
+}
+
+Point PictReader::ReadDeltaH(Point aBase)
+{
+ signed char ndh;
+
+ *pPict >> ((char&)ndh);
+
+ return Point( aBase.X() + (long)ndh, aBase.Y() );
+}
+
+Point PictReader::ReadDeltaV(Point aBase)
+{
+ signed char ndv;
+
+ *pPict >> ((char&)ndv);
+
+ return Point( aBase.X(), aBase.Y() + (long)ndv );
+}
+
+Point PictReader::ReadUnsignedDeltaH(Point aBase)
+{
+ sal_uInt8 ndh;
+
+ *pPict >> ndh;
+
+ return Point( aBase.X() + (long)ndh, aBase.Y() );
+}
+
+Point PictReader::ReadUnsignedDeltaV(Point aBase)
+{
+ sal_uInt8 ndv;
+
+ *pPict >> ndv;
+
+ return Point( aBase.X(), aBase.Y() + (long)ndv );
+}
+
+Size PictReader::ReadSize()
+{
+ short nx,ny;
+
+ *pPict >> ny >> nx;
+
+ return Size( (long)nx, (long)ny );
+}
+
+Color PictReader::ReadColor()
+{
+ sal_uInt32 nCol;
+ Color aCol;
+
+ *pPict >> nCol;
+ switch (nCol)
+ {
+ case 33: aCol=Color( COL_BLACK ); break;
+ case 30: aCol=Color( COL_WHITE ); break;
+ case 205: aCol=Color( COL_LIGHTRED ); break;
+ case 341: aCol=Color( COL_LIGHTGREEN ); break;
+ case 409: aCol=Color( COL_LIGHTBLUE ); break;
+ case 273: aCol=Color( COL_LIGHTCYAN ); break;
+ case 137: aCol=Color( COL_LIGHTMAGENTA ); break;
+ case 69: aCol=Color( COL_YELLOW ); break;
+ default: aCol=Color( COL_LIGHTGRAY );
+ }
+ return aCol;
+}
+
+
+Color PictReader::ReadRGBColor()
+{
+ USHORT nR, nG, nB;
+
+ *pPict >> nR >> nG >> nB;
+ return Color( (BYTE) ( nR >> 8 ), (BYTE) ( nG >> 8 ), (BYTE) ( nB >> 8 ) );
+}
+
+
+void PictReader::ReadRectangle(Rectangle & rRect)
+{
+ Point aTopLeft, aBottomRight;
+
+ aTopLeft=ReadPoint();
+ aBottomRight=ReadPoint();
+ aBottomRight.X() -= 1;
+ aBottomRight.Y() -= 1;
+ rRect=Rectangle(aTopLeft,aBottomRight);
+}
+
+
+ULONG PictReader::ReadPolygon(Polygon & rPoly)
+{
+ USHORT nSize,i;
+ ULONG nDataSize;
+
+ *pPict >> nSize;
+ pPict->SeekRel(8);
+ nDataSize=(ULONG)nSize;
+ nSize=(nSize-10)/4;
+ rPoly.SetSize(nSize);
+ for (i=0; i<nSize; i++) rPoly.SetPoint(ReadPoint(),i);
+ return nDataSize;
+}
+
+ULONG PictReader::ReadPattern(PenStyle * pPenStyle, BrushStyle * pBrushStyle)
+{
+ short nx,ny,nBitCount;
+ unsigned char nbyte[8];
+ BrushStyle eBrStyle;
+ PenStyle ePnStyle;
+ ULONG nHiBytes, nLoBytes;
+
+ // Anzahl der Bits im Pattern zaehlen, die auf 1 gesetzt sind:
+ nBitCount=0;
+ for (ny=0; ny<8; ny++) {
+ *pPict >> ((char&)nbyte[ny]);
+ for (nx=0; nx<8; nx++) {
+ if ( (nbyte[ny] & (1<<nx)) != 0 ) nBitCount++;
+ }
+ }
+
+ // Pattern in 2 Langworten unterbringen:
+ nHiBytes=(((((((ULONG)nbyte[0])<<8)|
+ (ULONG)nbyte[1])<<8)|
+ (ULONG)nbyte[2])<<8)|
+ (ULONG)nbyte[3];
+ nLoBytes=(((((((ULONG)nbyte[4])<<8)|
+ (ULONG)nbyte[5])<<8)|
+ (ULONG)nbyte[6])<<8)|
+ (ULONG)nbyte[7];
+
+ // Einen PenStyle machen:
+ if (nBitCount<=0) ePnStyle=PEN_NULL;
+ else if (nBitCount<=16) ePnStyle=PEN_DOT;
+ else if (nBitCount<=32) ePnStyle=PEN_DASHDOT;
+ else if (nBitCount<=48) ePnStyle=PEN_DASH;
+ else ePnStyle=PEN_SOLID;
+
+ // Einen BrushStyle machen:
+ if (nHiBytes==0xffffffff && nLoBytes==0xffffffff) eBrStyle=BRUSH_SOLID;
+ else if (nHiBytes==0xff000000 && nLoBytes==0x00000000) eBrStyle=BRUSH_HORZ;
+ else if (nHiBytes==0x80808080 && nLoBytes==0x80808080) eBrStyle=BRUSH_VERT;
+ else if (nHiBytes==0xff808080 && nLoBytes==0x80808080) eBrStyle=BRUSH_CROSS;
+ else if (nHiBytes==0x01824428 && nLoBytes==0x10284482) eBrStyle=BRUSH_DIAGCROSS;
+ else if (nHiBytes==0x80402010 && nLoBytes==0x08040201) eBrStyle=BRUSH_UPDIAG;
+ else if (nHiBytes==0x01020408 && nLoBytes==0x10204080) eBrStyle=BRUSH_DOWNDIAG;
+ else if (nBitCount<=24) eBrStyle=BRUSH_25;
+ else if (nBitCount<=40) eBrStyle=BRUSH_50;
+ else if (nBitCount<=56) eBrStyle=BRUSH_75;
+ else eBrStyle=BRUSH_SOLID;
+
+ if (pPenStyle!=0) *pPenStyle=ePnStyle;
+
+ if (pBrushStyle!=0) *pBrushStyle=eBrStyle;
+
+ return 8;
+}
+
+ULONG PictReader::ReadPixPattern(PenStyle * pPenStyle, BrushStyle * pBrushStyle)
+{
+ // Keine Ahnung, ob dies richtig ist, weil kein Bild gefunden, das
+ // PixPatterns enthaelt. Auch hier nur der Versuch, die Groesse der Daten zu
+ // ermitteln, und einfache StarView-Styles daraus zu machen. Gluecklicherweise
+ // enthaelt ein PixPattern immer auch ein normales Pattern.
+
+ ULONG nDataSize;
+ USHORT nPatType;
+ Bitmap aBMP;
+
+ *pPict >> nPatType;
+ if (nPatType==1) {
+ ReadPattern(pPenStyle,pBrushStyle);
+ nDataSize=ReadPixMapEtc(aBMP,FALSE,TRUE,NULL,NULL,FALSE,FALSE);
+ if (nDataSize!=0xffffffff) nDataSize+=10;
+ }
+ else if (nPatType==2) {
+ ReadPattern(pPenStyle,pBrushStyle);
+ pPict->SeekRel(6); // RGBColor
+ nDataSize=16;
+ }
+ else nDataSize=0xffffffff;
+
+ return nDataSize;
+}
+
+ULONG PictReader::ReadAndDrawRect(PictDrawingMethod eMethod)
+{
+ ReadRectangle(aLastRect);
+ DrawingMethod(eMethod);
+ pVirDev->DrawRect(aLastRect);
+ return 8;
+}
+
+ULONG PictReader::ReadAndDrawSameRect(PictDrawingMethod eMethod)
+{
+ DrawingMethod(eMethod);
+ pVirDev->DrawRect(aLastRect);
+ return 0;
+}
+
+ULONG PictReader::ReadAndDrawRoundRect(PictDrawingMethod eMethod)
+{
+ ReadRectangle(aLastRoundRect);
+ DrawingMethod(eMethod);
+ pVirDev->DrawRect(aLastRoundRect,aActOvalSize.Width(),aActOvalSize.Height());
+ return 8;
+}
+
+ULONG PictReader::ReadAndDrawSameRoundRect(PictDrawingMethod eMethod)
+{
+ DrawingMethod(eMethod);
+ pVirDev->DrawRect(aLastRoundRect,aActOvalSize.Width(),aActOvalSize.Height());
+ return 0;
+}
+
+ULONG PictReader::ReadAndDrawOval(PictDrawingMethod eMethod)
+{
+ ReadRectangle(aLastOval);
+ DrawingMethod(eMethod);
+ pVirDev->DrawEllipse(aLastOval);
+ return 8;
+}
+
+ULONG PictReader::ReadAndDrawSameOval(PictDrawingMethod eMethod)
+{
+ DrawingMethod(eMethod);
+ pVirDev->DrawEllipse(aLastOval);
+ return 0;
+}
+
+ULONG PictReader::ReadAndDrawPolygon(PictDrawingMethod eMethod)
+{
+ ULONG nDataSize;
+
+ nDataSize=ReadPolygon(aLastPolygon);
+ DrawingMethod(eMethod);
+ if (eMethod==PDM_FRAME) pVirDev->DrawPolyLine(aLastPolygon);
+ else pVirDev->DrawPolygon(aLastPolygon);
+ return nDataSize;
+}
+
+ULONG PictReader::ReadAndDrawSamePolygon(PictDrawingMethod eMethod)
+{
+ DrawingMethod(eMethod);
+ if (eMethod==PDM_FRAME) pVirDev->DrawPolyLine(aLastPolygon);
+ else pVirDev->DrawPolygon(aLastPolygon);
+ return 0;
+}
+
+
+ULONG PictReader::ReadAndDrawArc(PictDrawingMethod eMethod)
+{
+ short nstartAngle, narcAngle;
+ double fAng1, fAng2;
+ Point aStartPt, aEndPt, aCenter;
+
+ ReadRectangle(aLastArcRect);
+ *pPict >> nstartAngle >> narcAngle;
+ if (narcAngle<0) {
+ nstartAngle = nstartAngle + narcAngle;
+ narcAngle=-narcAngle;
+ }
+ fAng1=((double)nstartAngle)/180.0*3.14159265359;
+ fAng2=((double)(nstartAngle+narcAngle))/180.0*3.14159265359;
+ aCenter=Point((aLastArcRect.Left()+aLastArcRect.Right())/2,
+ (aLastArcRect.Top()+aLastArcRect.Bottom())/2);
+ aStartPt=Point(aCenter.X()+(long)( sin(fAng2)*256.0),
+ aCenter.Y()+(long)(-cos(fAng2)*256.0));
+ aEndPt= Point(aCenter.X()+(long)( sin(fAng1)*256.0),
+ aCenter.Y()+(long)(-cos(fAng1)*256.0));
+ DrawingMethod(eMethod);
+ if (eMethod==PDM_FRAME) pVirDev->DrawArc(aLastArcRect,aStartPt,aEndPt);
+ else pVirDev->DrawPie(aLastArcRect,aStartPt,aEndPt);
+ return 12;
+}
+
+ULONG PictReader::ReadAndDrawSameArc(PictDrawingMethod eMethod)
+{
+ short nstartAngle, narcAngle;
+ double fAng1, fAng2;
+ Point aStartPt, aEndPt, aCenter;
+
+ *pPict >> nstartAngle >> narcAngle;
+ if (narcAngle<0) {
+ nstartAngle = nstartAngle + narcAngle;
+ narcAngle=-narcAngle;
+ }
+ fAng1=((double)nstartAngle)/180.0*3.14159265359;
+ fAng2=((double)(nstartAngle+narcAngle))/180.0*3.14159265359;
+ aCenter=Point((aLastArcRect.Left()+aLastArcRect.Right())/2,
+ (aLastArcRect.Top()+aLastArcRect.Bottom())/2);
+ aStartPt=Point(aCenter.X()+(long)( sin(fAng2)*256.0),
+ aCenter.Y()+(long)(-cos(fAng2)*256.0));
+ aEndPt= Point(aCenter.X()+(long)( sin(fAng1)*256.0),
+ aCenter.Y()+(long)(-cos(fAng1)*256.0));
+ DrawingMethod(eMethod);
+ if (eMethod==PDM_FRAME) pVirDev->DrawArc(aLastArcRect,aStartPt,aEndPt);
+ else pVirDev->DrawPie(aLastArcRect,aStartPt,aEndPt);
+ return 4;
+}
+
+ULONG PictReader::ReadAndDrawRgn(PictDrawingMethod eMethod)
+{
+ USHORT nSize;
+
+ DrawingMethod(eMethod);
+ *pPict >> nSize;
+ // ...???...
+ return (ULONG)nSize;
+}
+
+ULONG PictReader::ReadAndDrawSameRgn(PictDrawingMethod eMethod)
+{
+ DrawingMethod(eMethod);
+ // ...???...
+ return 0;
+}
+
+void PictReader::DrawingMethod(PictDrawingMethod eMethod)
+{
+ if( eActMethod==eMethod ) return;
+ switch (eMethod) {
+ case PDM_FRAME:
+ SetLineColor( aActForeColor );
+ SetFillColor( Color(COL_TRANSPARENT) );
+ pVirDev->SetRasterOp(eActROP);
+ break;
+ case PDM_PAINT:
+ SetLineColor( Color(COL_TRANSPARENT) );
+ SetFillColor( aActForeColor );
+ pVirDev->SetRasterOp(eActROP);
+ break;
+ case PDM_ERASE:
+ SetLineColor( Color(COL_TRANSPARENT) );
+ SetFillColor( aActForeColor );
+ pVirDev->SetRasterOp(ROP_OVERPAINT);
+ break;
+ case PDM_INVERT:
+ SetLineColor( Color(COL_TRANSPARENT));
+ SetFillColor( Color( COL_BLACK ) );
+ pVirDev->SetRasterOp(ROP_INVERT);
+ break;
+ case PDM_FILL:
+ SetLineColor( Color(COL_TRANSPARENT) );
+ SetFillColor( aActForeColor );
+ pVirDev->SetRasterOp(ROP_OVERPAINT);
+ break;
+ case PDM_TEXT:
+ aActFont.SetColor(aActForeColor);
+ aActFont.SetFillColor(aActBackColor);
+ aActFont.SetTransparent(TRUE);
+ pVirDev->SetFont(aActFont);
+ pVirDev->SetRasterOp(ROP_OVERPAINT);
+ break;
+ default:
+ break; // -Wall undefined not handled...
+ }
+ eActMethod=eMethod;
+}
+
+ULONG PictReader::ReadAndDrawText()
+{
+ char nByteLen;
+ sal_uInt32 nLen, nDataLen;
+ sal_Char sText[256];
+
+ DrawingMethod(PDM_TEXT);
+ *pPict >> nByteLen; nLen=((ULONG)nByteLen)&0x000000ff;
+ nDataLen = nLen + 1;
+ pPict->Read( &sText, nLen );
+
+ // Stoerende Steuerzeuichen wegnehmen:
+ while ( nLen > 0 && ( (unsigned char)sText[ nLen - 1 ] ) < 32 )
+ nLen--;
+ sText[ nLen ] = 0;
+ String aString( (const sal_Char*)&sText, gsl_getSystemTextEncoding() );
+ pVirDev->DrawText( Point( aTextPosition.X(), aTextPosition.Y() ), aString );
+ return nDataLen;
+}
+
+ULONG PictReader::ReadPixMapEtc( Bitmap &rBitmap, BOOL bBaseAddr, BOOL bColorTable, Rectangle* pSrcRect,
+ Rectangle* pDestRect, BOOL bMode, BOOL bMaskRgn )
+{
+ Bitmap aBitmap;
+ BitmapWriteAccess* pAcc = NULL;
+ BitmapReadAccess* pReadAcc = NULL;
+ USHORT ny, nx, nColTabSize;
+ USHORT nRowBytes, nBndX, nBndY, nWidth, nHeight, nVersion, nPackType, nPixelType,
+ nPixelSize, nCmpCount, nCmpSize;
+ sal_uInt32 nPackSize, nPlaneBytes, nHRes, nVRes;
+ BYTE nDat, nRed, nGreen, nBlue, nDummy;
+ ULONG i, nDataSize = 0;
+
+ // In nDataSize wird mitgerechnet, wie gross die gesammten Daten sind.
+ nDataSize = 0;
+
+ // ggf. BaseAddr ueberlesen
+ if ( bBaseAddr )
+ {
+ pPict->SeekRel( 4 );
+ nDataSize += 4;
+ }
+
+ // PixMap oder Bitmap-Struktur einlesen;
+ *pPict >> nRowBytes >> nBndY >> nBndX >> nHeight >> nWidth;
+ nHeight = nHeight - nBndY;
+ nWidth = nWidth - nBndX;
+
+ if ( ( nRowBytes & 0x8000 ) != 0 )
+ { // it is a PixMap
+ nRowBytes &= 0x3fff;
+ *pPict >> nVersion >> nPackType >> nPackSize >> nHRes >> nVRes >> nPixelType >>
+ nPixelSize >> nCmpCount >> nCmpSize >> nPlaneBytes;
+
+ pPict->SeekRel( 8 );
+ nDataSize += 46;
+
+ sal_uInt16 nDstBitCount = nPixelSize;
+ if ( nDstBitCount > 8 )
+ nDstBitCount = 24;
+ else if ( nDstBitCount == 2 )
+ nDstBitCount = 4;
+ aBitmap = Bitmap( Size( nWidth, nHeight ), nDstBitCount );
+
+ if ( ( pAcc = aBitmap.AcquireWriteAccess() ) == NULL )
+ BITMAPERROR;
+
+ if ( bColorTable )
+ {
+ pPict->SeekRel( 6 );
+ *pPict >> nColTabSize;
+
+ if ( ++nColTabSize > 256 )
+ BITMAPERROR;
+
+ pAcc->SetPaletteEntryCount( nColTabSize );
+
+ for ( i = 0; i < nColTabSize; i++ )
+ {
+ pPict->SeekRel(2);
+ *pPict >> nRed >> nDummy >> nGreen >> nDummy >> nBlue >> nDummy;
+ pAcc->SetPaletteColor( (USHORT) i, BitmapColor( nRed, nGreen, nBlue ) );
+ }
+ nDataSize += 8 + nColTabSize * 8;
+ }
+ }
+ else
+ {
+ nRowBytes &= 0x3fff;
+ nVersion = 0;
+ nPackType = 0;
+ nPackSize = nHRes = nVRes = nPlaneBytes = 0;
+ nPixelType = 0;
+ nPixelSize = nCmpCount = nCmpSize = 1;
+ nDataSize += 10;
+ aBitmap = Bitmap( Size( nWidth, nHeight ), 1 );
+ if ( ( pAcc = aBitmap.AcquireWriteAccess() ) == NULL )
+ BITMAPERROR;
+ pAcc->SetPaletteEntryCount( 2 );
+ pAcc->SetPaletteColor( 0, BitmapColor( 0xff, 0xff, 0xff ) );
+ pAcc->SetPaletteColor( 1, BitmapColor( 0, 0, 0 ) );
+ }
+
+ // ggf. Quell-Rechteck einlesen:
+ if ( pSrcRect != 0)
+ {
+ USHORT nTop, nLeft, nBottom, nRight;
+ *pPict >> nTop >> nLeft >> nBottom >> nRight;
+ *pSrcRect = Rectangle( (ULONG)nLeft, (ULONG)nTop, (ULONG)nRight, (ULONG)nBottom );
+ nDataSize += 8;
+ }
+
+ // ggf. Ziel-Rechteck einlesen:
+ if ( pDestRect != 0 )
+ {
+ Point aTL, aBR;
+ aTL = ReadPoint();
+ aBR = ReadPoint();
+ *pDestRect = Rectangle( aTL, aBR );
+ nDataSize += 8;
+ }
+
+ // ggf. Modus einlesen (bzw. ueberspringen):
+ if ( bMode )
+ {
+ pPict->SeekRel(2);
+ nDataSize += 2;
+ }
+
+ // ggf. Region einlesen (bzw. ueberspringen):
+ if ( bMaskRgn )
+ {
+ USHORT nSize;
+ *pPict >> nSize;
+ pPict->SeekRel( nSize - 2 );
+ nDataSize += (ULONG)nSize;
+ }
+
+// aSMem << (nHRes/1665L) << (nVRes/1665L) << ((ULONG)0) << ((ULONG)0);
+
+ // Lese und Schreibe Bitmap-Bits:
+ if ( nPixelSize == 1 || nPixelSize == 2 || nPixelSize == 4 || nPixelSize == 8 )
+ {
+ BYTE nByteCountAsByte, nFlagCounterByte;
+ USHORT nByteCount, nCount, nSrcBPL, nDestBPL;
+
+ if ( nPixelSize == 1 ) nSrcBPL = ( nWidth + 7 ) >> 3;
+ else if ( nPixelSize == 2 ) nSrcBPL = ( nWidth + 3 ) >> 2;
+ else if ( nPixelSize == 4 ) nSrcBPL = ( nWidth + 1 ) >> 1;
+ else nSrcBPL = nWidth;
+ nDestBPL = ( nSrcBPL + 3 ) & 0xfffc;
+ if ( nRowBytes < nSrcBPL || nRowBytes > nDestBPL )
+ BITMAPERROR;
+
+ for ( ny = 0; ny < nHeight; ny++ )
+ {
+ nx = 0;
+ if ( nRowBytes < 8 || nPackType == 1 )
+ {
+ for ( i = 0; i < nRowBytes; i++ )
+ {
+ *pPict >> nDat;
+ if ( nx < nWidth )
+ SETBYTE;
+ }
+ nDataSize += nRowBytes;
+ }
+ else
+ {
+ if ( nRowBytes > 250 )
+ {
+ *pPict >> nByteCount;
+ nDataSize += 2 + (ULONG)nByteCount;
+ }
+ else
+ {
+ *pPict >> nByteCountAsByte;
+ nByteCount = ( (USHORT)nByteCountAsByte ) & 0x00ff;
+ nDataSize += 1 + (ULONG)nByteCount;
+ }
+
+ while ( nByteCount )
+ {
+ *pPict >> nFlagCounterByte;
+ if ( ( nFlagCounterByte & 0x80 ) == 0 )
+ {
+ nCount = ( (USHORT)nFlagCounterByte ) + 1;
+ for ( i = 0; i < nCount; i++ )
+ {
+ *pPict >> nDat;
+ if ( nx < nWidth )
+ SETBYTE;
+ }
+ nByteCount -= 1 + nCount;
+ }
+ else
+ {
+ nCount = ( 1 - ( ( (USHORT)nFlagCounterByte ) | 0xff00 ) );
+ *pPict >> nDat;
+ for ( i = 0; i < nCount; i++ )
+ {
+ if ( nx < nWidth )
+ SETBYTE;
+ }
+ nByteCount -= 2;
+ }
+ }
+ }
+ }
+ }
+ else if ( nPixelSize == 16 )
+ {
+ BYTE nByteCountAsByte, nFlagCounterByte;
+ USHORT nByteCount, nCount, nDestBPL,nD;
+ ULONG nSrcBitsPos;
+
+ if ( nRowBytes < 2 * nWidth )
+ BITMAPERROR;
+
+ nDestBPL = ( ( 3 * nWidth ) + 0x0003 ) & 0xfffc;
+
+ for ( ny = 0; ny < nHeight; ny++ )
+ {
+ nx = 0;
+ if ( nRowBytes < 8 || nPackType == 1 )
+ {
+ for ( i = 0; i < nWidth; i++ )
+ {
+ *pPict >> nD;
+ nRed = (BYTE)( nD >> 7 );
+ nGreen = (BYTE)( nD >> 2 );
+ nBlue = (BYTE)( nD << 3 );
+ pAcc->SetPixel( ny, nx++, BitmapColor( nRed, nGreen, nBlue ) );
+ }
+ nDataSize += ( (ULONG)nWidth ) * 2;
+ }
+ else
+ {
+ nSrcBitsPos = pPict->Tell();
+ if ( nRowBytes > 250 )
+ {
+ *pPict >> nByteCount;
+ nByteCount += 2;
+ }
+ else
+ {
+ *pPict >> nByteCountAsByte;
+ nByteCount = ( (USHORT)nByteCountAsByte ) & 0x00ff;
+ nByteCount++;
+ }
+ while ( nx != nWidth )
+ {
+ *pPict >> nFlagCounterByte;
+ if ( (nFlagCounterByte & 0x80) == 0)
+ {
+ nCount=((USHORT)nFlagCounterByte)+1;
+ if ( nCount + nx > nWidth) // SJ: the RLE decoding seems not to be correct here,
+ nCount = nWidth - nx; // I don't want to change this until I have a bugdoc for
+ for (i=0; i<nCount; i++) // this case. Have a look at 32bit, there I changed the
+ { // encoding, so that it is used a straight forward array
+ *pPict >> nD;
+ nRed = (BYTE)( nD >> 7 );
+ nGreen = (BYTE)( nD >> 2 );
+ nBlue = (BYTE)( nD << 3 );
+ pAcc->SetPixel( ny, nx++, BitmapColor( nRed, nGreen, nBlue ) );
+ }
+ }
+ else
+ {
+ nCount=(1-(((USHORT)nFlagCounterByte)|0xff00));
+ if ( nCount + nx > nWidth )
+ nCount = nWidth - nx;
+ *pPict >> nD;
+ nRed = (BYTE)( nD >> 7 );
+ nGreen = (BYTE)( nD >> 2 );
+ nBlue = (BYTE)( nD << 3 );
+ for (i=0; i<nCount; i++)
+ {
+ pAcc->SetPixel( ny, nx++, BitmapColor( nRed, nGreen, nBlue ) );
+ }
+ }
+ }
+ nDataSize+=(ULONG)nByteCount;
+ pPict->Seek(nSrcBitsPos+(ULONG)nByteCount);
+ }
+ }
+ }
+ else if (nPixelSize==32)
+ {
+ BYTE nByteCountAsByte, nFlagCounterByte;
+ USHORT nByteCount, nCount;
+ ULONG nSrcBitsPos;
+ BitmapColor aBitmapColor;
+ if ( ( pReadAcc = aBitmap.AcquireReadAccess() ) == NULL )
+ BITMAPERROR;
+ if ( nRowBytes != 4*nWidth )
+ BITMAPERROR;
+
+ if ( nRowBytes < 8 || nPackType == 1 )
+ {
+ for ( ny = 0; ny < nHeight; ny++ )
+ {
+ if ( nRowBytes < 8 || nPackType == 1 )
+ {
+ for ( nx = 0; nx < nWidth; nx++ )
+ {
+ *pPict >> nDummy >> nRed >> nGreen >> nBlue;
+ pAcc->SetPixel( ny, nx, BitmapColor( nRed, nGreen, nBlue) );
+ }
+ nDataSize += ( (ULONG)nWidth ) * 4;
+ }
+ }
+ }
+ else if ( nPackType == 2 )
+ {
+ for ( ny = 0; ny < nHeight; ny++ )
+ {
+ for ( nx = 0; nx < nWidth; nx++ )
+ {
+ *pPict >> nRed >> nGreen >> nBlue;
+ pAcc->SetPixel( ny, nx, BitmapColor( nRed, nGreen, nBlue ) );
+ }
+ nDataSize += ( (ULONG)nWidth ) * 3;
+ }
+ }
+ else
+ {
+ if ( ( nCmpCount == 3 ) || ( nCmpCount == 4 ) )
+ {
+ sal_uInt8* pScanline = new sal_uInt8[ nWidth * nCmpCount ];
+ for ( ny = 0; ny < nHeight; ny++ )
+ {
+ nSrcBitsPos = pPict->Tell();
+ if ( nRowBytes > 250 )
+ {
+ *pPict >> nByteCount;
+ nByteCount += 2;
+ }
+ else
+ {
+ *pPict >> nByteCountAsByte;
+ nByteCount = (BYTE)nByteCountAsByte;
+ nByteCount++;
+ }
+ i = 0;
+ while( i < (sal_uInt32)( nWidth * nCmpCount ) )
+ {
+ *pPict >> nFlagCounterByte;
+ if ( ( nFlagCounterByte & 0x80 ) == 0)
+ {
+ nCount = ( (USHORT)nFlagCounterByte ) + 1;
+ if ( ( i + nCount ) > (sal_uInt32)( nWidth * nCmpCount ) )
+ nCount = (sal_uInt16)( nWidth * nCmpCount - i );
+ while( nCount-- )
+ {
+ *pPict >> nDat;
+ pScanline[ i++ ] = nDat;
+ }
+ }
+ else
+ {
+ nCount = ( 1 - ( ( (USHORT)nFlagCounterByte ) | 0xff00 ) );
+ if ( ( i + nCount ) > (sal_uInt32)( nWidth * nCmpCount ) )
+ nCount = (sal_uInt16)( nWidth * nCmpCount - i );
+ *pPict >> nDat;
+ while( nCount-- )
+ pScanline[ i++ ] = nDat;
+ }
+ }
+ sal_uInt8* pTmp = pScanline;
+ if ( nCmpCount == 4 )
+ pTmp += nWidth;
+ for ( nx = 0; nx < nWidth; pTmp++ )
+ pAcc->SetPixel( ny, nx++, BitmapColor( *pTmp, pTmp[ nWidth ], pTmp[ 2 * nWidth ] ) );
+ nDataSize += (ULONG)nByteCount;
+ pPict->Seek( nSrcBitsPos + (ULONG)nByteCount );
+ }
+ delete[] pScanline;
+ }
+ }
+ }
+ else
+ BITMAPERROR;
+ if ( pReadAcc )
+ aBitmap.ReleaseAccess( pReadAcc );
+ aBitmap.ReleaseAccess( pAcc );
+ rBitmap = aBitmap;
+ return nDataSize;
+}
+
+void PictReader::ReadHeader()
+{
+ char nC;
+ short y1,x1,y2,x2;
+
+ sal_Char sBuf[ 3 ];
+ pPict->SeekRel( 10 );
+ pPict->Read( sBuf, 3 );
+ if ( sBuf[ 0 ] == 0x00 && sBuf[ 1 ] == 0x11 && ( sBuf[ 2 ] == 0x01 || sBuf[ 2 ] == 0x02 ) )
+ pPict->SeekRel( -13 ); // this maybe a pict from a ms document
+ else
+ pPict->SeekRel( 512 - 13 ); // 512 Bytes Muell am Anfang
+
+ pPict->SeekRel(2); // Lo-16-bits von "picture size"
+ *pPict >> y1 >> x1 >> y2 >> x2; // Rahmen-Rechteck des Bildes
+ aBoundingRect=Rectangle( x1,y1, --x2, --y2 );
+
+ // Jetzt kommen x-beliebig viele Nullen
+ // (in manchen Dateien tatsaechlich mehr als eine):
+ do { *pPict >> nC; } while (nC==0 && pPict->IsEof()==FALSE);
+
+ // dann sollte der Versions-Opcode 0x11 folgen, dann die Versionsnummer:
+ if (nC==0x11)
+ {
+ *pPict >> nC;
+ if ( nC == 0x01 )
+ IsVersion2 = FALSE; // Version 1
+ else // Version 2 oder hoeher
+ {
+ short nExtVer;
+ // 3 Bytes ueberspringen, um auf
+ // ExtVersion2 oder Version2 zu kommen
+ pPict->SeekRel( 3 );
+ *pPict >> nExtVer;
+
+ // nachsehen, ob wir einen Extended-Version2-Header (==-2) haben
+ // oder einen einfachen Version2-Header (==-1);
+ // dementsprechend Aufloesung einlesen oder nicht
+ if ( nExtVer == -2 )
+ {
+ sal_Int16 nReserved;
+ sal_Int32 nHResFixed, nVResFixed;
+ *pPict >> nReserved >> nHResFixed >> nVResFixed;
+ double fHRes = nHResFixed;
+ fHRes /= 65536;
+ double fVRes = nVResFixed;
+ fVRes /= 65536;
+ aHRes /= fHRes;
+ aVRes /= fVRes;
+ *pPict >> y1 >> x1 >> y2 >> x2; // reading the optimal bounding rect
+ aBoundingRect=Rectangle( x1,y1, --x2, --y2 );
+ pPict->SeekRel( -22 );
+ }
+ else
+ {
+ pPict->SeekRel( -4 );
+ }
+ IsVersion2=TRUE;
+ }
+ }
+ else {
+ // Eigentlich ist dies wohl kein Pict-File, aber es gibt tatsaechlich
+ // Dateien, bei denen mehr als 512 Bytes "Muell" am Anfang stehen.
+ // Somit koennte es theoretisch folgende Art von Header geben:
+ // <beliebig viele Bytes Muell> <Picture-Size (Lo-Bytes)> <BoundingRect>
+ // <beliebig viele Nullen> <0x11> ..
+ // Da aber in so einem Fall die Position von <BoundingRect> kaum auszumachen ist,
+ // gehen wir nun davon aus, dass in einer Datei immer entweder genau 512 Bytes Muell
+ // am Anfang sind (wie oben versucht), oder (wie normalerweise ueblich) genau eine 0 zwischen
+ // Bounding-Rectangle und 0x11. Des weiteren mag es hoechstens 1024 Bytes Muell geben,
+ // und das Ganze nur fuer Version 1 oder 2.
+ // Somit suchen wir nun nach der Folge 0x00,0x11,0x01 oder 0x00,0x11,0x02 innerhalb der
+ // "zweiten" 512 Bytes, und nehmen an, dass davor das Bounding-Rect steht, und hoffen
+ // dass das alles so seine Richtigkeit hat.
+ BYTE n1,n2,n3;
+ USHORT i,Found;
+ pPict->Seek(522);
+ Found=0;
+ *pPict >> n1 >> n2 >> n3;
+ for (i=0; i<512; i++) {
+ if (n1==0x00 && n2==0x11 && (n3==0x01 || n3==0x02)) { Found=1; break; }
+ n1=n2; n2=n3; *pPict >> n3;
+ }
+ if (Found!=0) {
+ pPict->SeekRel(-11);
+ *pPict >> y1 >> x1 >> y2 >> x2;
+ // Lieber nochmal nachsehen, ob das Bounding-Rectangle gut zu sein scheint:
+ if (x1+10<x2 && y1+10<y2 && y1>=-2048 && x1>=-2048 && x2<=2048 && y2<=2048) {
+ aBoundingRect=Rectangle( x1, y1, --x2, --y2 );
+ if (n3==0x01) {
+ pPict->SeekRel(3);
+ IsVersion2=FALSE;
+ }
+ else {
+ pPict->SeekRel(4);
+ IsVersion2=TRUE;
+ }
+ }
+ else pPict->SetError(SVSTREAM_FILEFORMAT_ERROR);
+ }
+ else pPict->SetError(SVSTREAM_FILEFORMAT_ERROR);
+ }
+}
+
+
+ULONG PictReader::ReadData(USHORT nOpcode)
+{
+ USHORT nUSHORT;
+ Point aPoint;
+ ULONG nDataSize=0;
+
+ switch(nOpcode) {
+
+ case 0x0000: // NOP
+ nDataSize=0;
+ break;
+
+ case 0x0001: { // Clip
+ Rectangle aRect;
+ *pPict >> nUSHORT;
+ nDataSize=nUSHORT;
+ ReadRectangle(aRect);
+ pVirDev->SetClipRegion( Region( aRect ) );
+ break;
+ }
+ case 0x0002: // BkPat
+ nDataSize=ReadPattern(NULL,&eActBackStyle);
+ eActMethod=PDM_UNDEFINED;
+ break;
+
+ case 0x0003: // TxFont
+ *pPict >> nUSHORT;
+ if (nUSHORT <= 1) aActFont.SetFamily(FAMILY_SWISS);
+ else if (nUSHORT <= 12) aActFont.SetFamily(FAMILY_DECORATIVE);
+ else if (nUSHORT <= 20) aActFont.SetFamily(FAMILY_ROMAN);
+ else if (nUSHORT == 21) aActFont.SetFamily(FAMILY_SWISS);
+ else if (nUSHORT == 22) aActFont.SetFamily(FAMILY_MODERN);
+ else if (nUSHORT <= 1023) aActFont.SetFamily(FAMILY_SWISS);
+ else aActFont.SetFamily(FAMILY_ROMAN);
+ if ( nUSHORT == 23 ) aActFont.SetCharSet( RTL_TEXTENCODING_SYMBOL );
+ else aActFont.SetCharSet( gsl_getSystemTextEncoding() );
+ eActMethod=PDM_UNDEFINED;
+ nDataSize=2;
+ break;
+
+ case 0x0004: { // TxFace
+ char nFace;
+ *pPict >> nFace;
+ if ( (nFace & 0x01)!=0 ) aActFont.SetWeight(WEIGHT_BOLD);
+ else aActFont.SetWeight(WEIGHT_NORMAL);
+ if ( (nFace & 0x02)!=0 ) aActFont.SetItalic(ITALIC_NORMAL);
+ else aActFont.SetItalic(ITALIC_NONE);
+ if ( (nFace & 0x04)!=0 ) aActFont.SetUnderline(UNDERLINE_SINGLE);
+ else aActFont.SetUnderline(UNDERLINE_NONE);
+ if ( (nFace & 0x08)!=0 ) aActFont.SetOutline(TRUE);
+ else aActFont.SetOutline(FALSE);
+ if ( (nFace & 0x10)!=0 ) aActFont.SetShadow(TRUE);
+ else aActFont.SetShadow(FALSE);
+ eActMethod=PDM_UNDEFINED;
+ nDataSize=1;
+ break;
+ }
+ case 0x0005: // TxMode
+ nDataSize=2;
+ break;
+
+ case 0x0006: // SpExtra
+ nDataSize=4;
+ break;
+
+ case 0x0007: { // PnSize
+ Size aSize;
+ aSize=ReadSize();
+ nActPenSize=(USHORT)((aSize.Width()+aSize.Height())/2);
+ eActMethod=PDM_UNDEFINED;
+ nDataSize=4;
+ break;
+ }
+ case 0x0008: // PnMode
+ *pPict >> nUSHORT;
+ switch (nUSHORT & 0x0007) {
+ case 0: eActROP=ROP_OVERPAINT; break; // Copy
+ case 1: eActROP=ROP_OVERPAINT; break; // Or
+ case 2: eActROP=ROP_XOR; break; // Xor
+ case 3: eActROP=ROP_OVERPAINT; break; // Bic
+ case 4: eActROP=ROP_INVERT; break; // notCopy
+ case 5: eActROP=ROP_OVERPAINT; break; // notOr
+ case 6: eActROP=ROP_XOR; break; // notXor
+ case 7: eActROP=ROP_OVERPAINT; break; // notBic
+ }
+ eActMethod=PDM_UNDEFINED;
+ nDataSize=2;
+ break;
+
+ case 0x0009: // PnPat
+ nDataSize=ReadPattern(&eActPenPenStyle,&eActPenBrushStyle);
+ eActMethod=PDM_UNDEFINED;
+ break;
+
+ case 0x000a: // FillPat
+ nDataSize=ReadPattern(NULL,&eActFillStyle);
+ eActMethod=PDM_UNDEFINED;
+ break;
+
+ case 0x000b: // OvSize
+ aActOvalSize=ReadSize();
+ nDataSize=4;
+ break;
+
+ case 0x000c: // Origin
+ nDataSize=4;
+ break;
+
+ case 0x000d: // TxSize
+ {
+ *pPict >> nUSHORT;
+ aActFont.SetSize( Size( 0, (long)nUSHORT ) );
+ eActMethod=PDM_UNDEFINED;
+ nDataSize=2;
+ }
+ break;
+
+ case 0x000e: // FgColor
+ aActForeColor=ReadColor();
+ eActMethod=PDM_UNDEFINED;
+ nDataSize=4;
+ break;
+
+ case 0x000f: // BkColor
+ aActBackColor=ReadColor();
+ nDataSize=4;
+ break;
+
+ case 0x0010: // TxRatio
+ nDataSize=8;
+ break;
+
+ case 0x0011: // VersionOp
+ nDataSize=1;
+ break;
+
+ case 0x0012: // BkPixPat
+ nDataSize=ReadPixPattern(NULL,&eActBackStyle);
+ eActMethod=PDM_UNDEFINED;
+ break;
+
+ case 0x0013: // PnPixPat
+ nDataSize=ReadPixPattern(&eActPenPenStyle,&eActPenBrushStyle);
+ eActMethod=PDM_UNDEFINED;
+ break;
+
+ case 0x0014: // FillPixPat
+ nDataSize=ReadPixPattern(NULL,&eActFillStyle);
+ eActMethod=PDM_UNDEFINED;
+ break;
+
+ case 0x0015: // PnLocHFrac
+ nDataSize=2;
+ break;
+
+ case 0x0016: // ChExtra
+ nDataSize=2;
+ break;
+
+ case 0x0017: // Reserved (0 Bytes)
+ case 0x0018: // Reserved (0 Bytes)
+ case 0x0019: // Reserved (0 Bytes)
+ nDataSize=0;
+ break;
+
+ case 0x001a: // RGBFgCol
+ aActForeColor=ReadRGBColor();
+ eActMethod=PDM_UNDEFINED;
+ nDataSize=6;
+ break;
+
+ case 0x001b: // RGBBkCol
+ aActBackColor=ReadRGBColor();
+ eActMethod=PDM_UNDEFINED;
+ nDataSize=6;
+ break;
+
+ case 0x001c: // HiliteMode
+ nDataSize=0;
+ break;
+
+ case 0x001d: // HiliteColor
+ nDataSize=6;
+ break;
+
+ case 0x001e: // DefHilite
+ nDataSize=0;
+ break;
+
+ case 0x001f: // OpColor
+ nDataSize=6;
+ break;
+
+ case 0x0020: // Line
+ aPoint=ReadPoint(); aPenPosition=ReadPoint();
+ DrawingMethod(PDM_FRAME);
+ pVirDev->DrawLine(aPoint,aPenPosition);
+ nDataSize=8;
+ break;
+
+ case 0x0021: // LineFrom
+ aPoint=aPenPosition; aPenPosition=ReadPoint();
+ DrawingMethod(PDM_FRAME);
+ pVirDev->DrawLine(aPoint,aPenPosition);
+ nDataSize=4;
+ break;
+
+ case 0x0022: // ShortLine
+ aPoint=ReadPoint();
+ aPenPosition=ReadDeltaH(aPoint);
+ aPenPosition=ReadDeltaV(aPenPosition);
+ DrawingMethod(PDM_FRAME);
+ pVirDev->DrawLine(aPoint,aPenPosition);
+ nDataSize=6;
+ break;
+
+ case 0x0023: // ShortLineFrom
+ aPoint=aPenPosition;
+ aPenPosition=ReadDeltaH(aPoint);
+ aPenPosition=ReadDeltaV(aPenPosition);
+ DrawingMethod(PDM_FRAME);
+ pVirDev->DrawLine(aPoint,aPenPosition);
+ nDataSize=2;
+ break;
+
+ case 0x0024: // Reserved (n Bytes)
+ case 0x0025: // Reserved (n Bytes)
+ case 0x0026: // Reserved (n Bytes)
+ case 0x0027: // Reserved (n Bytes)
+ *pPict >> nUSHORT;
+ nDataSize=2+nUSHORT;
+ break;
+
+ case 0x0028: // LongText
+ aTextPosition=ReadPoint();
+ nDataSize=4+ReadAndDrawText();
+ break;
+
+ case 0x0029: // DHText
+ aTextPosition=ReadUnsignedDeltaH(aTextPosition);
+ nDataSize=1+ReadAndDrawText();
+ break;
+
+ case 0x002a: // DVText
+ aTextPosition=ReadUnsignedDeltaV(aTextPosition);
+ nDataSize=1+ReadAndDrawText();
+ break;
+
+ case 0x002b: // DHDVText
+ aTextPosition=ReadUnsignedDeltaH(aTextPosition);
+ aTextPosition=ReadUnsignedDeltaV(aTextPosition);
+ nDataSize=2+ReadAndDrawText();
+ break;
+
+ case 0x002c: { // fontName
+ char sFName[ 256 ], nByteLen;
+ sal_uInt16 nLen;
+ *pPict >> nUSHORT; nDataSize=nUSHORT+2;
+ *pPict >> nUSHORT;
+ if (nUSHORT <= 1) aActFont.SetFamily(FAMILY_SWISS);
+ else if (nUSHORT <= 12) aActFont.SetFamily(FAMILY_DECORATIVE);
+ else if (nUSHORT <= 20) aActFont.SetFamily(FAMILY_ROMAN);
+ else if (nUSHORT == 21) aActFont.SetFamily(FAMILY_SWISS);
+ else if (nUSHORT == 22) aActFont.SetFamily(FAMILY_MODERN);
+ else if (nUSHORT <= 1023) aActFont.SetFamily(FAMILY_SWISS);
+ else aActFont.SetFamily(FAMILY_ROMAN);
+ if (nUSHORT==23) aActFont.SetCharSet( RTL_TEXTENCODING_SYMBOL);
+ else aActFont.SetCharSet( gsl_getSystemTextEncoding() );
+ *pPict >> nByteLen; nLen=((USHORT)nByteLen)&0x00ff;
+ pPict->Read( &sFName, nLen );
+ sFName[ nLen ] = 0;
+ String aString( (const sal_Char*)&sFName, gsl_getSystemTextEncoding() );
+ aActFont.SetName( aString );
+ eActMethod=PDM_UNDEFINED;
+ break;
+ }
+ case 0x002d: // lineJustify
+ nDataSize=10;
+ break;
+
+ case 0x002e: // glyphState
+ *pPict >> nUSHORT;
+ nDataSize=2+nUSHORT;
+ break;
+
+ case 0x002f: // Reserved (n Bytes)
+ *pPict >> nUSHORT;
+ nDataSize=2+nUSHORT;
+ break;
+
+ case 0x0030: // frameRect
+ nDataSize=ReadAndDrawRect(PDM_FRAME);
+ break;
+
+ case 0x0031: // paintRect
+ nDataSize=ReadAndDrawRect(PDM_PAINT);
+ break;
+
+ case 0x0032: // eraseRect
+ nDataSize=ReadAndDrawRect(PDM_ERASE);
+ break;
+
+ case 0x0033: // invertRect
+ nDataSize=ReadAndDrawRect(PDM_INVERT);
+ break;
+
+ case 0x0034: // fillRect
+ nDataSize=ReadAndDrawRect(PDM_FILL);
+ break;
+
+ case 0x0035: // Reserved (8 Bytes)
+ case 0x0036: // Reserved (8 Bytes)
+ case 0x0037: // Reserved (8 Bytes)
+ nDataSize=8;
+ break;
+
+ case 0x0038: // frameSameRect
+ nDataSize=ReadAndDrawSameRect(PDM_FRAME);
+ break;
+
+ case 0x0039: // paintSameRect
+ nDataSize=ReadAndDrawSameRect(PDM_PAINT);
+ break;
+
+ case 0x003a: // eraseSameRect
+ nDataSize=ReadAndDrawSameRect(PDM_ERASE);
+ break;
+
+ case 0x003b: // invertSameRect
+ nDataSize=ReadAndDrawSameRect(PDM_INVERT);
+ break;
+
+ case 0x003c: // fillSameRect
+ nDataSize=ReadAndDrawSameRect(PDM_FILL);
+ break;
+
+ case 0x003d: // Reserved (0 Bytes)
+ case 0x003e: // Reserved (0 Bytes)
+ case 0x003f: // Reserved (0 Bytes)
+ nDataSize=0;
+ break;
+
+ case 0x0040: // frameRRect
+ nDataSize=ReadAndDrawRoundRect(PDM_FRAME);
+ break;
+
+ case 0x0041: // paintRRect
+ nDataSize=ReadAndDrawRoundRect(PDM_PAINT);
+ break;
+
+ case 0x0042: // eraseRRect
+ nDataSize=ReadAndDrawRoundRect(PDM_ERASE);
+ break;
+
+ case 0x0043: // invertRRect
+ nDataSize=ReadAndDrawRoundRect(PDM_INVERT);
+ break;
+
+ case 0x0044: // fillRRect
+ nDataSize=ReadAndDrawRoundRect(PDM_FILL);
+ break;
+
+ case 0x0045: // Reserved (8 Bytes)
+ case 0x0046: // Reserved (8 Bytes)
+ case 0x0047: // Reserved (8 Bytes)
+ nDataSize=8;
+ break;
+
+ case 0x0048: // frameSameRRect
+ nDataSize=ReadAndDrawSameRoundRect(PDM_FRAME);
+ break;
+
+ case 0x0049: // paintSameRRect
+ nDataSize=ReadAndDrawSameRoundRect(PDM_PAINT);
+ break;
+
+ case 0x004a: // eraseSameRRect
+ nDataSize=ReadAndDrawSameRoundRect(PDM_ERASE);
+ break;
+
+ case 0x004b: // invertSameRRect
+ nDataSize=ReadAndDrawSameRoundRect(PDM_INVERT);
+ break;
+
+ case 0x004c: // fillSameRRect
+ nDataSize=ReadAndDrawSameRoundRect(PDM_FILL);
+ break;
+
+ case 0x004d: // Reserved (0 Bytes)
+ case 0x004e: // Reserved (0 Bytes)
+ case 0x004f: // Reserved (0 Bytes)
+ nDataSize=0;
+ break;
+
+ case 0x0050: // frameOval
+ nDataSize=ReadAndDrawOval(PDM_FRAME);
+ break;
+
+ case 0x0051: // paintOval
+ nDataSize=ReadAndDrawOval(PDM_PAINT);
+ break;
+
+ case 0x0052: // eraseOval
+ nDataSize=ReadAndDrawOval(PDM_ERASE);
+ break;
+
+ case 0x0053: // invertOval
+ nDataSize=ReadAndDrawOval(PDM_INVERT);
+ break;
+
+ case 0x0054: // fillOval
+ nDataSize=ReadAndDrawOval(PDM_FILL);
+ break;
+
+ case 0x0055: // Reserved (8 Bytes)
+ case 0x0056: // Reserved (8 Bytes)
+ case 0x0057: // Reserved (8 Bytes)
+ nDataSize=8;
+ break;
+
+ case 0x0058: // frameSameOval
+ nDataSize=ReadAndDrawSameOval(PDM_FRAME);
+ break;
+
+ case 0x0059: // paintSameOval
+ nDataSize=ReadAndDrawSameOval(PDM_PAINT);
+ break;
+
+ case 0x005a: // eraseSameOval
+ nDataSize=ReadAndDrawSameOval(PDM_ERASE);
+ break;
+
+ case 0x005b: // invertSameOval
+ nDataSize=ReadAndDrawSameOval(PDM_INVERT);
+ break;
+
+ case 0x005c: // fillSameOval
+ nDataSize=ReadAndDrawSameOval(PDM_FILL);
+ break;
+
+ case 0x005d: // Reserved (0 Bytes)
+ case 0x005e: // Reserved (0 Bytes)
+ case 0x005f: // Reserved (0 Bytes)
+ nDataSize=0;
+ break;
+
+ case 0x0060: // frameArc
+ nDataSize=ReadAndDrawArc(PDM_FRAME);
+ break;
+
+ case 0x0061: // paintArc
+ nDataSize=ReadAndDrawArc(PDM_PAINT);
+ break;
+
+ case 0x0062: // eraseArc
+ nDataSize=ReadAndDrawArc(PDM_ERASE);
+ break;
+
+ case 0x0063: // invertArc
+ nDataSize=ReadAndDrawArc(PDM_INVERT);
+ break;
+
+ case 0x0064: // fillArc
+ nDataSize=ReadAndDrawArc(PDM_FILL);
+ break;
+
+ case 0x0065: // Reserved (12 Bytes)
+ case 0x0066: // Reserved (12 Bytes)
+ case 0x0067: // Reserved (12 Bytes)
+ nDataSize=12;
+ break;
+
+ case 0x0068: // frameSameArc
+ nDataSize=ReadAndDrawSameArc(PDM_FRAME);
+ break;
+
+ case 0x0069: // paintSameArc
+ nDataSize=ReadAndDrawSameArc(PDM_PAINT);
+ break;
+
+ case 0x006a: // eraseSameArc
+ nDataSize=ReadAndDrawSameArc(PDM_ERASE);
+ break;
+
+ case 0x006b: // invertSameArc
+ nDataSize=ReadAndDrawSameArc(PDM_INVERT);
+ break;
+
+ case 0x006c: // fillSameArc
+ nDataSize=ReadAndDrawSameArc(PDM_FILL);
+ break;
+
+ case 0x006d: // Reserved (4 Bytes)
+ case 0x006e: // Reserved (4 Bytes)
+ case 0x006f: // Reserved (4 Bytes)
+ nDataSize=4;
+ break;
+
+ case 0x0070: // framePoly
+ nDataSize=ReadAndDrawPolygon(PDM_FRAME);
+ break;
+
+ case 0x0071: // paintPoly
+ nDataSize=ReadAndDrawPolygon(PDM_PAINT);
+ break;
+
+ case 0x0072: // erasePoly
+ nDataSize=ReadAndDrawPolygon(PDM_ERASE);
+ break;
+
+ case 0x0073: // invertPoly
+ nDataSize=ReadAndDrawPolygon(PDM_INVERT);
+ break;
+
+ case 0x0074: // fillPoly
+ nDataSize=ReadAndDrawPolygon(PDM_FILL);
+ break;
+
+ case 0x0075: // Reserved (Polygon-Size)
+ case 0x0076: // Reserved (Polygon-Size)
+ case 0x0077: // Reserved (Polygon-Size)
+ *pPict >> nUSHORT; nDataSize=nUSHORT;
+ break;
+
+ case 0x0078: // frameSamePoly
+ nDataSize=ReadAndDrawSamePolygon(PDM_FRAME);
+ break;
+
+ case 0x0079: // paintSamePoly
+ nDataSize=ReadAndDrawSamePolygon(PDM_PAINT);
+ break;
+
+ case 0x007a: // eraseSamePoly
+ nDataSize=ReadAndDrawSamePolygon(PDM_ERASE);
+ break;
+
+ case 0x007b: // invertSamePoly
+ nDataSize=ReadAndDrawSamePolygon(PDM_INVERT);
+ break;
+
+ case 0x007c: // fillSamePoly
+ nDataSize=ReadAndDrawSamePolygon(PDM_FILL);
+ break;
+
+ case 0x007d: // Reserved (0 Bytes)
+ case 0x007e: // Reserved (0 Bytes)
+ case 0x007f: // Reserved (0 Bytes)
+ nDataSize=0;
+ break;
+
+ case 0x0080: // frameRgn
+ nDataSize=ReadAndDrawRgn(PDM_FILL);
+ break;
+
+ case 0x0081: // paintRgn
+ nDataSize=ReadAndDrawRgn(PDM_PAINT);
+ break;
+
+ case 0x0082: // eraseRgn
+ nDataSize=ReadAndDrawRgn(PDM_ERASE);
+ break;
+
+ case 0x0083: // invertRgn
+ nDataSize=ReadAndDrawRgn(PDM_INVERT);
+ break;
+
+ case 0x0084: // fillRgn
+ nDataSize=ReadAndDrawRgn(PDM_FILL);
+ break;
+
+ case 0x0085: // Reserved (Region-Size)
+ case 0x0086: // Reserved (Region-Size)
+ case 0x0087: // Reserved (Region-Size)
+ *pPict >> nUSHORT; nDataSize=nUSHORT;
+ break;
+
+ case 0x0088: // frameSameRgn
+ nDataSize=ReadAndDrawSameRgn(PDM_FRAME);
+ break;
+
+ case 0x0089: // paintSameRgn
+ nDataSize=ReadAndDrawSameRgn(PDM_PAINT);
+ break;
+
+ case 0x008a: // eraseSameRgn
+ nDataSize=ReadAndDrawSameRgn(PDM_ERASE);
+ break;
+
+ case 0x008b: // invertSameRgn
+ nDataSize=ReadAndDrawSameRgn(PDM_INVERT);
+ break;
+
+ case 0x008c: // fillSameRgn
+ nDataSize=ReadAndDrawSameRgn(PDM_FILL);
+ break;
+
+ case 0x008d: // Reserved (0 Bytes)
+ case 0x008e: // Reserved (0 Bytes)
+ case 0x008f: // Reserved (0 Bytes)
+ nDataSize=0;
+ break;
+
+ case 0x0090: { // BitsRect
+ Bitmap aBmp;
+ Rectangle aSrcRect, aDestRect;
+ nDataSize=ReadPixMapEtc(aBmp, FALSE, TRUE, &aSrcRect, &aDestRect, TRUE, FALSE);
+ DrawingMethod(PDM_PAINT);
+ pVirDev->DrawBitmap(aDestRect.TopLeft(),aDestRect.GetSize(),aBmp);
+ break;
+ }
+ case 0x0091: { // BitsRgn
+ Bitmap aBmp;
+ Rectangle aSrcRect, aDestRect;
+ nDataSize=ReadPixMapEtc(aBmp, FALSE, TRUE, &aSrcRect, &aDestRect, TRUE, TRUE);
+ DrawingMethod(PDM_PAINT);
+ pVirDev->DrawBitmap(aDestRect.TopLeft(),aDestRect.GetSize(),aBmp);
+ break;
+ }
+ case 0x0092: // Reserved (n Bytes)
+ case 0x0093: // Reserved (n Bytes)
+ case 0x0094: // Reserved (n Bytes)
+ case 0x0095: // Reserved (n Bytes)
+ case 0x0096: // Reserved (n Bytes)
+ case 0x0097: // Reserved (n Bytes)
+ *pPict >> nUSHORT; nDataSize=2+nUSHORT;
+ break;
+
+ case 0x0098: { // PackBitsRect
+ Bitmap aBmp;
+ Rectangle aSrcRect, aDestRect;
+ nDataSize=ReadPixMapEtc(aBmp, FALSE, TRUE, &aSrcRect, &aDestRect, TRUE, FALSE);
+ DrawingMethod(PDM_PAINT);
+ pVirDev->DrawBitmap(aDestRect.TopLeft(),aDestRect.GetSize(),aBmp);
+ break;
+ }
+ case 0x0099: { // PackBitsRgn
+ Bitmap aBmp;
+ Rectangle aSrcRect, aDestRect;
+ nDataSize=ReadPixMapEtc(aBmp, FALSE, TRUE, &aSrcRect, &aDestRect, TRUE, TRUE);
+ DrawingMethod(PDM_PAINT);
+ pVirDev->DrawBitmap(aDestRect.TopLeft(),aDestRect.GetSize(),aBmp);
+ break;
+ }
+ case 0x009a: { // DirectBitsRect
+ Bitmap aBmp;
+ Rectangle aSrcRect, aDestRect;
+ nDataSize=ReadPixMapEtc(aBmp, TRUE, FALSE, &aSrcRect, &aDestRect, TRUE, FALSE);
+ DrawingMethod(PDM_PAINT);
+ pVirDev->DrawBitmap(aDestRect.TopLeft(),aDestRect.GetSize(),aBmp);
+ break;
+ }
+ case 0x009b: { // DirectBitsRgn
+ Bitmap aBmp;
+ Rectangle aSrcRect, aDestRect;
+ nDataSize=ReadPixMapEtc(aBmp, TRUE, FALSE, &aSrcRect, &aDestRect, TRUE, TRUE);
+ DrawingMethod(PDM_PAINT);
+ pVirDev->DrawBitmap(aDestRect.TopLeft(),aDestRect.GetSize(),aBmp);
+ break;
+ }
+ case 0x009c: // Reserved (n Bytes)
+ case 0x009d: // Reserved (n Bytes)
+ case 0x009e: // Reserved (n Bytes)
+ case 0x009f: // Reserved (n Bytes)
+ *pPict >> nUSHORT; nDataSize=2+nUSHORT;
+ break;
+
+ case 0x00a0: // ShortComment
+ nDataSize=2;
+ break;
+
+ case 0x00a1: // LongComment
+ pPict->SeekRel(2); *pPict >> nUSHORT; nDataSize=4+nUSHORT;
+ break;
+
+ default: // 0x00a2 bis 0xffff (zumeist Reserved)
+ if (nOpcode<=0x00af) { *pPict >> nUSHORT; nDataSize=2+nUSHORT; }
+ else if (nOpcode<=0x00cf) { nDataSize=0; }
+ else if (nOpcode<=0x00fe) { sal_uInt32 nTemp; *pPict >> nTemp ; nDataSize = nTemp; nDataSize+=4; }
+ else if (nOpcode==0x00ff) { nDataSize=2; } // OpEndPic
+ else if (nOpcode<=0x01ff) { nDataSize=2; }
+ else if (nOpcode<=0x0bfe) { nDataSize=4; }
+ else if (nOpcode<=0x0bff) { nDataSize=22; }
+ else if (nOpcode==0x0c00) { nDataSize=24; } // HeaderOp
+ else if (nOpcode<=0x7eff) { nDataSize=24; }
+ else if (nOpcode<=0x7fff) { nDataSize=254; }
+ else if (nOpcode<=0x80ff) { nDataSize=0; }
+ else { sal_uInt32 nTemp; *pPict >> nTemp ; nDataSize = nTemp; nDataSize+=4; }
+ }
+
+ if (nDataSize==0xffffffff) {
+ pPict->SetError(SVSTREAM_FILEFORMAT_ERROR);
+ return 0;
+ }
+ return nDataSize;
+}
+
+void PictReader::ReadPict( SvStream & rStreamPict, GDIMetaFile & rGDIMetaFile )
+{
+ USHORT nOpcode;
+ BYTE nOneByteOpcode;
+ ULONG nSize, nPos, nStartPos, nEndPos, nPercent, nLastPercent;
+
+ pPict = &rStreamPict;
+ nOrigPos = pPict->Tell();
+ nOrigNumberFormat = pPict->GetNumberFormatInt();
+
+ aActForeColor = Color(COL_BLACK);
+ aActBackColor = Color(COL_WHITE);
+ eActPenPenStyle = PEN_SOLID;
+ eActPenBrushStyle = BRUSH_SOLID;
+ eActFillStyle = BRUSH_SOLID;
+ eActBackStyle = BRUSH_SOLID;
+ nActPenSize = 1;
+ eActROP = ROP_OVERPAINT;
+ eActMethod = PDM_UNDEFINED;
+ aActOvalSize = Size(1,1);
+
+ aActFont.SetCharSet( gsl_getSystemTextEncoding() );
+ aActFont.SetFamily(FAMILY_SWISS);
+ aActFont.SetSize(Size(0,12));
+ aActFont.SetAlign(ALIGN_BASELINE);
+
+ aHRes = aVRes = Fraction( 1, 1 );
+
+ pVirDev = new VirtualDevice();
+ pVirDev->EnableOutput(FALSE);
+ rGDIMetaFile.Record(pVirDev);
+
+ pPict->SetNumberFormatInt(NUMBERFORMAT_INT_BIGENDIAN);
+
+ nStartPos=pPict->Tell();
+ nEndPos=pPict->Seek(STREAM_SEEK_TO_END); pPict->Seek(nStartPos);
+ Callback(0); nLastPercent=0;
+
+ ReadHeader();
+
+ aPenPosition=Point(-aBoundingRect.Left(),-aBoundingRect.Top());
+ aTextPosition=aPenPosition;
+
+ nPos=pPict->Tell();
+
+ for (;;) {
+
+ nPercent=(nPos-nStartPos)*100/(nEndPos-nStartPos);
+ if (nLastPercent+4<=nPercent) {
+ if (Callback((USHORT)nPercent)==TRUE) break;
+ nLastPercent=nPercent;
+ }
+
+ if (IsVersion2 )
+ *pPict >> nOpcode;
+ else
+ {
+ *pPict >> nOneByteOpcode;
+ nOpcode=(USHORT)nOneByteOpcode;
+ }
+
+ if (pPict->GetError())
+ break;
+
+ if (pPict->IsEof())
+ {
+ pPict->SetError(SVSTREAM_FILEFORMAT_ERROR);
+ break;
+ }
+
+ if (nOpcode==0x00ff)
+ break;
+
+ nSize=ReadData(nOpcode);
+
+ if ( IsVersion2 )
+ {
+ if ( nSize & 1 )
+ nSize++;
+
+ nPos+=2+nSize;
+ }
+ else
+ nPos+=1+nSize;
+
+ pPict->Seek(nPos);
+ }
+
+ rGDIMetaFile.Stop();
+ delete pVirDev;
+
+ rGDIMetaFile.SetPrefMapMode( MapMode( MAP_INCH, Point(), aHRes, aVRes ) );
+ rGDIMetaFile.SetPrefSize( aBoundingRect.GetSize() );
+
+ pPict->SetNumberFormatInt(nOrigNumberFormat);
+
+ if (pPict->GetError()) pPict->Seek(nOrigPos);
+}
+
+//================== GraphicImport - die exportierte Funktion ================
+
+extern "C" BOOL __LOADONCALLAPI GraphicImport( SvStream& rIStm, Graphic & rGraphic, FilterConfigItem*, BOOL )
+{
+ GDIMetaFile aMTF;
+ PictReader aPictReader;
+ BOOL bRet = FALSE;
+
+ aPictReader.ReadPict( rIStm, aMTF );
+
+ if ( !rIStm.GetError() )
+ {
+ rGraphic = Graphic( aMTF );
+ bRet = TRUE;
+ }
+
+ return bRet;
+}
+
+//================== ein bischen Muell fuer Windows ==========================
+#ifndef GCC
+#endif
+
+#ifdef WIN
+
+static HINSTANCE hDLLInst = 0; // HANDLE der DLL
+
+extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR )
+{
+#ifndef WNT
+ if ( nHeap )
+ UnlockData( 0 );
+#endif
+
+ hDLLInst = hDLL;
+
+ return TRUE;
+}
+
+extern "C" int CALLBACK WEP( int )
+{
+ return 1;
+}
+
+#endif
diff --git a/filter/source/graphicfilter/ipict/makefile.mk b/filter/source/graphicfilter/ipict/makefile.mk
new file mode 100644
index 000000000000..679fd79951ac
--- /dev/null
+++ b/filter/source/graphicfilter/ipict/makefile.mk
@@ -0,0 +1,68 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=filter
+TARGET=ipict
+DEPTARGET=vipict
+
+# --- Settings -----------------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Allgemein ----------------------------------------------------------
+
+.IF "$(editdebug)"!="" || "$(EDITDEBUG)"!=""
+CDEFS+= -DEDITDEBUG
+.ENDIF
+.IF "$(L10N_framework)"==""
+SLOFILES = $(SLO)$/ipict.obj
+
+# ==========================================================================
+
+SHL1TARGET= ipt$(DLLPOSTFIX)
+SHL1IMPLIB= ipict
+SHL1STDLIBS= $(VCLLIB) $(TOOLSLIB) $(SALLIB)
+SHL1LIBS= $(SLB)$/ipict.lib
+
+.IF "$(GUI)" != "UNX"
+.IF "$(COM)" != "GCC"
+SHL1OBJS= $(SLO)$/ipict.obj
+.ENDIF
+.ENDIF
+
+SHL1VERSIONMAP=exports.map
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+
+DEF1NAME=$(SHL1TARGET)
+.ENDIF
+
+# ==========================================================================
+
+.INCLUDE : target.mk
+
diff --git a/filter/source/graphicfilter/ipsd/exports.map b/filter/source/graphicfilter/ipsd/exports.map
new file mode 100644
index 000000000000..941e4ab9bde8
--- /dev/null
+++ b/filter/source/graphicfilter/ipsd/exports.map
@@ -0,0 +1,7 @@
+UDK_3_0_0 {
+ global:
+ GraphicImport;
+
+ local:
+ *;
+};
diff --git a/filter/source/graphicfilter/ipsd/ipsd.cxx b/filter/source/graphicfilter/ipsd/ipsd.cxx
new file mode 100644
index 000000000000..70cd1ab13f29
--- /dev/null
+++ b/filter/source/graphicfilter/ipsd/ipsd.cxx
@@ -0,0 +1,763 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include <vcl/graph.hxx>
+#include <vcl/bmpacc.hxx>
+#include <svtools/fltcall.hxx>
+
+//============================ PSDReader ==================================
+
+#define PSD_BITMAP 0
+#define PSD_GRAYSCALE 1
+#define PSD_INDEXED 2
+#define PSD_RGB 3
+#define PSD_CMYK 4
+#define PSD_MULTICHANNEL 7
+#define PSD_DUOTONE 8
+#define PSD_LAB 9
+
+typedef struct
+{
+ UINT32 nSignature;
+ UINT16 nVersion;
+ UINT32 nPad1;
+ UINT16 nPad2;
+ UINT16 nChannels;
+ UINT32 nRows;
+ UINT32 nColumns;
+ UINT16 nDepth;
+ UINT16 nMode;
+
+} PSDFileHeader;
+
+class PSDReader {
+
+private:
+
+ SvStream* mpPSD; // Die einzulesende PSD-Datei
+ PSDFileHeader* mpFileHeader;
+
+ sal_uInt32 mnXResFixed;
+ sal_uInt32 mnYResFixed;
+
+ sal_Bool mbStatus;
+ sal_Bool mbTransparent;
+
+ Bitmap maBmp;
+ Bitmap maMaskBmp;
+ BitmapReadAccess* mpReadAcc;
+ BitmapWriteAccess* mpWriteAcc;
+ BitmapWriteAccess* mpMaskWriteAcc;
+ USHORT mnDestBitDepth;
+ BOOL mbCompression; // RLE decoding
+ BYTE* mpPalette;
+
+ BOOL ImplReadBody();
+ BOOL ImplReadHeader();
+
+public:
+ PSDReader();
+ ~PSDReader();
+ BOOL ReadPSD( SvStream & rPSD, Graphic & rGraphic );
+};
+
+//=================== Methoden von PSDReader ==============================
+
+PSDReader::PSDReader() :
+ mpFileHeader ( NULL ),
+ mnXResFixed ( 0 ),
+ mnYResFixed ( 0 ),
+ mbStatus ( TRUE ),
+ mbTransparent ( FALSE ),
+ mpReadAcc ( NULL ),
+ mpWriteAcc ( NULL ),
+ mpMaskWriteAcc ( NULL ),
+ mpPalette ( NULL )
+{
+}
+
+PSDReader::~PSDReader()
+{
+ delete[] mpPalette;
+ delete mpFileHeader;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL PSDReader::ReadPSD( SvStream & rPSD, Graphic & rGraphic )
+{
+ if ( rPSD.GetError() )
+ return FALSE;
+
+ mpPSD = &rPSD;
+ mpPSD->SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN );
+
+ // Kopf einlesen:
+
+ if ( ImplReadHeader() == FALSE )
+ return FALSE;
+
+ Size aBitmapSize( mpFileHeader->nColumns, mpFileHeader->nRows );
+ maBmp = Bitmap( aBitmapSize, mnDestBitDepth );
+ if ( ( mpWriteAcc = maBmp.AcquireWriteAccess() ) == NULL )
+ mbStatus = FALSE;
+ if ( ( mpReadAcc = maBmp.AcquireReadAccess() ) == NULL )
+ mbStatus = FALSE;
+ if ( mbTransparent && mbStatus )
+ {
+ maMaskBmp = Bitmap( aBitmapSize, 1 );
+ if ( ( mpMaskWriteAcc = maMaskBmp.AcquireWriteAccess() ) == NULL )
+ mbStatus = FALSE;
+ }
+ if ( mpPalette && mbStatus )
+ {
+ mpWriteAcc->SetPaletteEntryCount( 256 );
+ for ( USHORT i = 0; i < 256; i++ )
+ {
+ mpWriteAcc->SetPaletteColor( i, Color( mpPalette[ i ], mpPalette[ i + 256 ], mpPalette[ i + 512 ] ) );
+ }
+ }
+ // Bitmap-Daten einlesen
+ if ( mbStatus && ImplReadBody() )
+ {
+ if ( mbTransparent )
+ rGraphic = Graphic( BitmapEx( maBmp, maMaskBmp ) );
+ else
+ rGraphic = maBmp;
+
+ if ( mnXResFixed && mnYResFixed )
+ {
+ Point aEmptyPoint;
+ Fraction aFractX( 1, mnXResFixed >> 16 );
+ Fraction aFractY( 1, mnYResFixed >> 16 );
+ MapMode aMapMode( MAP_INCH, aEmptyPoint, aFractX, aFractY );
+ Size aPrefSize = OutputDevice::LogicToLogic( aBitmapSize, aMapMode, MAP_100TH_MM );
+ rGraphic.SetPrefSize( aPrefSize );
+ rGraphic.SetPrefMapMode( MapMode( MAP_100TH_MM ) );
+ }
+ }
+ else
+ mbStatus = FALSE;
+ if ( mpWriteAcc )
+ maBmp.ReleaseAccess( mpWriteAcc );
+ if ( mpReadAcc )
+ maBmp.ReleaseAccess( mpReadAcc );
+ if ( mpMaskWriteAcc )
+ maMaskBmp.ReleaseAccess( mpMaskWriteAcc );
+ return mbStatus;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL PSDReader::ImplReadHeader()
+{
+ UINT16 nCompression;
+ UINT32 nColorLength, nResourceLength, nLayerMaskLength;
+
+ mpFileHeader = new PSDFileHeader;
+
+ if ( !mpFileHeader )
+ return FALSE;
+
+ *mpPSD >> mpFileHeader->nSignature >> mpFileHeader->nVersion >> mpFileHeader->nPad1 >>
+ mpFileHeader->nPad2 >> mpFileHeader->nChannels >> mpFileHeader->nRows >>
+ mpFileHeader->nColumns >> mpFileHeader->nDepth >> mpFileHeader->nMode;
+
+ if ( ( mpFileHeader->nSignature != 0x38425053 ) || ( mpFileHeader->nVersion != 1 ) )
+ return FALSE;
+
+ if ( mpFileHeader->nRows == 0 || mpFileHeader->nColumns == 0 )
+ return FALSE;
+
+ if ( ( mpFileHeader->nRows > 30000 ) || ( mpFileHeader->nColumns > 30000 ) )
+ return FALSE;
+
+ UINT16 nDepth = mpFileHeader->nDepth;
+ if (!( ( nDepth == 1 ) || ( nDepth == 8 ) || ( nDepth == 16 ) ) )
+ return FALSE;
+
+ mnDestBitDepth = ( nDepth == 16 ) ? 8 : nDepth;
+
+ *mpPSD >> nColorLength;
+ if ( mpFileHeader->nMode == PSD_CMYK )
+ {
+ switch ( mpFileHeader->nChannels )
+ {
+ case 5 :
+ mbTransparent = TRUE;
+ case 4 :
+ mnDestBitDepth = 24;
+ break;
+ default :
+ return FALSE;
+ }
+ }
+ else switch ( mpFileHeader->nChannels )
+ {
+ case 2 :
+ mbTransparent = TRUE;
+ case 1 :
+ break;
+ case 4 :
+ mbTransparent = TRUE;
+ case 3 :
+ mnDestBitDepth = 24;
+ break;
+ default:
+ return FALSE;
+ }
+
+ switch ( mpFileHeader->nMode )
+ {
+ case PSD_BITMAP :
+ {
+ if ( nColorLength || ( nDepth != 1 ) )
+ return FALSE;
+ }
+ break;
+
+ case PSD_INDEXED :
+ {
+ if ( nColorLength != 768 ) // we need the color map
+ return FALSE;
+ mpPalette = new BYTE[ 768 ];
+ if ( mpPalette == NULL )
+ return FALSE;
+ mpPSD->Read( mpPalette, 768 );
+ }
+ break;
+
+ case PSD_DUOTONE : // we'll handle the doutone color like a normal grayscale picture
+ mpPSD->SeekRel( nColorLength );
+ nColorLength = 0;
+ case PSD_GRAYSCALE :
+ {
+ if ( nColorLength )
+ return FALSE;
+ mpPalette = new BYTE[ 768 ];
+ if ( mpPalette == NULL )
+ return FALSE;
+ for ( USHORT i = 0; i < 256; i++ )
+ {
+ mpPalette[ i ] = mpPalette[ i + 256 ] = mpPalette[ i + 512 ] = (BYTE)i;
+ }
+ }
+ break;
+
+ case PSD_CMYK :
+ case PSD_RGB :
+ case PSD_MULTICHANNEL :
+ case PSD_LAB :
+ {
+ if ( nColorLength ) // color table is not supported by the other graphic modes
+ return FALSE;
+ }
+ break;
+
+ default:
+ return FALSE;
+ }
+ *mpPSD >> nResourceLength;
+ sal_uInt32 nLayerPos = mpPSD->Tell() + nResourceLength;
+
+ // this is a loop over the resource entries to get the resolution info
+ while( mpPSD->Tell() < nLayerPos )
+ {
+ sal_uInt8 n8;
+ sal_uInt32 nType, nPStringLen, nResEntryLen;
+ sal_uInt16 nUniqueID;
+
+ *mpPSD >> nType >> nUniqueID >> n8;
+ nPStringLen = n8;
+ if ( nType != 0x3842494d )
+ break;
+ if ( ! ( nPStringLen & 1 ) )
+ nPStringLen++;
+ mpPSD->SeekRel( nPStringLen ); // skipping the pstring
+ *mpPSD >> nResEntryLen;
+ if ( nResEntryLen & 1 )
+ nResEntryLen++; // the resource entries are padded
+ sal_uInt32 nCurrentPos = mpPSD->Tell();
+ if ( ( nResEntryLen + nCurrentPos ) > nLayerPos ) // check if size
+ break; // is possible
+ switch( nUniqueID )
+ {
+ case 0x3ed : // UID for the resolution info
+ {
+ sal_Int16 nUnit;
+
+ *mpPSD >> mnXResFixed >> nUnit >> nUnit
+ >> mnYResFixed >> nUnit >> nUnit;
+ }
+ break;
+ }
+ mpPSD->Seek( nCurrentPos + nResEntryLen ); // set the stream to the next
+ } // resource entry
+ mpPSD->Seek( nLayerPos );
+ *mpPSD >> nLayerMaskLength;
+ mpPSD->SeekRel( nLayerMaskLength );
+
+ *mpPSD >> nCompression;
+ if ( nCompression == 0 )
+ {
+ mbCompression = FALSE;
+ }
+ else if ( nCompression == 1 )
+ {
+ mpPSD->SeekRel( ( mpFileHeader->nRows * mpFileHeader->nChannels ) << 1 );
+ mbCompression = TRUE;
+ }
+ else
+ return FALSE;
+
+ return TRUE;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL PSDReader::ImplReadBody()
+{
+ ULONG nX, nY;
+ char nRunCount = 0;
+ signed char nBitCount = -1;
+ BYTE nDat = 0, nDummy, nRed, nGreen, nBlue;
+ BitmapColor aBitmapColor;
+ nX = nY = 0;
+
+ switch ( mnDestBitDepth )
+ {
+ case 1 :
+ {
+ while ( nY < mpFileHeader->nRows )
+ {
+ if ( nBitCount == -1 )
+ {
+ if ( mbCompression ) // else nRunCount = 0 -> so we use only single raw packets
+ *mpPSD >> nRunCount;
+ }
+ if ( nRunCount & 0x80 ) // a run length packet
+ {
+ if ( nBitCount == -1 ) // bits left in nDat ?
+ {
+ *mpPSD >> nDat;
+ nDat ^= 0xff;
+ nBitCount = 7;
+ }
+ for ( USHORT i = 0; i < ( -nRunCount + 1 ); i++ )
+ {
+ mpWriteAcc->SetPixel( nY, nX, (BYTE)nDat >> nBitCount-- );
+ if ( ++nX == mpFileHeader->nColumns )
+ {
+ nX = 0;
+ nY++;
+ nBitCount = -1;
+ if ( nY == mpFileHeader->nRows )
+ break;
+ }
+ }
+ }
+ else // a raw packet
+ {
+ for ( USHORT i = 0; i < ( ( nRunCount & 0x7f ) + 1 ); i++ )
+ {
+ if ( nBitCount == -1 ) // bits left in nDat ?
+ {
+ *mpPSD >> nDat;
+ nDat ^= 0xff;
+ nBitCount = 7;
+ }
+ mpWriteAcc->SetPixel( nY, nX, (BYTE)nDat >> nBitCount-- );
+ if ( ++nX == mpFileHeader->nColumns )
+ {
+ nX = 0;
+ nY++;
+ nBitCount = -1;
+ if ( nY == mpFileHeader->nRows )
+ break;
+ }
+ }
+ }
+ }
+ }
+ break;
+
+ case 8 :
+ {
+ while ( nY < mpFileHeader->nRows )
+ {
+ if ( mbCompression ) // else nRunCount = 0 -> so we use only single raw packets
+ *mpPSD >> nRunCount;
+
+ if ( nRunCount & 0x80 ) // a run length packet
+ {
+ *mpPSD >> nDat;
+ if ( mpFileHeader->nDepth == 16 ) // 16 bit depth is to be skipped
+ *mpPSD >> nDummy;
+ for ( USHORT i = 0; i < ( -nRunCount + 1 ); i++ )
+ {
+ mpWriteAcc->SetPixel( nY, nX, (BYTE)nDat );
+ if ( ++nX == mpFileHeader->nColumns )
+ {
+ nX = 0;
+ nY++;
+ if ( nY == mpFileHeader->nRows )
+ break;
+ }
+ }
+ }
+ else // a raw packet
+ {
+ for ( USHORT i = 0; i < ( ( nRunCount & 0x7f ) + 1 ); i++ )
+ {
+ *mpPSD >> nDat;
+ if ( mpFileHeader->nDepth == 16 ) // 16 bit depth is to be skipped
+ *mpPSD >> nDummy;
+ mpWriteAcc->SetPixel( nY, nX, (BYTE)nDat );
+ if ( ++nX == mpFileHeader->nColumns )
+ {
+ nX = 0;
+ nY++;
+ if ( nY == mpFileHeader->nRows )
+ break;
+ }
+ }
+ }
+ }
+ }
+ break;
+
+ case 24 :
+ {
+
+ // the psd format is in plain order (RRRR GGGG BBBB) so we have to set each pixel three times
+ // maybe the format is CCCC MMMM YYYY KKKK
+
+ while ( nY < mpFileHeader->nRows )
+ {
+ if ( mbCompression ) // else nRunCount = 0 -> so we use only single raw packets
+ *mpPSD >> nRunCount;
+
+ if ( nRunCount & 0x80 ) // a run length packet
+ {
+ *mpPSD >> nRed;
+ if ( mpFileHeader->nDepth == 16 ) // 16 bit depth is to be skipped
+ *mpPSD >> nDummy;
+ for ( USHORT i = 0; i < ( -nRunCount + 1 ); i++ )
+ {
+ mpWriteAcc->SetPixel( nY, nX, BitmapColor( nRed, (BYTE)0, (BYTE)0 ) );
+ if ( ++nX == mpFileHeader->nColumns )
+ {
+ nX = 0;
+ nY++;
+ if ( nY == mpFileHeader->nRows )
+ break;
+ }
+ }
+ }
+ else // a raw packet
+ {
+ for ( USHORT i = 0; i < ( ( nRunCount & 0x7f ) + 1 ); i++ )
+ {
+ *mpPSD >> nRed;
+ if ( mpFileHeader->nDepth == 16 ) // 16 bit depth is to be skipped
+ *mpPSD >> nDummy;
+ mpWriteAcc->SetPixel( nY, nX, BitmapColor( nRed, (BYTE)0, (BYTE)0 ) );
+ if ( ++nX == mpFileHeader->nColumns )
+ {
+ nX = 0;
+ nY++;
+ if ( nY == mpFileHeader->nRows )
+ break;
+ }
+ }
+ }
+ }
+ nY = 0;
+ while ( nY < mpFileHeader->nRows )
+ {
+ if ( mbCompression )
+ *mpPSD >> nRunCount;
+ if ( nRunCount & 0x80 ) // a run length packet
+ {
+ *mpPSD >> nGreen;
+ if ( mpFileHeader->nDepth == 16 ) // 16 bit depth is to be skipped
+ *mpPSD >> nDummy;
+ for ( USHORT i = 0; i < ( -nRunCount + 1 ); i++ )
+ {
+ aBitmapColor = mpReadAcc->GetPixel( nY, nX );
+ mpWriteAcc->SetPixel( nY, nX, BitmapColor( aBitmapColor.GetRed(), nGreen, aBitmapColor.GetBlue() ) );
+ if ( ++nX == mpFileHeader->nColumns )
+ {
+ nX = 0;
+ nY++;
+ if ( nY == mpFileHeader->nRows )
+ break;
+ }
+ }
+ }
+ else // a raw packet
+ {
+ for ( USHORT i = 0; i < ( ( nRunCount & 0x7f ) + 1 ); i++ )
+ {
+ *mpPSD >> nGreen;
+ if ( mpFileHeader->nDepth == 16 ) // 16 bit depth is to be skipped
+ *mpPSD >> nDummy;
+ aBitmapColor = mpReadAcc->GetPixel( nY, nX );
+ mpWriteAcc->SetPixel( nY, nX, BitmapColor( aBitmapColor.GetRed(), nGreen, aBitmapColor.GetBlue() ) );
+ if ( ++nX == mpFileHeader->nColumns )
+ {
+ nX = 0;
+ nY++;
+ if ( nY == mpFileHeader->nRows )
+ break;
+ }
+ }
+ }
+ }
+ nY = 0;
+ while ( nY < mpFileHeader->nRows )
+ {
+ if ( mbCompression )
+ *mpPSD >> nRunCount;
+ if ( nRunCount & 0x80 ) // a run length packet
+ {
+ *mpPSD >> nBlue;
+ if ( mpFileHeader->nDepth == 16 ) // 16 bit depth is to be skipped
+ *mpPSD >> nDummy;
+ for ( USHORT i = 0; i < ( -nRunCount + 1 ); i++ )
+ {
+ aBitmapColor = mpReadAcc->GetPixel( nY, nX );
+ mpWriteAcc->SetPixel( nY, nX, BitmapColor( aBitmapColor.GetRed(), aBitmapColor.GetGreen(), nBlue ) );
+ if ( ++nX == mpFileHeader->nColumns )
+ {
+ nX = 0;
+ nY++;
+ if ( nY == mpFileHeader->nRows )
+ break;
+ }
+ }
+ }
+ else // a raw packet
+ {
+ for ( USHORT i = 0; i < ( ( nRunCount & 0x7f ) + 1 ); i++ )
+ {
+ *mpPSD >> nBlue;
+ if ( mpFileHeader->nDepth == 16 ) // 16 bit depth is to be skipped
+ *mpPSD >> nDummy;
+ aBitmapColor = mpReadAcc->GetPixel( nY, nX );
+ mpWriteAcc->SetPixel( nY, nX, BitmapColor( aBitmapColor.GetRed(), aBitmapColor.GetGreen(), nBlue ) );
+ if ( ++nX == mpFileHeader->nColumns )
+ {
+ nX = 0;
+ nY++;
+ if ( nY == mpFileHeader->nRows )
+ break;
+ }
+ }
+ }
+ }
+ if ( mpFileHeader->nMode == PSD_CMYK )
+ {
+ UINT32 nBlack, nBlackMax = 0;
+ BYTE* pBlack = new BYTE[ mpFileHeader->nRows * mpFileHeader->nColumns ];
+ nY = 0;
+ while ( nY < mpFileHeader->nRows )
+ {
+ if ( mbCompression ) // else nRunCount = 0 -> so we use only single raw packets
+ *mpPSD >> nRunCount;
+
+ if ( nRunCount & 0x80 ) // a run length packet
+ {
+ *mpPSD >> nDat;
+
+ if ( mpFileHeader->nDepth == 16 ) // 16 bit depth is to be skipped
+ *mpPSD >> nDummy;
+
+ for ( USHORT i = 0; i < ( -nRunCount + 1 ); i++ )
+ {
+ nBlack = (BYTE)mpReadAcc->GetPixel( nY, nX ).GetRed() + nDat;
+ if ( nBlack > nBlackMax )
+ nBlackMax = nBlack;
+ nBlack = (BYTE)mpReadAcc->GetPixel( nY, nX ).GetGreen() + nDat;
+ if ( nBlack > nBlackMax )
+ nBlackMax = nBlack;
+ nBlack = (BYTE)mpReadAcc->GetPixel( nY, nX ).GetBlue() + nDat;
+ if ( nBlack > nBlackMax )
+ nBlackMax = nBlack;
+ pBlack[ nX + nY * mpFileHeader->nColumns ] = nDat ^ 0xff;
+ if ( ++nX == mpFileHeader->nColumns )
+ {
+ nX = 0;
+ nY++;
+ if ( nY == mpFileHeader->nRows )
+ break;
+ }
+ }
+ }
+ else // a raw packet
+ {
+ for ( USHORT i = 0; i < ( ( nRunCount & 0x7f ) + 1 ); i++ )
+ {
+ *mpPSD >> nDat;
+
+ if ( mpFileHeader->nDepth == 16 ) // 16 bit depth is to be skipped
+ *mpPSD >> nDummy;
+ nBlack = (BYTE)mpReadAcc->GetPixel( nY, nX ).GetRed() + nDat;
+ if ( nBlack > nBlackMax )
+ nBlackMax = nBlack;
+ nBlack = (BYTE)mpReadAcc->GetPixel( nY, nX ).GetGreen() + nDat;
+ if ( nBlack > nBlackMax )
+ nBlackMax = nBlack;
+ nBlack = (BYTE)mpReadAcc->GetPixel( nY, nX ).GetBlue() + nDat;
+ if ( nBlack > nBlackMax )
+ nBlackMax = nBlack;
+ pBlack[ nX + nY * mpFileHeader->nColumns ] = nDat ^ 0xff;
+ if ( ++nX == mpFileHeader->nColumns )
+ {
+ nX = 0;
+ nY++;
+ if ( nY == mpFileHeader->nRows )
+ break;
+ }
+ }
+ }
+ }
+
+ for ( nY = 0; nY < mpFileHeader->nRows; nY++ )
+ {
+ for ( nX = 0; nX < mpFileHeader->nColumns; nX++ )
+ {
+ INT32 nDAT = pBlack[ nX + nY * mpFileHeader->nColumns ] * ( nBlackMax - 256 ) / 0x1ff;
+
+ aBitmapColor = mpReadAcc->GetPixel( nY, nX );
+ BYTE cR = (BYTE) MinMax( aBitmapColor.GetRed() - nDAT, 0L, 255L );
+ BYTE cG = (BYTE) MinMax( aBitmapColor.GetGreen() - nDAT, 0L, 255L );
+ BYTE cB = (BYTE) MinMax( aBitmapColor.GetBlue() - nDAT, 0L, 255L );
+ mpWriteAcc->SetPixel( nY, nX, BitmapColor( cR, cG, cB ) );
+ }
+ }
+ delete[] pBlack;
+ }
+ }
+ break;
+ }
+
+ if ( mbTransparent )
+ {
+ // the psd is 24 or 8 bit grafix + alphachannel
+
+ nY = nX = 0;
+ while ( nY < mpFileHeader->nRows )
+ {
+ if ( mbCompression ) // else nRunCount = 0 -> so we use only single raw packets
+ *mpPSD >> nRunCount;
+
+ if ( nRunCount & 0x80 ) // a run length packet
+ {
+ *mpPSD >> nDat;
+ if ( nDat )
+ nDat = 0;
+ else
+ nDat = 1;
+ if ( mpFileHeader->nDepth == 16 ) // 16 bit depth is to be skipped
+ *mpPSD >> nDummy;
+ for ( USHORT i = 0; i < ( -nRunCount + 1 ); i++ )
+ {
+ mpMaskWriteAcc->SetPixel( nY, nX, (BYTE)nDat );
+ if ( ++nX == mpFileHeader->nColumns )
+ {
+ nX = 0;
+ nY++;
+ if ( nY == mpFileHeader->nRows )
+ break;
+ }
+ }
+ }
+ else // a raw packet
+ {
+ for ( USHORT i = 0; i < ( ( nRunCount & 0x7f ) + 1 ); i++ )
+ {
+ *mpPSD >> nDat;
+ if ( nDat )
+ nDat = 0;
+ else
+ nDat = 1;
+ if ( mpFileHeader->nDepth == 16 ) // 16 bit depth is to be skipped
+ *mpPSD >> nDummy;
+ mpMaskWriteAcc->SetPixel( nY, nX, (BYTE)nDat );
+ if ( ++nX == mpFileHeader->nColumns )
+ {
+ nX = 0;
+ nY++;
+ if ( nY == mpFileHeader->nRows )
+ break;
+ }
+ }
+ }
+ }
+ }
+ return TRUE;
+}
+
+//================== GraphicImport - die exportierte Funktion ================
+
+extern "C" BOOL __LOADONCALLAPI GraphicImport(SvStream & rStream, Graphic & rGraphic, FilterConfigItem*, BOOL )
+{
+ PSDReader aPSDReader;
+
+ return aPSDReader.ReadPSD( rStream, rGraphic );
+}
+
+//================== ein bischen Muell fuer Windows ==========================
+#ifndef GCC
+#endif
+
+#ifdef WIN
+
+static HINSTANCE hDLLInst = 0; // HANDLE der DLL
+
+extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR )
+{
+#ifndef WNT
+ if ( nHeap )
+ UnlockData( 0 );
+#endif
+
+ hDLLInst = hDLL;
+
+ return TRUE;
+}
+
+extern "C" int CALLBACK WEP( int )
+{
+ return 1;
+}
+
+#endif
diff --git a/filter/source/graphicfilter/ipsd/makefile.mk b/filter/source/graphicfilter/ipsd/makefile.mk
new file mode 100644
index 000000000000..8974563b3791
--- /dev/null
+++ b/filter/source/graphicfilter/ipsd/makefile.mk
@@ -0,0 +1,67 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=filter
+TARGET=ipsd
+DEPTARGET=vipsd
+
+# --- Settings -----------------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Allgemein ----------------------------------------------------------
+
+.IF "$(editdebug)"!="" || "$(EDITDEBUG)"!=""
+CDEFS+= -DEDITDEBUG
+.ENDIF
+.IF "$(L10N_framework)"==""
+SLOFILES = $(SLO)$/ipsd.obj
+
+# ==========================================================================
+
+SHL1TARGET= ipd$(DLLPOSTFIX)
+SHL1IMPLIB= ipsd
+SHL1STDLIBS= $(VCLLIB) $(TOOLSLIB) $(SALLIB)
+SHL1LIBS= $(SLB)$/ipsd.lib
+
+.IF "$(GUI)" != "UNX"
+.IF "$(COM)" != "GCC"
+SHL1OBJS= $(SLO)$/ipsd.obj
+.ENDIF
+.ENDIF
+
+SHL1VERSIONMAP=exports.map
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+
+DEF1NAME=$(SHL1TARGET)
+.ENDIF
+
+# ==========================================================================
+
+.INCLUDE : target.mk
diff --git a/filter/source/graphicfilter/iras/exports.map b/filter/source/graphicfilter/iras/exports.map
new file mode 100644
index 000000000000..941e4ab9bde8
--- /dev/null
+++ b/filter/source/graphicfilter/iras/exports.map
@@ -0,0 +1,7 @@
+UDK_3_0_0 {
+ global:
+ GraphicImport;
+
+ local:
+ *;
+};
diff --git a/filter/source/graphicfilter/iras/iras.cxx b/filter/source/graphicfilter/iras/iras.cxx
new file mode 100644
index 000000000000..6255dc486537
--- /dev/null
+++ b/filter/source/graphicfilter/iras/iras.cxx
@@ -0,0 +1,383 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include <vcl/graph.hxx>
+#include <vcl/bmpacc.hxx>
+#include <svtools/fltcall.hxx>
+
+#define RAS_TYPE_OLD 0x00000000 // supported formats by this filter
+#define RAS_TYPE_STANDARD 0x00000001
+#define RAS_TYPE_BYTE_ENCODED 0x00000002
+#define RAS_TYPE_RGB_FORMAT 0x00000003
+
+#define RAS_COLOR_NO_MAP 0x00000000
+#define RAS_COLOR_RGB_MAP 0x00000001
+#define RAS_COLOR_RAW_MAP 0x00000002
+
+#define SUNRASTER_MAGICNUMBER 0x59a66a95
+
+//============================ RASReader ==================================
+
+class RASReader {
+
+private:
+
+ SvStream* mpRAS; // Die einzulesende RAS-Datei
+
+ BOOL mbStatus;
+ Bitmap maBmp;
+ BitmapWriteAccess* mpAcc;
+ sal_uInt32 mnWidth, mnHeight; // Bildausmass in Pixeln
+ USHORT mnDstBitsPerPix;
+ USHORT mnDstColors;
+ sal_uInt32 mnDepth, mnImageDatSize, mnType;
+ sal_uInt32 mnColorMapType, mnColorMapSize;
+ BYTE mnRepCount, mnRepVal; // RLE Decoding
+ BOOL mbPalette;
+
+ BOOL ImplReadBody();
+ BOOL ImplReadHeader();
+ BYTE ImplGetByte();
+
+public:
+ RASReader();
+ ~RASReader();
+ BOOL ReadRAS( SvStream & rRAS, Graphic & rGraphic );
+};
+
+//=================== Methoden von RASReader ==============================
+
+RASReader::RASReader() :
+ mbStatus ( TRUE ),
+ mpAcc ( NULL ),
+ mnRepCount ( 0 ),
+ mbPalette ( FALSE )
+{
+}
+
+RASReader::~RASReader()
+{
+}
+
+//----------------------------------------------------------------------------
+
+BOOL RASReader::ReadRAS( SvStream & rRAS, Graphic & rGraphic )
+{
+ UINT32 nMagicNumber;
+
+ if ( rRAS.GetError() )
+ return FALSE;
+
+ mpRAS = &rRAS;
+ mpRAS->SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN );
+ *mpRAS >> nMagicNumber;
+ if ( nMagicNumber != SUNRASTER_MAGICNUMBER )
+ return FALSE;
+
+ // Kopf einlesen:
+
+ if ( ( mbStatus = ImplReadHeader() ) == FALSE )
+ return FALSE;
+
+ maBmp = Bitmap( Size( mnWidth, mnHeight ), mnDstBitsPerPix );
+ if ( ( mpAcc = maBmp.AcquireWriteAccess() ) == FALSE )
+ return FALSE;
+
+ if ( mnDstBitsPerPix <= 8 ) // paletten bildchen
+ {
+ if ( mnColorMapType == RAS_COLOR_RAW_MAP ) // RAW Colormap wird geskipped
+ {
+ ULONG nCurPos = mpRAS->Tell();
+ mpRAS->Seek( nCurPos + mnColorMapSize );
+ }
+ else if ( mnColorMapType == RAS_COLOR_RGB_MAP ) // RGB koennen wir auslesen
+ {
+ mnDstColors = (USHORT)( mnColorMapSize / 3 );
+
+ if ( ( 1 << mnDstBitsPerPix ) < mnDstColors )
+ return FALSE;
+
+ if ( ( mnDstColors >= 2 ) && ( ( mnColorMapSize % 3 ) == 0 ) )
+ {
+ mpAcc->SetPaletteEntryCount( mnDstColors );
+ USHORT i;
+ BYTE nRed[256], nGreen[256], nBlue[256];
+ for ( i = 0; i < mnDstColors; i++ ) *mpRAS >> nRed[ i ];
+ for ( i = 0; i < mnDstColors; i++ ) *mpRAS >> nGreen[ i ];
+ for ( i = 0; i < mnDstColors; i++ ) *mpRAS >> nBlue[ i ];
+ for ( i = 0; i < mnDstColors; i++ )
+ {
+ mpAcc->SetPaletteColor( i, BitmapColor( nRed[ i ], nGreen[ i ], nBlue[ i ] ) );
+ }
+ mbPalette = TRUE;
+ }
+ else
+ return FALSE;
+
+ }
+ else if ( mnColorMapType != RAS_COLOR_NO_MAP ) // alles andere ist kein standard
+ return FALSE;
+
+ if ( !mbPalette )
+ {
+ mnDstColors = 1 << mnDstBitsPerPix;
+ mpAcc->SetPaletteEntryCount( mnDstColors );
+ for ( USHORT i = 0; i < mnDstColors; i++ )
+ {
+ ULONG nCount = 255 - ( 255 * i / ( mnDstColors - 1 ) );
+ mpAcc->SetPaletteColor( i, BitmapColor( (BYTE)nCount, (BYTE)nCount, (BYTE)nCount ) );
+ }
+ }
+ }
+ else
+ {
+ if ( mnColorMapType != RAS_COLOR_NO_MAP ) // when graphic has more then 256 colors and a color map we skip
+ { // the colormap
+ ULONG nCurPos = mpRAS->Tell();
+ mpRAS->Seek( nCurPos + mnColorMapSize );
+ }
+ }
+
+ // Bitmap-Daten einlesen
+ mbStatus = ImplReadBody();
+
+ if ( mpAcc )
+ {
+ maBmp.ReleaseAccess( mpAcc ), mpAcc = NULL;
+ }
+ if ( mbStatus )
+ rGraphic = maBmp;
+
+ return mbStatus;
+}
+
+//----------------------------------------------------------------------------
+
+BOOL RASReader::ImplReadHeader()
+{
+ *mpRAS >> mnWidth >> mnHeight >> mnDepth >> mnImageDatSize >>
+ mnType >> mnColorMapType >> mnColorMapSize;
+
+ if ( mnWidth == 0 || mnHeight == 0 )
+ mbStatus = FALSE;
+
+ switch ( mnDepth )
+ {
+ case 24 :
+ case 8 :
+ case 1 :
+ mnDstBitsPerPix = (USHORT)mnDepth;
+ break;
+ case 32 :
+ mnDstBitsPerPix = 24;
+ break;
+
+ default :
+ mbStatus = FALSE;
+ }
+
+ switch ( mnType )
+ {
+ case RAS_TYPE_OLD :
+ case RAS_TYPE_STANDARD :
+ case RAS_TYPE_RGB_FORMAT :
+ case RAS_TYPE_BYTE_ENCODED : // this type will be supported later
+ break;
+
+ default:
+ mbStatus = FALSE;
+ }
+ return mbStatus;
+}
+
+//----------------------------------------------------------------------------
+
+BOOL RASReader::ImplReadBody()
+{
+ ULONG x, y;
+ BYTE nDat = 0;
+ BYTE nRed, nGreen, nBlue;
+ switch ( mnDstBitsPerPix )
+ {
+ case 1 :
+ for ( y = 0; y < mnHeight; y++ )
+ {
+ for ( x = 0; x < mnWidth; x++ )
+ {
+ if (!(x & 7))
+ nDat = ImplGetByte();
+ mpAcc->SetPixel (
+ y, x,
+ sal::static_int_cast< BYTE >(
+ nDat >> ( ( x & 7 ) ^ 7 )) );
+ }
+ if (!( ( x - 1 ) & 0x8 ) ) ImplGetByte(); // WORD ALIGNMENT ???
+ }
+ break;
+
+ case 8 :
+ for ( y = 0; y < mnHeight; y++ )
+ {
+ for ( x = 0; x < mnWidth; x++ )
+ {
+ nDat = ImplGetByte();
+ mpAcc->SetPixel ( y, x, nDat );
+ }
+ if ( x & 1 ) ImplGetByte(); // WORD ALIGNMENT ???
+ }
+ break;
+
+ case 24 :
+ switch ( mnDepth )
+ {
+
+ case 24 :
+ for ( y = 0; y < mnHeight; y++ )
+ {
+ for ( x = 0; x < mnWidth; x++ )
+ {
+ if ( mnType == RAS_TYPE_RGB_FORMAT )
+ {
+ nRed = ImplGetByte();
+ nGreen = ImplGetByte();
+ nBlue = ImplGetByte();
+ }
+ else
+ {
+ nBlue = ImplGetByte();
+ nGreen = ImplGetByte();
+ nRed = ImplGetByte();
+ }
+ mpAcc->SetPixel ( y, x, BitmapColor( nRed, nGreen, nBlue ) );
+ }
+ if ( x & 1 ) ImplGetByte(); // WORD ALIGNMENT ???
+ }
+ break;
+
+ case 32 :
+ for ( y = 0; y < mnHeight; y++ )
+ {
+ for ( x = 0; x < mnWidth; x++ )
+ {
+ nDat = ImplGetByte(); // pad byte > nil
+ if ( mnType == RAS_TYPE_RGB_FORMAT )
+ {
+ nRed = ImplGetByte();
+ nGreen = ImplGetByte();
+ nBlue = ImplGetByte();
+ }
+ else
+ {
+ nBlue = ImplGetByte();
+ nGreen = ImplGetByte();
+ nRed = ImplGetByte();
+ }
+ mpAcc->SetPixel ( y, x, BitmapColor( nRed, nGreen, nBlue ) );
+ }
+ }
+ break;
+ }
+ break;
+
+ default:
+ mbStatus = FALSE;
+ break;
+ }
+ return mbStatus;
+}
+
+//----------------------------------------------------------------------------
+
+BYTE RASReader::ImplGetByte()
+{
+ BYTE nRetVal;
+ if ( mnType != RAS_TYPE_BYTE_ENCODED )
+ {
+ *mpRAS >> nRetVal;
+ return nRetVal;
+ }
+ else
+ {
+ if ( mnRepCount )
+ {
+ mnRepCount--;
+ return mnRepVal;
+ }
+ else
+ {
+ *mpRAS >> nRetVal;
+ if ( nRetVal != 0x80 )
+ return nRetVal;
+ *mpRAS >> nRetVal;
+ if ( nRetVal == 0 )
+ return 0x80;
+ mnRepCount = nRetVal ;
+ *mpRAS >> mnRepVal;
+ return mnRepVal;
+ }
+ }
+}
+
+//================== GraphicImport - die exportierte Funktion ================
+
+extern "C" BOOL __LOADONCALLAPI GraphicImport(SvStream & rStream, Graphic & rGraphic, FilterConfigItem*, BOOL )
+{
+ RASReader aRASReader;
+
+ return aRASReader.ReadRAS( rStream, rGraphic );
+}
+
+//================== ein bischen Muell fuer Windows ==========================
+#ifndef GCC
+#endif
+
+#ifdef WIN
+
+static HINSTANCE hDLLInst = 0; // HANDLE der DLL
+
+extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR )
+{
+#ifndef WNT
+ if ( nHeap )
+ UnlockData( 0 );
+#endif
+
+ hDLLInst = hDLL;
+
+ return TRUE;
+}
+
+extern "C" int CALLBACK WEP( int )
+{
+ return 1;
+}
+
+#endif
+
diff --git a/filter/source/graphicfilter/iras/makefile.mk b/filter/source/graphicfilter/iras/makefile.mk
new file mode 100644
index 000000000000..9585a35f50b8
--- /dev/null
+++ b/filter/source/graphicfilter/iras/makefile.mk
@@ -0,0 +1,67 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=filter
+TARGET=iras
+DEPTARGET=viras
+
+# --- Settings -----------------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Allgemein ----------------------------------------------------------
+
+.IF "$(editdebug)"!="" || "$(EDITDEBUG)"!=""
+CDEFS+= -DEDITDEBUG
+.ENDIF
+.IF "$(L10N_framework)"==""
+SLOFILES = $(SLO)$/iras.obj
+
+# ==========================================================================
+
+SHL1TARGET= ira$(DLLPOSTFIX)
+SHL1IMPLIB= iras
+SHL1STDLIBS= $(VCLLIB) $(TOOLSLIB) $(SALLIB)
+SHL1LIBS= $(SLB)$/iras.lib
+
+.IF "$(GUI)" != "UNX"
+.IF "$(COM)" != "GCC"
+SHL1OBJS= $(SLO)$/iras.obj
+.ENDIF
+.ENDIF
+
+SHL1VERSIONMAP=exports.map
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+
+DEF1NAME=$(SHL1TARGET)
+.ENDIF
+
+# ==========================================================================
+
+.INCLUDE : target.mk
diff --git a/filter/source/graphicfilter/itga/exports.map b/filter/source/graphicfilter/itga/exports.map
new file mode 100644
index 000000000000..941e4ab9bde8
--- /dev/null
+++ b/filter/source/graphicfilter/itga/exports.map
@@ -0,0 +1,7 @@
+UDK_3_0_0 {
+ global:
+ GraphicImport;
+
+ local:
+ *;
+};
diff --git a/filter/source/graphicfilter/itga/itga.cxx b/filter/source/graphicfilter/itga/itga.cxx
new file mode 100644
index 000000000000..5dcb5f82ccab
--- /dev/null
+++ b/filter/source/graphicfilter/itga/itga.cxx
@@ -0,0 +1,758 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include <vcl/graph.hxx>
+#include <vcl/bmpacc.hxx>
+#include <svtools/fltcall.hxx>
+
+//============================ TGAReader ==================================
+
+struct TGAFileHeader
+{
+ BYTE nImageIDLength;
+ BYTE nColorMapType;
+ BYTE nImageType;
+ UINT16 nColorMapFirstEntryIndex;
+ UINT16 nColorMapLength;
+ BYTE nColorMapEntrySize;
+ UINT16 nColorMapXOrigin;
+ UINT16 nColorMapYOrigin;
+ UINT16 nImageWidth;
+ UINT16 nImageHeight;
+ BYTE nPixelDepth;
+ BYTE nImageDescriptor;
+};
+
+#define SizeOfTGAFileFooter 26
+
+struct TGAFileFooter
+{
+ UINT32 nExtensionFileOffset;
+ UINT32 nDeveloperDirectoryOffset;
+ UINT32 nSignature[4];
+ BYTE nPadByte;
+ BYTE nStringTerminator;
+};
+
+#define SizeOfTGAExtension 495
+
+struct TGAExtension
+{
+ UINT16 nExtensionSize;
+ char sAuthorName[41];
+ char sAuthorComment[324];
+ char sDateTimeStamp[12];
+ char sJobNameID[41];
+ UINT16 nJobTime[3];
+ char sSoftwareID[41];
+ UINT16 nSoftwareVersionNumber;
+ BYTE nSoftwareVersionLetter;
+ UINT32 nKeyColor;
+ UINT16 nPixelAspectRatioNumerator;
+ UINT16 nPixelAspectRatioDeNumerator;
+ UINT16 nGammaValueNumerator;
+ UINT16 nGammaValueDeNumerator;
+ UINT32 nColorCorrectionOffset;
+ UINT32 nPostageStampOffset;
+ UINT32 nScanLineOffset;
+ BYTE nAttributesType;
+};
+
+class TGAReader {
+
+private:
+
+ SvStream* mpTGA;
+
+ BitmapWriteAccess* mpAcc;
+ TGAFileHeader* mpFileHeader;
+ TGAFileFooter* mpFileFooter;
+ TGAExtension* mpExtension;
+ UINT32* mpColorMap;
+
+ BOOL mbStatus;
+
+ ULONG mnTGAVersion; // Enhanced TGA is defined as Version 2.0
+ UINT16 mnDestBitDepth;
+ BOOL mbIndexing; // TRUE if source contains indexing color values
+ BOOL mbEncoding; // TRUE if source is compressed
+
+ BOOL ImplReadHeader();
+ BOOL ImplReadPalette();
+ BOOL ImplReadBody();
+
+public:
+ TGAReader();
+ ~TGAReader();
+ BOOL ReadTGA( SvStream & rTGA, Graphic & rGraphic );
+};
+
+//=================== Methoden von TGAReader ==============================
+
+TGAReader::TGAReader() :
+ mpAcc ( NULL ),
+ mpFileHeader ( NULL ),
+ mpFileFooter ( NULL ),
+ mpExtension ( NULL ),
+ mpColorMap ( NULL ),
+ mbStatus ( TRUE ),
+ mnTGAVersion ( 1 ),
+ mbIndexing ( FALSE ),
+ mbEncoding ( FALSE )
+{
+}
+
+TGAReader::~TGAReader()
+{
+ delete[] mpColorMap;
+ delete mpFileHeader;
+ delete mpExtension;
+ delete mpFileFooter;
+}
+
+// -------------------------------------------------------------------------------------------
+
+BOOL TGAReader::ReadTGA( SvStream & rTGA, Graphic & rGraphic )
+{
+ if ( rTGA.GetError() )
+ return FALSE;
+
+ mpTGA = &rTGA;
+ mpTGA->SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
+
+ // Kopf einlesen:
+
+ if ( !mpTGA->GetError() )
+ {
+ mbStatus = ImplReadHeader();
+ if ( mbStatus )
+ {
+ Bitmap aBitmap;
+
+ aBitmap = Bitmap( Size( mpFileHeader->nImageWidth, mpFileHeader->nImageHeight ), mnDestBitDepth );
+ mpAcc = aBitmap.AcquireWriteAccess();
+ if ( mpAcc )
+ {
+ if ( mbIndexing )
+ mbStatus = ImplReadPalette();
+ if ( mbStatus )
+ mbStatus = ImplReadBody();
+ }
+ else
+ mbStatus = FALSE;
+
+ if ( mpAcc )
+ aBitmap.ReleaseAccess ( mpAcc), mpAcc = NULL;
+
+ if ( mbStatus )
+ rGraphic = aBitmap;
+ }
+ }
+ return mbStatus;
+}
+
+// -------------------------------------------------------------------------------------------
+
+BOOL TGAReader::ImplReadHeader()
+{
+ mpFileHeader = new TGAFileHeader;
+ if ( mpFileHeader == NULL )
+ return FALSE;
+
+ *mpTGA >> mpFileHeader->nImageIDLength >> mpFileHeader->nColorMapType >> mpFileHeader->nImageType >>
+ mpFileHeader->nColorMapFirstEntryIndex >> mpFileHeader->nColorMapLength >> mpFileHeader->nColorMapEntrySize >>
+ mpFileHeader->nColorMapXOrigin >> mpFileHeader->nColorMapYOrigin >> mpFileHeader->nImageWidth >>
+ mpFileHeader->nImageHeight >> mpFileHeader->nPixelDepth >> mpFileHeader->nImageDescriptor;
+
+ if ( mpFileHeader->nColorMapType > 1 )
+ return FALSE;
+ if ( mpFileHeader->nColorMapType == 1 )
+ mbIndexing = TRUE;
+
+ // first we want to get the version
+ mpFileFooter = new TGAFileFooter; // read the TGA-File-Footer to determine whether
+ if ( mpFileFooter ) // we got an old TGA format or the new one
+ {
+ ULONG nCurStreamPos = mpTGA->Tell();
+ mpTGA->Seek( STREAM_SEEK_TO_END );
+ ULONG nTemp = mpTGA->Tell();
+ mpTGA->Seek( nTemp - SizeOfTGAFileFooter );
+
+ *mpTGA >> mpFileFooter->nExtensionFileOffset >> mpFileFooter->nDeveloperDirectoryOffset >>
+ mpFileFooter->nSignature[0] >> mpFileFooter->nSignature[1] >> mpFileFooter->nSignature[2] >>
+ mpFileFooter->nSignature[3] >> mpFileFooter->nPadByte >> mpFileFooter->nStringTerminator;
+
+ // check for TRUE, VISI, ON-X, FILE in the signatures
+ if ( mpFileFooter->nSignature[ 0 ] == (('T'<<24)|('R'<<16)|('U'<<8)|'E') &&
+ mpFileFooter->nSignature[ 1 ] == (('V'<<24)|('I'<<16)|('S'<<8)|'I') &&
+ mpFileFooter->nSignature[ 2 ] == (('O'<<24)|('N'<<16)|('-'<<8)|'X') &&
+ mpFileFooter->nSignature[ 3 ] == (('F'<<24)|('I'<<16)|('L'<<8)|'E') )
+ {
+ mpExtension = new TGAExtension;
+ if ( mpExtension )
+ {
+ mpTGA->Seek( mpFileFooter->nExtensionFileOffset );
+ *mpTGA >> mpExtension->nExtensionSize;
+ if ( mpExtension->nExtensionSize >= SizeOfTGAExtension )
+ {
+ mnTGAVersion = 2;
+
+ mpTGA->Read( mpExtension->sAuthorName, 41 );
+ mpTGA->Read( mpExtension->sAuthorComment, 324 );
+ mpTGA->Read( mpExtension->sDateTimeStamp, 12 );
+ mpTGA->Read( mpExtension->sJobNameID, 12 );
+ *mpTGA >> mpExtension->sJobNameID[ 0 ] >> mpExtension->sJobNameID[ 1 ] >> mpExtension->sJobNameID[ 2 ];
+ mpTGA->Read( mpExtension->sSoftwareID, 41 );
+ *mpTGA >> mpExtension->nSoftwareVersionNumber >> mpExtension->nSoftwareVersionLetter
+ >> mpExtension->nKeyColor >> mpExtension->nPixelAspectRatioNumerator
+ >> mpExtension->nPixelAspectRatioDeNumerator >> mpExtension->nGammaValueNumerator
+ >> mpExtension->nGammaValueDeNumerator >> mpExtension->nColorCorrectionOffset
+ >> mpExtension->nPostageStampOffset >> mpExtension->nScanLineOffset
+ >> mpExtension->nAttributesType;
+
+ }
+ }
+ }
+ mpTGA->Seek( nCurStreamPos );
+ }
+
+ // using the TGA file specification this was the correct form but adobe photoshop sets nImageDescriptor
+ // equal to nPixelDepth
+ // mnDestBitDepth = mpFileHeader->nPixelDepth - ( mpFileHeader->nImageDescriptor & 0xf );
+ mnDestBitDepth = mpFileHeader->nPixelDepth;
+
+ if ( mnDestBitDepth == 8 ) // this is a patch for grayscale pictures not including a palette
+ mbIndexing = TRUE;
+
+ if ( mnDestBitDepth > 32 ) // maybe the pixeldepth is invalid
+ return FALSE;
+ else if ( mnDestBitDepth > 8 )
+ mnDestBitDepth = 24;
+ else if ( mnDestBitDepth > 4 )
+ mnDestBitDepth = 8;
+ else if ( mnDestBitDepth > 2 )
+ mnDestBitDepth = 4;
+
+ if ( !mbIndexing && ( mnDestBitDepth < 15 ) )
+ return FALSE;
+
+ switch ( mpFileHeader->nImageType )
+ {
+ case 9 : // encoding for colortype 9, 10, 11
+ case 10 :
+ case 11 :
+ mbEncoding = TRUE;
+ break;
+ };
+
+ if ( mpFileHeader->nImageIDLength ) // skip the Image ID
+ mpTGA->SeekRel( mpFileHeader->nImageIDLength );
+
+ return mbStatus;
+}
+
+// -------------------------------------------------------------------------------------------
+
+BOOL TGAReader::ImplReadBody()
+{
+
+ USHORT nXCount, nYCount, nRGB16;
+ BYTE nRed, nGreen, nBlue, nRunCount, nDummy, nDepth;
+
+ // this four variables match the image direction
+ long nY, nYAdd, nX, nXAdd, nXStart;
+
+ nX = nXStart = nY = 0;
+ nXCount = nYCount = 0;
+ nYAdd = nXAdd = 1;
+
+ if ( mpFileHeader->nImageDescriptor & 0x10 )
+ {
+ nX = nXStart = mpFileHeader->nImageWidth - 1;
+ nXAdd -= 2;
+ }
+
+ if ( !(mpFileHeader->nImageDescriptor & 0x20 ) )
+ {
+ nY = mpFileHeader->nImageHeight - 1;
+ nYAdd -=2;
+ }
+
+// nDepth = mpFileHeader->nPixelDepth - ( mpFileHeader->nImageDescriptor & 0xf );
+ nDepth = mpFileHeader->nPixelDepth;
+
+ if ( mbEncoding )
+ {
+ if ( mbIndexing )
+ {
+ switch( nDepth )
+ {
+ // 16 bit encoding + indexing
+ case 16 :
+ while ( nYCount < mpFileHeader->nImageHeight )
+ {
+ *mpTGA >> nRunCount;
+ if ( nRunCount & 0x80 ) // a run length packet
+ {
+ *mpTGA >> nRGB16;
+ if ( nRGB16 >= mpFileHeader->nColorMapLength )
+ return FALSE;
+ nRed = (BYTE)( mpColorMap[ nRGB16 ] >> 16 );
+ nGreen = (BYTE)( mpColorMap[ nRGB16 ] >> 8 );
+ nBlue = (BYTE)( mpColorMap[ nRGB16 ] );
+ for ( USHORT i = 0; i < ( ( nRunCount & 0x7f ) + 1 ); i++ )
+ {
+ mpAcc->SetPixel( nY, nX, BitmapColor( nRed, nGreen, nBlue ) );
+ nX += nXAdd;
+ nXCount++;
+ if ( nXCount == mpFileHeader->nImageWidth )
+ {
+ nX = nXStart;
+ nXCount = 0;
+ nY += nYAdd;
+ nYCount++;
+ }
+ }
+ }
+ else // a raw packet
+ {
+ for ( USHORT i = 0; i < ( ( nRunCount & 0x7f ) + 1 ); i++ )
+ {
+ *mpTGA >> nRGB16;
+ if ( nRGB16 >= mpFileHeader->nColorMapLength )
+ return FALSE;
+ nRed = (BYTE)( mpColorMap[ nRGB16 ] >> 16 );
+ nGreen = (BYTE)( mpColorMap[ nRGB16 ] >> 8 );
+ nBlue = (BYTE)( mpColorMap[ nRGB16 ] );
+ mpAcc->SetPixel( nY, nX, BitmapColor( nRed, nGreen, nBlue ) );
+ nX += nXAdd;
+ nXCount++;
+ if ( nXCount == mpFileHeader->nImageWidth )
+ {
+ nX = nXStart;
+ nXCount = 0;
+ nY += nYAdd;
+ nYCount++;
+ }
+ }
+ }
+ }
+ break;
+
+ // 8 bit encoding + indexing
+ case 8 :
+ while ( nYCount < mpFileHeader->nImageHeight )
+ {
+ *mpTGA >> nRunCount;
+ if ( nRunCount & 0x80 ) // a run length packet
+ {
+ *mpTGA >> nDummy;
+ if ( nDummy >= mpFileHeader->nColorMapLength )
+ return FALSE;
+ for ( USHORT i = 0; i < ( ( nRunCount & 0x7f ) + 1 ); i++ )
+ {
+ mpAcc->SetPixel( nY, nX, (BYTE)nDummy );
+ nX += nXAdd;
+ nXCount++;
+ if ( nXCount == mpFileHeader->nImageWidth )
+ {
+ nX = nXStart;
+ nXCount = 0;
+ nY += nYAdd;
+ nYCount++;
+ }
+ }
+ }
+ else // a raw packet
+ {
+ for ( USHORT i = 0; i < ( ( nRunCount & 0x7f ) + 1 ); i++ )
+ {
+
+ *mpTGA >> nDummy;
+ if ( nDummy >= mpFileHeader->nColorMapLength )
+ return FALSE;
+ mpAcc->SetPixel( nY, nX, (BYTE)nDummy );
+ nX += nXAdd;
+ nXCount++;
+ if ( nXCount == mpFileHeader->nImageWidth )
+ {
+ nX = nXStart;
+ nXCount = 0;
+ nY += nYAdd;
+ nYCount++;
+ }
+ }
+ }
+ }
+ break;
+ default:
+ return FALSE;
+ }
+ }
+ else
+ {
+ switch( nDepth )
+ {
+ // 32 bit transparent true color encoding
+ case 32 :
+ {
+ while ( nYCount < mpFileHeader->nImageHeight )
+ {
+ *mpTGA >> nRunCount;
+ if ( nRunCount & 0x80 ) // a run length packet
+ {
+ *mpTGA >> nBlue >> nGreen >> nRed >> nDummy;
+ for ( USHORT i = 0; i < ( ( nRunCount & 0x7f ) + 1 ); i++ )
+ {
+ mpAcc->SetPixel( nY, nX, BitmapColor( nRed, nGreen, nBlue ) );
+ nX += nXAdd;
+ nXCount++;
+ if ( nXCount == mpFileHeader->nImageWidth )
+ {
+ nX = nXStart;
+ nXCount = 0;
+ nY += nYAdd;
+ nYCount++;
+ }
+ }
+ }
+ else // a raw packet
+ {
+ for ( USHORT i = 0; i < ( ( nRunCount & 0x7f ) + 1 ); i++ )
+ {
+ *mpTGA >> nBlue >> nGreen >> nRed >> nDummy;
+ mpAcc->SetPixel( nY, nX, BitmapColor( nRed, nGreen, nBlue ) );
+ nX += nXAdd;
+ nXCount++;
+ if ( nXCount == mpFileHeader->nImageWidth )
+ {
+ nX = nXStart;
+ nXCount = 0;
+ nY += nYAdd;
+ nYCount++;
+ }
+ }
+ }
+ }
+ }
+ break;
+
+ // 24 bit true color encoding
+ case 24 :
+ while ( nYCount < mpFileHeader->nImageHeight )
+ {
+ *mpTGA >> nRunCount;
+ if ( nRunCount & 0x80 ) // a run length packet
+ {
+ *mpTGA >> nBlue >> nGreen >> nRed;
+ for ( USHORT i = 0; i < ( ( nRunCount & 0x7f ) + 1 ); i++ )
+ {
+ mpAcc->SetPixel( nY, nX, BitmapColor( nRed, nGreen, nBlue ) );
+ nX += nXAdd;
+ nXCount++;
+ if ( nXCount == mpFileHeader->nImageWidth )
+ {
+ nX = nXStart;
+ nXCount = 0;
+ nY += nYAdd;
+ nYCount++;
+ }
+ }
+ }
+ else // a raw packet
+ {
+ for ( USHORT i = 0; i < ( ( nRunCount & 0x7f ) + 1 ); i++ )
+ {
+ *mpTGA >> nBlue >> nGreen >> nRed;
+ mpAcc->SetPixel( nY, nX, BitmapColor( nRed, nGreen, nBlue ) );
+ nX += nXAdd;
+ nXCount++;
+ if ( nXCount == mpFileHeader->nImageWidth )
+ {
+ nX = nXStart;
+ nXCount = 0;
+ nY += nYAdd;
+ nYCount++;
+ }
+ }
+ }
+ }
+ break;
+
+ // 16 bit true color encoding
+ case 16 :
+ while ( nYCount < mpFileHeader->nImageHeight )
+ {
+ *mpTGA >> nRunCount;
+ if ( nRunCount & 0x80 ) // a run length packet
+ {
+ *mpTGA >> nRGB16;
+ nRed = (BYTE)( nRGB16 >> 7 ) & 0xf8;
+ nGreen = (BYTE)( nRGB16 >> 2 ) & 0xf8;
+ nBlue = (BYTE)( nRGB16 << 3 ) & 0xf8;
+ for ( USHORT i = 0; i < ( ( nRunCount & 0x7f ) + 1 ); i++ )
+ {
+ mpAcc->SetPixel( nY, nX, BitmapColor( nRed, nGreen, nBlue ) );
+ nX += nXAdd;
+ nXCount++;
+ if ( nXCount == mpFileHeader->nImageWidth )
+ {
+ nX = nXStart;
+ nXCount = 0;
+ nY += nYAdd;
+ nYCount++;
+ }
+ }
+ }
+ else // a raw packet
+ {
+ for ( USHORT i = 0; i < ( ( nRunCount & 0x7f ) + 1 ); i++ )
+ {
+ *mpTGA >> nRGB16;
+ nRed = (BYTE)( nRGB16 >> 7 ) & 0xf8;
+ nGreen = (BYTE)( nRGB16 >> 2 ) & 0xf8;
+ nBlue = (BYTE)( nRGB16 << 3 ) & 0xf8;
+ mpAcc->SetPixel( nY, nX, BitmapColor( nRed, nGreen, nBlue ) );
+ nX += nXAdd;
+ nXCount++;
+ if ( nXCount == mpFileHeader->nImageWidth )
+ {
+ nX = nXStart;
+ nXCount = 0;
+ nY += nYAdd;
+ nYCount++;
+ }
+ }
+ }
+ }
+ break;
+
+ default:
+ return FALSE;
+ }
+ }
+ }
+ else
+ {
+ for ( nYCount = 0; nYCount < mpFileHeader->nImageHeight; nYCount++, nY += nYAdd )
+ {
+ nX = nXStart;
+ nXCount = 0;
+
+ if ( mbIndexing )
+ {
+ switch( nDepth )
+ {
+ // 16 bit indexing
+ case 16 :
+ for (;nXCount < mpFileHeader->nImageWidth; nXCount++, nX += nXAdd )
+ {
+ *mpTGA >> nRGB16;
+ if ( nRGB16 >= mpFileHeader->nColorMapLength )
+ return FALSE;
+ nRed = (BYTE)( mpColorMap[ nRGB16 ] >> 16 );
+ nGreen = (BYTE)( mpColorMap[ nRGB16 ] >> 8 );
+ nBlue = (BYTE)( mpColorMap[ nRGB16 ] );
+ mpAcc->SetPixel( nY, nX, BitmapColor( nRed, nGreen, nBlue ) );
+ }
+ break;
+
+ // 8 bit indexing
+ case 8 :
+ for (;nXCount < mpFileHeader->nImageWidth; nXCount++, nX += nXAdd )
+ {
+ *mpTGA >> nDummy;
+ if ( nDummy >= mpFileHeader->nColorMapLength )
+ return FALSE;
+ mpAcc->SetPixel( nY, nX, (BYTE)nDummy );
+ }
+ break;
+ default:
+ return FALSE;
+ }
+ }
+ else
+ {
+ switch( nDepth )
+ {
+ // 32 bit true color
+ case 32 :
+ {
+ for (;nXCount < mpFileHeader->nImageWidth; nXCount++, nX += nXAdd )
+ {
+ *mpTGA >> nBlue >> nGreen >> nRed >> nDummy;
+ mpAcc->SetPixel( nY, nX, BitmapColor( nRed, nGreen, nBlue ) );
+ }
+ }
+ break;
+
+ // 24 bit true color
+ case 24 :
+ for (;nXCount < mpFileHeader->nImageWidth; nXCount++, nX += nXAdd )
+ {
+ *mpTGA >> nBlue >> nGreen >> nRed;
+ mpAcc->SetPixel( nY, nX, BitmapColor( nRed, nGreen, nBlue ) );
+ }
+ break;
+
+ // 16 bit true color
+ case 16 :
+ for (;nXCount < mpFileHeader->nImageWidth; nXCount++, nX += nXAdd )
+ {
+ *mpTGA >> nRGB16;
+ nRed = (BYTE)( nRGB16 >> 7 ) & 0xf8;
+ nGreen = (BYTE)( nRGB16 >> 2 ) & 0xf8;
+ nBlue = (BYTE)( nRGB16 << 3 ) & 0xf8;
+ mpAcc->SetPixel( nY, nX, BitmapColor( nRed, nGreen, nBlue ) );
+ }
+ break;
+ default:
+ return FALSE;
+ }
+ }
+ }
+ }
+ return mbStatus;
+}
+
+// -------------------------------------------------------------------------------------------
+
+BOOL TGAReader::ImplReadPalette()
+{
+ if ( mbIndexing ) // read the colormap
+ {
+ USHORT nColors = mpFileHeader->nColorMapLength;
+
+ if ( !nColors ) // colors == 0 ? -> we will build a grayscale palette
+ {
+ if ( mpFileHeader->nPixelDepth != 8 )
+ return FALSE;
+ nColors = 256;
+ mpFileHeader->nColorMapLength = 256;
+ mpFileHeader->nColorMapEntrySize = 0x3f; // patch for the following switch routine
+ }
+ mpColorMap = new UINT32[ nColors ]; // we will always index dwords
+ if ( mpColorMap == FALSE )
+ return FALSE; // out of memory %&!$&/!"�$
+
+ switch( mpFileHeader->nColorMapEntrySize )
+ {
+ case 0x3f :
+ {
+ for ( ULONG i = 0; i < nColors; i++ )
+ {
+ mpColorMap[ i ] = ( i << 16 ) + ( i << 8 ) + i;
+ }
+ }
+ break;
+
+ case 32 :
+ mpTGA->Read( mpColorMap, 4 * nColors );
+ break;
+
+ case 24 :
+ {
+ for ( ULONG i = 0; i < nColors; i++ )
+ {
+ mpTGA->Read( &mpColorMap[ i ], 3 );
+ }
+ }
+ break;
+
+ case 15 :
+ case 16 :
+ {
+ for ( ULONG i = 0; i < nColors; i++ )
+ {
+ UINT16 nTemp;
+ *mpTGA >> nTemp;
+ mpColorMap[ i ] = ( ( nTemp & 0x7c00 ) << 9 ) + ( ( nTemp & 0x01e0 ) << 6 ) +
+ ( ( nTemp & 0x1f ) << 3 );
+ }
+ }
+ break;
+
+ default :
+ return FALSE;
+ }
+ if ( mnDestBitDepth <= 8 )
+ {
+ USHORT nDestColors = ( 1 << mnDestBitDepth );
+ if ( nColors > nDestColors )
+ return FALSE;
+
+ mpAcc->SetPaletteEntryCount( nColors );
+ for ( USHORT i = 0; i < nColors; i++ )
+ {
+ mpAcc->SetPaletteColor( i, Color( (BYTE)( mpColorMap[ i ] >> 16 ),
+ (BYTE)( mpColorMap[ i ] >> 8 ), (BYTE)(mpColorMap[ i ] ) ) );
+ }
+ }
+ }
+
+ return mbStatus;
+}
+
+//================== GraphicImport - die exportierte Funktion ================
+
+extern "C" BOOL __LOADONCALLAPI GraphicImport(SvStream & rStream, Graphic & rGraphic, FilterConfigItem*, BOOL )
+{
+ TGAReader aTGAReader;
+
+ return aTGAReader.ReadTGA( rStream, rGraphic );
+}
+
+//================== ein bischen Muell fuer Windows ==========================
+#ifndef GCC
+#endif
+
+#ifdef WIN
+
+static HINSTANCE hDLLInst = 0; // HANDLE der DLL
+
+extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR )
+{
+#ifndef WNT
+ if ( nHeap )
+ UnlockData( 0 );
+#endif
+
+ hDLLInst = hDLL;
+
+ return TRUE;
+}
+
+extern "C" int CALLBACK WEP( int )
+{
+ return 1;
+}
+
+#endif
+
diff --git a/filter/source/graphicfilter/itga/makefile.mk b/filter/source/graphicfilter/itga/makefile.mk
new file mode 100644
index 000000000000..ef810d1708ef
--- /dev/null
+++ b/filter/source/graphicfilter/itga/makefile.mk
@@ -0,0 +1,67 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=filter
+TARGET=itga
+DEPTARGET=vitga
+
+# --- Settings -----------------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Allgemein ----------------------------------------------------------
+
+.IF "$(editdebug)"!="" || "$(EDITDEBUG)"!=""
+CDEFS+= -DEDITDEBUG
+.ENDIF
+.IF "$(L10N_framework)"==""
+SLOFILES = $(SLO)$/itga.obj
+
+# ==========================================================================
+
+SHL1TARGET= itg$(DLLPOSTFIX)
+SHL1IMPLIB= itga
+SHL1STDLIBS= $(VCLLIB) $(TOOLSLIB) $(SALLIB)
+SHL1LIBS= $(SLB)$/itga.lib
+
+.IF "$(GUI)" != "UNX"
+.IF "$(COM)" != "GCC"
+SHL1OBJS= $(SLO)$/itga.obj
+.ENDIF
+.ENDIF
+
+SHL1VERSIONMAP=exports.map
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+
+DEF1NAME=$(SHL1TARGET)
+.ENDIF
+
+# ==========================================================================
+
+.INCLUDE : target.mk
diff --git a/filter/source/graphicfilter/itiff/ccidecom.cxx b/filter/source/graphicfilter/itiff/ccidecom.cxx
new file mode 100644
index 000000000000..5e9e75cbf815
--- /dev/null
+++ b/filter/source/graphicfilter/itiff/ccidecom.cxx
@@ -0,0 +1,1112 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include "ccidecom.hxx"
+
+//=============================== Huffman-Tabellen ========================
+
+//---------------------------- White-Run ------------------------------
+
+#define CCIWhiteTableSize 105
+
+const CCIHuffmanTableEntry CCIWhiteTable[CCIWhiteTableSize]={
+ { 0, 0x0035, 8 },
+ { 1, 0x0007, 6 },
+ { 2, 0x0007, 4 },
+ { 3, 0x0008, 4 },
+ { 4, 0x000b, 4 },
+ { 5, 0x000c, 4 },
+ { 6, 0x000e, 4 },
+ { 7, 0x000f, 4 },
+ { 8, 0x0013, 5 },
+ { 9, 0x0014, 5 },
+ { 10, 0x0007, 5 },
+ { 11, 0x0008, 5 },
+ { 12, 0x0008, 6 },
+ { 13, 0x0003, 6 },
+ { 14, 0x0034, 6 },
+ { 15, 0x0035, 6 },
+ { 16, 0x002a, 6 },
+ { 17, 0x002b, 6 },
+ { 18, 0x0027, 7 },
+ { 19, 0x000c, 7 },
+ { 20, 0x0008, 7 },
+ { 21, 0x0017, 7 },
+ { 22, 0x0003, 7 },
+ { 23, 0x0004, 7 },
+ { 24, 0x0028, 7 },
+ { 25, 0x002b, 7 },
+ { 26, 0x0013, 7 },
+ { 27, 0x0024, 7 },
+ { 28, 0x0018, 7 },
+ { 29, 0x0002, 8 },
+ { 30, 0x0003, 8 },
+ { 31, 0x001a, 8 },
+ { 32, 0x001b, 8 },
+ { 33, 0x0012, 8 },
+ { 34, 0x0013, 8 },
+ { 35, 0x0014, 8 },
+ { 36, 0x0015, 8 },
+ { 37, 0x0016, 8 },
+ { 38, 0x0017, 8 },
+ { 39, 0x0028, 8 },
+ { 40, 0x0029, 8 },
+ { 41, 0x002a, 8 },
+ { 42, 0x002b, 8 },
+ { 43, 0x002c, 8 },
+ { 44, 0x002d, 8 },
+ { 45, 0x0004, 8 },
+ { 46, 0x0005, 8 },
+ { 47, 0x000a, 8 },
+ { 48, 0x000b, 8 },
+ { 49, 0x0052, 8 },
+ { 50, 0x0053, 8 },
+ { 51, 0x0054, 8 },
+ { 52, 0x0055, 8 },
+ { 53, 0x0024, 8 },
+ { 54, 0x0025, 8 },
+ { 55, 0x0058, 8 },
+ { 56, 0x0059, 8 },
+ { 57, 0x005a, 8 },
+ { 58, 0x005b, 8 },
+ { 59, 0x004a, 8 },
+ { 60, 0x004b, 8 },
+ { 61, 0x0032, 8 },
+ { 62, 0x0033, 8 },
+ { 63, 0x0034, 8 },
+ { 64, 0x001b, 5 },
+ { 128, 0x0012, 5 },
+ { 192, 0x0017, 6 },
+ { 256, 0x0037, 7 },
+ { 320, 0x0036, 8 },
+ { 384, 0x0037, 8 },
+ { 448, 0x0064, 8 },
+ { 512, 0x0065, 8 },
+ { 576, 0x0068, 8 },
+ { 640, 0x0067, 8 },
+ { 704, 0x00cc, 9 },
+ { 768, 0x00cd, 9 },
+ { 832, 0x00d2, 9 },
+ { 896, 0x00d3, 9 },
+ { 960, 0x00d4, 9 },
+ { 1024, 0x00d5, 9 },
+ { 1088, 0x00d6, 9 },
+ { 1152, 0x00d7, 9 },
+ { 1216, 0x00d8, 9 },
+ { 1280, 0x00d9, 9 },
+ { 1344, 0x00da, 9 },
+ { 1408, 0x00db, 9 },
+ { 1472, 0x0098, 9 },
+ { 1536, 0x0099, 9 },
+ { 1600, 0x009a, 9 },
+ { 1664, 0x0018, 6 },
+ { 1728, 0x009b, 9 },
+ { 1792, 0x0008, 11 },
+ { 1856, 0x000c, 11 },
+ { 1920, 0x000d, 11 },
+ { 1984, 0x0012, 12 },
+ { 2048, 0x0013, 12 },
+ { 2112, 0x0014, 12 },
+ { 2176, 0x0015, 12 },
+ { 2240, 0x0016, 12 },
+ { 2304, 0x0017, 12 },
+ { 2368, 0x001c, 12 },
+ { 2432, 0x001d, 12 },
+ { 2496, 0x001e, 12 },
+ { 2560, 0x001f, 12 },
+ { 9999, 0x0001, 12 } // EOL
+};
+
+//---------------------------- Black-Run ------------------------------
+
+#define CCIBlackTableSize 105
+
+const CCIHuffmanTableEntry CCIBlackTable[CCIBlackTableSize]={
+ { 0, 0x0037, 10 },
+ { 1, 0x0002, 3 },
+ { 2, 0x0003, 2 },
+ { 3, 0x0002, 2 },
+ { 4, 0x0003, 3 },
+ { 5, 0x0003, 4 },
+ { 6, 0x0002, 4 },
+ { 7, 0x0003, 5 },
+ { 8, 0x0005, 6 },
+ { 9, 0x0004, 6 },
+ { 10, 0x0004, 7 },
+ { 11, 0x0005, 7 },
+ { 12, 0x0007, 7 },
+ { 13, 0x0004, 8 },
+ { 14, 0x0007, 8 },
+ { 15, 0x0018, 9 },
+ { 16, 0x0017, 10 },
+ { 17, 0x0018, 10 },
+ { 18, 0x0008, 10 },
+ { 19, 0x0067, 11 },
+ { 20, 0x0068, 11 },
+ { 21, 0x006c, 11 },
+ { 22, 0x0037, 11 },
+ { 23, 0x0028, 11 },
+ { 24, 0x0017, 11 },
+ { 25, 0x0018, 11 },
+ { 26, 0x00ca, 12 },
+ { 27, 0x00cb, 12 },
+ { 28, 0x00cc, 12 },
+ { 29, 0x00cd, 12 },
+ { 30, 0x0068, 12 },
+ { 31, 0x0069, 12 },
+ { 32, 0x006a, 12 },
+ { 33, 0x006b, 12 },
+ { 34, 0x00d2, 12 },
+ { 35, 0x00d3, 12 },
+ { 36, 0x00d4, 12 },
+ { 37, 0x00d5, 12 },
+ { 38, 0x00d6, 12 },
+ { 39, 0x00d7, 12 },
+ { 40, 0x006c, 12 },
+ { 41, 0x006d, 12 },
+ { 42, 0x00da, 12 },
+ { 43, 0x00db, 12 },
+ { 44, 0x0054, 12 },
+ { 45, 0x0055, 12 },
+ { 46, 0x0056, 12 },
+ { 47, 0x0057, 12 },
+ { 48, 0x0064, 12 },
+ { 49, 0x0065, 12 },
+ { 50, 0x0052, 12 },
+ { 51, 0x0053, 12 },
+ { 52, 0x0024, 12 },
+ { 53, 0x0037, 12 },
+ { 54, 0x0038, 12 },
+ { 55, 0x0027, 12 },
+ { 56, 0x0028, 12 },
+ { 57, 0x0058, 12 },
+ { 58, 0x0059, 12 },
+ { 59, 0x002b, 12 },
+ { 60, 0x002c, 12 },
+ { 61, 0x005a, 12 },
+ { 62, 0x0066, 12 },
+ { 63, 0x0067, 12 },
+ { 64, 0x000f, 10 },
+ { 128, 0x00c8, 12 },
+ { 192, 0x00c9, 12 },
+ { 256, 0x005b, 12 },
+ { 320, 0x0033, 12 },
+ { 384, 0x0034, 12 },
+ { 448, 0x0035, 12 },
+ { 512, 0x006c, 13 },
+ { 576, 0x006d, 13 },
+ { 640, 0x004a, 13 },
+ { 704, 0x004b, 13 },
+ { 768, 0x004c, 13 },
+ { 832, 0x004d, 13 },
+ { 896, 0x0072, 13 },
+ { 960, 0x0073, 13 },
+ { 1024, 0x0074, 13 },
+ { 1088, 0x0075, 13 },
+ { 1152, 0x0076, 13 },
+ { 1216, 0x0077, 13 },
+ { 1280, 0x0052, 13 },
+ { 1344, 0x0053, 13 },
+ { 1408, 0x0054, 13 },
+ { 1472, 0x0055, 13 },
+ { 1536, 0x005a, 13 },
+ { 1600, 0x005b, 13 },
+ { 1664, 0x0064, 13 },
+ { 1728, 0x0065, 13 },
+ { 1792, 0x0008, 11 },
+ { 1856, 0x000c, 11 },
+ { 1920, 0x000d, 11 },
+ { 1984, 0x0012, 12 },
+ { 2048, 0x0013, 12 },
+ { 2112, 0x0014, 12 },
+ { 2176, 0x0015, 12 },
+ { 2240, 0x0016, 12 },
+ { 2304, 0x0017, 12 },
+ { 2368, 0x001c, 12 },
+ { 2432, 0x001d, 12 },
+ { 2496, 0x001e, 12 },
+ { 2560, 0x001f, 12 },
+ { 9999, 0x0001, 12 } // EOL
+};
+
+
+//---------------------------- 2D-Mode --------------------------------
+
+#define CCI2DMODE_UNCOMP 0
+#define CCI2DMODE_PASS 1
+#define CCI2DMODE_HORZ 2
+#define CCI2DMODE_VERT_L3 3
+#define CCI2DMODE_VERT_L2 4
+#define CCI2DMODE_VERT_L1 5
+#define CCI2DMODE_VERT_0 6
+#define CCI2DMODE_VERT_R1 7
+#define CCI2DMODE_VERT_R2 8
+#define CCI2DMODE_VERT_R3 9
+
+#define CCI2DModeTableSize 10
+
+const CCIHuffmanTableEntry CCI2DModeTable[CCI2DModeTableSize]={
+ { CCI2DMODE_UNCOMP , 0x000f, 10 },
+ { CCI2DMODE_PASS , 0x0001, 4 },
+ { CCI2DMODE_HORZ , 0x0001, 3 },
+ { CCI2DMODE_VERT_L3, 0x0002, 7 },
+ { CCI2DMODE_VERT_L2, 0x0002, 6 },
+ { CCI2DMODE_VERT_L1, 0x0002, 3 },
+ { CCI2DMODE_VERT_0 , 0x0001, 1 },
+ { CCI2DMODE_VERT_R1, 0x0003, 3 },
+ { CCI2DMODE_VERT_R2, 0x0003, 6 },
+ { CCI2DMODE_VERT_R3, 0x0003, 7 }
+};
+
+
+//-------------------------- 2D-Uncompressed-Mode ----------------------
+
+#define CCIUNCOMP_0White_1Black 0
+#define CCIUNCOMP_1White_1Black 1
+#define CCIUNCOMP_2White_1Black 2
+#define CCIUNCOMP_3White_1Black 3
+#define CCIUNCOMP_4White_1Black 4
+#define CCIUNCOMP_5White 5
+#define CCIUNCOMP_0White_End 6
+#define CCIUNCOMP_1White_End 7
+#define CCIUNCOMP_2White_End 8
+#define CCIUNCOMP_3White_End 9
+#define CCIUNCOMP_4White_End 10
+
+#define CCIUncompTableSize 11
+
+const CCIHuffmanTableEntry CCIUncompTable[CCIUncompTableSize]={
+ { CCIUNCOMP_0White_1Black, 0x0001, 1 },
+ { CCIUNCOMP_1White_1Black, 0x0001, 2 },
+ { CCIUNCOMP_2White_1Black, 0x0001, 3 },
+ { CCIUNCOMP_3White_1Black, 0x0001, 4 },
+ { CCIUNCOMP_4White_1Black, 0x0001, 5 },
+ { CCIUNCOMP_5White , 0x0001, 6 },
+ { CCIUNCOMP_0White_End , 0x0001, 7 },
+ { CCIUNCOMP_1White_End , 0x0001, 8 },
+ { CCIUNCOMP_2White_End , 0x0001, 9 },
+ { CCIUNCOMP_3White_End , 0x0001, 10 },
+ { CCIUNCOMP_4White_End , 0x0001, 11 }
+};
+
+
+//================== Sicherheitskopie der Huffman-Tabellen ================
+// Um sicher zugehen, dass die Huffman-Tabellen keine Fehler enthalten,
+// wurden sie zweimal von unterschiedlichen Quellen eingegeben (Uff) und
+// verglichen.
+// Da sich aber im Laufe der Pflege des Source-Codes mal ein Fehler
+// einschleichen koennte (z.B. versehentlicher druck einer Taste im Editor)
+// werden die Tablellen hier weiterhin zweimal aufgefuehrt und zur Laufzeit
+// verglichen. (Wenn der Vergleich fehlschlaegt, liefert CCIDecompressor
+// immer einen Fehler). Das Ganze mag etwas wahnsinnig erscheinen, aber ein Fehler
+// in den Tabellen waere sonst sehr sehr schwer zu erkennen, zumal es
+// unwahrscheinlich ist, dass eine oder mehere Beispieldateien alle Codes
+// durchlaufen.
+
+const CCIHuffmanTableEntry CCIWhiteTableSave[CCIWhiteTableSize]={
+ { 0, 0x0035, 8 },
+ { 1, 0x0007, 6 },
+ { 2, 0x0007, 4 },
+ { 3, 0x0008, 4 },
+ { 4, 0x000b, 4 },
+ { 5, 0x000c, 4 },
+ { 6, 0x000e, 4 },
+ { 7, 0x000f, 4 },
+ { 8, 0x0013, 5 },
+ { 9, 0x0014, 5 },
+ { 10, 0x0007, 5 },
+ { 11, 0x0008, 5 },
+ { 12, 0x0008, 6 },
+ { 13, 0x0003, 6 },
+ { 14, 0x0034, 6 },
+ { 15, 0x0035, 6 },
+ { 16, 0x002a, 6 },
+ { 17, 0x002b, 6 },
+ { 18, 0x0027, 7 },
+ { 19, 0x000c, 7 },
+ { 20, 0x0008, 7 },
+ { 21, 0x0017, 7 },
+ { 22, 0x0003, 7 },
+ { 23, 0x0004, 7 },
+ { 24, 0x0028, 7 },
+ { 25, 0x002b, 7 },
+ { 26, 0x0013, 7 },
+ { 27, 0x0024, 7 },
+ { 28, 0x0018, 7 },
+ { 29, 0x0002, 8 },
+ { 30, 0x0003, 8 },
+ { 31, 0x001a, 8 },
+ { 32, 0x001b, 8 },
+ { 33, 0x0012, 8 },
+ { 34, 0x0013, 8 },
+ { 35, 0x0014, 8 },
+ { 36, 0x0015, 8 },
+ { 37, 0x0016, 8 },
+ { 38, 0x0017, 8 },
+ { 39, 0x0028, 8 },
+ { 40, 0x0029, 8 },
+ { 41, 0x002a, 8 },
+ { 42, 0x002b, 8 },
+ { 43, 0x002c, 8 },
+ { 44, 0x002d, 8 },
+ { 45, 0x0004, 8 },
+ { 46, 0x0005, 8 },
+ { 47, 0x000a, 8 },
+ { 48, 0x000b, 8 },
+ { 49, 0x0052, 8 },
+ { 50, 0x0053, 8 },
+ { 51, 0x0054, 8 },
+ { 52, 0x0055, 8 },
+ { 53, 0x0024, 8 },
+ { 54, 0x0025, 8 },
+ { 55, 0x0058, 8 },
+ { 56, 0x0059, 8 },
+ { 57, 0x005a, 8 },
+ { 58, 0x005b, 8 },
+ { 59, 0x004a, 8 },
+ { 60, 0x004b, 8 },
+ { 61, 0x0032, 8 },
+ { 62, 0x0033, 8 },
+ { 63, 0x0034, 8 },
+ { 64, 0x001b, 5 },
+ { 128, 0x0012, 5 },
+ { 192, 0x0017, 6 },
+ { 256, 0x0037, 7 },
+ { 320, 0x0036, 8 },
+ { 384, 0x0037, 8 },
+ { 448, 0x0064, 8 },
+ { 512, 0x0065, 8 },
+ { 576, 0x0068, 8 },
+ { 640, 0x0067, 8 },
+ { 704, 0x00cc, 9 },
+ { 768, 0x00cd, 9 },
+ { 832, 0x00d2, 9 },
+ { 896, 0x00d3, 9 },
+ { 960, 0x00d4, 9 },
+ { 1024, 0x00d5, 9 },
+ { 1088, 0x00d6, 9 },
+ { 1152, 0x00d7, 9 },
+ { 1216, 0x00d8, 9 },
+ { 1280, 0x00d9, 9 },
+ { 1344, 0x00da, 9 },
+ { 1408, 0x00db, 9 },
+ { 1472, 0x0098, 9 },
+ { 1536, 0x0099, 9 },
+ { 1600, 0x009a, 9 },
+ { 1664, 0x0018, 6 },
+ { 1728, 0x009b, 9 },
+ { 1792, 0x0008, 11 },
+ { 1856, 0x000c, 11 },
+ { 1920, 0x000d, 11 },
+ { 1984, 0x0012, 12 },
+ { 2048, 0x0013, 12 },
+ { 2112, 0x0014, 12 },
+ { 2176, 0x0015, 12 },
+ { 2240, 0x0016, 12 },
+ { 2304, 0x0017, 12 },
+ { 2368, 0x001c, 12 },
+ { 2432, 0x001d, 12 },
+ { 2496, 0x001e, 12 },
+ { 2560, 0x001f, 12 },
+ { 9999, 0x0001, 12 } // EOL
+};
+
+const CCIHuffmanTableEntry CCIBlackTableSave[CCIBlackTableSize]={
+ { 0, 0x0037, 10 },
+ { 1, 0x0002, 3 },
+ { 2, 0x0003, 2 },
+ { 3, 0x0002, 2 },
+ { 4, 0x0003, 3 },
+ { 5, 0x0003, 4 },
+ { 6, 0x0002, 4 },
+ { 7, 0x0003, 5 },
+ { 8, 0x0005, 6 },
+ { 9, 0x0004, 6 },
+ { 10, 0x0004, 7 },
+ { 11, 0x0005, 7 },
+ { 12, 0x0007, 7 },
+ { 13, 0x0004, 8 },
+ { 14, 0x0007, 8 },
+ { 15, 0x0018, 9 },
+ { 16, 0x0017, 10 },
+ { 17, 0x0018, 10 },
+ { 18, 0x0008, 10 },
+ { 19, 0x0067, 11 },
+ { 20, 0x0068, 11 },
+ { 21, 0x006c, 11 },
+ { 22, 0x0037, 11 },
+ { 23, 0x0028, 11 },
+ { 24, 0x0017, 11 },
+ { 25, 0x0018, 11 },
+ { 26, 0x00ca, 12 },
+ { 27, 0x00cb, 12 },
+ { 28, 0x00cc, 12 },
+ { 29, 0x00cd, 12 },
+ { 30, 0x0068, 12 },
+ { 31, 0x0069, 12 },
+ { 32, 0x006a, 12 },
+ { 33, 0x006b, 12 },
+ { 34, 0x00d2, 12 },
+ { 35, 0x00d3, 12 },
+ { 36, 0x00d4, 12 },
+ { 37, 0x00d5, 12 },
+ { 38, 0x00d6, 12 },
+ { 39, 0x00d7, 12 },
+ { 40, 0x006c, 12 },
+ { 41, 0x006d, 12 },
+ { 42, 0x00da, 12 },
+ { 43, 0x00db, 12 },
+ { 44, 0x0054, 12 },
+ { 45, 0x0055, 12 },
+ { 46, 0x0056, 12 },
+ { 47, 0x0057, 12 },
+ { 48, 0x0064, 12 },
+ { 49, 0x0065, 12 },
+ { 50, 0x0052, 12 },
+ { 51, 0x0053, 12 },
+ { 52, 0x0024, 12 },
+ { 53, 0x0037, 12 },
+ { 54, 0x0038, 12 },
+ { 55, 0x0027, 12 },
+ { 56, 0x0028, 12 },
+ { 57, 0x0058, 12 },
+ { 58, 0x0059, 12 },
+ { 59, 0x002b, 12 },
+ { 60, 0x002c, 12 },
+ { 61, 0x005a, 12 },
+ { 62, 0x0066, 12 },
+ { 63, 0x0067, 12 },
+ { 64, 0x000f, 10 },
+ { 128, 0x00c8, 12 },
+ { 192, 0x00c9, 12 },
+ { 256, 0x005b, 12 },
+ { 320, 0x0033, 12 },
+ { 384, 0x0034, 12 },
+ { 448, 0x0035, 12 },
+ { 512, 0x006c, 13 },
+ { 576, 0x006d, 13 },
+ { 640, 0x004a, 13 },
+ { 704, 0x004b, 13 },
+ { 768, 0x004c, 13 },
+ { 832, 0x004d, 13 },
+ { 896, 0x0072, 13 },
+ { 960, 0x0073, 13 },
+ { 1024, 0x0074, 13 },
+ { 1088, 0x0075, 13 },
+ { 1152, 0x0076, 13 },
+ { 1216, 0x0077, 13 },
+ { 1280, 0x0052, 13 },
+ { 1344, 0x0053, 13 },
+ { 1408, 0x0054, 13 },
+ { 1472, 0x0055, 13 },
+ { 1536, 0x005a, 13 },
+ { 1600, 0x005b, 13 },
+ { 1664, 0x0064, 13 },
+ { 1728, 0x0065, 13 },
+ { 1792, 0x0008, 11 },
+ { 1856, 0x000c, 11 },
+ { 1920, 0x000d, 11 },
+ { 1984, 0x0012, 12 },
+ { 2048, 0x0013, 12 },
+ { 2112, 0x0014, 12 },
+ { 2176, 0x0015, 12 },
+ { 2240, 0x0016, 12 },
+ { 2304, 0x0017, 12 },
+ { 2368, 0x001c, 12 },
+ { 2432, 0x001d, 12 },
+ { 2496, 0x001e, 12 },
+ { 2560, 0x001f, 12 },
+ { 9999, 0x0001, 12 } // EOL
+};
+
+
+const CCIHuffmanTableEntry CCI2DModeTableSave[CCI2DModeTableSize]={
+ { CCI2DMODE_UNCOMP , 0x000f, 10 },
+ { CCI2DMODE_PASS , 0x0001, 4 },
+ { CCI2DMODE_HORZ , 0x0001, 3 },
+ { CCI2DMODE_VERT_L3, 0x0002, 7 },
+ { CCI2DMODE_VERT_L2, 0x0002, 6 },
+ { CCI2DMODE_VERT_L1, 0x0002, 3 },
+ { CCI2DMODE_VERT_0 , 0x0001, 1 },
+ { CCI2DMODE_VERT_R1, 0x0003, 3 },
+ { CCI2DMODE_VERT_R2, 0x0003, 6 },
+ { CCI2DMODE_VERT_R3, 0x0003, 7 }
+};
+
+
+const CCIHuffmanTableEntry CCIUncompTableSave[CCIUncompTableSize]={
+ { CCIUNCOMP_0White_1Black, 0x0001, 1 },
+ { CCIUNCOMP_1White_1Black, 0x0001, 2 },
+ { CCIUNCOMP_2White_1Black, 0x0001, 3 },
+ { CCIUNCOMP_3White_1Black, 0x0001, 4 },
+ { CCIUNCOMP_4White_1Black, 0x0001, 5 },
+ { CCIUNCOMP_5White , 0x0001, 6 },
+ { CCIUNCOMP_0White_End , 0x0001, 7 },
+ { CCIUNCOMP_1White_End , 0x0001, 8 },
+ { CCIUNCOMP_2White_End , 0x0001, 9 },
+ { CCIUNCOMP_3White_End , 0x0001, 10 },
+ { CCIUNCOMP_4White_End , 0x0001, 11 }
+};
+
+//=========================================================================
+
+
+CCIDecompressor::CCIDecompressor( ULONG nOpts, UINT32 nImageWidth ) :
+ bTableBad ( FALSE ),
+ bStatus ( FALSE ),
+ pByteSwap ( NULL ),
+ nWidth ( nImageWidth ),
+ nOptions ( nOpts ),
+ pLastLine ( NULL )
+{
+ if ( nOpts & CCI_OPTION_INVERSEBITORDER )
+ {
+ pByteSwap = new BYTE[ 256 ];
+ for ( int i = 0; i < 256; i++ )
+ {
+ pByteSwap[ i ] = sal::static_int_cast< BYTE >(
+ ( i << 7 ) | ( ( i & 2 ) << 5 ) | ( ( i & 4 ) << 3 ) | ( ( i & 8 ) << 1 ) |
+ ( ( i & 16 ) >> 1 ) | ( ( i & 32 ) >> 3 ) | ( ( i & 64 ) >> 5 ) | ( ( i & 128 ) >> 7 ));
+ }
+ }
+
+ pWhiteLookUp =new CCILookUpTableEntry[1<<13];
+ pBlackLookUp =new CCILookUpTableEntry[1<<13];
+ p2DModeLookUp=new CCILookUpTableEntry[1<<10];
+ pUncompLookUp=new CCILookUpTableEntry[1<<11];
+
+ MakeLookUp(CCIWhiteTable,CCIWhiteTableSave,pWhiteLookUp,CCIWhiteTableSize,13);
+ MakeLookUp(CCIBlackTable,CCIBlackTableSave,pBlackLookUp,CCIBlackTableSize,13);
+ MakeLookUp(CCI2DModeTable,CCI2DModeTableSave,p2DModeLookUp,CCI2DModeTableSize,10);
+ MakeLookUp(CCIUncompTable,CCIUncompTableSave,pUncompLookUp,CCIUncompTableSize,11);
+}
+
+
+CCIDecompressor::~CCIDecompressor()
+{
+ delete[] pByteSwap;
+ delete[] pLastLine;
+ delete[] pWhiteLookUp;
+ delete[] pBlackLookUp;
+ delete[] p2DModeLookUp;
+ delete[] pUncompLookUp;
+}
+
+
+void CCIDecompressor::StartDecompression( SvStream & rIStream )
+{
+ pIStream = &rIStream;
+ nInputBitsBufSize = 0;
+ bFirstEOL = TRUE;
+ bStatus = TRUE;
+ nEOLCount = 0;
+
+ if ( bTableBad == TRUE )
+ return;
+}
+
+
+BOOL CCIDecompressor::DecompressScanline( BYTE * pTarget, ULONG nTargetBits )
+{
+ USHORT i;
+ BYTE * pSrc,* pDst;
+ BOOL b2D;
+
+ if ( nEOLCount >= 5 ) // RTC( Return To Controller )
+ return TRUE;
+
+ if ( bStatus == FALSE )
+ return FALSE;
+
+ // Wenn EOL-Codes vorhanden sind, steht der EOL-Code auch vor der ersten Zeile.
+ // (und ich dachte EOL heisst 'End Of Line'...)
+ // Daher lesen wir den EOL-Code immer vor jeder Zeile als erstes ein:
+ if ( nOptions & CCI_OPTION_EOL )
+ {
+ if ( bFirstEOL )
+ {
+ UINT32 nCurPos = pIStream->Tell();
+ UINT16 nOldInputBitsBufSize = nInputBitsBufSize;
+ UINT32 nOldInputBitsBuf = nInputBitsBuf;
+ if ( ReadEOL( 32 ) == FALSE )
+ {
+ nInputBitsBufSize = nOldInputBitsBufSize;
+ nInputBitsBuf = nOldInputBitsBuf;
+ pIStream->Seek( nCurPos );
+ nOptions &=~ CCI_OPTION_EOL; // CCITT Group 3 - Compression Type 2
+ }
+ bFirstEOL = FALSE;
+ }
+ else
+ {
+ if ( ReadEOL( nTargetBits ) == FALSE )
+ {
+ return bStatus;
+ }
+ }
+ }
+
+ if ( nEOLCount >= 5 ) // RTC( Return To Controller )
+ return TRUE;
+
+ // ggf. eine weisse vorherige Zeile herstellen fuer 2D:
+ if ( nOptions & CCI_OPTION_2D )
+ {
+ if ( pLastLine == NULL || nLastLineSize != ( ( nTargetBits + 7 ) >> 3 ) )
+ {
+ if ( pLastLine == NULL )
+ delete[] pLastLine;
+ nLastLineSize = ( nTargetBits + 7 ) >> 3;
+ pLastLine = new BYTE[ nLastLineSize ];
+ pDst = pLastLine;
+ for ( i = 0; i < nLastLineSize; i++ ) *( pDst++ ) = 0x00;
+ }
+ }
+ // ggf. Zeilen-Anfang auf naechste Byte-Grenze runden:
+ if ( nOptions & CCI_OPTION_BYTEALIGNROW )
+ nInputBitsBufSize &= 0xfff8;
+
+ // Ist es eine 2D-Zeile ?:
+ if ( nOptions & CCI_OPTION_2D )
+ {
+ if ( nOptions & CCI_OPTION_EOL )
+ b2D = Read2DTag();
+ else
+ b2D = TRUE;
+ }
+ else
+ b2D = FALSE;
+
+ // Zeile einlesen:
+ if ( b2D )
+ Read2DScanlineData( pTarget, (USHORT)nTargetBits );
+ else
+ Read1DScanlineData( pTarget, (USHORT)nTargetBits );
+
+ // Wenn wir im 2D-Modus sind, muessen wir uns die Zeile merken:
+ if ( nOptions & CCI_OPTION_2D && bStatus == TRUE )
+ {
+ pSrc = pTarget;
+ pDst = pLastLine;
+ for ( i = 0; i < nLastLineSize; i++ ) *(pDst++)=*(pSrc++);
+ }
+
+ if ( pIStream->GetError() )
+ bStatus = FALSE;
+
+ return bStatus;
+}
+
+
+void CCIDecompressor::MakeLookUp(const CCIHuffmanTableEntry * pHufTab,
+ const CCIHuffmanTableEntry * pHufTabSave,
+ CCILookUpTableEntry * pLookUp,
+ USHORT nHuffmanTableSize,
+ USHORT nMaxCodeBits)
+{
+ USHORT i,j,nMinCode,nMaxCode,nLookUpSize,nMask;
+
+ if (bTableBad==TRUE) return;
+
+ nLookUpSize=1<<nMaxCodeBits;
+
+ nMask=0xffff>>(16-nMaxCodeBits);
+
+ for (i=0; i<nLookUpSize; i++) pLookUp[i].nCodeBits=0;
+ for (i=0; i<nHuffmanTableSize; i++) {
+ if ( pHufTab[i].nValue!=pHufTabSave[i].nValue ||
+ pHufTab[i].nCode!=pHufTabSave[i].nCode ||
+ pHufTab[i].nCodeBits!=pHufTabSave[i].nCodeBits ||
+ pHufTab[i].nCodeBits==0 ||
+ pHufTab[i].nCodeBits>nMaxCodeBits )
+ {
+ bTableBad=TRUE;
+ return;
+ }
+ nMinCode = nMask & (pHufTab[i].nCode << (nMaxCodeBits-pHufTab[i].nCodeBits));
+ nMaxCode = nMinCode | (nMask >> pHufTab[i].nCodeBits);
+ for (j=nMinCode; j<=nMaxCode; j++) {
+ if (pLookUp[j].nCodeBits!=0) {
+ bTableBad=TRUE;
+ return;
+ }
+ pLookUp[j].nValue=pHufTab[i].nValue;
+ pLookUp[j].nCodeBits=pHufTab[i].nCodeBits;
+ }
+ }
+}
+
+
+BOOL CCIDecompressor::ReadEOL( UINT32 /*nMaxFillBits*/ )
+{
+ USHORT nCode;
+ BYTE nByte;
+
+ // if (nOptions&CCI_OPTION_BYTEALIGNEOL) nMaxFillBits=7; else nMaxFillBits=0;
+ // Buuuh: Entweder wird die Option in itiff.cxx nicht richtig gesetzt (-> Fehler in Doku)
+ // oder es gibt tatsaechlich gemeine Export-Filter, die immer ein Align machen.
+ // Ausserdem wurden Dateien gefunden, in denen mehr als die maximal 7 noetigen
+ // Fuellbits vor dem EOL-Code stehen. Daher akzeptieren wir nun grundsaetzlich
+ // bis zu 32-Bloedsinn-Bits vor dem EOL-Code:
+ // und ich habe eine Datei gefunden in der bis zu ??? Bloedsinn Bits stehen, zudem ist dort die Bit Reihenfolge verdreht (SJ);
+
+ UINT32 nMaxPos = pIStream->Tell();
+ nMaxPos += nWidth >> 3;
+
+ for ( ;; )
+ {
+ while ( nInputBitsBufSize < 12 )
+ {
+ *pIStream >> nByte;
+ if ( pIStream->IsEof() )
+ return FALSE;
+ if ( pIStream->Tell() > nMaxPos )
+ return FALSE;
+
+ if ( nOptions & CCI_OPTION_INVERSEBITORDER )
+ nByte = pByteSwap[ nByte ];
+ nInputBitsBuf=(nInputBitsBuf<<8) | (ULONG)nByte;
+ nInputBitsBufSize += 8;
+ }
+ nCode = (USHORT)( ( nInputBitsBuf >> ( nInputBitsBufSize - 12 ) ) & 0x0fff );
+ if ( nCode == 0x0001 )
+ {
+ nEOLCount++;
+ nInputBitsBufSize -= 12;
+ break;
+ }
+ else
+ nInputBitsBufSize--;
+ }
+ return TRUE;
+}
+
+
+BOOL CCIDecompressor::Read2DTag()
+{
+ BYTE nByte;
+
+ // Ein Bit einlesen und TRUE liefern, wenn es 0 ist, sonst FALSE
+ if (nInputBitsBufSize==0) {
+ *pIStream >> nByte;
+ if ( nOptions & CCI_OPTION_INVERSEBITORDER )
+ nByte = pByteSwap[ nByte ];
+ nInputBitsBuf=(ULONG)nByte;
+ nInputBitsBufSize=8;
+ }
+ nInputBitsBufSize--;
+ if ( ((nInputBitsBuf>>nInputBitsBufSize)&0x0001) ) return FALSE;
+ else return TRUE;
+}
+
+
+BYTE CCIDecompressor::ReadBlackOrWhite()
+{
+ BYTE nByte;
+
+ // Ein Bit einlesen und 0x00 liefern, wenn es 0 ist, sonst 0xff
+ if (nInputBitsBufSize==0) {
+ *pIStream >> nByte;
+ if ( nOptions & CCI_OPTION_INVERSEBITORDER )
+ nByte = pByteSwap[ nByte ];
+ nInputBitsBuf=(ULONG)nByte;
+ nInputBitsBufSize=8;
+ }
+ nInputBitsBufSize--;
+ if ( ((nInputBitsBuf>>nInputBitsBufSize)&0x0001) ) return 0xff;
+ else return 0x00;
+}
+
+
+USHORT CCIDecompressor::ReadCodeAndDecode(const CCILookUpTableEntry * pLookUp,
+ USHORT nMaxCodeBits)
+{
+ USHORT nCode,nCodeBits;
+ BYTE nByte;
+
+ // Einen Huffman-Code einlesen und dekodieren:
+ while (nInputBitsBufSize<nMaxCodeBits) {
+ *pIStream >> nByte;
+ if ( nOptions & CCI_OPTION_INVERSEBITORDER )
+ nByte = pByteSwap[ nByte ];
+ nInputBitsBuf=(nInputBitsBuf<<8) | (ULONG)nByte;
+ nInputBitsBufSize+=8;
+ }
+ nCode=(USHORT)((nInputBitsBuf>>(nInputBitsBufSize-nMaxCodeBits))
+ &(0xffff>>(16-nMaxCodeBits)));
+ nCodeBits=pLookUp[nCode].nCodeBits;
+ if (nCodeBits==0) bStatus=FALSE;
+ nInputBitsBufSize = nInputBitsBufSize - nCodeBits;
+ return pLookUp[nCode].nValue;
+}
+
+
+void CCIDecompressor::FillBits(BYTE * pTarget, USHORT nTargetBits,
+ USHORT nBitPos, USHORT nNumBits,
+ BYTE nBlackOrWhite)
+{
+ if ( nBitPos >= nTargetBits )
+ return;
+ if ( nBitPos + nNumBits > nTargetBits )
+ nNumBits = nTargetBits - nBitPos;
+
+ pTarget+=nBitPos>>3;
+ nBitPos&=7;
+
+ if (nBlackOrWhite==0x00) *pTarget &= 0xff << (8-nBitPos);
+ else *pTarget |= 0xff >> nBitPos;
+ if (nNumBits>8-nBitPos) {
+ nNumBits-=8-nBitPos;
+ while (nNumBits>=8) {
+ *(++pTarget)=nBlackOrWhite;
+ nNumBits-=8;
+ }
+ if (nNumBits>0) *(++pTarget)=nBlackOrWhite;
+ }
+}
+
+
+USHORT CCIDecompressor::CountBits(const BYTE * pData, USHORT nDataSizeBits,
+ USHORT nBitPos, BYTE nBlackOrWhite)
+{
+ USHORT nPos,nLo;
+ BYTE nData;
+
+ // Hier wird die Anzahl der zusammenhaengenden Bits gezaehlt, die
+ // ab Position nBitPos in pTarget alle die Farbe nBlackOrWhite
+ // (0xff oder 0x00) haben.
+
+ nPos=nBitPos;
+ for (;;) {
+ if (nPos>=nDataSizeBits) {
+ nPos=nDataSizeBits;
+ break;
+ }
+ nData=pData[nPos>>3];
+ nLo=nPos & 7;
+ if ( nLo==0 && nData==nBlackOrWhite) nPos+=8;
+ else {
+ if ( ((nData^nBlackOrWhite) & (0x80 >> nLo))!=0) break;
+ nPos++;
+ }
+ }
+ if (nPos<=nBitPos) return 0;
+ else return nPos-nBitPos;
+}
+
+
+void CCIDecompressor::Read1DScanlineData(BYTE * pTarget, USHORT nTargetBits)
+{
+ USHORT nCode,nCodeBits,nDataBits,nTgtFreeByteBits;
+ BYTE nByte;
+ BYTE nBlackOrWhite; // ist 0xff fuer Black oder 0x00 fuer White
+ BOOL bTerminatingCode;
+
+ // Der erste Code ist immer eine "White-Code":
+ nBlackOrWhite=0x00;
+
+ // Anzahl der Bits, die im Byte *pTarget noch nicht geschrieben sind:
+ nTgtFreeByteBits=8;
+
+ // Schleife ueber Codes aus dem Eingabe-Stream:
+ do {
+
+ // die naechsten 13 Bits nach nCode holen, aber noch nicht
+ // aus dem Eingabe-Buffer loeschen:
+ while (nInputBitsBufSize<13) {
+ *pIStream >> nByte;
+ if ( nOptions & CCI_OPTION_INVERSEBITORDER )
+ nByte = pByteSwap[ nByte ];
+ nInputBitsBuf=(nInputBitsBuf<<8) | (ULONG)nByte;
+ nInputBitsBufSize+=8;
+ }
+ nCode=(USHORT)((nInputBitsBuf>>(nInputBitsBufSize-13))&0x1fff);
+
+ // Anzahl der DatenBits und Anzahl der CodeBits ermitteln:
+ if (nBlackOrWhite) {
+ nCodeBits=pBlackLookUp[nCode].nCodeBits;
+ nDataBits=pBlackLookUp[nCode].nValue;
+ }
+ else {
+ nCodeBits=pWhiteLookUp[nCode].nCodeBits;
+ nDataBits=pWhiteLookUp[nCode].nValue;
+ }
+ // Ist es ein Ungueltiger Code ?
+ if ( nDataBits == 9999 )
+ {
+ return;
+ }
+ if ( nCodeBits == 0 )
+ {
+ return; // das koennen sich jetzt um FuellBits handeln
+ }
+ nEOLCount = 0;
+ // Zuviele Daten ?
+ if (nDataBits>nTargetBits) {
+ // Ja, koennte ein Folge-Fehler durch ungueltigen Code sein,
+ // daher irdenwie weitermachen:
+ nDataBits=nTargetBits;
+ }
+
+ // Ist es ein 'Terminating-Code' ?
+ if (nDataBits<64) bTerminatingCode=TRUE; else bTerminatingCode=FALSE;
+
+ // Die gelesenen Bits aus dem Eingabe-Buffer entfernen:
+ nInputBitsBufSize = nInputBitsBufSize - nCodeBits;
+
+ // Die Anzahl Daten-Bits in die Scanline schreiben:
+ if (nDataBits>0) {
+ nTargetBits = nTargetBits - nDataBits;
+ if (nBlackOrWhite==0x00) *pTarget &= 0xff << nTgtFreeByteBits;
+ else *pTarget |= 0xff >> (8-nTgtFreeByteBits);
+ if (nDataBits<=nTgtFreeByteBits) {
+ if (nDataBits==nTgtFreeByteBits) {
+ pTarget++;
+ nTgtFreeByteBits=8;
+ }
+ else nTgtFreeByteBits = nTgtFreeByteBits - nDataBits;
+ }
+ else {
+ nDataBits = nDataBits - nTgtFreeByteBits;
+ pTarget++;
+ nTgtFreeByteBits=8;
+ while (nDataBits>=8) {
+ *(pTarget++)=nBlackOrWhite;
+ nDataBits-=8;
+ }
+ if (nDataBits>0) {
+ *pTarget=nBlackOrWhite;
+ nTgtFreeByteBits = nTgtFreeByteBits - nDataBits;
+ }
+ }
+ }
+
+ // ggf. Umschaltung Black <-> White:
+ if (bTerminatingCode==TRUE) nBlackOrWhite=~nBlackOrWhite;
+
+ } while (nTargetBits>0 || bTerminatingCode==FALSE);
+}
+
+
+
+void CCIDecompressor::Read2DScanlineData(BYTE * pTarget, USHORT nTargetBits)
+{
+ USHORT n2DMode,nBitPos,nUncomp,nRun,nRun2,nt;
+ BYTE nBlackOrWhite;
+
+ nBlackOrWhite=0x00;
+ nBitPos=0;
+
+ while (nBitPos<nTargetBits && bStatus==TRUE) {
+
+ n2DMode=ReadCodeAndDecode(p2DModeLookUp,10);
+ if (bStatus==FALSE) return;
+
+ if (n2DMode==CCI2DMODE_UNCOMP) {
+ for (;;) {
+ nUncomp=ReadCodeAndDecode(pUncompLookUp,11);
+ if ( nUncomp <= CCIUNCOMP_4White_1Black ) {
+ nRun=nUncomp-CCIUNCOMP_0White_1Black;
+ FillBits(pTarget,nTargetBits,nBitPos,nRun,0x00);
+ nBitPos = nBitPos + nRun;
+ FillBits(pTarget,nTargetBits,nBitPos,1,0xff);
+ nBitPos++;
+ }
+ else if ( nUncomp == CCIUNCOMP_5White ) {
+ FillBits(pTarget,nTargetBits,nBitPos,5,0x00);
+ nBitPos = nBitPos + 5;
+ }
+ else {
+ nRun=nUncomp-CCIUNCOMP_0White_End;
+ FillBits(pTarget,nTargetBits,nBitPos,nRun,0x00);
+ nBitPos = nBitPos + nRun;
+ nBlackOrWhite=ReadBlackOrWhite();
+ break;
+ }
+ }
+ }
+
+ else if (n2DMode==CCI2DMODE_PASS) {
+ if (nBitPos==0 && nBlackOrWhite==0x00 && CountBits(pLastLine,nTargetBits,0,0xff)!=0) nRun=0;
+ else {
+ nRun=CountBits(pLastLine,nTargetBits,nBitPos,~nBlackOrWhite);
+ nRun = nRun + CountBits(pLastLine,nTargetBits,nBitPos+nRun,nBlackOrWhite);
+ }
+ nRun = nRun + CountBits(pLastLine,nTargetBits,nBitPos+nRun,~nBlackOrWhite);
+ FillBits(pTarget,nTargetBits,nBitPos,nRun,nBlackOrWhite);
+ nBitPos = nBitPos + nRun;
+ }
+
+ else if (n2DMode==CCI2DMODE_HORZ) {
+ if (nBlackOrWhite==0x00) {
+ nRun=0;
+ do {
+ nt=ReadCodeAndDecode(pWhiteLookUp,13);
+ nRun = nRun + nt;
+ } while (nt>=64);
+ nRun2=0;
+ do {
+ nt=ReadCodeAndDecode(pBlackLookUp,13);
+ nRun2 = nRun2 + nt;
+ } while (nt>=64);
+ }
+ else {
+ nRun=0;
+ do {
+ nt=ReadCodeAndDecode(pBlackLookUp,13);
+ nRun = nRun + nt;
+ } while (nt>=64);
+ nRun2=0;
+ do {
+ nt=ReadCodeAndDecode(pWhiteLookUp,13);
+ nRun2 = nRun2 + nt;
+ } while (nt>=64);
+ }
+ FillBits(pTarget,nTargetBits,nBitPos,nRun,nBlackOrWhite);
+ nBitPos = nBitPos + nRun;
+ FillBits(pTarget,nTargetBits,nBitPos,nRun2,~nBlackOrWhite);
+ nBitPos = nBitPos + nRun2;
+ }
+
+ else { // Es ist einer der Modi CCI2DMODE_VERT_...
+ if (nBitPos==0 && nBlackOrWhite==0x00 && CountBits(pLastLine,nTargetBits,0,0xff)!=0) nRun=0;
+ else {
+ nRun=CountBits(pLastLine,nTargetBits,nBitPos,~nBlackOrWhite);
+ nRun = nRun + CountBits(pLastLine,nTargetBits,nBitPos+nRun,nBlackOrWhite);
+ }
+ nRun+=n2DMode-CCI2DMODE_VERT_0;
+ FillBits(pTarget,nTargetBits,nBitPos,nRun,nBlackOrWhite);
+ nBitPos = nBitPos + nRun;
+ nBlackOrWhite=~nBlackOrWhite;
+ }
+ }
+}
+
+
diff --git a/filter/source/graphicfilter/itiff/ccidecom.hxx b/filter/source/graphicfilter/itiff/ccidecom.hxx
new file mode 100644
index 000000000000..2543be82d052
--- /dev/null
+++ b/filter/source/graphicfilter/itiff/ccidecom.hxx
@@ -0,0 +1,125 @@
+/*************************************************************************
+ *
+ * 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 _CCIDECOM_HXX
+#define _CCIDECOM_HXX
+
+#include <tools/stream.hxx>
+
+
+#define CCI_OPTION_2D 1 // 2D-Komprimierung (statt 1D)
+#define CCI_OPTION_EOL 2 // EOL-Codes am Ende jeder Zeile vorhanden
+#define CCI_OPTION_BYTEALIGNEOL 4 // Fuellbits vor jedem EOL-Code, so dass
+ // Ende von EOL auf Bytes aligend
+#define CCI_OPTION_BYTEALIGNROW 8 // Rows beginnen immer auf Byte-Grenze
+#define CCI_OPTION_INVERSEBITORDER 16
+
+// Eintrag in eine Huffman-Tabelle:
+struct CCIHuffmanTableEntry {
+ USHORT nValue; // Der Daten-Wert.
+ USHORT nCode; // Der Code durch den der Daten-Wert repraesentiert wird.
+ USHORT nCodeBits; // Laenge des Codes in Bits.
+};
+
+
+// Eintrag in eine Hash-Tabelle zur schnellen Dekodierung
+struct CCILookUpTableEntry {
+ USHORT nValue;
+ USHORT nCodeBits;
+};
+
+
+class CCIDecompressor {
+
+public:
+
+ CCIDecompressor( ULONG nOptions, UINT32 nImageWidth );
+ ~CCIDecompressor();
+
+ void StartDecompression( SvStream & rIStream );
+
+ BOOL DecompressScanline(BYTE * pTarget, ULONG nTargetBits );
+
+private:
+
+ void MakeLookUp(const CCIHuffmanTableEntry * pHufTab,
+ const CCIHuffmanTableEntry * pHufTabSave,
+ CCILookUpTableEntry * pLookUp,
+ USHORT nHuffmanTableSize,
+ USHORT nMaxCodeBits);
+
+ BOOL ReadEOL( UINT32 nMaxFillBits );
+
+ BOOL Read2DTag();
+
+ BYTE ReadBlackOrWhite();
+
+ USHORT ReadCodeAndDecode(const CCILookUpTableEntry * pLookUp,
+ USHORT nMaxCodeBits);
+
+ void FillBits(BYTE * pTarget, USHORT nTargetBits,
+ USHORT nBitPos, USHORT nNumBits,
+ BYTE nBlackOrWhite);
+
+ USHORT CountBits(const BYTE * pData, USHORT nDataSizeBits,
+ USHORT nBitPos, BYTE nBlackOrWhite);
+
+ void Read1DScanlineData(BYTE * pTarget, USHORT nTargetBits);
+
+ void Read2DScanlineData(BYTE * pTarget, USHORT nTargetBits);
+
+ BOOL bTableBad;
+
+ BOOL bStatus;
+
+ BYTE* pByteSwap;
+
+ SvStream * pIStream;
+
+ UINT32 nEOLCount;
+
+ UINT32 nWidth;
+
+ ULONG nOptions;
+
+ BOOL bFirstEOL;
+
+ CCILookUpTableEntry * pWhiteLookUp;
+ CCILookUpTableEntry * pBlackLookUp;
+ CCILookUpTableEntry * p2DModeLookUp;
+ CCILookUpTableEntry * pUncompLookUp;
+
+ ULONG nInputBitsBuf;
+ USHORT nInputBitsBufSize;
+
+ BYTE * pLastLine;
+ ULONG nLastLineSize;
+};
+
+
+#endif
+
diff --git a/filter/source/graphicfilter/itiff/exports.map b/filter/source/graphicfilter/itiff/exports.map
new file mode 100644
index 000000000000..941e4ab9bde8
--- /dev/null
+++ b/filter/source/graphicfilter/itiff/exports.map
@@ -0,0 +1,7 @@
+UDK_3_0_0 {
+ global:
+ GraphicImport;
+
+ local:
+ *;
+};
diff --git a/filter/source/graphicfilter/itiff/itiff.cxx b/filter/source/graphicfilter/itiff/itiff.cxx
new file mode 100644
index 000000000000..5ad400fc3149
--- /dev/null
+++ b/filter/source/graphicfilter/itiff/itiff.cxx
@@ -0,0 +1,1342 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+#include <vcl/graph.hxx>
+#include <vcl/bmpacc.hxx>
+#ifndef _SV_FLTCALL_HXX
+#include <svtools/fltcall.hxx>
+#endif
+#include <vcl/animate.hxx>
+#include "lzwdecom.hxx"
+#include "ccidecom.hxx"
+
+#define OOODEBUG(str,Num) //(InfoBox(NULL,String(str)+String(" ")+String(Num)).Execute();
+
+namespace {
+
+template< typename T > T BYTESWAP(T nByte) {
+ return ( nByte << 7 ) | ( ( nByte & 2 ) << 5 ) | ( ( nByte & 4 ) << 3 ) |
+ ( ( nByte & 8 ) << 1 ) | ( ( nByte & 16 ) >> 1 ) |
+ ( ( nByte & 32 ) >> 3 ) | ( ( nByte & 64 ) >> 5 ) |
+ ( ( nByte & 128 ) >> 7 );
+}
+
+}
+
+//============================ TIFFReader ==================================
+
+class TIFFReader
+{
+
+private:
+
+ BOOL bStatus; // Ob bisher kein Fehler auftrat
+ Animation aAnimation;
+ ULONG nLastPercent;
+
+ SvStream* pTIFF; // Die einzulesende TIFF-Datei
+ Bitmap aBitmap;
+ BitmapWriteAccess* pAcc;
+ USHORT nDstBitsPerPixel;
+
+ ULONG nOrigPos; // Anfaengliche Position in pTIFF
+ UINT16 nOrigNumberFormat; // Anfaengliches Nummern-Format von pTIFF
+
+
+ UINT16 nDataType;
+ // Daten, die aus dem TIFF-Tags entnommen werden:
+ BOOL bByteSwap; // TRUE wenn bits 0..7 -> 7..0 invertiert werden sollen ( FILLORDER = 2 );
+ BYTE nByte1; // 'I', wenn Format LittleEndian
+
+ ULONG nNewSubFile; //
+ ULONG nSubFile; //
+ ULONG nImageWidth; // Bildbreite in Pixel
+ ULONG nImageLength; // Bildhoehe in Pixel
+ ULONG nBitsPerSample; // Bits pro Pixel pro Ebene
+ ULONG nCompression; // Art der Kompriemierung
+ ULONG nPhotometricInterpretation; //
+ ULONG nThresholding; //
+ ULONG nCellWidth; //
+ ULONG nCellLength; //
+ ULONG nFillOrder; //
+ ULONG* pStripOffsets; // Feld von Offsets zu den Bitmap-Daten-"Strips"
+ ULONG nNumStripOffsets; // Groesse obigen Feldes
+ ULONG nOrientation; //
+ ULONG nSamplesPerPixel; // Anzahl der Ebenen
+ ULONG nRowsPerStrip; // Wenn nicht komprimiert: Zahl der Zeilen pro Strip
+ ULONG* pStripByteCounts; // Wenn komprimiert (bestimmte Art): Groesse der Strips
+ ULONG nNumStripByteCounts; // Anzahl der Eintraege in obiges Feld
+ ULONG nMinSampleValue; //
+ ULONG nMaxSampleValue; //
+ double fXResolution; // X-Aufloesung oder 0.0
+ double fYResolution; // Y-Aufloesung oder 0.0
+ ULONG nPlanarConfiguration; //
+ ULONG nGroup3Options; //
+ ULONG nGroup4Options; //
+ ULONG nResolutionUnit; // Einheit von fX/YResolution: 1=unbekannt, 2(default)=Zoll, 3=cm
+ ULONG nPredictor; //
+ ULONG* pColorMap; // Farb-Palette
+ ULONG nNumColors; // Anzahl Farben in der Farbpalette
+
+ ULONG nPlanes; // Anzahl der Ebenen in der Tiff-Datei
+ ULONG nStripsPerPlane; // Anzahl der Strips pro Ebene
+ ULONG nBytesPerRow; // Bytes pro Zeile pro Ebene in der Tiff-Datei ( unkomprimiert )
+ BYTE* pMap[ 4 ]; // Temporaere Scanline
+
+
+ void MayCallback( ULONG nPercent );
+
+ ULONG DataTypeSize();
+ ULONG ReadIntData();
+ double ReadDoubleData();
+
+ void ReadHeader();
+ void ReadTagData( USHORT nTagType, sal_uInt32 nDataLen );
+
+ BOOL ReadMap( ULONG nMinPercent, ULONG nMaxPercent );
+ // Liesst/dekomprimert die Bitmap-Daten, und fuellt pMap
+
+ ULONG GetBits( const BYTE * pSrc, ULONG nBitsPos, ULONG nBitsCount );
+ // Holt nBitsCount Bits aus pSrc[..] an der Bit-Position nBitsPos
+
+ void MakePalCol( void );
+ // Erzeugt die Bitmap aus der temporaeren Bitmap pMap
+ // und loescht dabei pMap teilweise
+ BOOL ConvertScanline( ULONG nY );
+ // Konvertiert eine Scanline in das Windows-BMP-Format
+
+public:
+
+ TIFFReader() {}
+ ~TIFFReader() {}
+
+ BOOL ReadTIFF( SvStream & rTIFF, Graphic & rGraphic );
+};
+
+//=================== Methoden von TIFFReader ==============================
+
+void TIFFReader::MayCallback( ULONG /*nPercent*/ )
+{
+/*
+ if ( nPercent >= nLastPercent + 3 )
+ {
+ nLastPercent=nPercent;
+ if ( pCallback != NULL && nPercent <= 100 && bStatus == TRUE )
+ {
+ if (((*pCallback)(pCallerData,(USHORT)nPercent)) == TRUE )
+ bStatus = FALSE;
+ }
+ }
+*/
+}
+
+// ---------------------------------------------------------------------------------
+
+ULONG TIFFReader::DataTypeSize()
+{
+ ULONG nSize;
+ switch ( nDataType )
+ {
+ case 1 : // BYTE
+ case 2 : // ACSII
+ case 6 : // SIGNED Byte
+ case 7 : // UNDEFINED
+ nSize = 1;
+ break;
+ case 3 : // UINT16
+ case 8 : // INT16
+ nSize = 2;
+ break;
+ case 4 : // UINT32
+ case 9 : // INT32
+ case 11 : // FLOAT
+ nSize = 4;
+ break;
+ case 5 : // RATIONAL
+ case 10 : // SIGNED RATINAL
+ case 12 : // DOUBLE
+ nSize = 8;
+ break;
+ default:
+ pTIFF->SetError(SVSTREAM_FILEFORMAT_ERROR);
+ nSize=1;
+ }
+ return nSize;
+}
+
+// ---------------------------------------------------------------------------------
+
+ULONG TIFFReader::ReadIntData()
+{
+ double nDOUBLE;
+ float nFLOAT;
+ UINT32 nUINT32a, nUINT32b;
+ INT32 nINT32;
+ UINT16 nUINT16;
+ INT16 nINT16;
+ BYTE nBYTE;
+ char nCHAR;
+
+ switch( nDataType )
+ {
+ case 0 : //??
+ case 1 :
+ case 2 :
+ case 7 :
+ *pTIFF >> nBYTE;
+ nUINT32a = (ULONG)nBYTE;
+ break;
+ case 3 :
+ *pTIFF >> nUINT16;
+ nUINT32a = (ULONG)nUINT16;
+ break;
+ case 9 :
+ case 4 :
+ *pTIFF >> nUINT32a;
+ break;
+ case 5 :
+ *pTIFF >> nUINT32a >> nUINT32b;
+ if ( nUINT32b != 0 )
+ nUINT32a /= nUINT32b;
+ break;
+ case 6 :
+ *pTIFF >> nCHAR;
+ nUINT32a = (INT32)nCHAR;
+ break;
+ case 8 :
+ *pTIFF >> nINT16;
+ nUINT32a = (INT32)nINT16;
+ break;
+ case 10 :
+ *pTIFF >> nUINT32a >> nINT32;
+ if ( nINT32 != 0 )
+ nUINT32a /= nINT32;
+ break;
+ case 11 :
+ *pTIFF >> nFLOAT;
+ nUINT32a = (INT32)nFLOAT;
+ break;
+ case 12 :
+ *pTIFF >> nDOUBLE;
+ nUINT32a = (INT32)nDOUBLE;
+ break;
+ default:
+ *pTIFF >> nUINT32a;
+ break;
+ }
+ return nUINT32a;
+}
+
+// ---------------------------------------------------------------------------------
+
+double TIFFReader::ReadDoubleData()
+{
+ sal_uInt32 nulong;
+ double nd;
+
+ if ( nDataType == 5 )
+ {
+ *pTIFF >> nulong;
+ nd = (double)nulong;
+ *pTIFF >> nulong;
+ if ( nulong != 0 )
+ nd /= (double)nulong;
+ }
+ else
+ nd = (double)ReadIntData();
+ return nd;
+}
+
+// ---------------------------------------------------------------------------------
+
+void TIFFReader::ReadTagData( USHORT nTagType, sal_uInt32 nDataLen)
+{
+ if ( bStatus == FALSE )
+ return;
+
+ switch ( nTagType )
+ {
+ case 0x00fe: // New Sub File
+ nNewSubFile = ReadIntData();
+ OOODEBUG("NewSubFile",nNewSubFile);
+ break;
+
+ case 0x00ff: // Sub File
+ nSubFile = ReadIntData();
+ OOODEBUG("SubFile",nSubFile);
+ break;
+
+ case 0x0100: // Image Width
+ nImageWidth = ReadIntData();
+ OOODEBUG("ImageWidth",nImageWidth);
+ break;
+
+ case 0x0101: // Image Length
+ nImageLength = ReadIntData();
+ OOODEBUG("ImageLength",nImageLength);
+ break;
+
+ case 0x0102: // Bits Per Sample
+ nBitsPerSample = ReadIntData();
+ OOODEBUG("BitsPerSample",nBitsPerSample);
+ break;
+
+ case 0x0103: // Compression
+ nCompression = ReadIntData();
+ OOODEBUG("Compression",nCompression);
+ break;
+
+ case 0x0106: // Photometric Interpreation
+ nPhotometricInterpretation = ReadIntData();
+ OOODEBUG("PhotometricInterpretation",nPhotometricInterpretation);
+ break;
+
+ case 0x0107: // Thresholding
+ nThresholding = ReadIntData();
+ OOODEBUG("Thresholding",nThresholding);
+ break;
+
+ case 0x0108: // Cell Width
+ nCellWidth = ReadIntData();
+ break;
+
+ case 0x0109: // Cell Length
+ nCellLength = ReadIntData();
+ break;
+
+ case 0x010a: // Fill Order
+ nFillOrder = ReadIntData();
+ OOODEBUG("FillOrder",nFillOrder);
+ break;
+
+ case 0x0111: { // Strip Offset(s)
+ ULONG nOldNumSO, i, * pOldSO;
+ pOldSO = pStripOffsets;
+ if ( pOldSO == NULL )
+ nNumStripOffsets = 0;
+ nOldNumSO = nNumStripOffsets;
+ nDataLen += nOldNumSO;
+ if ( ( nDataLen > nOldNumSO ) && ( nDataLen < SAL_MAX_UINT32 / sizeof( sal_uInt32 ) ) )
+ {
+ nNumStripOffsets = nDataLen;
+ try
+ {
+ pStripOffsets = new ULONG[ nNumStripOffsets ];
+ }
+ catch (std::bad_alloc)
+ {
+ pStripOffsets = NULL;
+ nNumStripOffsets = 0;
+ }
+ if ( pStripOffsets )
+ {
+ for ( i = 0; i < nOldNumSO; i++ )
+ pStripOffsets[ i ] = pOldSO[ i ] + nOrigPos;
+ for ( i = nOldNumSO; i < nNumStripOffsets; i++ )
+ pStripOffsets[ i ] = ReadIntData() + nOrigPos;
+ }
+ delete[] pOldSO;
+ }
+ OOODEBUG("StripOffsets (Anzahl:)",nDataLen);
+ break;
+ }
+ case 0x0112: // Orientation
+ nOrientation = ReadIntData();
+ OOODEBUG("Orientation",nOrientation);
+ break;
+
+ case 0x0115: // Samples Per Pixel
+ nSamplesPerPixel = ReadIntData();
+ OOODEBUG("SamplesPerPixel",nSamplesPerPixel);
+ break;
+
+ case 0x0116: // Rows Per Strip
+ nRowsPerStrip = ReadIntData();
+ OOODEBUG("RowsPerStrip",nRowsPerStrip);
+ break;
+
+ case 0x0117: { // Strip Byte Counts
+ ULONG nOldNumSBC, i, * pOldSBC;
+ pOldSBC = pStripByteCounts;
+ if ( pOldSBC == NULL )
+ nNumStripByteCounts = 0; // Sicherheitshalber
+ nOldNumSBC = nNumStripByteCounts;
+ nDataLen += nOldNumSBC;
+ if ( ( nDataLen > nOldNumSBC ) && ( nDataLen < SAL_MAX_UINT32 / sizeof( sal_uInt32 ) ) )
+ {
+ nNumStripByteCounts = nDataLen;
+ try
+ {
+ pStripByteCounts = new ULONG[ nNumStripByteCounts ];
+ }
+ catch (std::bad_alloc)
+ {
+ pStripByteCounts = NULL;
+ nNumStripByteCounts = 0;
+ }
+ if ( pStripByteCounts )
+ {
+ for ( i = 0; i < nOldNumSBC; i++ )
+ pStripByteCounts[ i ] = pOldSBC[ i ];
+ for ( i = nOldNumSBC; i < nNumStripByteCounts; i++)
+ pStripByteCounts[ i ] = ReadIntData();
+ }
+ delete[] pOldSBC;
+ }
+ OOODEBUG("StripByteCounts (Anzahl:)",nDataLen);
+ break;
+ }
+ case 0x0118: // Min Sample Value
+ nMinSampleValue = ReadIntData();
+ OOODEBUG("MinSampleValue",nMinSampleValue);
+ break;
+
+ case 0x0119: // Max Sample Value
+ nMaxSampleValue = ReadIntData();
+ OOODEBUG("MaxSampleValue",nMaxSampleValue);
+ break;
+
+ case 0x011a: // X Resolution
+ fXResolution = ReadDoubleData();
+ break;
+
+ case 0x011b: // Y Resolution
+ fYResolution = ReadDoubleData();
+ break;
+
+ case 0x011c: // Planar Configuration
+ nPlanarConfiguration = ReadIntData();
+ OOODEBUG("PlanarConfiguration",nPlanarConfiguration);
+ break;
+
+ case 0x0124: // Group 3 Options
+ nGroup3Options = ReadIntData();
+ OOODEBUG("Group3Options",nGroup3Options);
+ break;
+
+ case 0x0125: // Group 4 Options
+ nGroup4Options = ReadIntData();
+ OOODEBUG("Group4Options",nGroup4Options);
+ break;
+
+ case 0x0128: // Resolution Unit
+ nResolutionUnit = ReadIntData();
+ break;
+
+ case 0x013d: // Predictor
+ nPredictor = ReadIntData();
+ OOODEBUG("Predictor",nPredictor);
+ break;
+
+ case 0x0140: { // Color Map
+ USHORT nVal;
+ ULONG i;
+ nNumColors= ( 1 << nBitsPerSample );
+ if ( nDataType == 3 && nNumColors <= 256)
+ {
+ pColorMap = new ULONG[ 256 ];
+ for ( i = 0; i < nNumColors; i++ )
+ pColorMap[ i ] = 0;
+ for ( i = 0; i < nNumColors; i++ )
+ {
+ *pTIFF >> nVal;
+ pColorMap[ i ] |= ( ( (ULONG)nVal ) << 8 ) & 0x00ff0000;
+ }
+ for ( i = 0; i < nNumColors; i++ )
+ {
+ *pTIFF >> nVal;
+ pColorMap[ i ] |= ( (ULONG)nVal ) & 0x0000ff00;
+ }
+ for ( i = 0; i < nNumColors; i++ )
+ {
+ *pTIFF >> nVal;
+ pColorMap[ i ] |= ( ( (ULONG)nVal ) >> 8 ) & 0x000000ff;
+ }
+ }
+ else
+ bStatus = FALSE;
+ OOODEBUG("ColorMap (Anzahl Farben:)", nNumColors);
+ break;
+ }
+ }
+
+ if ( pTIFF->GetError() )
+ bStatus = FALSE;
+}
+
+// ---------------------------------------------------------------------------------
+
+BOOL TIFFReader::ReadMap( ULONG nMinPercent, ULONG nMaxPercent )
+{
+ if ( nCompression == 1 || nCompression == 32771 )
+ {
+ ULONG ny, np, nStrip, nStripBytesPerRow;
+
+ if ( nCompression == 1 )
+ nStripBytesPerRow = nBytesPerRow;
+ else
+ nStripBytesPerRow = ( nBytesPerRow + 1 ) & 0xfffffffe;
+ for ( ny = 0; ny < nImageLength; ny++ )
+ {
+ for ( np = 0; np < nPlanes; np++ )
+ {
+ nStrip = ny / nRowsPerStrip + np * nStripsPerPlane;
+ if ( nStrip >= nNumStripOffsets )
+ return FALSE;
+ pTIFF->Seek( pStripOffsets[ nStrip ] + ( ny % nRowsPerStrip ) * nStripBytesPerRow );
+ pTIFF->Read( pMap[ np ], nBytesPerRow );
+ if ( pTIFF->GetError() )
+ return FALSE;
+ MayCallback( nMinPercent + ( nMaxPercent - nMinPercent ) * ( np * nImageLength + ny) / ( nImageLength * nPlanes ) );
+ }
+ if ( !ConvertScanline( ny ) )
+ return FALSE;
+ }
+ }
+ else if ( nCompression == 2 || nCompression == 3 || nCompression == 4 )
+ {
+ ULONG ny, np, nStrip, nOptions;
+ if ( nCompression == 2 )
+ {
+ nOptions = CCI_OPTION_BYTEALIGNROW;
+ }
+ else if ( nCompression == 3 )
+ {
+ nOptions = CCI_OPTION_EOL;
+ if ( nGroup3Options & 0x00000001 )
+ nOptions |= CCI_OPTION_2D;
+ if ( nGroup3Options & 0x00000004 )
+ nOptions |= CCI_OPTION_BYTEALIGNEOL;
+ if ( nGroup3Options & 0xfffffffa )
+ return FALSE;
+ }
+ else
+ { // nCompression==4
+ nOptions = CCI_OPTION_2D;
+ if ( nGroup4Options & 0xffffffff )
+ return FALSE;
+ }
+ if ( nFillOrder == 2 )
+ {
+ nOptions |= CCI_OPTION_INVERSEBITORDER;
+ bByteSwap = FALSE;
+ }
+ nStrip = 0;
+ if ( nStrip >= nNumStripOffsets )
+ return FALSE;
+ pTIFF->Seek(pStripOffsets[nStrip]);
+
+ CCIDecompressor aCCIDecom( nOptions, nImageWidth );
+
+ aCCIDecom.StartDecompression( *pTIFF );
+
+ for ( ny = 0; ny < nImageLength; ny++ )
+ {
+ for ( np = 0; np < nPlanes; np++ )
+ {
+ if ( ny / nRowsPerStrip + np * nStripsPerPlane > nStrip )
+ {
+ nStrip=ny/nRowsPerStrip+np*nStripsPerPlane;
+ if ( nStrip >= nNumStripOffsets )
+ return FALSE;
+ pTIFF->Seek( pStripOffsets[ nStrip ] );
+ aCCIDecom.StartDecompression( *pTIFF );
+ }
+ if ( aCCIDecom.DecompressScanline( pMap[ np ], nImageWidth * nBitsPerSample * nSamplesPerPixel / nPlanes ) == FALSE )
+ return FALSE;
+ if ( pTIFF->GetError() )
+ return FALSE;
+ MayCallback(nMinPercent+(nMaxPercent-nMinPercent)*(np*nImageLength+ny)/(nImageLength*nPlanes));
+ }
+ if ( !ConvertScanline( ny ) )
+ return FALSE;
+ }
+ }
+ else if ( nCompression == 5 )
+ {
+ LZWDecompressor aLZWDecom;
+ ULONG ny, np, nStrip;
+ nStrip=0;
+ if ( nStrip >= nNumStripOffsets )
+ return FALSE;
+ pTIFF->Seek(pStripOffsets[nStrip]);
+ aLZWDecom.StartDecompression(*pTIFF);
+ for ( ny = 0; ny < nImageLength; ny++ )
+ {
+ for ( np = 0; np < nPlanes; np++ )
+ {
+ if ( ny / nRowsPerStrip + np * nStripsPerPlane > nStrip )
+ {
+ nStrip = ny / nRowsPerStrip + np * nStripsPerPlane;
+ if ( nStrip >= nNumStripOffsets )
+ return FALSE;
+ pTIFF->Seek(pStripOffsets[nStrip]);
+ aLZWDecom.StartDecompression(*pTIFF);
+ }
+ if ( ( aLZWDecom.Decompress( pMap[ np ], nBytesPerRow ) != nBytesPerRow ) || pTIFF->GetError() )
+ return FALSE;
+ MayCallback(nMinPercent+(nMaxPercent-nMinPercent)*(np*nImageLength+ny)/(nImageLength*nPlanes));
+ }
+ if ( !ConvertScanline( ny ) )
+ return FALSE;
+ }
+ }
+ else if ( nCompression == 32773 )
+ {
+ ULONG nStrip,nRecCount,nRowBytesLeft,ny,np,i;
+ BYTE * pdst, nRecHeader, nRecData;
+ nStrip = 0;
+ if ( nStrip >= nNumStripOffsets )
+ return FALSE;
+ pTIFF->Seek(pStripOffsets[nStrip]);
+ for ( ny = 0; ny < nImageLength; ny++ )
+ {
+ for ( np = 0; np < nPlanes; np++ )
+ {
+ if ( ny / nRowsPerStrip + np * nStripsPerPlane > nStrip )
+ {
+ nStrip=ny/nRowsPerStrip+np*nStripsPerPlane;
+ if ( nStrip >= nNumStripOffsets )
+ return FALSE;
+ pTIFF->Seek(pStripOffsets[nStrip]);
+ }
+ nRowBytesLeft = nBytesPerRow;
+ pdst=pMap[ np ];
+ do
+ {
+ *pTIFF >> nRecHeader;
+ if ((nRecHeader&0x80)==0)
+ {
+ nRecCount=0x00000001+((ULONG)nRecHeader);
+ if ( nRecCount > nRowBytesLeft )
+ return FALSE;
+ pTIFF->Read(pdst,nRecCount);
+ pdst+=nRecCount;
+ nRowBytesLeft-=nRecCount;
+ }
+ else if ( nRecHeader != 0x80 )
+ {
+ nRecCount = 0x000000101 - ( (ULONG)nRecHeader );
+ if ( nRecCount > nRowBytesLeft )
+ {
+ nRecCount = nRowBytesLeft;
+
+// bStatus = FALSE;
+// return;
+
+ }
+ *pTIFF >> nRecData;
+ for ( i = 0; i < nRecCount; i++ )
+ *(pdst++) = nRecData;
+ nRowBytesLeft -= nRecCount;
+ }
+ } while ( nRowBytesLeft != 0 );
+ if ( pTIFF->GetError() )
+ return FALSE;
+ MayCallback(nMinPercent+(nMaxPercent-nMinPercent)*(np*nImageLength+ny)/(nImageLength*nPlanes));
+ }
+ if ( !ConvertScanline( ny ) )
+ return FALSE;
+ }
+ }
+ else
+ return FALSE;
+ return TRUE;
+}
+
+ULONG TIFFReader::GetBits( const BYTE * pSrc, ULONG nBitsPos, ULONG nBitsCount )
+{
+ ULONG nRes;
+ if ( bByteSwap )
+ {
+ pSrc += ( nBitsPos >> 3 );
+ nBitsPos &= 7;
+ BYTE nDat = *pSrc;
+ nRes = (ULONG)( BYTESWAP( nDat ) & ( 0xff >> nBitsPos ) );
+
+ if ( nBitsCount <= 8 - nBitsPos )
+ {
+ nRes >>= ( 8 - nBitsPos - nBitsCount );
+ }
+ else
+ {
+ pSrc++;
+ nBitsCount -= 8 - nBitsPos;
+ while ( nBitsCount >= 8 )
+ {
+ nDat = *(pSrc++);
+ nRes = ( nRes << 8 ) | ((ULONG)BYTESWAP( nDat ) );
+ nBitsCount -= 8;
+ }
+ if ( nBitsCount > 0 )
+ {
+ nDat = *pSrc;
+ nRes = ( nRes << nBitsCount ) | (((ULONG)BYTESWAP(nDat))>>(8-nBitsCount));
+ }
+ }
+ }
+ else
+ {
+ pSrc += ( nBitsPos >> 3 );
+ nBitsPos &= 7;
+ nRes = (ULONG)((*pSrc)&(0xff>>nBitsPos));
+ if ( nBitsCount <= 8 - nBitsPos )
+ {
+ nRes >>= ( 8 - nBitsPos - nBitsCount );
+ }
+ else
+ {
+ pSrc++;
+ nBitsCount -= 8 - nBitsPos;
+ while ( nBitsCount >= 8 )
+ {
+ nRes = ( nRes << 8 ) | ((ULONG)*(pSrc++));
+ nBitsCount -= 8;
+ }
+ if ( nBitsCount > 0 )
+ nRes = ( nRes << nBitsCount ) | (((ULONG)*pSrc)>>(8-nBitsCount));
+ }
+ }
+ return nRes;
+}
+
+// ---------------------------------------------------------------------------------
+
+BOOL TIFFReader::ConvertScanline( ULONG nY )
+{
+ UINT32 nRed, nGreen, nBlue, ns, nx, nVal, nByteCount;
+ BYTE nByteVal;
+
+ if ( nDstBitsPerPixel == 24 )
+ {
+ if ( nBitsPerSample == 8 && nSamplesPerPixel >= 3 &&
+ nPlanes == 1 && nPhotometricInterpretation == 2 )
+ {
+ BYTE* pt = pMap[ 0 ];
+
+ // sind die Werte als Differenz abgelegt?
+ if ( 2 == nPredictor )
+ {
+ BYTE nLRed = 0;
+ BYTE nLGreen = 0;
+ BYTE nLBlue = 0;
+ for ( nx = 0; nx < nImageWidth; nx++, pt += nSamplesPerPixel )
+ {
+ nLRed = nLRed + pt[ 0 ];
+ nLGreen = nLGreen + pt[ 1 ];
+ nLBlue = nLBlue + pt[ 2 ];
+ pAcc->SetPixel( nY, nx, Color( nLRed, nLGreen, nLBlue ) );
+ }
+ }
+ else
+ {
+ for ( nx = 0; nx < nImageWidth; nx++, pt += nSamplesPerPixel )
+ {
+ pAcc->SetPixel( nY, nx, Color( pt[0], pt[1], pt[2] ) );
+ }
+ }
+ }
+ else if ( nPhotometricInterpretation == 2 && nSamplesPerPixel >= 3 )
+ {
+ ULONG nMinMax = nMinSampleValue * 255 / ( nMaxSampleValue - nMinSampleValue );
+ for ( nx = 0; nx < nImageWidth; nx++ )
+ {
+ if ( nPlanes < 3 )
+ {
+ nRed = GetBits( pMap[ 0 ], ( nx * nSamplesPerPixel + 0 ) * nBitsPerSample, nBitsPerSample );
+ nGreen = GetBits( pMap[ 1 ], ( nx * nSamplesPerPixel + 1 ) * nBitsPerSample, nBitsPerSample );
+ nBlue = GetBits( pMap[ 2 ], ( nx * nSamplesPerPixel + 2 ) * nBitsPerSample, nBitsPerSample );
+ }
+ else
+ {
+ nRed = GetBits( pMap[ 0 ], nx * nBitsPerSample, nBitsPerSample );
+ nGreen = GetBits( pMap[ 1 ], nx * nBitsPerSample, nBitsPerSample );
+ nBlue = GetBits( pMap[ 2 ], nx * nBitsPerSample, nBitsPerSample );
+ }
+ pAcc->SetPixel( nY, nx, Color( (BYTE)( nRed - nMinMax ), (BYTE)( nGreen - nMinMax ), (BYTE)(nBlue - nMinMax) ) );
+ }
+ }
+ else if ( nPhotometricInterpretation == 5 && nSamplesPerPixel == 3 )
+ {
+ ULONG nMinMax = nMinSampleValue * 255 / ( nMaxSampleValue - nMinSampleValue );
+ for ( nx = 0; nx < nImageWidth; nx++ )
+ {
+ if ( nPlanes < 3 )
+ {
+ nRed = GetBits( pMap[ 0 ],( nx * nSamplesPerPixel + 0 ) * nBitsPerSample, nBitsPerSample );
+ nGreen = GetBits( pMap[ 0 ],( nx * nSamplesPerPixel + 1 ) * nBitsPerSample, nBitsPerSample );
+ nBlue = GetBits( pMap[ 0 ],( nx * nSamplesPerPixel + 2 ) * nBitsPerSample, nBitsPerSample );
+ }
+ else
+ {
+ nRed = GetBits( pMap[ 0 ], nx * nBitsPerSample, nBitsPerSample );
+ nGreen = GetBits( pMap[ 1 ], nx * nBitsPerSample, nBitsPerSample );
+ nBlue = GetBits( pMap[ 2 ], nx * nBitsPerSample, nBitsPerSample );
+ }
+ nRed = 255 - (BYTE)( nRed - nMinMax );
+ nGreen = 255 - (BYTE)( nGreen - nMinMax );
+ nBlue = 255 - (BYTE)( nBlue - nMinMax );
+ pAcc->SetPixel( nY, nx, Color( (BYTE) nRed, (BYTE) nGreen, (BYTE) nBlue ) );
+ }
+ }
+ else if( nPhotometricInterpretation == 5 && nSamplesPerPixel == 4 )
+ {
+ BYTE nSamp[ 4 ];
+ BYTE nSampLast[ 4 ] = { 0, 0, 0, 0 };
+ long nBlack;
+
+ for( nx = 0; nx < nImageWidth; nx++ )
+ {
+ // sind die Werte als Differenz abgelegt?
+ if( 2 == nPredictor )
+ {
+ for( ns = 0; ns < 4; ns++ )
+ {
+ if( nPlanes < 3 )
+ nSampLast[ ns ] = nSampLast[ ns ] + (BYTE) GetBits( pMap[ 0 ], ( nx * nSamplesPerPixel + ns ) * nBitsPerSample, nBitsPerSample );
+ else
+ nSampLast[ ns ] = nSampLast[ ns ] + (BYTE) GetBits( pMap[ ns ], nx * nBitsPerSample, nBitsPerSample );
+ nSamp[ ns ] = nSampLast[ ns ];
+ }
+ }
+ else
+ {
+ for( ns = 0; ns < 4; ns++ )
+ {
+ if( nPlanes < 3 )
+ nSamp[ ns ] = (BYTE) GetBits( pMap[ 0 ], ( nx * nSamplesPerPixel + ns ) * nBitsPerSample, nBitsPerSample );
+ else
+ nSamp[ ns ]= (BYTE) GetBits( pMap[ ns ], nx * nBitsPerSample, nBitsPerSample );
+ }
+ }
+ nBlack = nSamp[ 3 ];
+ nRed = (BYTE) Max( 0L, 255L - ( ( (long) nSamp[ 0 ] + nBlack - ( ( (long) nMinSampleValue ) << 1 ) ) *
+ 255L/(long)(nMaxSampleValue-nMinSampleValue) ) );
+ nGreen = (BYTE) Max( 0L, 255L - ( ( (long) nSamp[ 1 ] + nBlack - ( ( (long) nMinSampleValue ) << 1 ) ) *
+ 255L/(long)(nMaxSampleValue-nMinSampleValue) ) );
+ nBlue = (BYTE) Max( 0L, 255L - ( ( (long) nSamp[ 2 ] + nBlack - ( ( (long) nMinSampleValue ) << 1 ) ) *
+ 255L/(long)(nMaxSampleValue-nMinSampleValue) ) );
+ pAcc->SetPixel( nY, nx, Color ( (BYTE)nRed, (BYTE)nGreen, (BYTE)nBlue ) );
+
+ }
+ }
+ }
+ else if ( nSamplesPerPixel == 1 && ( nPhotometricInterpretation <= 1 || nPhotometricInterpretation == 3 ) )
+ {
+ ULONG nMinMax = ( ( 1 << nDstBitsPerPixel ) - 1 ) / ( nMaxSampleValue - nMinSampleValue );
+ BYTE* pt = pMap[ 0 ];
+ BYTE nShift;
+
+ switch ( nDstBitsPerPixel )
+ {
+ case 8 :
+ {
+ BYTE nLast;
+ if ( bByteSwap )
+ {
+ if ( nPredictor == 2 )
+ {
+ nLast = BYTESWAP( (BYTE)*pt++ );
+ for ( nx = 0; nx < nImageWidth; nx++ )
+ {
+ pAcc->SetPixel( nY, nx, nLast );
+ nLast = nLast + *pt++;
+ }
+ }
+ else
+ {
+ for ( nx = 0; nx < nImageWidth; nx++ )
+ {
+ nLast = *pt++;
+ pAcc->SetPixel( nY, nx, (BYTE)( ( (BYTESWAP((ULONG)nLast ) - nMinSampleValue ) * nMinMax ) ) );
+ }
+ }
+ }
+ else
+ {
+ if ( nPredictor == 2 )
+ {
+ nLast = *pt++;
+ for ( nx = 0; nx < nImageWidth; nx++ )
+ {
+ pAcc->SetPixel( nY, nx, nLast );
+ nLast = nLast + *pt++;
+ }
+ }
+ else
+ {
+ for ( nx = 0; nx < nImageWidth; nx++ )
+ {
+ pAcc->SetPixel( nY, nx, (BYTE)( ( (ULONG)*pt++ - nMinSampleValue ) * nMinMax ) );
+
+ }
+ }
+ }
+ }
+ break;
+
+ case 7 :
+ case 6 :
+ case 5 :
+ case 4 :
+ case 3 :
+ case 2 :
+ {
+ for ( nx = 0; nx < nImageWidth; nx++ )
+ {
+ nVal = ( GetBits( pt, nx * nBitsPerSample, nBitsPerSample ) - nMinSampleValue ) * nMinMax;
+ pAcc->SetPixel( nY, nx, (BYTE)nVal );
+ }
+ }
+ break;
+
+ case 1 :
+ {
+ if ( bByteSwap )
+ {
+ nx = 0;
+ nByteCount = ( nImageWidth >> 3 ) + 1;
+ while ( --nByteCount )
+ {
+ nByteVal = *pt++;
+ pAcc->SetPixel( nY, nx++, nByteVal & 1 );
+ nByteVal >>= 1;
+ pAcc->SetPixel( nY, nx++, nByteVal & 1 );
+ nByteVal >>= 1;
+ pAcc->SetPixel( nY, nx++, nByteVal & 1 );
+ nByteVal >>= 1;
+ pAcc->SetPixel( nY, nx++, nByteVal & 1 );
+ nByteVal >>= 1;
+ pAcc->SetPixel( nY, nx++, nByteVal & 1 );
+ nByteVal >>= 1;
+ pAcc->SetPixel( nY, nx++, nByteVal & 1 );
+ nByteVal >>= 1;
+ pAcc->SetPixel( nY, nx++, nByteVal & 1 );
+ nByteVal >>= 1;
+ pAcc->SetPixel( nY, nx++, nByteVal );
+ }
+ if ( nImageWidth & 7 )
+ {
+ nByteVal = *pt++;
+ while ( nx < nImageWidth )
+ {
+ pAcc->SetPixel( nY, nx++, nByteVal & 1 );
+ nByteVal >>= 1;
+ }
+ }
+ }
+ else
+ {
+ nx = 7;
+ nByteCount = ( nImageWidth >> 3 ) + 1;
+ while ( --nByteCount )
+ {
+ nByteVal = *pt++;
+ pAcc->SetPixel( nY, nx, nByteVal & 1 );
+ nByteVal >>= 1;
+ pAcc->SetPixel( nY, --nx, nByteVal & 1 );
+ nByteVal >>= 1;
+ pAcc->SetPixel( nY, --nx, nByteVal & 1 );
+ nByteVal >>= 1;
+ pAcc->SetPixel( nY, --nx, nByteVal & 1 );
+ nByteVal >>= 1;
+ pAcc->SetPixel( nY, --nx, nByteVal & 1 );
+ nByteVal >>= 1;
+ pAcc->SetPixel( nY, --nx, nByteVal & 1 );
+ nByteVal >>= 1;
+ pAcc->SetPixel( nY, --nx, nByteVal & 1 );
+ nByteVal >>= 1;
+ pAcc->SetPixel( nY, --nx, nByteVal );
+ nx += 15;
+ }
+ if ( nImageWidth & 7 )
+ {
+ nx -= 7;
+ nByteVal = *pt++;
+ nShift = 7;
+ while ( nx < nImageWidth )
+ {
+ pAcc->SetPixel( nY, nx++, ( nByteVal >> nShift ) & 1);
+ }
+ }
+ }
+ }
+ break;
+
+ default :
+ return FALSE;
+ }
+ }
+ else if ( ( nSamplesPerPixel == 2 ) && ( nBitsPerSample == 8 ) &&
+ ( nPlanarConfiguration == 1 ) && ( pColorMap == 0 ) ) // grayscale
+ {
+ ULONG nMinMax = ( ( 1 << 8 /*nDstBitsPerPixel*/ ) - 1 ) / ( nMaxSampleValue - nMinSampleValue );
+ BYTE* pt = pMap[ 0 ];
+ if ( nByte1 == 'I' )
+ pt++;
+ for ( nx = 0; nx < nImageWidth; nx++, pt += 2 )
+ {
+ pAcc->SetPixel( nY, nx, (BYTE)( ( (ULONG)*pt - nMinSampleValue ) * nMinMax ) );
+ }
+ }
+ else
+ return FALSE;
+ return TRUE;
+}
+
+// ---------------------------------------------------------------------------------
+
+void TIFFReader::MakePalCol( void )
+{
+ if ( nDstBitsPerPixel <= 8 )
+ {
+ ULONG i, nVal, n0RGB;
+ if ( pColorMap == NULL )
+ pColorMap = new ULONG[ 256 ];
+ if ( nPhotometricInterpretation <= 1 )
+ {
+ nNumColors = 1 << nBitsPerSample;
+ if ( nNumColors > 256 )
+ nNumColors = 256;
+ pAcc->SetPaletteEntryCount( (USHORT)nNumColors );
+ for ( i = 0; i < nNumColors; i++ )
+ {
+ nVal = ( i * 255 / ( nNumColors - 1 ) ) & 0xff;
+ n0RGB = nVal | ( nVal << 8 ) | ( nVal << 16 );
+ if ( nPhotometricInterpretation == 1 )
+ pColorMap[ i ] = n0RGB;
+ else
+ pColorMap[ nNumColors - i - 1 ] = n0RGB;
+ }
+ }
+ for ( i = 0; i < nNumColors; i++ )
+ {
+ pAcc->SetPaletteColor( (USHORT)i, BitmapColor( (BYTE)( pColorMap[ i ] >> 16 ),
+ (BYTE)( pColorMap[ i ] >> 8 ), (BYTE)pColorMap[ i ] ) );
+ }
+ }
+
+ if ( fXResolution > 1.0 && fYResolution > 1.0 && ( nResolutionUnit == 2 || nResolutionUnit == 3 ) )
+ {
+ ULONG nRX,nRY;
+ if (nResolutionUnit==2)
+ {
+ nRX=(ULONG)(fXResolution+0.5);
+ nRY=(ULONG)(fYResolution+0.5);
+ }
+ else
+ {
+ nRX=(ULONG)(fXResolution*2.54+0.5);
+ nRY=(ULONG)(fYResolution*2.54+0.5);
+ }
+ MapMode aMapMode(MAP_INCH,Point(0,0),Fraction(1,nRX),Fraction(1,nRY));
+ aBitmap.SetPrefMapMode(aMapMode);
+ aBitmap.SetPrefSize(Size(nImageWidth,nImageLength));
+ }
+}
+
+// ---------------------------------------------------------------------------------
+
+void TIFFReader::ReadHeader()
+{
+ BYTE nbyte1, nbyte2;
+ USHORT nushort;
+
+ *pTIFF >> nbyte1;
+ if ( nbyte1 == 'I' )
+ pTIFF->SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
+ else
+ pTIFF->SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN );
+
+ *pTIFF >> nbyte2 >> nushort;
+ if ( nbyte1 != nbyte2 || ( nbyte1 != 'I' && nbyte1 != 'M' ) || nushort != 0x002a )
+ bStatus = FALSE;
+}
+
+// ---------------------------------------------------------------------------------
+
+BOOL TIFFReader::ReadTIFF(SvStream & rTIFF, Graphic & rGraphic )
+{
+ USHORT i, nNumTags, nTagType;
+ ULONG nMaxPos;
+ ULONG nPos;
+ sal_uInt32 nFirstIfd, nDataLen;
+
+ bStatus = TRUE;
+ nLastPercent = 0;
+
+ pTIFF = &rTIFF;
+ nMaxPos = nOrigPos = pTIFF->Tell();
+ nOrigNumberFormat = pTIFF->GetNumberFormatInt();
+
+ MayCallback( 0 );
+
+ // Kopf einlesen:
+ ReadHeader();
+
+ // Ersten IFD einlesen:
+ *pTIFF >> nFirstIfd;
+
+ if( !nFirstIfd || pTIFF->GetError() )
+ bStatus = FALSE;
+
+ if ( bStatus )
+ {
+ sal_uInt32 nOffset = nFirstIfd;
+
+ // calculate length of TIFF file
+ do
+ {
+ pTIFF->Seek( nOrigPos + nOffset );
+
+ if( pTIFF->GetError() )
+ {
+ pTIFF->ResetError();
+ break;
+ };
+ nMaxPos = Max( pTIFF->Tell(), nMaxPos );
+
+ *pTIFF >> nNumTags;
+
+ // Schleife ueber Tags:
+ for( i = 0; i < nNumTags; i++ )
+ {
+ *pTIFF >> nTagType >> nDataType >> nDataLen >> nOffset;
+
+ if( DataTypeSize() * nDataLen > 4 )
+ nMaxPos = Max( nOrigPos + nOffset + DataTypeSize() * nDataLen, nMaxPos );
+ }
+ *pTIFF >> nOffset;
+ if ( pTIFF->IsEof() )
+ nOffset = 0;
+
+ nMaxPos = Max( pTIFF->Tell(), nMaxPos );
+ if ( !nOffset )
+ nMaxPos = Max( pTIFF->Tell(), nMaxPos );
+ }
+ while( nOffset );
+
+ for ( UINT32 nNextIfd = nFirstIfd; nNextIfd && bStatus; )
+ {
+ pTIFF->Seek( nOrigPos + nNextIfd );
+ {
+ bByteSwap = FALSE;
+
+ nNewSubFile = 0;
+ nSubFile = 0;
+ nImageWidth = 0;
+ nImageLength = 0;
+ nBitsPerSample = 1; // Defaultwert laut Doku
+ nCompression = 1;
+ nPhotometricInterpretation = 0;
+ nThresholding = 1; // Defaultwert laut Doku
+ nCellWidth = 1;
+ nCellLength = 1;
+ nFillOrder = 1; // Defaultwert laut Doku
+ nNumStripOffsets = 0;
+ nOrientation = 1;
+ nSamplesPerPixel = 1; // Defaultwert laut Doku
+ nRowsPerStrip = 0xffffffff; // Defaultwert laut Doku
+ nNumStripByteCounts = 0;
+ nMinSampleValue = 0; // Defaultwert laut Doku
+ nMaxSampleValue = 0;
+ fXResolution = 0.0;
+ fYResolution = 0.0;
+ nPlanarConfiguration = 1;
+ nGroup3Options = 0; // Defaultwert laut Doku
+ nGroup4Options = 0; // Defaultwert laut Doku
+ nResolutionUnit = 2; // Defaultwert laut Doku
+ nPredictor = 1;
+ nNumColors = 0;
+
+ pAcc = NULL;
+ pColorMap = NULL;
+ pStripOffsets = NULL;
+ pStripByteCounts = NULL;
+ pMap[ 0 ] = pMap[ 1 ] = pMap[ 2 ] = pMap[ 3 ] = NULL;
+
+ *pTIFF >> nNumTags;
+ nPos = pTIFF->Tell();
+
+ // Schleife ueber Tags:
+ for( i = 0; i < nNumTags; i++ )
+ {
+ *pTIFF >> nTagType >> nDataType >> nDataLen;
+
+ if( DataTypeSize() * nDataLen > 4 )
+ {
+ *pTIFF >> nOffset;
+ pTIFF->Seek( nOrigPos + nOffset );
+ }
+ ReadTagData( nTagType, nDataLen );
+ nPos += 12; pTIFF->Seek( nPos );
+
+ if ( pTIFF->GetError() )
+ bStatus = FALSE;
+
+ if ( bStatus == FALSE )
+ break;
+ }
+ *pTIFF >> nNextIfd;
+ if ( pTIFF->IsEof() )
+ nNextIfd = 0;
+ }
+ if ( bStatus )
+ {
+ if ( nMaxSampleValue == 0 )
+ nMaxSampleValue = ( 1 << nBitsPerSample ) - 1;
+
+ if ( nPhotometricInterpretation == 2 || nPhotometricInterpretation == 5 || nPhotometricInterpretation == 6 )
+ nDstBitsPerPixel = 24;
+ else if ( nBitsPerSample*nSamplesPerPixel <= 1 )
+ nDstBitsPerPixel = 1;
+ else if ( nBitsPerSample*nSamplesPerPixel <= 4 )
+ nDstBitsPerPixel = 4;
+ else
+ nDstBitsPerPixel = 8;
+
+ aBitmap = Bitmap( Size( nImageWidth, nImageLength ), nDstBitsPerPixel );
+ pAcc = aBitmap.AcquireWriteAccess();
+ if ( pAcc )
+ {
+ if ( nPlanarConfiguration == 1 )
+ nPlanes = 1;
+ else
+ nPlanes = nSamplesPerPixel;
+
+ if ( ( nFillOrder == 2 ) && ( nCompression != 5 ) ) // im LZW Mode werden die bits schon invertiert
+ bByteSwap = TRUE;
+
+ nStripsPerPlane = ( nImageLength - 1 ) / nRowsPerStrip + 1;
+ nBytesPerRow = ( nImageWidth * nSamplesPerPixel / nPlanes * nBitsPerSample + 7 ) >> 3;
+
+ for ( ULONG j = 0; j < 4; j++ )
+ {
+ try
+ {
+ pMap[ j ] = new BYTE[ nBytesPerRow ];
+ }
+ catch (std::bad_alloc)
+ {
+ pMap[ j ] = NULL;
+ bStatus = FALSE;
+ break;
+ }
+ }
+
+ if ( bStatus && ReadMap( 10, 60 ) )
+ {
+ nMaxPos = Max( pTIFF->Tell(), nMaxPos );
+ MakePalCol();
+ nMaxPos = Max( pTIFF->Tell(), nMaxPos );
+ }
+ else
+ bStatus = FALSE;
+
+ if( pAcc )
+ {
+ aBitmap.ReleaseAccess( pAcc );
+ if ( bStatus )
+ {
+ AnimationBitmap aAnimationBitmap( aBitmap, Point( 0, 0 ), aBitmap.GetSizePixel(),
+ ANIMATION_TIMEOUT_ON_CLICK, DISPOSE_BACK );
+
+ aAnimation.Insert( aAnimationBitmap );
+ }
+ }
+ // Aufraeumen:
+ for ( i = 0; i < 4; i++ )
+ delete[] pMap[ i ];
+
+ delete[] pColorMap;
+ delete[] pStripOffsets;
+ delete[] pStripByteCounts;
+ }
+ }
+ }
+ }
+
+ // seek to end of TIFF if succeeded
+ pTIFF->SetNumberFormatInt( nOrigNumberFormat );
+ pTIFF->Seek( bStatus ? nMaxPos : nOrigPos );
+
+ if ( aAnimation.Count() )
+ {
+ if ( aAnimation.Count() == 1 )
+ rGraphic = aAnimation.GetBitmapEx();
+ else
+ rGraphic = aAnimation; //aBitmap;
+
+ return TRUE;
+ }
+ else
+ return FALSE;
+}
+
+
+//================== GraphicImport - die exportierte Funktion ================
+
+extern "C" BOOL __LOADONCALLAPI GraphicImport(SvStream & rStream, Graphic & rGraphic, FilterConfigItem*, BOOL )
+{
+ TIFFReader aTIFFReader;
+
+ if ( aTIFFReader.ReadTIFF( rStream, rGraphic ) == FALSE )
+ return FALSE;
+
+ return TRUE;
+}
+
+//============================= fuer Windows ==================================
+#ifndef GCC
+#endif
+
+#ifdef WIN
+
+static HINSTANCE hDLLInst = 0; // HANDLE der DLL
+
+extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR )
+{
+#ifndef WNT
+ if ( nHeap )
+ UnlockData( 0 );
+#endif
+
+ hDLLInst = hDLL;
+
+ return TRUE;
+}
+
+extern "C" int CALLBACK WEP( int )
+{
+ return 1;
+}
+
+#endif
+
+
diff --git a/filter/source/graphicfilter/itiff/lzwdecom.cxx b/filter/source/graphicfilter/itiff/lzwdecom.cxx
new file mode 100644
index 000000000000..9460ed6ecf45
--- /dev/null
+++ b/filter/source/graphicfilter/itiff/lzwdecom.cxx
@@ -0,0 +1,192 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include "lzwdecom.hxx"
+
+LZWDecompressor::LZWDecompressor()
+{
+ USHORT i;
+
+ pTable=new LZWTableEntry[4096];
+ pOutBuf=new BYTE[4096];
+ for (i=0; i<4096; i++)
+ {
+ pTable[i].nPrevCode=0;
+ pTable[i].nDataCount=1;
+ pTable[i].nData=(BYTE)i;
+ }
+ pIStream=NULL;
+ bFirst = TRUE;
+ nOldCode = 0;
+}
+
+
+LZWDecompressor::~LZWDecompressor()
+{
+ delete[] pOutBuf;
+ delete[] pTable;
+}
+
+
+void LZWDecompressor::StartDecompression(SvStream & rIStream)
+{
+ pIStream=&rIStream;
+
+ nTableSize=258;
+
+ bEOIFound=FALSE;
+
+ nOutBufDataLen=0;
+
+ *pIStream >> nInputBitsBuf;
+
+ nInputBitsBufSize=8;
+
+ if ( bFirst )
+ {
+ bInvert = nInputBitsBuf == 1;
+ bFirst = FALSE;
+ }
+
+ if ( bInvert )
+ nInputBitsBuf = ( ( nInputBitsBuf & 1 ) << 7 ) | ( ( nInputBitsBuf & 2 ) << 5 ) | ( ( nInputBitsBuf & 4 ) << 3 ) | ( ( nInputBitsBuf & 8 ) << 1 ) | ( ( nInputBitsBuf & 16 ) >> 1 ) | ( ( nInputBitsBuf & 32 ) >> 3 ) | ( ( nInputBitsBuf & 64 ) >> 5 ) | ( (nInputBitsBuf & 128 ) >> 7 );
+}
+
+
+ULONG LZWDecompressor::Decompress(BYTE * pTarget, ULONG nMaxCount)
+{
+ ULONG nCount;
+
+ if (pIStream==NULL) return 0;
+
+ nCount=0;
+ for (;;) {
+
+ if (pIStream->GetError()) break;
+
+ if (((ULONG)nOutBufDataLen)>=nMaxCount) {
+ nOutBufDataLen = nOutBufDataLen - (USHORT)nMaxCount;
+ nCount+=nMaxCount;
+ while (nMaxCount>0) {
+ *(pTarget++)=*(pOutBufData++);
+ nMaxCount--;
+ }
+ break;
+ }
+
+ nMaxCount-=(ULONG)nOutBufDataLen;
+ nCount+=nOutBufDataLen;
+ while (nOutBufDataLen>0) {
+ *(pTarget++)=*(pOutBufData++);
+ nOutBufDataLen--;
+ }
+
+ if (bEOIFound==TRUE) break;
+
+ DecompressSome();
+
+ }
+
+ return nCount;
+}
+
+
+USHORT LZWDecompressor::GetNextCode()
+{
+ USHORT nBits,nCode;
+
+ if (nTableSize<511) nBits=9;
+ else if (nTableSize<1023) nBits=10;
+ else if (nTableSize<2047) nBits=11;
+ else nBits=12;
+
+ nCode=0;
+ do {
+ if (nInputBitsBufSize<=nBits)
+ {
+ nCode=(nCode<<nInputBitsBufSize) | nInputBitsBuf;
+ nBits = nBits - nInputBitsBufSize;
+ *pIStream >> nInputBitsBuf;
+ if ( bInvert )
+ nInputBitsBuf = ( ( nInputBitsBuf & 1 ) << 7 ) | ( ( nInputBitsBuf & 2 ) << 5 ) | ( ( nInputBitsBuf & 4 ) << 3 ) | ( ( nInputBitsBuf & 8 ) << 1 ) | ( ( nInputBitsBuf & 16 ) >> 1 ) | ( ( nInputBitsBuf & 32 ) >> 3 ) | ( ( nInputBitsBuf & 64 ) >> 5 ) | ( (nInputBitsBuf & 128 ) >> 7 );
+ nInputBitsBufSize=8;
+ }
+ else
+ {
+ nCode=(nCode<<nBits) | (nInputBitsBuf>>(nInputBitsBufSize-nBits));
+ nInputBitsBufSize = nInputBitsBufSize - nBits;
+ nInputBitsBuf&=0x00ff>>(8-nInputBitsBufSize);
+ nBits=0;
+ }
+ } while (nBits>0);
+
+ return nCode;
+}
+
+
+void LZWDecompressor::AddToTable(USHORT nPrevCode, USHORT nCodeFirstData)
+{
+ while (pTable[nCodeFirstData].nDataCount>1)
+ nCodeFirstData=pTable[nCodeFirstData].nPrevCode;
+
+ pTable[nTableSize].nPrevCode=nPrevCode;
+ pTable[nTableSize].nDataCount=pTable[nPrevCode].nDataCount+1;
+ pTable[nTableSize].nData=pTable[nCodeFirstData].nData;
+
+ nTableSize++;
+}
+
+
+void LZWDecompressor::DecompressSome()
+{
+ USHORT i,nCode;
+
+ nCode=GetNextCode();
+ if (nCode==256) {
+ nTableSize=258;
+ nCode=GetNextCode();
+ if (nCode==257) { bEOIFound=TRUE; return; }
+ }
+ else if (nCode<nTableSize) AddToTable(nOldCode,nCode);
+ else if (nCode==nTableSize) AddToTable(nOldCode,nOldCode);
+ else { bEOIFound=TRUE; return; }
+
+ nOldCode=nCode;
+
+ nOutBufDataLen=pTable[nCode].nDataCount;
+ pOutBufData=pOutBuf+nOutBufDataLen;
+ for (i=0; i<nOutBufDataLen; i++) {
+ *(--pOutBufData)=pTable[nCode].nData;
+ nCode=pTable[nCode].nPrevCode;
+ }
+}
+
+
+
diff --git a/filter/source/graphicfilter/itiff/lzwdecom.hxx b/filter/source/graphicfilter/itiff/lzwdecom.hxx
new file mode 100644
index 000000000000..164812878865
--- /dev/null
+++ b/filter/source/graphicfilter/itiff/lzwdecom.hxx
@@ -0,0 +1,79 @@
+/*************************************************************************
+ *
+ * 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 _LZWDECOM_HXX
+#define _LZWDECOM_HXX
+
+#include <tools/stream.hxx>
+
+struct LZWTableEntry {
+ USHORT nPrevCode;
+ USHORT nDataCount;
+ BYTE nData;
+};
+
+class LZWDecompressor {
+
+public:
+
+ LZWDecompressor();
+ ~LZWDecompressor();
+
+ void StartDecompression(SvStream & rIStream);
+
+ ULONG Decompress(BYTE * pTarget, ULONG nMaxCount);
+ // Liefert die Anzahl der geschriebenen Bytes, wenn < nMaxCount,
+ // sind keine weiteren Daten zu entpacken, oder es ist ein
+ // Fehler aufgetreten.
+
+private:
+
+ USHORT GetNextCode();
+ void AddToTable(USHORT nPrevCode, USHORT nCodeFirstData);
+ void DecompressSome();
+
+ SvStream * pIStream;
+
+ LZWTableEntry * pTable;
+ USHORT nTableSize;
+
+ BOOL bEOIFound, bInvert, bFirst;
+
+ USHORT nOldCode;
+
+ BYTE * pOutBuf;
+ BYTE * pOutBufData;
+ USHORT nOutBufDataLen;
+
+ BYTE nInputBitsBuf;
+ USHORT nInputBitsBufSize;
+};
+
+
+#endif
+
+
diff --git a/filter/source/graphicfilter/itiff/makefile.mk b/filter/source/graphicfilter/itiff/makefile.mk
new file mode 100644
index 000000000000..07fcf0ffdff4
--- /dev/null
+++ b/filter/source/graphicfilter/itiff/makefile.mk
@@ -0,0 +1,71 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=filter
+TARGET=itiff
+DEPTARGET=vitiff
+
+# --- Settings -----------------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Allgemein ----------------------------------------------------------
+
+.IF "$(editdebug)"!="" || "$(EDITDEBUG)"!=""
+CDEFS+= -DEDITDEBUG
+.ENDIF
+.IF "$(L10N_framework)"==""
+SLOFILES = $(SLO)$/itiff.obj \
+ $(SLO)$/lzwdecom.obj \
+ $(SLO)$/ccidecom.obj
+
+EXCEPTIONSNOOPTFILES= $(SLO)$/itiff.obj
+
+# ==========================================================================
+
+SHL1TARGET= iti$(DLLPOSTFIX)
+SHL1IMPLIB= itiff
+SHL1STDLIBS= $(VCLLIB) $(TOOLSLIB) $(SALLIB)
+SHL1LIBS= $(SLB)$/itiff.lib # $(LB)$/rtftoken.lib
+
+.IF "$(GUI)" != "UNX"
+.IF "$(COM)" != "GCC"
+SHL1OBJS= $(SLO)$/itiff.obj
+.ENDIF
+.ENDIF
+
+SHL1VERSIONMAP=exports.map
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+
+DEF1NAME=$(SHL1TARGET)
+.ENDIF
+
+# ==========================================================================
+
+.INCLUDE : target.mk
diff --git a/filter/source/msfilter/countryid.cxx b/filter/source/msfilter/countryid.cxx
new file mode 100644
index 000000000000..3239e5020cfb
--- /dev/null
+++ b/filter/source/msfilter/countryid.cxx
@@ -0,0 +1,342 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+// ============================================================================
+#include "filter/msfilter/countryid.hxx"
+
+#include <algorithm>
+
+// ----------------------------------------------------------------------------
+
+namespace msfilter {
+
+// Mapping table ==============================================================
+
+namespace {
+
+// ----------------------------------------------------------------------------
+
+/** Table entry for Windows country ID <-> language type conversion.
+
+ The first member is the Windows country ID, as defined in the header.
+
+ The second member contains the corresponding language type for each country
+ ID. This must be a full language, not only the primary language type.
+
+ The last bool flag defines, if the sub language type should be evaluated to
+ find the country ID from a language. If not set, all languages map to the
+ country which contain the given primary language type.
+
+ Example: The language entry (COUNTRY_USA,LANGUAGE_ENGLISH_US,false) maps
+ the country ID for USA to the language LANGUAGE_ENGLISH_US. The clear sub
+ language flag causes all english languages LANGUAGE_ENGLISH_*** to map to
+ this country ID by default. To map the special case LANGUAGE_ENGLISH_EIRE
+ to the country ID COUNTRY_IRELAND, the sub language flag must be set in the
+ respective table entry, here (COUNTRY_IRELAND,LANGUAGE_ENGLISH_EIRE,true).
+ */
+struct CountryEntry
+{
+ CountryId meCountry; /// Windows country ID.
+ LanguageType meLanguage; /// Corresponding language type.
+ bool mbUseSubLang; /// false = Primary only, true = Primary and sub language.
+};
+
+// ----------------------------------------------------------------------------
+
+/** Table for Windows country ID <-> language type conversion.
+
+ To map the same language to different country IDs, some of the entries
+ should contain a set sub language flag (see description of CountryEntry).
+ All table entries with a set flag take priority over the entry with the
+ same primary language, but cleared sub language flag, regardless of the
+ position in the table.
+
+ To map different languages to the same country ID, several entries with the
+ same country ID may be inserted. In this case the conversion to a language
+ is done with the first found entry (starting from top) containing the given
+ country ID.
+
+ For now all entries are sorted by country ID, but this is not required.
+ */
+static const CountryEntry pTable[] =
+{
+ { COUNTRY_USA, LANGUAGE_ENGLISH_US, false },
+ { COUNTRY_DOMINICAN_REPUBLIC, LANGUAGE_SPANISH_DOMINICAN_REPUBLIC, true },
+ { COUNTRY_JAMAICA, LANGUAGE_ENGLISH_JAMAICA, true },
+ { COUNTRY_PUERTO_RICO, LANGUAGE_SPANISH_PUERTO_RICO, true },
+ { COUNTRY_TRINIDAD_Y_TOBAGO, LANGUAGE_ENGLISH_TRINIDAD, true },
+ { COUNTRY_CANADA, LANGUAGE_ENGLISH_CAN, true },
+ { COUNTRY_CANADA, LANGUAGE_FRENCH_CANADIAN, true },
+ { COUNTRY_RUSSIA, LANGUAGE_RUSSIAN, false },
+ { COUNTRY_KAZAKHSTAN, LANGUAGE_KAZAK, false },
+ { COUNTRY_TATARSTAN, LANGUAGE_TATAR, false },
+ { COUNTRY_EGYPT, LANGUAGE_ARABIC_EGYPT, true },
+ { COUNTRY_SOUTH_AFRICA, LANGUAGE_AFRIKAANS, false },
+ { COUNTRY_SOUTH_AFRICA, LANGUAGE_ENGLISH_SAFRICA, true },
+ { COUNTRY_SOUTH_AFRICA, LANGUAGE_TSONGA, false },
+ { COUNTRY_SOUTH_AFRICA, LANGUAGE_VENDA, false },
+ { COUNTRY_SOUTH_AFRICA, LANGUAGE_XHOSA, false },
+ { COUNTRY_SOUTH_AFRICA, LANGUAGE_ZULU, false },
+ { COUNTRY_GREECE, LANGUAGE_GREEK, false },
+ { COUNTRY_NETHERLANDS, LANGUAGE_DUTCH, false },
+ { COUNTRY_NETHERLANDS, LANGUAGE_FRISIAN_NETHERLANDS, false },
+ { COUNTRY_BELGIUM, LANGUAGE_DUTCH_BELGIAN, true },
+ { COUNTRY_BELGIUM, LANGUAGE_FRENCH_BELGIAN, true },
+ { COUNTRY_FRANCE, LANGUAGE_FRENCH, false },
+ { COUNTRY_SPAIN, LANGUAGE_SPANISH_MODERN, false },
+ { COUNTRY_SPAIN, LANGUAGE_SPANISH_DATED, false },
+ { COUNTRY_SPAIN, LANGUAGE_CATALAN, false },
+ { COUNTRY_SPAIN, LANGUAGE_BASQUE, false },
+ { COUNTRY_SPAIN, LANGUAGE_GALICIAN, false },
+ { COUNTRY_HUNGARY, LANGUAGE_HUNGARIAN, false },
+ { COUNTRY_ITALY, LANGUAGE_ITALIAN, false },
+ { COUNTRY_ROMANIA, LANGUAGE_ROMANIAN, false },
+ { COUNTRY_SWITZERLAND, LANGUAGE_GERMAN_SWISS, true },
+ { COUNTRY_SWITZERLAND, LANGUAGE_FRENCH_SWISS, true },
+ { COUNTRY_SWITZERLAND, LANGUAGE_ITALIAN_SWISS, true },
+ { COUNTRY_SWITZERLAND, LANGUAGE_RHAETO_ROMAN, false },
+ { COUNTRY_AUSTRIA, LANGUAGE_GERMAN_AUSTRIAN, true },
+ { COUNTRY_UNITED_KINGDOM, LANGUAGE_ENGLISH_UK, true },
+ { COUNTRY_UNITED_KINGDOM, LANGUAGE_GAELIC_SCOTLAND, true },
+ { COUNTRY_UNITED_KINGDOM, LANGUAGE_WELSH, false },
+ { COUNTRY_DENMARK, LANGUAGE_DANISH, false },
+ { COUNTRY_SWEDEN, LANGUAGE_SWEDISH, false },
+ { COUNTRY_SWEDEN, LANGUAGE_SAMI_LAPPISH, false },
+ { COUNTRY_NORWAY, LANGUAGE_NORWEGIAN_BOKMAL, false },
+ { COUNTRY_POLAND, LANGUAGE_POLISH, false },
+ { COUNTRY_GERMANY, LANGUAGE_GERMAN, false },
+ { COUNTRY_GERMANY, LANGUAGE_SORBIAN, false },
+ { COUNTRY_PERU, LANGUAGE_SPANISH_PERU, true },
+ { COUNTRY_MEXICO, LANGUAGE_SPANISH_MEXICAN, true },
+ { COUNTRY_ARGENTINIA, LANGUAGE_SPANISH_ARGENTINA, true },
+ { COUNTRY_BRAZIL, LANGUAGE_PORTUGUESE_BRAZILIAN, true },
+ { COUNTRY_CHILE, LANGUAGE_SPANISH_CHILE, true },
+ { COUNTRY_COLOMBIA, LANGUAGE_SPANISH_COLOMBIA, true },
+ { COUNTRY_VENEZUELA, LANGUAGE_SPANISH_VENEZUELA, true },
+ { COUNTRY_MALAYSIA, LANGUAGE_MALAY_MALAYSIA, false },
+ { COUNTRY_AUSTRALIA, LANGUAGE_ENGLISH_AUS, true },
+ { COUNTRY_INDONESIA, LANGUAGE_INDONESIAN, false },
+ { COUNTRY_PHILIPPINES, LANGUAGE_ENGLISH_PHILIPPINES, true },
+ { COUNTRY_NEW_ZEALAND, LANGUAGE_MAORI_NEW_ZEALAND, false },
+ { COUNTRY_NEW_ZEALAND, LANGUAGE_ENGLISH_NZ, true },
+ { COUNTRY_SINGAPORE, LANGUAGE_CHINESE_SINGAPORE, true },
+ { COUNTRY_THAILAND, LANGUAGE_THAI, false },
+ { COUNTRY_JAPAN, LANGUAGE_JAPANESE, false },
+ { COUNTRY_SOUTH_KOREA, LANGUAGE_KOREAN, false },
+ { COUNTRY_VIET_NAM, LANGUAGE_VIETNAMESE, false },
+ { COUNTRY_PR_CHINA, LANGUAGE_CHINESE_SIMPLIFIED, false },
+ { COUNTRY_TIBET, LANGUAGE_TIBETAN, false },
+ { COUNTRY_TURKEY, LANGUAGE_TURKISH, false },
+ { COUNTRY_INDIA, LANGUAGE_HINDI, false },
+ { COUNTRY_INDIA, LANGUAGE_URDU_INDIA, true },
+ { COUNTRY_INDIA, LANGUAGE_PUNJABI, false },
+ { COUNTRY_INDIA, LANGUAGE_GUJARATI, false },
+ { COUNTRY_INDIA, LANGUAGE_ORIYA, false },
+ { COUNTRY_INDIA, LANGUAGE_TAMIL, false },
+ { COUNTRY_INDIA, LANGUAGE_TELUGU, false },
+ { COUNTRY_INDIA, LANGUAGE_KANNADA, false },
+ { COUNTRY_INDIA, LANGUAGE_MALAYALAM, false },
+ { COUNTRY_INDIA, LANGUAGE_ASSAMESE, false },
+ { COUNTRY_INDIA, LANGUAGE_MARATHI, false },
+ { COUNTRY_INDIA, LANGUAGE_SANSKRIT, false },
+ { COUNTRY_INDIA, LANGUAGE_KONKANI, false },
+ { COUNTRY_INDIA, LANGUAGE_MANIPURI, false },
+ { COUNTRY_INDIA, LANGUAGE_SINDHI, false },
+ { COUNTRY_INDIA, LANGUAGE_KASHMIRI, false },
+ { COUNTRY_PAKISTAN, LANGUAGE_URDU_PAKISTAN, false },
+ { COUNTRY_MYANMAR, LANGUAGE_BURMESE, false },
+ { COUNTRY_MOROCCO, LANGUAGE_ARABIC_MOROCCO, true },
+ { COUNTRY_ALGERIA, LANGUAGE_ARABIC_ALGERIA, true },
+ { COUNTRY_TUNISIA, LANGUAGE_ARABIC_TUNISIA, true },
+ { COUNTRY_LIBYA, LANGUAGE_ARABIC_LIBYA, true },
+ { COUNTRY_SENEGAL, LANGUAGE_FRENCH_SENEGAL, true },
+ { COUNTRY_MALI, LANGUAGE_FRENCH_MALI, true },
+ { COUNTRY_COTE_D_IVOIRE, LANGUAGE_FRENCH_COTE_D_IVOIRE, true },
+ { COUNTRY_CAMEROON, LANGUAGE_FRENCH_CAMEROON, true },
+ { COUNTRY_ZAIRE, LANGUAGE_FRENCH_ZAIRE, true },
+ { COUNTRY_RWANDA, LANGUAGE_KINYARWANDA_RWANDA, false },
+ { COUNTRY_KENYA, LANGUAGE_SWAHILI, false },
+ { COUNTRY_REUNION, LANGUAGE_FRENCH_REUNION, true },
+ { COUNTRY_ZIMBABWE, LANGUAGE_ENGLISH_ZIMBABWE, true },
+ { COUNTRY_LESOTHO, LANGUAGE_SESOTHO, false },
+ { COUNTRY_BOTSWANA, LANGUAGE_TSWANA, false },
+ { COUNTRY_FAEROE_ISLANDS, LANGUAGE_FAEROESE, false },
+ { COUNTRY_PORTUGAL, LANGUAGE_PORTUGUESE, false },
+ { COUNTRY_LUXEMBOURG, LANGUAGE_GERMAN_LUXEMBOURG, true },
+ { COUNTRY_LUXEMBOURG, LANGUAGE_FRENCH_LUXEMBOURG, true },
+ { COUNTRY_IRELAND, LANGUAGE_ENGLISH_EIRE, true },
+ { COUNTRY_IRELAND, LANGUAGE_GAELIC_IRELAND, true },
+ { COUNTRY_ICELAND, LANGUAGE_ICELANDIC, false },
+ { COUNTRY_ALBANIA, LANGUAGE_ALBANIAN, false },
+ { COUNTRY_MALTA, LANGUAGE_MALTESE, false },
+ { COUNTRY_FINLAND, LANGUAGE_FINNISH, false },
+ { COUNTRY_FINLAND, LANGUAGE_SWEDISH_FINLAND, true },
+ { COUNTRY_BULGARIA, LANGUAGE_BULGARIAN, false },
+ { COUNTRY_LITHUANIA, LANGUAGE_LITHUANIAN, false },
+ { COUNTRY_LATVIA, LANGUAGE_LATVIAN, false },
+ { COUNTRY_ESTONIA, LANGUAGE_ESTONIAN, false },
+ { COUNTRY_MOLDOVA, LANGUAGE_ROMANIAN_MOLDOVA, true },
+ { COUNTRY_MOLDOVA, LANGUAGE_RUSSIAN_MOLDOVA, true },
+ { COUNTRY_ARMENIA, LANGUAGE_ARMENIAN, false },
+ { COUNTRY_BELARUS, LANGUAGE_BELARUSIAN, false },
+ { COUNTRY_MONACO, LANGUAGE_FRENCH_MONACO, true },
+ { COUNTRY_UKRAINE, LANGUAGE_UKRAINIAN, false },
+ { COUNTRY_SERBIA, LANGUAGE_SERBIAN_LATIN, false },
+ { COUNTRY_CROATIA, LANGUAGE_CROATIAN, true }, // sub type of LANGUAGE_SERBIAN
+ { COUNTRY_SLOVENIA, LANGUAGE_SLOVENIAN, false },
+ { COUNTRY_MACEDONIA, LANGUAGE_MACEDONIAN, false },
+ { COUNTRY_CZECH, LANGUAGE_CZECH, false },
+ { COUNTRY_SLOVAK, LANGUAGE_SLOVAK, false },
+ { COUNTRY_LIECHTENSTEIN, LANGUAGE_GERMAN_LIECHTENSTEIN, true },
+ { COUNTRY_BELIZE, LANGUAGE_ENGLISH_BELIZE, true },
+ { COUNTRY_GUATEMALA, LANGUAGE_SPANISH_GUATEMALA, true },
+ { COUNTRY_EL_SALVADOR, LANGUAGE_SPANISH_EL_SALVADOR, true },
+ { COUNTRY_HONDURAS, LANGUAGE_SPANISH_HONDURAS, true },
+ { COUNTRY_NICARAGUA, LANGUAGE_SPANISH_NICARAGUA, true },
+ { COUNTRY_COSTA_RICA, LANGUAGE_SPANISH_COSTARICA, true },
+ { COUNTRY_PANAMA, LANGUAGE_SPANISH_PANAMA, true },
+ { COUNTRY_BOLIVIA, LANGUAGE_SPANISH_BOLIVIA, true },
+ { COUNTRY_ECUADOR, LANGUAGE_SPANISH_ECUADOR, true },
+ { COUNTRY_PARAGUAY, LANGUAGE_SPANISH_PARAGUAY, true },
+ { COUNTRY_URUGUAY, LANGUAGE_SPANISH_URUGUAY, true },
+ { COUNTRY_BRUNEI_DARUSSALAM, LANGUAGE_MALAY_BRUNEI_DARUSSALAM, true },
+ { COUNTRY_HONG_KONG, LANGUAGE_CHINESE_HONGKONG, true },
+ { COUNTRY_MACAU, LANGUAGE_CHINESE_MACAU, true },
+ { COUNTRY_CAMBODIA, LANGUAGE_KHMER, false },
+ { COUNTRY_LAOS, LANGUAGE_LAO, false },
+ { COUNTRY_BANGLADESH, LANGUAGE_BENGALI, false },
+ { COUNTRY_TAIWAN, LANGUAGE_CHINESE_TRADITIONAL, true },
+ { COUNTRY_MALDIVES, LANGUAGE_DHIVEHI, false },
+ { COUNTRY_LEBANON, LANGUAGE_ARABIC_LEBANON, true },
+ { COUNTRY_JORDAN, LANGUAGE_ARABIC_JORDAN, true },
+ { COUNTRY_SYRIA, LANGUAGE_ARABIC_SYRIA, true },
+ { COUNTRY_IRAQ, LANGUAGE_ARABIC_IRAQ, true },
+ { COUNTRY_KUWAIT, LANGUAGE_ARABIC_KUWAIT, true },
+ { COUNTRY_SAUDI_ARABIA, LANGUAGE_ARABIC_SAUDI_ARABIA, true },
+ { COUNTRY_YEMEN, LANGUAGE_ARABIC_YEMEN, true },
+ { COUNTRY_OMAN, LANGUAGE_ARABIC_OMAN, true },
+ { COUNTRY_UAE, LANGUAGE_ARABIC_UAE, true },
+ { COUNTRY_ISRAEL, LANGUAGE_HEBREW, false },
+ { COUNTRY_BAHRAIN, LANGUAGE_ARABIC_BAHRAIN, true },
+ { COUNTRY_QATAR, LANGUAGE_ARABIC_QATAR, true },
+ { COUNTRY_MONGOLIA, LANGUAGE_MONGOLIAN, false },
+ { COUNTRY_NEPAL, LANGUAGE_NEPALI, false },
+ { COUNTRY_IRAN, LANGUAGE_FARSI, false },
+ { COUNTRY_TAJIKISTAN, LANGUAGE_TAJIK, false },
+ { COUNTRY_TURKMENISTAN, LANGUAGE_TURKMEN, false },
+ { COUNTRY_AZERBAIJAN, LANGUAGE_AZERI_LATIN, false },
+ { COUNTRY_GEORGIA, LANGUAGE_GEORGIAN, false },
+ { COUNTRY_KYRGYZSTAN, LANGUAGE_KIRGHIZ, false },
+ { COUNTRY_UZBEKISTAN, LANGUAGE_UZBEK_LATIN, false }
+};
+
+const CountryEntry * const pEnd = pTable + sizeof( pTable ) / sizeof( pTable[ 0 ] );
+
+// ----------------------------------------------------------------------------
+
+/** Predicate comparing a country ID with the member of a CountryEntry. */
+struct CountryEntryPred_Country
+{
+ CountryId meCountry;
+
+ inline explicit CountryEntryPred_Country( CountryId eCountry ) :
+ meCountry( eCountry ) {}
+
+ inline bool operator()( const CountryEntry& rCmp ) const
+ { return rCmp.meCountry == meCountry; }
+};
+
+// ----------------------------------------------------------------------------
+
+/** Predicate comparing a language type with the member of a CountryEntry.
+
+ Compares by primary language only, if the passed CountryEntry allows it
+ (the member mbUseSubLang is cleared), otherwise by full language type. */
+struct CountryEntryPred_Language
+{
+ LanguageType meLanguage;
+
+ inline explicit CountryEntryPred_Language( LanguageType eLanguage ) :
+ meLanguage( eLanguage ) {}
+
+ inline bool operator()( const CountryEntry& rCmp ) const;
+};
+
+inline bool CountryEntryPred_Language::operator()( const CountryEntry& rCmp ) const
+{
+ // rCmp.mbUseSubLang==true -> compare full language type
+ // rCmp.mbUseSubLang==false -> compare primary language only
+ return rCmp.mbUseSubLang ? (meLanguage == rCmp.meLanguage) :
+ ((meLanguage & 0x03FF) == (rCmp.meLanguage & 0x03FF));
+}
+
+// ----------------------------------------------------------------------------
+
+} // namespace
+
+// Country ID <-> Language type conversion ====================================
+
+CountryId ConvertLanguageToCountry( LanguageType eLanguage )
+{
+ // country of a found primary language type
+ CountryId ePrimCountry = COUNTRY_DONTKNOW;
+
+ // find an exact match and a primary-language-only match, in one pass
+ const CountryEntry* pEntry = pTable;
+ do
+ {
+ pEntry = std::find_if( pEntry, pEnd, CountryEntryPred_Language( eLanguage ) );
+ if( pEntry != pEnd )
+ {
+ if( pEntry->mbUseSubLang )
+ return pEntry->meCountry; // exact match found -> return
+ if( ePrimCountry == COUNTRY_DONTKNOW )
+ ePrimCountry = pEntry->meCountry;
+ ++pEntry; // one entry forward for next find_if() call
+ }
+ }
+ while( pEntry != pEnd );
+
+ return ePrimCountry;
+}
+
+LanguageType ConvertCountryToLanguage( CountryId eCountry )
+{
+ // just find the first occurance of eCountry and return the language type
+ const CountryEntry* pEntry = std::find_if( pTable, pEnd, CountryEntryPred_Country( eCountry ) );
+ return (pEntry != pEnd) ? pEntry->meLanguage : LANGUAGE_DONTKNOW;
+}
+
+// ============================================================================
+
+} // namespace svx
+
+// ============================================================================
+
diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx
new file mode 100644
index 000000000000..2ad33b1e6195
--- /dev/null
+++ b/filter/source/msfilter/escherex.cxx
@@ -0,0 +1,4944 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+#include "eschesdo.hxx"
+#include <filter/msfilter/escherex.hxx>
+#include <svx/unoapi.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/svdoashp.hxx>
+#include <svx/svdoole2.hxx>
+#include <svx/svdmodel.hxx>
+#include <vcl/gradient.hxx>
+#include <vcl/graph.hxx>
+#include <vcl/cvtgrf.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/wrkwin.hxx>
+#include <tools/stream.hxx>
+#include <tools/zcodec.hxx>
+#include <svx/svdopath.hxx>
+#include <stdlib.h>
+#include <svtools/filter.hxx>
+#include "svx/EnhancedCustomShapeTypeNames.hxx"
+#include "svx/EnhancedCustomShapeGeometry.hxx"
+#include <svx/EnhancedCustomShapeFunctionParser.hxx>
+#include "svx/EnhancedCustomShape2d.hxx"
+#include <com/sun/star/beans/PropertyValues.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/awt/GradientStyle.hpp>
+#include <com/sun/star/awt/RasterOperation.hpp>
+#include <com/sun/star/awt/Gradient.hpp>
+#include <com/sun/star/drawing/LineStyle.hpp>
+#include <com/sun/star/drawing/LineJoint.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
+#include <com/sun/star/drawing/LineDash.hpp>
+#include <com/sun/star/drawing/BezierPoint.hpp>
+#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
+#include <com/sun/star/drawing/ConnectorType.hpp>
+#include <com/sun/star/drawing/ConnectionType.hpp>
+#include <com/sun/star/drawing/CircleKind.hpp>
+#include <com/sun/star/drawing/PointSequence.hpp>
+#include <com/sun/star/drawing/FlagSequence.hpp>
+#include <com/sun/star/drawing/PolygonFlags.hpp>
+#include <com/sun/star/text/WritingMode.hpp>
+#include <com/sun/star/drawing/TextVerticalAdjust.hpp>
+#include <com/sun/star/drawing/TextHorizontalAdjust.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeParameterType.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeGluePointType.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeSegmentCommand.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeTextFrame.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeTextPathMode.hpp>
+#include <com/sun/star/drawing/ProjectionMode.hpp>
+#include <com/sun/star/text/XSimpleText.hpp>
+#include <com/sun/star/drawing/ShadeMode.hpp>
+#include <vcl/hatch.hxx>
+#include <com/sun/star/awt/XGraphics.hpp>
+#include <com/sun/star/awt/FontSlant.hpp>
+#include <com/sun/star/awt/FontWeight.hpp>
+#include <com/sun/star/drawing/ColorMode.hpp>
+#include <com/sun/star/drawing/Position3D.hpp>
+#include <com/sun/star/drawing/Direction3D.hpp>
+#include <com/sun/star/text/GraphicCrop.hpp>
+#include <unotools/ucbstreamhelper.hxx>
+#include <unotools/localfilehelper.hxx>
+#include <comphelper/extract.hxx>
+#include <toolkit/unohlp.hxx>
+#include <vcl/virdev.hxx>
+#include <rtl/crc.h>
+#include <vos/xception.hxx>
+#ifndef _VOS_NO_NAMESPACE
+using namespace vos;
+#endif
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+
+
+// ---------------------------------------------------------------------------------------------
+
+EscherExContainer::EscherExContainer( SvStream& rSt, const sal_uInt16 nRecType, const sal_uInt16 nInstance ) :
+ rStrm ( rSt )
+{
+ rStrm << (sal_uInt32)( ( 0xf | ( nInstance << 4 ) ) | ( nRecType << 16 ) ) << (sal_uInt32)0;
+ nContPos = rStrm.Tell();
+}
+EscherExContainer::~EscherExContainer()
+{
+ sal_uInt32 nPos = rStrm.Tell();
+ sal_uInt32 nSize= nPos - nContPos;
+ if ( nSize )
+ {
+ rStrm.Seek( nContPos - 4 );
+ rStrm << nSize;
+ rStrm.Seek( nPos );
+ }
+}
+
+EscherExAtom::EscherExAtom( SvStream& rSt, const sal_uInt16 nRecType, const sal_uInt16 nInstance, const sal_uInt8 nVersion ) :
+ rStrm ( rSt )
+{
+ rStrm << (sal_uInt32)( ( nVersion | ( nInstance << 4 ) ) | ( nRecType << 16 ) ) << (sal_uInt32)0;
+ nContPos = rStrm.Tell();
+}
+EscherExAtom::~EscherExAtom()
+{
+ sal_uInt32 nPos = rStrm.Tell();
+ sal_uInt32 nSize= nPos - nContPos;
+ if ( nSize )
+ {
+ rStrm.Seek( nContPos - 4 );
+ rStrm << nSize;
+ rStrm.Seek( nPos );
+ }
+}
+
+// ---------------------------------------------------------------------------------------------
+
+EscherExClientRecord_Base::~EscherExClientRecord_Base()
+{
+}
+
+EscherExClientAnchor_Base::~EscherExClientAnchor_Base()
+{
+}
+
+// ---------------------------------------------------------------------------------------------
+
+void EscherPropertyContainer::ImplInit()
+{
+ nSortCount = 0;
+ nCountCount = 0;
+ nCountSize = 0;
+ nSortBufSize = 64;
+ bHasComplexData = sal_False;
+ bSuppressRotation = sal_False;
+ pSortStruct = new EscherPropSortStruct[ nSortBufSize ];
+}
+
+EscherPropertyContainer::EscherPropertyContainer() :
+ pGraphicProvider ( NULL ),
+ pPicOutStrm ( NULL )
+{
+ ImplInit();
+};
+
+EscherPropertyContainer::EscherPropertyContainer(
+ EscherGraphicProvider& rGraphProv,
+ SvStream* pPiOutStrm,
+ Rectangle& rBoundRect ) :
+
+ pGraphicProvider ( &rGraphProv ),
+ pPicOutStrm ( pPiOutStrm ),
+ pShapeBoundRect ( &rBoundRect )
+{
+ ImplInit();
+}
+
+EscherPropertyContainer::~EscherPropertyContainer()
+{
+ if ( bHasComplexData )
+ {
+ while ( nSortCount-- )
+ delete[] pSortStruct[ nSortCount ].pBuf;
+ }
+ delete[] pSortStruct;
+};
+
+void EscherPropertyContainer::AddOpt( sal_uInt16 nPropID, sal_uInt32 nPropValue, sal_Bool bBlib )
+{
+ AddOpt( nPropID, bBlib, nPropValue, NULL, 0 );
+}
+
+void EscherPropertyContainer::AddOpt( sal_uInt16 nPropID, const rtl::OUString& rString )
+{
+ sal_Int32 j, i, nLen = rString.getLength() * 2 + 2;
+ sal_uInt8* pBuf = new sal_uInt8[ nLen ];
+ for ( j = i = 0; i < rString.getLength(); i++ )
+ {
+ sal_uInt16 nChar = (sal_uInt16)rString[ i ];
+ pBuf[ j++ ] = (sal_uInt8)nChar;
+ pBuf[ j++ ] = (sal_uInt8)( nChar >> 8 );
+ }
+ pBuf[ j++ ] = 0;
+ pBuf[ j++ ] = 0;
+ AddOpt( nPropID, sal_True, nLen, pBuf, nLen );
+}
+
+void EscherPropertyContainer::AddOpt( sal_uInt16 nPropID, sal_Bool bBlib, sal_uInt32 nPropValue, sal_uInt8* pProp, sal_uInt32 nPropSize )
+{
+ if ( bBlib ) // bBlib is only valid when fComplex = 0
+ nPropID |= 0x4000;
+ if ( pProp )
+ nPropID |= 0x8000; // fComplex = TRUE;
+
+ sal_uInt32 i;
+ for( i = 0; i < nSortCount; i++ )
+ {
+ if ( ( pSortStruct[ i ].nPropId &~0xc000 ) == ( nPropID &~0xc000 ) ) // pruefen, ob Property nur ersetzt wird
+ {
+ pSortStruct[ i ].nPropId = nPropID;
+ if ( pSortStruct[ i ].pBuf )
+ {
+ nCountSize -= pSortStruct[ i ].nPropSize;
+ delete[] pSortStruct[ i ].pBuf;
+ }
+ pSortStruct[ i ].pBuf = pProp;
+ pSortStruct[ i ].nPropSize = nPropSize;
+ pSortStruct[ i ].nPropValue = nPropValue;
+ if ( pProp )
+ nCountSize += nPropSize;
+ return;
+ }
+ }
+ nCountCount++;
+ nCountSize += 6;
+ if ( nSortCount == nSortBufSize ) // buffer vergroessern
+ {
+ nSortBufSize <<= 1;
+ EscherPropSortStruct* pTemp = new EscherPropSortStruct[ nSortBufSize ];
+ for( i = 0; i < nSortCount; i++ )
+ {
+ pTemp[ i ] = pSortStruct[ i ];
+ }
+ delete pSortStruct;
+ pSortStruct = pTemp;
+ }
+ pSortStruct[ nSortCount ].nPropId = nPropID; // property einfuegen
+ pSortStruct[ nSortCount ].pBuf = pProp;
+ pSortStruct[ nSortCount ].nPropSize = nPropSize;
+ pSortStruct[ nSortCount++ ].nPropValue = nPropValue;
+
+ if ( pProp )
+ {
+ nCountSize += nPropSize;
+ bHasComplexData = sal_True;
+ }
+}
+
+sal_Bool EscherPropertyContainer::GetOpt( sal_uInt16 nPropId, sal_uInt32& rPropValue ) const
+{
+ EscherPropSortStruct aPropStruct;
+
+ if ( GetOpt( nPropId, aPropStruct ) )
+ {
+ rPropValue = aPropStruct.nPropValue;
+ return sal_True;
+ }
+ return sal_False;
+}
+
+sal_Bool EscherPropertyContainer::GetOpt( sal_uInt16 nPropId, EscherPropSortStruct& rPropValue ) const
+{
+ for( sal_uInt32 i = 0; i < nSortCount; i++ )
+ {
+ if ( ( pSortStruct[ i ].nPropId &~0xc000 ) == ( nPropId &~0xc000 ) )
+ {
+ rPropValue = pSortStruct[ i ];
+ return sal_True;
+ }
+ }
+ return sal_False;
+}
+
+EscherProperties EscherPropertyContainer::GetOpts() const
+{
+ EscherProperties aVector;
+
+ for ( sal_uInt32 i = 0; i < nSortCount; ++i )
+ aVector.push_back( pSortStruct[ i ] );
+
+ return aVector;
+}
+
+extern "C" int __LOADONCALLAPI EscherPropSortFunc( const void* p1, const void* p2 )
+{
+ INT16 nID1 = ((EscherPropSortStruct*)p1)->nPropId &~0xc000;
+ INT16 nID2 = ((EscherPropSortStruct*)p2)->nPropId &~0xc000;
+
+ if( nID1 < nID2 )
+ return -1;
+ else if( nID1 > nID2 )
+ return 1;
+ else
+ return 0;
+}
+
+void EscherPropertyContainer::Commit( SvStream& rSt, sal_uInt16 nVersion, sal_uInt16 nRecType )
+{
+ rSt << (sal_uInt16)( ( nCountCount << 4 ) | ( nVersion & 0xf ) ) << nRecType << nCountSize;
+ if ( nSortCount )
+ {
+ qsort( pSortStruct, nSortCount, sizeof( EscherPropSortStruct ), EscherPropSortFunc );
+ sal_uInt32 i;
+
+ for ( i = 0; i < nSortCount; i++ )
+ {
+ sal_uInt32 nPropValue = pSortStruct[ i ].nPropValue;
+ sal_uInt16 nPropId = pSortStruct[ i ].nPropId;
+
+ if ( bSuppressRotation && ( nPropId == ESCHER_Prop_Rotation ) )
+ nPropValue = 0;
+
+ rSt << nPropId
+ << nPropValue;
+ }
+ if ( bHasComplexData )
+ {
+ for ( i = 0; i < nSortCount; i++ )
+ {
+ if ( pSortStruct[ i ].pBuf )
+ rSt.Write( pSortStruct[ i ].pBuf, pSortStruct[ i ].nPropSize );
+ }
+ }
+ }
+}
+
+sal_Bool EscherPropertyContainer::IsFontWork() const
+{
+ sal_uInt32 nTextPathFlags = 0;
+ GetOpt( DFF_Prop_gtextFStrikethrough, nTextPathFlags );
+ return ( nTextPathFlags & 0x4000 ) != 0;
+}
+
+sal_uInt32 EscherPropertyContainer::ImplGetColor( const sal_uInt32 nSOColor, sal_Bool bSwap )
+{
+ if ( bSwap )
+ {
+ sal_uInt32 nColor = nSOColor & 0xff00; // GRUEN
+ nColor |= (sal_uInt8)( nSOColor ) << 16; // ROT
+ nColor |= (sal_uInt8)( nSOColor >> 16 ); // BLAU
+ return nColor;
+ }
+ else
+ return nSOColor & 0xffffff;
+}
+
+sal_uInt32 EscherPropertyContainer::GetGradientColor(
+ const ::com::sun::star::awt::Gradient* pGradient,
+ sal_uInt32 nStartColor )
+{
+ sal_uInt32 nIntensity = 100;
+ Color aColor;
+
+ if ( pGradient )
+ {
+ if ( nStartColor & 1 )
+ {
+ nIntensity = pGradient->StartIntensity;
+ aColor = pGradient->StartColor;
+ }
+ else
+ {
+ nIntensity = pGradient->EndIntensity;
+ aColor = pGradient->EndColor;
+ }
+ }
+ sal_uInt32 nRed = ( ( aColor.GetRed() * nIntensity ) / 100 );
+ sal_uInt32 nGreen = ( ( aColor.GetGreen() * nIntensity ) / 100 ) << 8;
+ sal_uInt32 nBlue = ( ( aColor.GetBlue() * nIntensity ) / 100 ) << 16;
+ return nRed | nGreen | nBlue;
+}
+
+void EscherPropertyContainer::CreateGradientProperties(
+ const ::com::sun::star::awt::Gradient & rGradient )
+{
+ sal_uInt32 nFillType = ESCHER_FillShadeScale;
+ sal_uInt32 nAngle = 0;
+ sal_uInt32 nFillFocus = 0;
+ sal_uInt32 nFillLR = 0;
+ sal_uInt32 nFillTB = 0;
+ sal_uInt32 nFirstColor = 0;
+ bool bWriteFillTo = false;
+
+ switch ( rGradient.Style )
+ {
+ case ::com::sun::star::awt::GradientStyle_LINEAR :
+ case ::com::sun::star::awt::GradientStyle_AXIAL :
+ {
+ nFillType = ESCHER_FillShadeScale;
+ nAngle = (rGradient.Angle * 0x10000) / 10;
+ nFillFocus = (sal::static_int_cast<int>(rGradient.Style) ==
+ sal::static_int_cast<int>(GradientStyle_LINEAR)) ? 0 : 50;
+ }
+ break;
+ case ::com::sun::star::awt::GradientStyle_RADIAL :
+ case ::com::sun::star::awt::GradientStyle_ELLIPTICAL :
+ case ::com::sun::star::awt::GradientStyle_SQUARE :
+ case ::com::sun::star::awt::GradientStyle_RECT :
+ {
+ nFillLR = (rGradient.XOffset * 0x10000) / 100;
+ nFillTB = (rGradient.YOffset * 0x10000) / 100;
+ if ( ((nFillLR > 0) && (nFillLR < 0x10000)) || ((nFillTB > 0) && (nFillTB < 0x10000)) )
+ nFillType = ESCHER_FillShadeShape;
+ else
+ nFillType = ESCHER_FillShadeCenter;
+ nFirstColor = 1;
+ bWriteFillTo = true;
+ }
+ break;
+ case ::com::sun::star::awt::GradientStyle_MAKE_FIXED_SIZE : break;
+ }
+ AddOpt( ESCHER_Prop_fillType, nFillType );
+ AddOpt( ESCHER_Prop_fillAngle, nAngle );
+ AddOpt( ESCHER_Prop_fillColor, GetGradientColor( &rGradient, nFirstColor ) );
+ AddOpt( ESCHER_Prop_fillBackColor, GetGradientColor( &rGradient, nFirstColor ^ 1 ) );
+ AddOpt( ESCHER_Prop_fillFocus, nFillFocus );
+ if ( bWriteFillTo )
+ {
+ AddOpt( ESCHER_Prop_fillToLeft, nFillLR );
+ AddOpt( ESCHER_Prop_fillToTop, nFillTB );
+ AddOpt( ESCHER_Prop_fillToRight, nFillLR );
+ AddOpt( ESCHER_Prop_fillToBottom, nFillTB );
+ }
+}
+
+void EscherPropertyContainer::CreateGradientProperties(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet )
+{
+ ::com::sun::star::uno::Any aAny;
+ ::com::sun::star::awt::Gradient aGradient;
+ if ( EscherPropertyValueHelper::GetPropertyValue(
+ aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FillGradient" ) ), sal_False ) )
+ {
+ aGradient = *static_cast< const ::com::sun::star::awt::Gradient* >( aAny.getValue() );
+ }
+ CreateGradientProperties( aGradient );
+};
+
+void EscherPropertyContainer::CreateFillProperties(
+ const uno::Reference< beans::XPropertySet > & rXPropSet,
+ sal_Bool bEdge )
+{
+ ::com::sun::star::uno::Any aAny;
+ AddOpt( ESCHER_Prop_WrapText, ESCHER_WrapNone );
+ AddOpt( ESCHER_Prop_AnchorText, ESCHER_AnchorMiddle );
+
+ sal_uInt32 nFillBackColor = 0;
+
+ const rtl::OUString aPropName( String( RTL_CONSTASCII_USTRINGPARAM( "FillStyle" ) ) );
+ if ( EscherPropertyValueHelper::GetPropertyValue(
+ aAny, rXPropSet, aPropName, sal_False ) )
+ {
+ ::com::sun::star::drawing::FillStyle eFS;
+ if ( ! ( aAny >>= eFS ) )
+ eFS = ::com::sun::star::drawing::FillStyle_SOLID;
+ switch( eFS )
+ {
+ case ::com::sun::star::drawing::FillStyle_GRADIENT :
+ {
+ CreateGradientProperties( rXPropSet );
+ AddOpt( ESCHER_Prop_fNoFillHitTest, 0x140014 );
+ }
+ break;
+
+ case ::com::sun::star::drawing::FillStyle_BITMAP :
+ {
+ CreateGraphicProperties( rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FillBitmapURL" ) ), sal_True );
+ AddOpt( ESCHER_Prop_fNoFillHitTest, 0x140014 );
+ AddOpt( ESCHER_Prop_fillBackColor, nFillBackColor );
+ }
+ break;
+ case ::com::sun::star::drawing::FillStyle_HATCH :
+ {
+ CreateGraphicProperties( rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FillHatch" ) ), sal_True );
+ }
+ break;
+ case ::com::sun::star::drawing::FillStyle_SOLID :
+ default:
+ {
+ ::com::sun::star::beans::PropertyState ePropState = EscherPropertyValueHelper::GetPropertyState(
+ rXPropSet, aPropName );
+ if ( ePropState == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
+ AddOpt( ESCHER_Prop_fillType, ESCHER_FillSolid );
+
+ if ( EscherPropertyValueHelper::GetPropertyValue(
+ aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FillColor" ) ), sal_False ) )
+ {
+ sal_uInt32 nFillColor = ImplGetColor( *((sal_uInt32*)aAny.getValue()) );
+ nFillBackColor = nFillColor ^ 0xffffff;
+ AddOpt( ESCHER_Prop_fillColor, nFillColor );
+ }
+ AddOpt( ESCHER_Prop_fNoFillHitTest, 0x100010 );
+ AddOpt( ESCHER_Prop_fillBackColor, nFillBackColor );
+ break;
+ }
+ case ::com::sun::star::drawing::FillStyle_NONE :
+ AddOpt( ESCHER_Prop_fNoFillHitTest, 0x100000 );
+ break;
+ }
+ if ( eFS != ::com::sun::star::drawing::FillStyle_NONE )
+ {
+ sal_uInt16 nTransparency = ( EscherPropertyValueHelper::GetPropertyValue(
+ aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FillTransparence" ) ), sal_True ) )
+ ? *((sal_Int16*)aAny.getValue() )
+ : 0;
+ if ( nTransparency )
+ AddOpt( ESCHER_Prop_fillOpacity, ( ( 100 - nTransparency ) << 16 ) / 100 );
+ }
+ }
+ CreateLineProperties( rXPropSet, bEdge );
+}
+
+void EscherPropertyContainer::CreateTextProperties(
+ const uno::Reference< beans::XPropertySet > & rXPropSet, sal_uInt32 nTextId,
+ const sal_Bool bIsCustomShape, const sal_Bool bIsTextFrame )
+{
+ uno::Any aAny;
+ text::WritingMode eWM( text::WritingMode_LR_TB );
+ drawing::TextVerticalAdjust eVA( drawing::TextVerticalAdjust_TOP );
+ drawing::TextHorizontalAdjust eHA( drawing::TextHorizontalAdjust_LEFT );
+
+ sal_Int32 nLeft ( 0 );
+ sal_Int32 nTop ( 0 );
+ sal_Int32 nRight ( 0 );
+ sal_Int32 nBottom ( 0 );
+
+ // used with normal shapes:
+ sal_Bool bAutoGrowWidth ( sal_False );
+ sal_Bool bAutoGrowHeight ( sal_False );
+ // used with ashapes:
+ sal_Bool bWordWrap ( sal_False );
+ sal_Bool bAutoGrowSize ( sal_False );
+
+ if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "TextWritingMode" ) ), sal_True ) )
+ aAny >>= eWM;
+ if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "TextVerticalAdjust" ) ), sal_True ) )
+ aAny >>= eVA;
+ if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "TextHorizontalAdjust" ) ), sal_True ) )
+ aAny >>= eHA;
+ if ( bIsCustomShape )
+ {
+ if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "TextWordWrap" ) ), sal_False ) )
+ aAny >>= bWordWrap;
+ if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "TextAutoGrowHeight" ) ), sal_True ) )
+ aAny >>= bAutoGrowSize;
+ }
+ else if ( bIsTextFrame )
+ {
+ if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "TextAutoGrowWidth" ) ), sal_True ) )
+ aAny >>= bAutoGrowWidth;
+
+// i63936 not setting autogrowheight, because otherwise
+// the minframeheight of the text will be ignored
+//
+// if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "TextAutoGrowHeight" ) ), sal_True ) )
+// aAny >>= bAutoGrowHeight;
+ }
+ if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "TextLeftDistance" ) ) ) )
+ aAny >>= nLeft;
+ if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "TextUpperDistance" ) ) ) )
+ aAny >>= nTop;
+ if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "TextRightDistance" ) ) ) )
+ aAny >>= nRight;
+ if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "TextLowerDistance" ) ) ) )
+ aAny >>= nBottom;
+
+/*
+ if ( rObj.ImplGetPropertyValue(
+ ::rtl::OUString::createFromAscii("TextWritingMode") ) )
+ {
+ ::com::sun::star::text::WritingMode eMode;
+ rObj.GetUsrAny() >>= eMode;
+ switch (eMode)
+ {
+ case ::com::sun::star::text::WritingMode_TB_RL:
+ //Well if it so happens that we are fliped 180 we can use
+ //this instead.
+ if (rObj.GetAngle() == 18000)
+ eFlow = ESCHER_txflBtoT;
+ else
+ eFlow = ESCHER_txflTtoBA;
+ break;
+ case ::com::sun::star::text::WritingMode_RL_TB:
+ eDir = ESCHER_txdirRTL;
+ break;
+ }
+ }
+*/
+
+ ESCHER_AnchorText eAnchor = ESCHER_AnchorTop;
+ ESCHER_WrapMode eWrapMode = ESCHER_WrapSquare;
+ sal_uInt32 nTextAttr = 0x40004; // rotate text with shape
+
+ if ( eWM == text::WritingMode_TB_RL )
+ { // verical writing
+ switch ( eHA )
+ {
+ case drawing::TextHorizontalAdjust_LEFT :
+ eAnchor = ESCHER_AnchorBottom;
+ break;
+ case drawing::TextHorizontalAdjust_CENTER :
+ eAnchor = ESCHER_AnchorMiddle;
+ break;
+ default :
+ case drawing::TextHorizontalAdjust_BLOCK :
+ case drawing::TextHorizontalAdjust_RIGHT :
+ eAnchor = ESCHER_AnchorTop;
+ break;
+ }
+ if ( eVA == drawing::TextVerticalAdjust_CENTER )
+ {
+ switch ( eAnchor )
+ {
+ case ESCHER_AnchorMiddle :
+ eAnchor = ESCHER_AnchorMiddleCentered;
+ break;
+ case ESCHER_AnchorBottom :
+ eAnchor = ESCHER_AnchorBottomCentered;
+ break;
+ default :
+ case ESCHER_AnchorTop :
+ eAnchor = ESCHER_AnchorTopCentered;
+ break;
+ }
+ }
+ if ( bIsCustomShape )
+ {
+ if ( bWordWrap )
+ eWrapMode = ESCHER_WrapSquare;
+ else
+ eWrapMode = ESCHER_WrapNone;
+ if ( bAutoGrowSize )
+ nTextAttr |= 0x20002;
+ }
+ else
+ {
+ if ( bAutoGrowHeight )
+ eWrapMode = ESCHER_WrapNone;
+ if ( bAutoGrowWidth )
+ nTextAttr |= 0x20002;
+ }
+
+ AddOpt( ESCHER_Prop_txflTextFlow, ESCHER_txflTtoBA ); // rotate text within shape by 90
+ }
+ else
+ { // normal from left to right
+ switch ( eVA )
+ {
+ case drawing::TextVerticalAdjust_CENTER :
+ eAnchor = ESCHER_AnchorMiddle;
+ break;
+
+ case drawing::TextVerticalAdjust_BOTTOM :
+ eAnchor = ESCHER_AnchorBottom;
+ break;
+
+ default :
+ case drawing::TextVerticalAdjust_TOP :
+ eAnchor = ESCHER_AnchorTop;
+ break;
+ }
+ if ( eHA == drawing::TextHorizontalAdjust_CENTER )
+ {
+ switch( eAnchor )
+ {
+ case ESCHER_AnchorMiddle :
+ eAnchor = ESCHER_AnchorMiddleCentered;
+ break;
+ case ESCHER_AnchorBottom :
+ eAnchor = ESCHER_AnchorBottomCentered;
+ break;
+ case ESCHER_AnchorTop :
+ eAnchor = ESCHER_AnchorTopCentered;
+ break;
+ default: break;
+ }
+ }
+ if ( bIsCustomShape )
+ {
+ if ( bWordWrap )
+ eWrapMode = ESCHER_WrapSquare;
+ else
+ eWrapMode = ESCHER_WrapNone;
+ if ( bAutoGrowSize )
+ nTextAttr |= 0x20002;
+ }
+ else
+ {
+ if ( bAutoGrowWidth )
+ eWrapMode = ESCHER_WrapNone;
+ if ( bAutoGrowHeight )
+ nTextAttr |= 0x20002;
+ }
+ }
+ AddOpt( ESCHER_Prop_dxTextLeft, nLeft * 360 );
+ AddOpt( ESCHER_Prop_dxTextRight, nRight * 360 );
+ AddOpt( ESCHER_Prop_dyTextTop, nTop * 360 );
+ AddOpt( ESCHER_Prop_dyTextBottom, nBottom * 360 );
+
+ AddOpt( ESCHER_Prop_WrapText, eWrapMode );
+ AddOpt( ESCHER_Prop_AnchorText, eAnchor );
+ AddOpt( ESCHER_Prop_FitTextToShape, nTextAttr );
+
+ if ( nTextId )
+ AddOpt( ESCHER_Prop_lTxid, nTextId );
+}
+
+sal_Bool EscherPropertyContainer::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 String sLineStart ( RTL_CONSTASCII_USTRINGPARAM( "LineStart" ) );
+ static String sLineStartName( RTL_CONSTASCII_USTRINGPARAM( "LineStartName" ) );
+ static String sLineEnd ( RTL_CONSTASCII_USTRINGPARAM( "LineEnd" ) );
+ static String sLineEndName ( RTL_CONSTASCII_USTRINGPARAM( "LineEndName" ) );
+
+ const String sLine ( bLineStart ? sLineStart : sLineEnd );
+ const String sLineName ( bLineStart ? sLineStartName : sLineEndName );
+
+ sal_Bool bIsArrow = sal_False;
+
+ ::com::sun::star::uno::Any aAny;
+ if ( EscherPropertyValueHelper::GetPropertyValue(
+ aAny, rXPropSet, sLine, sal_False ) )
+ {
+ PolyPolygon aPolyPoly( EscherPropertyContainer::GetPolyPolygon( aAny ) );
+ if ( aPolyPoly.Count() && aPolyPoly[ 0 ].GetSize() )
+ {
+ bIsArrow = sal_True;
+
+ reLineEnd = ESCHER_LineArrowEnd;
+ rnArrowLength = 1;
+ rnArrowWidth = 1;
+
+ if ( EscherPropertyValueHelper::GetPropertyValue(
+ aAny, rXPropSet, sLineName, sal_False ) )
+ {
+ String aArrowStartName = *(::rtl::OUString*)aAny.getValue();
+ rtl::OUString aApiName;
+ sal_Int16 nWhich = bLineStart ? XATTR_LINESTART : XATTR_LINEEND;
+
+ SvxUnogetApiNameForItem( nWhich, aArrowStartName, aApiName );
+ if ( aApiName.getLength() )
+ {
+
+ /* todo:
+ calculate the best option for ArrowLenght and ArrowWidth
+ */
+ if ( aApiName.equalsAscii( "Arrow concave" ) )
+ reLineEnd = ESCHER_LineArrowStealthEnd;
+ else if ( aApiName.equalsAscii( "Square 45" ) )
+ reLineEnd = ESCHER_LineArrowDiamondEnd;
+ else if ( aApiName.equalsAscii( "Small Arrow" ) )
+ reLineEnd = ESCHER_LineArrowEnd;
+ else if ( aApiName.equalsAscii( "Dimension Lines" ) )
+ {
+ rnArrowLength = 0;
+ rnArrowWidth = 2;
+ reLineEnd = ESCHER_LineArrowOvalEnd;
+ }
+ else if ( aApiName.equalsAscii( "Double Arrow" ) )
+ reLineEnd = ESCHER_LineArrowEnd;
+ else if ( aApiName.equalsAscii( "Rounded short Arrow" ) )
+ reLineEnd = ESCHER_LineArrowEnd;
+ else if ( aApiName.equalsAscii( "Symmetric Arrow" ) )
+ reLineEnd = ESCHER_LineArrowEnd;
+ else if ( aApiName.equalsAscii( "Line Arrow" ) )
+ reLineEnd = ESCHER_LineArrowOpenEnd;
+ else if ( aApiName.equalsAscii( "Rounded large Arrow" ) )
+ reLineEnd = ESCHER_LineArrowEnd;
+ else if ( aApiName.equalsAscii( "Circle" ) )
+ reLineEnd = ESCHER_LineArrowOvalEnd;
+ else if ( aApiName.equalsAscii( "Square" ) )
+ reLineEnd = ESCHER_LineArrowDiamondEnd;
+ else if ( aApiName.equalsAscii( "Arrow" ) )
+ reLineEnd = ESCHER_LineArrowEnd;
+ }
+ else if ( aArrowStartName.GetTokenCount( ' ' ) == 2 )
+ {
+ sal_Bool b = sal_True;
+ String aArrowName( aArrowStartName.GetToken( 0, ' ' ) );
+ if ( aArrowName.EqualsAscii( "msArrowEnd" ) )
+ reLineEnd = ESCHER_LineArrowEnd;
+ else if ( aArrowName.EqualsAscii( "msArrowOpenEnd" ) )
+ reLineEnd = ESCHER_LineArrowOpenEnd;
+ else if ( aArrowName.EqualsAscii( "msArrowStealthEnd" ) )
+ reLineEnd = ESCHER_LineArrowStealthEnd;
+ else if ( aArrowName.EqualsAscii( "msArrowDiamondEnd" ) )
+ reLineEnd = ESCHER_LineArrowDiamondEnd;
+ else if ( aArrowName.EqualsAscii( "msArrowOvalEnd" ) )
+ reLineEnd = ESCHER_LineArrowOvalEnd;
+ else
+ b = sal_False;
+
+ // now we have the arrow, and try to determine the arrow size;
+ if ( b )
+ {
+ String aArrowSize( aArrowStartName.GetToken( 1, ' ' ) );
+ sal_Int32 nArrowSize = aArrowSize.ToInt32();
+ rnArrowWidth = ( nArrowSize - 1 ) / 3;
+ rnArrowLength = nArrowSize - ( rnArrowWidth * 3 ) - 1;
+ }
+ }
+ }
+ }
+ }
+ return bIsArrow;
+}
+
+void EscherPropertyContainer::CreateLineProperties(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
+ sal_Bool bEdge )
+{
+ ::com::sun::star::uno::Any aAny;
+ sal_uInt32 nLineFlags = 0x80008;
+
+ ESCHER_LineEnd eLineEnd;
+ sal_Int32 nArrowLength;
+ sal_Int32 nArrowWidth;
+
+ sal_Bool bSwapLineEnds = sal_False;
+ if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "CircleKind" ) ), sal_True ) )
+ {
+ ::com::sun::star::drawing::CircleKind eCircleKind;
+ if ( aAny >>= eCircleKind )
+ {
+ if ( eCircleKind == ::com::sun::star::drawing::CircleKind_ARC )
+ bSwapLineEnds = sal_True;
+ }
+ }
+ if ( GetLineArrow( bSwapLineEnds ? sal_False : sal_True, rXPropSet, eLineEnd, nArrowLength, nArrowWidth ) )
+ {
+ AddOpt( ESCHER_Prop_lineStartArrowLength, nArrowLength );
+ AddOpt( ESCHER_Prop_lineStartArrowWidth, nArrowWidth );
+ AddOpt( ESCHER_Prop_lineStartArrowhead, eLineEnd );
+ nLineFlags |= 0x100010;
+ }
+ if ( GetLineArrow( bSwapLineEnds ? sal_True : sal_False, rXPropSet, eLineEnd, nArrowLength, nArrowWidth ) )
+ {
+ AddOpt( ESCHER_Prop_lineEndArrowLength, nArrowLength );
+ AddOpt( ESCHER_Prop_lineEndArrowWidth, nArrowWidth );
+ AddOpt( ESCHER_Prop_lineEndArrowhead, eLineEnd );
+ nLineFlags |= 0x100010;
+ }
+ if ( EscherPropertyValueHelper::GetPropertyValue(
+ aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "LineStyle" ) ), sal_False ) )
+ {
+ ::com::sun::star::drawing::LineStyle eLS;
+ if ( aAny >>= eLS )
+ {
+ switch ( eLS )
+ {
+ case ::com::sun::star::drawing::LineStyle_NONE :
+ AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x90000 ); // 80000
+ break;
+
+ case ::com::sun::star::drawing::LineStyle_DASH :
+ {
+ if ( EscherPropertyValueHelper::GetPropertyValue(
+ aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "LineDash" ) ), sal_False ) )
+ {
+ ESCHER_LineDashing eDash = ESCHER_LineSolid;
+ ::com::sun::star::drawing::LineDash* pLineDash = (::com::sun::star::drawing::LineDash*)aAny.getValue();
+ sal_Int32 nDistance = pLineDash->Distance << 1;
+ switch ( pLineDash->Style )
+ {
+ case ::com::sun::star::drawing::DashStyle_ROUND :
+ case ::com::sun::star::drawing::DashStyle_ROUNDRELATIVE :
+ AddOpt( ESCHER_Prop_lineEndCapStyle, 0 ); // Style Round setzen
+ break;
+ default : break;
+ }
+ if ( ((!(pLineDash->Dots )) || (!(pLineDash->Dashes )) ) || ( pLineDash->DotLen == pLineDash->DashLen ) )
+ {
+ sal_Int32 nLen = pLineDash->DotLen;
+ if ( pLineDash->Dashes )
+ nLen = pLineDash->DashLen;
+
+ if ( nLen >= nDistance )
+ eDash = ESCHER_LineLongDashGEL;
+ else if ( pLineDash->Dots )
+ eDash = ESCHER_LineDotSys;
+ else
+ eDash = ESCHER_LineDashGEL;
+ }
+ else // X Y
+ {
+ if ( pLineDash->Dots != pLineDash->Dashes )
+ {
+ if ( ( pLineDash->DashLen > nDistance ) || ( pLineDash->DotLen > nDistance ) )
+ eDash = ESCHER_LineLongDashDotDotGEL;
+ else
+ eDash = ESCHER_LineDashDotDotSys;
+ }
+ else // X Y Y
+ {
+ if ( ( pLineDash->DashLen > nDistance ) || ( pLineDash->DotLen > nDistance ) )
+ eDash = ESCHER_LineLongDashDotGEL;
+ else
+ eDash = ESCHER_LineDashDotGEL;
+
+ }
+ }
+ AddOpt( ESCHER_Prop_lineDashing, eDash );
+ }
+ }
+ case ::com::sun::star::drawing::LineStyle_SOLID :
+ default:
+ {
+ AddOpt( ESCHER_Prop_fNoLineDrawDash, nLineFlags );
+ }
+ break;
+ }
+ }
+ if ( EscherPropertyValueHelper::GetPropertyValue(
+ aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "LineColor" ) ), sal_False ) )
+ {
+ sal_uInt32 nLineColor = ImplGetColor( *((sal_uInt32*)aAny.getValue()) );
+ AddOpt( ESCHER_Prop_lineColor, nLineColor );
+ AddOpt( ESCHER_Prop_lineBackColor, nLineColor ^ 0xffffff );
+ }
+ }
+
+ sal_uInt32 nLineSize = ( EscherPropertyValueHelper::GetPropertyValue(
+ aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "LineWidth" ) ), sal_False ) )
+ ? *((sal_uInt32*)aAny.getValue())
+ : 0;
+ if ( nLineSize > 1 )
+ AddOpt( ESCHER_Prop_lineWidth, nLineSize * 360 ); // 100TH MM -> PT , 1PT = 12700 EMU
+
+ ESCHER_LineJoin eLineJoin = ESCHER_LineJoinMiter;
+ if ( EscherPropertyValueHelper::GetPropertyValue(
+ aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "LineJoint" ) ), sal_True ) )
+ {
+ ::com::sun::star::drawing::LineJoint eLJ;
+ if ( aAny >>= eLJ )
+ {
+ switch ( eLJ )
+ {
+ case com::sun::star::drawing::LineJoint_NONE :
+ case com::sun::star::drawing::LineJoint_MIDDLE :
+ case com::sun::star::drawing::LineJoint_BEVEL :
+ eLineJoin = ESCHER_LineJoinBevel;
+ break;
+ default:
+ case com::sun::star::drawing::LineJoint_MITER :
+ eLineJoin = ESCHER_LineJoinMiter;
+ break;
+ case com::sun::star::drawing::LineJoint_ROUND :
+ eLineJoin = ESCHER_LineJoinRound;
+ break;
+ }
+ }
+ }
+ AddOpt( ESCHER_Prop_lineJoinStyle, eLineJoin );
+
+ if ( bEdge == sal_False )
+ {
+ AddOpt( ESCHER_Prop_fFillOK, 0x1001 );
+ AddOpt( ESCHER_Prop_fNoFillHitTest, 0x100000 );
+ }
+}
+
+static Size lcl_SizeToEmu(Size aPrefSize, MapMode aPrefMapMode)
+{
+ Size aRetSize;
+ if (aPrefMapMode == MAP_PIXEL)
+ aRetSize = Application::GetDefaultDevice()->PixelToLogic( aPrefSize, MAP_100TH_MM );
+ else
+ aRetSize = Application::GetDefaultDevice()->LogicToLogic( aPrefSize, aPrefMapMode, MAP_100TH_MM );
+ return aRetSize;
+}
+
+void EscherPropertyContainer::ImplCreateGraphicAttributes( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
+ sal_uInt32 nBlibId, sal_Bool bCreateCroppingAttributes )
+{
+ ::com::sun::star::uno::Any aAny;
+
+ sal_uInt32 nPicFlags = 0;
+ ::com::sun::star::drawing::ColorMode eColorMode( ::com::sun::star::drawing::ColorMode_STANDARD );
+ sal_Int16 nLuminance = 0;
+ sal_Int32 nContrast = 0;
+ sal_Int16 nRed = 0;
+ sal_Int16 nGreen = 0;
+ sal_Int16 nBlue = 0;
+ double fGamma = 1.0;
+ sal_Int16 nTransparency = 0;
+
+ if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "GraphicColorMode" ) ) ) )
+ aAny >>= eColorMode;
+ if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "AdjustLuminance" ) ) ) )
+ aAny >>= nLuminance;
+ if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "AdjustContrast" ) ) ) )
+ {
+ sal_Int16 nC = sal_Int16();
+ aAny >>= nC;
+ nContrast = nC;
+ }
+ if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "AdjustRed" ) ) ) )
+ aAny >>= nRed;
+ if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "AdjustGreen" ) ) ) )
+ aAny >>= nGreen;
+ if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "AdjustBlue" ) ) ) )
+ aAny >>= nBlue;
+ if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Gamma" ) ) ) )
+ aAny >>= fGamma;
+ if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Transparency" ) ) ) )
+ aAny >>= nTransparency;
+
+ if ( eColorMode == ::com::sun::star::drawing::ColorMode_WATERMARK )
+ {
+ eColorMode = ::com::sun::star::drawing::ColorMode_STANDARD;
+ nLuminance += 70;
+ if ( nLuminance > 100 )
+ nLuminance = 100;
+ nContrast -= 70;
+ if ( nContrast < -100 )
+ nContrast = -100;
+ }
+ if ( eColorMode == ::com::sun::star::drawing::ColorMode_GREYS )
+ nPicFlags |= 0x40004;
+ else if ( eColorMode == ::com::sun::star::drawing::ColorMode_MONO )
+ nPicFlags |= 0x60006;
+
+ if ( nContrast )
+ {
+ nContrast += 100;
+ if ( nContrast == 100)
+ nContrast = 0x10000;
+ else if ( nContrast < 100 )
+ {
+ nContrast *= 0x10000;
+ nContrast /= 100;
+ }
+ else if ( nContrast < 200 )
+ nContrast = ( 100 * 0x10000 ) / ( 200 - nContrast );
+ else
+ nContrast = 0x7fffffff;
+ AddOpt( ESCHER_Prop_pictureContrast, nContrast );
+ }
+ if ( nLuminance )
+ AddOpt( ESCHER_Prop_pictureBrightness, nLuminance * 327 );
+ if ( nPicFlags )
+ AddOpt( ESCHER_Prop_pictureActive, nPicFlags );
+
+ if ( bCreateCroppingAttributes && pGraphicProvider )
+ {
+ Size aPrefSize;
+ MapMode aPrefMapMode;
+ if ( pGraphicProvider->GetPrefSize( nBlibId, aPrefSize, aPrefMapMode ) )
+ {
+ Size aCropSize(lcl_SizeToEmu(aPrefSize, aPrefMapMode));
+ if ( aCropSize.Width() && aCropSize.Height() )
+ {
+ if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "GraphicCrop" ) ) ) )
+ {
+ ::com::sun::star::text::GraphicCrop aGraphCrop;
+ if ( aAny >>= aGraphCrop )
+ {
+ if ( aGraphCrop.Left )
+ {
+ sal_uInt32 nLeft = ( aGraphCrop.Left * 65536 ) / aCropSize.Width();
+ AddOpt( ESCHER_Prop_cropFromLeft, nLeft );
+ }
+ if ( aGraphCrop.Top )
+ {
+ sal_uInt32 nTop = ( aGraphCrop.Top * 65536 ) / aCropSize.Height();
+ AddOpt( ESCHER_Prop_cropFromTop, nTop );
+ }
+ if ( aGraphCrop.Right )
+ {
+ sal_uInt32 nRight = ( aGraphCrop.Right * 65536 ) / aCropSize.Width();
+ AddOpt( ESCHER_Prop_cropFromRight, nRight );
+ }
+ if ( aGraphCrop.Bottom )
+ {
+ sal_uInt32 nBottom = ( aGraphCrop.Bottom * 65536 ) / aCropSize.Height();
+ AddOpt( ESCHER_Prop_cropFromBottom, nBottom );
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+sal_Bool EscherPropertyContainer::CreateShapeProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape )
+{
+ uno::Reference< beans::XPropertySet > aXPropSet( rXShape, uno::UNO_QUERY );
+ if ( aXPropSet.is() )
+ {
+ sal_Bool bVal = false;
+ ::com::sun::star::uno::Any aAny;
+ sal_uInt32 nShapeAttr = 0;
+ EscherPropertyValueHelper::GetPropertyValue( aAny, aXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Visible" ) ), sal_True );
+ if ( aAny >>= bVal )
+ {
+ if ( !bVal )
+ nShapeAttr |= 0x20002; // set fHidden = true
+ }
+ EscherPropertyValueHelper::GetPropertyValue( aAny, aXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Printable" ) ), sal_True );
+ if ( aAny >>= bVal )
+ {
+ if ( !bVal )
+ nShapeAttr |= 0x10000; // set fPrint = false;
+ }
+ if ( nShapeAttr )
+ AddOpt( ESCHER_Prop_fPrint, nShapeAttr );
+ }
+ return sal_True;
+}
+
+sal_Bool EscherPropertyContainer::CreateOLEGraphicProperties(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape )
+{
+ sal_Bool bRetValue = sal_False;
+
+ if ( rXShape.is() )
+ {
+ SdrObject* pSdrOLE2( GetSdrObjectFromXShape( rXShape ) ); // SJ: leaving unoapi, because currently there is
+ if ( pSdrOLE2 && pSdrOLE2->ISA( SdrOle2Obj ) ) // no access to the native graphic object
+ {
+ Graphic* pGraphic = ((SdrOle2Obj*)pSdrOLE2)->GetGraphic();
+ if ( pGraphic )
+ {
+ GraphicObject aGraphicObject( *pGraphic );
+ ByteString aUniqueId( aGraphicObject.GetUniqueID() );
+ if ( aUniqueId.Len() )
+ {
+ AddOpt( ESCHER_Prop_fillType, ESCHER_FillPicture );
+ uno::Reference< beans::XPropertySet > aXPropSet( rXShape, uno::UNO_QUERY );
+
+ if ( pGraphicProvider && pPicOutStrm && pShapeBoundRect && aXPropSet.is() )
+ {
+ ::com::sun::star::uno::Any aAny;
+ ::com::sun::star::awt::Rectangle* pVisArea = NULL;
+ if ( EscherPropertyValueHelper::GetPropertyValue( aAny, aXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "VisibleArea" ) ) ) )
+ {
+ pVisArea = new ::com::sun::star::awt::Rectangle;
+ aAny >>= (*pVisArea);
+ }
+ Rectangle aRect( Point( 0, 0 ), pShapeBoundRect->GetSize() );
+ sal_uInt32 nBlibId = pGraphicProvider->GetBlibID( *pPicOutStrm, aUniqueId, aRect, pVisArea, NULL );
+ if ( nBlibId )
+ {
+ AddOpt( ESCHER_Prop_pib, nBlibId, sal_True );
+ ImplCreateGraphicAttributes( aXPropSet, nBlibId, sal_False );
+ bRetValue = sal_True;
+ }
+ delete pVisArea;
+ }
+ }
+ }
+ }
+ }
+ return bRetValue;
+}
+
+
+sal_Bool EscherPropertyContainer::ImplCreateEmbeddedBmp( const ByteString& rUniqueId )
+{
+ if( rUniqueId.Len() > 0 )
+ {
+ EscherGraphicProvider aProvider;
+ SvMemoryStream aMemStrm;
+ Rectangle aRect;
+ if ( aProvider.GetBlibID( aMemStrm, rUniqueId, aRect ) )
+ {
+ // grab BLIP from stream and insert directly as complex property
+ // ownership of stream memory goes to complex property
+ aMemStrm.ObjectOwnsMemory( FALSE );
+ sal_uInt8* pBuf = (sal_uInt8*) aMemStrm.GetData();
+ sal_uInt32 nSize = aMemStrm.Seek( STREAM_SEEK_TO_END );
+ AddOpt( ESCHER_Prop_fillBlip, sal_True, nSize, pBuf, nSize );
+ return sal_True;
+ }
+ }
+ return sal_False;
+}
+
+sal_Bool EscherPropertyContainer::CreateEmbeddedBitmapProperties(
+ const ::rtl::OUString& rBitmapUrl, ::com::sun::star::drawing::BitmapMode eBitmapMode )
+{
+ sal_Bool bRetValue = sal_False;
+ String aVndUrl( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.GraphicObject:" ) );
+ String aBmpUrl( rBitmapUrl );
+ xub_StrLen nIndex = aBmpUrl.Search( aVndUrl, 0 );
+ if( nIndex != STRING_NOTFOUND )
+ {
+ // note: += ist not defined for xub_StrLen -> conversion to int and back to xub_StrLen
+ nIndex = nIndex + aVndUrl.Len();
+ if( aBmpUrl.Len() > nIndex )
+ {
+ ByteString aUniqueId( aBmpUrl, nIndex, aBmpUrl.Len() - nIndex, RTL_TEXTENCODING_UTF8 );
+ bRetValue = ImplCreateEmbeddedBmp( aUniqueId );
+ if( bRetValue )
+ {
+ // bitmap mode property
+ bool bRepeat = eBitmapMode == ::com::sun::star::drawing::BitmapMode_REPEAT;
+ AddOpt( ESCHER_Prop_fillType, bRepeat ? ESCHER_FillTexture : ESCHER_FillPicture );
+ }
+ }
+ }
+ return bRetValue;
+}
+
+
+namespace {
+
+GraphicObject lclDrawHatch( const ::com::sun::star::drawing::Hatch& rHatch, const Color& rBackColor, bool bFillBackground )
+{
+ const MapMode aMap100( MAP_100TH_MM );
+ VirtualDevice aVDev( *Application::GetDefaultDevice(), 0, 1 );
+ aVDev.SetMapMode( aMap100 );
+
+ const Size aOutSize = aVDev.PixelToLogic( Size( 28, 28 ) );
+ aVDev.SetOutputSize( aOutSize );
+
+ Rectangle aRectangle( Point( 0, 0 ), aOutSize );
+ const PolyPolygon aPolyPoly( aRectangle );
+
+ aVDev.SetLineColor();
+ aVDev.SetFillColor( bFillBackground ? rBackColor : Color( COL_TRANSPARENT ) );
+ aVDev.DrawRect( Rectangle( Point(), aOutSize ) );
+
+ Hatch aVclHatch( (HatchStyle) rHatch.Style, Color( rHatch.Color ), rHatch.Distance, (sal_uInt16)rHatch.Angle );
+ aVDev.DrawHatch( aPolyPoly, aVclHatch );
+
+ return GraphicObject( Graphic( aVDev.GetBitmapEx( Point(), aOutSize ) ) );
+}
+
+} // namespace
+
+
+sal_Bool EscherPropertyContainer::CreateEmbeddedHatchProperties( const ::com::sun::star::drawing::Hatch& rHatch, const Color& rBackColor, bool bFillBackground )
+{
+ GraphicObject aGraphicObject = lclDrawHatch( rHatch, rBackColor, bFillBackground );
+ ByteString aUniqueId = aGraphicObject.GetUniqueID();
+ sal_Bool bRetValue = ImplCreateEmbeddedBmp( aUniqueId );
+ if ( bRetValue )
+ AddOpt( ESCHER_Prop_fillType, ESCHER_FillTexture );
+ return bRetValue;
+}
+
+
+sal_Bool EscherPropertyContainer::CreateGraphicProperties(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
+ const String& rSource, const sal_Bool bCreateFillBitmap, const sal_Bool bCreateCroppingAttributes,
+ const sal_Bool bFillBitmapModeAllowed )
+{
+ sal_Bool bRetValue = sal_False;
+ sal_Bool bCreateFillStyles = sal_False;
+
+ sal_Bool bMirrored = sal_False;
+ sal_Bool bRotate = sal_True;
+ sal_uInt16 nAngle = 0;
+ GraphicAttr* pGraphicAttr = NULL;
+ GraphicObject aGraphicObject;
+ String aGraphicUrl;
+ ByteString aUniqueId;
+ bool bIsGraphicMtf(false);
+
+ ::com::sun::star::drawing::BitmapMode eBitmapMode( ::com::sun::star::drawing::BitmapMode_NO_REPEAT );
+ ::com::sun::star::uno::Any aAny;
+
+ if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, rSource ) )
+ {
+ if ( rSource == String( RTL_CONSTASCII_USTRINGPARAM( "MetaFile" ) ) )
+ {
+ ::com::sun::star::uno::Sequence<sal_uInt8> aSeq = *(::com::sun::star::uno::Sequence<sal_uInt8>*)aAny.getValue();
+ const sal_uInt8* pAry = aSeq.getArray();
+ sal_uInt32 nAryLen = aSeq.getLength();
+
+ // the metafile is already rotated
+ bRotate = sal_False;
+
+ if ( pAry && nAryLen )
+ {
+ Graphic aGraphic;
+ SvMemoryStream aTemp( (void*)pAry, nAryLen, STREAM_READ );
+ sal_uInt32 nErrCode = GraphicConverter::Import( aTemp, aGraphic, CVT_WMF );
+ if ( nErrCode == ERRCODE_NONE )
+ {
+ aGraphicObject = aGraphic;
+ aUniqueId = aGraphicObject.GetUniqueID();
+ bIsGraphicMtf = aGraphicObject.GetType() == GRAPHIC_GDIMETAFILE;
+ }
+ }
+ }
+ else if ( rSource == String( RTL_CONSTASCII_USTRINGPARAM( "Bitmap" ) ) )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap >xBitmap;
+ if ( ::cppu::extractInterface( xBitmap, aAny ) )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap > xBmp;
+ if ( aAny >>= xBmp )
+ {
+ BitmapEx aBitmapEx( VCLUnoHelper::GetBitmap( xBmp ) );
+ Graphic aGraphic( aBitmapEx );
+ aGraphicObject = aGraphic;
+ aUniqueId = aGraphicObject.GetUniqueID();
+ bIsGraphicMtf = aGraphicObject.GetType() == GRAPHIC_GDIMETAFILE;
+ }
+ }
+ }
+ else if ( rSource == String( RTL_CONSTASCII_USTRINGPARAM( "FillBitmapURL" ) ) )
+ {
+ aGraphicUrl = *(::rtl::OUString*)aAny.getValue();
+ }
+ else if ( rSource == String( RTL_CONSTASCII_USTRINGPARAM( "GraphicURL" ) ) )
+ {
+ aGraphicUrl = *(::rtl::OUString*)aAny.getValue();
+ bCreateFillStyles = sal_True;
+ }
+ else if ( rSource == String( RTL_CONSTASCII_USTRINGPARAM( "FillHatch" ) ) )
+ {
+ ::com::sun::star::drawing::Hatch aHatch;
+ if ( aAny >>= aHatch )
+ {
+ Color aBackColor;
+ if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet,
+ String( RTL_CONSTASCII_USTRINGPARAM( "FillColor" ) ), sal_False ) )
+ {
+ aBackColor = ImplGetColor( *((sal_uInt32*)aAny.getValue()), sal_False );
+ }
+ bool bFillBackground = false;
+ if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet,
+ String( RTL_CONSTASCII_USTRINGPARAM( "FillBackground" ) ), sal_True ) )
+ {
+ aAny >>= bFillBackground;
+ }
+ aGraphicObject = lclDrawHatch( aHatch, aBackColor, bFillBackground );
+ aUniqueId = aGraphicObject.GetUniqueID();
+ eBitmapMode = ::com::sun::star::drawing::BitmapMode_REPEAT;
+ bIsGraphicMtf = aGraphicObject.GetType() == GRAPHIC_GDIMETAFILE;
+ }
+ }
+
+ if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "IsMirrored" ) ), sal_True ) )
+ aAny >>= bMirrored;
+
+ if ( bCreateFillBitmap && bFillBitmapModeAllowed )
+ {
+ if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FillBitmapMode" ) ), sal_True ) )
+ aAny >>= eBitmapMode;
+ }
+ else
+ {
+ nAngle = bRotate && EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet,
+ String( RTL_CONSTASCII_USTRINGPARAM( "RotateAngle" ) ), sal_True )
+ ? (sal_uInt16)( ( *((sal_Int32*)aAny.getValue() ) ) + 5 ) / 10
+ : 0;
+ }
+
+ if ( aGraphicUrl.Len() )
+ {
+ String aVndUrl( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.GraphicObject:" ) );
+ xub_StrLen nIndex = aGraphicUrl.Search( aVndUrl, 0 );
+ if ( nIndex != STRING_NOTFOUND )
+ {
+ nIndex = nIndex + aVndUrl.Len();
+ if ( aGraphicUrl.Len() > nIndex )
+ aUniqueId = ByteString( aGraphicUrl, nIndex, aGraphicUrl.Len() - nIndex, RTL_TEXTENCODING_UTF8 );
+ }
+ else
+ {
+ // externally, linked graphic? convert to embedded
+ // one, if transformations are needed. this is because
+ // everything < msoxp cannot even handle rotated
+ // bitmaps.
+ // And check whether the graphic link target is
+ // actually supported by mso.
+ INetURLObject aTmp( aGraphicUrl );
+ GraphicDescriptor aDescriptor(aTmp);
+ aDescriptor.Detect();
+ const USHORT nFormat = aDescriptor.GetFileFormat();
+
+ // can MSO handle it?
+ if ( bMirrored || nAngle ||
+ (nFormat != GFF_BMP &&
+ nFormat != GFF_GIF &&
+ nFormat != GFF_JPG &&
+ nFormat != GFF_PNG &&
+ nFormat != GFF_TIF &&
+ nFormat != GFF_PCT &&
+ nFormat != GFF_WMF &&
+ nFormat != GFF_EMF) )
+ {
+ SvStream* pIn = ::utl::UcbStreamHelper::CreateStream(
+ aTmp.GetMainURL( INetURLObject::NO_DECODE ), STREAM_READ );
+ if ( pIn )
+ {
+ Graphic aGraphic;
+ sal_uInt32 nErrCode = GraphicConverter::Import( *pIn, aGraphic );
+
+ if ( nErrCode == ERRCODE_NONE )
+ {
+ // no.
+ aGraphicObject = aGraphic;
+ aUniqueId = aGraphicObject.GetUniqueID();
+ }
+ // else: simply keep the graphic link
+ delete pIn;
+ }
+ }
+ }
+ }
+
+ if ( aGraphicUrl.Len() || aUniqueId.Len() )
+ {
+ if ( bMirrored || nAngle )
+ {
+ pGraphicAttr = new GraphicAttr;
+ if ( bMirrored )
+ pGraphicAttr->SetMirrorFlags( BMP_MIRROR_HORZ );
+ if ( bIsGraphicMtf )
+ AddOpt( ESCHER_Prop_Rotation, ( ( ((sal_Int32)nAngle << 16 ) / 10 ) + 0x8000 ) &~ 0xffff );
+ else
+ {
+ pGraphicAttr->SetRotation( nAngle );
+ if ( nAngle && pShapeBoundRect ) // up to xp ppoint does not rotate bitmaps !
+ {
+ Polygon aPoly( *pShapeBoundRect );
+ aPoly.Rotate( pShapeBoundRect->TopLeft(), nAngle );
+ *pShapeBoundRect = aPoly.GetBoundRect();
+ bSuppressRotation = sal_True;
+ }
+ }
+ }
+
+ if ( eBitmapMode == ::com::sun::star::drawing::BitmapMode_REPEAT )
+ AddOpt( ESCHER_Prop_fillType, ESCHER_FillTexture );
+ else
+ AddOpt( ESCHER_Prop_fillType, ESCHER_FillPicture );
+
+ if ( aUniqueId.Len() )
+ {
+ // write out embedded graphic
+ if ( pGraphicProvider && pPicOutStrm && pShapeBoundRect )
+ {
+ Rectangle aRect( Point( 0, 0 ), pShapeBoundRect->GetSize() );
+
+ sal_uInt32 nBlibId = 0;
+ nBlibId = pGraphicProvider->GetBlibID( *pPicOutStrm, aUniqueId, aRect, NULL, pGraphicAttr );
+ if ( nBlibId )
+ {
+ if ( bCreateFillBitmap )
+ AddOpt( ESCHER_Prop_fillBlip, nBlibId, sal_True );
+ else
+ {
+ AddOpt( ESCHER_Prop_pib, nBlibId, sal_True );
+ ImplCreateGraphicAttributes( rXPropSet, nBlibId, bCreateCroppingAttributes );
+ }
+ bRetValue = sal_True;
+ }
+ }
+ else
+ {
+ EscherGraphicProvider aProvider;
+ SvMemoryStream aMemStrm;
+ Rectangle aRect;
+
+ if ( aProvider.GetBlibID( aMemStrm, aUniqueId, aRect, NULL, pGraphicAttr ) )
+ {
+ // grab BLIP from stream and insert directly as complex property
+ // ownership of stream memory goes to complex property
+ aMemStrm.ObjectOwnsMemory( FALSE );
+ sal_uInt8* pBuf = (sal_uInt8*) aMemStrm.GetData();
+ sal_uInt32 nSize = aMemStrm.Seek( STREAM_SEEK_TO_END );
+ AddOpt( ESCHER_Prop_fillBlip, sal_True, nSize, pBuf, nSize );
+ bRetValue = sal_True;
+ }
+ }
+ }
+ // write out link to graphic
+ else
+ {
+ OSL_ASSERT(aGraphicUrl.Len());
+
+ AddOpt( ESCHER_Prop_pibName, aGraphicUrl );
+ sal_uInt32 nPibFlags=0;
+ GetOpt( ESCHER_Prop_pibFlags, nPibFlags );
+ AddOpt( ESCHER_Prop_pibFlags,
+ ESCHER_BlipFlagLinkToFile|ESCHER_BlipFlagFile|ESCHER_BlipFlagDoNotSave | nPibFlags );
+ }
+ }
+ }
+ delete pGraphicAttr;
+ if ( bCreateFillStyles )
+ CreateFillProperties( rXPropSet, sal_True );
+
+ return bRetValue;
+}
+
+PolyPolygon EscherPropertyContainer::GetPolyPolygon( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape )
+{
+ PolyPolygon aRetPolyPoly;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > aXPropSet;
+ ::com::sun::star::uno::Any aAny( rXShape->queryInterface(
+ ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >*) 0 ) ));
+
+ String sPolyPolygonBezier( RTL_CONSTASCII_USTRINGPARAM( "PolyPolygonBezier" ) );
+ String sPolyPolygon ( RTL_CONSTASCII_USTRINGPARAM( "PolyPolygon" ) );
+ String sPolygon ( RTL_CONSTASCII_USTRINGPARAM( "Polygon" ) );
+
+ if ( aAny >>= aXPropSet )
+ {
+ sal_Bool bHasProperty = EscherPropertyValueHelper::GetPropertyValue( aAny, aXPropSet, sPolyPolygonBezier, sal_True );
+ if ( !bHasProperty )
+ bHasProperty = EscherPropertyValueHelper::GetPropertyValue( aAny, aXPropSet, sPolyPolygon, sal_True );
+ if ( !bHasProperty )
+ bHasProperty = EscherPropertyValueHelper::GetPropertyValue( aAny, aXPropSet, sPolygon, sal_True );
+ if ( bHasProperty )
+ aRetPolyPoly = GetPolyPolygon( aAny );
+ }
+ return aRetPolyPoly;
+}
+
+PolyPolygon EscherPropertyContainer::GetPolyPolygon( const ::com::sun::star::uno::Any& rAny )
+{
+ sal_Bool bNoError = sal_True;
+
+ Polygon aPolygon;
+ PolyPolygon aPolyPolygon;
+
+ if ( rAny.getValueType() == ::getCppuType( ( const ::com::sun::star::drawing::PolyPolygonBezierCoords* ) 0 ) )
+ {
+ ::com::sun::star::drawing::PolyPolygonBezierCoords* pSourcePolyPolygon
+ = (::com::sun::star::drawing::PolyPolygonBezierCoords*)rAny.getValue();
+ sal_uInt16 nOuterSequenceCount = (sal_uInt16)pSourcePolyPolygon->Coordinates.getLength();
+
+ // Zeiger auf innere sequences holen
+ ::com::sun::star::drawing::PointSequence* pOuterSequence = pSourcePolyPolygon->Coordinates.getArray();
+ ::com::sun::star::drawing::FlagSequence* pOuterFlags = pSourcePolyPolygon->Flags.getArray();
+
+ bNoError = pOuterSequence && pOuterFlags;
+ if ( bNoError )
+ {
+ sal_uInt16 a, b, nInnerSequenceCount;
+ ::com::sun::star::awt::Point* pArray;
+
+ // dies wird ein Polygon set
+ for ( a = 0; a < nOuterSequenceCount; a++ )
+ {
+ ::com::sun::star::drawing::PointSequence* pInnerSequence = pOuterSequence++;
+ ::com::sun::star::drawing::FlagSequence* pInnerFlags = pOuterFlags++;
+
+ bNoError = pInnerSequence && pInnerFlags;
+ if ( bNoError )
+ {
+ // Zeiger auf Arrays holen
+ pArray = pInnerSequence->getArray();
+ ::com::sun::star::drawing::PolygonFlags* pFlags = pInnerFlags->getArray();
+
+ if ( pArray && pFlags )
+ {
+ nInnerSequenceCount = (sal_uInt16)pInnerSequence->getLength();
+ aPolygon = Polygon( nInnerSequenceCount );
+ for( b = 0; b < nInnerSequenceCount; b++)
+ {
+ PolyFlags ePolyFlags( *( (PolyFlags*)pFlags++ ) );
+ ::com::sun::star::awt::Point aPoint( (::com::sun::star::awt::Point)*(pArray++) );
+ aPolygon[ b ] = Point( aPoint.X, aPoint.Y );
+ aPolygon.SetFlags( b, ePolyFlags );
+
+ if ( ePolyFlags == POLY_CONTROL )
+ continue;
+ }
+ aPolyPolygon.Insert( aPolygon, POLYPOLY_APPEND );
+ }
+ }
+ }
+ }
+ }
+ else if ( rAny.getValueType() == ::getCppuType( ( const ::com::sun::star::drawing::PointSequenceSequence* ) 0 ) )
+ {
+ ::com::sun::star::drawing::PointSequenceSequence* pSourcePolyPolygon
+ = (::com::sun::star::drawing::PointSequenceSequence*)rAny.getValue();
+ sal_uInt16 nOuterSequenceCount = (sal_uInt16)pSourcePolyPolygon->getLength();
+
+ // Zeiger auf innere sequences holen
+ ::com::sun::star::drawing::PointSequence* pOuterSequence = pSourcePolyPolygon->getArray();
+ bNoError = pOuterSequence != NULL;
+ if ( bNoError )
+ {
+ sal_uInt16 a, b, nInnerSequenceCount;
+
+ // dies wird ein Polygon set
+ for( a = 0; a < nOuterSequenceCount; a++ )
+ {
+ ::com::sun::star::drawing::PointSequence* pInnerSequence = pOuterSequence++;
+ bNoError = pInnerSequence != NULL;
+ if ( bNoError )
+ {
+ // Zeiger auf Arrays holen
+ ::com::sun::star::awt::Point* pArray =
+ pInnerSequence->getArray();
+ if ( pArray != NULL )
+ {
+ nInnerSequenceCount = (sal_uInt16)pInnerSequence->getLength();
+ aPolygon = Polygon( nInnerSequenceCount );
+ for( b = 0; b < nInnerSequenceCount; b++)
+ {
+ aPolygon[ b ] = Point( pArray->X, pArray->Y );
+ pArray++;
+ }
+ aPolyPolygon.Insert( aPolygon, POLYPOLY_APPEND );
+ }
+ }
+ }
+ }
+ }
+ else if ( rAny.getValueType() == ::getCppuType( ( const ::com::sun::star::drawing::PointSequence* ) 0 ) )
+ {
+ ::com::sun::star::drawing::PointSequence* pInnerSequence =
+ (::com::sun::star::drawing::PointSequence*)rAny.getValue();
+
+ bNoError = pInnerSequence != NULL;
+ if ( bNoError )
+ {
+ sal_uInt16 a, nInnerSequenceCount;
+
+ // Zeiger auf Arrays holen
+ ::com::sun::star::awt::Point* pArray = pInnerSequence->getArray();
+ if ( pArray != NULL )
+ {
+ nInnerSequenceCount = (sal_uInt16)pInnerSequence->getLength();
+ aPolygon = Polygon( nInnerSequenceCount );
+ for( a = 0; a < nInnerSequenceCount; a++)
+ {
+ aPolygon[ a ] = Point( pArray->X, pArray->Y );
+ pArray++;
+ }
+ aPolyPolygon.Insert( aPolygon, POLYPOLY_APPEND );
+ }
+ }
+ }
+ return aPolyPolygon;
+}
+
+sal_Bool EscherPropertyContainer::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 )
+{
+ static String sPolyPolygonBezier( RTL_CONSTASCII_USTRINGPARAM( "PolyPolygonBezier" ) );
+ static String sPolyPolygon ( RTL_CONSTASCII_USTRINGPARAM( "PolyPolygon" ) );
+
+ sal_Bool bRetValue = sal_True;
+ sal_Bool bLine = ( nFlags & ESCHER_CREATEPOLYGON_LINE ) != 0;
+
+ PolyPolygon aPolyPolygon;
+
+ if ( pPolygon )
+ aPolyPolygon.Insert( *pPolygon, POLYPOLY_APPEND );
+ else
+ {
+ ::com::sun::star::uno::Any aAny;
+ bRetValue = EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet,
+ ( bBezier ) ? sPolyPolygonBezier : sPolyPolygon, sal_True );
+ if ( bRetValue )
+ {
+ aPolyPolygon = GetPolyPolygon( aAny );
+ bRetValue = aPolyPolygon.Count() != 0;
+ }
+ }
+ if ( bRetValue )
+ {
+ if ( bLine )
+ {
+ if ( ( aPolyPolygon.Count() == 1 ) && ( aPolyPolygon[ 0 ].GetSize() == 2 ) )
+ {
+ const Polygon& rPoly = aPolyPolygon[ 0 ];
+ rGeoRect = ::com::sun::star::awt::Rectangle(
+ rPoly[ 0 ].X(),
+ rPoly[ 0 ].Y(),
+ rPoly[ 1 ].X() - rPoly[ 0 ].X(),
+ rPoly[ 1 ].Y() - rPoly[ 0 ].Y() );
+ }
+ else
+ bRetValue = sal_False;
+ }
+ else
+ {
+ Polygon aPolygon;
+
+ sal_uInt16 i, j, k, nPoints, nBezPoints, nPolyCount = aPolyPolygon.Count();
+ Rectangle aRect( aPolyPolygon.GetBoundRect() );
+ rGeoRect = ::com::sun::star::awt::Rectangle( aRect.Left(), aRect.Top(), aRect.GetWidth(), aRect.GetHeight() );
+
+ for ( nBezPoints = nPoints = i = 0; i < nPolyCount; i++ )
+ {
+ k = aPolyPolygon[ i ].GetSize();
+ nPoints = nPoints + k;
+ for ( j = 0; j < k; j++ )
+ {
+ if ( aPolyPolygon[ i ].GetFlags( j ) != POLY_CONTROL )
+ nBezPoints++;
+ }
+ }
+ sal_uInt32 nVerticesBufSize = ( nPoints << 2 ) + 6;
+ sal_uInt8* pVerticesBuf = new sal_uInt8[ nVerticesBufSize ];
+
+
+ sal_uInt32 nSegmentBufSize = ( ( nBezPoints << 2 ) + 8 );
+ if ( nPolyCount > 1 )
+ nSegmentBufSize += ( nPolyCount << 1 );
+ sal_uInt8* pSegmentBuf = new sal_uInt8[ nSegmentBufSize ];
+
+ sal_uInt8* pPtr = pVerticesBuf;
+ *pPtr++ = (sal_uInt8)( nPoints ); // Little endian
+ *pPtr++ = (sal_uInt8)( nPoints >> 8 );
+ *pPtr++ = (sal_uInt8)( nPoints );
+ *pPtr++ = (sal_uInt8)( nPoints >> 8 );
+ *pPtr++ = (sal_uInt8)0xf0;
+ *pPtr++ = (sal_uInt8)0xff;
+
+ for ( j = 0; j < nPolyCount; j++ )
+ {
+ aPolygon = aPolyPolygon[ j ];
+ nPoints = aPolygon.GetSize();
+ for ( i = 0; i < nPoints; i++ ) // Punkte aus Polygon in Buffer schreiben
+ {
+ Point aPoint = aPolygon[ i ];
+ aPoint.X() -= rGeoRect.X;
+ aPoint.Y() -= rGeoRect.Y;
+
+ *pPtr++ = (sal_uInt8)( aPoint.X() );
+ *pPtr++ = (sal_uInt8)( aPoint.X() >> 8 );
+ *pPtr++ = (sal_uInt8)( aPoint.Y() );
+ *pPtr++ = (sal_uInt8)( aPoint.Y() >> 8 );
+ }
+ }
+
+ pPtr = pSegmentBuf;
+ *pPtr++ = (sal_uInt8)( ( nSegmentBufSize - 6 ) >> 1 );
+ *pPtr++ = (sal_uInt8)( ( nSegmentBufSize - 6 ) >> 9 );
+ *pPtr++ = (sal_uInt8)( ( nSegmentBufSize - 6 ) >> 1 );
+ *pPtr++ = (sal_uInt8)( ( nSegmentBufSize - 6 ) >> 9 );
+ *pPtr++ = (sal_uInt8)2;
+ *pPtr++ = (sal_uInt8)0;
+
+ for ( j = 0; j < nPolyCount; j++ )
+ {
+ *pPtr++ = 0x0; // Polygon start
+ *pPtr++ = 0x40;
+ aPolygon = aPolyPolygon[ j ];
+ nPoints = aPolygon.GetSize();
+ for ( i = 0; i < nPoints; i++ ) // Polyflags in Buffer schreiben
+ {
+ *pPtr++ = 0;
+ if ( bBezier )
+ *pPtr++ = 0xb3;
+ else
+ *pPtr++ = 0xac;
+ if ( ( i + 1 ) != nPoints )
+ {
+ *pPtr++ = 1;
+ if ( aPolygon.GetFlags( i + 1 ) == POLY_CONTROL )
+ {
+ *pPtr++ = 0x20;
+ i += 2;
+ }
+ else
+ *pPtr++ = 0;
+ }
+ }
+ if ( nPolyCount > 1 )
+ {
+ *pPtr++ = 1; // end of polygon
+ *pPtr++ = 0x60;
+ }
+ }
+ *pPtr++ = 0;
+ *pPtr++ = 0x80;
+
+ AddOpt( ESCHER_Prop_geoRight, rGeoRect.Width );
+ AddOpt( ESCHER_Prop_geoBottom, rGeoRect.Height );
+
+ AddOpt( ESCHER_Prop_shapePath, ESCHER_ShapeComplex );
+ AddOpt( ESCHER_Prop_pVertices, TRUE, nVerticesBufSize - 6, (sal_uInt8*)pVerticesBuf, nVerticesBufSize );
+ AddOpt( ESCHER_Prop_pSegmentInfo, TRUE, nSegmentBufSize, (sal_uInt8*)pSegmentBuf, nSegmentBufSize );
+ }
+ }
+ return bRetValue;
+}
+
+sal_Bool EscherPropertyContainer::CreateConnectorProperties(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape,
+ EscherSolverContainer& rSolverContainer, ::com::sun::star::awt::Rectangle& rGeoRect,
+ sal_uInt16& rShapeType, sal_uInt16& rShapeFlags )
+{
+ static String sEdgeKind ( RTL_CONSTASCII_USTRINGPARAM( "EdgeKind" ) );
+ static String sEdgeStartPoint ( RTL_CONSTASCII_USTRINGPARAM( "EdgeStartPoint" ) );
+ static String sEdgeEndPoint ( RTL_CONSTASCII_USTRINGPARAM( "EdgeEndPoint" ) );
+ static String sEdgeStartConnection ( RTL_CONSTASCII_USTRINGPARAM( "EdgeStartConnection" ) );
+ static String sEdgeEndConnection ( RTL_CONSTASCII_USTRINGPARAM( "EdgeEndConnection" ) );
+
+ sal_Bool bRetValue = sal_False;
+ rShapeType = rShapeFlags = 0;
+
+ if ( rXShape.is() )
+ {
+ ::com::sun::star::awt::Point aStartPoint, aEndPoint;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > aXPropSet;
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > aShapeA, aShapeB;
+ ::com::sun::star::uno::Any aAny( rXShape->queryInterface( ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >*) 0 ) ));
+ if ( aAny >>= aXPropSet )
+ {
+ if ( EscherPropertyValueHelper::GetPropertyValue( aAny, aXPropSet, sEdgeKind, sal_True ) )
+ {
+ ::com::sun::star::drawing::ConnectorType eCt;
+ aAny >>= eCt;
+ if ( EscherPropertyValueHelper::GetPropertyValue( aAny, aXPropSet, sEdgeStartPoint ) )
+ {
+ aStartPoint = *(::com::sun::star::awt::Point*)aAny.getValue();
+ if ( EscherPropertyValueHelper::GetPropertyValue( aAny, aXPropSet, sEdgeEndPoint ) )
+ {
+ aEndPoint = *(::com::sun::star::awt::Point*)aAny.getValue();
+
+ rShapeFlags = SHAPEFLAG_HAVEANCHOR | SHAPEFLAG_HAVESPT | SHAPEFLAG_CONNECTOR;
+ rGeoRect = ::com::sun::star::awt::Rectangle( aStartPoint.X, aStartPoint.Y,
+ ( aEndPoint.X - aStartPoint.X ) + 1, ( aEndPoint.Y - aStartPoint.Y ) + 1 );
+ if ( rGeoRect.Height < 0 ) // justify
+ {
+ rShapeFlags |= SHAPEFLAG_FLIPV;
+ rGeoRect.Y = aEndPoint.Y;
+ rGeoRect.Height = -rGeoRect.Height;
+ }
+ if ( rGeoRect.Width < 0 )
+ {
+ rShapeFlags |= SHAPEFLAG_FLIPH;
+ rGeoRect.X = aEndPoint.X;
+ rGeoRect.Width = -rGeoRect.Width;
+ }
+ sal_uInt32 nAdjustValue1, nAdjustValue2, nAdjustValue3;
+ nAdjustValue1 = nAdjustValue2 = nAdjustValue3 = 0x2a30;
+
+ if ( EscherPropertyValueHelper::GetPropertyValue( aAny, aXPropSet, sEdgeStartConnection ) )
+ aAny >>= aShapeA;
+ if ( EscherPropertyValueHelper::GetPropertyValue( aAny, aXPropSet, sEdgeEndConnection ) )
+ aAny >>= aShapeB;
+/*
+ if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "EdgeLine1Delta" ) ) ) )
+ {
+ }
+ if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "EdgeLine2Delta" ) ) ) )
+ {
+ }
+ if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "EdgeLine3Delta" ) ) ) )
+ {
+ }
+ if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "EdgeNode1HorzDist" ) ) ) )
+ {
+ }
+ if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "EdgeNode1VertDist" ) ) ) )
+ {
+ }
+ if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "EdgeNode2HorzDist" ) ) ) )
+ {
+ }
+ if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "EdgeNode2VertDist" ) ) ) )
+ {
+ }
+*/
+ rSolverContainer.AddConnector( rXShape, aStartPoint, aShapeA, aEndPoint, aShapeB );
+ switch ( eCt )
+ {
+ case ::com::sun::star::drawing::ConnectorType_CURVE :
+ {
+ rShapeType = ESCHER_ShpInst_CurvedConnector3;
+ AddOpt( ESCHER_Prop_cxstyle, ESCHER_cxstyleCurved );
+ AddOpt( ESCHER_Prop_adjustValue, nAdjustValue1 );
+ AddOpt( ESCHER_Prop_adjust2Value, -(sal_Int32)nAdjustValue2 );
+ }
+ break;
+
+ case ::com::sun::star::drawing::ConnectorType_STANDARD :// Connector 2->5
+ {
+ rShapeType = ESCHER_ShpInst_BentConnector3;
+ AddOpt( ESCHER_Prop_cxstyle, ESCHER_cxstyleBent );
+ }
+ break;
+
+ default:
+ case ::com::sun::star::drawing::ConnectorType_LINE :
+ case ::com::sun::star::drawing::ConnectorType_LINES : // Connector 2->5
+ {
+ rShapeType = ESCHER_ShpInst_StraightConnector1;
+ AddOpt( ESCHER_Prop_cxstyle, ESCHER_cxstyleStraight );
+ }
+ break;
+ }
+ CreateLineProperties( aXPropSet, sal_False );
+ bRetValue = bSuppressRotation = sal_True;
+ }
+ }
+ }
+ }
+ }
+ return bRetValue;
+}
+
+sal_Bool EscherPropertyContainer::CreateShadowProperties(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet )
+{
+ ::com::sun::star::uno::Any aAny;
+
+ sal_Bool bHasShadow = sal_False; // shadow is possible only if at least a fillcolor, linecolor or graphic is set
+ sal_uInt32 nLineFlags = 0; // default : shape has no line
+ sal_uInt32 nFillFlags = 0x10; // shape is filled
+
+ GetOpt( ESCHER_Prop_fNoLineDrawDash, nLineFlags );
+ GetOpt( ESCHER_Prop_fNoFillHitTest, nFillFlags );
+
+ sal_uInt32 nDummy;
+ sal_Bool bGraphic = GetOpt( DFF_Prop_pib, nDummy ) || GetOpt( DFF_Prop_pibName, nDummy ) || GetOpt( DFF_Prop_pibFlags, nDummy );
+
+ sal_uInt32 nShadowFlags = 0x20000;
+ if ( ( nLineFlags & 8 ) || ( nFillFlags & 0x10 ) || bGraphic )
+ {
+ if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet,
+ String( RTL_CONSTASCII_USTRINGPARAM( "Shadow" ) ), sal_True ) )
+ {
+ if ( aAny >>= bHasShadow )
+ {
+ if ( bHasShadow )
+ {
+ nShadowFlags |= 2;
+ if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet,
+ String( RTL_CONSTASCII_USTRINGPARAM( "ShadowColor" ) ), sal_False ) )
+ AddOpt( ESCHER_Prop_shadowColor, ImplGetColor( *((sal_uInt32*)aAny.getValue()) ) );
+ if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet,
+ String( RTL_CONSTASCII_USTRINGPARAM( "ShadowXDistance" ) ), sal_False ) )
+ AddOpt( ESCHER_Prop_shadowOffsetX, *((sal_Int32*)aAny.getValue()) * 360 );
+ if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet,
+ String( RTL_CONSTASCII_USTRINGPARAM( "ShadowYDistance" ) ), sal_False ) )
+ AddOpt( ESCHER_Prop_shadowOffsetY, *((sal_Int32*)aAny.getValue()) * 360 );
+ if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet,
+ String( RTL_CONSTASCII_USTRINGPARAM( "ShadowTransparence" ) ), sal_False ) )
+ AddOpt( ESCHER_Prop_shadowOpacity, 0x10000 - (((sal_uInt32)*((sal_uInt16*)aAny.getValue())) * 655 ) );
+ }
+ }
+ }
+ }
+ AddOpt( ESCHER_Prop_fshadowObscured, nShadowFlags );
+ return bHasShadow;
+}
+
+// ---------------------------------------------------------------------------------------------
+
+sal_Int32 GetValueForEnhancedCustomShapeParameter( const com::sun::star::drawing::EnhancedCustomShapeParameter& rParameter, const std::vector< sal_Int32 >& rEquationOrder )
+{
+ sal_Int32 nValue = 0;
+ if ( rParameter.Value.getValueTypeClass() == uno::TypeClass_DOUBLE )
+ {
+ double fValue;
+ if ( rParameter.Value >>= fValue )
+ nValue = (sal_Int32)fValue;
+ }
+ else
+ rParameter.Value >>= nValue;
+
+ switch( rParameter.Type )
+ {
+ case com::sun::star::drawing::EnhancedCustomShapeParameterType::EQUATION :
+ {
+ nValue = (sal_uInt16)rEquationOrder[ nValue ];
+ nValue |= (sal_uInt32)0x80000000;
+ }
+ break;
+ case com::sun::star::drawing::EnhancedCustomShapeParameterType::NORMAL :
+ {
+
+ }
+ break;
+/* not sure if it is allowed to set following values
+(but they are not yet used)
+ case com::sun::star::drawing::EnhancedCustomShapeParameterType::ADJUSTMENT :
+ case com::sun::star::drawing::EnhancedCustomShapeParameterType::BOTTOM :
+ case com::sun::star::drawing::EnhancedCustomShapeParameterType::RIGHT :
+ case com::sun::star::drawing::EnhancedCustomShapeParameterType::TOP :
+ case com::sun::star::drawing::EnhancedCustomShapeParameterType::LEFT :
+*/
+ }
+ return nValue;
+}
+
+sal_Bool GetValueForEnhancedCustomShapeHandleParameter( sal_Int32& nRetValue, const com::sun::star::drawing::EnhancedCustomShapeParameter& rParameter )
+{
+ sal_Bool bSpecial = sal_False;
+ nRetValue = 0;
+ if ( rParameter.Value.getValueTypeClass() == uno::TypeClass_DOUBLE )
+ {
+ double fValue;
+ if ( rParameter.Value >>= fValue )
+ nRetValue = (sal_Int32)fValue;
+ }
+ else
+ rParameter.Value >>= nRetValue;
+
+ switch( rParameter.Type )
+ {
+ case com::sun::star::drawing::EnhancedCustomShapeParameterType::EQUATION :
+ {
+ nRetValue += 3;
+ bSpecial = sal_True;
+ }
+ break;
+ case com::sun::star::drawing::EnhancedCustomShapeParameterType::ADJUSTMENT :
+ {
+ nRetValue += 0x100;
+ bSpecial = sal_True;
+ }
+ break;
+ case com::sun::star::drawing::EnhancedCustomShapeParameterType::TOP :
+ case com::sun::star::drawing::EnhancedCustomShapeParameterType::LEFT :
+ {
+ nRetValue = 0;
+ bSpecial = sal_True;
+ }
+ break;
+ case com::sun::star::drawing::EnhancedCustomShapeParameterType::RIGHT :
+ case com::sun::star::drawing::EnhancedCustomShapeParameterType::BOTTOM :
+ {
+ nRetValue = 1;
+ bSpecial = sal_True;
+ }
+ break;
+ case com::sun::star::drawing::EnhancedCustomShapeParameterType::NORMAL :
+ {
+
+ }
+ break;
+ }
+ return bSpecial;
+}
+
+void ConvertEnhancedCustomShapeEquation( SdrObjCustomShape* pCustoShape,
+ std::vector< EnhancedCustomShapeEquation >& rEquations, std::vector< sal_Int32 >& rEquationOrder )
+{
+ if ( pCustoShape )
+ {
+ uno::Sequence< rtl::OUString > sEquationSource;
+ const rtl::OUString sEquations( RTL_CONSTASCII_USTRINGPARAM( "Equations" ) );
+ SdrCustomShapeGeometryItem& rGeometryItem = (SdrCustomShapeGeometryItem&)(const SdrCustomShapeGeometryItem&)
+ pCustoShape->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY );
+ const uno::Any* pAny = ((SdrCustomShapeGeometryItem&)rGeometryItem).GetPropertyValueByName( sEquations );
+ if ( pAny )
+ *pAny >>= sEquationSource;
+ sal_Int32 nEquationSourceCount = sEquationSource.getLength();
+ if ( nEquationSourceCount )
+ {
+ sal_Int32 i;
+ for ( i = 0; i < nEquationSourceCount; i++ )
+ {
+ EnhancedCustomShape2d aCustoShape2d( pCustoShape );
+ try
+ {
+ ::boost::shared_ptr< EnhancedCustomShape::ExpressionNode > aExpressNode(
+ EnhancedCustomShape::FunctionParser::parseFunction( sEquationSource[ i ], aCustoShape2d ) );
+ com::sun::star::drawing::EnhancedCustomShapeParameter aPara( aExpressNode->fillNode( rEquations, NULL, 0 ) );
+ if ( aPara.Type != com::sun::star::drawing::EnhancedCustomShapeParameterType::EQUATION )
+ {
+ EnhancedCustomShapeEquation aEquation;
+ aEquation.nOperation = 0;
+ EnhancedCustomShape::FillEquationParameter( aPara, 0, aEquation );
+ rEquations.push_back( aEquation );
+ }
+ }
+ catch ( EnhancedCustomShape::ParseError& )
+ {
+ EnhancedCustomShapeEquation aEquation; // ups, we should not be here,
+ aEquation.nOperation = 0; // creating a default equation with value 1
+ aEquation.nPara[ 0 ] = 1; // hoping that this will not break anything
+ rEquations.push_back( aEquation );
+ }
+ rEquationOrder.push_back( rEquations.size() - 1 );
+ }
+ // now updating our old equation indices, they are marked with a bit in the hiword of nOperation
+ std::vector< EnhancedCustomShapeEquation >::iterator aIter( rEquations.begin() );
+ std::vector< EnhancedCustomShapeEquation >::iterator aEnd ( rEquations.end() );
+ while( aIter != aEnd )
+ {
+ sal_Int32 nMask = 0x20000000;
+ for( i = 0; i < 3; i++ )
+ {
+ if ( aIter->nOperation & nMask )
+ {
+ aIter->nOperation ^= nMask;
+ aIter->nPara[ i ] = rEquationOrder[ aIter->nPara[ i ] & 0x3ff ] | 0x400;
+ }
+ nMask <<= 1;
+ }
+ aIter++;
+ }
+ }
+ }
+}
+
+sal_Bool EscherPropertyContainer::IsDefaultObject( SdrObjCustomShape* pCustoShape )
+{
+ sal_Bool bIsDefaultObject = sal_False;
+ if ( pCustoShape )
+ {
+ if ( pCustoShape->IsDefaultGeometry( SdrObjCustomShape::DEFAULT_EQUATIONS )
+ && pCustoShape->IsDefaultGeometry( SdrObjCustomShape::DEFAULT_VIEWBOX )
+ && pCustoShape->IsDefaultGeometry( SdrObjCustomShape::DEFAULT_PATH )
+ && pCustoShape->IsDefaultGeometry( SdrObjCustomShape::DEFAULT_GLUEPOINTS )
+ && pCustoShape->IsDefaultGeometry( SdrObjCustomShape::DEFAULT_SEGMENTS )
+ && pCustoShape->IsDefaultGeometry( SdrObjCustomShape::DEFAULT_STRETCHX )
+ && pCustoShape->IsDefaultGeometry( SdrObjCustomShape::DEFAULT_STRETCHY )
+// && pCustoShape->IsDefaultGeometry( SdrObjCustomShape::DEFAULT_HANDLES )
+ && pCustoShape->IsDefaultGeometry( SdrObjCustomShape::DEFAULT_TEXTFRAMES ) )
+ bIsDefaultObject = sal_True;
+ }
+
+ return bIsDefaultObject;
+}
+
+void EscherPropertyContainer::LookForPolarHandles( const MSO_SPT eShapeType, sal_Int32& nAdjustmentsWhichNeedsToBeConverted )
+{
+ const mso_CustomShape* pDefCustomShape = GetCustomShapeContent( eShapeType );
+ if ( pDefCustomShape && pDefCustomShape->nHandles && pDefCustomShape->pHandles )
+ {
+ sal_Int32 k, nkCount = pDefCustomShape->nHandles;
+ const SvxMSDffHandle* pData = pDefCustomShape->pHandles;
+ for ( k = 0; k < nkCount; k++, pData++ )
+ {
+ if ( pData->nFlags & MSDFF_HANDLE_FLAGS_POLAR )
+ {
+ if ( ( pData->nPositionY >= 0x256 ) || ( pData->nPositionY <= 0x107 ) )
+ nAdjustmentsWhichNeedsToBeConverted |= ( 1 << k );
+ }
+ }
+ }
+}
+
+sal_Bool EscherPropertyContainer::GetAdjustmentValue( const com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue & rkProp, sal_Int32 nIndex, sal_Int32 nAdjustmentsWhichNeedsToBeConverted, sal_Int32& nValue )
+{
+ if ( rkProp.State != beans::PropertyState_DIRECT_VALUE )
+ return FALSE;
+
+ sal_Bool bUseFixedFloat = ( nAdjustmentsWhichNeedsToBeConverted & ( 1 << nIndex ) ) != 0;
+ if ( rkProp.Value.getValueTypeClass() == uno::TypeClass_DOUBLE )
+ {
+ double fValue(0.0);
+ rkProp.Value >>= fValue;
+ if ( bUseFixedFloat )
+ fValue *= 65536.0;
+ nValue = (sal_Int32)fValue;
+ }
+ else
+ {
+ rkProp.Value >>= nValue;
+ if ( bUseFixedFloat )
+ nValue <<= 16;
+ }
+
+ return TRUE;
+}
+
+void EscherPropertyContainer::CreateCustomShapeProperties( const MSO_SPT eShapeType, const uno::Reference< drawing::XShape > & rXShape )
+{
+ uno::Reference< beans::XPropertySet > aXPropSet( rXShape, uno::UNO_QUERY );
+ if ( aXPropSet.is() )
+ {
+ SdrObjCustomShape* pCustoShape = (SdrObjCustomShape*)GetSdrObjectFromXShape( rXShape );
+ const rtl::OUString sCustomShapeGeometry( RTL_CONSTASCII_USTRINGPARAM( "CustomShapeGeometry" ) );
+ uno::Any aGeoPropSet = aXPropSet->getPropertyValue( sCustomShapeGeometry );
+ uno::Sequence< beans::PropertyValue > aGeoPropSeq;
+ if ( aGeoPropSet >>= aGeoPropSeq )
+ {
+ const rtl::OUString sViewBox ( RTL_CONSTASCII_USTRINGPARAM( "ViewBox" ) );
+ const rtl::OUString sTextRotateAngle ( RTL_CONSTASCII_USTRINGPARAM( "TextRotateAngle" ) );
+ const rtl::OUString sExtrusion ( RTL_CONSTASCII_USTRINGPARAM( "Extrusion" ) );
+ const rtl::OUString sEquations ( RTL_CONSTASCII_USTRINGPARAM( "Equations" ) );
+ const rtl::OUString sPath ( RTL_CONSTASCII_USTRINGPARAM( "Path" ) );
+ const rtl::OUString sTextPath ( RTL_CONSTASCII_USTRINGPARAM( "TextPath" ) );
+ const rtl::OUString sHandles ( RTL_CONSTASCII_USTRINGPARAM( "Handles" ) );
+ const rtl::OUString sAdjustmentValues ( RTL_CONSTASCII_USTRINGPARAM( "AdjustmentValues" ) );
+
+ const beans::PropertyValue* pAdjustmentValuesProp = NULL;
+ sal_Int32 nAdjustmentsWhichNeedsToBeConverted = 0;
+ uno::Sequence< beans::PropertyValues > aHandlesPropSeq;
+ sal_Bool bPredefinedHandlesUsed = sal_True;
+ sal_Bool bIsDefaultObject = IsDefaultObject( pCustoShape );
+
+ // convert property "Equations" into std::vector< EnhancedCustomShapeEquationEquation >
+ std::vector< EnhancedCustomShapeEquation > aEquations;
+ std::vector< sal_Int32 > aEquationOrder;
+ ConvertEnhancedCustomShapeEquation( pCustoShape, aEquations, aEquationOrder );
+
+ sal_Int32 i, nCount = aGeoPropSeq.getLength();
+ for ( i = 0; i < nCount; i++ )
+ {
+ const beans::PropertyValue& rProp = aGeoPropSeq[ i ];
+ if ( rProp.Name.equals( sViewBox ) )
+ {
+ if ( !bIsDefaultObject )
+ {
+ awt::Rectangle aViewBox;
+ if ( rProp.Value >>= aViewBox )
+ {
+ AddOpt( DFF_Prop_geoLeft, aViewBox.X );
+ AddOpt( DFF_Prop_geoTop, aViewBox.Y );
+ AddOpt( DFF_Prop_geoRight, aViewBox.X + aViewBox.Width );
+ AddOpt( DFF_Prop_geoBottom,aViewBox.Y + aViewBox.Height );
+ }
+ }
+ }
+ else if ( rProp.Name.equals( sTextRotateAngle ) )
+ {
+ double f = 0, fTextRotateAngle;
+ if ( rProp.Value >>= f )
+ {
+ fTextRotateAngle = fmod( f, 360.0 );
+ if ( fTextRotateAngle < 0 )
+ fTextRotateAngle = 360 + fTextRotateAngle;
+ if ( ( fTextRotateAngle < 271.0 ) && ( fTextRotateAngle > 269.0 ) )
+ AddOpt( DFF_Prop_cdirFont, mso_cdir90 );
+ else if ( ( fTextRotateAngle < 181.0 ) && ( fTextRotateAngle > 179.0 ) )
+ AddOpt( DFF_Prop_cdirFont, mso_cdir180 );
+ else if ( ( fTextRotateAngle < 91.0 ) && ( fTextRotateAngle > 79.0 ) )
+ AddOpt( DFF_Prop_cdirFont, mso_cdir270 );
+ }
+ }
+ else if ( rProp.Name.equals( sExtrusion ) )
+ {
+ uno::Sequence< beans::PropertyValue > aExtrusionPropSeq;
+ if ( rProp.Value >>= aExtrusionPropSeq )
+ {
+ sal_uInt32 nLightFaceFlagsOrg, nLightFaceFlags;
+ sal_uInt32 nFillHarshFlagsOrg, nFillHarshFlags;
+ nLightFaceFlagsOrg = nLightFaceFlags = 0x000001;
+ nFillHarshFlagsOrg = nFillHarshFlags = 0x00001e;
+ if ( GetOpt( DFF_Prop_fc3DLightFace, nLightFaceFlags ) )
+ nLightFaceFlagsOrg = nLightFaceFlags;
+ if ( GetOpt( DFF_Prop_fc3DFillHarsh, nFillHarshFlags ) )
+ nFillHarshFlagsOrg = nFillHarshFlags;
+
+ sal_Int32 r, nrCount = aExtrusionPropSeq.getLength();
+ for ( r = 0; r < nrCount; r++ )
+ {
+ const beans::PropertyValue& rrProp = aExtrusionPropSeq[ r ];
+ const rtl::OUString sExtrusionBrightness ( RTL_CONSTASCII_USTRINGPARAM( "Brightness" ) );
+ const rtl::OUString sExtrusionDepth ( RTL_CONSTASCII_USTRINGPARAM( "Depth" ) );
+ const rtl::OUString sExtrusionDiffusion ( RTL_CONSTASCII_USTRINGPARAM( "Diffusion" ) );
+ const rtl::OUString sExtrusionNumberOfLineSegments ( RTL_CONSTASCII_USTRINGPARAM( "NumberOfLineSegments" ) );
+ const rtl::OUString sExtrusionLightFace ( RTL_CONSTASCII_USTRINGPARAM( "LightFace" ) );
+ const rtl::OUString sExtrusionFirstLightHarsh ( RTL_CONSTASCII_USTRINGPARAM( "FirstLightHarsh" ) );
+ const rtl::OUString sExtrusionSecondLightHarsh ( RTL_CONSTASCII_USTRINGPARAM( "SecondLightHarsh" ) );
+ const rtl::OUString sExtrusionFirstLightLevel ( RTL_CONSTASCII_USTRINGPARAM( "FirstLightLevel" ) );
+ const rtl::OUString sExtrusionSecondLightLevel ( RTL_CONSTASCII_USTRINGPARAM( "SecondLightLevel" ) );
+ const rtl::OUString sExtrusionFirstLightDirection ( RTL_CONSTASCII_USTRINGPARAM( "FirstLightDirection" ) );
+ const rtl::OUString sExtrusionSecondLightDirection ( RTL_CONSTASCII_USTRINGPARAM( "SecondLightDirection" ) );
+ const rtl::OUString sExtrusionMetal ( RTL_CONSTASCII_USTRINGPARAM( "Metal" ) );
+ const rtl::OUString sExtrusionShadeMode ( RTL_CONSTASCII_USTRINGPARAM( "ShadeMode" ) );
+ const rtl::OUString sExtrusionRotateAngle ( RTL_CONSTASCII_USTRINGPARAM( "RotateAngle" ) );
+ const rtl::OUString sExtrusionRotationCenter ( RTL_CONSTASCII_USTRINGPARAM( "RotationCenter" ) );
+ const rtl::OUString sExtrusionShininess ( RTL_CONSTASCII_USTRINGPARAM( "Shininess" ) );
+ const rtl::OUString sExtrusionSkew ( RTL_CONSTASCII_USTRINGPARAM( "Skew" ) );
+ const rtl::OUString sExtrusionSpecularity ( RTL_CONSTASCII_USTRINGPARAM( "Specularity" ) );
+ const rtl::OUString sExtrusionProjectionMode ( RTL_CONSTASCII_USTRINGPARAM( "ProjectionMode" ) );
+ const rtl::OUString sExtrusionViewPoint ( RTL_CONSTASCII_USTRINGPARAM( "ViewPoint" ) );
+ const rtl::OUString sExtrusionOrigin ( RTL_CONSTASCII_USTRINGPARAM( "Origin" ) );
+ const rtl::OUString sExtrusionColor ( RTL_CONSTASCII_USTRINGPARAM( "Color" ) );
+
+ if ( rrProp.Name.equals( sExtrusion ) )
+ {
+ sal_Bool bExtrusionOn = sal_Bool();
+ if ( rrProp.Value >>= bExtrusionOn )
+ {
+ nLightFaceFlags |= 0x80000;
+ if ( bExtrusionOn )
+ nLightFaceFlags |= 8;
+ else
+ nLightFaceFlags &=~8;
+ }
+ }
+ else if ( rrProp.Name.equals( sExtrusionBrightness ) )
+ {
+ double fExtrusionBrightness = 0;
+ if ( rrProp.Value >>= fExtrusionBrightness )
+ AddOpt( DFF_Prop_c3DAmbientIntensity, (sal_Int32)( fExtrusionBrightness * 655.36 ) );
+ }
+ else if ( rrProp.Name.equals( sExtrusionDepth ) )
+ {
+ double fDepth = 0;
+ double fFraction = 0;
+ com::sun::star::drawing::EnhancedCustomShapeParameterPair aDepthParaPair;
+ if ( ( rrProp.Value >>= aDepthParaPair ) && ( aDepthParaPair.First.Value >>= fDepth ) && ( aDepthParaPair.Second.Value >>= fFraction ) )
+ {
+ double fForeDepth = fDepth * fFraction;
+ double fBackDepth = fDepth - fForeDepth;
+
+ fBackDepth *= 360.0;
+ AddOpt( DFF_Prop_c3DExtrudeBackward, (sal_Int32)fBackDepth );
+
+ if ( fForeDepth != 0.0 )
+ {
+ fForeDepth *= 360.0;
+ AddOpt( DFF_Prop_c3DExtrudeForward, (sal_Int32)fForeDepth );
+ }
+ }
+ }
+ else if ( rrProp.Name.equals( sExtrusionDiffusion ) )
+ {
+ double fExtrusionDiffusion = 0;
+ if ( rrProp.Value >>= fExtrusionDiffusion )
+ AddOpt( DFF_Prop_c3DDiffuseAmt, (sal_Int32)( fExtrusionDiffusion * 655.36 ) );
+ }
+ else if ( rrProp.Name.equals( sExtrusionNumberOfLineSegments ) )
+ {
+ sal_Int32 nExtrusionNumberOfLineSegments = 0;
+ if ( rrProp.Value >>= nExtrusionNumberOfLineSegments )
+ AddOpt( DFF_Prop_c3DTolerance, nExtrusionNumberOfLineSegments );
+ }
+ else if ( rrProp.Name.equals( sExtrusionLightFace ) )
+ {
+ sal_Bool bExtrusionLightFace = sal_Bool();
+ if ( rrProp.Value >>= bExtrusionLightFace )
+ {
+ nLightFaceFlags |= 0x10000;
+ if ( bExtrusionLightFace )
+ nLightFaceFlags |= 1;
+ else
+ nLightFaceFlags &=~1;
+ }
+ }
+ else if ( rrProp.Name.equals( sExtrusionFirstLightHarsh ) )
+ {
+ sal_Bool bExtrusionFirstLightHarsh = sal_Bool();
+ if ( rrProp.Value >>= bExtrusionFirstLightHarsh )
+ {
+ nFillHarshFlags |= 0x20000;
+ if ( bExtrusionFirstLightHarsh )
+ nFillHarshFlags |= 2;
+ else
+ nFillHarshFlags &=~2;
+ }
+ }
+ else if ( rrProp.Name.equals( sExtrusionSecondLightHarsh ) )
+ {
+ sal_Bool bExtrusionSecondLightHarsh = sal_Bool();
+ if ( rrProp.Value >>= bExtrusionSecondLightHarsh )
+ {
+ nFillHarshFlags |= 0x10000;
+ if ( bExtrusionSecondLightHarsh )
+ nFillHarshFlags |= 1;
+ else
+ nFillHarshFlags &=~1;
+ }
+ }
+ else if ( rrProp.Name.equals( sExtrusionFirstLightLevel ) )
+ {
+ double fExtrusionFirstLightLevel = 0;
+ if ( rrProp.Value >>= fExtrusionFirstLightLevel )
+ AddOpt( DFF_Prop_c3DKeyIntensity, (sal_Int32)( fExtrusionFirstLightLevel * 655.36 ) );
+ }
+ else if ( rrProp.Name.equals( sExtrusionSecondLightLevel ) )
+ {
+ double fExtrusionSecondLightLevel = 0;
+ if ( rrProp.Value >>= fExtrusionSecondLightLevel )
+ AddOpt( DFF_Prop_c3DFillIntensity, (sal_Int32)( fExtrusionSecondLightLevel * 655.36 ) );
+ }
+ else if ( rrProp.Name.equals( sExtrusionFirstLightDirection ) )
+ {
+ drawing::Direction3D aExtrusionFirstLightDirection;
+ if ( rrProp.Value >>= aExtrusionFirstLightDirection )
+ {
+ AddOpt( DFF_Prop_c3DKeyX, (sal_Int32)aExtrusionFirstLightDirection.DirectionX );
+ AddOpt( DFF_Prop_c3DKeyY, (sal_Int32)aExtrusionFirstLightDirection.DirectionY );
+ AddOpt( DFF_Prop_c3DKeyZ, (sal_Int32)aExtrusionFirstLightDirection.DirectionZ );
+ }
+ }
+ else if ( rrProp.Name.equals( sExtrusionSecondLightDirection ) )
+ {
+ drawing::Direction3D aExtrusionSecondLightPosition;
+ if ( rrProp.Value >>= aExtrusionSecondLightPosition )
+ {
+ AddOpt( DFF_Prop_c3DFillX, (sal_Int32)aExtrusionSecondLightPosition.DirectionX );
+ AddOpt( DFF_Prop_c3DFillY, (sal_Int32)aExtrusionSecondLightPosition.DirectionY );
+ AddOpt( DFF_Prop_c3DFillZ, (sal_Int32)aExtrusionSecondLightPosition.DirectionZ );
+ }
+ }
+ else if ( rrProp.Name.equals( sExtrusionMetal ) )
+ {
+ sal_Bool bExtrusionMetal = sal_Bool();
+ if ( rrProp.Value >>= bExtrusionMetal )
+ {
+ nLightFaceFlags |= 0x40000;
+ if ( bExtrusionMetal )
+ nLightFaceFlags |= 4;
+ else
+ nLightFaceFlags &=~4;
+ }
+ }
+ else if ( rrProp.Name.equals( sExtrusionShadeMode ) )
+ {
+ drawing::ShadeMode eExtrusionShadeMode;
+ if ( rrProp.Value >>= eExtrusionShadeMode )
+ {
+ sal_uInt32 nRenderMode;
+ switch( eExtrusionShadeMode )
+ {
+ default:
+ case drawing::ShadeMode_FLAT :
+ case drawing::ShadeMode_PHONG :
+ case drawing::ShadeMode_SMOOTH :
+ nRenderMode = mso_FullRender;
+ break;
+ case drawing::ShadeMode_DRAFT :
+ {
+ nRenderMode = mso_Wireframe;
+ }
+ break;
+ }
+ AddOpt( DFF_Prop_c3DRenderMode, nRenderMode );
+ }
+ }
+ else if ( rrProp.Name.equals( sExtrusionRotateAngle ) )
+ {
+ double fExtrusionAngleX = 0;
+ double fExtrusionAngleY = 0;
+ com::sun::star::drawing::EnhancedCustomShapeParameterPair aRotateAnglePair;
+ if ( ( rrProp.Value >>= aRotateAnglePair ) && ( aRotateAnglePair.First.Value >>= fExtrusionAngleX ) && ( aRotateAnglePair.Second.Value >>= fExtrusionAngleY ) )
+ {
+ fExtrusionAngleX *= 65536;
+ fExtrusionAngleY *= 65536;
+ AddOpt( DFF_Prop_c3DXRotationAngle, (sal_Int32)fExtrusionAngleX );
+ AddOpt( DFF_Prop_c3DYRotationAngle, (sal_Int32)fExtrusionAngleY );
+ }
+ }
+ else if ( rrProp.Name.equals( sExtrusionRotationCenter ) )
+ {
+ drawing::Direction3D aExtrusionRotationCenter;
+ if ( rrProp.Value >>= aExtrusionRotationCenter )
+ {
+ AddOpt( DFF_Prop_c3DRotationCenterX, (sal_Int32)( aExtrusionRotationCenter.DirectionX * 360.0 ) );
+ AddOpt( DFF_Prop_c3DRotationCenterY, (sal_Int32)( aExtrusionRotationCenter.DirectionY * 360.0 ) );
+ AddOpt( DFF_Prop_c3DRotationCenterZ, (sal_Int32)( aExtrusionRotationCenter.DirectionZ * 360.0 ) );
+ nFillHarshFlags &=~8; // don't use AutoRotationCenter;
+ }
+ }
+ else if ( rrProp.Name.equals( sExtrusionShininess ) )
+ {
+ double fExtrusionShininess = 0;
+ if ( rrProp.Value >>= fExtrusionShininess )
+ AddOpt( DFF_Prop_c3DShininess, (sal_Int32)( fExtrusionShininess * 655.36 ) );
+ }
+ else if ( rrProp.Name.equals( sExtrusionSkew ) )
+ {
+ double fSkewAmount = 0;
+ double fSkewAngle = 0;
+ com::sun::star::drawing::EnhancedCustomShapeParameterPair aSkewParaPair;
+ if ( ( rrProp.Value >>= aSkewParaPair ) && ( aSkewParaPair.First.Value >>= fSkewAmount ) && ( aSkewParaPair.Second.Value >>= fSkewAngle ) )
+ {
+ AddOpt( DFF_Prop_c3DSkewAmount, (sal_Int32)fSkewAmount );
+ AddOpt( DFF_Prop_c3DSkewAngle, (sal_Int32)( fSkewAngle * 65536 ) );
+ }
+ }
+ else if ( rrProp.Name.equals( sExtrusionSpecularity ) )
+ {
+ double fExtrusionSpecularity = 0;
+ if ( rrProp.Value >>= fExtrusionSpecularity )
+ AddOpt( DFF_Prop_c3DSpecularAmt, (sal_Int32)( fExtrusionSpecularity * 1333 ) );
+ }
+ else if ( rrProp.Name.equals( sExtrusionProjectionMode ) )
+ {
+ drawing::ProjectionMode eExtrusionProjectionMode;
+ if ( rrProp.Value >>= eExtrusionProjectionMode )
+ {
+ nFillHarshFlags |= 0x40000;
+ if ( eExtrusionProjectionMode == drawing::ProjectionMode_PARALLEL )
+ nFillHarshFlags |= 4;
+ else
+ nFillHarshFlags &=~4;
+ }
+ }
+ else if ( rrProp.Name.equals( sExtrusionViewPoint ) )
+ {
+ drawing::Position3D aExtrusionViewPoint;
+ if ( rrProp.Value >>= aExtrusionViewPoint )
+ {
+ aExtrusionViewPoint.PositionX *= 360.0;
+ aExtrusionViewPoint.PositionY *= 360.0;
+ aExtrusionViewPoint.PositionZ *= 360.0;
+ AddOpt( DFF_Prop_c3DXViewpoint, (sal_Int32)aExtrusionViewPoint.PositionX );
+ AddOpt( DFF_Prop_c3DYViewpoint, (sal_Int32)aExtrusionViewPoint.PositionY );
+ AddOpt( DFF_Prop_c3DZViewpoint, (sal_Int32)aExtrusionViewPoint.PositionZ );
+ }
+ }
+ else if ( rrProp.Name.equals( sExtrusionOrigin ) )
+ {
+ double fExtrusionOriginX = 0;
+ double fExtrusionOriginY = 0;
+ com::sun::star::drawing::EnhancedCustomShapeParameterPair aOriginPair;
+ if ( ( rrProp.Value >>= aOriginPair ) && ( aOriginPair.First.Value >>= fExtrusionOriginX ) && ( aOriginPair.Second.Value >>= fExtrusionOriginY ) )
+ {
+ AddOpt( DFF_Prop_c3DOriginX, (sal_Int32)( fExtrusionOriginX * 65536 ) );
+ AddOpt( DFF_Prop_c3DOriginY, (sal_Int32)( fExtrusionOriginY * 65536 ) );
+ }
+ }
+ else if ( rrProp.Name.equals( sExtrusionColor ) )
+ {
+ sal_Bool bExtrusionColor = sal_Bool();
+ if ( rrProp.Value >>= bExtrusionColor )
+ {
+ nLightFaceFlags |= 0x20000;
+ if ( bExtrusionColor )
+ {
+ nLightFaceFlags |= 2;
+ uno::Any aFillColor2;
+ if ( EscherPropertyValueHelper::GetPropertyValue( aFillColor2, aXPropSet,
+ String( RTL_CONSTASCII_USTRINGPARAM( "FillColor2" ) ), sal_True ) )
+ {
+ sal_uInt32 nFillColor = ImplGetColor( *((sal_uInt32*)aFillColor2.getValue()) );
+ AddOpt( DFF_Prop_c3DExtrusionColor, nFillColor );
+ }
+ }
+ else
+ nLightFaceFlags &=~2;
+ }
+ }
+ }
+ if ( nLightFaceFlags != nLightFaceFlagsOrg )
+ AddOpt( DFF_Prop_fc3DLightFace, nLightFaceFlags );
+ if ( nFillHarshFlags != nFillHarshFlagsOrg )
+ AddOpt( DFF_Prop_fc3DFillHarsh, nFillHarshFlags );
+ }
+ }
+ else if ( rProp.Name.equals( sEquations ) )
+ {
+ if ( !bIsDefaultObject )
+ {
+ sal_uInt16 nElements = (sal_uInt16)aEquations.size();
+ if ( nElements )
+ {
+ sal_uInt16 nElementSize = 8;
+ sal_uInt32 nStreamSize = nElementSize * nElements + 6;
+ SvMemoryStream aOut( nStreamSize );
+ aOut << nElements
+ << nElements
+ << nElementSize;
+
+ std::vector< EnhancedCustomShapeEquation >::const_iterator aIter( aEquations.begin() );
+ std::vector< EnhancedCustomShapeEquation >::const_iterator aEnd ( aEquations.end() );
+ while( aIter != aEnd )
+ {
+ aOut << (sal_uInt16)aIter->nOperation
+ << (sal_Int16)aIter->nPara[ 0 ]
+ << (sal_Int16)aIter->nPara[ 1 ]
+ << (sal_Int16)aIter->nPara[ 2 ];
+ aIter++;
+ }
+ sal_uInt8* pBuf = new sal_uInt8[ nStreamSize ];
+ memcpy( pBuf, aOut.GetData(), nStreamSize );
+ AddOpt( DFF_Prop_pFormulas, sal_True, nStreamSize - 6, pBuf, nStreamSize );
+ }
+ else
+ {
+ sal_uInt8* pBuf = new sal_uInt8[ 1 ];
+ AddOpt( DFF_Prop_pFormulas, sal_True, 0, pBuf, 0 );
+ }
+ }
+ }
+ else if ( rProp.Name.equals( sPath ) )
+ {
+ uno::Sequence< beans::PropertyValue > aPathPropSeq;
+ if ( rProp.Value >>= aPathPropSeq )
+ {
+ sal_uInt32 nPathFlags, nPathFlagsOrg;
+ nPathFlagsOrg = nPathFlags = 0x39;
+ if ( GetOpt( DFF_Prop_fFillOK, nPathFlags ) )
+ nPathFlagsOrg = nPathFlags;
+
+ sal_Int32 r, nrCount = aPathPropSeq.getLength();
+ for ( r = 0; r < nrCount; r++ )
+ {
+ const beans::PropertyValue& rrProp = aPathPropSeq[ r ];
+ const rtl::OUString sPathExtrusionAllowed ( RTL_CONSTASCII_USTRINGPARAM( "ExtrusionAllowed" ) );
+ const rtl::OUString sPathConcentricGradientFillAllowed ( RTL_CONSTASCII_USTRINGPARAM( "ConcentricGradientFillAllowed" ) );
+ const rtl::OUString sPathTextPathAllowed ( RTL_CONSTASCII_USTRINGPARAM( "TextPathAllowed" ) );
+ const rtl::OUString sPathCoordinates ( RTL_CONSTASCII_USTRINGPARAM( "Coordinates" ) );
+ const rtl::OUString sPathGluePoints ( RTL_CONSTASCII_USTRINGPARAM( "GluePoints" ) );
+ const rtl::OUString sPathGluePointType ( RTL_CONSTASCII_USTRINGPARAM( "GluePointType" ) );
+ const rtl::OUString sPathSegments ( RTL_CONSTASCII_USTRINGPARAM( "Segments" ) );
+ const rtl::OUString sPathStretchX ( RTL_CONSTASCII_USTRINGPARAM( "StretchX" ) );
+ const rtl::OUString sPathStretchY ( RTL_CONSTASCII_USTRINGPARAM( "StretchY" ) );
+ const rtl::OUString sPathTextFrames ( RTL_CONSTASCII_USTRINGPARAM( "TextFrames" ) );
+
+ if ( rrProp.Name.equals( sPathExtrusionAllowed ) )
+ {
+ sal_Bool bExtrusionAllowed = sal_Bool();
+ if ( rrProp.Value >>= bExtrusionAllowed )
+ {
+ nPathFlags |= 0x100000;
+ if ( bExtrusionAllowed )
+ nPathFlags |= 16;
+ else
+ nPathFlags &=~16;
+ }
+ }
+ else if ( rrProp.Name.equals( sPathConcentricGradientFillAllowed ) )
+ {
+ sal_Bool bConcentricGradientFillAllowed = sal_Bool();
+ if ( rrProp.Value >>= bConcentricGradientFillAllowed )
+ {
+ nPathFlags |= 0x20000;
+ if ( bConcentricGradientFillAllowed )
+ nPathFlags |= 2;
+ else
+ nPathFlags &=~2;
+ }
+ }
+ else if ( rrProp.Name.equals( sPathTextPathAllowed ) )
+ {
+ sal_Bool bTextPathAllowed = sal_Bool();
+ if ( rrProp.Value >>= bTextPathAllowed )
+ {
+ nPathFlags |= 0x40000;
+ if ( bTextPathAllowed )
+ nPathFlags |= 4;
+ else
+ nPathFlags &=~4;
+ }
+ }
+ else if ( rrProp.Name.equals( sPathCoordinates ) )
+ {
+ if ( !bIsDefaultObject )
+ {
+ com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair > aCoordinates;
+ if ( rrProp.Value >>= aCoordinates )
+ {
+ // creating the vertices
+ if ( (sal_uInt16)aCoordinates.getLength() )
+ {
+ sal_uInt16 j, nElements = (sal_uInt16)aCoordinates.getLength();
+ sal_uInt16 nElementSize = 8;
+ sal_uInt32 nStreamSize = nElementSize * nElements + 6;
+ SvMemoryStream aOut( nStreamSize );
+ aOut << nElements
+ << nElements
+ << nElementSize;
+ for( j = 0; j < nElements; j++ )
+ {
+ sal_Int32 X = GetValueForEnhancedCustomShapeParameter( aCoordinates[ j ].First, aEquationOrder );
+ sal_Int32 Y = GetValueForEnhancedCustomShapeParameter( aCoordinates[ j ].Second, aEquationOrder );
+ aOut << X
+ << Y;
+ }
+ sal_uInt8* pBuf = new sal_uInt8[ nStreamSize ];
+ memcpy( pBuf, aOut.GetData(), nStreamSize );
+ AddOpt( DFF_Prop_pVertices, sal_True, nStreamSize - 6, pBuf, nStreamSize ); // -6
+ }
+ else
+ {
+ sal_uInt8* pBuf = new sal_uInt8[ 1 ];
+ AddOpt( DFF_Prop_pVertices, sal_True, 0, pBuf, 0 );
+ }
+ }
+ }
+ }
+ else if ( rrProp.Name.equals( sPathGluePoints ) )
+ {
+ if ( !bIsDefaultObject )
+ {
+ com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair> aGluePoints;
+ if ( rrProp.Value >>= aGluePoints )
+ {
+ // creating the vertices
+ sal_uInt16 nElements = (sal_uInt16)aGluePoints.getLength();
+ if ( nElements )
+ {
+ sal_uInt16 j, nElementSize = 8;
+ sal_uInt32 nStreamSize = nElementSize * nElements + 6;
+ SvMemoryStream aOut( nStreamSize );
+ aOut << nElements
+ << nElements
+ << nElementSize;
+ for( j = 0; j < nElements; j++ )
+ {
+ sal_Int32 X = GetValueForEnhancedCustomShapeParameter( aGluePoints[ j ].First, aEquationOrder );
+ sal_Int32 Y = GetValueForEnhancedCustomShapeParameter( aGluePoints[ j ].Second, aEquationOrder );
+ aOut << X
+ << Y;
+ }
+ sal_uInt8* pBuf = new sal_uInt8[ nStreamSize ];
+ memcpy( pBuf, aOut.GetData(), nStreamSize );
+ AddOpt( DFF_Prop_connectorPoints, sal_True, nStreamSize - 6, pBuf, nStreamSize ); // -6
+ }
+ else
+ {
+ sal_uInt8* pBuf = new sal_uInt8[ 1 ];
+ AddOpt( DFF_Prop_connectorPoints, sal_True, 0, pBuf, 0 );
+ }
+ }
+ }
+ }
+ else if ( rrProp.Name.equals( sPathGluePointType ) )
+ {
+ sal_Int16 nGluePointType = sal_Int16();
+ if ( rrProp.Value >>= nGluePointType )
+ AddOpt( DFF_Prop_connectorType, (sal_uInt16)nGluePointType );
+ }
+ else if ( rrProp.Name.equals( sPathSegments ) )
+ {
+ if ( !bIsDefaultObject )
+ {
+ com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeSegment > aSegments;
+ if ( rrProp.Value >>= aSegments )
+ {
+ // creating seginfo
+ if ( (sal_uInt16)aSegments.getLength() )
+ {
+ sal_uInt16 j, nElements = (sal_uInt16)aSegments.getLength();
+ sal_uInt16 nElementSize = 2;
+ sal_uInt32 nStreamSize = nElementSize * nElements + 6;
+ SvMemoryStream aOut( nStreamSize );
+ aOut << nElements
+ << nElements
+ << nElementSize;
+ for ( j = 0; j < nElements; j++ )
+ {
+ sal_uInt16 nVal = (sal_uInt16)aSegments[ j ].Count;
+ switch( aSegments[ j ].Command )
+ {
+ case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::UNKNOWN :
+ case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::LINETO : break;
+ case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::MOVETO :
+ {
+ nVal = 0x4000;
+ }
+ break;
+ case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::CURVETO :
+ {
+ nVal |= 0x2000;
+ }
+ break;
+ case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::CLOSESUBPATH :
+ {
+ nVal = 0x6001;
+ }
+ break;
+ case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ENDSUBPATH :
+ {
+ nVal = 0x8000;
+ }
+ break;
+ case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::NOFILL :
+ {
+ nVal = 0xaa00;
+ }
+ break;
+ case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::NOSTROKE :
+ {
+ nVal = 0xab00;
+ }
+ break;
+ case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ANGLEELLIPSETO :
+ {
+ nVal *= 3;
+ nVal |= 0xa100;
+ }
+ break;
+ case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ANGLEELLIPSE :
+ {
+ nVal *= 3;
+ nVal |= 0xa200;
+ }
+ break;
+ case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ARCTO :
+ {
+ nVal <<= 2;
+ nVal |= 0xa300;
+ }
+ break;
+ case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ARC :
+ {
+ nVal <<= 2;
+ nVal |= 0xa400;
+ }
+ break;
+ case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::CLOCKWISEARCTO :
+ {
+ nVal <<= 2;
+ nVal |= 0xa500;
+ }
+ break;
+ case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::CLOCKWISEARC :
+ {
+ nVal <<= 2;
+ nVal |= 0xa600;
+ }
+ break;
+ case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ELLIPTICALQUADRANTX :
+ {
+ nVal |= 0xa700;
+ }
+ break;
+ case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ELLIPTICALQUADRANTY :
+ {
+ nVal |= 0xa800;
+ }
+ break;
+ }
+ aOut << nVal;
+ }
+ sal_uInt8* pBuf = new sal_uInt8[ nStreamSize ];
+ memcpy( pBuf, aOut.GetData(), nStreamSize );
+ AddOpt( DFF_Prop_pSegmentInfo, sal_False, nStreamSize - 6, pBuf, nStreamSize );
+ }
+ else
+ {
+ sal_uInt8* pBuf = new sal_uInt8[ 1 ];
+ AddOpt( DFF_Prop_pSegmentInfo, sal_True, 0, pBuf, 0 );
+ }
+ }
+ }
+ }
+ else if ( rrProp.Name.equals( sPathStretchX ) )
+ {
+ if ( !bIsDefaultObject )
+ {
+ sal_Int32 nStretchX = 0;
+ if ( rrProp.Value >>= nStretchX )
+ AddOpt( DFF_Prop_stretchPointX, nStretchX );
+ }
+ }
+ else if ( rrProp.Name.equals( sPathStretchY ) )
+ {
+ if ( !bIsDefaultObject )
+ {
+ sal_Int32 nStretchY = 0;
+ if ( rrProp.Value >>= nStretchY )
+ AddOpt( DFF_Prop_stretchPointY, nStretchY );
+ }
+ }
+ else if ( rrProp.Name.equals( sPathTextFrames ) )
+ {
+ if ( !bIsDefaultObject )
+ {
+ com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeTextFrame > aPathTextFrames;
+ if ( rrProp.Value >>= aPathTextFrames )
+ {
+ if ( (sal_uInt16)aPathTextFrames.getLength() )
+ {
+ sal_uInt16 j, nElements = (sal_uInt16)aPathTextFrames.getLength();
+ sal_uInt16 nElementSize = 16;
+ sal_uInt32 nStreamSize = nElementSize * nElements + 6;
+ SvMemoryStream aOut( nStreamSize );
+ aOut << nElements
+ << nElements
+ << nElementSize;
+ for ( j = 0; j < nElements; j++ )
+ {
+ sal_Int32 nLeft = GetValueForEnhancedCustomShapeParameter( aPathTextFrames[ j ].TopLeft.First, aEquationOrder );
+ sal_Int32 nTop = GetValueForEnhancedCustomShapeParameter( aPathTextFrames[ j ].TopLeft.Second, aEquationOrder );
+ sal_Int32 nRight = GetValueForEnhancedCustomShapeParameter( aPathTextFrames[ j ].BottomRight.First, aEquationOrder );
+ sal_Int32 nBottom = GetValueForEnhancedCustomShapeParameter( aPathTextFrames[ j ].BottomRight.Second, aEquationOrder );
+
+ aOut << nLeft
+ << nTop
+ << nRight
+ << nBottom;
+ }
+ sal_uInt8* pBuf = new sal_uInt8[ nStreamSize ];
+ memcpy( pBuf, aOut.GetData(), nStreamSize );
+ AddOpt( DFF_Prop_textRectangles, sal_True, nStreamSize - 6, pBuf, nStreamSize );
+ }
+ else
+ {
+ sal_uInt8* pBuf = new sal_uInt8[ 1 ];
+ AddOpt( DFF_Prop_textRectangles, sal_True, 0, pBuf, 0 );
+ }
+ }
+ }
+ }
+ }
+ if ( nPathFlags != nPathFlagsOrg )
+ AddOpt( DFF_Prop_fFillOK, nPathFlags );
+ }
+ }
+ else if ( rProp.Name.equals( sTextPath ) )
+ {
+ uno::Sequence< beans::PropertyValue > aTextPathPropSeq;
+ if ( rProp.Value >>= aTextPathPropSeq )
+ {
+ sal_uInt32 nTextPathFlagsOrg, nTextPathFlags;
+ nTextPathFlagsOrg = nTextPathFlags = 0xffff1000; // default
+ if ( GetOpt( DFF_Prop_gtextFStrikethrough, nTextPathFlags ) )
+ nTextPathFlagsOrg = nTextPathFlags;
+
+ sal_Int32 r, nrCount = aTextPathPropSeq.getLength();
+ for ( r = 0; r < nrCount; r++ )
+ {
+ const beans::PropertyValue& rrProp = aTextPathPropSeq[ r ];
+ const rtl::OUString sTextPathMode ( RTL_CONSTASCII_USTRINGPARAM( "TextPathMode" ) );
+ const rtl::OUString sTextPathScaleX ( RTL_CONSTASCII_USTRINGPARAM( "ScaleX" ) );
+ const rtl::OUString sSameLetterHeights ( RTL_CONSTASCII_USTRINGPARAM( "SameLetterHeights" ) );
+
+ if ( rrProp.Name.equals( sTextPath ) )
+ {
+ sal_Bool bTextPathOn = sal_Bool();
+ if ( rrProp.Value >>= bTextPathOn )
+ {
+ nTextPathFlags |= 0x40000000;
+ if ( bTextPathOn )
+ {
+ nTextPathFlags |= 0x4000;
+
+ sal_uInt32 nPathFlags = 0x39;
+ GetOpt( DFF_Prop_fFillOK, nPathFlags ); // SJ: can be removed if we are supporting the TextPathAllowed property in XML
+ nPathFlags |= 0x40004;
+ AddOpt( DFF_Prop_fFillOK, nPathFlags );
+ }
+ else
+ nTextPathFlags &=~0x4000;
+ }
+ }
+ else if ( rrProp.Name.equals( sTextPathMode ) )
+ {
+ com::sun::star::drawing::EnhancedCustomShapeTextPathMode eTextPathMode;
+ if ( rrProp.Value >>= eTextPathMode )
+ {
+ nTextPathFlags |= 0x05000000;
+ nTextPathFlags &=~0x500; // TextPathMode_NORMAL
+ if ( eTextPathMode == com::sun::star::drawing::EnhancedCustomShapeTextPathMode_PATH )
+ nTextPathFlags |= 0x100;
+ else if ( eTextPathMode == com::sun::star::drawing::EnhancedCustomShapeTextPathMode_SHAPE )
+ nTextPathFlags |= 0x500;
+ }
+ }
+ else if ( rrProp.Name.equals( sTextPathScaleX ) )
+ {
+ sal_Bool bTextPathScaleX = sal_Bool();
+ if ( rrProp.Value >>= bTextPathScaleX )
+ {
+ nTextPathFlags |= 0x00400000;
+ if ( bTextPathScaleX )
+ nTextPathFlags |= 0x40;
+ else
+ nTextPathFlags &=~0x40;
+ }
+ }
+ else if ( rrProp.Name.equals( sSameLetterHeights ) )
+ {
+ sal_Bool bSameLetterHeights = sal_Bool();
+ if ( rrProp.Value >>= bSameLetterHeights )
+ {
+ nTextPathFlags |= 0x00800000;
+ if ( bSameLetterHeights )
+ nTextPathFlags |= 0x80;
+ else
+ nTextPathFlags &=~0x80;
+ }
+ }
+ }
+ if ( nTextPathFlags & 0x4000 ) // Is FontWork ?
+ {
+ // FontWork Text
+ rtl::OUString aText;
+ uno::Reference< text::XSimpleText > xText( rXShape, uno::UNO_QUERY );
+ if ( xText.is() )
+ aText = xText->getString();
+ if ( !aText.getLength() )
+ aText = ::rtl::OUString::createFromAscii( "your text" ); // todo: moving into a resource
+ AddOpt( DFF_Prop_gtextUNICODE, aText );
+
+ // FontWork Font
+ rtl::OUString aFontName;
+ const rtl::OUString sCharFontName ( RTL_CONSTASCII_USTRINGPARAM( "CharFontName" ) );
+ uno::Any aAny = aXPropSet->getPropertyValue( sCharFontName );
+ aAny >>= aFontName;
+ if ( !aFontName.getLength() )
+ aFontName = ::rtl::OUString::createFromAscii( "Arial Black" );
+ AddOpt( DFF_Prop_gtextFont, aFontName );
+
+ sal_Int16 nCharScaleWidth = 100;
+ if ( EscherPropertyValueHelper::GetPropertyValue( aAny, aXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "CharScaleWidth" ) ), sal_True ) )
+ {
+ if ( aAny >>= nCharScaleWidth )
+ {
+ if ( nCharScaleWidth != 100 )
+ {
+ sal_Int32 nVal = nCharScaleWidth * 655;
+ AddOpt( DFF_Prop_gtextSpacing, nVal );
+ }
+ }
+ }
+ if ( EscherPropertyValueHelper::GetPropertyValue( aAny, aXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "CharKerning" ) ), sal_True ) )
+ {
+ sal_Int16 nCharKerning = sal_Int16();
+ if ( aAny >>= nCharKerning )
+ {
+ nTextPathFlags |= 0x10000000;
+ if ( nCharKerning )
+ nTextPathFlags |= 0x1000;
+ else
+ nTextPathFlags &=~0x1000;
+ }
+ }
+ if ( EscherPropertyValueHelper::GetPropertyValue( aAny, aXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "CharPosture" ) ), sal_True ) )
+ {
+ awt::FontSlant eFontSlant;
+ if ( aAny >>= eFontSlant )
+ {
+ nTextPathFlags |= 0x100010;
+ if ( eFontSlant != awt::FontSlant_NONE )
+ nTextPathFlags |= 0x10;
+ else
+ nTextPathFlags &=~0x10;
+ }
+ }
+ if ( EscherPropertyValueHelper::GetPropertyValue( aAny, aXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "CharWeight" ) ), sal_True ) )
+ {
+ float fFontWidth = 0;
+ if ( aAny >>= fFontWidth )
+ {
+ nTextPathFlags |= 0x200020;
+ if ( fFontWidth > awt::FontWeight::NORMAL )
+ nTextPathFlags |= 0x20;
+ else
+ nTextPathFlags &=~0x20;
+ }
+ }
+ }
+ if ( nTextPathFlags != nTextPathFlagsOrg )
+ AddOpt( DFF_Prop_gtextFStrikethrough, nTextPathFlags );
+ }
+ }
+ else if ( rProp.Name.equals( sHandles ) )
+ {
+ if ( !bIsDefaultObject )
+ {
+ bPredefinedHandlesUsed = sal_False;
+ if ( rProp.Value >>= aHandlesPropSeq )
+ {
+ sal_uInt16 nElements = (sal_uInt16)aHandlesPropSeq.getLength();
+ if ( nElements )
+ {
+ const rtl::OUString sHandle ( RTL_CONSTASCII_USTRINGPARAM( "Handle" ) );
+
+ sal_uInt16 k, j, nElementSize = 36;
+ sal_uInt32 nStreamSize = nElementSize * nElements + 6;
+ SvMemoryStream aOut( nStreamSize );
+ aOut << nElements
+ << nElements
+ << nElementSize;
+
+ for ( k = 0; k < nElements; k++ )
+ {
+ sal_uInt32 nFlags = 0;
+ sal_Int32 nXPosition = 0;
+ sal_Int32 nYPosition = 0;
+ sal_Int32 nXMap = 0;
+ sal_Int32 nYMap = 0;
+ sal_Int32 nXRangeMin = 0x80000000;
+ sal_Int32 nXRangeMax = 0x7fffffff;
+ sal_Int32 nYRangeMin = 0x80000000;
+ sal_Int32 nYRangeMax = 0x7fffffff;
+
+ const uno::Sequence< beans::PropertyValue >& rPropSeq = aHandlesPropSeq[ k ];
+ for ( j = 0; j < rPropSeq.getLength(); j++ )
+ {
+ const beans::PropertyValue& rPropVal = rPropSeq[ j ];
+
+ const rtl::OUString sPosition ( RTL_CONSTASCII_USTRINGPARAM( "Position" ) );
+ const rtl::OUString sMirroredX ( RTL_CONSTASCII_USTRINGPARAM( "MirroredX" ) );
+ const rtl::OUString sMirroredY ( RTL_CONSTASCII_USTRINGPARAM( "MirroredY" ) );
+ const rtl::OUString sSwitched ( RTL_CONSTASCII_USTRINGPARAM( "Switched" ) );
+ const rtl::OUString sPolar ( RTL_CONSTASCII_USTRINGPARAM( "Polar" ) );
+ // const rtl::OUString sMap ( RTL_CONSTASCII_USTRINGPARAM( "Map" ) );
+ const rtl::OUString sRadiusRangeMinimum ( RTL_CONSTASCII_USTRINGPARAM( "RadiusRangeMinimum" ) );
+ const rtl::OUString sRadiusRangeMaximum ( RTL_CONSTASCII_USTRINGPARAM( "RadiusRangeMaximum" ) );
+ const rtl::OUString sRangeXMinimum ( RTL_CONSTASCII_USTRINGPARAM( "RangeXMinimum" ) );
+ const rtl::OUString sRangeXMaximum ( RTL_CONSTASCII_USTRINGPARAM( "RangeXMaximum" ) );
+ const rtl::OUString sRangeYMinimum ( RTL_CONSTASCII_USTRINGPARAM( "RangeYMinimum" ) );
+ const rtl::OUString sRangeYMaximum ( RTL_CONSTASCII_USTRINGPARAM( "RangeYMaximum" ) );
+
+ if ( rPropVal.Name.equals( sPosition ) )
+ {
+ com::sun::star::drawing::EnhancedCustomShapeParameterPair aPosition;
+ if ( rPropVal.Value >>= aPosition )
+ {
+ GetValueForEnhancedCustomShapeHandleParameter( nXPosition, aPosition.First );
+ GetValueForEnhancedCustomShapeHandleParameter( nYPosition, aPosition.Second );
+ }
+ }
+ else if ( rPropVal.Name.equals( sMirroredX ) )
+ {
+ sal_Bool bMirroredX = sal_Bool();
+ if ( rPropVal.Value >>= bMirroredX )
+ {
+ if ( bMirroredX )
+ nFlags |= 1;
+ }
+ }
+ else if ( rPropVal.Name.equals( sMirroredY ) )
+ {
+ sal_Bool bMirroredY = sal_Bool();
+ if ( rPropVal.Value >>= bMirroredY )
+ {
+ if ( bMirroredY )
+ nFlags |= 2;
+ }
+ }
+ else if ( rPropVal.Name.equals( sSwitched ) )
+ {
+ sal_Bool bSwitched = sal_Bool();
+ if ( rPropVal.Value >>= bSwitched )
+ {
+ if ( bSwitched )
+ nFlags |= 4;
+ }
+ }
+ else if ( rPropVal.Name.equals( sPolar ) )
+ {
+ com::sun::star::drawing::EnhancedCustomShapeParameterPair aPolar;
+ if ( rPropVal.Value >>= aPolar )
+ {
+ if ( GetValueForEnhancedCustomShapeHandleParameter( nXMap, aPolar.First ) )
+ nFlags |= 0x800;
+ if ( GetValueForEnhancedCustomShapeHandleParameter( nYMap, aPolar.Second ) )
+ nFlags |= 0x1000;
+ nFlags |= 8;
+ }
+ }
+ /* seems not to be used.
+ else if ( rPropVal.Name.equals( sMap ) )
+ {
+ com::sun::star::drawing::EnhancedCustomShapeParameterPair aMap;
+ if ( rPropVal.Value >>= aMap )
+ {
+ if ( GetValueForEnhancedCustomShapeHandleParameter( nXMap, aMap.First ) )
+ nFlags |= 0x800;
+ if ( GetValueForEnhancedCustomShapeHandleParameter( nYMap, aMap.Second ) )
+ nFlags |= 0x1000;
+ nFlags |= 0x10;
+ }
+ }
+ */
+ else if ( rPropVal.Name.equals( sRadiusRangeMinimum ) )
+ {
+ nYRangeMin = (sal_Int32)0xff4c0000; // the range of angles seems to be a not
+ nYRangeMax = (sal_Int32)0x00b40000; // used feature, so we are defaulting this
+
+ com::sun::star::drawing::EnhancedCustomShapeParameter aRadiusRangeMinimum;
+ if ( rPropVal.Value >>= aRadiusRangeMinimum )
+ {
+ if ( GetValueForEnhancedCustomShapeHandleParameter( nXRangeMin, aRadiusRangeMinimum ) )
+ nFlags |= 0x80;
+ nFlags |= 0x2000;
+ }
+ }
+ else if ( rPropVal.Name.equals( sRadiusRangeMaximum ) )
+ {
+ nYRangeMin = (sal_Int32)0xff4c0000; // the range of angles seems to be a not
+ nYRangeMax = (sal_Int32)0x00b40000; // used feature, so we are defaulting this
+
+ com::sun::star::drawing::EnhancedCustomShapeParameter aRadiusRangeMaximum;
+ if ( rPropVal.Value >>= aRadiusRangeMaximum )
+ {
+ if ( GetValueForEnhancedCustomShapeHandleParameter( nXRangeMax, aRadiusRangeMaximum ) )
+ nFlags |= 0x100;
+ nFlags |= 0x2000;
+ }
+ }
+ else if ( rPropVal.Name.equals( sRangeXMinimum ) )
+ {
+ com::sun::star::drawing::EnhancedCustomShapeParameter aXRangeMinimum;
+ if ( rPropVal.Value >>= aXRangeMinimum )
+ {
+ if ( GetValueForEnhancedCustomShapeHandleParameter( nXRangeMin, aXRangeMinimum ) )
+ nFlags |= 0x80;
+ nFlags |= 0x20;
+ }
+ }
+ else if ( rPropVal.Name.equals( sRangeXMaximum ) )
+ {
+ com::sun::star::drawing::EnhancedCustomShapeParameter aXRangeMaximum;
+ if ( rPropVal.Value >>= aXRangeMaximum )
+ {
+ if ( GetValueForEnhancedCustomShapeHandleParameter( nXRangeMax, aXRangeMaximum ) )
+ nFlags |= 0x100;
+ nFlags |= 0x20;
+ }
+ }
+ else if ( rPropVal.Name.equals( sRangeYMinimum ) )
+ {
+ com::sun::star::drawing::EnhancedCustomShapeParameter aYRangeMinimum;
+ if ( rPropVal.Value >>= aYRangeMinimum )
+ {
+ if ( GetValueForEnhancedCustomShapeHandleParameter( nYRangeMin, aYRangeMinimum ) )
+ nFlags |= 0x200;
+ nFlags |= 0x20;
+ }
+ }
+ else if ( rPropVal.Name.equals( sRangeYMaximum ) )
+ {
+ com::sun::star::drawing::EnhancedCustomShapeParameter aYRangeMaximum;
+ if ( rPropVal.Value >>= aYRangeMaximum )
+ {
+ if ( GetValueForEnhancedCustomShapeHandleParameter( nYRangeMax, aYRangeMaximum ) )
+ nFlags |= 0x400;
+ nFlags |= 0x20;
+ }
+ }
+ }
+ aOut << nFlags
+ << nXPosition
+ << nYPosition
+ << nXMap
+ << nYMap
+ << nXRangeMin
+ << nXRangeMax
+ << nYRangeMin
+ << nYRangeMax;
+
+ if ( nFlags & 8 )
+ nAdjustmentsWhichNeedsToBeConverted |= ( 1 << ( nYPosition - 0x100 ) );
+ }
+ sal_uInt8* pBuf = new sal_uInt8[ nStreamSize ];
+ memcpy( pBuf, aOut.GetData(), nStreamSize );
+ AddOpt( DFF_Prop_Handles, sal_True, nStreamSize - 6, pBuf, nStreamSize );
+ }
+ else
+ {
+ sal_uInt8* pBuf = new sal_uInt8[ 1 ];
+ AddOpt( DFF_Prop_Handles, sal_True, 0, pBuf, 0 );
+ }
+ }
+ }
+ }
+ else if ( rProp.Name.equals( sAdjustmentValues ) )
+ {
+ // it is required, that the information which handle is polar has already be read,
+ // so we are able to change the polar value to a fixed float
+ pAdjustmentValuesProp = &rProp;
+ }
+ }
+ if ( pAdjustmentValuesProp )
+ {
+ uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue > aAdjustmentSeq;
+ if ( pAdjustmentValuesProp->Value >>= aAdjustmentSeq )
+ {
+ if ( bPredefinedHandlesUsed )
+ LookForPolarHandles( eShapeType, nAdjustmentsWhichNeedsToBeConverted );
+
+ sal_Int32 k, nValue = 0, nAdjustmentValues = aAdjustmentSeq.getLength();
+ for ( k = 0; k < nAdjustmentValues; k++ )
+ if( GetAdjustmentValue( aAdjustmentSeq[ k ], k, nAdjustmentsWhichNeedsToBeConverted, nValue ) )
+ AddOpt( (sal_uInt16)( DFF_Prop_adjustValue + k ), (sal_uInt32)nValue );
+ }
+ }
+ }
+ }
+}
+
+// ---------------------------------------------------------------------------------------------
+
+MSO_SPT EscherPropertyContainer::GetCustomShapeType( const uno::Reference< drawing::XShape > & rXShape, sal_uInt32& nMirrorFlags, rtl::OUString& rShapeType )
+{
+ MSO_SPT eShapeType = mso_sptNil;
+ nMirrorFlags = 0;
+ uno::Reference< beans::XPropertySet > aXPropSet( rXShape, uno::UNO_QUERY );
+ if ( aXPropSet.is() )
+ {
+ try
+ {
+ const OUString sCustomShapeGeometry( RTL_CONSTASCII_USTRINGPARAM ( "CustomShapeGeometry" ) );
+ uno::Any aGeoPropSet = aXPropSet->getPropertyValue( sCustomShapeGeometry );
+ uno::Sequence< beans::PropertyValue > aGeoPropSeq;
+ if ( aGeoPropSet >>= aGeoPropSeq )
+ {
+ sal_Int32 i, nCount = aGeoPropSeq.getLength();
+ for ( i = 0; i < nCount; i++ )
+ {
+ const beans::PropertyValue& rProp = aGeoPropSeq[ i ];
+ if ( rProp.Name.equalsAscii( "Type" ) )
+ {
+ if ( rProp.Value >>= rShapeType )
+ eShapeType = EnhancedCustomShapeTypeNames::Get( rShapeType );
+ }
+ else if ( rProp.Name.equalsAscii( "MirroredX" ) )
+ {
+ sal_Bool bMirroredX = sal_Bool();
+ if ( ( rProp.Value >>= bMirroredX ) && bMirroredX )
+ nMirrorFlags |= SHAPEFLAG_FLIPH;
+ }
+ else if ( rProp.Name.equalsAscii( "MirroredY" ) )
+ {
+ sal_Bool bMirroredY = sal_Bool();
+ if ( ( rProp.Value >>= bMirroredY ) && bMirroredY )
+ nMirrorFlags |= SHAPEFLAG_FLIPV;
+ }
+ }
+ }
+ }
+ catch( ::com::sun::star::uno::Exception& )
+ {
+ }
+ }
+ return eShapeType;
+}
+
+MSO_SPT EscherPropertyContainer::GetCustomShapeType( const uno::Reference< drawing::XShape > & rXShape, sal_uInt32& nMirrorFlags )
+{
+ rtl::OUString aShapeType;
+ return GetCustomShapeType( rXShape, nMirrorFlags, aShapeType );
+}
+
+// ---------------------------------------------------------------------------------------------
+
+EscherPersistTable::EscherPersistTable()
+{
+}
+
+// ---------------------------------------------------------------------------------------------
+
+EscherPersistTable::~EscherPersistTable()
+{
+ for ( void* pPtr = maPersistTable.First(); pPtr; pPtr = maPersistTable.Next() )
+ delete (EscherPersistEntry*)pPtr;
+}
+
+// ---------------------------------------------------------------------------------------------
+
+BOOL EscherPersistTable::PtIsID( UINT32 nID )
+{
+ for ( void* pPtr = maPersistTable.First(); pPtr; pPtr = maPersistTable.Next() )
+ {
+ if ( ((EscherPersistEntry*)pPtr)->mnID == nID )
+ return TRUE;
+ }
+ return FALSE;
+}
+
+// ---------------------------------------------------------------------------------------------
+
+void EscherPersistTable::PtInsert( UINT32 nID, UINT32 nOfs )
+{
+ maPersistTable.Insert( new EscherPersistEntry( nID, nOfs ) );
+}
+
+// ---------------------------------------------------------------------------------------------
+
+UINT32 EscherPersistTable::PtDelete( UINT32 nID )
+{
+ for ( void* pPtr = maPersistTable.First(); pPtr; pPtr = maPersistTable.Next() )
+ {
+ if ( ((EscherPersistEntry*)pPtr)->mnID == nID )
+ {
+// UINT32 nRetValue = ((EscherPersistEntry*)pPtr)->mnOffset;
+ delete (EscherPersistEntry*) maPersistTable.Remove();
+ }
+ }
+ return 0;
+}
+
+// ---------------------------------------------------------------------------------------------
+
+UINT32 EscherPersistTable::PtGetOffsetByID( UINT32 nID )
+{
+ for ( void* pPtr = maPersistTable.First(); pPtr; pPtr = maPersistTable.Next() )
+ {
+ if ( ((EscherPersistEntry*)pPtr)->mnID == nID )
+ return ((EscherPersistEntry*)pPtr)->mnOffset;
+ }
+ return 0;
+};
+
+// ---------------------------------------------------------------------------------------------
+
+UINT32 EscherPersistTable::PtReplace( UINT32 nID, UINT32 nOfs )
+{
+ for ( void* pPtr = maPersistTable.First(); pPtr; pPtr = maPersistTable.Next() )
+ {
+ if ( ((EscherPersistEntry*)pPtr)->mnID == nID )
+ {
+ UINT32 nRetValue = ((EscherPersistEntry*)pPtr)->mnOffset;
+ ((EscherPersistEntry*)pPtr)->mnOffset = nOfs;
+ return nRetValue;
+ }
+ }
+ return 0;
+}
+
+// ---------------------------------------------------------------------------------------------
+
+UINT32 EscherPersistTable::PtReplaceOrInsert( UINT32 nID, UINT32 nOfs )
+{
+ for ( void* pPtr = maPersistTable.First(); pPtr; pPtr = maPersistTable.Next() )
+ {
+ if ( ((EscherPersistEntry*)pPtr)->mnID == nID )
+ {
+ UINT32 nRetValue = ((EscherPersistEntry*)pPtr)->mnOffset;
+ ((EscherPersistEntry*)pPtr)->mnOffset = nOfs;
+ return nRetValue;
+ }
+ }
+ PtInsert( nID, nOfs );
+ return 0;
+}
+
+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 )
+{
+ sal_Bool bRetValue = sal_True;
+ if ( bTestPropertyAvailability )
+ {
+ bRetValue = sal_False;
+ try
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
+ aXPropSetInfo( rXPropSet->getPropertySetInfo() );
+ if ( aXPropSetInfo.is() )
+ bRetValue = aXPropSetInfo->hasPropertyByName( rString );
+ }
+ catch( ::com::sun::star::uno::Exception& )
+ {
+ bRetValue = sal_False;
+ }
+ }
+ if ( bRetValue )
+ {
+ try
+ {
+ rAny = rXPropSet->getPropertyValue( rString );
+ if ( !rAny.hasValue() )
+ bRetValue = sal_False;
+ }
+ catch( ::com::sun::star::uno::Exception& )
+ {
+ bRetValue = sal_False;
+ }
+ }
+ return bRetValue;
+}
+
+// ---------------------------------------------------------------------------------------------
+
+::com::sun::star::beans::PropertyState EscherPropertyValueHelper::GetPropertyState(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
+ const String& rPropertyName )
+{
+ ::com::sun::star::beans::PropertyState eRetValue = ::com::sun::star::beans::PropertyState_AMBIGUOUS_VALUE;
+ try
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState > aXPropState
+ ( rXPropSet, ::com::sun::star::uno::UNO_QUERY );
+ if ( aXPropState.is() )
+ eRetValue = aXPropState->getPropertyState( rPropertyName );
+ }
+ catch( ::com::sun::star::uno::Exception& )
+ {
+ //...
+ }
+ return eRetValue;
+}
+
+// ---------------------------------------------------------------------------------------------
+// ---------------------------------------------------------------------------------------------
+// ---------------------------------------------------------------------------------------------
+
+EscherBlibEntry::EscherBlibEntry( sal_uInt32 nPictureOffset, const GraphicObject& rObject, const ByteString& rId,
+ const GraphicAttr* pGraphicAttr ) :
+ mnPictureOffset ( nPictureOffset ),
+ mnRefCount ( 1 ),
+ mnSizeExtra ( 0 ),
+ maPrefSize ( rObject.GetPrefSize() ),
+ maPrefMapMode ( rObject.GetPrefMapMode() ),
+ mbIsEmpty ( TRUE )
+{
+ mbIsNativeGraphicPossible = ( pGraphicAttr == NULL );
+ meBlibType = UNKNOWN;
+ mnSize = 0;
+
+ sal_uInt32 nLen = rId.Len();
+ const sal_Char* pData = rId.GetBuffer();
+ GraphicType eType( rObject.GetType() );
+ if ( nLen && pData && ( eType != GRAPHIC_NONE ) )
+ {
+ mnIdentifier[ 0 ] = rtl_crc32( 0,pData, nLen );
+ mnIdentifier[ 1 ] = 0;
+
+ if ( pGraphicAttr )
+ {
+ if ( pGraphicAttr->IsSpecialDrawMode()
+ || pGraphicAttr->IsMirrored()
+ || pGraphicAttr->IsCropped()
+ || pGraphicAttr->IsRotated()
+ || pGraphicAttr->IsTransparent()
+ || pGraphicAttr->IsAdjusted() )
+ {
+ SvMemoryStream aSt( sizeof( GraphicAttr ) );
+ aSt << static_cast<sal_uInt16>(pGraphicAttr->GetDrawMode())
+ << static_cast<sal_uInt32>(pGraphicAttr->GetMirrorFlags())
+ << pGraphicAttr->GetLeftCrop()
+ << pGraphicAttr->GetTopCrop()
+ << pGraphicAttr->GetRightCrop()
+ << pGraphicAttr->GetBottomCrop()
+ << pGraphicAttr->GetRotation()
+ << pGraphicAttr->GetLuminance()
+ << pGraphicAttr->GetContrast()
+ << pGraphicAttr->GetChannelR()
+ << pGraphicAttr->GetChannelG()
+ << pGraphicAttr->GetChannelB()
+ << pGraphicAttr->GetGamma()
+ << (BOOL)( pGraphicAttr->IsInvert() == TRUE )
+ << pGraphicAttr->GetTransparency();
+ mnIdentifier[ 1 ] = rtl_crc32( 0, aSt.GetData(), aSt.Tell() );
+ }
+ else
+ mbIsNativeGraphicPossible = TRUE;
+ }
+ sal_uInt32 i, nTmp, n1, n2;
+ n1 = n2 = 0;
+ for ( i = 0; i < nLen; i++ )
+ {
+ nTmp = n2 >> 28; // rotating 4 bit
+ n2 <<= 4;
+ n2 |= n1 >> 28;
+ n1 <<= 4;
+ n1 |= nTmp;
+ n1 ^= *pData++ - '0';
+ }
+ mnIdentifier[ 2 ] = n1;
+ mnIdentifier[ 3 ] = n2;
+ mbIsEmpty = FALSE;
+ }
+};
+
+// ---------------------------------------------------------------------------------------------
+
+void EscherBlibEntry::WriteBlibEntry( SvStream& rSt, sal_Bool bWritePictureOffset, sal_uInt32 nResize )
+{
+ sal_uInt32 nPictureOffset = ( bWritePictureOffset ) ? mnPictureOffset : 0;
+
+ rSt << (sal_uInt32)( ( ESCHER_BSE << 16 ) | ( ( (sal_uInt16)meBlibType << 4 ) | 2 ) )
+ << (sal_uInt32)( 36 + nResize )
+ << (sal_uInt8)meBlibType;
+
+ switch ( meBlibType )
+ {
+ case EMF :
+ case WMF : // EMF/WMF auf OS2 zu Pict Konvertieren
+ rSt << (sal_uInt8)PICT;
+ break;
+ default:
+ rSt << (sal_uInt8)meBlibType;
+ };
+
+ rSt.Write( &mnIdentifier[ 0 ], 16 );
+ rSt << (sal_uInt16)0
+ << (sal_uInt32)( mnSize + mnSizeExtra )
+ << mnRefCount
+ << nPictureOffset
+ << (sal_uInt32)0;
+}
+
+// ---------------------------------------------------------------------------------------------
+
+EscherBlibEntry::~EscherBlibEntry()
+{
+};
+
+// ---------------------------------------------------------------------------------------------
+
+BOOL EscherBlibEntry::operator==( const EscherBlibEntry& rEscherBlibEntry ) const
+{
+ for ( int i = 0; i < 3; i++ )
+ {
+ if ( mnIdentifier[ i ] != rEscherBlibEntry.mnIdentifier[ i ] )
+ return FALSE;
+ }
+ return TRUE;
+}
+
+// ---------------------------------------------------------------------------------------------
+// ---------------------------------------------------------------------------------------------
+// ---------------------------------------------------------------------------------------------
+
+EscherGraphicProvider::EscherGraphicProvider( sal_uInt32 nFlags ) :
+ mnFlags ( nFlags ),
+ mpBlibEntrys ( NULL ),
+ mnBlibBufSize ( 0 ),
+ mnBlibEntrys ( 0 )
+{
+}
+
+EscherGraphicProvider::~EscherGraphicProvider()
+{
+ for ( UINT32 i = 0; i < mnBlibEntrys; delete mpBlibEntrys[ i++ ] ) ;
+ delete[] mpBlibEntrys;
+}
+
+void EscherGraphicProvider::SetNewBlipStreamOffset( sal_Int32 nOffset )
+{
+ for( sal_uInt32 i = 0; i < mnBlibEntrys; i++ )
+ {
+ EscherBlibEntry* pBlibEntry = mpBlibEntrys[ i ];
+ pBlibEntry->mnPictureOffset += nOffset;
+ }
+}
+
+UINT32 EscherGraphicProvider::ImplInsertBlib( EscherBlibEntry* p_EscherBlibEntry )
+{
+ if ( mnBlibBufSize == mnBlibEntrys )
+ {
+ mnBlibBufSize += 64;
+ EscherBlibEntry** pTemp = new EscherBlibEntry*[ mnBlibBufSize ];
+ for ( UINT32 i = 0; i < mnBlibEntrys; i++ )
+ {
+ pTemp[ i ] = mpBlibEntrys[ i ];
+ }
+ delete[] mpBlibEntrys;
+ mpBlibEntrys = pTemp;
+ }
+ mpBlibEntrys[ mnBlibEntrys++ ] = p_EscherBlibEntry;
+ return mnBlibEntrys;
+}
+
+sal_uInt32 EscherGraphicProvider::GetBlibStoreContainerSize( SvStream* pMergePicStreamBSE ) const
+{
+ sal_uInt32 nSize = 44 * mnBlibEntrys + 8;
+ if ( pMergePicStreamBSE )
+ {
+ for ( sal_uInt32 i = 0; i < mnBlibEntrys; i++ )
+ nSize += mpBlibEntrys[ i ]->mnSize + mpBlibEntrys[ i ]->mnSizeExtra;
+ }
+ return nSize;
+}
+
+sal_Bool EscherGraphicProvider::WriteBlibStoreEntry(SvStream& rSt,
+ sal_uInt32 nBlipId, sal_Bool bWritePictureOffSet, sal_uInt32 nResize)
+{
+ if (nBlipId > mnBlibEntrys || nBlipId == 0)
+ return sal_False;
+ mpBlibEntrys[nBlipId-1]->WriteBlibEntry(rSt, bWritePictureOffSet, nResize);
+ return sal_True;
+}
+
+void EscherGraphicProvider::WriteBlibStoreContainer( SvStream& rSt, SvStream* pMergePicStreamBSE )
+{
+ sal_uInt32 nSize = GetBlibStoreContainerSize( pMergePicStreamBSE );
+ if ( nSize )
+ {
+ rSt << (sal_uInt32)( ( ESCHER_BstoreContainer << 16 ) | 0x1f )
+ << (sal_uInt32)( nSize - 8 );
+
+ if ( pMergePicStreamBSE )
+ {
+ sal_uInt32 i, nBlipSize, nOldPos = pMergePicStreamBSE->Tell();
+ const sal_uInt32 nBuf = 0x40000; // 256KB buffer
+ sal_uInt8* pBuf = new sal_uInt8[ nBuf ];
+
+ for ( i = 0; i < mnBlibEntrys; i++ )
+ {
+ EscherBlibEntry* pBlibEntry = mpBlibEntrys[ i ];
+
+ ESCHER_BlibType nBlibType = pBlibEntry->meBlibType;
+ nBlipSize = pBlibEntry->mnSize + pBlibEntry->mnSizeExtra;
+ pBlibEntry->WriteBlibEntry( rSt, sal_False, nBlipSize );
+
+ // BLIP
+ pMergePicStreamBSE->Seek( pBlibEntry->mnPictureOffset );
+ UINT16 n16;
+ // record version and instance
+ *pMergePicStreamBSE >> n16;
+ rSt << n16;
+ // record type
+ *pMergePicStreamBSE >> n16;
+ rSt << UINT16( ESCHER_BlipFirst + nBlibType );
+ DBG_ASSERT( n16 == ESCHER_BlipFirst + nBlibType , "EscherGraphicProvider::WriteBlibStoreContainer: BLIP record types differ" );
+ UINT32 n32;
+ // record size
+ *pMergePicStreamBSE >> n32;
+ nBlipSize -= 8;
+ rSt << nBlipSize;
+ DBG_ASSERT( nBlipSize == n32, "EscherGraphicProvider::WriteBlibStoreContainer: BLIP sizes differ" );
+ // record
+ while ( nBlipSize )
+ {
+ UINT32 nBytes = ( nBlipSize > nBuf ? nBuf : nBlipSize );
+ pMergePicStreamBSE->Read( pBuf, nBytes );
+ rSt.Write( pBuf, nBytes );
+ nBlipSize -= nBytes;
+ }
+ }
+ delete[] pBuf;
+ pMergePicStreamBSE->Seek( nOldPos );
+ }
+ else
+ {
+ for ( sal_uInt32 i = 0; i < mnBlibEntrys; i++ )
+ mpBlibEntrys[ i ]->WriteBlibEntry( rSt, sal_True );
+ }
+ }
+}
+
+sal_Bool EscherGraphicProvider::GetPrefSize( const sal_uInt32 nBlibId, Size& rPrefSize, MapMode& rPrefMapMode )
+{
+ sal_Bool bInRange = nBlibId && ( ( nBlibId - 1 ) < mnBlibEntrys );
+ if ( bInRange )
+ {
+ EscherBlibEntry* pEntry = mpBlibEntrys[ nBlibId - 1 ];
+ rPrefSize = pEntry->maPrefSize;
+ rPrefMapMode = pEntry->maPrefMapMode;
+ }
+ return bInRange;
+}
+
+sal_uInt32 EscherGraphicProvider::GetBlibID( SvStream& rPicOutStrm, const ByteString& rId,
+ const Rectangle& /* rBoundRect */, const com::sun::star::awt::Rectangle* pVisArea, const GraphicAttr* pGraphicAttr )
+{
+ sal_uInt32 nBlibId = 0;
+ GraphicObject aGraphicObject( rId );
+
+ EscherBlibEntry* p_EscherBlibEntry = new EscherBlibEntry( rPicOutStrm.Tell(), aGraphicObject, rId, pGraphicAttr );
+ if ( !p_EscherBlibEntry->IsEmpty() )
+ {
+ for ( UINT32 i = 0; i < mnBlibEntrys; i++ )
+ {
+ if ( *( mpBlibEntrys[ i ] ) == *p_EscherBlibEntry )
+ {
+ mpBlibEntrys[ i ]->mnRefCount++;
+ delete p_EscherBlibEntry;
+ return i + 1;
+ }
+ }
+
+ sal_Bool bUseNativeGraphic( FALSE );
+
+ Graphic aGraphic( aGraphicObject.GetTransformedGraphic( pGraphicAttr ) );
+ GfxLink aGraphicLink;
+ SvMemoryStream aStream;
+
+ const sal_uInt8* pGraphicAry = NULL;
+
+ if ( p_EscherBlibEntry->mbIsNativeGraphicPossible && aGraphic.IsLink() )
+ {
+ aGraphicLink = aGraphic.GetLink();
+
+ p_EscherBlibEntry->mnSize = aGraphicLink.GetDataSize();
+ pGraphicAry = aGraphicLink.GetData();
+
+ if ( p_EscherBlibEntry->mnSize && pGraphicAry )
+ {
+ switch ( aGraphicLink.GetType() )
+ {
+ case GFX_LINK_TYPE_NATIVE_JPG : p_EscherBlibEntry->meBlibType = PEG; break;
+ case GFX_LINK_TYPE_NATIVE_PNG : p_EscherBlibEntry->meBlibType = PNG; break;
+ case GFX_LINK_TYPE_NATIVE_WMF :
+ {
+ if ( pGraphicAry && ( p_EscherBlibEntry->mnSize > 0x2c ) )
+ {
+ if ( ( pGraphicAry[ 0x28 ] == 0x20 ) && ( pGraphicAry[ 0x29 ] == 0x45 ) // check the magic
+ && ( pGraphicAry[ 0x2a ] == 0x4d ) && ( pGraphicAry[ 0x2b ] == 0x46 ) ) // number ( emf detection )
+ {
+ p_EscherBlibEntry->meBlibType = EMF;
+ }
+ else
+ {
+ p_EscherBlibEntry->meBlibType = WMF;
+ if ( ( pGraphicAry[ 0 ] == 0xd7 ) && ( pGraphicAry[ 1 ] == 0xcd )
+ && ( pGraphicAry[ 2 ] == 0xc6 ) && ( pGraphicAry[ 3 ] == 0x9a ) )
+ { // we have to get rid of the metafileheader
+ pGraphicAry += 22;
+ p_EscherBlibEntry->mnSize -= 22;
+ }
+ }
+ }
+ }
+ break;
+ default: break;
+ }
+ if ( p_EscherBlibEntry->meBlibType != UNKNOWN )
+ bUseNativeGraphic = TRUE;
+ }
+ }
+ if ( !bUseNativeGraphic )
+ {
+ GraphicType eGraphicType = aGraphic.GetType();
+ if ( ( eGraphicType == GRAPHIC_BITMAP ) || ( eGraphicType == GRAPHIC_GDIMETAFILE ) )
+ {
+ sal_uInt32 nErrCode;
+ if ( !aGraphic.IsAnimated() )
+// !EMF nErrCode = GraphicConverter::Export( aStream, aGraphic, ( eGraphicType == GRAPHIC_BITMAP ) ? CVT_PNG : CVT_WMF );
+ nErrCode = GraphicConverter::Export( aStream, aGraphic, ( eGraphicType == GRAPHIC_BITMAP ) ? CVT_PNG : CVT_EMF );
+ else
+ { // to store a animation, a gif has to be included into the msOG chunk of a png #I5583#
+ GraphicFilter* pFilter = GraphicFilter::GetGraphicFilter();
+ SvMemoryStream aGIFStream;
+ ByteString aVersion( "MSOFFICE9.0" );
+ aGIFStream.Write( aVersion.GetBuffer(), aVersion.Len() );
+ nErrCode = pFilter->ExportGraphic( aGraphic, String(), aGIFStream,
+ pFilter->GetExportFormatNumberForShortName( String( RTL_CONSTASCII_USTRINGPARAM( "GIF" ) ) ), NULL );
+ com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > aFilterData( 1 );
+ com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > aAdditionalChunkSequence( 1 );
+ sal_uInt32 nGIFSreamLen = aGIFStream.Tell();
+ com::sun::star::uno::Sequence< sal_Int8 > aGIFSeq( nGIFSreamLen );
+ sal_Int8* pSeq = aGIFSeq.getArray();
+ aGIFStream.Seek( STREAM_SEEK_TO_BEGIN );
+ aGIFStream.Read( pSeq, nGIFSreamLen );
+ com::sun::star::beans::PropertyValue aChunkProp, aFilterProp;
+ aChunkProp.Name = String( RTL_CONSTASCII_USTRINGPARAM( "msOG" ) );
+ aChunkProp.Value <<= aGIFSeq;
+ aAdditionalChunkSequence[ 0 ] = aChunkProp;
+ aFilterProp.Name = String( RTL_CONSTASCII_USTRINGPARAM( "AdditionalChunks" ) );
+ aFilterProp.Value <<= aAdditionalChunkSequence;
+ aFilterData[ 0 ] = aFilterProp;
+ nErrCode = pFilter->ExportGraphic( aGraphic, String(), aStream,
+ pFilter->GetExportFormatNumberForShortName( String( RTL_CONSTASCII_USTRINGPARAM( "PNG" ) ) ), &aFilterData );
+ }
+ if ( nErrCode == ERRCODE_NONE )
+ {
+// !EMF p_EscherBlibEntry->meBlibType = ( eGraphicType == GRAPHIC_BITMAP ) ? PNG : WMF;
+ p_EscherBlibEntry->meBlibType = ( eGraphicType == GRAPHIC_BITMAP ) ? PNG : EMF;
+ aStream.Seek( STREAM_SEEK_TO_END );
+ p_EscherBlibEntry->mnSize = aStream.Tell();
+ pGraphicAry = (sal_uInt8*)aStream.GetData();
+
+ if ( p_EscherBlibEntry->meBlibType == WMF ) // the fileheader is not used
+ {
+ p_EscherBlibEntry->mnSize -= 22;
+ pGraphicAry += 22;
+ }
+ }
+ }
+ }
+
+ ESCHER_BlibType eBlibType = p_EscherBlibEntry->meBlibType;
+ if ( p_EscherBlibEntry->mnSize && pGraphicAry && ( eBlibType != UNKNOWN ) )
+ {
+ sal_uInt32 nExtra, nAtomSize = 0;
+ sal_uInt32 nInstance, nUncompressedSize = p_EscherBlibEntry->mnSize;
+
+ if ( mnFlags & _E_GRAPH_PROV_USE_INSTANCES )
+ {
+ rPicOutStrm << (UINT32)( 0x7f90000 | (UINT16)( mnBlibEntrys << 4 ) )
+ << (UINT32)0;
+ nAtomSize = rPicOutStrm.Tell();
+ if ( eBlibType == PNG )
+ rPicOutStrm << (sal_uInt16)0x0606;
+ else if ( eBlibType == WMF )
+ rPicOutStrm << (sal_uInt16)0x0403;
+ else if ( eBlibType == EMF )
+ rPicOutStrm << (sal_uInt16)0x0402;
+ else if ( eBlibType == PEG )
+ rPicOutStrm << (sal_uInt16)0x0505;
+ }
+ if ( ( eBlibType == PEG ) || ( eBlibType == PNG ) )
+ {
+ nExtra = 17;
+ p_EscherBlibEntry->mnSizeExtra = nExtra + 8;
+ nInstance = ( eBlibType == PNG ) ? 0xf01e6e00 : 0xf01d46a0;
+ rPicOutStrm << nInstance << (sal_uInt32)( p_EscherBlibEntry->mnSize + nExtra );
+ rPicOutStrm.Write( p_EscherBlibEntry->mnIdentifier, 16 );
+ rPicOutStrm << (sal_uInt8)0xff;
+ rPicOutStrm.Write( pGraphicAry, p_EscherBlibEntry->mnSize );
+ }
+ else
+ {
+ ZCodec aZCodec( 0x8000, 0x8000 );
+ aZCodec.BeginCompression();
+ SvMemoryStream aDestStrm;
+ aZCodec.Write( aDestStrm, pGraphicAry, p_EscherBlibEntry->mnSize );
+ aZCodec.EndCompression();
+ aDestStrm.Seek( STREAM_SEEK_TO_END );
+ p_EscherBlibEntry->mnSize = aDestStrm.Tell();
+ pGraphicAry = (sal_uInt8*)aDestStrm.GetData();
+ if ( p_EscherBlibEntry->mnSize && pGraphicAry )
+ {
+ nExtra = eBlibType == WMF ? 0x42 : 0x32; // !EMF -> no change
+ p_EscherBlibEntry->mnSizeExtra = nExtra + 8;
+ nInstance = ( eBlibType == WMF ) ? 0xf01b2170 : 0xf01a3d40; // !EMF -> no change
+ rPicOutStrm << nInstance << (sal_uInt32)( p_EscherBlibEntry->mnSize + nExtra );
+ if ( eBlibType == WMF ) // !EMF -> no change
+ rPicOutStrm.Write( p_EscherBlibEntry->mnIdentifier, 16 );
+ rPicOutStrm.Write( p_EscherBlibEntry->mnIdentifier, 16 );
+
+ /*
+ ##913##
+ For Word the stored size of the graphic is critical the
+ metafile boundaries must match the actual graphics
+ boundaries, and the width and height must be in EMU's
+
+ If you don't do it this way then objects edited in the
+ msoffice app may show strange behaviour as the size jumps
+ around, and the original size and scaling factor in word
+ will be a very strange figure
+ */
+ UINT32 nPrefWidth = p_EscherBlibEntry->maPrefSize.Width();
+ UINT32 nPrefHeight = p_EscherBlibEntry->maPrefSize.Height();
+ UINT32 nWidth, nHeight;
+ if ( pVisArea )
+ {
+ nWidth = pVisArea->Width * 360;
+ nHeight = pVisArea->Height * 360;
+ }
+ else
+ {
+ Size aPrefSize(lcl_SizeToEmu(p_EscherBlibEntry->maPrefSize, p_EscherBlibEntry->maPrefMapMode));
+ nWidth = aPrefSize.Width() * 360;
+ nHeight = aPrefSize.Height() * 360;
+ }
+ rPicOutStrm << nUncompressedSize // WMFSize without FileHeader
+ << (sal_Int32)0 // da die Originalgroesse des WMF's (ohne FileHeader)
+ << (sal_Int32)0 // nicht mehr feststellbar ist, schreiben wir 10cm / x
+ << nPrefWidth
+ << nPrefHeight
+ << nWidth
+ << nHeight
+ << p_EscherBlibEntry->mnSize
+ << (sal_uInt16)0xfe00; // compression Flags
+ rPicOutStrm.Write( pGraphicAry, p_EscherBlibEntry->mnSize );
+ }
+ }
+ if ( nAtomSize )
+ {
+ sal_uInt32 nPos = rPicOutStrm.Tell();
+ rPicOutStrm.Seek( nAtomSize - 4 );
+ rPicOutStrm << (sal_uInt32)( nPos - nAtomSize );
+ rPicOutStrm.Seek( nPos );
+ }
+ nBlibId = ImplInsertBlib( p_EscherBlibEntry ), p_EscherBlibEntry = NULL;
+ }
+ }
+ if ( p_EscherBlibEntry )
+ delete p_EscherBlibEntry;
+ return nBlibId;
+}
+
+// ---------------------------------------------------------------------------------------------
+// ---------------------------------------------------------------------------------------------
+// ---------------------------------------------------------------------------------------------
+
+struct EscherConnectorRule
+{
+ sal_uInt32 nRuleId;
+ sal_uInt32 nShapeA; // SPID of shape A
+ sal_uInt32 nShapeB; // SPID of shape B
+ sal_uInt32 nShapeC; // SPID of connector shape
+ sal_uInt32 ncptiA; // Connection site Index of shape A
+ sal_uInt32 ncptiB; // Connection site Index of shape B
+};
+
+struct EscherShapeListEntry
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > aXShape;
+ sal_uInt32 n_EscherId;
+
+ EscherShapeListEntry( const ::com::sun::star::uno::Reference
+ < ::com::sun::star::drawing::XShape > & rShape, sal_uInt32 nId ) :
+ aXShape ( rShape ),
+ n_EscherId ( nId ) {}
+};
+
+sal_uInt32 EscherConnectorListEntry::GetClosestPoint( const Polygon& rPoly, const ::com::sun::star::awt::Point& rPoint )
+{
+ sal_uInt16 nCount = rPoly.GetSize();
+ sal_uInt16 nClosest = nCount;
+ double fDist = (sal_uInt32)0xffffffff;
+ while( nCount-- )
+ {
+ double fDistance = hypot( rPoint.X - rPoly[ nCount ].X(), rPoint.Y - rPoly[ nCount ].Y() );
+ if ( fDistance < fDist )
+ {
+ nClosest = nCount;
+ fDist = fDistance;
+ }
+ }
+ return nClosest;
+};
+
+// ---------------------------------------------------------------------------------------------
+// bei Rechtecken bei Ellipsen bei Polygonen
+//
+// nRule = 0 ->Top 0 ->Top nRule = Index auf ein (Poly)Polygon Punkt
+// 1 ->Left 2 ->Left
+// 2 ->Bottom 4 ->Bottom
+// 3 ->Right 6 ->Right
+
+sal_uInt32 EscherConnectorListEntry::GetConnectorRule( sal_Bool bFirst )
+{
+ sal_uInt32 nRule = 0;
+
+ ::com::sun::star::uno::Any aAny;
+ ::com::sun::star::awt::Point aRefPoint( ( bFirst ) ? maPointA : maPointB );
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ aXShape( ( bFirst ) ? mXConnectToA : mXConnectToB );
+
+ String aString( (::rtl::OUString)aXShape->getShapeType() );
+ ByteString aType( aString, RTL_TEXTENCODING_UTF8 );
+ aType.Erase( 0, 13 ); // removing "com.sun.star."
+ sal_uInt16 nPos = aType.Search( "Shape" );
+ aType.Erase( nPos, 5 );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
+ aPropertySet( aXShape, ::com::sun::star::uno::UNO_QUERY );
+
+ if ( aType == "drawing.PolyPolygon" || aType == "drawing.PolyLine" )
+ {
+ if ( aPropertySet.is() )
+ {
+ if ( EscherPropertyValueHelper::GetPropertyValue( aAny,
+ aPropertySet, String( RTL_CONSTASCII_USTRINGPARAM( "PolyPolygon" ) ) ) )
+ {
+ ::com::sun::star::drawing::PointSequenceSequence* pSourcePolyPolygon =
+ (::com::sun::star::drawing::PointSequenceSequence*)aAny.getValue();
+ sal_Int32 nOuterSequenceCount = pSourcePolyPolygon->getLength();
+ ::com::sun::star::drawing::PointSequence* pOuterSequence = pSourcePolyPolygon->getArray();
+
+ if ( pOuterSequence )
+ {
+ sal_Int32 a, b, nIndex = 0;
+ sal_uInt32 nDistance = 0xffffffff;
+ for( a = 0; a < nOuterSequenceCount; a++ )
+ {
+ ::com::sun::star::drawing::PointSequence* pInnerSequence = pOuterSequence++;
+ if ( pInnerSequence )
+ {
+ ::com::sun::star::awt::Point* pArray = pInnerSequence->getArray();
+ if ( pArray )
+ {
+ for ( b = 0; b < pInnerSequence->getLength(); b++, nIndex++, pArray++ )
+ {
+ sal_uInt32 nDist = (sal_uInt32)hypot( aRefPoint.X - pArray->X, aRefPoint.Y - pArray->Y );
+ if ( nDist < nDistance )
+ {
+ nRule = nIndex;
+ nDistance = nDist;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ else if ( ( aType == "drawing.OpenBezier" ) || ( aType == "drawing.OpenFreeHand" ) || ( aType == "drawing.PolyLinePath" )
+ || ( aType == "drawing.ClosedBezier" ) || ( aType == "drawing.ClosedFreeHand" ) || ( aType == "drawing.PolyPolygonPath" ) )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
+ aPropertySet2( aXShape, ::com::sun::star::uno::UNO_QUERY );
+ if ( aPropertySet2.is() )
+ {
+ if ( EscherPropertyValueHelper::GetPropertyValue( aAny,
+ aPropertySet2, String( RTL_CONSTASCII_USTRINGPARAM( "PolyPolygonBezier" ) ) ) )
+ {
+ ::com::sun::star::drawing::PolyPolygonBezierCoords* pSourcePolyPolygon =
+ (::com::sun::star::drawing::PolyPolygonBezierCoords*)aAny.getValue();
+ sal_Int32 nOuterSequenceCount = pSourcePolyPolygon->Coordinates.getLength();
+
+ // Zeiger auf innere sequences holen
+ ::com::sun::star::drawing::PointSequence* pOuterSequence =
+ pSourcePolyPolygon->Coordinates.getArray();
+ ::com::sun::star::drawing::FlagSequence* pOuterFlags =
+ pSourcePolyPolygon->Flags.getArray();
+
+ if ( pOuterSequence && pOuterFlags )
+ {
+ sal_Int32 a, b, nIndex = 0;
+ sal_uInt32 nDistance = 0xffffffff;
+
+ for ( a = 0; a < nOuterSequenceCount; a++ )
+ {
+ ::com::sun::star::drawing::PointSequence* pInnerSequence = pOuterSequence++;
+ ::com::sun::star::drawing::FlagSequence* pInnerFlags = pOuterFlags++;
+ if ( pInnerSequence && pInnerFlags )
+ {
+ ::com::sun::star::awt::Point* pArray = pInnerSequence->getArray();
+ ::com::sun::star::drawing::PolygonFlags* pFlags = pInnerFlags->getArray();
+ if ( pArray && pFlags )
+ {
+ for ( b = 0; b < pInnerSequence->getLength(); b++, pArray++ )
+ {
+ PolyFlags ePolyFlags = *( (PolyFlags*)pFlags++ );
+ if ( ePolyFlags == POLY_CONTROL )
+ continue;
+ sal_uInt32 nDist = (sal_uInt32)hypot( aRefPoint.X - pArray->X, aRefPoint.Y - pArray->Y );
+ if ( nDist < nDistance )
+ {
+ nRule = nIndex;
+ nDistance = nDist;
+ }
+ nIndex++;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ bool bRectangularConnection = true;
+
+ if ( aType == "drawing.Custom" )
+ {
+ SdrObject* pCustoShape( GetSdrObjectFromXShape( aXShape ) );
+ if ( pCustoShape && pCustoShape->ISA( SdrObjCustomShape ) )
+ {
+ SdrCustomShapeGeometryItem& rGeometryItem = (SdrCustomShapeGeometryItem&)(const SdrCustomShapeGeometryItem&)
+ pCustoShape->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY );
+
+ const rtl::OUString sPath( RTL_CONSTASCII_USTRINGPARAM( "Path" ) );
+ const rtl::OUString sType( RTL_CONSTASCII_USTRINGPARAM ( "Type" ) );
+ const rtl::OUString sGluePointType( RTL_CONSTASCII_USTRINGPARAM( "GluePointType" ) );
+
+ rtl::OUString sShapeType;
+ uno::Any* pType = rGeometryItem.GetPropertyValueByName( sType );
+ if ( pType )
+ *pType >>= sShapeType;
+ MSO_SPT eSpType = EnhancedCustomShapeTypeNames::Get( sShapeType );
+
+ uno::Any* pGluePointType = ((SdrCustomShapeGeometryItem&)rGeometryItem).GetPropertyValueByName( sPath, sGluePointType );
+
+ sal_Int16 nGluePointType = sal_Int16();
+ if ( !( pGluePointType &&
+ ( *pGluePointType >>= nGluePointType ) ) )
+ nGluePointType = GetCustomShapeConnectionTypeDefault( eSpType );
+
+ if ( nGluePointType == com::sun::star::drawing::EnhancedCustomShapeGluePointType::CUSTOM )
+ {
+ const SdrGluePointList* pList = pCustoShape->GetGluePointList();
+ if ( pList )
+ {
+ Polygon aPoly;
+ USHORT nNum, nAnz = pList->GetCount();
+ if ( nAnz )
+ {
+ for ( nNum = 0; nNum < nAnz; nNum++ )
+ {
+ const SdrGluePoint& rGP = (*pList)[ nNum ];
+ Point aPt( rGP.GetAbsolutePos( *pCustoShape ) );
+ aPoly.Insert( POLY_APPEND, aPt );
+ }
+ nRule = GetClosestPoint( aPoly, aRefPoint );
+ bRectangularConnection = false;
+ }
+ }
+ }
+ else if ( nGluePointType == com::sun::star::drawing::EnhancedCustomShapeGluePointType::SEGMENTS )
+ {
+ SdrObject* pPoly = pCustoShape->DoConvertToPolyObj( TRUE );
+ if ( pPoly && pPoly->ISA( SdrPathObj ) )
+ {
+ sal_Int16 a, b, nIndex = 0;
+ sal_uInt32 nDistance = 0xffffffff;
+
+ // #i74631# use explicit constructor here. Also XPolyPolygon is not necessary,
+ // reducing to PolyPolygon
+ const PolyPolygon aPolyPoly(((SdrPathObj*)pPoly)->GetPathPoly());
+
+ for ( a = 0; a < aPolyPoly.Count(); a++ )
+ {
+ const Polygon& rPoly = aPolyPoly.GetObject( a );
+ for ( b = 0; b < rPoly.GetSize(); b++ )
+ {
+ if ( rPoly.GetFlags( b ) != POLY_NORMAL )
+ continue;
+ const Point& rPt = rPoly[ b ];
+ sal_uInt32 nDist = (sal_uInt32)hypot( aRefPoint.X - rPt.X(), aRefPoint.Y - rPt.Y() );
+ if ( nDist < nDistance )
+ {
+ nRule = nIndex;
+ nDistance = nDist;
+ }
+ nIndex++;
+ }
+ }
+ if ( nDistance != 0xffffffff )
+ bRectangularConnection = false;
+ }
+ }
+ }
+ }
+ if ( bRectangularConnection )
+ {
+ ::com::sun::star::awt::Point aPoint( aXShape->getPosition() );
+ ::com::sun::star::awt::Size aSize( aXShape->getSize() );
+
+ Rectangle aRect( Point( aPoint.X, aPoint.Y ), Size( aSize.Width, aSize.Height ) );
+ Point aCenter( aRect.Center() );
+ Polygon aPoly( 4 );
+
+ aPoly[ 0 ] = Point( aCenter.X(), aRect.Top() );
+ aPoly[ 1 ] = Point( aRect.Left(), aCenter.Y() );
+ aPoly[ 2 ] = Point( aCenter.X(), aRect.Bottom() );
+ aPoly[ 3 ] = Point( aRect.Right(), aCenter.Y() );
+
+ sal_Int32 nAngle = ( EscherPropertyValueHelper::GetPropertyValue( aAny,
+ aPropertySet, String( RTL_CONSTASCII_USTRINGPARAM( "RotateAngle" ) ), sal_True ) )
+ ? *((sal_Int32*)aAny.getValue() )
+ : 0;
+ if ( nAngle )
+ aPoly.Rotate( aRect.TopLeft(), (sal_uInt16)( ( nAngle + 5 ) / 10 ) );
+ nRule = GetClosestPoint( aPoly, aRefPoint );
+
+ if ( aType == "drawing.Ellipse" )
+ nRule <<= 1; // In PPT hat eine Ellipse 8 M?glichkeiten sich zu connecten
+ }
+ }
+ return nRule;
+}
+
+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;
+}
+
+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 );
+}
+
+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 );
+}
+
+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() )
+ {
+ if ( rXShape == pPtr->aXShape )
+ return ( pPtr->n_EscherId );
+ }
+ return 0;
+}
+
+void EscherSolverContainer::WriteSolver( SvStream& rStrm )
+{
+ sal_uInt32 nCount = maConnectorList.Count();
+ if ( nCount )
+ {
+ sal_uInt32 nRecHdPos, nCurrentPos, nSize;
+ rStrm << (sal_uInt16)( ( nCount << 4 ) | 0xf ) // open an ESCHER_SolverContainer
+ << (sal_uInt16)ESCHER_SolverContainer //
+ << (sal_uInt32)0; //
+
+ nRecHdPos = rStrm.Tell() - 4;
+
+ EscherConnectorRule aConnectorRule;
+ aConnectorRule.nRuleId = 2;
+ for ( EscherConnectorListEntry* pPtr = (EscherConnectorListEntry*)maConnectorList.First();
+ pPtr; pPtr = (EscherConnectorListEntry*)maConnectorList.Next() )
+ {
+ aConnectorRule.ncptiA = aConnectorRule.ncptiB = 0xffffffff;
+ aConnectorRule.nShapeC = GetShapeId( pPtr->mXConnector );
+ aConnectorRule.nShapeA = GetShapeId( pPtr->mXConnectToA );
+ aConnectorRule.nShapeB = GetShapeId( pPtr->mXConnectToB );
+
+ if ( aConnectorRule.nShapeC )
+ {
+ if ( aConnectorRule.nShapeA )
+ aConnectorRule.ncptiA = pPtr->GetConnectorRule( sal_True );
+ if ( aConnectorRule.nShapeB )
+ aConnectorRule.ncptiB = pPtr->GetConnectorRule( sal_False );
+ }
+ rStrm << (sal_uInt32)( ( ESCHER_ConnectorRule << 16 ) | 1 ) // atom hd
+ << (sal_uInt32)24 //
+ << aConnectorRule.nRuleId
+ << aConnectorRule.nShapeA
+ << aConnectorRule.nShapeB
+ << aConnectorRule.nShapeC
+ << aConnectorRule.ncptiA
+ << aConnectorRule.ncptiB;
+
+ aConnectorRule.nRuleId += 2;
+ }
+
+ nCurrentPos = rStrm.Tell(); // close the ESCHER_SolverContainer
+ nSize = ( nCurrentPos - nRecHdPos ) - 4;//
+ rStrm.Seek( nRecHdPos ); //
+ rStrm << nSize; //
+ rStrm.Seek( nCurrentPos ); //
+ }
+}
+
+// ---------------------------------------------------------------------------------------------
+
+EscherExGlobal::EscherExGlobal( sal_uInt32 nGraphicProvFlags ) :
+ EscherGraphicProvider( nGraphicProvFlags ),
+ mpPicStrm( 0 ),
+ mbHasDggCont( false ),
+ mbPicStrmQueried( false )
+{
+}
+
+EscherExGlobal::~EscherExGlobal()
+{
+}
+
+sal_uInt32 EscherExGlobal::GenerateDrawingId()
+{
+ // new drawing starts a new cluster in the cluster table (cluster identifiers are one-based)
+ sal_uInt32 nClusterId = static_cast< sal_uInt32 >( maClusterTable.size() + 1 );
+ // drawing identifiers are one-based
+ sal_uInt32 nDrawingId = static_cast< sal_uInt32 >( maDrawingInfos.size() + 1 );
+ // prepare new entries in the tables
+ maClusterTable.push_back( ClusterEntry( nDrawingId ) );
+ maDrawingInfos.push_back( DrawingInfo( nClusterId ) );
+ // return the new drawing identifier
+ return nDrawingId;
+}
+
+sal_uInt32 EscherExGlobal::GenerateShapeId( sal_uInt32 nDrawingId, bool bIsInSpgr )
+{
+ // drawing identifier is one-based
+ size_t nDrawingIdx = nDrawingId - 1;
+ OSL_ENSURE( nDrawingIdx < maDrawingInfos.size(), "EscherExGlobal::GenerateShapeId - invalid drawing ID" );
+ if( nDrawingIdx >= maDrawingInfos.size() )
+ return 0;
+ DrawingInfo& rDrawingInfo = maDrawingInfos[ nDrawingIdx ];
+
+ // cluster identifier in drawing info struct is one-based
+ ClusterEntry* pClusterEntry = &maClusterTable[ rDrawingInfo.mnClusterId - 1 ];
+
+ // check cluster overflow, create new cluster entry
+ if( pClusterEntry->mnNextShapeId == DFF_DGG_CLUSTER_SIZE )
+ {
+ // start a new cluster in the cluster table
+ maClusterTable.push_back( ClusterEntry( nDrawingId ) );
+ pClusterEntry = &maClusterTable.back();
+ // new size of maClusterTable is equal to one-based identifier of the new cluster
+ rDrawingInfo.mnClusterId = static_cast< sal_uInt32 >( maClusterTable.size() );
+ }
+
+ // build shape identifier from cluster identifier and next free cluster shape identifier
+ rDrawingInfo.mnLastShapeId = static_cast< sal_uInt32 >( rDrawingInfo.mnClusterId * DFF_DGG_CLUSTER_SIZE + pClusterEntry->mnNextShapeId );
+ // update free shape identifier in cluster entry
+ ++pClusterEntry->mnNextShapeId;
+ /* Old code has counted the shapes only, if we are in a SPGRCONTAINER. Is
+ this really intended? Maybe it's always true... */
+ if( bIsInSpgr )
+ ++rDrawingInfo.mnShapeCount;
+
+ // return the new shape identifier
+ return rDrawingInfo.mnLastShapeId;
+}
+
+sal_uInt32 EscherExGlobal::GetDrawingShapeCount( sal_uInt32 nDrawingId ) const
+{
+ size_t nDrawingIdx = nDrawingId - 1;
+ OSL_ENSURE( nDrawingIdx < maDrawingInfos.size(), "EscherExGlobal::GetDrawingShapeCount - invalid drawing ID" );
+ return (nDrawingIdx < maDrawingInfos.size()) ? maDrawingInfos[ nDrawingIdx ].mnShapeCount : 0;
+}
+
+sal_uInt32 EscherExGlobal::GetLastShapeId( sal_uInt32 nDrawingId ) const
+{
+ size_t nDrawingIdx = nDrawingId - 1;
+ OSL_ENSURE( nDrawingIdx < maDrawingInfos.size(), "EscherExGlobal::GetLastShapeId - invalid drawing ID" );
+ return (nDrawingIdx < maDrawingInfos.size()) ? maDrawingInfos[ nDrawingIdx ].mnLastShapeId : 0;
+}
+
+sal_uInt32 EscherExGlobal::GetDggAtomSize() const
+{
+ // 8 bytes header, 16 bytes fixed DGG data, 8 bytes for each cluster
+ return static_cast< sal_uInt32 >( 24 + 8 * maClusterTable.size() );
+}
+
+void EscherExGlobal::WriteDggAtom( SvStream& rStrm ) const
+{
+ sal_uInt32 nDggSize = GetDggAtomSize();
+
+ // write the DGG record header (do not include the 8 bytes of the header in the data size)
+ rStrm << static_cast< sal_uInt32 >( ESCHER_Dgg << 16 ) << static_cast< sal_uInt32 >( nDggSize - 8 );
+
+ // claculate and write the fixed DGG data
+ sal_uInt32 nShapeCount = 0;
+ sal_uInt32 nLastShapeId = 0;
+ for( DrawingInfoVector::const_iterator aIt = maDrawingInfos.begin(), aEnd = maDrawingInfos.end(); aIt != aEnd; ++aIt )
+ {
+ nShapeCount += aIt->mnShapeCount;
+ nLastShapeId = ::std::max( nLastShapeId, aIt->mnLastShapeId );
+ }
+ // the non-existing cluster with index #0 is counted too
+ sal_uInt32 nClusterCount = static_cast< sal_uInt32 >( maClusterTable.size() + 1 );
+ sal_uInt32 nDrawingCount = static_cast< sal_uInt32 >( maDrawingInfos.size() );
+ rStrm << nLastShapeId << nClusterCount << nShapeCount << nDrawingCount;
+
+ // write the cluster table
+ for( ClusterTable::const_iterator aIt = maClusterTable.begin(), aEnd = maClusterTable.end(); aIt != aEnd; ++aIt )
+ rStrm << aIt->mnDrawingId << aIt->mnNextShapeId;
+}
+
+SvStream* EscherExGlobal::QueryPictureStream()
+{
+ if( !mbPicStrmQueried )
+ {
+ mpPicStrm = ImplQueryPictureStream();
+ mbPicStrmQueried = true;
+ }
+ return mpPicStrm;
+}
+
+SvStream* EscherExGlobal::ImplQueryPictureStream()
+{
+ return 0;
+}
+
+// ---------------------------------------------------------------------------------------------
+// ---------------------------------------------------------------------------------------------
+// ---------------------------------------------------------------------------------------------
+
+EscherEx::EscherEx( const EscherExGlobalRef& rxGlobal, SvStream& rOutStrm ) :
+ mxGlobal ( rxGlobal ),
+ mpOutStrm ( &rOutStrm ),
+
+ mnGroupLevel ( 0 ),
+ mnHellLayerId ( USHRT_MAX ),
+
+ mbEscherSpgr ( FALSE ),
+ mbEscherDg ( FALSE )
+{
+ mnStrmStartOfs = mpOutStrm->Tell();
+ mpImplEscherExSdr.reset( new ImplEscherExSdr( *this ) );
+}
+
+EscherEx::~EscherEx()
+{
+}
+
+// ---------------------------------------------------------------------------------------------
+
+void EscherEx::Flush( SvStream* pPicStreamMergeBSE /* = NULL */ )
+{
+ if ( mxGlobal->HasDggContainer() )
+ {
+ // store the current stream position at ESCHER_Persist_CurrentPosition key
+ PtReplaceOrInsert( ESCHER_Persist_CurrentPosition, mpOutStrm->Tell() );
+ if ( DoSeek( ESCHER_Persist_Dgg ) )
+ {
+ /* The DGG record is still not written. ESCHER_Persist_Dgg seeks
+ to the place where the complete record has to be inserted. */
+ InsertAtCurrentPos( mxGlobal->GetDggAtomSize(), false );
+ mxGlobal->WriteDggAtom( *mpOutStrm );
+
+ if ( mxGlobal->HasGraphics() )
+ {
+ /* Calculate the total size of the BSTORECONTAINER including
+ all BSE records containing the picture data contained in
+ the passed in pPicStreamMergeBSE. */
+ sal_uInt32 nBSCSize = mxGlobal->GetBlibStoreContainerSize( pPicStreamMergeBSE );
+ if ( nBSCSize > 0 )
+ {
+ InsertAtCurrentPos( nBSCSize, false );
+ mxGlobal->WriteBlibStoreContainer( *mpOutStrm, pPicStreamMergeBSE );
+ }
+ }
+
+ /* Forget the stream position stored for the DGG which is invalid
+ after the call to InsertAtCurrentPos() anyway. */
+ PtDelete( ESCHER_Persist_Dgg );
+ }
+ // seek to initial position (may be different due to inserted DGG and BLIPs)
+ mpOutStrm->Seek( PtGetOffsetByID( ESCHER_Persist_CurrentPosition ) );
+ }
+}
+
+// ---------------------------------------------------------------------------------------------
+
+void EscherEx::InsertAtCurrentPos( UINT32 nBytes, bool bExpandEndOfAtom )
+{
+ UINT32 nSize, nType, nSource, nBufSize, nToCopy, nCurPos = mpOutStrm->Tell();
+ BYTE* pBuf;
+
+ // Persist table anpassen
+ for ( void* pPtr = maPersistTable.First(); pPtr; pPtr = maPersistTable.Next() )
+ {
+ UINT32 nOfs = ((EscherPersistEntry*)pPtr)->mnOffset;
+ if ( nOfs >= nCurPos )
+ ((EscherPersistEntry*)pPtr)->mnOffset += nBytes;
+ }
+
+ // container und atom sizes anpassen
+ mpOutStrm->Seek( mnStrmStartOfs );
+ while ( mpOutStrm->Tell() < nCurPos )
+ {
+ *mpOutStrm >> nType >> nSize;
+ sal_uInt32 nEndOfRecord = mpOutStrm->Tell() + nSize;
+ bool bContainer = (nType & 0x0F) == 0x0F;
+ /* Expand the record, if the insertion position is inside, or if the
+ position is at the end of a container (expands always), or at the
+ end of an atom and bExpandEndOfAtom is set. */
+ if ( (nCurPos < nEndOfRecord) || ((nCurPos == nEndOfRecord) && (bContainer || bExpandEndOfAtom)) )
+ {
+ mpOutStrm->SeekRel( -4 );
+ *mpOutStrm << (UINT32)( nSize + nBytes );
+ if ( !bContainer )
+ mpOutStrm->SeekRel( nSize );
+ }
+ else
+ mpOutStrm->SeekRel( nSize );
+ }
+ std::vector< sal_uInt32 >::iterator aIter( mOffsets.begin() );
+ std::vector< sal_uInt32 >::iterator aEnd( mOffsets.end() );
+ while( aIter != aEnd )
+ {
+ if ( *aIter > nCurPos )
+ *aIter += nBytes;
+ aIter++;
+ }
+ mpOutStrm->Seek( STREAM_SEEK_TO_END );
+ nSource = mpOutStrm->Tell();
+ nToCopy = nSource - nCurPos; // Stream um nBytes vergroessern
+ pBuf = new BYTE[ 0x40000 ]; // 256KB Buffer
+ while ( nToCopy )
+ {
+ nBufSize = ( nToCopy >= 0x40000 ) ? 0x40000 : nToCopy;
+ nToCopy -= nBufSize;
+ nSource -= nBufSize;
+ mpOutStrm->Seek( nSource );
+ mpOutStrm->Read( pBuf, nBufSize );
+ mpOutStrm->Seek( nSource + nBytes );
+ mpOutStrm->Write( pBuf, nBufSize );
+ }
+ delete[] pBuf;
+ mpOutStrm->Seek( nCurPos );
+}
+
+// ---------------------------------------------------------------------------------------------
+
+BOOL EscherEx::SeekBehindRecHeader( UINT16 nRecType )
+{
+ UINT32 nOldPos, nStreamEnd, nType, nSize;
+
+ nOldPos = mpOutStrm->Tell();
+ nStreamEnd = mpOutStrm->Seek( STREAM_SEEK_TO_END );
+ mpOutStrm->Seek( nOldPos );
+ while ( mpOutStrm->Tell() < nStreamEnd )
+ {
+ *mpOutStrm >> nType >> nSize;
+ if ( ( nType >> 16 ) == nRecType )
+ return TRUE;
+ if ( ( nType & 0xf ) != 0xf )
+ mpOutStrm->SeekRel( nSize );
+ }
+ mpOutStrm->Seek( nOldPos );
+ return FALSE;
+}
+
+// ---------------------------------------------------------------------------------------------
+
+void EscherEx::InsertPersistOffset( UINT32 nKey, UINT32 nOffset )
+{
+ PtInsert( ESCHER_Persist_PrivateEntry | nKey, nOffset );
+}
+
+void EscherEx::ReplacePersistOffset( UINT32 nKey, UINT32 nOffset )
+{
+ PtReplace( ESCHER_Persist_PrivateEntry | nKey, nOffset );
+}
+
+UINT32 EscherEx::GetPersistOffset( UINT32 nKey )
+{
+ return PtGetOffsetByID( ESCHER_Persist_PrivateEntry | nKey );
+}
+
+// ---------------------------------------------------------------------------------------------
+
+BOOL EscherEx::DoSeek( UINT32 nKey )
+{
+ UINT32 nPos = PtGetOffsetByID( nKey );
+ if ( nPos )
+ mpOutStrm->Seek( nPos );
+ else
+ {
+ if (! PtIsID( nKey ) )
+ return FALSE;
+ mpOutStrm->Seek( 0 );
+ }
+ return TRUE;
+}
+
+// ---------------------------------------------------------------------------------------------
+
+BOOL EscherEx::SeekToPersistOffset( UINT32 nKey )
+{
+ return DoSeek( ESCHER_Persist_PrivateEntry | nKey );
+}
+
+// ---------------------------------------------------------------------------------------------
+
+BOOL EscherEx::InsertAtPersistOffset( UINT32 nKey, UINT32 nValue )
+{
+ UINT32 nOldPos = mpOutStrm->Tell();
+ BOOL bRetValue = SeekToPersistOffset( nKey );
+ if ( bRetValue )
+ {
+ *mpOutStrm << nValue;
+ mpOutStrm->Seek( nOldPos );
+ }
+ return bRetValue;
+}
+
+// ---------------------------------------------------------------------------------------------
+
+void EscherEx::OpenContainer( UINT16 nEscherContainer, int nRecInstance )
+{
+ *mpOutStrm << (UINT16)( ( nRecInstance << 4 ) | 0xf ) << nEscherContainer << (UINT32)0;
+ mOffsets.push_back( mpOutStrm->Tell() - 4 );
+ mRecTypes.push_back( nEscherContainer );
+ switch( nEscherContainer )
+ {
+ case ESCHER_DggContainer :
+ {
+ mxGlobal->SetDggContainer();
+ mnCurrentDg = 0;
+ /* Remember the current position as start position of the DGG
+ record and BSTORECONTAINER, but do not write them actually.
+ This will be done later in Flush() when the number of drawings,
+ the size and contents of the FIDCL cluster table, and the size
+ of the BLIP container are known. */
+ PtReplaceOrInsert( ESCHER_Persist_Dgg, mpOutStrm->Tell() );
+ }
+ break;
+
+ case ESCHER_DgContainer :
+ {
+ if ( mxGlobal->HasDggContainer() )
+ {
+ if ( !mbEscherDg )
+ {
+ mbEscherDg = TRUE;
+ mnCurrentDg = mxGlobal->GenerateDrawingId();
+ AddAtom( 8, ESCHER_Dg, 0, mnCurrentDg );
+ PtReplaceOrInsert( ESCHER_Persist_Dg | mnCurrentDg, mpOutStrm->Tell() );
+ *mpOutStrm << (UINT32)0 // The number of shapes in this drawing
+ << (UINT32)0; // The last MSOSPID given to an SP in this DG
+ }
+ }
+ }
+ break;
+
+ case ESCHER_SpgrContainer :
+ {
+ if ( mbEscherDg )
+ {
+ mbEscherSpgr = TRUE;
+ }
+ }
+ break;
+
+ case ESCHER_SpContainer :
+ {
+ }
+ break;
+
+ default:
+ break;
+ }
+}
+
+// ---------------------------------------------------------------------------------------------
+
+void EscherEx::CloseContainer()
+{
+ sal_uInt32 nSize, nPos = mpOutStrm->Tell();
+ nSize = ( nPos - mOffsets.back() ) - 4;
+ mpOutStrm->Seek( mOffsets.back() );
+ *mpOutStrm << nSize;
+
+ switch( mRecTypes.back() )
+ {
+ case ESCHER_DgContainer :
+ {
+ if ( mbEscherDg )
+ {
+ mbEscherDg = FALSE;
+ if ( DoSeek( ESCHER_Persist_Dg | mnCurrentDg ) )
+ *mpOutStrm << mxGlobal->GetDrawingShapeCount( mnCurrentDg ) << mxGlobal->GetLastShapeId( mnCurrentDg );
+ }
+ }
+ break;
+
+ case ESCHER_SpgrContainer :
+ {
+ if ( mbEscherSpgr )
+ {
+ mbEscherSpgr = FALSE;
+
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+ mOffsets.pop_back();
+ mRecTypes.pop_back();
+ mpOutStrm->Seek( nPos );
+}
+
+// ---------------------------------------------------------------------------------------------
+
+void EscherEx::BeginAtom()
+{
+ mnCountOfs = mpOutStrm->Tell();
+ *mpOutStrm << (UINT32)0 << (UINT32)0; // record header wird spaeter geschrieben
+}
+
+// ---------------------------------------------------------------------------------------------
+
+void EscherEx::EndAtom( UINT16 nRecType, int nRecVersion, int nRecInstance )
+{
+ UINT32 nOldPos = mpOutStrm->Tell();
+ mpOutStrm->Seek( mnCountOfs );
+ sal_uInt32 nSize = nOldPos - mnCountOfs;
+ *mpOutStrm << (UINT16)( ( nRecInstance << 4 ) | ( nRecVersion & 0xf ) ) << nRecType << (UINT32)( nSize - 8 );
+ mpOutStrm->Seek( nOldPos );
+}
+
+// ---------------------------------------------------------------------------------------------
+
+void EscherEx::AddAtom( UINT32 nAtomSize, UINT16 nRecType, int nRecVersion, int nRecInstance )
+{
+ *mpOutStrm << (UINT16)( ( nRecInstance << 4 ) | ( nRecVersion & 0xf ) ) << nRecType << nAtomSize;
+}
+
+// ---------------------------------------------------------------------------------------------
+
+void EscherEx::AddChildAnchor( const Rectangle& rRect )
+{
+ AddAtom( 16, ESCHER_ChildAnchor );
+ *mpOutStrm << (sal_Int32)rRect.Left()
+ << (sal_Int32)rRect.Top()
+ << (sal_Int32)rRect.Right()
+ << (sal_Int32)rRect.Bottom();
+}
+
+// ---------------------------------------------------------------------------------------------
+
+void EscherEx::AddClientAnchor( const Rectangle& rRect )
+{
+ AddAtom( 8, ESCHER_ClientAnchor );
+ *mpOutStrm << (sal_Int16)rRect.Top()
+ << (sal_Int16)rRect.Left()
+ << (sal_Int16)( rRect.GetWidth() + rRect.Left() )
+ << (sal_Int16)( rRect.GetHeight() + rRect.Top() );
+}
+
+// ---------------------------------------------------------------------------------------------
+
+EscherExHostAppData* EscherEx::EnterAdditionalTextGroup()
+{
+ return NULL;
+}
+
+// ---------------------------------------------------------------------------------------------
+
+UINT32 EscherEx::EnterGroup( const String& rShapeName, const Rectangle* pBoundRect )
+{
+ Rectangle aRect;
+ if( pBoundRect )
+ aRect = *pBoundRect;
+
+ OpenContainer( ESCHER_SpgrContainer );
+ OpenContainer( ESCHER_SpContainer );
+ AddAtom( 16, ESCHER_Spgr, 1 );
+ PtReplaceOrInsert( ESCHER_Persist_Grouping_Snap | mnGroupLevel,
+ mpOutStrm->Tell() );
+ *mpOutStrm << (INT32)aRect.Left() // Bounding box fuer die Gruppierten shapes an die sie attached werden
+ << (INT32)aRect.Top()
+ << (INT32)aRect.Right()
+ << (INT32)aRect.Bottom();
+
+ sal_uInt32 nShapeId = GenerateShapeId();
+ if ( !mnGroupLevel )
+ AddShape( ESCHER_ShpInst_Min, 5, nShapeId ); // Flags: Group | Patriarch
+ else
+ {
+ AddShape( ESCHER_ShpInst_Min, 0x201, nShapeId ); // Flags: Group | HaveAnchor
+ EscherPropertyContainer aPropOpt;
+ aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x00040004 );
+ aPropOpt.AddOpt( ESCHER_Prop_dxWrapDistLeft, 0 );
+ aPropOpt.AddOpt( ESCHER_Prop_dxWrapDistRight, 0 );
+
+ // #i51348# shape name
+ if( rShapeName.Len() > 0 )
+ aPropOpt.AddOpt( ESCHER_Prop_wzName, rShapeName );
+
+ Commit( aPropOpt, aRect );
+ if ( mnGroupLevel > 1 )
+ AddChildAnchor( aRect );
+
+ EscherExHostAppData* pAppData = mpImplEscherExSdr->ImplGetHostData();
+ if( pAppData )
+ {
+ if ( mnGroupLevel <= 1 )
+ pAppData->WriteClientAnchor( *this, aRect );
+ pAppData->WriteClientData( *this );
+ }
+ }
+ CloseContainer(); // ESCHER_SpContainer
+ mnGroupLevel++;
+ return nShapeId;
+}
+
+UINT32 EscherEx::EnterGroup( const Rectangle* pBoundRect )
+{
+ return EnterGroup( String::EmptyString(), pBoundRect );
+}
+
+// ---------------------------------------------------------------------------------------------
+
+BOOL EscherEx::SetGroupSnapRect( UINT32 nGroupLevel, const Rectangle& rRect )
+{
+ BOOL bRetValue = FALSE;
+ if ( nGroupLevel )
+ {
+ UINT32 nCurrentPos = mpOutStrm->Tell();
+ if ( DoSeek( ESCHER_Persist_Grouping_Snap | ( nGroupLevel - 1 ) ) )
+ {
+ *mpOutStrm << (INT32)rRect.Left() // Bounding box fuer die Gruppierten shapes an die sie attached werden
+ << (INT32)rRect.Top()
+ << (INT32)rRect.Right()
+ << (INT32)rRect.Bottom();
+ mpOutStrm->Seek( nCurrentPos );
+ }
+ }
+ return bRetValue;
+}
+
+// ---------------------------------------------------------------------------------------------
+
+BOOL EscherEx::SetGroupLogicRect( UINT32 nGroupLevel, const Rectangle& rRect )
+{
+ BOOL bRetValue = FALSE;
+ if ( nGroupLevel )
+ {
+ UINT32 nCurrentPos = mpOutStrm->Tell();
+ if ( DoSeek( ESCHER_Persist_Grouping_Logic | ( nGroupLevel - 1 ) ) )
+ {
+ *mpOutStrm << (INT16)rRect.Top() << (INT16)rRect.Left() << (INT16)rRect.Right() << (INT16)rRect.Bottom();
+ mpOutStrm->Seek( nCurrentPos );
+ }
+ }
+ return bRetValue;
+}
+
+// ---------------------------------------------------------------------------------------------
+
+void EscherEx::LeaveGroup()
+{
+ --mnGroupLevel;
+ PtDelete( ESCHER_Persist_Grouping_Snap | mnGroupLevel );
+ PtDelete( ESCHER_Persist_Grouping_Logic | mnGroupLevel );
+ CloseContainer();
+}
+
+// ---------------------------------------------------------------------------------------------
+
+void EscherEx::AddShape( UINT32 nShpInstance, UINT32 nFlags, UINT32 nShapeID )
+{
+ AddAtom( 8, ESCHER_Sp, 2, nShpInstance );
+
+ if ( !nShapeID )
+ nShapeID = GenerateShapeId();
+
+ if ( nFlags ^ 1 ) // is this a group shape ?
+ { // if not
+ if ( mnGroupLevel > 1 )
+ nFlags |= 2; // this not a topmost shape
+ }
+ *mpOutStrm << nShapeID << nFlags;
+}
+
+// ---------------------------------------------------------------------------------------------
+
+void EscherEx::Commit( EscherPropertyContainer& rProps, const Rectangle& )
+{
+ rProps.Commit( GetStream() );
+}
+
+// ---------------------------------------------------------------------------------------------
+
+UINT32 EscherEx::GetColor( const UINT32 nSOColor, BOOL bSwap )
+{
+ if ( bSwap )
+ {
+ UINT32 nColor = nSOColor & 0xff00; // GRUEN
+ nColor |= (BYTE)( nSOColor ) << 16; // ROT
+ nColor |= (BYTE)( nSOColor >> 16 ); // BLAU
+ return nColor;
+ }
+ else
+ return nSOColor & 0xffffff;
+}
+
+// ---------------------------------------------------------------------------------------------
+
+UINT32 EscherEx::GetColor( const Color& rSOColor, BOOL bSwap )
+{
+ UINT32 nColor = ( rSOColor.GetRed() << 16 );
+ nColor |= ( rSOColor.GetGreen() << 8 );
+ nColor |= rSOColor.GetBlue();
+
+ if ( !bSwap )
+ nColor = GetColor( nColor, TRUE );
+
+ return nColor;
+}
+
+// ---------------------------------------------------------------------------------------------
+
diff --git a/filter/source/msfilter/eschesdo.cxx b/filter/source/msfilter/eschesdo.cxx
new file mode 100644
index 000000000000..950a32cd0645
--- /dev/null
+++ b/filter/source/msfilter/eschesdo.cxx
@@ -0,0 +1,1255 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+#include "eschesdo.hxx"
+#include <svx/svdobj.hxx>
+#include <svx/unoapi.hxx>
+#include <svx/svdoashp.hxx>
+#include <svx/unoshape.hxx>
+#include <vcl/outdev.hxx>
+#include <tools/poly.hxx>
+#include <vcl/bitmapex.hxx>
+#include <vcl/graph.hxx>
+#include <tools/debug.hxx>
+#include <svx/fmdpage.hxx>
+#include <toolkit/unohlp.hxx>
+#include <com/sun/star/style/VerticalAlignment.hpp>
+#include <com/sun/star/awt/Gradient.hpp>
+#include <com/sun/star/drawing/PointSequence.hpp>
+#include <com/sun/star/drawing/PointSequenceSequence.hpp>
+#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
+#include <com/sun/star/drawing/FlagSequence.hpp>
+#include <com/sun/star/drawing/TextAdjust.hpp>
+#include <com/sun/star/drawing/LineDash.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/drawing/CircleKind.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
+#include <com/sun/star/task/XStatusIndicator.hpp>
+#include <comphelper/extract.hxx>
+#include <svtools/fltcall.hxx>
+#include <vcl/cvtgrf.hxx>
+
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::task;
+using namespace ::com::sun::star::style;
+
+#define EES_MAP_FRACTION 1440 // 1440 dpi
+
+// ===================================================================
+
+ImplEESdrWriter::ImplEESdrWriter( EscherEx& rEx )
+ :
+ mpEscherEx ( &rEx ),
+ maMapModeSrc ( MAP_100TH_MM ),
+ // PowerPoint: 576 dpi, WinWord: 1440 dpi, Excel: 1440 dpi
+ maMapModeDest( MAP_INCH, Point(), Fraction( 1, EES_MAP_FRACTION ), Fraction( 1, EES_MAP_FRACTION ) ),
+// mXStatusIndicator ( rXStatInd ),
+ mpPicStrm ( NULL ),
+ mpHostAppData ( NULL ),
+ mnPagesWritten ( 0 ),
+ mnShapeMasterTitle ( 0 ),
+ mnShapeMasterBody ( 0 ),
+ mbStatusIndicator ( FALSE ),
+ mbStatus ( FALSE )
+{
+}
+
+
+// -------------------------------------------------------------------
+
+Point ImplEESdrWriter::ImplMapPoint( const Point& rPoint )
+{
+ return OutputDevice::LogicToLogic( rPoint, maMapModeSrc, maMapModeDest );
+}
+
+
+// -------------------------------------------------------------------
+
+Size ImplEESdrWriter::ImplMapSize( const Size& rSize )
+{
+ Size aRetSize( OutputDevice::LogicToLogic( rSize, maMapModeSrc, maMapModeDest ) );
+
+ if ( !aRetSize.Width() )
+ aRetSize.Width()++;
+ if ( !aRetSize.Height() )
+ aRetSize.Height()++;
+ return aRetSize;
+}
+
+// -------------------------------------------------------------------
+
+void ImplEESdrWriter::ImplFlipBoundingBox( ImplEESdrObject& rObj, EscherPropertyContainer& rPropOpt )
+{
+ INT32 nAngle = rObj.GetAngle();
+ Rectangle aRect( rObj.GetRect() );
+
+ if ( nAngle < 0 )
+ nAngle = ( 36000 + nAngle ) % 36000;
+ else
+ nAngle = ( 36000 - ( nAngle % 36000 ) );
+
+ double fVal = (double)nAngle * F_PI18000;
+ double fCos = cos( fVal );
+ double fSin = sin( fVal );
+
+ double nWidthHalf = (double) aRect.GetWidth() / 2;
+ double nHeightHalf = (double) aRect.GetHeight() / 2;
+
+ double nXDiff = fCos * nWidthHalf + fSin * (-nHeightHalf);
+ double nYDiff = - ( fSin * nWidthHalf - fCos * ( -nHeightHalf ) );
+
+ aRect.Move( (sal_Int32)( -( nWidthHalf - nXDiff ) ), (sal_Int32)( - ( nHeightHalf + nYDiff ) ) );
+
+ nAngle *= 655;
+ nAngle += 0x8000;
+ nAngle &=~0xffff; // nAngle auf volle Gradzahl runden
+ rPropOpt.AddOpt( ESCHER_Prop_Rotation, nAngle );
+
+ rObj.SetAngle( nAngle );
+ rObj.SetRect( aRect );
+}
+
+// -----------------------------------------------------------------------
+
+#define ADD_SHAPE( nType, nFlags ) \
+{ \
+ nShapeType = nType; \
+ nShapeID = mpEscherEx->GenerateShapeId(); \
+ rObj.SetShapeId( nShapeID ); \
+ mpEscherEx->AddShape( (UINT32)nType, (UINT32)nFlags, nShapeID ); \
+ rSolverContainer.AddShape( rObj.GetShapeRef(), nShapeID ); \
+}
+
+#define SHAPE_TEXT( bFill ) \
+{ \
+ mpEscherEx->OpenContainer( ESCHER_SpContainer ); \
+ ADD_SHAPE( ESCHER_ShpInst_TextBox, 0xa00 ); \
+ if ( bFill ) \
+ aPropOpt.CreateFillProperties( rObj.mXPropSet, sal_True ); \
+ if( rObj.ImplGetText() ) \
+ aPropOpt.CreateTextProperties( rObj.mXPropSet, \
+ mpEscherEx->QueryTextID( rObj.GetShapeRef(), \
+ rObj.GetShapeId() ) ); \
+}
+
+//Map from twips to export units, generally twips as well, only excel and word
+//export is happening here, so native units are export units, leave as
+//placeholder if required in future
+void ImplEESdrWriter::MapRect(ImplEESdrObject& /* rObj */ )
+{
+}
+
+UINT32 ImplEESdrWriter::ImplWriteShape( ImplEESdrObject& rObj,
+ EscherSolverContainer& rSolverContainer,
+ ImplEESdrPageType ePageType )
+{
+ UINT32 nShapeID = 0;
+ UINT16 nShapeType = 0;
+ BOOL bDontWriteText = FALSE; // if a metafile is written as shape replacement, then the text is already part of the metafile
+ BOOL bAdditionalText = FALSE;
+ UINT32 nGrpShapeID = 0;
+
+ do {
+ mpHostAppData = mpEscherEx->StartShape( rObj.GetShapeRef(), (mpEscherEx->GetGroupLevel() > 1) ? &rObj.GetRect() : 0 );
+ if ( mpHostAppData && mpHostAppData->DontWriteShape() )
+ break;
+
+ // #i51348# get shape name
+ String aShapeName;
+ if( const SdrObject* pSdrObj = rObj.GetSdrObject() )
+ if( pSdrObj->GetName().Len() > 0 )
+ aShapeName = pSdrObj->GetName();
+
+ Point aTextRefPoint;
+
+ if( rObj.GetType().EqualsAscii( "drawing.Group" ))
+ {
+ Reference< XIndexAccess > xXIndexAccess( rObj.GetShapeRef(), UNO_QUERY );
+
+ if( xXIndexAccess.is() && 0 != xXIndexAccess->getCount() )
+ {
+ nShapeID = mpEscherEx->EnterGroup( aShapeName, &rObj.GetRect() );
+ nShapeType = ESCHER_ShpInst_Min;
+
+ for( UINT32 n = 0, nCnt = xXIndexAccess->getCount();
+ n < nCnt; ++n )
+ {
+ ImplEESdrObject aObj( *this, *(Reference< XShape >*)
+ xXIndexAccess->getByIndex( n ).getValue() );
+ if( aObj.IsValid() )
+ ImplWriteShape( aObj, rSolverContainer, ePageType );
+ }
+ mpEscherEx->LeaveGroup();
+ }
+ break;
+ }
+ rObj.SetAngle( rObj.ImplGetInt32PropertyValue( ::rtl::OUString::createFromAscii("RotateAngle") ));
+
+ if( ( rObj.ImplGetPropertyValue( ::rtl::OUString::createFromAscii("IsFontwork") ) &&
+ ::cppu::any2bool( rObj.GetUsrAny() ) ) ||
+ rObj.GetType().EqualsAscii( "drawing.Measure" ) || rObj.GetType().EqualsAscii( "drawing.Caption" ) )
+ {
+/*
+ if( rObj.ImplGetPropertyValue( ::rtl::OUString::createFromAscii("BoundRect") ) )
+ {
+ ::com::sun::star::awt::Rectangle aRect( *(::com::sun::star::awt::Rectangle*)rObj.GetUsrAny().getValue() );
+ rObj.SetRect( ImplMapPoint( Point( aRect.X, aRect.Y ) ),
+ ImplMapSize( Size( aRect.Width, aRect.Height ) ) );
+ }
+*/
+ rObj.SetType( String( RTL_CONSTASCII_STRINGPARAM(
+ "drawing.dontknow" ),
+ RTL_TEXTENCODING_MS_1252 ));
+ }
+
+ const ::com::sun::star::awt::Size aSize100thmm( rObj.GetShapeRef()->getSize() );
+ const ::com::sun::star::awt::Point aPoint100thmm( rObj.GetShapeRef()->getPosition() );
+ Rectangle aRect100thmm( Point( aPoint100thmm.X, aPoint100thmm.Y ), Size( aSize100thmm.Width, aSize100thmm.Height ) );
+ if ( !mpPicStrm )
+ mpPicStrm = mpEscherEx->QueryPictureStream();
+ EscherPropertyContainer aPropOpt( mpEscherEx->GetGraphicProvider(), mpPicStrm, aRect100thmm );
+
+ // #i51348# shape name
+ if( aShapeName.Len() > 0 )
+ aPropOpt.AddOpt( ESCHER_Prop_wzName, aShapeName );
+
+ if ( rObj.GetType().EqualsAscii( "drawing.Custom" ) )
+ {
+ mpEscherEx->OpenContainer( ESCHER_SpContainer );
+ sal_uInt32 nMirrorFlags;
+
+ rtl::OUString sCustomShapeType;
+ MSO_SPT eShapeType = aPropOpt.GetCustomShapeType( rObj.GetShapeRef(), nMirrorFlags, sCustomShapeType );
+ if ( sCustomShapeType.equalsAscii( "col-502ad400" ) || sCustomShapeType.equalsAscii( "col-60da8460" ) )
+ {
+ ADD_SHAPE( ESCHER_ShpInst_PictureFrame, 0xa00 );
+ if ( aPropOpt.CreateGraphicProperties( rObj.mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "MetaFile" ) ), sal_False ) )
+ {
+ aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 );
+ aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x100000 ); // no fill
+ aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x90000 ); // no linestyle
+ SdrObject* pObj = GetSdrObjectFromXShape( rObj.GetShapeRef() );
+ if ( pObj )
+ {
+ Rectangle aBound = pObj->GetCurrentBoundRect();
+ Point aPosition( ImplMapPoint( aBound.TopLeft() ) );
+ Size aSize( ImplMapSize( aBound.GetSize() ) );
+ rObj.SetRect( Rectangle( aPosition, aSize ) );
+ rObj.SetAngle( 0 );
+ bDontWriteText = sal_True;
+ }
+ }
+ }
+ else
+ {
+ ADD_SHAPE(
+ sal::static_int_cast< UINT16 >(eShapeType),
+ nMirrorFlags | 0xa00 );
+ aPropOpt.CreateCustomShapeProperties( eShapeType, rObj.GetShapeRef() );
+ aPropOpt.CreateFillProperties( rObj.mXPropSet, sal_True );
+ if ( rObj.ImplGetText() )
+ {
+ if ( !aPropOpt.IsFontWork() )
+ aPropOpt.CreateTextProperties( rObj.mXPropSet, mpEscherEx->QueryTextID(
+ rObj.GetShapeRef(), rObj.GetShapeId() ), sal_True, sal_False );
+ }
+ }
+ }
+ else if ( rObj.GetType().EqualsAscii( "drawing.Rectangle" ))
+ {
+ mpEscherEx->OpenContainer( ESCHER_SpContainer );
+ sal_Int32 nRadius = (sal_Int32)rObj.ImplGetInt32PropertyValue(
+ ::rtl::OUString::createFromAscii("CornerRadius"));
+ if( nRadius )
+ {
+ nRadius = ImplMapSize( Size( nRadius, 0 )).Width();
+ ADD_SHAPE( ESCHER_ShpInst_RoundRectangle, 0xa00 ); // Flags: Connector | HasSpt
+ INT32 nLenght = rObj.GetRect().GetWidth();
+ if ( nLenght > rObj.GetRect().GetHeight() )
+ nLenght = rObj.GetRect().GetHeight();
+ nLenght >>= 1;
+ if ( nRadius >= nLenght )
+ nRadius = 0x2a30; // 0x2a30 ist PPTs maximum radius
+ else
+ nRadius = ( 0x2a30 * nRadius ) / nLenght;
+ aPropOpt.AddOpt( ESCHER_Prop_adjustValue, nRadius );
+ }
+ else
+ {
+ ADD_SHAPE( ESCHER_ShpInst_Rectangle, 0xa00 ); // Flags: Connector | HasSpt
+ }
+ aPropOpt.CreateFillProperties( rObj.mXPropSet, sal_True );
+ if( rObj.ImplGetText() )
+ aPropOpt.CreateTextProperties( rObj.mXPropSet,
+ mpEscherEx->QueryTextID( rObj.GetShapeRef(),
+ rObj.GetShapeId() ), sal_False, sal_False );
+ }
+ else if ( rObj.GetType().EqualsAscii( "drawing.Ellipse" ))
+ {
+ CircleKind eCircleKind = CircleKind_FULL;
+ PolyStyle ePolyKind = PolyStyle();
+ if ( rObj.ImplGetPropertyValue( ::rtl::OUString::createFromAscii("CircleKind") ) )
+ {
+ eCircleKind = *( (CircleKind*)rObj.GetUsrAny().getValue() );
+ switch ( eCircleKind )
+ {
+ case CircleKind_SECTION :
+ {
+ ePolyKind = POLY_PIE;
+ }
+ break;
+ case CircleKind_ARC :
+ {
+ ePolyKind = POLY_ARC;
+ }
+ break;
+
+ case CircleKind_CUT :
+ {
+ ePolyKind = POLY_CHORD;
+ }
+ break;
+
+ default:
+ eCircleKind = CircleKind_FULL;
+ }
+ }
+ if ( eCircleKind == CircleKind_FULL )
+ {
+ mpEscherEx->OpenContainer( ESCHER_SpContainer );
+ ADD_SHAPE( ESCHER_ShpInst_Ellipse, 0xa00 ); // Flags: Connector | HasSpt
+ aPropOpt.CreateFillProperties( rObj.mXPropSet, sal_True );;
+ }
+ else
+ {
+ INT32 nStartAngle, nEndAngle;
+ if ( !rObj.ImplGetPropertyValue( ::rtl::OUString::createFromAscii("CircleStartAngle") ) )
+ break;
+ nStartAngle = *( (INT32*)rObj.GetUsrAny().getValue() );
+ if( !rObj.ImplGetPropertyValue( ::rtl::OUString::createFromAscii("CircleEndAngle") ) )
+ break;
+ nEndAngle = *( (INT32*)rObj.GetUsrAny().getValue() );
+
+ Point aStart, aEnd, aCenter;
+ aStart.X() = (INT32)( ( cos( (double)( nStartAngle *
+ F_PI18000 ) ) * 100.0 ) );
+ aStart.Y() = - (INT32)( ( sin( (double)( nStartAngle *
+ F_PI18000 ) ) * 100.0 ) );
+ aEnd.X() = (INT32)( ( cos( (double)( nEndAngle *
+ F_PI18000 ) ) * 100.0 ) );
+ aEnd.Y() = - (INT32)( ( sin( (double)( nEndAngle *
+ F_PI18000 ) ) * 100.0 ) );
+ const Rectangle& rRect = aRect100thmm;
+ aCenter.X() = rRect.Left() + ( rRect.GetWidth() / 2 );
+ aCenter.Y() = rRect.Top() + ( rRect.GetHeight() / 2 );
+ aStart.X() += aCenter.X();
+ aStart.Y() += aCenter.Y();
+ aEnd.X() += aCenter.X();
+ aEnd.Y() += aCenter.Y();
+ Polygon aPolygon( rRect, aStart, aEnd, ePolyKind );
+ if( rObj.GetAngle() )
+ {
+ aPolygon.Rotate( rRect.TopLeft(), (sal_uInt16)( rObj.GetAngle() / 10 ) );
+ rObj.SetAngle( 0 );
+ }
+ mpEscherEx->OpenContainer( ESCHER_SpContainer );
+ ADD_SHAPE( ESCHER_ShpInst_NotPrimitive, 0xa00 ); // Flags: Connector | HasSpt
+ ::com::sun::star::awt::Rectangle aNewRect;
+ switch ( ePolyKind )
+ {
+ case POLY_PIE :
+ case POLY_CHORD :
+ {
+ aPropOpt.CreatePolygonProperties( rObj.mXPropSet, ESCHER_CREATEPOLYGON_POLYPOLYGON, sal_False, aNewRect, &aPolygon );
+ aPropOpt.CreateFillProperties( rObj.mXPropSet, sal_True );
+ }
+ break;
+
+ case POLY_ARC :
+ {
+ aPropOpt.CreatePolygonProperties( rObj.mXPropSet, ESCHER_CREATEPOLYGON_POLYLINE, sal_False, aNewRect, &aPolygon );
+ aPropOpt.CreateLineProperties( rObj.mXPropSet, sal_False );
+ }
+ break;
+ }
+ rObj.SetRect( Rectangle( ImplMapPoint( Point( aNewRect.X, aNewRect.Y ) ),
+ ImplMapSize( Size( aNewRect.Width, aNewRect.Height ) ) ) );
+ }
+ if ( rObj.ImplGetText() )
+ aPropOpt.CreateTextProperties( rObj.mXPropSet,
+ mpEscherEx->QueryTextID( rObj.GetShapeRef(),
+ rObj.GetShapeId() ), sal_False, sal_False );
+
+ }
+ else if ( rObj.GetType().EqualsAscii( "drawing.Control" ))
+ {
+ break;
+ }
+ else if ( rObj.GetType().EqualsAscii( "drawing.Connector" ))
+ {
+ sal_uInt16 nSpType, nSpFlags;
+ ::com::sun::star::awt::Rectangle aNewRect;
+ if ( aPropOpt.CreateConnectorProperties( rObj.GetShapeRef(),
+ rSolverContainer, aNewRect, nSpType, nSpFlags ) == sal_False )
+ break;
+ rObj.SetRect( Rectangle( ImplMapPoint( Point( aNewRect.X, aNewRect.Y ) ),
+ ImplMapSize( Size( aNewRect.Width, aNewRect.Height ) ) ) );
+
+ mpEscherEx->OpenContainer( ESCHER_SpContainer );
+ ADD_SHAPE( nSpType, nSpFlags );
+ }
+ else if ( rObj.GetType().EqualsAscii( "drawing.Measure" ))
+ {
+/*
+ if ( ImplGetPropertyValue( L"MeasureKind" ) )
+ {
+ mpEscherEx->EnterGroup( &maRect );
+ mpEscherEx->OpenContainer( ESCHER_SpContainer );
+ ImplWriteAny( ANY_FLAGS_LINE, FALSE );
+ UINT32 nFlags = 0xa00; // Flags: Connector | HasSpt
+ if ( maRect.Top() > maRect.Bottom() )
+ nFlags |= 0x80; // Flags: VertMirror
+ if ( maRect.Left() > maRect.Right() )
+ nFlags |= 0x40; // Flags: HorzMirror
+
+ ADD_SHAPE( ESCHER_ShpInst_Line, nFlags );
+ aPropOpt.AddOpt( ESCHER_Prop_shapePath, ESCHER_ShapeComplex );
+ aPropOpt.CreateLineProperties( rObj.mXPropSet, sal_False );
+ mpEscherEx->EndCount( ESCHER_OPT, 3 );
+ maRect.Justify();
+ mpEscherEx->AddClientAnchor( maRect );
+ mpEscherEx->CloseContainer(); // ESCHER_SpContainer
+
+ if ( ImplGetPropertyValue( L"MeasureTextHorizontalPosition" ) )
+ {
+ }
+ if ( ImplGetPropertyValue( L"MeasureTextVerticalPosition" ) )
+ {
+ }
+ if ( ImplGetPropertyValue( L"MeasureLineDistance" ) )
+ {
+ }
+ if ( ImplGetPropertyValue( L"MeasureHelpLineOverhang" ) )
+ {
+ }
+ if ( ImplGetPropertyValue( L"MeasureHelpLineDistance" ) )
+ {
+ }
+ if ( ImplGetPropertyValue( L"MeasureHelpLine1Length" ) )
+ {
+ }
+ if ( ImplGetPropertyValue( L"MeasureHelpLine2Length" ) )
+ {
+ }
+ if ( ImplGetPropertyValue( L"MeasureBelowReferenceEdge" ) )
+ {
+ }
+ if ( ImplGetPropertyValue( L"MeasureTextRotate90" ) )
+ {
+ }
+ if ( ImplGetPropertyValue( L"MeasureTextUpsideDown" ) )
+ {
+ }
+ if ( ImplGetPropertyValue( L"MeasureOverhang" ) )
+ {
+ }
+ if ( ImplGetPropertyValue( L"MeasureUnit" ) )
+ {
+ }
+ if ( ImplGetPropertyValue( L"MeasureScale" ) )
+ {
+ }
+ if ( ImplGetPropertyValue( L"MeasureShowUnit" ) )
+ {
+ }
+ if ( ImplGetPropertyValue( L"MeasureFormatString" ) )
+ {
+ }
+ if ( ImplGetPropertyValue( L"MeasureTextAutoAngle" ) )
+ {
+ }
+ if ( ImplGetPropertyValue( L"MeasureTextAutoAngleView" ) )
+ {
+ }
+ if ( ImplGetPropertyValue( L"MeasureTextIsFixedAngle" ) )
+ {
+ }
+ if ( ImplGetPropertyValue( L"MeasureTextFixedAngle" ) )
+ {
+ }
+ mpEscherEx->LeaveGroup();
+ }
+*/
+ break;
+ }
+ else if ( rObj.GetType().EqualsAscii( "drawing.Line" ))
+ {
+ ::com::sun::star::awt::Rectangle aNewRect;
+ aPropOpt.CreatePolygonProperties( rObj.mXPropSet, ESCHER_CREATEPOLYGON_LINE, sal_False, aNewRect, NULL );
+ MapRect(rObj);
+ //i27942: Poly/Lines/Bezier do not support text.
+
+ mpEscherEx->OpenContainer( ESCHER_SpContainer );
+ UINT32 nFlags = 0xa00; // Flags: Connector | HasSpt
+ if( aNewRect.Height < 0 )
+ nFlags |= 0x80; // Flags: VertMirror
+ if( aNewRect.Width < 0 )
+ nFlags |= 0x40; // Flags: HorzMirror
+
+ ADD_SHAPE( ESCHER_ShpInst_Line, nFlags );
+ aPropOpt.AddOpt( ESCHER_Prop_shapePath, ESCHER_ShapeComplex );
+ aPropOpt.CreateLineProperties( rObj.mXPropSet, sal_False );
+ rObj.SetAngle( 0 );
+ }
+ else if ( rObj.GetType().EqualsAscii( "drawing.PolyPolygon" ))
+ {
+ if( rObj.ImplHasText() )
+ {
+ nGrpShapeID = ImplEnterAdditionalTextGroup( rObj.GetShapeRef(), &rObj.GetRect() );
+ bAdditionalText = TRUE;
+ }
+ mpEscherEx->OpenContainer( ESCHER_SpContainer );
+ ADD_SHAPE( ESCHER_ShpInst_NotPrimitive, 0xa00 ); // Flags: Connector | HasSpt
+ ::com::sun::star::awt::Rectangle aNewRect;
+ aPropOpt.CreatePolygonProperties( rObj.mXPropSet, ESCHER_CREATEPOLYGON_POLYPOLYGON, sal_False, aNewRect, NULL );
+ MapRect(rObj);
+ aPropOpt.CreateFillProperties( rObj.mXPropSet, sal_True );
+ rObj.SetAngle( 0 );
+ }
+ else if ( rObj.GetType().EqualsAscii( "drawing.PolyLine" ))
+ {
+ //i27942: Poly/Lines/Bezier do not support text.
+
+ mpEscherEx->OpenContainer( ESCHER_SpContainer );
+ ADD_SHAPE( ESCHER_ShpInst_NotPrimitive, 0xa00 ); // Flags: Connector | HasSpt
+ ::com::sun::star::awt::Rectangle aNewRect;
+ aPropOpt.CreatePolygonProperties( rObj.mXPropSet, ESCHER_CREATEPOLYGON_POLYLINE, sal_False, aNewRect, NULL );
+ MapRect(rObj);
+ aPropOpt.CreateLineProperties( rObj.mXPropSet, sal_False );
+ rObj.SetAngle( 0 );
+ }
+ else if ( rObj.GetType().EqualsAscii( "drawing.OpenBezier" ) )
+ {
+ //i27942: Poly/Lines/Bezier do not support text.
+
+ mpEscherEx->OpenContainer( ESCHER_SpContainer );
+ ADD_SHAPE( ESCHER_ShpInst_NotPrimitive, 0xa00 ); // Flags: Connector | HasSpt
+ ::com::sun::star::awt::Rectangle aNewRect;
+ aPropOpt.CreatePolygonProperties( rObj.mXPropSet, ESCHER_CREATEPOLYGON_POLYLINE, sal_True, aNewRect, NULL );
+ MapRect(rObj);
+ aPropOpt.CreateLineProperties( rObj.mXPropSet, sal_False );
+ rObj.SetAngle( 0 );
+ }
+ else if ( rObj.GetType().EqualsAscii( "drawing.ClosedBezier" ) )
+ {
+ if ( rObj.ImplHasText() )
+ {
+ nGrpShapeID = ImplEnterAdditionalTextGroup( rObj.GetShapeRef(), &rObj.GetRect() );
+ bAdditionalText = TRUE;
+ }
+ mpEscherEx->OpenContainer( ESCHER_SpContainer );
+ ADD_SHAPE( ESCHER_ShpInst_NotPrimitive, 0xa00 ); // Flags: Connector | HasSpt
+ ::com::sun::star::awt::Rectangle aNewRect;
+ aPropOpt.CreatePolygonProperties( rObj.mXPropSet, ESCHER_CREATEPOLYGON_POLYPOLYGON, sal_True, aNewRect, NULL );
+ MapRect(rObj);
+ aPropOpt.CreateFillProperties( rObj.mXPropSet, sal_True );
+ rObj.SetAngle( 0 );
+ }
+ else if ( rObj.GetType().EqualsAscii( "drawing.GraphicObject" ))
+ {
+ mpEscherEx->OpenContainer( ESCHER_SpContainer );
+
+ // ein GraphicObject kann auch ein ClickMe Element sein
+ if( rObj.IsEmptyPresObj() && ( ePageType == NORMAL ) )
+ {
+ ADD_SHAPE( ESCHER_ShpInst_Rectangle, 0x220 ); // Flags: HaveAnchor | HaveMaster
+ UINT32 nTxtBxId = mpEscherEx->QueryTextID( rObj.GetShapeRef(),
+ rObj.GetShapeId() );
+ aPropOpt.AddOpt( ESCHER_Prop_lTxid, nTxtBxId );
+ aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x10001 );
+ aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x10001 );
+ aPropOpt.AddOpt( ESCHER_Prop_hspMaster, mnShapeMasterBody );
+ }
+ else
+ {
+ if( rObj.ImplGetText() )
+ {
+ /* SJ #i34951#: because M. documents are not allowing GraphicObjects containing text, we
+ have to create a simpe Rectangle with fill bitmap instead (while not allowing BitmapMode_Repeat).
+ */
+ ADD_SHAPE( ESCHER_ShpInst_Rectangle, 0xa00 ); // Flags: Connector | HasSpt
+ if ( aPropOpt.CreateGraphicProperties( rObj.mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "GraphicURL" ) ), sal_True, sal_True, sal_False ) )
+ {
+ aPropOpt.AddOpt( ESCHER_Prop_WrapText, ESCHER_WrapNone );
+ aPropOpt.AddOpt( ESCHER_Prop_AnchorText, ESCHER_AnchorMiddle );
+ aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x140014 );
+ aPropOpt.AddOpt( ESCHER_Prop_fillBackColor, 0x8000000 );
+ aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x80000 );
+ if ( rObj.ImplGetText() )
+ aPropOpt.CreateTextProperties( rObj.mXPropSet,
+ mpEscherEx->QueryTextID( rObj.GetShapeRef(),
+ rObj.GetShapeId() ), sal_False, sal_False );
+ }
+ }
+ else
+ {
+ ADD_SHAPE( ESCHER_ShpInst_PictureFrame, 0xa00 );
+ if ( aPropOpt.CreateGraphicProperties( rObj.mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "GraphicURL" ) ), sal_False, sal_True ) )
+ aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 );
+ }
+ }
+ }
+ else if ( rObj.GetType().EqualsAscii( "drawing.Text" ))
+ {
+ SHAPE_TEXT( TRUE );
+ }
+ else if ( rObj.GetType().EqualsAscii( "drawing.Page" ))
+ {
+ mpEscherEx->OpenContainer( ESCHER_SpContainer );
+ ADD_SHAPE( ESCHER_ShpInst_Rectangle, 0xa00 );
+ aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x40004 );
+ aPropOpt.AddOpt( ESCHER_Prop_fFillOK, 0x100001 );
+ aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x110011 );
+ aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x90008 );
+ aPropOpt.AddOpt( ESCHER_Prop_fshadowObscured, 0x10001 );
+ }
+ else if ( rObj.GetType().EqualsAscii( "drawing.Frame" ))
+ {
+ break;
+ }
+ else if ( rObj.GetType().EqualsAscii( "drawing.OLE2" ))
+ {
+ mpEscherEx->OpenContainer( ESCHER_SpContainer );
+ if( rObj.IsEmptyPresObj() && ( ePageType == NORMAL ) )
+ {
+ ADD_SHAPE( ESCHER_ShpInst_Rectangle, 0x220 ); // Flags: HaveAnchor | HaveMaster
+ UINT32 nTxtBxId = mpEscherEx->QueryTextID( rObj.GetShapeRef(),
+ rObj.GetShapeId() );
+ aPropOpt.AddOpt( ESCHER_Prop_lTxid, nTxtBxId );
+ aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x10001 );
+ aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x10001 );
+ aPropOpt.AddOpt( ESCHER_Prop_hspMaster, mnShapeMasterBody );
+ }
+ else
+ {
+ //2do: could be made an option in HostAppData whether OLE object should be written or not
+ BOOL bAppOLE = TRUE;
+ ADD_SHAPE( ESCHER_ShpInst_PictureFrame,
+ 0xa00 | (bAppOLE ? SHAPEFLAG_OLESHAPE : 0) );
+ if ( aPropOpt.CreateOLEGraphicProperties( rObj.GetShapeRef() ) )
+ {
+ if ( bAppOLE )
+ { // snooped from Xcl hex dump, nobody knows the trouble I have seen
+ aPropOpt.AddOpt( ESCHER_Prop_FitTextToShape, 0x00080008 );
+ aPropOpt.AddOpt( ESCHER_Prop_pictureId, 0x00000001 );
+ aPropOpt.AddOpt( ESCHER_Prop_fillColor, 0x08000041 );
+ aPropOpt.AddOpt( ESCHER_Prop_fillBackColor, 0x08000041 );
+ aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x00110010 );
+ aPropOpt.AddOpt( ESCHER_Prop_lineColor, 0x08000040 );
+ aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash,0x00080008 );
+// aPropOpt.AddOpt( ESCHER_Prop_fshadowObscured,0x00020000 );
+ aPropOpt.AddOpt( ESCHER_Prop_fPrint, 0x00080000 );
+ }
+ aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 );
+ }
+ }
+ }
+ else if( '3' == rObj.GetType().GetChar(8 ) &&
+ 'D' == rObj.GetType().GetChar( 9 ) ) // drawing.3D
+ {
+ // SceneObject, CubeObject, SphereObject, LatheObject, ExtrudeObject, PolygonObject
+ if ( !rObj.ImplGetPropertyValue( ::rtl::OUString::createFromAscii("Bitmap") ) )
+ break;
+
+ mpEscherEx->OpenContainer( ESCHER_SpContainer );
+ ADD_SHAPE( ESCHER_ShpInst_PictureFrame, 0xa00 );
+
+ if ( aPropOpt.CreateGraphicProperties( rObj.mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Bitmap" ) ), sal_False ) )
+ aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 );
+ }
+ else if ( rObj.GetType().EqualsAscii( "drawing.dontknow" ))
+ {
+ rObj.SetAngle( 0 );
+ mpEscherEx->OpenContainer( ESCHER_SpContainer );
+ ADD_SHAPE( ESCHER_ShpInst_PictureFrame, 0xa00 );
+ if ( aPropOpt.CreateGraphicProperties( rObj.mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "MetaFile" ) ), sal_False ) )
+ aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 );
+ }
+ else
+ {
+ break;
+ }
+ aPropOpt.CreateShadowProperties( rObj.mXPropSet );
+
+ if( USHRT_MAX != mpEscherEx->GetHellLayerId() &&
+ rObj.ImplGetPropertyValue( ::rtl::OUString::createFromAscii("LayerID") ) &&
+ (*((UINT16*)rObj.GetUsrAny().getValue()) ) == mpEscherEx->GetHellLayerId() )
+ {
+ aPropOpt.AddOpt( ESCHER_Prop_fPrint, 0x200020 );
+ }
+
+ {
+ Rectangle aRect( rObj.GetRect() );
+ aRect.Justify();
+ rObj.SetRect( aRect );
+ }
+
+ if( rObj.GetAngle() )
+ ImplFlipBoundingBox( rObj, aPropOpt );
+
+ aPropOpt.CreateShapeProperties( rObj.GetShapeRef() );
+ mpEscherEx->Commit( aPropOpt, rObj.GetRect() );
+ if( mpEscherEx->GetGroupLevel() > 1 )
+ mpEscherEx->AddChildAnchor( rObj.GetRect() );
+
+ if ( mpHostAppData )
+ { //! with AdditionalText the App has to control whether these are written or not
+ mpHostAppData->WriteClientAnchor( *mpEscherEx, rObj.GetRect() );
+ mpHostAppData->WriteClientData( *mpEscherEx );
+ if ( !bDontWriteText )
+ mpHostAppData->WriteClientTextbox( *mpEscherEx );
+ }
+ mpEscherEx->CloseContainer(); // ESCHER_SpContainer
+
+ if( bAdditionalText )
+ {
+ mpEscherEx->EndShape( nShapeType, nShapeID );
+ ImplWriteAdditionalText( rObj, aTextRefPoint );
+ }
+
+ } while ( 0 );
+
+ if ( bAdditionalText )
+ mpEscherEx->EndShape( ESCHER_ShpInst_Min, nGrpShapeID );
+ else
+ mpEscherEx->EndShape( nShapeType, nShapeID );
+ return nShapeID;
+}
+
+void ImplEESdrWriter::ImplWriteAdditionalText( ImplEESdrObject& rObj,
+ const Point& rTextRefPoint )
+{
+ UINT32 nShapeID = 0;
+ UINT16 nShapeType = 0;
+ do
+ {
+ mpHostAppData = mpEscherEx->StartShape( rObj.GetShapeRef(), (mpEscherEx->GetGroupLevel() > 1) ? &rObj.GetRect() : 0 );
+ if ( mpHostAppData && mpHostAppData->DontWriteShape() )
+ break;
+
+ const ::com::sun::star::awt::Size aSize100thmm( rObj.GetShapeRef()->getSize() );
+ const ::com::sun::star::awt::Point aPoint100thmm( rObj.GetShapeRef()->getPosition() );
+ Rectangle aRect100thmm( Point( aPoint100thmm.X, aPoint100thmm.Y ), Size( aSize100thmm.Width, aSize100thmm.Height ) );
+ if ( !mpPicStrm )
+ mpPicStrm = mpEscherEx->QueryPictureStream();
+ EscherPropertyContainer aPropOpt( mpEscherEx->GetGraphicProvider(), mpPicStrm, aRect100thmm );
+ rObj.SetAngle( rObj.ImplGetInt32PropertyValue( ::rtl::OUString::createFromAscii("RotateAngle")));
+ INT32 nAngle = rObj.GetAngle();
+ if( rObj.GetType().EqualsAscii( "drawing.Line" ))
+ {
+//2do: this does not work right
+ double fDist = hypot( rObj.GetRect().GetWidth(),
+ rObj.GetRect().GetHeight() );
+ rObj.SetRect( Rectangle( rTextRefPoint,
+ Point( (sal_Int32)( rTextRefPoint.X() + fDist ), rTextRefPoint.Y() - 1 ) ) );
+
+ mpEscherEx->OpenContainer( ESCHER_SpContainer );
+ mpEscherEx->AddShape( ESCHER_ShpInst_TextBox, 0xa00 );
+ if ( rObj.ImplGetText() )
+ aPropOpt.CreateTextProperties( rObj.mXPropSet,
+ mpEscherEx->QueryTextID( rObj.GetShapeRef(),
+ rObj.GetShapeId() ) );
+
+ aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x90000 );
+ aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x100000 );
+ aPropOpt.AddOpt( ESCHER_Prop_FitTextToShape, 0x60006 ); // Size Shape To Fit Text
+ if ( nAngle < 0 )
+ nAngle = ( 36000 + nAngle ) % 36000;
+ if ( nAngle )
+ ImplFlipBoundingBox( rObj, aPropOpt );
+ }
+ else
+ {
+ mpEscherEx->OpenContainer( ESCHER_SpContainer );
+ nShapeID = mpEscherEx->GenerateShapeId();
+ mpEscherEx->AddShape( nShapeType = ESCHER_ShpInst_TextBox, 0xa00, nShapeID );
+ if ( rObj.ImplGetText() )
+ aPropOpt.CreateTextProperties( rObj.mXPropSet,
+ mpEscherEx->QueryTextID( rObj.GetShapeRef(),
+ rObj.GetShapeId() ) );
+ aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x90000 );
+ aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x100000 );
+
+ if( nAngle < 0 )
+ nAngle = ( 36000 + nAngle ) % 36000;
+ else
+ nAngle = ( 36000 - ( nAngle % 36000 ) );
+
+ nAngle *= 655;
+ nAngle += 0x8000;
+ nAngle &=~0xffff; // nAngle auf volle Gradzahl runden
+ aPropOpt.AddOpt( ESCHER_Prop_Rotation, nAngle );
+ mpEscherEx->SetGroupSnapRect( mpEscherEx->GetGroupLevel(),
+ rObj.GetRect() );
+ mpEscherEx->SetGroupLogicRect( mpEscherEx->GetGroupLevel(),
+ rObj.GetRect() );
+ }
+ rObj.SetAngle( nAngle );
+ aPropOpt.CreateShapeProperties( rObj.GetShapeRef() );
+ mpEscherEx->Commit( aPropOpt, rObj.GetRect() );
+
+ // write the childanchor
+ mpEscherEx->AddChildAnchor( rObj.GetRect() );
+
+#if defined EES_WRITE_EPP
+ // ClientAnchor
+ mpEscherEx->AddClientAnchor( maRect );
+ // ClientTextbox
+ mpEscherEx->OpenContainer( ESCHER_ClientTextbox );
+ mpEscherEx->AddAtom( 4, EPP_TextHeaderAtom );
+ *mpStrm << (UINT32)EPP_TEXTTYPE_Other; // Text in a Shape
+ ImplWriteTextStyleAtom();
+ mpEscherEx->CloseContainer(); // ESCHER_ClientTextBox
+#else // !EES_WRITE_EPP
+ if ( mpHostAppData )
+ { //! the App has to control whether these are written or not
+ mpHostAppData->WriteClientAnchor( *mpEscherEx, rObj.GetRect() );
+ mpHostAppData->WriteClientData( *mpEscherEx );
+ mpHostAppData->WriteClientTextbox( *mpEscherEx );
+ }
+#endif // EES_WRITE_EPP
+ mpEscherEx->CloseContainer(); // ESCHER_SpContainer
+ } while ( 0 );
+ mpEscherEx->LeaveGroup();
+ mpEscherEx->EndShape( nShapeType, nShapeID );
+}
+
+
+// -------------------------------------------------------------------
+
+UINT32 ImplEESdrWriter::ImplEnterAdditionalTextGroup( const Reference< XShape >& rShape,
+ const Rectangle* pBoundRect )
+{
+ mpHostAppData = mpEscherEx->EnterAdditionalTextGroup();
+ UINT32 nGrpId = mpEscherEx->EnterGroup( pBoundRect );
+ mpHostAppData = mpEscherEx->StartShape( rShape, pBoundRect );
+ return nGrpId;
+}
+
+
+// -------------------------------------------------------------------
+
+BOOL ImplEESdrWriter::ImplInitPageValues()
+{
+ mnIndices = 0;
+ mnOutlinerCount = 0; // die gliederungsobjekte muessen dem layout entsprechen,
+ mnEffectCount = 0;
+ mbIsTitlePossible = TRUE; // bei mehr als einem title geht powerpoint in die knie
+
+ return TRUE;
+}
+
+
+// -------------------------------------------------------------------
+
+void ImplEESdrWriter::ImplWritePage(
+ EscherSolverContainer& rSolverContainer,
+ ImplEESdrPageType ePageType, BOOL /* bBackGround */ )
+{
+ ImplInitPageValues();
+
+ UINT32 nLastPer = 0, nShapes = mXShapes->getCount();
+ for( UINT32 n = 0; n < nShapes; ++n )
+ {
+ UINT32 nPer = ( 5 * n ) / nShapes;
+ if( nPer != nLastPer )
+ {
+ nLastPer = nPer;
+ UINT32 nValue = mnPagesWritten * 5 + nPer;
+ if( nValue > mnStatMaxValue )
+ nValue = mnStatMaxValue;
+ if( mbStatusIndicator )
+ mXStatusIndicator->setValue( nValue );
+ }
+
+ ImplEESdrObject aObj( *this, *(Reference< XShape >*)
+ mXShapes->getByIndex( n ).getValue() );
+ if( aObj.IsValid() )
+ {
+ ImplWriteShape( aObj, rSolverContainer, ePageType );
+ }
+ }
+ mnPagesWritten++;
+}
+
+// ===================================================================
+
+ImplEscherExSdr::ImplEscherExSdr( EscherEx& rEx )
+ :
+ ImplEESdrWriter( rEx ),
+ mpSdrPage( NULL ),
+ mpSolverContainer( NULL )
+{
+}
+
+
+// -------------------------------------------------------------------
+
+ImplEscherExSdr::~ImplEscherExSdr()
+{
+ DBG_ASSERT( !mpSolverContainer, "ImplEscherExSdr::~ImplEscherExSdr: unwritten SolverContainer" );
+ delete mpSolverContainer;
+}
+
+
+// -------------------------------------------------------------------
+
+bool ImplEscherExSdr::ImplInitPage( const SdrPage& rPage )
+{
+ do
+ {
+ SvxDrawPage* pSvxDrawPage;
+ if ( mpSdrPage != &rPage || !mXDrawPage.is() )
+ {
+ // eventually write SolverContainer of current page, deletes the Solver
+ ImplFlushSolverContainer();
+
+ mpSdrPage = NULL;
+ // why not declare a const parameter if the object will not be modified?
+// mXDrawPage = pSvxDrawPage = new SvxDrawPage( (SdrPage*) &rPage );
+ mXDrawPage = pSvxDrawPage = new SvxFmDrawPage( (SdrPage*) &rPage );
+ mXShapes = Reference< XShapes >::query( mXDrawPage );
+ if ( !mXShapes.is() )
+ break;
+ if ( !ImplInitPageValues() ) // ImplEESdrWriter
+ break;
+ mpSdrPage = &rPage;
+
+ mpSolverContainer = new EscherSolverContainer;
+ }
+ else
+ pSvxDrawPage = SvxDrawPage::getImplementation(mXDrawPage);
+
+ return pSvxDrawPage != 0;
+ } while ( 0 );
+
+ return false;
+}
+
+// -------------------------------------------------------------------
+
+bool ImplEscherExSdr::ImplInitUnoShapes( const Reference< XShapes >& rxShapes )
+{
+ // eventually write SolverContainer of current page, deletes the Solver
+ ImplFlushSolverContainer();
+
+ if( !rxShapes.is() )
+ return false;
+
+ mpSdrPage = 0;
+ mXDrawPage.clear();
+ mXShapes = rxShapes;
+
+ if( !ImplInitPageValues() ) // ImplEESdrWriter
+ return false;
+
+ mpSolverContainer = new EscherSolverContainer;
+ return true;
+}
+
+// -------------------------------------------------------------------
+
+void ImplEscherExSdr::ImplExitPage()
+{
+ // close all groups before the solver container is written
+ while( mpEscherEx->GetGroupLevel() )
+ mpEscherEx->LeaveGroup();
+
+ ImplFlushSolverContainer();
+ mpSdrPage = NULL; // reset page for next init
+}
+
+
+// -------------------------------------------------------------------
+
+void ImplEscherExSdr::ImplFlushSolverContainer()
+{
+ if ( mpSolverContainer )
+ {
+ mpSolverContainer->WriteSolver( mpEscherEx->GetStream() );
+ delete mpSolverContainer;
+ mpSolverContainer = NULL;
+ }
+}
+
+
+// -------------------------------------------------------------------
+
+void ImplEscherExSdr::ImplWriteCurrentPage()
+{
+ DBG_ASSERT( mpSolverContainer, "ImplEscherExSdr::ImplWriteCurrentPage: no SolverContainer" );
+ ImplWritePage( *mpSolverContainer, NORMAL );
+ ImplExitPage();
+}
+
+
+// -------------------------------------------------------------------
+
+UINT32 ImplEscherExSdr::ImplWriteTheShape( ImplEESdrObject& rObj )
+{
+ DBG_ASSERT( mpSolverContainer, "ImplEscherExSdr::ImplWriteShape: no SolverContainer" );
+ return ImplWriteShape( rObj, *mpSolverContainer, NORMAL );
+}
+
+
+// ===================================================================
+
+void EscherEx::AddSdrPage( const SdrPage& rPage )
+{
+ if ( mpImplEscherExSdr->ImplInitPage( rPage ) )
+ mpImplEscherExSdr->ImplWriteCurrentPage();
+}
+
+// -------------------------------------------------------------------
+
+void EscherEx::AddUnoShapes( const Reference< XShapes >& rxShapes )
+{
+ if ( mpImplEscherExSdr->ImplInitUnoShapes( rxShapes ) )
+ mpImplEscherExSdr->ImplWriteCurrentPage();
+}
+
+// -------------------------------------------------------------------
+
+UINT32 EscherEx::AddSdrObject( const SdrObject& rObj )
+{
+ ImplEESdrObject aObj( *mpImplEscherExSdr, rObj );
+ if( aObj.IsValid() )
+ return mpImplEscherExSdr->ImplWriteTheShape( aObj );
+ return 0;
+}
+
+
+// -------------------------------------------------------------------
+
+void EscherEx::EndSdrObjectPage()
+{
+ mpImplEscherExSdr->ImplExitPage();
+}
+
+// -------------------------------------------------------------------
+
+EscherExHostAppData* EscherEx::StartShape( const Reference< XShape >& /* rShape */, const Rectangle* /*pChildAnchor*/ )
+{
+ return NULL;
+}
+
+// -------------------------------------------------------------------
+
+void EscherEx::EndShape( UINT16 /* nShapeType */, UINT32 /* nShapeID */ )
+{
+}
+
+// -------------------------------------------------------------------
+
+UINT32 EscherEx::QueryTextID( const Reference< XShape >&, UINT32 )
+{
+ return 0;
+}
+
+// -------------------------------------------------------------------
+// add an dummy rectangle shape into the escher stream
+UINT32 EscherEx::AddDummyShape()
+{
+ OpenContainer( ESCHER_SpContainer );
+ UINT32 nShapeID = GenerateShapeId();
+ AddShape( ESCHER_ShpInst_Rectangle, 0xa00, nShapeID );
+//?? aSolverContainer.AddShape( mXShape, nShapeID );
+ CloseContainer();
+
+ return nShapeID;
+}
+
+// -------------------------------------------------------------------
+
+// static
+const SdrObject* EscherEx::GetSdrObject( const Reference< XShape >& rShape )
+{
+ const SdrObject* pRet = 0;
+ const SvxShape* pSvxShape = SvxShape::getImplementation( rShape );
+ DBG_ASSERT( pSvxShape, "EscherEx::GetSdrObject: no SvxShape" );
+ if( pSvxShape )
+ {
+ pRet = pSvxShape->GetSdrObject();
+ DBG_ASSERT( pRet, "EscherEx::GetSdrObject: no SdrObj" );
+ }
+ return pRet;
+}
+
+
+// -------------------------------------------------------------------
+
+ImplEESdrObject::ImplEESdrObject( ImplEscherExSdr& rEx,
+ const SdrObject& rObj ) :
+ mnShapeId( 0 ),
+ mnTextSize( 0 ),
+ mnAngle( 0 ),
+ mbValid( FALSE ),
+ mbPresObj( FALSE ),
+ mbEmptyPresObj( FALSE )
+{
+ SdrPage* pPage = rObj.GetPage();
+ DBG_ASSERT( pPage, "ImplEESdrObject::ImplEESdrObject: no SdrPage" );
+ if( pPage && rEx.ImplInitPage( *pPage ) )
+ {
+ // why not declare a const parameter if the object will
+ // not be modified?
+ mXShape = uno::Reference< drawing::XShape >::query( ((SdrObject*)&rObj)->getUnoShape() );;
+ Init( rEx );
+ }
+}
+
+ImplEESdrObject::ImplEESdrObject( ImplEESdrWriter& rEx,
+ const Reference< XShape >& rShape ) :
+ mXShape( rShape ),
+ mnShapeId( 0 ),
+ mnTextSize( 0 ),
+ mnAngle( 0 ),
+ mbValid( FALSE ),
+ mbPresObj( FALSE ),
+ mbEmptyPresObj( FALSE )
+{
+ Init( rEx );
+}
+
+
+ImplEESdrObject::~ImplEESdrObject()
+{
+}
+
+void ImplEESdrObject::Init( ImplEESdrWriter& rEx )
+{
+ mXPropSet = Reference< XPropertySet >::query( mXShape );
+ if( mXPropSet.is() )
+ {
+ static const sal_Char aPrefix[] = "com.sun.star.";
+ static const xub_StrLen nPrefix = sizeof(aPrefix)-1;
+ SetRect( rEx.ImplMapPoint( Point( mXShape->getPosition().X, mXShape->getPosition().Y ) ),
+ rEx.ImplMapSize( Size( mXShape->getSize().Width, mXShape->getSize().Height ) ) );
+ mType = String( mXShape->getShapeType() );
+ mType.Erase( 0, nPrefix ); // strip "com.sun.star."
+ xub_StrLen nPos = mType.SearchAscii( "Shape" );
+ mType.Erase( nPos, 5 );
+
+ static const OUString sPresStr(rtl::OUString::createFromAscii("IsPresentationObject"));
+ static const OUString sEmptyPresStr(rtl::OUString::createFromAscii("IsEmptyPresentationObject"));
+
+ if( ImplGetPropertyValue( sPresStr ) )
+ mbPresObj = ::cppu::any2bool( mAny );
+
+ if( mbPresObj && ImplGetPropertyValue( sEmptyPresStr ) )
+ mbEmptyPresObj = ::cppu::any2bool( mAny );
+
+ mbValid = TRUE;
+ }
+}
+
+//BOOL ImplEESdrObject::ImplGetPropertyValue( const OUString& rString )
+BOOL ImplEESdrObject::ImplGetPropertyValue( const sal_Unicode* rString )
+{
+ BOOL bRetValue = FALSE;
+ if( mbValid )
+ {
+ try
+ {
+ mAny = mXPropSet->getPropertyValue( rString );
+ if( mAny.hasValue() )
+ bRetValue = TRUE;
+ }
+ catch( ::com::sun::star::uno::Exception& )
+ {
+ bRetValue = FALSE;
+ }
+ }
+ return bRetValue;
+}
+
+#ifdef USED
+BOOL ImplEESdrObject::ImplGetPropertyValue( const Reference< XPropertySet >& rXPropSet,
+ const OUString& rString )
+{
+ BOOL bRetValue = FALSE;
+ if( mbValid )
+ {
+ try
+ {
+ mAny = rXPropSet->getPropertyValue( rString );
+ if( 0 != mAny.get() )
+ bRetValue = TRUE;
+ }
+ catch( ::com::sun::star::uno::Exception& )
+ {
+ bRetValue = FALSE;
+ }
+ }
+ return bRetValue;
+}
+#endif
+
+void ImplEESdrObject::SetRect( const Point& rPos, const Size& rSz )
+{
+ maRect = Rectangle( rPos, rSz );
+}
+
+const SdrObject* ImplEESdrObject::GetSdrObject() const
+{
+ return EscherEx::GetSdrObject( mXShape );
+}
+
+// laedt und konvertiert text aus shape, ergebnis ist mnTextSize gespeichert
+UINT32 ImplEESdrObject::ImplGetText()
+{
+ Reference< XText > xXText( mXShape, UNO_QUERY );
+ mnTextSize = 0;
+ if( xXText.is() )
+ mnTextSize = xXText->getString().getLength();
+ return mnTextSize;
+}
+
+BOOL ImplEESdrObject::ImplHasText() const
+{
+ Reference< XText > xXText( mXShape, UNO_QUERY );
+ return xXText.is() && xXText->getString().getLength();
+}
+
diff --git a/filter/source/msfilter/eschesdo.hxx b/filter/source/msfilter/eschesdo.hxx
new file mode 100644
index 000000000000..754eb6f3a2c0
--- /dev/null
+++ b/filter/source/msfilter/eschesdo.hxx
@@ -0,0 +1,206 @@
+/*************************************************************************
+ *
+ * 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 _ESCHESDO_HXX
+#define _ESCHESDO_HXX
+#include <filter/msfilter/escherex.hxx>
+#include <svx/unopage.hxx>
+#include <vcl/mapmod.hxx>
+
+// ===================================================================
+// fractions of Draw PPTWriter etc.
+
+enum ImplEESdrPageType { NORMAL = 0, MASTER = 1, NOTICE = 2, UNDEFINED = 3 };
+
+class ImplEESdrWriter;
+class ImplEscherExSdr;
+
+class ImplEESdrObject
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > mXShape;
+// XTextRef mXText; // TextRef des globalen Text
+ ::com::sun::star::uno::Any mAny;
+ Rectangle maRect;
+ String mType;
+ UINT32 mnShapeId;
+ UINT32 mnTextSize;
+ INT32 mnAngle;
+ BOOL mbValid : 1;
+ BOOL mbPresObj : 1;
+ BOOL mbEmptyPresObj : 1;
+
+ void Init( ImplEESdrWriter& rEx );
+public:
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > mXPropSet;
+
+ ImplEESdrObject( ImplEscherExSdr& rEx, const SdrObject& rObj );
+ ImplEESdrObject( ImplEESdrWriter& rEx, const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rShape );
+ ~ImplEESdrObject();
+
+ BOOL ImplGetPropertyValue( const sal_Unicode* pString );
+
+ INT32 ImplGetInt32PropertyValue( const sal_Unicode* pStr, UINT32 nDef = 0 )
+ { return ImplGetPropertyValue( pStr ) ? *(INT32*)mAny.getValue() : nDef; }
+
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& GetShapeRef() const { return mXShape; }
+ const ::com::sun::star::uno::Any& GetUsrAny() const { return mAny; }
+ const String& GetType() const { return mType; }
+ void SetType( const String& rS ) { mType = rS; }
+
+ const Rectangle& GetRect() const { return maRect; }
+ void SetRect( const Point& rPos, const Size& rSz );
+ void SetRect( const Rectangle& rRect )
+ { maRect = rRect; }
+
+ INT32 GetAngle() const { return mnAngle; }
+ void SetAngle( INT32 nVal ) { mnAngle = nVal; }
+
+ UINT32 GetTextSize() const { return mnTextSize; }
+
+ BOOL IsValid() const { return mbValid; }
+ BOOL IsPresObj() const { return mbPresObj; }
+ BOOL IsEmptyPresObj() const { return mbEmptyPresObj; }
+ UINT32 GetShapeId() const { return mnShapeId; }
+ void SetShapeId( UINT32 nVal ) { mnShapeId = nVal; }
+
+ const SdrObject* GetSdrObject() const;
+
+ UINT32 ImplGetText();
+ BOOL ImplHasText() const;
+};
+
+
+
+// -------------------------------------------------------------------
+// fractions of the Draw PPTWriter
+
+class EscherEx;
+namespace com { namespace sun { namespace star {
+ namespace drawing {
+ class XDrawPage;
+ class XShape;
+ }
+ namespace task {
+ class XStatusIndicator;
+ }
+}}}
+class EscherExHostAppData;
+class Polygon;
+
+class ImplEESdrWriter
+{
+protected:
+ EscherEx* mpEscherEx;
+ MapMode maMapModeSrc;
+ MapMode maMapModeDest;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator > mXStatusIndicator;
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > mXDrawPage;
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > mXShapes;
+
+ SvStream* mpPicStrm;
+
+ // own extensions
+
+ EscherExHostAppData* mpHostAppData;
+
+ UINT32 mnPagesWritten;
+
+ UINT32 mnShapeMasterTitle;
+ UINT32 mnShapeMasterBody;
+
+ // per page values
+ UINT32 mnIndices;
+ UINT32 mnOutlinerCount;
+ UINT32 mnPrevTextStyle;
+ UINT32 mnStatMaxValue;
+
+ UINT16 mnEffectCount;
+
+ BOOL mbIsTitlePossible;
+ BOOL mbStatusIndicator;
+ BOOL mbStatus;
+
+
+ ImplEESdrWriter( EscherEx& rEx );
+
+ BOOL ImplInitPageValues();
+
+ void ImplWritePage(
+ EscherSolverContainer& rSolver,
+ ImplEESdrPageType ePageType,
+ BOOL bBackGround = FALSE );
+
+ UINT32 ImplWriteShape( ImplEESdrObject& rObj,
+ EscherSolverContainer& rSolver,
+ ImplEESdrPageType ePageType ); // returns ShapeID
+
+ void ImplFlipBoundingBox( ImplEESdrObject& rObj, EscherPropertyContainer& rPropOpt );
+ BOOL ImplGetText( ImplEESdrObject& rObj );
+ void ImplWriteAdditionalText(
+ ImplEESdrObject& rObj,
+ const Point& rTextRefPoint );
+ UINT32 ImplEnterAdditionalTextGroup(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rShape,
+ const Rectangle* pBoundRect = NULL );
+
+
+public:
+ Point ImplMapPoint( const Point& rPoint );
+ Size ImplMapSize( const Size& rSize );
+ EscherExHostAppData* ImplGetHostData() { return mpHostAppData; }
+ void MapRect(ImplEESdrObject& rObj);
+};
+
+
+// ===================================================================
+
+class SdrObject;
+class SdrPage;
+
+class ImplEscherExSdr : public ImplEESdrWriter
+{
+private:
+ const SdrPage* mpSdrPage;
+ EscherSolverContainer* mpSolverContainer;
+
+public:
+ ImplEscherExSdr( EscherEx& rEx );
+ virtual ~ImplEscherExSdr();
+
+ bool ImplInitPage( const SdrPage& rPage );
+ bool ImplInitUnoShapes( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes );
+ void ImplWriteCurrentPage();
+
+ UINT32 ImplWriteTheShape( ImplEESdrObject& rObj );
+
+ void ImplExitPage();
+ void ImplFlushSolverContainer();
+};
+
+
+
+#endif // _ESCHESDO_HXX
diff --git a/filter/source/msfilter/makefile.mk b/filter/source/msfilter/makefile.mk
new file mode 100644
index 000000000000..7780529b5580
--- /dev/null
+++ b/filter/source/msfilter/makefile.mk
@@ -0,0 +1,86 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ=../..
+
+PRJNAME=filter
+TARGET=msfilter
+ENABLE_EXCEPTIONS=true
+LIBTARGET=NO
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : makefile.pmk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES= \
+ $(SLO)$/countryid.obj \
+ $(SLO)$/escherex.obj \
+ $(SLO)$/eschesdo.obj \
+ $(SLO)$/msdffimp.obj \
+ $(SLO)$/msoleexp.obj \
+ $(SLO)$/msvbasic.obj \
+ $(SLO)$/svxmsbas.obj \
+ $(SLO)$/msocximex.obj \
+ $(SLO)$/mscodec.obj \
+ $(SLO)$/msfiltertracer.obj \
+ $(SLO)$/svdfppt.obj \
+ $(SLO)$/svxmsbas2.obj \
+ $(SLO)$/msvbahelper.obj \
+
+SHL1TARGET= msfilter$(DLLPOSTFIX)
+SHL1IMPLIB= i$(TARGET)
+SHL1OBJS= $(SLOFILES)
+SHL1USE_EXPORTS=name
+SHL1STDLIBS= \
+ $(EDITENGLIB) \
+ $(SVXCORELIB) \
+ $(SFX2LIB) \
+ $(XMLOFFLIB) \
+ $(BASEGFXLIB) \
+ $(BASICLIB) \
+ $(SVTOOLLIB) \
+ $(TKLIB) \
+ $(VCLLIB) \
+ $(SVLLIB) \
+ $(SOTLIB) \
+ $(UNOTOOLSLIB) \
+ $(TOOLSLIB) \
+ $(XMLSCRIPTLIB) \
+ $(COMPHELPERLIB) \
+ $(CPPUHELPERLIB) \
+ $(CPPULIB) \
+ $(SALLIB)
+
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+DEF1NAME= $(SHL1TARGET)
+
+.INCLUDE : target.mk
+
+
diff --git a/filter/source/msfilter/makefile.pmk b/filter/source/msfilter/makefile.pmk
new file mode 100644
index 000000000000..1b3ae0c70ae0
--- /dev/null
+++ b/filter/source/msfilter/makefile.pmk
@@ -0,0 +1,30 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+
+# Reduction of exported symbols:
+CDEFS += -DMSFILTER_DLLIMPLEMENTATION
+VISIBILITY_HIDDEN=TRUE
diff --git a/filter/source/msfilter/mscodec.cxx b/filter/source/msfilter/mscodec.cxx
new file mode 100644
index 000000000000..de17da6bde59
--- /dev/null
+++ b/filter/source/msfilter/mscodec.cxx
@@ -0,0 +1,534 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+#include "filter/msfilter/mscodec.hxx"
+
+#include <osl/diagnose.h>
+#include <algorithm>
+#include <string.h>
+#include <tools/solar.h>
+
+#define DEBUG_MSO_ENCRYPTION_STD97 0
+
+#if DEBUG_MSO_ENCRYPTION_STD97
+#include <stdio.h>
+#endif
+
+
+namespace msfilter {
+
+// ============================================================================
+
+namespace {
+
+/** Rotates rnValue left by nBits bits. */
+template< typename Type >
+inline void lclRotateLeft( Type& rnValue, int nBits )
+{
+ OSL_ASSERT(
+ nBits >= 0 &&
+ sal::static_int_cast< unsigned int >(nBits) < sizeof( Type ) * 8 );
+ rnValue = static_cast< Type >( (rnValue << nBits) | (rnValue >> (sizeof( Type ) * 8 - nBits)) );
+}
+
+/** Rotates the lower nWidth bits of rnValue left by nBits bits. */
+template< typename Type >
+inline void lclRotateLeft( Type& rnValue, sal_uInt8 nBits, sal_uInt8 nWidth )
+{
+ OSL_ASSERT( (nBits < nWidth) && (nWidth < sizeof( Type ) * 8) );
+ Type nMask = static_cast< Type >( (1UL << nWidth) - 1 );
+ rnValue = static_cast< Type >(
+ ((rnValue << nBits) | ((rnValue & nMask) >> (nWidth - nBits))) & nMask );
+}
+
+sal_Size lclGetLen( const sal_uInt8* pnPassData, sal_Size nBufferSize )
+{
+ sal_Size nLen = 0;
+ while( (nLen < nBufferSize) && pnPassData[ nLen ] ) ++nLen;
+ return nLen;
+}
+
+sal_uInt16 lclGetKey( const sal_uInt8* pnPassData, sal_Size nBufferSize )
+{
+ sal_Size nLen = lclGetLen( pnPassData, nBufferSize );
+ if( !nLen ) return 0;
+
+ sal_uInt16 nKey = 0;
+ sal_uInt16 nKeyBase = 0x8000;
+ sal_uInt16 nKeyEnd = 0xFFFF;
+ const sal_uInt8* pnChar = pnPassData + nLen - 1;
+ for( sal_Size nIndex = 0; nIndex < nLen; ++nIndex, --pnChar )
+ {
+ sal_uInt8 cChar = *pnChar & 0x7F;
+ for( sal_uInt8 nBit = 0; nBit < 8; ++nBit )
+ {
+ lclRotateLeft( nKeyBase, 1 );
+ if( nKeyBase & 1 ) nKeyBase ^= 0x1020;
+ if( cChar & 1 ) nKey ^= nKeyBase;
+ cChar >>= 1;
+ lclRotateLeft( nKeyEnd, 1 );
+ if( nKeyEnd & 1 ) nKeyEnd ^= 0x1020;
+ }
+ }
+ return nKey ^ nKeyEnd;
+}
+
+sal_uInt16 lclGetHash( const sal_uInt8* pnPassData, sal_Size nBufferSize )
+{
+ sal_Size nLen = lclGetLen( pnPassData, nBufferSize );
+
+ sal_uInt16 nHash = static_cast< sal_uInt16 >( nLen );
+ if( nLen )
+ nHash ^= 0xCE4B;
+
+ const sal_uInt8* pnChar = pnPassData;
+ for( sal_Size nIndex = 0; nIndex < nLen; ++nIndex, ++pnChar )
+ {
+ sal_uInt16 cChar = *pnChar;
+ sal_uInt8 nRot = static_cast< sal_uInt8 >( (nIndex + 1) % 15 );
+ lclRotateLeft( cChar, nRot, 15 );
+ nHash ^= cChar;
+ }
+ return nHash;
+}
+
+
+} // namespace
+
+// ============================================================================
+
+MSCodec_Xor95::MSCodec_Xor95(int nRotateDistance) :
+ mnOffset( 0 ),
+ mnKey( 0 ),
+ mnHash( 0 ),
+ mnRotateDistance( nRotateDistance )
+{
+ (void)memset( mpnKey, 0, sizeof( mpnKey ) );
+}
+
+MSCodec_Xor95::~MSCodec_Xor95()
+{
+ (void)memset( mpnKey, 0, sizeof( mpnKey ) );
+ mnKey = mnHash = 0;
+}
+
+void MSCodec_Xor95::InitKey( const sal_uInt8 pnPassData[ 16 ] )
+{
+ mnKey = lclGetKey( pnPassData, 16 );
+ mnHash = lclGetHash( pnPassData, 16 );
+
+ (void)memcpy( mpnKey, pnPassData, 16 );
+
+ static const sal_uInt8 spnFillChars[] =
+ {
+ 0xBB, 0xFF, 0xFF, 0xBA,
+ 0xFF, 0xFF, 0xB9, 0x80,
+ 0x00, 0xBE, 0x0F, 0x00,
+ 0xBF, 0x0F, 0x00
+ };
+
+ sal_Size nIndex;
+ sal_Size nLen = lclGetLen( pnPassData, 16 );
+ const sal_uInt8* pnFillChar = spnFillChars;
+ for( nIndex = nLen; nIndex < sizeof( mpnKey ); ++nIndex, ++pnFillChar )
+ mpnKey[ nIndex ] = *pnFillChar;
+
+ SVBT16 pnOrigKey;
+ ShortToSVBT16( mnKey, pnOrigKey );
+ sal_uInt8* pnKeyChar = mpnKey;
+ for( nIndex = 0; nIndex < sizeof( mpnKey ); ++nIndex, ++pnKeyChar )
+ {
+ *pnKeyChar ^= pnOrigKey[ nIndex & 0x01 ];
+ lclRotateLeft( *pnKeyChar, mnRotateDistance );
+ }
+}
+
+bool MSCodec_Xor95::VerifyKey( sal_uInt16 nKey, sal_uInt16 nHash ) const
+{
+ return (nKey == mnKey) && (nHash == mnHash);
+}
+
+void MSCodec_Xor95::InitCipher()
+{
+ mnOffset = 0;
+}
+
+void MSCodec_XorXLS95::Decode( sal_uInt8* pnData, sal_Size nBytes )
+{
+ const sal_uInt8* pnCurrKey = mpnKey + mnOffset;
+ const sal_uInt8* pnKeyLast = mpnKey + 0x0F;
+
+ for( const sal_uInt8* pnDataEnd = pnData + nBytes; pnData < pnDataEnd; ++pnData )
+ {
+ lclRotateLeft( *pnData, 3 );
+ *pnData ^= *pnCurrKey;
+ if( pnCurrKey < pnKeyLast ) ++pnCurrKey; else pnCurrKey = mpnKey;
+ }
+
+ // update mnOffset
+ Skip( nBytes );
+}
+
+void MSCodec_XorWord95::Decode( sal_uInt8* pnData, sal_Size nBytes )
+{
+ const sal_uInt8* pnCurrKey = mpnKey + mnOffset;
+ const sal_uInt8* pnKeyLast = mpnKey + 0x0F;
+
+ for( const sal_uInt8* pnDataEnd = pnData + nBytes; pnData < pnDataEnd; ++pnData )
+ {
+ const sal_uInt8 cChar = *pnData ^ *pnCurrKey;
+ if (*pnData && cChar)
+ *pnData = cChar;
+ if( pnCurrKey < pnKeyLast ) ++pnCurrKey; else pnCurrKey = mpnKey;
+ }
+
+ // update mnOffset
+ Skip( nBytes );
+}
+
+
+void MSCodec_Xor95::Skip( sal_Size nBytes )
+{
+ mnOffset = (mnOffset + nBytes) & 0x0F;
+}
+
+sal_uInt16 MSCodec_Xor95::GetHash( const sal_uInt8* pnPassData, sal_Size nSize )
+{
+ return lclGetHash( pnPassData, nSize );
+}
+
+// ============================================================================
+
+MSCodec_Std97::MSCodec_Std97 ()
+{
+ m_hCipher = rtl_cipher_create (
+ rtl_Cipher_AlgorithmARCFOUR, rtl_Cipher_ModeStream);
+ OSL_ASSERT(m_hCipher != 0);
+
+ m_hDigest = rtl_digest_create (
+ rtl_Digest_AlgorithmMD5);
+ OSL_ASSERT(m_hDigest != 0);
+
+ (void)memset (m_pDigestValue, 0, sizeof(m_pDigestValue));
+}
+
+MSCodec_Std97::~MSCodec_Std97 ()
+{
+ (void)memset (m_pDigestValue, 0, sizeof(m_pDigestValue));
+ rtl_digest_destroy (m_hDigest);
+ rtl_cipher_destroy (m_hCipher);
+}
+
+#if DEBUG_MSO_ENCRYPTION_STD97
+static void lcl_PrintKeyData(const sal_uInt8* pKeyData, const char* msg)
+{
+ printf("pKeyData: (%s)\n", msg);
+ for (int j = 0; j < 4; ++j)
+ {
+ for (int i = 0; i < 16; ++i)
+ printf("%2.2x ", pKeyData[j*16+i]);
+ printf("\n");
+ }
+}
+#else
+static void lcl_PrintKeyData(const sal_uInt8* /*pKeyData*/, const char* /*msg*/)
+{
+}
+#endif
+
+#if DEBUG_MSO_ENCRYPTION_STD97
+static void lcl_PrintDigest(const sal_uInt8* pDigest, const char* msg)
+{
+ printf("digest: (%s)\n", msg);
+ for (int i = 0; i < 16; ++i)
+ printf("%2.2x ", pDigest[i]);
+ printf("\n");
+}
+#else
+static void lcl_PrintDigest(const sal_uInt8* /*pDigest*/, const char* /*msg*/)
+{
+}
+#endif
+
+void MSCodec_Std97::InitKey (
+ const sal_uInt16 pPassData[16],
+ const sal_uInt8 pUnique[16])
+{
+#if DEBUG_MSO_ENCRYPTION_STD97
+ fprintf(stdout, "MSCodec_Std97::InitKey: --begin\n");fflush(stdout);
+#endif
+ sal_uInt8 pKeyData[64];
+ int i, n;
+
+ // Fill PassData into KeyData.
+ (void)memset (pKeyData, 0, sizeof(pKeyData));
+ lcl_PrintKeyData(pKeyData, "initial");
+ for (i = 0, n = 16; (i < n) && pPassData[i]; i++)
+ {
+ pKeyData[2*i ] = sal::static_int_cast< sal_uInt8 >(
+ (pPassData[i] >> 0) & 0xff);
+ pKeyData[2*i + 1] = sal::static_int_cast< sal_uInt8 >(
+ (pPassData[i] >> 8) & 0xff);
+ }
+ pKeyData[2*i] = 0x80;
+ pKeyData[ 56] = sal::static_int_cast< sal_uInt8 >(i << 4);
+
+ lcl_PrintKeyData(pKeyData, "password data");
+
+ // Fill raw digest of KeyData into KeyData.
+ (void)rtl_digest_updateMD5 (
+ m_hDigest, pKeyData, sizeof(pKeyData));
+ (void)rtl_digest_rawMD5 (
+ m_hDigest, pKeyData, RTL_DIGEST_LENGTH_MD5);
+
+ lcl_PrintKeyData(pKeyData, "raw digest of key data");
+
+ // Update digest with KeyData and Unique.
+ for (i = 0; i < 16; i++)
+ {
+ rtl_digest_updateMD5 (m_hDigest, pKeyData, 5);
+ rtl_digest_updateMD5 (m_hDigest, pUnique, 16);
+ }
+
+ // Update digest with padding.
+ pKeyData[16] = 0x80;
+ (void)memset (pKeyData + 17, 0, sizeof(pKeyData) - 17);
+ pKeyData[56] = 0x80;
+ pKeyData[57] = 0x0a;
+
+ lcl_PrintKeyData(pKeyData, "update digest with padding");
+
+ rtl_digest_updateMD5 (
+ m_hDigest, &(pKeyData[16]), sizeof(pKeyData) - 16);
+
+ // Fill raw digest of above updates into DigestValue.
+ rtl_digest_rawMD5 (
+ m_hDigest, m_pDigestValue, sizeof(m_pDigestValue));
+
+ lcl_PrintDigest(m_pDigestValue, "digest value");
+
+ // Erase KeyData array and leave.
+ (void)memset (pKeyData, 0, sizeof(pKeyData));
+}
+
+bool MSCodec_Std97::VerifyKey (
+ const sal_uInt8 pSaltData[16],
+ const sal_uInt8 pSaltDigest[16])
+{
+ // both the salt data and salt digest (hash) come from the document being imported.
+
+#if DEBUG_MSO_ENCRYPTION_STD97
+ fprintf(stdout, "MSCodec_Std97::VerifyKey: \n");
+ lcl_PrintDigest(pSaltData, "salt data");
+ lcl_PrintDigest(pSaltDigest, "salt hash");
+#endif
+ bool result = false;
+
+ if (InitCipher(0))
+ {
+ sal_uInt8 pDigest[RTL_DIGEST_LENGTH_MD5];
+ GetDigestFromSalt(pSaltData, pDigest);
+
+ sal_uInt8 pBuffer[16];
+ // Decode original SaltDigest into Buffer.
+ rtl_cipher_decode (
+ m_hCipher, pSaltDigest, 16, pBuffer, sizeof(pBuffer));
+
+ // Compare Buffer with computed Digest.
+ result = (memcmp (pBuffer, pDigest, sizeof(pDigest)) == 0);
+
+ // Erase Buffer and Digest arrays.
+ (void)memset (pBuffer, 0, sizeof(pBuffer));
+ (void)memset (pDigest, 0, sizeof(pDigest));
+ }
+
+ return (result);
+}
+
+bool MSCodec_Std97::InitCipher (sal_uInt32 nCounter)
+{
+ rtlCipherError result;
+ sal_uInt8 pKeyData[64]; // 512-bit message block
+
+ // Initialize KeyData array.
+ (void)memset (pKeyData, 0, sizeof(pKeyData));
+
+ // Fill 40 bit of DigestValue into [0..4].
+ (void)memcpy (pKeyData, m_pDigestValue, 5);
+
+ // Fill counter into [5..8].
+ pKeyData[ 5] = sal_uInt8((nCounter >> 0) & 0xff);
+ pKeyData[ 6] = sal_uInt8((nCounter >> 8) & 0xff);
+ pKeyData[ 7] = sal_uInt8((nCounter >> 16) & 0xff);
+ pKeyData[ 8] = sal_uInt8((nCounter >> 24) & 0xff);
+
+ pKeyData[ 9] = 0x80;
+ pKeyData[56] = 0x48;
+
+ // Fill raw digest of KeyData into KeyData.
+ (void)rtl_digest_updateMD5 (
+ m_hDigest, pKeyData, sizeof(pKeyData));
+ (void)rtl_digest_rawMD5 (
+ m_hDigest, pKeyData, RTL_DIGEST_LENGTH_MD5);
+
+ // Initialize Cipher with KeyData (for decoding).
+ result = rtl_cipher_init (
+ m_hCipher, rtl_Cipher_DirectionBoth,
+ pKeyData, RTL_DIGEST_LENGTH_MD5, 0, 0);
+
+ // Erase KeyData array and leave.
+ (void)memset (pKeyData, 0, sizeof(pKeyData));
+
+ return (result == rtl_Cipher_E_None);
+}
+
+bool MSCodec_Std97::CreateSaltDigest( const sal_uInt8 nSaltData[16], sal_uInt8 nSaltDigest[16] )
+{
+#if DEBUG_MSO_ENCRYPTION_STD97
+ lcl_PrintDigest(pSaltData, "salt data");
+#endif
+ bool result = false;
+
+ if (InitCipher(0))
+ {
+ sal_uInt8 pDigest[RTL_DIGEST_LENGTH_MD5];
+ GetDigestFromSalt(nSaltData, pDigest);
+
+ rtl_cipher_decode (
+ m_hCipher, pDigest, 16, pDigest, sizeof(pDigest));
+
+ (void)memcpy(nSaltDigest, pDigest, 16);
+ }
+
+ return (result);
+}
+
+bool MSCodec_Std97::Encode (
+ const void *pData, sal_Size nDatLen,
+ sal_uInt8 *pBuffer, sal_Size nBufLen)
+{
+ rtlCipherError result;
+
+ result = rtl_cipher_encode (
+ m_hCipher, pData, nDatLen, pBuffer, nBufLen);
+
+ return (result == rtl_Cipher_E_None);
+}
+
+bool MSCodec_Std97::Decode (
+ const void *pData, sal_Size nDatLen,
+ sal_uInt8 *pBuffer, sal_Size nBufLen)
+{
+ rtlCipherError result;
+
+ result = rtl_cipher_decode (
+ m_hCipher, pData, nDatLen, pBuffer, nBufLen);
+
+ return (result == rtl_Cipher_E_None);
+}
+
+bool MSCodec_Std97::Skip( sal_Size nDatLen )
+{
+ sal_uInt8 pnDummy[ 1024 ];
+ sal_Size nDatLeft = nDatLen;
+ bool bResult = true;
+
+ while (bResult && nDatLeft)
+ {
+ sal_Size nBlockLen = ::std::min< sal_Size >( nDatLeft, sizeof(pnDummy) );
+ bResult = Decode( pnDummy, nBlockLen, pnDummy, nBlockLen );
+ nDatLeft -= nBlockLen;
+ }
+
+ return bResult;
+}
+
+void MSCodec_Std97::GetDigestFromSalt( const sal_uInt8 pSaltData[16], sal_uInt8 pDigest[16] )
+{
+ sal_uInt8 pBuffer[64];
+ sal_uInt8 pDigestLocal[16];
+
+ // Decode SaltData into Buffer.
+ rtl_cipher_decode (
+ m_hCipher, pSaltData, 16, pBuffer, sizeof(pBuffer));
+
+ // set the 129th bit to make the buffer 128-bit in length.
+ pBuffer[16] = 0x80;
+
+ // erase the rest of the buffer with zeros.
+ (void)memset (pBuffer + 17, 0, sizeof(pBuffer) - 17);
+
+ // set the 441st bit.
+ pBuffer[56] = 0x80;
+
+ // Fill raw digest of Buffer into Digest.
+ rtl_digest_updateMD5 (
+ m_hDigest, pBuffer, sizeof(pBuffer));
+ rtl_digest_rawMD5 (
+ m_hDigest, pDigestLocal, sizeof(pDigestLocal));
+
+ memcpy(pDigest, pDigestLocal, 16);
+}
+
+void MSCodec_Std97::GetEncryptKey (
+ const sal_uInt8 pSalt[16],
+ sal_uInt8 pSaltData[16],
+ sal_uInt8 pSaltDigest[16])
+{
+ if (InitCipher(0))
+ {
+ sal_uInt8 pDigest[RTL_DIGEST_LENGTH_MD5];
+ sal_uInt8 pBuffer[64];
+
+ rtl_cipher_encode (
+ m_hCipher, pSalt, 16, pSaltData, sizeof(pBuffer));
+
+ (void)memcpy( pBuffer, pSalt, 16 );
+
+ pBuffer[16] = 0x80;
+ (void)memset (pBuffer + 17, 0, sizeof(pBuffer) - 17);
+ pBuffer[56] = 0x80;
+
+ rtl_digest_updateMD5 (
+ m_hDigest, pBuffer, sizeof(pBuffer));
+ rtl_digest_rawMD5 (
+ m_hDigest, pDigest, sizeof(pDigest));
+
+ rtl_cipher_encode (
+ m_hCipher, pDigest, 16, pSaltDigest, 16);
+
+ (void)memset (pBuffer, 0, sizeof(pBuffer));
+ (void)memset (pDigest, 0, sizeof(pDigest));
+ }
+}
+
+// ============================================================================
+
+} // namespace svx
+
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
new file mode 100644
index 000000000000..05411501218e
--- /dev/null
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -0,0 +1,8151 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
+#include <com/sun/star/embed/Aspects.hpp>
+
+#include <math.h>
+#include <limits.h>
+#include <vector>
+#include <osl/endian.h>
+#include <tools/solar.h> // UINTXX
+#include <rtl/math.hxx>
+
+#include <sot/clsids.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <unotools/streamwrap.hxx>
+#include <comphelper/processfactory.hxx>
+#include <sot/exchange.hxx>
+#include <sot/storinfo.hxx>
+#include <vcl/cvtgrf.hxx>
+#include "viscache.hxx"
+
+// SvxItem-Mapping. Wird benoetigt um die SvxItem-Header erfolgreich zu includen
+#include <editeng/eeitem.hxx>
+#include <editeng/editdata.hxx>
+#include <svl/urihelper.hxx>
+#include <tools/stream.hxx>
+#include <tools/debug.hxx>
+#include <tools/zcodec.hxx>
+#include <unotools/ucbstreamhelper.hxx>
+#include <unotools/localfilehelper.hxx>
+#include <filter/msfilter/escherex.hxx>
+#include <basegfx/range/b2drange.hxx>
+#include <com/sun/star/container/XIdentifierContainer.hpp>
+#include <com/sun/star/drawing/XGluePointsSupplier.hpp>
+#include <com/sun/star/drawing/Position3D.hpp>
+#include <com/sun/star/drawing/Direction3D.hpp>
+#include <com/sun/star/drawing/GluePoint2.hpp>
+#include <com/sun/star/drawing/XShapes.hpp>
+#include <editeng/charscaleitem.hxx>
+#include <editeng/kernitem.hxx>
+#include <svtools/filter.hxx>
+#include <tools/string.hxx>
+#include <tools/urlobj.hxx>
+#include <vcl/virdev.hxx>
+#include <vcl/bmpacc.hxx>
+#include <sot/storage.hxx>
+#include <sfx2/docfac.hxx>
+#include <sfx2/docfilt.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/fcontnr.hxx>
+#include <sfx2/module.hxx>
+#include <svx/sdgcpitm.hxx>
+#include <svx/sdgmoitm.hxx>
+#include <editeng/tstpitem.hxx>
+#include <svx/fmmodel.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/svdogrp.hxx>
+#include <svx/svdograf.hxx>
+#include <svx/svdotext.hxx>
+#include <svx/svdorect.hxx>
+#include <svx/svdocapt.hxx>
+#include <svx/svdoedge.hxx>
+#include <svx/svdocirc.hxx>
+#include <svx/svdoutl.hxx>
+#include <svx/svdoole2.hxx>
+#include <svx/svdopath.hxx>
+#include <editeng/frmdir.hxx>
+#include <editeng/frmdiritem.hxx>
+#include <svx/svdtrans.hxx>
+#include <svx/sxenditm.hxx>
+#include <svx/sdgluitm.hxx>
+#include <editeng/fhgtitem.hxx>
+#include <editeng/wghtitem.hxx>
+#include <editeng/postitem.hxx>
+#include <editeng/udlnitem.hxx>
+#include <editeng/crsditem.hxx>
+#include <editeng/shdditem.hxx>
+#include <editeng/fontitem.hxx>
+#include <editeng/colritem.hxx>
+#include <svx/sxekitm.hxx>
+#include <editeng/bulitem.hxx>
+#include <svx/polysc3d.hxx>
+#include <svx/extrud3d.hxx>
+#include "svx/svditer.hxx"
+#include <svx/xpoly.hxx>
+#include "svx/xattr.hxx"
+#include <filter/msfilter/msdffimp.hxx> // extern sichtbare Header-Datei
+#include <editeng/outliner.hxx>
+#include <editeng/outlobj.hxx>
+#include <editeng/editobj.hxx>
+#include <editeng/editeng.hxx>
+#include "svx/gallery.hxx"
+#include <com/sun/star/drawing/ShadeMode.hpp>
+#include <svl/itempool.hxx>
+#include <vcl/svapp.hxx>
+#include <svx/svx3ditems.hxx>
+#include <svx/svdoashp.hxx>
+#include <svx/sdasaitm.hxx>
+#include <ucbhelper/content.hxx>
+#include <ucbhelper/contentbroker.hxx>
+#include <vos/xception.hxx>
+#ifndef _VOS_NO_NAMESPACE
+using namespace vos;
+#endif
+#include "svx/EnhancedCustomShapeTypeNames.hxx"
+#include "svx/EnhancedCustomShapeGeometry.hxx"
+#include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeParameterType.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeGluePointType.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeSegmentCommand.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeTextFrame.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeTextPathMode.hpp>
+#include <com/sun/star/beans/PropertyValues.hpp>
+#include <com/sun/star/drawing/ProjectionMode.hpp>
+#include "svx/EnhancedCustomShape2d.hxx"
+
+using namespace ::com::sun::star ;
+using namespace ::com::sun::star::drawing;
+using namespace uno ;
+using namespace beans ;
+using namespace drawing ;
+using namespace container ;
+
+#define ITEMVALUE(ItemSet,Id,Cast) ((const Cast&)(ItemSet).Get(Id)).GetValue()
+
+// static counter for OLE-Objects
+static sal_uInt32 nMSOleObjCntr = 0;
+#define MSO_OLE_Obj "MSO_OLE_Obj"
+
+
+/*************************************************************************/
+BOOL Impl_OlePres::Read( SvStream & rStm )
+{
+ ULONG nBeginPos = rStm.Tell();
+ INT32 n;
+ rStm >> n;
+ if( n != -1 )
+ {
+ pBmp = new Bitmap;
+ rStm >> *pBmp;
+ if( rStm.GetError() == SVSTREAM_OK )
+ {
+ nFormat = FORMAT_BITMAP;
+ aSize = pBmp->GetPrefSize();
+ MapMode aMMSrc;
+ if( !aSize.Width() || !aSize.Height() )
+ {
+ // letzte Chance
+ aSize = pBmp->GetSizePixel();
+ aMMSrc = MAP_PIXEL;
+ }
+ else
+ aMMSrc = pBmp->GetPrefMapMode();
+ MapMode aMMDst( MAP_100TH_MM );
+ aSize = OutputDevice::LogicToLogic( aSize, aMMSrc, aMMDst );
+ return TRUE;
+ }
+ else
+ {
+ delete pBmp;
+ pBmp = NULL;
+
+ pMtf = new GDIMetaFile();
+ rStm.ResetError();
+ rStm >> *pMtf;
+ if( rStm.GetError() == SVSTREAM_OK )
+ {
+ nFormat = FORMAT_GDIMETAFILE;
+ aSize = pMtf->GetPrefSize();
+ MapMode aMMSrc = pMtf->GetPrefMapMode();
+ MapMode aMMDst( MAP_100TH_MM );
+ aSize = OutputDevice::LogicToLogic( aSize, aMMSrc, aMMDst );
+ return TRUE;
+ }
+ else
+ {
+ delete pMtf;
+ pMtf = NULL;
+ }
+ }
+
+ }
+
+ rStm.ResetError();
+ rStm.Seek( nBeginPos );
+ nFormat = ReadClipboardFormat( rStm );
+ // JobSetup, bzw. TargetDevice ueberlesen
+ // Information aufnehmen, um sie beim Schreiben nicht zu verlieren
+ nJobLen = 0;
+ rStm >> nJobLen;
+ if( nJobLen >= 4 )
+ {
+ nJobLen -= 4;
+ if( nJobLen )
+ {
+ pJob = new BYTE[ nJobLen ];
+ rStm.Read( pJob, nJobLen );
+ }
+ }
+ else
+ {
+ rStm.SetError( SVSTREAM_GENERALERROR );
+ return FALSE;
+ }
+ UINT32 nAsp;
+ rStm >> nAsp;
+ USHORT nSvAsp = USHORT( nAsp );
+ SetAspect( nSvAsp );
+ rStm.SeekRel( 4 ); //L-Index ueberlesen
+ rStm >> nAdvFlags;
+ rStm.SeekRel( 4 ); //Compression
+ UINT32 nWidth = 0;
+ UINT32 nHeight = 0;
+ UINT32 nSize = 0;
+ rStm >> nWidth >> nHeight >> nSize;
+ aSize.Width() = nWidth;
+ aSize.Height() = nHeight;
+
+ if( nFormat == FORMAT_GDIMETAFILE )
+ {
+ pMtf = new GDIMetaFile();
+ ReadWindowMetafile( rStm, *pMtf, NULL );
+ }
+ else if( nFormat == FORMAT_BITMAP )
+ {
+ pBmp = new Bitmap();
+ rStm >> *pBmp;
+ }
+ else
+ {
+ BYTE * p = new BYTE[ nSize ];
+ rStm.Read( p, nSize );
+ delete [] p;
+ return FALSE;
+ }
+ return TRUE;
+}
+
+/************************************************************************/
+void Impl_OlePres::Write( SvStream & rStm )
+{
+ WriteClipboardFormat( rStm, FORMAT_GDIMETAFILE );
+ rStm << (INT32)(nJobLen +4); // immer leeres TargetDevice
+ if( nJobLen )
+ rStm.Write( pJob, nJobLen );
+ rStm << (UINT32)nAspect;
+ rStm << (INT32)-1; //L-Index immer -1
+ rStm << (INT32)nAdvFlags;
+ rStm << (INT32)0; //Compression
+ rStm << (INT32)aSize.Width();
+ rStm << (INT32)aSize.Height();
+ ULONG nPos = rStm.Tell();
+ rStm << (INT32)0;
+
+ if( GetFormat() == FORMAT_GDIMETAFILE && pMtf )
+ {
+ // Immer auf 1/100 mm, bis Mtf-Loesung gefunden
+ // Annahme (keine Skalierung, keine Org-Verschiebung)
+ DBG_ASSERT( pMtf->GetPrefMapMode().GetScaleX() == Fraction( 1, 1 ),
+ "X-Skalierung im Mtf" );
+ DBG_ASSERT( pMtf->GetPrefMapMode().GetScaleY() == Fraction( 1, 1 ),
+ "Y-Skalierung im Mtf" );
+ DBG_ASSERT( pMtf->GetPrefMapMode().GetOrigin() == Point(),
+ "Origin-Verschiebung im Mtf" );
+ MapUnit nMU = pMtf->GetPrefMapMode().GetMapUnit();
+ if( MAP_100TH_MM != nMU )
+ {
+ Size aPrefS( pMtf->GetPrefSize() );
+ Size aS( aPrefS );
+ aS = OutputDevice::LogicToLogic( aS, nMU, MAP_100TH_MM );
+
+ pMtf->Scale( Fraction( aS.Width(), aPrefS.Width() ),
+ Fraction( aS.Height(), aPrefS.Height() ) );
+ pMtf->SetPrefMapMode( MAP_100TH_MM );
+ pMtf->SetPrefSize( aS );
+ }
+ WriteWindowMetafileBits( rStm, *pMtf );
+ }
+ else
+ {
+ DBG_ERROR( "unknown format" );
+ }
+ ULONG nEndPos = rStm.Tell();
+ rStm.Seek( nPos );
+ rStm << (UINT32)(nEndPos - nPos - 4);
+ 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( USHORT 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
+//---------------------------------------------------------------------------
+
+SvStream& operator>>( SvStream& rIn, DffRecordHeader& rRec )
+{
+ rRec.nFilePos = rIn.Tell();
+ UINT16 nTmp(0);
+ rIn >> nTmp;
+ rRec.nImpVerInst = nTmp;
+ rRec.nRecVer = sal::static_int_cast< BYTE >(nTmp & 0x000F);
+ rRec.nRecInstance = nTmp >> 4;
+ rIn >> rRec.nRecType;
+ rIn >> rRec.nRecLen;
+ return rIn;
+}
+
+// Masse fuer dashed lines
+#define LLEN_MIDDLE (450)
+#define LLEN_SPACE_MIDDLE (360)
+#define LLEN_LONG (LLEN_MIDDLE * 2)
+#define LLEN_SPACE_LONG (LLEN_SPACE_MIDDLE + 20)
+#define LLEN_POINT (LLEN_MIDDLE / 4)
+#define LLEN_SPACE_POINT (LLEN_SPACE_MIDDLE / 4)
+
+SvStream& operator>>( SvStream& rIn, DffPropSet& rRec )
+{
+ rRec.InitializePropSet();
+
+ DffRecordHeader aHd;
+ rIn >> aHd;
+ UINT32 nPropCount = aHd.nRecInstance;
+
+ // FilePos der ComplexData merken
+ UINT32 nComplexDataFilePos = rIn.Tell() + ( nPropCount * 6 );
+
+ for( UINT32 nPropNum = 0; nPropNum < nPropCount; nPropNum++ )
+ {
+ sal_uInt16 nTmp;
+ sal_uInt32 nRecType, nContent, nContentEx = 0xffff0000;
+ rIn >> nTmp
+ >> nContent;
+
+ nRecType = nTmp & 0x3fff;
+
+ if ( nRecType > 0x3ff )
+ break;
+ if ( ( nRecType & 0x3f ) == 0x3f )
+ { // clear flags that have to be cleared
+ rRec.mpContents[ nRecType ] &= ( ( nContent >> 16 ) ^ 0xffffffff );
+ // set flags that have to be set
+ rRec.mpContents[ nRecType ] |= nContent;
+ nContentEx |= ( nContent >> 16 );
+ rRec.Replace( nRecType, (void*)nContentEx );
+ }
+ else
+ {
+ DffPropFlags aPropFlag = { 1, 0, 0, 0 };
+ if ( nTmp & 0x4000 )
+ aPropFlag.bBlip = sal_True;
+ if ( nTmp & 0x8000 )
+ aPropFlag.bComplex = sal_True;
+ if ( aPropFlag.bComplex && nContent && ( nComplexDataFilePos < aHd.GetRecEndFilePos() ) )
+ {
+ // normally nContent is the complete size of the complex property,
+ // but this is not always true for IMsoArrays ( what the hell is a IMsoArray ? )
+
+ // I love special threatments :-(
+ if ( ( nRecType == DFF_Prop_pVertices ) || ( nRecType == DFF_Prop_pSegmentInfo )
+ || ( nRecType == DFF_Prop_fillShadeColors ) || ( nRecType == DFF_Prop_lineDashStyle )
+ || ( nRecType == DFF_Prop_pWrapPolygonVertices ) || ( nRecType == DFF_Prop_connectorPoints )
+ || ( nRecType == DFF_Prop_Handles ) || ( nRecType == DFF_Prop_pFormulas )
+ || ( nRecType == DFF_Prop_textRectangles ) )
+ {
+ // now check if the current content size is possible, or 6 bytes too small
+ sal_uInt32 nOldPos = rIn.Tell();
+ sal_Int16 nNumElem, nNumElemReserved, nSize;
+
+ rIn.Seek( nComplexDataFilePos );
+ rIn >> nNumElem >> nNumElemReserved >> nSize;
+ if ( nNumElemReserved >= nNumElem )
+ {
+ // the size of these array elements is nowhere defined,
+ // what if the size is negative ?
+ // ok, we will make it positive and shift it.
+ // for -16 this works
+ if ( nSize < 0 )
+ nSize = ( -nSize ) >> 2;
+ sal_uInt32 nDataSize = (sal_uInt32)( nSize * nNumElem );
+
+ // sometimes the content size is 6 bytes too small (array header information is missing )
+ if ( nDataSize == nContent )
+ nContent += 6;
+
+ // check if array fits into the PropertyContainer
+ if ( ( nComplexDataFilePos + nContent ) > aHd.GetRecEndFilePos() )
+ nContent = 0;
+ }
+ else
+ nContent = 0;
+ rIn.Seek( nOldPos );
+ }
+ if ( nContent )
+ {
+ nContentEx = nComplexDataFilePos; // insert the filepos of this property;
+ nComplexDataFilePos += nContent; // store filepos, that is used for the next complex property
+ }
+ else // a complex property needs content
+ aPropFlag.bSet = sal_False; // otherwise something is wrong
+ }
+ rRec.mpContents[ nRecType ] = nContent;
+ rRec.mpFlags[ nRecType ] = aPropFlag;
+ rRec.Insert( nRecType, (void*)nContentEx );
+ }
+ }
+ aHd.SeekToEndOfRecord( rIn );
+ return rIn;
+}
+
+void DffPropSet::InitializePropSet() const
+{
+ /*
+ cmc:
+ " Boolean properties are grouped in bitfields by property set; note that
+ the Boolean properties in each property set are contiguous. They are saved
+ under the property ID of the last Boolean property in the set, and are
+ placed in the value field in reverse order starting with the last property
+ in the low bit. "
+
+ e.g.
+
+ fEditedWrap
+ fBehindDocument
+ fOnDblClickNotify
+ fIsButton
+ fOneD
+ fHidden
+ fPrint
+
+ are all part of a group and all are by default false except for fPrint,
+ which equates to a default bit sequence for the group of 0000001 -> 0x1
+
+ If at a later stage word sets fBehindDocument away from the default it
+ will be done by having a property named fPrint whose bitsequence will have
+ the fBehindDocument bit set. e.g. a DFF_Prop_fPrint with value 0x200020
+ has set bit 6 on so as to enable fBehindDocument (as well as disabling
+ everything else)
+ */
+
+ memset( ( (DffPropSet*) this )->mpFlags, 0, 0x400 * sizeof(DffPropFlags) );
+ ( (DffPropSet*) this )->Clear();
+
+ DffPropFlags nFlags = { 1, 0, 0, 1 };
+
+ ( (DffPropSet*) this )->mpContents[ DFF_Prop_LockAgainstGrouping ] = 0x0000; //0x01ff0000;
+ ( (DffPropSet*) this )->mpFlags[ DFF_Prop_LockAgainstGrouping ] = nFlags;
+ ( (DffPropSet*) this )->Insert( DFF_Prop_LockAgainstGrouping, (void*)0xffff0000 );
+
+ ( (DffPropSet*) this )->mpContents[ DFF_Prop_FitTextToShape ] = 0x0010; //0x001f0010;
+ ( (DffPropSet*) this )->mpFlags[ DFF_Prop_FitTextToShape ] = nFlags;
+ ( (DffPropSet*) this )->Insert( DFF_Prop_FitTextToShape, (void*)0xffff0000 );
+
+ ( (DffPropSet*) this )->mpContents[ DFF_Prop_gtextFStrikethrough ] = 0x0000; //0xffff0000;
+ ( (DffPropSet*) this )->mpFlags[ DFF_Prop_gtextFStrikethrough ] = nFlags;
+ ( (DffPropSet*) this )->Insert( DFF_Prop_gtextFStrikethrough, (void*)0xffff0000 );
+
+ ( (DffPropSet*) this )->mpContents[ DFF_Prop_pictureActive ] = 0x0000; //0x000f0000;
+ ( (DffPropSet*) this )->mpFlags[ DFF_Prop_pictureActive ] = nFlags;
+ ( (DffPropSet*) this )->Insert( DFF_Prop_pictureActive, (void*)0xffff0000 );
+
+ ( (DffPropSet*) this )->mpContents[ DFF_Prop_fFillOK ] = 0x0039; //0x003f0039;
+ ( (DffPropSet*) this )->mpFlags[ DFF_Prop_fFillOK ] = nFlags;
+ ( (DffPropSet*) this )->Insert( DFF_Prop_fFillOK, (void*)0xffff0000 );
+
+ ( (DffPropSet*) this )->mpContents[ DFF_Prop_fNoFillHitTest ] = 0x001c; //0x001f001c;
+ ( (DffPropSet*) this )->mpFlags[ DFF_Prop_fNoFillHitTest ] = nFlags;
+ ( (DffPropSet*) this )->Insert( DFF_Prop_fNoFillHitTest, (void*)0xffff0000 );
+
+ ( (DffPropSet*) this )->mpContents[ DFF_Prop_fNoLineDrawDash ] = 0x001e; //0x001f000e;
+ ( (DffPropSet*) this )->mpFlags[ DFF_Prop_fNoLineDrawDash ] = nFlags;
+ ( (DffPropSet*) this )->Insert( DFF_Prop_fNoLineDrawDash, (void*)0xffff0000 );
+
+ ( (DffPropSet*) this )->mpContents[ DFF_Prop_fshadowObscured ] = 0x0000; //0x00030000;
+ ( (DffPropSet*) this )->mpFlags[ DFF_Prop_fshadowObscured ] = nFlags;
+ ( (DffPropSet*) this )->Insert( DFF_Prop_fshadowObscured, (void*)0xffff0000 );
+
+ ( (DffPropSet*) this )->mpContents[ DFF_Prop_fPerspective ] = 0x0000; //0x00010000;
+ ( (DffPropSet*) this )->mpFlags[ DFF_Prop_fPerspective ] = nFlags;
+ ( (DffPropSet*) this )->Insert( DFF_Prop_fPerspective, (void*)0xffff0000 );
+
+ ( (DffPropSet*) this )->mpContents[ DFF_Prop_fc3DLightFace ] = 0x0001; //0x000f0001;
+ ( (DffPropSet*) this )->mpFlags[ DFF_Prop_fc3DLightFace ] = nFlags;
+ ( (DffPropSet*) this )->Insert( DFF_Prop_fc3DLightFace, (void*)0xffff0000 );
+
+ ( (DffPropSet*) this )->mpContents[ DFF_Prop_fc3DFillHarsh ] = 0x0016; //0x001f0016;
+ ( (DffPropSet*) this )->mpFlags[ DFF_Prop_fc3DFillHarsh ] = nFlags;
+ ( (DffPropSet*) this )->Insert( DFF_Prop_fc3DFillHarsh, (void*)0xffff0000 );
+
+ ( (DffPropSet*) this )->mpContents[ DFF_Prop_fBackground ] = 0x0000; //0x001f0000;
+ ( (DffPropSet*) this )->mpFlags[ DFF_Prop_fBackground ] = nFlags;
+ ( (DffPropSet*) this )->Insert( DFF_Prop_fBackground, (void*)0xffff0000 );
+
+ ( (DffPropSet*) this )->mpContents[ DFF_Prop_fCalloutLengthSpecified ] = 0x0010; //0x00ef0010;
+ ( (DffPropSet*) this )->mpFlags[ DFF_Prop_fCalloutLengthSpecified ] = nFlags;
+ ( (DffPropSet*) this )->Insert( DFF_Prop_fCalloutLengthSpecified, (void*)0xffff0000 );
+
+ ( (DffPropSet*) this )->mpContents[ DFF_Prop_fPrint ] = 0x0001; //0x00ef0001;
+ ( (DffPropSet*) this )->mpFlags[ DFF_Prop_fPrint ] = nFlags;
+ ( (DffPropSet*) this )->Insert( DFF_Prop_fPrint, (void*)0xffff0000 );
+
+ ( (DffPropSet*) this )->mpContents[ DFF_Prop_fillColor ] = 0xffffff;
+ ( (DffPropSet*) this )->mpFlags[ DFF_Prop_fillColor ] = nFlags;
+ ( (DffPropSet*) this )->Insert( DFF_Prop_fillColor, (void*)0xffff0000 );
+}
+
+void DffPropSet::Merge( DffPropSet& rMaster ) const
+{
+ for ( void* pDummy = rMaster.First(); pDummy; pDummy = rMaster.Next() )
+ {
+ UINT32 nRecType = rMaster.GetCurKey();
+ if ( ( nRecType & 0x3f ) == 0x3f ) // this is something called FLAGS
+ {
+ UINT32 nCurrentFlags = mpContents[ nRecType ];
+ UINT32 nMergeFlags = rMaster.mpContents[ nRecType ];
+ nMergeFlags &= ( nMergeFlags >> 16 ) | 0xffff0000; // clearing low word
+ nMergeFlags &= ( ( nCurrentFlags & 0xffff0000 ) // remove allready hard set
+ | ( nCurrentFlags >> 16 ) ) ^ 0xffffffff; // attributes from mergeflags
+ nCurrentFlags &= ( ( nMergeFlags & 0xffff0000 ) // apply zero master bits
+ | ( nMergeFlags >> 16 ) ) ^ 0xffffffff;
+ nCurrentFlags |= (UINT16)nMergeFlags; // apply filled master bits
+ ( (DffPropSet*) this )->mpContents[ nRecType ] = nCurrentFlags;
+
+
+ sal_uInt32 nNewContentEx = (sal_uInt32)(sal_uIntPtr)rMaster.GetCurObject();
+ if ( ((DffPropSet*)this)->Seek( nRecType ) )
+ nNewContentEx |= (sal_uInt32)(sal_uIntPtr)GetCurObject();
+ ( (DffPropSet*) this )->Replace( nRecType, (void*)nNewContentEx );
+ }
+ else
+ {
+ if ( !IsProperty( nRecType ) || !IsHardAttribute( nRecType ) )
+ {
+ ( (DffPropSet*) this )->mpContents[ nRecType ] = rMaster.mpContents[ nRecType ];
+ DffPropFlags nFlags( rMaster.mpFlags[ nRecType ] );
+ nFlags.bSoftAttr = TRUE;
+ ( (DffPropSet*) this )->mpFlags[ nRecType ] = nFlags;
+ ( (DffPropSet*) this )->Insert( nRecType, pDummy );
+ }
+ }
+ }
+}
+
+BOOL DffPropSet::IsHardAttribute( UINT32 nId ) const
+{
+ BOOL bRetValue = TRUE;
+ nId &= 0x3ff;
+ if ( ( nId & 0x3f ) >= 48 ) // is this a flag id
+ {
+ if ( ((DffPropSet*)this)->Seek( nId | 0x3f ) )
+ {
+ sal_uInt32 nContentEx = (sal_uInt32)(sal_uIntPtr)GetCurObject();
+ bRetValue = ( nContentEx & ( 1 << ( 0xf - ( nId & 0xf ) ) ) ) != 0;
+ }
+ }
+ else
+ bRetValue = ( mpFlags[ nId ].bSoftAttr == 0 );
+ return bRetValue;
+};
+
+UINT32 DffPropSet::GetPropertyValue( UINT32 nId, UINT32 nDefault ) const
+{
+ nId &= 0x3ff;
+ return ( mpFlags[ nId ].bSet ) ? mpContents[ nId ] : nDefault;
+};
+
+bool DffPropSet::GetPropertyBool( UINT32 nId, bool bDefault ) const
+{
+ UINT32 nBaseId = nId | 31; // base ID to get the UINT32 property value
+ UINT32 nMask = 1 << (nBaseId - nId); // bit mask of the boolean property
+
+ UINT32 nPropValue = GetPropertyValue( nBaseId, bDefault ? nMask : 0 );
+ return (nPropValue & nMask) != 0;
+}
+
+::rtl::OUString DffPropSet::GetPropertyString( UINT32 nId, SvStream& rStrm ) const
+{
+ sal_Size nOldPos = rStrm.Tell();
+ ::rtl::OUStringBuffer aBuffer;
+ sal_uInt32 nBufferSize = GetPropertyValue( nId );
+ if( (nBufferSize > 0) && SeekToContent( nId, rStrm ) )
+ {
+ sal_Int32 nStrLen = static_cast< sal_Int32 >( nBufferSize / 2 );
+ aBuffer.ensureCapacity( nStrLen );
+ for( sal_Int32 nCharIdx = 0; nCharIdx < nStrLen; ++nCharIdx )
+ {
+ sal_uInt16 nChar = 0;
+ rStrm >> nChar;
+ if( nChar > 0 )
+ aBuffer.append( static_cast< sal_Unicode >( nChar ) );
+ else
+ break;
+ }
+ }
+ rStrm.Seek( nOldPos );
+ return aBuffer.makeStringAndClear();
+}
+
+void DffPropSet::SetPropertyValue( UINT32 nId, UINT32 nValue ) const
+{
+ if ( !mpFlags[ nId ].bSet )
+ {
+ ( (DffPropSet*) this )->Insert( nId, (void*)nValue );
+ ( (DffPropSet*) this )->mpFlags[ nId ].bSet = TRUE;
+ }
+ ( (DffPropSet*) this )->mpContents[ nId ] = nValue;
+};
+
+BOOL DffPropSet::SeekToContent( UINT32 nRecType, SvStream& rStrm ) const
+{
+ nRecType &= 0x3ff;
+ if ( mpFlags[ nRecType ].bSet )
+ {
+ if ( mpFlags[ nRecType ].bComplex )
+ {
+ if ( ((DffPropSet*)this)->Seek( nRecType ) )
+ {
+ sal_uInt32 nOffset = (sal_uInt32)(sal_uIntPtr)GetCurObject();
+ if ( nOffset && ( ( nOffset & 0xffff0000 ) != 0xffff0000 ) )
+ {
+ rStrm.Seek( nOffset );
+ return TRUE;
+ }
+ }
+ }
+ }
+ return FALSE;
+}
+
+DffPropertyReader::DffPropertyReader( const SvxMSDffManager& rMan ) :
+ rManager( rMan ),
+ pDefaultPropSet( NULL )
+{
+ InitializePropSet();
+}
+
+void DffPropertyReader::SetDefaultPropSet( SvStream& rStCtrl, UINT32 nOffsDgg ) const
+{
+ delete pDefaultPropSet;
+ UINT32 nMerk = rStCtrl.Tell();
+ rStCtrl.Seek( nOffsDgg );
+ DffRecordHeader aRecHd;
+ rStCtrl >> aRecHd;
+ if ( aRecHd.nRecType == DFF_msofbtDggContainer )
+ {
+ if ( rManager.SeekToRec( rStCtrl, DFF_msofbtOPT, aRecHd.GetRecEndFilePos() ) )
+ {
+ ( (DffPropertyReader*) this )->pDefaultPropSet = new DffPropSet;
+ rStCtrl >> *pDefaultPropSet;
+ }
+ }
+ rStCtrl.Seek( nMerk );
+}
+
+#ifdef DBG_CUSTOMSHAPE
+void DffPropertyReader::ReadPropSet( SvStream& rIn, void* pClientData, UINT32 nShapeId ) const
+#else
+void DffPropertyReader::ReadPropSet( SvStream& rIn, void* pClientData ) const
+#endif
+{
+ ULONG nFilePos = rIn.Tell();
+ rIn >> (DffPropertyReader&)*this;
+
+ if ( IsProperty( DFF_Prop_hspMaster ) )
+ {
+ if ( rManager.SeekToShape( rIn, pClientData, GetPropertyValue( DFF_Prop_hspMaster ) ) )
+ {
+ DffRecordHeader aRecHd;
+ rIn >> aRecHd;
+ if ( rManager.SeekToRec( rIn, DFF_msofbtOPT, aRecHd.GetRecEndFilePos() ) )
+ {
+ DffPropSet aMasterPropSet;
+ rIn >> aMasterPropSet;
+ Merge( aMasterPropSet );
+ }
+ }
+ }
+// if ( pDefaultPropSet )
+// Merge( *( pDefaultPropSet ) );
+
+ ( (DffPropertyReader*) this )->mnFix16Angle = Fix16ToAngle( GetPropertyValue( DFF_Prop_Rotation, 0 ) );
+
+#ifdef DBG_CUSTOMSHAPE
+
+ String aURLStr;
+
+ if( ::utl::LocalFileHelper::ConvertPhysicalNameToURL( String( RTL_CONSTASCII_STRINGPARAM( "d:\\ashape.dbg" ) ), aURLStr ) )
+ {
+ SvStream* pOut = ::utl::UcbStreamHelper::CreateStream( aURLStr, STREAM_WRITE );
+
+ if( pOut )
+ {
+ pOut->Seek( STREAM_SEEK_TO_END );
+
+ if ( IsProperty( DFF_Prop_adjustValue ) || IsProperty( DFF_Prop_pVertices ) )
+ {
+ pOut->WriteLine( "" );
+ ByteString aString( "ShapeId: " );
+ aString.Append( ByteString::CreateFromInt32( nShapeId ) );
+ pOut->WriteLine( aString );
+ }
+ for ( sal_uInt32 i = DFF_Prop_adjustValue; i <= DFF_Prop_adjust10Value; i++ )
+ {
+ if ( IsProperty( i ) )
+ {
+ ByteString aString( "Prop_adjustValue" );
+ aString.Append( ByteString::CreateFromInt32( ( i - DFF_Prop_adjustValue ) + 1 ) );
+ aString.Append( ":" );
+ aString.Append( ByteString::CreateFromInt32( GetPropertyValue( i ) ) );
+ pOut->WriteLine( aString );
+ }
+ }
+ sal_Int32 i;
+ for ( i = 320; i < 383; i++ )
+ {
+ if ( ( i >= DFF_Prop_adjustValue ) && ( i <= DFF_Prop_adjust10Value ) )
+ continue;
+ if ( IsProperty( i ) )
+ {
+ if ( SeekToContent( i, rIn ) )
+ {
+ INT32 nLen = (INT32)GetPropertyValue( i );
+ if ( nLen )
+ {
+ pOut->WriteLine( "" );
+ ByteString aDesc( "Property:" );
+ aDesc.Append( ByteString::CreateFromInt32( i ) );
+ aDesc.Append( ByteString( " Size:" ) );
+ aDesc.Append( ByteString::CreateFromInt32( nLen ) );
+ pOut->WriteLine( aDesc );
+ INT16 nNumElem, nNumElemMem, nNumSize;
+ rIn >> nNumElem >> nNumElemMem >> nNumSize;
+ aDesc = ByteString( "Entries: " );
+ aDesc.Append( ByteString::CreateFromInt32( nNumElem ) );
+ aDesc.Append( ByteString( " Size:" ) );
+ aDesc.Append( ByteString::CreateFromInt32( nNumSize ) );
+ pOut->WriteLine( aDesc );
+ if ( nNumSize < 0 )
+ nNumSize = ( ( -nNumSize ) >> 2 );
+ if ( !nNumSize )
+ nNumSize = 16;
+ nLen -= 6;
+ while ( nLen > 0 )
+ {
+ ByteString aString;
+ for ( UINT32 j = 0; nLen && ( j < ( nNumSize >> 1 ) ); j++ )
+ {
+ for ( UINT32 k = 0; k < 2; k++ )
+ {
+ if ( nLen )
+ {
+ BYTE nVal;
+ rIn >> nVal;
+ if ( ( nVal >> 4 ) > 9 )
+ *pOut << (BYTE)( ( nVal >> 4 ) + 'A' - 10 );
+ else
+ *pOut << (BYTE)( ( nVal >> 4 ) + '0' );
+
+ if ( ( nVal & 0xf ) > 9 )
+ *pOut << (BYTE)( ( nVal & 0xf ) + 'A' - 10 );
+ else
+ *pOut << (BYTE)( ( nVal & 0xf ) + '0' );
+
+ nLen--;
+ }
+ }
+ *pOut << (char)( ' ' );
+ }
+ pOut->WriteLine( aString );
+ }
+ }
+ }
+ else
+ {
+ ByteString aString( "Property" );
+ aString.Append( ByteString::CreateFromInt32( i ) );
+ aString.Append( ":" );
+ aString.Append( ByteString::CreateFromInt32( GetPropertyValue( i ) ) );
+ pOut->WriteLine( aString );
+ }
+ }
+ }
+
+ delete pOut;
+ }
+ }
+
+#endif
+
+ rIn.Seek( nFilePos );
+}
+
+
+INT32 DffPropertyReader::Fix16ToAngle( INT32 nContent ) const
+{
+ INT32 nAngle = 0;
+ if ( nContent )
+ {
+ nAngle = ( (INT16)( nContent >> 16) * 100L ) + ( ( ( nContent & 0x0000ffff) * 100L ) >> 16 );
+ nAngle = NormAngle360( -nAngle );
+ }
+ return nAngle;
+}
+
+DffPropertyReader::~DffPropertyReader()
+{
+ delete pDefaultPropSet;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SvStream& operator>>( SvStream& rIn, SvxMSDffConnectorRule& rRule )
+{
+ rIn >> rRule.nRuleId
+ >> rRule.nShapeA
+ >> rRule.nShapeB
+ >> rRule.nShapeC
+ >> rRule.ncptiA
+ >> rRule.ncptiB;
+
+ return rIn;
+}
+
+SvxMSDffSolverContainer::SvxMSDffSolverContainer()
+{
+}
+
+SvxMSDffSolverContainer::~SvxMSDffSolverContainer()
+{
+ for ( SvxMSDffConnectorRule* pPtr = (SvxMSDffConnectorRule*)aCList.First();
+ pPtr; pPtr = (SvxMSDffConnectorRule*)aCList.Next() )
+ delete pPtr;
+}
+
+SvStream& operator>>( SvStream& rIn, SvxMSDffSolverContainer& rContainer )
+{
+ DffRecordHeader aHd;
+ rIn >> aHd;
+ if ( aHd.nRecType == DFF_msofbtSolverContainer )
+ {
+ DffRecordHeader aCRule;
+ while ( ( rIn.GetError() == 0 ) && ( rIn.Tell() < aHd.GetRecEndFilePos() ) )
+ {
+ rIn >> aCRule;
+ if ( aCRule.nRecType == DFF_msofbtConnectorRule )
+ {
+ SvxMSDffConnectorRule* pRule = new SvxMSDffConnectorRule;
+ rIn >> *pRule;
+ rContainer.aCList.Insert( pRule, LIST_APPEND );
+ }
+ aCRule.SeekToEndOfRecord( rIn );
+ }
+ }
+ return rIn;
+}
+
+void SvxMSDffManager::SolveSolver( const SvxMSDffSolverContainer& rSolver )
+{
+ sal_Int32 i, nCnt;
+ for ( i = 0, nCnt = rSolver.aCList.Count(); i < nCnt; i++ )
+ {
+ SvxMSDffConnectorRule* pPtr = (SvxMSDffConnectorRule*)rSolver.aCList.GetObject( i );
+ if ( pPtr->pCObj )
+ {
+ for ( int nN = 0; nN < 2; nN++ )
+ {
+ SdrObject* pO;
+ sal_uInt32 nC, nSpFlags;
+ sal_Bool bTail;
+ if ( !nN )
+ {
+ bTail = sal_True;
+ pO = pPtr->pAObj;
+ nC = pPtr->ncptiA;
+ nSpFlags = pPtr->nSpFlagsA;
+ }
+ else
+ {
+ bTail = sal_False;
+ pO = pPtr->pBObj;
+ nC = pPtr->ncptiB;
+ nSpFlags = pPtr->nSpFlagsB;
+ }
+ if ( pO )
+ {
+ Any aAny;
+ SdrGluePoint aGluePoint;
+ Reference< XShape > aXShape( pO->getUnoShape(), UNO_QUERY );
+ Reference< XShape > aXConnector( pPtr->pCObj->getUnoShape(), UNO_QUERY );
+ SdrGluePointList* pList = pO->ForceGluePointList();
+
+ sal_Bool bValidGluePoint = sal_False;
+ sal_Int32 nId = nC;
+ sal_uInt32 nInventor = pO->GetObjInventor();
+
+ if( nInventor == SdrInventor )
+ {
+ sal_uInt32 nObjId = pO->GetObjIdentifier();
+ switch( nObjId )
+ {
+ case OBJ_GRUP :
+ case OBJ_GRAF :
+ case OBJ_RECT :
+ case OBJ_TEXT :
+ case OBJ_PAGE :
+ case OBJ_TEXTEXT :
+ case OBJ_wegFITTEXT :
+ case OBJ_wegFITALLTEXT :
+ case OBJ_TITLETEXT :
+ case OBJ_OUTLINETEXT :
+ {
+ if ( nC & 1 )
+ {
+ if ( nSpFlags & SP_FFLIPH )
+ nC ^= 2; // 1 <-> 3
+ }
+ else
+ {
+ if ( nSpFlags & SP_FFLIPV )
+ nC ^= 1; // 0 <-> 2
+ }
+ switch( nC )
+ {
+ case 0 :
+ nId = 0; // SDRVERTALIGN_TOP;
+ break;
+ case 1 :
+ nId = 3; // SDRHORZALIGN_RIGHT;
+ break;
+ case 2 :
+ nId = 2; // SDRVERTALIGN_BOTTOM;
+ break;
+ case 3 :
+ nId = 1; // SDRHORZALIGN_LEFT;
+ break;
+ }
+ if ( nId <= 3 )
+ bValidGluePoint = sal_True;
+ }
+ break;
+ case OBJ_POLY :
+ case OBJ_PLIN :
+ case OBJ_LINE :
+ case OBJ_PATHLINE :
+ case OBJ_PATHFILL :
+ case OBJ_FREELINE :
+ case OBJ_FREEFILL :
+ case OBJ_SPLNLINE :
+ case OBJ_SPLNFILL :
+ case OBJ_PATHPOLY :
+ case OBJ_PATHPLIN :
+ {
+ if ( pList && ( pList->GetCount() > nC ) )
+ {
+ bValidGluePoint = sal_True;
+ nId = (sal_Int32)((*pList)[ (sal_uInt16)nC].GetId() + 3 );
+ }
+ else
+ {
+ sal_Bool bNotFound = sal_True;
+
+ PolyPolygon aPolyPoly( EscherPropertyContainer::GetPolyPolygon( aXShape ) );
+ sal_uInt16 k, j, nPolySize = aPolyPoly.Count();
+ if ( nPolySize )
+ {
+ sal_uInt32 nPointCount = 0;
+ Rectangle aBoundRect( aPolyPoly.GetBoundRect() );
+ if ( aBoundRect.GetWidth() && aBoundRect.GetHeight() )
+ {
+ for ( k = 0; bNotFound && ( k < nPolySize ); k++ )
+ {
+ const Polygon& rPolygon = aPolyPoly.GetObject( k );
+ for ( j = 0; bNotFound && ( j < rPolygon.GetSize() ); j++ )
+ {
+ PolyFlags eFlags = rPolygon.GetFlags( j );
+ if ( eFlags == POLY_NORMAL )
+ {
+ if ( nC == nPointCount )
+ {
+ const Point& rPoint = rPolygon.GetPoint( j );
+ double fXRel = rPoint.X() - aBoundRect.Left();
+ double fYRel = rPoint.Y() - aBoundRect.Top();
+ sal_Int32 nWidth = aBoundRect.GetWidth();
+ if ( !nWidth )
+ nWidth = 1;
+ sal_Int32 nHeight= aBoundRect.GetHeight();
+ if ( !nHeight )
+ nHeight = 1;
+ fXRel /= (double)nWidth;
+ fXRel *= 10000;
+ fYRel /= (double)nHeight;
+ fYRel *= 10000;
+ aGluePoint.SetPos( Point( (sal_Int32)fXRel, (sal_Int32)fYRel ) );
+ aGluePoint.SetPercent( sal_True );
+ aGluePoint.SetAlign( SDRVERTALIGN_TOP | SDRHORZALIGN_LEFT );
+ aGluePoint.SetEscDir( SDRESC_SMART );
+ nId = (sal_Int32)((*pList)[ pList->Insert( aGluePoint ) ].GetId() + 3 );
+ bNotFound = sal_False;
+ }
+ nPointCount++;
+ }
+ }
+ }
+ }
+ }
+ if ( !bNotFound )
+ {
+ bValidGluePoint = sal_True;
+ }
+ }
+ }
+ break;
+
+ case OBJ_CUSTOMSHAPE :
+ {
+ SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)((SdrObjCustomShape*)pO)->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
+ const rtl::OUString sPath( RTL_CONSTASCII_USTRINGPARAM ( "Path" ) );
+ const rtl::OUString sGluePointType( RTL_CONSTASCII_USTRINGPARAM ( "GluePointType" ) );
+ sal_Int16 nGluePointType = EnhancedCustomShapeGluePointType::SEGMENTS;
+ com::sun::star::uno::Any* pAny = aGeometryItem.GetPropertyValueByName( sPath, sGluePointType );
+ if ( pAny )
+ *pAny >>= nGluePointType;
+ else
+ {
+ const rtl::OUString sType( RTL_CONSTASCII_USTRINGPARAM ( "Type" ) );
+ rtl::OUString sShapeType;
+ pAny = aGeometryItem.GetPropertyValueByName( sType );
+ if ( pAny )
+ *pAny >>= sShapeType;
+ MSO_SPT eSpType = EnhancedCustomShapeTypeNames::Get( sShapeType );
+ nGluePointType = GetCustomShapeConnectionTypeDefault( eSpType );
+ }
+ if ( nGluePointType == EnhancedCustomShapeGluePointType::CUSTOM )
+ {
+ if ( pList && ( pList->GetCount() > nC ) )
+ {
+ bValidGluePoint = sal_True;
+ nId = (sal_Int32)((*pList)[ (sal_uInt16)nC].GetId() + 3 );
+ }
+ }
+ else if ( nGluePointType == EnhancedCustomShapeGluePointType::RECT )
+ {
+ if ( nC & 1 )
+ {
+ if ( nSpFlags & SP_FFLIPH )
+ nC ^= 2; // 1 <-> 3
+ }
+ else
+ {
+ if ( nSpFlags & SP_FFLIPV )
+ nC ^= 1; // 0 <-> 2
+ }
+ switch( nC )
+ {
+ case 0 :
+ nId = 0; // SDRVERTALIGN_TOP;
+ break;
+ case 1 :
+ nId = 3; // SDRHORZALIGN_RIGHT;
+ break;
+ case 2 :
+ nId = 2; // SDRVERTALIGN_BOTTOM;
+ break;
+ case 3 :
+ nId = 1; // SDRHORZALIGN_LEFT;
+ break;
+ }
+ if ( nId <= 3 )
+ bValidGluePoint = sal_True;
+ }
+ else if ( nGluePointType == EnhancedCustomShapeGluePointType::SEGMENTS )
+ {
+ const rtl::OUString sSegments( RTL_CONSTASCII_USTRINGPARAM ( "Segments" ) );
+ const rtl::OUString sCoordinates( RTL_CONSTASCII_USTRINGPARAM ( "Coordinates" ) );
+
+ sal_uInt32 k, nPt = nC;
+ com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeSegment > aSegments;
+ pAny = aGeometryItem.GetPropertyValueByName( sPath, sSegments );
+ if ( pAny )
+ {
+ if ( *pAny >>= aSegments )
+ {
+ for ( nPt = 0, k = 1; nC && ( k < (sal_uInt32)aSegments.getLength() ); k++ )
+ {
+ sal_Int16 j, nCnt2 = aSegments[ k ].Count;
+ if ( aSegments[ k ].Command != EnhancedCustomShapeSegmentCommand::UNKNOWN )
+ {
+ for ( j = 0; nC && ( j < nCnt2 ); j++ )
+ {
+ switch( aSegments[ k ].Command )
+ {
+ case EnhancedCustomShapeSegmentCommand::ENDSUBPATH :
+ case EnhancedCustomShapeSegmentCommand::CLOSESUBPATH :
+ case EnhancedCustomShapeSegmentCommand::LINETO :
+ case EnhancedCustomShapeSegmentCommand::MOVETO :
+ {
+ nC--;
+ nPt++;
+ }
+ break;
+ case EnhancedCustomShapeSegmentCommand::ELLIPTICALQUADRANTX :
+ case EnhancedCustomShapeSegmentCommand::ELLIPTICALQUADRANTY :
+ break;
+
+ case EnhancedCustomShapeSegmentCommand::CURVETO :
+ {
+ nC--;
+ nPt += 3;
+ }
+ break;
+
+ case EnhancedCustomShapeSegmentCommand::ANGLEELLIPSETO :
+ case EnhancedCustomShapeSegmentCommand::ANGLEELLIPSE :
+ {
+ nC--;
+ nPt += 3;
+ }
+ break;
+ case EnhancedCustomShapeSegmentCommand::ARCTO :
+ case EnhancedCustomShapeSegmentCommand::ARC :
+ case EnhancedCustomShapeSegmentCommand::CLOCKWISEARCTO :
+ case EnhancedCustomShapeSegmentCommand::CLOCKWISEARC :
+ {
+ nC--;
+ nPt += 4;
+ }
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ pAny = aGeometryItem.GetPropertyValueByName( sPath, sCoordinates );
+ if ( pAny )
+ {
+ com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair > aCoordinates;
+ *pAny >>= aCoordinates;
+ if ( nPt < (sal_uInt32)aCoordinates.getLength() )
+ {
+ nId = 4;
+ com::sun::star::drawing::EnhancedCustomShapeParameterPair& rPara = aCoordinates[ nPt ];
+ sal_Int32 nX = 0, nY = 0;
+ if ( ( rPara.First.Value >>= nX ) && ( rPara.Second.Value >>= nY ) )
+ {
+ const rtl::OUString sGluePoints( RTL_CONSTASCII_USTRINGPARAM ( "GluePoints" ) );
+ com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair > aGluePoints;
+ pAny = aGeometryItem.GetPropertyValueByName( sPath, sGluePoints );
+ if ( pAny )
+ *pAny >>= aGluePoints;
+ sal_Int32 nGluePoints = aGluePoints.getLength();
+ aGluePoints.realloc( nGluePoints + 1 );
+ EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( aGluePoints[ nGluePoints ].First, nX );
+ EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( aGluePoints[ nGluePoints ].Second, nY );
+ PropertyValue aProp;
+ aProp.Name = sGluePoints;
+ aProp.Value <<= aGluePoints;
+ aGeometryItem.SetPropertyValue( sPath, aProp );
+ bValidGluePoint = sal_True;
+ ((SdrObjCustomShape*)pO)->SetMergedItem( aGeometryItem );
+ SdrGluePointList* pLst = pO->ForceGluePointList();
+ if ( pLst->GetCount() > nGluePoints )
+ nId = (sal_Int32)((*pLst)[ (sal_uInt16)nGluePoints ].GetId() + 3 );
+ }
+ }
+ }
+ }
+ }
+ break;
+ }
+ if ( bValidGluePoint )
+ {
+ Reference< XPropertySet > xPropSet( aXConnector, UNO_QUERY );
+ if ( xPropSet.is() )
+ {
+ if ( nN )
+ {
+ String aPropName( RTL_CONSTASCII_USTRINGPARAM( "EndShape" ) );
+ aAny <<= aXShape;
+ SetPropValue( aAny, xPropSet, aPropName, sal_True );
+ aPropName = String( RTL_CONSTASCII_USTRINGPARAM( "EndGluePointIndex" ) );
+ aAny <<= nId;
+ SetPropValue( aAny, xPropSet, aPropName, sal_True );
+ }
+ else
+ {
+ String aPropName( RTL_CONSTASCII_USTRINGPARAM( "StartShape" ) );
+ aAny <<= aXShape;
+ SetPropValue( aAny, xPropSet, aPropName, sal_True );
+ aPropName = String( RTL_CONSTASCII_USTRINGPARAM( "StartGluePointIndex" ) );
+ aAny <<= nId;
+ SetPropValue( aAny, xPropSet, aPropName, sal_True );
+ }
+
+ // Not sure what this is good for, repaint or broadcast of object change.
+ //( Thus i am adding repaint here
+ pO->SetChanged();
+ pO->BroadcastObjectChange();
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+static basegfx::B2DPolygon GetLineArrow( const sal_Int32 nLineWidth, const MSO_LineEnd eLineEnd,
+ const MSO_LineEndWidth eLineWidth, const MSO_LineEndLength eLineLenght,
+ sal_Int32& rnArrowWidth, sal_Bool& rbArrowCenter,
+ String& rsArrowName, sal_Bool bScaleArrow )
+{
+ basegfx::B2DPolygon aRetval;
+ double fLineWidth = nLineWidth < 70 ? 70.0 : nLineWidth;
+ double fLenghtMul, fWidthMul;
+ sal_Int32 nLineNumber;
+ switch( eLineLenght )
+ {
+ default :
+ case mso_lineMediumLenArrow : fLenghtMul = 3.0; nLineNumber = 2; break;
+ case mso_lineShortArrow : fLenghtMul = 2.0; nLineNumber = 1; break;
+ case mso_lineLongArrow : fLenghtMul = 5.0; nLineNumber = 3; break;
+ }
+ switch( eLineWidth )
+ {
+ default :
+ case mso_lineMediumWidthArrow : fWidthMul = 3.0; nLineNumber += 3; break;
+ case mso_lineNarrowArrow : fWidthMul = 2.0; break;
+ case mso_lineWideArrow : fWidthMul = 5.0; nLineNumber += 6; break;
+ }
+
+ if ( bScaleArrow ) // #i33630 arrows imported from Word are too big
+ {
+ fWidthMul /= 1.75;
+ fLenghtMul/= 1.75;
+ }
+
+ rbArrowCenter = sal_False;
+ switch ( eLineEnd )
+ {
+ case mso_lineArrowEnd :
+ {
+ basegfx::B2DPolygon aTriangle;
+ aTriangle.append(basegfx::B2DPoint( fWidthMul * fLineWidth * 0.50, 0.0 ));
+ aTriangle.append(basegfx::B2DPoint( fWidthMul * fLineWidth, fLenghtMul * fLineWidth ));
+ aTriangle.append(basegfx::B2DPoint( 0.0, fLenghtMul * fLineWidth ));
+ aTriangle.setClosed(true);
+ aRetval = aTriangle;
+ rsArrowName = String( RTL_CONSTASCII_STRINGPARAM( "msArrowEnd " ), RTL_TEXTENCODING_UTF8 );
+ }
+ break;
+
+ case mso_lineArrowOpenEnd :
+ {
+ switch( eLineLenght )
+ {
+ default :
+ case mso_lineMediumLenArrow : fLenghtMul = 4.5; break;
+ case mso_lineShortArrow : fLenghtMul = 3.5; break;
+ case mso_lineLongArrow : fLenghtMul = 6.0; break;
+ }
+ switch( eLineWidth )
+ {
+ default :
+ case mso_lineMediumWidthArrow : fWidthMul = 4.5; break;
+ case mso_lineNarrowArrow : fWidthMul = 3.5; break;
+ case mso_lineWideArrow : fWidthMul = 6.0; break;
+ }
+ basegfx::B2DPolygon aTriangle;
+ aTriangle.append(basegfx::B2DPoint( fWidthMul * fLineWidth * 0.50 , 0.0 ));
+ aTriangle.append(basegfx::B2DPoint( fWidthMul * fLineWidth, fLenghtMul * fLineWidth * 0.91 ));
+ aTriangle.append(basegfx::B2DPoint( fWidthMul * fLineWidth * 0.85, fLenghtMul * fLineWidth ));
+ aTriangle.append(basegfx::B2DPoint( fWidthMul * fLineWidth * 0.50, fLenghtMul * fLineWidth * 0.36 ));
+ aTriangle.append(basegfx::B2DPoint( fWidthMul * fLineWidth * 0.15, fLenghtMul * fLineWidth ));
+ aTriangle.append(basegfx::B2DPoint( 0.0, fLenghtMul * fLineWidth * 0.91 ));
+ aTriangle.setClosed(true);
+ aRetval = aTriangle;
+ rsArrowName = String( RTL_CONSTASCII_STRINGPARAM( "msArrowOpenEnd " ), RTL_TEXTENCODING_UTF8 );
+ }
+ break;
+ case mso_lineArrowStealthEnd :
+ {
+ basegfx::B2DPolygon aTriangle;
+ aTriangle.append(basegfx::B2DPoint( fWidthMul * fLineWidth * 0.50 , 0.0 ));
+ aTriangle.append(basegfx::B2DPoint( fWidthMul * fLineWidth , fLenghtMul * fLineWidth ));
+ aTriangle.append(basegfx::B2DPoint( fWidthMul * fLineWidth * 0.50 , fLenghtMul * fLineWidth * 0.60 ));
+ aTriangle.append(basegfx::B2DPoint( 0.0, fLenghtMul * fLineWidth ));
+ aTriangle.setClosed(true);
+ aRetval = aTriangle;
+ rsArrowName = String( RTL_CONSTASCII_STRINGPARAM( "msArrowStealthEnd " ), RTL_TEXTENCODING_UTF8 );
+ }
+ break;
+ case mso_lineArrowDiamondEnd :
+ {
+ basegfx::B2DPolygon aTriangle;
+ aTriangle.append(basegfx::B2DPoint( fWidthMul * fLineWidth * 0.50 , 0.0 ));
+ aTriangle.append(basegfx::B2DPoint( fWidthMul * fLineWidth , fLenghtMul * fLineWidth * 0.50 ));
+ aTriangle.append(basegfx::B2DPoint( fWidthMul * fLineWidth * 0.50 , fLenghtMul * fLineWidth ));
+ aTriangle.append(basegfx::B2DPoint( 0.0, fLenghtMul * fLineWidth * 0.50 ));
+ aTriangle.setClosed(true);
+ aRetval = aTriangle;
+ rbArrowCenter = sal_True;
+ rsArrowName = String( RTL_CONSTASCII_STRINGPARAM( "msArrowDiamondEnd " ), RTL_TEXTENCODING_UTF8 );
+ }
+ break;
+ case mso_lineArrowOvalEnd :
+ {
+ aRetval = XPolygon( Point( (sal_Int32)( fWidthMul * fLineWidth * 0.50 ), 0 ),
+ (sal_Int32)( fWidthMul * fLineWidth * 0.50 ),
+ (sal_Int32)( fLenghtMul * fLineWidth * 0.50 ), 0, 3600 ).getB2DPolygon();
+ rbArrowCenter = sal_True;
+ rsArrowName = String( RTL_CONSTASCII_STRINGPARAM( "msArrowOvalEnd " ), RTL_TEXTENCODING_UTF8 );
+ }
+ break;
+ default: break;
+ }
+ rsArrowName.Append( String::CreateFromInt32( nLineNumber ) );
+ rnArrowWidth = (sal_Int32)( fLineWidth * fWidthMul );
+
+ return aRetval;
+}
+
+void DffPropertyReader::ApplyLineAttributes( SfxItemSet& rSet, const MSO_SPT eShapeType ) const // #i28269#
+{
+ UINT32 nLineFlags(GetPropertyValue( DFF_Prop_fNoLineDrawDash ));
+
+ if(!IsHardAttribute( DFF_Prop_fLine ) && !IsCustomShapeStrokedByDefault( eShapeType ))
+ {
+ nLineFlags &= ~0x08;
+ }
+
+ if ( nLineFlags & 8 )
+ {
+ // Linienattribute
+ sal_Int32 nLineWidth = (INT32)GetPropertyValue( DFF_Prop_lineWidth, 9525 );
+
+ MSO_LineDashing eLineDashing = (MSO_LineDashing)GetPropertyValue( DFF_Prop_lineDashing, mso_lineSolid );
+ if ( eLineDashing == mso_lineSolid )
+ rSet.Put(XLineStyleItem( XLINE_SOLID ) );
+ else
+ {
+// MSO_LineCap eLineCap = (MSO_LineCap)GetPropertyValue( DFF_Prop_lineEndCapStyle, mso_lineEndCapSquare );
+
+ XDashStyle eDash = XDASH_RECT;
+ sal_uInt16 nDots = 1;
+ sal_uInt32 nDotLen = nLineWidth / 360;
+ sal_uInt16 nDashes = 0;
+ sal_uInt32 nDashLen = ( 8 * nLineWidth ) / 360;
+ sal_uInt32 nDistance = ( 3 * nLineWidth ) / 360;;
+
+ switch ( eLineDashing )
+ {
+ default:
+ case mso_lineDotSys :
+ {
+ nDots = 1;
+ nDashes = 0;
+ nDistance = nDotLen;
+ }
+ break;
+
+ case mso_lineDashGEL :
+ {
+ nDots = 0;
+ nDashes = 1;
+ nDashLen = ( 4 * nLineWidth ) / 360;
+ }
+ break;
+
+ case mso_lineDashDotGEL :
+ {
+ nDots = 1;
+ nDashes = 1;
+ nDashLen = ( 4 * nLineWidth ) / 360;
+ }
+ break;
+
+ case mso_lineLongDashGEL :
+ {
+ nDots = 0;
+ nDashes = 1;
+ }
+ break;
+
+ case mso_lineLongDashDotGEL :
+ {
+ nDots = 1;
+ nDashes = 1;
+ }
+ break;
+
+ case mso_lineLongDashDotDotGEL:
+ {
+ nDots = 2;
+ nDashes = 1;
+ }
+ break;
+ }
+
+ rSet.Put( XLineDashItem( String(), XDash( eDash, nDots, nDotLen, nDashes, nDashLen, nDistance ) ) );
+ rSet.Put( XLineStyleItem( XLINE_DASH ) );
+ }
+ rSet.Put( XLineColorItem( String(), rManager.MSO_CLR_ToColor( GetPropertyValue( DFF_Prop_lineColor ), DFF_Prop_lineColor ) ) );
+ if ( IsProperty( DFF_Prop_lineOpacity ) )
+ {
+ double nTrans = GetPropertyValue(DFF_Prop_lineOpacity, 0x10000);
+ nTrans = (nTrans * 100) / 65536;
+ rSet.Put(XLineTransparenceItem(
+ sal_uInt16(100 - ::rtl::math::round(nTrans))));
+ }
+
+ rManager.ScaleEmu( nLineWidth );
+ rSet.Put( XLineWidthItem( nLineWidth ) );
+
+ // SJ: LineJoint (setting each time a line is set, because our internal joint type has another default)
+ MSO_LineJoin eLineJointDefault = mso_lineJoinMiter;
+ if ( eShapeType == mso_sptMin )
+ eLineJointDefault = mso_lineJoinRound;
+ MSO_LineJoin eLineJoint = (MSO_LineJoin)GetPropertyValue( DFF_Prop_lineJoinStyle, eLineJointDefault );
+ XLineJoint eXLineJoint( XLINEJOINT_MITER );
+ if ( eLineJoint == mso_lineJoinBevel )
+ eXLineJoint = XLINEJOINT_BEVEL;
+ else if ( eLineJoint == mso_lineJoinRound )
+ eXLineJoint = XLINEJOINT_ROUND;
+ rSet.Put( XLineJointItem( eXLineJoint ) );
+
+ if ( nLineFlags & 0x10 )
+ {
+ sal_Bool bScaleArrows = rManager.pSdrModel->GetScaleUnit() == MAP_TWIP;
+ ///////////////
+ // LineStart //
+ ///////////////
+ if ( IsProperty( DFF_Prop_lineStartArrowhead ) )
+ {
+ MSO_LineEnd eLineEnd = (MSO_LineEnd)GetPropertyValue( DFF_Prop_lineStartArrowhead );
+ MSO_LineEndWidth eWidth = (MSO_LineEndWidth)GetPropertyValue( DFF_Prop_lineStartArrowWidth, mso_lineMediumWidthArrow );
+ MSO_LineEndLength eLenght = (MSO_LineEndLength)GetPropertyValue( DFF_Prop_lineStartArrowLength, mso_lineMediumLenArrow );
+
+ sal_Int32 nArrowWidth;
+ sal_Bool bArrowCenter;
+ String aArrowName;
+ basegfx::B2DPolygon aPoly(GetLineArrow( nLineWidth, eLineEnd, eWidth, eLenght, nArrowWidth, bArrowCenter, aArrowName, bScaleArrows ));
+
+ rSet.Put( XLineStartWidthItem( nArrowWidth ) );
+ rSet.Put( XLineStartItem( aArrowName, basegfx::B2DPolyPolygon(aPoly) ) );
+ rSet.Put( XLineStartCenterItem( bArrowCenter ) );
+ }
+ /////////////
+ // LineEnd //
+ /////////////
+ if ( IsProperty( DFF_Prop_lineEndArrowhead ) )
+ {
+ MSO_LineEnd eLineEnd = (MSO_LineEnd)GetPropertyValue( DFF_Prop_lineEndArrowhead );
+ MSO_LineEndWidth eWidth = (MSO_LineEndWidth)GetPropertyValue( DFF_Prop_lineEndArrowWidth, mso_lineMediumWidthArrow );
+ MSO_LineEndLength eLenght = (MSO_LineEndLength)GetPropertyValue( DFF_Prop_lineEndArrowLength, mso_lineMediumLenArrow );
+
+ sal_Int32 nArrowWidth;
+ sal_Bool bArrowCenter;
+ String aArrowName;
+ basegfx::B2DPolygon aPoly(GetLineArrow( nLineWidth, eLineEnd, eWidth, eLenght, nArrowWidth, bArrowCenter, aArrowName, bScaleArrows ));
+
+ rSet.Put( XLineEndWidthItem( nArrowWidth ) );
+ rSet.Put( XLineEndItem( aArrowName, basegfx::B2DPolyPolygon(aPoly) ) );
+ rSet.Put( XLineEndCenterItem( bArrowCenter ) );
+ }
+ if ( IsProperty( DFF_Prop_lineEndCapStyle ) )
+ {
+ MSO_LineCap eLineCap = (MSO_LineCap)GetPropertyValue( DFF_Prop_lineEndCapStyle );
+ const SfxPoolItem* pPoolItem = NULL;
+ if ( rSet.GetItemState( XATTR_LINEDASH, FALSE, &pPoolItem ) == SFX_ITEM_SET )
+ {
+ XDashStyle eNewStyle = XDASH_RECT;
+ if ( eLineCap == mso_lineEndCapRound )
+ eNewStyle = XDASH_ROUND;
+ const XDash& rOldDash = ( (const XLineDashItem*)pPoolItem )->GetDashValue();
+ if ( rOldDash.GetDashStyle() != eNewStyle )
+ {
+ XDash aNew( rOldDash );
+ aNew.SetDashStyle( eNewStyle );
+ rSet.Put( XLineDashItem( XubString(), aNew ) );
+ }
+ }
+ }
+ }
+ }
+ else
+ rSet.Put( XLineStyleItem( XLINE_NONE ) );
+}
+
+struct ShadeColor
+{
+ Color aColor;
+ double fDist;
+
+ ShadeColor( const Color& rC, double fR ) : aColor( rC ), fDist( fR ) {};
+};
+
+void GetShadeColors( const SvxMSDffManager& rManager, const DffPropertyReader& rProperties, SvStream& rIn, std::vector< ShadeColor >& rShadeColors )
+{
+ sal_uInt32 nPos = rIn.Tell();
+ if ( rProperties.IsProperty( DFF_Prop_fillShadeColors ) )
+ {
+ if ( rProperties.SeekToContent( DFF_Prop_fillShadeColors, rIn ) )
+ {
+ sal_uInt16 i = 0, nNumElem = 0, nNumElemReserved = 0, nSize = 0;
+ rIn >> nNumElem >> nNumElemReserved >> nSize;
+ for ( ; i < nNumElem; i++ )
+ {
+ sal_Int32 nColor;
+ sal_Int32 nDist;
+
+ rIn >> nColor >> nDist;
+ rShadeColors.push_back( ShadeColor( rManager.MSO_CLR_ToColor( nColor, DFF_Prop_fillColor ), 1.0 - ( nDist / 65536.0 ) ) );
+ }
+ }
+ }
+ if ( !rShadeColors.size() )
+ {
+ rShadeColors.push_back( ShadeColor( rManager.MSO_CLR_ToColor( rProperties.GetPropertyValue( DFF_Prop_fillBackColor, COL_WHITE ), DFF_Prop_fillBackColor ), 0 ) );
+ rShadeColors.push_back( ShadeColor( rManager.MSO_CLR_ToColor( rProperties.GetPropertyValue( DFF_Prop_fillColor, COL_WHITE ), DFF_Prop_fillColor ), 1 ) );
+ }
+ rIn.Seek( nPos );
+}
+
+struct QuantErr
+{
+ double fRed;
+ double fGreen;
+ double fBlue;
+
+ QuantErr() : fRed( 0.0 ), fGreen( 0.0 ), fBlue( 0.0 ){};
+};
+
+void ApplyRectangularGradientAsBitmap( const SvxMSDffManager& rManager, SvStream& rIn, SfxItemSet& rSet, const std::vector< ShadeColor >& rShadeColors, const DffObjData& rObjData, sal_Int32 nFix16Angle )
+{
+ Size aBitmapSizePixel( static_cast< sal_Int32 >( ( rObjData.aBoundRect.GetWidth() / 2540.0 ) * 90.0 ), // we will create a bitmap with 90 dpi
+ static_cast< sal_Int32 >( ( rObjData.aBoundRect.GetHeight() / 2540.0 ) * 90.0 ) );
+ if ( aBitmapSizePixel.Width() && aBitmapSizePixel.Height() && ( aBitmapSizePixel.Width() <= 1024 ) && ( aBitmapSizePixel.Height() <= 1024 ) )
+ {
+// std::vector< QuantErr > aQuantErrCurrScan( aBitmapSizePixel.Width() + 1 );
+// std::vector< QuantErr > aQuantErrNextScan( aBitmapSizePixel.Width() + 1 );
+
+ double fFocusX = rManager.GetPropertyValue( DFF_Prop_fillToRight, 0 ) / 65536.0;
+ double fFocusY = rManager.GetPropertyValue( DFF_Prop_fillToBottom, 0 ) / 65536.0;
+
+ Bitmap aBitmap( aBitmapSizePixel, 24 );
+ BitmapWriteAccess* pAcc = aBitmap.AcquireWriteAccess();
+ if ( pAcc )
+ {
+ sal_Int32 nX, nY;
+ for ( nY = 0; nY < aBitmapSizePixel.Height(); nY++ )
+ {
+ for ( nX = 0; nX < aBitmapSizePixel.Width(); nX++ )
+ {
+ double fX = static_cast< double >( nX ) / aBitmapSizePixel.Width();
+ double fY = static_cast< double >( nY ) / aBitmapSizePixel.Height();
+
+ double fD, fDist;
+ if ( fX < fFocusX )
+ {
+ if ( fY < fFocusY )
+ {
+ if ( fX > fY )
+ fDist = fY, fD = fFocusY;
+ else
+ fDist = fX, fD = fFocusX;
+ }
+ else
+ {
+ if ( fX > ( 1 - fY ) )
+ fDist = ( 1 - fY ), fD = 1 - fFocusY;
+ else
+ fDist = fX, fD = fFocusX;
+ }
+ }
+ else
+ {
+ if ( fY < fFocusY )
+ {
+ if ( ( 1 - fX ) > fY )
+ fDist = fY, fD = fFocusY;
+ else
+ fDist = ( 1 - fX ), fD = 1 - fFocusX;
+ }
+ else
+ {
+ if ( ( 1 - fX ) > ( 1 - fY ) )
+ fDist = ( 1 - fY ), fD = 1 - fFocusY;
+ else
+ fDist = ( 1 - fX ), fD = 1 - fFocusX;
+ }
+ }
+ if ( fD != 0.0 )
+ fDist /= fD;
+
+ std::vector< ShadeColor >::const_iterator aIter( rShadeColors.begin() );
+ double fA = 0.0;
+ Color aColorA = aIter->aColor;
+ double fB = 1.0;
+ Color aColorB( aColorA );
+ while ( aIter != rShadeColors.end() )
+ {
+ if ( aIter->fDist <= fDist )
+ {
+ if ( aIter->fDist >= fA )
+ {
+ fA = aIter->fDist;
+ aColorA = aIter->aColor;
+ }
+ }
+ if ( aIter->fDist > fDist )
+ {
+ if ( aIter->fDist <= fB )
+ {
+ fB = aIter->fDist;
+ aColorB = aIter->aColor;
+ }
+ }
+ aIter++;
+ }
+ double fRed = aColorA.GetRed(), fGreen = aColorA.GetGreen(), fBlue = aColorA.GetBlue();
+ double fD1 = fB - fA;
+ if ( fD1 != 0.0 )
+ {
+ fRed += ( ( ( fDist - fA ) * ( aColorB.GetRed() - aColorA.GetRed() ) ) / fD1 ); // + aQuantErrCurrScan[ nX ].fRed;
+ fGreen += ( ( ( fDist - fA ) * ( aColorB.GetGreen() - aColorA.GetGreen() ) ) / fD1 ); // + aQuantErrCurrScan[ nX ].fGreen;
+ fBlue += ( ( ( fDist - fA ) * ( aColorB.GetBlue() - aColorA.GetBlue() ) ) / fD1 ); // + aQuantErrCurrScan[ nX ].fBlue;
+ }
+ sal_Int16 nRed = static_cast< sal_Int16 >( fRed + 0.5 );
+ sal_Int16 nGreen = static_cast< sal_Int16 >( fGreen + 0.5 );
+ sal_Int16 nBlue = static_cast< sal_Int16 >( fBlue + 0.5 );
+/*
+ double fErr = fRed - nRed;
+ aQuantErrCurrScan[ nX + 1 ].fRed += 7.0 * fErr / 16.0;
+ if ( nX )
+ aQuantErrNextScan[ nX - 1 ].fRed += 3.0 * fErr / 16.0;
+ aQuantErrNextScan[ nX ].fRed += 5.0 * fErr / 16.0;
+ aQuantErrNextScan[ nX + 1 ].fRed += 1.0 * fErr / 16.0;
+
+ fErr = fGreen - nGreen;
+ aQuantErrCurrScan[ nX + 1 ].fGreen += 7.0 * fErr / 16.0;
+ if ( nX )
+ aQuantErrNextScan[ nX - 1 ].fGreen += 3.0 * fErr / 16.0;
+ aQuantErrNextScan[ nX ].fGreen += 5.0 * fErr / 16.0;
+ aQuantErrNextScan[ nX + 1 ].fGreen += 1.0 * fErr / 16.0;
+
+ fErr = fBlue - nBlue;
+ aQuantErrCurrScan[ nX + 1 ].fBlue += 7.0 * fErr / 16.0;
+ if ( nX )
+ aQuantErrNextScan[ nX - 1 ].fBlue += 3.0 * fErr / 16.0;
+ aQuantErrNextScan[ nX ].fBlue += 5.0 * fErr / 16.0;
+ aQuantErrNextScan[ nX + 1 ].fBlue += 1.0 * fErr / 16.0;
+*/
+ if ( nRed < 0 )
+ nRed = 0;
+ if ( nRed > 255 )
+ nRed = 255;
+ if ( nGreen < 0 )
+ nGreen = 0;
+ if ( nGreen > 255 )
+ nGreen = 255;
+ if ( nBlue < 0 )
+ nBlue = 0;
+ if ( nBlue > 255 )
+ nBlue = 255;
+
+ pAcc->SetPixel( nY, nX, BitmapColor( static_cast< sal_Int8 >( nRed ), static_cast< sal_Int8 >( nGreen ), static_cast< sal_Int8 >( nBlue ) ) );
+ }
+/*
+ aQuantErrCurrScan.swap( aQuantErrNextScan );
+ std::vector< QuantErr >::iterator aIter( aQuantErrNextScan.begin() );
+ while( aIter != aQuantErrNextScan.end() )
+ {
+ *aIter = QuantErr();
+ aIter++;
+ }
+*/
+ }
+ aBitmap.ReleaseAccess( pAcc );
+
+ if ( nFix16Angle )
+ {
+ sal_Bool bRotateWithShape = sal_True; // TRUE seems to be default
+ sal_uInt32 nPos = rIn.Tell();
+ if ( const_cast< SvxMSDffManager& >( rManager ).maShapeRecords.SeekToContent( rIn, DFF_msofbtUDefProp, SEEK_FROM_CURRENT_AND_RESTART ) )
+ {
+ const_cast< SvxMSDffManager& >( rManager ).maShapeRecords.Current()->SeekToBegOfRecord( rIn );
+ DffPropertyReader aSecPropSet( rManager );
+ aSecPropSet.ReadPropSet( rIn, NULL );
+ sal_Int32 nSecFillProperties = aSecPropSet.GetPropertyValue( DFF_Prop_fNoFillHitTest, 0x200020 );
+ bRotateWithShape = ( nSecFillProperties & 0x0020 );
+ }
+ rIn.Seek( nPos );
+ if ( bRotateWithShape )
+ {
+ aBitmap.Rotate( nFix16Angle / 10, rShadeColors[ 0 ].aColor );
+
+ ULONG nMirrorFlags = BMP_MIRROR_NONE;
+ if ( rObjData.nSpFlags & SP_FFLIPV )
+ nMirrorFlags |= BMP_MIRROR_VERT;
+ if ( rObjData.nSpFlags & SP_FFLIPH )
+ nMirrorFlags |= BMP_MIRROR_HORZ;
+ if ( nMirrorFlags != BMP_MIRROR_NONE )
+ aBitmap.Mirror( nMirrorFlags );
+ }
+ }
+
+ XOBitmap aXBmp( aBitmap, XBITMAP_STRETCH );
+ rSet.Put( XFillBmpTileItem( sal_False ) );
+ rSet.Put( XFillBitmapItem( String(), aXBmp ) );
+ }
+ }
+}
+
+void DffPropertyReader::ApplyFillAttributes( SvStream& rIn, SfxItemSet& rSet, const DffObjData& rObjData ) const
+{
+ UINT32 nFillFlags(GetPropertyValue( DFF_Prop_fNoFillHitTest ));
+
+ std::vector< ShadeColor > aShadeColors;
+ GetShadeColors( rManager, *this, rIn, aShadeColors );
+
+ if(!IsHardAttribute( DFF_Prop_fFilled ) && !IsCustomShapeFilledByDefault( rObjData.eShapeType ))
+ {
+ nFillFlags &= ~0x10;
+ }
+
+ if ( nFillFlags & 0x10 )
+ {
+ MSO_FillType eMSO_FillType = (MSO_FillType)GetPropertyValue( DFF_Prop_fillType, mso_fillSolid );
+ XFillStyle eXFill = XFILL_NONE;
+ switch( eMSO_FillType )
+ {
+ case mso_fillSolid : // Fill with a solid color
+ eXFill = XFILL_SOLID;
+ break;
+ case mso_fillPattern : // Fill with a pattern (bitmap)
+ case mso_fillTexture : // A texture (pattern with its own color map)
+ case mso_fillPicture : // Center a picture in the shape
+ eXFill = XFILL_BITMAP;
+ break;
+ case mso_fillShadeCenter : // Shade from bounding rectangle to end point
+ {
+ if ( rObjData.aBoundRect.IsEmpty() )// size of object needed to be able
+ eXFill = XFILL_GRADIENT; // to create a bitmap substitution
+ else
+ eXFill = XFILL_BITMAP;
+ }
+ break;
+ case mso_fillShade : // Shade from start to end points
+ case mso_fillShadeShape : // Shade from shape outline to end point
+ case mso_fillShadeScale : // Similar to mso_fillShade, but the fillAngle
+ case mso_fillShadeTitle : // special type - shade to title --- for PP
+ eXFill = XFILL_GRADIENT;
+ break;
+// case mso_fillBackground : // Use the background fill color/pattern
+ default: break;
+ }
+ rSet.Put( XFillStyleItem( eXFill ) );
+
+ if (IsProperty(DFF_Prop_fillOpacity))
+ {
+ double nTrans = GetPropertyValue(DFF_Prop_fillOpacity);
+ nTrans = (nTrans * 100) / 65536;
+ rSet.Put(XFillTransparenceItem(
+ sal_uInt16(100 - ::rtl::math::round(nTrans))));
+ }
+
+ if ( ( eMSO_FillType == mso_fillShadeCenter ) && ( eXFill == XFILL_BITMAP ) )
+ {
+ ApplyRectangularGradientAsBitmap( rManager, rIn, rSet, aShadeColors, rObjData, mnFix16Angle );
+ }
+ else if ( eXFill == XFILL_GRADIENT )
+ {
+ sal_Int32 nAngle = 3600 - ( ( Fix16ToAngle( GetPropertyValue( DFF_Prop_fillAngle, 0 ) ) + 5 ) / 10 );
+
+ // Rotationswinkel in Bereich zwingen
+ while ( nAngle >= 3600 )
+ nAngle -= 3600;
+ while ( nAngle < 0 )
+ nAngle += 3600;
+
+ sal_Int32 nFocus = GetPropertyValue( DFF_Prop_fillFocus, 0 );
+ XGradientStyle eGrad = XGRAD_LINEAR;
+ sal_Int32 nChgColors = 0;
+
+ if ( nFocus < 0 ) // Bei negativem Focus sind die Farben zu tauschen
+ {
+ nFocus =- nFocus;
+ nChgColors ^= 1;
+ }
+ if( nFocus > 40 && nFocus < 60 )
+ {
+ eGrad = XGRAD_AXIAL; // Besser gehts leider nicht
+ }
+
+ USHORT nFocusX = (USHORT)nFocus;
+ USHORT nFocusY = (USHORT)nFocus;
+
+ switch( eMSO_FillType )
+ {
+ case mso_fillShadeShape :
+ {
+ eGrad = XGRAD_RECT;
+ nFocusY = nFocusX = 50;
+ nChgColors ^= 1;
+ }
+ break;
+ case mso_fillShadeCenter :
+ {
+ eGrad = XGRAD_RECT;
+ nFocusX = ( IsProperty( DFF_Prop_fillToRight ) ) ? 100 : 0;
+ nFocusY = ( IsProperty( DFF_Prop_fillToBottom ) ) ? 100 : 0;
+ nChgColors ^= 1;
+ }
+ break;
+ default: break;
+ }
+ Color aCol1( rManager.MSO_CLR_ToColor( GetPropertyValue( DFF_Prop_fillColor, COL_WHITE ), DFF_Prop_fillColor ) );
+ Color aCol2( rManager.MSO_CLR_ToColor( GetPropertyValue( DFF_Prop_fillBackColor, COL_WHITE ), DFF_Prop_fillBackColor ) );
+
+ if ( nChgColors )
+ {
+ Color aZwi( aCol1 );
+ aCol1 = aCol2;
+ aCol2 = aZwi;
+ }
+ XGradient aGrad( aCol2, aCol1, eGrad, nAngle, nFocusX, nFocusY );
+ aGrad.SetStartIntens( 100 );
+ aGrad.SetEndIntens( 100 );
+ rSet.Put( XFillGradientItem( String(), aGrad ) );
+ }
+ else if ( eXFill == XFILL_BITMAP )
+ {
+ if( IsProperty( DFF_Prop_fillBlip ) )
+ {
+ Graphic aGraf;
+ // first try to get BLIP from cache
+ BOOL bOK = rManager.GetBLIP( GetPropertyValue( DFF_Prop_fillBlip ), aGraf, NULL );
+ // then try directly from stream (i.e. Excel chart hatches/bitmaps)
+ if ( !bOK )
+ bOK = SeekToContent( DFF_Prop_fillBlip, rIn ) && rManager.GetBLIPDirect( rIn, aGraf, NULL );
+ if ( bOK )
+ {
+ Bitmap aBmp( aGraf.GetBitmap() );
+
+ if ( eMSO_FillType == mso_fillPattern )
+ {
+ Color aCol1( COL_WHITE ), aCol2( COL_WHITE );
+ if ( IsProperty( DFF_Prop_fillColor ) )
+ aCol1 = rManager.MSO_CLR_ToColor( GetPropertyValue( DFF_Prop_fillColor ), DFF_Prop_fillColor );
+ if ( IsProperty( DFF_Prop_fillBackColor ) )
+ aCol2 = rManager.MSO_CLR_ToColor( GetPropertyValue( DFF_Prop_fillBackColor ), DFF_Prop_fillBackColor );
+
+ XOBitmap aXOBitmap;
+
+ // Bitmap einsetzen
+ aXOBitmap.SetBitmap( aBmp );
+ aXOBitmap.SetBitmapType( XBITMAP_IMPORT );
+
+ if( aBmp.GetSizePixel().Width() == 8 && aBmp.GetSizePixel().Height() == 8 && aBmp.GetColorCount() == 2)
+ {
+ aXOBitmap.Bitmap2Array();
+ aXOBitmap.SetBitmapType( XBITMAP_8X8 );
+ aXOBitmap.SetPixelSize( aBmp.GetSizePixel() );
+
+ if( aXOBitmap.GetBackgroundColor() == COL_BLACK )
+ {
+ aXOBitmap.SetPixelColor( aCol1 );
+ aXOBitmap.SetBackgroundColor( aCol2 );
+ }
+ else
+ {
+ aXOBitmap.SetPixelColor( aCol2 );
+ aXOBitmap.SetBackgroundColor( aCol1 );
+ }
+ }
+ rSet.Put( XFillBitmapItem( String(), aXOBitmap ) );
+ }
+ else if ( eMSO_FillType == mso_fillTexture )
+ {
+ XOBitmap aXBmp( aBmp, XBITMAP_STRETCH );
+ rSet.Put( XFillBmpTileItem( sal_True ) );
+ rSet.Put( XFillBitmapItem( String(), aXBmp ) );
+ rSet.Put( XFillBmpSizeXItem( GetPropertyValue( DFF_Prop_fillWidth, 0 ) / 360 ) );
+ rSet.Put( XFillBmpSizeYItem( GetPropertyValue( DFF_Prop_fillHeight, 0 ) / 360 ) );
+ rSet.Put( XFillBmpSizeLogItem( sal_True ) );
+ }
+ else
+ {
+ XOBitmap aXBmp( aBmp, XBITMAP_STRETCH );
+ rSet.Put( XFillBitmapItem( String(), aXBmp ) );
+ rSet.Put( XFillBmpTileItem( sal_False ) );
+ }
+ }
+ }
+ }
+ }
+ else
+ rSet.Put( XFillStyleItem( XFILL_NONE ) );
+}
+
+void DffPropertyReader::ApplyCustomShapeTextAttributes( SfxItemSet& rSet ) const
+{
+// sal_uInt32 nTextFlags = aTextObj.GetTextFlags();
+ sal_Bool bVerticalText = sal_False;
+ sal_Int32 nTextLeft = GetPropertyValue( DFF_Prop_dxTextLeft, 25 * 3600 ) / 360; // 0.25 cm (emu)
+ sal_Int32 nTextRight = GetPropertyValue( DFF_Prop_dxTextRight, 25 * 3600 ) / 360; // 0.25 cm (emu)
+ sal_Int32 nTextTop = GetPropertyValue( DFF_Prop_dyTextTop, 13 * 3600 ) / 360; // 0.13 cm (emu)
+ sal_Int32 nTextBottom = GetPropertyValue( DFF_Prop_dyTextBottom, 13 * 3600 ) /360; // 0.13 cm (emu)
+
+ SdrTextVertAdjust eTVA;
+ SdrTextHorzAdjust eTHA;
+
+ if ( IsProperty( DFF_Prop_txflTextFlow ) )
+ {
+ MSO_TextFlow eTextFlow = (MSO_TextFlow)( GetPropertyValue( DFF_Prop_txflTextFlow ) & 0xFFFF );
+ switch( eTextFlow )
+ {
+ case mso_txflTtoBA : /* #68110# */ // Top to Bottom @-font, oben -> unten
+ case mso_txflTtoBN : // Top to Bottom non-@, oben -> unten
+ case mso_txflVertN : // Vertical, non-@, oben -> unten
+ bVerticalText = sal_True; // nTextRotationAngle += 27000;
+ break;
+ default: break;
+ }
+ }
+ sal_Int32 nFontDirection = GetPropertyValue( DFF_Prop_cdirFont, mso_cdir0 );
+ if ( ( nFontDirection == 1 ) || ( nFontDirection == 3 ) )
+ bVerticalText = !bVerticalText;
+
+ if ( bVerticalText )
+ {
+ eTVA = SDRTEXTVERTADJUST_BLOCK;
+ eTHA = SDRTEXTHORZADJUST_CENTER;
+
+ // Textverankerung lesen
+ MSO_Anchor eTextAnchor = (MSO_Anchor)GetPropertyValue( DFF_Prop_anchorText, mso_anchorTop );
+
+ switch( eTextAnchor )
+ {
+ case mso_anchorTop:
+ case mso_anchorTopCentered:
+ case mso_anchorTopBaseline:
+ case mso_anchorTopCenteredBaseline:
+ eTHA = SDRTEXTHORZADJUST_RIGHT;
+ break;
+
+ case mso_anchorMiddle :
+ case mso_anchorMiddleCentered:
+ eTHA = SDRTEXTHORZADJUST_CENTER;
+ break;
+
+ case mso_anchorBottom:
+ case mso_anchorBottomCentered:
+ case mso_anchorBottomBaseline:
+ case mso_anchorBottomCenteredBaseline:
+ eTHA = SDRTEXTHORZADJUST_LEFT;
+ break;
+ }
+ // if there is a 100% use of following attributes, the textbox can been aligned also in vertical direction
+ switch ( eTextAnchor )
+ {
+ case mso_anchorTopCentered :
+ case mso_anchorMiddleCentered :
+ case mso_anchorBottomCentered :
+ case mso_anchorTopCenteredBaseline:
+ case mso_anchorBottomCenteredBaseline:
+ eTVA = SDRTEXTVERTADJUST_CENTER;
+ break;
+
+ default :
+ eTVA = SDRTEXTVERTADJUST_TOP;
+ break;
+ }
+ }
+ else
+ {
+ eTVA = SDRTEXTVERTADJUST_CENTER;
+ eTHA = SDRTEXTHORZADJUST_BLOCK;
+
+ // Textverankerung lesen
+ MSO_Anchor eTextAnchor = (MSO_Anchor)GetPropertyValue( DFF_Prop_anchorText, mso_anchorTop );
+
+ switch( eTextAnchor )
+ {
+ case mso_anchorTop:
+ case mso_anchorTopCentered:
+ case mso_anchorTopBaseline:
+ case mso_anchorTopCenteredBaseline:
+ eTVA = SDRTEXTVERTADJUST_TOP;
+ break;
+
+ case mso_anchorMiddle :
+ case mso_anchorMiddleCentered:
+ eTVA = SDRTEXTVERTADJUST_CENTER;
+ break;
+
+ case mso_anchorBottom:
+ case mso_anchorBottomCentered:
+ case mso_anchorBottomBaseline:
+ case mso_anchorBottomCenteredBaseline:
+ eTVA = SDRTEXTVERTADJUST_BOTTOM;
+ break;
+ }
+ // if there is a 100% usage of following attributes, the textbox can be aligned also in horizontal direction
+ switch ( eTextAnchor )
+ {
+ case mso_anchorTopCentered :
+ case mso_anchorMiddleCentered :
+ case mso_anchorBottomCentered :
+ case mso_anchorTopCenteredBaseline:
+ case mso_anchorBottomCenteredBaseline:
+ eTHA = SDRTEXTHORZADJUST_CENTER; // the text has to be displayed using the full width;
+ break;
+
+ default :
+ eTHA = SDRTEXTHORZADJUST_LEFT;
+ break;
+ }
+ }
+ rSet.Put( SvxFrameDirectionItem( bVerticalText ? FRMDIR_VERT_TOP_RIGHT : FRMDIR_HORI_LEFT_TOP, EE_PARA_WRITINGDIR ) );
+
+ rSet.Put( SdrTextVertAdjustItem( eTVA ) );
+ rSet.Put( SdrTextHorzAdjustItem( eTHA ) );
+
+ rSet.Put( SdrTextLeftDistItem( nTextLeft ) );
+ rSet.Put( SdrTextRightDistItem( nTextRight ) );
+ rSet.Put( SdrTextUpperDistItem( nTextTop ) );
+ rSet.Put( SdrTextLowerDistItem( nTextBottom ) );
+
+ rSet.Put( SdrTextWordWrapItem( (MSO_WrapMode)GetPropertyValue( DFF_Prop_WrapText, mso_wrapSquare ) != mso_wrapNone ? sal_True : sal_False ) );
+ rSet.Put( SdrTextAutoGrowHeightItem( ( GetPropertyValue( DFF_Prop_FitTextToShape ) & 2 ) != 0 ) );
+
+// rSet.Put( SdrTextAutoGrowWidthItem( (MSO_WrapMode)GetPropertyValue( DFF_Prop_WrapText, mso_wrapSquare ) != mso_wrapNone ? sal_False : sal_True ) );
+// rSet.Put( SdrTextAutoGrowHeightItem( ( GetPropertyValue( DFF_Prop_FitTextToShape ) & 2 ) != 0 ) );
+}
+
+void DffPropertyReader::ApplyCustomShapeGeometryAttributes( SvStream& rIn, SfxItemSet& rSet, const DffObjData& rObjData ) const
+{
+
+ sal_uInt32 nAdjustmentsWhichNeedsToBeConverted = 0;
+
+ ///////////////////////////////////////
+ // creating SdrCustomShapeGeometryItem //
+ ///////////////////////////////////////
+ typedef uno::Sequence< beans::PropertyValue > PropSeq;
+ typedef std::vector< beans::PropertyValue > PropVec;
+ typedef PropVec::iterator PropVecIter;
+ PropVecIter aIter;
+ PropVecIter aEnd;
+
+
+ // aPropVec will be filled with all PropertyValues
+ PropVec aPropVec;
+ PropertyValue aProp;
+
+ /////////////////////////////////////////////////////////////////////
+ // "Type" property, including the predefined CustomShape type name //
+ /////////////////////////////////////////////////////////////////////
+ const rtl::OUString sType( RTL_CONSTASCII_USTRINGPARAM ( "Type" ) );
+ aProp.Name = sType;
+ aProp.Value <<= EnhancedCustomShapeTypeNames::Get( rObjData.eShapeType );
+ aPropVec.push_back( aProp );
+
+/*
+ /////////////////
+ // "MirroredX" //
+ /////////////////
+ if ( nShapeFlags & SP_FFLIPH )
+ {
+ const rtl::OUString sMirroredX( RTL_CONSTASCII_USTRINGPARAM ( "MirroredX" ) );
+ sal_Bool bMirroredX = sal_True;
+ aProp.Name = sMirroredX;
+ aProp.Value <<= bMirroredX;
+ aPropVec.push_back( aProp );
+ }
+ /////////////////
+ // "MirroredY" //
+ /////////////////
+ if ( nShapeFlags & SP_FFLIPV )
+ {
+ const rtl::OUString sMirroredY( RTL_CONSTASCII_USTRINGPARAM ( "MirroredY" ) );
+ sal_Bool bMirroredY = sal_True;
+ aProp.Name = sMirroredY;
+ aProp.Value <<= bMirroredY;
+ aPropVec.push_back( aProp );
+ }
+*/
+ ///////////////
+ // "ViewBox" //
+ ///////////////
+
+ sal_Int32 nCoordWidth = 21600; // needed to replace handle type center with absolute value
+ sal_Int32 nCoordHeight= 21600;
+ if ( IsProperty( DFF_Prop_geoLeft ) || IsProperty( DFF_Prop_geoTop ) || IsProperty( DFF_Prop_geoRight ) || IsProperty( DFF_Prop_geoBottom ) )
+ {
+ com::sun::star::awt::Rectangle aViewBox;
+ const rtl::OUString sViewBox( RTL_CONSTASCII_USTRINGPARAM ( "ViewBox" ) );
+ aViewBox.X = GetPropertyValue( DFF_Prop_geoLeft, 0 );
+ aViewBox.Y = GetPropertyValue( DFF_Prop_geoTop, 0 );
+ aViewBox.Width = nCoordWidth = ((sal_Int32)GetPropertyValue( DFF_Prop_geoRight, 21600 ) ) - aViewBox.X;
+ aViewBox.Height = nCoordHeight = ((sal_Int32)GetPropertyValue( DFF_Prop_geoBottom, 21600 ) ) - aViewBox.Y;
+ aProp.Name = sViewBox;
+ aProp.Value <<= aViewBox;
+ aPropVec.push_back( aProp );
+ }
+ /////////////////////
+ // TextRotateAngle //
+ /////////////////////
+ if ( IsProperty( DFF_Prop_txflTextFlow ) || IsProperty( DFF_Prop_cdirFont ) )
+ {
+ sal_Int32 nTextRotateAngle = 0;
+ MSO_TextFlow eTextFlow = (MSO_TextFlow)( GetPropertyValue( DFF_Prop_txflTextFlow ) & 0xFFFF );
+/* sal_Int32 nFontDirection = GetPropertyValue( DFF_Prop_cdirFont, mso_cdir0 ); */
+
+ if ( eTextFlow == mso_txflBtoT ) // Bottom to Top non-@, unten -> oben
+ nTextRotateAngle += 90;
+ switch( GetPropertyValue( DFF_Prop_cdirFont, mso_cdir0 ) ) // SJ: mso_cdir90 and mso_cdir270 will be simulated by
+ { // activating vertical writing for the text objects
+ case mso_cdir90 :
+ {
+ if ( eTextFlow == mso_txflTtoBA )
+ nTextRotateAngle -= 180;
+ }
+ break;
+ case mso_cdir180: nTextRotateAngle -= 180; break;
+ case mso_cdir270:
+ {
+ if ( eTextFlow != mso_txflTtoBA )
+ nTextRotateAngle -= 180;
+ }
+ break;
+ default: break;
+ }
+ if ( nTextRotateAngle )
+ {
+ double fTextRotateAngle = nTextRotateAngle;
+ const rtl::OUString sTextRotateAngle( RTL_CONSTASCII_USTRINGPARAM ( "TextRotateAngle" ) );
+ aProp.Name = sTextRotateAngle;
+ aProp.Value <<= fTextRotateAngle;
+ aPropVec.push_back( aProp );
+ }
+ }
+ //////////////////////////////////////////
+ // "Extrusion" PropertySequence element //
+ //////////////////////////////////////////
+ sal_Bool bExtrusionOn = ( GetPropertyValue( DFF_Prop_fc3DLightFace ) & 8 ) != 0;
+ if ( bExtrusionOn )
+ {
+ PropVec aExtrusionPropVec;
+
+ // "Extrusion"
+ const rtl::OUString sExtrusionOn( RTL_CONSTASCII_USTRINGPARAM ( "Extrusion" ) );
+ aProp.Name = sExtrusionOn;
+ aProp.Value <<= bExtrusionOn;
+ aExtrusionPropVec.push_back( aProp );
+
+ // "Brightness"
+ if ( IsProperty( DFF_Prop_c3DAmbientIntensity ) )
+ {
+ const rtl::OUString sExtrusionBrightness( RTL_CONSTASCII_USTRINGPARAM ( "Brightness" ) );
+ double fBrightness = (sal_Int32)GetPropertyValue( DFF_Prop_c3DAmbientIntensity );
+ fBrightness /= 655.36;
+ aProp.Name = sExtrusionBrightness;
+ aProp.Value <<= fBrightness;
+ aExtrusionPropVec.push_back( aProp );
+ }
+ // "Depth" in 1/100mm
+ if ( IsProperty( DFF_Prop_c3DExtrudeBackward ) || IsProperty( DFF_Prop_c3DExtrudeForward ) )
+ {
+ const rtl::OUString sDepth( RTL_CONSTASCII_USTRINGPARAM ( "Depth" ) );
+ double fBackDepth = (double)((sal_Int32)GetPropertyValue( DFF_Prop_c3DExtrudeBackward, 1270 * 360 )) / 360.0;
+ double fForeDepth = (double)((sal_Int32)GetPropertyValue( DFF_Prop_c3DExtrudeForward ), 0 ) / 360.0;
+ double fDepth = fBackDepth + fForeDepth;
+ double fFraction = fDepth != 0.0 ? fForeDepth / fDepth : 0;
+ EnhancedCustomShapeParameterPair aDepthParaPair;
+ aDepthParaPair.First.Value <<= fDepth;
+ aDepthParaPair.First.Type = EnhancedCustomShapeParameterType::NORMAL;
+ aDepthParaPair.Second.Value <<= fFraction;
+ aDepthParaPair.Second.Type = EnhancedCustomShapeParameterType::NORMAL;
+ aProp.Name = sDepth;
+ aProp.Value <<= aDepthParaPair;
+ aExtrusionPropVec.push_back( aProp );
+ }
+ // "Diffusion"
+ if ( IsProperty( DFF_Prop_c3DDiffuseAmt ) )
+ {
+ const rtl::OUString sExtrusionDiffusion( RTL_CONSTASCII_USTRINGPARAM ( "Diffusion" ) );
+ double fDiffusion = (sal_Int32)GetPropertyValue( DFF_Prop_c3DDiffuseAmt );
+ fDiffusion /= 655.36;
+ aProp.Name = sExtrusionDiffusion;
+ aProp.Value <<= fDiffusion;
+ aExtrusionPropVec.push_back( aProp );
+ }
+ // "NumberOfLineSegments"
+ if ( IsProperty( DFF_Prop_c3DTolerance ) )
+ {
+ const rtl::OUString sExtrusionNumberOfLineSegments( RTL_CONSTASCII_USTRINGPARAM ( "NumberOfLineSegments" ) );
+ aProp.Name = sExtrusionNumberOfLineSegments;
+ aProp.Value <<= (sal_Int32)GetPropertyValue( DFF_Prop_c3DTolerance );
+ aExtrusionPropVec.push_back( aProp );
+ }
+ // "LightFace"
+ const rtl::OUString sExtrusionLightFace( RTL_CONSTASCII_USTRINGPARAM ( "LightFace" ) );
+ sal_Bool bExtrusionLightFace = ( GetPropertyValue( DFF_Prop_fc3DLightFace ) & 1 ) != 0;
+ aProp.Name = sExtrusionLightFace;
+ aProp.Value <<= bExtrusionLightFace;
+ aExtrusionPropVec.push_back( aProp );
+ // "FirstLightHarsh"
+ const rtl::OUString sExtrusionFirstLightHarsh( RTL_CONSTASCII_USTRINGPARAM ( "FirstLightHarsh" ) );
+ sal_Bool bExtrusionFirstLightHarsh = ( GetPropertyValue( DFF_Prop_fc3DFillHarsh ) & 2 ) != 0;
+ aProp.Name = sExtrusionFirstLightHarsh;
+ aProp.Value <<= bExtrusionFirstLightHarsh;
+ aExtrusionPropVec.push_back( aProp );
+ // "SecondLightHarsh"
+ const rtl::OUString sExtrusionSecondLightHarsh( RTL_CONSTASCII_USTRINGPARAM ( "SecondLightHarsh" ) );
+ sal_Bool bExtrusionSecondLightHarsh = ( GetPropertyValue( DFF_Prop_fc3DFillHarsh ) & 1 ) != 0;
+ aProp.Name = sExtrusionSecondLightHarsh;
+ aProp.Value <<= bExtrusionSecondLightHarsh;
+ aExtrusionPropVec.push_back( aProp );
+ // "FirstLightLevel"
+ if ( IsProperty( DFF_Prop_c3DKeyIntensity ) )
+ {
+ const rtl::OUString sExtrusionFirstLightLevel( RTL_CONSTASCII_USTRINGPARAM ( "FirstLightLevel" ) );
+ double fFirstLightLevel = (sal_Int32)GetPropertyValue( DFF_Prop_c3DKeyIntensity );
+ fFirstLightLevel /= 655.36;
+ aProp.Name = sExtrusionFirstLightLevel;
+ aProp.Value <<= fFirstLightLevel;
+ aExtrusionPropVec.push_back( aProp );
+ }
+ // "SecondLightLevel"
+ if ( IsProperty( DFF_Prop_c3DFillIntensity ) )
+ {
+ const rtl::OUString sExtrusionSecondLightLevel( RTL_CONSTASCII_USTRINGPARAM ( "SecondLightLevel" ) );
+ double fSecondLightLevel = (sal_Int32)GetPropertyValue( DFF_Prop_c3DFillIntensity );
+ fSecondLightLevel /= 655.36;
+ aProp.Name = sExtrusionSecondLightLevel;
+ aProp.Value <<= fSecondLightLevel;
+ aExtrusionPropVec.push_back( aProp );
+ }
+ // "FirtstLightDirection"
+ if ( IsProperty( DFF_Prop_c3DKeyX ) || IsProperty( DFF_Prop_c3DKeyY ) || IsProperty( DFF_Prop_c3DKeyZ ) )
+ {
+ double fLightX = (double)((sal_Int32)GetPropertyValue( DFF_Prop_c3DKeyX, 50000 ));
+ double fLightY = (double)((sal_Int32)GetPropertyValue( DFF_Prop_c3DKeyY, 0 ));
+ double fLightZ = (double)((sal_Int32)GetPropertyValue( DFF_Prop_c3DKeyZ, 10000 ));
+ ::com::sun::star::drawing::Direction3D aExtrusionFirstLightDirection( fLightX, fLightY, fLightZ );
+ const rtl::OUString sExtrusionFirstLightDirection( RTL_CONSTASCII_USTRINGPARAM ( "FirstLightDirection" ) );
+ aProp.Name = sExtrusionFirstLightDirection;
+ aProp.Value <<= aExtrusionFirstLightDirection;
+ aExtrusionPropVec.push_back( aProp );
+ }
+ // "SecondLightDirection"
+ if ( IsProperty( DFF_Prop_c3DFillX ) || IsProperty( DFF_Prop_c3DFillY ) || IsProperty( DFF_Prop_c3DFillZ ) )
+ {
+ double fLight2X = (double)((sal_Int32)GetPropertyValue( DFF_Prop_c3DFillX, (sal_uInt32)-50000 ));
+ double fLight2Y = (double)((sal_Int32)GetPropertyValue( DFF_Prop_c3DFillY, 0 ));
+ double fLight2Z = (double)((sal_Int32)GetPropertyValue( DFF_Prop_c3DFillZ, 10000 ));
+ ::com::sun::star::drawing::Direction3D aExtrusionSecondLightDirection( fLight2X, fLight2Y, fLight2Z );
+ const rtl::OUString sExtrusionSecondLightDirection( RTL_CONSTASCII_USTRINGPARAM ( "SecondLightDirection" ) );
+ aProp.Name = sExtrusionSecondLightDirection;
+ aProp.Value <<= aExtrusionSecondLightDirection;
+ aExtrusionPropVec.push_back( aProp );
+ }
+
+/* LockRotationCenter, OrientationAngle and Orientation needs to be converted to use the properties AngleX, AngleY and RotationAngle instead.
+ // "LockRotationCenter"
+ const rtl::OUString sExtrusionLockRotationCenter( RTL_CONSTASCII_USTRINGPARAM ( "LockRotationCenter" ) );
+ sal_Bool bExtrusionLockRotationCenter = ( GetPropertyValue( DFF_Prop_fc3DFillHarsh ) & 16 ) != 0;
+ aProp.Name = sExtrusionLockRotationCenter;
+ aProp.Value <<= bExtrusionLockRotationCenter;
+ aExtrusionPropVec.push_back( aProp );
+
+ // "Orientation"
+ if ( IsProperty( DFF_Prop_c3DRotationAxisX ) || IsProperty( DFF_Prop_c3DRotationAxisY ) || IsProperty( DFF_Prop_c3DRotationAxisZ ) )
+ {
+ double fRotX = (double)((sal_Int32)GetPropertyValue( DFF_Prop_c3DRotationAxisX, 100 ));
+ double fRotY = (double)((sal_Int32)GetPropertyValue( DFF_Prop_c3DRotationAxisY, 0 ));
+ double fRotZ = (double)((sal_Int32)GetPropertyValue( DFF_Prop_c3DRotationAxisZ, 0 ));
+ ::com::sun::star::drawing::Direction3D aExtrusionDirection( fRotX, fRotY, fRotZ );
+ const rtl::OUString sExtrusionDirection( RTL_CONSTASCII_USTRINGPARAM ( "Orientation" ) );
+ aProp.Name = sExtrusionDirection;
+ aProp.Value <<= aExtrusionDirection;
+ aExtrusionPropVec.push_back( aProp );
+ }
+ // "OrientationAngle" in Grad
+ if ( IsProperty( DFF_Prop_c3DRotationAngle ) )
+ {
+ const rtl::OUString sExtrusionOrientationAngle( RTL_CONSTASCII_USTRINGPARAM ( "OrientationAngle" ) );
+ double fOrientationAngle = (double)((sal_Int32)GetPropertyValue( DFF_Prop_c3DRotationAngle )) / 65536.0;
+ aProp.Name = sExtrusionOrientationAngle;
+ aProp.Value <<= fOrientationAngle;
+ aExtrusionPropVec.push_back( aProp );
+ }
+*/
+
+ // "Metal"
+ const rtl::OUString sExtrusionMetal( RTL_CONSTASCII_USTRINGPARAM ( "Metal" ) );
+ sal_Bool bExtrusionMetal = ( GetPropertyValue( DFF_Prop_fc3DLightFace ) & 4 ) != 0;
+ aProp.Name = sExtrusionMetal;
+ aProp.Value <<= bExtrusionMetal;
+ aExtrusionPropVec.push_back( aProp );
+// if ( IsProperty( DFF_Prop_c3DExtrudePlane ) )
+// {
+// UPS
+// }
+ // "ShadeMode"
+ if ( IsProperty( DFF_Prop_c3DRenderMode ) )
+ {
+ const rtl::OUString sExtrusionShadeMode( RTL_CONSTASCII_USTRINGPARAM ( "ShadeMode" ) );
+ sal_uInt32 nExtrusionRenderMode = GetPropertyValue( DFF_Prop_c3DRenderMode );
+ com::sun::star::drawing::ShadeMode eExtrusionShadeMode( com::sun::star::drawing::ShadeMode_FLAT );
+ if ( nExtrusionRenderMode == mso_Wireframe )
+ eExtrusionShadeMode = com::sun::star::drawing::ShadeMode_DRAFT;
+
+ aProp.Name = sExtrusionShadeMode;
+ aProp.Value <<= eExtrusionShadeMode;
+ aExtrusionPropVec.push_back( aProp );
+ }
+ // "RotateAngle" in Grad
+ if ( IsProperty( DFF_Prop_c3DXRotationAngle ) || IsProperty( DFF_Prop_c3DYRotationAngle ) )
+ {
+ const rtl::OUString sExtrusionAngle( RTL_CONSTASCII_USTRINGPARAM ( "RotateAngle" ) );
+ double fAngleX = (double)((sal_Int32)GetPropertyValue( DFF_Prop_c3DXRotationAngle, 0 )) / 65536.0;
+ double fAngleY = (double)((sal_Int32)GetPropertyValue( DFF_Prop_c3DYRotationAngle, 0 )) / 65536.0;
+ EnhancedCustomShapeParameterPair aRotateAnglePair;
+ aRotateAnglePair.First.Value <<= fAngleX;
+ aRotateAnglePair.First.Type = EnhancedCustomShapeParameterType::NORMAL;
+ aRotateAnglePair.Second.Value <<= fAngleY;
+ aRotateAnglePair.Second.Type = EnhancedCustomShapeParameterType::NORMAL;
+ aProp.Name = sExtrusionAngle;
+ aProp.Value <<= aRotateAnglePair;
+ aExtrusionPropVec.push_back( aProp );
+ }
+
+ // "AutoRotationCenter"
+ if ( ( GetPropertyValue( DFF_Prop_fc3DFillHarsh ) & 8 ) == 0 )
+ {
+ // "RotationCenter"
+ if ( IsProperty( DFF_Prop_c3DRotationCenterX ) || IsProperty( DFF_Prop_c3DRotationCenterY ) || IsProperty( DFF_Prop_c3DRotationCenterZ ) )
+ {
+ ::com::sun::star::drawing::Direction3D aRotationCenter(
+ (double)((sal_Int32)GetPropertyValue( DFF_Prop_c3DRotationCenterX, 0 )) / 360.0,
+ (double)((sal_Int32)GetPropertyValue( DFF_Prop_c3DRotationCenterY, 0 )) / 360.0,
+ (double)((sal_Int32)GetPropertyValue( DFF_Prop_c3DRotationCenterZ, 0 )) / 360.0 );
+
+ const rtl::OUString sExtrusionRotationCenter( RTL_CONSTASCII_USTRINGPARAM ( "RotationCenter" ) );
+ aProp.Name = sExtrusionRotationCenter;
+ aProp.Value <<= aRotationCenter;
+ aExtrusionPropVec.push_back( aProp );
+ }
+ }
+ // "Shininess"
+ if ( IsProperty( DFF_Prop_c3DShininess ) )
+ {
+ const rtl::OUString sExtrusionShininess( RTL_CONSTASCII_USTRINGPARAM ( "Shininess" ) );
+ double fShininess = (sal_Int32)GetPropertyValue( DFF_Prop_c3DShininess );
+ fShininess /= 655.36;
+ aProp.Name = sExtrusionShininess;
+ aProp.Value <<= fShininess;
+ aExtrusionPropVec.push_back( aProp );
+ }
+ // "Skew"
+ if ( IsProperty( DFF_Prop_c3DSkewAmount ) || IsProperty( DFF_Prop_c3DSkewAngle ) )
+ {
+ const rtl::OUString sExtrusionSkew( RTL_CONSTASCII_USTRINGPARAM ( "Skew" ) );
+ double fSkewAmount = (sal_Int32)GetPropertyValue( DFF_Prop_c3DSkewAmount, 50 );
+ double fSkewAngle = (double)((sal_Int32)GetPropertyValue( DFF_Prop_c3DSkewAngle, sal::static_int_cast< UINT32 >(-135 * 65536) )) / 65536.0;
+
+ EnhancedCustomShapeParameterPair aSkewPair;
+ aSkewPair.First.Value <<= fSkewAmount;
+ aSkewPair.First.Type = EnhancedCustomShapeParameterType::NORMAL;
+ aSkewPair.Second.Value <<= fSkewAngle;
+ aSkewPair.Second.Type = EnhancedCustomShapeParameterType::NORMAL;
+ aProp.Name = sExtrusionSkew;
+ aProp.Value <<= aSkewPair;
+ aExtrusionPropVec.push_back( aProp );
+ }
+ // "Specularity"
+ if ( IsProperty( DFF_Prop_c3DSpecularAmt ) )
+ {
+ const rtl::OUString sExtrusionSpecularity( RTL_CONSTASCII_USTRINGPARAM ( "Specularity" ) );
+ double fSpecularity = (sal_Int32)GetPropertyValue( DFF_Prop_c3DSpecularAmt );
+ fSpecularity /= 1333;
+ aProp.Name = sExtrusionSpecularity;
+ aProp.Value <<= fSpecularity;
+ aExtrusionPropVec.push_back( aProp );
+ }
+ // "ProjectionMode"
+ const rtl::OUString sExtrusionProjectionMode( RTL_CONSTASCII_USTRINGPARAM ( "ProjectionMode" ) );
+ ProjectionMode eProjectionMode = GetPropertyValue( DFF_Prop_fc3DFillHarsh ) & 4 ? ProjectionMode_PARALLEL : ProjectionMode_PERSPECTIVE;
+ aProp.Name = sExtrusionProjectionMode;
+ aProp.Value <<= eProjectionMode;
+ aExtrusionPropVec.push_back( aProp );
+
+ // "ViewPoint" in 1/100mm
+ if ( IsProperty( DFF_Prop_c3DXViewpoint ) || IsProperty( DFF_Prop_c3DYViewpoint ) || IsProperty( DFF_Prop_c3DZViewpoint ) )
+ {
+ double fViewX = (double)((sal_Int32)GetPropertyValue( DFF_Prop_c3DXViewpoint, 1249920 )) / 360.0;
+ double fViewY = (double)((sal_Int32)GetPropertyValue( DFF_Prop_c3DYViewpoint, (sal_uInt32)-1249920 ))/ 360.0;
+ double fViewZ = (double)((sal_Int32)GetPropertyValue( DFF_Prop_c3DZViewpoint, 9000000 )) / 360.0;
+ ::com::sun::star::drawing::Position3D aExtrusionViewPoint( fViewX, fViewY, fViewZ );
+ const rtl::OUString sExtrusionViewPoint( RTL_CONSTASCII_USTRINGPARAM ( "ViewPoint" ) );
+ aProp.Name = sExtrusionViewPoint;
+ aProp.Value <<= aExtrusionViewPoint;
+ aExtrusionPropVec.push_back( aProp );
+ }
+ // "Origin"
+ if ( IsProperty( DFF_Prop_c3DOriginX ) || IsProperty( DFF_Prop_c3DOriginY ) )
+ {
+ const rtl::OUString sExtrusionOrigin( RTL_CONSTASCII_USTRINGPARAM ( "Origin" ) );
+ double fOriginX = (double)((sal_Int32)GetPropertyValue( DFF_Prop_c3DOriginX, 0 ));
+ double fOriginY = (double)((sal_Int32)GetPropertyValue( DFF_Prop_c3DOriginY, 0 ));
+ fOriginX /= 65536;
+ fOriginY /= 65536;
+ EnhancedCustomShapeParameterPair aOriginPair;
+ aOriginPair.First.Value <<= fOriginX;
+ aOriginPair.First.Type = EnhancedCustomShapeParameterType::NORMAL;
+ aOriginPair.Second.Value <<= fOriginY;
+ aOriginPair.Second.Type = EnhancedCustomShapeParameterType::NORMAL;
+ aProp.Name = sExtrusionOrigin;
+ aProp.Value <<= aOriginPair;
+ aExtrusionPropVec.push_back( aProp );
+ }
+ // "ExtrusionColor"
+ const rtl::OUString sExtrusionColor( RTL_CONSTASCII_USTRINGPARAM ( "Color" ) );
+ sal_Bool bExtrusionColor = IsProperty( DFF_Prop_c3DExtrusionColor ); // ( GetPropertyValue( DFF_Prop_fc3DLightFace ) & 2 ) != 0;
+ aProp.Name = sExtrusionColor;
+ aProp.Value <<= bExtrusionColor;
+ aExtrusionPropVec.push_back( aProp );
+ if ( IsProperty( DFF_Prop_c3DExtrusionColor ) )
+ rSet.Put( XSecondaryFillColorItem( String(), rManager.MSO_CLR_ToColor(
+ GetPropertyValue( DFF_Prop_c3DExtrusionColor ), DFF_Prop_c3DExtrusionColor ) ) );
+ // pushing the whole Extrusion element
+ const rtl::OUString sExtrusion( RTL_CONSTASCII_USTRINGPARAM ( "Extrusion" ) );
+ PropSeq aExtrusionPropSeq( aExtrusionPropVec.size() );
+ aIter = aExtrusionPropVec.begin();
+ aEnd = aExtrusionPropVec.end();
+ beans::PropertyValue* pExtrusionValues = aExtrusionPropSeq.getArray();
+ while ( aIter != aEnd )
+ *pExtrusionValues++ = *aIter++;
+ aProp.Name = sExtrusion;
+ aProp.Value <<= aExtrusionPropSeq;
+ aPropVec.push_back( aProp );
+ }
+
+ /////////////////////////////////////////
+ // "Equations" PropertySequence element //
+ /////////////////////////////////////////
+ if ( IsProperty( DFF_Prop_pFormulas ) )
+ {
+ sal_uInt16 i;
+ sal_uInt16 nNumElem = 0;
+ sal_uInt16 nNumElemMem = 0;
+ sal_uInt16 nElemSize = 8;
+
+ if ( SeekToContent( DFF_Prop_pFormulas, rIn ) )
+ rIn >> nNumElem >> nNumElemMem >> nElemSize;
+
+ sal_Int16 nP1, nP2, nP3;
+ sal_uInt16 nFlags;
+
+ uno::Sequence< rtl::OUString > aEquations( nNumElem );
+ for ( i = 0; i < nNumElem; i++ )
+ {
+ rIn >> nFlags >> nP1 >> nP2 >> nP3;
+ aEquations[ i ] = EnhancedCustomShape2d::GetEquation( nFlags, nP1, nP2, nP3 );
+ }
+ // pushing the whole Equations element
+ const rtl::OUString sEquations( RTL_CONSTASCII_USTRINGPARAM ( "Equations" ) );
+ aProp.Name = sEquations;
+ aProp.Value <<= aEquations;
+ aPropVec.push_back( aProp );
+ }
+
+ ////////////////////////////////////////
+ // "Handles" PropertySequence element //
+ ////////////////////////////////////////
+ if ( IsProperty( DFF_Prop_Handles ) )
+ {
+ sal_uInt16 i;
+ sal_uInt16 nNumElem = 0;
+ sal_uInt16 nNumElemMem = 0;
+ sal_uInt16 nElemSize = 36;
+
+ if ( SeekToContent( DFF_Prop_Handles, rIn ) )
+ rIn >> nNumElem >> nNumElemMem >> nElemSize;
+ if ( nElemSize == 36 )
+ {
+ uno::Sequence< beans::PropertyValues > aHandles( nNumElem );
+ for ( i = 0; i < nNumElem; i++ )
+ {
+ PropVec aHandlePropVec;
+ sal_uInt32 nFlags;
+ sal_Int32 nPositionX, nPositionY, nCenterX, nCenterY, nRangeXMin, nRangeXMax, nRangeYMin, nRangeYMax;
+ rIn >> nFlags
+ >> nPositionX
+ >> nPositionY
+ >> nCenterX
+ >> nCenterY
+ >> nRangeXMin
+ >> nRangeXMax
+ >> nRangeYMin
+ >> nRangeYMax;
+
+ if ( nPositionX == 2 ) // replacing center position with absolute value
+ nPositionX = nCoordWidth / 2;
+ if ( nPositionY == 2 )
+ nPositionY = nCoordHeight / 2;
+ EnhancedCustomShapeParameterPair aPosition;
+ EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aPosition.First, nPositionX, sal_True, sal_True );
+ EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aPosition.Second, nPositionY, sal_True, sal_False );
+ const rtl::OUString sHandlePosition( RTL_CONSTASCII_USTRINGPARAM ( "Position" ) );
+ aProp.Name = sHandlePosition;
+ aProp.Value <<= aPosition;
+ aHandlePropVec.push_back( aProp );
+
+ if ( nFlags & MSDFF_HANDLE_FLAGS_MIRRORED_X )
+ {
+ sal_Bool bMirroredX = sal_True;
+ const rtl::OUString sHandleMirroredX( RTL_CONSTASCII_USTRINGPARAM ( "MirroredX" ) );
+ aProp.Name = sHandleMirroredX;
+ aProp.Value <<= bMirroredX;
+ aHandlePropVec.push_back( aProp );
+ }
+ if ( nFlags & MSDFF_HANDLE_FLAGS_MIRRORED_Y )
+ {
+ sal_Bool bMirroredY = sal_True;
+ const rtl::OUString sHandleMirroredY( RTL_CONSTASCII_USTRINGPARAM ( "MirroredY" ) );
+ aProp.Name = sHandleMirroredY;
+ aProp.Value <<= bMirroredY;
+ aHandlePropVec.push_back( aProp );
+ }
+ if ( nFlags & MSDFF_HANDLE_FLAGS_SWITCHED )
+ {
+ sal_Bool bSwitched = sal_True;
+ const rtl::OUString sHandleSwitched( RTL_CONSTASCII_USTRINGPARAM ( "Switched" ) );
+ aProp.Name = sHandleSwitched;
+ aProp.Value <<= bSwitched;
+ aHandlePropVec.push_back( aProp );
+ }
+ if ( nFlags & MSDFF_HANDLE_FLAGS_POLAR )
+ {
+ if ( nCenterX == 2 )
+ nCenterX = nCoordWidth / 2;
+ if ( nCenterY == 2 )
+ nCenterY = nCoordHeight / 2;
+ if ( ( nPositionY >= 0x256 ) || ( nPositionY <= 0x107 ) ) // position y
+ nAdjustmentsWhichNeedsToBeConverted |= ( 1 << i );
+ EnhancedCustomShapeParameterPair aPolar;
+ EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aPolar.First, nCenterX, ( nFlags & 0x800 ) != 0, sal_True );
+ EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aPolar.Second, nCenterY, ( nFlags & 0x1000 ) != 0, sal_False );
+ const rtl::OUString sHandlePolar( RTL_CONSTASCII_USTRINGPARAM ( "Polar" ) );
+ aProp.Name = sHandlePolar;
+ aProp.Value <<= aPolar;
+ aHandlePropVec.push_back( aProp );
+ }
+ if ( nFlags & MSDFF_HANDLE_FLAGS_MAP )
+ {
+ if ( nCenterX == 2 )
+ nCenterX = nCoordWidth / 2;
+ if ( nCenterY == 2 )
+ nCenterY = nCoordHeight / 2;
+ EnhancedCustomShapeParameterPair aMap;
+ EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aMap.First, nCenterX, ( nFlags & 0x800 ) != 0, sal_True );
+ EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aMap.Second, nCenterY, ( nFlags & 0x1000 ) != 0, sal_False );
+ const rtl::OUString sHandleMap( RTL_CONSTASCII_USTRINGPARAM ( "Map" ) );
+ aProp.Name = sHandleMap;
+ aProp.Value <<= aMap;
+ aHandlePropVec.push_back( aProp );
+ }
+ if ( nFlags & MSDFF_HANDLE_FLAGS_RANGE )
+ {
+ if ( (sal_uInt32)nRangeXMin != 0x80000000 )
+ {
+ if ( nRangeXMin == 2 )
+ nRangeXMin = nCoordWidth / 2;
+ EnhancedCustomShapeParameter aRangeXMinimum;
+ EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aRangeXMinimum, nRangeXMin,
+ ( nFlags & MSDFF_HANDLE_FLAGS_RANGE_X_MIN_IS_SPECIAL ) != 0, sal_True );
+ const rtl::OUString sHandleRangeXMinimum( RTL_CONSTASCII_USTRINGPARAM ( "RangeXMinimum" ) );
+ aProp.Name = sHandleRangeXMinimum;
+ aProp.Value <<= aRangeXMinimum;
+ aHandlePropVec.push_back( aProp );
+ }
+ if ( (sal_uInt32)nRangeXMax != 0x7fffffff )
+ {
+ if ( nRangeXMax == 2 )
+ nRangeXMax = nCoordWidth / 2;
+ EnhancedCustomShapeParameter aRangeXMaximum;
+ EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aRangeXMaximum, nRangeXMax,
+ ( nFlags & MSDFF_HANDLE_FLAGS_RANGE_X_MAX_IS_SPECIAL ) != 0, sal_False );
+ const rtl::OUString sHandleRangeXMaximum( RTL_CONSTASCII_USTRINGPARAM ( "RangeXMaximum" ) );
+ aProp.Name = sHandleRangeXMaximum;
+ aProp.Value <<= aRangeXMaximum;
+ aHandlePropVec.push_back( aProp );
+ }
+ if ( (sal_uInt32)nRangeYMin != 0x80000000 )
+ {
+ if ( nRangeYMin == 2 )
+ nRangeYMin = nCoordHeight / 2;
+ EnhancedCustomShapeParameter aRangeYMinimum;
+ EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aRangeYMinimum, nRangeYMin,
+ ( nFlags & MSDFF_HANDLE_FLAGS_RANGE_Y_MIN_IS_SPECIAL ) != 0, sal_True );
+ const rtl::OUString sHandleRangeYMinimum( RTL_CONSTASCII_USTRINGPARAM ( "RangeYMinimum" ) );
+ aProp.Name = sHandleRangeYMinimum;
+ aProp.Value <<= aRangeYMinimum;
+ aHandlePropVec.push_back( aProp );
+ }
+ if ( (sal_uInt32)nRangeYMax != 0x7fffffff )
+ {
+ if ( nRangeYMax == 2 )
+ nRangeYMax = nCoordHeight / 2;
+ EnhancedCustomShapeParameter aRangeYMaximum;
+ EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aRangeYMaximum, nRangeYMax,
+ ( nFlags & MSDFF_HANDLE_FLAGS_RANGE_Y_MAX_IS_SPECIAL ) != 0, sal_False );
+ const rtl::OUString sHandleRangeYMaximum( RTL_CONSTASCII_USTRINGPARAM ( "RangeYMaximum" ) );
+ aProp.Name = sHandleRangeYMaximum;
+ aProp.Value <<= aRangeYMaximum;
+ aHandlePropVec.push_back( aProp );
+ }
+ }
+ if ( nFlags & MSDFF_HANDLE_FLAGS_RADIUS_RANGE )
+ {
+ if ( (sal_uInt32)nRangeXMin != 0x7fffffff )
+ {
+ if ( nRangeXMin == 2 )
+ nRangeXMin = nCoordWidth / 2;
+ EnhancedCustomShapeParameter aRadiusRangeMinimum;
+ EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aRadiusRangeMinimum, nRangeXMin,
+ ( nFlags & MSDFF_HANDLE_FLAGS_RANGE_X_MIN_IS_SPECIAL ) != 0, sal_True );
+ const rtl::OUString sHandleRadiusRangeMinimum( RTL_CONSTASCII_USTRINGPARAM ( "RadiusRangeMinimum" ) );
+ aProp.Name = sHandleRadiusRangeMinimum;
+ aProp.Value <<= aRadiusRangeMinimum;
+ aHandlePropVec.push_back( aProp );
+ }
+ if ( (sal_uInt32)nRangeXMax != 0x80000000 )
+ {
+ if ( nRangeXMax == 2 )
+ nRangeXMax = nCoordWidth / 2;
+ EnhancedCustomShapeParameter aRadiusRangeMaximum;
+ EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aRadiusRangeMaximum, nRangeXMax,
+ ( nFlags & MSDFF_HANDLE_FLAGS_RANGE_X_MAX_IS_SPECIAL ) != 0, sal_False );
+ const rtl::OUString sHandleRadiusRangeMaximum( RTL_CONSTASCII_USTRINGPARAM ( "RadiusRangeMaximum" ) );
+ aProp.Name = sHandleRadiusRangeMaximum;
+ aProp.Value <<= aRadiusRangeMaximum;
+ aHandlePropVec.push_back( aProp );
+ }
+ }
+ if ( aHandlePropVec.size() )
+ {
+ PropSeq aHandlePropSeq( aHandlePropVec.size() );
+ aIter = aHandlePropVec.begin();
+ aEnd = aHandlePropVec.end();
+ beans::PropertyValue* pHandleValues = aHandlePropSeq.getArray();
+ while ( aIter != aEnd )
+ *pHandleValues++ = *aIter++;
+ aHandles[ i ] = aHandlePropSeq;
+ }
+ }
+ // pushing the whole Handles element
+ const rtl::OUString sHandles( RTL_CONSTASCII_USTRINGPARAM ( "Handles" ) );
+ aProp.Name = sHandles;
+ aProp.Value <<= aHandles;
+ aPropVec.push_back( aProp );
+ }
+ }
+ else
+ {
+ const mso_CustomShape* pDefCustomShape = GetCustomShapeContent( rObjData.eShapeType );
+ if ( pDefCustomShape && pDefCustomShape->nHandles && pDefCustomShape->pHandles )
+ {
+ sal_Int32 i, nCnt = pDefCustomShape->nHandles;
+ const SvxMSDffHandle* pData = pDefCustomShape->pHandles;
+ for ( i = 0; i < nCnt; i++, pData++ )
+ {
+ if ( pData->nFlags & MSDFF_HANDLE_FLAGS_POLAR )
+ {
+ if ( ( pData->nPositionY >= 0x256 ) || ( pData->nPositionY <= 0x107 ) )
+ nAdjustmentsWhichNeedsToBeConverted |= ( 1 << i );
+ }
+ }
+ }
+ }
+ /////////////////////////////////////
+ // "Path" PropertySequence element //
+ /////////////////////////////////////
+ {
+ PropVec aPathPropVec;
+
+ // "Path/ExtrusionAllowed"
+ if ( IsHardAttribute( DFF_Prop_f3DOK ) )
+ {
+ const rtl::OUString sExtrusionAllowed( RTL_CONSTASCII_USTRINGPARAM ( "ExtrusionAllowed" ) );
+ sal_Bool bExtrusionAllowed = ( GetPropertyValue( DFF_Prop_fFillOK ) & 16 ) != 0;
+ aProp.Name = sExtrusionAllowed;
+ aProp.Value <<= bExtrusionAllowed;
+ aPathPropVec.push_back( aProp );
+ }
+ // "Path/ConcentricGradientFillAllowed"
+ if ( IsHardAttribute( DFF_Prop_fFillShadeShapeOK ) )
+ {
+ const rtl::OUString sConcentricGradientFillAllowed( RTL_CONSTASCII_USTRINGPARAM ( "ConcentricGradientFillAllowed" ) );
+ sal_Bool bConcentricGradientFillAllowed = ( GetPropertyValue( DFF_Prop_fFillOK ) & 2 ) != 0;
+ aProp.Name = sConcentricGradientFillAllowed;
+ aProp.Value <<= bConcentricGradientFillAllowed;
+ aPathPropVec.push_back( aProp );
+ }
+ // "Path/TextPathAllowed"
+ if ( IsHardAttribute( DFF_Prop_fGtextOK ) || ( GetPropertyValue( DFF_Prop_gtextFStrikethrough, 0 ) & 0x4000 ) )
+ {
+ const rtl::OUString sTextPathAllowed( RTL_CONSTASCII_USTRINGPARAM ( "TextPathAllowed" ) );
+ sal_Bool bTextPathAllowed = ( GetPropertyValue( DFF_Prop_fFillOK ) & 4 ) != 0;
+ aProp.Name = sTextPathAllowed;
+ aProp.Value <<= bTextPathAllowed;
+ aPathPropVec.push_back( aProp );
+ }
+ // Path/Coordinates
+ if ( IsProperty( DFF_Prop_pVertices ) )
+ {
+ com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair > aCoordinates;
+
+ sal_uInt16 i;
+ sal_uInt16 nNumElemVert = 0;
+ sal_uInt16 nNumElemMemVert = 0;
+ sal_uInt16 nElemSizeVert = 8;
+
+ if ( SeekToContent( DFF_Prop_pVertices, rIn ) )
+ rIn >> nNumElemVert >> nNumElemMemVert >> nElemSizeVert;
+ if ( nNumElemVert )
+ {
+ sal_Int32 nX, nY;
+ sal_Int16 nTmpA, nTmpB;
+ aCoordinates.realloc( nNumElemVert );
+ for ( i = 0; i < nNumElemVert; i++ )
+ {
+ if ( nElemSizeVert == 8 )
+ {
+ rIn >> nX
+ >> nY;
+ }
+ else
+ {
+ rIn >> nTmpA
+ >> nTmpB;
+
+ nX = nTmpA;
+ nY = nTmpB;
+ }
+ EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( aCoordinates[ i ].First, nX );
+ EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( aCoordinates[ i ].Second, nY );
+ }
+ }
+ const rtl::OUString sCoordinates( RTL_CONSTASCII_USTRINGPARAM ( "Coordinates" ) );
+ aProp.Name = sCoordinates;
+ aProp.Value <<= aCoordinates;
+ aPathPropVec.push_back( aProp );
+ }
+ // Path/Segments
+ if ( IsProperty( DFF_Prop_pSegmentInfo ) )
+ {
+ com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeSegment > aSegments;
+
+ sal_uInt16 i, nTmp;
+ sal_uInt16 nNumElemSeg = 0;
+ sal_uInt16 nNumElemMemSeg = 0;
+ sal_uInt16 nElemSizeSeg = 2;
+
+ if ( SeekToContent( DFF_Prop_pSegmentInfo, rIn ) )
+ rIn >> nNumElemSeg >> nNumElemMemSeg >> nElemSizeSeg;
+ if ( nNumElemSeg )
+ {
+ sal_Int16 nCommand;
+ sal_Int16 nCnt;
+ aSegments.realloc( nNumElemSeg );
+ for ( i = 0; i < nNumElemSeg; i++ )
+ {
+ rIn >> nTmp;
+ nCommand = EnhancedCustomShapeSegmentCommand::UNKNOWN;
+ nCnt = (sal_Int16)( nTmp & 0xfff );
+ switch( nTmp >> 12 )
+ {
+ case 0x0: nCommand = EnhancedCustomShapeSegmentCommand::LINETO; if ( !nCnt ) nCnt = 1; break;
+ case 0x1: nCommand = EnhancedCustomShapeSegmentCommand::LINETO; if ( !nCnt ) nCnt = 1; break; // seems to the relative lineto
+ case 0x4: nCommand = EnhancedCustomShapeSegmentCommand::MOVETO; if ( !nCnt ) nCnt = 1; break;
+ case 0x2: nCommand = EnhancedCustomShapeSegmentCommand::CURVETO; if ( !nCnt ) nCnt = 1; break;
+ case 0x3: nCommand = EnhancedCustomShapeSegmentCommand::CURVETO; if ( !nCnt ) nCnt = 1; break; // seems to be the relative curveto
+ case 0x8: nCommand = EnhancedCustomShapeSegmentCommand::ENDSUBPATH; nCnt = 0; break;
+ case 0x6: nCommand = EnhancedCustomShapeSegmentCommand::CLOSESUBPATH; nCnt = 0; break;
+ case 0xa:
+ case 0xb:
+ {
+ switch ( ( nTmp >> 8 ) & 0xf )
+ {
+ case 0x0:
+ {
+ nCommand = EnhancedCustomShapeSegmentCommand::LINETO;
+ if ( !nCnt )
+ nCnt = 1;
+ }
+ break;
+ case 0x1:
+ {
+ nCommand = EnhancedCustomShapeSegmentCommand::ANGLEELLIPSETO;
+ nCnt = ( nTmp & 0xff ) / 3;
+ }
+ break;
+ case 0x2:
+ {
+ nCommand = EnhancedCustomShapeSegmentCommand::ANGLEELLIPSE;
+ nCnt = ( nTmp & 0xff ) / 3;
+ }
+ break;
+ case 0x3:
+ {
+ nCommand = EnhancedCustomShapeSegmentCommand::ARCTO;
+ nCnt = ( nTmp & 0xff ) >> 2;
+ };
+ break;
+ case 0x4:
+ {
+ nCommand = EnhancedCustomShapeSegmentCommand::ARC;
+ nCnt = ( nTmp & 0xff ) >> 2;
+ }
+ break;
+ case 0x5:
+ {
+ nCommand = EnhancedCustomShapeSegmentCommand::CLOCKWISEARCTO;
+ nCnt = ( nTmp & 0xff ) >> 2;
+ }
+ break;
+ case 0x6:
+ {
+ nCommand = EnhancedCustomShapeSegmentCommand::CLOCKWISEARC;
+ nCnt = ( nTmp & 0xff ) >> 2;
+ }
+ break;
+ case 0x7:
+ {
+ nCommand = EnhancedCustomShapeSegmentCommand::ELLIPTICALQUADRANTX;
+ nCnt = nTmp & 0xff;
+ }
+ break;
+ case 0x8:
+ {
+ nCommand = EnhancedCustomShapeSegmentCommand::ELLIPTICALQUADRANTY;
+ nCnt = nTmp & 0xff;
+ }
+ break;
+ case 0xa: nCommand = EnhancedCustomShapeSegmentCommand::NOFILL; nCnt = 0; break;
+ case 0xb: nCommand = EnhancedCustomShapeSegmentCommand::NOSTROKE; nCnt = 0; break;
+ }
+ }
+ break;
+ }
+ // if the command is unknown, we will store all the data in nCnt, so it will be possible to export without loss
+ if ( nCommand == EnhancedCustomShapeSegmentCommand::UNKNOWN )
+ nCnt = (sal_Int16)nTmp;
+ aSegments[ i ].Command = nCommand;
+ aSegments[ i ].Count = nCnt;
+ }
+ }
+ const rtl::OUString sSegments( RTL_CONSTASCII_USTRINGPARAM ( "Segments" ) );
+ aProp.Name = sSegments;
+ aProp.Value <<= aSegments;
+ aPathPropVec.push_back( aProp );
+ }
+ // Path/StretchX
+ if ( IsProperty( DFF_Prop_stretchPointX ) )
+ {
+ const rtl::OUString sStretchX( RTL_CONSTASCII_USTRINGPARAM ( "StretchX" ) );
+ sal_Int32 nStretchX = GetPropertyValue( DFF_Prop_stretchPointX, 0 );
+ aProp.Name = sStretchX;
+ aProp.Value <<= nStretchX;
+ aPathPropVec.push_back( aProp );
+ }
+ // Path/StretchX
+ if ( IsProperty( DFF_Prop_stretchPointY ) )
+ {
+ const rtl::OUString sStretchY( RTL_CONSTASCII_USTRINGPARAM ( "StretchY" ) );
+ sal_Int32 nStretchY = GetPropertyValue( DFF_Prop_stretchPointY, 0 );
+ aProp.Name = sStretchY;
+ aProp.Value <<= nStretchY;
+ aPathPropVec.push_back( aProp );
+ }
+ // Path/TextFrames
+ if ( IsProperty( DFF_Prop_textRectangles ) )
+ {
+ sal_uInt16 i;
+ sal_uInt16 nNumElem = 0;
+ sal_uInt16 nNumElemMem = 0;
+ sal_uInt16 nElemSize = 16;
+
+ if ( SeekToContent( DFF_Prop_textRectangles, rIn ) )
+ rIn >> nNumElem >> nNumElemMem >> nElemSize;
+ if ( nElemSize == 16 )
+ {
+ sal_Int32 nLeft, nTop, nRight, nBottom;
+ com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeTextFrame > aTextFrames( nNumElem );
+ for ( i = 0; i < nNumElem; i++ )
+ {
+ rIn >> nLeft
+ >> nTop
+ >> nRight
+ >> nBottom;
+
+ EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( aTextFrames[ i ].TopLeft.First, nLeft );
+ EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( aTextFrames[ i ].TopLeft.Second, nTop );
+ EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( aTextFrames[ i ].BottomRight.First, nRight );
+ EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( aTextFrames[ i ].BottomRight.Second, nBottom);
+ }
+ const rtl::OUString sTextFrames( RTL_CONSTASCII_USTRINGPARAM ( "TextFrames" ) );
+ aProp.Name = sTextFrames;
+ aProp.Value <<= aTextFrames;
+ aPathPropVec.push_back( aProp );
+ }
+ }
+ //Path/GluePoints
+ if ( IsProperty( DFF_Prop_connectorPoints ) )
+ {
+ com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair > aGluePoints;
+
+ sal_uInt16 i;
+ sal_uInt16 nNumElemVert = 0;
+ sal_uInt16 nNumElemMemVert = 0;
+ sal_uInt16 nElemSizeVert = 8;
+
+ if ( SeekToContent( DFF_Prop_connectorPoints, rIn ) )
+ rIn >> nNumElemVert >> nNumElemMemVert >> nElemSizeVert;
+
+ sal_Int32 nX, nY;
+ sal_Int16 nTmpA, nTmpB;
+ aGluePoints.realloc( nNumElemVert );
+ for ( i = 0; i < nNumElemVert; i++ )
+ {
+ if ( nElemSizeVert == 8 )
+ {
+ rIn >> nX
+ >> nY;
+ }
+ else
+ {
+ rIn >> nTmpA
+ >> nTmpB;
+
+ nX = nTmpA;
+ nY = nTmpB;
+ }
+ EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( aGluePoints[ i ].First, nX );
+ EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( aGluePoints[ i ].Second, nY );
+ }
+ const rtl::OUString sGluePoints( RTL_CONSTASCII_USTRINGPARAM ( "GluePoints" ) );
+ aProp.Name = sGluePoints;
+ aProp.Value <<= aGluePoints;
+ aPathPropVec.push_back( aProp );
+ }
+ if ( IsProperty( DFF_Prop_connectorType ) )
+ {
+ sal_Int16 nGluePointType = (sal_uInt16)GetPropertyValue( DFF_Prop_connectorType );
+ const rtl::OUString sGluePointType( RTL_CONSTASCII_USTRINGPARAM ( "GluePointType" ) );
+ aProp.Name = sGluePointType;
+ aProp.Value <<= nGluePointType;
+ aPathPropVec.push_back( aProp );
+ }
+ // pushing the whole Path element
+ if ( aPathPropVec.size() )
+ {
+ const rtl::OUString sPath( RTL_CONSTASCII_USTRINGPARAM ( "Path" ) );
+ PropSeq aPathPropSeq( aPathPropVec.size() );
+ aIter = aPathPropVec.begin();
+ aEnd = aPathPropVec.end();
+ beans::PropertyValue* pPathValues = aPathPropSeq.getArray();
+ while ( aIter != aEnd )
+ *pPathValues++ = *aIter++;
+ aProp.Name = sPath;
+ aProp.Value <<= aPathPropSeq;
+ aPropVec.push_back( aProp );
+ }
+ }
+ /////////////////////////////////////////
+ // "TextPath" PropertySequence element //
+ /////////////////////////////////////////
+ sal_Bool bTextPathOn = ( GetPropertyValue( DFF_Prop_gtextFStrikethrough ) & 0x4000 ) != 0;
+ if ( bTextPathOn )
+ {
+ PropVec aTextPathPropVec;
+
+ // TextPath
+ const rtl::OUString sTextPathOn( RTL_CONSTASCII_USTRINGPARAM ( "TextPath" ) );
+ aProp.Name = sTextPathOn;
+ aProp.Value <<= bTextPathOn;
+ aTextPathPropVec.push_back( aProp );
+
+ // TextPathMode
+ const rtl::OUString sTextPathMode( RTL_CONSTASCII_USTRINGPARAM ( "TextPathMode" ) );
+ sal_Bool bTextPathFitPath = ( GetPropertyValue( DFF_Prop_gtextFStrikethrough ) & 0x100 ) != 0;
+
+ sal_Bool bTextPathFitShape;
+ if ( IsHardAttribute( DFF_Prop_gtextFStretch ) )
+ bTextPathFitShape = ( GetPropertyValue( DFF_Prop_gtextFStrikethrough ) & 0x400 ) != 0;
+ else
+ {
+ bTextPathFitShape = true;
+ switch( rObjData.eShapeType )
+ {
+ case mso_sptTextArchUpCurve :
+ case mso_sptTextArchDownCurve :
+ case mso_sptTextCircleCurve :
+ case mso_sptTextButtonCurve :
+ bTextPathFitShape = false;
+ default : break;
+ }
+ }
+ EnhancedCustomShapeTextPathMode eTextPathMode( EnhancedCustomShapeTextPathMode_NORMAL );
+ if ( bTextPathFitShape )
+ eTextPathMode = EnhancedCustomShapeTextPathMode_SHAPE;
+ else if ( bTextPathFitPath )
+ eTextPathMode = EnhancedCustomShapeTextPathMode_PATH;
+ aProp.Name = sTextPathMode;
+ aProp.Value <<= eTextPathMode;
+ aTextPathPropVec.push_back( aProp );
+
+ // ScaleX
+ const rtl::OUString sTextPathScaleX( RTL_CONSTASCII_USTRINGPARAM ( "ScaleX" ) );
+ sal_Bool bTextPathScaleX = ( GetPropertyValue( DFF_Prop_gtextFStrikethrough ) & 0x40 ) != 0;
+ aProp.Name = sTextPathScaleX;
+ aProp.Value <<= bTextPathScaleX;
+ aTextPathPropVec.push_back( aProp );
+ // SameLetterHeights
+ const rtl::OUString sSameLetterHeight( RTL_CONSTASCII_USTRINGPARAM ( "SameLetterHeights" ) );
+ sal_Bool bSameLetterHeight = ( GetPropertyValue( DFF_Prop_gtextFStrikethrough ) & 0x80 ) != 0;
+ aProp.Name = sSameLetterHeight;
+ aProp.Value <<= bSameLetterHeight;
+ aTextPathPropVec.push_back( aProp );
+
+ // pushing the whole TextPath element
+ const rtl::OUString sTextPath( RTL_CONSTASCII_USTRINGPARAM ( "TextPath" ) );
+ PropSeq aTextPathPropSeq( aTextPathPropVec.size() );
+ aIter = aTextPathPropVec.begin();
+ aEnd = aTextPathPropVec.end();
+ beans::PropertyValue* pTextPathValues = aTextPathPropSeq.getArray();
+ while ( aIter != aEnd )
+ *pTextPathValues++ = *aIter++;
+ aProp.Name = sTextPath;
+ aProp.Value <<= aTextPathPropSeq;
+ aPropVec.push_back( aProp );
+ }
+ ////////////////////////
+ // "AdjustmentValues" // The AdjustmentValues are imported at last, because depending to the type of the
+ //////////////////////// handle (POLAR) we will convert the adjustment value from a fixed float to double
+
+ // checking the last used adjustment handle, so we can determine how many handles are to allocate
+ sal_Int32 i = DFF_Prop_adjust10Value;
+ while ( ( i >= DFF_Prop_adjustValue ) && !IsProperty( i ) )
+ i--;
+ sal_Int32 nAdjustmentValues = ( i - DFF_Prop_adjustValue ) + 1;
+ if ( nAdjustmentValues )
+ {
+ uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue > aAdjustmentSeq( nAdjustmentValues );
+ while( --nAdjustmentValues >= 0 )
+ {
+ sal_Int32 nValue = 0;
+ beans::PropertyState ePropertyState = beans::PropertyState_DEFAULT_VALUE;
+ if ( IsProperty( i ) )
+ {
+ nValue = GetPropertyValue( i );
+ ePropertyState = beans::PropertyState_DIRECT_VALUE;
+ }
+ if ( nAdjustmentsWhichNeedsToBeConverted & ( 1 << ( i - DFF_Prop_adjustValue ) ) )
+ {
+ double fValue = nValue;
+ fValue /= 65536;
+ aAdjustmentSeq[ nAdjustmentValues ].Value <<= fValue;
+ }
+ else
+ aAdjustmentSeq[ nAdjustmentValues ].Value <<= nValue;
+ aAdjustmentSeq[ nAdjustmentValues ].State = ePropertyState;
+ i--;
+ }
+ const rtl::OUString sAdjustmentValues( RTL_CONSTASCII_USTRINGPARAM ( "AdjustmentValues" ) );
+ aProp.Name = sAdjustmentValues;
+ aProp.Value <<= aAdjustmentSeq;
+ aPropVec.push_back( aProp );
+ }
+
+ // creating the whole property set
+ PropSeq aSeq( aPropVec.size() );
+ beans::PropertyValue* pValues = aSeq.getArray();
+ aIter = aPropVec.begin();
+ aEnd = aPropVec.end();
+ while ( aIter != aEnd )
+ *pValues++ = *aIter++;
+ rSet.Put( SdrCustomShapeGeometryItem( aSeq ) );
+}
+
+void DffPropertyReader::ApplyAttributes( SvStream& rIn, SfxItemSet& rSet ) const
+{
+ Rectangle aEmptyRect;
+ DffRecordHeader aHdTemp;
+ DffObjData aDffObjTemp( aHdTemp, aEmptyRect, 0 );
+ ApplyAttributes( rIn, rSet, aDffObjTemp );
+}
+
+void DffPropertyReader::ApplyAttributes( SvStream& rIn, SfxItemSet& rSet, const DffObjData& rObjData ) const
+{
+// MapUnit eMap( rManager.GetModel()->GetScaleUnit() );
+
+ sal_Bool bHasShadow = sal_False;
+
+ for ( void* pDummy = ((DffPropertyReader*)this)->First(); pDummy; pDummy = ((DffPropertyReader*)this)->Next() )
+ {
+ UINT32 nRecType = GetCurKey();
+ UINT32 nContent = mpContents[ nRecType ];
+ switch ( nRecType )
+ {
+ case DFF_Prop_gtextSize :
+ rSet.Put( SvxFontHeightItem( rManager.ScalePt( nContent ), 100, EE_CHAR_FONTHEIGHT ) );
+ break;
+ // GeoText
+ case DFF_Prop_gtextFStrikethrough :
+ {
+ if ( nContent & 0x20 )
+ rSet.Put( SvxWeightItem( nContent ? WEIGHT_BOLD : WEIGHT_NORMAL, EE_CHAR_WEIGHT ) );
+ if ( nContent & 0x10 )
+ rSet.Put( SvxPostureItem( nContent ? ITALIC_NORMAL : ITALIC_NONE, EE_CHAR_ITALIC ) );
+ if ( nContent & 0x08 )
+ rSet.Put( SvxUnderlineItem( nContent ? UNDERLINE_SINGLE : UNDERLINE_NONE, EE_CHAR_UNDERLINE ) );
+ if ( nContent & 0x40 )
+ rSet.Put(SvxShadowedItem( nContent != 0, EE_CHAR_SHADOW ) );
+// if ( nContent & 0x02 )
+// rSet.Put( SvxCaseMapItem( nContent ? SVX_CASEMAP_KAPITAELCHEN : SVX_CASEMAP_NOT_MAPPED ) );
+ if ( nContent & 0x01 )
+ rSet.Put( SvxCrossedOutItem( nContent ? STRIKEOUT_SINGLE : STRIKEOUT_NONE, EE_CHAR_STRIKEOUT ) );
+ }
+ break;
+
+ case DFF_Prop_fillColor :
+ rSet.Put( XFillColorItem( String(), rManager.MSO_CLR_ToColor( nContent, DFF_Prop_fillColor ) ) );
+ break;
+
+ // ShadowStyle
+ case DFF_Prop_shadowType :
+ {
+ MSO_ShadowType eShadowType = (MSO_ShadowType)nContent;
+ if( eShadowType != mso_shadowOffset )
+ {
+ // mso_shadowDouble
+ // mso_shadowRich
+ // mso_shadowEmbossOrEngrave
+ // koennen wir nicht, kreiere Default-Schatten mit default-
+ // Abstand
+ rSet.Put( SdrShadowXDistItem( 35 ) ); // 0,35 mm Schattendistanz
+ rSet.Put( SdrShadowYDistItem( 35 ) );
+ }
+ }
+ break;
+ case DFF_Prop_shadowColor :
+ rSet.Put( SdrShadowColorItem( String(), rManager.MSO_CLR_ToColor( nContent, DFF_Prop_shadowColor ) ) );
+ break;
+ case DFF_Prop_shadowOpacity :
+ rSet.Put( SdrShadowTransparenceItem( (sal_uInt16)( ( 0x10000 - nContent ) / 655 ) ) );
+ break;
+ case DFF_Prop_shadowOffsetX :
+ {
+ INT32 nVal = (INT32)nContent;
+ rManager.ScaleEmu( nVal );
+ if ( nVal )
+ rSet.Put( SdrShadowXDistItem( nVal ) );
+ }
+ break;
+ case DFF_Prop_shadowOffsetY :
+ {
+ INT32 nVal = (INT32)nContent;
+ rManager.ScaleEmu( nVal );
+ if ( nVal )
+ rSet.Put( SdrShadowYDistItem( nVal ) );
+ }
+ break;
+ case DFF_Prop_fshadowObscured :
+ {
+ bHasShadow = ( nContent & 2 ) != 0;
+ if ( bHasShadow )
+ {
+ if ( !IsProperty( DFF_Prop_shadowOffsetX ) )
+ rSet.Put( SdrShadowXDistItem( 35 ) );
+ if ( !IsProperty( DFF_Prop_shadowOffsetY ) )
+ rSet.Put( SdrShadowYDistItem( 35 ) );
+ }
+ }
+ break;
+ }
+ }
+
+ if ( bHasShadow )
+ {
+ // #160376# sj: activating shadow only if fill and or linestyle is used
+ // this is required because of the latest drawing layer core changes.
+ // Issue i104085 is related to this.
+ UINT32 nLineFlags(GetPropertyValue( DFF_Prop_fNoLineDrawDash ));
+ if(!IsHardAttribute( DFF_Prop_fLine ) && !IsCustomShapeStrokedByDefault( rObjData.eShapeType ))
+ nLineFlags &= ~0x08;
+ UINT32 nFillFlags(GetPropertyValue( DFF_Prop_fNoFillHitTest ));
+ if(!IsHardAttribute( DFF_Prop_fFilled ) && !IsCustomShapeFilledByDefault( rObjData.eShapeType ))
+ nFillFlags &= ~0x10;
+ if ( nFillFlags & 0x10 )
+ {
+ MSO_FillType eMSO_FillType = (MSO_FillType)GetPropertyValue( DFF_Prop_fillType, mso_fillSolid );
+ switch( eMSO_FillType )
+ {
+ case mso_fillSolid :
+ case mso_fillPattern :
+ case mso_fillTexture :
+ case mso_fillPicture :
+ case mso_fillShade :
+ case mso_fillShadeCenter :
+ case mso_fillShadeShape :
+ case mso_fillShadeScale :
+ case mso_fillShadeTitle :
+ break;
+ // case mso_fillBackground :
+ default:
+ nFillFlags &=~0x10; // no fillstyle used
+ break;
+ }
+ }
+ if ( ( ( nLineFlags & 0x08 ) == 0 ) && ( ( nFillFlags & 0x10 ) == 0 ) ) // if there is no fillstyle and linestyle
+ bHasShadow = sal_False; // we are turning shadow off.
+
+ if ( bHasShadow )
+ rSet.Put( SdrShadowItem( bHasShadow ) );
+ }
+ ApplyLineAttributes( rSet, rObjData.eShapeType ); // #i28269#
+ ApplyFillAttributes( rIn, rSet, rObjData );
+ if ( rObjData.eShapeType != mso_sptNil )
+ {
+ ApplyCustomShapeGeometryAttributes( rIn, rSet, rObjData );
+ ApplyCustomShapeTextAttributes( rSet );
+ }
+}
+
+//---------------------------------------------------------------------------
+//- Record Manager ----------------------------------------------------------
+//---------------------------------------------------------------------------
+
+DffRecordList::DffRecordList( DffRecordList* pList ) :
+ nCount ( 0 ),
+ nCurrent ( 0 ),
+ pPrev ( pList ),
+ pNext ( NULL )
+{
+ if ( pList )
+ pList->pNext = this;
+}
+
+DffRecordList::~DffRecordList()
+{
+ delete pNext;
+}
+
+DffRecordManager::DffRecordManager() :
+ DffRecordList ( NULL ),
+ pCList ( (DffRecordList*)this )
+{
+}
+
+DffRecordManager::DffRecordManager( SvStream& rIn ) :
+ DffRecordList ( NULL ),
+ pCList ( (DffRecordList*)this )
+{
+ Consume( rIn );
+}
+
+DffRecordManager::~DffRecordManager()
+{
+};
+
+
+void DffRecordManager::Consume( SvStream& rIn, BOOL bAppend, UINT32 nStOfs )
+{
+ if ( !bAppend )
+ Clear();
+ UINT32 nOldPos = rIn.Tell();
+ if ( !nStOfs )
+ {
+ DffRecordHeader aHd;
+ rIn >> aHd;
+ if ( aHd.nRecVer == DFF_PSFLAG_CONTAINER )
+ nStOfs = aHd.GetRecEndFilePos();
+ }
+ if ( nStOfs )
+ {
+ pCList = (DffRecordList*)this;
+ while ( pCList->pNext )
+ pCList = pCList->pNext;
+ while ( ( rIn.GetError() == 0 ) && ( ( rIn.Tell() + 8 ) <= nStOfs ) )
+ {
+ if ( pCList->nCount == DFF_RECORD_MANAGER_BUF_SIZE )
+ pCList = new DffRecordList( pCList );
+ rIn >> pCList->mHd[ pCList->nCount ];
+ pCList->mHd[ pCList->nCount++ ].SeekToEndOfRecord( rIn );
+ }
+ rIn.Seek( nOldPos );
+ }
+}
+
+void DffRecordManager::Clear()
+{
+ pCList = (DffRecordList*)this;
+ delete pNext, pNext = NULL;
+ nCurrent = 0;
+ nCount = 0;
+}
+
+DffRecordHeader* DffRecordManager::Current()
+{
+ DffRecordHeader* pRet = NULL;
+ if ( pCList->nCurrent < pCList->nCount )
+ pRet = &pCList->mHd[ pCList->nCurrent ];
+ return pRet;
+}
+
+DffRecordHeader* DffRecordManager::First()
+{
+ DffRecordHeader* pRet = NULL;
+ pCList = (DffRecordList*)this;
+ if ( pCList->nCount )
+ {
+ pCList->nCurrent = 0;
+ pRet = &pCList->mHd[ 0 ];
+ }
+ return pRet;
+}
+
+DffRecordHeader* DffRecordManager::Next()
+{
+ DffRecordHeader* pRet = NULL;
+ UINT32 nC = pCList->nCurrent + 1;
+ if ( nC < pCList->nCount )
+ {
+ pCList->nCurrent++;
+ pRet = &pCList->mHd[ nC ];
+ }
+ else if ( pCList->pNext )
+ {
+ pCList = pCList->pNext;
+ pCList->nCurrent = 0;
+ pRet = &pCList->mHd[ 0 ];
+ }
+ return pRet;
+}
+
+DffRecordHeader* DffRecordManager::Prev()
+{
+ DffRecordHeader* pRet = NULL;
+ UINT32 nCur = pCList->nCurrent;
+ if ( !nCur && pCList->pPrev )
+ {
+ pCList = pCList->pPrev;
+ nCur = pCList->nCount;
+ }
+ if ( nCur-- )
+ {
+ pCList->nCurrent = nCur;
+ pRet = &pCList->mHd[ nCur ];
+ }
+ return pRet;
+}
+
+DffRecordHeader* DffRecordManager::Last()
+{
+ DffRecordHeader* pRet = NULL;
+ while ( pCList->pNext )
+ pCList = pCList->pNext;
+ UINT32 nCnt = pCList->nCount;
+ if ( nCnt-- )
+ {
+ pCList->nCurrent = nCnt;
+ pRet = &pCList->mHd[ nCnt ];
+ }
+ return pRet;
+}
+
+BOOL DffRecordManager::SeekToContent( SvStream& rIn, UINT16 nRecId, DffSeekToContentMode eMode )
+{
+ DffRecordHeader* pHd = GetRecordHeader( nRecId, eMode );
+ if ( pHd )
+ {
+ pHd->SeekToContent( rIn );
+ return TRUE;
+ }
+ else
+ return FALSE;
+}
+
+DffRecordHeader* DffRecordManager::GetRecordHeader( UINT16 nRecId, DffSeekToContentMode eMode )
+{
+ UINT32 nOldCurrent = pCList->nCurrent;
+ DffRecordList* pOldList = pCList;
+ DffRecordHeader* pHd;
+
+ if ( eMode == SEEK_FROM_BEGINNING )
+ pHd = First();
+ else
+ pHd = Next();
+
+ while ( pHd )
+ {
+ if ( pHd->nRecType == nRecId )
+ break;
+ pHd = Next();
+ }
+ if ( !pHd && eMode == SEEK_FROM_CURRENT_AND_RESTART )
+ {
+ DffRecordHeader* pBreak = &pOldList->mHd[ nOldCurrent ];
+ pHd = First();
+ if ( pHd )
+ {
+ while ( pHd != pBreak )
+ {
+ if ( pHd->nRecType == nRecId )
+ break;
+ pHd = Next();
+ }
+ if ( pHd->nRecType != nRecId )
+ pHd = NULL;
+ }
+ }
+ if ( !pHd )
+ {
+ pCList = pOldList;
+ pOldList->nCurrent = nOldCurrent;
+ }
+ return pHd;
+}
+
+//---------------------------------------------------------------------------
+// private Methoden
+//---------------------------------------------------------------------------
+
+struct EscherBlipCacheEntry
+{
+ ByteString aUniqueID;
+ sal_uInt32 nBlip;
+
+ EscherBlipCacheEntry( sal_uInt32 nBlipId, const ByteString& rUniqueID ) :
+ aUniqueID( rUniqueID ),
+ nBlip( nBlipId ) {}
+};
+
+void SvxMSDffManager::Scale( sal_Int32& rVal ) const
+{
+ if ( bNeedMap )
+ rVal = BigMulDiv( rVal, nMapMul, nMapDiv );
+}
+
+void SvxMSDffManager::Scale( Point& rPos ) const
+{
+ rPos.X() += nMapXOfs;
+ rPos.Y() += nMapYOfs;
+ if ( bNeedMap )
+ {
+ rPos.X() = BigMulDiv( rPos.X(), nMapMul, nMapDiv );
+ rPos.Y() = BigMulDiv( rPos.Y(), nMapMul, nMapDiv );
+ }
+}
+
+void SvxMSDffManager::Scale( Size& rSiz ) const
+{
+ if ( bNeedMap )
+ {
+ rSiz.Width() = BigMulDiv( rSiz.Width(), nMapMul, nMapDiv );
+ rSiz.Height() = BigMulDiv( rSiz.Height(), nMapMul, nMapDiv );
+ }
+}
+
+void SvxMSDffManager::Scale( Rectangle& rRect ) const
+{
+ rRect.Move( nMapXOfs, nMapYOfs );
+ if ( bNeedMap )
+ {
+ rRect.Left() =BigMulDiv( rRect.Left() , nMapMul, nMapDiv );
+ rRect.Top() =BigMulDiv( rRect.Top() , nMapMul, nMapDiv );
+ rRect.Right() =BigMulDiv( rRect.Right() , nMapMul, nMapDiv );
+ rRect.Bottom()=BigMulDiv( rRect.Bottom(), nMapMul, nMapDiv );
+ }
+}
+
+void SvxMSDffManager::Scale( Polygon& rPoly ) const
+{
+ if ( !bNeedMap )
+ return;
+ USHORT nPointAnz = rPoly.GetSize();
+ for ( USHORT nPointNum = 0; nPointNum < nPointAnz; nPointNum++ )
+ Scale( rPoly[ nPointNum ] );
+}
+
+void SvxMSDffManager::Scale( PolyPolygon& rPoly ) const
+{
+ if ( !bNeedMap )
+ return;
+ USHORT nPolyAnz = rPoly.Count();
+ for ( USHORT nPolyNum = 0; nPolyNum < nPolyAnz; nPolyNum++ )
+ Scale( rPoly[ nPolyNum ] );
+}
+
+void SvxMSDffManager::ScaleEmu( sal_Int32& rVal ) const
+{
+ rVal = BigMulDiv( rVal, nEmuMul, nEmuDiv );
+}
+
+UINT32 SvxMSDffManager::ScalePt( UINT32 nVal ) const
+{
+ MapUnit eMap = pSdrModel->GetScaleUnit();
+ Fraction aFact( GetMapFactor( MAP_POINT, eMap ).X() );
+ long aMul = aFact.GetNumerator();
+ long aDiv = aFact.GetDenominator() * 65536;
+ aFact = Fraction( aMul, aDiv ); // nochmal versuchen zu kuerzen
+ return BigMulDiv( nVal, aFact.GetNumerator(), aFact.GetDenominator() );
+}
+
+INT32 SvxMSDffManager::ScalePoint( INT32 nVal ) const
+{
+ return BigMulDiv( nVal, nPntMul, nPntDiv );
+};
+
+void SvxMSDffManager::SetModel(SdrModel* pModel, long nApplicationScale)
+{
+ pSdrModel = pModel;
+ if( pModel && (0 < nApplicationScale) )
+ {
+ // PPT arbeitet nur mit Einheiten zu 576DPI
+ // WW hingegen verwendet twips, dh. 1440DPI.
+ MapUnit eMap = pSdrModel->GetScaleUnit();
+ Fraction aFact( GetMapFactor(MAP_INCH, eMap).X() );
+ long nMul=aFact.GetNumerator();
+ long nDiv=aFact.GetDenominator()*nApplicationScale;
+ aFact=Fraction(nMul,nDiv); // nochmal versuchen zu kuerzen
+ // Bei 100TH_MM -> 2540/576=635/144
+ // Bei Twip -> 1440/576=5/2
+ nMapMul = aFact.GetNumerator();
+ nMapDiv = aFact.GetDenominator();
+ bNeedMap = nMapMul!=nMapDiv;
+
+ // MS-DFF-Properties sind grossteils in EMU (English Metric Units) angegeben
+ // 1mm=36000emu, 1twip=635emu
+ aFact=GetMapFactor(MAP_100TH_MM,eMap).X();
+ nMul=aFact.GetNumerator();
+ nDiv=aFact.GetDenominator()*360;
+ aFact=Fraction(nMul,nDiv); // nochmal versuchen zu kuerzen
+ // Bei 100TH_MM -> 1/360
+ // Bei Twip -> 14,40/(25,4*360)=144/91440=1/635
+ nEmuMul=aFact.GetNumerator();
+ nEmuDiv=aFact.GetDenominator();
+
+ // Und noch was fuer typografische Points
+ aFact=GetMapFactor(MAP_POINT,eMap).X();
+ nPntMul=aFact.GetNumerator();
+ nPntDiv=aFact.GetDenominator();
+ }
+ else
+ {
+ pModel = 0;
+ nMapMul = nMapDiv = nMapXOfs = nMapYOfs = nEmuMul = nEmuDiv = nPntMul = nPntDiv = 0;
+ bNeedMap = FALSE;
+ }
+}
+
+BOOL SvxMSDffManager::SeekToShape( SvStream& rSt, void* /* pClientData */, UINT32 nId ) const
+{
+ BOOL bRet = FALSE;
+ if ( mpFidcls )
+ {
+ UINT32 nMerk = rSt.Tell();
+ UINT32 nShapeId, nSec = ( nId >> 10 ) - 1;
+ if ( nSec < mnIdClusters )
+ {
+ sal_IntPtr nOfs = (sal_IntPtr)maDgOffsetTable.Get( mpFidcls[ nSec ].dgid );
+ if ( nOfs )
+ {
+ rSt.Seek( nOfs );
+ DffRecordHeader aEscherF002Hd;
+ rSt >> aEscherF002Hd;
+ ULONG nEscherF002End = aEscherF002Hd.GetRecEndFilePos();
+ DffRecordHeader aEscherObjListHd;
+ while ( rSt.Tell() < nEscherF002End )
+ {
+ rSt >> aEscherObjListHd;
+ if ( aEscherObjListHd.nRecVer != 0xf )
+ aEscherObjListHd.SeekToEndOfRecord( rSt );
+ else if ( aEscherObjListHd.nRecType == DFF_msofbtSpContainer )
+ {
+ DffRecordHeader aShapeHd;
+ if ( SeekToRec( rSt, DFF_msofbtSp, aEscherObjListHd.GetRecEndFilePos(), &aShapeHd ) )
+ {
+ rSt >> nShapeId;
+ if ( nId == nShapeId )
+ {
+ aEscherObjListHd.SeekToBegOfRecord( rSt );
+ bRet = TRUE;
+ break;
+ }
+ }
+ aEscherObjListHd.SeekToEndOfRecord( rSt );
+ }
+ }
+ }
+ }
+ if ( !bRet )
+ rSt.Seek( nMerk );
+ }
+ return bRet;
+}
+
+FASTBOOL SvxMSDffManager::SeekToRec( SvStream& rSt, USHORT nRecId, ULONG nMaxFilePos, DffRecordHeader* pRecHd, ULONG nSkipCount ) const
+{
+ FASTBOOL bRet = FALSE;
+ ULONG nFPosMerk = rSt.Tell(); // FilePos merken fuer ggf. spaetere Restauration
+ DffRecordHeader aHd;
+ do
+ {
+ rSt >> aHd;
+ if ( aHd.nRecType == nRecId )
+ {
+ if ( nSkipCount )
+ nSkipCount--;
+ else
+ {
+ bRet = TRUE;
+ if ( pRecHd != NULL )
+ *pRecHd = aHd;
+ else
+ aHd.SeekToBegOfRecord( rSt );
+ }
+ }
+ if ( !bRet )
+ aHd.SeekToEndOfRecord( rSt );
+ }
+ while ( rSt.GetError() == 0 && rSt.Tell() < nMaxFilePos && !bRet );
+ if ( !bRet )
+ rSt.Seek( nFPosMerk ); // FilePos restaurieren
+ return bRet;
+}
+
+FASTBOOL SvxMSDffManager::SeekToRec2( USHORT nRecId1, USHORT nRecId2, ULONG nMaxFilePos, DffRecordHeader* pRecHd, ULONG nSkipCount ) const
+{
+ FASTBOOL bRet = FALSE;
+ ULONG nFPosMerk = rStCtrl.Tell(); // FilePos merken fuer ggf. spaetere Restauration
+ DffRecordHeader aHd;
+ do
+ {
+ rStCtrl >> aHd;
+ if ( aHd.nRecType == nRecId1 || aHd.nRecType == nRecId2 )
+ {
+ if ( nSkipCount )
+ nSkipCount--;
+ else
+ {
+ bRet = TRUE;
+ if ( pRecHd )
+ *pRecHd = aHd;
+ else
+ aHd.SeekToBegOfRecord( rStCtrl );
+ }
+ }
+ if ( !bRet )
+ aHd.SeekToEndOfRecord( rStCtrl );
+ }
+ while ( rStCtrl.GetError() == 0 && rStCtrl.Tell() < nMaxFilePos && !bRet );
+ if ( !bRet )
+ rStCtrl.Seek( nFPosMerk ); // FilePos restaurieren
+ return bRet;
+}
+
+
+FASTBOOL SvxMSDffManager::GetColorFromPalette( USHORT /* nNum */, Color& rColor ) const
+{
+ // diese Methode ist in der zum Excel-Import
+ // abgeleiteten Klasse zu ueberschreiben...
+ rColor.SetColor( COL_WHITE );
+ return TRUE;
+}
+
+// sj: the documentation is not complete, especially in ppt the normal rgb for text
+// color is written as 0xfeRRGGBB, this can't be explained by the documentation, nearly
+// every bit in the upper code is set -> so there seems to be a special handling for
+// ppt text colors, i decided not to fix this in MSO_CLR_ToColor because of possible
+// side effects, instead MSO_TEXT_CLR_ToColor is called for PPT text colors, to map
+// the color code to something that behaves like the other standard color codes used by
+// fill and line color
+Color SvxMSDffManager::MSO_TEXT_CLR_ToColor( sal_uInt32 nColorCode ) const
+{
+ // Fuer Textfarben: Header ist 0xfeRRGGBB
+ if ( ( nColorCode & 0xfe000000 ) == 0xfe000000 )
+ nColorCode &= 0x00ffffff;
+ else
+ {
+ // for colorscheme colors the color index are the lower three bits of the upper byte
+ if ( ( nColorCode & 0xf8000000 ) == 0 ) // this must be a colorscheme index
+ {
+ nColorCode >>= 24;
+ nColorCode |= 0x8000000;
+ }
+ }
+ return MSO_CLR_ToColor( nColorCode );
+}
+
+Color SvxMSDffManager::MSO_CLR_ToColor( sal_uInt32 nColorCode, sal_uInt16 nContentProperty ) const
+{
+ Color aColor( mnDefaultColor );
+
+ // Fuer Textfarben: Header ist 0xfeRRGGBB
+ if ( ( nColorCode & 0xfe000000 ) == 0xfe000000 ) // sj: it needs to be checked if 0xfe is used in
+ nColorCode &= 0x00ffffff; // other cases than ppt text -> if not this code can be removed
+
+ sal_uInt8 nUpper = (sal_uInt8)( nColorCode >> 24 );
+
+ // sj: below change from 0x1b to 0x19 was done because of i84812 (0x02 -> rgb color),
+ // now I have some problems to fix i104685 (there the color value is 0x02000000 whichs requires
+ // a 0x2 scheme color to be displayed properly), the color docu seems to be incomplete
+ if( nUpper & 0x19 ) // if( nUpper & 0x1f )
+ {
+ if( ( nUpper & 0x08 ) || ( ( nUpper & 0x10 ) == 0 ) )
+ {
+ // SCHEMECOLOR
+ if ( !GetColorFromPalette( ( nUpper & 8 ) ? (sal_uInt16)nColorCode : nUpper, aColor ) )
+ {
+ switch( nContentProperty )
+ {
+ case DFF_Prop_pictureTransparent :
+ case DFF_Prop_shadowColor :
+ case DFF_Prop_fillBackColor :
+ case DFF_Prop_fillColor :
+ aColor = Color( COL_WHITE );
+ break;
+ case DFF_Prop_lineColor :
+ {
+ aColor = Color( COL_BLACK );
+ }
+ break;
+ }
+ }
+ }
+ else // SYSCOLOR
+ {
+ const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
+
+// UINT16 nParameter = (BYTE)( nColorCode >> 16); // SJ: nice compiler optimization bug on windows, though downcasting
+ UINT16 nParameter = sal_uInt16(( nColorCode >> 16 ) & 0x00ff); // the HiByte of nParameter is not zero, an exclusive AND is helping :o
+ UINT16 nFunctionBits = (UINT16)( ( nColorCode & 0x00000f00 ) >> 8 );
+ UINT16 nAdditionalFlags = (UINT16)( ( nColorCode & 0x0000f000) >> 8 );
+ UINT16 nColorIndex = sal_uInt16(nColorCode & 0x00ff);
+ UINT32 nPropColor = 0;
+
+ sal_uInt16 nCProp = 0;
+
+ switch ( nColorIndex )
+ {
+ case mso_syscolorButtonFace : aColor = rStyleSettings.GetFaceColor(); break;
+ case mso_syscolorWindowText : aColor = rStyleSettings.GetWindowTextColor(); break;
+ case mso_syscolorMenu : aColor = rStyleSettings.GetMenuColor(); break;
+ case mso_syscolor3DLight :
+ case mso_syscolorButtonHighlight :
+ case mso_syscolorHighlight : aColor = rStyleSettings.GetHighlightColor(); break;
+ case mso_syscolorHighlightText : aColor = rStyleSettings.GetHighlightTextColor(); break;
+ case mso_syscolorCaptionText : aColor = rStyleSettings.GetMenuTextColor(); break;
+ case mso_syscolorActiveCaption : aColor = rStyleSettings.GetHighlightColor(); break;
+ case mso_syscolorButtonShadow : aColor = rStyleSettings.GetShadowColor(); break;
+ case mso_syscolorButtonText : aColor = rStyleSettings.GetButtonTextColor(); break;
+ case mso_syscolorGrayText : aColor = rStyleSettings.GetDeactiveColor(); break;
+ case mso_syscolorInactiveCaption : aColor = rStyleSettings.GetDeactiveColor(); break;
+ case mso_syscolorInactiveCaptionText : aColor = rStyleSettings.GetDeactiveColor(); break;
+ case mso_syscolorInfoBackground : aColor = rStyleSettings.GetFaceColor(); break;
+ case mso_syscolorInfoText : aColor = rStyleSettings.GetInfoTextColor(); break;
+ case mso_syscolorMenuText : aColor = rStyleSettings.GetMenuTextColor(); break;
+ case mso_syscolorScrollbar : aColor = rStyleSettings.GetFaceColor(); break;
+ case mso_syscolorWindow : aColor = rStyleSettings.GetWindowColor(); break;
+ case mso_syscolorWindowFrame : aColor = rStyleSettings.GetWindowColor(); break;
+
+ case mso_colorFillColor :
+ {
+ nPropColor = GetPropertyValue( DFF_Prop_fillColor, 0xffffff );
+ nCProp = DFF_Prop_fillColor;
+ }
+ break;
+ case mso_colorLineOrFillColor : // ( use the line color only if there is a line )
+ {
+ if ( GetPropertyValue( DFF_Prop_fNoLineDrawDash ) & 8 )
+ {
+ nPropColor = GetPropertyValue( DFF_Prop_lineColor, 0 );
+ nCProp = DFF_Prop_lineColor;
+ }
+ else
+ {
+ nPropColor = GetPropertyValue( DFF_Prop_fillColor, 0xffffff );
+ nCProp = DFF_Prop_fillColor;
+ }
+ }
+ break;
+ case mso_colorLineColor :
+ {
+ nPropColor = GetPropertyValue( DFF_Prop_lineColor, 0 );
+ nCProp = DFF_Prop_lineColor;
+ }
+ break;
+ case mso_colorShadowColor :
+ {
+ nPropColor = GetPropertyValue( DFF_Prop_shadowColor, 0x808080 );
+ nCProp = DFF_Prop_shadowColor;
+ }
+ break;
+ case mso_colorThis : // ( use this color ... )
+ {
+ nPropColor = GetPropertyValue( DFF_Prop_fillColor, 0xffffff ); //?????????????
+ nCProp = DFF_Prop_fillColor;
+ }
+ break;
+ case mso_colorFillBackColor :
+ {
+ nPropColor = GetPropertyValue( DFF_Prop_fillBackColor, 0xffffff );
+ nCProp = DFF_Prop_fillBackColor;
+ }
+ break;
+ case mso_colorLineBackColor :
+ {
+ nPropColor = GetPropertyValue( DFF_Prop_lineBackColor, 0xffffff );
+ nCProp = DFF_Prop_lineBackColor;
+ }
+ break;
+ case mso_colorFillThenLine : // ( use the fillcolor unless no fill and line )
+ {
+ nPropColor = GetPropertyValue( DFF_Prop_fillColor, 0xffffff ); //?????????????
+ nCProp = DFF_Prop_fillColor;
+ }
+ break;
+ case mso_colorIndexMask : // ( extract the color index ) ?
+ {
+ nPropColor = GetPropertyValue( DFF_Prop_fillColor, 0xffffff ); //?????????????
+ nCProp = DFF_Prop_fillColor;
+ }
+ break;
+ }
+ if ( nCProp && ( nPropColor & 0x10000000 ) == 0 ) // beware of looping recursive
+ aColor = MSO_CLR_ToColor( nPropColor, nCProp );
+
+ if( nAdditionalFlags & 0x80 ) // make color gray
+ {
+ UINT8 nZwi = aColor.GetLuminance();
+ aColor = Color( nZwi, nZwi, nZwi );
+ }
+ switch( nFunctionBits )
+ {
+ case 0x01 : // darken color by parameter
+ {
+ aColor.SetRed( sal::static_int_cast< UINT8 >( ( nParameter * aColor.GetRed() ) >> 8 ) );
+ aColor.SetGreen( sal::static_int_cast< UINT8 >( ( nParameter * aColor.GetGreen() ) >> 8 ) );
+ aColor.SetBlue( sal::static_int_cast< UINT8 >( ( nParameter * aColor.GetBlue() ) >> 8 ) );
+ }
+ break;
+ case 0x02 : // lighten color by parameter
+ {
+ UINT16 nInvParameter = ( 0x00ff - nParameter ) * 0xff;
+ aColor.SetRed( sal::static_int_cast< UINT8 >( ( nInvParameter + ( nParameter * aColor.GetRed() ) ) >> 8 ) );
+ aColor.SetGreen( sal::static_int_cast< UINT8 >( ( nInvParameter + ( nParameter * aColor.GetGreen() ) ) >> 8 ) );
+ aColor.SetBlue( sal::static_int_cast< UINT8 >( ( nInvParameter + ( nParameter * aColor.GetBlue() ) ) >> 8 ) );
+ }
+ break;
+ case 0x03 : // add grey level RGB(p,p,p)
+ {
+ INT16 nR = (INT16)aColor.GetRed() + (INT16)nParameter;
+ INT16 nG = (INT16)aColor.GetGreen() + (INT16)nParameter;
+ INT16 nB = (INT16)aColor.GetBlue() + (INT16)nParameter;
+ if ( nR > 0x00ff )
+ nR = 0x00ff;
+ if ( nG > 0x00ff )
+ nG = 0x00ff;
+ if ( nB > 0x00ff )
+ nB = 0x00ff;
+ aColor = Color( (UINT8)nR, (UINT8)nG, (UINT8)nB );
+ }
+ break;
+ case 0x04 : // substract grey level RGB(p,p,p)
+ {
+ INT16 nR = (INT16)aColor.GetRed() - (INT16)nParameter;
+ INT16 nG = (INT16)aColor.GetGreen() - (INT16)nParameter;
+ INT16 nB = (INT16)aColor.GetBlue() - (INT16)nParameter;
+ if ( nR < 0 )
+ nR = 0;
+ if ( nG < 0 )
+ nG = 0;
+ if ( nB < 0 )
+ nB = 0;
+ aColor = Color( (UINT8)nR, (UINT8)nG, (UINT8)nB );
+ }
+ break;
+ case 0x05 : // substract from grey level RGB(p,p,p)
+ {
+ INT16 nR = (INT16)nParameter - (INT16)aColor.GetRed();
+ INT16 nG = (INT16)nParameter - (INT16)aColor.GetGreen();
+ INT16 nB = (INT16)nParameter - (INT16)aColor.GetBlue();
+ if ( nR < 0 )
+ nR = 0;
+ if ( nG < 0 )
+ nG = 0;
+ if ( nB < 0 )
+ nB = 0;
+ aColor = Color( (UINT8)nR, (UINT8)nG, (UINT8)nB );
+ }
+ break;
+ case 0x06 : // per component: black if < p, white if >= p
+ {
+ aColor.SetRed( aColor.GetRed() < nParameter ? 0x00 : 0xff );
+ aColor.SetGreen( aColor.GetGreen() < nParameter ? 0x00 : 0xff );
+ aColor.SetBlue( aColor.GetBlue() < nParameter ? 0x00 : 0xff );
+ }
+ break;
+ }
+ if ( nAdditionalFlags & 0x40 ) // top-bit invert
+ aColor = Color( aColor.GetRed() ^ 0x80, aColor.GetGreen() ^ 0x80, aColor.GetBlue() ^ 0x80 );
+
+ if ( nAdditionalFlags & 0x20 ) // invert color
+ aColor = Color(0xff - aColor.GetRed(), 0xff - aColor.GetGreen(), 0xff - aColor.GetBlue());
+ }
+ }
+ else if ( ( nUpper & 4 ) && ( ( nColorCode & 0xfffff8 ) == 0 ) )
+ { // case of nUpper == 4 powerpoint takes this as agrument for a colorschemecolor
+ GetColorFromPalette( nUpper, aColor );
+ }
+ else // hart attributiert, eventuell mit Hinweis auf SYSTEMRGB
+ aColor = Color( (BYTE)nColorCode, (BYTE)( nColorCode >> 8 ), (BYTE)( nColorCode >> 16 ) );
+ return aColor;
+}
+
+FASTBOOL SvxMSDffManager::ReadDffString(SvStream& rSt, String& rTxt) const
+{
+ FASTBOOL bRet=FALSE;
+ DffRecordHeader aStrHd;
+ if( !ReadCommonRecordHeader(aStrHd, rSt) )
+ rSt.Seek( aStrHd.nFilePos );
+ else if ( aStrHd.nRecType == DFF_PST_TextBytesAtom || aStrHd.nRecType == DFF_PST_TextCharsAtom )
+ {
+ FASTBOOL bUniCode=aStrHd.nRecType==DFF_PST_TextCharsAtom;
+ bRet=TRUE;
+ ULONG nBytes = aStrHd.nRecLen;
+ MSDFFReadZString( rSt, rTxt, nBytes, bUniCode );
+ if( !bUniCode )
+ {
+ for ( xub_StrLen n = 0; n < nBytes; n++ )
+ {
+ if( rTxt.GetChar( n ) == 0x0B )
+ rTxt.SetChar( n, ' ' ); // Weicher Umbruch
+ // TODO: Zeilenumbruch im Absatz via Outliner setzen.
+ }
+ }
+ aStrHd.SeekToEndOfRecord( rSt );
+ }
+ else
+ aStrHd.SeekToBegOfRecord( rSt );
+ return bRet;
+}
+
+// sj: I just want to set a string for a text object that may contain multiple
+// paragraphs. If I now take a look at the follwing code I get the impression that
+// our outliner is too complicate to be used properly,
+void SvxMSDffManager::ReadObjText( const String& rText, SdrObject* pObj ) const
+{
+ SdrTextObj* pText = PTR_CAST( SdrTextObj, pObj );
+ if ( pText )
+ {
+ SdrOutliner& rOutliner = pText->ImpGetDrawOutliner();
+ rOutliner.Init( OUTLINERMODE_TEXTOBJECT );
+
+ BOOL bOldUpdateMode = rOutliner.GetUpdateMode();
+ rOutliner.SetUpdateMode( FALSE );
+ rOutliner.SetVertical( pText->IsVerticalWriting() );
+
+ sal_uInt16 nParaIndex = 0;
+ sal_uInt32 nParaSize;
+ const sal_Unicode* pCurrent, *pBuf = rText.GetBuffer();
+ const sal_Unicode* pEnd = rText.GetBuffer() + rText.Len();
+
+ while( pBuf < pEnd )
+ {
+ pCurrent = pBuf;
+
+ for ( nParaSize = 0; pBuf < pEnd; )
+ {
+ sal_Unicode nChar = *pBuf++;
+ if ( nChar == 0xa )
+ {
+ if ( ( pBuf < pEnd ) && ( *pBuf == 0xd ) )
+ pBuf++;
+ break;
+ }
+ else if ( nChar == 0xd )
+ {
+ if ( ( pBuf < pEnd ) && ( *pBuf == 0xa ) )
+ pBuf++;
+ break;
+ }
+ else
+ nParaSize++;
+ }
+ ESelection aSelection( nParaIndex, 0, nParaIndex, 0 );
+ String aParagraph( pCurrent, (sal_uInt16)nParaSize );
+ if ( !nParaIndex && !aParagraph.Len() ) // SJ: we are crashing if the first paragraph is empty ?
+ aParagraph += (sal_Unicode)' '; // otherwise these two lines can be removed.
+ rOutliner.Insert( aParagraph, nParaIndex, 0 );
+ rOutliner.SetParaAttribs( nParaIndex, rOutliner.GetEmptyItemSet() );
+
+ SfxItemSet aParagraphAttribs( rOutliner.GetEmptyItemSet() );
+ if ( !aSelection.nStartPos )
+ aParagraphAttribs.Put( SfxBoolItem( EE_PARA_BULLETSTATE, FALSE ) );
+ aSelection.nStartPos = 0;
+ rOutliner.QuickSetAttribs( aParagraphAttribs, aSelection );
+ nParaIndex++;
+ }
+ OutlinerParaObject* pNewText = rOutliner.CreateParaObject();
+ rOutliner.Clear();
+ rOutliner.SetUpdateMode( bOldUpdateMode );
+ pText->SetOutlinerParaObject( pNewText );
+ }
+}
+
+FASTBOOL SvxMSDffManager::ReadObjText(SvStream& rSt, SdrObject* pObj) const
+{
+ FASTBOOL bRet=FALSE;
+ SdrTextObj* pText = PTR_CAST(SdrTextObj, pObj);
+ if( pText )
+ {
+ DffRecordHeader aTextHd;
+ if( !ReadCommonRecordHeader(aTextHd, rSt) )
+ rSt.Seek( aTextHd.nFilePos );
+ else if ( aTextHd.nRecType==DFF_msofbtClientTextbox )
+ {
+ bRet=TRUE;
+ ULONG nRecEnd=aTextHd.GetRecEndFilePos();
+ DffRecordHeader aHd;
+ String aText;
+// UINT32 nInvent=pText->GetObjInventor();
+// UINT16 nIdent=pText->GetObjIdentifier();
+
+ SdrOutliner& rOutliner=pText->ImpGetDrawOutliner();
+// sal_Int16 nMinDepth = rOutliner.GetMinDepth();
+ USHORT nOutlMode = rOutliner.GetMode();
+
+ { // Wohl 'nen kleiner Bug der EditEngine, das die
+ // Absastzattribute bei Clear() nicht entfernt werden.
+ FASTBOOL bClearParaAttribs = TRUE;
+ rOutliner.SetStyleSheet( 0, NULL );
+ SfxItemSet aSet(rOutliner.GetEmptyItemSet());
+ aSet.Put(SvxColorItem( COL_BLACK ));
+ rOutliner.SetParaAttribs(0,aSet);
+ pText->SetMergedItemSet(aSet);
+
+ bClearParaAttribs = FALSE;
+ if( bClearParaAttribs )
+ {
+ // Wohl 'nen kleiner Bug der EditEngine, dass die
+ // Absastzattribute bei Clear() nicht entfernt werden.
+ rOutliner.SetParaAttribs(0,rOutliner.GetEmptyItemSet());
+ }
+ }
+ rOutliner.Init( OUTLINERMODE_TEXTOBJECT );
+
+// ULONG nFilePosMerker=rSt.Tell();
+ ////////////////////////////////////
+ // TextString und MetaChars lesen //
+ ////////////////////////////////////
+ do
+ {
+ if( !ReadCommonRecordHeader(aHd, rSt) )
+ rSt.Seek( aHd.nFilePos );
+ else
+ {
+ switch (aHd.nRecType)
+ {
+ //case TextHeaderAtom
+ //case TextSpecInfoAtom
+ case DFF_PST_TextBytesAtom:
+ case DFF_PST_TextCharsAtom:
+ {
+ aHd.SeekToBegOfRecord(rSt);
+ ReadDffString(rSt, aText);
+ }
+ break;
+ case DFF_PST_TextRulerAtom :
+ {
+ UINT16 nLen = (UINT16)aHd.nRecLen;
+ if(nLen)
+ {
+ UINT16 nVal1, nVal2, nVal3;
+ UINT16 nDefaultTab = 2540; // PPT def: 1 Inch //rOutliner.GetDefTab();
+ UINT16 nMostrightTab = 0;
+ SfxItemSet aSet(rOutliner.GetEmptyItemSet());
+ SvxTabStopItem aTabItem(0, 0, SVX_TAB_ADJUST_DEFAULT, EE_PARA_TABS);
+
+ rSt >> nVal1;
+ rSt >> nVal2;
+ nLen -= 4;
+
+ // Allg. TAB verstellt auf Wert in nVal3
+ if(nLen && (nVal1 & 0x0001))
+ {
+ rSt >> nVal3;
+ nLen -= 2;
+ nDefaultTab = (UINT16)(((UINT32)nVal3 * 1000) / 240);
+ }
+
+ // Weitere, frei gesetzte TABs
+ if(nLen && (nVal1 & 0x0004))
+ {
+ rSt >> nVal1;
+ nLen -= 2;
+
+ // fest gesetzte TABs importieren
+ while(nLen && nVal1--)
+ {
+ rSt >> nVal2;
+ rSt >> nVal3;
+ nLen -= 4;
+
+ UINT16 nNewTabPos = (UINT16)(((UINT32)nVal2 * 1000) / 240);
+ if(nNewTabPos > nMostrightTab)
+ nMostrightTab = nNewTabPos;
+
+ SvxTabStop aTabStop(nNewTabPos);
+ aTabItem.Insert(aTabStop);
+ }
+ }
+
+ // evtl. noch default-TABs ergaenzen (immer)
+ UINT16 nObjWidth = sal_uInt16(pObj->GetSnapRect().GetWidth() + 1);
+ UINT16 nDefaultTabPos = nDefaultTab;
+
+ while(nDefaultTabPos <= nObjWidth && nDefaultTabPos <= nMostrightTab)
+ nDefaultTabPos =
+ nDefaultTabPos + nDefaultTab;
+
+ while(nDefaultTabPos <= nObjWidth)
+ {
+ SvxTabStop aTabStop(nDefaultTabPos);
+ aTabItem.Insert(aTabStop);
+ nDefaultTabPos =
+ nDefaultTabPos + nDefaultTab;
+ }
+
+ // Falls TABs angelegt wurden, setze diese
+ if(aTabItem.Count())
+ {
+ aSet.Put(aTabItem);
+ rOutliner.SetParaAttribs(0, aSet);
+ }
+ }
+ }
+ break;
+ }
+ aHd.SeekToEndOfRecord( rSt );
+ }
+ }
+ while ( rSt.GetError() == 0 && rSt.Tell() < nRecEnd );
+
+ ////////////////////////
+ // SHIFT-Ret ersetzen //
+ ////////////////////////
+ if ( aText.Len() )
+ {
+ aText += ' ';
+ aText.SetChar( aText.Len()-1, 0x0D );
+ rOutliner.SetText( aText, rOutliner.GetParagraph( 0 ) );
+
+ // SHIFT-Ret ersetzen im Outliner
+ if(aText.GetTokenCount(0x0B) > 1)
+ {
+ UINT32 nParaCount = rOutliner.GetParagraphCount();
+ for(UINT16 a=0;a<nParaCount;a++)
+ {
+ Paragraph* pActPara = rOutliner.GetParagraph(a);
+ String aParaText = rOutliner.GetText(pActPara);
+ for(UINT16 b=0;b<aParaText.Len();b++)
+ {
+ if( aParaText.GetChar( b ) == 0x0B)
+ {
+ ESelection aSelection(a, b, a, b+1);
+ rOutliner.QuickInsertLineBreak(aSelection);
+ }
+ }
+ }
+ }
+ }
+ OutlinerParaObject* pNewText=rOutliner.CreateParaObject();
+ rOutliner.Init( nOutlMode );
+ pText->NbcSetOutlinerParaObject(pNewText);
+ }
+ else
+ aTextHd.SeekToBegOfRecord(rSt);
+
+ }
+ return bRet;
+}
+
+//static
+void SvxMSDffManager::MSDFFReadZString( SvStream& rIn, String& rStr,
+ ULONG nRecLen, FASTBOOL bUniCode )
+{
+ sal_uInt16 nLen = (sal_uInt16)nRecLen;
+ if( nLen )
+ {
+ if ( bUniCode )
+ nLen >>= 1;
+
+ String sBuf;
+ sal_Unicode* pBuf = sBuf.AllocBuffer( nLen );
+
+ if( bUniCode )
+ {
+ rIn.Read( (sal_Char*)pBuf, nLen << 1 );
+
+#ifdef OSL_BIGENDIAN
+ for( sal_uInt16 n = 0; n < nLen; ++n, ++pBuf )
+ *pBuf = SWAPSHORT( *pBuf );
+#endif // ifdef OSL_BIGENDIAN
+ }
+ else
+ {
+ // use the String-Data as buffer for the 8bit characters and
+ // change then all to unicode
+ sal_Char* pReadPos = ((sal_Char*)pBuf) + nLen;
+ rIn.Read( (sal_Char*)pReadPos, nLen );
+ for( sal_uInt16 n = 0; n < nLen; ++n, ++pBuf, ++pReadPos )
+ *pBuf = ByteString::ConvertToUnicode( *pReadPos, RTL_TEXTENCODING_MS_1252 );
+ }
+
+ rStr = sBuf.EraseTrailingChars( 0 );
+ }
+ else
+ rStr.Erase();
+}
+
+SdrObject* SvxMSDffManager::ImportFontWork( SvStream& rStCt, SfxItemSet& rSet, Rectangle& rBoundRect ) const
+{
+ SdrObject* pRet = NULL;
+ String aObjectText;
+ String aFontName;
+ BOOL bTextRotate = FALSE;
+
+ ((SvxMSDffManager*)this)->mnFix16Angle = 0; // we don't want to use this property in future
+ if ( SeekToContent( DFF_Prop_gtextUNICODE, rStCt ) )
+ MSDFFReadZString( rStCt, aObjectText, GetPropertyValue( DFF_Prop_gtextUNICODE ), TRUE );
+ if ( SeekToContent( DFF_Prop_gtextFont, rStCt ) )
+ MSDFFReadZString( rStCt, aFontName, GetPropertyValue( DFF_Prop_gtextFont ), TRUE );
+ if ( GetPropertyValue( DFF_Prop_gtextFStrikethrough, 0 ) & 0x2000 )
+ {
+ // Text ist senkrecht formatiert, Box Kippen
+ INT32 nHalfWidth = ( rBoundRect.GetWidth() + 1) >> 1;
+ INT32 nHalfHeight = ( rBoundRect.GetHeight() + 1) >> 1;
+ Point aTopLeft( rBoundRect.Left() + nHalfWidth - nHalfHeight,
+ rBoundRect.Top() + nHalfHeight - nHalfWidth);
+ Size aNewSize( rBoundRect.GetHeight(), rBoundRect.GetWidth() );
+ Rectangle aNewRect( aTopLeft, aNewSize );
+ rBoundRect = aNewRect;
+
+ String aSrcText( aObjectText );
+ aObjectText.Erase();
+ for( UINT16 a = 0; a < aSrcText.Len(); a++ )
+ {
+ aObjectText += aSrcText.GetChar( a );
+ aObjectText += '\n';
+ }
+ rSet.Put( SdrTextHorzAdjustItem( SDRTEXTHORZADJUST_CENTER ) );
+ bTextRotate = TRUE;
+ }
+ if ( aObjectText.Len() )
+ { // FontWork-Objekt Mit dem Text in aObjectText erzeugen
+ SdrObject* pNewObj = new SdrRectObj( OBJ_TEXT, rBoundRect );
+ if( pNewObj )
+ {
+ pNewObj->SetModel( pSdrModel );
+ ((SdrRectObj*)pNewObj)->SetText( aObjectText );
+ SdrFitToSizeType eFTS = SDRTEXTFIT_PROPORTIONAL;
+ rSet.Put( SdrTextFitToSizeTypeItem( eFTS ) );
+ rSet.Put( SdrTextAutoGrowHeightItem( FALSE ) );
+ rSet.Put( SdrTextAutoGrowWidthItem( FALSE ) );
+ rSet.Put( SvxFontItem( FAMILY_DONTKNOW, aFontName, String(),
+ PITCH_DONTKNOW, RTL_TEXTENCODING_DONTKNOW, EE_CHAR_FONTINFO ));
+
+ pNewObj->SetMergedItemSet(rSet);
+
+ pRet = pNewObj->ConvertToPolyObj( FALSE, FALSE );
+ if( !pRet )
+ pRet = pNewObj;
+ else
+ {
+ pRet->NbcSetSnapRect( rBoundRect );
+ SdrObject::Free( pNewObj );
+ }
+ if( bTextRotate )
+ {
+ double a = 9000 * nPi180;
+ pRet->NbcRotate( rBoundRect.Center(), 9000, sin( a ), cos( a ) );
+ }
+ }
+ }
+ return pRet;
+}
+
+static Size lcl_GetPrefSize(const Graphic& rGraf, MapMode aWanted)
+{
+ MapMode aPrefMapMode(rGraf.GetPrefMapMode());
+ if (aPrefMapMode == aWanted)
+ return rGraf.GetPrefSize();
+ Size aRetSize;
+ if (aPrefMapMode == MAP_PIXEL)
+ {
+ aRetSize = Application::GetDefaultDevice()->PixelToLogic(
+ rGraf.GetPrefSize(), aWanted);
+ }
+ else
+ {
+ aRetSize = Application::GetDefaultDevice()->LogicToLogic(
+ rGraf.GetPrefSize(), rGraf.GetPrefMapMode(), aWanted);
+ }
+ return aRetSize;
+}
+
+// sj: if the parameter pSet is null, then the resulting crop bitmap will be stored in rGraf,
+// otherwise rGraf is untouched and pSet is used to store the corresponding SdrGrafCropItem
+static void lcl_ApplyCropping( const DffPropSet& rPropSet, SfxItemSet* pSet, Graphic& rGraf )
+{
+ sal_Int32 nCropTop = (sal_Int32)rPropSet.GetPropertyValue( DFF_Prop_cropFromTop, 0 );
+ sal_Int32 nCropBottom = (sal_Int32)rPropSet.GetPropertyValue( DFF_Prop_cropFromBottom, 0 );
+ sal_Int32 nCropLeft = (sal_Int32)rPropSet.GetPropertyValue( DFF_Prop_cropFromLeft, 0 );
+ sal_Int32 nCropRight = (sal_Int32)rPropSet.GetPropertyValue( DFF_Prop_cropFromRight, 0 );
+
+ if( nCropTop || nCropBottom || nCropLeft || nCropRight )
+ {
+ double fFactor;
+ Size aCropSize;
+ BitmapEx aCropBitmap;
+ sal_uInt32 nTop( 0 ), nBottom( 0 ), nLeft( 0 ), nRight( 0 );
+
+ if ( pSet ) // use crop attributes ?
+ aCropSize = lcl_GetPrefSize( rGraf, MAP_100TH_MM );
+ else
+ {
+ aCropBitmap = rGraf.GetBitmapEx();
+ aCropSize = aCropBitmap.GetSizePixel();
+ }
+ if ( nCropTop )
+ {
+ fFactor = (double)nCropTop / 65536.0;
+ nTop = (sal_uInt32)( ( (double)( aCropSize.Height() + 1 ) * fFactor ) + 0.5 );
+ }
+ if ( nCropBottom )
+ {
+ fFactor = (double)nCropBottom / 65536.0;
+ nBottom = (sal_uInt32)( ( (double)( aCropSize.Height() + 1 ) * fFactor ) + 0.5 );
+ }
+ if ( nCropLeft )
+ {
+ fFactor = (double)nCropLeft / 65536.0;
+ nLeft = (sal_uInt32)( ( (double)( aCropSize.Width() + 1 ) * fFactor ) + 0.5 );
+ }
+ if ( nCropRight )
+ {
+ fFactor = (double)nCropRight / 65536.0;
+ nRight = (sal_uInt32)( ( (double)( aCropSize.Width() + 1 ) * fFactor ) + 0.5 );
+ }
+ if ( pSet ) // use crop attributes ?
+ pSet->Put( SdrGrafCropItem( nLeft, nTop, nRight, nBottom ) );
+ else
+ {
+ Rectangle aCropRect( nLeft, nTop, aCropSize.Width() - nRight, aCropSize.Height() - nBottom );
+ aCropBitmap.Crop( aCropRect );
+ rGraf = aCropBitmap;
+ }
+ }
+}
+
+SdrObject* SvxMSDffManager::ImportGraphic( SvStream& rSt, SfxItemSet& rSet, const DffObjData& rObjData ) const
+{
+ SdrObject* pRet = NULL;
+ String aFilename;
+ String aLinkFileName, aLinkFilterName;
+ Rectangle aVisArea;
+
+ MSO_BlipFlags eFlags = (MSO_BlipFlags)GetPropertyValue( DFF_Prop_pibFlags, mso_blipflagDefault );
+ sal_uInt32 nBlipId = GetPropertyValue( DFF_Prop_pib, 0 );
+ sal_Bool bGrfRead = sal_False,
+
+ // Grafik verlinkt
+ bLinkGrf = 0 != ( eFlags & mso_blipflagLinkToFile );
+ {
+ Graphic aGraf; // be sure this graphic is deleted before swapping out
+ if( SeekToContent( DFF_Prop_pibName, rSt ) )
+ MSDFFReadZString( rSt, aFilename, GetPropertyValue( DFF_Prop_pibName ), TRUE );
+
+ // UND, ODER folgendes:
+ if( !( eFlags & mso_blipflagDoNotSave ) ) // Grafik embedded
+ {
+ bGrfRead = GetBLIP( nBlipId, aGraf, &aVisArea );
+ if ( !bGrfRead )
+ {
+ /*
+ Still no luck, lets look at the end of this record for a FBSE pool,
+ this fallback is a specific case for how word does it sometimes
+ */
+ rObjData.rSpHd.SeekToEndOfRecord( rSt );
+ DffRecordHeader aHd;
+ rSt >> aHd;
+ if( DFF_msofbtBSE == aHd.nRecType )
+ {
+ const ULONG nSkipBLIPLen = 20;
+ const ULONG nSkipShapePos = 4;
+ const ULONG nSkipBLIP = 4;
+ const ULONG nSkip =
+ nSkipBLIPLen + 4 + nSkipShapePos + 4 + nSkipBLIP;
+
+ if (nSkip <= aHd.nRecLen)
+ {
+ rSt.SeekRel(nSkip);
+ if (0 == rSt.GetError())
+ bGrfRead = GetBLIPDirect( rSt, aGraf, &aVisArea );
+ }
+ }
+ }
+ }
+ if ( bGrfRead )
+ {
+ // the writer is doing it's own cropping, so this part affects only impress and calc
+ if ( GetSvxMSDffSettings() & SVXMSDFF_SETTINGS_CROP_BITMAPS )
+ lcl_ApplyCropping( *this, ( rObjData.nSpFlags & SP_FOLESHAPE ) == 0 ? &rSet : NULL, aGraf );
+
+ if ( IsProperty( DFF_Prop_pictureTransparent ) )
+ {
+ UINT32 nTransColor = GetPropertyValue( DFF_Prop_pictureTransparent, 0 );
+
+ if ( aGraf.GetType() == GRAPHIC_BITMAP )
+ {
+ BitmapEx aBitmapEx( aGraf.GetBitmapEx() );
+ Bitmap aBitmap( aBitmapEx.GetBitmap() );
+ Bitmap aMask( aBitmap.CreateMask( MSO_CLR_ToColor( nTransColor, DFF_Prop_pictureTransparent ), 9 ) );
+ if ( aBitmapEx.IsTransparent() )
+ aMask.CombineSimple( aBitmapEx.GetMask(), BMP_COMBINE_OR );
+ aGraf = BitmapEx( aBitmap, aMask );
+ }
+ }
+
+ sal_Int32 nContrast = GetPropertyValue( DFF_Prop_pictureContrast, 0x10000 );
+ /*
+ 0x10000 is msoffice 50%
+ < 0x10000 is in units of 1/50th of 0x10000 per 1%
+ > 0x10000 is in units where
+ a msoffice x% is stored as 50/(100-x) * 0x10000
+
+ plus, a (ui) microsoft % ranges from 0 to 100, OOO
+ from -100 to 100, so also normalize into that range
+ */
+ if ( nContrast > 0x10000 )
+ {
+ double fX = nContrast;
+ fX /= 0x10000;
+ fX /= 51; // 50 + 1 to round
+ fX = 1/fX;
+ nContrast = static_cast<sal_Int32>(fX);
+ nContrast -= 100;
+ nContrast = -nContrast;
+ nContrast = (nContrast-50)*2;
+ }
+ else if ( nContrast == 0x10000 )
+ nContrast = 0;
+ else
+ {
+ nContrast *= 101; //100 + 1 to round
+ nContrast /= 0x10000;
+ nContrast -= 100;
+ }
+ sal_Int16 nBrightness = (sal_Int16)( (sal_Int32)GetPropertyValue( DFF_Prop_pictureBrightness, 0 ) / 327 );
+ sal_Int32 nGamma = GetPropertyValue( DFF_Prop_pictureGamma, 0x10000 );
+ GraphicDrawMode eDrawMode = GRAPHICDRAWMODE_STANDARD;
+ switch ( GetPropertyValue( DFF_Prop_pictureActive ) & 6 )
+ {
+ case 4 : eDrawMode = GRAPHICDRAWMODE_GREYS; break;
+ case 6 : eDrawMode = GRAPHICDRAWMODE_MONO; break;
+ case 0 :
+ {
+ //office considers the converted values of (in OOo) 70 to be the
+ //"watermark" values, which can vary slightly due to rounding from the
+ //above values
+ if (( nContrast == -70 ) && ( nBrightness == 70 ))
+ {
+ nContrast = 0;
+ nBrightness = 0;
+ eDrawMode = GRAPHICDRAWMODE_WATERMARK;
+ };
+ }
+ break;
+ }
+
+ if ( nContrast || nBrightness || ( nGamma != 0x10000 ) || ( eDrawMode != GRAPHICDRAWMODE_STANDARD ) )
+ {
+ if ( ( rObjData.nSpFlags & SP_FOLESHAPE ) == 0 )
+ {
+ if ( nBrightness )
+ rSet.Put( SdrGrafLuminanceItem( nBrightness ) );
+ if ( nContrast )
+ rSet.Put( SdrGrafContrastItem( (sal_Int16)nContrast ) );
+ if ( nGamma != 0x10000 )
+ rSet.Put( SdrGrafGamma100Item( nGamma / 655 ) );
+ if ( eDrawMode != GRAPHICDRAWMODE_STANDARD )
+ rSet.Put( SdrGrafModeItem( eDrawMode ) );
+ }
+ else
+ {
+ if ( eDrawMode == GRAPHICDRAWMODE_WATERMARK )
+ {
+ nContrast = 60;
+ nBrightness = 70;
+ eDrawMode = GRAPHICDRAWMODE_STANDARD;
+ }
+ switch ( aGraf.GetType() )
+ {
+ case GRAPHIC_BITMAP :
+ {
+ BitmapEx aBitmapEx( aGraf.GetBitmapEx() );
+ if ( nBrightness || nContrast || ( nGamma != 0x10000 ) )
+ aBitmapEx.Adjust( nBrightness, (sal_Int16)nContrast, 0, 0, 0, (double)nGamma / 0x10000, FALSE );
+ if ( eDrawMode == GRAPHICDRAWMODE_GREYS )
+ aBitmapEx.Convert( BMP_CONVERSION_8BIT_GREYS );
+ else if ( eDrawMode == GRAPHICDRAWMODE_MONO )
+ aBitmapEx.Convert( BMP_CONVERSION_1BIT_THRESHOLD );
+ aGraf = aBitmapEx;
+
+ }
+ break;
+
+ case GRAPHIC_GDIMETAFILE :
+ {
+ GDIMetaFile aGdiMetaFile( aGraf.GetGDIMetaFile() );
+ if ( nBrightness || nContrast || ( nGamma != 0x10000 ) )
+ aGdiMetaFile.Adjust( nBrightness, (sal_Int16)nContrast, 0, 0, 0, (double)nGamma / 0x10000, FALSE );
+ if ( eDrawMode == GRAPHICDRAWMODE_GREYS )
+ aGdiMetaFile.Convert( MTF_CONVERSION_8BIT_GREYS );
+ else if ( eDrawMode == GRAPHICDRAWMODE_MONO )
+ aGdiMetaFile.Convert( MTF_CONVERSION_1BIT_THRESHOLD );
+ aGraf = aGdiMetaFile;
+ }
+ break;
+ default: break;
+ }
+ }
+ }
+ }
+
+ // sollte es ein OLE-Object sein?
+ if( bGrfRead && !bLinkGrf && IsProperty( DFF_Prop_pictureId ) )
+ {
+ // TODO/LATER: in future probably the correct aspect should be provided here
+ sal_Int64 nAspect = embed::Aspects::MSOLE_CONTENT;
+ // --> OD 2004-12-14 #i32596# - pass <nCalledByGroup> to method
+ pRet = ImportOLE( GetPropertyValue( DFF_Prop_pictureId ), aGraf, rObjData.aBoundRect, aVisArea, rObjData.nCalledByGroup, nAspect );
+ // <--
+ }
+ if( !pRet )
+ {
+ pRet = new SdrGrafObj;
+ if( bGrfRead )
+ ((SdrGrafObj*)pRet)->SetGraphic( aGraf );
+
+ if( bLinkGrf && !bGrfRead ) // sj: #i55484# if the graphic was embedded ( bGrfRead == true ) then
+ { // we do not need to set a link. TODO: not to lose the information where the graphic is linked from
+ UniString aName( ::URIHelper::SmartRel2Abs( INetURLObject(maBaseURL), aFilename, URIHelper::GetMaybeFileHdl(), true, false,
+ INetURLObject::WAS_ENCODED,
+ INetURLObject::DECODE_UNAMBIGUOUS ) );
+
+ String aFilterName;
+ INetURLObject aURLObj( aName );
+
+ if( aURLObj.GetProtocol() == INET_PROT_NOT_VALID )
+ {
+ String aValidURL;
+
+ if( ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aName, aValidURL ) )
+ aURLObj = INetURLObject( aValidURL );
+ }
+
+ if( aURLObj.GetProtocol() != INET_PROT_NOT_VALID )
+ {
+ GraphicFilter* pGrfFilter = GraphicFilter::GetGraphicFilter();
+ aFilterName = pGrfFilter->GetImportFormatName(
+ pGrfFilter->GetImportFormatNumberForShortName( aURLObj.getExtension() ) );
+ }
+
+ aLinkFileName = aName;
+ aLinkFilterName = aFilterName;
+ }
+ }
+
+ // set the size from BLIP if there is one
+ if ( pRet && bGrfRead && !aVisArea.IsEmpty() )
+ pRet->SetBLIPSizeRectangle( aVisArea );
+
+ if ( !pRet->GetName().Len() ) // SJ 22.02.00 : PPT OLE IMPORT:
+ { // name is already set in ImportOLE !!
+ // JP 01.12.99: SetName before SetModel - because in the other order the Bug 70098 is active
+ if ( ( eFlags & mso_blipflagType ) != mso_blipflagComment )
+ {
+ INetURLObject aURL;
+ aURL.SetSmartURL( aFilename );
+ pRet->SetName( aURL.getBase() );
+ }
+ else
+ pRet->SetName( aFilename );
+ }
+ }
+ pRet->SetModel( pSdrModel ); // fuer GraphicLink erforderlich
+ pRet->SetLogicRect( rObjData.aBoundRect );
+
+ if ( pRet->ISA( SdrGrafObj ) )
+ {
+ if( aLinkFileName.Len() )
+ ((SdrGrafObj*)pRet)->SetGraphicLink( aLinkFileName, aLinkFilterName );
+
+ if ( bLinkGrf && !bGrfRead )
+ {
+ ((SdrGrafObj*)pRet)->ForceSwapIn();
+ Graphic aGraf(((SdrGrafObj*)pRet)->GetGraphic());
+ lcl_ApplyCropping( *this, &rSet, aGraf );
+ }
+ ((SdrGrafObj*)pRet)->ForceSwapOut();
+ }
+
+ return pRet;
+}
+
+// PptSlidePersistEntry& rPersistEntry, SdPage* pPage
+SdrObject* SvxMSDffManager::ImportObj( SvStream& rSt, void* pClientData,
+ Rectangle& rClientRect, const Rectangle& rGlobalChildRect, int nCalledByGroup, sal_Int32* pShapeId )
+{
+ SdrObject* pRet = NULL;
+ DffRecordHeader aObjHd;
+ rSt >> aObjHd;
+ if ( aObjHd.nRecType == DFF_msofbtSpgrContainer )
+ {
+ pRet = ImportGroup( aObjHd, rSt, pClientData, rClientRect, rGlobalChildRect, nCalledByGroup, pShapeId );
+ }
+ else if ( aObjHd.nRecType == DFF_msofbtSpContainer )
+ {
+ pRet = ImportShape( aObjHd, rSt, pClientData, rClientRect, rGlobalChildRect, nCalledByGroup, pShapeId );
+ }
+ aObjHd.SeekToBegOfRecord( rSt ); // FilePos restaurieren
+ return pRet;
+}
+
+SdrObject* SvxMSDffManager::ImportGroup( const DffRecordHeader& rHd, SvStream& rSt, void* pClientData,
+ Rectangle& rClientRect, const Rectangle& rGlobalChildRect,
+ int nCalledByGroup, sal_Int32* pShapeId )
+{
+ SdrObject* pRet = NULL;
+
+ if( pShapeId )
+ *pShapeId = 0;
+
+ rHd.SeekToContent( rSt );
+ DffRecordHeader aRecHd; // the first atom has to be the SpContainer for the GroupObject
+ rSt >> aRecHd;
+ if ( aRecHd.nRecType == DFF_msofbtSpContainer )
+ {
+ INT32 nGroupRotateAngle = 0;
+ INT32 nSpFlags = 0;
+ mnFix16Angle = 0;
+ aRecHd.SeekToBegOfRecord( rSt );
+ 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 ) )
+ {
+ sal_Int32 nHalfWidth = ( aClientRect.GetWidth() + 1 ) >> 1;
+ sal_Int32 nHalfHeight = ( aClientRect.GetHeight() + 1 ) >> 1;
+ Point aTopLeft( aClientRect.Left() + nHalfWidth - nHalfHeight,
+ aClientRect.Top() + nHalfHeight - nHalfWidth );
+ Size aNewSize( aClientRect.GetHeight(), aClientRect.GetWidth() );
+ Rectangle aNewRect( aTopLeft, aNewSize );
+ aClientRect = aNewRect;
+ }
+
+ // now importing the inner objects of the group
+ aRecHd.SeekToEndOfRecord( rSt );
+ while ( ( rSt.GetError() == 0 ) && ( rSt.Tell() < rHd.GetRecEndFilePos() ) )
+ {
+ DffRecordHeader aRecHd2;
+ rSt >> aRecHd2;
+ if ( aRecHd2.nRecType == DFF_msofbtSpgrContainer )
+ {
+ Rectangle aGroupClientAnchor, aGroupChildAnchor;
+ GetGroupAnchors( aRecHd2, rSt, aGroupClientAnchor, aGroupChildAnchor, aClientRect, aGlobalChildRect );
+ aRecHd2.SeekToBegOfRecord( rSt );
+ sal_Int32 nShapeId;
+ SdrObject* pTmp = ImportGroup( aRecHd2, rSt, pClientData, aGroupClientAnchor, aGroupChildAnchor, nCalledByGroup + 1, &nShapeId );
+ if ( pTmp )
+ {
+ ((SdrObjGroup*)pRet)->GetSubList()->NbcInsertObject( pTmp );
+ if( nShapeId )
+ insertShapeId( nShapeId, pTmp );
+ }
+ }
+ else if ( aRecHd2.nRecType == DFF_msofbtSpContainer )
+ {
+ aRecHd2.SeekToBegOfRecord( rSt );
+ sal_Int32 nShapeId;
+ SdrObject* pTmp = ImportShape( aRecHd2, rSt, pClientData, aClientRect, aGlobalChildRect, nCalledByGroup + 1, &nShapeId );
+ if ( pTmp )
+ {
+ ((SdrObjGroup*)pRet)->GetSubList()->NbcInsertObject( pTmp );
+ if( nShapeId )
+ insertShapeId( nShapeId, pTmp );
+ }
+ }
+ aRecHd2.SeekToEndOfRecord( rSt );
+ }
+
+ // pRet->NbcSetSnapRect( aGroupBound );
+ if ( nGroupRotateAngle )
+ {
+ double a = nGroupRotateAngle * nPi180;
+ pRet->NbcRotate( aClientRect.Center(), nGroupRotateAngle, sin( a ), cos( a ) );
+ }
+ if ( nSpFlags & SP_FFLIPV ) // Vertikal gespiegelt?
+ { // 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?
+ { // BoundRect in aBoundRect
+ Point aTop( ( aClientRect.Left() + aClientRect.Right() ) >> 1, aClientRect.Top() );
+ Point aBottom( aTop.X(), aTop.Y() + 1000 );
+ pRet->NbcMirror( aTop, aBottom );
+ }
+ }
+ }
+ return pRet;
+}
+
+SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& rSt, void* pClientData,
+ Rectangle& rClientRect, const Rectangle& rGlobalChildRect,
+ int nCalledByGroup, sal_Int32* pShapeId )
+{
+ SdrObject* pRet = NULL;
+
+ if( pShapeId )
+ *pShapeId = 0;
+
+ rHd.SeekToBegOfRecord( rSt );
+ DffObjData aObjData( rHd, rClientRect, nCalledByGroup );
+ maShapeRecords.Consume( rSt, FALSE );
+ aObjData.bShapeType = maShapeRecords.SeekToContent( rSt, DFF_msofbtSp, SEEK_FROM_BEGINNING );
+ if ( aObjData.bShapeType )
+ {
+ rSt >> aObjData.nShapeId
+ >> aObjData.nSpFlags;
+ aObjData.eShapeType = (MSO_SPT)maShapeRecords.Current()->nRecInstance;
+ }
+ else
+ {
+ aObjData.nShapeId = 0;
+ aObjData.nSpFlags = 0;
+ aObjData.eShapeType = mso_sptNil;
+ }
+
+ if( pShapeId )
+ *pShapeId = aObjData.nShapeId;
+
+ if ( mbTracing )
+ mpTracer->AddAttribute( aObjData.nSpFlags & SP_FGROUP
+ ? rtl::OUString::createFromAscii( "GroupShape" )
+ : rtl::OUString::createFromAscii( "Shape" ),
+ rtl::OUString::valueOf( (sal_Int32)aObjData.nShapeId ) );
+ aObjData.bOpt = maShapeRecords.SeekToContent( rSt, DFF_msofbtOPT, SEEK_FROM_CURRENT_AND_RESTART );
+ if ( aObjData.bOpt )
+ {
+ maShapeRecords.Current()->SeekToBegOfRecord( rSt );
+#ifdef DBG_AUTOSHAPE
+ ReadPropSet( rSt, pClientData, (UINT32)aObjData.eShapeType );
+#else
+ ReadPropSet( rSt, pClientData );
+#endif
+ }
+ else
+ {
+ InitializePropSet(); // get the default PropSet
+ ( (DffPropertyReader*) this )->mnFix16Angle = 0;
+ }
+
+ aObjData.bChildAnchor = maShapeRecords.SeekToContent( rSt, DFF_msofbtChildAnchor, SEEK_FROM_CURRENT_AND_RESTART );
+ if ( aObjData.bChildAnchor )
+ {
+ INT32 l, o, r, u;
+ rSt >> l >> o >> r >> u;
+ Scale( l );
+ Scale( o );
+ Scale( r );
+ Scale( u );
+ aObjData.aChildAnchor = Rectangle( l, o, r, u );
+ if ( !rGlobalChildRect.IsEmpty() && !rClientRect.IsEmpty() && rGlobalChildRect.GetWidth() && rGlobalChildRect.GetHeight() )
+ {
+ double fl = l;
+ double fo = o;
+ double fWidth = r - l;
+ double fHeight= u - o;
+ double fXScale = (double)rClientRect.GetWidth() / (double)rGlobalChildRect.GetWidth();
+ double fYScale = (double)rClientRect.GetHeight() / (double)rGlobalChildRect.GetHeight();
+ fl = ( ( l - rGlobalChildRect.Left() ) * fXScale ) + rClientRect.Left();
+ fo = ( ( o - rGlobalChildRect.Top() ) * fYScale ) + rClientRect.Top();
+ fWidth *= fXScale;
+ fHeight *= fYScale;
+ aObjData.aChildAnchor = Rectangle( Point( (sal_Int32)fl, (sal_Int32)fo ), Size( (sal_Int32)( fWidth + 1 ), (sal_Int32)( fHeight + 1 ) ) );
+ }
+ }
+
+ aObjData.bClientAnchor = maShapeRecords.SeekToContent( rSt, DFF_msofbtClientAnchor, SEEK_FROM_CURRENT_AND_RESTART );
+ if ( aObjData.bClientAnchor )
+ ProcessClientAnchor2( rSt, *maShapeRecords.Current(), pClientData, aObjData );
+
+ if ( aObjData.bChildAnchor )
+ aObjData.aBoundRect = aObjData.aChildAnchor;
+
+ if ( aObjData.nSpFlags & SP_FBACKGROUND )
+ aObjData.aBoundRect = Rectangle( Point(), Size( 1, 1 ) );
+
+ Rectangle aTextRect;
+ if ( !aObjData.aBoundRect.IsEmpty() )
+ { // Rotation auf BoundingBox anwenden, BEVOR ien Objekt generiert wurde
+ if( mnFix16Angle )
+ {
+ long nAngle = mnFix16Angle;
+ if ( ( nAngle > 4500 && nAngle <= 13500 ) || ( nAngle > 22500 && nAngle <= 31500 ) )
+ {
+ INT32 nHalfWidth = ( aObjData.aBoundRect.GetWidth() + 1 ) >> 1;
+ INT32 nHalfHeight = ( aObjData.aBoundRect.GetHeight() + 1 ) >> 1;
+ Point aTopLeft( aObjData.aBoundRect.Left() + nHalfWidth - nHalfHeight,
+ aObjData.aBoundRect.Top() + nHalfHeight - nHalfWidth );
+ Size aNewSize( aObjData.aBoundRect.GetHeight(), aObjData.aBoundRect.GetWidth() );
+ Rectangle aNewRect( aTopLeft, aNewSize );
+ aObjData.aBoundRect = aNewRect;
+ }
+ }
+ aTextRect = aObjData.aBoundRect;
+ FASTBOOL bGraphic = IsProperty( DFF_Prop_pib ) ||
+ IsProperty( DFF_Prop_pibName ) ||
+ IsProperty( DFF_Prop_pibFlags );
+
+ if ( aObjData.nSpFlags & SP_FGROUP )
+ {
+ pRet = new SdrObjGroup;
+ /* After CWS aw033 has been integrated, an empty group object
+ cannot store its resulting bounding rectangle anymore. We have
+ to return this rectangle via rClientRect now, but only, if
+ caller has not passed an own bounding ractangle. */
+ if ( rClientRect.IsEmpty() )
+ rClientRect = aObjData.aBoundRect;
+ nGroupShapeFlags = aObjData.nSpFlags; // #73013#
+ }
+ else if ( ( aObjData.eShapeType != mso_sptNil ) || IsProperty( DFF_Prop_pVertices ) || bGraphic )
+ {
+ SfxItemSet aSet( pSdrModel->GetItemPool() );
+
+ sal_Bool bIsConnector = ( ( aObjData.eShapeType >= mso_sptStraightConnector1 ) && ( aObjData.eShapeType <= mso_sptCurvedConnector5 ) );
+ sal_Bool bIsCustomShape = sal_False;
+ sal_Int32 nObjectRotation = mnFix16Angle;
+ sal_uInt32 nSpFlags = aObjData.nSpFlags;
+
+ if ( bGraphic )
+ {
+ pRet = ImportGraphic( rSt, aSet, aObjData ); // SJ: #68396# is no longer true (fixed in ppt2000)
+ ApplyAttributes( rSt, aSet, aObjData );
+ pRet->SetMergedItemSet(aSet);
+ }
+ else if ( aObjData.eShapeType == mso_sptLine )
+ {
+ basegfx::B2DPolygon aPoly;
+ aPoly.append(basegfx::B2DPoint(aObjData.aBoundRect.Left(), aObjData.aBoundRect.Top()));
+ aPoly.append(basegfx::B2DPoint(aObjData.aBoundRect.Right(), aObjData.aBoundRect.Bottom()));
+ pRet = new SdrPathObj(OBJ_LINE, basegfx::B2DPolyPolygon(aPoly));
+ pRet->SetModel( pSdrModel );
+ ApplyAttributes( rSt, aSet, aObjData );
+ pRet->SetMergedItemSet(aSet);
+ }
+ else
+ {
+ if ( GetCustomShapeContent( aObjData.eShapeType ) || IsProperty( DFF_Prop_pVertices ) )
+ {
+
+ ApplyAttributes( rSt, aSet, aObjData );
+
+// the com.sun.star.drawing.EnhancedCustomShapeEngine is default, so we do not need to set a hard attribute
+// aSet.Put( SdrCustomShapeEngineItem( String::CreateFromAscii( "com.sun.star.drawing.EnhancedCustomShapeEngine" ) ) );
+ pRet = new SdrObjCustomShape();
+ pRet->SetModel( pSdrModel );
+
+ sal_Bool bIsFontwork = ( GetPropertyValue( DFF_Prop_gtextFStrikethrough, 0 ) & 0x4000 ) != 0;
+
+ // in case of a FontWork, the text is set by the escher import
+ if ( bIsFontwork )
+ {
+ String aObjectText;
+ String aFontName;
+ MSO_GeoTextAlign eGeoTextAlign;
+
+ if ( SeekToContent( DFF_Prop_gtextFont, rSt ) )
+ {
+ SvxFontItem aLatin(EE_CHAR_FONTINFO), aAsian(EE_CHAR_FONTINFO_CJK), aComplex(EE_CHAR_FONTINFO_CTL);
+ GetDefaultFonts( aLatin, aAsian, aComplex );
+
+ MSDFFReadZString( rSt, aFontName, GetPropertyValue( DFF_Prop_gtextFont ), TRUE );
+ aSet.Put( SvxFontItem( aLatin.GetFamily(), aFontName, aLatin.GetStyleName(),
+ PITCH_DONTKNOW, RTL_TEXTENCODING_DONTKNOW, EE_CHAR_FONTINFO ));
+ aSet.Put( SvxFontItem( aLatin.GetFamily(), aFontName, aLatin.GetStyleName(),
+ PITCH_DONTKNOW, RTL_TEXTENCODING_DONTKNOW, EE_CHAR_FONTINFO_CJK ) );
+ aSet.Put( SvxFontItem( aLatin.GetFamily(), aFontName, aLatin.GetStyleName(),
+ PITCH_DONTKNOW, RTL_TEXTENCODING_DONTKNOW, EE_CHAR_FONTINFO_CTL ) );
+ }
+
+ // SJ: applying fontattributes for Fontwork :
+ if ( IsHardAttribute( DFF_Prop_gtextFItalic ) )
+ aSet.Put( SvxPostureItem( ( GetPropertyValue( DFF_Prop_gtextFStrikethrough, 0 ) & 0x0010 ) != 0 ? ITALIC_NORMAL : ITALIC_NONE, EE_CHAR_ITALIC ) );
+
+ if ( IsHardAttribute( DFF_Prop_gtextFBold ) )
+ aSet.Put( SvxWeightItem( ( GetPropertyValue( DFF_Prop_gtextFStrikethrough, 0 ) & 0x0020 ) != 0 ? WEIGHT_BOLD : WEIGHT_NORMAL, EE_CHAR_WEIGHT ) );
+
+ // SJ TODO: Vertical Writing is not correct, instead this should be
+ // replaced through "CharacterRotation" by 90°, therefore a new Item has to be
+ // supported by svx core, api and xml file format
+ ((SdrObjCustomShape*)pRet)->SetVerticalWriting( ( GetPropertyValue( DFF_Prop_gtextFStrikethrough, 0 ) & 0x2000 ) != 0 );
+
+ if ( SeekToContent( DFF_Prop_gtextUNICODE, rSt ) )
+ {
+ MSDFFReadZString( rSt, aObjectText, GetPropertyValue( DFF_Prop_gtextUNICODE ), TRUE );
+ ReadObjText( aObjectText, pRet );
+ }
+
+ eGeoTextAlign = ( (MSO_GeoTextAlign)GetPropertyValue( DFF_Prop_gtextAlign, mso_alignTextCenter ) );
+ {
+ SdrTextHorzAdjust eHorzAdjust;
+ switch( eGeoTextAlign )
+ {
+ case mso_alignTextLetterJust :
+ case mso_alignTextWordJust :
+ case mso_alignTextStretch : eHorzAdjust = SDRTEXTHORZADJUST_BLOCK; break;
+ default:
+ case mso_alignTextInvalid :
+ case mso_alignTextCenter : eHorzAdjust = SDRTEXTHORZADJUST_CENTER; break;
+ case mso_alignTextLeft : eHorzAdjust = SDRTEXTHORZADJUST_LEFT; break;
+ case mso_alignTextRight : eHorzAdjust = SDRTEXTHORZADJUST_RIGHT; break;
+ }
+ aSet.Put( SdrTextHorzAdjustItem( eHorzAdjust ) );
+
+ SdrFitToSizeType eFTS = SDRTEXTFIT_NONE;
+ if ( eGeoTextAlign == mso_alignTextStretch )
+ eFTS = SDRTEXTFIT_ALLLINES;
+ aSet.Put( SdrTextFitToSizeTypeItem( eFTS ) );
+ }
+ if ( IsProperty( DFF_Prop_gtextSpacing ) )
+ {
+ sal_Int32 nTextWidth = GetPropertyValue( DFF_Prop_gtextSpacing, 100 < 16 ) / 655;
+ if ( nTextWidth != 100 )
+ aSet.Put( SvxCharScaleWidthItem( (sal_uInt16)nTextWidth, EE_CHAR_FONTWIDTH ) );
+ }
+ if ( GetPropertyValue( DFF_Prop_gtextFStrikethrough, 0 ) & 0x1000 ) // SJ: Font Kerning On ?
+ aSet.Put( SvxKerningItem( 1, EE_CHAR_KERNING ) );
+ }
+ pRet->SetMergedItemSet( aSet );
+
+ // sj: taking care of rtl, ltr. In case of fontwork mso. seems not to be able to set
+ // proper text directions, instead the text default is depending to the string.
+ // so we have to calculate the a text direction from string:
+ if ( bIsFontwork )
+ {
+ OutlinerParaObject* pParaObj = ((SdrObjCustomShape*)pRet)->GetOutlinerParaObject();
+ if ( pParaObj )
+ {
+ SdrOutliner& rOutliner = ((SdrObjCustomShape*)pRet)->ImpGetDrawOutliner();
+ BOOL bOldUpdateMode = rOutliner.GetUpdateMode();
+ SdrModel* pModel = pRet->GetModel();
+ if ( pModel )
+ rOutliner.SetStyleSheetPool( (SfxStyleSheetPool*)pModel->GetStyleSheetPool() );
+ rOutliner.SetUpdateMode( FALSE );
+ rOutliner.SetText( *pParaObj );
+ VirtualDevice aVirDev( 1 );
+ aVirDev.SetMapMode( MAP_100TH_MM );
+ sal_uInt32 i, nParagraphs = rOutliner.GetParagraphCount();
+ if ( nParagraphs )
+ {
+ sal_Bool bCreateNewParaObject = sal_False;
+ for ( i = 0; i < nParagraphs; i++ )
+ {
+ BOOL bIsRTL = aVirDev.GetTextIsRTL( rOutliner.GetText( rOutliner.GetParagraph( i ) ), 0, STRING_LEN );
+ if ( bIsRTL )
+ {
+ SfxItemSet aSet2( rOutliner.GetParaAttribs( (USHORT)i ) );
+ aSet2.Put( SvxFrameDirectionItem( FRMDIR_HORI_RIGHT_TOP, EE_PARA_WRITINGDIR ) );
+ rOutliner.SetParaAttribs( (USHORT)i, aSet2 );
+ bCreateNewParaObject = sal_True;
+ }
+ }
+ if ( bCreateNewParaObject )
+ {
+ OutlinerParaObject* pNewText = rOutliner.CreateParaObject();
+ rOutliner.Init( OUTLINERMODE_TEXTOBJECT );
+ ((SdrObjCustomShape*)pRet)->NbcSetOutlinerParaObject( pNewText );
+ }
+ }
+ rOutliner.Clear();
+ rOutliner.SetUpdateMode( bOldUpdateMode );
+ }
+ }
+
+ // mso_sptArc special treating:
+ // sj: since we actually can't render the arc because of its weird SnapRect settings,
+ // we will create a new CustomShape, that can be saved/loaded without problems.
+ // We will change the shape type, so this code applys only if importing arcs from msoffice.
+ if ( aObjData.eShapeType == mso_sptArc )
+ {
+ const rtl::OUString sAdjustmentValues( RTL_CONSTASCII_USTRINGPARAM ( "AdjustmentValues" ) );
+ const rtl::OUString sCoordinates( RTL_CONSTASCII_USTRINGPARAM ( "Coordinates" ) );
+ const rtl::OUString sHandles( RTL_CONSTASCII_USTRINGPARAM ( "Handles" ) );
+ const rtl::OUString sEquations( RTL_CONSTASCII_USTRINGPARAM ( "Equations" ) );
+ const rtl::OUString sViewBox( RTL_CONSTASCII_USTRINGPARAM ( "ViewBox" ) );
+ const rtl::OUString sPath( RTL_CONSTASCII_USTRINGPARAM ( "Path" ) );
+ const rtl::OUString sTextFrames( RTL_CONSTASCII_USTRINGPARAM ( "TextFrames" ) );
+ SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)((SdrObjCustomShape*)pRet)->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
+ com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair> seqCoordinates;
+ com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue > seqAdjustmentValues;
+
+ // before clearing the GeometryItem we have to store the current Coordinates
+ const uno::Any* pAny = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName( sPath, sCoordinates );
+ Rectangle aPolyBoundRect;
+ if ( pAny && ( *pAny >>= seqCoordinates ) && ( seqCoordinates.getLength() >= 4 ) )
+ {
+ sal_Int32 nPtNum, nNumElemVert = seqCoordinates.getLength();
+ XPolygon aXP( (sal_uInt16)nNumElemVert );
+// const EnhancedCustomShapeParameterPair* pTmp = seqCoordinates.getArray();
+ for ( nPtNum = 0; nPtNum < nNumElemVert; nPtNum++ )
+ {
+ Point aP;
+ sal_Int32 nX = 0, nY = 0;
+ seqCoordinates[ nPtNum ].First.Value >>= nX;
+ seqCoordinates[ nPtNum ].Second.Value >>= nY;
+ aP.X() = nX;
+ aP.Y() = nY;
+ aXP[ (sal_uInt16)nPtNum ] = aP;
+ }
+ aPolyBoundRect = Rectangle( aXP.GetBoundRect() );
+ }
+ else
+ aPolyBoundRect = Rectangle( -21600, 0, 21600, 43200 ); // defaulting
+
+ // clearing items, so MergeDefaultAttributes will set the corresponding defaults from EnhancedCustomShapeGeometry
+ aGeometryItem.ClearPropertyValue( sHandles );
+ aGeometryItem.ClearPropertyValue( sEquations );
+ aGeometryItem.ClearPropertyValue( sViewBox );
+ aGeometryItem.ClearPropertyValue( sPath );
+
+ sal_Int32 nEndAngle = 9000;
+ sal_Int32 nStartAngle = 0;
+ pAny = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName( sAdjustmentValues );
+ if ( pAny && ( *pAny >>= seqAdjustmentValues ) && seqAdjustmentValues.getLength() > 1 )
+ {
+ double fNumber;
+ if ( seqAdjustmentValues[ 0 ].State == com::sun::star::beans::PropertyState_DIRECT_VALUE )
+ {
+ seqAdjustmentValues[ 0 ].Value >>= fNumber;
+ nEndAngle = NormAngle360( - (sal_Int32)fNumber * 100 );
+ }
+ else
+ {
+ fNumber = 270.0;
+ seqAdjustmentValues[ 0 ].Value <<= fNumber;
+ seqAdjustmentValues[ 0 ].State = com::sun::star::beans::PropertyState_DIRECT_VALUE; // so this value will properly be stored
+ }
+
+ if ( seqAdjustmentValues[ 1 ].State == com::sun::star::beans::PropertyState_DIRECT_VALUE )
+ {
+ seqAdjustmentValues[ 1 ].Value >>= fNumber;
+ nStartAngle = NormAngle360( - (sal_Int32)fNumber * 100 );
+ }
+ else
+ {
+ fNumber = 0.0;
+ seqAdjustmentValues[ 1 ].Value <<= fNumber;
+ seqAdjustmentValues[ 1 ].State = com::sun::star::beans::PropertyState_DIRECT_VALUE;
+ }
+
+ PropertyValue aPropVal;
+ aPropVal.Name = sAdjustmentValues;
+ aPropVal.Value <<= seqAdjustmentValues;
+ aGeometryItem.SetPropertyValue( aPropVal ); // storing the angle attribute
+ }
+ if ( nStartAngle != nEndAngle )
+ {
+ XPolygon aXPoly( aPolyBoundRect.Center(), aPolyBoundRect.GetWidth() / 2, aPolyBoundRect.GetHeight() / 2,
+ (USHORT)nStartAngle / 10, (USHORT)nEndAngle / 10, TRUE );
+ Rectangle aPolyPieRect( aXPoly.GetBoundRect() );
+
+ double fYScale, fXScale;
+ double fYOfs, fXOfs;
+
+ Point aP( aObjData.aBoundRect.Center() );
+ Size aS( aObjData.aBoundRect.GetSize() );
+ aP.X() -= aS.Width() / 2;
+ aP.Y() -= aS.Height() / 2;
+ Rectangle aLogicRect( aP, aS );
+
+ fYOfs = fXOfs = 0.0;
+
+ if ( aPolyBoundRect.GetWidth() && aPolyPieRect.GetWidth() )
+ {
+ fXScale = (double)aLogicRect.GetWidth() / (double)aPolyPieRect.GetWidth();
+ if ( nSpFlags & SP_FFLIPH )
+ fXOfs = ( (double)aPolyPieRect.Right() - (double)aPolyBoundRect.Right() ) * fXScale;
+ else
+ fXOfs = ( (double)aPolyBoundRect.Left() - (double)aPolyPieRect.Left() ) * fXScale;
+ }
+ if ( aPolyBoundRect.GetHeight() && aPolyPieRect.GetHeight() )
+ {
+ fYScale = (double)aLogicRect.GetHeight() / (double)aPolyPieRect.GetHeight();
+ if ( nSpFlags & SP_FFLIPV )
+ fYOfs = ( (double)aPolyPieRect.Bottom() - (double)aPolyBoundRect.Bottom() ) * fYScale;
+ else
+ fYOfs = ((double)aPolyBoundRect.Top() - (double)aPolyPieRect.Top() ) * fYScale;
+ }
+
+ fXScale = (double)aPolyBoundRect.GetWidth() / (double)aPolyPieRect.GetWidth();
+ fYScale = (double)aPolyBoundRect.GetHeight() / (double)aPolyPieRect.GetHeight();
+
+ Rectangle aOldBoundRect( aObjData.aBoundRect );
+ aObjData.aBoundRect = Rectangle( Point( aLogicRect.Left() + (sal_Int32)fXOfs, aLogicRect.Top() + (sal_Int32)fYOfs ),
+ Size( (sal_Int32)( aLogicRect.GetWidth() * fXScale ), (sal_Int32)( aLogicRect.GetHeight() * fYScale ) ) );
+
+ // creating the text frame -> scaling into (0,0),(21600,21600) destination coordinate system
+ double fTextFrameScaleX = (double)21600 / (double)aPolyBoundRect.GetWidth();
+ double fTextFrameScaleY = (double)21600 / (double)aPolyBoundRect.GetHeight();
+ sal_Int32 nLeft = (sal_Int32)(( aPolyPieRect.Left() - aPolyBoundRect.Left() ) * fTextFrameScaleX );
+ sal_Int32 nTop = (sal_Int32)(( aPolyPieRect.Top() - aPolyBoundRect.Top() ) * fTextFrameScaleY );
+ sal_Int32 nRight = (sal_Int32)(( aPolyPieRect.Right() - aPolyBoundRect.Left() ) * fTextFrameScaleX );
+ sal_Int32 nBottom= (sal_Int32)(( aPolyPieRect.Bottom()- aPolyBoundRect.Top() ) * fTextFrameScaleY );
+ com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeTextFrame > aTextFrame( 1 );
+ EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( aTextFrame[ 0 ].TopLeft.First, nLeft );
+ EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( aTextFrame[ 0 ].TopLeft.Second, nTop );
+ EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( aTextFrame[ 0 ].BottomRight.First, nRight );
+ EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( aTextFrame[ 0 ].BottomRight.Second,nBottom );
+ PropertyValue aProp;
+ aProp.Name = sTextFrames;
+ aProp.Value <<= aTextFrame;
+ aGeometryItem.SetPropertyValue( sPath, aProp );
+
+ // sj: taking care of the different rotation points, since the new arc is having a bigger snaprect
+ if ( mnFix16Angle )
+ {
+ sal_Int32 nAngle = mnFix16Angle;
+ if ( nSpFlags & SP_FFLIPH )
+ nAngle = 36000 - nAngle;
+ if ( nSpFlags & SP_FFLIPV )
+ nAngle = -nAngle;
+ double a = nAngle * F_PI18000;
+ double ss = sin( a );
+ double cc = cos( a );
+ Point aP1( aOldBoundRect.TopLeft() );
+ Point aC1( aObjData.aBoundRect.Center() );
+ Point aP2( aOldBoundRect.TopLeft() );
+ Point aC2( aOldBoundRect.Center() );
+ RotatePoint( aP1, aC1, ss, cc );
+ RotatePoint( aP2, aC2, ss, cc );
+ aObjData.aBoundRect.Move( aP2.X() - aP1.X(), aP2.Y() - aP1.Y() );
+ }
+ }
+ ((SdrObjCustomShape*)pRet)->SetMergedItem( aGeometryItem );
+ ((SdrObjCustomShape*)pRet)->MergeDefaultAttributes();
+
+ // now setting a new name, so the above correction is only done once when importing from ms
+ SdrCustomShapeGeometryItem aGeoName( (SdrCustomShapeGeometryItem&)((SdrObjCustomShape*)pRet)->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
+ const rtl::OUString sType( RTL_CONSTASCII_USTRINGPARAM ( "Type" ) );
+ const rtl::OUString sName( RTL_CONSTASCII_USTRINGPARAM ( "mso-spt100" ) );
+ PropertyValue aPropVal;
+ aPropVal.Name = sType;
+ aPropVal.Value <<= sName;
+ aGeoName.SetPropertyValue( aPropVal );
+ ((SdrObjCustomShape*)pRet)->SetMergedItem( aGeoName );
+ }
+ else
+ ((SdrObjCustomShape*)pRet)->MergeDefaultAttributes();
+
+ pRet->SetSnapRect( aObjData.aBoundRect );
+ EnhancedCustomShape2d aCustomShape2d( pRet );
+ aTextRect = aCustomShape2d.GetTextRect();
+
+ bIsCustomShape = TRUE;
+
+ if( bIsConnector )
+ {
+ if( nObjectRotation )
+ {
+ double a = nObjectRotation * nPi180;
+ pRet->NbcRotate( aObjData.aBoundRect.Center(), nObjectRotation, sin( a ), cos( a ) );
+ }
+ // Horizontal gespiegelt?
+ if ( nSpFlags & SP_FFLIPH )
+ {
+ Rectangle aBndRect( pRet->GetSnapRect() );
+ Point aTop( ( aBndRect.Left() + aBndRect.Right() ) >> 1, aBndRect.Top() );
+ Point aBottom( aTop.X(), aTop.Y() + 1000 );
+ pRet->NbcMirror( aTop, aBottom );
+ }
+ // Vertikal gespiegelt?
+ if ( nSpFlags & SP_FFLIPV )
+ {
+ Rectangle aBndRect( pRet->GetSnapRect() );
+ Point aLeft( aBndRect.Left(), ( aBndRect.Top() + aBndRect.Bottom() ) >> 1 );
+ Point aRight( aLeft.X() + 1000, aLeft.Y() );
+ pRet->NbcMirror( aLeft, aRight );
+ }
+ basegfx::B2DPolyPolygon aPoly( SdrObjCustomShape::GetLineGeometry( (SdrObjCustomShape*)pRet, sal_True ) );
+ SdrObject::Free( pRet );
+
+ pRet = new SdrEdgeObj();
+ ApplyAttributes( rSt, aSet, aObjData );
+ pRet->SetLogicRect( aObjData.aBoundRect );
+ pRet->SetMergedItemSet(aSet);
+
+ // Konnektoren
+ MSO_ConnectorStyle eConnectorStyle = (MSO_ConnectorStyle)GetPropertyValue( DFF_Prop_cxstyle, mso_cxstyleStraight );
+
+ ((SdrEdgeObj*)pRet)->ConnectToNode(TRUE, NULL);
+ ((SdrEdgeObj*)pRet)->ConnectToNode(FALSE, NULL);
+
+ Point aPoint1( aObjData.aBoundRect.TopLeft() );
+ Point aPoint2( aObjData.aBoundRect.BottomRight() );
+
+ // Rotationen beachten
+ if ( nObjectRotation )
+ {
+ double a = nObjectRotation * nPi180;
+ Point aCenter( aObjData.aBoundRect.Center() );
+ double ss = sin(a);
+ double cc = cos(a);
+
+ RotatePoint(aPoint1, aCenter, ss, cc);
+ RotatePoint(aPoint2, aCenter, ss, cc);
+ }
+
+ // Linie innerhalb des Bereiches zurechtdrehen/spiegeln
+ if ( nSpFlags & SP_FFLIPH )
+ {
+ INT32 n = aPoint1.X();
+ aPoint1.X() = aPoint2.X();
+ aPoint2.X() = n;
+ }
+ if ( nSpFlags & SP_FFLIPV )
+ {
+ INT32 n = aPoint1.Y();
+ aPoint1.Y() = aPoint2.Y();
+ aPoint2.Y() = n;
+ }
+ nSpFlags &= ~( SP_FFLIPV | SP_FFLIPH );
+
+ pRet->NbcSetPoint(aPoint1, 0L); // Startpunkt
+ pRet->NbcSetPoint(aPoint2, 1L); // Endpunkt
+
+ sal_Int32 n1HorzDist, n1VertDist, n2HorzDist, n2VertDist;
+ n1HorzDist = n1VertDist = n2HorzDist = n2VertDist = 0;
+ switch( eConnectorStyle )
+ {
+ case mso_cxstyleBent:
+ {
+ aSet.Put( SdrEdgeKindItem( SDREDGE_ORTHOLINES ) );
+ n1HorzDist = n1VertDist = n2HorzDist = n2VertDist = 630;
+ }
+ break;
+ case mso_cxstyleCurved:
+ aSet.Put( SdrEdgeKindItem( SDREDGE_BEZIER ) );
+ break;
+ default: // mso_cxstyleStraight || mso_cxstyleNone
+ aSet.Put( SdrEdgeKindItem( SDREDGE_ONELINE ) );
+ break;
+ }
+ aSet.Put( SdrEdgeNode1HorzDistItem( n1HorzDist ) );
+ aSet.Put( SdrEdgeNode1VertDistItem( n1VertDist ) );
+ aSet.Put( SdrEdgeNode2HorzDistItem( n2HorzDist ) );
+ aSet.Put( SdrEdgeNode2VertDistItem( n2VertDist ) );
+
+ ((SdrEdgeObj*)pRet)->SetEdgeTrackPath( aPoly );
+ }
+ pRet->SetMergedItemSet( aSet );
+ }
+ }
+
+ if ( pRet )
+ {
+ if( nObjectRotation )
+ {
+ double a = nObjectRotation * nPi180;
+ pRet->NbcRotate( aObjData.aBoundRect.Center(), nObjectRotation, sin( a ), cos( a ) );
+ }
+ // Horizontal gespiegelt?
+ if ( nSpFlags & SP_FFLIPH )
+ {
+ Rectangle aBndRect( pRet->GetSnapRect() );
+ Point aTop( ( aBndRect.Left() + aBndRect.Right() ) >> 1, aBndRect.Top() );
+ Point aBottom( aTop.X(), aTop.Y() + 1000 );
+ pRet->NbcMirror( aTop, aBottom );
+ }
+ // Vertikal gespiegelt?
+ if ( nSpFlags & SP_FFLIPV )
+ {
+ Rectangle aBndRect( pRet->GetSnapRect() );
+ Point aLeft( aBndRect.Left(), ( aBndRect.Top() + aBndRect.Bottom() ) >> 1 );
+ Point aRight( aLeft.X() + 1000, aLeft.Y() );
+ pRet->NbcMirror( aLeft, aRight );
+ }
+ }
+ }
+ }
+
+ // #i51348# #118052# name of the shape
+ if( pRet )
+ {
+ ::rtl::OUString aObjName = GetPropertyString( DFF_Prop_wzName, rSt );
+ if( aObjName.getLength() > 0 )
+ pRet->SetName( aObjName );
+ }
+
+ pRet =
+ ProcessObj( rSt, aObjData, pClientData, aTextRect, pRet);
+
+ if ( pRet )
+ {
+ sal_Int32 nGroupProperties( GetPropertyValue( DFF_Prop_fPrint ) );
+ pRet->SetVisible( ( nGroupProperties & 2 ) == 0 );
+ pRet->SetPrintable( ( nGroupProperties & 1 ) != 0 );
+ }
+
+ if ( mbTracing )
+ mpTracer->RemoveAttribute( aObjData.nSpFlags & SP_FGROUP
+ ? rtl::OUString::createFromAscii( "GroupShape" )
+ : rtl::OUString::createFromAscii( "Shape" ) );
+ return pRet;
+}
+
+Rectangle SvxMSDffManager::GetGlobalChildAnchor( const DffRecordHeader& rHd, SvStream& rSt, Rectangle& aClientRect )
+{
+ Rectangle aChildAnchor;
+ rHd.SeekToContent( rSt );
+ while ( ( rSt.GetError() == 0 ) && ( rSt.Tell() < rHd.GetRecEndFilePos() ) )
+ {
+ DffRecordHeader aShapeHd;
+ rSt >> aShapeHd;
+ if ( ( aShapeHd.nRecType == DFF_msofbtSpContainer ) ||
+ ( aShapeHd.nRecType == DFF_msofbtSpgrContainer ) )
+ {
+ DffRecordHeader aShapeHd2( aShapeHd );
+ if ( aShapeHd.nRecType == DFF_msofbtSpgrContainer )
+ rSt >> aShapeHd2;
+ while( ( rSt.GetError() == 0 ) && ( rSt.Tell() < aShapeHd2.GetRecEndFilePos() ) )
+ {
+ DffRecordHeader aShapeAtom;
+ rSt >> aShapeAtom;
+
+ if ( aShapeAtom.nRecType == DFF_msofbtClientAnchor )
+ {
+ if ( GetSvxMSDffSettings() & SVXMSDFF_SETTINGS_IMPORT_PPT )
+ {
+ sal_Int32 l, t, r, b;
+ if ( aShapeAtom.nRecLen == 16 )
+ {
+ rSt >> l >> t >> r >> b;
+ }
+ else
+ {
+ INT16 ls, ts, rs, bs;
+ rSt >> ts >> ls >> rs >> bs; // etwas seltsame Koordinatenreihenfolge ...
+ l = ls, t = ts, r = rs, b = bs;
+ }
+ Scale( l );
+ Scale( t );
+ Scale( r );
+ Scale( b );
+ aClientRect = Rectangle( l, t, r, b );
+ }
+ break;
+ }
+ else if ( aShapeAtom.nRecType == DFF_msofbtChildAnchor )
+ {
+ sal_Int32 l, o, r, u;
+ rSt >> l >> o >> r >> u;
+ Scale( l );
+ Scale( o );
+ Scale( r );
+ Scale( u );
+ Rectangle aChild( l, o, r, u );
+ aChildAnchor.Union( aChild );
+ break;
+ }
+ aShapeAtom.SeekToEndOfRecord( rSt );
+ }
+ }
+ aShapeHd.SeekToEndOfRecord( rSt );
+ }
+ return aChildAnchor;
+}
+
+void SvxMSDffManager::GetGroupAnchors( const DffRecordHeader& rHd, SvStream& rSt,
+ Rectangle& rGroupClientAnchor, Rectangle& rGroupChildAnchor,
+ const Rectangle& rClientRect, const Rectangle& rGlobalChildRect )
+{
+ sal_Bool bFirst = sal_True;
+ rHd.SeekToContent( rSt );
+ DffRecordHeader aShapeHd;
+ while ( ( rSt.GetError() == 0 ) && ( rSt.Tell() < rHd.GetRecEndFilePos() ) )
+ {
+ rSt >> aShapeHd;
+ if ( ( aShapeHd.nRecType == DFF_msofbtSpContainer ) ||
+ ( aShapeHd.nRecType == DFF_msofbtSpgrContainer ) )
+ {
+ DffRecordHeader aShapeHd2( aShapeHd );
+ if ( aShapeHd.nRecType == DFF_msofbtSpgrContainer )
+ rSt >> aShapeHd2;
+ while( ( rSt.GetError() == 0 ) && ( rSt.Tell() < aShapeHd2.GetRecEndFilePos() ) )
+ {
+ DffRecordHeader aShapeAtom;
+ rSt >> aShapeAtom;
+ if ( aShapeAtom.nRecType == DFF_msofbtChildAnchor )
+ {
+ sal_Int32 l, o, r, u;
+ rSt >> l >> o >> r >> u;
+ Scale( l );
+ Scale( o );
+ Scale( r );
+ Scale( u );
+ Rectangle aChild( l, o, r, u );
+
+ if ( bFirst )
+ {
+ if ( !rGlobalChildRect.IsEmpty() && !rClientRect.IsEmpty() && rGlobalChildRect.GetWidth() && rGlobalChildRect.GetHeight() )
+ {
+ double fl = l;
+ double fo = o;
+ double fWidth = r - l;
+ double fHeight= u - o;
+ double fXScale = (double)rClientRect.GetWidth() / (double)rGlobalChildRect.GetWidth();
+ double fYScale = (double)rClientRect.GetHeight() / (double)rGlobalChildRect.GetHeight();
+ fl = ( ( l - rGlobalChildRect.Left() ) * fXScale ) + rClientRect.Left();
+ fo = ( ( o - rGlobalChildRect.Top() ) * fYScale ) + rClientRect.Top();
+ fWidth *= fXScale;
+ fHeight *= fYScale;
+ rGroupClientAnchor = Rectangle( Point( (sal_Int32)fl, (sal_Int32)fo ), Size( (sal_Int32)( fWidth + 1 ), (sal_Int32)( fHeight + 1 ) ) );
+ }
+ bFirst = sal_False;
+ }
+ else
+ rGroupChildAnchor.Union( aChild );
+ break;
+ }
+ aShapeAtom.SeekToEndOfRecord( rSt );
+ }
+ }
+ aShapeHd.SeekToEndOfRecord( rSt );
+ }
+}
+
+SdrObject* SvxMSDffManager::ProcessObj(SvStream& rSt,
+ DffObjData& rObjData,
+ void* pData,
+ Rectangle& rTextRect,
+ SdrObject* pObj
+ )
+{
+ if( !rTextRect.IsEmpty() )
+ {
+ SvxMSDffImportData& rImportData = *(SvxMSDffImportData*)pData;
+ SvxMSDffImportRec* pImpRec = new SvxMSDffImportRec;
+ SvxMSDffImportRec* pTextImpRec = pImpRec;
+
+ // fill Import Record with data
+ pImpRec->nShapeId = rObjData.nShapeId;
+ pImpRec->eShapeType = rObjData.eShapeType;
+
+ MSO_WrapMode eWrapMode( (MSO_WrapMode)GetPropertyValue(
+ DFF_Prop_WrapText,
+ mso_wrapSquare ) );
+ rObjData.bClientAnchor = maShapeRecords.SeekToContent( rSt,
+ DFF_msofbtClientAnchor,
+ SEEK_FROM_CURRENT_AND_RESTART );
+ if( rObjData.bClientAnchor )
+ ProcessClientAnchor( rSt,
+ maShapeRecords.Current()->nRecLen,
+ pImpRec->pClientAnchorBuffer, pImpRec->nClientAnchorLen );
+
+ rObjData.bClientData = maShapeRecords.SeekToContent( rSt,
+ DFF_msofbtClientData,
+ SEEK_FROM_CURRENT_AND_RESTART );
+ if( rObjData.bClientData )
+ ProcessClientData( rSt,
+ maShapeRecords.Current()->nRecLen,
+ pImpRec->pClientDataBuffer, pImpRec->nClientDataLen );
+
+
+ // process user (== Winword) defined parameters in 0xF122 record
+ if( maShapeRecords.SeekToContent( rSt,
+ DFF_msofbtUDefProp,
+ SEEK_FROM_CURRENT_AND_RESTART )
+ && maShapeRecords.Current()->nRecLen )
+ {
+ UINT32 nBytesLeft = maShapeRecords.Current()->nRecLen;
+ UINT32 nUDData;
+ UINT16 nPID;
+ while( 5 < nBytesLeft )
+ {
+ rSt >> nPID;
+ if ( rSt.GetError() != 0 )
+ break;
+ rSt >> nUDData;
+ switch( nPID )
+ {
+ case 0x038F: pImpRec->nXAlign = nUDData; break;
+ case 0x0390: pImpRec->nXRelTo = nUDData; break;
+ case 0x0391: pImpRec->nYAlign = nUDData; break;
+ case 0x0392: pImpRec->nYRelTo = nUDData; break;
+ case 0x03BF: pImpRec->nLayoutInTableCell = nUDData; break;
+ }
+ if ( rSt.GetError() != 0 )
+ break;
+ pImpRec->bHasUDefProp = TRUE;
+ nBytesLeft -= 6;
+ }
+ }
+
+ // Textrahmen, auch Title oder Outline
+ SdrObject* pOrgObj = pObj;
+ SdrRectObj* pTextObj = 0;
+ UINT32 nTextId = GetPropertyValue( DFF_Prop_lTxid, 0 );
+ if( nTextId )
+ {
+ SfxItemSet aSet( pSdrModel->GetItemPool() );
+
+ //Originally anything that as a mso_sptTextBox was created as a
+ //textbox, this was changed for #88277# to be created as a simple
+ //rect to keep impress happy. For the rest of us we'd like to turn
+ //it back into a textbox again.
+ FASTBOOL bTextFrame = (pImpRec->eShapeType == mso_sptTextBox);
+ if (!bTextFrame)
+ {
+ //Either
+ //a) its a simple text object or
+ //b) its a rectangle with text and square wrapping.
+ bTextFrame =
+ (
+ (pImpRec->eShapeType == mso_sptTextSimple) ||
+ (
+ (pImpRec->eShapeType == mso_sptRectangle)
+ && (eWrapMode == mso_wrapSquare)
+ && ShapeHasText(pImpRec->nShapeId, rObjData.rSpHd.GetRecBegFilePos() )
+ )
+ );
+ }
+
+ if (bTextFrame)
+ {
+ SdrObject::Free( pObj );
+ pObj = pOrgObj = 0;
+ }
+
+ // Distance of Textbox to it's surrounding Customshape
+ INT32 nTextLeft = GetPropertyValue( DFF_Prop_dxTextLeft, 91440L);
+ INT32 nTextRight = GetPropertyValue( DFF_Prop_dxTextRight, 91440L );
+ INT32 nTextTop = GetPropertyValue( DFF_Prop_dyTextTop, 45720L );
+ INT32 nTextBottom = GetPropertyValue( DFF_Prop_dyTextBottom, 45720L );
+
+ ScaleEmu( nTextLeft );
+ ScaleEmu( nTextRight );
+ ScaleEmu( nTextTop );
+ ScaleEmu( nTextBottom );
+
+ INT32 nTextRotationAngle=0;
+ bool bVerticalText = false;
+ if ( IsProperty( DFF_Prop_txflTextFlow ) )
+ {
+ MSO_TextFlow eTextFlow = (MSO_TextFlow)(GetPropertyValue(
+ DFF_Prop_txflTextFlow) & 0xFFFF);
+ switch( eTextFlow )
+ {
+ case mso_txflBtoT:
+ nTextRotationAngle = 9000;
+ break;
+ case mso_txflVertN:
+ case mso_txflTtoBN:
+ nTextRotationAngle = 27000;
+ break;
+ case mso_txflTtoBA:
+ bVerticalText = true;
+ break;
+ case mso_txflHorzA:
+ bVerticalText = true;
+ nTextRotationAngle = 9000;
+ case mso_txflHorzN:
+ default :
+ break;
+ }
+ }
+
+ if (nTextRotationAngle)
+ {
+ while (nTextRotationAngle > 360000)
+ nTextRotationAngle-=9000;
+ switch (nTextRotationAngle)
+ {
+ case 9000:
+ {
+ long nWidth = rTextRect.GetWidth();
+ rTextRect.Right() = rTextRect.Left() + rTextRect.GetHeight();
+ rTextRect.Bottom() = rTextRect.Top() + nWidth;
+
+ INT32 nOldTextLeft = nTextLeft;
+ INT32 nOldTextRight = nTextRight;
+ INT32 nOldTextTop = nTextTop;
+ INT32 nOldTextBottom = nTextBottom;
+
+ nTextLeft = nOldTextBottom;
+ nTextRight = nOldTextTop;
+ nTextTop = nOldTextLeft;
+ nTextBottom = nOldTextRight;
+ }
+ break;
+ case 27000:
+ {
+ long nWidth = rTextRect.GetWidth();
+ rTextRect.Right() = rTextRect.Left() + rTextRect.GetHeight();
+ rTextRect.Bottom() = rTextRect.Top() + nWidth;
+
+ INT32 nOldTextLeft = nTextLeft;
+ INT32 nOldTextRight = nTextRight;
+ INT32 nOldTextTop = nTextTop;
+ INT32 nOldTextBottom = nTextBottom;
+
+ nTextLeft = nOldTextTop;
+ nTextRight = nOldTextBottom;
+ nTextTop = nOldTextRight;
+ nTextBottom = nOldTextLeft;
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ pTextObj = new SdrRectObj(OBJ_TEXT, rTextRect);
+ pTextImpRec = new SvxMSDffImportRec(*pImpRec);
+
+ // Die vertikalen Absatzeinrueckungen sind im BoundRect mit drin,
+ // hier rausrechnen
+ Rectangle aNewRect(rTextRect);
+ aNewRect.Bottom() -= nTextTop + nTextBottom;
+ aNewRect.Right() -= nTextLeft + nTextRight;
+
+ // Nur falls es eine einfache Textbox ist, darf der Writer
+ // das Objekt durch einen Rahmen ersetzen, ansonsten
+ if( bTextFrame )
+ {
+ SvxMSDffShapeInfo aTmpRec( 0, pImpRec->nShapeId );
+ aTmpRec.bSortByShapeId = TRUE;
+
+ USHORT nFound;
+ if( pShapeInfos->Seek_Entry( &aTmpRec, &nFound ) )
+ {
+ SvxMSDffShapeInfo& rInfo = *pShapeInfos->GetObject(nFound);
+ pTextImpRec->bReplaceByFly = rInfo.bReplaceByFly;
+ pTextImpRec->bLastBoxInChain = rInfo.bLastBoxInChain;
+ }
+ }
+
+ if( !pObj )
+ ApplyAttributes( rSt, aSet, rObjData );
+
+ bool bFitText = false;
+ if (GetPropertyValue(DFF_Prop_FitTextToShape) & 2)
+ {
+ aSet.Put( SdrTextAutoGrowHeightItem( TRUE ) );
+ aSet.Put( SdrTextMinFrameHeightItem(
+ aNewRect.Bottom() - aNewRect.Top() ) );
+ aSet.Put( SdrTextMinFrameWidthItem(
+ aNewRect.Right() - aNewRect.Left() ) );
+ bFitText = true;
+ }
+ else
+ {
+ aSet.Put( SdrTextAutoGrowHeightItem( FALSE ) );
+ aSet.Put( SdrTextAutoGrowWidthItem( FALSE ) );
+ }
+
+ switch ( (MSO_WrapMode)
+ GetPropertyValue( DFF_Prop_WrapText, mso_wrapSquare ) )
+ {
+ case mso_wrapNone :
+ aSet.Put( SdrTextAutoGrowWidthItem( TRUE ) );
+ if (bFitText)
+ {
+ //can't do autowidth in flys #i107184#
+ pTextImpRec->bReplaceByFly = false;
+ }
+ break;
+ case mso_wrapByPoints :
+ aSet.Put( SdrTextContourFrameItem( TRUE ) );
+ break;
+ default: break;
+ }
+
+ // Abstaende an den Raendern der Textbox setzen
+ aSet.Put( SdrTextLeftDistItem( nTextLeft ) );
+ aSet.Put( SdrTextRightDistItem( nTextRight ) );
+ aSet.Put( SdrTextUpperDistItem( nTextTop ) );
+ aSet.Put( SdrTextLowerDistItem( nTextBottom ) );
+ pTextImpRec->nDxTextLeft = nTextLeft;
+ pTextImpRec->nDyTextTop = nTextTop;
+ pTextImpRec->nDxTextRight = nTextRight;
+ pTextImpRec->nDyTextBottom = nTextBottom;
+
+ // Textverankerung lesen
+ if ( IsProperty( DFF_Prop_anchorText ) )
+ {
+ MSO_Anchor eTextAnchor =
+ (MSO_Anchor)GetPropertyValue( DFF_Prop_anchorText );
+
+ SdrTextVertAdjust eTVA = SDRTEXTVERTADJUST_CENTER;
+ BOOL bTVASet(FALSE);
+ SdrTextHorzAdjust eTHA = SDRTEXTHORZADJUST_CENTER;
+ BOOL bTHASet(FALSE);
+
+ switch( eTextAnchor )
+ {
+ case mso_anchorTop:
+ {
+ eTVA = SDRTEXTVERTADJUST_TOP;
+ bTVASet = TRUE;
+ }
+ break;
+ case mso_anchorTopCentered:
+ {
+ eTVA = SDRTEXTVERTADJUST_TOP;
+ bTVASet = TRUE;
+ bTHASet = TRUE;
+ }
+ break;
+
+ case mso_anchorMiddle:
+ bTVASet = TRUE;
+ break;
+ case mso_anchorMiddleCentered:
+ {
+ bTVASet = TRUE;
+ bTHASet = TRUE;
+ }
+ break;
+ case mso_anchorBottom:
+ {
+ eTVA = SDRTEXTVERTADJUST_BOTTOM;
+ bTVASet = TRUE;
+ }
+ break;
+ case mso_anchorBottomCentered:
+ {
+ eTVA = SDRTEXTVERTADJUST_BOTTOM;
+ bTVASet = TRUE;
+ bTHASet = TRUE;
+ }
+ break;
+ /*
+ case mso_anchorTopBaseline:
+ case mso_anchorBottomBaseline:
+ case mso_anchorTopCenteredBaseline:
+ case mso_anchorBottomCenteredBaseline:
+ break;
+ */
+ default : break;
+ }
+ // Einsetzen
+ if ( bTVASet )
+ aSet.Put( SdrTextVertAdjustItem( eTVA ) );
+ if ( bTHASet )
+ aSet.Put( SdrTextHorzAdjustItem( eTHA ) );
+ }
+
+ pTextObj->SetMergedItemSet(aSet);
+ pTextObj->SetModel(pSdrModel);
+
+ if (bVerticalText)
+ pTextObj->SetVerticalWriting(sal_True);
+
+ if (nTextRotationAngle)
+ {
+ long nMinWH = rTextRect.GetWidth() < rTextRect.GetHeight() ?
+ rTextRect.GetWidth() : rTextRect.GetHeight();
+ nMinWH /= 2;
+ Point aPivot(rTextRect.TopLeft());
+ aPivot.X() += nMinWH;
+ aPivot.Y() += nMinWH;
+ double a = nTextRotationAngle * nPi180;
+ pTextObj->NbcRotate(aPivot, nTextRotationAngle, sin(a), cos(a));
+ }
+
+ // rotate text with shape ?
+ if ( mnFix16Angle )
+ {
+ double a = mnFix16Angle * nPi180;
+ pTextObj->NbcRotate( rObjData.aBoundRect.Center(), mnFix16Angle,
+ sin( a ), cos( a ) );
+ }
+
+ if( !pObj )
+ {
+ pObj = pTextObj;
+ }
+ else
+ {
+ if( pTextObj != pObj )
+ {
+ SdrObject* pGroup = new SdrObjGroup;
+ pGroup->GetSubList()->NbcInsertObject( pObj );
+ pGroup->GetSubList()->NbcInsertObject( pTextObj );
+ if (pOrgObj == pObj)
+ pOrgObj = pGroup;
+ else
+ pOrgObj = pObj;
+ pObj = pGroup;
+ }
+ }
+ }
+ else if( !pObj )
+ {
+ // simple rectangular objects are ignored by ImportObj() :-(
+ // this is OK for Draw but not for Calc and Writer
+ // cause here these objects have a default border
+ pObj = new SdrRectObj(rTextRect);
+ pOrgObj = pObj;
+ pObj->SetModel( pSdrModel );
+ SfxItemSet aSet( pSdrModel->GetItemPool() );
+ ApplyAttributes( rSt, aSet, rObjData );
+
+ const SfxPoolItem* pPoolItem=NULL;
+ SfxItemState eState = aSet.GetItemState( XATTR_FILLCOLOR,
+ FALSE, &pPoolItem );
+ if( SFX_ITEM_DEFAULT == eState )
+ aSet.Put( XFillColorItem( String(),
+ Color( mnDefaultColor ) ) );
+ pObj->SetMergedItemSet(aSet);
+ }
+
+ //Means that fBehindDocument is set
+ if (GetPropertyValue(DFF_Prop_fPrint) & 0x20)
+ pImpRec->bDrawHell = TRUE;
+ else
+ pImpRec->bDrawHell = FALSE;
+ if (GetPropertyValue(DFF_Prop_fPrint) & 0x02)
+ pImpRec->bHidden = TRUE;
+ pTextImpRec->bDrawHell = pImpRec->bDrawHell;
+ pTextImpRec->bHidden = pImpRec->bHidden;
+ pImpRec->nNextShapeId = GetPropertyValue( DFF_Prop_hspNext, 0 );
+ pTextImpRec->nNextShapeId=pImpRec->nNextShapeId;
+
+ if ( nTextId )
+ {
+ pTextImpRec->aTextId.nTxBxS = (UINT16)( nTextId >> 16 );
+ pTextImpRec->aTextId.nSequence = (UINT16)nTextId;
+ }
+
+ pTextImpRec->nDxWrapDistLeft = GetPropertyValue(
+ DFF_Prop_dxWrapDistLeft, 114935L ) / 635L;
+ pTextImpRec->nDyWrapDistTop = GetPropertyValue(
+ DFF_Prop_dyWrapDistTop, 0 ) / 635L;
+ pTextImpRec->nDxWrapDistRight = GetPropertyValue(
+ DFF_Prop_dxWrapDistRight, 114935L ) / 635L;
+ pTextImpRec->nDyWrapDistBottom = GetPropertyValue(
+ DFF_Prop_dyWrapDistBottom, 0 ) / 635L;
+ // 16.16 fraction times total image width or height, as appropriate.
+
+ if (SeekToContent(DFF_Prop_pWrapPolygonVertices, rSt))
+ {
+ delete pTextImpRec->pWrapPolygon;
+ sal_uInt16 nNumElemVert, nNumElemMemVert, nElemSizeVert;
+ rSt >> nNumElemVert >> nNumElemMemVert >> nElemSizeVert;
+ if (nNumElemVert && ((nElemSizeVert == 8) || (nElemSizeVert == 4)))
+ {
+ pTextImpRec->pWrapPolygon = new Polygon(nNumElemVert);
+ for (sal_uInt16 i = 0; i < nNumElemVert; ++i)
+ {
+ sal_Int32 nX, nY;
+ if (nElemSizeVert == 8)
+ rSt >> nX >> nY;
+ else
+ {
+ sal_Int16 nSmallX, nSmallY;
+ rSt >> nSmallX >> nSmallY;
+ nX = nSmallX;
+ nY = nSmallY;
+ }
+ (*(pTextImpRec->pWrapPolygon))[i].X() = nX;
+ (*(pTextImpRec->pWrapPolygon))[i].Y() = nY;
+ }
+ }
+ }
+
+ pImpRec->nCropFromTop = GetPropertyValue(
+ DFF_Prop_cropFromTop, 0 );
+ pImpRec->nCropFromBottom = GetPropertyValue(
+ DFF_Prop_cropFromBottom, 0 );
+ pImpRec->nCropFromLeft = GetPropertyValue(
+ DFF_Prop_cropFromLeft, 0 );
+ pImpRec->nCropFromRight = GetPropertyValue(
+ DFF_Prop_cropFromRight, 0 );
+
+ pImpRec->bVFlip = (rObjData.nSpFlags & SP_FFLIPV) ? true : false;
+ pImpRec->bHFlip = (rObjData.nSpFlags & SP_FFLIPH) ? true : false;
+
+ UINT32 nLineFlags = GetPropertyValue( DFF_Prop_fNoLineDrawDash );
+ pImpRec->eLineStyle = (nLineFlags & 8)
+ ? (MSO_LineStyle)GetPropertyValue(
+ DFF_Prop_lineStyle,
+ mso_lineSimple )
+ : (MSO_LineStyle)USHRT_MAX;
+ pTextImpRec->eLineStyle = pImpRec->eLineStyle;
+
+ if( pImpRec->nShapeId )
+ {
+ // Import-Record-Liste ergaenzen
+ if( pOrgObj )
+ {
+ pImpRec->pObj = pOrgObj;
+ rImportData.aRecords.Insert( pImpRec );
+ }
+
+ if( pTextObj && (pOrgObj != pTextObj) )
+ {
+ // Modify ShapeId (must be unique)
+ pImpRec->nShapeId |= 0x8000000;
+ pTextImpRec->pObj = pTextObj;
+ rImportData.aRecords.Insert( pTextImpRec );
+ }
+
+ // Eintrag in Z-Order-Liste um Zeiger auf dieses Objekt ergaenzen
+ /*Only store objects which are not deep inside the tree*/
+ if( ( rObjData.nCalledByGroup == 0 )
+ ||
+ ( (rObjData.nSpFlags & SP_FGROUP)
+ && (rObjData.nCalledByGroup < 2) )
+ )
+ StoreShapeOrder( pImpRec->nShapeId,
+ ( ( (ULONG)pImpRec->aTextId.nTxBxS ) << 16 )
+ + pImpRec->aTextId.nSequence, pObj );
+ }
+ else
+ delete pImpRec;
+ }
+
+ return pObj;
+};
+
+void SvxMSDffManager::StoreShapeOrder(ULONG nId,
+ ULONG nTxBx,
+ SdrObject* pObject,
+ SwFlyFrmFmt* pFly,
+ short nHdFtSection) const
+{
+ USHORT nShpCnt = pShapeOrders->Count();
+ for (USHORT nShapeNum=0; nShapeNum < nShpCnt; nShapeNum++)
+ {
+ SvxMSDffShapeOrder& rOrder
+ = *(SvxMSDffShapeOrder*)(pShapeOrders->GetObject( nShapeNum ));
+
+ if( rOrder.nShapeId == nId )
+ {
+ rOrder.nTxBxComp = nTxBx;
+ rOrder.pObj = pObject;
+ rOrder.pFly = pFly;
+ rOrder.nHdFtSection = nHdFtSection;
+ }
+ }
+}
+
+
+void SvxMSDffManager::ExchangeInShapeOrder( SdrObject* pOldObject,
+ ULONG nTxBx,
+ SwFlyFrmFmt* pFly,
+ SdrObject* pObject) const
+{
+ USHORT nShpCnt = pShapeOrders->Count();
+ for (USHORT nShapeNum=0; nShapeNum < nShpCnt; nShapeNum++)
+ {
+ SvxMSDffShapeOrder& rOrder
+ = *(SvxMSDffShapeOrder*)(pShapeOrders->GetObject( nShapeNum ));
+
+ if( rOrder.pObj == pOldObject )
+ {
+ rOrder.pFly = pFly;
+ rOrder.pObj = pObject;
+ rOrder.nTxBxComp = nTxBx;
+ }
+ }
+}
+
+
+void SvxMSDffManager::RemoveFromShapeOrder( SdrObject* pObject ) const
+{
+ USHORT nShpCnt = pShapeOrders->Count();
+ for (USHORT nShapeNum=0; nShapeNum < nShpCnt; nShapeNum++)
+ {
+ SvxMSDffShapeOrder& rOrder
+ = *(SvxMSDffShapeOrder*)(pShapeOrders->GetObject( nShapeNum ));
+
+ if( rOrder.pObj == pObject )
+ {
+ rOrder.pObj = 0;
+ rOrder.pFly = 0;
+ rOrder.nTxBxComp = 0;
+ }
+ }
+}
+
+
+
+
+//---------------------------------------------------------------------------
+// Hilfs Deklarationen
+//---------------------------------------------------------------------------
+
+/*struct SvxMSDffBLIPInfo -> in's Header-File
+{
+ USHORT nBLIPType; // Art des BLIP: z.B. 6 fuer PNG
+ ULONG nFilePos; // Offset des BLIP im Daten-Stream
+ ULONG nBLIPSize; // Anzahl Bytes, die der BLIP im Stream einnimmt
+ SvxMSDffBLIPInfo(USHORT nBType, ULONG nFPos, ULONG nBSize):
+ nBLIPType( nBType ), nFilePos( nFPos ), nBLIPSize( nBSize ){}
+};
+*/
+
+SV_IMPL_PTRARR( SvxMSDffBLIPInfos, SvxMSDffBLIPInfo_Ptr );
+
+SV_IMPL_PTRARR( SvxMSDffShapeOrders, SvxMSDffShapeOrder_Ptr );
+
+SV_IMPL_OP_PTRARR_SORT( SvxMSDffShapeInfos, SvxMSDffShapeInfo_Ptr );
+
+SV_IMPL_OP_PTRARR_SORT( SvxMSDffShapeTxBxSort, SvxMSDffShapeOrder_Ptr );
+
+
+// Liste aller SvxMSDffImportRec fuer eine Gruppe
+SV_IMPL_OP_PTRARR_SORT(MSDffImportRecords, MSDffImportRec_Ptr)
+
+//---------------------------------------------------------------------------
+// exportierte Klasse: oeffentliche Methoden
+//---------------------------------------------------------------------------
+
+SvxMSDffManager::SvxMSDffManager(SvStream& rStCtrl_,
+ const String& rBaseURL,
+ long nOffsDgg_,
+ SvStream* pStData_,
+ SdrModel* pSdrModel_,// s. unten: SetModel()
+ long nApplicationScale,
+ ColorData mnDefaultColor_,
+ ULONG nDefaultFontHeight_,
+ SvStream* pStData2_,
+ MSFilterTracer* pTracer )
+ :DffPropertyReader( *this ),
+ pFormModel( NULL ),
+ pBLIPInfos( new SvxMSDffBLIPInfos ),
+ pShapeInfos( new SvxMSDffShapeInfos ),
+ 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
+ maBaseURL( rBaseURL ),
+ mpFidcls( NULL ),
+ rStCtrl( rStCtrl_ ),
+ pStData( pStData_ ),
+ pStData2( pStData2_ ),
+ nSvxMSDffSettings( 0 ),
+ nSvxMSDffOLEConvFlags( 0 ),
+ pEscherBlipCache( NULL ),
+ mnDefaultColor( mnDefaultColor_),
+ mpTracer( pTracer ),
+ mbTracing( sal_False )
+{
+ if ( mpTracer )
+ {
+ uno::Any aAny( mpTracer->GetProperty( rtl::OUString::createFromAscii( "On" ) ) );
+ aAny >>= mbTracing;
+ }
+ SetModel( pSdrModel_, nApplicationScale );
+
+ // FilePos des/der Stream(s) merken
+ ULONG nOldPosCtrl = rStCtrl.Tell();
+ ULONG nOldPosData = pStData ? pStData->Tell() : nOldPosCtrl;
+
+ // Falls kein Datenstream angegeben, gehen wir davon aus,
+ // dass die BLIPs im Steuerstream stehen.
+ if( !pStData )
+ pStData = &rStCtrl;
+
+ SetDefaultPropSet( rStCtrl, nOffsDgg );
+
+ // Steuer Stream auslesen, im Erfolgsfall nBLIPCount setzen
+ GetCtrlData( nOffsDgg );
+
+ // Text-Box-Story-Ketten-Infos ueberpruefen
+ CheckTxBxStoryChain();
+
+ // alte FilePos des/der Stream(s) restaurieren
+ rStCtrl.Seek( nOldPosCtrl );
+ if( &rStCtrl != pStData )
+ pStData->Seek( nOldPosData );
+}
+
+SvxMSDffManager::SvxMSDffManager( SvStream& rStCtrl_, const String& rBaseURL, MSFilterTracer* pTracer )
+ :DffPropertyReader( *this ),
+ pFormModel( NULL ),
+ pBLIPInfos( new SvxMSDffBLIPInfos ),
+ pShapeInfos( new SvxMSDffShapeInfos ),
+ pShapeOrders( new SvxMSDffShapeOrders ),
+ nDefaultFontHeight( 24 ),
+ nOffsDgg( 0 ),
+ nBLIPCount( USHRT_MAX ), // mit Error initialisieren, da wir erst pruefen,
+ nShapeCount( USHRT_MAX ), // ob Kontroll-Stream korrekte Daten enthaellt
+ maBaseURL( rBaseURL ),
+ mpFidcls( NULL ),
+ rStCtrl( rStCtrl_ ),
+ pStData( 0 ),
+ pStData2( 0 ),
+ nSvxMSDffSettings( 0 ),
+ nSvxMSDffOLEConvFlags( 0 ),
+ pEscherBlipCache( NULL ),
+ mnDefaultColor( COL_DEFAULT ),
+ mpTracer( pTracer ),
+ mbTracing( sal_False )
+{
+ if ( mpTracer )
+ {
+ uno::Any aAny( mpTracer->GetProperty( rtl::OUString::createFromAscii( "On" ) ) );
+ aAny >>= mbTracing;
+ }
+ SetModel( NULL, 0 );
+}
+
+SvxMSDffManager::~SvxMSDffManager()
+{
+ if ( pEscherBlipCache )
+ {
+ void* pPtr;
+ for ( pPtr = pEscherBlipCache->First(); pPtr; pPtr = pEscherBlipCache->Next() )
+ delete (EscherBlipCacheEntry*)pPtr;
+ delete pEscherBlipCache;
+ }
+ delete pBLIPInfos;
+ delete pShapeInfos;
+ delete pShapeOrders;
+ delete pFormModel;
+ delete[] mpFidcls;
+}
+
+void SvxMSDffManager::InitSvxMSDffManager( long nOffsDgg_, SvStream* pStData_, sal_uInt32 nOleConvFlags )
+{
+ nOffsDgg = nOffsDgg_;
+ pStData = pStData_;
+ nSvxMSDffOLEConvFlags = nOleConvFlags;
+
+ // FilePos des/der Stream(s) merken
+ ULONG nOldPosCtrl = rStCtrl.Tell();
+
+ SetDefaultPropSet( rStCtrl, nOffsDgg );
+
+ // insert fidcl cluster table
+ GetFidclData( nOffsDgg );
+
+ // Steuer Stream auslesen, im Erfolgsfall nBLIPCount setzen
+ GetCtrlData( nOffsDgg );
+
+ // Text-Box-Story-Ketten-Infos ueberpruefen
+ CheckTxBxStoryChain();
+
+ // alte FilePos des/der Stream(s) restaurieren
+ rStCtrl.Seek( nOldPosCtrl );
+}
+
+void SvxMSDffManager::SetDgContainer( SvStream& rSt )
+{
+ UINT32 nFilePos = rSt.Tell();
+ DffRecordHeader aDgContHd;
+ rSt >> aDgContHd;
+ // insert this container only if there is also a DgAtom
+ if ( SeekToRec( rSt, DFF_msofbtDg, aDgContHd.GetRecEndFilePos() ) )
+ {
+ DffRecordHeader aRecHd;
+ rSt >> aRecHd;
+ UINT32 nDrawingId = aRecHd.nRecInstance;
+ maDgOffsetTable.Insert( nDrawingId, (void*)nFilePos );
+ rSt.Seek( nFilePos );
+ }
+}
+
+void SvxMSDffManager::GetFidclData( long nOffsDggL )
+{
+ if ( nOffsDggL )
+ {
+ UINT32 nDummy, nMerk = rStCtrl.Tell();
+ rStCtrl.Seek( nOffsDggL );
+
+ DffRecordHeader aRecHd;
+ rStCtrl >> aRecHd;
+
+ DffRecordHeader aDggAtomHd;
+ if ( SeekToRec( rStCtrl, DFF_msofbtDgg, aRecHd.GetRecEndFilePos(), &aDggAtomHd ) )
+ {
+ aDggAtomHd.SeekToContent( rStCtrl );
+ rStCtrl >> mnCurMaxShapeId
+ >> mnIdClusters
+ >> nDummy
+ >> mnDrawingsSaved;
+
+ if ( mnIdClusters-- > 2 )
+ {
+ if ( aDggAtomHd.nRecLen == ( mnIdClusters * sizeof( FIDCL ) + 16 ) )
+ {
+ mpFidcls = new FIDCL[ mnIdClusters ];
+ for ( UINT32 i = 0; i < mnIdClusters; i++ )
+ {
+ rStCtrl >> mpFidcls[ i ].dgid
+ >> mpFidcls[ i ].cspidCur;
+ }
+ }
+ }
+ }
+ rStCtrl.Seek( nMerk );
+ }
+}
+
+void SvxMSDffManager::CheckTxBxStoryChain()
+{
+ SvxMSDffShapeInfos* pOld = pShapeInfos;
+ USHORT nCnt = pOld->Count();
+ pShapeInfos = new SvxMSDffShapeInfos( (nCnt < 255)
+ ? nCnt
+ : 255 );
+ // altes Info-Array ueberarbeiten
+ // (ist sortiert nach nTxBxComp)
+ ULONG nChain = ULONG_MAX;
+ USHORT nObjMark = 0;
+ BOOL bSetReplaceFALSE = FALSE;
+ USHORT nObj;
+ for( nObj = 0; nObj < nCnt; ++nObj )
+ {
+ SvxMSDffShapeInfo* pObj = pOld->GetObject( nObj );
+ if( pObj->nTxBxComp )
+ {
+ pObj->bLastBoxInChain = FALSE;
+ // Gruppenwechsel ?
+ // --> OD 2008-07-28 #156763#
+ // the text id also contains an internal drawing container id
+ // to distinguish between text id of drawing objects in different
+ // drawing containers.
+// if( nChain != (pObj->nTxBxComp & 0xFFFF0000) )
+ if( nChain != pObj->nTxBxComp )
+ // <--
+ {
+ // voriger war letzter seiner Gruppe
+ if( nObj )
+ pOld->GetObject( nObj-1 )->bLastBoxInChain = TRUE;
+ // Merker und Hilfs-Flag zuruecksetzen
+ nObjMark = nObj;
+ // --> OD 2008-07-28 #156763#
+// nChain = pObj->nTxBxComp & 0xFFFF0000;
+ nChain = pObj->nTxBxComp;
+ // <--
+ bSetReplaceFALSE = !pObj->bReplaceByFly;
+ }
+ else
+ if( !pObj->bReplaceByFly )
+ {
+ // Objekt, das NICHT durch Rahmen ersetzt werden darf ?
+ // Hilfs-Flag setzen
+ bSetReplaceFALSE = TRUE;
+ // ggfs Flag in Anfang der Gruppe austragen
+ for( USHORT nObj2 = nObjMark; nObj2 < nObj; ++nObj2 )
+ pOld->GetObject( nObj2 )->bReplaceByFly = FALSE;
+ }
+
+ if( bSetReplaceFALSE )
+ {
+ pObj->bReplaceByFly = FALSE;
+ }
+ }
+ // alle Shape-Info-Objekte in pShapeInfos umkopieren
+ // (aber nach nShapeId sortieren)
+ pObj->bSortByShapeId = TRUE;
+ // --> OD 2008-07-28 #156763#
+ pObj->nTxBxComp = pObj->nTxBxComp & 0xFFFF0000;
+ // <--
+ pShapeInfos->Insert( pObj );
+ }
+ // voriger war letzter seiner Gruppe
+ if( nObj )
+ pOld->GetObject( nObj-1 )->bLastBoxInChain = TRUE;
+ // urspruengliches Array freigeben, ohne Objekte zu zerstoeren
+ pOld->Remove((USHORT)0, nCnt);
+ delete pOld;
+}
+
+
+/*****************************************************************************
+
+ Einlesen der Shape-Infos im Ctor:
+ ---------------------------------
+ merken der Shape-Ids und zugehoerigen Blip-Nummern und TextBox-Infos
+ ========= ============ =============
+ und merken des File-Offsets fuer jedes Blip
+ ============
+******************************************************************************/
+void SvxMSDffManager::GetCtrlData( long nOffsDgg_ )
+{
+ // Start Offset unbedingt merken, falls wir nochmal aufsetzen muessen
+ long nOffsDggL = nOffsDgg_;
+
+ // Kontroll Stream positionieren
+ rStCtrl.Seek( nOffsDggL );
+
+ BYTE nVer;
+ USHORT nInst;
+ USHORT nFbt;
+ UINT32 nLength;
+ if( !this->ReadCommonRecordHeader( rStCtrl, nVer, nInst, nFbt, nLength ) ) return;
+
+ BOOL bOk;
+ ULONG nPos = nOffsDggL + DFF_COMMON_RECORD_HEADER_SIZE;
+
+ // Fall A: erst Drawing Group Container, dann n Mal Drawing Container
+ if( DFF_msofbtDggContainer == nFbt )
+ {
+ GetDrawingGroupContainerData( rStCtrl, nLength );
+
+ rStCtrl.Seek( STREAM_SEEK_TO_END );
+ UINT32 nMaxStrPos = rStCtrl.Tell();
+
+ nPos += nLength;
+ // --> OD 2008-07-28 #156763#
+ unsigned long nDrawingContainerId = 1;
+ // <--
+ do
+ {
+ rStCtrl.Seek( nPos );
+
+ bOk = ReadCommonRecordHeader( rStCtrl, nVer, nInst, nFbt, nLength ) && ( DFF_msofbtDgContainer == nFbt );
+
+ if( !bOk )
+ {
+ nPos++;
+ rStCtrl.Seek( nPos );
+ bOk = ReadCommonRecordHeader( rStCtrl, nVer, nInst, nFbt, nLength )
+ && ( DFF_msofbtDgContainer == nFbt );
+ }
+ if( bOk )
+ {
+ // --> OD 2008-07-28 #156763#
+ GetDrawingContainerData( rStCtrl, nLength, nDrawingContainerId );
+ // <--
+ }
+ nPos += DFF_COMMON_RECORD_HEADER_SIZE + nLength;
+ // --> OD 2008-07-28 #156763#
+ ++nDrawingContainerId;
+ // <--
+ }
+ while( nPos < nMaxStrPos && bOk );
+ }
+}
+
+
+// ab hier: Drawing Group Container d.h. Dokument - weit gueltige Daten
+// ======================= ========
+//
+void SvxMSDffManager::GetDrawingGroupContainerData( SvStream& rSt, ULONG nLenDgg )
+{
+ BYTE nVer;
+ USHORT nInst;
+ USHORT nFbt;
+ UINT32 nLength;
+
+ ULONG nLenBStoreCont = 0, nLenFBSE = 0, nRead = 0;
+
+ // Nach einem BStore Container suchen
+ do
+ {
+ if(!this->ReadCommonRecordHeader( rSt, nVer, nInst, nFbt, nLength)) return;
+ nRead += DFF_COMMON_RECORD_HEADER_SIZE + nLength;
+ if( DFF_msofbtBstoreContainer == nFbt )
+ {
+ nLenBStoreCont = nLength; break;
+ }
+ rSt.SeekRel( nLength );
+ }
+ while( nRead < nLenDgg );
+
+ if( !nLenBStoreCont ) return;
+
+ // Im BStore Container alle Header der Container und Atome auslesen und die
+ // relevanten Daten aller enthaltenen FBSEs in unserem Pointer Array ablegen.
+ // Dabei zaehlen wir die gefundenen FBSEs im Member nBLIPCount mit.
+
+ const ULONG nSkipBLIPLen = 20; // bis zu nBLIPLen zu ueberspringende Bytes
+ const ULONG nSkipBLIPPos = 4; // dahinter bis zu nBLIPPos zu skippen
+
+ sal_uInt32 nBLIPLen = 0, nBLIPPos = 0;
+
+ nRead = 0;
+ do
+ {
+ if(!this->ReadCommonRecordHeader( rSt, nVer, nInst, nFbt, nLength)) return;
+ nRead += DFF_COMMON_RECORD_HEADER_SIZE + nLength;
+ if( DFF_msofbtBSE == nFbt )
+ {
+ nLenFBSE = nLength;
+ // ist FBSE gross genug fuer unsere Daten
+ BOOL bOk = ( nSkipBLIPLen + 4 + nSkipBLIPPos + 4 <= nLenFBSE );
+
+ if( bOk )
+ {
+ rSt.SeekRel( nSkipBLIPLen );
+ rSt >> nBLIPLen;
+ rSt.SeekRel( nSkipBLIPPos );
+ rSt >> nBLIPPos;
+ bOk = rSt.GetError() == 0;
+
+ nLength -= nSkipBLIPLen+ 4 + nSkipBLIPPos + 4;
+ }
+
+ if( bOk )
+ {
+ // Besonderheit:
+ // Falls nBLIPLen kleiner ist als nLenFBSE UND nBLIPPos Null ist,
+ // nehmen wir an, dass das Bild IM FBSE drin steht!
+ if( (!nBLIPPos) && (nBLIPLen < nLenFBSE) )
+ nBLIPPos = rSt.Tell() + 4;
+
+ // Das hat ja fein geklappt!
+ // Wir merken uns, dass wir einen FBSE mehr im Pointer Array haben.
+ nBLIPPos = Calc_nBLIPPos(nBLIPPos, rSt.Tell());
+
+ if( USHRT_MAX == nBLIPCount )
+ nBLIPCount = 1;
+ else
+ nBLIPCount++;
+
+ // Jetzt die Infos fuer spaetere Zugriffe speichern
+ pBLIPInfos->Insert( new SvxMSDffBLIPInfo( nInst, nBLIPPos, nBLIPLen ),
+ pBLIPInfos->Count() );
+ }
+ }
+ rSt.SeekRel( nLength );
+ }
+ while( nRead < nLenBStoreCont );
+}
+
+
+// ab hier: Drawing Container d.h. Seiten (Blatt, Dia) - weit gueltige Daten
+// ================= ======
+//
+void SvxMSDffManager::GetDrawingContainerData( SvStream& rSt, ULONG nLenDg,
+ const unsigned long nDrawingContainerId )
+{
+ BYTE nVer;USHORT nInst;USHORT nFbt;UINT32 nLength;
+
+ ULONG nReadDg = 0;
+
+ // Wir stehen in einem Drawing Container (je einer pro Seite)
+ // und muessen nun
+ // alle enthaltenen Shape Group Container abklappern
+ do
+ {
+ if(!this->ReadCommonRecordHeader( rSt, nVer, nInst, nFbt, nLength)) return;
+ nReadDg += DFF_COMMON_RECORD_HEADER_SIZE;
+ // Patriarch gefunden (der oberste Shape Group Container) ?
+ if( DFF_msofbtSpgrContainer == nFbt )
+ {
+ if(!this->GetShapeGroupContainerData( rSt, nLength, TRUE, nDrawingContainerId )) return;
+ }
+ else
+ // blanker Shape Container ? (ausserhalb vom Shape Group Container)
+ if( DFF_msofbtSpContainer == nFbt )
+ {
+ if(!this->GetShapeContainerData( rSt, nLength, ULONG_MAX, nDrawingContainerId )) return;
+ }
+ else
+ rSt.SeekRel( nLength );
+ nReadDg += nLength;
+ }
+ while( nReadDg < nLenDg );
+}
+
+BOOL SvxMSDffManager::GetShapeGroupContainerData( SvStream& rSt,
+ ULONG nLenShapeGroupCont,
+ BOOL bPatriarch,
+ const unsigned long nDrawingContainerId )
+{
+ BYTE nVer;USHORT nInst;USHORT nFbt;UINT32 nLength;
+ long nStartShapeGroupCont = rSt.Tell();
+ // Wir stehen in einem Shape Group Container (ggfs. mehrere pro Seite)
+ // und muessen nun
+ // alle enthaltenen Shape Container abklappern
+ BOOL bFirst = !bPatriarch;
+ ULONG nReadSpGrCont = 0;
+ do
+ {
+ if( !this->ReadCommonRecordHeader( rSt, nVer, nInst, nFbt, nLength ) )
+ return FALSE;
+ nReadSpGrCont += DFF_COMMON_RECORD_HEADER_SIZE;
+ // Shape Container ?
+ if( DFF_msofbtSpContainer == nFbt )
+ {
+ ULONG nGroupOffs = bFirst ? nStartShapeGroupCont - DFF_COMMON_RECORD_HEADER_SIZE : ULONG_MAX;
+ if ( !this->GetShapeContainerData( rSt, nLength, nGroupOffs, nDrawingContainerId ) )
+ return FALSE;
+ bFirst = FALSE;
+ }
+ else
+ // eingeschachtelter Shape Group Container ?
+ if( DFF_msofbtSpgrContainer == nFbt )
+ {
+ if ( !this->GetShapeGroupContainerData( rSt, nLength, FALSE, nDrawingContainerId ) )
+ return FALSE;
+ }
+ else
+ rSt.SeekRel( nLength );
+ nReadSpGrCont += nLength;
+ }
+ while( nReadSpGrCont < nLenShapeGroupCont );
+ // den Stream wieder korrekt positionieren
+ rSt.Seek( nStartShapeGroupCont + nLenShapeGroupCont );
+ return TRUE;
+}
+
+BOOL SvxMSDffManager::GetShapeContainerData( SvStream& rSt,
+ ULONG nLenShapeCont,
+ ULONG nPosGroup,
+ const unsigned long nDrawingContainerId )
+{
+ BYTE nVer;USHORT nInst;USHORT nFbt;UINT32 nLength;
+ long nStartShapeCont = rSt.Tell();
+ // Wir stehen in einem Shape Container (ggfs. mehrere pro Sh. Group)
+ // und muessen nun
+ // die Shape Id und File-Pos (fuer spaetere, erneute Zugriffe)
+ // und den ersten BStore Verweis (falls vorhanden) entnehmen
+ ULONG nLenShapePropTbl = 0;
+ ULONG nReadSpCont = 0;
+
+ // File Offset des Shape-Containers bzw. der Gruppe(!) vermerken
+ //
+ ULONG nStartOffs = (ULONG_MAX > nPosGroup) ?
+ nPosGroup : nStartShapeCont - DFF_COMMON_RECORD_HEADER_SIZE;
+ SvxMSDffShapeInfo aInfo( nStartOffs );
+
+ // duerfte das Shape durch einen Rahmen ersetzt werden ?
+ // (vorausgesetzt, es zeigt sich, dass es eine TextBox ist,
+ // und der Text nicht gedreht ist)
+ BOOL bCanBeReplaced = (ULONG_MAX > nPosGroup) ? FALSE : TRUE;
+
+ // wir wissen noch nicht, ob es eine TextBox ist
+ MSO_SPT eShapeType = mso_sptNil;
+ MSO_WrapMode eWrapMode = mso_wrapSquare;
+// BOOL bIsTextBox = FALSE;
+
+ // Shape analysieren
+ //
+ do
+ {
+ if(!this->ReadCommonRecordHeader( rSt, nVer, nInst, nFbt, nLength)) return FALSE;
+ nReadSpCont += DFF_COMMON_RECORD_HEADER_SIZE;
+ // FSP ?
+ if( ( DFF_msofbtSp == nFbt ) && ( 4 <= nLength ) )
+ {
+ // Wir haben den FSP gefunden: Shape Typ und Id vermerken!
+ eShapeType = (MSO_SPT)nInst;
+ rSt >> aInfo.nShapeId;
+ rSt.SeekRel( nLength - 4 );
+ nReadSpCont += nLength;
+ }
+ else if( DFF_msofbtOPT == nFbt ) // Shape Property Table ?
+ {
+ // Wir haben die Property Table gefunden:
+ // nach der Blip Property suchen!
+ ULONG nPropRead = 0;
+ USHORT nPropId;
+ sal_uInt32 nPropVal;
+ nLenShapePropTbl = nLength;
+// UINT32 nPropCount = nInst;
+ long nStartShapePropTbl = rSt.Tell();
+// UINT32 nComplexDataFilePos = nStartShapePropTbl + (nPropCount * 6);
+ do
+ {
+ rSt >> nPropId
+ >> nPropVal;
+ nPropRead += 6;
+
+ switch( nPropId )
+ {
+ case DFF_Prop_txflTextFlow :
+ //Writer can now handle vertical textflows in its
+ //native frames, to only need to do this for the
+ //other two formats
+
+ //Writer will handle all textflow except BtoT
+ if (GetSvxMSDffSettings() &
+ (SVXMSDFF_SETTINGS_IMPORT_PPT |
+ SVXMSDFF_SETTINGS_IMPORT_EXCEL))
+ {
+ if( 0 != nPropVal )
+ bCanBeReplaced = false;
+ }
+ else if (
+ (nPropVal != mso_txflHorzN) &&
+ (nPropVal != mso_txflTtoBA)
+ )
+ {
+ bCanBeReplaced = false;
+ }
+ break;
+ case DFF_Prop_cdirFont :
+ //Writer can now handle right to left and left
+ //to right in its native frames, so only do
+ //this for the other two formats.
+ if (GetSvxMSDffSettings() &
+ (SVXMSDFF_SETTINGS_IMPORT_PPT |
+ SVXMSDFF_SETTINGS_IMPORT_EXCEL))
+ {
+ if( 0 != nPropVal )
+ bCanBeReplaced = FALSE;
+ }
+ break;
+ case DFF_Prop_Rotation :
+ if( 0 != nPropVal )
+ bCanBeReplaced = FALSE;
+ break;
+
+ case DFF_Prop_gtextFStrikethrough :
+ if( ( 0x20002000 & nPropVal ) == 0x20002000 )
+ bCanBeReplaced = FALSE;
+ break;
+
+ case DFF_Prop_fc3DLightFace :
+ if( ( 0x00080008 & nPropVal ) == 0x00080008 )
+ bCanBeReplaced = FALSE;
+ break;
+
+ case DFF_Prop_WrapText :
+ eWrapMode = (MSO_WrapMode)nPropVal;
+ break;
+
+ default:
+ {
+ // Bit gesetzt und gueltig?
+ if( 0x4000 == ( nPropId & 0xC000 ) )
+ {
+ // Blip Property gefunden: BStore Idx vermerken!
+ nPropRead = nLenShapePropTbl;
+ }
+ else if( 0x8000 & nPropId )
+ {
+ // komplexe Prop gefunden:
+ // Laenge ist immer 6, nur die Laenge der nach der
+ // eigentlichen Prop-Table anhaengenden Extra-Daten
+ // ist unterschiedlich
+ nPropVal = 6;
+ }
+ }
+ break;
+ }
+
+/*
+//JP 21.04.99: Bug 64510
+// alte Version, die unter OS/2 zu Compilerfehlern fuehrt und damit arge
+// Performance einbussen hat.
+
+ if( 0x4000 == ( nPropId & 0xC000 ) )// Bit gesetzt und gueltig?
+ {
+ // Blip Property gefunden: BStore Idx vermerken!
+ aInfo.nBStoreIdx = nPropVal; // Index im BStore Container
+ break;
+ }
+ else
+ if( ( ( (DFF_Prop_txflTextFlow == nPropId)
+ || (DFF_Prop_Rotation == nPropId)
+ || (DFF_Prop_cdirFont == nPropId) )
+ && (0 != nPropVal) )
+
+ || ( (DFF_Prop_gtextFStrikethrough == nPropId)
+ && ( (0x20002000 & nPropVal) == 0x20002000) ) // also DFF_Prop_gtextFVertical
+ || ( (DFF_Prop_fc3DLightFace == nPropId)
+ && ( (0x00080008 & nPropVal) == 0x00080008) ) // also DFF_Prop_f3D
+ )
+ {
+ bCanBeReplaced = FALSE; // Mist: gedrehter Text oder 3D-Objekt!
+ }
+ else
+ if( DFF_Prop_WrapText == nPropId )
+ {
+ eWrapMode = (MSO_WrapMode)nPropVal;
+ }
+ ////////////////////////////////////////////////////////////////
+ ////////////////////////////////////////////////////////////////
+ // keine weitere Property-Auswertung: folge beim Shape-Import //
+ ////////////////////////////////////////////////////////////////
+ ////////////////////////////////////////////////////////////////
+ else
+ if( 0x8000 & nPropId )
+ {
+ // komplexe Prop gefunden: Laenge lesen und ueberspringen
+ if(!SkipBytes( rSt, nPropVal )) return FALSE;
+ nPropRead += nPropVal;
+ }
+*/
+ }
+ while( nPropRead < nLenShapePropTbl );
+ rSt.Seek( nStartShapePropTbl + nLenShapePropTbl );
+ nReadSpCont += nLenShapePropTbl;
+ }
+ else if( ( DFF_msofbtClientTextbox == nFbt ) && ( 4 == nLength ) ) // Text-Box-Story-Eintrag gefunden
+ {
+ rSt >> aInfo.nTxBxComp;
+ // --> OD 2008-07-28 #156763#
+ // Add internal drawing container id to text id.
+ // Note: The text id uses the first two bytes, while the internal
+ // drawing container id used the second two bytes.
+ aInfo.nTxBxComp = ( aInfo.nTxBxComp & 0xFFFF0000 ) +
+ nDrawingContainerId;
+ DBG_ASSERT( (aInfo.nTxBxComp & 0x0000FFFF) == nDrawingContainerId,
+ "<SvxMSDffManager::GetShapeContainerData(..)> - internal drawing container Id could not be correctly merged into DFF_msofbtClientTextbox value." );
+ // <--
+ }
+ else
+ {
+ rSt.SeekRel( nLength );
+ nReadSpCont += nLength;
+ }
+ }
+ while( nReadSpCont < nLenShapeCont );
+
+ //
+ // Jetzt ggfs. die Infos fuer spaetere Zugriffe auf das Shape speichern
+ //
+ if( aInfo.nShapeId )
+ {
+ // fuer Textboxen ggfs. ersetzen durch Rahmen erlauben
+ if( bCanBeReplaced
+ && aInfo.nTxBxComp
+ && (
+ ( eShapeType == mso_sptTextSimple )
+ || ( eShapeType == mso_sptTextBox )
+ || ( ( ( eShapeType == mso_sptRectangle )
+ || ( eShapeType == mso_sptRoundRectangle )
+ )
+ ) ) )
+ {
+ aInfo.bReplaceByFly = TRUE;
+ }
+ pShapeInfos->Insert( new SvxMSDffShapeInfo( aInfo ) );
+ pShapeOrders->Insert( new SvxMSDffShapeOrder( aInfo.nShapeId ),
+ pShapeOrders->Count() );
+ }
+
+ // und den Stream wieder korrekt positionieren
+ rSt.Seek( nStartShapeCont + nLenShapeCont );
+ return TRUE;
+}
+
+
+
+/*****************************************************************************
+
+ Zugriff auf ein Shape zur Laufzeit (ueber die Shape-Id)
+ ----------------------------------
+******************************************************************************/
+BOOL SvxMSDffManager::GetShape(ULONG nId, SdrObject*& rpShape,
+ SvxMSDffImportData& rData)
+{
+ SvxMSDffShapeInfo aTmpRec(0, nId);
+ aTmpRec.bSortByShapeId = TRUE;
+
+ USHORT nFound;
+ if( pShapeInfos->Seek_Entry(&aTmpRec, &nFound) )
+ {
+ SvxMSDffShapeInfo& rInfo = *pShapeInfos->GetObject( nFound );
+
+ // eventuell altes Errorflag loeschen
+ if( rStCtrl.GetError() )
+ rStCtrl.ResetError();
+ // FilePos des/der Stream(s) merken
+ ULONG nOldPosCtrl = rStCtrl.Tell();
+ ULONG nOldPosData = pStData ? pStData->Tell() : nOldPosCtrl;
+ // das Shape im Steuer Stream anspringen
+ rStCtrl.Seek( rInfo.nFilePos );
+
+ // Falls missglueckt, den Fehlerstatus zuruecksetzen und Pech gehabt!
+ if( rStCtrl.GetError() )
+ rStCtrl.ResetError();
+ else
+ rpShape = ImportObj( rStCtrl, &rData, rData.aParentRect, rData.aParentRect );
+
+ // alte FilePos des/der Stream(s) restaurieren
+ rStCtrl.Seek( nOldPosCtrl );
+ if( &rStCtrl != pStData )
+ pStData->Seek( nOldPosData );
+ return ( 0 != rpShape );
+ }
+ return FALSE;
+}
+
+
+
+/* Zugriff auf ein BLIP zur Laufzeit (bei bereits bekannter Blip-Nr)
+ ---------------------------------
+******************************************************************************/
+BOOL SvxMSDffManager::GetBLIP( ULONG nIdx_, Graphic& rData, Rectangle* pVisArea ) const
+{
+ BOOL bOk = FALSE; // Ergebnisvariable initialisieren
+ if ( pStData )
+ {
+ // check if a graphic for this blipId is already imported
+ if ( nIdx_ && pEscherBlipCache )
+ {
+ EscherBlipCacheEntry* pEntry;
+ for ( pEntry = (EscherBlipCacheEntry*)pEscherBlipCache->First(); pEntry;
+ pEntry = (EscherBlipCacheEntry*)pEscherBlipCache->Next() )
+ {
+ if ( pEntry->nBlip == nIdx_ )
+ { /* if this entry is available, then it should be possible
+ to get the Graphic via GraphicObject */
+ GraphicObject aGraphicObject( pEntry->aUniqueID );
+ rData = aGraphicObject.GetGraphic();
+ if ( rData.GetType() != GRAPHIC_NONE )
+ bOk = sal_True;
+ else
+ delete (EscherBlipCacheEntry*)pEscherBlipCache->Remove();
+ break;
+ }
+ }
+ }
+ if ( !bOk )
+ {
+ USHORT nIdx = USHORT( nIdx_ );
+ if( !nIdx || (pBLIPInfos->Count() < nIdx) ) return FALSE;
+
+ // eventuell alte(s) Errorflag(s) loeschen
+ if( rStCtrl.GetError() )
+ rStCtrl.ResetError();
+ if( ( &rStCtrl != pStData )
+ && pStData->GetError() )
+ pStData->ResetError();
+
+ // FilePos des/der Stream(s) merken
+ ULONG nOldPosCtrl = rStCtrl.Tell();
+ ULONG nOldPosData = pStData ? pStData->Tell() : nOldPosCtrl;
+
+ // passende Info-Struct aus unserem Pointer Array nehmen
+ SvxMSDffBLIPInfo& rInfo = *(*pBLIPInfos)[ nIdx-1 ];
+
+ // das BLIP Atom im Daten Stream anspringen
+ pStData->Seek( rInfo.nFilePos );
+ // ggfs. Fehlerstatus zuruecksetzen
+ if( pStData->GetError() )
+ pStData->ResetError();
+ else
+ bOk = GetBLIPDirect( *pStData, rData, pVisArea );
+ if( pStData2 && !bOk )
+ {
+ // Fehler, aber zweite Chance: es gibt noch einen zweiten
+ // Datenstream, in dem die Grafik liegen koennte!
+ if( pStData2->GetError() )
+ pStData2->ResetError();
+ ULONG nOldPosData2 = pStData2->Tell();
+ // das BLIP Atom im zweiten Daten Stream anspringen
+ pStData2->Seek( rInfo.nFilePos );
+ // ggfs. Fehlerstatus zuruecksetzen
+ if( pStData2->GetError() )
+ pStData2->ResetError();
+ else
+ bOk = GetBLIPDirect( *pStData2, rData, pVisArea );
+ // alte FilePos des zweiten Daten-Stream restaurieren
+ pStData2->Seek( nOldPosData2 );
+ }
+ // alte FilePos des/der Stream(s) restaurieren
+ rStCtrl.Seek( nOldPosCtrl );
+ if( &rStCtrl != pStData )
+ pStData->Seek( nOldPosData );
+
+ if ( bOk )
+ {
+ // create new BlipCacheEntry for this graphic
+ GraphicObject aGraphicObject( rData );
+ if ( !pEscherBlipCache )
+ const_cast <SvxMSDffManager*> (this)->pEscherBlipCache = new List();
+ EscherBlipCacheEntry* pNewEntry = new EscherBlipCacheEntry( nIdx_, aGraphicObject.GetUniqueID() );
+ pEscherBlipCache->Insert( pNewEntry, LIST_APPEND );
+ }
+ }
+ }
+ return bOk;
+}
+
+/* Zugriff auf ein BLIP zur Laufzeit (mit korrekt positioniertem Stream)
+ ---------------------------------
+******************************************************************************/
+BOOL SvxMSDffManager::GetBLIPDirect( SvStream& rBLIPStream, Graphic& rData, Rectangle* pVisArea ) const
+{
+ ULONG nOldPos = rBLIPStream.Tell();
+
+ int nRes = GRFILTER_OPENERROR; // Fehlervariable initialisieren
+
+ // nachschauen, ob es sich auch wirklich um ein BLIP handelt
+ UINT32 nLength;
+ USHORT nInst, nFbt( 0 );
+ BYTE nVer;
+ if( ReadCommonRecordHeader( rBLIPStream, nVer, nInst, nFbt, nLength) && ( 0xF018 <= nFbt ) && ( 0xF117 >= nFbt ) )
+ {
+ Size aMtfSize100;
+ BOOL bMtfBLIP = FALSE;
+ BOOL bZCodecCompression = FALSE;
+ // Nun exakt auf den Beginn der eingebetteten Grafik positionieren
+ ULONG nSkip = ( nInst & 0x0001 ) ? 32 : 16;
+
+ switch( nInst & 0xFFFE )
+ {
+ case 0x216 : // Metafile header then compressed WMF
+ case 0x3D4 : // Metafile header then compressed EMF
+ case 0x542 : // Metafile hd. then compressed PICT
+ {
+ rBLIPStream.SeekRel( nSkip + 20 );
+
+ // read in size of metafile in EMUS
+ rBLIPStream >> aMtfSize100.Width() >> aMtfSize100.Height();
+
+ // scale to 1/100mm
+ aMtfSize100.Width() /= 360, aMtfSize100.Height() /= 360;
+
+ if ( pVisArea ) // seem that we currently are skipping the visarea position
+ *pVisArea = Rectangle( Point(), aMtfSize100 );
+
+ // skip rest of header
+ nSkip = 6;
+ bMtfBLIP = bZCodecCompression = TRUE;
+ }
+ break;
+ case 0x46A : // One byte tag then JPEG (= JFIF) data
+ case 0x6E0 : // One byte tag then PNG data
+ case 0x7A8 :
+ nSkip += 1; // One byte tag then DIB data
+ break;
+ }
+ rBLIPStream.SeekRel( nSkip );
+
+ SvStream* pGrStream = &rBLIPStream;
+ SvMemoryStream* pOut = NULL;
+ if( bZCodecCompression )
+ {
+ pOut = new SvMemoryStream( 0x8000, 0x4000 );
+ ZCodec aZCodec( 0x8000, 0x8000 );
+ aZCodec.BeginCompression();
+ aZCodec.Decompress( rBLIPStream, *pOut );
+ aZCodec.EndCompression();
+ pOut->Seek( STREAM_SEEK_TO_BEGIN );
+ pOut->SetResizeOffset( 0 ); // sj: #i102257# setting ResizeOffset of 0 prevents from seeking
+ // behind the stream end (allocating too much memory)
+ pGrStream = pOut;
+ }
+
+//#define DBG_EXTRACTGRAPHICS
+#ifdef DBG_EXTRACTGRAPHICS
+
+ static sal_Int32 nCount;
+
+ String aFileName( String( RTL_CONSTASCII_STRINGPARAM( "dbggfx" ) ) );
+ aFileName.Append( String::CreateFromInt32( nCount++ ) );
+ switch( nInst &~ 1 )
+ {
+ case 0x216 : aFileName.Append( String( RTL_CONSTASCII_STRINGPARAM( ".wmf" ) ) ); break;
+ case 0x3d4 : aFileName.Append( String( RTL_CONSTASCII_STRINGPARAM( ".emf" ) ) ); break;
+ case 0x542 : aFileName.Append( String( RTL_CONSTASCII_STRINGPARAM( ".pct" ) ) ); break;
+ case 0x46a : aFileName.Append( String( RTL_CONSTASCII_STRINGPARAM( ".jpg" ) ) ); break;
+ case 0x6e0 : aFileName.Append( String( RTL_CONSTASCII_STRINGPARAM( ".png" ) ) ); break;
+ case 0x7a8 : aFileName.Append( String( RTL_CONSTASCII_STRINGPARAM( ".bmp" ) ) ); break;
+ }
+
+ String aURLStr;
+
+ if( ::utl::LocalFileHelper::ConvertPhysicalNameToURL( Application::GetAppFileName(), aURLStr ) )
+ {
+ INetURLObject aURL( aURLStr );
+
+ aURL.removeSegment();
+ aURL.removeFinalSlash();
+ aURL.Append( aFileName );
+
+ SvStream* pDbgOut = ::utl::UcbStreamHelper::CreateStream( aURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_TRUNC | STREAM_WRITE );
+
+ if( pDbgOut )
+ {
+ if ( bZCodecCompression )
+ {
+ pOut->Seek( STREAM_SEEK_TO_END );
+ pDbgOut->Write( pOut->GetData(), pOut->Tell() );
+ pOut->Seek( STREAM_SEEK_TO_BEGIN );
+ }
+ else
+ {
+ sal_Int32 nDbgLen = nLength - nSkip;
+ if ( nDbgLen )
+ {
+ sal_Char* pDat = new sal_Char[ nDbgLen ];
+ pGrStream->Read( pDat, nDbgLen );
+ pDbgOut->Write( pDat, nDbgLen );
+ pGrStream->SeekRel( -nDbgLen );
+ delete[] pDat;
+ }
+ }
+
+ delete pDbgOut;
+ }
+ }
+#endif
+
+ if( ( nInst & 0xFFFE ) == 0x7A8 )
+ { // DIBs direkt holen
+ Bitmap aNew;
+ if( aNew.Read( *pGrStream, FALSE ) )
+ {
+ rData = Graphic( aNew );
+ nRes = GRFILTER_OK;
+ }
+ }
+ else
+ { // und unsere feinen Filter darauf loslassen
+ GraphicFilter* pGF = GraphicFilter::GetGraphicFilter();
+ String aEmptyStr;
+ nRes = pGF->ImportGraphic( rData, aEmptyStr, *pGrStream, GRFILTER_FORMAT_DONTKNOW );
+
+ // SJ: I40472, sometimes the aspect ratio (aMtfSize100) does not match and we get scaling problems,
+ // then it is better to use the prefsize that is stored within the metafile. Bug #72846# for what the
+ // scaling has been implemented does not happen anymore.
+ //
+ // For pict graphics we will furthermore scale the metafile, because font scaling leads to error if the
+ // dxarray is empty (this has been solved in wmf/emf but not for pict)
+ if( bMtfBLIP && ( GRFILTER_OK == nRes ) && ( rData.GetType() == GRAPHIC_GDIMETAFILE ) && ( ( nInst & 0xFFFE ) == 0x542 ) )
+ {
+ if ( ( aMtfSize100.Width() >= 1000 ) && ( aMtfSize100.Height() >= 1000 ) )
+ { // #75956#, scaling does not work properly, if the graphic is less than 1cm
+ GDIMetaFile aMtf( rData.GetGDIMetaFile() );
+ const Size aOldSize( aMtf.GetPrefSize() );
+
+ if( aOldSize.Width() && ( aOldSize.Width() != aMtfSize100.Width() ) &&
+ aOldSize.Height() && ( aOldSize.Height() != aMtfSize100.Height() ) )
+ {
+ aMtf.Scale( (double) aMtfSize100.Width() / aOldSize.Width(),
+ (double) aMtfSize100.Height() / aOldSize.Height() );
+ aMtf.SetPrefSize( aMtfSize100 );
+ aMtf.SetPrefMapMode( MAP_100TH_MM );
+ rData = aMtf;
+ }
+ }
+ }
+ }
+ // ggfs. Fehlerstatus zuruecksetzen
+ if ( ERRCODE_IO_PENDING == pGrStream->GetError() )
+ pGrStream->ResetError();
+ delete pOut;
+ }
+ rBLIPStream.Seek( nOldPos ); // alte FilePos des Streams restaurieren
+
+ return ( GRFILTER_OK == nRes ); // Ergebniss melden
+}
+
+/* static */
+BOOL SvxMSDffManager::ReadCommonRecordHeader(DffRecordHeader& rRec, SvStream& rIn)
+{
+ rRec.nFilePos = rIn.Tell();
+ return SvxMSDffManager::ReadCommonRecordHeader( rIn,rRec.nRecVer,
+ rRec.nRecInstance,
+ rRec.nRecType,
+ rRec.nRecLen );
+}
+
+
+/* auch static */
+BOOL SvxMSDffManager::ReadCommonRecordHeader( SvStream& rSt,
+ BYTE& rVer,
+ USHORT& rInst,
+ USHORT& rFbt,
+ UINT32& rLength )
+{
+ sal_uInt16 nTmp;
+ rSt >> nTmp >> rFbt >> rLength;
+ rVer = sal::static_int_cast< BYTE >(nTmp & 15);
+ rInst = nTmp >> 4;
+ return rSt.GetError() == 0;
+}
+
+
+
+
+BOOL SvxMSDffManager::ProcessClientAnchor(SvStream& rStData, ULONG nDatLen,
+ char*& rpBuff, UINT32& rBuffLen ) const
+{
+ if( nDatLen )
+ {
+ rpBuff = new char[ nDatLen ];
+ rBuffLen = nDatLen;
+ rStData.Read( rpBuff, nDatLen );
+ }
+ return TRUE;
+}
+
+BOOL SvxMSDffManager::ProcessClientData(SvStream& rStData, ULONG nDatLen,
+ char*& rpBuff, UINT32& rBuffLen ) const
+{
+ if( nDatLen )
+ {
+ rpBuff = new char[ nDatLen ];
+ rBuffLen = nDatLen;
+ rStData.Read( rpBuff, nDatLen );
+ }
+ return TRUE;
+}
+
+
+void SvxMSDffManager::ProcessClientAnchor2( SvStream& /* rSt */, DffRecordHeader& /* rHd */ , void* /* pData */, DffObjData& /* rObj */ )
+{
+ return; // wird von SJ im Draw ueberladen
+}
+
+ULONG SvxMSDffManager::Calc_nBLIPPos( ULONG nOrgVal, ULONG /* nStreamPos */ ) const
+{
+ return nOrgVal;
+}
+
+BOOL SvxMSDffManager::GetOLEStorageName( long /* nOLEId */, String&, SvStorageRef&, uno::Reference < embed::XStorage >& ) const
+{
+ return FALSE;
+}
+
+BOOL SvxMSDffManager::ShapeHasText( ULONG /* nShapeId */, ULONG /* nFilePos */ ) const
+{
+ return TRUE;
+}
+
+// --> OD 2004-12-14 #i32596# - add new parameter <_nCalledByGroup>
+SdrObject* SvxMSDffManager::ImportOLE( long nOLEId,
+ const Graphic& rGrf,
+ const Rectangle& rBoundRect,
+ const Rectangle& rVisArea,
+ const int /* _nCalledByGroup */,
+ sal_Int64 nAspect ) const
+// <--
+{
+ SdrObject* pRet = 0;
+ String sStorageName;
+ SvStorageRef xSrcStg;
+ ErrCode nError = ERRCODE_NONE;
+ uno::Reference < embed::XStorage > xDstStg;
+ if( GetOLEStorageName( nOLEId, sStorageName, xSrcStg, xDstStg ))
+ pRet = CreateSdrOLEFromStorage( sStorageName, xSrcStg, xDstStg,
+ rGrf, rBoundRect, rVisArea, pStData, nError,
+ nSvxMSDffOLEConvFlags, nAspect );
+ return pRet;
+}
+
+const GDIMetaFile* SvxMSDffManager::lcl_GetMetaFileFromGrf_Impl( const Graphic& rGrf,
+ GDIMetaFile& rMtf )
+{
+ const GDIMetaFile* pMtf;
+ if( GRAPHIC_BITMAP == rGrf.GetType() )
+ {
+ Point aPt;
+ const Size aSz(lcl_GetPrefSize(rGrf, MAP_100TH_MM));
+
+ VirtualDevice aVirtDev;
+ aVirtDev.EnableOutput( FALSE );
+ MapMode aMM(MAP_100TH_MM);
+ aVirtDev.SetMapMode( aMM );
+
+ rMtf.Record( &aVirtDev );
+ rGrf.Draw( &aVirtDev, aPt, aSz );
+ rMtf.Stop();
+ rMtf.SetPrefMapMode(aMM);
+ rMtf.SetPrefSize( aSz );
+
+ pMtf = &rMtf;
+ }
+ else
+ pMtf = &rGrf.GetGDIMetaFile();
+ return pMtf;
+}
+
+BOOL SvxMSDffManager::MakeContentStream( SotStorage * pStor, const GDIMetaFile & rMtf )
+{
+ String aPersistStream( String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( SVEXT_PERSIST_STREAM ) ) );
+ SotStorageStreamRef xStm = pStor->OpenSotStream( aPersistStream );
+ xStm->SetVersion( pStor->GetVersion() );
+ xStm->SetBufferSize( 8192 );
+
+ USHORT nAspect = ASPECT_CONTENT;
+ ULONG nAdviseModes = 2;
+
+ Impl_OlePres aEle( FORMAT_GDIMETAFILE );
+ // Die Groesse in 1/100 mm umrechnen
+ // Falls eine nicht anwendbare MapUnit (Device abhaengig) verwendet wird,
+ // versucht SV einen BestMatchden richtigen Wert zu raten.
+ Size aSize = rMtf.GetPrefSize();
+ MapMode aMMSrc = rMtf.GetPrefMapMode();
+ MapMode aMMDst( MAP_100TH_MM );
+ aSize = OutputDevice::LogicToLogic( aSize, aMMSrc, aMMDst );
+ aEle.SetSize( aSize );
+ aEle.SetAspect( nAspect );
+ aEle.SetAdviseFlags( nAdviseModes );
+ aEle.SetMtf( rMtf );
+ aEle.Write( *xStm );
+
+ xStm->SetBufferSize( 0 );
+ return xStm->GetError() == SVSTREAM_OK;
+}
+
+struct ClsIDs {
+ UINT32 nId;
+ const sal_Char* pSvrName;
+ const sal_Char* pDspName;
+};
+static ClsIDs aClsIDs[] = {
+
+ { 0x000212F0, "MSWordArt", "Microsoft Word Art" },
+ { 0x000212F0, "MSWordArt.2", "Microsoft Word Art 2.0" },
+
+ // MS Apps
+ { 0x00030000, "ExcelWorksheet", "Microsoft Excel Worksheet" },
+ { 0x00030001, "ExcelChart", "Microsoft Excel Chart" },
+ { 0x00030002, "ExcelMacrosheet", "Microsoft Excel Macro" },
+ { 0x00030003, "WordDocument", "Microsoft Word Document" },
+ { 0x00030004, "MSPowerPoint", "Microsoft PowerPoint" },
+ { 0x00030005, "MSPowerPointSho", "Microsoft PowerPoint Slide Show"},
+ { 0x00030006, "MSGraph", "Microsoft Graph" },
+ { 0x00030007, "MSDraw", "Microsoft Draw" },
+ { 0x00030008, "Note-It", "Microsoft Note-It" },
+ { 0x00030009, "WordArt", "Microsoft Word Art" },
+ { 0x0003000a, "PBrush", "Microsoft PaintBrush Picture" },
+ { 0x0003000b, "Equation", "Microsoft Equation Editor" },
+ { 0x0003000c, "Package", "Package" },
+ { 0x0003000d, "SoundRec", "Sound" },
+ { 0x0003000e, "MPlayer", "Media Player" },
+ // MS Demos
+ { 0x0003000f, "ServerDemo", "OLE 1.0 Server Demo" },
+ { 0x00030010, "Srtest", "OLE 1.0 Test Demo" },
+ { 0x00030011, "SrtInv", "OLE 1.0 Inv Demo" },
+ { 0x00030012, "OleDemo", "OLE 1.0 Demo" },
+
+ // Coromandel / Dorai Swamy / 718-793-7963
+ { 0x00030013, "CoromandelIntegra", "Coromandel Integra" },
+ { 0x00030014, "CoromandelObjServer","Coromandel Object Server" },
+
+ // 3-d Visions Corp / Peter Hirsch / 310-325-1339
+ { 0x00030015, "StanfordGraphics", "Stanford Graphics" },
+
+ // Deltapoint / Nigel Hearne / 408-648-4000
+ { 0x00030016, "DGraphCHART", "DeltaPoint Graph Chart" },
+ { 0x00030017, "DGraphDATA", "DeltaPoint Graph Data" },
+
+ // Corel / Richard V. Woodend / 613-728-8200 x1153
+ { 0x00030018, "PhotoPaint", "Corel PhotoPaint" },
+ { 0x00030019, "CShow", "Corel Show" },
+ { 0x0003001a, "CorelChart", "Corel Chart" },
+ { 0x0003001b, "CDraw", "Corel Draw" },
+
+ // Inset Systems / Mark Skiba / 203-740-2400
+ { 0x0003001c, "HJWIN1.0", "Inset Systems" },
+
+ // Mark V Systems / Mark McGraw / 818-995-7671
+ { 0x0003001d, "ObjMakerOLE", "MarkV Systems Object Maker" },
+
+ // IdentiTech / Mike Gilger / 407-951-9503
+ { 0x0003001e, "FYI", "IdentiTech FYI" },
+ { 0x0003001f, "FYIView", "IdentiTech FYI Viewer" },
+
+ // Inventa Corporation / Balaji Varadarajan / 408-987-0220
+ { 0x00030020, "Stickynote", "Inventa Sticky Note" },
+
+ // ShapeWare Corp. / Lori Pearce / 206-467-6723
+ { 0x00030021, "ShapewareVISIO10", "Shapeware Visio 1.0" },
+ { 0x00030022, "ImportServer", "Spaheware Import Server" },
+
+ // test app SrTest
+ { 0x00030023, "SrvrTest", "OLE 1.0 Server Test" },
+
+ // test app ClTest. Doesn't really work as a server but is in reg db
+ { 0x00030025, "Cltest", "OLE 1.0 Client Test" },
+
+ // Microsoft ClipArt Gallery Sherry Larsen-Holmes
+ { 0x00030026, "MS_ClipArt_Gallery", "Microsoft ClipArt Gallery" },
+ // Microsoft Project Cory Reina
+ { 0x00030027, "MSProject", "Microsoft Project" },
+
+ // Microsoft Works Chart
+ { 0x00030028, "MSWorksChart", "Microsoft Works Chart" },
+
+ // Microsoft Works Spreadsheet
+ { 0x00030029, "MSWorksSpreadsheet", "Microsoft Works Spreadsheet" },
+
+ // AFX apps - Dean McCrory
+ { 0x0003002A, "MinSvr", "AFX Mini Server" },
+ { 0x0003002B, "HierarchyList", "AFX Hierarchy List" },
+ { 0x0003002C, "BibRef", "AFX BibRef" },
+ { 0x0003002D, "MinSvrMI", "AFX Mini Server MI" },
+ { 0x0003002E, "TestServ", "AFX Test Server" },
+
+ // Ami Pro
+ { 0x0003002F, "AmiProDocument", "Ami Pro Document" },
+
+ // WordPerfect Presentations For Windows
+ { 0x00030030, "WPGraphics", "WordPerfect Presentation" },
+ { 0x00030031, "WPCharts", "WordPerfect Chart" },
+
+ // MicroGrafx Charisma
+ { 0x00030032, "Charisma", "MicroGrafx Charisma" },
+ { 0x00030033, "Charisma_30", "MicroGrafx Charisma 3.0" },
+ { 0x00030034, "CharPres_30", "MicroGrafx Charisma 3.0 Pres" },
+ // MicroGrafx Draw
+ { 0x00030035, "Draw", "MicroGrafx Draw" },
+ // MicroGrafx Designer
+ { 0x00030036, "Designer_40", "MicroGrafx Designer 4.0" },
+
+ // STAR DIVISION
+// { 0x000424CA, "StarMath", "StarMath 1.0" },
+ { 0x00043AD2, "FontWork", "Star FontWork" },
+// { 0x000456EE, "StarMath2", "StarMath 2.0" },
+
+ { 0, "", "" } };
+
+
+BOOL SvxMSDffManager::ConvertToOle2( SvStream& rStm, UINT32 nReadLen,
+ const GDIMetaFile * pMtf, const SotStorageRef& rDest )
+{
+ BOOL bMtfRead = FALSE;
+ SotStorageStreamRef xOle10Stm = rDest->OpenSotStream( String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "\1Ole10Native" ) ),
+ STREAM_WRITE| STREAM_SHARE_DENYALL );
+ if( xOle10Stm->GetError() )
+ return FALSE;
+
+ UINT32 nType;
+ UINT32 nRecType;
+ UINT32 nStrLen;
+ String aSvrName;
+ UINT32 nDummy0;
+ UINT32 nDummy1;
+ UINT32 nDataLen;
+ BYTE * pData;
+ UINT32 nBytesRead = 0;
+ do
+ {
+ rStm >> nType;
+ rStm >> nRecType;
+ rStm >> nStrLen;
+ if( nStrLen )
+ {
+ if( 0x10000L > nStrLen )
+ {
+ sal_Char * pBuf = new sal_Char[ nStrLen ];
+ rStm.Read( pBuf, nStrLen );
+ aSvrName.Assign( String( pBuf, (USHORT) nStrLen-1, gsl_getSystemTextEncoding() ) );
+ delete[] pBuf;
+ }
+ else
+ break;
+ }
+ rStm >> nDummy0;
+ rStm >> nDummy1;
+ rStm >> nDataLen;
+
+ nBytesRead += 6 * sizeof( UINT32 ) + nStrLen + nDataLen;
+
+ if( !rStm.IsEof() && nReadLen > nBytesRead && nDataLen )
+ {
+ if( xOle10Stm.Is() )
+ {
+ pData = new BYTE[ nDataLen ];
+ if( !pData )
+ return FALSE;
+
+ rStm.Read( pData, nDataLen );
+
+ // write to ole10 stream
+ *xOle10Stm << nDataLen;
+ xOle10Stm->Write( pData, nDataLen );
+ xOle10Stm = SotStorageStreamRef();
+
+ // set the compobj stream
+ ClsIDs* pIds;
+ for( pIds = aClsIDs; pIds->nId; pIds++ )
+ {
+ if( COMPARE_EQUAL == aSvrName.CompareToAscii( pIds->pSvrName ) )
+ break;
+ }
+// SvGlobalName* pClsId = NULL;
+ String aShort, aFull;
+ if( pIds->nId )
+ {
+ // gefunden!
+ ULONG nCbFmt = SotExchange::RegisterFormatName( aSvrName );
+ rDest->SetClass( SvGlobalName( pIds->nId, 0, 0, 0xc0,0,0,0,0,0,0,0x46 ), nCbFmt,
+ String( pIds->pDspName, RTL_TEXTENCODING_ASCII_US ) );
+ }
+ else
+ {
+ ULONG nCbFmt = SotExchange::RegisterFormatName( aSvrName );
+ rDest->SetClass( SvGlobalName(), nCbFmt, aSvrName );
+ }
+
+ delete[] pData;
+ }
+ else if( nRecType == 5 && !pMtf )
+ {
+ ULONG nPos = rStm.Tell();
+ UINT16 sz[4];
+ rStm.Read( sz, 8 );
+ //rStm.SeekRel( 8 );
+ Graphic aGraphic;
+ if( ERRCODE_NONE == GraphicConverter::Import( rStm, aGraphic ) && aGraphic.GetType() )
+ {
+ const GDIMetaFile& rMtf = aGraphic.GetGDIMetaFile();
+ MakeContentStream( rDest, rMtf );
+ bMtfRead = TRUE;
+ }
+ // set behind the data
+ rStm.Seek( nPos + nDataLen );
+ }
+ else
+ rStm.SeekRel( nDataLen );
+ }
+ } while( !rStm.IsEof() && nReadLen >= nBytesRead );
+
+ if( !bMtfRead && pMtf )
+ {
+ MakeContentStream( rDest, *pMtf );
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+const char* GetInternalServerName_Impl( const SvGlobalName& aGlobName )
+{
+ if ( aGlobName == SvGlobalName( SO3_SW_OLE_EMBED_CLASSID_60 )
+ || aGlobName == SvGlobalName( SO3_SW_OLE_EMBED_CLASSID_8 ) )
+ return "swriter";
+ else if ( aGlobName == SvGlobalName( SO3_SC_OLE_EMBED_CLASSID_60 )
+ || aGlobName == SvGlobalName( SO3_SC_OLE_EMBED_CLASSID_8 ) )
+ return "scalc";
+ else if ( aGlobName == SvGlobalName( SO3_SIMPRESS_OLE_EMBED_CLASSID_60 )
+ || aGlobName == SvGlobalName( SO3_SIMPRESS_OLE_EMBED_CLASSID_8 ) )
+ return "simpress";
+ else if ( aGlobName == SvGlobalName( SO3_SDRAW_OLE_EMBED_CLASSID_60 )
+ || aGlobName == SvGlobalName( SO3_SDRAW_OLE_EMBED_CLASSID_8 ) )
+ return "sdraw";
+ else if ( aGlobName == SvGlobalName( SO3_SM_OLE_EMBED_CLASSID_60 )
+ || aGlobName == SvGlobalName( SO3_SM_OLE_EMBED_CLASSID_8 ) )
+ return "smath";
+ else if ( aGlobName == SvGlobalName( SO3_SCH_OLE_EMBED_CLASSID_60 )
+ || aGlobName == SvGlobalName( SO3_SCH_OLE_EMBED_CLASSID_8 ) )
+ return "schart";
+ return 0;
+}
+
+::rtl::OUString GetFilterNameFromClassID_Impl( const SvGlobalName& aGlobName )
+{
+ if ( aGlobName == SvGlobalName( SO3_SW_OLE_EMBED_CLASSID_60 ) )
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StarOffice XML (Writer)" ) );
+
+ if ( aGlobName == SvGlobalName( SO3_SW_OLE_EMBED_CLASSID_8 ) )
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "writer8" ) );
+
+ if ( aGlobName == SvGlobalName( SO3_SC_OLE_EMBED_CLASSID_60 ) )
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StarOffice XML (Calc)" ) );
+
+ if ( aGlobName == SvGlobalName( SO3_SC_OLE_EMBED_CLASSID_8 ) )
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "calc8" ) );
+
+ if ( aGlobName == SvGlobalName( SO3_SIMPRESS_OLE_EMBED_CLASSID_60 ) )
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StarOffice XML (Impress)" ) );
+
+ if ( aGlobName == SvGlobalName( SO3_SIMPRESS_OLE_EMBED_CLASSID_8 ) )
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "impress8" ) );
+
+ if ( aGlobName == SvGlobalName( SO3_SDRAW_OLE_EMBED_CLASSID_60 ) )
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StarOffice XML (Draw)" ) );
+
+ if ( aGlobName == SvGlobalName( SO3_SDRAW_OLE_EMBED_CLASSID_8 ) )
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "draw8" ) );
+
+ if ( aGlobName == SvGlobalName( SO3_SM_OLE_EMBED_CLASSID_60 ) )
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StarOffice XML (Math)" ) );
+
+ if ( aGlobName == SvGlobalName( SO3_SM_OLE_EMBED_CLASSID_8 ) )
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "math8" ) );
+
+ if ( aGlobName == SvGlobalName( SO3_SCH_OLE_EMBED_CLASSID_60 ) )
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StarOffice XML (Chart)" ) );
+
+ if ( aGlobName == SvGlobalName( SO3_SCH_OLE_EMBED_CLASSID_8 ) )
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "chart8" ) );
+
+ return ::rtl::OUString();
+}
+
+com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject > SvxMSDffManager::CheckForConvertToSOObj( UINT32 nConvertFlags,
+ SotStorage& rSrcStg, const uno::Reference < embed::XStorage >& rDestStorage,
+ const Graphic& rGrf,
+ const Rectangle& rVisArea )
+{
+ uno::Reference < embed::XEmbeddedObject > xObj;
+ SvGlobalName aStgNm = rSrcStg.GetClassName();
+ const char* pName = GetInternalServerName_Impl( aStgNm );
+ String sStarName;
+ if ( pName )
+ sStarName = String::CreateFromAscii( pName );
+ else if ( nConvertFlags )
+ {
+ static struct _ObjImpType
+ {
+ UINT32 nFlag;
+ const char* pFactoryNm;
+ // GlobalNameId
+ UINT32 n1;
+ USHORT n2, n3;
+ BYTE b8, b9, b10, b11, b12, b13, b14, b15;
+ } aArr[] = {
+ { OLE_MATHTYPE_2_STARMATH, "smath",
+ 0x0002ce02L, 0x0000, 0x0000,
+ 0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46 },
+ { OLE_MATHTYPE_2_STARMATH, "smath",
+ 0x00021700L, 0x0000, 0x0000,
+ 0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46 },
+ { OLE_WINWORD_2_STARWRITER, "swriter",
+ 0x00020906L, 0x0000, 0x0000,
+ 0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46 },
+ { OLE_EXCEL_2_STARCALC, "scalc", // Excel table
+ 0x00020810L, 0x0000, 0x0000,
+ 0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46 },
+ { OLE_EXCEL_2_STARCALC, "scalc", // Excel chart
+ 0x00020820L, 0x0000, 0x0000,
+ 0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46 },
+ // 114465: additional Excel OLE chart classId to above.
+ { OLE_EXCEL_2_STARCALC, "scalc",
+ 0x00020821L, 0x0000, 0x0000,
+ 0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46 },
+ { OLE_POWERPOINT_2_STARIMPRESS, "simpress", // PowerPoint presentation
+ 0x64818d10L, 0x4f9b, 0x11cf,
+ 0x86,0xea,0x00,0xaa,0x00,0xb9,0x29,0xe8 },
+ { OLE_POWERPOINT_2_STARIMPRESS, "simpress", // PowerPoint slide
+ 0x64818d11L, 0x4f9b, 0x11cf,
+ 0x86,0xea,0x00,0xaa,0x00,0xb9,0x29,0xe8 },
+ { 0, 0,
+ 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0 }
+ };
+
+ for( const _ObjImpType* pArr = aArr; pArr->nFlag; ++pArr )
+ {
+ if( nConvertFlags & pArr->nFlag )
+ {
+ SvGlobalName aTypeName( pArr->n1, pArr->n2, pArr->n3,
+ pArr->b8, pArr->b9, pArr->b10, pArr->b11,
+ pArr->b12, pArr->b13, pArr->b14, pArr->b15 );
+
+ if ( aStgNm == aTypeName )
+ {
+ sStarName = String::CreateFromAscii( pArr->pFactoryNm );
+ break;
+ }
+ }
+ }
+ }
+
+ if ( sStarName.Len() )
+ {
+ //TODO/MBA: check if (and when) storage and stream will be destroyed!
+ const SfxFilter* pFilter = 0;
+ SvMemoryStream* pStream = new SvMemoryStream;
+ if ( pName )
+ {
+ // TODO/LATER: perhaps we need to retrieve VisArea and Metafile from the storage also
+ SotStorageStreamRef xStr = rSrcStg.OpenSotStream( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "package_stream" ) ), STREAM_STD_READ );
+ *xStr >> *pStream;
+ }
+ else
+ {
+ SfxFilterMatcher aMatch( sStarName );
+ SotStorageRef xStorage = new SotStorage( FALSE, *pStream );
+ rSrcStg.CopyTo( xStorage );
+ xStorage->Commit();
+ xStorage.Clear();
+ String aType = SfxFilter::GetTypeFromStorage( rSrcStg );
+ if ( aType.Len() )
+ pFilter = aMatch.GetFilter4EA( aType );
+ }
+
+ if ( pName || pFilter )
+ {
+ //Reuse current ole name
+ String aDstStgName(String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM(MSO_OLE_Obj)));
+ aDstStgName += String::CreateFromInt32(nMSOleObjCntr);
+
+ ::rtl::OUString aFilterName;
+ if ( pFilter )
+ aFilterName = pFilter->GetName();
+ else
+ aFilterName = GetFilterNameFromClassID_Impl( aStgNm );
+
+ uno::Sequence < beans::PropertyValue > aMedium( aFilterName.getLength() ? 3 : 2);
+ aMedium[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "InputStream" ) );
+ uno::Reference < io::XInputStream > xStream = new ::utl::OSeekableInputStreamWrapper( *pStream );
+ aMedium[0].Value <<= xStream;
+ aMedium[1].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) );
+ aMedium[1].Value <<= ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "private:stream" ) );
+
+ if ( aFilterName.getLength() )
+ {
+ aMedium[2].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FilterName" ) );
+ aMedium[2].Value <<= aFilterName;
+ }
+
+ ::rtl::OUString aName( aDstStgName );
+ comphelper::EmbeddedObjectContainer aCnt( rDestStorage );
+ xObj = aCnt.InsertEmbeddedObject( aMedium, aName );
+
+ if ( !xObj.is() )
+ {
+ if( aFilterName.getLength() )
+ {
+ // throw the filter parameter away as workaround
+ aMedium.realloc( 2 );
+ xObj = aCnt.InsertEmbeddedObject( aMedium, aName );
+ }
+
+ if ( !xObj.is() )
+ return xObj;
+ }
+
+ // TODO/LATER: ViewAspect must be passed from outside!
+ sal_Int64 nViewAspect = embed::Aspects::MSOLE_CONTENT;
+
+ // JP 26.10.2001: Bug 93374 / 91928 the writer
+ // objects need the correct visarea needs the
+ // correct visarea, but this is not true for
+ // PowerPoint (see bugdoc 94908b)
+ // SJ: 19.11.2001 bug 94908, also chart objects
+ // needs the correct visarea
+
+ // If pName is set this is an own embedded object, it should have the correct size internally
+ // TODO/LATER: it might make sence in future to set the size stored in internal object
+ if( !pName && ( sStarName.EqualsAscii( "swriter" ) || sStarName.EqualsAscii( "scalc" ) ) )
+ {
+ MapMode aMapMode( VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( nViewAspect ) ) );
+ Size aSz;
+ if ( rVisArea.IsEmpty() )
+ aSz = lcl_GetPrefSize(rGrf, aMapMode );
+ else
+ {
+ aSz = rVisArea.GetSize();
+ aSz = OutputDevice::LogicToLogic( aSz, MapMode( MAP_100TH_MM ), aMapMode );
+ }
+
+ // don't modify the object
+ //TODO/LATER: remove those hacks, that needs to be done differently!
+ //xIPObj->EnableSetModified( FALSE );
+ awt::Size aSize;
+ aSize.Width = aSz.Width();
+ aSize.Height = aSz.Height();
+ xObj->setVisualAreaSize( nViewAspect, aSize );
+ //xIPObj->EnableSetModified( TRUE );
+ }
+ else if ( sStarName.EqualsAscii( "smath" ) )
+ { // SJ: force the object to recalc its visarea
+ //TODO/LATER: wait for PrinterChangeNotification
+ //xIPObj->OnDocumentPrinterChanged( NULL );
+ }
+ }
+ }
+
+ return xObj;
+}
+
+// TODO/MBA: code review and testing!
+SdrOle2Obj* SvxMSDffManager::CreateSdrOLEFromStorage(
+ const String& rStorageName,
+ SotStorageRef& rSrcStorage,
+ const uno::Reference < embed::XStorage >& xDestStorage,
+ const Graphic& rGrf,
+ const Rectangle& rBoundRect,
+ const Rectangle& rVisArea,
+ SvStream* pDataStrm,
+ ErrCode& rError,
+ UINT32 nConvertFlags,
+ sal_Int64 nReccomendedAspect )
+{
+ sal_Int64 nAspect = nReccomendedAspect;
+ SdrOle2Obj* pRet = 0;
+ if( rSrcStorage.Is() && xDestStorage.is() && rStorageName.Len() )
+ {
+ comphelper::EmbeddedObjectContainer aCnt( xDestStorage );
+ // Ist der 01Ole-Stream ueberhaupt vorhanden ?
+ // ( ist er z.B. bei FontWork nicht )
+ // Wenn nicht -> Einbindung als Grafik
+ BOOL bValidStorage = FALSE;
+ String aDstStgName( String::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM(MSO_OLE_Obj)));
+
+ aDstStgName += String::CreateFromInt32( ++nMSOleObjCntr );
+
+ {
+ SvStorageRef xObjStg = rSrcStorage->OpenSotStorage( rStorageName,
+ STREAM_READWRITE| STREAM_SHARE_DENYALL );
+ if( xObjStg.Is() )
+ {
+ {
+ BYTE aTestA[10]; // exist the \1CompObj-Stream ?
+ SvStorageStreamRef xSrcTst = xObjStg->OpenSotStream(
+ String(RTL_CONSTASCII_STRINGPARAM("\1CompObj"),
+ RTL_TEXTENCODING_MS_1252 ));
+ bValidStorage = xSrcTst.Is() && sizeof( aTestA ) ==
+ xSrcTst->Read( aTestA, sizeof( aTestA ) );
+ if( !bValidStorage )
+ {
+ // or the \1Ole-Stream ?
+ xSrcTst = xObjStg->OpenSotStream(
+ String(RTL_CONSTASCII_STRINGPARAM("\1Ole"),
+ RTL_TEXTENCODING_MS_1252 ));
+ bValidStorage = xSrcTst.Is() && sizeof(aTestA) ==
+ xSrcTst->Read(aTestA, sizeof(aTestA));
+ }
+ }
+
+ if( bValidStorage )
+ {
+ if ( nAspect != embed::Aspects::MSOLE_ICON )
+ {
+ // check whether the object is iconified one
+ // usually this information is already known, the only exception
+ // is a kind of embedded objects in Word documents
+ // TODO/LATER: should the caller be notified if the aspect changes in future?
+
+ SvStorageStreamRef xObjInfoSrc = xObjStg->OpenSotStream(
+ String( RTL_CONSTASCII_STRINGPARAM( "\3ObjInfo" ) ),
+ STREAM_STD_READ | STREAM_NOCREATE );
+ if ( xObjInfoSrc.Is() && !xObjInfoSrc->GetError() )
+ {
+ BYTE nByte = 0;
+ *xObjInfoSrc >> nByte;
+ if ( ( nByte >> 4 ) & embed::Aspects::MSOLE_ICON )
+ nAspect = embed::Aspects::MSOLE_ICON;
+ }
+ }
+
+ uno::Reference < embed::XEmbeddedObject > xObj( CheckForConvertToSOObj(
+ nConvertFlags, *xObjStg, xDestStorage, rGrf, rVisArea ));
+ if ( xObj.is() )
+ {
+ svt::EmbeddedObjectRef aObj( xObj, nAspect );
+
+ // TODO/LATER: need MediaType
+ aObj.SetGraphic( rGrf, ::rtl::OUString() );
+
+ // TODO/MBA: check setting of PersistName
+ pRet = new SdrOle2Obj( aObj, String(), rBoundRect, false);
+ // we have the Object, don't create another
+ bValidStorage = false;
+ }
+ }
+ }
+ }
+
+ if( bValidStorage )
+ {
+ // object is not an own object
+ SotStorageRef xObjStor = SotStorage::OpenOLEStorage( xDestStorage, aDstStgName, STREAM_READWRITE );
+
+ if ( xObjStor.Is() )
+ {
+ SotStorageRef xSrcStor = rSrcStorage->OpenSotStorage( rStorageName, STREAM_READ );
+ xSrcStor->CopyTo( xObjStor );
+
+ if( !xObjStor->GetError() )
+ xObjStor->Commit();
+
+ if( xObjStor->GetError() )
+ {
+ rError = xObjStor->GetError();
+ bValidStorage = FALSE;
+ }
+ else if( !xObjStor.Is() )
+ bValidStorage = FALSE;
+ }
+ }
+ else if( pDataStrm )
+ {
+ UINT32 nLen, nDummy;
+ *pDataStrm >> nLen >> nDummy;
+ if( SVSTREAM_OK != pDataStrm->GetError() ||
+ // Id in BugDoc - exist there other Ids?
+ // The ConvertToOle2 - does not check for consistent
+ 0x30008 != nDummy )
+ bValidStorage = FALSE;
+ else
+ {
+ // or is it an OLE-1 Stream in the DataStream?
+ SvStorageRef xObjStor = SotStorage::OpenOLEStorage( xDestStorage, aDstStgName );
+ //TODO/MBA: remove metafile conversion from ConvertToOle2
+ //when is this code used?!
+ GDIMetaFile aMtf;
+ bValidStorage = ConvertToOle2( *pDataStrm, nLen, &aMtf, xObjStor );
+ xObjStor->Commit();
+ }
+ }
+
+ if( bValidStorage )
+ {
+ uno::Reference < embed::XEmbeddedObject > xObj = aCnt.GetEmbeddedObject( aDstStgName );
+ if( xObj.is() )
+ {
+ // the visual area must be retrieved from the metafile (object doesn't know it so far)
+
+ if ( nAspect != embed::Aspects::MSOLE_ICON )
+ {
+ // working with visual area can switch the object to running state
+ awt::Size aAwtSz;
+ try
+ {
+ // the provided visual area should be used, if there is any
+ if ( rVisArea.IsEmpty() )
+ {
+ MapUnit aMapUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( nAspect ) );
+ Size aSz(lcl_GetPrefSize(rGrf, MapMode(aMapUnit)));
+ aAwtSz.Width = aSz.Width();
+ aAwtSz.Height = aSz.Height();
+ }
+ else
+ {
+ aAwtSz.Width = rVisArea.GetWidth();
+ aAwtSz.Height = rVisArea.GetHeight();
+ }
+ //xInplaceObj->EnableSetModified( FALSE );
+ xObj->setVisualAreaSize( nAspect, aAwtSz );
+ //xInplaceObj->EnableSetModified( TRUE );*/
+ }
+ catch( uno::Exception& )
+ {
+ OSL_ENSURE( sal_False, "Could not set visual area of the object!\n" );
+ }
+ }
+
+ svt::EmbeddedObjectRef aObj( xObj, nAspect );
+
+ // TODO/LATER: need MediaType
+ aObj.SetGraphic( rGrf, ::rtl::OUString() );
+
+ pRet = new SdrOle2Obj( aObj, aDstStgName, rBoundRect, false);
+ }
+ }
+ }
+
+ return pRet;
+}
+
+SdrObject* SvxMSDffManager::GetAutoForm( MSO_SPT eTyp ) const
+{
+ SdrObject* pRet = NULL;
+
+ if(120 >= UINT16(eTyp))
+ {
+ pRet = new SdrRectObj();
+ }
+
+ DBG_ASSERT(pRet, "SvxMSDffManager::GetAutoForm -> UNKNOWN AUTOFORM");
+
+ return pRet;
+}
+
+sal_Bool SvxMSDffManager::SetPropValue( const uno::Any& rAny, const uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
+ const String& rPropName, sal_Bool bTestPropertyAvailability )
+{
+ sal_Bool bRetValue = sal_True;
+ if ( bTestPropertyAvailability )
+ {
+ bRetValue = sal_False;
+ try
+ {
+ uno::Reference< beans::XPropertySetInfo >
+ aXPropSetInfo( rXPropSet->getPropertySetInfo() );
+ if ( aXPropSetInfo.is() )
+ bRetValue = aXPropSetInfo->hasPropertyByName( rPropName );
+ }
+ catch( uno::Exception& )
+ {
+ bRetValue = sal_False;
+ }
+ }
+ if ( bRetValue )
+ {
+ try
+ {
+ rXPropSet->setPropertyValue( rPropName, rAny );
+ bRetValue = sal_True;
+ }
+ catch( uno::Exception& )
+ {
+ bRetValue = sal_False;
+ }
+ }
+ return bRetValue;
+}
+
+SvxMSDffImportRec::SvxMSDffImportRec()
+ : pObj( 0 ),
+ pWrapPolygon(0),
+ pClientAnchorBuffer( 0 ),
+ nClientAnchorLen( 0 ),
+ pClientDataBuffer( 0 ),
+ nClientDataLen( 0 ),
+ nXAlign( 0 ), // position n cm from left
+ nXRelTo( 2 ), // relative to column
+ nYAlign( 0 ), // position n cm below
+ nYRelTo( 2 ), // relative to paragraph
+ nLayoutInTableCell( 0 ), // element is laid out in table cell
+ nTextRotationAngle( 0 ),
+ nDxTextLeft( 144 ),
+ nDyTextTop( 72 ),
+ nDxTextRight( 144 ),
+ nDyTextBottom( 72 ),
+ nDxWrapDistLeft( 0 ),
+ nDyWrapDistTop( 0 ),
+ nDxWrapDistRight( 0 ),
+ nDyWrapDistBottom(0 ),
+ nCropFromTop( 0 ),
+ nCropFromBottom( 0 ),
+ nCropFromLeft( 0 ),
+ nCropFromRight( 0 ),
+ aTextId( 0, 0 ),
+ nNextShapeId( 0 ),
+ nShapeId( 0 ),
+ eShapeType( mso_sptNil )
+{
+ eLineStyle = mso_lineSimple; // GPF-Bug #66227#
+ bDrawHell = FALSE;
+ bHidden = FALSE;
+// bInGroup = FALSE;
+ bReplaceByFly = FALSE;
+ bLastBoxInChain = TRUE;
+ bHasUDefProp = FALSE; // was the DFF_msofbtUDefProp record set?
+ bVFlip = FALSE;
+ bHFlip = FALSE;
+ bAutoWidth = FALSE;
+}
+
+SvxMSDffImportRec::SvxMSDffImportRec(const SvxMSDffImportRec& rCopy)
+ : pObj( rCopy.pObj ),
+ nXAlign( rCopy.nXAlign ),
+ nXRelTo( rCopy.nXRelTo ),
+ nYAlign( rCopy.nYAlign ),
+ nYRelTo( rCopy.nYRelTo ),
+ nLayoutInTableCell( rCopy.nLayoutInTableCell ),
+ nTextRotationAngle( rCopy.nTextRotationAngle ),
+ nDxTextLeft( rCopy.nDxTextLeft ),
+ nDyTextTop( rCopy.nDyTextTop ),
+ nDxTextRight( rCopy.nDxTextRight ),
+ nDyTextBottom( rCopy.nDyTextBottom ),
+ nDxWrapDistLeft( rCopy.nDxWrapDistLeft ),
+ nDyWrapDistTop( rCopy.nDyWrapDistTop ),
+ nDxWrapDistRight( rCopy.nDxWrapDistRight ),
+ nDyWrapDistBottom(rCopy.nDyWrapDistBottom ),
+ nCropFromTop( rCopy.nCropFromTop ),
+ nCropFromBottom( rCopy.nCropFromBottom ),
+ nCropFromLeft( rCopy.nCropFromLeft ),
+ nCropFromRight( rCopy.nCropFromRight ),
+ aTextId( rCopy.aTextId ),
+ nNextShapeId( rCopy.nNextShapeId ),
+ nShapeId( rCopy.nShapeId ),
+ eShapeType( rCopy.eShapeType )
+{
+ eLineStyle = rCopy.eLineStyle; // GPF-Bug #66227#
+ bDrawHell = rCopy.bDrawHell;
+ bHidden = rCopy.bHidden;
+// bInGroup = rCopy.bInGroup;
+ bReplaceByFly = rCopy.bReplaceByFly;
+ bAutoWidth = rCopy.bAutoWidth;
+ bLastBoxInChain = rCopy.bLastBoxInChain;
+ bHasUDefProp = rCopy.bHasUDefProp;
+ bVFlip = rCopy.bVFlip;
+ bHFlip = rCopy.bHFlip;
+ nClientAnchorLen = rCopy.nClientAnchorLen;
+ if( rCopy.nClientAnchorLen )
+ {
+ pClientAnchorBuffer = new char[ nClientAnchorLen ];
+ memcpy( pClientAnchorBuffer,
+ rCopy.pClientAnchorBuffer,
+ nClientAnchorLen );
+ }
+ else
+ pClientAnchorBuffer = 0;
+
+ nClientDataLen = rCopy.nClientDataLen;
+ if( rCopy.nClientDataLen )
+ {
+ pClientDataBuffer = new char[ nClientDataLen ];
+ memcpy( pClientDataBuffer,
+ rCopy.pClientDataBuffer,
+ nClientDataLen );
+ }
+ else
+ pClientDataBuffer = 0;
+
+ if (rCopy.pWrapPolygon)
+ pWrapPolygon = new Polygon(*rCopy.pWrapPolygon);
+ else
+ pWrapPolygon = 0;
+}
+
+SvxMSDffImportRec::~SvxMSDffImportRec()
+{
+ if (pClientAnchorBuffer)
+ delete[] pClientAnchorBuffer;
+ if (pClientDataBuffer)
+ delete[] pClientDataBuffer;
+ if (pWrapPolygon)
+ delete pWrapPolygon;
+}
+
+/* vi:set tabstop=4 shiftwidth=4 expandtab: */
+
+void SvxMSDffManager::insertShapeId( sal_Int32 nShapeId, SdrObject* pShape )
+{
+ maShapeIdContainer[nShapeId] = pShape;
+}
+
+void SvxMSDffManager::removeShapeId( SdrObject* pShape )
+{
+ SvxMSDffShapeIdContainer::iterator aIter( maShapeIdContainer.begin() );
+ const SvxMSDffShapeIdContainer::iterator aEnd( maShapeIdContainer.end() );
+ while( aIter != aEnd )
+ {
+ if( (*aIter).second == pShape )
+ {
+ maShapeIdContainer.erase( aIter );
+ break;
+ }
+ aIter++;
+ }
+}
+
+SdrObject* SvxMSDffManager::getShapeForId( sal_Int32 nShapeId )
+{
+ SvxMSDffShapeIdContainer::iterator aIter( maShapeIdContainer.find(nShapeId) );
+ return aIter != maShapeIdContainer.end() ? (*aIter).second : 0;
+}
diff --git a/filter/source/msfilter/msfiltertracer.cxx b/filter/source/msfilter/msfiltertracer.cxx
new file mode 100644
index 000000000000..a961693165ab
--- /dev/null
+++ b/filter/source/msfilter/msfiltertracer.cxx
@@ -0,0 +1,251 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+#include <filter/msfilter/msfiltertracer.hxx>
+#include <vcl/svapp.hxx>
+#include <tools/urlobj.hxx>
+#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/util/logging/LogLevel.hpp>
+#include <com/sun/star/util/SearchAlgorithms.hpp>
+#include <com/sun/star/util/SearchFlags.hpp>
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/io/XActiveDataSource.hpp>
+#include <svtools/FilterConfigItem.hxx>
+#include <unotools/localfilehelper.hxx>
+#include <unotools/streamwrap.hxx>
+#include <unotools/ucbstreamhelper.hxx>
+
+
+// --------------
+// - Namespaces -
+// --------------
+
+using namespace ::com::sun::star;
+
+MSFilterTracer::MSFilterTracer( const ::rtl::OUString& rConfigPath, uno::Sequence< beans::PropertyValue >* pConfigData ) :
+ mpCfgItem( new FilterConfigItem( rConfigPath, pConfigData ) ),
+ mpAttributeList( new SvXMLAttributeList() ),
+ mpStream( NULL ),
+ mbEnabled( sal_False ) // will be set to true in StartTracing()
+{
+ if ( mpCfgItem->ReadBool( rtl::OUString::createFromAscii( "On" ), sal_False ) )
+ {
+ uno::Reference< lang::XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() );
+ if ( xMgr.is() )
+ {
+ /* the following methods try to read a property, if it is not available it will put the second
+ parameter as default into the property sequence of the FilterConfigItem. It means we ensure that
+ the property is available by trying to read it (the return value of the method is ignored) */
+ ::rtl::OUString aEmptyString;
+ mpCfgItem->ReadInt32( rtl::OUString::createFromAscii( "LogLevel" ), util::logging::LogLevel::ALL );
+ mpCfgItem->ReadString( rtl::OUString::createFromAscii( "ClassFilter" ), aEmptyString );
+ mpCfgItem->ReadString( rtl::OUString::createFromAscii( "MethodFilter" ), aEmptyString );
+ mpCfgItem->ReadString( rtl::OUString::createFromAscii( "MessageFilter" ), aEmptyString );
+ util::SearchAlgorithms eSearchAlgorithm = (util::SearchAlgorithms)
+ mpCfgItem->ReadInt32( rtl::OUString::createFromAscii( "SearchAlgorithm" ), util::SearchAlgorithms_ABSOLUTE );
+
+ // creating the name of the log file
+ rtl::OUString aPath( mpCfgItem->ReadString( rtl::OUString::createFromAscii( "Path" ), aEmptyString ) );
+ rtl::OUString aName( mpCfgItem->ReadString( rtl::OUString::createFromAscii( "Name" ), aEmptyString ) );
+ rtl::OUString aDocumentURL( mpCfgItem->ReadString( rtl::OUString::createFromAscii( "DocumentURL" ), aEmptyString ) );
+ INetURLObject aLogFile( aDocumentURL );
+ if ( aLogFile.GetMainURL( INetURLObject::NO_DECODE ).getLength() )
+ {
+ if ( aPath.getLength() )
+ {
+ String aOldName( aLogFile.getName( INetURLObject::LAST_SEGMENT, true, INetURLObject::NO_DECODE ) );
+ aLogFile = INetURLObject( aPath );
+ aLogFile.insertName( aOldName );
+ }
+ if ( aName.getLength() )
+ aLogFile.setName( aName );
+ }
+ else
+ {
+ if ( aPath.getLength() )
+ aLogFile = INetURLObject( aPath );
+ else
+ {
+ String aURLStr;
+ if( ::utl::LocalFileHelper::ConvertPhysicalNameToURL( Application::GetAppFileName(), aURLStr ) )
+ {
+ aLogFile = INetURLObject(aURLStr);
+ aLogFile .removeSegment();
+ aLogFile .removeFinalSlash();
+ }
+ }
+ if ( !aName.getLength() )
+ aName = rtl::OUString::createFromAscii( "tracer" );
+ aLogFile.insertName( aName );
+ }
+ aLogFile.setExtension( rtl::OUString::createFromAscii( "log" ) );
+
+ // creating the file stream
+ mpStream = ::utl::UcbStreamHelper::CreateStream( aLogFile.GetMainURL( INetURLObject::NO_DECODE ), STREAM_WRITE | STREAM_TRUNC | STREAM_SHARE_DENYNONE );
+ if ( mpStream && !mpStream->GetError() )
+ {
+ // creating a wrapper for our stream
+ utl::OOutputStreamWrapper* pHelper = new ::utl::OOutputStreamWrapper( *mpStream );
+ uno::Reference< io::XOutputStream > xOutputStream( pHelper );
+
+ // instanciating the DocumentHandler, then setting the OutputStream
+ mxHandler = uno::Reference< xml::sax::XDocumentHandler >( xMgr->createInstance( rtl::OUString::createFromAscii( "com.sun.star.xml.sax.Writer" ) ), uno::UNO_QUERY );
+ uno::Reference< io::XActiveDataSource > xDocSrc( mxHandler, uno::UNO_QUERY );
+ xDocSrc->setOutputStream( xOutputStream );
+ mxHandler->startDocument();
+ mxHandler->ignorableWhitespace ( rtl::OUString::createFromAscii( " " ) );
+
+ // writing the "DocumentHandler" property, so the FilterTracer component
+ // will use it for the output
+ uno::Any aAny;
+ aAny <<= xDocSrc;
+ mpCfgItem->WriteAny( rtl::OUString::createFromAscii( "DocumentHandler" ), aAny );
+
+ SvXMLAttributeList* pAttrList = new SvXMLAttributeList;
+ pAttrList->AddAttribute( rtl::OUString::createFromAscii( "DocumentURL" ), aDocumentURL );
+ uno::Reference < xml::sax::XAttributeList > xAttributeList(pAttrList);
+ mxHandler->startElement( rtl::OUString::createFromAscii( "Document" ), xAttributeList );
+ }
+
+ uno::Sequence< uno::Any > aArgument( 1 );
+ uno::Sequence< beans::PropertyValue > aPropValues( mpCfgItem->GetFilterData() );
+ aArgument[ 0 ] <<= aPropValues;
+ mxFilterTracer = xMgr->createInstanceWithArguments( rtl::OUString::createFromAscii( "com.sun.star.util.FilterTracer" ), aArgument );
+ if ( mxFilterTracer.is() )
+ {
+ mxTextSearch = uno::Reference< util::XTextSearch >( mxFilterTracer, uno::UNO_QUERY );
+ mxLogger = uno::Reference< util::logging::XLogger >( mxFilterTracer, uno::UNO_QUERY );
+ if ( mxTextSearch.is() )
+ {
+ maSearchOptions.algorithmType = eSearchAlgorithm;
+ mxTextSearch->setOptions( maSearchOptions );
+ }
+ }
+ }
+ }
+}
+
+MSFilterTracer::~MSFilterTracer()
+{
+ mxLogger = NULL;
+ mxFilterTracer = NULL;
+ if ( mxHandler.is() )
+ {
+ mxHandler->ignorableWhitespace ( rtl::OUString::createFromAscii( " " ) );
+ mxHandler->endElement( rtl::OUString::createFromAscii( "Document" ) );
+ mxHandler->ignorableWhitespace ( rtl::OUString::createFromAscii( " " ) );
+ mxHandler->endDocument();
+ mxHandler = NULL;
+ }
+ delete mpAttributeList;
+ delete mpCfgItem;
+ delete mpStream;
+}
+
+void MSFilterTracer::StartTracing()
+{
+ mbEnabled = mpCfgItem->ReadBool( rtl::OUString::createFromAscii( "On" ), sal_False );
+}
+
+void MSFilterTracer::EndTracing()
+{
+ mbEnabled = sal_False;
+}
+
+void MSFilterTracer::StartElement( const rtl::OUString& rName, uno::Reference< xml::sax::XAttributeList > xAttribs )
+{
+ if ( mxHandler.is() )
+ mxHandler->startElement( rName, xAttribs );
+}
+
+void MSFilterTracer::EndElement( const rtl::OUString& rName )
+{
+ if ( mxHandler.is() )
+ mxHandler->endElement( rName );
+}
+
+void MSFilterTracer::Trace( const rtl::OUString& rElement, const rtl::OUString& rMessage )
+{
+ if ( mbEnabled && mxLogger.is() )
+ {
+ sal_Bool bFilter = sal_False;
+ if ( rMessage.getLength() && mxTextSearch.is() )
+ {
+ maSearchOptions.searchString = rMessage;
+ mxTextSearch->setOptions( maSearchOptions );
+ util::SearchResult aSearchResult = mxTextSearch->searchForward( rMessage, 0, rMessage.getLength() );
+ bFilter = aSearchResult.subRegExpressions != 0;
+ }
+ if ( !bFilter )
+ {
+ uno::Reference < xml::sax::XAttributeList > xAttrList( new SvXMLAttributeList( *mpAttributeList ) );
+ if ( mxHandler.is() )
+ mxHandler->startElement( rElement, xAttrList );
+ if ( rMessage.getLength() )
+ {
+ rtl::OUString aEmpty;
+ mxLogger->logp( 0, aEmpty, aEmpty, rMessage );
+ }
+ if ( mxHandler.is() )
+ mxHandler->endElement( rElement );
+ }
+ }
+}
+
+void MSFilterTracer::AddAttribute( const ::rtl::OUString& sName , const ::rtl::OUString& sValue )
+{
+ if ( mbEnabled )
+ mpAttributeList->AddAttribute( sName, sValue );
+}
+void MSFilterTracer::ClearAttributes()
+{
+ if ( mbEnabled )
+ mpAttributeList->Clear();
+}
+
+void MSFilterTracer::RemoveAttribute( const ::rtl::OUString& sName )
+{
+ if ( mbEnabled )
+ mpAttributeList->RemoveAttribute( sName );
+}
+
+uno::Any MSFilterTracer::GetProperty( const rtl::OUString& rPropName, const uno::Any* pDefault ) const
+{
+ uno::Any aDefault;
+ if ( pDefault )
+ aDefault = *pDefault;
+ return mpCfgItem->ReadAny( rPropName, aDefault );
+}
+
+void MSFilterTracer::SetProperty( const ::rtl::OUString& rPropName, const uno::Any& rProperty )
+{
+ mpCfgItem->WriteAny( rPropName, rProperty );
+}
+
diff --git a/filter/source/msfilter/msocximex.cxx b/filter/source/msfilter/msocximex.cxx
new file mode 100644
index 000000000000..82663cdf2523
--- /dev/null
+++ b/filter/source/msfilter/msocximex.cxx
@@ -0,0 +1,5956 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
+#include <com/sun/star/uno/Any.h>
+#include <com/sun/star/text/VertOrientation.hpp>
+#include <com/sun/star/text/XText.hpp>
+#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HDL_
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#endif
+#include <com/sun/star/text/TextContentAnchorType.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <com/sun/star/drawing/XShapes.hpp>
+#include <com/sun/star/drawing/XControlShape.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/container/XIndexContainer.hpp>
+#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
+#include <com/sun/star/form/XFormsSupplier.hpp>
+#include <com/sun/star/form/XForm.hpp>
+#include <com/sun/star/form/FormComponentType.hpp>
+#include <com/sun/star/awt/FontWeight.hpp>
+#include <com/sun/star/awt/FontSlant.hpp>
+#include <com/sun/star/awt/FontUnderline.hpp>
+#include <com/sun/star/awt/FontStrikeout.hpp>
+#include <com/sun/star/awt/ScrollBarOrientation.hpp>
+#include <com/sun/star/style/VerticalAlignment.hpp>
+#include <comphelper/extract.hxx>
+#include <com/sun/star/awt/XControlModel.hpp>
+#include <com/sun/star/io/XInputStreamProvider.hpp>
+#include <rtl/ustrbuf.hxx>
+#include <vcl/svapp.hxx>
+#include <sfx2/objsh.hxx>
+#include <xmlscript/xmldlg_imexp.hxx>
+#include <filter/msfilter/msocximex.hxx>
+#include <osl/file.hxx>
+#include <unotools/ucbstreamhelper.hxx>
+#include <com/sun/star/embed/XStorage.hpp>
+#include <com/sun/star/embed/XTransactedObject.hpp>
+#include <com/sun/star/embed/ElementModes.hpp>
+#include <comphelper/processfactory.hxx> // shouldn't be needed
+#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
+#include <algorithm>
+#include <memory>
+
+#ifndef C2S
+#define C2S(cChar) String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM(cChar))
+#endif
+#ifndef C2U
+#define C2U(cChar) rtl::OUString::createFromAscii(cChar)
+#endif
+
+using namespace ::com::sun::star;
+using namespace ::rtl;
+using namespace cppu;
+
+
+#define WW8_ASCII2STR(s) String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM(s))
+
+
+static char sWW8_form[] = "WW-Standard";
+
+
+struct SortOrderByTabPos
+{
+ bool operator()( const OCX_Control* a, const OCX_Control* b )
+ {
+ return a->mnTabPos < b->mnTabPos;
+ }
+};
+
+
+sal_uInt8 __READONLY_DATA OCX_Control::aObjInfo[4] = { 0x00, 0x12, 0x03, 0x00 };
+
+long ReadAlign(SvStorageStream *pS, long nPos, int nAmount)
+{
+ if (long nAlign = nPos % nAmount)
+ {
+
+ long nLen = nAmount - nAlign;
+ pS->SeekRel(nLen);
+ return nLen;
+ }
+ return 0;
+}
+
+
+// NP - Images in controls in OO2.0/SO8 exist as links, e.g. they are not part of the document so are
+// referenced externally. On import from ms document try to save images for controls here.
+// Images are stored in directory called temp in the user installation directory. Next version of OO/SO
+// hopefully will address this issue and allow a choice e.g. images for controls to be stored as links
+// or embeded in the document.
+
+// [out]location path to the stream to where the image is to be stored,
+// if same name exists in folder then this function calcuates a new name
+// [in] data raw bytes of image to be stored.
+// [in] dataLen no. byte to be stored
+//
+// returns, true if successful
+
+bool storePictureInFileSystem( OUString& location, sal_uInt8* data, sal_uInt32 dataLen )
+{
+ bool result = true;
+ OUString origPath = location;
+ try
+ {
+ uno::Reference<lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory(),
+ uno::UNO_QUERY_THROW );
+ uno::Reference< com::sun::star::ucb::XSimpleFileAccess> xSFA( xMSF->createInstance(
+ S2U("com.sun.star.ucb.SimpleFileAccess" ) ),
+ uno::UNO_QUERY_THROW );
+ OUString ext;
+ sal_Int32 index = 0;
+ while ( xSFA->exists( location ) )
+ {
+ ext = OUString::valueOf( ++index );
+ location = origPath + ext;
+ }
+
+ SvStream* pStream = ::utl::UcbStreamHelper::CreateStream( location, STREAM_WRITE | STREAM_TRUNC );
+ if ( pStream )
+ {
+ pStream->Write(data, dataLen);
+ delete pStream;
+ }
+ else
+ {
+ result = false;
+ }
+ }
+ catch( uno::Exception& )
+ {
+ result = false;
+ }
+ return result;
+}
+
+// NP - Images in controls in OO2.0/SO8 exist as links, e.g. they are not part of the document so are
+// referenced externally. On import from ms document try to save images from controls here so this
+// at least a macro programmer has a chance to accessed them manually later. Next version of OO/SO
+// hopefully will address this issue.
+// Images will be stored in a top level folder in the document package, folder is named "MigratedImages"
+
+// [in] pDocSh* the document shell.
+// [in] name name of stream image to stored in.
+// [in] data raw bytes of image to be stored.
+// [in] dataLen no. byte to be stored
+
+bool storePictureInDoc( SfxObjectShell* pDocSh, OUString& name, sal_uInt8* data, sal_uInt32 dataLen )
+{
+ uno::Reference < embed::XStorage > xStor;
+ if (pDocSh)
+ {
+ xStor = pDocSh->GetStorage();
+ if( xStor.is() )
+ {
+ try
+ {
+ uno::Reference< embed::XStorage > xPictures = xStor->openStorageElement(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "MigratedImages" ) ),
+ embed::ElementModes::READWRITE );
+ uno::Reference< beans::XPropertySet > xPropSet( xPictures, uno::UNO_QUERY );
+
+ // Set media type of folder MigratedImages to something ( that is unknown ) so that
+ // it will get copied to exported OO/SO format after SaveAs
+ if ( xPropSet.is() )
+ {
+ OUString aMediaType = C2U("MigrationImages");
+ uno::Any a;
+ a <<= aMediaType;
+ xPropSet->setPropertyValue( C2U("MediaType"), a );
+ }
+
+ uno::Reference< io::XStream > xObjReplStr = xPictures->openStreamElement(
+ name,
+ embed::ElementModes::READWRITE | embed::ElementModes::TRUNCATE );
+ uno::Reference< io::XOutputStream > xOutStream( xObjReplStr->getOutputStream(), uno::UNO_QUERY_THROW );
+ uno::Sequence< sal_Int8 > imageBytes( (sal_Int8*)data, dataLen );
+ xOutStream->writeBytes( imageBytes );
+ xOutStream->closeOutput();
+
+ uno::Reference< embed::XTransactedObject > xTransact( xPictures, uno::UNO_QUERY );
+ if ( xTransact.is() )
+ {
+ xTransact->commit();
+ }
+ }
+ catch( uno::Exception& )
+ {
+ return false;
+ }
+
+ }
+ else
+ {
+ // no storage something wrong
+ return false;
+ }
+ }
+ else
+ {
+ //No doc shell
+ return false;
+ }
+ return true;
+}
+
+long WriteAlign(SvStorageStream *pS, int nAmount)
+{
+ if (long nAlign = pS->Tell() % nAmount)
+ {
+ long nLen = nAmount - nAlign;
+ for (long i=0; i< nLen; ++i)
+ *pS << sal_uInt8(0x00);
+ return nLen;
+ }
+ return 0;
+}
+// string import/export =======================================================
+/** #117832# import of form control names
+* control name is located in stream ("\3OCXNAME")
+* a strings in "\3OCXNAME" stream seem to be terminated by 4 trailing bytes of 0's.
+* ====
+* Note: If the string in the stream is overwritten by a shorter string
+* some characters from the original string may remain, the new string however
+* will still be terminated in the same way e.g. by 4 bytes with value 0.
+*/
+
+bool writeOCXNAME( const OUString& sOCXName, SvStorageStream* pStream )
+{
+ const sal_Unicode* buffer = sOCXName.getStr();
+ for ( sal_Int32 index=0; index < sOCXName.getLength(); index++ )
+ {
+ sal_uInt16 ch = static_cast< sal_uInt16 >( buffer[ index ] );
+ *pStream << ch;
+ }
+ // write
+ *pStream << sal_uInt32(0);
+ return ( SVSTREAM_OK == pStream->GetError() );
+
+}
+
+bool readOCXNAME( OUString& sCName, SvStorageStream* pStream )
+{
+ /*
+ * Read uniCode until no data or 0 encountered
+ */
+ OUStringBuffer buf(40);
+ do
+ {
+ sal_uInt16 ch = 0;
+ *pStream >> ch;
+ sal_Unicode uni = static_cast< sal_Unicode >( ch );
+ if ( uni == 0 )
+ {
+ break;
+ }
+ buf.append( &uni, 1 );
+
+ } while ( !pStream->IsEof() );
+
+ sCName = buf.makeStringAndClear();
+ return ( SVSTREAM_OK == pStream->GetError() );
+}
+
+
+/* #110435# (DR, 2003-11-12) ** Import of Unicode strings in form controls **
+
+ Strings may be stored either as compressed or uncompressed Unicode
+ character array. There are no encoded byte strings anywhere.
+
+ The string length field stores the length of the character array (not the
+ character count of the string) in the lower 31 bits, and the compression
+ state in the highest bit.
+
+ A set bit means the character array is compressed. This means all Unicode
+ characters are <=0xFF. Therefore the high bytes of all characters are left
+ out, and the character array size is equal to the string length.
+
+ A cleared bit means the character array is not compressed. The buffer
+ contains Little-Endian Unicode characters, and the resulting string length
+ is half the buffer size.
+
+ TODO: This implementation of the new string import is a hack to keep
+ msocximex.hxx unchanged. A better implementation would replace the char*
+ members of all classes by something more reasonable.
+ */
+
+namespace {
+
+const sal_uInt32 SVX_MSOCX_SIZEMASK = 0x7FFFFFFF; /// Mask for character buffer size.
+const sal_uInt32 SVX_MSOCX_COMPRESSED = 0x80000000; /// 1 = compressed Unicode array.
+
+
+/** Returns true, if the passed length field specifies a compressed character array.
+ */
+inline bool lclIsCompressed( sal_uInt32 nLenFld )
+{
+ return (nLenFld & SVX_MSOCX_COMPRESSED) != 0;
+}
+
+
+/** Extracts and returns the memory size of the character buffer.
+ @return Character buffer size (may differ from resulting string length!).
+ */
+inline sal_uInt32 lclGetBufferSize( sal_uInt32 nLenFld )
+{
+ return nLenFld & SVX_MSOCX_SIZEMASK;
+}
+
+
+// import ---------------------------------------------------------------------
+
+/** Reads the character array of a string in a form control.
+
+ Creates a new character array containing the character data.
+ The length field must be read before and passed to this function.
+ Aligns stream position to multiple of 4 before.
+
+ @param rStrm
+ The input stream.
+
+ @param rpcCharArr
+ (out-param) Will point to the created character array,
+ or will be 0 if string is empty. The array is NOT null-terminated.
+ If the passed pointer points to an old existing array, it will be
+ deleted before. Caller must delete the returned array.
+
+ @param nLenFld
+ The corresponding string length field read somewhere before.
+ */
+void lclReadCharArray( SvStorageStream& rStrm, char*& rpcCharArr, sal_uInt32 nLenFld, long nPos )
+{
+ delete[] rpcCharArr;
+ rpcCharArr = 0;
+ sal_uInt32 nBufSize = lclGetBufferSize( nLenFld );
+ DBG_ASSERT( nBufSize <= 0xFFFF, "lclReadCharArray - possible read error: char array is too big" );
+ if( nBufSize && nBufSize <= 0xFFFF )
+ {
+ rpcCharArr = new char[ nBufSize ];
+ if( rpcCharArr )
+ {
+ ReadAlign( &rStrm, nPos, 4 );
+ rStrm.Read( rpcCharArr, nBufSize );
+ }
+ }
+}
+
+
+/** Creates an OUString from a character array created with lclReadCharArray().
+
+ The passed parameters must match, that means the length field must be the
+ same used to create the passed character array.
+
+ @param pcCharArr
+ The character array returned by lclReadCharArray(). May be compressed
+ or uncompressed, next parameter nLenFld will specify this.
+
+ @param nLenFld
+ MUST be the same string length field that has been passed to
+ lclReadCharArray() to create the character array in previous parameter
+ pcCharArr.
+
+ @return
+ An OUString containing the decoded string data. Will be empty if
+ pcCharArr is 0.
+ */
+OUString lclCreateOUString( const char* pcCharArr, sal_uInt32 nLenFld )
+{
+ OUStringBuffer aBuffer;
+ sal_uInt32 nBufSize = lclGetBufferSize( nLenFld );
+ if( lclIsCompressed( nLenFld ) )
+ {
+ // buffer contains compressed Unicode, not encoded bytestring
+ sal_Int32 nStrLen = static_cast< sal_Int32 >( nBufSize );
+ aBuffer.setLength( nStrLen );
+ const char* pcCurrChar = pcCharArr;
+ for( sal_Int32 nChar = 0; nChar < nStrLen; ++nChar, ++pcCurrChar )
+ /* *pcCurrChar may contain negative values and therefore MUST be
+ casted to unsigned char, before assigned to a sal_Unicode. */
+ aBuffer.setCharAt( nChar, static_cast< unsigned char >( *pcCurrChar ) );
+ }
+ else
+ {
+ // buffer contains Little-Endian Unicode
+ sal_Int32 nStrLen = static_cast< sal_Int32 >( nBufSize ) / 2;
+ aBuffer.setLength( nStrLen );
+ const char* pcCurrChar = pcCharArr;
+ for( sal_Int32 nChar = 0; nChar < nStrLen; ++nChar )
+ {
+ /* *pcCurrChar may contain negative values and therefore MUST be
+ casted to unsigned char, before assigned to a sal_Unicode. */
+ sal_Unicode cChar = static_cast< unsigned char >( *pcCurrChar++ );
+ cChar |= (static_cast< unsigned char >( *pcCurrChar++ ) << 8);
+ aBuffer.setCharAt( nChar, cChar );
+ }
+ }
+ return aBuffer.makeStringAndClear();
+}
+
+// export ---------------------------------------------------------------------
+
+/** This class implements writing a character array from a Unicode string.
+
+ Usage:
+ 1) Construct an instance, either directly with an OUString, or with an UNO
+ Any containing an OUString.
+ 2) Check with HasData(), if there is something to write.
+ 3) Write the string length field with WriteLenField() at the right place.
+ 4) Write the encoded character array with WriteCharArray().
+ */
+class SvxOcxString
+{
+public:
+ /** Constructs an empty string. String data may be set later by assignment. */
+ inline explicit SvxOcxString() : mnLenFld( 0 ) {}
+ /** Constructs the string from the passed OUString. */
+ inline explicit SvxOcxString( const OUString& rStr ) { Init( rStr ); }
+ /** Constructs the string from the passed UNO Any. */
+ inline explicit SvxOcxString( const uno::Any& rAny ) { Init( rAny ); }
+
+ /** Assigns the passed string to the object. */
+ inline SvxOcxString& operator=( const OUString& rStr ) { Init( rStr ); return *this; }
+ /** Assigns the string in the passed UNO Any to the object. */
+ inline SvxOcxString& operator=( const uno::Any& rAny ) { Init( rAny ); return *this; }
+
+ /** Returns true, if the string contains at least one character to write. */
+ inline bool HasData() const { return maString.getLength() > 0; }
+
+ /** Writes the encoded 32-bit string length field. Aligns stream position to mult. of 4 before. */
+ void WriteLenField( SvStorageStream& rStrm ) const;
+ /** Writes the encoded character array. Aligns stream position to mult. of 4 before. */
+ void WriteCharArray( SvStorageStream& rStrm ) const;
+
+private:
+ inline void Init( const OUString& rStr ) { maString = rStr; Init(); }
+ void Init( const uno::Any& rAny );
+ void Init();
+
+ OUString maString; /// The initial string data.
+ sal_uInt32 mnLenFld; /// The encoded string length field.
+};
+
+void SvxOcxString::Init( const uno::Any& rAny )
+{
+ if( !(rAny >>= maString) )
+ maString = OUString();
+ Init();
+}
+
+void SvxOcxString::Init()
+{
+ mnLenFld = static_cast< sal_uInt32 >( maString.getLength() );
+ bool bCompr = true;
+ // try to find a character >= 0x100 -> character array will be stored uncompressed then
+ if( const sal_Unicode* pChar = maString.getStr() )
+ for( const sal_Unicode* pEnd = pChar + maString.getLength(); bCompr && (pChar < pEnd); ++pChar )
+ bCompr = (*pChar < 0x100);
+ if( bCompr )
+ mnLenFld |= SVX_MSOCX_COMPRESSED;
+ else
+ mnLenFld *= 2;
+}
+
+void SvxOcxString::WriteLenField( SvStorageStream& rStrm ) const
+{
+ if( HasData() )
+ {
+ WriteAlign( &rStrm, 4);
+ rStrm << mnLenFld;
+ }
+}
+
+void SvxOcxString::WriteCharArray( SvStorageStream& rStrm ) const
+{
+ if( HasData() )
+ {
+ const sal_Unicode* pChar = maString.getStr();
+ const sal_Unicode* pEnd = pChar + maString.getLength();
+ bool bCompr = lclIsCompressed( mnLenFld );
+
+ WriteAlign( &rStrm, 4);
+ for( ; pChar < pEnd; ++pChar )
+ {
+ // write compressed Unicode (not encoded bytestring), or Little-Endian Unicode
+ rStrm << static_cast< sal_uInt8 >( *pChar );
+ if( !bCompr )
+ rStrm << static_cast< sal_uInt8 >( *pChar >> 8 );
+ }
+ }
+}
+
+const sal_uInt16 USERFORM = (sal_uInt16)0xFF;
+const sal_uInt16 STDCONTAINER = (sal_uInt16)0xFE;
+
+const sal_uInt16 PAGE = (sal_uInt16)0x07;
+
+const sal_uInt16 IMAGE = (sal_uInt16)0x0C;
+const sal_uInt16 FRAME = (sal_uInt16)0x0E;
+
+const sal_uInt16 SPINBUTTON = (sal_uInt16)0x10;
+const sal_uInt16 CMDBUTTON = (sal_uInt16)0x11;
+const sal_uInt16 TABSTRIP = (sal_uInt16)0x12;
+
+const sal_uInt16 LABEL = (sal_uInt16)0x15;
+
+const sal_uInt16 TEXTBOX = (sal_uInt16)0x17;
+const sal_uInt16 LISTBOX = (sal_uInt16)0x18;
+const sal_uInt16 COMBOBOX = (sal_uInt16)0x19;
+const sal_uInt16 CHECKBOX = (sal_uInt16)0x1A;
+
+const sal_uInt16 OPTIONBUTTON = (sal_uInt16)0x1B;
+const sal_uInt16 TOGGLEBUTTON = (sal_uInt16)0x1C;
+
+const sal_uInt16 SCROLLBAR = (sal_uInt16)0x2F;
+
+const sal_uInt16 MULTIPAGE = (sal_uInt16)0x39;
+const sal_uInt16 PROGRESSBAR = (sal_uInt16)0x8000;
+
+typedef std::vector< ContainerRecord > ContainerRecordList;
+
+class ContainerRecReader
+{
+ public:
+
+ virtual ~ContainerRecReader() {}
+
+ virtual bool Read( OCX_ContainerControl* pContainerControl, SvStorageStream *pS)
+ {
+ *pS >> nNoRecords;
+ *pS >> nTotalLen;
+
+ if ( isMultiPage )
+ {
+ if ( !handleMultiPageHdr( pS ) )
+ {
+ return false;
+ }
+ }
+ else
+ {
+ if ( !handleStandardHdr( pS ) )
+ {
+ return false;
+ }
+ }
+
+ records.clear();
+ for (sal_uInt32 nRecord = 0; nRecord < nNoRecords; ++nRecord)
+ {
+ // DR #134146# redo loading of FrameChild data
+
+ ContainerRecord rec;
+
+ // record header
+ sal_uInt16 nId, nSize;
+ *pS >> nId >> nSize;
+ sal_Size nStartPos = pS->Tell();
+
+ // content flags
+ sal_uInt32 nContentFlags;
+ *pS >> nContentFlags;
+
+ // length of control name
+ sal_uInt32 nNameLen = 0;
+ if( nContentFlags & 0x00000001 )
+ *pS >> nNameLen;
+ // length of control tag
+ sal_uInt32 nTagLen = 0;
+ if( nContentFlags & 0x00000002 )
+ *pS >> nTagLen;
+ // substorage id for frames
+ if( nContentFlags & 0x00000004 )
+ *pS >> rec.nSubStorageId;
+ // help-context id
+ if( nContentFlags & 0x00000008 )
+ pS->SeekRel( 4 );
+ // option flags
+ if( nContentFlags & 0x00000010 )
+ {
+ sal_uInt32 nBitFlags = 0;
+ *pS >> nBitFlags;
+ rec.bVisible = ( ( nBitFlags & 0x02 ) == 0x02 );
+ }
+ // substream size
+ if( nContentFlags & 0x00000020 )
+ *pS >> rec.nSubStreamLen;
+ // tabstop position
+ if( nContentFlags & 0x00000040 )
+ *pS >> rec.nTabPos;
+ // control type
+ if( nContentFlags & 0x00000080 )
+ *pS >> rec.nTypeIdent;
+ // length of infotip
+ sal_uInt32 nTipLen = 0;
+ if( nContentFlags & 0x00000800 )
+ {
+ ReadAlign( pS, pS->Tell() - nStartPos, 4 );
+ *pS >> nTipLen;
+ }
+
+ sal_uInt32 nCntrlIdLen = 0;
+ if( nContentFlags & 0x00001000 )
+ *pS >> nCntrlIdLen;
+
+ // length of control source name
+ sal_uInt32 nCtrlSrcLen = 0;
+ if( nContentFlags & 0x00002000 )
+ {
+ ReadAlign( pS, pS->Tell() - nStartPos, 4 );
+ *pS >> nCtrlSrcLen;
+ }
+
+ // length of row source name
+ sal_uInt32 nRowSrcLen = 0;
+ if( nContentFlags & 0x00004000 )
+ {
+ ReadAlign( pS, pS->Tell() - nStartPos, 4 );
+ *pS >> nRowSrcLen;
+ }
+
+ // control name
+ sal_Char* pName = 0;
+ sal_uInt32 nNameBufSize = lclGetBufferSize( nNameLen );
+ if( nNameBufSize > 0 )
+ {
+ pName = new char[ nNameBufSize ];
+ ReadAlign( pS, pS->Tell() - nStartPos, 4 );
+ pS->Read( pName, nNameBufSize );
+ }
+ // control tag
+ sal_uInt32 nTagBufSize = lclGetBufferSize( nTagLen );
+ if( nTagBufSize > 0 )
+ {
+ ReadAlign( pS, pS->Tell() - nStartPos, 4 );
+ pS->SeekRel( nTagBufSize );
+ }
+
+ // control position
+ if( nContentFlags & 0x00000100 )
+ {
+ ReadAlign( pS, pS->Tell() - nStartPos, 4 );
+ *pS >> rec.nLeft >> rec.nTop;
+ }
+
+ // control infotip
+ sal_uInt32 nTipBufSize = lclGetBufferSize( nTipLen );
+ if( nTipBufSize > 0 )
+ {
+ std::auto_ptr< sal_Char > pTipName;
+ pTipName.reset( new sal_Char[ nTipBufSize ] );
+ ReadAlign( pS, pS->Tell() - nStartPos, 4 );
+ pS->Read( pTipName.get(), nTipBufSize );
+ rec.controlTip = lclCreateOUString( pTipName.get(), nTipLen );
+ }
+ // control id
+ sal_uInt32 nCntrlIdSize = lclGetBufferSize( nCntrlIdLen );
+ if( nCntrlIdSize > 0 )
+ {
+ ReadAlign( pS, pS->Tell() - nStartPos, 4 );
+ pS->SeekRel( nCntrlIdSize );
+ }
+ // control source name
+ sal_uInt32 nCtrlSrcBufSize = lclGetBufferSize( nCtrlSrcLen );
+ if( nCtrlSrcBufSize > 0 )
+ {
+ ReadAlign( pS, pS->Tell() - nStartPos, 4 );
+ pS->SeekRel( nCtrlSrcBufSize );
+ }
+ // row source name
+ sal_uInt32 nRowSrcBufSize = lclGetBufferSize( nRowSrcLen );
+ if( nRowSrcBufSize > 0 )
+ {
+ ReadAlign( pS, pS->Tell() - nStartPos, 4 );
+ pS->SeekRel( nRowSrcBufSize );
+ }
+
+ // seek to end of data
+ pS->Seek( nStartPos + nSize );
+
+ rec.cName = lclCreateOUString(pName, nNameLen);
+ delete[] pName;
+
+ OCX_Control* pControl = NULL;
+ if( pContainerControl->createFromContainerRecord( rec, pControl ) &&
+ pControl )
+ {
+ // propagate doc shell from parent
+ pControl->pDocSh = pContainerControl->pDocSh;
+ pContainerControl->ProcessControl( pControl, pS, rec );
+ }
+ else
+ {
+ DBG_ERROR("Terminating import, unexpected error");
+ return false;
+ }
+ }
+ return true;
+ }
+
+ protected:
+ ContainerRecReader() : isMultiPage(false){}
+ bool isMultiPage;
+ sal_uInt32 nNoRecords;
+ sal_uInt32 nTotalLen;
+
+ private:
+ bool handleStandardHdr( SvStorageStream* pS )
+ {
+ sal_uInt8 aUnknown11[4];
+ pS->Read(aUnknown11, sizeof(aUnknown11));
+ return true;
+ }
+
+ bool handleMultiPageHdr( SvStorageStream* pS )
+ {
+ sal_uInt32 nUnknown_32b; // unknown 32 bit structure, flags ?
+ sal_uInt16 nUnknown_16b; // unknown 16 bit structure
+ sal_uInt16 nMysteryLen; // lenght of unknown sub record
+
+ *pS >> nUnknown_32b;
+ *pS >> nUnknown_16b;
+ *pS >> nMysteryLen;
+
+ pS->SeekRel( nMysteryLen );
+ return true;
+ }
+ ContainerRecordList records;
+};
+
+class StdContainerRecReader : public ContainerRecReader
+{
+ public:
+ StdContainerRecReader(){}
+};
+
+class MultiPageContainerRecReader : public ContainerRecReader
+{
+ public:
+ MultiPageContainerRecReader()
+ {
+ // NP ( 27-01-05 )
+ // Strictly speaking this approach shouldn't be necessary.
+ // It should be possible to have a common routine read the
+ // container record array and by examining the flags present in
+ // the record to determine we expect to read or not.
+ // In this case for a MultPage control there is no Top or Left
+ // values in the control record array, however time contraints
+ // and associated risk prevent further investigation of this
+ // at the moment.
+ // similar situation exists for the start of the container record
+ // which in the case of the MultiPage is different from
+ // UserForm & Frame ( the other containers )
+
+ isMultiPage = true; // tell the base class skip
+ }
+};
+
+class ContainerRecordReaderFac
+{
+ public:
+ static ContainerRecReader* instance( sal_uInt32 containerType )
+ {
+ switch( containerType )
+ {
+ case PAGE:
+ case FRAME:
+ case USERFORM:
+ case STDCONTAINER:
+ return new StdContainerRecReader();
+ case MULTIPAGE:
+ return new MultiPageContainerRecReader();
+ default:
+ DBG_ERROR("Illegal container type for factory");
+ return NULL;
+ }
+ }
+ private:
+ ContainerRecordReaderFac();
+};
+
+} // namespace
+
+// ============================================================================
+
+void RBGroup::add(OCX_Control* pRB)
+{
+ // The tab index for the group is calculated as
+ // the lowest tab index found in the list of RadioButtons
+ if ( pRB->mnTabPos < mRBGroupPos )
+ {
+ mRBGroupPos = pRB->mnTabPos;
+ CtrlIterator aEnd = mpControls.end();
+ for (CtrlIterator aIter = mpControls.begin(); aIter != aEnd; ++ aIter )
+ {
+ (*aIter)->mnTabPos = mRBGroupPos;
+ }
+ }
+ mpControls.push_back( pRB );
+}
+
+struct SortGroupByTabPos
+{
+ bool operator()( const RBGroup* a, const RBGroup* b )
+ {
+ return a->tabPos() < b->tabPos();
+ }
+};
+
+RBGroupManager::RBGroupManager( String& defaultName ):mSDefaultName( defaultName ),
+ numRadioButtons(0)
+{
+ groupList.reserve( 8 ); // reserve far more than we expect
+}
+
+RBGroupManager::~RBGroupManager()
+{
+ for ( GroupIterator gIter=groupList.begin(); gIter!=groupList.end(); ++gIter )
+ {
+ delete( *gIter );
+ }
+}
+
+// Loose description of the method below ( I sure there is a better way to do
+// this )
+// In order to "fake" MS grouping behavior for OptionButtons the OptionButtons
+// in the same group need to have consecutive tab indices ( regardless of the
+// imported tab indices of the RadioButtons ). Additionally if two
+// groups of OptionButtons end up having all consecutive indices they
+// will be treated as a single group by OpenOffice. In this case
+// a dummy seperator control needs to be inserted between the groups.
+//
+// This method returns a new list "destinationList" containing the controls
+// passed in "sourceList" and the OptionButtons contained in the various
+// Groups maintained by this class.
+// Controls are ordered in the destination list by tab index.
+// Each RadioButtonGroup has a tab index associated with it.
+// ( Tab index of a RadioGroup is determined as the tab index of the
+// OptionButton control with the lowest tab index in the group )
+
+
+void RBGroupManager::addRadioButton( OCX_OptionButton* pRButton )
+{
+ if ( pRButton )
+ {
+ OUString groupName = mSDefaultName;
+ if ( pRButton->nGroupNameLen )
+ {
+ groupName =
+ lclCreateOUString(pRButton->pGroupName,
+ pRButton->nGroupNameLen);
+ }
+ ++numRadioButtons;
+ RBGroupHash::iterator iter = rbGroups.find( groupName );
+ if ( iter != rbGroups.end() )
+ {
+ iter->second->controls().push_back( pRButton );
+ }
+ else
+ {
+ RBGroup* newGroup = new RBGroup(pRButton->mnTabPos);
+ newGroup->controls().push_back( pRButton );
+ rbGroups[ groupName ] = newGroup;
+ groupList.push_back( newGroup );
+ }
+
+ }
+}
+
+CtrlList RBGroupManager::insertGroupsIntoControlList( const CtrlList& sourceList )
+{
+ ::std::sort( groupList.begin(), groupList.end(), SortGroupByTabPos() );
+ std::vector<OCX_Control*> destinationList;
+ if ( groupList.size() )
+ {
+ destinationList.reserve( sourceList.size() + numRadioButtons );
+
+ GroupIterator groupEnd = groupList.end();
+ CtrlIteratorConst sourceEnd = sourceList.end();
+
+ size_t prevGroupListSize = 0;
+
+ CtrlIteratorConst containees = sourceList.begin();
+ GroupIterator groupIter=groupList.begin();
+ while ( containees != sourceEnd ||
+ groupIter != groupEnd )
+ {
+ bool addGroupSeperator = false;
+ if ( containees != sourceEnd )
+ {
+ if ( groupIter != groupEnd )
+ {
+ sal_Int16 groupTabPos = (*groupIter)->tabPos();
+ if ( (*containees)->mnTabPos >= groupTabPos )
+ {
+ if ( !(destinationList.size() >= prevGroupListSize ))
+ {
+ addGroupSeperator = true;
+ }
+ copyList( (*groupIter)->controls(), destinationList, addGroupSeperator );
+ ++groupIter;
+
+ prevGroupListSize = destinationList.size();
+ }
+ }
+ destinationList.push_back(*containees);
+ ++containees;
+ }
+ else
+ {
+ if ( groupIter != groupEnd )
+ {
+ if ( !(destinationList.size() > prevGroupListSize ))
+ {
+ addGroupSeperator = true;
+ }
+ copyList( (*groupIter)->controls(), destinationList, addGroupSeperator );
+ ++groupIter;
+ prevGroupListSize = destinationList.size();
+ }
+ }
+ }
+ }
+ else
+ {
+ destinationList = sourceList;
+ }
+ return destinationList;
+
+}
+
+
+void RBGroupManager::addSeperator( std::vector< OCX_Control* >& dest )
+{
+ OCX_Control* seperator = new OCX_CommandButton;
+ seperator->SetInDialog(true);
+ seperator->sName = C2S("GroupSeperator");
+ dest.push_back( seperator );
+}
+
+void RBGroupManager::copyList( std::vector< OCX_Control* >& src,
+ std::vector< OCX_Control* >& dest,
+ bool addGroupSeperator )
+{
+ if ( addGroupSeperator )
+ {
+ addSeperator( dest );
+ }
+
+ for ( CtrlIterator rbIter = src.begin(); rbIter != src.end(); ++rbIter )
+ {
+ dest.push_back( *rbIter );
+ }
+}
+
+class OCX_UserFormLabel : public OCX_Label
+{
+public:
+ OCX_UserFormLabel(OCX_Control* pParent ) : OCX_Label( pParent )
+ {
+ mnForeColor = 0x80000012L;
+ mnBackColor = 0x8000000FL;
+ }
+};
+
+
+sal_uInt16 OCX_Control::nStandardId(0x0200);
+sal_uInt16 OCX_FontData::nStandardId(0x0200);
+
+sal_uInt32 OCX_Control::pColor[25] = {
+0xC0C0C0, 0x008080, 0x000080, 0x808080, 0xC0C0C0, 0xFFFFFF, 0x000000,
+0x000000, 0x000000, 0xFFFFFF, 0xC0C0C0, 0xC0C0C0, 0x808080, 0x000080,
+0xFFFFFF, 0xC0C0C0, 0x808080, 0x808080, 0x000000, 0xC0C0C0, 0xFFFFFF,
+0x000000, 0xC0C0C0, 0x000000, 0xFFFFC0 };
+
+void OCX_Control::FillSystemColors()
+{
+ // overwrite the predefined colors with available system colors
+ const StyleSettings& rSett = Application::GetSettings().GetStyleSettings();
+
+ pColor[ 0x00 ] = rSett.GetFaceColor().GetColor();
+ pColor[ 0x01 ] = rSett.GetWorkspaceColor().GetColor();
+ pColor[ 0x02 ] = rSett.GetActiveColor().GetColor();
+ pColor[ 0x03 ] = rSett.GetDeactiveColor().GetColor();
+ pColor[ 0x04 ] = rSett.GetMenuBarColor().GetColor();
+ pColor[ 0x05 ] = rSett.GetWindowColor().GetColor();
+ pColor[ 0x07 ] = rSett.GetMenuTextColor().GetColor();
+ pColor[ 0x08 ] = rSett.GetWindowTextColor().GetColor();
+ pColor[ 0x09 ] = rSett.GetActiveTextColor().GetColor();
+ pColor[ 0x0A ] = rSett.GetActiveBorderColor().GetColor();
+ pColor[ 0x0B ] = rSett.GetDeactiveBorderColor().GetColor();
+ pColor[ 0x0C ] = rSett.GetWorkspaceColor().GetColor();
+ pColor[ 0x0D ] = rSett.GetHighlightColor().GetColor();
+ pColor[ 0x0E ] = rSett.GetHighlightTextColor().GetColor();
+ pColor[ 0x0F ] = rSett.GetFaceColor().GetColor();
+ pColor[ 0x10 ] = rSett.GetShadowColor().GetColor();
+ pColor[ 0x12 ] = rSett.GetButtonTextColor().GetColor();
+ pColor[ 0x13 ] = rSett.GetDeactiveTextColor().GetColor();
+ pColor[ 0x14 ] = rSett.GetHighlightColor().GetColor();
+ pColor[ 0x15 ] = rSett.GetDarkShadowColor().GetColor();
+ pColor[ 0x16 ] = rSett.GetShadowColor().GetColor();
+ pColor[ 0x17 ] = rSett.GetHelpTextColor().GetColor();
+ pColor[ 0x18 ] = rSett.GetHelpColor().GetColor();
+}
+
+sal_uInt32 OCX_Control::ImportColor(sal_uInt32 nColor) const
+{
+ sal_uInt8 nUpper = (sal_uInt8)( nColor >> 24 );
+ if (nUpper & 0x80) //Palette color, should be switch on bottom 24 bits
+ {
+ /*Might as well use my systems ones in the absence of any other ideas*/
+ nColor = nColor&0x00FFFFFF;
+ DBG_ASSERT (nColor <= 24,"Unknown Palette Index");
+ if (nColor > 24)
+ nColor = 0xFFFFFF;
+ else
+ nColor = pColor[nColor];
+ }
+ else
+ {
+ //Stored in bgr! rather than rgb
+ nColor = SwapColor(nColor);
+ }
+ return nColor;
+}
+
+sal_Int16 OCX_FontData::ImportAlign(sal_uInt8 _nJustification) const
+{
+ sal_Int16 nRet;
+ switch (_nJustification)
+ {
+ default:
+ case 1:
+ nRet = 0;
+ break;
+ case 2:
+ nRet = 2;
+ break;
+ case 3:
+ nRet = 1;
+ break;
+ }
+ return nRet;
+}
+
+sal_uInt8 OCX_FontData::ExportAlign(sal_Int16 nAlign) const
+{
+ sal_Int8 nRet;
+ switch (nAlign)
+ {
+ default:
+ case 0:
+ nRet = 1;
+ break;
+ case 2:
+ nRet = 2;
+ break;
+ case 1:
+ nRet = 3;
+ break;
+ }
+ return nRet;
+}
+
+sal_uInt32 OCX_Control::SwapColor(sal_uInt32 nColor) const
+{
+ sal_uInt8
+ r(static_cast<sal_uInt8>(nColor&0xFF)),
+ g(static_cast<sal_uInt8>(((nColor)>>8)&0xFF)),
+ b(static_cast<sal_uInt8>((nColor>>16)&0xFF));
+ nColor = (r<<16) + (g<<8) + b;
+ return nColor;
+}
+
+sal_uInt32 OCX_Control::ExportColor(sal_uInt32 nColor) const
+{
+ sal_uInt8 nUpper = (sal_uInt8)( nColor >> 24 );
+ if (nUpper & 0x80) //Palette color, should be switch on bottom 24 bits
+ {
+ /*Might as well use my systems ones in the absence of any other ideas*/
+ nColor = nColor&0x00FFFFFF;
+ DBG_ASSERT (nColor <= 24,"Unknown Palette Index");
+ if (nColor > 24)
+ nColor = 0xFFFFFF;
+ else
+ nColor = pColor[nColor];
+ }
+
+ //Stored in bgr! rather than rgb
+ nColor = SwapColor(nColor);
+ return nColor;
+}
+
+sal_Bool OCX_Control::Import(
+ const uno::Reference< lang::XMultiServiceFactory > &rServiceFactory,
+ uno::Reference< form::XFormComponent > &rFComp, awt::Size &rSz)
+{
+
+ if(msFormType.getLength() == 0)
+ return sal_False;
+
+ rSz.Width = nWidth;
+ rSz.Height = nHeight;
+
+ uno::Reference<uno::XInterface> xCreate =
+ rServiceFactory->createInstance(msFormType);
+ if (!xCreate.is())
+ return sal_False;
+
+ rFComp = uno::Reference<form::XFormComponent>(xCreate,uno::UNO_QUERY);
+ if (!rFComp.is())
+ return sal_False;
+ uno::Reference<beans::XPropertySet> xPropSet(xCreate,uno::UNO_QUERY);
+ if (!xPropSet.is())
+ return sal_False;
+ return Import(xPropSet);
+}
+
+sal_Bool OCX_Control::Import(uno::Reference<container::XNameContainer> &rDialog
+ )
+{
+ uno::Reference<lang::XMultiServiceFactory>
+ xFactory(rDialog, uno::UNO_QUERY);
+
+ uno::Reference<uno::XInterface> xCreate =
+ xFactory->createInstance(msDialogType);
+ if (!xCreate.is())
+ return sal_False;
+
+ uno::Reference<awt::XControlModel> xModel(xCreate, uno::UNO_QUERY);
+ if (!xModel.is())
+ return sal_False;
+
+ /* #147900# sometimes insertion of a control fails due to existing name,
+ do not break entire form import then... */
+ try
+ {
+ rDialog->insertByName(sName, uno::makeAny(xModel));
+ }
+ catch( uno::Exception& )
+ {
+ DBG_ERRORFILE(
+ ByteString( "OCX_Control::Import - cannot insert control \"" ).
+ Append( ByteString( sName, RTL_TEXTENCODING_UTF8 ) ).
+ Append( '"' ).GetBuffer() );
+ }
+
+ uno::Reference<beans::XPropertySet> xPropSet(xCreate, uno::UNO_QUERY);
+ if (!xPropSet.is())
+ return sal_False;
+
+ if (!Import(xPropSet))
+ return sal_False;
+
+ uno::Any aTmp;
+ aTmp <<= sal_Int32((mnLeft * 2) / 100);
+ xPropSet->setPropertyValue(WW8_ASCII2STR("PositionX"), aTmp);
+ aTmp <<= sal_Int32((mnTop * 2) / 100);
+ xPropSet->setPropertyValue(WW8_ASCII2STR("PositionY"), aTmp);
+ aTmp <<= sal_Int32((nWidth * 2) / 100);
+ xPropSet->setPropertyValue(WW8_ASCII2STR("Width"), aTmp);
+ aTmp <<= sal_Int32((nHeight * 2) / 100);
+ xPropSet->setPropertyValue(WW8_ASCII2STR("Height"), aTmp);
+ if ( msToolTip.Len() > 0 )
+ xPropSet->setPropertyValue(WW8_ASCII2STR("HelpText"), uno::Any(OUString(msToolTip)));
+
+ if ( mnStep )
+ {
+ aTmp <<= mnStep;
+ xPropSet->setPropertyValue(WW8_ASCII2STR("Step"), aTmp);
+ }
+
+ try
+ {
+ xPropSet->setPropertyValue(WW8_ASCII2STR("EnableVisible"), uno::makeAny( mbVisible ) );
+ }
+ catch( uno::Exception& )
+ {
+ }
+ return sal_True;
+}
+
+sal_Int16 OCX_Control::ImportBorder(sal_uInt16 nSpecialEffect,
+ sal_uInt16 nBorderStyle) const
+{
+ if ((nSpecialEffect == 0) && (nBorderStyle == 0))
+ return 0; //No Border
+ else if ((nSpecialEffect == 0) && (nBorderStyle == 1))
+ return 2; //Flat Border
+ return 1; //3D Border
+}
+
+sal_uInt8 OCX_Control::ExportBorder(sal_uInt16 nBorder,sal_uInt8 &rBorderStyle)
+ const
+{
+ sal_uInt8 nRet;
+ switch(nBorder)
+ {
+ case 0:
+ nRet = rBorderStyle = 0;
+ break;
+ default:
+ case 1:
+ nRet = 2;
+ rBorderStyle = 0;
+ break;
+ case 2:
+ nRet = 0;
+ rBorderStyle = 1;
+ break;
+ }
+ return nRet;
+}
+
+sal_Int16 OCX_Control::ImportSpecEffect( sal_uInt8 nSpecialEffect ) const
+{
+ return (nSpecialEffect == 0) ? 2 : 1;
+}
+
+sal_uInt8 OCX_Control::ExportSpecEffect( sal_Int16 nApiEffect ) const
+{
+ return (nApiEffect == 2) ? 0 : 2;
+}
+
+sal_Bool OCX_Control::ReadFontData(SvStorageStream *pS)
+{
+ return aFontData.Read(pS);
+}
+
+
+const uno::Reference< drawing::XDrawPage >&
+ SvxMSConvertOCXControls::GetDrawPage()
+{
+ if( !xDrawPage.is() && pDocSh )
+ {
+ uno::Reference< drawing::XDrawPageSupplier > xTxtDoc(pDocSh->GetModel(),
+ uno::UNO_QUERY);
+ DBG_ASSERT(xTxtDoc.is(),"XDrawPageSupplier nicht vom XModel erhalten");
+ xDrawPage = xTxtDoc->getDrawPage();
+ DBG_ASSERT( xDrawPage.is(), "XDrawPage nicht erhalten" );
+ }
+
+ return xDrawPage;
+}
+
+
+const uno::Reference< lang::XMultiServiceFactory >&
+ SvxMSConvertOCXControls::GetServiceFactory()
+{
+ if( !xServiceFactory.is() && pDocSh )
+ {
+ xServiceFactory = uno::Reference< lang::XMultiServiceFactory >
+ (pDocSh->GetBaseModel(), uno::UNO_QUERY);
+ DBG_ASSERT( xServiceFactory.is(),
+ "XMultiServiceFactory nicht vom Model erhalten" );
+ }
+
+ return xServiceFactory;
+}
+
+const uno::Reference< drawing::XShapes >& SvxMSConvertOCXControls::GetShapes()
+{
+ if( !xShapes.is() )
+ {
+ GetDrawPage();
+ if( xDrawPage.is() )
+ {
+
+ xShapes = uno::Reference< drawing::XShapes >(xDrawPage,
+ uno::UNO_QUERY);
+ DBG_ASSERT( xShapes.is(), "XShapes nicht vom XDrawPage erhalten" );
+ }
+ }
+ return xShapes;
+}
+
+const uno::Reference< container::XIndexContainer >&
+ SvxMSConvertOCXControls::GetFormComps()
+{
+ if( !xFormComps.is() )
+ {
+ GetDrawPage();
+ if( xDrawPage.is() )
+ {
+ uno::Reference< form::XFormsSupplier > xFormsSupplier( xDrawPage,
+ uno::UNO_QUERY );
+ DBG_ASSERT( xFormsSupplier.is(),
+ "XFormsSupplier nicht vom XDrawPage erhalten" );
+
+ uno::Reference< container::XNameContainer > xNameCont =
+ xFormsSupplier->getForms();
+
+ // Das Formular bekommt einen Namen wie "WW-Standard[n]" und
+ // wird in jedem Fall neu angelegt.
+ UniString sName( sWW8_form, RTL_TEXTENCODING_MS_1252 );
+ sal_uInt16 n = 0;
+
+ while( xNameCont->hasByName( sName ) )
+ {
+ sName.AssignAscii( sWW8_form );
+ sName += String::CreateFromInt32( ++n );
+ }
+
+ const uno::Reference< lang::XMultiServiceFactory > &rServiceFactory
+ = GetServiceFactory();
+ if( !rServiceFactory.is() )
+ return xFormComps;
+
+ uno::Reference< uno::XInterface > xCreate =
+ rServiceFactory->createInstance(WW8_ASCII2STR(
+ "com.sun.star.form.component.Form"));
+ if( xCreate.is() )
+ {
+ uno::Reference< beans::XPropertySet > xFormPropSet( xCreate,
+ uno::UNO_QUERY );
+
+ uno::Any aTmp(&sName,getCppuType((OUString *)0));
+ xFormPropSet->setPropertyValue( WW8_ASCII2STR("Name"), aTmp );
+
+ uno::Reference< form::XForm > xForm( xCreate, uno::UNO_QUERY );
+ DBG_ASSERT(xForm.is(), "keine Form?");
+
+ uno::Reference< container::XIndexContainer > xForms( xNameCont,
+ uno::UNO_QUERY );
+ DBG_ASSERT( xForms.is(), "XForms nicht erhalten" );
+
+ aTmp.setValue( &xForm,
+ ::getCppuType((uno::Reference < form::XForm >*)0));
+ xForms->insertByIndex( xForms->getCount(), aTmp );
+
+ xFormComps = uno::Reference< container::XIndexContainer >
+ (xCreate, uno::UNO_QUERY);
+ }
+ }
+ }
+
+ return xFormComps;
+}
+
+sal_Bool OCX_CommandButton::Import( com::sun::star::uno::Reference<
+ com::sun::star::beans::XPropertySet> &rPropSet)
+{
+ uno::Any aTmp(&sName,getCppuType((OUString *)0));
+ rPropSet->setPropertyValue( WW8_ASCII2STR("Name"), aTmp );
+
+ aTmp <<= ImportColor(mnForeColor);
+ rPropSet->setPropertyValue( WW8_ASCII2STR("TextColor"), aTmp);
+
+ // fake transparent push button by setting window background color
+ if( !fBackStyle )
+ mnBackColor = 0x80000005;
+ aTmp <<= ImportColor(mnBackColor);
+ rPropSet->setPropertyValue( WW8_ASCII2STR("BackgroundColor"), aTmp);
+
+ sal_Bool bTemp;
+ if ((!(fEnabled)) || (fLocked))
+ bTemp = sal_False;
+ else
+ bTemp = sal_True;
+ aTmp = bool2any(bTemp);
+
+ rPropSet->setPropertyValue( WW8_ASCII2STR("Enabled"), aTmp);
+
+ bTemp = fWordWrap != 0;
+ aTmp = bool2any(bTemp);
+ rPropSet->setPropertyValue( WW8_ASCII2STR("MultiLine"), aTmp);
+
+ if (pCaption)
+ {
+ aTmp <<= lclCreateOUString( pCaption, nCaptionLen );
+ rPropSet->setPropertyValue( WW8_ASCII2STR("Label"), aTmp);
+ }
+
+ aTmp = bool2any( mbTakeFocus );
+ rPropSet->setPropertyValue( WW8_ASCII2STR( "FocusOnClick" ), aTmp );
+
+ aFontData.Import(rPropSet);
+ return sal_True;
+}
+
+sal_Bool OCX_GroupBox::Export(SvStorageRef& /* rObj */,
+ const uno::Reference< beans::XPropertySet >& /* rPropSet */,
+ const awt::Size& /* rSize */ )
+{
+ sal_Bool bRet=sal_True;
+ return bRet;
+}
+
+sal_Bool OCX_GroupBox::WriteContents(SvStorageStreamRef& /* rObj */,
+ const uno::Reference< beans::XPropertySet >& /* rPropSet */,
+ const awt::Size& /* rSize */)
+{
+ sal_Bool bRet=sal_True;
+ return bRet;
+}
+
+sal_Bool OCX_CommandButton::WriteContents(SvStorageStreamRef& rContents,
+ const uno::Reference< beans::XPropertySet >& rPropSet,
+ const awt::Size& rSize )
+{
+ sal_Bool bRet=sal_True;
+
+ sal_uInt32 nOldPos = rContents->Tell();
+ rContents->SeekRel(8);
+
+ uno::Any aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("TextColor"));
+ if (aTmp.hasValue())
+ aTmp >>= mnForeColor;
+ *rContents << ExportColor(mnForeColor);
+
+ aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("BackgroundColor"));
+ if (aTmp.hasValue())
+ aTmp >>= mnBackColor;
+ *rContents << ExportColor(mnBackColor);
+
+ aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("Enabled"));
+ fEnabled = any2bool(aTmp);
+ sal_uInt8 nTemp=0;//fEnabled;
+ if (fEnabled)
+ nTemp |= 0x02;
+ if (fBackStyle)
+ nTemp |= 0x08;
+ *rContents << nTemp;
+ *rContents << sal_uInt8(0x00);
+
+ nTemp = 0;
+ aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("MultiLine"));
+ fWordWrap = any2bool(aTmp);
+ if (fWordWrap)
+ nTemp |= 0x80;
+ *rContents << nTemp;
+ *rContents << sal_uInt8(0x00);
+
+ SvxOcxString aCaption( rPropSet->getPropertyValue(WW8_ASCII2STR("Label")) );
+ aCaption.WriteLenField( *rContents );
+ aCaption.WriteCharArray( *rContents );
+
+ WriteAlign(rContents,4);
+
+ *rContents << rSize.Width;
+ *rContents << rSize.Height;
+
+ // "take focus on click" is directly in content flags, not in option field...
+ mbTakeFocus = any2bool( rPropSet->getPropertyValue( WW8_ASCII2STR( "FocusOnClick" ) ) );
+
+ nFixedAreaLen = static_cast<sal_uInt16>(rContents->Tell()-nOldPos-4);
+
+ bRet = aFontData.Export(rContents,rPropSet);
+
+ rContents->Seek(nOldPos);
+ *rContents << nStandardId;
+ *rContents << nFixedAreaLen;
+
+ sal_uInt8 nTmp = 0x27;
+ if (aCaption.HasData())
+ nTmp |= 0x08;
+ *rContents << nTmp;
+ nTmp = 0x00;
+ if( !mbTakeFocus ) // flag is set, if option is off
+ nTmp |= 0x02;
+ *rContents << nTmp;
+ *rContents << sal_uInt8(0x00);
+ *rContents << sal_uInt8(0x00);
+
+ DBG_ASSERT((rContents.Is() && (SVSTREAM_OK==rContents->GetError())),"damn");
+ return bRet;
+}
+
+
+
+sal_Bool OCX_CommandButton::Export(SvStorageRef &rObj,
+ const uno::Reference< beans::XPropertySet > &rPropSet,
+ const awt::Size &rSize)
+{
+ static sal_uInt8 __READONLY_DATA aCompObj[] = {
+ 0x01, 0x00, 0xFE, 0xFF, 0x03, 0x0A, 0x00, 0x00,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0x40, 0x32, 0x05, 0xD7,
+ 0x69, 0xCE, 0xCD, 0x11, 0xA7, 0x77, 0x00, 0xDD,
+ 0x01, 0x14, 0x3C, 0x57, 0x22, 0x00, 0x00, 0x00,
+ 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66,
+ 0x74, 0x20, 0x46, 0x6F, 0x72, 0x6d, 0x73, 0x20,
+ 0x32, 0x2e, 0x30, 0x20, 0x43, 0x6F, 0x6D, 0x6D,
+ 0x61, 0x6E, 0x64, 0x42, 0x75, 0x74, 0x74, 0x6F,
+ 0x6E, 0x00, 0x10, 0x00, 0x00, 0x00, 0x45, 0x6D,
+ 0x62, 0x65, 0x64, 0x64, 0x65, 0x64, 0x20, 0x4F,
+ 0x62, 0x6A, 0x65, 0x63, 0x74, 0x00, 0x16, 0x00,
+ 0x00, 0x00, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x2E,
+ 0x43, 0x6F, 0x6D, 0x6D, 0x61, 0x6E, 0x64, 0x42,
+ 0x75, 0x74, 0x74, 0x6F, 0x6E, 0x2E, 0x31, 0x00,
+ 0xF4, 0x39, 0xB2, 0x71, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+
+ {
+ SvStorageStreamRef xStor( rObj->OpenSotStream( C2S("\1CompObj")));
+ xStor->Write(aCompObj,sizeof(aCompObj));
+ DBG_ASSERT((xStor.Is() && (SVSTREAM_OK == xStor->GetError())),"damn");
+ }
+
+ {
+ SvStorageStreamRef xStor3( rObj->OpenSotStream( C2S("\3ObjInfo")));
+ xStor3->Write(aObjInfo,sizeof(aObjInfo));
+ DBG_ASSERT((xStor3.Is() && (SVSTREAM_OK == xStor3->GetError())),"damn");
+ }
+
+ static sal_uInt8 __READONLY_DATA aOCXNAME[] = {
+ 0x43, 0x00, 0x6F, 0x00, 0x6D, 0x00, 0x6D, 0x00,
+ 0x61, 0x00, 0x6E, 0x00, 0x64, 0x00, 0x42, 0x00,
+ 0x75, 0x00, 0x74, 0x00, 0x74, 0x00, 0x6F, 0x00,
+ 0x6E, 0x00, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+
+ {
+ SvStorageStreamRef xStor2( rObj->OpenSotStream( C2S("\3OCXNAME")));
+ xStor2->Write(aOCXNAME,sizeof(aOCXNAME));
+ DBG_ASSERT((xStor2.Is() && (SVSTREAM_OK == xStor2->GetError())),"damn");
+ }
+
+ SvStorageStreamRef xContents( rObj->OpenSotStream( C2S("contents")));
+
+ return WriteContents(xContents,rPropSet,rSize);
+}
+
+sal_Bool OCX_ImageButton::WriteContents(SvStorageStreamRef &rContents,
+ const uno::Reference< beans::XPropertySet > &rPropSet,
+ const awt::Size &rSize)
+{
+ sal_Bool bRet=sal_True;
+
+ sal_uInt32 nOldPos = rContents->Tell();
+ rContents->SeekRel(8);
+
+ uno::Any aTmp=rPropSet->getPropertyValue(WW8_ASCII2STR("BackgroundColor"));
+ if (aTmp.hasValue())
+ aTmp >>= mnBackColor;
+ *rContents << ExportColor(mnBackColor);
+
+ aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("Enabled"));
+ fEnabled = any2bool(aTmp);
+ sal_uInt8 nTemp=0;//fEnabled;
+ if (fEnabled)
+ nTemp |= 0x02;
+ *rContents << nTemp;
+ *rContents << sal_uInt8(0x00);
+ *rContents << sal_uInt8(0x00);
+ *rContents << sal_uInt8(0x00);
+
+ WriteAlign(rContents,4);
+
+ *rContents << rSize.Width;
+ *rContents << rSize.Height;
+
+ nFixedAreaLen = static_cast<sal_uInt16>(rContents->Tell()-nOldPos-4);
+
+ bRet = aFontData.Export(rContents,rPropSet);
+
+ rContents->Seek(nOldPos);
+ *rContents << nStandardId;
+ *rContents << nFixedAreaLen;
+
+ sal_uInt8 nTmp = 0x26;
+ *rContents << nTmp;
+ *rContents << sal_uInt8(0x00);
+ *rContents << sal_uInt8(0x00);
+ *rContents << sal_uInt8(0x00);
+
+ DBG_ASSERT((rContents.Is() && (SVSTREAM_OK==rContents->GetError())),"damn");
+ return bRet;
+}
+
+
+
+sal_Bool OCX_ImageButton::Export(SvStorageRef &rObj,
+ const uno::Reference< beans::XPropertySet > &rPropSet,
+ const awt::Size &rSize)
+{
+ static sal_uInt8 __READONLY_DATA aCompObj[] = {
+ 0x01, 0x00, 0xFE, 0xFF, 0x03, 0x0A, 0x00, 0x00,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0x40, 0x32, 0x05, 0xD7,
+ 0x69, 0xCE, 0xCD, 0x11, 0xA7, 0x77, 0x00, 0xDD,
+ 0x01, 0x14, 0x3C, 0x57, 0x22, 0x00, 0x00, 0x00,
+ 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66,
+ 0x74, 0x20, 0x46, 0x6F, 0x72, 0x6d, 0x73, 0x20,
+ 0x32, 0x2e, 0x30, 0x20, 0x43, 0x6F, 0x6D, 0x6D,
+ 0x61, 0x6E, 0x64, 0x42, 0x75, 0x74, 0x74, 0x6F,
+ 0x6E, 0x00, 0x10, 0x00, 0x00, 0x00, 0x45, 0x6D,
+ 0x62, 0x65, 0x64, 0x64, 0x65, 0x64, 0x20, 0x4F,
+ 0x62, 0x6A, 0x65, 0x63, 0x74, 0x00, 0x16, 0x00,
+ 0x00, 0x00, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x2E,
+ 0x43, 0x6F, 0x6D, 0x6D, 0x61, 0x6E, 0x64, 0x42,
+ 0x75, 0x74, 0x74, 0x6F, 0x6E, 0x2E, 0x31, 0x00,
+ 0xF4, 0x39, 0xB2, 0x71, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+
+ {
+ SvStorageStreamRef xStor( rObj->OpenSotStream( C2S("\1CompObj")));
+ xStor->Write(aCompObj,sizeof(aCompObj));
+ DBG_ASSERT((xStor.Is() && (SVSTREAM_OK == xStor->GetError())),"damn");
+ }
+
+ {
+ SvStorageStreamRef xStor3( rObj->OpenSotStream( C2S("\3ObjInfo")));
+ xStor3->Write(aObjInfo,sizeof(aObjInfo));
+ DBG_ASSERT((xStor3.Is() && (SVSTREAM_OK == xStor3->GetError())),"damn");
+ }
+
+ static sal_uInt8 __READONLY_DATA aOCXNAME[] = {
+ 0x43, 0x00, 0x6F, 0x00, 0x6D, 0x00, 0x6D, 0x00,
+ 0x61, 0x00, 0x6E, 0x00, 0x64, 0x00, 0x42, 0x00,
+ 0x75, 0x00, 0x74, 0x00, 0x74, 0x00, 0x6F, 0x00,
+ 0x6E, 0x00, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+
+ {
+ SvStorageStreamRef xStor2( rObj->OpenSotStream( C2S("\3OCXNAME")));
+ xStor2->Write(aOCXNAME,sizeof(aOCXNAME));
+ DBG_ASSERT((xStor2.Is() && (SVSTREAM_OK == xStor2->GetError())),"damn");
+ }
+
+ SvStorageStreamRef xContents( rObj->OpenSotStream( C2S("contents")));
+ return WriteContents(xContents,rPropSet,rSize);
+}
+
+
+sal_Bool OCX_OptionButton::Import(com::sun::star::uno::Reference<
+ com::sun::star::beans::XPropertySet> &rPropSet)
+{
+ uno::Any aTmp(&sName,getCppuType((OUString *)0));
+ rPropSet->setPropertyValue( WW8_ASCII2STR("Name"), aTmp );
+
+ // background color: fBackStyle==0 -> transparent
+ if( fBackStyle )
+ aTmp <<= ImportColor(mnBackColor);
+ else
+ aTmp = uno::Any();
+ rPropSet->setPropertyValue( WW8_ASCII2STR("BackgroundColor"), aTmp);
+
+ sal_Bool bTemp;
+ if ((!(fEnabled)) || (fLocked))
+ bTemp = sal_False;
+ else
+ bTemp = sal_True;
+ aTmp = bool2any(bTemp);
+ rPropSet->setPropertyValue( WW8_ASCII2STR("Enabled"), aTmp);
+
+ bTemp = fWordWrap != 0;
+ aTmp = bool2any(bTemp);
+ rPropSet->setPropertyValue( WW8_ASCII2STR("MultiLine"), aTmp);
+
+ aTmp <<= ImportColor(mnForeColor);
+ rPropSet->setPropertyValue( WW8_ASCII2STR("TextColor"), aTmp);
+
+ aTmp <<= ImportSpecEffect( nSpecialEffect );
+ rPropSet->setPropertyValue( WW8_ASCII2STR("VisualEffect"), aTmp);
+
+ if (pValue && !bSetInDialog)
+ {
+ INT16 nTmp = pValue[0]-0x30;
+ aTmp <<= nTmp;
+ rPropSet->setPropertyValue( WW8_ASCII2STR("DefaultState"), aTmp);
+ }
+
+ if (pCaption)
+ {
+ aTmp <<= lclCreateOUString( pCaption, nCaptionLen );
+ rPropSet->setPropertyValue( WW8_ASCII2STR("Label"), aTmp);
+ }
+
+ // #i40279# always centered vertically
+ aTmp <<= ::com::sun::star::style::VerticalAlignment_MIDDLE;
+ rPropSet->setPropertyValue( WW8_ASCII2STR("VerticalAlign"), aTmp );
+
+ aFontData.Import(rPropSet);
+ return sal_True;
+}
+
+sal_Bool OCX_OptionButton::WriteContents(SvStorageStreamRef &rContents,
+ const uno::Reference< beans::XPropertySet > &rPropSet,
+ const awt::Size &rSize)
+{
+ sal_Bool bRet=sal_True;
+
+ sal_uInt32 nOldPos = rContents->Tell();
+ rContents->SeekRel(12);
+
+ pBlockFlags[0] = 0;
+ pBlockFlags[1] = 0x01;
+ pBlockFlags[2] = 0;
+ pBlockFlags[3] = 0x80;
+ pBlockFlags[4] = 0;
+ pBlockFlags[5] = 0;
+ pBlockFlags[6] = 0;
+ pBlockFlags[7] = 0;
+
+ uno::Any aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("Enabled"));
+ fEnabled = any2bool(aTmp);
+
+ aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("BackgroundColor"));
+ if (aTmp.hasValue())
+ aTmp >>= mnBackColor;
+ else
+ fBackStyle = 0;
+
+ sal_uInt8 nTemp=0;//=fEnabled;
+ if (fEnabled)
+ nTemp |= 0x02;
+ if (fBackStyle)
+ nTemp |= 0x08;
+ *rContents << nTemp;
+ pBlockFlags[0] |= 0x01;
+ *rContents << sal_uInt8(0x00);
+ nTemp = 0;
+ aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("MultiLine"));
+ fWordWrap = any2bool(aTmp);
+ if (fWordWrap)
+ nTemp |= 0x80;
+ *rContents << nTemp;
+ *rContents << sal_uInt8(0x00);
+
+ *rContents << ExportColor(mnBackColor);
+ pBlockFlags[0] |= 0x02;
+
+ aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("TextColor"));
+ if (aTmp.hasValue())
+ aTmp >>= mnForeColor;
+ *rContents << ExportColor(mnForeColor);
+ pBlockFlags[0] |= 0x04;
+
+ nStyle = 5;
+ *rContents << nStyle;
+ pBlockFlags[0] |= 0x40;
+
+ WriteAlign(rContents,4);
+ nValueLen = 1|SVX_MSOCX_COMPRESSED;
+ aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("DefaultState"));
+ sal_Int16 nDefault = sal_Int16();
+ aTmp >>= nDefault;
+ *rContents << nValueLen;
+ pBlockFlags[2] |= 0x40;
+
+
+ SvxOcxString aCaption( rPropSet->getPropertyValue(WW8_ASCII2STR("Label")) );
+ if (aCaption.HasData())
+ pBlockFlags[2] |= 0x80;
+ aCaption.WriteLenField( *rContents );
+
+ aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("VisualEffect"));
+ if (aTmp.hasValue())
+ {
+ sal_Int16 nApiSpecEffect = sal_Int16();
+ aTmp >>= nApiSpecEffect;
+ nSpecialEffect = ExportSpecEffect( nApiSpecEffect );
+ }
+ *rContents << nSpecialEffect;
+ pBlockFlags[3] |= 0x04;
+
+ WriteAlign(rContents,4);
+ *rContents << rSize.Width;
+ *rContents << rSize.Height;
+
+ nDefault += 0x30;
+ *rContents << sal_uInt8(nDefault);
+ *rContents << sal_uInt8(0x00);
+
+ aCaption.WriteCharArray( *rContents );
+
+ WriteAlign(rContents,4);
+ nFixedAreaLen = static_cast<sal_uInt16>(rContents->Tell()-nOldPos-4);
+ bRet = aFontData.Export(rContents,rPropSet);
+
+ rContents->Seek(nOldPos);
+ *rContents << nStandardId;
+ *rContents << nFixedAreaLen;
+
+ *rContents << pBlockFlags[0];
+ *rContents << pBlockFlags[1];
+ *rContents << pBlockFlags[2];
+ *rContents << pBlockFlags[3];
+ *rContents << pBlockFlags[4];
+ *rContents << pBlockFlags[5];
+ *rContents << pBlockFlags[6];
+ *rContents << pBlockFlags[7];
+
+ DBG_ASSERT((rContents.Is() &&
+ (SVSTREAM_OK==rContents->GetError())),"damn");
+ return bRet;
+}
+
+
+
+sal_Bool OCX_OptionButton::Export(SvStorageRef &rObj,
+ const uno::Reference< beans::XPropertySet > &rPropSet,
+ const awt::Size &rSize)
+{
+ static sal_uInt8 __READONLY_DATA aCompObj[] = {
+ 0x01, 0x00, 0xFE, 0xFF, 0x03, 0x0A, 0x00, 0x00,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0x50, 0x1D, 0xD2, 0x8B,
+ 0x42, 0xEC, 0xCE, 0x11, 0x9E, 0x0D, 0x00, 0xAA,
+ 0x00, 0x60, 0x02, 0xF3, 0x21, 0x00, 0x00, 0x00,
+ 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66,
+ 0x74, 0x20, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x20,
+ 0x32, 0x2E, 0x30, 0x20, 0x4F, 0x70, 0x74, 0x69,
+ 0x6F, 0x6E, 0x42, 0x75, 0x74, 0x74, 0x6F, 0x6E,
+ 0x00, 0x10, 0x00, 0x00, 0x00, 0x45, 0x6D, 0x62,
+ 0x65, 0x64, 0x64, 0x65, 0x64, 0x20, 0x4F, 0x62,
+ 0x6A, 0x65, 0x63, 0x74, 0x00, 0x15, 0x00, 0x00,
+ 0x00, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x2E, 0x4F,
+ 0x70, 0x74, 0x69, 0x6F, 0x6E, 0x42, 0x75, 0x74,
+ 0x74, 0x6F, 0x6E, 0x2E, 0x31, 0x00, 0xF4, 0x39,
+ 0xB2, 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+
+ {
+ SvStorageStreamRef xStor( rObj->OpenSotStream( C2S("\1CompObj")));
+ xStor->Write(aCompObj,sizeof(aCompObj));
+ DBG_ASSERT((xStor.Is() && (SVSTREAM_OK == xStor->GetError())),"damn");
+ }
+
+ {
+ SvStorageStreamRef xStor3( rObj->OpenSotStream( C2S("\3ObjInfo")));
+ xStor3->Write(aObjInfo,sizeof(aObjInfo));
+ DBG_ASSERT((xStor3.Is() && (SVSTREAM_OK == xStor3->GetError())),"damn");
+ }
+
+ static sal_uInt8 __READONLY_DATA aOCXNAME[] = {
+ 0x4F, 0x00, 0x70, 0x00, 0x74, 0x00, 0x69, 0x00,
+ 0x6F, 0x00, 0x6E, 0x00, 0x42, 0x00, 0x75, 0x00,
+ 0x74, 0x00, 0x74, 0x00, 0x6F, 0x00, 0x6E, 0x00,
+ 0x31, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+
+ {
+ SvStorageStreamRef xStor2( rObj->OpenSotStream( C2S("\3OCXNAME")));
+ xStor2->Write(aOCXNAME,sizeof(aOCXNAME));
+ DBG_ASSERT((xStor2.Is() && (SVSTREAM_OK == xStor2->GetError())),"damn");
+ }
+
+ SvStorageStreamRef xContents( rObj->OpenSotStream( C2S("contents")));
+ return WriteContents(xContents, rPropSet, rSize);
+}
+
+
+sal_Bool OCX_TextBox::Import(com::sun::star::uno::Reference<
+ com::sun::star::beans::XPropertySet> &rPropSet)
+{
+ uno::Any aTmp(&sName,getCppuType((OUString *)0));
+ rPropSet->setPropertyValue( WW8_ASCII2STR("Name"), aTmp );
+
+ aTmp = bool2any( fEnabled != 0 );
+ rPropSet->setPropertyValue( WW8_ASCII2STR("Enabled"), aTmp);
+
+ aTmp = bool2any( fLocked != 0 );
+ rPropSet->setPropertyValue( WW8_ASCII2STR("ReadOnly"), aTmp);
+
+ aTmp = bool2any( fHideSelection != 0 );
+ rPropSet->setPropertyValue( WW8_ASCII2STR( "HideInactiveSelection" ), aTmp);
+
+ aTmp <<= ImportColor(mnForeColor);
+ rPropSet->setPropertyValue( WW8_ASCII2STR("TextColor"), aTmp);
+
+ aTmp <<= ImportColor(mnBackColor);
+ rPropSet->setPropertyValue( WW8_ASCII2STR("BackgroundColor"), aTmp);
+
+ aTmp <<= ImportBorder(nSpecialEffect,nBorderStyle);
+ rPropSet->setPropertyValue( WW8_ASCII2STR("Border"), aTmp);
+
+ aTmp <<= ImportColor( nBorderColor );
+ rPropSet->setPropertyValue( WW8_ASCII2STR("BorderColor"), aTmp);
+
+ aTmp = bool2any( fMultiLine != 0 );
+ rPropSet->setPropertyValue( WW8_ASCII2STR("MultiLine"), aTmp);
+
+ sal_uInt16 nTmp = static_cast<sal_uInt16>(nMaxLength);
+ aTmp <<= nTmp;
+ rPropSet->setPropertyValue( WW8_ASCII2STR("MaxTextLen"), aTmp);
+
+
+ sal_Bool bTemp1,bTemp2;
+ uno::Any aBarsH,aBarsV;
+ switch(nScrollBars)
+ {
+ case 1:
+ bTemp1 = sal_True;
+ bTemp2 = sal_False;
+ break;
+ case 2:
+ bTemp1 = sal_False;
+ bTemp2 = sal_True;
+ break;
+ case 3:
+ bTemp1 = sal_True;
+ bTemp2 = sal_True;
+ break;
+ case 0:
+ default:
+ bTemp1 = sal_False;
+ bTemp2 = sal_False;
+ break;
+ }
+
+ aBarsH = bool2any(bTemp1);
+ aBarsV = bool2any(bTemp2);
+ rPropSet->setPropertyValue( WW8_ASCII2STR("HScroll"), aBarsH);
+ rPropSet->setPropertyValue( WW8_ASCII2STR("VScroll"), aBarsV);
+
+ nTmp = nPasswordChar;
+ aTmp <<= nTmp;
+ rPropSet->setPropertyValue( WW8_ASCII2STR("EchoChar"), aTmp);
+
+ if (pValue)
+ {
+ aTmp <<= lclCreateOUString( pValue, nValueLen );
+ // DefaultText seems to no longer be in UnoEditControlModel
+ if ( bSetInDialog )
+ {
+ rPropSet->setPropertyValue( WW8_ASCII2STR("Text"), aTmp);
+ }
+ else
+ {
+ rPropSet->setPropertyValue( WW8_ASCII2STR("DefaultText"), aTmp);
+ }
+ }
+
+ aFontData.Import(rPropSet);
+ return sal_True;
+}
+
+sal_Bool OCX_TextBox::WriteContents(SvStorageStreamRef &rContents,
+ const uno::Reference< beans::XPropertySet > &rPropSet,
+ const awt::Size &rSize)
+{
+ sal_Bool bRet=sal_True;
+ sal_uInt32 nOldPos = rContents->Tell();
+ rContents->SeekRel(12);
+
+ pBlockFlags[0] = 0;
+ pBlockFlags[1] = 0x01;
+ pBlockFlags[2] = 0x00;
+ pBlockFlags[3] = 0x80;
+ pBlockFlags[4] = 0;
+ pBlockFlags[5] = 0;
+ pBlockFlags[6] = 0;
+ pBlockFlags[7] = 0;
+
+
+ sal_uInt8 nTemp=0x19;
+ uno::Any aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("Enabled"));
+ fEnabled = any2bool(aTmp);
+ if (fEnabled)
+ nTemp |= 0x02;
+
+ aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("ReadOnly"));
+ fLocked = any2bool(aTmp);
+ if (fLocked)
+ nTemp |= 0x04;
+
+ *rContents << nTemp;
+ pBlockFlags[0] |= 0x01;
+ *rContents << sal_uInt8(0x48);
+ *rContents << sal_uInt8(0x80);
+
+ fMultiLine = any2bool(rPropSet->getPropertyValue(WW8_ASCII2STR("MultiLine")));
+ fHideSelection = any2bool(rPropSet->getPropertyValue(WW8_ASCII2STR("HideInactiveSelection")));
+ nTemp = 0x0C;
+ if (fMultiLine)
+ nTemp |= 0x80;
+ if( fHideSelection )
+ nTemp |= 0x20;
+ *rContents << nTemp;
+
+ aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("BackgroundColor"));
+ if (aTmp.hasValue())
+ aTmp >>= mnBackColor;
+ *rContents << ExportColor(mnBackColor);
+ pBlockFlags[0] |= 0x02;
+
+ aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("TextColor"));
+ if (aTmp.hasValue())
+ aTmp >>= mnForeColor;
+ *rContents << ExportColor(mnForeColor);
+ pBlockFlags[0] |= 0x04;
+
+ aTmp = rPropSet->getPropertyValue( WW8_ASCII2STR("MaxTextLen"));
+ aTmp >>= nMaxLength;
+ *rContents << nMaxLength;
+ pBlockFlags[0] |= 0x08;
+
+ aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("Border"));
+ sal_Int16 nBorder = sal_Int16();
+ aTmp >>= nBorder;
+ nSpecialEffect = ExportBorder(nBorder,nBorderStyle);
+ *rContents << nBorderStyle;
+ pBlockFlags[0] |= 0x10;
+
+ aTmp = rPropSet->getPropertyValue( WW8_ASCII2STR("HScroll"));
+ sal_Bool bTemp1 = any2bool(aTmp);
+ aTmp = rPropSet->getPropertyValue( WW8_ASCII2STR("VScroll"));
+ sal_Bool bTemp2 = any2bool(aTmp);
+ if (!bTemp1 && !bTemp2)
+ nScrollBars =0;
+ else if (bTemp1 && bTemp2)
+ nScrollBars = 3;
+ else if (!bTemp1 && bTemp2)
+ nScrollBars = 2;
+ else
+ nScrollBars = 1;
+ *rContents << nScrollBars;
+ pBlockFlags[0] |= 0x20;
+
+ aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("EchoChar"));
+ sal_uInt16 nTmp = sal_uInt16();
+ aTmp >>= nTmp;
+ nPasswordChar = static_cast<sal_uInt8>(nTmp);
+ *rContents << nPasswordChar;
+ pBlockFlags[1] |= 0x02;
+
+ SvxOcxString aValue( rPropSet->getPropertyValue(WW8_ASCII2STR("DefaultText")) );
+ aValue.WriteLenField( *rContents );
+ if (aValue.HasData())
+ pBlockFlags[2] |= 0x40;
+
+ WriteAlign(rContents,4);
+ aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("BorderColor"));
+ if (aTmp.hasValue())
+ aTmp >>= nBorderColor;
+ *rContents << ExportColor(nBorderColor);
+ pBlockFlags[3] |= 0x02;
+
+ *rContents << nSpecialEffect;
+ pBlockFlags[3] |= 0x04;
+
+ WriteAlign(rContents,4);
+ *rContents << rSize.Width;
+ *rContents << rSize.Height;
+
+ aValue.WriteCharArray( *rContents );
+
+ WriteAlign(rContents,4);
+
+ nFixedAreaLen = static_cast<sal_uInt16>(rContents->Tell()-nOldPos-4);
+
+ bRet = aFontData.Export(rContents,rPropSet);
+
+ rContents->Seek(nOldPos);
+ *rContents << nStandardId;
+ *rContents << nFixedAreaLen;
+
+ *rContents << pBlockFlags[0];
+ *rContents << pBlockFlags[1];
+ *rContents << pBlockFlags[2];
+ *rContents << pBlockFlags[3];
+ *rContents << pBlockFlags[4];
+ *rContents << pBlockFlags[5];
+ *rContents << pBlockFlags[6];
+ *rContents << pBlockFlags[7];
+
+ DBG_ASSERT((rContents.Is() &&
+ (SVSTREAM_OK == rContents->GetError())),"damn");
+ return bRet;
+}
+
+
+sal_Bool OCX_TextBox::Export(SvStorageRef &rObj,
+ const uno::Reference< beans::XPropertySet > &rPropSet,
+ const awt::Size &rSize)
+{
+ static sal_uInt8 __READONLY_DATA aCompObj[] = {
+ 0x01, 0x00, 0xFE, 0xFF, 0x03, 0x0A, 0x00, 0x00,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0x10, 0x1D, 0xD2, 0x8B,
+ 0x42, 0xEC, 0xCE, 0x11, 0x9E, 0x0D, 0x00, 0xAA,
+ 0x00, 0x60, 0x02, 0xF3, 0x1C, 0x00, 0x00, 0x00,
+ 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66,
+ 0x74, 0x20, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x20,
+ 0x32, 0x2E, 0x30, 0x20, 0x54, 0x65, 0x78, 0x74,
+ 0x42, 0x6F, 0x78, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x45, 0x6D, 0x62, 0x65, 0x64, 0x64, 0x65, 0x64,
+ 0x20, 0x4F, 0x62, 0x6A, 0x65, 0x63, 0x74, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x46, 0x6F, 0x72, 0x6D,
+ 0x73, 0x2E, 0x54, 0x65, 0x78, 0x74, 0x42, 0x6F,
+ 0x78, 0x2E, 0x31, 0x00, 0xF4, 0x39, 0xB2, 0x71,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00
+ };
+
+ {
+ SvStorageStreamRef xStor( rObj->OpenSotStream( C2S("\1CompObj")));
+ xStor->Write(aCompObj,sizeof(aCompObj));
+ DBG_ASSERT((xStor.Is() && (SVSTREAM_OK == xStor->GetError())),"damn");
+ }
+
+ {
+ SvStorageStreamRef xStor3( rObj->OpenSotStream( C2S("\3ObjInfo")));
+ xStor3->Write(aObjInfo,sizeof(aObjInfo));
+ DBG_ASSERT((xStor3.Is() && (SVSTREAM_OK == xStor3->GetError())),"damn");
+ }
+
+ static sal_uInt8 __READONLY_DATA aOCXNAME[] = {
+ 0x54, 0x00, 0x65, 0x00, 0x78, 0x00, 0x74, 0x00,
+ 0x42, 0x00, 0x6F, 0x00, 0x78, 0x00, 0x31, 0x00,
+ 0x00, 0x00, 0x00, 0x00
+ };
+
+ {
+ SvStorageStreamRef xStor2( rObj->OpenSotStream( C2S("\3OCXNAME")));
+ xStor2->Write(aOCXNAME,sizeof(aOCXNAME));
+ DBG_ASSERT((xStor2.Is() && (SVSTREAM_OK == xStor2->GetError())),"damn");
+ }
+
+ SvStorageStreamRef xContents( rObj->OpenSotStream( C2S("contents")));
+ return WriteContents(xContents, rPropSet, rSize);
+}
+
+sal_Bool OCX_FieldControl::WriteContents(SvStorageStreamRef &rContents,
+ const uno::Reference< beans::XPropertySet > &rPropSet,
+ const awt::Size &rSize)
+{
+ sal_Bool bRet=sal_True;
+ sal_uInt32 nOldPos = rContents->Tell();
+ rContents->SeekRel(12);
+
+ pBlockFlags[0] = 0;
+ pBlockFlags[1] = 0x01;
+ pBlockFlags[2] = 0x00;
+ pBlockFlags[3] = 0x80;
+ pBlockFlags[4] = 0;
+ pBlockFlags[5] = 0;
+ pBlockFlags[6] = 0;
+ pBlockFlags[7] = 0;
+
+
+ sal_uInt8 nTemp=0x19;
+ uno::Any aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("Enabled"));
+ fEnabled = any2bool(aTmp);
+ if (fEnabled)
+ nTemp |= 0x02;
+
+ aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("ReadOnly"));
+ fLocked = any2bool(aTmp);
+ if (fLocked)
+ nTemp |= 0x04;
+
+ *rContents << nTemp;
+ pBlockFlags[0] |= 0x01;
+ *rContents << sal_uInt8(0x48);
+ *rContents << sal_uInt8(0x80);
+
+ nTemp = 0x2C;
+ *rContents << nTemp;
+
+ aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("BackgroundColor"));
+ if (aTmp.hasValue())
+ aTmp >>= mnBackColor;
+ *rContents << ExportColor(mnBackColor);
+ pBlockFlags[0] |= 0x02;
+
+ aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("TextColor"));
+ if (aTmp.hasValue())
+ aTmp >>= mnForeColor;
+ *rContents << ExportColor(mnForeColor);
+ pBlockFlags[0] |= 0x04;
+
+ aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("Border"));
+ sal_Int16 nBorder = sal_Int16();
+ aTmp >>= nBorder;
+ nSpecialEffect = ExportBorder(nBorder,nBorderStyle);
+ *rContents << nBorderStyle;
+ pBlockFlags[0] |= 0x10;
+
+#if 0 //Each control has a different Value format, and how to convert each to text has to be found out
+ SvxOcxString aValue( rPropSet->getPropertyValue(WW8_ASCII2STR("DefaultText")) );
+ aValue.WriteLenField( *rContents );
+ if (aValue.HasData())
+ pBlockFlags[2] |= 0x40;
+#endif
+
+ *rContents << nSpecialEffect;
+ pBlockFlags[3] |= 0x04;
+
+ WriteAlign(rContents,4);
+ *rContents << rSize.Width;
+ *rContents << rSize.Height;
+
+#if 0
+ aValue.WriteCharArray( *rContents );
+#endif
+
+ WriteAlign(rContents,4);
+
+ nFixedAreaLen = static_cast<sal_uInt16>(rContents->Tell()-nOldPos-4);
+
+ bRet = aFontData.Export(rContents,rPropSet);
+
+ rContents->Seek(nOldPos);
+ *rContents << nStandardId;
+ *rContents << nFixedAreaLen;
+
+ *rContents << pBlockFlags[0];
+ *rContents << pBlockFlags[1];
+ *rContents << pBlockFlags[2];
+ *rContents << pBlockFlags[3];
+ *rContents << pBlockFlags[4];
+ *rContents << pBlockFlags[5];
+ *rContents << pBlockFlags[6];
+ *rContents << pBlockFlags[7];
+
+ DBG_ASSERT((rContents.Is() &&
+ (SVSTREAM_OK==rContents->GetError())),"damn");
+ return bRet;
+}
+
+sal_Bool OCX_FieldControl::Export(SvStorageRef &rObj,
+ const uno::Reference< beans::XPropertySet > &rPropSet,
+ const awt::Size &rSize)
+{
+ static sal_uInt8 __READONLY_DATA aCompObj[] = {
+ 0x01, 0x00, 0xFE, 0xFF, 0x03, 0x0A, 0x00, 0x00,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0x10, 0x1D, 0xD2, 0x8B,
+ 0x42, 0xEC, 0xCE, 0x11, 0x9E, 0x0D, 0x00, 0xAA,
+ 0x00, 0x60, 0x02, 0xF3, 0x1C, 0x00, 0x00, 0x00,
+ 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66,
+ 0x74, 0x20, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x20,
+ 0x32, 0x2E, 0x30, 0x20, 0x54, 0x65, 0x78, 0x74,
+ 0x42, 0x6F, 0x78, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x45, 0x6D, 0x62, 0x65, 0x64, 0x64, 0x65, 0x64,
+ 0x20, 0x4F, 0x62, 0x6A, 0x65, 0x63, 0x74, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x46, 0x6F, 0x72, 0x6D,
+ 0x73, 0x2E, 0x54, 0x65, 0x78, 0x74, 0x42, 0x6F,
+ 0x78, 0x2E, 0x31, 0x00, 0xF4, 0x39, 0xB2, 0x71,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00
+ };
+
+ {
+ SvStorageStreamRef xStor( rObj->OpenSotStream( C2S("\1CompObj")));
+ xStor->Write(aCompObj,sizeof(aCompObj));
+ DBG_ASSERT((xStor.Is() && (SVSTREAM_OK == xStor->GetError())),"damn");
+ }
+
+ {
+ SvStorageStreamRef xStor3( rObj->OpenSotStream( C2S("\3ObjInfo")));
+ xStor3->Write(aObjInfo,sizeof(aObjInfo));
+ DBG_ASSERT((xStor3.Is() && (SVSTREAM_OK == xStor3->GetError())),"damn");
+ }
+
+ static sal_uInt8 __READONLY_DATA aOCXNAME[] = {
+ 0x54, 0x00, 0x65, 0x00, 0x78, 0x00, 0x74, 0x00,
+ 0x42, 0x00, 0x6F, 0x00, 0x78, 0x00, 0x31, 0x00,
+ 0x00, 0x00, 0x00, 0x00
+ };
+
+ {
+ SvStorageStreamRef xStor2( rObj->OpenSotStream( C2S("\3OCXNAME")));
+ xStor2->Write(aOCXNAME,sizeof(aOCXNAME));
+ DBG_ASSERT((xStor2.Is() && (SVSTREAM_OK == xStor2->GetError())),"damn");
+ }
+
+ SvStorageStreamRef xContents( rObj->OpenSotStream( C2S("contents")));
+ return WriteContents(xContents, rPropSet, rSize);
+}
+
+
+
+sal_Bool OCX_ToggleButton::Import(com::sun::star::uno::Reference<
+ com::sun::star::beans::XPropertySet> &rPropSet)
+{
+ uno::Any aTmp(&sName,getCppuType((OUString *)0));
+ rPropSet->setPropertyValue( WW8_ASCII2STR("Name"), aTmp );
+
+ aTmp = bool2any(true);
+ rPropSet->setPropertyValue( WW8_ASCII2STR("Toggle"), aTmp );
+
+ sal_Bool bTemp;
+ if ((!(fEnabled)) || (fLocked))
+ bTemp = sal_False;
+ else
+ bTemp = sal_True;
+ aTmp = bool2any(bTemp);
+ rPropSet->setPropertyValue( WW8_ASCII2STR("Enabled"), aTmp);
+
+ bTemp = fWordWrap != 0;
+ aTmp = bool2any(bTemp);
+ rPropSet->setPropertyValue( WW8_ASCII2STR("MultiLine"), aTmp);
+
+ aTmp <<= ImportColor(mnForeColor);
+ rPropSet->setPropertyValue( WW8_ASCII2STR("TextColor"), aTmp);
+
+ // fake transparent toggle button by setting window background color
+ if( !fBackStyle )
+ mnBackColor = 0x80000005;
+ aTmp <<= ImportColor(mnBackColor);
+ rPropSet->setPropertyValue( WW8_ASCII2STR("BackgroundColor"), aTmp);
+
+ if (pValue)
+ {
+ INT16 nTmp=pValue[0]-0x30;
+ aTmp <<= nTmp == 1;
+ rPropSet->setPropertyValue( WW8_ASCII2STR("DefaultState"), aTmp);
+ }
+
+ if (pCaption)
+ {
+ aTmp <<= lclCreateOUString( pCaption, nCaptionLen );
+ rPropSet->setPropertyValue( WW8_ASCII2STR("Label"), aTmp);
+ }
+
+ aFontData.Import(rPropSet);
+ return sal_True;
+}
+
+sal_Bool OCX_ToggleButton::Export(
+ SvStorageRef &rObj, const uno::Reference< beans::XPropertySet> &rPropSet,
+ const awt::Size& rSize )
+{
+ static sal_uInt8 __READONLY_DATA aCompObj[] = {
+ 0x01, 0x00, 0xFE, 0xFF, 0x03, 0x0A, 0x00, 0x00,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0x60, 0x1D, 0xD2, 0x8B,
+ 0x42, 0xEC, 0xCE, 0x11, 0x9E, 0x0D, 0x00, 0xAA,
+ 0x00, 0x60, 0x02, 0xF3, 0x21, 0x00, 0x00, 0x00,
+ 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66,
+ 0x74, 0x20, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x20,
+ 0x32, 0x2E, 0x30, 0x20, 0x54, 0x6F, 0x67, 0x67,
+ 0x6C, 0x65, 0x42, 0x75, 0x74, 0x74, 0x6F, 0x6E,
+ 0x00, 0x10, 0x00, 0x00, 0x00, 0x45, 0x6D, 0x62,
+ 0x65, 0x64, 0x64, 0x65, 0x64, 0x20, 0x4F, 0x62,
+ 0x6A, 0x65, 0x63, 0x74, 0x00, 0x15, 0x00, 0x00,
+ 0x00, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x2E, 0x54,
+ 0x6F, 0x67, 0x67, 0x6C, 0x65, 0x42, 0x75, 0x74,
+ 0x74, 0x6F, 0x6E, 0x2E, 0x31, 0x00, 0xF4, 0x39,
+ 0xB2, 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+
+ {
+ SvStorageStreamRef xStor( rObj->OpenSotStream( C2S("\1CompObj")));
+ xStor->Write(aCompObj,sizeof(aCompObj));
+ DBG_ASSERT((xStor.Is() && (SVSTREAM_OK == xStor->GetError())),"damn");
+ }
+
+ {
+ SvStorageStreamRef xStor3( rObj->OpenSotStream( C2S("\3ObjInfo")));
+ xStor3->Write(aObjInfo,sizeof(aObjInfo));
+ DBG_ASSERT((xStor3.Is() && (SVSTREAM_OK == xStor3->GetError())),"damn");
+ }
+
+ static sal_uInt8 __READONLY_DATA aOCXNAME[] = {
+ 0x54, 0x00, 0x6F, 0x00, 0x67, 0x00, 0x67, 0x00,
+ 0x6C, 0x00, 0x65, 0x00, 0x42, 0x00, 0x75, 0x00,
+ 0x74, 0x00, 0x74, 0x00, 0x6F, 0x00, 0x6E, 0x00,
+ 0x31, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+
+ {
+ SvStorageStreamRef xStor2( rObj->OpenSotStream( C2S("\3OCXNAME")));
+ xStor2->Write(aOCXNAME,sizeof(aOCXNAME));
+ DBG_ASSERT((xStor2.Is() && (SVSTREAM_OK == xStor2->GetError())),"damn");
+ }
+
+ SvStorageStreamRef xContents( rObj->OpenSotStream( C2S("contents")));
+
+ return WriteContents(xContents,rPropSet,rSize);
+}
+
+sal_Bool OCX_ToggleButton::WriteContents(SvStorageStreamRef &rContents,
+ const uno::Reference< beans::XPropertySet > &rPropSet,
+ const awt::Size &rSize)
+{
+ sal_Bool bRet=sal_True;
+ sal_uInt32 nOldPos = rContents->Tell();
+ rContents->SeekRel(12);
+
+ pBlockFlags[0] = 0;
+ pBlockFlags[1] = 0x01;
+ pBlockFlags[2] = 0;
+ pBlockFlags[3] = 0x80;
+ pBlockFlags[4] = 0;
+ pBlockFlags[5] = 0;
+ pBlockFlags[6] = 0;
+ pBlockFlags[7] = 0;
+
+ uno::Any aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("Enabled"));
+ fEnabled = any2bool(aTmp);
+
+ sal_uInt8 nTemp=fEnabled;
+ if (fEnabled)
+ nTemp = nTemp << 1;
+ if (fBackStyle)
+ nTemp |= 0x08;
+ *rContents << nTemp;
+ pBlockFlags[0] |= 0x01;
+ *rContents << sal_uInt8(0x00);
+ nTemp = 0;
+ aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("MultiLine"));
+ fWordWrap = any2bool(aTmp);
+ if (fWordWrap)
+ nTemp |= 0x80;
+ *rContents << nTemp;
+ *rContents << sal_uInt8(0x00);
+
+ aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("BackgroundColor"));
+ if (aTmp.hasValue())
+ aTmp >>= mnBackColor;
+ *rContents << ExportColor(mnBackColor);
+ pBlockFlags[0] |= 0x02;
+
+ aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("TextColor"));
+ if (aTmp.hasValue())
+ aTmp >>= mnForeColor;
+ *rContents << ExportColor(mnForeColor);
+ pBlockFlags[0] |= 0x04;
+
+ nStyle = 6;
+ *rContents << nStyle;
+ pBlockFlags[0] |= 0x40;
+
+ WriteAlign(rContents,4);
+ nValueLen = 1|SVX_MSOCX_COMPRESSED;
+ bool bDefault = false;
+ rPropSet->getPropertyValue(WW8_ASCII2STR("DefaultState")) >>= bDefault;
+ sal_uInt8 nDefault = static_cast< sal_uInt8 >( bDefault ? '1' : '0' );
+ *rContents << nValueLen;
+ pBlockFlags[2] |= 0x40;
+
+ SvxOcxString aCaption( rPropSet->getPropertyValue(WW8_ASCII2STR("Label")) );
+ aCaption.WriteLenField( *rContents );
+ if (aCaption.HasData())
+ pBlockFlags[2] |= 0x80;
+
+ WriteAlign(rContents,4);
+ *rContents << rSize.Width;
+ *rContents << rSize.Height;
+
+ *rContents << nDefault;
+ *rContents << sal_uInt8(0x00);
+
+ aCaption.WriteCharArray( *rContents );
+
+ WriteAlign(rContents,4);
+ nFixedAreaLen = static_cast<sal_uInt16>(rContents->Tell()-nOldPos-4);
+ bRet = aFontData.Export(rContents,rPropSet);
+ rContents->Seek(nOldPos);
+ *rContents << nStandardId;
+ *rContents << nFixedAreaLen;
+
+ *rContents << pBlockFlags[0];
+ *rContents << pBlockFlags[1];
+ *rContents << pBlockFlags[2];
+ *rContents << pBlockFlags[3];
+ *rContents << pBlockFlags[4];
+ *rContents << pBlockFlags[5];
+ *rContents << pBlockFlags[6];
+ *rContents << pBlockFlags[7];
+
+ DBG_ASSERT((rContents.Is() &&
+ (SVSTREAM_OK==rContents->GetError())),"damn");
+ return bRet;
+}
+
+sal_Bool OCX_Label::Import(uno::Reference< beans::XPropertySet > &rPropSet)
+{
+ uno::Any aTmp(&sName,getCppuType((OUString *)0));
+ rPropSet->setPropertyValue( WW8_ASCII2STR("Name"), aTmp );
+
+ sal_Bool bTemp;
+ if ((!(fEnabled)) || (fLocked))
+ bTemp = sal_False;
+ else
+ bTemp = sal_True;
+ aTmp = bool2any(bTemp);
+ rPropSet->setPropertyValue( WW8_ASCII2STR("Enabled"), aTmp);
+
+ aTmp <<= ImportColor(mnForeColor);
+ rPropSet->setPropertyValue( WW8_ASCII2STR("TextColor"), aTmp);
+
+ // background color: fBackStyle==0 -> transparent
+ if( fBackStyle )
+ {
+ aTmp <<= ImportColor(mnBackColor);
+ }
+ else
+ {
+ // try fake transparent by using parents backColor
+ if ( bSetInDialog && mpParent != NULL )
+ {
+ aTmp <<= ImportColor( mpParent->mnBackColor );
+ }
+ else
+ {
+ aTmp = uno::Any(); // use SO default
+ }
+ }
+ rPropSet->setPropertyValue( WW8_ASCII2STR("BackgroundColor"), aTmp);
+
+ aTmp <<= ImportBorder(nSpecialEffect,nBorderStyle);
+ rPropSet->setPropertyValue( WW8_ASCII2STR("Border"), aTmp);
+
+ aTmp <<= ImportColor( nBorderColor );
+ rPropSet->setPropertyValue( WW8_ASCII2STR("BorderColor"), aTmp);
+
+ bTemp=fWordWrap;
+ aTmp = bool2any(bTemp);
+ rPropSet->setPropertyValue( WW8_ASCII2STR("MultiLine"), aTmp);
+
+ if (pCaption)
+ {
+ aTmp <<= lclCreateOUString( pCaption, nCaptionLen );
+ rPropSet->setPropertyValue( WW8_ASCII2STR("Label"), aTmp);
+ }
+
+ aFontData.Import(rPropSet);
+ return sal_True;
+}
+
+sal_Bool OCX_ComboBox::Import(com::sun::star::uno::Reference<
+ com::sun::star::beans::XPropertySet> &rPropSet)
+{
+
+ uno::Any aTmp(&sName,getCppuType((OUString *)0));
+ rPropSet->setPropertyValue( WW8_ASCII2STR("Name"), aTmp );
+
+ aTmp = bool2any(fEnabled != 0);
+ rPropSet->setPropertyValue( WW8_ASCII2STR("Enabled"), aTmp);
+
+ aTmp = bool2any(fLocked != 0);
+ rPropSet->setPropertyValue( WW8_ASCII2STR("ReadOnly"), aTmp);
+
+ aTmp = bool2any( nDropButtonStyle != 0 );
+ rPropSet->setPropertyValue( WW8_ASCII2STR("Dropdown"), aTmp);
+
+ aTmp = bool2any( fHideSelection != 0 );
+ rPropSet->setPropertyValue( WW8_ASCII2STR( "HideInactiveSelection" ), aTmp);
+
+ aTmp <<= ImportColor(mnForeColor);
+ rPropSet->setPropertyValue( WW8_ASCII2STR("TextColor"), aTmp);
+
+ if (pValue)
+ {
+ aTmp <<= lclCreateOUString( pValue, nValueLen );
+ if ( bSetInDialog )
+ {
+ rPropSet->setPropertyValue( WW8_ASCII2STR("Text"), aTmp);
+ }
+ else
+ {
+ rPropSet->setPropertyValue( WW8_ASCII2STR("DefaultText"), aTmp);
+ }
+ }
+
+ aTmp <<= ImportColor(mnBackColor);
+ rPropSet->setPropertyValue( WW8_ASCII2STR("BackgroundColor"), aTmp);
+
+ aTmp <<= ImportBorder(nSpecialEffect,nBorderStyle);
+ rPropSet->setPropertyValue( WW8_ASCII2STR("Border"), aTmp);
+
+ aTmp <<= ImportColor( nBorderColor );
+ rPropSet->setPropertyValue( WW8_ASCII2STR("BorderColor"), aTmp);
+
+ sal_Int16 nTmp=static_cast<sal_Int16>(nMaxLength);
+ aTmp <<= nTmp;
+ rPropSet->setPropertyValue( WW8_ASCII2STR("MaxTextLen"), aTmp);
+
+ aFontData.Import(rPropSet);
+ return sal_True;
+}
+
+sal_Bool OCX_ComboBox::WriteContents(SvStorageStreamRef &rContents,
+ const uno::Reference< beans::XPropertySet > &rPropSet,
+ const awt::Size &rSize)
+{
+ sal_Bool bRet=sal_True;
+ sal_uInt32 nOldPos = rContents->Tell();
+ rContents->SeekRel(12);
+
+ pBlockFlags[0] = 0;
+ pBlockFlags[1] = 0x01;
+ pBlockFlags[2] = 0x00;
+ pBlockFlags[3] = 0x80;
+ pBlockFlags[4] = 0;
+ pBlockFlags[5] = 0;
+ pBlockFlags[6] = 0;
+ pBlockFlags[7] = 0;
+
+
+ sal_uInt8 nTemp=0x19;//fEnabled;
+ uno::Any aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("Enabled"));
+ fEnabled = any2bool(aTmp);
+ if (fEnabled)
+ nTemp |= 0x02;
+
+ aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("ReadOnly"));
+ fLocked = any2bool(aTmp);
+ if (fLocked)
+ nTemp |= 0x04;
+
+ *rContents << nTemp;
+ pBlockFlags[0] |= 0x01;
+ *rContents << sal_uInt8(0x48);
+ *rContents << sal_uInt8(0x80);
+
+ nTemp = 0x0C;
+ fHideSelection = any2bool(rPropSet->getPropertyValue(WW8_ASCII2STR("HideInactiveSelection")));
+ if( fHideSelection )
+ nTemp |= 0x20;
+ *rContents << nTemp;
+
+ aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("BackgroundColor"));
+ if (aTmp.hasValue())
+ aTmp >>= mnBackColor;
+ *rContents << ExportColor(mnBackColor);
+ pBlockFlags[0] |= 0x02;
+
+ aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("TextColor"));
+ if (aTmp.hasValue())
+ aTmp >>= mnForeColor;
+ *rContents << ExportColor(mnForeColor);
+ pBlockFlags[0] |= 0x04;
+
+ aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("Border"));
+ sal_Int16 nBorder = sal_Int16();
+ aTmp >>= nBorder;
+ nSpecialEffect = ExportBorder(nBorder,nBorderStyle);
+ *rContents << nBorderStyle;
+ pBlockFlags[0] |= 0x10;
+
+ nStyle = 3;
+ *rContents << nStyle;
+ pBlockFlags[0] |= 0x40;
+
+ WriteAlign(rContents,2);
+
+ aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("LineCount"));
+ aTmp >>= nListRows;
+ *rContents << nListRows;
+ pBlockFlags[1] |= 0x40;
+
+ *rContents << sal_uInt8(1); //DefaultSelected One
+ pBlockFlags[2] |= 0x01;
+
+ aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("Dropdown"));
+ nDropButtonStyle = any2bool(aTmp);
+ if (nDropButtonStyle)
+ nDropButtonStyle=0x02;
+ *rContents << nDropButtonStyle;
+ pBlockFlags[2] |= 0x04;
+
+ SvxOcxString aValue( rPropSet->getPropertyValue(WW8_ASCII2STR("Text")) );
+ aValue.WriteLenField( *rContents );
+ if (aValue.HasData())
+ pBlockFlags[2] |= 0x40;
+
+ WriteAlign(rContents,4);
+ aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("BorderColor"));
+ if (aTmp.hasValue())
+ aTmp >>= nBorderColor;
+ *rContents << ExportColor(nBorderColor);
+ pBlockFlags[3] |= 0x02;
+
+ *rContents << nSpecialEffect;
+ pBlockFlags[3] |= 0x04;
+
+ WriteAlign(rContents,4);
+ *rContents << rSize.Width;
+ *rContents << rSize.Height;
+
+ aValue.WriteCharArray( *rContents );
+
+ WriteAlign(rContents,4);
+
+ nFixedAreaLen = static_cast<sal_uInt16>(rContents->Tell()-nOldPos-4);
+
+ bRet = aFontData.Export(rContents,rPropSet);
+
+ rContents->Seek(nOldPos);
+ *rContents << nStandardId;
+ *rContents << nFixedAreaLen;
+
+ *rContents << pBlockFlags[0];
+ *rContents << pBlockFlags[1];
+ *rContents << pBlockFlags[2];
+ *rContents << pBlockFlags[3];
+ *rContents << pBlockFlags[4];
+ *rContents << pBlockFlags[5];
+ *rContents << pBlockFlags[6];
+ *rContents << pBlockFlags[7];
+
+ DBG_ASSERT((rContents.Is() &&
+ (SVSTREAM_OK==rContents->GetError())),"damn");
+ return bRet;
+}
+
+
+sal_Bool OCX_ComboBox::Export(SvStorageRef &rObj,
+ const uno::Reference< beans::XPropertySet > &rPropSet,
+ const awt::Size &rSize)
+{
+ static sal_uInt8 __READONLY_DATA aCompObj[] = {
+ 0x01, 0x00, 0xFE, 0xFF, 0x03, 0x0A, 0x00, 0x00,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0x30, 0x1D, 0xD2, 0x8B,
+ 0x42, 0xEC, 0xCE, 0x11, 0x9E, 0x0D, 0x00, 0xAA,
+ 0x00, 0x60, 0x02, 0xF3, 0x1D, 0x00, 0x00, 0x00,
+ 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66,
+ 0x74, 0x20, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x20,
+ 0x32, 0x2E, 0x30, 0x20, 0x43, 0x6F, 0x6D, 0x62,
+ 0x6F, 0x42, 0x6F, 0x78, 0x00, 0x10, 0x00, 0x00,
+ 0x00, 0x45, 0x6D, 0x62, 0x65, 0x64, 0x64, 0x65,
+ 0x64, 0x20, 0x4F, 0x62, 0x6A, 0x65, 0x63, 0x74,
+ 0x00, 0x11, 0x00, 0x00, 0x00, 0x46, 0x6F, 0x72,
+ 0x6D, 0x73, 0x2E, 0x43, 0x6F, 0x6D, 0x62, 0x6F,
+ 0x42, 0x6F, 0x78, 0x2E, 0x31, 0x00, 0xF4, 0x39,
+ 0xB2, 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+
+ {
+ SvStorageStreamRef xStor( rObj->OpenSotStream( C2S("\1CompObj")));
+ xStor->Write(aCompObj,sizeof(aCompObj));
+ DBG_ASSERT((xStor.Is() && (SVSTREAM_OK == xStor->GetError())),"damn");
+ }
+
+ {
+ SvStorageStreamRef xStor3( rObj->OpenSotStream( C2S("\3ObjInfo")));
+ xStor3->Write(aObjInfo,sizeof(aObjInfo));
+ DBG_ASSERT((xStor3.Is() && (SVSTREAM_OK == xStor3->GetError())),"damn");
+ }
+
+ static sal_uInt8 __READONLY_DATA aOCXNAME[] = {
+ 0x43, 0x00, 0x6F, 0x00, 0x6D, 0x00, 0x62, 0x00,
+ 0x6F, 0x00, 0x42, 0x00, 0x6F, 0x00, 0x78, 0x00,
+ 0x31, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+
+ {
+ SvStorageStreamRef xStor2( rObj->OpenSotStream( C2S("\3OCXNAME")));
+ xStor2->Write(aOCXNAME,sizeof(aOCXNAME));
+ DBG_ASSERT((xStor2.Is() && (SVSTREAM_OK == xStor2->GetError())),"damn");
+ }
+
+ SvStorageStreamRef xContents( rObj->OpenSotStream( C2S("contents")));
+ return WriteContents(xContents, rPropSet, rSize);
+}
+
+
+
+sal_Bool OCX_ListBox::Import(com::sun::star::uno::Reference<
+ com::sun::star::beans::XPropertySet> &rPropSet)
+{
+
+ uno::Any aTmp(&sName,getCppuType((OUString *)0));
+ rPropSet->setPropertyValue( WW8_ASCII2STR("Name"), aTmp );
+
+ sal_Bool bTmp=fEnabled;
+ aTmp = bool2any(bTmp);
+ rPropSet->setPropertyValue( WW8_ASCII2STR("Enabled"), aTmp);
+
+ bTmp=fLocked;
+ aTmp = bool2any(bTmp);
+ rPropSet->setPropertyValue( WW8_ASCII2STR("ReadOnly"), aTmp);
+
+ aTmp <<= ImportColor(mnForeColor);
+ rPropSet->setPropertyValue( WW8_ASCII2STR("TextColor"), aTmp);
+
+ sal_Bool bTemp = nMultiState;
+ aTmp = bool2any(bTemp);
+ rPropSet->setPropertyValue( WW8_ASCII2STR("MultiSelection"), aTmp);
+
+#if 0 //Don't delete this for now until I figure out if I can make this
+ if (pValue)
+ {
+ aTmp <<= lclCreateOUString( pValue, nValueLen );
+ xPropSet->setPropertyValue( WW8_ASCII2STR("DefaultText"), aTmp);
+ }
+#endif
+
+ aTmp <<= ImportColor(mnBackColor);
+ rPropSet->setPropertyValue( WW8_ASCII2STR("BackgroundColor"), aTmp);
+
+ aTmp <<= ImportBorder(nSpecialEffect,nBorderStyle);
+ rPropSet->setPropertyValue( WW8_ASCII2STR("Border"), aTmp);
+
+ aTmp <<= ImportColor( nBorderColor );
+ rPropSet->setPropertyValue( WW8_ASCII2STR("BorderColor"), aTmp);
+
+ aFontData.Import(rPropSet);
+ return sal_True;
+}
+
+sal_Bool OCX_ListBox::WriteContents(SvStorageStreamRef &rContents,
+ const uno::Reference< beans::XPropertySet > &rPropSet,
+ const awt::Size &rSize)
+{
+ sal_Bool bRet=sal_True;
+ sal_uInt32 nOldPos = rContents->Tell();
+ rContents->SeekRel(12);
+
+ pBlockFlags[0] = 0;
+ pBlockFlags[1] = 0x01;
+ pBlockFlags[2] = 0x01;
+ pBlockFlags[3] = 0x80;
+ pBlockFlags[4] = 0;
+ pBlockFlags[5] = 0;
+ pBlockFlags[6] = 0;
+ pBlockFlags[7] = 0;
+
+ uno::Any aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("Enabled"));
+ fEnabled = any2bool(aTmp);
+ sal_uInt8 nTemp=fEnabled;
+ if (fEnabled)
+ nTemp = nTemp << 1;
+
+ aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("ReadOnly"));
+ fLocked = any2bool(aTmp);
+ if (fLocked)
+ nTemp |= 0x04;
+
+ *rContents << nTemp;
+ pBlockFlags[0] |= 0x01;
+ *rContents << sal_uInt8(0x00);
+ *rContents << sal_uInt8(0x00);
+ *rContents << sal_uInt8(0x00);
+
+ aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("BackgroundColor"));
+ if (aTmp.hasValue())
+ aTmp >>= mnBackColor;
+ *rContents << ExportColor(mnBackColor);
+ pBlockFlags[0] |= 0x02;
+
+ aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("TextColor"));
+ if (aTmp.hasValue())
+ aTmp >>= mnForeColor;
+ *rContents << ExportColor(mnForeColor);
+ pBlockFlags[0] |= 0x04;
+
+ aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("Border"));
+ sal_Int16 nBorder = sal_Int16();
+ aTmp >>= nBorder;
+ nSpecialEffect = ExportBorder(nBorder,nBorderStyle);
+ WriteAlign(rContents,2);
+ *rContents << nBorderStyle;
+ pBlockFlags[0] |= 0x10;
+
+ aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("MultiSelection"));
+ nMultiState = any2bool(aTmp);
+
+ if (nMultiState)
+ {
+ *rContents << nMultiState;
+ pBlockFlags[0] |= 0x20;
+ }
+
+ nStyle = 2;
+ *rContents << nStyle;
+ pBlockFlags[0] |= 0x40;
+
+
+ WriteAlign(rContents,4);
+
+#if 0
+ SvxOcxString aValue( rPropSet->getPropertyValue(WW8_ASCII2STR("DefaultText")) );
+ aValue.WriteLenField( *rContents );
+ if (aValue.HasData())
+ pBlockFlags[2] |= 0x40;
+
+ WriteAlign(rContents,4);
+#endif
+
+ WriteAlign(rContents,4);
+ aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("BorderColor"));
+ if (aTmp.hasValue())
+ aTmp >>= nBorderColor;
+ *rContents << ExportColor(nBorderColor);
+ pBlockFlags[3] |= 0x02;
+
+ *rContents << nSpecialEffect;
+ pBlockFlags[3] |= 0x04;
+
+ WriteAlign(rContents,4);
+ *rContents << rSize.Width;
+ *rContents << rSize.Height;
+
+#if 0
+ aValue.WriteCharArray( *rContents );
+#endif
+
+ WriteAlign(rContents,4);
+
+ nFixedAreaLen = static_cast<sal_uInt16>(rContents->Tell()-nOldPos-4);
+
+ bRet = aFontData.Export(rContents,rPropSet);
+
+ rContents->Seek(nOldPos);
+ *rContents << nStandardId;
+ *rContents << nFixedAreaLen;
+
+ *rContents << pBlockFlags[0];
+ *rContents << pBlockFlags[1];
+ *rContents << pBlockFlags[2];
+ *rContents << pBlockFlags[3];
+ *rContents << pBlockFlags[4];
+ *rContents << pBlockFlags[5];
+ *rContents << pBlockFlags[6];
+ *rContents << pBlockFlags[7];
+
+ DBG_ASSERT((rContents.Is() &&
+ (SVSTREAM_OK==rContents->GetError())),"damn");
+ return bRet;
+}
+
+sal_Bool OCX_ListBox::Export(SvStorageRef &rObj,
+ const uno::Reference< beans::XPropertySet > &rPropSet,
+ const awt::Size &rSize)
+{
+ static sal_uInt8 __READONLY_DATA aCompObj[] = {
+ 0x01, 0x00, 0xFE, 0xFF, 0x03, 0x0A, 0x00, 0x00,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0x20, 0x1D, 0xD2, 0x8B,
+ 0x42, 0xEC, 0xCE, 0x11, 0x9E, 0x0D, 0x00, 0xAA,
+ 0x00, 0x60, 0x02, 0xF3, 0x1C, 0x00, 0x00, 0x00,
+ 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66,
+ 0x74, 0x20, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x20,
+ 0x32, 0x2E, 0x30, 0x20, 0x4C, 0x69, 0x73, 0x74,
+ 0x42, 0x6F, 0x78, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x45, 0x6D, 0x62, 0x65, 0x64, 0x64, 0x65, 0x64,
+ 0x20, 0x4F, 0x62, 0x6A, 0x65, 0x63, 0x74, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x46, 0x6F, 0x72, 0x6D,
+ 0x73, 0x2E, 0x4C, 0x69, 0x73, 0x74, 0x42, 0x6F,
+ 0x78, 0x2E, 0x31, 0x00, 0xF4, 0x39, 0xB2, 0x71,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00
+ };
+
+ {
+ SvStorageStreamRef xStor( rObj->OpenSotStream( C2S("\1CompObj")));
+ xStor->Write(aCompObj,sizeof(aCompObj));
+ DBG_ASSERT((xStor.Is() && (SVSTREAM_OK == xStor->GetError())),"damn");
+ }
+
+ {
+ SvStorageStreamRef xStor3( rObj->OpenSotStream( C2S("\3ObjInfo")));
+ xStor3->Write(aObjInfo,sizeof(aObjInfo));
+ DBG_ASSERT((xStor3.Is() && (SVSTREAM_OK == xStor3->GetError())),"damn");
+ }
+
+ static sal_uInt8 __READONLY_DATA aOCXNAME[] = {
+ 0x4C, 0x00, 0x69, 0x00, 0x73, 0x00, 0x74, 0x00,
+ 0x42, 0x00, 0x6F, 0x00, 0x78, 0x00, 0x31, 0x00,
+ 0x00, 0x00, 0x00, 0x00
+ };
+
+ {
+ SvStorageStreamRef xStor2( rObj->OpenSotStream( C2S("\3OCXNAME")));
+ xStor2->Write(aOCXNAME,sizeof(aOCXNAME));
+ DBG_ASSERT((xStor2.Is() && (SVSTREAM_OK == xStor2->GetError())),"damn");
+ }
+
+ SvStorageStreamRef xContents( rObj->OpenSotStream( C2S("contents")));
+ return WriteContents(xContents, rPropSet, rSize);
+}
+
+sal_Bool OCX_Control::Read(SvStorageStream *pS)
+{
+ sal_uInt16 nIdentifier, nFixedAreaLen;
+ *pS >> nIdentifier;
+ DBG_ASSERT(nStandardId==nIdentifier,
+ "A control that has a different identifier");
+ *pS >> nFixedAreaLen;
+ pS->SeekRel(nFixedAreaLen);
+ return true;
+}
+
+sal_Bool OCX_ModernControl::Read(SvStorageStream *pS)
+{
+ long nStart = pS->Tell();
+ *pS >> nIdentifier;
+ DBG_ASSERT(nIdentifier==nStandardId,
+ "A control that has a different identifier");
+ *pS >> nFixedAreaLen;
+ pS->Read(pBlockFlags,8);
+
+ if (pBlockFlags[0] & 0x01)
+ {
+ sal_uInt8 nTemp;
+ *pS >> nTemp;
+
+ fEnabled = (nTemp & 0x02) >> 1;
+ fLocked = (nTemp & 0x04) >> 2;
+ fBackStyle = (nTemp & 0x08) >> 3;
+
+ *pS >> nTemp;
+
+ fColumnHeads = (nTemp & 0x04) >> 2;
+ fIntegralHeight = (nTemp & 0x08) >> 3;
+ fMatchRequired = (nTemp & 0x10) >> 4;
+ fAlignment = (nTemp & 0x20) >> 5;
+
+ *pS >> nTemp;
+
+ fDragBehaviour = (nTemp & 0x08) >> 3;
+ fEnterKeyBehaviour = (nTemp & 0x10) >> 4;
+ fEnterFieldBehaviour = (nTemp & 0x20) >> 5;
+ fTabKeyBehaviour = (nTemp & 0x40) >> 6;
+ fWordWrap = (nTemp & 0x80) >> 7;
+
+ *pS >> nTemp;
+ fSelectionMargin = (nTemp & 0x04) >> 2;
+ fAutoWordSelect = (nTemp & 0x08) >> 3;
+ fAutoSize = (nTemp & 0x10) >> 4;
+ fHideSelection = (nTemp & 0x20) >> 5;
+ fAutoTab = (nTemp & 0x40) >> 6;
+ fMultiLine = (nTemp & 0x80) >> 7;
+
+ }
+
+ /*If any of these are set they follow eachother in this order one after
+ another padded out to the next U32 boundary with 0's
+ U8 can abut each other U16 must start on a U16 boundary and are padded to
+ that with 0's. A standardish word alignment structure*/
+
+ if (pBlockFlags[0] & 0x02)
+ *pS >> mnBackColor;
+ if (pBlockFlags[0] & 0x04)
+ *pS >> mnForeColor;
+ if (pBlockFlags[0] & 0x08)
+ *pS >> nMaxLength;
+
+ if (pBlockFlags[0] & 0x10)
+ *pS >> nBorderStyle;
+ if (pBlockFlags[0] & 0x20)
+ *pS >> nScrollBars;
+ if (pBlockFlags[0] & 0x40)
+ *pS >> nStyle;// (UI 0 == Data 3, UI 2 = Data 7)
+ if (pBlockFlags[0] & 0x80)
+ *pS >> nMousePointer;
+
+ if (pBlockFlags[1] & 0x02)
+ *pS >> nPasswordChar; //HUH ??? always 0 ??? not sure maybe just padding
+
+ if (pBlockFlags[1] & 0x04)
+ {
+ ReadAlign(pS, pS->Tell() - nStart, 4);
+ *pS >> nListWidth;
+ }
+
+ if (pBlockFlags[1] & 0x08)
+ {
+ ReadAlign(pS, pS->Tell() - nStart, 2);
+ *pS >> nBoundColumn;
+ }
+ if (pBlockFlags[1] & 0x10)
+ {
+ ReadAlign(pS, pS->Tell() - nStart, 2);
+ *pS >> nTextColumn;
+ }
+ if (pBlockFlags[1] & 0x20)
+ {
+ ReadAlign(pS, pS->Tell() - nStart, 2);
+ *pS >> nColumnCount;
+ }
+ if (pBlockFlags[1] & 0x40)
+ {
+ ReadAlign(pS, pS->Tell() - nStart, 2);
+ *pS >> nListRows;
+ }
+ if (pBlockFlags[1] & 0x80)
+ {
+ ReadAlign(pS, pS->Tell() - nStart, 2);
+ *pS >> nUnknown8; //something to do with ColumnWidths
+ }
+ if (pBlockFlags[2] & 0x01)
+ *pS >> nMatchEntry;
+ if (pBlockFlags[2] & 0x02)
+ *pS >> nListStyle;
+ if (pBlockFlags[2] & 0x04)
+ *pS >> nShowDropButtonWhen;
+ if (pBlockFlags[2] & 0x10)
+ *pS >> nDropButtonStyle;
+ if (pBlockFlags[2] & 0x20)
+ *pS >> nMultiState;
+
+ bool bValue = (pBlockFlags[2] & 0x40) != 0;
+ if (bValue)
+ {
+ ReadAlign(pS, pS->Tell() - nStart, 4);
+ *pS >> nValueLen;
+ }
+ bool bCaption = (pBlockFlags[2] & 0x80) != 0;
+ if (bCaption)
+ {
+ ReadAlign(pS, pS->Tell() - nStart, 4);
+ *pS >> nCaptionLen;
+ }
+ if (pBlockFlags[3] & 0x01)
+ {
+ ReadAlign(pS, pS->Tell() - nStart, 4);
+ *pS >> nHorzPos;
+ *pS >> nVertPos;
+ }
+ if (pBlockFlags[3] & 0x02)
+ {
+ ReadAlign(pS, pS->Tell() - nStart, 4);
+ *pS >> nBorderColor;
+ }
+ if (pBlockFlags[3] & 0x04)
+ {
+ ReadAlign(pS, pS->Tell() - nStart, 4); // NEW
+ *pS >> nSpecialEffect;
+ pS->SeekRel( 3 ); // special effect is 32bit, not 8bit
+ }
+ if (pBlockFlags[3] & 0x08)
+ {
+ ReadAlign(pS, pS->Tell() - nStart, 2);
+ *pS >> nIcon;
+ DBG_ASSERT(nIcon == 0xFFFF, "Unexpected nIcon");
+ }
+ if (pBlockFlags[3] & 0x10)
+ {
+ ReadAlign(pS, pS->Tell() - nStart, 2);
+ *pS >> nPicture;
+ DBG_ASSERT(nPicture == 0xFFFF, "Unexpected nIcon");
+ }
+ if (pBlockFlags[3] & 0x20)
+ *pS >> nAccelerator;
+ /*
+ if (pBlockFlags[3] & 0x80)
+ *pS >> nUnknown9;
+ */
+ bool bGroupName = (pBlockFlags[4] & 0x01) != 0;
+ if (bGroupName)
+ {
+ ReadAlign(pS, pS->Tell() - nStart, 4);
+ *pS >> nGroupNameLen;
+ }
+
+ //End
+
+ ReadAlign(pS, pS->Tell() - nStart, 4);
+ *pS >> nWidth;
+ *pS >> nHeight;
+
+ if (bValue)
+ lclReadCharArray( *pS, pValue, nValueLen, pS->Tell() - nStart);
+
+ if (bCaption)
+ lclReadCharArray( *pS, pCaption, nCaptionLen, pS->Tell() - nStart);
+
+ if (bGroupName)
+ lclReadCharArray( *pS, pGroupName, nGroupNameLen, pS->Tell() - nStart);
+
+ ReadAlign(pS, pS->Tell() - nStart, 4);
+ if (nIcon)
+ {
+ pS->Read(pIconHeader,20);
+ *pS >> nIconLen;
+ pIcon = new sal_uInt8[nIconLen];
+ pS->Read(pIcon,nIconLen);
+ }
+
+ if (nPicture)
+ {
+ pS->Read(pPictureHeader,20);
+ *pS >> nPictureLen;
+ pPicture = new sal_uInt8[nPictureLen];
+ pS->Read(pPicture,nPictureLen);
+ }
+
+ return sal_True;
+}
+
+
+sal_Bool OCX_CommandButton::Read(SvStorageStream *pS)
+{
+ long nStart = pS->Tell();
+ *pS >> nIdentifier;
+ DBG_ASSERT(nStandardId==nIdentifier,
+ "A control that has a different identifier");
+ *pS >> nFixedAreaLen;
+ pS->Read(pBlockFlags,4);
+
+
+ if (pBlockFlags[0] & 0x01)
+ *pS >> mnForeColor;
+ if (pBlockFlags[0] & 0x02)
+ *pS >> mnBackColor;
+
+ if (pBlockFlags[0] & 0x04)
+ {
+ sal_uInt8 nTemp;
+ *pS >> nTemp;
+ fEnabled = (nTemp&0x02)>>1;
+ fLocked = (nTemp&0x04)>>2;
+ fBackStyle = (nTemp&0x08)>>3;
+ *pS >> nTemp;
+ *pS >> nTemp;
+ fWordWrap = (nTemp&0x80)>>7;
+ *pS >> nTemp;
+ fAutoSize = (nTemp&0x10)>>4;
+ }
+
+ bool bCaption = (pBlockFlags[0] & 0x08) != 0;
+ if (bCaption)
+ {
+ *pS >> nCaptionLen;
+ }
+ if (pBlockFlags[0] & 0x10) /*Picture Position, a strange mechanism here*/
+ {
+ *pS >> nVertPos;
+ *pS >> nHorzPos;
+ }
+
+ if (pBlockFlags[0] & 0x40) /*MousePointer*/
+ *pS >> nMousePointer;
+
+ if (pBlockFlags[0] & 0x80)
+ {
+ ReadAlign(pS, pS->Tell() - nStart, 2);
+ *pS >> nPicture;
+ }
+
+ if (pBlockFlags[1] & 0x01)
+ {
+ ReadAlign(pS, pS->Tell() - nStart, 2);
+ *pS >> nAccelerator;
+ }
+
+ // "take focus on click" is directly in content flags, not in option field...
+ mbTakeFocus = (pBlockFlags[1] & 0x02) == 0; // option is on, if flag is not set
+
+ if (pBlockFlags[1] & 0x04)
+ {
+ ReadAlign(pS, pS->Tell() - nStart, 2);
+ *pS >> nIcon;
+ }
+
+ if (bCaption)
+ lclReadCharArray( *pS, pCaption, nCaptionLen, pS->Tell() - nStart);
+
+ ReadAlign(pS, pS->Tell() - nStart, 4);
+ *pS >> nWidth;
+ *pS >> nHeight;
+
+ if (nIcon)
+ {
+ pS->Read(pIconHeader,20);
+ *pS >> nIconLen;
+ pIcon = new sal_uInt8[nIconLen];
+ pS->Read(pIcon,nIconLen);
+ }
+
+ if (nPicture)
+ {
+ pS->Read(pPictureHeader,20);
+ *pS >> nPictureLen;
+ pPicture = new sal_uInt8[nPictureLen];
+ pS->Read(pPicture,nPictureLen);
+ }
+
+ return sal_True;
+}
+
+sal_Bool OCX_Label::Read(SvStorageStream *pS)
+{
+ long nStart = pS->Tell();
+ *pS >> nIdentifier;
+ DBG_ASSERT(nStandardId==nIdentifier,
+ "A control that has a different identifier");
+ *pS >> nFixedAreaLen;
+ pS->Read(pBlockFlags,4);
+
+
+ if (pBlockFlags[0] & 0x01)
+ *pS >> mnForeColor;
+ if (pBlockFlags[0] & 0x02)
+ *pS >> mnBackColor;
+
+
+ if (pBlockFlags[0] & 0x04)
+ {
+ sal_uInt8 nTemp;
+ *pS >> nTemp;
+ fEnabled = (nTemp&0x02)>>1;
+ fLocked = (nTemp&0x04)>>2;
+ fBackStyle = (nTemp&0x08)>>3;
+ *pS >> nTemp;
+ *pS >> nTemp;
+ fWordWrap = (nTemp&0x80)>>7;
+ *pS >> nTemp;
+ fAutoSize = (nTemp&0x10)>>4;
+ }
+ bool bCaption = (pBlockFlags[0] & 0x08) != 0;
+ if (bCaption)
+ *pS >> nCaptionLen;
+
+ if (pBlockFlags[0] & 0x10)
+ {
+ *pS >> nVertPos;
+ *pS >> nHorzPos;
+ }
+
+ if (pBlockFlags[0] & 0x40)
+ *pS >> nMousePointer;
+
+ if (pBlockFlags[0] & 0x80)
+ {
+ ReadAlign(pS,pS->Tell() - nStart, 4);
+ *pS >> nBorderColor;
+ }
+
+ if (pBlockFlags[1] & 0x01)
+ {
+ ReadAlign(pS, pS->Tell() - nStart, 2);
+ *pS >> nBorderStyle;
+ }
+
+ if (pBlockFlags[1] & 0x02)
+ {
+ ReadAlign(pS, pS->Tell() - nStart, 2);
+ *pS >> nSpecialEffect;
+ }
+
+ if (pBlockFlags[1] & 0x04)
+ {
+ ReadAlign(pS, pS->Tell() - nStart, 2);
+ *pS >> nPicture;
+ }
+
+ if (pBlockFlags[1] & 0x08)
+ {
+ ReadAlign(pS, pS->Tell() - nStart, 2);
+ *pS >> nAccelerator;
+ }
+
+ if (pBlockFlags[1] & 0x10)
+ {
+ ReadAlign(pS, pS->Tell() - nStart, 2);
+ *pS >> nIcon;
+ }
+
+ if (bCaption)
+ lclReadCharArray( *pS, pCaption, nCaptionLen, pS->Tell() - nStart);
+
+ ReadAlign(pS, pS->Tell() - nStart, 4);
+ *pS >> nWidth;
+ *pS >> nHeight;
+
+ if (nPicture)
+ {
+ pS->Read(pPictureHeader,20);
+ *pS >> nPictureLen;
+ pPicture = new sal_uInt8[nPictureLen];
+ pS->Read(pPicture,nPictureLen);
+ }
+ if (nIcon)
+ {
+ pS->Read(pIconHeader,20);
+ *pS >> nIconLen;
+ pIcon = new sal_uInt8[nIconLen];
+ pS->Read(pIcon,nIconLen);
+ }
+
+ return sal_True;
+}
+
+TypeName::TypeName(sal_Char *pName, sal_uInt32 nStoreId, sal_uInt32 nLen, sal_uInt16 nType, sal_Int32 nLeft,
+ sal_Int32 nTop)
+ : msName(lclCreateOUString(pName, nLen)), mnType(nType), mnLeft(nLeft),
+ mnTop(nTop),mnStoreId(nStoreId)
+{
+}
+
+OCX_ContainerControl::OCX_ContainerControl( SotStorageRef& parent,
+ const ::rtl::OUString& storageName,
+ const ::rtl::OUString& sN,
+ const uno::Reference< container::XNameContainer > &rParent,
+ OCX_Control* pParent ) :
+ OCX_Control(sN, pParent), rbGroupMgr( sName ), mxParent(rParent), nNoRecords(0), nTotalLen(0), containerType( STDCONTAINER )
+{
+
+ mContainerStorage = parent->OpenSotStorage(storageName,
+ STREAM_READWRITE |
+ STREAM_NOCREATE |
+ STREAM_SHARE_DENYALL);
+ mContainerStream = mContainerStorage->OpenSotStream(
+ String(RTL_CONSTASCII_STRINGPARAM("f"),
+ RTL_TEXTENCODING_MS_1252),
+ STREAM_STD_READ | STREAM_NOCREATE);
+ mContainedControlsStream = mContainerStorage->OpenSotStream( String(RTL_CONSTASCII_STRINGPARAM("o"),
+ RTL_TEXTENCODING_MS_1252),
+ STREAM_STD_READ | STREAM_NOCREATE);
+}
+OCX_ContainerControl::~OCX_ContainerControl()
+{
+ CtrlIterator aEnd = mpControls.end();
+ for (CtrlIterator aIter = mpControls.begin(); aIter != aEnd; ++ aIter )
+ {
+ delete *aIter;
+ }
+}
+
+// Really import should receive the parent e.g. a Userform, Frame or Multi Page
+// and call import on its containees with itself ( up-called from
+// the base class ) but... the reality is we have no containment model
+// so we make sure rPropSet is always the parent Dialog
+
+sal_Bool OCX_ContainerControl::Import(uno::Reference<beans::XPropertySet>& /* rProps */ )
+{
+ if ( !mxParent.is() )
+ {
+ return sal_False;
+ }
+ CtrlIterator aEnd = mpControls.end();
+// int count = 0;
+ for (CtrlIterator aIter = mpControls.begin(); aIter != aEnd; ++ aIter )
+ {
+ if ( !(*aIter)->Import( mxParent ) )
+ {
+ return sal_False;
+ }
+ }
+ return sal_True;
+}
+
+OUString OCX_ContainerControl::createSubStreamName( const sal_uInt32& subStorageId )
+{
+ static OUString sI = OUString::createFromAscii("i");
+ static OUString sZero = OUString::createFromAscii( "0" );
+ OUStringBuffer buf( 6 );
+ buf.append( sI );
+ // for subStorage id < 10 stream name has leading '0'
+ // eg "i07"
+ if ( subStorageId < 10 )
+ {
+ buf.append( sZero );
+ }
+ buf.append( OUString::valueOf( (sal_Int32)subStorageId ) );
+ return buf.makeStringAndClear();
+}
+
+bool OCX_ContainerControl::createFromContainerRecord( const ContainerRecord& record, OCX_Control*& pControl )
+{
+ pControl = NULL;
+ switch ( record.nTypeIdent)
+ {
+ case CMDBUTTON:
+ pControl = new OCX_CommandButton;
+ break;
+ case LABEL:
+ pControl = new OCX_UserFormLabel(this);
+ break;
+ case TEXTBOX:
+ pControl = new OCX_TextBox;
+ break;
+ case LISTBOX:
+ pControl = new OCX_ListBox;
+ break;
+ case COMBOBOX:
+ pControl = new OCX_ComboBox;
+ break;
+ case CHECKBOX:
+ pControl = new OCX_CheckBox;
+ break;
+ case OPTIONBUTTON:
+ pControl = new OCX_OptionButton;
+ break;
+ case TOGGLEBUTTON:
+ pControl = new OCX_ToggleButton;
+ break;
+ case IMAGE: //Image
+ {
+ pControl = new OCX_Image;
+ break;
+ }
+ case PAGE: // Page
+ {
+ OUString sMSStore = createSubStreamName( record.nSubStorageId );
+ pControl = new OCX_Page(mContainerStorage, sMSStore,
+ record.cName, mxParent, this);
+ break;
+ }
+ case MULTIPAGE: // MultiPage
+ {
+ OUString sMSStore = createSubStreamName( record.nSubStorageId );
+ pControl = new OCX_MultiPage( mContainerStorage, sMSStore,
+ record.cName, mxParent, this);
+ break;
+ }
+ case FRAME: //Frame
+ {
+ OUString sFrameStore = createSubStreamName( record.nSubStorageId );
+ pControl = new OCX_Frame(mContainerStorage, sFrameStore,
+ record.cName, mxParent, this);
+
+ break;
+ }
+ case SPINBUTTON: //SpinButton
+ {
+ pControl = new OCX_SpinButton;
+ break;
+ }
+ case TABSTRIP: //TabStrip
+ {
+ pControl = new OCX_TabStrip;
+ break;
+ }
+ case SCROLLBAR: //ScrollBar
+ pControl = new OCX_ScrollBar;
+ break;
+ case PROGRESSBAR: //ProgressBar Active X control
+ pControl = new OCX_ProgressBar;
+ break;
+ default:
+ OSL_TRACE( "**** Unknown control 0x%x", record.nTypeIdent );
+ DBG_ERROR( "Unknown control");
+ return false;
+ }
+ pControl->sName = record.cName;
+ return true;
+}
+
+
+void addSeperator( std::vector< OCX_Control* >& dest )
+{
+ OCX_Control* seperator = new OCX_CommandButton;
+ seperator->SetInDialog(true);
+ seperator->sName = C2S("GroupSeperator");
+ dest.push_back( seperator );
+}
+
+void addRButtons( std::vector< OCX_Control* >& src,
+ std::vector< OCX_Control* >& dest,
+ bool addGroupSeperator )
+{
+ if ( addGroupSeperator )
+ {
+ addSeperator( dest );
+ }
+
+ for ( CtrlIterator rbIter = src.begin(); rbIter != src.end(); ++rbIter )
+ {
+ dest.push_back( *rbIter );
+ }
+}
+
+void OCX_ContainerControl::ProcessControl(OCX_Control* pControl,SvStorageStream* /* pS */, ContainerRecord& rec )
+{
+ SotStorageStreamRef oStream = mContainedControlsStream;
+
+ // can insert into OO Dialog (e.g is this a supported dialog control)??
+ if ( rec.nTypeIdent == SPINBUTTON ||
+ rec.nTypeIdent == TABSTRIP)
+ {
+ // skip the record in the stream, discard the control
+ oStream->SeekRel( rec.nSubStreamLen );
+ delete pControl;
+ }
+ else
+ {
+ // A container control needs to read the f stream in
+ // the folder ( substorage ) associated with this control
+ if ( rec.nTypeIdent == FRAME ||
+ rec.nTypeIdent == MULTIPAGE||
+ rec.nTypeIdent == PAGE )
+ {
+ OCX_ContainerControl* pContainer =
+ static_cast< OCX_ContainerControl* >( pControl );
+ oStream = pContainer->getContainerStream();
+ }
+
+ pControl->sName = rec.cName;
+ pControl->msToolTip = rec.controlTip;
+ // Position of controls is relative to the container
+ pControl->mnTop = rec.nTop + mnTop;
+ pControl->mnLeft = rec.nLeft + mnLeft;
+ // MS tabIndex, pretty useless in OpenOffice land
+ // as tab indexes in MS are relative to parent container.
+ // However we need this value in order to set
+ // OpenOffice tab indices in a sensible way to
+ // reflect the ms tabbing from orig MS UserForm, see below
+ pControl->mnTabPos = rec.nTabPos;
+ pControl->SetInDialog(true);
+ pControl->mbVisible = rec.bVisible;
+ if ( mnStep )
+ {
+ // If the container has a step then it should be
+ // applied to all containees
+ pControl->mnStep = mnStep;
+ }
+
+ // #117490# DR: container records provide size of substream, use it here...
+
+ // remember initial position to set correct stream position
+ ULONG nStrmPos = oStream->Tell();
+ // import control, may return with invalid stream position
+ pControl->FullRead(oStream);
+ // set stream to position behind substream of this control
+ oStream->Seek( nStrmPos + rec.nSubStreamLen );
+
+ //need to fake grouping behaviour for radio ( option ) buttons
+ if ( rec.nTypeIdent == OPTIONBUTTON )
+ {
+ OCX_OptionButton* pRButton =
+ static_cast< OCX_OptionButton*>(pControl);
+ rbGroupMgr.addRadioButton( pRButton );
+ }
+ else
+ {
+ mpControls.push_back( pControl );
+ }
+ }
+}
+
+sal_Bool OCX_ContainerControl::Read(SvStorageStream *pS)
+{
+
+ if ( mpParent )
+ {
+ mnBackColor = mpParent->mnBackColor;
+ }
+
+ std::auto_ptr< ContainerRecReader > reader (
+ ContainerRecordReaderFac::instance( containerType ) );
+
+ reader->Read( this, pS );
+ // Need to honour the MS Tab Indexes. However MS tab indexes are
+ // relative to parent, this hack sorts the controls in each container
+ // based on the ms tab indexes. When import is called we create the
+ // controls in Open/Star office based on the order of the tab indexes,
+ // this ensures that the default tab index created by Star/Open office
+ // reflects the "flattened" ms tab order.
+ ::std::sort( mpControls.begin(), mpControls.end(), SortOrderByTabPos() );
+ mpControls = rbGroupMgr.insertGroupsIntoControlList( mpControls );
+ return true;
+}
+
+OCX_MultiPage::OCX_MultiPage( SotStorageRef& parent,
+ const ::rtl::OUString& storageName,
+ const ::rtl::OUString& sN,
+ const uno::Reference< container::XNameContainer > &rDialog,
+ OCX_Control* pParent):
+ OCX_ContainerControl(parent, storageName, sN, rDialog, pParent ), fUnknown1(0), fEnabled(1),
+ fLocked(0), fBackStyle(1), fWordWrap(1), fAutoSize(0), nCaptionLen(0),
+ nVertPos(1), nHorzPos(7), nMousePointer(0), nBorderColor(0x80000012),
+ nKeepScrollBarsVisible(3), nCycle(0), nBorderStyle(0), nSpecialEffect(0),
+ nPicture(0), nPictureAlignment(2), nPictureSizeMode(0),
+ bPictureTiling(FALSE), nAccelerator(0), nIcon(0), pCaption(0),
+ nScrollWidth(0), nScrollHeight(0), nIconLen(0), pIcon(0), nPictureLen(0),
+ pPicture(0)
+{
+ msDialogType = C2U("NotSupported");
+ mnForeColor = 0x80000012L,
+ mnBackColor = 0x8000000FL;
+ bSetInDialog = true;// UserForm control only
+ aFontData.SetHasAlign(TRUE);
+ containerType = MULTIPAGE;
+ mnCurrentPageStep = 0;
+}
+
+void OCX_MultiPage::ProcessControl(OCX_Control* pControl, SvStorageStream* /* pS */, ContainerRecord& rec )
+{
+ SotStorageStreamRef oStream = mContainedControlsStream;
+
+ OCX_Page *pPage = NULL;
+ if ( rec.nTypeIdent == PAGE )
+ pPage = static_cast< OCX_Page* >( pControl );
+ if ( pPage != NULL )
+ {
+ pPage->mnStep = ++mnCurrentPageStep;
+
+ pPage->mnTop = mnTop;// move these to Page::import ?
+ pPage->mnLeft = mnLeft;
+ pPage->mnBackColor = mnBackColor;
+
+ oStream = pPage->getContainerStream();;
+ // Position of controls is relative to pos of this MuliPage
+ // Control
+ pPage->FullRead( oStream );
+
+ mpControls.push_back( pPage );
+ }
+ else
+ {
+ OSL_TRACE("!!!! Unsupported Control 0x%x ", rec.nTypeIdent);
+ DBG_ERROR("MultiPage error expected Page control");
+ }
+
+}
+
+sal_Bool OCX_MultiPage::Read(SvStorageStream *pS)
+{
+ // Unlike the other containers e.g. UserForm & Frame
+ // the o stream is does not contain info for the contained controls
+ // ( e.g. the pages themselves ) but seems to be for the MultiPage
+ // itself - need to check this in more detail
+
+ // For the moment skip read of the MultiPage specific properties
+ // not much point reading these as we can't display the multi page
+ // control or in fact any sort of tabbed layout, best we can do is
+ // import just the contained controls of the individual pages
+ // Note: the record skipped below ( does not contain the expected
+ // info on this control, that seems to be contained in the o stream,
+ // see comment above)
+ OCX_Control skip(C2S("Dummy"));
+ skip.Read( pS );
+ mnCurrentPageStep = mnStep; //( set step of of pages relative to step
+ //of this MultiPage ( e.g. emulate containment )
+ return OCX_ContainerControl::Read(pS);
+}
+
+
+sal_Bool OCX_MultiPage::Import(com::sun::star::uno::Reference<
+ com::sun::star::beans::XPropertySet> &rPropSet)
+{
+ // Calls import on contained controls
+ OCX_ContainerControl::Import( rPropSet );
+ return sal_True;
+}
+
+sal_Bool OCX_MultiPage::Import(com::sun::star::uno::Reference<
+ com::sun::star::container::XNameContainer>
+ &rDialog)
+{
+ uno::Reference<beans::XPropertySet> xPropSet( rDialog, uno::UNO_QUERY );
+
+ // Although MultiPage is not represeted by a "real" control we still
+ // need to propagate the backcolor of this logical parent
+ // ( the dialog or Frame or whatever ) to the children of this control.
+ // For example the controls contained in the Page of a
+ // MultiPage control use the parents backcolor ( e,g,
+ // Pages backcolor ) when trying to fake transparency
+ mnBackColor = mpParent->mnBackColor;
+
+ if ( xPropSet.is() )
+ {
+ // Calls import on contained pages
+ return OCX_ContainerControl::Import( xPropSet );
+ }
+ OSL_TRACE("*** Major problem, no dialog to add controls to ");
+ DBG_ERROR(" Major problem, no dialog to add controls to ");
+ return false;
+}
+
+
+
+OCX_Page::OCX_Page( SotStorageRef& parent,
+ const ::rtl::OUString& storageName,
+ const ::rtl::OUString& sN,
+ const uno::Reference< container::XNameContainer > &rDialog,
+ OCX_Control* pParent):
+ OCX_ContainerControl(parent, storageName, sN, rDialog, pParent ),
+ fUnknown1(0), fEnabled(1), fLocked(0),
+ fBackStyle(1), fWordWrap(1), fAutoSize(0), nCaptionLen(0), nVertPos(1),
+ nHorzPos(7), nMousePointer(0), nBorderColor(0x80000012),
+ nKeepScrollBarsVisible(3), nCycle(0), nBorderStyle(0), nSpecialEffect(0),
+ nPicture(0), nPictureAlignment(2), nPictureSizeMode(0),
+ bPictureTiling(FALSE), nAccelerator(0), nIcon(0), pCaption(0),
+ nScrollWidth(0), nScrollHeight(0), nIconLen(0), pIcon(0), nPictureLen(0),
+ pPicture(0)
+{
+ msDialogType = C2U("NotSupported");
+ mnForeColor = 0x80000012,
+ mnBackColor = 0x8000000F,
+ bSetInDialog = true;// UserForm control only
+ aFontData.SetHasAlign(TRUE);
+}
+
+
+sal_Bool OCX_Page::Read(SvStorageStream *pS)
+{
+ long nStart = pS->Tell();
+ *pS >> nIdentifier;
+ DBG_ASSERT(0x400==nIdentifier,
+ "A control that has a different identifier");
+ *pS >> nFixedAreaLen;
+ pS->Read(pBlockFlags,4);
+
+ pS->SeekRel( nFixedAreaLen - sizeof( pBlockFlags ) );
+
+ ReadAlign( pS, pS->Tell() - nStart, 4);
+
+ if (pBlockFlags[2] & 0x10)
+ {
+ //Font Stuff..
+ pS->SeekRel(0x1a);
+ sal_uInt8 nFontLen;
+ *pS >> nFontLen;
+ pS->SeekRel(nFontLen);
+ }
+ return OCX_ContainerControl::Read(pS);
+
+}
+
+sal_Bool OCX_Page::Import(com::sun::star::uno::Reference<
+ com::sun::star::container::XNameContainer>
+ &rDialog)
+{
+
+ uno::Reference<beans::XPropertySet> xPropSet( rDialog, uno::UNO_QUERY );
+ if ( xPropSet.is() )
+ {
+ // apply Step to contained controls
+ CtrlIterator aEnd = mpControls.end();
+ for (CtrlIterator aIter = mpControls.begin(); aIter != aEnd; ++ aIter )
+ {
+ (*aIter)->mnStep = mnStep;
+ }
+ // Calls import on contained pages
+ return OCX_ContainerControl::Import( xPropSet );
+ }
+ OSL_TRACE("*** Major problem, no dialog to add controls to ");
+ DBG_ERROR("*** Major problem, no dialog to add controls to ");
+ return sal_False;
+}
+
+OCX_Frame::OCX_Frame( SotStorageRef& parent,
+ const ::rtl::OUString& storageName,
+ const ::rtl::OUString& sN,
+ const uno::Reference< container::XNameContainer > &rDialog, OCX_Control* pParent):
+ OCX_ContainerControl(parent, storageName, sN, rDialog, pParent ),fUnknown1(0),fEnabled(1), fLocked(0),
+ fBackStyle(1), fWordWrap(1), fAutoSize(0), nCaptionLen(0), nVertPos(1),
+ nHorzPos(7), nMousePointer(0), nBorderColor(0x80000012),
+ nKeepScrollBarsVisible(3), nCycle(0), nBorderStyle(0), nSpecialEffect(0),
+ nPicture(0), nPictureAlignment(2), nPictureSizeMode(0),
+ bPictureTiling(FALSE), nAccelerator(0), nIcon(0), pCaption(0),
+ nScrollWidth(0), nScrollHeight(0), nScrollLeft(0), nScrollTop(0), nIconLen(0), pIcon(0), nPictureLen(0),
+ pPicture(0)
+{
+ msDialogType = C2U("com.sun.star.awt.UnoControlGroupBoxModel");
+ mnForeColor = 0x80000012;
+ mnBackColor = 0x8000000F;
+ bSetInDialog = true;// UserForm control only
+ aFontData.SetHasAlign(TRUE);
+}
+
+
+sal_Bool OCX_Frame::Read(SvStorageStream *pS)
+{
+ long nStart = pS->Tell();
+ *pS >> nIdentifier;
+ DBG_ASSERT(0x400==nIdentifier,
+ "A control that has a different identifier");
+ *pS >> nFixedAreaLen;
+ pS->Read(pBlockFlags,4);
+
+ if (pBlockFlags[0] & 0x01)
+ {
+ DBG_ASSERT(!this, "ARSE");
+ }
+ if (pBlockFlags[0] & 0x02)
+ *pS >> mnBackColor;
+ if (pBlockFlags[0] & 0x04)
+ *pS >> mnForeColor;
+ if (pBlockFlags[0] & 0x08)
+ *pS >> fUnknown1;
+ if (pBlockFlags[0] & 0x40)
+ {
+ sal_uInt8 nTemp;
+ *pS >> nTemp;
+ fEnabled = (nTemp&0x04)>>2;
+ fBackStyle = (nTemp&0x08)>>3;
+ *pS >> nTemp;
+ *pS >> nTemp;
+ fWordWrap = (nTemp&0x80)>>7;
+ *pS >> nTemp;
+ fAutoSize = (nTemp&0x10)>>4;
+ }
+ if (pBlockFlags[0] & 0x80)
+ {
+ *pS >> nBorderStyle;
+ }
+
+ ReadAlign(pS, pS->Tell() - nStart, 4);
+
+ if (pBlockFlags[1] & 0x01)
+ *pS >> nMousePointer;
+ if (pBlockFlags[1] & 0x02)
+ *pS >> nKeepScrollBarsVisible;
+ if (pBlockFlags[1] & 0x20)
+ *pS >> fUnknown1; // another unknown 32 bit ( or is 8 or 16 bit with padding ? )
+
+ if (pBlockFlags[1] & 0x80)
+ {
+ ReadAlign(pS, pS->Tell() - nStart, 2);
+ *pS >> nIcon;
+ DBG_ASSERT(nIcon == 0xFFFF, "Unexpected nIcon");
+ }
+
+ bool bCaption = false;
+
+ if (pBlockFlags[2] & 0x01)
+ *pS >> nCycle;
+ if (pBlockFlags[2] & 0x02)
+ *pS >> nSpecialEffect;
+
+ if (pBlockFlags[2] & 0x04)
+ {
+ ReadAlign(pS, pS->Tell() - nStart, 4);
+ *pS >> nBorderColor;
+ }
+
+ if (pBlockFlags[2] & 0x08)
+ {
+ ReadAlign(pS, pS->Tell() - nStart, 4);
+ *pS >> nCaptionLen;
+ bCaption = true;
+ }
+
+ if (pBlockFlags[2] & 0x10)
+ {
+ ReadAlign(pS, pS->Tell() - nStart, 2);
+ sal_uInt16 nNoIdea;
+ *pS >> nNoIdea;
+ DBG_ASSERT(nNoIdea == 0xFFFF, "Expected 0xFFFF, (related to font ?)");
+ }
+
+ if (pBlockFlags[2] & 0x20)
+ {
+ ReadAlign(pS, pS->Tell() - nStart, 2);
+ *pS >> nPicture;
+ DBG_ASSERT(nPicture == 0xFFFF, "Unexpected nIcon");
+ }
+
+ if (pBlockFlags[2] & 0x80)
+ *pS >> nPictureAlignment;
+
+ if (pBlockFlags[3] & 0x01)
+ bPictureTiling = true;
+
+ if (pBlockFlags[3] & 0x02)
+ *pS >> nPictureSizeMode;
+
+ if (pBlockFlags[3] & 0x04)
+ {
+ ReadAlign(pS, pS->Tell() - nStart, 4);
+ *pS >> fUnknown8;
+ }
+
+ if (pBlockFlags[3] & 0x08)
+ {
+ ReadAlign(pS, pS->Tell() - nStart, 4);
+ *pS >> fUnknown9;
+ }
+
+ ReadAlign(pS, pS->Tell() - nStart, 4);
+ *pS >> nWidth;
+ *pS >> nHeight;
+ *pS >> nScrollWidth;
+ *pS >> nScrollHeight;
+
+ if (pBlockFlags[1] & 0x10)
+ {
+ *pS >> nScrollLeft;
+ *pS >> nScrollTop;
+ }
+
+ if ( bCaption )
+ {
+ lclReadCharArray( *pS, pCaption, nCaptionLen, pS->Tell() - nStart);
+ }
+
+ OUString tempCaption = lclCreateOUString( pCaption, nCaptionLen );
+
+ if (nIcon)
+ {
+ pS->Read(pIconHeader,20);
+ *pS >> nIconLen;
+ pIcon = new sal_uInt8[nIconLen];
+ pS->Read(pIcon,nIconLen);
+ }
+
+ if (nPicture)
+ {
+ pS->Read(pPictureHeader,20);
+ *pS >> nPictureLen;
+ pPicture = new sal_uInt8[nPictureLen];
+ pS->Read(pPicture,nPictureLen);
+ }
+
+ ReadAlign( pS, pS->Tell() - nStart, 4);
+
+ if (pBlockFlags[2] & 0x10)
+ {
+ //Font Stuff..
+ pS->SeekRel(0x1a);
+ sal_uInt8 nFontLen;
+ *pS >> nFontLen;
+ pS->SeekRel(nFontLen);
+ }
+
+ return OCX_ContainerControl::Read( pS );
+}
+
+sal_Bool OCX_Frame::Import(com::sun::star::uno::Reference<
+ com::sun::star::beans::XPropertySet> &rPropSet)
+{
+ uno::Any aTmp(&sName,getCppuType((OUString *)0));
+ rPropSet->setPropertyValue(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Name")), aTmp);
+ if ( pCaption )
+ {
+ aTmp <<= lclCreateOUString( pCaption, nCaptionLen );
+ rPropSet->setPropertyValue( WW8_ASCII2STR("Label"), aTmp);
+ }
+
+ // Calls import on contained controls
+ OCX_ContainerControl::Import( rPropSet );
+ return sal_True;
+}
+OCX_UserForm::OCX_UserForm( SotStorageRef& parent,
+ const OUString& storageName,
+ const OUString& sN,
+ const ::uno::Reference< container::XNameContainer > &rDialog,
+ const ::uno::Reference< lang::XMultiServiceFactory >& rMsf):
+ OCX_ContainerControl(parent, storageName, sN, rDialog),
+ nChildrenA(0), fEnabled(1), fLocked(0),
+ fBackStyle(1), fWordWrap(1), fAutoSize(0), nCaptionLen(0), nVertPos(1),
+ nHorzPos(7), nMousePointer(0), nBorderColor(0x80000012), nChildrenB(0),
+ nKeepScrollBarsVisible(3), nCycle(0), nBorderStyle(0), nSpecialEffect(0),
+ nPicture(0), nPictureAlignment(2), nPictureSizeMode(0),
+ bPictureTiling(FALSE), nAccelerator(0), nIcon(0), pCaption(0),
+ nScrollWidth(0), nScrollHeight(0), nScrollLeft(0), nScrollTop(0), nIconLen(0), pIcon(0), nPictureLen(0),
+ pPicture(0)
+ {
+ mnForeColor = 0x80000012;
+ mnBackColor = 0x8000000F;
+ uno::Reference< beans::XPropertySet> xProps( rMsf, uno::UNO_QUERY);
+ if ( xProps.is() )
+ {
+ xProps->getPropertyValue(C2S("DefaultContext")) >>= mxCtx;
+ }
+ aFontData.SetHasAlign(TRUE);
+ }
+sal_Bool OCX_UserForm::Read(SvStorageStream *pS)
+{
+ long nStart = pS->Tell();
+ *pS >> nIdentifier;
+ DBG_ASSERT(0x400==nIdentifier,
+ "A control that has a different identifier");
+ *pS >> nFixedAreaLen;
+ pS->Read(pBlockFlags,4);
+
+ if (pBlockFlags[0] & 0x01)
+ {
+ DBG_ASSERT(!this, "ARSE");
+ }
+ if (pBlockFlags[0] & 0x02)
+ *pS >> mnBackColor;
+ if (pBlockFlags[0] & 0x04)
+ *pS >> mnForeColor;
+ if (pBlockFlags[0] & 0x08)
+ *pS >> nChildrenA;
+ if (pBlockFlags[0] & 0x40)
+ {
+ sal_uInt8 nTemp;
+ *pS >> nTemp;
+ fEnabled = (nTemp&0x04)>>2;
+ fBackStyle = (nTemp&0x08)>>3;
+ *pS >> nTemp;
+ *pS >> nTemp;
+ fWordWrap = (nTemp&0x80)>>7;
+ *pS >> nTemp;
+ fAutoSize = (nTemp&0x10)>>4;
+ }
+ if (pBlockFlags[0] & 0x80)
+ {
+ ReadAlign(pS, pS->Tell() - nStart, 4);
+ *pS >> nBorderStyle;
+ }
+#if 0
+ sal_uInt16 nFixedOrAlign;
+ *pS >> nFixedOrAlign;
+#endif
+ if (pBlockFlags[1] & 0x01)
+ *pS >> nMousePointer;
+ if (pBlockFlags[1] & 0x02)
+ *pS >> nKeepScrollBarsVisible;
+ if (pBlockFlags[1] & 0x20)
+ {
+ sal_uInt32 nUnknown32;
+ *pS >> nUnknown32;
+ }
+ if (pBlockFlags[1] & 0x80)
+ {
+ ReadAlign(pS, pS->Tell() - nStart, 2);
+ *pS >> nIcon;
+ DBG_ASSERT(nIcon == 0xFFFF, "Unexpected nIcon");
+ }
+ if (pBlockFlags[2] & 0x01)
+ *pS >> nCycle;
+ if (pBlockFlags[2] & 0x02)
+ *pS >> nSpecialEffect;
+
+ if (pBlockFlags[2] & 0x04)
+ {
+ ReadAlign(pS, pS->Tell() - nStart, 4);
+ *pS >> nBorderColor;
+ }
+
+ if (pBlockFlags[2] & 0x10)
+ {
+ ReadAlign(pS, pS->Tell() - nStart, 2);
+ sal_uInt16 nNoIdea;
+ *pS >> nNoIdea;
+ DBG_ASSERT(nNoIdea == 0xFFFF, "Expected 0xFFFF, (related to font ?)");
+ }
+
+ if (pBlockFlags[2] & 0x20)
+ {
+ ReadAlign(pS, pS->Tell() - nStart, 2);
+ *pS >> nPicture;
+ DBG_ASSERT(nPicture == 0xFFFF, "Unexpected nIcon");
+ }
+
+ if (pBlockFlags[2] & 0x80)
+ *pS >> nPictureAlignment;
+
+ if (pBlockFlags[3] & 0x01)
+ bPictureTiling = true;
+
+ if (pBlockFlags[3] & 0x02)
+ *pS >> nPictureSizeMode;
+
+ if (pBlockFlags[3] & 0x04)
+ {
+ ReadAlign(pS, pS->Tell() - nStart, 4);
+ *pS >> nChildrenB;
+ }
+
+ ReadAlign(pS, pS->Tell() - nStart, 4);
+ *pS >> nDrawBuffer;
+
+ ReadAlign(pS, pS->Tell() - nStart, 4);
+ *pS >> nWidth;
+ *pS >> nHeight;
+ *pS >> nScrollWidth;
+ *pS >> nScrollHeight;
+
+ if (pBlockFlags[1] & 0x10)
+ {
+ *pS >> nScrollLeft;
+ *pS >> nScrollTop;
+ }
+
+ if (nIcon)
+ {
+ pS->Read(pIconHeader,20);
+ *pS >> nIconLen;
+ pIcon = new sal_uInt8[nIconLen];
+ pS->Read(pIcon,nIconLen);
+ }
+
+ if (nPicture)
+ {
+ pS->Read(pPictureHeader,20);
+ *pS >> nPictureLen;
+ pPicture = new sal_uInt8[nPictureLen];
+ pS->Read(pPicture,nPictureLen);
+ }
+
+ ReadAlign( pS, pS->Tell() - nStart, 4);
+
+ if (pBlockFlags[2] & 0x10)
+ {
+ //Font Stuff..
+ pS->SeekRel(0x1a);
+ sal_uInt8 nFontLen;
+ *pS >> nFontLen;
+ pS->SeekRel(nFontLen);
+ }
+
+ sal_Int16 numTrailingRecs = 0;
+ *pS >> numTrailingRecs;
+ // seems to be no. of trailing records,
+ // before container record starts proper
+ // ( unknown what these trailing records are for)
+ if ( numTrailingRecs )
+ {
+ for ( ; numTrailingRecs ; --numTrailingRecs )
+ {
+ OCX_Control skip(C2S("dummy")) ;
+ skip.Read( pS );
+ }
+ }
+ return OCX_ContainerControl::Read( pS );
+}
+
+sal_Bool OCX_UserForm::Import(
+ uno::Reference<container::XNameContainer> &rLib )
+{
+ uno::Reference<beans::XPropertySet>
+ xDialogPropSet(mxParent, uno::UNO_QUERY);
+ uno::Any aTmp(&sName,getCppuType((OUString *)0));
+ xDialogPropSet->setPropertyValue(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Name")), aTmp);
+ xDialogPropSet->setPropertyValue(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Title")), aTmp);
+ aTmp <<= ImportColor(mnBackColor);
+ xDialogPropSet->setPropertyValue( WW8_ASCII2STR("BackgroundColor"), aTmp);
+
+ aTmp <<= sal_Int32((nWidth * 2) / 100);
+ xDialogPropSet->setPropertyValue(WW8_ASCII2STR("Width"), aTmp);
+ aTmp <<= sal_Int32((nHeight * 2) / 100);
+ xDialogPropSet->setPropertyValue(WW8_ASCII2STR("Height"), aTmp);
+
+ uno::Reference<beans::XPropertySet> xPropSet( mxParent, uno::UNO_QUERY );
+ OCX_ContainerControl::Import( xPropSet );
+
+ uno::Reference<io::XInputStreamProvider> xSource =
+ xmlscript::exportDialogModel(mxParent, mxCtx);
+ uno::Any aSourceAny(uno::makeAny(xSource));
+ if (rLib->hasByName(sName))
+ rLib->replaceByName(sName, aSourceAny);
+ else
+ rLib->insertByName(sName, aSourceAny);
+ return sal_True;
+}
+
+sal_Bool OCX_Label::WriteContents(SvStorageStreamRef &rContents,
+ const uno::Reference< beans::XPropertySet > &rPropSet,
+ const awt::Size &rSize)
+{
+ sal_Bool bRet = sal_True;
+ sal_uInt32 nOldPos = rContents->Tell();
+ rContents->SeekRel(8);
+ pBlockFlags[0] = 0x20;
+ pBlockFlags[1] = 0;
+ pBlockFlags[2] = 0;
+ pBlockFlags[3] = 0;
+
+ uno::Any aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("TextColor"));
+ if (aTmp.hasValue())
+ aTmp >>= mnForeColor;
+ *rContents << ExportColor(mnForeColor);
+ pBlockFlags[0] |= 0x01;
+
+ aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("BackgroundColor"));
+ if (aTmp.hasValue())
+ aTmp >>= mnBackColor;
+ *rContents << ExportColor(mnBackColor);
+ pBlockFlags[0] |= 0x02;
+
+ aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("Enabled"));
+ fEnabled = any2bool(aTmp);
+ sal_uInt8 nTemp=fEnabled;
+ if (fEnabled)
+ nTemp = nTemp << 1;
+ *rContents << nTemp;
+ *rContents << sal_uInt8(0x00);
+
+ aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("MultiLine"));
+ fWordWrap = any2bool(aTmp);
+ nTemp=fWordWrap;
+ nTemp = nTemp << 7;
+ *rContents << nTemp;
+ *rContents << sal_uInt8(0x00);
+ pBlockFlags[0] |= 0x04;
+
+ SvxOcxString aCaption( rPropSet->getPropertyValue(WW8_ASCII2STR("Label")) );
+ aCaption.WriteLenField( *rContents );
+ if (aCaption.HasData())
+ pBlockFlags[0] |= 0x08;
+
+ WriteAlign(rContents,4);
+ aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("BorderColor"));
+ if (aTmp.hasValue())
+ aTmp >>= nBorderColor;
+ *rContents << ExportColor(nBorderColor);
+ pBlockFlags[0] |= 0x80;
+
+ aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("Border"));
+ sal_Int16 nBorder = sal_Int16();
+ aTmp >>= nBorder;
+ sal_uInt8 nNewBorder;
+ nSpecialEffect = ExportBorder(nBorder,nNewBorder);
+ nBorderStyle = nNewBorder;
+ *rContents << nBorderStyle;
+ pBlockFlags[1] |= 0x01;
+ *rContents << nSpecialEffect;
+ pBlockFlags[1] |= 0x02;
+
+ aCaption.WriteCharArray( *rContents );
+
+ WriteAlign(rContents,4);
+ *rContents << rSize.Width;
+ *rContents << rSize.Height;
+ nFixedAreaLen = static_cast<sal_uInt16>(rContents->Tell()-nOldPos-4);
+
+ bRet = aFontData.Export(rContents,rPropSet);
+
+ rContents->Seek(nOldPos);
+ *rContents << nStandardId;
+ *rContents << nFixedAreaLen;
+
+ *rContents << pBlockFlags[0];
+ *rContents << pBlockFlags[1];
+ *rContents << pBlockFlags[2];
+ *rContents << pBlockFlags[3];
+
+ DBG_ASSERT((rContents.Is() &&
+ (SVSTREAM_OK==rContents->GetError())),"damn");
+ return bRet;
+}
+
+
+
+sal_Bool OCX_Label::Export(SvStorageRef &rObj,
+ const uno::Reference< beans::XPropertySet > &rPropSet,
+ const awt::Size &rSize)
+{
+ static sal_uInt8 __READONLY_DATA aCompObj[] = {
+ 0x01, 0x00, 0xFE, 0xFF, 0x03, 0x0A, 0x00, 0x00,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0x23, 0x9E, 0x8C, 0x97,
+ 0xB0, 0xD4, 0xCE, 0x11, 0xBF, 0x2D, 0x00, 0xAA,
+ 0x00, 0x3F, 0x40, 0xD0, 0x1A, 0x00, 0x00, 0x00,
+ 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66,
+ 0x74, 0x20, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x20,
+ 0x32, 0x2E, 0x30, 0x20, 0x4C, 0x61, 0x62, 0x65,
+ 0x6C, 0x00, 0x10, 0x00, 0x00, 0x00, 0x45, 0x6D,
+ 0x62, 0x65, 0x64, 0x64, 0x65, 0x64, 0x20, 0x4F,
+ 0x62, 0x6A, 0x65, 0x63, 0x74, 0x00, 0x0E, 0x00,
+ 0x00, 0x00, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x2E,
+ 0x4C, 0x61, 0x62, 0x65, 0x6C, 0x2E, 0x31, 0x00,
+ 0xF4, 0x39, 0xB2, 0x71, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+
+ {
+ SvStorageStreamRef xStor( rObj->OpenSotStream( C2S("\1CompObj")));
+ xStor->Write(aCompObj,sizeof(aCompObj));
+ DBG_ASSERT((xStor.Is() && (SVSTREAM_OK == xStor->GetError())),"damn");
+ }
+
+ {
+ SvStorageStreamRef xStor3( rObj->OpenSotStream( C2S("\3ObjInfo")));
+ xStor3->Write(aObjInfo,sizeof(aObjInfo));
+ DBG_ASSERT((xStor3.Is() && (SVSTREAM_OK == xStor3->GetError())),"damn");
+ }
+
+ static sal_uInt8 __READONLY_DATA aOCXNAME[] = {
+ 0x4C, 0x00, 0x61, 0x00, 0x62, 0x00, 0x65, 0x00,
+ 0x6C, 0x00, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+
+ {
+ SvStorageStreamRef xStor2( rObj->OpenSotStream( C2S("\3OCXNAME")));
+ xStor2->Write(aOCXNAME,sizeof(aOCXNAME));
+ DBG_ASSERT((xStor2.Is() && (SVSTREAM_OK == xStor2->GetError())),"damn");
+ }
+/*
+ static sal_uInt8 __READONLY_DATA aTest[] = {
+ 0x00, 0x02, 0x20, 0x00, 0x2B, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00,
+ 0x06, 0x00, 0x00, 0x80, 0x4C, 0x61, 0x62, 0x65,
+ 0x6C, 0x31, 0x18, 0x00, 0xEC, 0x09, 0x00, 0x00,
+ 0x7B, 0x02, 0x00, 0x00, 0x00, 0x02, 0x20, 0x00,
+ 0x35, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x80,
+ 0xC3, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
+ 0x54, 0x69, 0x6D, 0x65, 0x73, 0x20, 0x4E, 0x65,
+ 0x77, 0x20, 0x52, 0x6F, 0x6D, 0x61, 0x6E, 0x00,
+ };
+*/
+ SvStorageStreamRef xContents( rObj->OpenSotStream( C2S("contents")));
+ return WriteContents(xContents, rPropSet, rSize);
+}
+
+typedef OCX_Control *(*FNCreate)();
+
+
+struct OCX_map
+{
+ FNCreate pCreate;
+ const char *sId;
+ sal_Int16 nId;
+ const char *sName;
+};
+
+OCX_map aOCXTab[] =
+{
+ // Command button MUST be at index 0
+ {&OCX_CommandButton::Create,"D7053240-CE69-11CD-a777-00dd01143c57",
+ form::FormComponentType::COMMANDBUTTON,"CommandButton"},
+ // Toggle button MUST be at index 1
+ {&OCX_ToggleButton::Create,"8BD21D60-EC42-11CE-9e0d-00aa006002f3",
+ form::FormComponentType::COMMANDBUTTON,"ToggleButton"},
+ {&OCX_Label::Create, "978C9E23-D4B0-11CE-bf2d-00aa003f40d0",
+ form::FormComponentType::FIXEDTEXT,"Label"},
+ {&OCX_TextBox::Create,"8BD21D10-EC42-11CE-9e0d-00aa006002f3",
+ form::FormComponentType::TEXTFIELD,"TextBox"},
+ {&OCX_ListBox::Create,"8BD21D20-EC42-11CE-9e0d-00aa006002f3",
+ form::FormComponentType::LISTBOX,"ListBox"},
+ {&OCX_ComboBox::Create,"8BD21D30-EC42-11CE-9e0d-00aa006002f3",
+ form::FormComponentType::COMBOBOX,"ComboBox"},
+ {&OCX_CheckBox::Create,"8BD21D40-EC42-11CE-9e0d-00aa006002f3",
+ form::FormComponentType::CHECKBOX,"CheckBox"},
+ {&OCX_OptionButton::Create,"8BD21D50-EC42-11CE-9e0d-00aa006002f3",
+ form::FormComponentType::RADIOBUTTON,"OptionButton"},
+ {&OCX_Image::Create,"4C599241-6926-101B-9992-00000b65c6f9",
+ form::FormComponentType::IMAGECONTROL,"Image"},
+ {&OCX_FieldControl::Create,"8BD21D10-EC42-11CE-9e0d-00aa006002f3",
+ form::FormComponentType::DATEFIELD,"TextBox"},
+ {&OCX_FieldControl::Create,"8BD21D10-EC42-11CE-9e0d-00aa006002f3",
+ form::FormComponentType::TIMEFIELD,"TextBox"},
+ {&OCX_FieldControl::Create,"8BD21D10-EC42-11CE-9e0d-00aa006002f3",
+ form::FormComponentType::NUMERICFIELD,"TextBox"},
+ {&OCX_FieldControl::Create,"8BD21D10-EC42-11CE-9e0d-00aa006002f3",
+ form::FormComponentType::CURRENCYFIELD,"TextBox"},
+ {&OCX_FieldControl::Create,"8BD21D10-EC42-11CE-9e0d-00aa006002f3",
+ form::FormComponentType::PATTERNFIELD,"TextBox"},
+#if 0
+ {&OCX_FieldControl::Create,"8BD21D10-EC42-11CE-9e0d-00aa006002f3",
+ form::FormComponentType::FORMULAFIELD,"TextBox"},
+#endif
+ {&OCX_ImageButton::Create,"D7053240-CE69-11CD-a777-00dd01143c57",
+ form::FormComponentType::IMAGEBUTTON,"CommandButton"},
+ {&OCX_SpinButton::Create,"79176FB0-B7F2-11CE-97ef-00aa006d2776",
+ form::FormComponentType::SPINBUTTON,"SpinButton"},
+ {&OCX_ScrollBar::Create,"DFD181E0-5E2F-11CE-a449-00aa004a803d",
+ form::FormComponentType::SCROLLBAR,"ScrollBar"},
+ {&OCX_GroupBox::Create,"",
+ form::FormComponentType::GROUPBOX,""},
+ {&OCX_ProgressBar::Create,"",
+ form::FormComponentType::CONTROL,""}
+};
+
+const int NO_OCX = sizeof( aOCXTab ) / sizeof( *aOCXTab );
+
+SvxMSConvertOCXControls::SvxMSConvertOCXControls(SfxObjectShell *pDSh, SwPaM *pP) :
+ pDocSh(pDSh), pPaM(pP), nEdit(0), nCheckbox(0)
+{
+ DBG_ASSERT( pDocSh, "No DocShell, Cannot do Controls" );
+ OCX_Control::FillSystemColors();
+}
+
+SvxMSConvertOCXControls::~SvxMSConvertOCXControls()
+{
+}
+
+OCX_Control * SvxMSConvertOCXControls::OCX_Factory(const String &sName)
+{
+ for (int i=0;i<NO_OCX;i++)
+ {
+ if ( sName.EqualsIgnoreCaseAscii( aOCXTab[i].sId ))
+ return(aOCXTab[i].pCreate());
+ }
+ return(NULL);
+}
+
+OCX_Control * SvxMSConvertOCXControls::OCX_Factory(
+ const uno::Reference< awt::XControlModel > &rControlModel,
+ String &rId, String &rName)
+{
+ rName.Erase();
+ rId.Erase();
+
+ uno::Reference< beans::XPropertySet > xPropSet(
+ rControlModel,uno::UNO_QUERY);
+
+ uno::Any aTmp = xPropSet->getPropertyValue(
+ OUString::createFromAscii("ClassId"));
+ sal_Int16 nClassId = *(sal_Int16*) aTmp.getValue();
+
+//Begin nasty hack
+ /*
+ There is a truly horrible thing with EditControls and FormattedField
+ Controls, they both pretend to have an EDITBOX ClassId for compability
+ reasons, at some stage in the future hopefully there will be a proper
+ FormulaField ClassId rather than this piggybacking two controls onto the
+ same ClassId, when this happens uncomment the FORMULAFIELD in the OCX_Tab
+ and delete this block, cmc.
+
+ And also the nClassId for ImageControls is being reported as "CONTROL"
+ rather than IMAGECONTROL
+ */
+ if (nClassId == form::FormComponentType::TEXTFIELD)
+ {
+ uno::Reference< lang::XServiceInfo > xInfo(rControlModel,
+ uno::UNO_QUERY);
+ if (xInfo->
+ supportsService(OUString::createFromAscii(
+ "com.sun.star.form.component.FormattedField")))
+ {
+ rId.AppendAscii("8BD21D10-EC42-11CE-9e0d-00aa006002f3");
+ rName.AppendAscii("TextBox");
+ return new OCX_FieldControl;
+ }
+ }
+ else if (nClassId == form::FormComponentType::CONTROL)
+ {
+ uno::Reference< lang::XServiceInfo > xInfo(rControlModel,
+ uno::UNO_QUERY);
+ if (xInfo->
+ supportsService(OUString::createFromAscii(
+ "com.sun.star.form.component.ImageControl")))
+ nClassId = form::FormComponentType::IMAGECONTROL;
+ }
+//End nasty hack
+
+ const OCX_map* pEntry = 0;
+
+ // distinguish between push button and toggle button
+ if( nClassId == form::FormComponentType::COMMANDBUTTON )
+ {
+ pEntry = any2bool(xPropSet->getPropertyValue(WW8_ASCII2STR("Toggle"))) ?
+ (aOCXTab + 1) : aOCXTab;
+ }
+ else
+ {
+ for( int i = 2; (i < NO_OCX) && !pEntry; ++i )
+ if( nClassId == aOCXTab[ i ].nId )
+ pEntry = aOCXTab + i;
+ }
+
+ if( pEntry )
+ {
+ rId.AppendAscii( pEntry->sId );
+ rName.AppendAscii( pEntry->sName );
+ return pEntry->pCreate();
+ }
+
+ return 0;
+}
+
+
+sal_Bool SvxMSConvertOCXControls::ReadOCXStream( SvStorageRef& rSrc1,
+ uno::Reference < drawing::XShape > *pShapeRef,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,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)
+{
+ sal_Bool bRet=sal_False;
+
+ DBG_ASSERT( rControlModel.is(), "UNO-Control missing Model, panic!" );
+ if( !rControlModel.is() )
+ return sal_False;
+
+#if 0
+ uno::Any aTmp = xPropSet->getPropertyValue(
+ OUString::createFromAscii("ClassId"));
+ sal_Int16 nClassId = *(sal_Int16*) aTmp.getValue();
+#endif
+
+ String sId;
+ OCX_Control *pObj = OCX_Factory(rControlModel,sId,rName);
+ if (pObj != NULL)
+ {
+ uno::Reference<beans::XPropertySet> xPropSet(rControlModel,
+ uno::UNO_QUERY);
+
+ /* #117832# - also enable export of control name */
+ OUString sCName;
+ xPropSet->getPropertyValue(C2S("Name")) >>= sCName;
+ pObj->sName = sCName;
+
+ SvGlobalName aName;
+ aName.MakeId(sId);
+ String sFullName(String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM(
+ "Microsoft Forms 2.0 ")));
+ sFullName.Append(rName);
+ rSrc1->SetClass(aName,0x5C,sFullName);
+ // ^^^^, this pathetic 0x5c is the magic number
+ // which the lack of originally blocked the implementation of
+ // the controls export
+ // cmc
+
+ bRet = pObj->Export(rSrc1,xPropSet,rSize);
+ SvStorageStreamRef xStor2( rSrc1->OpenSotStream( WW8_ASCII2STR("\3OCXNAME")));
+ /* #117832# - also enable export of control name */
+ writeOCXNAME( sCName, xStor2 );
+ delete pObj;
+ }
+ return bRet;
+}
+
+
+//I think this should work for excel documents, create the "Ctls" stream
+//and give it here as rContents, we'll append out streams ole id and
+//contents here and that appears to be what Excel is doing
+sal_Bool SvxMSConvertOCXControls::WriteOCXExcelKludgeStream(
+ SvStorageStreamRef& rContents,
+ const uno::Reference< awt::XControlModel > &rControlModel,
+ const awt::Size &rSize, String &rName)
+{
+ sal_Bool bRet=sal_False;
+
+ DBG_ASSERT( rControlModel.is(), "UNO-Control missing Model, panic!" );
+ if( !rControlModel.is() )
+ return sal_False;
+
+ String sId;
+ OCX_Control *pObj = OCX_Factory(rControlModel,sId,rName);
+ if (pObj != NULL)
+ {
+ uno::Reference<beans::XPropertySet> xPropSet(rControlModel,
+ uno::UNO_QUERY);
+
+ SvGlobalName aName;
+ aName.MakeId(sId);
+ String sFullName(String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM(
+ "Microsoft Forms 2.0 ")));
+ sFullName.Append(rName);
+ SvStream *pS=rContents;
+ *pS << aName;
+ bRet = pObj->WriteContents(rContents,xPropSet,rSize);
+ delete pObj;
+ // export needs correct stream position
+ rContents->Seek( STREAM_SEEK_TO_END );
+ }
+ return bRet;
+}
+
+
+
+
+
+
+
+sal_Bool OCX_CheckBox::Import(com::sun::star::uno::Reference<
+ com::sun::star::beans::XPropertySet> &rPropSet)
+{
+ uno::Any aTmp(&sName,getCppuType((OUString *)0));
+ rPropSet->setPropertyValue( WW8_ASCII2STR("Name"), aTmp );
+
+ // background color: fBackStyle==0 -> transparent
+ if( fBackStyle )
+ aTmp <<= ImportColor(mnBackColor);
+ else
+ aTmp = uno::Any();
+ rPropSet->setPropertyValue( WW8_ASCII2STR("BackgroundColor"), aTmp);
+
+ sal_Bool bTemp;
+ if ((!(fEnabled)) || (fLocked))
+ bTemp = sal_False;
+ else
+ bTemp = sal_True;
+ aTmp = bool2any(bTemp);
+ rPropSet->setPropertyValue( WW8_ASCII2STR("Enabled"), aTmp);
+
+ bTemp = fWordWrap != 0;
+ aTmp = bool2any(bTemp);
+ rPropSet->setPropertyValue( WW8_ASCII2STR("MultiLine"), aTmp);
+
+ aTmp <<= ImportColor(mnForeColor);
+ rPropSet->setPropertyValue( WW8_ASCII2STR("TextColor"), aTmp);
+
+ bTemp = nMultiState;
+ aTmp = bool2any(bTemp);
+ rPropSet->setPropertyValue( WW8_ASCII2STR("TriState"), aTmp);
+
+ aTmp <<= ImportSpecEffect( nSpecialEffect );
+ rPropSet->setPropertyValue( WW8_ASCII2STR("VisualEffect"), aTmp);
+
+ if (pValue && !bSetInDialog)
+ {
+ INT16 nTmp=pValue[0]-0x30;
+ aTmp <<= nTmp;
+ rPropSet->setPropertyValue( WW8_ASCII2STR("DefaultState"), aTmp);
+ }
+
+ if (pCaption)
+ {
+ aTmp <<= lclCreateOUString( pCaption, nCaptionLen );
+ rPropSet->setPropertyValue( WW8_ASCII2STR("Label"), aTmp);
+ }
+
+ // #i40279# always centered vertically
+ aTmp <<= ::com::sun::star::style::VerticalAlignment_MIDDLE;
+ rPropSet->setPropertyValue( WW8_ASCII2STR("VerticalAlign"), aTmp );
+
+ aFontData.Import(rPropSet);
+ return(sal_True);
+}
+
+sal_Bool OCX_CheckBox::WriteContents(SvStorageStreamRef &rContents,
+ const uno::Reference< beans::XPropertySet > &rPropSet,
+ const awt::Size &rSize)
+
+{
+ sal_Bool bRet=sal_True;
+ sal_uInt32 nOldPos = rContents->Tell();
+ rContents->SeekRel(12);
+
+ pBlockFlags[0] = 0;
+ pBlockFlags[1] = 0x01;
+ pBlockFlags[2] = 0;
+ pBlockFlags[3] = 0x80;
+ pBlockFlags[4] = 0;
+ pBlockFlags[5] = 0;
+ pBlockFlags[6] = 0;
+ pBlockFlags[7] = 0;
+
+ uno::Any aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("Enabled"));
+ fEnabled = any2bool(aTmp);
+
+ aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("BackgroundColor"));
+ fBackStyle = aTmp.hasValue() ? 1 : 0;
+ if (fBackStyle)
+ aTmp >>= mnBackColor;
+
+ sal_uInt8 nTemp=fEnabled;
+ if (fEnabled)
+ nTemp = nTemp << 1;
+ if (fBackStyle)
+ nTemp |= 0x08;
+ *rContents << nTemp;
+ pBlockFlags[0] |= 0x01;
+ *rContents << sal_uInt8(0x00);
+ nTemp = 0;
+ aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("MultiLine"));
+ fWordWrap = any2bool(aTmp);
+ if (fWordWrap)
+ nTemp |= 0x80;
+ *rContents << nTemp;
+ *rContents << sal_uInt8(0x00);
+
+ *rContents << ExportColor(mnBackColor);
+ pBlockFlags[0] |= 0x02;
+
+ aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("TextColor"));
+ if (aTmp.hasValue())
+ aTmp >>= mnForeColor;
+ *rContents << ExportColor(mnForeColor);
+ pBlockFlags[0] |= 0x04;
+
+ nStyle = 4;
+ *rContents << nStyle;
+ pBlockFlags[0] |= 0x40;
+
+ aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("TriState"));
+ nMultiState = any2bool(aTmp);
+ *rContents << nMultiState;
+ pBlockFlags[2] |= 0x20;
+
+ WriteAlign(rContents,4);
+ nValueLen = 1|SVX_MSOCX_COMPRESSED;
+ aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("DefaultState"));
+ sal_Int16 nDefault = sal_Int16();
+ aTmp >>= nDefault;
+ *rContents << nValueLen;
+ pBlockFlags[2] |= 0x40;
+
+ SvxOcxString aCaption( rPropSet->getPropertyValue(WW8_ASCII2STR("Label")) );
+ aCaption.WriteLenField( *rContents );
+ if (aCaption.HasData())
+ pBlockFlags[2] |= 0x80;
+
+ aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("VisualEffect"));
+ if (aTmp.hasValue())
+ {
+ sal_Int16 nApiSpecEffect = sal_Int16();
+ aTmp >>= nApiSpecEffect;
+ nSpecialEffect = ExportSpecEffect( nApiSpecEffect );
+ }
+ WriteAlign(rContents,4);
+ *rContents << nSpecialEffect;
+ pBlockFlags[3] |= 0x04;
+
+ WriteAlign(rContents,4);
+ *rContents << rSize.Width;
+ *rContents << rSize.Height;
+
+ nDefault += 0x30;
+ *rContents << sal_uInt8(nDefault);
+ *rContents << sal_uInt8(0x00);
+
+ aCaption.WriteCharArray( *rContents );
+
+ WriteAlign(rContents,4);
+ nFixedAreaLen = static_cast<sal_uInt16>(rContents->Tell()-nOldPos-4);
+ bRet = aFontData.Export(rContents,rPropSet);
+ rContents->Seek(nOldPos);
+ *rContents << nStandardId;
+ *rContents << nFixedAreaLen;
+
+ *rContents << pBlockFlags[0];
+ *rContents << pBlockFlags[1];
+ *rContents << pBlockFlags[2];
+ *rContents << pBlockFlags[3];
+ *rContents << pBlockFlags[4];
+ *rContents << pBlockFlags[5];
+ *rContents << pBlockFlags[6];
+ *rContents << pBlockFlags[7];
+
+ DBG_ASSERT((rContents.Is() &&
+ (SVSTREAM_OK==rContents->GetError())),"damn");
+ return bRet;
+}
+
+
+sal_Bool OCX_CheckBox::Export(SvStorageRef &rObj,
+ const uno::Reference< beans::XPropertySet > &rPropSet,
+ const awt::Size &rSize)
+
+{
+ static sal_uInt8 __READONLY_DATA aCompObj[] = {
+ 0x01, 0x00, 0xFE, 0xFF, 0x03, 0x0A, 0x00, 0x00,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0x40, 0x1D, 0xD2, 0x8B,
+ 0x42, 0xEC, 0xCE, 0x11, 0x9E, 0x0D, 0x00, 0xAA,
+ 0x00, 0x60, 0x02, 0xF3, 0x1D, 0x00, 0x00, 0x00,
+ 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66,
+ 0x74, 0x20, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x20,
+ 0x32, 0x2E, 0x30, 0x20, 0x43, 0x68, 0x65, 0x63,
+ 0x6B, 0x42, 0x6F, 0x78, 0x00, 0x10, 0x00, 0x00,
+ 0x00, 0x45, 0x6D, 0x62, 0x65, 0x64, 0x64, 0x65,
+ 0x64, 0x20, 0x4F, 0x62, 0x6A, 0x65, 0x63, 0x74,
+ 0x00, 0x11, 0x00, 0x00, 0x00, 0x46, 0x6F, 0x72,
+ 0x6D, 0x73, 0x2E, 0x43, 0x68, 0x65, 0x63, 0x6B,
+ 0x42, 0x6F, 0x78, 0x2E, 0x31, 0x00, 0xF4, 0x39,
+ 0xB2, 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+
+ {
+ SvStorageStreamRef xStor( rObj->OpenSotStream( C2S("\1CompObj")));
+ xStor->Write(aCompObj,sizeof(aCompObj));
+ DBG_ASSERT((xStor.Is() && (SVSTREAM_OK == xStor->GetError())),"damn");
+ }
+
+ {
+ SvStorageStreamRef xStor3( rObj->OpenSotStream( C2S("\3ObjInfo")));
+ xStor3->Write(aObjInfo,sizeof(aObjInfo));
+ DBG_ASSERT((xStor3.Is() && (SVSTREAM_OK == xStor3->GetError())),"damn");
+ }
+
+ static sal_uInt8 __READONLY_DATA aOCXNAME[] = {
+ 0x43, 0x00, 0x68, 0x00, 0x65, 0x00, 0x63, 0x00,
+ 0x6B, 0x00, 0x42, 0x00, 0x6F, 0x00, 0x78, 0x00,
+ 0x31, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+ {
+ SvStorageStreamRef xStor2( rObj->OpenSotStream( C2S("\3OCXNAME")));
+ xStor2->Write(aOCXNAME,sizeof(aOCXNAME));
+ DBG_ASSERT((xStor2.Is() && (SVSTREAM_OK == xStor2->GetError())),"damn");
+ }
+/*
+ static sal_uInt8 __READONLY_DATA aTest[] = {
+ 0x00, 0x02, 0x34, 0x00, 0x46, 0x01, 0xC0, 0x80,
+ 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x80, 0x09, 0x00, 0x00, 0x80,
+ 0xE2, 0x0E, 0x00, 0x00, 0x95, 0x02, 0x00, 0x00,
+ 0x30, 0x69, 0x1D, 0x00, 0x43, 0x68, 0x65, 0x63,
+ 0x6B, 0x42, 0x6F, 0x78, 0x31, 0x20, 0x52, 0x6F,
+ 0x00, 0x02, 0x20, 0x00, 0x35, 0x00, 0x00, 0x00,
+ 0x0F, 0x00, 0x00, 0x80, 0xC3, 0x00, 0x00, 0x00,
+ 0x00, 0x02, 0x00, 0x00, 0x54, 0x69, 0x6D, 0x65,
+ 0x73, 0x20, 0x4E, 0x65, 0x77, 0x20, 0x52, 0x6F,
+ 0x6D, 0x61, 0x6E, 0x00,
+ };
+*/
+ SvStorageStreamRef xContents( rObj->OpenSotStream( C2S("contents")));
+ return WriteContents(xContents, rPropSet, rSize);
+}
+
+
+sal_Bool OCX_FontData::Read(SvStorageStream *pS)
+{
+ long nStart = pS->Tell();
+ *pS >> nIdentifier;
+ *pS >> nFixedAreaLen;
+ pS->Read(pBlockFlags,4);
+
+ bool bFontName = (pBlockFlags[0] & 0x01) != 0;
+ if (bFontName)
+ *pS >> nFontNameLen;
+ if (pBlockFlags[0] & 0x02)
+ {
+ sal_uInt8 nTmp;
+ *pS >> nTmp;
+ fBold = nTmp & 0x01;
+ fItalic = (nTmp & 0x02) >> 1;
+ fUnderline = (nTmp & 0x04) >> 2;
+ fStrike = (nTmp & 0x08) >> 3;
+ fUnknown1 = (nTmp & 0xF0) >> 4;
+ *pS >> nUnknown2;
+ *pS >> nUnknown3;
+ *pS >> nUnknown4;
+ }
+ if (pBlockFlags[0] & 0x04)
+ {
+ ReadAlign(pS, pS->Tell() - nStart, 4);
+ *pS >> nFontSize;
+ }
+ else
+ nFontSize = 240;
+ if (pBlockFlags[0] & 0x10)
+ {
+ ReadAlign(pS, pS->Tell() - nStart, 2);
+ *pS >> nLanguageID;
+ }
+ if (pBlockFlags[0] & 0x40)
+ {
+ *pS >> nJustification;
+ }
+ if (pBlockFlags[0] & 0x80) // font weight before font name
+ {
+ ReadAlign(pS, pS->Tell() - nStart, 2);
+ *pS >> nFontWeight;
+ }
+
+ if (bFontName)
+ lclReadCharArray( *pS, pFontName, nFontNameLen, pS->Tell() - nStart);
+
+ ReadAlign(pS, pS->Tell() - nStart, 4);
+ return(TRUE);
+}
+
+void OCX_FontData::Import(uno::Reference< beans::XPropertySet > &rPropSet)
+{
+ uno::Any aTmp;
+ if (pFontName)
+ {
+ aTmp <<= lclCreateOUString( pFontName, nFontNameLen );
+ rPropSet->setPropertyValue( WW8_ASCII2STR("FontName"), aTmp);
+ }
+
+ if (bHasAlign)
+ {
+ sal_Int16 nAlign = ImportAlign(nJustification);
+ aTmp <<= nAlign;
+ rPropSet->setPropertyValue( WW8_ASCII2STR("Align"), aTmp);
+ }
+
+ if (fBold)
+ {
+ aTmp <<= awt::FontWeight::BOLD;
+ rPropSet->setPropertyValue( WW8_ASCII2STR("FontWeight"), aTmp);
+ }
+
+ if (fItalic)
+ {
+ aTmp <<= (sal_Int16)awt::FontSlant_ITALIC;
+ rPropSet->setPropertyValue( WW8_ASCII2STR("FontSlant"), aTmp);
+ }
+
+ if (fUnderline)
+ {
+ aTmp <<= awt::FontUnderline::SINGLE;
+ rPropSet->setPropertyValue( WW8_ASCII2STR("FontUnderline"), aTmp);
+ }
+
+ if (fStrike)
+ {
+ aTmp <<= awt::FontStrikeout::SINGLE;
+ rPropSet->setPropertyValue( WW8_ASCII2STR("FontStrikeout"), aTmp);
+ }
+
+ // 2004-09-17: very strange way of storing font sizes...
+ // 1pt->30, 2pt->45, 3pt->60, 4pt->75, 5pt->105, 6pt->120, 7pt->135
+ // 8pt->165, 9pt->180, 10pt->195, 11pt->225, ...
+ aTmp <<= sal_Int16( (nFontSize <= 30) ? 1 : ((nFontSize + 10) / 20) );
+ rPropSet->setPropertyValue( WW8_ASCII2STR("FontHeight"), aTmp);
+}
+
+sal_Bool OCX_FontData::Export(SvStorageStreamRef &rContent,
+ const uno::Reference< beans::XPropertySet > &rPropSet)
+{
+ sal_uInt8 nFlags=0x00;
+ sal_uInt32 nOldPos = rContent->Tell();
+ rContent->SeekRel(8);
+ SvxOcxString aFontName;
+ uno::Any aTmp;
+
+ if (bHasFont)
+ aFontName = rPropSet->getPropertyValue(WW8_ASCII2STR("FontName"));
+ if (!aFontName.HasData())
+ aFontName = OUString( RTL_CONSTASCII_USTRINGPARAM( "Times New Roman" ) );
+ aFontName.WriteLenField( *rContent );
+ nFlags |= 0x01;
+
+ if (bHasFont)
+ {
+ aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("FontWeight"));
+ float nBold = 0;
+ aTmp >>= nBold;
+
+ if (nBold >= 150)
+ {
+ nFlags |= 0x02;
+ sal_uInt8 nTmp=0x01;
+ *rContent << nTmp;
+ nTmp=0x00;
+ *rContent << nTmp;
+ *rContent << nTmp;
+ *rContent << nTmp;
+ }
+
+ aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("FontHeight"));
+ float nFontHeight = 0;
+ aTmp >>= nFontHeight;
+ if (nFontHeight)
+ {
+ nFlags |= 0x04;
+ // 2004-09-17: very strange way of storing font sizes:
+ // 1pt->30, 2pt->45, 3pt->60, 4pt->75, 5pt->105, 6pt->120, 7pt->135
+ // 8pt->165, 9pt->180, 10pt->195, 11pt->225, ...
+ nFontSize = (nFontHeight == 1) ? 30 : (static_cast<sal_uInt32>((nFontHeight*4+1)/3)*15);
+ *rContent << nFontSize;
+ }
+
+ if (bHasAlign)
+ {
+ *rContent << sal_uInt16(0x0200);
+ nFlags |= 0x10;
+
+ nFlags |= 0x20; // ?
+
+ aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("Align"));
+ nFlags |= 0x40;
+ sal_Int16 nAlign(0);
+ if (aTmp.hasValue())
+ aTmp >>= nAlign;
+ nJustification = ExportAlign(nAlign);
+ *rContent << nJustification;
+ }
+ }
+
+ aFontName.WriteCharArray( *rContent );
+ WriteAlign(rContent,4);
+
+ sal_uInt16 nFixedAreaLn = static_cast<sal_uInt16>(rContent->Tell()-nOldPos-4);
+ rContent->Seek(nOldPos);
+ *rContent << nStandardId;
+ *rContent << nFixedAreaLn;
+ *rContent << nFlags;
+ *rContent << sal_uInt8(0x00);
+ *rContent << sal_uInt8(0x00);
+ *rContent << sal_uInt8(0x00);
+
+ WriteAlign(rContent,4);
+ return sal_True;
+}
+
+// Doesn't really read anything but just skips the
+// record.
+sal_Bool OCX_TabStrip::Read(SotStorageStream *pS)
+{
+ const long skipLen = 0x18;
+ *pS >> nIdentifier;
+ DBG_ASSERT(nStandardId==nIdentifier,
+ "A control that has a different identifier");
+ *pS >> nFixedAreaLen;
+
+ pS->Read(pBlockFlags, sizeof(pBlockFlags));
+ pS->SeekRel(skipLen);
+ *pS >> nNumTabs;
+ // skip to end of control
+ pS->SeekRel(nFixedAreaLen - sizeof(pBlockFlags) - sizeof(nNumTabs) - skipLen );
+ return sal_True;
+}
+
+sal_Bool OCX_TabStrip::ReadFontData(SotStorageStream *pS)
+{
+ // Seems like there is a real font record followed by
+ // a number of blank records ( e.g. nFixedAreaLen = 0 )
+ // The number of trailing blank records is equal to the number of tabs
+ OCX_Control::ReadFontData(pS);
+ for ( sal_uInt16 index = 0; index < nNumTabs; index++ )
+ {
+ OCX_Control::Read(pS); // read trailing records
+ }
+ return sal_True;
+}
+
+sal_Bool OCX_Image::Read(SotStorageStream *pS)
+{
+ if ( !bSetInDialog )
+ {
+ // preserve the present behavior at the moment.
+ // only import image control for UserForms
+ return sal_False;
+ }
+ ULONG nStart = pS->Tell();
+ *pS >> nIdentifier;
+ DBG_ASSERT(nStandardId==nIdentifier,
+ "A control that has a different identifier");
+ *pS >> nFixedAreaLen;
+
+ pS->Read(pBlockFlags, sizeof(pBlockFlags));
+
+ bool hasEmbeddedImage = false;
+
+ if ( pBlockFlags[0] & 0x04 )
+ {
+ bAutoSize = true;
+ }
+ if ( pBlockFlags[0] & 0x08 )
+ {
+ *pS >> nBorderColor;
+ }
+ if ( pBlockFlags[0] & 0x10 )
+ {
+ *pS >> mnBackColor;
+ }
+ if ( pBlockFlags[0] & 0x20 )
+ {
+ *pS >> nBorderStyle;
+ }
+ if ( pBlockFlags[0] & 0x40 )
+ {
+ *pS >> nMousePointer;
+ }
+ if ( pBlockFlags[0] & 0x80 )
+ {
+ *pS >> nPictureSizeMode;
+ }
+
+ if ( pBlockFlags[ 1 ] & 0x1 )
+ {
+ *pS >> nSpecialEffect;
+ }
+ // investigate if valid also for formcontrols, although for controls
+ // images themselves seem to come through from escher ( as shape, think
+ // its probably a preview? )
+
+ // np a bit of a guess ( until proved incorrect )
+ if ( pBlockFlags[ 1 ] & 0x4 )
+ {
+ ReadAlign(pS, pS->Tell() - nStart, 2);
+ hasEmbeddedImage = true;
+ sal_uInt16 unknown;
+ *pS >> unknown;
+ }
+
+
+ if ( pBlockFlags[ 1 ] & 0x8 )
+ {
+ ReadAlign(pS, pS->Tell() - nStart, 2);
+ *pS >> nPictureAlignment;
+
+ }
+ if ( pBlockFlags[ 1 ] & 0x10 )
+ {
+ bPictureTiling = true;
+ }
+ if ( pBlockFlags[1] & 0x20 )
+ {
+ ReadAlign(pS, pS->Tell() - nStart, 4);
+ sal_uInt8 nTemp;
+ *pS >> nTemp;
+ fEnabled = (nTemp&0x02)>>1;
+ fBackStyle = (nTemp&0x08)>>3;
+ // padding?
+ *pS >> nTemp;
+ *pS >> nTemp;
+ *pS >> nTemp;
+ }
+ ReadAlign(pS, pS->Tell() - nStart, 4);
+ *pS >> nWidth;
+ *pS >> nHeight;
+
+ if ( hasEmbeddedImage )
+ {
+ //image follows this block
+ //len of image is 0x14 relative to end of this block
+ pS->Seek( pS->Tell() + 0x14 );
+
+ sal_uInt32 nImageLen = 0;
+ *pS >> nImageLen;
+
+ long imagePos = pS->Tell();
+
+ pS->Seek( imagePos );
+
+ sImageUrl = C2U("vnd.sun.star.expand:${$BRAND_BASE_DIR/program/") + C2U( SAL_CONFIGFILE( "bootstrap" ) ) + C2U("::UserInstallation}/user/temp/") + sName;
+
+ sal_uInt8* pImage = new sal_uInt8[ nImageLen ];
+ pS->Read(pImage, nImageLen);
+ bool result = storePictureInFileSystem( sImageUrl, pImage, nImageLen );
+ OUString pictName = sImageUrl.copy( sImageUrl.lastIndexOf('/') + 1 );
+ result = storePictureInDoc( pDocSh, pictName, pImage, nImageLen );
+ delete [] pImage;
+ }
+ return sal_True;
+}
+
+sal_Bool OCX_Image::Import( uno::Reference< beans::XPropertySet > &rPropSet )
+{
+ uno::Any aTmp(&sName,getCppuType((OUString *)0));
+ rPropSet->setPropertyValue( WW8_ASCII2STR("Name"), aTmp );
+
+ if( fBackStyle )
+ aTmp <<= ImportColor(mnBackColor);
+ else
+ aTmp = uno::Any();
+ rPropSet->setPropertyValue( WW8_ASCII2STR("BackgroundColor"), aTmp);
+
+ sal_Bool bTemp;
+ if (fEnabled)
+ bTemp = sal_True;
+ else
+ bTemp = sal_False;
+ aTmp = bool2any(bTemp);
+ rPropSet->setPropertyValue( WW8_ASCII2STR("Enabled"), aTmp);
+ if ( sImageUrl.getLength() )
+ {
+ aTmp <<= sImageUrl;
+ rPropSet->setPropertyValue( WW8_ASCII2STR("ImageURL"), aTmp);
+ }
+ return sal_True;
+}
+
+sal_Bool OCX_Image::WriteContents(SvStorageStreamRef &rContents,
+ const uno::Reference< beans::XPropertySet > &rPropSet,
+ const awt::Size &rSize)
+{
+ sal_Bool bRet=sal_True;
+ sal_uInt32 nOldPos = rContents->Tell();
+ rContents->SeekRel(8);
+
+ pBlockFlags[0] = 0;
+ pBlockFlags[1] = 0x02;
+ pBlockFlags[2] = 0;
+ pBlockFlags[3] = 0;
+
+ uno::Any aTmp = rPropSet->getPropertyValue(
+ WW8_ASCII2STR("BackgroundColor"));
+ if (aTmp.hasValue())
+ aTmp >>= mnBackColor;
+ *rContents << ExportColor(mnBackColor);
+ pBlockFlags[0] |= 0x10;
+
+
+ aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("Border"));
+ sal_Int16 nBorder = sal_Int16();
+ aTmp >>= nBorder;
+ nSpecialEffect = ExportBorder(nBorder,nBorderStyle);
+ *rContents << nBorderStyle;
+ pBlockFlags[0] |= 0x20;
+
+ *rContents << nSpecialEffect;
+ pBlockFlags[1] |= 0x01;
+
+ WriteAlign(rContents,4);
+
+ aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("Enabled"));
+ fEnabled = any2bool(aTmp);
+ if (fEnabled)
+ {
+ sal_uInt8 nTemp = 0x19;
+ *rContents << nTemp;
+ pBlockFlags[1] |= 0x20;
+ *rContents << sal_uInt8(0x00);
+ *rContents << sal_uInt8(0x00);
+ *rContents << sal_uInt8(0x00);
+ }
+
+ aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("ImageURL"));
+// OUString *pStr = (OUString *)aTmp.getValue();
+ /*Magically fetch that image and turn it into something that
+ *we can store in ms controls, wmf,png,jpg are almost certainly
+ *the options we have for export...*/
+
+ WriteAlign(rContents,4);
+ *rContents << rSize.Width;
+ *rContents << rSize.Height;
+
+ WriteAlign(rContents,4);
+ nFixedAreaLen = static_cast<sal_uInt16>(rContents->Tell()-nOldPos-4);
+
+ rContents->Seek(nOldPos);
+ *rContents << nStandardId;
+ *rContents << nFixedAreaLen;
+
+ *rContents << pBlockFlags[0];
+ *rContents << pBlockFlags[1];
+ *rContents << pBlockFlags[2];
+ *rContents << pBlockFlags[3];
+ DBG_ASSERT((rContents.Is() &&
+ (SVSTREAM_OK==rContents->GetError())),"damn");
+ return bRet;
+}
+
+
+sal_Bool OCX_Image::Export(SvStorageRef &rObj,
+ const uno::Reference< beans::XPropertySet > &rPropSet,
+ const awt::Size &rSize)
+{
+ static sal_uInt8 __READONLY_DATA aCompObj[] = {
+ 0x01, 0x00, 0xFE, 0xFF, 0x03, 0x0A, 0x00, 0x00,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0x41, 0x92, 0x59, 0x4C,
+ 0x26, 0x69, 0x1B, 0x10, 0x99, 0x92, 0x00, 0x00,
+ 0x0B, 0x65, 0xC6, 0xF9, 0x1A, 0x00, 0x00, 0x00,
+ 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66,
+ 0x74, 0x20, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x20,
+ 0x32, 0x2E, 0x30, 0x20, 0x49, 0x6D, 0x61, 0x67,
+ 0x65, 0x00, 0x10, 0x00, 0x00, 0x00, 0x45, 0x6D,
+ 0x62, 0x65, 0x64, 0x64, 0x65, 0x64, 0x20, 0x4F,
+ 0x62, 0x6A, 0x65, 0x63, 0x74, 0x00, 0x0E, 0x00,
+ 0x00, 0x00, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x2E,
+ 0x49, 0x6D, 0x61, 0x67, 0x65, 0x2E, 0x31, 0x00,
+ 0xF4, 0x39, 0xB2, 0x71, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+
+ {
+ SvStorageStreamRef xStor( rObj->OpenSotStream( C2S("\1CompObj")));
+ xStor->Write(aCompObj,sizeof(aCompObj));
+ DBG_ASSERT((xStor.Is() && (SVSTREAM_OK == xStor->GetError())),"damn");
+ }
+
+ {
+ SvStorageStreamRef xStor3( rObj->OpenSotStream( C2S("\3ObjInfo")));
+ xStor3->Write(aObjInfo,sizeof(aObjInfo));
+ DBG_ASSERT((xStor3.Is() && (SVSTREAM_OK == xStor3->GetError())),"damn");
+ }
+
+ static sal_uInt8 __READONLY_DATA aOCXNAME[] = {
+ 0x49, 0x00, 0x6D, 0x00, 0x61, 0x00, 0x67, 0x00,
+ 0x65, 0x00, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+
+ {
+ SvStorageStreamRef xStor2( rObj->OpenSotStream( C2S("\3OCXNAME")));
+ xStor2->Write(aOCXNAME,sizeof(aOCXNAME));
+ DBG_ASSERT((xStor2.Is() && (SVSTREAM_OK == xStor2->GetError())),"damn");
+ }
+
+ SvStorageStreamRef xContents( rObj->OpenSotStream( C2S("contents")));
+ return WriteContents(xContents, rPropSet, rSize);
+}
+
+// ============================================================================
+
+OCX_SpinButton::OCX_SpinButton() :
+ OCX_Control( OUString( RTL_CONSTASCII_USTRINGPARAM( "SpinButton" ) ) ),
+ mnBlockFlags( 0 ),
+ mnValue( 0 ),
+ mnMin( 0 ),
+ mnMax( 100 ),
+ mnSmallStep( 1 ),
+ mnPageStep( 1 ),
+ mnOrient( -1 ),
+ mnDelay( 50 ),
+ mbEnabled( true ),
+ mbLocked( false ),
+ mbPropThumb( true )
+{
+ msFormType = C2U("com.sun.star.form.component.SpinButton");
+ msDialogType = C2U("com.sun.star.awt.UnoControlSpinButtonModel");
+ mnBackColor = 0x8000000F;
+ mnForeColor = 0x80000012;
+}
+
+OCX_Control* OCX_SpinButton::Create()
+{
+ return new OCX_SpinButton;
+}
+
+sal_Bool OCX_SpinButton::Read( SvStorageStream *pS )
+{
+ if( !pS ) return sal_False;
+
+ SvStream& rStrm = *pS;
+ sal_uInt16 nId, nSize;
+ sal_Int32 nIcon = 0;
+
+ rStrm >> nId >> nSize >> mnBlockFlags;
+
+ DBG_ASSERT( nStandardId == nId, "OCX_SpinButton::Read - unknown identifier" );
+
+ if( mnBlockFlags & 0x00000001 ) rStrm >> mnForeColor;
+ if( mnBlockFlags & 0x00000002 ) rStrm >> mnBackColor;
+ if( mnBlockFlags & 0x00000004 )
+ {
+ sal_Int32 nFlags;
+ rStrm >> nFlags;
+ mbEnabled = (nFlags & 0x00000002) != 0;
+ mbLocked = (nFlags & 0x00000004) != 0;
+ }
+ if( mnBlockFlags & 0x00000010 ) rStrm.SeekRel( 4 ); // mouse pointer
+ if( mnBlockFlags & 0x00000020 ) rStrm >> mnMin;
+ if( mnBlockFlags & 0x00000040 ) rStrm >> mnMax;
+ if( mnBlockFlags & 0x00000080 ) rStrm >> mnValue;
+ if( mnBlockFlags & 0x00000100 ) rStrm.SeekRel( 4 ); // unknown
+ if( mnBlockFlags & 0x00000200 ) rStrm.SeekRel( 4 ); // unknown
+ if( mnBlockFlags & 0x00000400 ) rStrm.SeekRel( 4 ); // unknown
+ if( mnBlockFlags & 0x00000800 ) rStrm >> mnSmallStep;
+ if( mnBlockFlags & 0x00001000 ) rStrm >> mnPageStep;
+ if( mnBlockFlags & 0x00002000 ) rStrm >> mnOrient;
+ if( mnBlockFlags & 0x00004000 )
+ {
+ sal_Int32 nThumb;
+ *pS >> nThumb;
+ mbPropThumb = nThumb != 0;
+ }
+ if( mnBlockFlags & 0x00008000 ) rStrm >> mnDelay;
+ if( mnBlockFlags & 0x00010000 ) rStrm >> nIcon;
+ if( mnBlockFlags & 0x00000008 ) rStrm >> nWidth >> nHeight;
+
+ if( nIcon )
+ {
+ sal_Int32 nIconSize;
+ pS->SeekRel( 20 );
+ *pS >> nIconSize;
+ pS->SeekRel( nIconSize );
+ }
+
+ return sal_True;
+}
+
+sal_Bool OCX_SpinButton::ReadFontData( SvStorageStream* /* pS */ )
+{
+ // spin buttons and scroll bars do not support font data
+ return sal_True;
+}
+
+sal_Bool OCX_SpinButton::Import(com::sun::star::uno::Reference<
+ com::sun::star::beans::XPropertySet> &rPropSet)
+{
+ if( (nWidth < 1) || (nHeight < 1) )
+ return sal_False;
+
+ uno::Any aTmp( &sName, getCppuType((OUString *)0) );
+ rPropSet->setPropertyValue( WW8_ASCII2STR( "Name" ), aTmp );
+
+ aTmp <<= ImportColor( mnForeColor );
+ rPropSet->setPropertyValue( WW8_ASCII2STR("SymbolColor"), aTmp);
+
+ aTmp <<= ImportColor( mnBackColor );
+ rPropSet->setPropertyValue( WW8_ASCII2STR("BackgroundColor"), aTmp);
+
+ aTmp = bool2any( mbEnabled && !mbLocked );
+ rPropSet->setPropertyValue( WW8_ASCII2STR("Enabled"), aTmp);
+
+ aTmp <<= mnValue;
+ if ( bSetInDialog )
+ {
+ rPropSet->setPropertyValue( WW8_ASCII2STR("SpinValue"), aTmp );
+ }
+ else
+ {
+ rPropSet->setPropertyValue( WW8_ASCII2STR("DefaultSpinValue"), aTmp );
+ }
+
+ aTmp <<= mnMin;
+ rPropSet->setPropertyValue( WW8_ASCII2STR("SpinValueMin"), aTmp );
+
+ aTmp <<= mnMax;
+ rPropSet->setPropertyValue( WW8_ASCII2STR("SpinValueMax"), aTmp );
+
+ aTmp <<= mnSmallStep;
+ rPropSet->setPropertyValue( WW8_ASCII2STR("SpinIncrement"), aTmp );
+
+ namespace AwtScrollOrient = ::com::sun::star::awt::ScrollBarOrientation;
+ switch( mnOrient )
+ {
+ case 0: aTmp <<= AwtScrollOrient::VERTICAL; break;
+ case 1: aTmp <<= AwtScrollOrient::HORIZONTAL; break;
+ default: aTmp <<= (nWidth < nHeight) ? AwtScrollOrient::VERTICAL : AwtScrollOrient::HORIZONTAL;
+ }
+ rPropSet->setPropertyValue( WW8_ASCII2STR("Orientation"), aTmp );
+
+ aTmp = bool2any( true );
+ rPropSet->setPropertyValue( WW8_ASCII2STR("Repeat"), aTmp );
+
+ aTmp <<= mnDelay;
+ rPropSet->setPropertyValue( WW8_ASCII2STR("RepeatDelay"), aTmp );
+
+ aTmp <<= sal_Int16( 0 );
+ rPropSet->setPropertyValue( WW8_ASCII2STR("Border"), aTmp);
+
+ return sal_True;
+}
+
+sal_Bool OCX_SpinButton::Export(
+ SvStorageRef &rObj,
+ const uno::Reference< beans::XPropertySet>& rPropSet,
+ const awt::Size& rSize )
+{
+ static sal_uInt8 __READONLY_DATA aCompObj[] =
+ {
+ 0x01, 0x00, 0xFE, 0xFF, 0x03, 0x0A, 0x00, 0x00,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xB0, 0x6F, 0x17, 0x79,
+ 0xF2, 0xB7, 0xCE, 0x11, 0x97, 0xEF, 0x00, 0xAA,
+ 0x00, 0x6D, 0x27, 0x76, 0x1F, 0x00, 0x00, 0x00,
+ 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66,
+ 0x74, 0x20, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x20,
+ 0x32, 0x2E, 0x30, 0x20, 0x53, 0x70, 0x69, 0x6E,
+ 0x42, 0x75, 0x74, 0x74, 0x6F, 0x6E, 0x00, 0x10,
+ 0x00, 0x00, 0x00, 0x45, 0x6D, 0x62, 0x65, 0x64,
+ 0x64, 0x65, 0x64, 0x20, 0x4F, 0x62, 0x6A, 0x65,
+ 0x63, 0x74, 0x00, 0x13, 0x00, 0x00, 0x00, 0x46,
+ 0x6E, 0x42, 0x75, 0x74, 0x74, 0x6F, 0x6E, 0x2E,
+ 0x31, 0x00, 0xF4, 0x39, 0xB2, 0x71, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00
+ };
+
+ {
+ SvStorageStreamRef xStor( rObj->OpenSotStream( C2S("\1CompObj")));
+ xStor->Write(aCompObj,sizeof(aCompObj));
+ DBG_ASSERT((xStor.Is() && (SVSTREAM_OK == xStor->GetError())),"damn");
+ }
+
+ {
+ SvStorageStreamRef xStor3( rObj->OpenSotStream( C2S("\3ObjInfo")));
+ xStor3->Write(aObjInfo,sizeof(aObjInfo));
+ DBG_ASSERT((xStor3.Is() && (SVSTREAM_OK == xStor3->GetError())),"damn");
+ }
+
+ static sal_uInt8 __READONLY_DATA aOCXNAME[] =
+ {
+ 0x53, 0x00, 0x70, 0x00, 0x69, 0x00, 0x6E, 0x00,
+ 0x42, 0x00, 0x75, 0x00, 0x74, 0x00, 0x74, 0x00,
+ 0x6F, 0x00, 0x6E, 0x00, 0x31, 0x00, 0x00, 0x00,
+ 0x00, 0x00
+ };
+
+ {
+ SvStorageStreamRef xStor2( rObj->OpenSotStream( C2S("\3OCXNAME")));
+ xStor2->Write(aOCXNAME,sizeof(aOCXNAME));
+ DBG_ASSERT((xStor2.Is() && (SVSTREAM_OK == xStor2->GetError())),"damn");
+ }
+
+ SvStorageStreamRef xContents( rObj->OpenSotStream( C2S("contents")));
+ return WriteContents(xContents, rPropSet, rSize);
+}
+
+sal_Bool OCX_SpinButton::WriteContents(
+ SvStorageStreamRef &rObj,
+ const uno::Reference< beans::XPropertySet> &rPropSet,
+ const awt::Size& rSize )
+{
+ if( !rObj.Is() )
+ return sal_False;
+
+ mnBlockFlags = 0x00000008;
+ nWidth = rSize.Width;
+ nHeight = rSize.Height;
+
+ GetInt32Property( mnForeColor, rPropSet, WW8_ASCII2STR( "SymbolColor" ), 0x00000001 );
+ GetInt32Property( mnBackColor, rPropSet, WW8_ASCII2STR( "BackgroundColor" ), 0x00000002 );
+ GetBoolProperty( mbEnabled, rPropSet, WW8_ASCII2STR( "Enabled" ), 0x00000304 );
+ GetInt32Property( mnMin, rPropSet, WW8_ASCII2STR( "SpinValueMin" ), 0x00000020 );
+ GetInt32Property( mnMax, rPropSet, WW8_ASCII2STR( "SpinValueMax" ), 0x00000040 );
+ GetInt32Property( mnValue, rPropSet, WW8_ASCII2STR( "SpinValue" ), 0x00000080 );
+ GetInt32Property( mnSmallStep, rPropSet, WW8_ASCII2STR( "SpinIncrement" ), 0x00000800 );
+ GetInt32Property( mnDelay, rPropSet, WW8_ASCII2STR( "RepeatDelay" ), 0x00008000 );
+
+ namespace AwtScrollOrient = ::com::sun::star::awt::ScrollBarOrientation;
+ sal_Int16 nApiOrient = sal_Int16();
+ if( rPropSet->getPropertyValue( WW8_ASCII2STR( "Orientation" ) ) >>= nApiOrient )
+ UpdateInt32Property( mnOrient, (nApiOrient == AwtScrollOrient::VERTICAL) ? 0 : 1, 0x00002000 );
+
+ return WriteData( *rObj );
+}
+
+void OCX_SpinButton::UpdateInt32Property(
+ sal_Int32& rnCoreValue, sal_Int32 nNewValue, sal_Int32 nBlockFlag )
+{
+ if( nNewValue != rnCoreValue )
+ {
+ rnCoreValue = nNewValue;
+ mnBlockFlags |= nBlockFlag;
+ }
+}
+
+void OCX_SpinButton::GetInt32Property(
+ sal_Int32& rnCoreValue, const uno::Reference< beans::XPropertySet>& rxPropSet,
+ const OUString& rPropName, sal_Int32 nBlockFlag )
+{
+ sal_Int32 nNewValue = 0;
+ if( rxPropSet->getPropertyValue( rPropName ) >>= nNewValue )
+ UpdateInt32Property( rnCoreValue, nNewValue, nBlockFlag );
+}
+
+void OCX_SpinButton::UpdateBoolProperty(
+ bool& rbCoreValue, bool bNewValue, sal_Int32 nBlockFlag )
+{
+ if( bNewValue != rbCoreValue )
+ {
+ rbCoreValue = bNewValue;
+ mnBlockFlags |= nBlockFlag;
+ }
+}
+
+void OCX_SpinButton::GetBoolProperty(
+ bool& rbCoreValue, const uno::Reference< beans::XPropertySet>& rxPropSet,
+ const OUString& rPropName, sal_Int32 nBlockFlag )
+{
+ UpdateBoolProperty( rbCoreValue,
+ any2bool( rxPropSet->getPropertyValue( rPropName ) ), nBlockFlag );
+}
+
+sal_Bool OCX_SpinButton::WriteData( SvStream& rStrm ) const
+{
+ sal_Bool bRet = sal_True;
+ ULONG nStartPos = rStrm.Tell();
+
+ rStrm << sal_Int32( 0 ) << mnBlockFlags;
+
+ if( mnBlockFlags & 0x00000001 ) rStrm << ExportColor( mnForeColor );
+ if( mnBlockFlags & 0x00000002 ) rStrm << ExportColor( mnBackColor );
+ if( mnBlockFlags & 0x00000004 )
+ {
+ sal_Int32 nFlags = 0x00000019; // always set
+ if( mbEnabled ) nFlags |= 0x00000002;
+ if( mbLocked ) nFlags |= 0x00000004;
+ rStrm << nFlags;
+ }
+ if( mnBlockFlags & 0x00000020 ) rStrm << mnMin;
+ if( mnBlockFlags & 0x00000040 ) rStrm << mnMax;
+ if( mnBlockFlags & 0x00000080 ) rStrm << mnValue;
+ if( mnBlockFlags & 0x00000100 ) rStrm << sal_Int32( 0 ); // unknown
+ if( mnBlockFlags & 0x00000200 ) rStrm << sal_Int32( 0 ); // unknown
+ if( mnBlockFlags & 0x00000400 ) rStrm << sal_Int32( 0 ); // unknown
+ if( mnBlockFlags & 0x00000800 ) rStrm << mnSmallStep;
+ if( mnBlockFlags & 0x00001000 ) rStrm << mnPageStep;
+ if( mnBlockFlags & 0x00002000 ) rStrm << mnOrient;
+ if( mnBlockFlags & 0x00004000 ) rStrm << sal_Int32( mbPropThumb ? 1 : 0 );
+ if( mnBlockFlags & 0x00008000 ) rStrm << mnDelay;
+ if( mnBlockFlags & 0x00000008 ) rStrm << nWidth << nHeight;
+
+ sal_uInt16 nSize = static_cast< sal_uInt16 >( rStrm.Tell() - nStartPos - 4 );
+ rStrm.Seek( nStartPos );
+ rStrm << nStandardId << nSize;
+
+ DBG_ASSERT( rStrm.GetError() == SVSTREAM_OK, "OCX_SpinButton::WriteData - error in stream" );
+ return bRet;
+}
+
+// ============================================================================
+
+OCX_ScrollBar::OCX_ScrollBar()
+{
+ sName = OUString( RTL_CONSTASCII_USTRINGPARAM( "ScrollBar" ) );
+ mnMax = 32767;
+ msFormType = C2U("com.sun.star.form.component.ScrollBar");
+ msDialogType = C2U("com.sun.star.awt.UnoControlScrollBarModel");
+
+}
+
+OCX_Control* OCX_ScrollBar::Create()
+{
+ return new OCX_ScrollBar;
+}
+
+sal_Bool OCX_ScrollBar::Import(com::sun::star::uno::Reference<
+ com::sun::star::beans::XPropertySet> &rPropSet)
+{
+ if( (nWidth < 1) || (nHeight < 1) )
+ return sal_False;
+
+ uno::Any aTmp( &sName, getCppuType((OUString *)0) );
+ rPropSet->setPropertyValue( WW8_ASCII2STR( "Name" ), aTmp );
+
+ aTmp <<= ImportColor( mnForeColor );
+ rPropSet->setPropertyValue( WW8_ASCII2STR("SymbolColor"), aTmp);
+
+ aTmp <<= ImportColor( mnBackColor );
+ rPropSet->setPropertyValue( WW8_ASCII2STR("BackgroundColor"), aTmp);
+
+ aTmp = bool2any( mbEnabled && !mbLocked );
+ rPropSet->setPropertyValue( WW8_ASCII2STR("Enabled"), aTmp);
+
+ aTmp <<= mnValue;
+ if ( bSetInDialog )
+ {
+ rPropSet->setPropertyValue( WW8_ASCII2STR("ScrollValue"), aTmp );
+ }
+ else
+ {
+ rPropSet->setPropertyValue( WW8_ASCII2STR("DefaultScrollValue"), aTmp );
+ }
+
+ aTmp <<= mnMin;
+ rPropSet->setPropertyValue( WW8_ASCII2STR("ScrollValueMin"), aTmp );
+
+ aTmp <<= mnMax;
+ rPropSet->setPropertyValue( WW8_ASCII2STR("ScrollValueMax"), aTmp );
+
+ aTmp <<= mnSmallStep;
+ rPropSet->setPropertyValue( WW8_ASCII2STR("LineIncrement"), aTmp );
+
+ aTmp <<= mnPageStep;
+ rPropSet->setPropertyValue( WW8_ASCII2STR("BlockIncrement"), aTmp );
+ if( mbPropThumb && (mnPageStep > 0) )
+ rPropSet->setPropertyValue( WW8_ASCII2STR("VisibleSize"), aTmp );
+
+ namespace AwtScrollOrient = ::com::sun::star::awt::ScrollBarOrientation;
+ switch( mnOrient )
+ {
+ case 0: aTmp <<= AwtScrollOrient::VERTICAL; break;
+ case 1: aTmp <<= AwtScrollOrient::HORIZONTAL; break;
+ default: aTmp <<= (nWidth < nHeight) ? AwtScrollOrient::VERTICAL : AwtScrollOrient::HORIZONTAL;
+ }
+ rPropSet->setPropertyValue( WW8_ASCII2STR("Orientation"), aTmp );
+
+ aTmp <<= mnDelay;
+ rPropSet->setPropertyValue( WW8_ASCII2STR("RepeatDelay"), aTmp );
+
+ aTmp <<= sal_Int16( 0 );
+ rPropSet->setPropertyValue( WW8_ASCII2STR("Border"), aTmp);
+
+ return sal_True;
+}
+
+sal_Bool OCX_ScrollBar::Export(
+ SvStorageRef &rObj,
+ const uno::Reference< beans::XPropertySet>& rPropSet,
+ const awt::Size& rSize )
+{
+ static sal_uInt8 __READONLY_DATA aCompObj[] =
+ {
+ 0x01, 0x00, 0xFE, 0xFF, 0x03, 0x0A, 0x00, 0x00,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xE0, 0x81, 0xD1, 0xDF,
+ 0x2F, 0x5E, 0xCE, 0x11, 0xA4, 0x49, 0x00, 0xAA,
+ 0x00, 0x4A, 0x80, 0x3D, 0x1E, 0x00, 0x00, 0x00,
+ 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66,
+ 0x74, 0x20, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x20,
+ 0x32, 0x2E, 0x30, 0x20, 0x53, 0x63, 0x72, 0x6F,
+ 0x6C, 0x6C, 0x42, 0x61, 0x72, 0x00, 0x10, 0x00,
+ 0x00, 0x00, 0x45, 0x6D, 0x62, 0x65, 0x64, 0x64,
+ 0x65, 0x64, 0x20, 0x4F, 0x62, 0x6A, 0x65, 0x63,
+ 0x74, 0x00, 0x12, 0x00, 0x00, 0x00, 0x46, 0x6F,
+ 0x72, 0x6D, 0x73, 0x2E, 0x53, 0x63, 0x72, 0x6F,
+ 0x6C, 0x6C, 0x42, 0x61, 0x72, 0x2E, 0x31, 0x00,
+ 0xF4, 0x39, 0xB2, 0x71, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+
+ {
+ SvStorageStreamRef xStor( rObj->OpenSotStream( C2S("\1CompObj")));
+ xStor->Write(aCompObj,sizeof(aCompObj));
+ DBG_ASSERT((xStor.Is() && (SVSTREAM_OK == xStor->GetError())),"damn");
+ }
+
+ {
+ SvStorageStreamRef xStor3( rObj->OpenSotStream( C2S("\3ObjInfo")));
+ xStor3->Write(aObjInfo,sizeof(aObjInfo));
+ DBG_ASSERT((xStor3.Is() && (SVSTREAM_OK == xStor3->GetError())),"damn");
+ }
+
+ static sal_uInt8 __READONLY_DATA aOCXNAME[] =
+ {
+ 0x53, 0x00, 0x63, 0x00, 0x72, 0x00, 0x6F, 0x00,
+ 0x6C, 0x00, 0x6C, 0x00, 0x42, 0x00, 0x61, 0x00,
+ 0x72, 0x00, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+
+ {
+ SvStorageStreamRef xStor2( rObj->OpenSotStream( C2S("\3OCXNAME")));
+ xStor2->Write(aOCXNAME,sizeof(aOCXNAME));
+ DBG_ASSERT((xStor2.Is() && (SVSTREAM_OK == xStor2->GetError())),"damn");
+ }
+
+ SvStorageStreamRef xContents( rObj->OpenSotStream( C2S("contents")));
+ return WriteContents(xContents, rPropSet, rSize);
+}
+
+sal_Bool OCX_ScrollBar::WriteContents(
+ SvStorageStreamRef &rObj,
+ const uno::Reference< beans::XPropertySet> &rPropSet,
+ const awt::Size& rSize )
+{
+ if( !rObj.Is() )
+ return sal_False;
+
+ mnBlockFlags = 0x00000008;
+ nWidth = rSize.Width;
+ nHeight = rSize.Height;
+
+ GetInt32Property( mnForeColor, rPropSet, WW8_ASCII2STR( "SymbolColor" ), 0x00000001 );
+ GetInt32Property( mnBackColor, rPropSet, WW8_ASCII2STR( "BackgroundColor" ), 0x00000002 );
+ GetBoolProperty( mbEnabled, rPropSet, WW8_ASCII2STR( "Enabled" ), 0x00000304 );
+ GetInt32Property( mnMin, rPropSet, WW8_ASCII2STR( "ScrollValueMin" ), 0x00000020 );
+ GetInt32Property( mnMax, rPropSet, WW8_ASCII2STR( "ScrollValueMax" ), 0x00000040 );
+ GetInt32Property( mnValue, rPropSet, WW8_ASCII2STR( "ScrollValue" ), 0x00000080 );
+ GetInt32Property( mnSmallStep, rPropSet, WW8_ASCII2STR( "LineIncrement" ), 0x00000800 );
+ GetInt32Property( mnPageStep, rPropSet, WW8_ASCII2STR( "BlockIncrement" ), 0x00001000 );
+ GetInt32Property( mnDelay, rPropSet, WW8_ASCII2STR( "RepeatDelay" ), 0x00008000 );
+
+ namespace AwtScrollOrient = ::com::sun::star::awt::ScrollBarOrientation;
+ sal_Int16 nApiOrient = sal_Int16();
+ if( rPropSet->getPropertyValue( WW8_ASCII2STR( "Orientation" ) ) >>= nApiOrient )
+ UpdateInt32Property( mnOrient, (nApiOrient == AwtScrollOrient::VERTICAL) ? 0 : 1, 0x00002000 );
+
+ UpdateBoolProperty( mbPropThumb, true, 0x00004000 );
+
+ return WriteData( *rObj );
+}
+
+OCX_ProgressBar::OCX_ProgressBar() :
+ OCX_Control( OUString( RTL_CONSTASCII_USTRINGPARAM( "ProgressBar" ) ) ),
+ nMin( 0 ),
+ nMax( 0 ),
+ bFixedSingle(true),
+ bEnabled( true ),
+ b3d( true )
+{
+ msDialogType = C2U("com.sun.star.awt.UnoControlProgressBarModel");
+ bSetInDialog = true;
+}
+
+sal_Bool OCX_ProgressBar::Read( SvStorageStream *pS )
+{
+ pS->SeekRel( 8 );
+ *pS >> nWidth >> nHeight;
+ pS->SeekRel( 12 );
+
+ float fMin, fMax;
+ *pS >> fMin >> fMax;
+ nMin = static_cast< sal_Int32 >( fMin );
+ nMax = static_cast< sal_Int32 >( fMax );
+ bool bVisible = true;
+ sal_uInt8 pUnknownFlags[4];
+ pS->Read(pUnknownFlags,4);
+
+ // complete guess, but we don't handle visible anyway
+ if ( ( pUnknownFlags[2] & 0x8 ) && ( pUnknownFlags[2] & 0x2 ) )
+ bVisible = false;
+
+ sal_uInt32 nFlags;
+ *pS >> nFlags;
+
+ // seems these work out
+ bFixedSingle = (nFlags & 0x01) != 0;
+ bEnabled = (nFlags & 0x02) != 0;
+ b3d = (nFlags & 0x04) != 0;
+
+ return true;
+}
+
+OCX_Control* OCX_ProgressBar::Create()
+{
+ return new OCX_ProgressBar;
+}
+
+sal_Bool OCX_ProgressBar::Import(uno::Reference< beans::XPropertySet > &rPropSet)
+{
+ uno::Any aTmp(&sName,getCppuType((OUString *)0));
+ rPropSet->setPropertyValue( WW8_ASCII2STR("Name"), aTmp );
+ aTmp <<= nMax;
+ rPropSet->setPropertyValue( WW8_ASCII2STR("ProgressValueMax"), aTmp );
+ aTmp <<= nMin;
+ rPropSet->setPropertyValue( WW8_ASCII2STR("ProgressValueMin"), aTmp );
+
+ if ( !bEnabled )
+ rPropSet->setPropertyValue( WW8_ASCII2STR("Enabled"), uno::makeAny( sal_False ) );
+ return sal_True;
+}
+// ============================================================================
+
+/* vi:set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/filter/source/msfilter/msoleexp.cxx b/filter/source/msfilter/msoleexp.cxx
new file mode 100644
index 000000000000..ebafd06688b0
--- /dev/null
+++ b/filter/source/msfilter/msoleexp.cxx
@@ -0,0 +1,364 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/embed/XEmbedPersist.hpp>
+#include <com/sun/star/embed/NoVisualAreaSizeException.hpp>
+#include <com/sun/star/embed/EmbedStates.hpp>
+#include <com/sun/star/frame/XStorable.hpp>
+#include <com/sun/star/awt/Size.hpp>
+#include <com/sun/star/embed/Aspects.hpp>
+#include <sot/clsids.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/docfac.hxx>
+#include <sfx2/docfilt.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/fcontnr.hxx>
+#include <sot/formats.hxx>
+#include <comphelper/processfactory.hxx>
+#include <unotools/streamwrap.hxx>
+#include <comphelper/storagehelper.hxx>
+#include <svtools/embedhlp.hxx>
+#include <filter/msfilter/msdffimp.hxx> // extern sichtbare Header-Datei
+
+#include "filter/msfilter/msoleexp.hxx"
+
+#define CREATE_CONST_ASC(s) String::CreateFromAscii( \
+ RTL_CONSTASCII_STRINGPARAM(s))
+
+using namespace ::com::sun::star;
+
+SvGlobalName GetEmbeddedVersion( const SvGlobalName& aAppName )
+{
+ if ( aAppName == SvGlobalName( SO3_SM_CLASSID_60 ) )
+ return SvGlobalName( SO3_SM_OLE_EMBED_CLASSID_8 );
+ else if ( aAppName == SvGlobalName( SO3_SW_CLASSID_60 ) )
+ return SvGlobalName( SO3_SW_OLE_EMBED_CLASSID_8 );
+ else if ( aAppName == SvGlobalName( SO3_SC_CLASSID_60 ) )
+ return SvGlobalName( SO3_SC_OLE_EMBED_CLASSID_8 );
+ else if ( aAppName == SvGlobalName( SO3_SDRAW_CLASSID_60 ) )
+ return SvGlobalName( SO3_SDRAW_OLE_EMBED_CLASSID_8 );
+ else if ( aAppName == SvGlobalName( SO3_SIMPRESS_CLASSID_60 ) )
+ return SvGlobalName( SO3_SIMPRESS_OLE_EMBED_CLASSID_8 );
+ else if ( aAppName == SvGlobalName( SO3_SCH_CLASSID_60 ) )
+ return SvGlobalName( SO3_SCH_OLE_EMBED_CLASSID_8 );
+
+ return SvGlobalName();
+}
+
+String GetStorageType( const SvGlobalName& aEmbName )
+{
+ if ( aEmbName == SvGlobalName( SO3_SM_OLE_EMBED_CLASSID_8 ) )
+ return String::CreateFromAscii( "opendocument.MathDocument.1" );
+ else if ( aEmbName == SvGlobalName( SO3_SW_OLE_EMBED_CLASSID_8 ) )
+ return String::CreateFromAscii( "opendocument.WriterDocument.1" );
+ else if ( aEmbName == SvGlobalName( SO3_SC_OLE_EMBED_CLASSID_8 ) )
+ return String::CreateFromAscii( "opendocument.CalcDocument.1" );
+ else if ( aEmbName == SvGlobalName( SO3_SDRAW_OLE_EMBED_CLASSID_8 ) )
+ return String::CreateFromAscii( "opendocument.DrawDocument.1" );
+ else if ( aEmbName == SvGlobalName( SO3_SIMPRESS_OLE_EMBED_CLASSID_8 ) )
+ return String::CreateFromAscii( "opendocument.ImpressDocument.1" );
+ else if ( aEmbName == SvGlobalName( SO3_SCH_OLE_EMBED_CLASSID_8 ) )
+ return String::CreateFromAscii( "opendocument.ChartDocument.1" );
+
+ return String();
+}
+
+sal_Bool UseOldMSExport()
+{
+ uno::Reference< lang::XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory();
+
+ if ( xFactory.is() )
+ {
+ uno::Reference< lang::XMultiServiceFactory > xProvider( xFactory->createInstance(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationProvider"))),
+ uno::UNO_QUERY);
+ if ( xProvider.is() )
+ {
+ try {
+ uno::Sequence< uno::Any > aArg( 1 );
+ aArg[0] <<= rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Common/InternalMSExport") );
+ uno::Reference< container::XNameAccess > xNameAccess(
+ xProvider->createInstanceWithArguments(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationUpdateAccess" ) ),
+ aArg ),
+ uno::UNO_QUERY );
+ if ( xNameAccess.is() )
+ {
+ uno::Any aResult = xNameAccess->getByName(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UseOldExport" ) ) );
+
+ sal_Bool bResult = sal_Bool();
+ if ( aResult >>= bResult )
+ return bResult;
+ }
+ }
+ catch( uno::Exception& )
+ {
+ }
+ }
+ }
+
+ OSL_ENSURE( sal_False, "Could not get access to configuration entry!\n" );
+ return sal_False;
+}
+
+void SvxMSExportOLEObjects::ExportOLEObject( const com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject>& rObj, SotStorage& rDestStg )
+{
+ svt::EmbeddedObjectRef aObj( rObj, embed::Aspects::MSOLE_CONTENT );
+ ExportOLEObject( aObj, rDestStg );
+}
+
+void SvxMSExportOLEObjects::ExportOLEObject( svt::EmbeddedObjectRef& rObj, SvStorage& rDestStg )
+{
+ SvGlobalName aOwnGlobalName;
+ SvGlobalName aObjName( rObj->getClassID() );
+ const SfxFilter* pExpFilter = NULL;
+ {
+ static struct _ObjExpType {
+ UINT32 nFlag;
+ const char* pFilterNm;
+ // GlobalNameId
+ struct _GlobalNameIds {
+ UINT32 n1;
+ USHORT n2, n3;
+ BYTE b8, b9, b10, b11, b12, b13, b14, b15;
+ }
+ aGlNmIds[4];
+ } aArr[] = {
+ { OLE_STARMATH_2_MATHTYPE, "MathType 3.x",
+ {{SO3_SM_CLASSID_60}, {SO3_SM_CLASSID_50},
+ {SO3_SM_CLASSID_40}, {SO3_SM_CLASSID_30 }}},
+ { OLE_STARWRITER_2_WINWORD, "MS Word 97",
+ {{SO3_SW_CLASSID_60}, {SO3_SW_CLASSID_50},
+ {SO3_SW_CLASSID_40}, {SO3_SW_CLASSID_30 }}},
+ { OLE_STARCALC_2_EXCEL, "MS Excel 97",
+ {{SO3_SC_CLASSID_60}, {SO3_SC_CLASSID_50},
+ {SO3_SC_CLASSID_40}, {SO3_SC_CLASSID_30 }}},
+ { OLE_STARIMPRESS_2_POWERPOINT, "MS PowerPoint 97",
+ {{SO3_SIMPRESS_CLASSID_60}, {SO3_SIMPRESS_CLASSID_50},
+ {SO3_SIMPRESS_CLASSID_40}, {SO3_SIMPRESS_CLASSID_30 }}},
+ { 0, "",
+ {{SO3_SCH_CLASSID_60}, {SO3_SCH_CLASSID_50},
+ {SO3_SCH_CLASSID_40}, {SO3_SCH_CLASSID_30 }}},
+ { 0, "",
+ {{SO3_SDRAW_CLASSID_60}, {SO3_SDRAW_CLASSID_50}, // SJ: !!!! SO3_SDRAW_CLASSID is only available up from
+ {SO3_SDRAW_CLASSID_60}, {SO3_SDRAW_CLASSID_50 }}}, // ver 5.0, it is purpose to have double entrys here.
+
+ { 0xffff,0,
+ {{SO3_SDRAW_CLASSID_60}, {SO3_SDRAW_CLASSID_50},
+ {SO3_SDRAW_CLASSID_60}, {SO3_SDRAW_CLASSID_50}}}
+ };
+
+ for( const _ObjExpType* pArr = aArr; !pExpFilter && ( pArr->nFlag != 0xffff ); ++pArr )
+ {
+ for ( int n = 0; n < 4; ++n )
+ {
+ const _ObjExpType::_GlobalNameIds& rId = pArr->aGlNmIds[ n ];
+ SvGlobalName aGlbNm( rId.n1, rId.n2, rId.n3,
+ rId.b8, rId.b9, rId.b10, rId.b11,
+ rId.b12, rId.b13, rId.b14, rId.b15 );
+ if( aObjName == aGlbNm )
+ {
+ aOwnGlobalName = aGlbNm;
+
+ // flags for checking if conversion is wanted at all (SaveOptions?!)
+ if( GetFlags() & pArr->nFlag )
+ {
+ pExpFilter = SfxFilterMatcher().GetFilter4FilterName(String::CreateFromAscii(pArr->pFilterNm));
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ if( pExpFilter ) // use this filter for the export
+ {
+ try
+ {
+ if ( rObj->getCurrentState() == embed::EmbedStates::LOADED )
+ rObj->changeState( embed::EmbedStates::RUNNING );
+ //TODO/LATER: is stream instead of outputstream a better choice?!
+ //TODO/LATER: a "StoreTo" method at embedded object would be nice
+ uno::Sequence < beans::PropertyValue > aSeq(2);
+ SvStream* pStream = new SvMemoryStream;
+ aSeq[0].Name = ::rtl::OUString::createFromAscii( "OutputStream" );
+ ::uno::Reference < io::XOutputStream > xOut = new ::utl::OOutputStreamWrapper( *pStream );
+ aSeq[0].Value <<= xOut;
+ aSeq[1].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FilterName" ) );
+ aSeq[1].Value <<= ::rtl::OUString( pExpFilter->GetName() );
+ uno::Reference < frame::XStorable > xStor( rObj->getComponent(), uno::UNO_QUERY );
+ xStor->storeToURL( ::rtl::OUString::createFromAscii( "private:stream" ), aSeq );
+ SotStorageRef xOLEStor = new SotStorage( pStream, TRUE );
+ xOLEStor->CopyTo( &rDestStg );
+ rDestStg.Commit();
+ }
+ catch( uno::Exception& )
+ {
+ // TODO/LATER: Error handling
+ DBG_ERROR( "The object could not be exported!" );
+ }
+ }
+ else if( aOwnGlobalName != SvGlobalName() )
+ {
+ // own format, maybe SO6 format or lower
+ SvGlobalName aEmbName = GetEmbeddedVersion( aOwnGlobalName );
+ if ( aEmbName != SvGlobalName() && !UseOldMSExport() )
+ {
+ // this is a SO6 embedded object, save in old binary format
+ rDestStg.SetVersion( SOFFICE_FILEFORMAT_31 );
+ rDestStg.SetClass( aEmbName,
+ SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE,
+ GetStorageType( aEmbName ) );
+ SotStorageStreamRef xExtStm = rDestStg.OpenSotStream(
+ String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "properties_stream" ) ),
+ STREAM_STD_READWRITE );
+
+ sal_Bool bExtentSuccess = sal_False;
+ if( !xExtStm->GetError() )
+ {
+ // write extent
+ //TODO/MBA: check if writing a size is enough
+ if( rObj.GetObject().is() )
+ {
+ // MSOLE objects don't need to be in running state for VisualArea access
+ awt::Size aSize;
+ try
+ {
+ // this is an own object, the content size must be stored in the
+ // extension stream
+ aSize = rObj->getVisualAreaSize( embed::Aspects::MSOLE_CONTENT );
+ }
+ catch( embed::NoVisualAreaSizeException& )
+ {
+ OSL_ENSURE( sal_False, "Could not get visual area size!\n" );
+ aSize.Width = 5000;
+ aSize.Height = 5000;
+ }
+ catch( uno::Exception& )
+ {
+ OSL_ENSURE( sal_False, "Unexpected exception while getting visual area size!\n" );
+ aSize.Width = 5000;
+ aSize.Height = 5000;
+ }
+
+ //Rectangle aVisArea = xSfxIPObj->GetVisArea( ASPECT_CONTENT );
+ sal_Int32 pRect[4];
+ //pRect[0] = aVisArea.Left();
+ //pRect[1] = aVisArea.Right();
+ //pRect[2] = aVisArea.Top();
+ //pRect[3] = aVisArea.Bottom();
+ pRect[0] = 0;
+ pRect[1] = aSize.Width;
+ pRect[2] = 0;
+ pRect[3] = aSize.Height;
+
+ sal_Int8 aWriteSet[16];
+ for ( int ind = 0; ind < 4; ind++ )
+ {
+ sal_Int32 nVal = pRect[ind];
+ for ( int nByte = 0; nByte < 4; nByte++ )
+ {
+ aWriteSet[ind*4+nByte] = (sal_Int8) nVal % 0x100;
+ nVal /= 0x100;
+ }
+ }
+
+ bExtentSuccess = ( xExtStm->Write( aWriteSet, 16 ) == 16 );
+ }
+ }
+
+ if ( bExtentSuccess )
+ {
+ SotStorageStreamRef xEmbStm = rDestStg.OpenSotStream(
+ String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "package_stream" ) ),
+ STREAM_STD_READWRITE );
+ if( !xEmbStm->GetError() )
+ {
+ try
+ {
+ if ( rObj->getCurrentState() == embed::EmbedStates::LOADED )
+ rObj->changeState( embed::EmbedStates::RUNNING );
+ //TODO/LATER: is stream instead of outputstream a better choice?!
+ //TODO/LATER: a "StoreTo" method at embedded object would be nice
+ uno::Sequence < beans::PropertyValue > aSeq(1);
+ aSeq[0].Name = ::rtl::OUString::createFromAscii( "OutputStream" );
+ ::uno::Reference < io::XOutputStream > xOut = new ::utl::OOutputStreamWrapper( *xEmbStm );
+ aSeq[0].Value <<= xOut;
+ uno::Reference < frame::XStorable > xStor( rObj->getComponent(), uno::UNO_QUERY );
+ xStor->storeToURL( ::rtl::OUString::createFromAscii( "private:stream" ), aSeq );
+ }
+ catch( uno::Exception& )
+ {
+ // TODO/LATER: Error handling
+ DBG_ERROR( "The object could not be exported!" );
+ }
+ }
+ }
+ }
+ else
+ {
+ DBG_ERROR("Own binary format inside own container document!");
+ }
+ }
+ else
+ {
+ // alien objects
+ //TODO/LATER: a "StoreTo" method at embedded object would be nice
+ rDestStg.SetVersion( SOFFICE_FILEFORMAT_31 );
+ uno::Reference < embed::XStorage > xStor = ::comphelper::OStorageHelper::GetTemporaryStorage();
+ uno::Reference < embed::XEmbedPersist > xPers( rObj.GetObject(), uno::UNO_QUERY );
+ if ( xPers.is() )
+ {
+ uno::Sequence < beans::PropertyValue > aEmptySeq;
+ ::rtl::OUString aTempName(::rtl::OUString::createFromAscii("bla"));
+ try
+ {
+ xPers->storeToEntry( xStor, aTempName, aEmptySeq, aEmptySeq );
+ }
+ catch ( uno::Exception& )
+ {}
+
+ SotStorageRef xOLEStor = SotStorage::OpenOLEStorage( xStor, aTempName, STREAM_STD_READ );
+ xOLEStor->CopyTo( &rDestStg );
+ rDestStg.Commit();
+ }
+ }
+
+ //We never need this stream: See #99809# and #i2179#
+ rDestStg.Remove(CREATE_CONST_ASC(SVEXT_PERSIST_STREAM));
+}
+
+
+
diff --git a/filter/source/msfilter/msvbahelper.cxx b/filter/source/msfilter/msvbahelper.cxx
new file mode 100644
index 000000000000..18ecc5ae6530
--- /dev/null
+++ b/filter/source/msfilter/msvbahelper.cxx
@@ -0,0 +1,399 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include <filter/msfilter/msvbahelper.hxx>
+#include <basic/sbx.hxx>
+#include <basic/sbstar.hxx>
+#include <basic/basmgr.hxx>
+#include <basic/sbmod.hxx>
+#include <basic/sbmeth.hxx>
+#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
+#include <com/sun/star/document/XDocumentProperties.hpp>
+#include <com/sun/star/document/XDocumentInfoSupplier.hpp>
+#include <tools/urlobj.hxx>
+#include <osl/file.hxx>
+
+using namespace ::com::sun::star;
+
+namespace ooo { namespace vba {
+
+const static rtl::OUString sUrlPart0 = rtl::OUString::createFromAscii( "vnd.sun.star.script:");
+const static rtl::OUString sUrlPart1 = rtl::OUString::createFromAscii( "?language=Basic&location=document");
+
+String makeMacroURL( const String& sMacroName )
+{
+ return sUrlPart0.concat( sMacroName ).concat( sUrlPart1 ) ;
+}
+
+::rtl::OUString extractMacroName( const ::rtl::OUString& rMacroUrl )
+{
+ if( (rMacroUrl.getLength() > sUrlPart0.getLength() + sUrlPart1.getLength()) &&
+ rMacroUrl.match( sUrlPart0 ) &&
+ rMacroUrl.match( sUrlPart1, rMacroUrl.getLength() - sUrlPart1.getLength() ) )
+ {
+ return rMacroUrl.copy( sUrlPart0.getLength(), rMacroUrl.getLength() - sUrlPart0.getLength() - sUrlPart1.getLength() );
+ }
+ return ::rtl::OUString();
+}
+
+SfxObjectShell* findShellForUrl( const rtl::OUString& sMacroURLOrPath )
+{
+ SfxObjectShell* pFoundShell=NULL;
+ SfxObjectShell* pShell = SfxObjectShell::GetFirst();
+ INetURLObject aObj;
+ aObj.SetURL( sMacroURLOrPath );
+ bool bIsURL = aObj.GetProtocol() != INET_PROT_NOT_VALID;
+ rtl::OUString aURL;
+ if ( bIsURL )
+ aURL = sMacroURLOrPath;
+ else
+ {
+ osl::FileBase::getFileURLFromSystemPath( sMacroURLOrPath, aURL );
+ aObj.SetURL( aURL );
+ }
+ OSL_TRACE("Trying to find shell for url %s", rtl::OUStringToOString( aURL, RTL_TEXTENCODING_UTF8 ).getStr() );
+ while ( pShell )
+ {
+
+ uno::Reference< frame::XModel > xModel = pShell->GetModel();
+ // are we searching for a template? if so we have to cater for the
+ // fact that in openoffice a document opened from a template is always
+ // a new document :/
+ if ( xModel.is() )
+ {
+ OSL_TRACE("shell 0x%x has model with url %s and we look for %s", pShell
+ , rtl::OUStringToOString( xModel->getURL(), RTL_TEXTENCODING_UTF8 ).getStr()
+ , rtl::OUStringToOString( aURL, RTL_TEXTENCODING_UTF8 ).getStr()
+ );
+ if ( sMacroURLOrPath.endsWithIgnoreAsciiCaseAsciiL( ".dot", 4 ) )
+ {
+ uno::Reference< document::XDocumentInfoSupplier > xDocInfoSupp( xModel, uno::UNO_QUERY );
+ if( xDocInfoSupp.is() )
+ {
+ uno::Reference< document::XDocumentPropertiesSupplier > xDocPropSupp( xDocInfoSupp->getDocumentInfo(), uno::UNO_QUERY_THROW );
+ uno::Reference< document::XDocumentProperties > xDocProps( xDocPropSupp->getDocumentProperties(), uno::UNO_QUERY_THROW );
+ rtl::OUString sCurrName = xDocProps->getTemplateName();
+ if( sMacroURLOrPath.lastIndexOf( sCurrName ) >= 0 )
+ {
+ pFoundShell = pShell;
+ break;
+ }
+ }
+ }
+ else
+ {
+ if ( aURL.equals( xModel->getURL() ) )
+ {
+ pFoundShell = pShell;
+ break;
+ }
+ }
+ }
+ pShell = SfxObjectShell::GetNext( *pShell );
+ }
+ return pFoundShell;
+}
+
+// sMod can be empty ( but we really need the library to search in )
+// if sMod is empty and a macro is found then sMod is updated
+bool hasMacro( SfxObjectShell* pShell, const String& sLibrary, String& sMod, const String& sMacro )
+{
+ bool bFound = false;
+ if ( sLibrary.Len() && sMacro.Len() )
+ {
+ OSL_TRACE("** Searching for %s.%s in library %s"
+ ,rtl::OUStringToOString( sMod, RTL_TEXTENCODING_UTF8 ).getStr()
+ ,rtl::OUStringToOString( sMacro, RTL_TEXTENCODING_UTF8 ).getStr()
+ ,rtl::OUStringToOString( sLibrary, RTL_TEXTENCODING_UTF8 ).getStr() );
+ BasicManager* pBasicMgr = pShell-> GetBasicManager();
+ if ( pBasicMgr )
+ {
+ StarBASIC* pBasic = pBasicMgr->GetLib( sLibrary );
+ if ( !pBasic )
+ {
+ USHORT nId = pBasicMgr->GetLibId( sLibrary );
+ pBasicMgr->LoadLib( nId );
+ pBasic = pBasicMgr->GetLib( sLibrary );
+ }
+ if ( pBasic )
+ {
+ if ( sMod.Len() ) // we wish to find the macro is a specific module
+ {
+ SbModule* pModule = pBasic->FindModule( sMod );
+ if ( pModule )
+ {
+ SbxArray* pMethods = pModule->GetMethods();
+ if ( pMethods )
+ {
+ SbMethod* pMethod = static_cast< SbMethod* >( pMethods->Find( sMacro, SbxCLASS_METHOD ) );
+ if ( pMethod )
+ bFound = true;
+ }
+ }
+ }
+ else if( SbMethod* pMethod = dynamic_cast< SbMethod* >( pBasic->Find( sMacro, SbxCLASS_METHOD ) ) )
+ {
+ if( SbModule* pModule = pMethod->GetModule() )
+ {
+ sMod = pModule->GetName();
+ bFound = true;
+ }
+ }
+ }
+ }
+ }
+ return bFound;
+}
+void parseMacro( const rtl::OUString& sMacro, String& sContainer, String& sModule, String& sProcedure )
+{
+ sal_Int32 nMacroDot = sMacro.lastIndexOf( '.' );
+
+ if ( nMacroDot != -1 )
+ {
+ sProcedure = sMacro.copy( nMacroDot + 1 );
+
+ sal_Int32 nContainerDot = sMacro.lastIndexOf( '.', nMacroDot - 1 );
+ if ( nContainerDot != -1 )
+ {
+ sModule = sMacro.copy( nContainerDot + 1, nMacroDot - nContainerDot - 1 );
+ sContainer = sMacro.copy( 0, nContainerDot );
+ }
+ else
+ sModule = sMacro.copy( 0, nMacroDot );
+ }
+ else
+ sProcedure = sMacro;
+}
+
+VBAMacroResolvedInfo resolveVBAMacro( SfxObjectShell* pShell, const rtl::OUString& MacroName, bool bSearchGlobalTemplates )
+{
+ VBAMacroResolvedInfo aRes;
+ if ( !pShell )
+ return aRes;
+ aRes.SetMacroDocContext( pShell );
+
+ // the name may be enclosed in apostrophs
+ ::rtl::OUString sMacroUrl = MacroName;
+ sal_Int32 nMacroLen = MacroName.getLength();
+ if( (nMacroLen >= 2) && (MacroName[0] == '\'') && (MacroName[nMacroLen-1] == '\'') )
+ sMacroUrl = MacroName.copy( 1, nMacroLen - 2 );
+
+ // parse the macro name
+ sal_Int32 nDocSepIndex = sMacroUrl.indexOf( '!' );
+
+ String sContainer;
+ String sModule;
+ String sProcedure;
+
+ if( nDocSepIndex > 0 )
+ {
+ // macro specified by document name
+ // find document shell for document name and call ourselves
+ // recursively
+
+ // assume for now that the document name is *this* document
+ String sDocUrlOrPath = sMacroUrl.copy( 0, nDocSepIndex );
+ sMacroUrl = sMacroUrl.copy( nDocSepIndex + 1 );
+ OSL_TRACE("doc search, current shell is 0x%x", pShell );
+ SfxObjectShell* pFoundShell = findShellForUrl( sDocUrlOrPath );
+ OSL_TRACE("doc search, after find, found shell is 0x%x", pFoundShell );
+ aRes = resolveVBAMacro( pFoundShell, sMacroUrl );
+ }
+ else
+ {
+ // macro is contained in 'this' document ( or code imported from a template
+ // where that template is a global template or perhaps the template this
+ // document is created from )
+
+ // macro format = Container.Module.Procedure
+ parseMacro( sMacroUrl, sContainer, sModule, sProcedure );
+ uno::Reference< lang::XMultiServiceFactory> xSF( pShell->GetModel(), uno::UNO_QUERY);
+ uno::Reference< container::XNameContainer > xPrjNameCache;
+ if ( xSF.is() )
+ xPrjNameCache.set( xSF->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAProjectNameProvider" ) ) ), uno::UNO_QUERY );
+
+ std::vector< rtl::OUString > sSearchList;
+
+ if ( sContainer.Len() > 0 )
+ {
+ // get the Project associated with the Container
+ if ( xPrjNameCache.is() )
+ {
+ if ( xPrjNameCache->hasByName( sContainer ) )
+ {
+ rtl::OUString sProject;
+ xPrjNameCache->getByName( sContainer ) >>= sProject;
+ sContainer = sProject;
+ }
+ }
+ sSearchList.push_back( sContainer ); // First Lib to search
+ }
+ else
+ {
+ // Ok, if we have no Container specified then we need to search them in order, this document, template this document created from, global templates,
+ // get the name of Project/Library for 'this' document
+ rtl::OUString sThisProject;
+ BasicManager* pBasicMgr = pShell-> GetBasicManager();
+ if ( pBasicMgr )
+ {
+ if ( pBasicMgr->GetName().Len() )
+ sThisProject = pBasicMgr->GetName();
+ else // cater for the case where VBA is not enabled
+ sThisProject = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Standard") );
+ }
+ sSearchList.push_back( sThisProject ); // First Lib to search
+ if ( xPrjNameCache.is() )
+ {
+ // is this document created from a template?
+ uno::Reference< document::XDocumentInfoSupplier > xDocInfoSupp( pShell->GetModel(), uno::UNO_QUERY_THROW );
+ uno::Reference< document::XDocumentPropertiesSupplier > xDocPropSupp( xDocInfoSupp->getDocumentInfo(), uno::UNO_QUERY_THROW );
+ uno::Reference< document::XDocumentProperties > xDocProps( xDocPropSupp->getDocumentProperties(), uno::UNO_QUERY_THROW );
+
+ rtl::OUString sCreatedFrom = xDocProps->getTemplateURL();
+ if ( sCreatedFrom.getLength() )
+ {
+ INetURLObject aObj;
+ aObj.SetURL( sCreatedFrom );
+ bool bIsURL = aObj.GetProtocol() != INET_PROT_NOT_VALID;
+ rtl::OUString aURL;
+ if ( bIsURL )
+ aURL = sCreatedFrom;
+ else
+ {
+ osl::FileBase::getFileURLFromSystemPath( sCreatedFrom, aURL );
+ aObj.SetURL( aURL );
+ }
+ sCreatedFrom = aObj.GetLastName();
+ }
+
+ sal_Int32 nIndex = sCreatedFrom.lastIndexOf( '.' );
+ if ( nIndex != -1 )
+ sCreatedFrom = sCreatedFrom.copy( 0, nIndex );
+
+ rtl::OUString sPrj;
+ if ( sCreatedFrom.getLength() && xPrjNameCache->hasByName( sCreatedFrom ) )
+ {
+ xPrjNameCache->getByName( sCreatedFrom ) >>= sPrj;
+ // Make sure we don't double up with this project
+ if ( !sPrj.equals( sThisProject ) )
+ sSearchList.push_back( sPrj );
+ }
+
+ // get list of global template Names
+ uno::Sequence< rtl::OUString > sTemplateNames = xPrjNameCache->getElementNames();
+ sal_Int32 nLen = sTemplateNames.getLength();
+ for ( sal_Int32 index = 0; ( bSearchGlobalTemplates && index < nLen ); ++index )
+ {
+
+ if ( !sCreatedFrom.equals( sTemplateNames[ index ] ) )
+ {
+ if ( xPrjNameCache->hasByName( sTemplateNames[ index ] ) )
+ {
+ xPrjNameCache->getByName( sTemplateNames[ index ] ) >>= sPrj;
+ // Make sure we don't double up with this project
+ if ( !sPrj.equals( sThisProject ) )
+ sSearchList.push_back( sPrj );
+ }
+ }
+
+ }
+ }
+ }
+ std::vector< rtl::OUString >::iterator it_end = sSearchList.end();
+ for ( std::vector< rtl::OUString >::iterator it = sSearchList.begin(); it != it_end; ++it )
+ {
+ bool bRes = hasMacro( pShell, *it, sModule, sProcedure );
+ if ( bRes )
+ {
+ aRes.SetResolved( true );
+ aRes.SetMacroDocContext( pShell );
+ sContainer = *it;
+ break;
+ }
+ }
+ }
+ aRes.SetResolvedMacro( sProcedure.Insert( '.', 0 ).Insert( sModule, 0).Insert( '.', 0 ).Insert( sContainer, 0 ) );
+
+ return aRes;
+}
+
+// Treat the args as possible inouts ( convertion at bottom of method )
+sal_Bool executeMacro( SfxObjectShell* pShell, const String& sMacroName, uno::Sequence< uno::Any >& aArgs, uno::Any& /*aRet*/, const uno::Any& aCaller )
+{
+ sal_Bool bRes = sal_False;
+ if ( !pShell )
+ return bRes;
+ rtl::OUString sUrl = makeMacroURL( sMacroName );
+
+ uno::Sequence< sal_Int16 > aOutArgsIndex;
+ uno::Sequence< uno::Any > aOutArgs;
+
+ try
+ {
+ uno::Reference< script::provider::XScriptProvider > xScriptProvider;
+ uno::Reference< script::provider::XScriptProviderSupplier > xSPS( pShell->GetModel(), uno::UNO_QUERY_THROW );
+
+ xScriptProvider.set( xSPS->getScriptProvider(), uno::UNO_QUERY_THROW );
+
+ uno::Reference< script::provider::XScript > xScript( xScriptProvider->getScript( sUrl ), uno::UNO_QUERY_THROW );
+
+ if ( aCaller.hasValue() )
+ {
+ uno::Reference< beans::XPropertySet > xProps( xScript, uno::UNO_QUERY );
+ if ( xProps.is() )
+ {
+ uno::Sequence< uno::Any > aCallerHack(1);
+ aCallerHack[ 0 ] = aCaller;
+ xProps->setPropertyValue( rtl::OUString::createFromAscii( "Caller" ), uno::makeAny( aCallerHack ) );
+ }
+ }
+
+
+ xScript->invoke( aArgs, aOutArgsIndex, aOutArgs );
+
+ sal_Int32 nLen = aOutArgs.getLength();
+ // convert any out params to seem like they were inouts
+ if ( nLen )
+ {
+ for ( sal_Int32 index=0; index < nLen; ++index )
+ {
+ sal_Int32 nOutIndex = aOutArgsIndex[ index ];
+ aArgs[ nOutIndex ] = aOutArgs[ index ];
+ }
+ }
+
+ bRes = sal_True;
+ }
+ catch ( uno::Exception& e )
+ {
+ bRes = sal_False;
+ }
+ return bRes;
+}
+} } // vba // ooo
diff --git a/filter/source/msfilter/msvbasic.cxx b/filter/source/msfilter/msvbasic.cxx
new file mode 100644
index 000000000000..65d39953ec20
--- /dev/null
+++ b/filter/source/msfilter/msvbasic.cxx
@@ -0,0 +1,639 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
+
+#include <string.h> // memset(), ...
+#ifndef UNX
+#include <io.h> // access()
+#endif
+#include <osl/endian.h>
+#include <rtl/tencinfo.h> //rtl_getTextEncodingFromWindowsCodePage
+#include "msvbasic.hxx"
+
+#include <com/sun/star/script/ModuleType.hpp>
+
+using namespace ::com::sun::star::script;
+
+/*
+A few urls which may in the future be of some use
+http://www.virusbtn.com/vb2000/Programme/papers/bontchev.pdf
+*/
+
+/* class VBA_Impl:
+ * The VBA class provides a set of methods to handle Visual Basic For
+ * Applications streams, the constructor is given the root ole2 stream
+ * of the document, Open reads the VBA project file and figures out
+ * the number of VBA streams, and the offset of the data within them.
+ * Decompress decompresses a particular numbered stream, NoStreams returns
+ * this number, and StreamName can give you the streams name. Decompress
+ * will call Output when it has a 4096 byte collection of data to output,
+ * and also with the final remainder of data if there is still some left
+ * at the end of compression. Output is virtual to allow custom handling
+ * of each chunk of decompressed data. So inherit from this to do something
+ * useful with the data.
+ *
+ * cmc
+ * */
+const int MINVBASTRING = 6;
+
+VBA_Impl::VBA_Impl(SvStorage &rIn, bool bCmmntd)
+ : aVBAStrings(0),
+ sComment(RTL_CONSTASCII_USTRINGPARAM("Rem ")),
+ xStor(&rIn), pOffsets(0), nOffsets(0), meCharSet(RTL_TEXTENCODING_MS_1252),
+ bCommented(bCmmntd), mbMac(false), nLines(0)
+{
+}
+
+VBA_Impl::~VBA_Impl()
+{
+ delete [] pOffsets;
+ for (ULONG i=0;i<aVBAStrings.GetSize();++i)
+ delete aVBAStrings.Get(i);
+}
+
+sal_uInt8 VBA_Impl::ReadPString(SvStorageStreamRef &xVBAProject,
+ bool bIsUnicode)
+{
+ sal_uInt16 nIdLen, nOut16;
+ sal_uInt8 nType = 0, nOut8;
+ String sReference;
+
+ *xVBAProject >> nIdLen;
+
+ if (nIdLen < MINVBASTRING) //Error recovery
+ xVBAProject->SeekRel(-2); //undo 2 byte len
+ else
+ {
+ for(sal_uInt16 i=0; i < nIdLen / (bIsUnicode ? 2 : 1); i++)
+ {
+ if (bIsUnicode)
+ *xVBAProject >> nOut16;
+ else
+ {
+ *xVBAProject >> nOut8;
+ nOut16 = nOut8;
+ }
+ sReference += nOut16;
+ if (i==2)
+ {
+ if ((nOut16 == 'G') || (nOut16 == 'H') || (nOut16 == 'C') ||
+ nOut16 == 'D')
+ {
+ nType = static_cast<sal_uInt8>(nOut16);
+ }
+ if (nType == 0)
+ {
+ //Error recovery, 2byte len + 3 characters of used type
+ xVBAProject->SeekRel(-(2 + 3 * (bIsUnicode ? 2 : 1)));
+ break;
+ }
+ }
+ }
+ maReferences.push_back(sReference);
+ }
+ return nType;
+}
+
+void VBA_Impl::Output( int nLen, const sal_uInt8*pData )
+{
+ /*
+ Each StarBasic module is tragically limited to the maximum len of a
+ string and WordBasic is not, so each overlarge module must be split
+ */
+ String sTemp((const sal_Char *)pData, (xub_StrLen)nLen,
+ meCharSet);
+ int nTmp = sTemp.GetTokenCount('\x0D');
+ int nIndex = aVBAStrings.GetSize()-1;
+ if (aVBAStrings.Get(nIndex)->Len() +
+ nLen + ((nLines+nTmp) * sComment.Len()) >= STRING_MAXLEN)
+ {
+ //DBG_ASSERT(0,"New Module String\n");
+ //we are too large for our boots, break out into another
+ //string
+ nLines=0;
+ nIndex++;
+ aVBAStrings.SetSize(nIndex+1);
+ aVBAStrings.Put(nIndex,new String);
+ }
+ *(aVBAStrings.Get(nIndex)) += sTemp;
+ nLines+=nTmp;
+}
+
+
+int VBA_Impl::ReadVBAProject(const SvStorageRef &rxVBAStorage)
+{
+ SvStorageStreamRef xVBAProject;
+ xVBAProject = rxVBAStorage->OpenSotStream(
+ String( RTL_CONSTASCII_USTRINGPARAM( "_VBA_PROJECT" ) ),
+ STREAM_STD_READ | STREAM_NOCREATE );
+
+ if( !xVBAProject.Is() || SVSTREAM_OK != xVBAProject->GetError() )
+ {
+ DBG_WARNING("Not able to find vba project, cannot find macros");
+ return 0;
+ }
+
+ static const sal_uInt8 aKnownId[] = {0xCC, 0x61};
+ sal_uInt8 aId[2];
+ xVBAProject->Read( aId, sizeof(aId) );
+ if (memcmp( aId, aKnownId, sizeof(aId)))
+ {
+ DBG_WARNING("unrecognized VBA macro project type");
+ return 0;
+ }
+
+ static const sal_uInt8 aOffice2007LE[] = { 0x88, 0x00, 0x00, 0x01, 0x00, 0xFF };
+ static const sal_uInt8 aOffice2003LE_2[] = { 0x79, 0x00, 0x00, 0x01, 0x00, 0xFF };
+ static const sal_uInt8 aOffice2003LE[] = { 0x76, 0x00, 0x00, 0x01, 0x00, 0xFF };
+ static const sal_uInt8 aOfficeXPLE[] = { 0x73, 0x00, 0x00, 0x01, 0x00, 0xFF };
+ static const sal_uInt8 aOfficeXPBE[] = { 0x63, 0x00, 0x00, 0x0E, 0x00, 0xFF };
+ static const sal_uInt8 aOffice2000LE[] = { 0x6D, 0x00, 0x00, 0x01, 0x00, 0xFF };
+ static const sal_uInt8 aOffice98BE[] = { 0x60, 0x00, 0x00, 0x0E, 0x00, 0xFF };
+ static const sal_uInt8 aOffice97LE[] = { 0x5E, 0x00, 0x00, 0x01, 0x00, 0xFF };
+
+ sal_uInt8 aProduct[6];
+ xVBAProject->Read( aProduct, sizeof(aProduct) );
+
+ bool bIsUnicode;
+ if (!(memcmp(aProduct, aOffice2007LE, sizeof(aProduct))) ||
+ !(memcmp(aProduct, aOffice2003LE, sizeof(aProduct))) ||
+ !(memcmp(aProduct, aOffice2003LE_2, sizeof(aProduct))) ||
+ !(memcmp(aProduct, aOfficeXPLE, sizeof(aProduct))) ||
+ !(memcmp(aProduct, aOffice2000LE, sizeof(aProduct))) ||
+ !(memcmp(aProduct, aOffice97LE, sizeof(aProduct))) )
+ {
+ xVBAProject->SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
+ bIsUnicode = true;
+ }
+ else if (!(memcmp(aProduct, aOfficeXPBE, sizeof(aProduct))) ||
+ !(memcmp(aProduct, aOffice98BE, sizeof(aProduct))) )
+ {
+ xVBAProject->SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN );
+ mbMac = true;
+ bIsUnicode = false;
+ }
+ else
+ {
+ switch (aProduct[3])
+ {
+ case 0x1:
+ xVBAProject->SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN);
+ bIsUnicode = true;
+ DBG_ASSERT(!this, "unrecognized VBA macro version, report to cmc. Guessing at unicode little endian");
+ break;
+ case 0xe:
+ xVBAProject->SetNumberFormatInt(NUMBERFORMAT_INT_BIGENDIAN);
+ mbMac = true;
+ bIsUnicode = false;
+ DBG_ASSERT(!this, "unrecognized VBA macro version, report to cmc. Guessing at 8bit big endian");
+ break;
+ default:
+ DBG_ASSERT(!this, "totally unrecognized VBA macro version, report to cmc");
+ return 0;
+ }
+ }
+
+ sal_uInt32 nLidA; //Language identifiers
+ sal_uInt32 nLidB;
+ sal_uInt16 nCharSet;
+ sal_uInt16 nLenA;
+ sal_uInt32 nUnknownB;
+ sal_uInt32 nUnknownC;
+ sal_uInt16 nLenB;
+ sal_uInt16 nLenC;
+ sal_uInt16 nLenD;
+
+ *xVBAProject >> nLidA >> nLidB >> nCharSet >> nLenA >> nUnknownB;
+ *xVBAProject >> nUnknownC >> nLenB >> nLenC >> nLenD;
+
+ meCharSet = rtl_getTextEncodingFromWindowsCodePage(nCharSet);
+
+ DBG_ASSERT(meCharSet != RTL_TEXTENCODING_DONTKNOW,
+ "don't know what vba charset to use");
+ if (meCharSet == RTL_TEXTENCODING_DONTKNOW)
+ meCharSet = RTL_TEXTENCODING_MS_1252;
+
+ if (nLenD != 0x02)
+ {
+ DBG_WARNING("Warning VBA number is different, please report");
+ return 0;
+ }
+
+ /*
+ A sequence of string that are prepended with a len and then begin with G
+ or H, there are also those that begin with C or D. If a string begins with
+ C or D, it is really two strings, one right after the other. Each string
+ then has a 12 bytes suffix
+
+ Recognizing the end of the sequence is done by finding a str len of < 6
+ which does not appear to be the beginning of an object id. Admittedly this
+ isn't a great test, but nothing in the header appears to count the number
+ of strings, and nothing else seems to match. So it'll have to do, its
+ protected by a number of secondry tests to prove its a valid string, and
+ everything gives up if this isn't proven.
+ */
+ bool bPredictsTrailingTwenty = false;
+ while (1)
+ {
+ sal_uInt8 nType = ReadPString(xVBAProject,bIsUnicode);
+ //Type C and D seem to come as pairs, so skip the following one
+ if (nType == 'C' || nType == 'D')
+ {
+ nType = ReadPString(xVBAProject,bIsUnicode);
+ DBG_ASSERT( nType == 'C' || nType == 'D',
+ "VBA: This must be a 'C' or 'D' string!" );
+ if (nType != 'C' && nType != 'D')
+ return 0;
+ }
+ if (!nType)
+ break;
+ xVBAProject->SeekRel(10);
+ sal_uInt16 nPredictsTrailingTwenty;
+ *xVBAProject >> nPredictsTrailingTwenty;
+ if (nPredictsTrailingTwenty)
+ bPredictsTrailingTwenty = true;
+ if (bPredictsTrailingTwenty)
+ {
+ sal_uInt16 nTestIsNotString;
+ *xVBAProject >> nTestIsNotString;
+ if (nTestIsNotString < MINVBASTRING)
+ {
+ DBG_ASSERT(nTestIsNotString <= 1,
+ "Haven't seen a len like this in VBA, report to CMC");
+ xVBAProject->SeekRel(18);
+ bPredictsTrailingTwenty = false;
+ }
+ else
+ xVBAProject->SeekRel(-2);
+ }
+ }
+
+ sal_Int16 nInt16s;
+ *xVBAProject >> nInt16s;
+ DBG_ASSERT( nInt16s >= 0, "VBA: Bad no of records in VBA Project, panic!" );
+ if (!nInt16s)
+ return 0;
+
+ xVBAProject->SeekRel(2*nInt16s);
+
+ sal_Int16 nInt32s;
+ *xVBAProject >> nInt32s;
+ DBG_ASSERT( nInt32s >= 0, "VBA: Bad no of records in VBA Project, panic!" );
+ if (!nInt32s)
+ return 0;
+ xVBAProject->SeekRel(4*nInt32s);
+
+ xVBAProject->SeekRel(2);
+ for(int k=0;k<3;k++)
+ {
+ sal_uInt16 nLen;
+ *xVBAProject >> nLen;
+ if (nLen != 0xFFFF)
+ xVBAProject->SeekRel(nLen);
+ }
+ xVBAProject->SeekRel(100); //Seems fixed len
+
+ *xVBAProject >> nOffsets;
+ DBG_ASSERT( nOffsets != 0xFFFF, "VBA: Bad nOffsets, panic!!" );
+ if ((nOffsets == 0xFFFF) || (nOffsets == 0))
+ return 0;
+ pOffsets = new VBAOffset_Impl[ nOffsets ];
+
+ int i, j;
+ for( i=0; i < nOffsets; i++)
+ {
+ sal_uInt16 nLen;
+ *xVBAProject >> nLen;
+
+ if (bIsUnicode)
+ {
+ sal_Unicode* pBuf = pOffsets[i].sName.AllocBuffer( nLen / 2 );
+ xVBAProject->Read( (sal_Char*)pBuf, nLen );
+
+#ifdef OSL_BIGENDIAN
+ for( j = 0; j < nLen / 2; ++j, ++pBuf )
+ *pBuf = SWAPSHORT( *pBuf );
+#endif // ifdef OSL_BIGENDIAN
+ }
+ else
+ {
+ ByteString aByteStr;
+ sal_Char* pByteData = aByteStr.AllocBuffer( nLen );
+ sal_Size nWasRead = xVBAProject->Read( pByteData, nLen );
+ if( nWasRead != nLen )
+ aByteStr.ReleaseBufferAccess();
+ pOffsets[i].sName += String( aByteStr, meCharSet);
+ }
+
+ *xVBAProject >> nLen;
+ xVBAProject->SeekRel( nLen );
+
+ //begin section, another problem area
+ *xVBAProject >> nLen;
+ if ( nLen == 0xFFFF)
+ {
+ xVBAProject->SeekRel(2);
+ *xVBAProject >> nLen;
+ xVBAProject->SeekRel( nLen );
+ }
+ else
+ xVBAProject->SeekRel( nLen+2 );
+
+ *xVBAProject >> nLen;
+ DBG_ASSERT( nLen == 0xFFFF, "VBA: Bad field in VBA Project, panic!!" );
+ if ( nLen != 0xFFFF)
+ return 0;
+
+ xVBAProject->SeekRel(6);
+ sal_uInt16 nOctects;
+ *xVBAProject >> nOctects;
+ for(j=0;j<nOctects;j++)
+ xVBAProject->SeekRel(8);
+
+ xVBAProject->SeekRel(5);
+ //end section
+
+ *xVBAProject >> pOffsets[i].nOffset;
+ xVBAProject->SeekRel(2);
+ }
+
+ return nOffsets;
+}
+
+
+/* #117718# For a given Module name return its type,
+ * Form, Class, Document, Normal or Unknown
+ *
+*/
+
+ModType VBA_Impl::GetModuleType( const UniString& rModuleName )
+{
+ ModuleTypeHash::iterator iter = mhModHash.find( rModuleName );
+ ModuleTypeHash::iterator iterEnd = mhModHash.end();
+ if ( iter != iterEnd )
+ {
+ return iter->second;
+ }
+ return ModuleType::UNKNOWN;
+}
+
+bool VBA_Impl::Open( const String &rToplevel, const String &rSublevel )
+{
+ /* beginning test for vba stuff */
+ bool bRet = false;
+ SvStorageRef xMacros= xStor->OpenSotStorage( rToplevel,
+ STREAM_READWRITE | STREAM_NOCREATE |
+ STREAM_SHARE_DENYALL );
+ if( !xMacros.Is() || SVSTREAM_OK != xMacros->GetError() )
+ {
+ DBG_WARNING("No Macros Storage");
+ }
+ else
+ {
+ xVBA = xMacros->OpenSotStorage( rSublevel,
+ STREAM_READWRITE | STREAM_NOCREATE |
+ STREAM_SHARE_DENYALL );
+ if( !xVBA.Is() || SVSTREAM_OK != xVBA->GetError() )
+ {
+ DBG_WARNING("No Visual Basic in Storage");
+ }
+ else
+ {
+ if (ReadVBAProject(xVBA))
+ bRet = true;
+ }
+ /* #117718#
+ * Information regarding the type of module is contained in the
+ * "PROJECT" stream, this stream consists of a number of ascii lines
+ * entries are of the form Key=Value, the ones that we are interested
+ * in have the keys; Class, BaseClass & Module indicating the module
+ * ( value ) is either a Class Module, Form Module or a plain VB Module. */
+ SvStorageStreamRef xProject = xMacros->OpenSotStream(
+ String( RTL_CONSTASCII_USTRINGPARAM( "PROJECT" ) ) );
+ SvStorageStream* pStp = xProject;
+ UniString tmp;
+ static const String sThisDoc( RTL_CONSTASCII_USTRINGPARAM( "ThisDocument" ) );
+ static const String sModule( RTL_CONSTASCII_USTRINGPARAM( "Module" ) );
+ static const String sClass( RTL_CONSTASCII_USTRINGPARAM( "Class" ) );
+ static const String sBaseClass( RTL_CONSTASCII_USTRINGPARAM( "BaseClass" ) );
+ static const String sDocument( RTL_CONSTASCII_USTRINGPARAM( "Document" ) );
+ mhModHash[ sThisDoc ] = ModuleType::CLASS;
+ while ( pStp->ReadByteStringLine( tmp, meCharSet ) )
+ {
+ xub_StrLen index = tmp.Search( '=' );
+ if ( index != STRING_NOTFOUND )
+ {
+ String key = tmp.Copy( 0, index );
+ String value = tmp.Copy( index + 1 );
+ if ( key == sClass )
+ {
+ mhModHash[ value ] = ModuleType::CLASS;
+ OSL_TRACE("Module %s is of type Class",
+ ::rtl::OUStringToOString( value ,
+ RTL_TEXTENCODING_ASCII_US ).pData->buffer );
+ }
+ else if ( key == sBaseClass )
+ {
+ mhModHash[ value ] = ModuleType::FORM;
+ OSL_TRACE("Module %s is of type Form",
+ ::rtl::OUStringToOString( value ,
+ RTL_TEXTENCODING_ASCII_US ).pData->buffer );
+ }
+ else if ( key == sDocument )
+ {
+ /* #i37965# DR 2004-12-03: add "Document", used i.e.
+ in Excel for macros attached to sheet or document. */
+
+ // value is of form <name>/&H<identifier>, strip the identifier
+ value.Erase( value.Search( '/' ) );
+
+ mhModHash[ value ] = ModuleType::DOCUMENT;
+ OSL_TRACE("Module %s is of type Document VBA",
+ ::rtl::OUStringToOString( value ,
+ RTL_TEXTENCODING_ASCII_US ).pData->buffer );
+ }
+ else if ( key == sModule )
+ {
+ mhModHash[ value ] = ModuleType::NORMAL;
+ OSL_TRACE("Module %s is of type Normal VBA",
+ ::rtl::OUStringToOString( value ,
+ RTL_TEXTENCODING_ASCII_US ).pData->buffer );
+ }
+ }
+ }
+ }
+ /* end test for vba stuff */
+ return bRet;
+}
+
+const StringArray &VBA_Impl::Decompress(sal_uInt16 nIndex, int *pOverflow)
+{
+ DBG_ASSERT( nIndex < nOffsets, "Index out of range" );
+ SvStorageStreamRef xVBAStream;
+ aVBAStrings.SetSize(1);
+ aVBAStrings.Put(0,new String);
+
+ xVBAStream = xVBA->OpenSotStream( pOffsets[nIndex].sName,
+ STREAM_STD_READ | STREAM_NOCREATE );
+ if (pOverflow)
+ *pOverflow=0;
+
+ if( !xVBAStream.Is() || SVSTREAM_OK != xVBAStream->GetError() )
+ {
+ DBG_WARNING("Not able to open vb module ");
+ }
+ else
+ {
+ xVBAStream->SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
+ DecompressVBA( nIndex, xVBAStream );
+ /*
+ * if len was too big for a single string set that variable ?
+ * if ((len > XX) && (pOverflow))
+ *pOverflow=1;
+ */
+ if (bCommented)
+ {
+ String sTempStringa;
+ if (mbMac)
+ sTempStringa = String( RTL_CONSTASCII_USTRINGPARAM( "\x0D" ) );
+ else
+ sTempStringa = String( RTL_CONSTASCII_USTRINGPARAM( "\x0D\x0A" ) );
+ String sTempStringb(sTempStringa);
+ sTempStringb+=sComment;
+ for(ULONG i=0;i<aVBAStrings.GetSize();i++)
+ {
+ aVBAStrings.Get(i)->SearchAndReplaceAll(
+ sTempStringa,sTempStringb);
+ aVBAStrings.Get(i)->Insert(sComment,0);
+ }
+ }
+ }
+ return aVBAStrings;
+}
+
+
+int VBA_Impl::DecompressVBA( int nIndex, SvStorageStreamRef &xVBAStream )
+{
+ sal_uInt8 nLeadbyte;
+ sal_uInt16 nToken;
+ unsigned int nPos = 0;
+ int nLen, nDistance, nShift, nClean=1;
+
+ xVBAStream->Seek( pOffsets[ nIndex ].nOffset + 3 );
+
+ while(xVBAStream->Read(&nLeadbyte,1))
+ {
+ for(int nPosition=0x01;nPosition < 0x100;nPosition=nPosition<<1)
+ {
+ //we see if the leadbyte has flagged this location as a dataunit
+ //which is actually a token which must be looked up in the history
+ if (nLeadbyte & nPosition)
+ {
+ *xVBAStream >> nToken;
+
+ if (nClean == 0)
+ nClean=1;
+
+ //For some reason the division of the token into the length
+ //field of the data to be inserted, and the distance back into
+ //the history differs depending on how full the history is
+ int nPos2 = nPos % nWINDOWLEN;
+ if (nPos2 <= 0x10)
+ nShift = 12;
+ else if (nPos2 <= 0x20)
+ nShift = 11;
+ else if (nPos2 <= 0x40)
+ nShift = 10;
+ else if (nPos2 <= 0x80)
+ nShift = 9;
+ else if (nPos2 <= 0x100)
+ nShift = 8;
+ else if (nPos2 <= 0x200)
+ nShift = 7;
+ else if (nPos2 <= 0x400)
+ nShift = 6;
+ else if (nPos2 <= 0x800)
+ nShift = 5;
+ else
+ nShift = 4;
+
+ int i;
+ nLen=0;
+ for(i=0;i<nShift;i++)
+ nLen |= nToken & (1<<i);
+
+ nLen += 3;
+
+ nDistance = nToken >> nShift;
+
+ //read the len of data from the history, wrapping around the
+ //nWINDOWLEN boundary if necessary data read from the history
+ //is also copied into the recent part of the history as well.
+ for (i = 0; i < nLen; i++)
+ {
+ unsigned char c;
+ c = aHistory[(nPos-nDistance-1) % nWINDOWLEN];
+ aHistory[nPos % nWINDOWLEN] = c;
+ nPos++;
+ }
+ }
+ else
+ {
+ // special boundary case code, not guarantueed to be correct
+ // seems to work though, there is something wrong with the
+ // compression scheme (or maybe a feature) where when the data
+ // ends on a nWINDOWLEN boundary and the excess bytes in the 8
+ // dataunit list are discarded, and not interpreted as tokens
+ // or normal data.
+ if ((nPos != 0) && ((nPos % nWINDOWLEN) == 0) && (nClean))
+ {
+ xVBAStream->SeekRel(2);
+ nClean=0;
+ Output(nWINDOWLEN, aHistory);
+ break;
+ }
+ //This is the normal case for when the data unit is not a
+ //token to be looked up, but instead some normal data which
+ //can be output, and placed in the history.
+ if (xVBAStream->Read(&aHistory[nPos % nWINDOWLEN],1))
+ nPos++;
+
+ if (nClean == 0)
+ nClean=1;
+ }
+ }
+ }
+ if (nPos % nWINDOWLEN)
+ Output(nPos % nWINDOWLEN,aHistory);
+ return(nPos);
+}
+
+/* vi:set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/filter/source/msfilter/msvbasic.hxx b/filter/source/msfilter/msvbasic.hxx
new file mode 100644
index 000000000000..171671e8cd5c
--- /dev/null
+++ b/filter/source/msfilter/msvbasic.hxx
@@ -0,0 +1,120 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
+
+#ifndef _MSVBASIC_HXX
+#define _MSVBASIC_HXX
+
+#include <tools/solar.h>
+#include <tools/debug.hxx>
+#include <sot/storage.hxx>
+#include <tools/dynary.hxx>
+#include <vector>
+#include <map>
+
+/* class VBA:
+ * The VBA class provides a set of methods to handle Visual Basic For
+ * Applications streams, the constructor is given the root ole2 stream
+ * of the document, Open reads the VBA project file and figures out
+ * the number of VBA streams, and the offset of the data within them.
+ * Decompress decompresses a particular numbered stream, NoStreams returns
+ * this number, and StreamName can give you the streams name. Decompress
+ * will return a string with the decompressed data. The optional extra
+ * argument will be set if not NULL to 1 in the case of a string overflow,
+ * if I can figure out how to do that.
+ *
+ * Otherwise it is possible to inherit from VBA and implement a Output
+ * member which gets called with each 4096 output sized block.
+ *
+ * cmc
+ * */
+
+DECLARE_DYNARRAY(StringArray,String *)
+
+// #117718# define internal types to distinguish between
+// module types, form, class & normal
+// #i37965# DR 2004-12-03: add "Document", used in Excel for macros attached to sheet
+
+// #117718# define map to hold types of module
+//
+typedef sal_Int32 ModType;
+typedef ::std::map< UniString,
+ ModType > ModuleTypeHash;
+
+class VBA_Impl
+{
+public:
+ VBA_Impl(SvStorage &rIn, bool bCmmntd = true);
+ ~VBA_Impl();
+ //0 for failure, 1 for success
+ bool Open( const String &rToplevel, const String &rSublevel);
+ const StringArray & Decompress(sal_uInt16 nIndex, int *pOverflow=0);
+ sal_uInt16 GetNoStreams() const { return nOffsets; }
+ const String &GetStreamName(sal_uInt16 nIndex) const
+ {
+ DBG_ASSERT( nIndex < nOffsets, "Index out of range" );
+ return pOffsets[ nIndex ].sName;
+ }
+ //I'm the method that would be made virtual to make this class
+ //useful elsewhere
+ void Output(int len, const sal_uInt8 *data);
+ //
+ // #117718# member map of module names to types of module
+ ModType GetModuleType( const UniString& rModuleName );
+ std::vector<String> maReferences;
+private:
+ struct VBAOffset_Impl
+ {
+ String sName;
+ sal_uInt32 nOffset;
+ };
+
+ // #117718# member map of module names to types of module
+ ModuleTypeHash mhModHash;
+ SvStorageRef xVBA;
+ StringArray aVBAStrings;
+ String sComment;
+ SvStorageRef xStor;
+ VBAOffset_Impl *pOffsets;
+ sal_uInt16 nOffsets;
+ enum Limits {nWINDOWLEN = 4096};
+ sal_uInt8 aHistory[nWINDOWLEN];
+ rtl_TextEncoding meCharSet;
+ bool bCommented;
+ bool mbMac;
+ int nLines;
+
+ //0 for failure, anything else for success
+ int ReadVBAProject(const SvStorageRef &rxVBAStorage);
+ int DecompressVBA(int index, SvStorageStreamRef &rxVBAStream);
+ sal_uInt8 ReadPString(SvStorageStreamRef &xVBAProject, bool bIsUnicode);
+};
+
+#endif
+
+/* vi:set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/filter/source/msfilter/powerpoint/makefile.mk b/filter/source/msfilter/powerpoint/makefile.mk
new file mode 100644
index 000000000000..0ad3d4202f1f
--- /dev/null
+++ b/filter/source/msfilter/powerpoint/makefile.mk
@@ -0,0 +1,65 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+PRJNAME=filter
+TARGET=PptImporter
+
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings ----------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Files -------------------------------------
+
+SLOFILES= $(SLO)$/pptimporter.obj \
+ $(SLO)$/pptimporteruno.obj \
+ $(SLO)$/ppttoxml.obj
+
+# --- Library -----------------------------------
+
+SHL1TARGET=$(TARGET)$(DLLPOSTFIX)
+SHL1STDLIBS=\
+ $(SOTLIB) \
+ $(TOOLSLIB) \
+ $(CPPUHELPERLIB) \
+ $(CPPULIB) \
+ $(SALLIB)
+
+SHL1DEPN=
+SHL1IMPLIB= i$(SHL1TARGET)
+SHL1LIBS= $(SLB)$/$(TARGET).lib
+SHL1VERSIONMAP=$(SOLARENV)/src/component.map
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+
+DEF1NAME=$(SHL1TARGET)
+
+# --- Targets ----------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/filter/source/msfilter/powerpoint/pptcom.hxx b/filter/source/msfilter/powerpoint/pptcom.hxx
new file mode 100644
index 000000000000..64dff7e54b30
--- /dev/null
+++ b/filter/source/msfilter/powerpoint/pptcom.hxx
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * 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 _PPTCOM_HXX
+#define _PPTCOM_HXX
+
+#include <rtl/ustring.hxx>
+#include <tools/debug.hxx>
+#include <tools/stream.hxx>
+#include <tools/string.hxx>
+#include <tools/urlobj.hxx>
+#include <tools/stack.hxx>
+
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/registry/XRegistryKey.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <xmloff/xmlexp.hxx>
+#include <xmloff/nmspmap.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/implbase4.hxx>
+#include <com/sun/star/document/XFilter.hpp>
+#include <com/sun/star/document/XImporter.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+
+// -----------------------------------------------------------------------------
+
+#define NMSP_CPPU cppu
+#define NMSP_RTL rtl
+#define NMSP_UTL utl
+#define NMSP_COMPHELPER comphelper
+#define NMSP_UNO com::sun::star::uno
+#define NMSP_BEANS com::sun::star::beans
+#define NMSP_LANG com::sun::star::lang
+#define NMSP_IO com::sun::star::io
+#define NMSP_SAX com::sun::star::xml::sax
+#define NMSP_PRES com::sun::star::presentation
+#define NMSP_REGISTRY com::sun::star::registry
+#define NMSP_DOCUMENT com::sun::star::document
+
+
+#define REF( _def_Obj ) NMSP_UNO::Reference< _def_Obj >
+#define SEQ( _def_Obj ) NMSP_UNO::Sequence< _def_Obj >
+#define ANY NMSP_UNO::Any
+#define B2UCONST( _def_pChar ) (NMSP_RTL::OUString(RTL_CONSTASCII_USTRINGPARAM(_def_pChar )))
+#define PPT_DTD_STRING B2UCONST( "<!DOCTYPE office:document-styles PUBLIC \"-//OpenOffice.org//DTD OfficeDocument 1.0//EN\" \"office.dtd\">"
+#endif
diff --git a/filter/source/msfilter/powerpoint/pptimporter.cxx b/filter/source/msfilter/powerpoint/pptimporter.cxx
new file mode 100644
index 000000000000..960987700980
--- /dev/null
+++ b/filter/source/msfilter/powerpoint/pptimporter.cxx
@@ -0,0 +1,163 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+#include "pptimporter.hxx"
+
+#ifdef DBG_DUMP_PPT_IMPORT
+#ifndef _COM_SUN_STAR_IO_XACTIVEDATASOURCE_HDL_
+#include <com/sun/star/io/XActiveDataSource.hpp>
+#endif
+#include <unotools/streamwrap.hxx>
+#include <comphelper/processfactory.hxx>
+#endif
+
+#include <uno/mapping.hxx>
+
+// -----------------
+// - PptImporter -
+// -----------------
+
+NMSP_RTL::OUString PptImporter_getImplementationName()
+ throw( NMSP_UNO::RuntimeException )
+{
+ return B2UCONST( "com.sun.star.presentation.PptImporter" );
+}
+#define SERVICE_NAME "com.sun.star.document.ImportFilter"
+sal_Bool SAL_CALL PptImporter_supportsService( const NMSP_RTL::OUString& ServiceName )
+ throw( NMSP_UNO::RuntimeException )
+{
+ return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( SERVICE_NAME ) );
+}
+
+SEQ( NMSP_RTL::OUString ) SAL_CALL PptImporter_getSupportedServiceNames()
+ throw( NMSP_UNO::RuntimeException )
+{
+ SEQ( NMSP_RTL::OUString ) aRet(1);
+ NMSP_RTL::OUString* pArray = aRet.getArray();
+ pArray[0] = B2UCONST( SERVICE_NAME );
+ return aRet;
+}
+#undef SERVICE_NAME
+
+// -----------------------------------------------------------------------------
+
+PptImporter::PptImporter( const REF( NMSP_LANG::XMultiServiceFactory )& rxMgr ) :
+ xFact( rxMgr )
+{
+ NMSP_RTL::OUString sService( B2UCONST( "com.sun.star.comp.Impress.XMLImporter" ) );
+ try
+ {
+ xHdl = REF( NMSP_SAX::XDocumentHandler ) ( xFact->createInstance( sService ), NMSP_UNO::UNO_QUERY );
+ xImporter = REF( NMSP_DOCUMENT::XImporter )( xHdl, NMSP_UNO::UNO_QUERY );
+ }
+ catch( NMSP_UNO::Exception & )
+ {
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+PptImporter::~PptImporter()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL PptImporter::acquire() throw()
+{
+ OWeakObject::acquire();
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL PptImporter::release() throw()
+{
+ OWeakObject::release();
+}
+
+// XFilter
+sal_Bool SAL_CALL PptImporter::filter( const SEQ( NMSP_BEANS::PropertyValue )& aDescriptor )
+ throw ( NMSP_UNO::RuntimeException )
+{
+
+
+#ifdef DBG_DUMP_PPT_IMPORT
+
+ REF( NMSP_LANG::XMultiServiceFactory ) xServiceFactory( NMSP_COMPHELPER::getProcessServiceFactory() );
+ REF( NMSP_UNO::XInterface ) xWriter( xServiceFactory->createInstance( B2UCONST( "com.sun.star.xml.sax.Writer" ) ) );
+ SvFileStream aStrm( B2UCONST( "d:\\test2.xml" ), STREAM_READ | STREAM_WRITE | STREAM_TRUNC );
+ REF( NMSP_IO::XOutputStream ) xOutStream( (::cppu::OWeakObject*) new NMSP_UTL::OOutputStreamWrapper( aStrm ), NMSP_UNO::UNO_QUERY );
+ REF( NMSP_IO::XActiveDataSource ) xDataSource( xWriter , NMSP_UNO::UNO_QUERY );
+ xDataSource->setOutputStream( xOutStream );
+ aFilter.filter( aDescriptor, REF( NMSP_SAX::XDocumentHandler )( xWriter, NMSP_UNO::UNO_QUERY ) );
+
+// REF( NMSP_BEANS::XPropertySet ) xPropSet( xServiceFactory->createInstance( B2UCONST( "com.sun.star.beans.PropertySet" ) ) );
+// Any aAny;
+// aAny <<= (sal_Bool)sal_True;
+// xPropSet->setPropertyValue( B2UCONST( "UsePrettyPrinting" ), aAny );
+
+#endif
+
+ return aFilter.filter( aDescriptor, xHdl );
+}
+void SAL_CALL PptImporter::cancel()
+ throw ( NMSP_UNO::RuntimeException )
+{
+ aFilter.cancel();
+}
+
+// XImporter
+void SAL_CALL PptImporter::setTargetDocument( const REF( NMSP_LANG::XComponent )& xDoc )
+ throw ( NMSP_LANG::IllegalArgumentException, NMSP_UNO::RuntimeException)
+{
+ xImporter->setTargetDocument( xDoc );
+}
+
+// XInitialization
+void SAL_CALL PptImporter::initialize( const SEQ( NMSP_UNO::Any )& /* aArguments */ )
+ throw ( NMSP_UNO::Exception, NMSP_UNO::RuntimeException )
+{
+}
+
+// XServiceInfo
+NMSP_RTL::OUString SAL_CALL PptImporter::getImplementationName()
+ throw( NMSP_UNO::RuntimeException )
+{
+ return PptImporter_getImplementationName();
+}
+sal_Bool SAL_CALL PptImporter::supportsService( const NMSP_RTL::OUString& rServiceName )
+ throw( NMSP_UNO::RuntimeException )
+{
+ return PptImporter_supportsService( rServiceName );
+}
+SEQ( NMSP_RTL::OUString ) SAL_CALL PptImporter::getSupportedServiceNames()
+ throw ( NMSP_UNO::RuntimeException )
+{
+ return PptImporter_getSupportedServiceNames();
+}
diff --git a/filter/source/msfilter/powerpoint/pptimporter.hxx b/filter/source/msfilter/powerpoint/pptimporter.hxx
new file mode 100644
index 000000000000..6366d0fda054
--- /dev/null
+++ b/filter/source/msfilter/powerpoint/pptimporter.hxx
@@ -0,0 +1,91 @@
+/*************************************************************************
+ *
+ * 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 _PPTIMPORTER_HXX
+#define _PPTIMPORTER_HXX
+
+#include "pptcom.hxx"
+#include "ppttoxml.hxx"
+
+// ---------------
+// - PptImporter -
+// ---------------
+
+class PptImporter : public NMSP_CPPU::WeakImplHelper4
+<
+ NMSP_DOCUMENT::XFilter,
+ NMSP_DOCUMENT::XImporter,
+ NMSP_LANG::XInitialization,
+ NMSP_LANG::XServiceInfo
+>
+{
+ PptToXml aFilter;
+ REF( NMSP_SAX::XDocumentHandler ) xHdl;
+ REF( NMSP_LANG::XMultiServiceFactory ) xFact;
+ REF( NMSP_DOCUMENT::XImporter ) xImporter;
+
+public:
+
+ PptImporter( const REF( NMSP_LANG::XMultiServiceFactory )& rxMgr );
+ virtual ~PptImporter();
+
+ // XInterface
+ virtual void SAL_CALL acquire() throw();
+ virtual void SAL_CALL release() throw();
+
+ // XFilter
+ virtual sal_Bool SAL_CALL filter( const SEQ( NMSP_BEANS::PropertyValue )& aDescriptor )
+ throw ( NMSP_UNO::RuntimeException );
+ virtual void SAL_CALL cancel( )
+ throw ( NMSP_UNO::RuntimeException );
+
+ // XImporter
+ virtual void SAL_CALL setTargetDocument( const REF(NMSP_LANG::XComponent)& xDoc )
+ throw ( NMSP_LANG::IllegalArgumentException, NMSP_UNO::RuntimeException );
+
+ // XInitialization
+ virtual void SAL_CALL initialize( const SEQ( NMSP_UNO::Any )& aArguments )
+ throw ( NMSP_UNO::Exception, NMSP_UNO::RuntimeException );
+
+ // XServiceInfo
+ virtual NMSP_RTL::OUString SAL_CALL getImplementationName()
+ throw ( NMSP_UNO::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService( const NMSP_RTL::OUString& ServiceName )
+ throw ( NMSP_UNO::RuntimeException );
+ virtual SEQ( NMSP_RTL::OUString ) SAL_CALL getSupportedServiceNames()
+ throw ( NMSP_UNO::RuntimeException );
+
+};
+
+NMSP_RTL::OUString PptImporter_getImplementationName()
+ throw ( NMSP_UNO::RuntimeException );
+sal_Bool SAL_CALL PptImportert_supportsService( const NMSP_RTL::OUString& ServiceName )
+ throw( NMSP_UNO::RuntimeException );
+SEQ( NMSP_RTL::OUString ) SAL_CALL PptImporter_getSupportedServiceNames()
+ throw( NMSP_UNO::RuntimeException );
+
+#endif
diff --git a/filter/source/msfilter/powerpoint/pptimporteruno.cxx b/filter/source/msfilter/powerpoint/pptimporteruno.cxx
new file mode 100644
index 000000000000..c1089f66a5c3
--- /dev/null
+++ b/filter/source/msfilter/powerpoint/pptimporteruno.cxx
@@ -0,0 +1,110 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include "pptimporter.hxx"
+
+#include <cppuhelper/factory.hxx>
+#include <uno/mapping.hxx>
+
+// -------------------
+// - factory methods -
+// -------------------
+
+static REF( NMSP_UNO::XInterface ) SAL_CALL create_PptImporter( const REF( NMSP_LANG::XMultiServiceFactory )& rxFact )
+{
+ return REF( NMSP_UNO::XInterface )( *new PptImporter( rxFact ) );
+}
+
+// ------------------------------------------
+// - component_getImplementationEnvironment -
+// ------------------------------------------
+
+extern "C" void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */ )
+{
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+
+// -----------------------
+// - component_writeInfo -
+// -----------------------
+
+extern "C" sal_Bool SAL_CALL component_writeInfo( void* /* pServiceManager */, void* pRegistryKey )
+{
+ sal_Bool bRet = sal_False;
+
+ if( pRegistryKey )
+ {
+ try
+ {
+ NMSP_UNO::Reference< NMSP_REGISTRY::XRegistryKey > xNewKey(
+ reinterpret_cast< NMSP_REGISTRY::XRegistryKey * >( pRegistryKey )->createKey(
+ PptImporter_getImplementationName() ) );
+ xNewKey = xNewKey->createKey( B2UCONST( "/UNO/SERVICES" ) );
+ const SEQ( NMSP_RTL::OUString )& rSNL = PptImporter_getSupportedServiceNames();
+ const NMSP_RTL::OUString * pArray = rSNL.getConstArray();
+ for ( sal_Int32 nPos = rSNL.getLength(); nPos--; )
+ xNewKey->createKey( pArray[nPos] );
+ bRet = sal_True;
+ }
+ catch( NMSP_REGISTRY::InvalidRegistryException& )
+ {
+ OSL_ENSURE( sal_False, "### InvalidRegistryException!" );
+ }
+ }
+
+ return bRet;
+}
+
+// ------------------------
+// - component_getFactory -
+// ------------------------
+
+extern "C" void* SAL_CALL component_getFactory( const sal_Char* pImplName, void* pServiceManager, void* /* pRegistryKey */ )
+{
+ REF( NMSP_LANG::XSingleServiceFactory ) xFactory;
+ void* pRet = 0;
+
+ if( rtl_str_compare( pImplName, "com.sun.star.presentation.PptImporter" ) == 0 )
+ {
+ const NMSP_RTL::OUString aServiceName( B2UCONST( "com.sun.star.presentation.PptImporter" ) );
+
+ xFactory = REF( NMSP_LANG::XSingleServiceFactory )( NMSP_CPPU::createSingleFactory(
+ reinterpret_cast< NMSP_LANG::XMultiServiceFactory* >( pServiceManager ),
+ B2UCONST( "com.sun.star.presentation.PptImporter" ),
+ create_PptImporter, SEQ( NMSP_RTL::OUString )( &aServiceName, 1 ) ) );
+ }
+ if( xFactory.is() )
+ {
+ xFactory->acquire();
+ pRet = xFactory.get();
+ }
+
+ return pRet;
+}
diff --git a/filter/source/msfilter/powerpoint/ppttoxml.cxx b/filter/source/msfilter/powerpoint/ppttoxml.cxx
new file mode 100644
index 000000000000..d4ec2af93e7b
--- /dev/null
+++ b/filter/source/msfilter/powerpoint/ppttoxml.cxx
@@ -0,0 +1,91 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include "ppttoxml.hxx"
+#include <sot/storage.hxx>
+
+PptToXml::PptToXml()
+{
+}
+
+PptToXml::~PptToXml()
+{
+}
+
+sal_Bool PptToXml::filter( const SEQ( NMSP_BEANS::PropertyValue )& aDescriptor,
+ REF( NMSP_SAX::XDocumentHandler ) xHandler )
+{
+ xHdl = xHandler;
+
+ sal_Bool bStatus = sal_False;
+ sal_Int32 i;
+ for( i = 0; i < aDescriptor.getLength(); i++ )
+ {
+ NMSP_RTL::OUString strTemp;
+ aDescriptor[ i ].Value >>= strTemp;
+
+/* we will open the document by url, so the stream is not needed
+ if( aDescriptor[i].Name == B2UCONST( "InputStream" ) )
+ {
+ REF( NMSP_IO::XInputStream ) rInputStream;
+ aDescriptor[ i].Value >>= rInputStream;
+ }
+ else
+*/
+ if ( aDescriptor[ i ].Name == B2UCONST( "URL" ) )
+ {
+ NMSP_RTL::OUString sURL;
+ aDescriptor[ i ].Value >>= sURL;
+ SotStorageRef xStg( new SotStorage( sURL, STREAM_STD_READ, 0 ) );
+ if ( xStg.Is() )
+ {
+ SotStorageStreamRef xDocStream( xStg->OpenSotStream( B2UCONST( "PowerPoint Document" ), STREAM_STD_READ ) );
+ if( xDocStream.Is() )
+ {
+ xDocStream->SetVersion( xStg->GetVersion() );
+ xDocStream->SetKey( xStg->GetKey() );
+
+// xHdl->unknown( PPT_DTD_STRING );
+ xHdl->startDocument();
+
+
+ xHdl->endDocument();
+ bStatus = sal_True;
+ }
+ }
+ }
+ }
+ return bStatus;
+}
+
+void PptToXml::cancel()
+{
+
+}
diff --git a/filter/source/msfilter/powerpoint/ppttoxml.hxx b/filter/source/msfilter/powerpoint/ppttoxml.hxx
new file mode 100644
index 000000000000..b77f85b0109b
--- /dev/null
+++ b/filter/source/msfilter/powerpoint/ppttoxml.hxx
@@ -0,0 +1,51 @@
+/*************************************************************************
+ *
+ * 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 _PPTTOXML_HXX
+#define _PPTTOXML_HXX
+
+#include "pptcom.hxx"
+
+// ------------
+// - PptToXml -
+// ------------
+
+class PptToXml
+{
+ REF( NMSP_SAX::XDocumentHandler ) xHdl;
+
+ public:
+
+ PptToXml();
+ ~PptToXml();
+
+ sal_Bool filter( const SEQ( NMSP_BEANS::PropertyValue )& aDescriptor,
+ REF(NMSP_SAX::XDocumentHandler) xHandler );
+ void cancel();
+};
+
+#endif
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
new file mode 100644
index 000000000000..747306f81677
--- /dev/null
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -0,0 +1,7815 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+#include <osl/endian.h>
+#include <vcl/svapp.hxx>
+#include <unotools/tempfile.hxx>
+#include <math.h>
+#include <editeng/eeitem.hxx>
+#include <sot/storage.hxx>
+#include <sot/storinfo.hxx>
+#include <sot/stg.hxx>
+#include <com/sun/star/embed/Aspects.hpp>
+#include <com/sun/star/office/XAnnotation.hpp>
+#include <com/sun/star/office/XAnnotationAccess.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/geometry/RealPoint2D.hpp>
+#include <com/sun/star/util/DateTime.hpp>
+#include <unotools/streamwrap.hxx>
+#include <filter/msfilter/svdfppt.hxx>
+#include <svx/xpoly.hxx>
+#include <svx/svdtrans.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/svdogrp.hxx>
+#include <svx/svdorect.hxx>
+#include <svx/svdopage.hxx>
+#include <svx/svdograf.hxx>
+#include <svx/svdopath.hxx>
+#include <svx/svdocirc.hxx>
+#include <svx/svdocapt.hxx>
+#include <svx/svdotable.hxx>
+#include <editeng/outlobj.hxx>
+#include <svx/svdattr.hxx>
+#include "svx/xattr.hxx"
+#include "svx/svditext.hxx"
+#include <svx/svdetc.hxx>
+#include <editeng/bulitem.hxx>
+#include <svx/polysc3d.hxx>
+#include <svx/extrud3d.hxx>
+#include <svx/svdoashp.hxx>
+#include <editeng/tstpitem.hxx>
+#include <editeng/unoprnms.hxx>
+#include <editeng/editids.hrc>
+
+#if defined(JOEENV) && defined(JOEDEBUG)
+#include "impinccv.h" // etwas Testkram
+#endif
+
+#if defined(DBG_EXTRACTOLEOBJECTS) || defined(DBG_EXTRACTFONTMETRICS)
+#include <tools/urlobj.hxx>
+#include <unotools/localfilehelper.hxx>
+#endif
+
+#define ITEMVALUE(ItemSet,Id,Cast) ((const Cast&)(ItemSet).Get(Id)).GetValue()
+#include <editeng/adjitem.hxx>
+#include <editeng/escpitem.hxx>
+#include <editeng/colritem.hxx>
+#include <editeng/fhgtitem.hxx>
+#include <editeng/wghtitem.hxx>
+#include <editeng/postitem.hxx>
+#include <editeng/udlnitem.hxx>
+#include <editeng/crsditem.hxx>
+#include <editeng/shdditem.hxx>
+#include <editeng/charreliefitem.hxx>
+#include <editeng/fontitem.hxx>
+#include <svx/svdoutl.hxx>
+#include <editeng/editeng.hxx>
+#include <editeng/lspcitem.hxx>
+#include <editeng/ulspitem.hxx>
+#include <editeng/lrspitem.hxx>
+#include <vcl/metric.hxx>
+#include <vcl/bmpacc.hxx>
+#include <svx/svditer.hxx>
+#include <svx/svdoedge.hxx>
+#include <svx/sxekitm.hxx>
+#include <editeng/flditem.hxx>
+#include <svtools/sychconv.hxx>
+#include <tools/zcodec.hxx>
+#include <filter/msfilter/svxmsbas.hxx>
+#include <sfx2/objsh.hxx>
+#include <editeng/brshitem.hxx>
+#include <editeng/langitem.hxx>
+#include <svx/svdoole2.hxx>
+#include <svx/unoapi.hxx>
+#include <toolkit/unohlp.hxx>
+#include <com/sun/star/container/XIndexContainer.hpp>
+#include <com/sun/star/drawing/XShapes.hpp>
+#include <com/sun/star/drawing/XControlShape.hpp>
+#include <com/sun/star/form/XFormComponent.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
+#include <com/sun/star/drawing/XMasterPagesSupplier.hpp>
+#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
+#include <com/sun/star/awt/Size.hpp>
+#include <com/sun/star/awt/Point.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
+#include <com/sun/star/drawing/TextVerticalAdjust.hpp>
+#include <editeng/writingmodeitem.hxx>
+#include <vcl/print.hxx>
+#include <editeng/svxfont.hxx>
+#include <editeng/frmdiritem.hxx>
+#include <svx/sdtfchim.hxx>
+#include <unotools/ucbstreamhelper.hxx>
+#include <editeng/scripttypeitem.hxx>
+#include "com/sun/star/awt/Gradient.hpp"
+#include <com/sun/star/table/XMergeableCellRange.hpp>
+#include <com/sun/star/table/BorderLine.hpp>
+#include <vcl/virdev.hxx>
+#include <algorithm>
+#include <set>
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+// PPT ColorScheme Slots
+#define PPT_COLSCHEME (0x08000000)
+#define PPT_COLSCHEME_HINTERGRUND (0x08000000)
+#define PPT_COLSCHEME_TEXT_UND_ZEILEN (0x08000001)
+#define PPT_COLSCHEME_SCHATTEN (0x08000002)
+#define PPT_COLSCHEME_TITELTEXT (0x08000003)
+#define PPT_COLSCHEME_FUELLBEREICHE (0x08000004)
+#define PPT_COLSCHEME_AKZENT (0x08000005)
+#define PPT_COLSCHEME_A_UND_HYPERLINK (0x08000006)
+#define PPT_COLSCHEME_A_H_GESICHERT (0x08000007)
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#define ANSI_CHARSET 0
+#define DEFAULT_CHARSET 1
+#define SYMBOL_CHARSET 2
+#define SHIFTJIS_CHARSET 128
+#define HANGEUL_CHARSET 129
+#define CHINESEBIG5_CHARSET 136
+#define OEM_CHARSET 255
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/* Font Families */
+#define FF_DONTCARE 0x00
+#define FF_ROMAN 0x10
+#define FF_SWISS 0x20
+#define FF_MODERN 0x30
+#define FF_SCRIPT 0x40
+#define FF_DECORATIVE 0x50
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#define DEFAULT_PITCH 0x00
+#define FIXED_PITCH 0x01
+#define VARIABLE_PITCH 0x02
+
+using namespace ::com::sun::star ;
+using namespace uno ;
+using namespace beans ;
+using namespace drawing ;
+using namespace container ;
+using namespace table ;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+PowerPointImportParam::PowerPointImportParam( SvStream& rDocStrm, sal_uInt32 nFlags, MSFilterTracer* pT ) :
+ rDocStream ( rDocStrm ),
+ nImportFlags ( nFlags ),
+ pTracer ( pT )
+{
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SvStream& operator>>( SvStream& rIn, PptCurrentUserAtom& rAtom )
+{
+ DffRecordHeader aHd;
+ rIn >> aHd;
+ if ( aHd.nRecType == PPT_PST_CurrentUserAtom )
+ {
+ sal_uInt32 nLen;
+ sal_uInt16 nUserNameLen, nPad;
+ rIn >> nLen
+ >> rAtom.nMagic
+ >> rAtom.nCurrentUserEdit
+ >> nUserNameLen
+ >> rAtom.nDocFileVersion
+ >> rAtom.nMajorVersion
+ >> rAtom.nMinorVersion
+ >> nPad;
+ SvxMSDffManager::MSDFFReadZString( rIn, rAtom.aCurrentUser, nUserNameLen, sal_True );
+ }
+ aHd.SeekToEndOfRecord( rIn );
+ return rIn;
+}
+
+void PptSlidePersistAtom::Clear()
+{
+ nReserved = nPsrReference = nFlags = nNumberTexts = nSlideId = 0;
+}
+
+SvStream& operator>>( SvStream& rIn, PptSlidePersistAtom& rAtom )
+{
+ DffRecordHeader aHd;
+ rIn >> aHd
+ >> rAtom.nPsrReference
+ >> rAtom.nFlags
+ >> rAtom.nNumberTexts
+ >> rAtom.nSlideId;
+// >> rAtom.nReserved;
+ aHd.SeekToEndOfRecord( rIn );
+ return rIn;
+}
+
+SV_IMPL_PTRARR(_PptSlidePersistList,PptSlidePersistEntry*);
+
+USHORT PptSlidePersistList::FindPage(UINT32 nId) const
+{
+ for ( USHORT i=0; i < Count(); i++ )
+ {
+ if (operator[](i)->GetSlideId()==nId) return i;
+ }
+ return PPTSLIDEPERSIST_ENTRY_NOTFOUND;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SvStream& operator>>( SvStream& rIn, PptInteractiveInfoAtom& rAtom )
+{
+ rIn >> rAtom.nSoundRef
+ >> rAtom.nExHyperlinkId
+ >> rAtom.nAction
+ >> rAtom.nOleVerb
+ >> rAtom.nJump
+ >> rAtom.nFlags
+ >> rAtom.nHyperlinkType
+ >> rAtom.nUnknown1
+ >> rAtom.nUnknown2
+ >> rAtom.nUnknown3;
+ return rIn;
+}
+
+SvStream& operator>>( SvStream& rIn, PptExOleObjAtom& rAtom )
+{
+ rIn >> rAtom.nAspect
+ >> rAtom.nDummy1
+ >> rAtom.nId
+ >> rAtom.nDummy2
+ >> rAtom.nPersistPtr
+ >> rAtom.nDummy4;
+ return rIn;
+}
+
+Size PptDocumentAtom::GetPageSize(const Size& rSiz) const
+{
+ return rSiz;
+/*
+ Size aRet;
+ switch ( eSlidesPageFormat )
+ {
+ // Wenn man in Powerpoint als Seitenformat "Bildschirmgroesse"
+ // einstellt, dann zeigt dieser Dialog zwar 24x18cm an, die
+ // angezeigte Seite ist aber anders. Das sieht man, wenn man
+ // ein Rechteck seitenfuellend aufzieht und sich dessen Groesse
+ // ansieht. Die importierten Abmessungen sind auf jeden Fall
+ // die, die auch im Ppt-File stehen. Ich denke, das es sich
+ // hier eher um ein Bug in PowerPoint handelt, das im
+ // Seitenformat-Dialog bei "Bildschirmgroesse" falsche Masse
+ // angezeigt werden (vielleicht ja auch bildschirmabhaengig?).
+// case PPTPF_SCREEN : aRet.Width()=4082; aRet.Height()=5443; break;
+ case PPTPF_USLETTER: aRet.Width()=4896; aRet.Height()=6336; break;
+ case PPTPF_A4 : aRet.Width()=4762; aRet.Height()=6735; break;
+// case PPTPF_35MMDIA : aRet.Width()=4082; aRet.Height()=6123; break;
+// case PPTPF_OVERHEAD: aRet.Width()=4082; aRet.Height()=5443; break;
+ }
+ if ( aRet.Width() )
+ {
+ if ( rSiz.Width() > rSiz.Height() )
+ { // Querformat
+ long nMerk = aRet.Width();
+ aRet.Width() = aRet.Height();
+ aRet.Height() = nMerk;
+ }
+ }
+ else // CustomFormat oder Unbekannt oder Screen,Dia,Overhead
+ aRet = rSiz;
+ return aRet;
+*/
+}
+
+SvStream& operator>>(SvStream& rIn, PptDocumentAtom& rAtom)
+{
+// Tatsaechliches Format:
+// 00 aSlidePageSizeXY 8
+// 08 aNotesPageSizeXY 8
+// 16 aZoomRatio (OLE) 8
+// 24 nNotesMasterPersist 4
+// 28 nHandoutMasterPersist 4
+// 32 n1stPageNumber 2
+// 34 ePageFormat 2
+// 36 bEmbeddedTrueType 1
+// 37 bOmitTitlePlace 1
+// 38 bRightToLeft 1
+// 39 bShowComments 1
+
+ DffRecordHeader aHd;
+ INT32 nSlideX,nSlideY, nNoticeX, nNoticeY, nDummy;
+ UINT16 nSlidePageFormat;
+ INT8 nEmbeddedTrueType, nTitlePlaceHoldersOmitted, nRightToLeft, nShowComments;
+
+ rIn >> aHd
+ >> nSlideX >> nSlideY
+ >> nNoticeX >> nNoticeY
+ >> nDummy >> nDummy // ZoomRation ueberspringen
+ >> rAtom.nNotesMasterPersist
+ >> rAtom.nHandoutMasterPersist
+ >> rAtom.n1stPageNumber
+ >> nSlidePageFormat
+ >> nEmbeddedTrueType
+ >> nTitlePlaceHoldersOmitted
+ >> nRightToLeft
+ >> nShowComments;
+ rAtom.aSlidesPageSize.Width() = nSlideX;
+ rAtom.aSlidesPageSize.Height() = nSlideY;
+ rAtom.aNotesPageSize.Width() = nNoticeX;
+ rAtom.aNotesPageSize.Height() = nNoticeY;
+ rAtom.eSlidesPageFormat = (PptPageFormat)nSlidePageFormat;
+ rAtom.bEmbeddedTrueType = nEmbeddedTrueType;
+ rAtom.bTitlePlaceholdersOmitted = nTitlePlaceHoldersOmitted;
+ rAtom.bRightToLeft = nRightToLeft;
+ rAtom.bShowComments = nShowComments;
+ aHd.SeekToEndOfRecord( rIn );
+ return rIn;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void PptSlideLayoutAtom::Clear()
+{
+ eLayout = 0;
+ for ( USHORT i = 0; i < 8; i++ )
+ {
+ aPlaceholderId[ i ] = 0;
+ aPlacementId[ i ] = 0;
+ }
+}
+
+SvStream& operator>>( SvStream& rIn, PptSlideLayoutAtom& rAtom )
+{
+ rIn >> rAtom.eLayout;
+ rIn.Read( rAtom.aPlaceholderId, 8 );
+ return rIn;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SvStream& operator>>( SvStream& rIn, PptSlideAtom& rAtom )
+{
+ DffRecordHeader aHd;
+ rIn >> aHd
+ >> rAtom.aLayout
+ >> rAtom.nMasterId
+ >> rAtom.nNotesId
+ >> rAtom.nFlags;
+ aHd.SeekToEndOfRecord( rIn );
+ return rIn;
+}
+
+void PptSlideAtom::Clear()
+{
+ nMasterId = nNotesId = 0;
+ nFlags = 0;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SvStream& operator>>( SvStream& rIn, PptNotesAtom& rAtom )
+{
+ DffRecordHeader aHd;
+ rIn >> aHd
+ >> rAtom.nSlideId
+ >> rAtom.nFlags;
+ aHd.SeekToEndOfRecord( rIn );
+ return rIn;
+}
+
+void PptNotesAtom::Clear()
+{
+ nSlideId = 0;
+ nFlags = 0;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void PptColorSchemeAtom::Clear()
+{
+ memset(&aData[0], 0, 32);
+}
+
+Color PptColorSchemeAtom::GetColor( USHORT nNum ) const
+{
+ Color aRetval;
+ if ( nNum < 8 )
+ {
+ nNum <<= 2;
+ aRetval.SetRed( aData[ nNum++ ] );
+ aRetval.SetGreen( aData[ nNum++ ] );
+ aRetval.SetBlue( aData[ nNum++ ] );
+ }
+ return aRetval;
+}
+
+SvStream& operator>>( SvStream& rIn, PptColorSchemeAtom& rAtom )
+{
+ DffRecordHeader aHd;
+ rIn >> aHd;
+ rIn.Read( rAtom.aData, 32 );
+ aHd.SeekToEndOfRecord( rIn );
+ return rIn;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SvStream& operator>>( SvStream& rIn, PptFontEntityAtom& rAtom )
+{
+ DffRecordHeader aHd;
+ rIn >> aHd;
+ sal_Unicode nTemp, cData[ 32 ];
+ rIn.Read( cData, 64 );
+
+ sal_uInt8 lfCharset, lfPitchAndFamily;
+
+ rIn >> lfCharset
+ >> rAtom.lfClipPrecision
+ >> rAtom.lfQuality
+ >> lfPitchAndFamily;
+
+ switch( lfCharset )
+ {
+ case SYMBOL_CHARSET :
+ rAtom.eCharSet = RTL_TEXTENCODING_SYMBOL;
+ break;
+ case ANSI_CHARSET :
+ rAtom.eCharSet = RTL_TEXTENCODING_MS_1252;
+ break;
+
+// case DEFAULT_CHARSET :
+// case SHIFTJIS_CHARSET :
+// case HANGEUL_CHARSET :
+// case CHINESEBIG5_CHARSET :
+// case OEM_CHARSET :
+ default :
+ rAtom.eCharSet = gsl_getSystemTextEncoding();
+ }
+ switch ( lfPitchAndFamily & 0xf0 )
+ {
+ case FF_ROMAN:
+ rAtom.eFamily = FAMILY_ROMAN;
+ break;
+
+ case FF_SWISS:
+ rAtom.eFamily = FAMILY_SWISS;
+ break;
+
+ case FF_MODERN:
+ rAtom.eFamily = FAMILY_MODERN;
+ break;
+
+ case FF_SCRIPT:
+ rAtom.eFamily = FAMILY_SCRIPT;
+ break;
+
+ case FF_DECORATIVE:
+ rAtom.eFamily = FAMILY_DECORATIVE;
+ break;
+
+ default:
+ rAtom.eFamily = FAMILY_DONTKNOW;
+ break;
+ }
+
+ switch ( lfPitchAndFamily & 0x0f )
+ {
+ case FIXED_PITCH:
+ rAtom.ePitch = PITCH_FIXED;
+ break;
+
+ case DEFAULT_PITCH:
+ case VARIABLE_PITCH:
+ default:
+ rAtom.ePitch = PITCH_VARIABLE;
+ break;
+ }
+ sal_uInt16 i;
+ for ( i = 0; i < 32; i++ )
+ {
+ nTemp = cData[ i ];
+ if ( !nTemp )
+ break;
+#ifdef OSL_BIGENDIAN
+ cData[ i ] = ( nTemp >> 8 ) | ( nTemp << 8 );
+#endif
+ }
+ rAtom.aName = String( cData, i );
+ OutputDevice* pDev = (OutputDevice*)Application::GetDefaultDevice();
+ rAtom.bAvailable = pDev->IsFontAvailable( rAtom.aName );
+ aHd.SeekToEndOfRecord( rIn );
+ return rIn;
+}
+
+SV_DECL_PTRARR_DEL( PptFontEntityAtomList, PptFontEntityAtom*, 16, 16 )
+SV_IMPL_PTRARR( PptFontEntityAtomList, PptFontEntityAtom* );
+
+class PptFontCollection: public PptFontEntityAtomList {
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SvStream& operator>>( SvStream& rIn, PptUserEditAtom& rAtom )
+{
+ rIn >> rAtom.aHd
+ >> rAtom.nLastSlideID
+ >> rAtom.nVersion
+ >> rAtom.nOffsetLastEdit
+ >> rAtom.nOffsetPersistDirectory
+ >> rAtom.nDocumentRef
+ >> rAtom.nMaxPersistWritten
+ >> rAtom.eLastViewType;
+ rAtom.aHd.SeekToEndOfRecord(rIn);
+ return rIn;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void PptOEPlaceholderAtom::Clear()
+{
+ nPlacementId = 0;
+ nPlaceholderSize = nPlaceholderId = 0;
+}
+
+SvStream& operator>>( SvStream& rIn, PptOEPlaceholderAtom& rAtom )
+{
+ rIn >> rAtom.nPlacementId
+ >> rAtom.nPlaceholderId
+ >> rAtom.nPlaceholderSize;
+ return rIn;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+PptSlidePersistEntry::PptSlidePersistEntry() :
+ pStyleSheet ( NULL ),
+ pHeaderFooterEntry ( NULL ),
+ pSolverContainer ( NULL ),
+ nSlidePersistStartOffset( 0 ),
+ nSlidePersistEndOffset ( 0 ),
+ nBackgroundOffset ( 0 ),
+ nDrawingDgId ( 0xffffffff ),
+ pPresentationObjects ( NULL ),
+ pBObj ( NULL ),
+ bBObjIsTemporary ( sal_True ),
+ ePageKind ( PPT_MASTERPAGE ),
+ bNotesMaster ( FALSE ),
+ bHandoutMaster ( FALSE ),
+ bStarDrawFiller ( FALSE )
+{
+ HeaderFooterOfs[ 0 ] = HeaderFooterOfs[ 1 ] = HeaderFooterOfs[ 2 ] = HeaderFooterOfs[ 3 ] = 0;
+}
+
+
+PptSlidePersistEntry::~PptSlidePersistEntry()
+{
+ delete pStyleSheet;
+ delete pSolverContainer;
+ delete[] pPresentationObjects;
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SdrEscherImport::SdrEscherImport( PowerPointImportParam& rParam, const String& rBaseURL ) :
+ SvxMSDffManager ( rParam.rDocStream, rBaseURL, rParam.pTracer ),
+ pFonts ( NULL ),
+ nStreamLen ( 0 ),
+ nTextStylesIndex ( 0xffff ),
+ eCharSetSystem ( gsl_getSystemTextEncoding() ),
+ bWingdingsChecked ( FALSE ),
+ bWingdingsAvailable ( FALSE ),
+ bMonotypeSortsChecked ( FALSE ),
+ bMonotypeSortsAvailable ( FALSE ),
+ bTimesNewRomanChecked ( FALSE ),
+ bTimesNewRomanAvailable ( FALSE ),
+ rImportParam ( rParam )
+{
+}
+
+SdrEscherImport::~SdrEscherImport()
+{
+ void* pPtr;
+ for ( pPtr = aOleObjectList.First(); pPtr; pPtr = aOleObjectList.Next() )
+ delete (PPTOleEntry*)pPtr;
+ delete pFonts;
+}
+
+const PptSlideLayoutAtom* SdrEscherImport::GetSlideLayoutAtom() const
+{
+ return NULL;
+}
+
+sal_Bool SdrEscherImport::ReadString( String& rStr ) const
+{
+ sal_Bool bRet = FALSE;
+ DffRecordHeader aStrHd;
+ rStCtrl >> aStrHd;
+ if (aStrHd.nRecType == PPT_PST_TextBytesAtom
+ || aStrHd.nRecType == PPT_PST_TextCharsAtom
+ || aStrHd.nRecType == PPT_PST_CString)
+ {
+ sal_Bool bUniCode =
+ (aStrHd.nRecType == PPT_PST_TextCharsAtom
+ || aStrHd.nRecType == PPT_PST_CString);
+ bRet=TRUE;
+ ULONG nBytes = aStrHd.nRecLen;
+ MSDFFReadZString( rStCtrl, rStr, nBytes, bUniCode );
+ aStrHd.SeekToEndOfRecord( rStCtrl );
+ }
+ else
+ aStrHd.SeekToBegOfRecord( rStCtrl );
+ return bRet;
+}
+
+FASTBOOL SdrEscherImport::GetColorFromPalette(USHORT /*nNum*/, Color& /*rColor*/) const
+{
+ return FALSE;
+}
+
+BOOL SdrEscherImport::SeekToShape( SvStream& /*rSt*/, void* /*pClientData*/, UINT32 /*nId*/) const
+{
+ return FALSE;
+}
+
+PptFontEntityAtom* SdrEscherImport::GetFontEnityAtom( UINT32 nNum ) const
+{
+ PptFontEntityAtom* pRetValue = NULL;
+ if ( pFonts && ( nNum < pFonts->Count() ) )
+ pRetValue = (*pFonts)[ (USHORT)nNum ];
+ return pRetValue;
+}
+
+CharSet SdrEscherImport::GetCharSet( UINT32 nNum ) const
+{
+ CharSet eRetValue( eCharSetSystem );
+ if ( pFonts && ( nNum < pFonts->Count() ) )
+ eRetValue = (*pFonts)[ (USHORT)nNum ]->eCharSet;
+ return eRetValue;
+}
+
+BOOL SdrEscherImport::IsFontAvailable( UINT32 nNum ) const
+{
+ BOOL bRetValue = FALSE;
+ if ( pFonts && ( nNum < pFonts->Count() ) )
+ bRetValue = (*pFonts)[ (USHORT)nNum ]->bAvailable;
+ return bRetValue;
+}
+
+SdrObject* SdrEscherImport::ReadObjText( PPTTextObj* /*pTextObj*/, SdrObject* pObj, SdPage* /*pPage*/) const
+{
+ return pObj;
+}
+
+void SdrEscherImport::ProcessClientAnchor2( SvStream& rSt, DffRecordHeader& rHd, void* /*pData*/, DffObjData& rObj )
+{
+ sal_Int32 l, t, r, b;
+ if ( rHd.nRecLen == 16 )
+ {
+ rSt >> l >> t >> r >> b;
+ }
+ else
+ {
+ INT16 ls, ts, rs, bs;
+ rSt >> ts >> ls >> rs >> bs; // etwas seltsame Koordinatenreihenfolge ...
+ l = ls, t = ts, r = rs, b = bs;
+ }
+ Scale( l );
+ Scale( t );
+ Scale( r );
+ Scale( b );
+ rObj.aChildAnchor = Rectangle( l, t, r, b );
+ rObj.bChildAnchor = TRUE;
+ return;
+};
+
+void SdrEscherImport::RecolorGraphic( SvStream& rSt, sal_uInt32 nRecLen, Graphic& rGraphic )
+{
+ if ( rGraphic.GetType() == GRAPHIC_GDIMETAFILE )
+ {
+ sal_uInt16 nX, nGlobalColorsCount, nFillColorsCount;
+
+ rSt >> nX
+ >> nGlobalColorsCount
+ >> nFillColorsCount
+ >> nX
+ >> nX
+ >> nX;
+
+ if ( ( nGlobalColorsCount <= 64 ) && ( nFillColorsCount <= 64 ) )
+ {
+ if ( (sal_uInt32)( ( nGlobalColorsCount + nFillColorsCount ) * 44 + 12 ) == nRecLen )
+ {
+ sal_uInt32 OriginalGlobalColors[ 64 ];
+ sal_uInt32 NewGlobalColors[ 64 ];
+ sal_uInt32 OriginalFillColors[ 64 ];
+ sal_uInt32 NewFillColors[ 64 ];
+
+ sal_uInt32 i, j, nGlobalColorsChanged, nFillColorsChanged;
+ nGlobalColorsChanged = nFillColorsChanged = 0;
+
+ sal_uInt32* pCurrentOriginal = OriginalGlobalColors;
+ sal_uInt32* pCurrentNew = NewGlobalColors;
+ sal_uInt32* pCount = &nGlobalColorsChanged;
+ i = nGlobalColorsCount;
+
+ for ( j = 0; j < 2; j++ )
+ {
+ for ( ; i > 0; i-- )
+ {
+ sal_uInt32 nIndex, nPos = rSt.Tell();
+ sal_uInt8 nDummy, nRed, nGreen, nBlue;
+ sal_uInt16 nChanged;
+ rSt >> nChanged;
+ if ( nChanged & 1 )
+ {
+ sal_uInt32 nColor = 0;
+ rSt >> nDummy
+ >> nRed
+ >> nDummy
+ >> nGreen
+ >> nDummy
+ >> nBlue
+ >> nIndex;
+
+ if ( nIndex < 8 )
+ {
+ Color aColor = MSO_CLR_ToColor( nIndex << 24 );
+ nRed = aColor.GetRed();
+ nGreen = aColor.GetGreen();
+ nBlue = aColor.GetBlue();
+ }
+ nColor = nRed | ( nGreen << 8 ) | ( nBlue << 16 );
+ *pCurrentNew++ = nColor;
+ rSt >> nDummy
+ >> nRed
+ >> nDummy
+ >> nGreen
+ >> nDummy
+ >> nBlue;
+ nColor = nRed | ( nGreen << 8 ) | ( nBlue << 16 );
+ *pCurrentOriginal++ = nColor;
+ (*pCount)++;
+ }
+ rSt.Seek( nPos + 44 );
+ }
+ pCurrentOriginal = OriginalFillColors;
+ pCurrentNew = NewFillColors;
+ pCount = &nFillColorsChanged;
+ i = nFillColorsCount;
+ }
+ if ( nGlobalColorsChanged || nFillColorsChanged )
+ {
+ Color* pSearchColors = new Color[ nGlobalColorsChanged ];
+ Color* pReplaceColors = new Color[ nGlobalColorsChanged ];
+
+ for ( j = 0; j < nGlobalColorsChanged; j++ )
+ {
+ sal_uInt32 nSearch = OriginalGlobalColors[ j ];
+ sal_uInt32 nReplace = NewGlobalColors[ j ];
+
+ pSearchColors[ j ].SetRed( (BYTE)nSearch );
+ pSearchColors[ j ].SetGreen( (BYTE)( nSearch >> 8 ) );
+ pSearchColors[ j ].SetBlue( (BYTE)( nSearch >> 16 ) );
+
+ pReplaceColors[ j ].SetRed( (BYTE)nReplace );
+ pReplaceColors[ j ].SetGreen( (BYTE)( nReplace >> 8 ) );
+ pReplaceColors[ j ].SetBlue( (BYTE)( nReplace >> 16 ) );
+ }
+ GDIMetaFile aGdiMetaFile( rGraphic.GetGDIMetaFile() );
+ aGdiMetaFile.ReplaceColors( pSearchColors, pReplaceColors,
+ nGlobalColorsChanged, NULL );
+ rGraphic = aGdiMetaFile;
+
+ delete[] pSearchColors;
+ delete[] pReplaceColors;
+ }
+ }
+ }
+ }
+}
+
+/* ProcessObject is called from ImplSdPPTImport::ProcessObj to hanlde all application specific things,
+ such as the import of text, animation effects, header footer and placeholder.
+
+ The parameter pOriginalObj is the object as it was imported by our general escher import, it must either
+ be deleted or it can be returned to be inserted into the sdr page.
+*/
+SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, void* pData, Rectangle& rTextRect, SdrObject* pOriginalObj )
+{
+ if ( pOriginalObj && pOriginalObj->ISA( SdrObjCustomShape ) )
+ pOriginalObj->SetMergedItem( SdrTextFixedCellHeightItem( TRUE ) );
+
+ // we are initializing our return value with the object that was imported by our escher import
+ SdrObject* pRet = pOriginalObj;
+
+ ProcessData& rData = *((ProcessData*)pData);
+ PptSlidePersistEntry& rPersistEntry = rData.rPersistEntry;
+
+ if ( ! ( rObjData.nSpFlags & SP_FGROUP ) ) // sj: #114758# ...
+ {
+ PptOEPlaceholderAtom aPlaceholderAtom;
+ INT16 nHeaderFooterInstance = -1;
+
+ if ( maShapeRecords.SeekToContent( rSt, DFF_msofbtClientData, SEEK_FROM_CURRENT_AND_RESTART ) )
+ {
+ DffRecordHeader aClientDataHd;
+ while ( ( rSt.GetError() == 0 ) && ( rSt.Tell() < maShapeRecords.Current()->GetRecEndFilePos() ) )
+ {
+ rSt >> aClientDataHd;
+ switch ( aClientDataHd.nRecType )
+ {
+ // importing header/footer object from master page
+ case PPT_PST_OEPlaceholderAtom :
+ {
+ rSt >> aPlaceholderAtom;
+ if ( nHeaderFooterInstance == -1 )
+ {
+ switch ( aPlaceholderAtom.nPlaceholderId )
+ {
+ case PPT_PLACEHOLDER_MASTERSLIDENUMBER : nHeaderFooterInstance++;
+ case PPT_PLACEHOLDER_MASTERFOOTER : nHeaderFooterInstance++;
+ case PPT_PLACEHOLDER_MASTERHEADER : nHeaderFooterInstance++;
+ case PPT_PLACEHOLDER_MASTERDATE : nHeaderFooterInstance++; break;
+ }
+ if ( ! ( nHeaderFooterInstance & 0xfffc ) ) // is this a valid instance ( 0->3 )
+ rPersistEntry.HeaderFooterOfs[ nHeaderFooterInstance ] = rObjData.rSpHd.GetRecBegFilePos();
+ }
+ }
+ break;
+
+ case PPT_PST_RecolorInfoAtom :
+ {
+ if ( pRet && ( pRet->ISA( SdrGrafObj ) && ((SdrGrafObj*)pRet)->HasGDIMetaFile() ) )
+ {
+ Graphic aGraphic( ((SdrGrafObj*)pRet)->GetGraphic() );
+ RecolorGraphic( rSt, aClientDataHd.nRecLen, aGraphic );
+ ((SdrGrafObj*)pRet)->SetGraphic( aGraphic );
+ }
+ }
+ break;
+ }
+ aClientDataHd.SeekToEndOfRecord( rSt );
+ }
+ }
+ if ( ( aPlaceholderAtom.nPlaceholderId == PPT_PLACEHOLDER_NOTESSLIDEIMAGE ) && ( rPersistEntry.bNotesMaster == FALSE ) )
+ {
+ USHORT nPageNum = pSdrModel->GetPageCount();
+ if ( nPageNum > 0 )
+ nPageNum--;
+
+ // replacing the object which we will return with a SdrPageObj
+ SdrObject::Free( pRet );
+ pRet = new SdrPageObj( rObjData.aBoundRect, pSdrModel->GetPage( nPageNum - 1 ) );
+ }
+ else
+ {
+ // try to load some ppt text
+ PPTTextObj aTextObj( rSt, (SdrPowerPointImport&)*this, rPersistEntry, &rObjData );
+ if ( ( aTextObj.Count() || aTextObj.GetOEPlaceHolderAtom() ) )
+ {
+ sal_Bool bVerticalText = sal_False;
+ // and if the text object is not empty, it must be applied to pRet, the object we
+ // initially got from our escher import
+ INT32 nTextRotationAngle = 0;
+ if ( IsProperty( DFF_Prop_txflTextFlow ) )
+ {
+ MSO_TextFlow eTextFlow = (MSO_TextFlow)( GetPropertyValue( DFF_Prop_txflTextFlow ) & 0xFFFF );
+ switch( eTextFlow )
+ {
+ case mso_txflBtoT : // Bottom to Top non-@, unten -> oben
+ nTextRotationAngle += 9000;
+ break;
+ case mso_txflTtoBA : /* #68110# */ // Top to Bottom @-font, oben -> unten
+ case mso_txflTtoBN : // Top to Bottom non-@, oben -> unten
+ case mso_txflVertN : // Vertical, non-@, oben -> unten
+ bVerticalText = !bVerticalText; // nTextRotationAngle += 27000;
+ break;
+ // case mso_txflHorzN : // Horizontal non-@, normal
+ // case mso_txflHorzA : // Horizontal @-font, normal
+ default: break;
+ }
+ }
+ sal_Int32 nFontDirection = GetPropertyValue( DFF_Prop_cdirFont, mso_cdir0 );
+ nTextRotationAngle -= nFontDirection * 9000;
+ if ( ( nFontDirection == 1 ) || ( nFontDirection == 3 ) ) // #104546#
+ {
+ bVerticalText = !bVerticalText;
+/*
+ sal_Int32 nHalfWidth = ( rTextRect.GetWidth() + 1 ) >> 1;
+ sal_Int32 nHalfHeight = ( rTextRect.GetHeight() + 1 ) >> 1;
+ Point aTopLeft( rTextRect.Left() + nHalfWidth - nHalfHeight,
+ rTextRect.Top() + nHalfHeight - nHalfWidth );
+ Size aNewSize( rTextRect.GetHeight(), rTextRect.GetWidth() );
+ Rectangle aNewRect( aTopLeft, aNewSize );
+ rTextRect = aNewRect;
+*/
+ }
+ aTextObj.SetVertical( bVerticalText );
+ if ( pRet )
+ {
+ BOOL bDeleteSource = aTextObj.GetOEPlaceHolderAtom() != 0;
+ if ( bDeleteSource && ( pRet->ISA( SdrGrafObj ) == FALSE ) // we are not allowed to get
+ && ( pRet->ISA( SdrObjGroup ) == FALSE ) // grouped placeholder objects
+ && ( pRet->ISA( SdrOle2Obj ) == FALSE ) )
+ SdrObject::Free( pRet );
+ }
+ sal_uInt32 nTextFlags = aTextObj.GetTextFlags();
+ sal_Int32 nTextLeft = GetPropertyValue( DFF_Prop_dxTextLeft, 25 * 3600 ); // 0.25 cm (emu)
+ sal_Int32 nTextRight = GetPropertyValue( DFF_Prop_dxTextRight, 25 * 3600 ); // 0.25 cm (emu)
+ sal_Int32 nTextTop = GetPropertyValue( DFF_Prop_dyTextTop, 13 * 3600 ); // 0.13 cm (emu)
+ sal_Int32 nTextBottom = GetPropertyValue( DFF_Prop_dyTextBottom, 13 * 3600 );
+ ScaleEmu( nTextLeft );
+ ScaleEmu( nTextRight );
+ ScaleEmu( nTextTop );
+ ScaleEmu( nTextBottom );
+
+ sal_Int32 nMinFrameWidth = 0;
+ sal_Int32 nMinFrameHeight = 0;
+ sal_Bool bAutoGrowWidth, bAutoGrowHeight;
+
+ SdrTextVertAdjust eTVA;
+ SdrTextHorzAdjust eTHA;
+
+ nTextFlags &= PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_LEFT | PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_RIGHT
+ | PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_CENTER | PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_BLOCK;
+
+ if ( bVerticalText )
+ {
+ eTVA = SDRTEXTVERTADJUST_BLOCK;
+ eTHA = SDRTEXTHORZADJUST_CENTER;
+
+ // Textverankerung lesen
+ MSO_Anchor eTextAnchor = (MSO_Anchor)GetPropertyValue( DFF_Prop_anchorText, mso_anchorTop );
+
+ switch( eTextAnchor )
+ {
+ case mso_anchorTop:
+ case mso_anchorTopCentered:
+ case mso_anchorTopBaseline:
+ case mso_anchorTopCenteredBaseline:
+ eTHA = SDRTEXTHORZADJUST_RIGHT;
+ break;
+
+ case mso_anchorMiddle :
+ case mso_anchorMiddleCentered:
+ eTHA = SDRTEXTHORZADJUST_CENTER;
+ break;
+
+ case mso_anchorBottom:
+ case mso_anchorBottomCentered:
+ case mso_anchorBottomBaseline:
+ case mso_anchorBottomCenteredBaseline:
+ eTHA = SDRTEXTHORZADJUST_LEFT;
+ break;
+ }
+ // if there is a 100% use of following attributes, the textbox can been aligned also in vertical direction
+ switch ( eTextAnchor )
+ {
+ case mso_anchorTopCentered :
+ case mso_anchorMiddleCentered :
+ case mso_anchorBottomCentered :
+ case mso_anchorTopCenteredBaseline:
+ case mso_anchorBottomCenteredBaseline:
+ {
+ // check if it is sensible to use the centered alignment
+ sal_uInt32 nMask = PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_LEFT | PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_RIGHT;
+ if ( ( nTextFlags & nMask ) != nMask ) // if the textobject has left and also right aligned pararagraphs
+ eTVA = SDRTEXTVERTADJUST_CENTER; // the text has to be displayed using the full width;
+ }
+ break;
+
+ default :
+ {
+ if ( nTextFlags == PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_LEFT )
+ eTVA = SDRTEXTVERTADJUST_TOP;
+ else if ( nTextFlags == PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_RIGHT )
+ eTVA = SDRTEXTVERTADJUST_BOTTOM;
+ }
+ break;
+ }
+ nMinFrameWidth = rTextRect.GetWidth() - ( nTextLeft + nTextRight );
+ }
+ else
+ {
+ eTVA = SDRTEXTVERTADJUST_CENTER;
+ eTHA = SDRTEXTHORZADJUST_BLOCK;
+
+ // Textverankerung lesen
+ MSO_Anchor eTextAnchor = (MSO_Anchor)GetPropertyValue( DFF_Prop_anchorText, mso_anchorTop );
+
+ switch( eTextAnchor )
+ {
+ case mso_anchorTop:
+ case mso_anchorTopCentered:
+ case mso_anchorTopBaseline:
+ case mso_anchorTopCenteredBaseline:
+ eTVA = SDRTEXTVERTADJUST_TOP;
+ break;
+
+ case mso_anchorMiddle :
+ case mso_anchorMiddleCentered:
+ eTVA = SDRTEXTVERTADJUST_CENTER;
+ break;
+
+ case mso_anchorBottom:
+ case mso_anchorBottomCentered:
+ case mso_anchorBottomBaseline:
+ case mso_anchorBottomCenteredBaseline:
+ eTVA = SDRTEXTVERTADJUST_BOTTOM;
+ break;
+ }
+ // if there is a 100% usage of following attributes, the textbox can be aligned also in horizontal direction
+ switch ( eTextAnchor )
+ {
+ case mso_anchorTopCentered :
+ case mso_anchorMiddleCentered :
+ case mso_anchorBottomCentered :
+ case mso_anchorTopCenteredBaseline:
+ case mso_anchorBottomCenteredBaseline:
+ {
+ // check if it is sensible to use the centered alignment
+ sal_uInt32 nMask = PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_LEFT | PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_RIGHT;
+ if ( ( nTextFlags & nMask ) != nMask ) // if the textobject has left and also right aligned pararagraphs
+ eTHA = SDRTEXTHORZADJUST_CENTER; // the text has to be displayed using the full width;
+ }
+ break;
+
+ default :
+ break;
+ }
+ nMinFrameHeight = rTextRect.GetHeight() - ( nTextTop + nTextBottom );
+ }
+
+ SdrObjKind eTextKind = OBJ_RECT;
+ if ( ( aPlaceholderAtom.nPlaceholderId == PPT_PLACEHOLDER_NOTESSLIDEIMAGE )
+ || ( aPlaceholderAtom.nPlaceholderId == PPT_PLACEHOLDER_MASTERNOTESSLIDEIMAGE ) )
+ {
+ aTextObj.SetInstance( 2 );
+ eTextKind = OBJ_TITLETEXT;
+ }
+ else if ( ( aPlaceholderAtom.nPlaceholderId == PPT_PLACEHOLDER_MASTERNOTESBODYIMAGE )
+ || ( aPlaceholderAtom.nPlaceholderId == PPT_PLACEHOLDER_NOTESBODY ) )
+ {
+ aTextObj.SetInstance( 2 );
+ eTextKind = OBJ_TEXT;
+ }
+
+ sal_uInt32 nDestinationInstance = aTextObj.GetInstance();
+ if ( ( rPersistEntry.ePageKind == PPT_MASTERPAGE ) )
+ {
+ if ( !rPersistEntry.pPresentationObjects )
+ {
+ rPersistEntry.pPresentationObjects = new UINT32[ PPT_STYLESHEETENTRYS ];
+ memset( rPersistEntry.pPresentationObjects, 0, PPT_STYLESHEETENTRYS * 4 );
+ }
+ if ( !rPersistEntry.pPresentationObjects[ nDestinationInstance ] )
+ rPersistEntry.pPresentationObjects[ nDestinationInstance ] = rObjData.rSpHd.GetRecBegFilePos();
+ }
+ switch ( nDestinationInstance )
+ {
+ case TSS_TYPE_PAGETITLE :
+ case TSS_TYPE_TITLE :
+ {
+ if ( GetSlideLayoutAtom()->eLayout == PPT_LAYOUT_TITLEMASTERSLIDE )
+ nDestinationInstance = TSS_TYPE_TITLE;
+ else
+ nDestinationInstance = TSS_TYPE_PAGETITLE;
+ }
+ break;
+ case TSS_TYPE_BODY :
+ // case TSS_TYPE_SUBTITLE :
+ case TSS_TYPE_HALFBODY :
+ case TSS_TYPE_QUARTERBODY :
+ nDestinationInstance = TSS_TYPE_BODY;
+ break;
+ }
+ aTextObj.SetDestinationInstance( (sal_uInt16)nDestinationInstance );
+
+ switch ( aTextObj.GetInstance() )
+ {
+ case TSS_TYPE_PAGETITLE :
+ case TSS_TYPE_TITLE : eTextKind = OBJ_TITLETEXT; break;
+ case TSS_TYPE_SUBTITLE : eTextKind = OBJ_TEXT; break;
+ case TSS_TYPE_BODY :
+ case TSS_TYPE_HALFBODY :
+ case TSS_TYPE_QUARTERBODY : eTextKind = OBJ_OUTLINETEXT; break;
+ }
+ if ( aTextObj.GetDestinationInstance() != TSS_TYPE_TEXT_IN_SHAPE )
+ {
+ if ( !aTextObj.GetOEPlaceHolderAtom() || !aTextObj.GetOEPlaceHolderAtom()->nPlaceholderId )
+ {
+ aTextObj.SetDestinationInstance( TSS_TYPE_TEXT_IN_SHAPE );
+ eTextKind = OBJ_RECT;
+ }
+ }
+ SdrObject* pTObj = NULL;
+ sal_Bool bWordWrap = (MSO_WrapMode)GetPropertyValue( DFF_Prop_WrapText, mso_wrapSquare ) != mso_wrapNone;
+ sal_Bool bFitShapeToText = ( GetPropertyValue( DFF_Prop_FitTextToShape ) & 2 ) != 0;
+
+ if ( pRet && pRet->ISA( SdrObjCustomShape ) && ( eTextKind == OBJ_RECT ) )
+ {
+ bAutoGrowHeight = bFitShapeToText;
+ if ( bWordWrap )
+ bAutoGrowWidth = sal_False;
+ else
+ bAutoGrowWidth = sal_True;
+ pTObj = pRet;
+ pRet = NULL;
+ }
+ else
+ {
+ if ( pRet && pRet->ISA( SdrObjCustomShape ) )
+ {
+ SdrObject::Free( pRet );
+ pRet = NULL;
+ }
+ pTObj = new SdrRectObj( eTextKind != OBJ_RECT ? eTextKind : OBJ_TEXT );
+ pTObj->SetModel( pSdrModel );
+ SfxItemSet aSet( pSdrModel->GetItemPool() );
+ if ( !pRet )
+ ((SdrEscherImport*)this)->ApplyAttributes( rSt, aSet, rObjData );
+ pTObj->SetMergedItemSet( aSet );
+ if ( pRet )
+ {
+ pTObj->SetMergedItem( XLineStyleItem( XLINE_NONE ) );
+ pTObj->SetMergedItem( XFillStyleItem( XFILL_NONE ) );
+ }
+ if ( bVerticalText )
+ {
+ bAutoGrowWidth = bFitShapeToText; // bFitShapeToText; can't be used, because we cut the text if it is too height,
+ bAutoGrowHeight = sal_False;
+ }
+ else
+ {
+ bAutoGrowWidth = sal_False;
+ bAutoGrowHeight = sal_True; // bFitShapeToText; can't be used, because we cut the text if it is too height,
+ }
+ }
+ pTObj->SetMergedItem( SvxFrameDirectionItem( bVerticalText ? FRMDIR_VERT_TOP_RIGHT : FRMDIR_HORI_LEFT_TOP, EE_PARA_WRITINGDIR ) );
+
+ if ( !pTObj->ISA( SdrObjCustomShape ) )
+ {
+ pTObj->SetMergedItem( SdrTextAutoGrowWidthItem( bAutoGrowWidth ) );
+ pTObj->SetMergedItem( SdrTextAutoGrowHeightItem( bAutoGrowHeight ) );
+ }
+ else
+ {
+ pTObj->SetMergedItem( SdrTextWordWrapItem( bWordWrap ) );
+ pTObj->SetMergedItem( SdrTextAutoGrowHeightItem( bFitShapeToText ) );
+ }
+
+ pTObj->SetMergedItem( SdrTextVertAdjustItem( eTVA ) );
+ pTObj->SetMergedItem( SdrTextHorzAdjustItem( eTHA ) );
+
+ if ( nMinFrameHeight < 0 )
+ nMinFrameHeight = 0;
+ if ( !pTObj->ISA( SdrObjCustomShape ) )
+ pTObj->SetMergedItem( SdrTextMinFrameHeightItem( nMinFrameHeight ) );
+
+ if ( nMinFrameWidth < 0 )
+ nMinFrameWidth = 0;
+ if ( !pTObj->ISA( SdrObjCustomShape ) )
+ pTObj->SetMergedItem( SdrTextMinFrameWidthItem( nMinFrameWidth ) );
+
+ // Abstaende an den Raendern der Textbox setzen
+ pTObj->SetMergedItem( SdrTextLeftDistItem( nTextLeft ) );
+ pTObj->SetMergedItem( SdrTextRightDistItem( nTextRight ) );
+ pTObj->SetMergedItem( SdrTextUpperDistItem( nTextTop ) );
+ pTObj->SetMergedItem( SdrTextLowerDistItem( nTextBottom ) );
+ pTObj->SetMergedItem( SdrTextFixedCellHeightItem( TRUE ) );
+
+ if ( !pTObj->ISA( SdrObjCustomShape ) )
+ pTObj->SetSnapRect( rTextRect );
+ pTObj = ReadObjText( &aTextObj, pTObj, rData.pPage );
+ if ( pTObj )
+ {
+ /* check if our new snaprect makes trouble,
+ because we do not display the ADJUST_BLOCK
+ properly if the textsize is bigger than the
+ snaprect of the object. Then we will use
+ ADJUST_CENTER instead of ADJUST_BLOCK.
+ */
+ if ( !pTObj->ISA( SdrObjCustomShape ) && !bFitShapeToText && !bWordWrap )
+ {
+ SdrTextObj* pText = PTR_CAST( SdrTextObj, pTObj );
+ if ( pText )
+ {
+ if ( bVerticalText )
+ {
+ if ( eTVA == SDRTEXTVERTADJUST_BLOCK )
+ {
+ Size aTextSize( pText->GetTextSize() );
+ aTextSize.Width() += nTextLeft + nTextRight;
+ aTextSize.Height() += nTextTop + nTextBottom;
+ if ( rTextRect.GetHeight() < aTextSize.Height() )
+ pTObj->SetMergedItem( SdrTextVertAdjustItem( SDRTEXTVERTADJUST_CENTER ) );
+ }
+ }
+ else
+ {
+ if ( eTHA == SDRTEXTHORZADJUST_BLOCK )
+ {
+ Size aTextSize( pText->GetTextSize() );
+ aTextSize.Width() += nTextLeft + nTextRight;
+ aTextSize.Height() += nTextTop + nTextBottom;
+ if ( rTextRect.GetWidth() < aTextSize.Width() )
+ pTObj->SetMergedItem( SdrTextHorzAdjustItem( SDRTEXTHORZADJUST_CENTER ) );
+ }
+ }
+ }
+ }
+ // rotate text with shape ?
+ sal_Int32 nAngle = ( rObjData.nSpFlags & SP_FFLIPV ) ? -mnFix16Angle : mnFix16Angle; // #72116# vertical flip -> rotate by using the other way
+ nAngle += nTextRotationAngle;
+
+ if ( pTObj->ISA( SdrObjCustomShape ) )
+ {
+/*
+ if ( nTextRotationAngle )
+ {
+ double fTextRotateAngle = (double)nTextRotationAngle / 100.0;
+ SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)((SdrObjCustomShape*)pTObj)->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
+ const rtl::OUString sTextRotateAngle( RTL_CONSTASCII_USTRINGPARAM ( "TextRotateAngle" ) );
+ PropertyValue aPropValue;
+ aPropValue.Name = sTextRotateAngle;
+ aPropValue.Value <<= fTextRotateAngle;
+ aGeometryItem.SetPropertyValue( aPropValue );
+ ((SdrObjCustomShape*)pTObj)->SetMergedItem( aGeometryItem );
+ }
+*/
+ }
+ else
+ {
+ if ( rObjData.nSpFlags & SP_FFLIPV )
+ {
+ double a = 18000 * nPi180;
+ pTObj->Rotate( rTextRect.Center(), 18000, sin( a ), cos( a ) );
+ }
+ if ( rObjData.nSpFlags & SP_FFLIPH )
+ nAngle = 36000 - nAngle;
+ if ( nAngle )
+ {
+ double a = nAngle * nPi180;
+ pTObj->NbcRotate( rObjData.aBoundRect.Center(), nAngle, sin( a ), cos( a ) );
+ }
+ }
+ if ( pRet )
+ {
+ SdrObject* pGroup = new SdrObjGroup;
+ pGroup->GetSubList()->NbcInsertObject( pRet );
+ pGroup->GetSubList()->NbcInsertObject( pTObj );
+ pRet = pGroup;
+ }
+ else
+ pRet = pTObj;
+ }
+ }
+ }
+ }
+ else
+ {
+ if ( maShapeRecords.SeekToContent( rSt, DFF_msofbtUDefProp, SEEK_FROM_CURRENT_AND_RESTART ) )
+ {
+ maShapeRecords.Current()->SeekToBegOfRecord( rSt );
+ DffPropertyReader aSecPropSet( *this );
+ aSecPropSet.ReadPropSet( rSt, (ProcessData*)pData );
+ sal_Int32 nTableProperties = aSecPropSet.GetPropertyValue( DFF_Prop_tableProperties, 0 );
+ if ( nTableProperties & 3 )
+ {
+ if ( aSecPropSet.SeekToContent( DFF_Prop_tableRowProperties, rSt ) )
+ {
+ sal_Int16 i, nRowCount = 0;
+ rSt >> nRowCount >> i >> i;
+ if ( nRowCount )
+ {
+ sal_uInt32* pTableArry = new sal_uInt32[ nRowCount + 2 ];
+ pTableArry[ 0 ] = nTableProperties;
+ pTableArry[ 1 ] = nRowCount;
+ for ( i = 0; i < nRowCount; i++ )
+ rSt >> pTableArry[ i + 2 ];
+ rData.pTableRowProperties = pTableArry;
+ }
+ }
+ }
+ }
+ }
+ if ( pRet ) // sj: #i38501#, and and taking care of connections to group objects
+ {
+ if ( rObjData.nSpFlags & SP_FBACKGROUND )
+ {
+ pRet->NbcSetSnapRect( Rectangle( Point(), ((SdrPage*)rData.pPage)->GetSize() ) ); // Groesse setzen
+ }
+ if ( rPersistEntry.pSolverContainer )
+ {
+ for ( SvxMSDffConnectorRule* pPtr = (SvxMSDffConnectorRule*)rPersistEntry.pSolverContainer->aCList.First();
+ pPtr; pPtr = (SvxMSDffConnectorRule*)rPersistEntry.pSolverContainer->aCList.Next() )
+ {
+ if ( rObjData.nShapeId == pPtr->nShapeC )
+ pPtr->pCObj = pRet;
+ else
+ {
+ SdrObject* pConnectObj = pRet;
+ if ( pOriginalObj && pRet->ISA( SdrObjGroup ) )
+ { /* check if the original object from the escherimport is part of the group object,
+ if this is the case, we will use the original object to connect to */
+ SdrObjListIter aIter( *pRet, IM_DEEPWITHGROUPS );
+ while( aIter.IsMore() )
+ {
+ SdrObject* pPartObj = aIter.Next();
+ if ( pPartObj == pOriginalObj )
+ {
+ pConnectObj = pPartObj;
+ break;
+ }
+ }
+ }
+ if ( rObjData.nShapeId == pPtr->nShapeA )
+ {
+ pPtr->pAObj = pConnectObj;
+ pPtr->nSpFlagsA = rObjData.nSpFlags;
+ }
+ if ( rObjData.nShapeId == pPtr->nShapeB )
+ {
+ pPtr->pBObj = pConnectObj;
+ pPtr->nSpFlagsB = rObjData.nSpFlags;
+ }
+ }
+ }
+ }
+ if ( rPersistEntry.ePageKind == PPT_MASTERPAGE )
+ { // maybe the escher clusterlist is not correct, but we have to got the right page by using the
+ // spMaster property, so we are patching the table
+ if ( rPersistEntry.nDrawingDgId != 0xffffffff )
+ {
+ UINT32 nSec = ( rObjData.nShapeId >> 10 ) - 1;
+ if ( mpFidcls && ( nSec < mnIdClusters ) )
+ mpFidcls[ nSec ].dgid = rPersistEntry.nDrawingDgId; // insert the correct drawing id;
+ }
+ }
+ if ( GetPropertyValue( DFF_Prop_fNoFillHitTest ) & 0x10 )
+ {
+ if ( (MSO_FillType)GetPropertyValue( DFF_Prop_fillType, mso_fillSolid ) == mso_fillBackground )
+ {
+ if ( !rData.pBackgroundColoredObjects )
+ rData.pBackgroundColoredObjects = new List;
+ rData.pBackgroundColoredObjects->Insert( pRet, LIST_APPEND );
+ }
+ }
+ }
+ return pRet;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrEscherImport::CheckWingdings() const
+{
+ OutputDevice* pDev = (OutputDevice*)Application::GetDefaultDevice();
+ ((SdrEscherImport*)this)->bWingdingsAvailable = pDev->IsFontAvailable( String( RTL_CONSTASCII_USTRINGPARAM( "WINGDINGS" ) ) );
+ ((SdrEscherImport*)this)->bWingdingsChecked = TRUE;
+}
+
+void SdrEscherImport::CheckMonotypeSorts() const
+{
+ OutputDevice* pDev = (OutputDevice*)Application::GetDefaultDevice();
+ ((SdrEscherImport*)this)->bMonotypeSortsAvailable = pDev->IsFontAvailable( String( RTL_CONSTASCII_USTRINGPARAM( "MONOTYPE SORTS" ) ) );
+ ((SdrEscherImport*)this)->bMonotypeSortsChecked = TRUE;
+}
+
+void SdrEscherImport::CheckTimesNewRoman() const
+{
+ OutputDevice* pDev = (OutputDevice*)Application::GetDefaultDevice();
+ ((SdrEscherImport*)this)->bTimesNewRomanAvailable = pDev->IsFontAvailable( String( RTL_CONSTASCII_USTRINGPARAM( "TIMES NEW ROMAN" ) ) );
+ ((SdrEscherImport*)this)->bTimesNewRomanChecked = TRUE;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SdrPowerPointImport::SdrPowerPointImport( PowerPointImportParam& rParam, const String& rBaseURL ) :
+ SdrEscherImport ( rParam, rBaseURL ),
+ bOk ( rStCtrl.GetErrorCode() == SVSTREAM_OK ),
+ pPersistPtr ( NULL ),
+ nPersistPtrAnz ( 0 ),
+ pDefaultSheet ( NULL ),
+ pMasterPages ( NULL ),
+ pSlidePages ( NULL ),
+ pNotePages ( NULL ),
+ nAktPageNum ( 0 ),
+ nDocStreamPos ( 0 ),
+ nPageColorsNum ( 0xFFFF ),
+ ePageColorsKind ( PPT_MASTERPAGE ),
+ eAktPageKind ( PPT_MASTERPAGE )
+{
+ DffRecordHeader* pHd;
+ if ( bOk )
+ {
+ rStCtrl.Seek( STREAM_SEEK_TO_END );
+ nStreamLen = rStCtrl.Tell();
+
+ // try to allocate the UserEditAtom via CurrentUserAtom
+ sal_uInt32 nCurrentUserEdit = rParam.aCurrentUserAtom.nCurrentUserEdit;
+ if ( nCurrentUserEdit )
+ {
+ rStCtrl.Seek( nCurrentUserEdit );
+ rStCtrl >> aUserEditAtom;
+ }
+ if ( !aUserEditAtom.nOffsetPersistDirectory )
+ { // if there is no UserEditAtom try to search the last one
+
+ rStCtrl.Seek( 0 );
+ DffRecordManager aPptRecManager; // contains all first level container and atoms
+ aPptRecManager.Consume( rStCtrl, FALSE, nStreamLen );
+ for ( pHd = aPptRecManager.Last(); pHd; pHd = aPptRecManager.Prev() )
+ {
+ if ( pHd->nRecType == PPT_PST_UserEditAtom )
+ {
+ pHd->SeekToBegOfRecord( rStCtrl );
+ rStCtrl >> aUserEditAtom;
+ break;
+ }
+ }
+ if ( !pHd )
+ bOk = FALSE;
+ }
+ }
+ if ( rStCtrl.GetError() != 0 )
+ bOk = FALSE;
+
+ if ( bOk )
+ {
+ // PersistPtrs lesen (alle)
+ nPersistPtrAnz = aUserEditAtom.nMaxPersistWritten + 1; // 1 mehr, damit ich immer direkt indizieren kann
+ pPersistPtr = new UINT32[ nPersistPtrAnz ]; // (die fangen naemlich eigentlich bei 1 an)
+ if ( !pPersistPtr )
+ bOk = FALSE;
+ else
+ {
+ memset( pPersistPtr, 0x00, nPersistPtrAnz * 4 );
+
+ // SJ: new search mechanism from bottom to top (Issue 21122)
+ PptUserEditAtom aCurrentEditAtom( aUserEditAtom );
+ sal_uInt32 nCurrentEditAtomStrmPos = aCurrentEditAtom.aHd.GetRecEndFilePos();
+ while( nCurrentEditAtomStrmPos )
+ {
+ sal_uInt32 nPersistIncPos = aCurrentEditAtom.nOffsetPersistDirectory;
+ if ( nPersistIncPos )
+ {
+ rStCtrl.Seek( nPersistIncPos );
+ DffRecordHeader aPersistHd;
+ rStCtrl >> aPersistHd;
+ if ( aPersistHd.nRecType == PPT_PST_PersistPtrIncrementalBlock )
+ {
+ ULONG nPibLen = aPersistHd.GetRecEndFilePos();
+ while ( bOk && ( rStCtrl.GetError() == 0 ) && ( rStCtrl.Tell() < nPibLen ) )
+ {
+ sal_uInt32 nOfs, nAnz;
+ rStCtrl >> nOfs;
+ nAnz = nOfs;
+ nOfs &= 0x000FFFFF;
+ nAnz >>= 20;
+ while ( bOk && ( rStCtrl.GetError() == 0 ) && ( nAnz > 0 ) && ( nOfs <= nPersistPtrAnz ) )
+ {
+ sal_uInt32 nPt;
+ rStCtrl >> nPt;
+ if ( !pPersistPtr[ nOfs ] )
+ {
+ pPersistPtr[ nOfs ] = nPt;
+ if ( pPersistPtr[ nOfs ] > nStreamLen )
+ {
+ bOk = FALSE;
+ DBG_ERROR("SdrPowerPointImport::Ctor(): Ungueltiger Eintrag im Persist-Directory!");
+ }
+ }
+ nAnz--;
+ nOfs++;
+ }
+ if ( bOk && nAnz > 0 )
+ {
+ DBG_ERROR("SdrPowerPointImport::Ctor(): Nicht alle Persist-Directory Entraege gelesen!");
+ bOk = FALSE;
+ }
+ }
+ }
+ }
+ nCurrentEditAtomStrmPos = aCurrentEditAtom.nOffsetLastEdit < nCurrentEditAtomStrmPos ? aCurrentEditAtom.nOffsetLastEdit : 0;
+ if ( nCurrentEditAtomStrmPos )
+ {
+ rStCtrl.Seek( nCurrentEditAtomStrmPos );
+ rStCtrl >> aCurrentEditAtom;
+ }
+ }
+ }
+ }
+ if ( rStCtrl.GetError() != 0 )
+ bOk = FALSE;
+ if ( bOk )
+ { // Document PersistEntry checken
+ nDocStreamPos = aUserEditAtom.nDocumentRef;
+ if ( nDocStreamPos > nPersistPtrAnz )
+ {
+ DBG_ERROR("SdrPowerPointImport::Ctor(): aUserEditAtom.nDocumentRef ungueltig!");
+ bOk = FALSE;
+ }
+ }
+ if ( bOk )
+ { // Document FilePos checken
+ nDocStreamPos = pPersistPtr[ nDocStreamPos ];
+ if ( nDocStreamPos >= nStreamLen )
+ {
+ DBG_ERROR("SdrPowerPointImport::Ctor(): nDocStreamPos >= nStreamLen!");
+ bOk = FALSE;
+ }
+ }
+ if ( bOk )
+ {
+ rStCtrl.Seek( nDocStreamPos );
+ aDocRecManager.Consume( rStCtrl );
+
+ DffRecordHeader aDocHd;
+ rStCtrl >> aDocHd;
+ // DocumentAtom lesen
+ DffRecordHeader aDocAtomHd;
+ rStCtrl >> aDocAtomHd;
+ if ( aDocHd.nRecType == PPT_PST_Document && aDocAtomHd.nRecType == PPT_PST_DocumentAtom )
+ {
+ aDocAtomHd.SeekToBegOfRecord( rStCtrl );
+ rStCtrl >> aDocAtom;
+ }
+ else
+ bOk = FALSE;
+
+ if ( bOk )
+ {
+ if ( !pFonts )
+ ReadFontCollection();
+
+ // reading TxPF, TxSI
+ PPTTextCharacterStyleAtomInterpreter aTxCFStyle; // SJ: ToDo, this atom needs to be interpreted, it contains character default styles for standard objects (instance4)
+ PPTTextParagraphStyleAtomInterpreter aTxPFStyle;
+ PPTTextSpecInfoAtomInterpreter aTxSIStyle; // styles (default language setting ... )
+
+ DffRecordHeader* pEnvHd = aDocRecManager.GetRecordHeader( PPT_PST_Environment );
+ if ( pEnvHd )
+ {
+ pEnvHd->SeekToContent( rStCtrl );
+ DffRecordHeader aTxPFStyleRecHd;
+ if ( SeekToRec( rStCtrl, PPT_PST_TxPFStyleAtom, pEnvHd->GetRecEndFilePos(), &aTxPFStyleRecHd ) )
+ aTxPFStyle.Read( rStCtrl, aTxPFStyleRecHd );
+
+ pEnvHd->SeekToContent( rStCtrl );
+ DffRecordHeader aTxSIStyleRecHd;
+ if ( SeekToRec( rStCtrl, PPT_PST_TxSIStyleAtom, pEnvHd->GetRecEndFilePos(), &aTxSIStyleRecHd ) )
+ {
+ aTxSIStyle.Read( rStCtrl, aTxSIStyleRecHd, PPT_PST_TxSIStyleAtom );
+#ifdef DBG_UTIL
+ if ( !aTxSIStyle.bValid )
+ {
+ if (!(rImportParam.nImportFlags & PPT_IMPORTFLAGS_NO_TEXT_ASSERT ))
+ {
+ DBG_ERROR( "SdrTextSpecInfoAtomInterpreter::Ctor(): parsing error, this document needs to be analysed (SJ)" );
+ }
+ }
+#endif
+ }
+ }
+
+ // todo:: PPT_PST_TxPFStyleAtom
+
+ // SlidePersists Lesen
+ pMasterPages=new PptSlidePersistList;
+ pSlidePages =new PptSlidePersistList;
+ pNotePages =new PptSlidePersistList;
+
+ // now always creating the handout page, it will be the first in our masterpage list
+ PptSlidePersistEntry* pE = new PptSlidePersistEntry;
+ pE->aPersistAtom.nPsrReference = aDocAtom.nHandoutMasterPersist;
+ pE->bHandoutMaster = sal_True;
+ if ( !aDocAtom.nHandoutMasterPersist )
+ pE->bStarDrawFiller = sal_True; // this is a dummy master page
+ pMasterPages->C40_INSERT( PptSlidePersistEntry, pE, 0 );
+
+ USHORT nPageListNum = 0;
+ DffRecordHeader* pSlideListWithTextHd = aDocRecManager.GetRecordHeader( PPT_PST_SlideListWithText );
+ PptSlidePersistEntry* pPreviousPersist = NULL;
+ while ( pSlideListWithTextHd && ( nPageListNum < 3 ) )
+ {
+ pSlideListWithTextHd->SeekToContent( rStCtrl );
+ PptSlidePersistList* pPageList = GetPageList( PptPageKind( nPageListNum ) );
+ sal_uInt32 nSlideListWithTextHdEndOffset = pSlideListWithTextHd->GetRecEndFilePos();
+ while ( SeekToRec( rStCtrl, PPT_PST_SlidePersistAtom, nSlideListWithTextHdEndOffset ) )
+ {
+ if ( pPreviousPersist )
+ pPreviousPersist->nSlidePersistEndOffset = rStCtrl.Tell();
+ PptSlidePersistEntry* pE2 = new PptSlidePersistEntry;
+ rStCtrl >> pE2->aPersistAtom;
+ pE2->nSlidePersistStartOffset = rStCtrl.Tell();
+ pE2->ePageKind = PptPageKind( nPageListNum );
+ pPageList->C40_INSERT( PptSlidePersistEntry, pE2, pPageList->Count() );
+ pPreviousPersist = pE2;
+ }
+ if ( pPreviousPersist )
+ pPreviousPersist->nSlidePersistEndOffset = nSlideListWithTextHdEndOffset;
+ pSlideListWithTextHd = aDocRecManager.GetRecordHeader( PPT_PST_SlideListWithText, SEEK_FROM_CURRENT );
+ nPageListNum++;
+ }
+
+ // we will ensure that there is at least one master page
+ if ( pMasterPages->Count() == 1 ) // -> there is only a handout page available
+ {
+ PptSlidePersistEntry* pE2 = new PptSlidePersistEntry;
+ pE2->bStarDrawFiller = sal_True; // this is a dummy master page
+ pMasterPages->C40_INSERT( PptSlidePersistEntry, pE2, 1 );
+ }
+
+ // now we will insert at least one notes master for each master page
+ sal_uInt16 nMasterPage;
+ sal_uInt16 nMasterPages = pMasterPages->Count() - 1;
+ for ( nMasterPage = 0; nMasterPage < nMasterPages; nMasterPage++ )
+ {
+ PptSlidePersistEntry* pE2 = new PptSlidePersistEntry;
+ pE2->bNotesMaster = sal_True;
+ pE2->bStarDrawFiller = sal_True; // this is a dummy master page
+ if ( !nMasterPage && aDocAtom.nNotesMasterPersist )
+ { // special treatment for the first notes master
+ pE2->aPersistAtom.nPsrReference = aDocAtom.nNotesMasterPersist;
+ pE2->bStarDrawFiller = sal_False; // this is a dummy master page
+ }
+ pMasterPages->C40_INSERT( PptSlidePersistEntry, pE2, ( nMasterPage + 1 ) << 1 );
+ }
+
+ // Zu jeder Page noch das SlideAtom bzw. NotesAtom lesen, soweit vorhanden
+ nPageListNum = 0;
+ for ( nPageListNum = 0; nPageListNum < 3; nPageListNum++ )
+ {
+ PptSlidePersistList* pPageList = GetPageList( PptPageKind( nPageListNum ) );
+ for ( USHORT nPageNum = 0; nPageNum < pPageList->Count(); nPageNum++ )
+ {
+ PptSlidePersistEntry* pE2 = (*pPageList)[ nPageNum ];
+ ULONG nPersist = pE2->aPersistAtom.nPsrReference;
+ if ( ( nPersist > 0 ) && ( nPersist < nPersistPtrAnz ) )
+ {
+ ULONG nFPos = pPersistPtr[ nPersist ];
+ if ( nFPos < nStreamLen )
+ {
+ rStCtrl.Seek( nFPos );
+ DffRecordHeader aSlideHd;
+ rStCtrl >> aSlideHd;
+ if ( SeekToRec( rStCtrl, PPT_PST_SlideAtom, aSlideHd.GetRecEndFilePos() ) )
+ rStCtrl >> pE2->aSlideAtom;
+ else if ( SeekToRec( rStCtrl, PPT_PST_NotesAtom, aSlideHd.GetRecEndFilePos() ) )
+ rStCtrl >> pE2->aNotesAtom;
+ aSlideHd.SeekToContent( rStCtrl );
+
+ DffRecordHeader aPPTDrawingHd;
+ if ( SeekToRec( rStCtrl, PPT_PST_PPDrawing, aSlideHd.GetRecEndFilePos(), &aPPTDrawingHd ) )
+ {
+ DffRecordHeader aPPTDgContainer;
+ if ( SeekToRec( rStCtrl, DFF_msofbtDgContainer, aPPTDrawingHd.GetRecEndFilePos(), &aPPTDgContainer ) )
+ {
+ if ( SeekToRec( rStCtrl, DFF_msofbtDg, aPPTDrawingHd.GetRecEndFilePos() ) )
+ {
+ DffRecordHeader aDgRecordHeader;
+ rStCtrl >> aDgRecordHeader;
+ pE2->nDrawingDgId = aDgRecordHeader.nRecInstance;
+ aDgRecordHeader.SeekToEndOfRecord( rStCtrl );
+ }
+ if ( SeekToRec( rStCtrl, DFF_msofbtSolverContainer, aPPTDgContainer.GetRecEndFilePos() ) )
+ {
+ pE2->pSolverContainer = new SvxMSDffSolverContainer;
+ rStCtrl >> *( pE2->pSolverContainer );
+ }
+ aPPTDgContainer.SeekToBegOfRecord( rStCtrl );
+ SetDgContainer( rStCtrl ); // set this, so that the escherimport is knowing of our drawings
+ }
+ }
+ // office xp is supporting more than one stylesheet
+ if ( ( pE2->ePageKind == PPT_MASTERPAGE ) && ( pE2->aSlideAtom.nMasterId == 0 ) && ( pE2->bNotesMaster == 0 ) )
+ {
+ PPTTextSpecInfo aTxSI( 0 );
+ if ( aTxSIStyle.bValid && aTxSIStyle.aList.Count() )
+ aTxSI = *( ( (PPTTextSpecInfo*)aTxSIStyle.aList.GetObject( 0 ) ) );
+
+ pE2->pStyleSheet = new PPTStyleSheet( aSlideHd, rStCtrl, *this, aTxCFStyle, aTxPFStyle, aTxSI );
+ pDefaultSheet = pE2->pStyleSheet;
+ }
+ if ( SeekToRec( rStCtrl, PPT_PST_ColorSchemeAtom, aSlideHd.GetRecEndFilePos() ) )
+ rStCtrl >> pE2->aColorScheme;
+ else
+ {
+ DBG_ERROR( "SdrPowerPointImport::Ctor(): could not get SlideColorScheme! (SJ)" );
+ }
+ }
+ else
+ {
+ DBG_ERROR("SdrPowerPointImport::Ctor(): Persist-Eintrag fehlerhaft! (SJ)");
+ }
+ }
+ }
+ }
+ DffRecordHeader* pHeadersFootersHd = aDocRecManager.GetRecordHeader( PPT_PST_HeadersFooters, SEEK_FROM_BEGINNING );
+ if ( pHeadersFootersHd )
+ {
+ HeaderFooterEntry aNormalMaster, aNotesMaster;
+ for ( ; pHeadersFootersHd; pHeadersFootersHd = aDocRecManager.GetRecordHeader( PPT_PST_HeadersFooters, SEEK_FROM_CURRENT ) )
+ {
+ if ( pHeadersFootersHd->nRecInstance == 3 ) // normal master
+ ImportHeaderFooterContainer( *pHeadersFootersHd, aNormalMaster );
+ else if ( pHeadersFootersHd->nRecInstance == 4 ) // notes master
+ ImportHeaderFooterContainer( *pHeadersFootersHd, aNotesMaster );
+ }
+ for ( USHORT i = 0; i < pMasterPages->Count(); i++ )
+ {
+ if ( (*pMasterPages)[ i ]->bNotesMaster )
+ (*pMasterPages)[ i ]->pHeaderFooterEntry = new HeaderFooterEntry( aNotesMaster );
+ else
+ (*pMasterPages)[ i ]->pHeaderFooterEntry = new HeaderFooterEntry( aNormalMaster );
+ }
+ }
+ }
+ }
+ if ( ( rStCtrl.GetError() != 0 ) || ( pDefaultSheet == NULL ) )
+ bOk = FALSE;
+ pPPTStyleSheet = pDefaultSheet;
+ rStCtrl.Seek( 0 );
+}
+
+SdrPowerPointImport::~SdrPowerPointImport()
+{
+ for ( void* pPtr = aHyperList.First(); pPtr; pPtr = aHyperList.Next() )
+ delete (SdHyperlinkEntry*)pPtr;
+ delete pMasterPages;
+ delete pSlidePages;
+ delete pNotePages;
+ delete[] pPersistPtr;
+}
+
+sal_Bool PPTConvertOCXControls::InsertControl(
+ const com::sun::star::uno::Reference<
+ com::sun::star::form::XFormComponent > &rFComp,
+ const com::sun::star::awt::Size& rSize,
+ com::sun::star::uno::Reference<
+ com::sun::star::drawing::XShape > *pShape,
+ BOOL /*bFloatingCtrl*/)
+{
+ sal_Bool bRetValue = FALSE;
+ try
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape;
+
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > & rFormComps =
+ GetFormComps();
+
+ ::com::sun::star::uno::Any aTmp( &rFComp, ::getCppuType((const ::com::sun::star::uno::Reference<
+ com::sun::star::form::XFormComponent >*)0) );
+
+ rFormComps->insertByIndex( rFormComps->getCount(), aTmp );
+
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rServiceFactory =
+ GetServiceFactory();
+ if( rServiceFactory.is() )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xCreate = rServiceFactory
+ ->createInstance(String( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.drawing.ControlShape" ) ) );
+ if( xCreate.is() )
+ {
+ xShape = ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >(xCreate, ::com::sun::star::uno::UNO_QUERY);
+ if ( xShape.is() )
+ {
+ xShape->setSize(rSize);
+// GetShapes()->add( xShape );
+ // Das Control-Model am Control-Shape setzen
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XControlShape > xControlShape( xShape,
+ ::com::sun::star::uno::UNO_QUERY );
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > xControlModel( rFComp,
+ ::com::sun::star::uno::UNO_QUERY );
+ if ( xControlShape.is() && xControlModel.is() )
+ {
+ xControlShape->setControl( xControlModel );
+ if (pShape)
+ *pShape = xShape;
+ bRetValue = TRUE;
+ }
+ }
+ }
+ }
+ }
+ catch( ... )
+ {
+ bRetValue = FALSE;
+ }
+ return bRetValue;
+};
+
+const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& PPTConvertOCXControls::GetDrawPage()
+{
+ if( !xDrawPage.is() && pDocSh )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > xModel( pDocSh->GetModel() );
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPages > xDrawPages;
+ switch( ePageKind )
+ {
+ case PPT_SLIDEPAGE :
+ case PPT_NOTEPAGE :
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPagesSupplier >
+ xDrawPagesSupplier( xModel, ::com::sun::star::uno::UNO_QUERY);
+ if ( xDrawPagesSupplier.is() )
+ xDrawPages = xDrawPagesSupplier->getDrawPages();
+ }
+ break;
+
+ case PPT_MASTERPAGE :
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XMasterPagesSupplier >
+ xMasterPagesSupplier( xModel, ::com::sun::star::uno::UNO_QUERY);
+ if ( xMasterPagesSupplier.is() )
+ xDrawPages = xMasterPagesSupplier->getMasterPages();
+ }
+ break;
+ }
+ if ( xDrawPages.is() && xDrawPages->getCount() )
+ {
+ xDrawPages->getCount();
+ ::com::sun::star::uno::Any aAny( xDrawPages->getByIndex( xDrawPages->getCount() - 1 ) );
+ aAny >>= xDrawPage;
+ }
+ }
+ return xDrawPage;
+}
+
+sal_Bool SdrPowerPointOLEDecompress( SvStream& rOutput, SvStream& rInput, sal_uInt32 nInputSize )
+{
+ sal_uInt32 nOldPos = rInput.Tell();
+ char* pBuf = new char[ nInputSize ];
+ rInput.Read( pBuf, nInputSize );
+ ZCodec aZCodec( 0x8000, 0x8000 );
+ aZCodec.BeginCompression();
+ SvMemoryStream aSource( pBuf, nInputSize, STREAM_READ );
+ aZCodec.Decompress( aSource, rOutput );
+ const sal_Bool bSuccess(0L != aZCodec.EndCompression());
+ delete[] pBuf;
+ rInput.Seek( nOldPos );
+ return bSuccess;
+}
+
+// --> OD 2004-12-14 #i32596# - add new parameter <_nCalledByGroup>
+SdrObject* SdrPowerPointImport::ImportOLE( long nOLEId,
+ const Graphic& rGraf,
+ const Rectangle& rBoundRect,
+ const Rectangle& rVisArea,
+ const int /*_nCalledByGroup*/,
+ sal_Int64 /*nAspect*/ ) const
+// <--
+{
+ SdrObject* pRet = NULL;
+
+ UINT32 nOldPos = rStCtrl.Tell();
+
+ Graphic aGraphic( rGraf );
+
+ if ( ((SdrPowerPointImport*)this)->maShapeRecords.SeekToContent( rStCtrl, DFF_msofbtClientData, SEEK_FROM_CURRENT_AND_RESTART ) )
+ {
+ DffRecordHeader aPlaceHd;
+ while ( ( rStCtrl.GetError() == 0 )
+ && ( rStCtrl.Tell() < ((SdrPowerPointImport*)this)->maShapeRecords.Current()->GetRecEndFilePos() ) )
+ {
+ rStCtrl >> aPlaceHd;
+ if ( aPlaceHd.nRecType == PPT_PST_RecolorInfoAtom )
+ {
+ ((SdrPowerPointImport*)this)->RecolorGraphic( rStCtrl, aPlaceHd.nRecLen, aGraphic );
+ break;
+ }
+ else
+ aPlaceHd.SeekToEndOfRecord( rStCtrl );
+ }
+ }
+
+ PPTOleEntry* pOe;
+ for ( pOe = (PPTOleEntry*)((SdrPowerPointImport*)this)->aOleObjectList.First(); pOe;
+ pOe = (PPTOleEntry*)((SdrPowerPointImport*)this)->aOleObjectList.Next() )
+ {
+ if ( pOe->nId != (sal_uInt32)nOLEId )
+ continue;
+
+ rStCtrl.Seek( pOe->nRecHdOfs );
+
+ DffRecordHeader aHd;
+ rStCtrl >> aHd;
+
+ sal_uInt32 nLen = aHd.nRecLen - 4;
+ if ( (INT32)nLen > 0 )
+ {
+ sal_Bool bSuccess = sal_False;
+
+ rStCtrl.SeekRel( 4 );
+
+ ::utl::TempFile aTmpFile;
+ aTmpFile.EnableKillingFile( sal_True );
+
+ if ( aTmpFile.IsValid() )
+ {
+ SvStream* pDest = ::utl::UcbStreamHelper::CreateStream( aTmpFile.GetURL(), STREAM_TRUNC | STREAM_WRITE );
+ if ( pDest )
+ bSuccess = SdrPowerPointOLEDecompress( *pDest, rStCtrl, nLen );
+ delete pDest;
+ }
+ if ( bSuccess )
+ {
+ SvStream* pDest = ::utl::UcbStreamHelper::CreateStream( aTmpFile.GetURL(), STREAM_READ );
+ Storage* pObjStor = pDest ? new Storage( *pDest, TRUE ) : NULL;
+ if ( pObjStor )
+ {
+ SotStorageRef xObjStor( new SotStorage( pObjStor ) );
+ if ( xObjStor.Is() && !xObjStor->GetError() )
+ {
+ if ( xObjStor->GetClassName() == SvGlobalName() )
+ {
+ ClsId aId( pObjStor->GetClassId() );
+ xObjStor->SetClass( SvGlobalName( aId.n1, aId.n2, aId.n3, aId.n4, aId.n5, aId.n6, aId.n7, aId.n8, aId.n9, aId.n10, aId.n11 ),
+ pObjStor->GetFormat(), pObjStor->GetUserName() );
+ }
+ SotStorageStreamRef xSrcTst = xObjStor->OpenSotStream( String( RTL_CONSTASCII_USTRINGPARAM( "\1Ole" ) ) );
+ if ( xSrcTst.Is() )
+ {
+ BYTE aTestA[ 10 ];
+ BOOL bGetItAsOle = ( sizeof( aTestA ) == xSrcTst->Read( aTestA, sizeof( aTestA ) ) );
+ if ( !bGetItAsOle )
+ { // maybe there is a contentsstream in here
+ xSrcTst = xObjStor->OpenSotStream( String( RTL_CONSTASCII_USTRINGPARAM( "Contents" ) ), STREAM_READWRITE | STREAM_NOCREATE );
+ bGetItAsOle = ( xSrcTst.Is() && sizeof( aTestA ) == xSrcTst->Read( aTestA, sizeof( aTestA ) ) );
+ }
+ if ( bGetItAsOle )
+ {
+ ::rtl::OUString aNm;
+ // if ( nSvxMSDffOLEConvFlags )
+ {
+ uno::Reference < embed::XStorage > xDestStorage( pOe->pShell->GetStorage() );
+ uno::Reference < embed::XEmbeddedObject > xObj =
+ CheckForConvertToSOObj( nSvxMSDffOLEConvFlags, *xObjStor, xDestStorage, rGraf, rVisArea );
+ if( xObj.is() )
+ {
+ pOe->pShell->getEmbeddedObjectContainer().InsertEmbeddedObject( xObj, aNm );
+
+ svt::EmbeddedObjectRef aObj( xObj, pOe->nAspect );
+
+ // TODO/LATER: need MediaType for Graphic
+ aObj.SetGraphic( rGraf, ::rtl::OUString() );
+ pRet = new SdrOle2Obj( aObj, aNm, rBoundRect, FALSE );
+ }
+ }
+ if ( !pRet && ( pOe->nType == PPT_PST_ExControl ) )
+ {
+ PPTConvertOCXControls aPPTConvertOCXControls( pOe->pShell, eAktPageKind );
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape;
+ if ( aPPTConvertOCXControls.ReadOCXStream( xObjStor, &xShape, FALSE ) )
+ pRet = GetSdrObjectFromXShape( xShape );
+ }
+ if ( !pRet )
+ {
+ aNm = pOe->pShell->getEmbeddedObjectContainer().CreateUniqueObjectName();
+ ErrCode aErrCode = 0;
+
+ // object is not an own object
+ SotStorageRef xTarget = SotStorage::OpenOLEStorage( pOe->pShell->GetStorage(), aNm, STREAM_READWRITE );
+ if ( xObjStor.Is() && xTarget.Is() )
+ {
+ xObjStor->CopyTo( xTarget );
+ if( !xTarget->GetError() )
+ xTarget->Commit();
+ if( xTarget->GetError() )
+ aErrCode = xTarget->GetError();
+ }
+ xTarget.Clear();
+
+ uno::Reference < embed::XEmbeddedObject > xObj =
+ pOe->pShell->getEmbeddedObjectContainer().GetEmbeddedObject( aNm );
+ if ( xObj.is() )
+ {
+ if ( pOe->nAspect != embed::Aspects::MSOLE_ICON )
+ {
+ //TODO/LATER: keep on hacking?!
+ // modifiziert wollen wir nicht werden
+ //xInplaceObj->EnableSetModified( FALSE );
+ if ( rVisArea.IsEmpty() )
+ {
+ MapUnit aMapUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( pOe->nAspect ) );
+ Size aSize( OutputDevice::LogicToLogic( aGraphic.GetPrefSize(),
+ aGraphic.GetPrefMapMode(), MapMode( aMapUnit ) ) );
+
+ awt::Size aSz;
+ aSz.Width = aSize.Width();
+ aSz.Height = aSize.Height();
+ xObj->setVisualAreaSize( pOe->nAspect, aSz );
+ }
+ else
+ {
+ awt::Size aSize( rVisArea.GetSize().Width(), rVisArea.GetSize().Height() );
+ xObj->setVisualAreaSize( pOe->nAspect, aSize );
+ }
+ //xInplaceObj->EnableSetModified( TRUE );
+ }
+
+ svt::EmbeddedObjectRef aObj( xObj, pOe->nAspect );
+
+ // TODO/LATER: need MediaType for Graphic
+ aObj.SetGraphic( aGraphic, ::rtl::OUString() );
+
+ pRet = new SdrOle2Obj( aObj, aNm, rBoundRect, FALSE );
+ }
+ }
+ }
+ }
+ }
+ }
+ delete pDest;
+ }
+ }
+ }
+ rStCtrl.Seek( nOldPos );
+
+ return pRet;
+}
+
+SvMemoryStream* SdrPowerPointImport::ImportExOleObjStg( UINT32 nPersistPtr, UINT32& nOleId ) const
+{
+ SvMemoryStream* pRet = NULL;
+ if ( nPersistPtr && ( nPersistPtr < nPersistPtrAnz ) )
+ {
+ UINT32 nOldPos, nOfs = pPersistPtr[ nPersistPtr ];
+ nOldPos = rStCtrl.Tell();
+ rStCtrl.Seek( nOfs );
+ DffRecordHeader aHd;
+ rStCtrl >> aHd;
+ if ( aHd.nRecType == DFF_PST_ExOleObjStg )
+ {
+ UINT32 nLen = aHd.nRecLen - 4;
+ if ( (INT32)nLen > 0 )
+ {
+ rStCtrl >> nOleId;
+ pRet = new SvMemoryStream;
+ ZCodec aZCodec( 0x8000, 0x8000 );
+ aZCodec.BeginCompression();
+ aZCodec.Decompress( rStCtrl, *pRet );
+ if ( !aZCodec.EndCompression() )
+ delete pRet, pRet = NULL;
+ }
+ }
+ rStCtrl.Seek( nOldPos );
+ }
+ return pRet;
+}
+
+void SdrPowerPointImport::SeekOle( SfxObjectShell* pShell, sal_uInt32 nFilterOptions )
+{
+ if ( pShell )
+ {
+ DffRecordHeader* pHd;
+
+ UINT32 nOldPos = rStCtrl.Tell();
+ if ( nFilterOptions & 1 )
+ {
+ pHd = aDocRecManager.GetRecordHeader( PPT_PST_List, SEEK_FROM_BEGINNING );
+ if ( pHd )
+ {
+ // we try to locate the basic atom
+ pHd->SeekToContent( rStCtrl );
+ if ( SeekToRec( rStCtrl, PPT_PST_VBAInfo, pHd->GetRecEndFilePos(), pHd ) )
+ {
+ if ( SeekToRec( rStCtrl, PPT_PST_VBAInfoAtom, pHd->GetRecEndFilePos(), pHd ) )
+ {
+ UINT32 nPersistPtr, nIDoNotKnow1, nIDoNotKnow2;
+ rStCtrl >> nPersistPtr
+ >> nIDoNotKnow1
+ >> nIDoNotKnow2;
+
+ UINT32 nOleId;
+ SvMemoryStream* pBas = ImportExOleObjStg( nPersistPtr, nOleId );
+ if ( pBas )
+ {
+ SotStorageRef xSource( new SotStorage( pBas, TRUE ) );
+ SotStorageRef xDest( new SotStorage( new SvMemoryStream(), TRUE ) );
+ if ( xSource.Is() && xDest.Is() )
+ {
+ // is this a visual basic storage ?
+ SotStorageRef xSubStorage = xSource->OpenSotStorage( String( RTL_CONSTASCII_USTRINGPARAM( "VBA" ) ),
+ STREAM_READWRITE | STREAM_NOCREATE | STREAM_SHARE_DENYALL );
+ if( xSubStorage.Is() && ( SVSTREAM_OK == xSubStorage->GetError() ) )
+ {
+ SotStorageRef xMacros = xDest->OpenSotStorage( String( RTL_CONSTASCII_USTRINGPARAM( "MACROS" ) ) );
+ if ( xMacros.Is() )
+ {
+ SvStorageInfoList aList;
+ xSource->FillInfoList( &aList );
+ UINT32 i;
+
+ BOOL bCopied = TRUE;
+ for ( i = 0; i < aList.Count(); i++ ) // copy all entrys
+ {
+ const SvStorageInfo& rInfo = aList[ i ];
+ if ( !xSource->CopyTo( rInfo.GetName(), xMacros, rInfo.GetName() ) )
+ bCopied = FALSE;
+ }
+ if ( i && bCopied )
+ {
+ SvxImportMSVBasic aMSVBas( *pShell, *xDest, TRUE, FALSE );
+ //int nSuccess = aMSVBas.Import( String( RTL_CONSTASCII_USTRINGPARAM( "MACROS" ) ),
+ // String( RTL_CONSTASCII_USTRINGPARAM( "VBA" ) ), TRUE, FALSE );
+
+ uno::Reference < embed::XStorage > xDoc( pShell->GetStorage() );
+ if ( xDoc.is() )
+ {
+ SotStorageRef xVBA = SotStorage::OpenOLEStorage( xDoc, String( RTL_CONSTASCII_USTRINGPARAM( "_MS_VBA_Macros" ) ) );
+ if ( xVBA.Is() && ( xVBA->GetError() == SVSTREAM_OK ) )
+ {
+ SotStorageRef xSubVBA = xVBA->OpenSotStorage( String( RTL_CONSTASCII_USTRINGPARAM( "_MS_VBA_Overhead" ) ) );
+ if ( xSubVBA.Is() && ( xSubVBA->GetError() == SVSTREAM_OK ) )
+ {
+ SotStorageStreamRef xOriginal = xSubVBA->OpenSotStream( String( RTL_CONSTASCII_USTRINGPARAM( "_MS_VBA_Overhead2" ) ) );
+ if ( xOriginal.Is() && ( xOriginal->GetError() == SVSTREAM_OK ) )
+ {
+ if ( nPersistPtr && ( nPersistPtr < nPersistPtrAnz ) )
+ {
+ rStCtrl.Seek( pPersistPtr[ nPersistPtr ] );
+ rStCtrl >> *pHd;
+
+ *xOriginal << nIDoNotKnow1
+ << nIDoNotKnow2;
+
+ UINT32 nSource, nToCopy, nBufSize;
+ nSource = rStCtrl.Tell();
+ nToCopy = pHd->nRecLen;
+ BYTE* pBuf = new BYTE[ 0x40000 ]; // 256KB Buffer
+ if ( pBuf )
+ {
+ while ( nToCopy )
+ {
+ nBufSize = ( nToCopy >= 0x40000 ) ? 0x40000 : nToCopy;
+ rStCtrl.Read( pBuf, nBufSize );
+ xOriginal->Write( pBuf, nBufSize );
+ nToCopy -= nBufSize;
+ }
+ delete[] pBuf;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ pHd = aDocRecManager.GetRecordHeader( PPT_PST_ExObjList, SEEK_FROM_BEGINNING );
+ if ( pHd )
+ {
+ DffRecordManager* pExObjListManager = NULL;
+ DffRecordHeader* pExEmbed = NULL;
+
+ pHd->SeekToBegOfRecord( rStCtrl );
+ pExObjListManager = new DffRecordManager( rStCtrl );
+ sal_uInt16 i, nRecType(PPT_PST_ExEmbed);
+
+ for ( i = 0; i < 2; i++ )
+ {
+ switch ( i )
+ {
+ case 0 : nRecType = PPT_PST_ExEmbed; break;
+ case 1 : nRecType = PPT_PST_ExControl; break;
+ }
+ for ( pExEmbed = pExObjListManager->GetRecordHeader( nRecType, SEEK_FROM_BEGINNING );
+ pExEmbed; pExEmbed = pExObjListManager->GetRecordHeader( nRecType, SEEK_FROM_CURRENT ) )
+ {
+ pExEmbed->SeekToContent( rStCtrl );
+
+ DffRecordHeader aExOleAtHd;
+ if ( SeekToRec( rStCtrl, PPT_PST_ExOleObjAtom, pExEmbed->GetRecEndFilePos(), &aExOleAtHd ) )
+ {
+ PptExOleObjAtom aAt;
+ rStCtrl >> aAt;
+
+ if ( aAt.nPersistPtr && ( aAt.nPersistPtr < nPersistPtrAnz ) )
+ {
+ UINT32 nId;
+ rStCtrl.Seek( pPersistPtr[ aAt.nPersistPtr ] );
+ DffRecordHeader aHd;
+ rStCtrl >> aHd;
+ if ( aHd.nRecType == DFF_PST_ExOleObjStg )
+ {
+ rStCtrl >> nId;
+ aOleObjectList.Insert(
+ new PPTOleEntry( aAt.nId, aHd.nFilePos, pShell, nRecType, aAt.nAspect ) );
+ }
+ }
+ }
+ }
+ }
+ delete pExObjListManager;
+ }
+ rStCtrl.Seek( nOldPos );
+ }
+}
+
+sal_Bool SdrPowerPointImport::ReadFontCollection()
+{
+ sal_Bool bRet = FALSE;
+ DffRecordHeader* pEnvHd = aDocRecManager.GetRecordHeader( PPT_PST_Environment );
+ if ( pEnvHd )
+ {
+ ULONG nFPosMerk = rStCtrl.Tell(); // FilePos merken fuer spaetere Restauration
+ pEnvHd->SeekToContent( rStCtrl );
+ DffRecordHeader aListHd;
+ if ( SeekToRec( rStCtrl, PPT_PST_FontCollection, pEnvHd->GetRecEndFilePos(), &aListHd ) )
+ {
+ sal_uInt16 nCount2 = 0;
+ VirtualDevice* pVDev = NULL;
+ while ( SeekToRec( rStCtrl, PPT_PST_FontEntityAtom, aListHd.GetRecEndFilePos() ) )
+ {
+ bRet = TRUE;
+ if ( !pFonts )
+ pFonts = new PptFontCollection;
+ PptFontEntityAtom* pFont = new PptFontEntityAtom;
+ rStCtrl >> *pFont;
+
+ Font aFont;
+ aFont.SetCharSet( pFont->eCharSet );
+ aFont.SetName( pFont->aName );
+ aFont.SetFamily( pFont->eFamily );
+ aFont.SetPitch( pFont->ePitch );
+ aFont.SetHeight( 100 );
+
+ if ( mbTracing && !pFont->bAvailable )
+ mpTracer->Trace( rtl::OUString::createFromAscii( "sd1000" ), pFont->aName );
+
+#ifdef DBG_EXTRACTFONTMETRICS
+
+ SvxFont aTmpFont( aFont );
+
+ if ( !pVDev )
+ pVDev = new VirtualDevice;
+ aTmpFont.SetPhysFont( pVDev );
+ FontMetric aMetric( pVDev->GetFontMetric() );
+ sal_uInt16 nTxtHeight = (sal_uInt16)aMetric.GetAscent() + (sal_uInt16)aMetric.GetDescent();
+
+ String aFileURLStr;
+ if( ::utl::LocalFileHelper::ConvertPhysicalNameToURL( Application::GetAppFileName(), aFileURLStr ) )
+ {
+ INetURLObject aURL( aFileURLStr );
+ aURL.SetName( String( RTL_CONSTASCII_STRINGPARAM( "dbgfontmetrics.txt" ) ) );
+
+ SvStream* pDbgOut = ::utl::UcbStreamHelper::CreateStream( aURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_WRITE );
+ if( pDbgOut )
+ {
+ pDbgOut->Seek( STREAM_SEEK_TO_END );
+
+ Printer* pPrinter = NULL;
+ if ( pSdrModel->GetRefDevice() && pSdrModel->GetRefDevice()->GetOutDevType() == OUTDEV_PRINTER )
+ pPrinter = (Printer*)pSdrModel->GetRefDevice();
+ if ( pPrinter )
+ {
+ Font aOldFont( pPrinter->GetFont() );
+ aFont.SetKerning( TRUE );
+ pPrinter->SetFont( aFont );
+ aMetric = pPrinter->GetFontMetric();
+ pPrinter->SetFont( aOldFont );
+ }
+
+ if ( ( pPrinter == NULL ) || ( aMetric.GetIntLeading() == 0 ) )
+ {
+ VirtualDevice aVirDev( 1 );
+ aVirDev.SetFont( aFont );
+ aMetric = aVirDev.GetFontMetric();
+ }
+ ByteString aFontName( aFont.GetName(), RTL_TEXTENCODING_UTF8 );
+ ByteString aHeight( ByteString::CreateFromInt32( aMetric.GetLineHeight() ) );
+ ByteString aAscent( ByteString::CreateFromInt32( aMetric.GetAscent() ) );
+ ByteString aDescent( ByteString::CreateFromInt32( aMetric.GetDescent() ) );
+ ByteString aLeading( ByteString::CreateFromInt32( aMetric.GetIntLeading() ) );
+ ByteString aPhysHeight( ByteString::CreateFromInt32( nTxtHeight ) );
+
+ *pDbgOut << (sal_uInt8)0xa
+ << "FontName : " << aFontName.GetBuffer() << (sal_uInt8)0xa
+ << " Height: " << aHeight.GetBuffer() << (sal_uInt8)0xa
+ << " Ascent: " << aAscent.GetBuffer() << (sal_uInt8)0xa
+ << " Descent:" << aDescent.GetBuffer() << (sal_uInt8)0xa
+ << " Leading:" << aLeading.GetBuffer() << (sal_uInt8)0xa
+ << "PhysHeight :" << aPhysHeight.GetBuffer()<< (sal_uInt8)0xa;
+ }
+ delete pDbgOut;
+ }
+#endif
+ // following block is necessary, because our old PowerPoint export did not set the
+ // correct charset
+ if ( pFont->aName.EqualsIgnoreCaseAscii( "Wingdings" ) ||
+ pFont->aName.EqualsIgnoreCaseAscii( "Wingdings 2" ) ||
+ pFont->aName.EqualsIgnoreCaseAscii( "Wingdings 3" ) ||
+ pFont->aName.EqualsIgnoreCaseAscii( "Monotype Sorts" ) ||
+ pFont->aName.EqualsIgnoreCaseAscii( "Monotype Sorts 2" ) ||
+ pFont->aName.EqualsIgnoreCaseAscii( "Webdings" ) ||
+ pFont->aName.EqualsIgnoreCaseAscii( "StarBats" ) ||
+ pFont->aName.EqualsIgnoreCaseAscii( "StarMath" ) ||
+ pFont->aName.EqualsIgnoreCaseAscii( "ZapfDingbats" ) )
+ {
+ pFont->eCharSet = RTL_TEXTENCODING_SYMBOL;
+ };
+ pFonts->C40_INSERT( PptFontEntityAtom, pFont, nCount2++ );
+ }
+ delete pVDev;
+ }
+ rStCtrl.Seek( nFPosMerk ); // FilePos restaurieren
+ }
+ return bRet;
+}
+
+PptSlidePersistList* SdrPowerPointImport::GetPageList(PptPageKind ePageKind) const
+{
+ if ( ePageKind == PPT_MASTERPAGE )
+ return pMasterPages;
+ if ( ePageKind == PPT_SLIDEPAGE )
+ return pSlidePages;
+ if ( ePageKind == PPT_NOTEPAGE )
+ return pNotePages;
+ return NULL;
+}
+
+SdrOutliner* SdrPowerPointImport::GetDrawOutliner( SdrTextObj* pSdrText ) const
+{
+ if ( !pSdrText )
+ return NULL;
+ else
+ return &pSdrText->ImpGetDrawOutliner();
+}
+
+
+SdrObject* SdrPowerPointImport::ReadObjText( PPTTextObj* pTextObj, SdrObject* pSdrObj, SdPage* pPage ) const
+{
+ SdrTextObj* pText = PTR_CAST( SdrTextObj, pSdrObj );
+ if ( pText )
+ {
+ if ( !ApplyTextObj( pTextObj, pText, pPage, NULL, NULL ) )
+ pSdrObj = NULL;
+ }
+ return pSdrObj;
+}
+
+
+SdrObject* SdrPowerPointImport::ApplyTextObj( PPTTextObj* pTextObj, SdrTextObj* pSdrText, SdPage* /*pPage*/,
+ SfxStyleSheet* pSheet, SfxStyleSheet** ppStyleSheetAry ) const
+{
+ SdrTextObj* pText = pSdrText;
+ if ( pTextObj->Count() )
+ {
+ UINT32 nDestinationInstance = pTextObj->GetDestinationInstance() ;
+ SdrOutliner& rOutliner = pText->ImpGetDrawOutliner();
+ if ( ( pText->GetObjInventor() == SdrInventor ) && ( pText->GetObjIdentifier() == OBJ_TITLETEXT ) ) // Outliner-Style fuer Titel-Textobjekt?!? (->von DL)
+ rOutliner.Init( OUTLINERMODE_TITLEOBJECT ); // Outliner reset
+
+ BOOL bOldUpdateMode = rOutliner.GetUpdateMode();
+ rOutliner.SetUpdateMode( FALSE );
+ if ( pSheet )
+ {
+ if ( rOutliner.GetStyleSheet( 0 ) != pSheet )
+ rOutliner.SetStyleSheet( 0, pSheet );
+ }
+ rOutliner.SetVertical( pTextObj->GetVertical() );
+ sal_Int16 nLastStartNumbering = -1;
+ const PPTParagraphObj* pPreviousParagraph = NULL;
+ for ( PPTParagraphObj* pPara = pTextObj->First(); pPara; pPara = pTextObj->Next() )
+ {
+ UINT32 nTextSize = pPara->GetTextSize();
+ if ( ! ( nTextSize & 0xffff0000 ) )
+ {
+ PPTPortionObj* pPortion;
+ sal_Unicode* pParaText = new sal_Unicode[ nTextSize ];
+ UINT32 nCurrentIndex = 0;
+ for ( pPortion = pPara->First(); pPortion; pPortion = pPara->Next() )
+ {
+ if ( pPortion->mpFieldItem )
+ pParaText[ nCurrentIndex++ ] = ' ';
+ else
+ {
+ sal_uInt32 nCharacters = pPortion->Count();
+ const sal_Unicode* pSource = pPortion->maString.GetBuffer();
+ sal_Unicode* pDest = pParaText + nCurrentIndex;
+
+ sal_uInt32 nFont;
+ pPortion->GetAttrib( PPT_CharAttr_Font, nFont, pTextObj->GetInstance() );
+ PptFontEntityAtom* pFontEnityAtom = GetFontEnityAtom( nFont );
+ if ( pFontEnityAtom && ( pFontEnityAtom->eCharSet == RTL_TEXTENCODING_SYMBOL ) )
+ {
+ sal_uInt32 i;
+ sal_Unicode nUnicode;
+ for ( i = 0; i < nCharacters; i++ )
+ {
+ nUnicode = pSource[ i ];
+ if ( ! ( nUnicode & 0xff00 ) )
+ nUnicode |= 0xf000;
+ pDest[ i ] = nUnicode;
+ }
+ }
+ else
+ memcpy( pDest, pSource, nCharacters << 1 );
+ nCurrentIndex += nCharacters;
+ }
+ }
+ sal_uInt16 nParaIndex = (UINT16)pTextObj->GetCurrentIndex();
+ SfxStyleSheet* pS = ( ppStyleSheetAry ) ? ppStyleSheetAry[ pPara->pParaSet->mnDepth ] : pSheet;
+
+ ESelection aSelection( nParaIndex, 0, nParaIndex, 0 );
+ rOutliner.Insert( String(), nParaIndex, pPara->pParaSet->mnDepth );
+ rOutliner.QuickInsertText( String( pParaText, (UINT16)nCurrentIndex ), aSelection );
+ rOutliner.SetParaAttribs( nParaIndex, rOutliner.GetEmptyItemSet() );
+ if ( pS )
+ rOutliner.SetStyleSheet( nParaIndex, pS );
+
+ for ( pPortion = pPara->First(); pPortion; pPortion = pPara->Next() )
+ {
+ SfxItemSet aPortionAttribs( rOutliner.GetEmptyItemSet() );
+ SvxFieldItem* pFieldItem = pPortion->GetTextField();
+ if ( pFieldItem )
+ {
+ rOutliner.QuickInsertField( *pFieldItem, ESelection( nParaIndex, aSelection.nEndPos, nParaIndex, aSelection.nEndPos + 1 ) );
+ aSelection.nEndPos++;
+ delete pFieldItem;
+ }
+ else
+ {
+ const sal_Unicode *pF, *pPtr = pPortion->maString.GetBuffer();
+ const sal_Unicode *pMax = pPtr + pPortion->maString.Len();
+ sal_Int32 nLen;
+ for ( pF = pPtr; pPtr < pMax; pPtr++ )
+ {
+ if ( *pPtr == 0xb )
+ {
+ nLen = pPtr - pF;
+ if ( nLen )
+ aSelection.nEndPos =
+ sal::static_int_cast< USHORT >(
+ aSelection.nEndPos + nLen );
+ pF = pPtr + 1;
+ rOutliner.QuickInsertLineBreak( ESelection( nParaIndex, aSelection.nEndPos, nParaIndex, aSelection.nEndPos + 1 ) );
+ aSelection.nEndPos++;
+ }
+ }
+ nLen = pPtr - pF;
+ if ( nLen )
+ aSelection.nEndPos = sal::static_int_cast< USHORT >(
+ aSelection.nEndPos + nLen );
+ }
+ pPortion->ApplyTo( aPortionAttribs, (SdrPowerPointImport&)*this, nDestinationInstance, pTextObj );
+ rOutliner.QuickSetAttribs( aPortionAttribs, aSelection );
+ aSelection.nStartPos = aSelection.nEndPos;
+ }
+ boost::optional< sal_Int16 > oStartNumbering;
+ SfxItemSet aParagraphAttribs( rOutliner.GetEmptyItemSet() );
+ pPara->ApplyTo( aParagraphAttribs, oStartNumbering, (SdrPowerPointImport&)*this, nDestinationInstance, pPreviousParagraph );
+
+ UINT32 nIsBullet2 = 0; //, nInstance = nDestinationInstance != 0xffffffff ? nDestinationInstance : pTextObj->GetInstance();
+ pPara->GetAttrib( PPT_ParaAttr_BulletOn, nIsBullet2, nDestinationInstance );
+ if ( !nIsBullet2 )
+ aParagraphAttribs.Put( SfxBoolItem( EE_PARA_BULLETSTATE, FALSE ) );
+
+ if ( oStartNumbering )
+ {
+ if ( *oStartNumbering != nLastStartNumbering )
+ rOutliner.SetNumberingStartValue( nParaIndex, *oStartNumbering );
+ else
+ rOutliner.SetNumberingStartValue( nParaIndex, -1 );
+ nLastStartNumbering = *oStartNumbering;
+ }
+ else
+ {
+ nLastStartNumbering = -1;
+ rOutliner.SetNumberingStartValue( nParaIndex, nLastStartNumbering );
+ }
+
+ pPreviousParagraph = pPara;
+ if ( !aSelection.nStartPos ) // in PPT empty paragraphs never gets a bullet
+ {
+ aParagraphAttribs.Put( SfxBoolItem( EE_PARA_BULLETSTATE, FALSE ) );
+// rOutliner.SetDepth( rOutliner.GetParagraph( nParaIndex ), -1 );
+ }
+ aSelection.nStartPos = 0;
+ rOutliner.QuickSetAttribs( aParagraphAttribs, aSelection );
+ delete[] pParaText;
+ }
+ }
+ OutlinerParaObject* pNewText = rOutliner.CreateParaObject();
+ rOutliner.Clear();
+ rOutliner.SetUpdateMode( bOldUpdateMode );
+ pText->SetOutlinerParaObject( pNewText );
+ }
+ return pText;
+}
+
+sal_Bool SdrPowerPointImport::SeekToDocument( DffRecordHeader* pRecHd ) const
+{
+ sal_Bool bRet;
+ ULONG nFPosMerk = rStCtrl.Tell(); // FilePos merken fuer ggf. spaetere Restauration
+ rStCtrl.Seek( nDocStreamPos );
+ DffRecordHeader aDocHd;
+ rStCtrl >> aDocHd;
+ bRet = aDocHd.nRecType == PPT_PST_Document;
+ if ( bRet )
+ {
+ if ( pRecHd )
+ *pRecHd = aDocHd;
+ else
+ aDocHd.SeekToBegOfRecord( rStCtrl );
+ }
+ if ( !bRet )
+ rStCtrl.Seek( nFPosMerk ); // FilePos restaurieren
+ return bRet;
+}
+
+sal_Bool SdrPowerPointImport::SeekToContentOfProgTag( sal_Int32 nVersion, SvStream& rSt,
+ const DffRecordHeader& rSourceHd, DffRecordHeader& rContentHd )
+{
+ sal_Bool bRetValue = sal_False;
+ sal_uInt32 nOldPos = rSt.Tell();
+
+ DffRecordHeader aProgTagsHd, aProgTagBinaryDataHd;
+ rSourceHd.SeekToContent( rSt );
+ sal_Bool bFound = rSourceHd.nRecType == PPT_PST_ProgTags;
+ if ( !bFound )
+ bFound = SeekToRec( rSt, PPT_PST_ProgTags, rSourceHd.GetRecEndFilePos(), &aProgTagsHd );
+ if ( bFound )
+ {
+ while( SeekToRec( rSt, PPT_PST_ProgBinaryTag, aProgTagsHd.GetRecEndFilePos(), &aProgTagBinaryDataHd ) )
+ {
+ rSt >> rContentHd;
+ if ( rContentHd.nRecType == PPT_PST_CString )
+ {
+ sal_uInt16 n = 6;
+ sal_uInt32 i = rContentHd.nRecLen >> 1;
+ if ( i > n )
+ {
+ String aPre, aSuf;
+ sal_Unicode *pTmp = aPre.AllocBuffer( n );
+ while ( n-- )
+ rSt >> *pTmp++;
+ n = (sal_uInt16)( i - 6 );
+ pTmp = aSuf.AllocBuffer( n );
+ while ( n-- )
+ rSt >> *pTmp++;
+ sal_Int32 nV = aSuf.ToInt32();
+ if ( ( nV == nVersion ) && ( aPre == String( RTL_CONSTASCII_USTRINGPARAM( "___PPT" ) ) ) )
+ {
+ rContentHd.SeekToEndOfRecord( rSt );
+ rSt >> rContentHd;
+ if ( rContentHd.nRecType == PPT_PST_BinaryTagData )
+ {
+ bRetValue = sal_True;
+ break;
+ }
+ }
+ }
+ }
+ aProgTagBinaryDataHd.SeekToEndOfRecord( rSt );
+ }
+ }
+ if ( !bRetValue )
+ rSt.Seek( nOldPos );
+ return bRetValue;
+}
+
+UINT32 SdrPowerPointImport::GetAktPageId()
+{
+ PptSlidePersistList* pList = GetPageList( eAktPageKind );
+ if ( pList && nAktPageNum < pList->Count() )
+ return (*pList)[ (USHORT)nAktPageNum ]->aPersistAtom.nSlideId;
+ return 0;
+}
+
+sal_Bool SdrPowerPointImport::SeekToAktPage( DffRecordHeader* pRecHd ) const
+{
+ sal_Bool bRet = FALSE;
+ PptSlidePersistList* pList = GetPageList( eAktPageKind );
+ if ( pList && ( nAktPageNum < pList->Count() ) )
+ {
+ ULONG nPersist = (*pList)[ (USHORT)nAktPageNum ]->aPersistAtom.nPsrReference;
+ if ( nPersist > 0 && nPersist < nPersistPtrAnz )
+ {
+ ULONG nFPos = 0;
+ nFPos = pPersistPtr[ nPersist ];
+ if ( nFPos < nStreamLen )
+ {
+ rStCtrl.Seek( nFPos );
+ if ( pRecHd )
+ rStCtrl >> *pRecHd;
+ bRet = TRUE;
+ }
+ }
+ }
+ return bRet;
+}
+
+USHORT SdrPowerPointImport::GetPageCount( PptPageKind ePageKind ) const
+{
+ PptSlidePersistList* pList = GetPageList( ePageKind );
+ if ( pList )
+ return pList->Count();
+ return 0;
+}
+
+void SdrPowerPointImport::SetPageNum( sal_uInt16 nPageNum, PptPageKind eKind )
+{
+ eAktPageKind = eKind;
+ nAktPageNum = nPageNum;
+
+ pPPTStyleSheet = NULL;
+
+ sal_Bool bHasMasterPage = sal_True;
+ sal_uInt16 nMasterIndex = 0;
+
+ if ( eKind == PPT_MASTERPAGE )
+ nMasterIndex = nPageNum;
+ else
+ {
+ if ( HasMasterPage( nPageNum, eKind ) )
+ nMasterIndex = GetMasterPageIndex( nPageNum, eKind );
+ else
+ bHasMasterPage = sal_False;
+ }
+ if ( bHasMasterPage )
+ {
+ PptSlidePersistList* pPageList = GetPageList( PPT_MASTERPAGE );
+ if ( pPageList && nMasterIndex < pPageList->Count() )
+ {
+ PptSlidePersistEntry* pMasterPersist = (*pPageList)[ nMasterIndex ];
+ if ( ( pMasterPersist->pStyleSheet == NULL ) && pMasterPersist->aSlideAtom.nMasterId )
+ {
+ nMasterIndex = pMasterPages->FindPage( pMasterPersist->aSlideAtom.nMasterId );
+ if ( nMasterIndex != PPTSLIDEPERSIST_ENTRY_NOTFOUND )
+ pMasterPersist = (*pPageList)[ nMasterIndex ];
+ }
+ pPPTStyleSheet = pMasterPersist->pStyleSheet;
+ }
+ }
+ if ( !pPPTStyleSheet )
+ pPPTStyleSheet = pDefaultSheet;
+}
+
+Size SdrPowerPointImport::GetPageSize() const
+{
+ Size aRet( IsNoteOrHandout( nAktPageNum, eAktPageKind ) ? aDocAtom.GetNotesPageSize() : aDocAtom.GetSlidesPageSize() );
+ Scale( aRet );
+ // PPT arbeitet nur mit Einheiten zu 576DPI. Um Ungenauigkeiten zu
+ // vermeiden runde ich die letzte Nachkommastelle metrisch weg.
+ if ( nMapMul > 2 * nMapDiv )
+ {
+ MapUnit eMap = pSdrModel->GetScaleUnit();
+ bool bInch = IsInch( eMap );
+ long nInchMul = 1, nInchDiv = 1;
+ if ( bInch )
+ { // Size temporaer (zum runden) in nach metric konvertieren
+ Fraction aFact(GetMapFactor(eMap,MAP_100TH_MM).X());
+ nInchMul = aFact.GetNumerator();
+ nInchDiv = aFact.GetDenominator();
+ aRet.Width() = BigMulDiv( aRet.Width(), nInchMul, nInchDiv );
+ aRet.Height() = BigMulDiv( aRet.Height(), nInchMul, nInchDiv );
+ }
+ aRet.Width() += 5; aRet.Width() /= 10; aRet.Width()*=10;
+ aRet.Height() += 5; aRet.Height() /= 10; aRet.Height()*=10;
+ if ( bInch )
+ {
+ aRet.Width() = BigMulDiv( aRet.Width(), nInchDiv, nInchMul );
+ aRet.Height() = BigMulDiv( aRet.Height(), nInchDiv, nInchMul );
+ }
+ }
+ return aRet;
+}
+
+FASTBOOL SdrPowerPointImport::GetColorFromPalette( USHORT nNum, Color& rColor ) const
+{
+ if ( nPageColorsNum != nAktPageNum || ePageColorsKind != eAktPageKind )
+ {
+ UINT16 nSlideFlags = 0;
+ PptSlidePersistList* pPageList = GetPageList( eAktPageKind );
+ if ( pPageList && ( nAktPageNum < pPageList->Count() ) )
+ {
+ PptSlidePersistEntry* pE = (*pPageList)[ nAktPageNum ];
+ if ( pE )
+ nSlideFlags = pE->aSlideAtom.nFlags;
+ if ( ! ( nSlideFlags & 2 ) )
+ ((SdrPowerPointImport*)this)->aPageColors = pE->aColorScheme;
+ }
+ if ( nSlideFlags & 2 ) // follow master colorscheme ?
+ {
+ PptSlidePersistList* pPageList2 = GetPageList( PPT_MASTERPAGE );
+ if ( pPageList2 )
+ {
+ PptSlidePersistEntry* pMasterPersist = NULL;
+ if ( eAktPageKind == PPT_MASTERPAGE )
+ pMasterPersist = (*pPageList2)[ nAktPageNum ];
+ else
+ {
+ if ( HasMasterPage( nAktPageNum, eAktPageKind ) )
+ {
+ sal_uInt16 nMasterNum = GetMasterPageIndex( nAktPageNum, eAktPageKind );
+ if ( nMasterNum < pPageList2->Count() )
+ pMasterPersist = (*pPageList2)[ nMasterNum ];
+ }
+ }
+ if ( pMasterPersist )
+ {
+ while( ( pMasterPersist && pMasterPersist->aSlideAtom.nFlags & 2 ) // it is possible that a masterpage
+ && pMasterPersist->aSlideAtom.nMasterId ) // itself is following a master colorscheme
+ {
+ sal_uInt16 nNextMaster = pMasterPages->FindPage( pMasterPersist->aSlideAtom.nMasterId );
+ if ( nNextMaster == PPTSLIDEPERSIST_ENTRY_NOTFOUND )
+ break;
+ else
+ pMasterPersist = (*pPageList2)[ nNextMaster ];
+ }
+ ((SdrPowerPointImport*)this)->aPageColors = pMasterPersist->aColorScheme;
+ }
+ }
+ }
+ // momentanes Farbschema eintragen
+ ((SdrPowerPointImport*)this)->nPageColorsNum = nAktPageNum;
+ ((SdrPowerPointImport*)this)->ePageColorsKind = eAktPageKind;
+ }
+ rColor = aPageColors.GetColor( nNum );
+ return TRUE;
+}
+
+BOOL SdrPowerPointImport::SeekToShape( SvStream& rSt, void* pClientData, UINT32 nId ) const
+{
+ BOOL bRet = SvxMSDffManager::SeekToShape( rSt, pClientData, nId );
+ if ( !bRet )
+ {
+ ProcessData& rData = *( (ProcessData*)pClientData );
+ PptSlidePersistEntry& rPersistEntry = rData.rPersistEntry;
+ if ( rPersistEntry.ePageKind == PPT_SLIDEPAGE )
+ {
+ if ( HasMasterPage( nAktPageNum, eAktPageKind ) )
+ {
+ USHORT nMasterNum = GetMasterPageIndex( nAktPageNum, eAktPageKind );
+ PptSlidePersistList* pPageList = GetPageList( PPT_MASTERPAGE );
+ if ( pPageList && ( nMasterNum < pPageList->Count() ) )
+ {
+ PptSlidePersistEntry* pPersist = (*pPageList)[ nMasterNum ]; // get the masterpage's persistentry
+ if ( pPersist && pPersist->pPresentationObjects )
+ {
+ UINT32 nCurrent(0L);
+ DffRecordList* pCList = maShapeRecords.pCList; // we got a backup of the current position
+ if ( pCList )
+ nCurrent = pCList->nCurrent;
+ if ( ((SdrEscherImport*)this )->maShapeRecords.SeekToContent( rSt, DFF_msofbtClientData, SEEK_FROM_CURRENT_AND_RESTART ) )
+ {
+ UINT32 nStreamPos = rSt.Tell();
+ PPTTextObj aTextObj( rSt, (SdrPowerPointImport&)*this, rPersistEntry, NULL );
+ if ( aTextObj.Count() || aTextObj.GetOEPlaceHolderAtom() )
+ {
+ UINT32 nShapePos = 0;
+ switch ( aTextObj.GetInstance() )
+ {
+ case TSS_TYPE_TITLE :
+ nShapePos = pPersist->pPresentationObjects[ TSS_TYPE_PAGETITLE ];
+ break;
+ case TSS_TYPE_PAGETITLE :
+ nShapePos = pPersist->pPresentationObjects[ TSS_TYPE_PAGETITLE ];
+ break;
+ case TSS_TYPE_SUBTITLE :
+ case TSS_TYPE_HALFBODY :
+ case TSS_TYPE_QUARTERBODY :
+ case TSS_TYPE_BODY :
+ nShapePos = pPersist->pPresentationObjects[ TSS_TYPE_BODY ];
+ break;
+// case TSS_TYPE_NOTES :
+// case TSS_TYPE_UNUSED :
+// case TSS_TYPE_TEXT_IN_SHAPE :
+ }
+ if ( nShapePos )
+ {
+ rSt.Seek( nShapePos );
+ bRet = TRUE;
+ }
+ }
+ if ( !bRet )
+ rSt.Seek( nStreamPos );
+ }
+ if ( pCList ) // restoring
+ pCList->nCurrent = nCurrent;
+ ((SdrEscherImport*)this )->maShapeRecords.pCList = pCList;
+ }
+ }
+ }
+ }
+ }
+ return bRet;
+}
+
+SdrPage* SdrPowerPointImport::MakeBlancPage( sal_Bool bMaster ) const
+{
+ SdrPage* pRet = pSdrModel->AllocPage( bMaster );
+ pRet->SetSize( GetPageSize() );
+
+/*
+ SJ (21.08.00) : since bug #77576# i decided not to set a border size.
+
+ Size aPageSize( aDocAtom.GetSlidesPageSize() ); // PageSize in 576DPI-Units
+ long nHMarg = aPageSize.Width() - aDocAtom.aSlidesPageSize.Width();
+ long nVMarg = aPageSize.Height() - aDocAtom.aSlidesPageSize.Height();
+ if ( nHMarg > 0 )
+ {
+ Scale( nHMarg );
+ pRet->SetLftBorder( nHMarg / 2 );
+ pRet->SetRgtBorder( nHMarg - nHMarg / 2 );
+ }
+ if ( nVMarg > 0 )
+ {
+ Scale( nVMarg );
+ pRet->SetUppBorder( nVMarg / 2 );
+ pRet->SetLwrBorder( nVMarg - nVMarg / 2 );
+ }
+*/
+ return pRet;
+}
+
+void ImportComment10( SvxMSDffManager& rMan, SvStream& rStCtrl, SdrPage* pPage, DffRecordHeader& rComment10Hd )
+{
+ rtl::OUString sAuthor;
+ rtl::OUString sText;
+ rtl::OUString sInitials;
+
+ sal_Int32 nIndex = 0;
+ util::DateTime aDateTime;
+ sal_Int32 nPosX = 0;
+ sal_Int32 nPosY = 0;
+
+ while ( ( rStCtrl.GetError() == 0 ) && ( rStCtrl.Tell() < rComment10Hd.GetRecEndFilePos() ) )
+ {
+ DffRecordHeader aCommentHd;
+ rStCtrl >> aCommentHd;
+ switch( aCommentHd.nRecType )
+ {
+ case PPT_PST_CString :
+ {
+ String aString;
+ SvxMSDffManager::MSDFFReadZString( rStCtrl, aString, aCommentHd.nRecLen, TRUE );
+ switch ( aCommentHd.nRecInstance )
+ {
+ case 0 : sAuthor = aString; break;
+ case 1 : sText = aString; break;
+ case 2 : sInitials = aString; break;
+ }
+ }
+ break;
+
+ case PPT_PST_CommentAtom10 :
+ {
+ rStCtrl >> nIndex
+ >> aDateTime.Year
+ >> aDateTime.Month
+ >> aDateTime.Day // DayOfWeek
+ >> aDateTime.Day
+ >> aDateTime.Hours
+ >> aDateTime.Minutes
+ >> aDateTime.Seconds
+ >> aDateTime.HundredthSeconds
+ >> nPosX
+ >> nPosY;
+
+ aDateTime.HundredthSeconds /= 10;
+ }
+ break;
+ }
+ aCommentHd.SeekToEndOfRecord( rStCtrl );
+ }
+ Point aPosition( nPosX, nPosY );
+ rMan.Scale( aPosition );
+
+ try
+ {
+ uno::Reference< office::XAnnotationAccess > xAnnotationAccess( pPage->getUnoPage(), UNO_QUERY_THROW );
+ uno::Reference< office::XAnnotation > xAnnotation( xAnnotationAccess->createAndInsertAnnotation() );
+ xAnnotation->setPosition( geometry::RealPoint2D( aPosition.X() / 100.0, aPosition.Y() / 100.0 ) );
+ xAnnotation->setAuthor( sAuthor );
+ xAnnotation->setDateTime( aDateTime );
+ uno::Reference< text::XText > xText( xAnnotation->getTextRange() );
+ xText->setString( sText );
+ }
+ catch( uno::Exception& )
+ {
+
+ }
+}
+
+
+// be sure not to import masterpages with this method
+// be sure not to import masterpages with this method
+void SdrPowerPointImport::ImportPage( SdrPage* pRet, const PptSlidePersistEntry* pMasterPersist )
+{
+ UINT32 nMerk = rStCtrl.Tell();
+ PptSlidePersistList* pList = GetPageList( eAktPageKind );
+ if ( ( !pList ) || ( pList->Count() <= nAktPageNum ) )
+ return;
+ PptSlidePersistEntry& rSlidePersist = *(*pList)[ nAktPageNum ];
+ if ( rSlidePersist.bStarDrawFiller )
+ return;
+
+ DffRecordHeader aPageHd;
+ if ( SeekToAktPage( &aPageHd ) )
+ {
+ if ( mbTracing )
+ mpTracer->AddAttribute( eAktPageKind == PPT_SLIDEPAGE
+ ? rtl::OUString::createFromAscii( "Page" )
+ : rtl::OUString::createFromAscii( "NotesPage" ),
+ rtl::OUString::valueOf( (sal_Int32)nAktPageNum + 1 ) );
+
+ rSlidePersist.pHeaderFooterEntry = new HeaderFooterEntry( pMasterPersist );
+ ProcessData aProcessData( rSlidePersist, (SdPage*)pRet );
+ while ( ( rStCtrl.GetError() == 0 ) && ( rStCtrl.Tell() < aPageHd.GetRecEndFilePos() ) )
+ {
+ DffRecordHeader aHd;
+ rStCtrl >> aHd;
+ switch ( aHd.nRecType )
+ {
+ case PPT_PST_HeadersFooters :
+ {
+ ImportHeaderFooterContainer( aHd, *rSlidePersist.pHeaderFooterEntry );
+ }
+ break;
+
+ case PPT_PST_ProgTags :
+ {
+ DffRecordHeader aContentDataHd;
+ if ( SeekToContentOfProgTag( 10, rStCtrl, aHd, aContentDataHd ) )
+ {
+ DffRecordHeader aComment10Hd;
+ while( ( rStCtrl.GetError() == 0 ) && SeekToRec( rStCtrl, PPT_PST_Comment10, aContentDataHd.GetRecEndFilePos(), &aComment10Hd ) )
+ {
+ ImportComment10( *this, rStCtrl, pRet, aComment10Hd );
+ aComment10Hd.SeekToEndOfRecord( rStCtrl );
+ }
+ }
+ }
+ break;
+
+ case PPT_PST_PPDrawing :
+ {
+ DffRecordHeader aPPDrawHd;
+ if ( SeekToRec( rStCtrl, DFF_msofbtDgContainer, aHd.GetRecEndFilePos(), &aPPDrawHd ) )
+ {
+ sal_uInt32 nPPDrawOfs = rStCtrl.Tell();
+
+ // importing the background object before importing the page
+ while ( ( rStCtrl.GetError() == 0 ) && ( rStCtrl.Tell() < aPPDrawHd.GetRecEndFilePos() ) )
+ {
+ DffRecordHeader aEscherObjListHd;
+ rStCtrl >> aEscherObjListHd;
+ switch ( aEscherObjListHd.nRecType )
+ {
+ case DFF_msofbtSpContainer :
+ {
+ Rectangle aPageSize( Point(), pRet->GetSize() );
+ if ( rSlidePersist.aSlideAtom.nFlags & 4 ) // follow master background ?
+ {
+ if ( HasMasterPage( nAktPageNum, eAktPageKind ) )
+ {
+ sal_uInt16 nMasterNum = GetMasterPageIndex( nAktPageNum, eAktPageKind );
+ PptSlidePersistList* pPageList = GetPageList( PPT_MASTERPAGE );
+ PptSlidePersistEntry* pE = (*pPageList)[ nMasterNum ];
+ while( ( pE->aSlideAtom.nFlags & 4 ) && pE->aSlideAtom.nMasterId )
+ {
+ sal_uInt16 nNextMaster = pMasterPages->FindPage( pE->aSlideAtom.nMasterId );
+ if ( nNextMaster == PPTSLIDEPERSIST_ENTRY_NOTFOUND )
+ break;
+ else
+ pE = (*pPageList)[ nNextMaster ];
+ }
+ if ( pE->nBackgroundOffset )
+ {
+ // do not follow master colorscheme ?
+ sal_Bool bTemporary = ( rSlidePersist.aSlideAtom.nFlags & 2 ) != 0;
+ sal_uInt32 nPos = rStCtrl.Tell();
+ rStCtrl.Seek( pE->nBackgroundOffset );
+ rSlidePersist.pBObj = ImportObj( rStCtrl, (void*)&aProcessData, aPageSize, aPageSize );
+ rSlidePersist.bBObjIsTemporary = bTemporary;
+ rStCtrl.Seek( nPos );
+ }
+ }
+ }
+ else
+ {
+ DffRecordHeader aShapeHd;
+ rStCtrl >> aShapeHd;
+ if ( aShapeHd.nRecType == DFF_msofbtSp )
+ {
+ UINT32 nSpFlags;
+ rStCtrl >> nSpFlags >> nSpFlags;
+ if ( nSpFlags & SP_FBACKGROUND )
+ {
+ aEscherObjListHd.SeekToBegOfRecord( rStCtrl );
+ rSlidePersist.pBObj = ImportObj( rStCtrl, (void*)&aProcessData, aPageSize, aPageSize );
+ rSlidePersist.bBObjIsTemporary = sal_False;
+ }
+ }
+ }
+ }
+ break;
+ }
+ if ( aEscherObjListHd.nRecType == DFF_msofbtSpContainer )
+ break;
+ aEscherObjListHd.SeekToEndOfRecord( rStCtrl );
+ }
+
+ // now importing page
+ rStCtrl.Seek( nPPDrawOfs );
+ while ( ( rStCtrl.GetError() == 0 ) && ( rStCtrl.Tell() < aPPDrawHd.GetRecEndFilePos() ) )
+ {
+ DffRecordHeader aEscherObjListHd;
+ rStCtrl >> aEscherObjListHd;
+ switch ( aEscherObjListHd.nRecType )
+ {
+ case DFF_msofbtSpgrContainer :
+ {
+ DffRecordHeader aShapeHd;
+ if ( SeekToRec( rStCtrl, DFF_msofbtSpContainer, aEscherObjListHd.GetRecEndFilePos(), &aShapeHd ) )
+ {
+ aShapeHd.SeekToEndOfRecord( rStCtrl );
+ while ( ( rStCtrl.GetError() == 0 ) && ( rStCtrl.Tell() < aEscherObjListHd.GetRecEndFilePos() ) )
+ {
+ rStCtrl >> aShapeHd;
+ if ( ( aShapeHd.nRecType == DFF_msofbtSpContainer ) || ( aShapeHd.nRecType == DFF_msofbtSpgrContainer ) )
+ {
+ Rectangle aEmpty;
+ aShapeHd.SeekToBegOfRecord( rStCtrl );
+ sal_Int32 nShapeId;
+ aProcessData.pTableRowProperties = NULL;
+ SdrObject* pObj = ImportObj( rStCtrl, (void*)&aProcessData, aEmpty, aEmpty, 0, &nShapeId );
+ if ( pObj )
+ {
+ if ( aProcessData.pTableRowProperties )
+ pObj = CreateTable( pObj, aProcessData.pTableRowProperties, aProcessData.rPersistEntry.pSolverContainer );
+
+ pRet->NbcInsertObject( pObj );
+
+ if( nShapeId )
+ insertShapeId( nShapeId, pObj );
+ }
+ }
+ aShapeHd.SeekToEndOfRecord( rStCtrl );
+ }
+ }
+ }
+ break;
+ }
+ if ( aEscherObjListHd.nRecType == DFF_msofbtSpgrContainer )
+ break;
+ aEscherObjListHd.SeekToEndOfRecord( rStCtrl );
+ }
+
+ /* There are a lot of Shapes who are dependent to
+ the current background color */
+ if ( rSlidePersist.ePageKind == PPT_SLIDEPAGE )
+ {
+ List* pList2 = aProcessData.pBackgroundColoredObjects;
+ if ( pList2 )
+ {
+ if ( rSlidePersist.pBObj )
+ {
+ void* pPtr;
+ const SfxPoolItem* pPoolItem = NULL;
+ const SfxItemSet& rObjectItemSet = rSlidePersist.pBObj->GetMergedItemSet();
+
+ //SfxItemState eState = rObjectItemSet.GetItemState( XATTR_FILLCOLOR, FALSE, &pPoolItem );
+ if ( pPoolItem )
+ {
+ SfxItemSet aNewSet(*rObjectItemSet.GetPool());
+ aNewSet.Put(*pPoolItem);
+ aNewSet.Put(XFillStyleItem( XFILL_SOLID ));
+
+ for ( pPtr = pList2->First(); pPtr; pPtr = pList2->Next() )
+ {
+ ((SdrObject*)pPtr)->SetMergedItemSet(aNewSet);
+ }
+ }
+ }
+ }
+ }
+ if ( rSlidePersist.pBObj )
+ {
+ // #i99386# transfer the attributes from the temporary BackgroundObject
+ // to the Page and delete it. Maybe rSlidePersist.bBObjIsTemporary is
+ // obsolete here, too.
+ pRet->getSdrPageProperties().ClearItem();
+ pRet->getSdrPageProperties().PutItemSet(rSlidePersist.pBObj->GetMergedItemSet());
+ SdrObject::Free( rSlidePersist.pBObj );
+ }
+ }
+ }
+ break;
+ }
+ aHd.SeekToEndOfRecord( rStCtrl );
+ }
+ if ( rSlidePersist.pSolverContainer )
+ SolveSolver( *rSlidePersist.pSolverContainer );
+ if ( mbTracing )
+ mpTracer->RemoveAttribute( eAktPageKind == PPT_SLIDEPAGE
+ ? rtl::OUString::createFromAscii( "Page" )
+ : rtl::OUString::createFromAscii( "NotesPage" ) );
+ }
+ rStCtrl.Seek( nMerk );
+}
+
+const PptSlideLayoutAtom* SdrPowerPointImport::GetSlideLayoutAtom() const
+{
+ PptSlidePersistList* pPageList = GetPageList( eAktPageKind );
+ if ( pPageList && nAktPageNum < pPageList->Count() )
+ {
+ PptSlidePersistEntry* pE = (*pPageList)[ nAktPageNum ];
+ if ( pE )
+ return &pE->aSlideAtom.aLayout;
+ }
+ return NULL;
+}
+
+sal_Bool SdrPowerPointImport::IsNoteOrHandout( USHORT nPageNum, PptPageKind /*ePageKind*/) const
+{
+ sal_Bool bNote = eAktPageKind == PPT_NOTEPAGE;
+ if ( eAktPageKind == PPT_MASTERPAGE )
+ bNote = ( nPageNum & 1 ) == 0;
+ return bNote;
+}
+
+UINT32 SdrPowerPointImport::GetMasterPageId( USHORT nPageNum, PptPageKind ePageKind ) const
+{
+ PptSlidePersistList* pPageList = GetPageList( ePageKind );
+ if ( pPageList && nPageNum < pPageList->Count() )
+ return (*pPageList)[ nPageNum ]->aSlideAtom.nMasterId;
+ return 0;
+}
+
+UINT32 SdrPowerPointImport::GetNotesPageId( USHORT nPageNum ) const
+{
+ PptSlidePersistList* pPageList=GetPageList( PPT_SLIDEPAGE );
+ if ( pPageList && nPageNum < pPageList->Count() )
+ return (*pPageList)[ nPageNum ]->aSlideAtom.nNotesId;
+ return 0;
+}
+
+sal_Bool SdrPowerPointImport::HasMasterPage( USHORT nPageNum, PptPageKind ePageKind ) const
+{
+ if ( ePageKind == PPT_NOTEPAGE )
+ return aDocAtom.nNotesMasterPersist != 0;
+ if ( ePageKind == PPT_MASTERPAGE )
+ return FALSE;
+ return GetMasterPageId( nPageNum, ePageKind ) != 0;
+}
+
+USHORT SdrPowerPointImport::GetMasterPageIndex( USHORT nPageNum, PptPageKind ePageKind ) const
+{
+ USHORT nIdx = 0;
+ if ( ePageKind == PPT_NOTEPAGE )
+ return 2;
+ UINT32 nId = GetMasterPageId( nPageNum, ePageKind );
+ if ( nId && pMasterPages )
+ {
+ nIdx = pMasterPages->FindPage( nId );
+ if ( nIdx == PPTSLIDEPERSIST_ENTRY_NOTFOUND )
+ nIdx = 0;
+ }
+ return nIdx;
+}
+
+SdrObject* SdrPowerPointImport::ImportPageBackgroundObject( const SdrPage& rPage, sal_uInt32& nBgFileOffset, sal_Bool bForce )
+{
+ SdrObject* pRet = NULL;
+ sal_Bool bCreateObj = bForce;
+ SfxItemSet* pSet = NULL;
+ ULONG nFPosMerk = rStCtrl.Tell(); // FilePos merken fuer spaetere Restauration
+ DffRecordHeader aPageHd;
+ if ( SeekToAktPage( &aPageHd ) )
+ { // und nun die Hintergrundattribute der Page suchen
+ ULONG nPageRecEnd = aPageHd.GetRecEndFilePos();
+ DffRecordHeader aPPDrawHd;
+ if ( SeekToRec( rStCtrl, PPT_PST_PPDrawing, nPageRecEnd, &aPPDrawHd ) )
+ {
+ ULONG nPPDrawEnd = aPPDrawHd.GetRecEndFilePos();
+ DffRecordHeader aEscherF002Hd;
+ if ( SeekToRec( rStCtrl, DFF_msofbtDgContainer, nPPDrawEnd, &aEscherF002Hd ) )
+ {
+ ULONG nEscherF002End = aEscherF002Hd.GetRecEndFilePos();
+ DffRecordHeader aEscherObjectHd;
+ if ( SeekToRec( rStCtrl, DFF_msofbtSpContainer, nEscherF002End, &aEscherObjectHd ) )
+ {
+ nBgFileOffset = aEscherObjectHd.GetRecBegFilePos();
+ //ULONG nEscherObjectEnd = aEscherObjectHd.GetRecEndFilePos();
+ //DffRecordHeader aEscherPropertiesHd;
+ if ( SeekToRec( rStCtrl, DFF_msofbtOPT,nEscherF002End ) )
+ {
+ rStCtrl >> (DffPropertyReader&)*this;
+ mnFix16Angle = Fix16ToAngle( GetPropertyValue( DFF_Prop_Rotation, 0 ) );
+ UINT32 nColor = GetPropertyValue( DFF_Prop_fillColor, 0xffffff );
+ pSet = new SfxItemSet( pSdrModel->GetItemPool() );
+ DffObjData aObjData( aEscherObjectHd, Rectangle( 0, 0, 28000, 21000 ), 0 );
+ ApplyAttributes( rStCtrl, *pSet, aObjData );
+ Color aColor( MSO_CLR_ToColor( nColor ) );
+ pSet->Put( XFillColorItem( String(), aColor ) );
+ }
+ }
+ }
+ }
+ }
+ rStCtrl.Seek( nFPosMerk ); // FilePos restaurieren
+ if ( bCreateObj )
+ {
+ if ( !pSet )
+ {
+ pSet = new SfxItemSet( pSdrModel->GetItemPool() );
+ pSet->Put( XFillStyleItem( XFILL_NONE ) );
+ }
+ pSet->Put( XLineStyleItem( XLINE_NONE ) );
+ Rectangle aRect( rPage.GetLftBorder(), rPage.GetUppBorder(), rPage.GetWdt()-rPage.GetRgtBorder(), rPage.GetHgt()-rPage.GetLwrBorder() );
+ pRet = new SdrRectObj( aRect );
+ pRet->SetModel( pSdrModel );
+
+ pRet->SetMergedItemSet(*pSet);
+
+ pRet->SetMarkProtect( TRUE );
+ pRet->SetMoveProtect( TRUE );
+ pRet->SetResizeProtect( TRUE );
+ }
+ delete pSet;
+ return pRet;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+HeaderFooterEntry::HeaderFooterEntry( const PptSlidePersistEntry* pMPE ) :
+ pMasterPersist ( pMPE ),
+ nAtom ( 0 )
+{
+ if ( pMPE )
+ {
+ HeaderFooterEntry* pMHFE = pMPE->pHeaderFooterEntry;
+ if ( pMHFE )
+ {
+ nAtom = pMPE->pHeaderFooterEntry->nAtom;
+ pPlaceholder[ 0 ] = pMHFE->pPlaceholder[ 0 ];
+ pPlaceholder[ 1 ] = pMHFE->pPlaceholder[ 1 ];
+ pPlaceholder[ 2 ] = pMHFE->pPlaceholder[ 2 ];
+ pPlaceholder[ 3 ] = pMHFE->pPlaceholder[ 3 ];
+ }
+ }
+}
+
+HeaderFooterEntry::~HeaderFooterEntry()
+{
+}
+
+UINT32 HeaderFooterEntry::GetMaskForInstance( UINT32 nInstance )
+{
+ UINT32 nRet = 0;
+ switch ( nInstance )
+ {
+ case 0 : nRet = 0x07ffff; break;
+ case 1 : nRet = 0x100000; break;
+ case 2 : nRet = 0x200000; break;
+ case 3 : nRet = 0x080000; break;
+ }
+ return nRet;
+}
+
+UINT32 HeaderFooterEntry::IsToDisplay( UINT32 nInstance )
+{
+ UINT32 nMask = 0;
+ switch ( nInstance )
+ {
+ case 0 : nMask = 0x010000; break;
+ case 1 : nMask = 0x100000; break;
+ case 2 : nMask = 0x200000; break;
+ case 3 : nMask = 0x080000; break;
+ }
+ return ( nAtom & nMask );
+}
+
+// The following method checks if the slide is using a different colorscheme than
+// its master, if this is the fact, then the HeaderFooter must probably be
+// imported as real sdrobject. In this case, the return value is the offset to the
+// master header footer object, so it can be re-loaded with a different color set
+sal_uInt32 HeaderFooterEntry::NeedToImportInstance( const sal_uInt32 nInstance, const PptSlidePersistEntry& rSlidePersist )
+{
+ sal_uInt32 nRet = 0;
+ if ( pMasterPersist )
+ {
+ if ( !( rSlidePersist.aSlideAtom.nFlags & 2 ) )
+ { // not following the master persist, so we have to check if the colors are changed
+ if ( memcmp( &rSlidePersist.aColorScheme, &pMasterPersist->aColorScheme, 32 ) )
+ {
+ nRet = pMasterPersist->HeaderFooterOfs[ nInstance ];
+ }
+ }
+ }
+ return nRet;
+}
+
+void SdrEscherImport::ImportHeaderFooterContainer( DffRecordHeader& rHd, HeaderFooterEntry& rE )
+{
+ rHd.SeekToContent( rStCtrl );
+ while ( ( rStCtrl.GetError() == 0 ) && ( rStCtrl.Tell() < rHd.GetRecEndFilePos() ) )
+ {
+ DffRecordHeader aHd;
+ rStCtrl >> aHd;
+ switch ( aHd.nRecType )
+ {
+ case PPT_PST_HeadersFootersAtom :
+ rStCtrl >> rE.nAtom;
+ break;
+
+ case PPT_PST_CString :
+ {
+ if ( aHd.nRecInstance < 4 )
+ MSDFFReadZString( rStCtrl, rE.pPlaceholder[ aHd.nRecInstance ], aHd.nRecLen, TRUE );
+ }
+ break;
+ }
+ aHd.SeekToEndOfRecord( rStCtrl );
+ }
+}
+
+//static sal_Unicode PPTExportMapper( sal_Unicode nUni, BOOL& bNeedsStarBats )
+//{
+// bNeedsStarBats = FALSE;
+//
+// sal_Unicode cLo, cReplace;
+// cLo = cReplace = 0;
+// switch ( nUni )
+// {
+// case 132 : cLo = 175; break;
+// case 147 : cLo = 174; break;
+// // Currency
+// case 0x00A2: cReplace = 224; break;
+// case 0x00A4: cReplace = 225; break;
+// case 0x00A5: cReplace = 226; break;
+// case 0x20A1: cReplace = 228; break;
+// case 0x20A2: cReplace = 229; break;
+// case 0x20A3: cReplace = 230; break;
+// case 0x20A4: cReplace = 231; break;
+// case 0x20A7: cReplace = 227; break;
+// case 0x20A8: cReplace = 234; break;
+// case 0x20A9: cReplace = 232; break;
+// case 0x20AB: cReplace = 233; break;
+// case 0x20AC: cReplace = 128; break;
+// // Punctuation and other
+// case 0x201A: cReplace = 130; break; // SINGLE LOW-9 QUOTATION MARK
+// case 0x0192: cReplace = 131; break; // LATIN SMALL LETTER F WITH HOOK
+// case 0x201E: // DOUBLE LOW-9 QUOTATION MARK
+// case 0x301F: // LOW DOUBLE PRIME QUOTATION MARK
+// cReplace = 132; break;
+// case 0x2026: cReplace = 133; break; // HORIZONTAL ELLIPSES
+// case 0x2020: cReplace = 134; break; // DAGGER
+// case 0x2021: cReplace = 135; break; // DOUBLE DAGGER
+// case 0x02C6: cReplace = 136; break; // MODIFIER LETTER CIRCUMFLEX ACCENT
+// case 0x2030: cReplace = 137; break; // PER MILLE SIGN
+// case 0x0160: cReplace = 138; break; // LATIN CAPITAL LETTER S WITH CARON
+// case 0x2039: cReplace = 139; break; // SINGLE LEFT-POINTING ANGLE QUOTATION MARK
+// case 0x0152: cReplace = 140; break; // LATIN CAPITAL LIGATURE OE
+// case 0x017D: cReplace = 142; break; // LATIN CAPITAL LETTER Z WITH CARON
+// case 0x2018: // LEFT SINGLE QUOTATION MARK
+// case 0x02BB: // MODIFIER LETTER TURNED COMMA
+// cReplace = 145; break;
+// case 0x2019: // RIGHT SINGLE QUOTATION MARK
+// case 0x02BC: // MODIFIER LETTER APOSTROPHE
+// cReplace = 146; break;
+// case 0x201C: // LEFT DOUBLE QUOTATION MARK
+// case 0x301D: // REVERSED DOUBLE PRIME QUOTATION MARK
+// cReplace = 147; break;
+// case 0x201D: // RIGHT DOUBLE QUOTATION MARK
+// case 0x301E: // REVERSED DOUBLE PRIME QUOTATION MARK
+// cReplace = 148; break;
+// case 0x2022: cReplace = 149; break; // BULLET
+// case 0x2013: cReplace = 150; break; // EN DASH
+// case 0x2014: cReplace = 151; break; // EM DASH
+// case 0x02DC: cReplace = 152; break; // SMALL TILDE
+// case 0x2122: cReplace = 153; break; // TRADE MARK SIGN
+// case 0x0161: cReplace = 154; break; // LATIN SMALL LETTER S WITH CARON
+// case 0x203A: cReplace = 155; break; // SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
+// case 0x0153: cReplace = 156; break; // LATIN SMALL LIGATURE OE
+// case 0x017E: cReplace = 158; break; // LATIN SMALL LETTER Z WITH CARON
+// case 0x0178: cReplace = 159; break; // LATIN CAPITAL LETTER Y WITH DIAERESIS
+// case 0x00B6: cReplace = 222; break; // PILCROW SIGN / PARAGRAPH SIGN
+// }
+// if ( cReplace )
+// {
+// bNeedsStarBats = TRUE;
+// return cReplace;
+// }
+// else
+// return cLo;
+//}
+
+// no longer needed
+sal_Unicode SdrPowerPointImport::PPTSubstitute( UINT16 /*nFont*/, sal_Unicode /*nChar*/,
+ UINT32& /*nMappedFontId*/, Font& /*rFont*/, char /*nDefault*/) const
+{
+ return 0;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+PPTBuGraEntry::PPTBuGraEntry( Graphic& rGraphic, UINT32 nInst ) :
+ nInstance ( nInst ),
+ aBuGra ( rGraphic ) {}
+
+PPTExtParaLevel::PPTExtParaLevel()
+: mnExtParagraphMask( 0 )
+, mnBuBlip( 0xffff )
+, mnHasAnm( 0 )
+, mnAnmScheme( 0 )
+, mpfPP10Ext( 0 )
+, mnExtCharacterMask( 0 )
+, mcfPP10Ext( 0 )
+, mbSet( sal_False )
+{}
+
+SvStream& operator>>( SvStream& rIn, PPTExtParaLevel& rLevel )
+{
+ rLevel.mbSet = TRUE;
+ rIn >> rLevel.mnExtParagraphMask;
+ if ( rLevel.mnExtParagraphMask & 0x00800000 )
+ rIn >> rLevel.mnBuBlip;
+ if ( rLevel.mnExtParagraphMask & 0x02000000 )
+ rIn >> rLevel.mnHasAnm;
+ if ( rLevel.mnExtParagraphMask & 0x01000000 )
+ rIn >> rLevel.mnAnmScheme;
+ if ( rLevel.mnExtParagraphMask & 0x04000000 )
+ rIn >> rLevel.mpfPP10Ext;
+ rIn >> rLevel.mnExtCharacterMask;
+ if ( rLevel.mnExtCharacterMask & 0x100000 )
+ rIn >> rLevel.mcfPP10Ext;
+ return rIn;
+}
+
+BOOL PPTExtParaProv::GetGraphic( UINT32 nInstance, Graphic& rGraph ) const
+{
+ BOOL bRetValue = FALSE;
+ PPTBuGraEntry* pPtr = NULL;
+ if ( nInstance < aBuGraList.Count() )
+ {
+ pPtr = (PPTBuGraEntry*)aBuGraList.GetObject( nInstance );
+ if ( pPtr->nInstance == nInstance )
+ bRetValue = TRUE;
+ }
+ if ( !bRetValue )
+ {
+ sal_uInt32 i;
+ for ( i = 0; i < aBuGraList.Count(); i++ )
+ {
+ pPtr = (PPTBuGraEntry*)aBuGraList.GetObject( i );
+ if ( pPtr->nInstance == nInstance )
+ {
+ bRetValue = TRUE;
+ break;
+ }
+ }
+ }
+ if ( bRetValue )
+ rGraph = pPtr->aBuGra;
+ return bRetValue;
+}
+
+PPTExtParaProv::PPTExtParaProv( SdrPowerPointImport& rMan, SvStream& rSt, const DffRecordHeader* pHd ) :
+ bStyles ( FALSE ),
+ bGraphics ( FALSE )
+{
+ UINT32 nOldPos = rSt.Tell();
+
+ // here we have to get the graphical bullets...
+
+ DffRecordHeader aHd;
+ DffRecordHeader aContentDataHd;
+
+ const DffRecordHeader* pListHd = rMan.aDocRecManager.GetRecordHeader( PPT_PST_List, SEEK_FROM_BEGINNING );
+ while( pListHd )
+ {
+ pListHd->SeekToContent( rSt );
+ if ( !rMan.SeekToContentOfProgTag( 9, rSt, *pListHd, aContentDataHd ) )
+ break;
+ while ( ( rSt.GetError() == 0 ) && ( rSt.Tell() < aContentDataHd.GetRecEndFilePos() ) )
+ {
+ rSt >> aHd;
+ switch ( aHd.nRecType )
+ {
+ case PPT_PST_ExtendedBuGraContainer :
+ {
+ while ( ( rSt.GetError() == 0 ) && ( rSt.Tell() < aHd.GetRecEndFilePos() ) )
+ {
+ UINT16 nType;
+ DffRecordHeader aBuGraAtomHd;
+ rSt >> aBuGraAtomHd;
+ if ( aBuGraAtomHd.nRecType == PPT_PST_ExtendedBuGraAtom )
+ {
+ rSt >> nType;
+ Graphic aGraphic;
+ if ( rMan.GetBLIPDirect( rSt, aGraphic, NULL ) )
+ {
+ UINT32 nInstance = aBuGraAtomHd.nRecInstance;
+ PPTBuGraEntry* pBuGra = new PPTBuGraEntry( aGraphic, nInstance );
+ UINT32 n = 0;
+ UINT32 nBuGraCount = aBuGraList.Count();
+ if ( nBuGraCount )
+ {
+ if ( ( (PPTBuGraEntry*)aBuGraList.GetObject( nBuGraCount - 1 ) )->nInstance < nInstance )
+ n = nBuGraCount;
+ else
+ { // maybe the instances are not sorted, we sort it
+ for ( n = 0; n < nBuGraCount; n++ )
+ { // sorting fields ( hi >> lo )
+ if ( ( (PPTBuGraEntry*)aBuGraList.GetObject( n ) )->nInstance < nInstance )
+ break;
+ }
+ }
+ }
+ aBuGraList.Insert( pBuGra, (UINT32)n );
+ }
+#ifdef DBG_UTIL
+ else DBG_ERROR( "PPTExParaProv::PPTExParaProv - bullet graphic is not valid (SJ)" );
+#endif
+ }
+#ifdef DBG_UTIL
+ else DBG_ERROR( "PPTExParaProv::PPTExParaProv - unknown atom interpreting the PPT_PST_ExtendedBuGraContainer (SJ)" );
+#endif
+ aBuGraAtomHd.SeekToEndOfRecord( rSt );
+ }
+ if ( aBuGraList.Count() )
+ bGraphics = TRUE;
+ }
+ break;
+
+ case PPT_PST_ExtendedPresRuleContainer :
+ aExtendedPresRules.Consume( rSt, FALSE, aHd.GetRecEndFilePos() );
+ break;
+#ifdef DBG_UTIL
+ default :
+ DBG_ERROR( "PPTExParaProv::PPTExParaProv - unknown atom reading ppt2000 num rules (SJ)" );
+ case PPT_PST_MasterText : // first seen in: ms-tt02.ppt
+ case PPT_PST_SrKinsoku :
+ case PPT_PST_NewlyAddedAtom4016 :
+ case PPT_PST_NewlyAddedAtomByPPT2000_6010 :
+ case PPT_PST_NewlyAddedAtomByPPT2000_6011 :
+ case PPT_PST_NewlyAddedAtomByXP1037 :
+ case PPT_PST_NewlyAddedAtomByXP12004 :
+ case PPT_PST_NewlyAddedAtomByXP14001 :
+ break;
+#endif
+ }
+ aHd.SeekToEndOfRecord( rSt );
+ }
+ break;
+ }
+
+ while( pHd )
+ { // get the extended paragraph styles on mainmaster ( graphical bullets, num ruling ... )
+ if ( !rMan.SeekToContentOfProgTag( 9, rSt, *pHd, aContentDataHd ) )
+ break;
+ while ( ( rSt.GetError() == 0 ) && ( rSt.Tell() < aContentDataHd.GetRecEndFilePos() ) )
+ {
+ rSt >> aHd;
+ switch ( aHd.nRecType )
+ {
+ case PPT_PST_ExtendedParagraphMasterAtom :
+ {
+ if ( aHd.nRecInstance < PPT_STYLESHEETENTRYS )
+ {
+ UINT16 nDepth, i = 0;
+ rSt >> nDepth;
+ if ( i <= 5 )
+ {
+
+ while ( ( rSt.GetError() == 0 ) && ( rSt.Tell() < aHd.GetRecEndFilePos() ) && ( i < nDepth ) )
+ {
+ bStyles = TRUE;
+ rSt >> aExtParaSheet[ aHd.nRecInstance ].aExtParaLevel[ i++ ];
+ }
+#ifdef DBG_UTIL
+ if ( rSt.Tell() != aHd.GetRecEndFilePos() )
+ DBG_ERROR( "PPTExParaProv::PPTExParaProv - error reading PPT_PST_ExtendedParagraphMasterAtom (SJ)" );
+#endif
+ }
+#ifdef DBG_UTIL
+ else DBG_ERROR( "PPTExParaProv::PPTExParaProv - depth is greater than 5 (SJ)" );
+#endif
+ }
+#ifdef DBG_UTIL
+ else DBG_ERROR( "PPTExParaProv::PPTExParaProv - instance out of range (SJ)" );
+#endif
+ }
+ break;
+ default :
+ DBG_ERROR( "PPTExParaProv::PPTExParaProv - unknown atom, assuming PPT_PST_ExtendedParagraphMasterAtom (SJ)" );
+ case PPT_PST_NewlyAddedAtomByXP11008 :
+ case PPT_PST_NewlyAddedAtomByXP11010 :
+ case PPT_PST_NewlyAddedAtomByXP12010 :
+ case PPT_PST_NewlyAddedAtomByXP12011 :
+ case 0xf144 :
+ break;
+ }
+ aHd.SeekToEndOfRecord( rSt );
+ }
+ break;
+ }
+ rSt.Seek( nOldPos );
+}
+
+PPTExtParaProv::~PPTExtParaProv()
+{
+ void* pPtr;
+ for ( pPtr = aBuGraList.First(); pPtr; pPtr = aBuGraList.Next() )
+ delete (PPTBuGraEntry*)pPtr;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+PPTNumberFormatCreator::PPTNumberFormatCreator( PPTExtParaProv* pParaProv ) :
+ pExtParaProv ( pParaProv )
+{
+}
+
+PPTNumberFormatCreator::~PPTNumberFormatCreator()
+{
+ delete pExtParaProv;
+}
+
+BOOL PPTNumberFormatCreator::ImplGetExtNumberFormat( SdrPowerPointImport& rManager,
+ SvxNumberFormat& rNumberFormat, UINT32 nLevel, UINT32 nInstance, UINT32 nDestinationInstance,
+ boost::optional< sal_Int16 >& rStartNumbering, UINT32 nFontHeight, PPTParagraphObj* pPara )
+{
+ BOOL bHardAttribute = ( nDestinationInstance == 0xffffffff );
+
+ UINT32 nBuFlags = 0;
+ UINT16 nHasAnm = 0;
+ UINT32 nAnmScheme = 0x10003;
+ UINT16 nBuBlip = 0xffff;
+
+ const PPTExtParaProv* pParaProv = pExtParaProv;
+ if ( !pExtParaProv )
+ pParaProv = ( pPara ) ? pPara->mrStyleSheet.pExtParaProv
+ : rManager.pPPTStyleSheet->pExtParaProv;
+ if ( pPara )
+ {
+ nBuFlags = pPara->pParaSet->mnExtParagraphMask;
+ if ( nBuFlags )
+ {
+ if ( nBuFlags & 0x00800000 )
+ nBuBlip = pPara->pParaSet->mnBuBlip;
+ if ( nBuFlags & 0x01000000 )
+ nAnmScheme = pPara->pParaSet->mnAnmScheme;
+ if ( nBuFlags & 0x02000000 )
+ nHasAnm = pPara->pParaSet->mnHasAnm;
+ bHardAttribute = TRUE;
+ }
+ }
+
+ if ( ( nBuFlags & 0x03800000 ) != 0x03800000 ) // merge style sheet
+ { // we have to read the master attributes
+ if ( pParaProv && ( nLevel < 5 ) )
+ {
+ if ( pParaProv->bStyles )
+ {
+ const PPTExtParaLevel& rLev = pParaProv->aExtParaSheet[ nInstance ].aExtParaLevel[ nLevel ];
+ if ( rLev.mbSet )
+ {
+ UINT32 nMaBuFlags = rLev.mnExtParagraphMask;
+
+ if ( (!( nBuFlags & 0x00800000)) && ( nMaBuFlags & 0x00800000 ) )
+ {
+ if (!( nBuFlags & 0x02000000)) // if there is a BuStart without BuInstance,
+ nBuBlip = rLev.mnBuBlip; // then there is no graphical Bullet possible
+ }
+ if ( (!( nBuFlags & 0x01000000)) && ( nMaBuFlags & 0x01000000 ) )
+ nAnmScheme = rLev.mnAnmScheme;
+ if ( (!( nBuFlags & 0x02000000)) && ( nMaBuFlags & 0x02000000 ) )
+ nHasAnm = rLev.mnHasAnm;
+ nBuFlags |= nMaBuFlags;
+ }
+ }
+ }
+ }
+ if ( nBuBlip != 0xffff ) // set graphical bullet
+ {
+ Graphic aGraphic;
+ if ( pParaProv->GetGraphic( nBuBlip, aGraphic ) )
+ {
+ SvxBrushItem aBrush( aGraphic, GPOS_MM, SID_ATTR_BRUSH );
+ rNumberFormat.SetGraphicBrush( &aBrush );
+ sal_uInt32 nHeight = (sal_uInt32)( (double)nFontHeight * 0.2540 * nBulletHeight + 0.5 );
+ Size aPrefSize( aGraphic.GetPrefSize() );
+ UINT32 nWidth = ( nHeight * aPrefSize.Width() ) / aPrefSize.Height();
+ rNumberFormat.SetGraphicSize( Size( nWidth, nHeight ) );
+ rNumberFormat.SetNumberingType ( SVX_NUM_BITMAP );
+ }
+ }
+ else if ( nHasAnm )
+ {
+ switch( static_cast< sal_uInt16 >( nAnmScheme ) )
+ {
+ default :
+ case 0 :
+ {
+ rNumberFormat.SetNumberingType( SVX_NUM_CHARS_LOWER_LETTER );
+ rNumberFormat.SetSuffix( String( RTL_CONSTASCII_USTRINGPARAM( "." ) ) );
+ }
+ break;
+ case 1 :
+ {
+ rNumberFormat.SetNumberingType( SVX_NUM_CHARS_UPPER_LETTER );
+ rNumberFormat.SetSuffix( String( RTL_CONSTASCII_USTRINGPARAM( "." ) ) );
+ }
+ break;
+ case 2 :
+ {
+ rNumberFormat.SetNumberingType( SVX_NUM_ARABIC );
+ rNumberFormat.SetSuffix( String( RTL_CONSTASCII_USTRINGPARAM( ")" ) ) );
+ }
+ break;
+ case 3 :
+ {
+ rNumberFormat.SetNumberingType( SVX_NUM_ARABIC );
+ rNumberFormat.SetSuffix( String( RTL_CONSTASCII_USTRINGPARAM( "." ) ) );
+ }
+ break;
+ case 4 :
+ {
+ rNumberFormat.SetNumberingType( SVX_NUM_ROMAN_LOWER );
+ rNumberFormat.SetSuffix( String( RTL_CONSTASCII_USTRINGPARAM( ")" ) ) );
+ rNumberFormat.SetPrefix( String( RTL_CONSTASCII_USTRINGPARAM( "(" ) ) );
+ }
+ break;
+ case 5 :
+ {
+ rNumberFormat.SetNumberingType( SVX_NUM_ROMAN_LOWER );
+ rNumberFormat.SetSuffix( String( RTL_CONSTASCII_USTRINGPARAM( ")" ) ) );
+ }
+ break;
+ case 6 :
+ {
+ rNumberFormat.SetNumberingType( SVX_NUM_ROMAN_LOWER );
+ rNumberFormat.SetSuffix( String( RTL_CONSTASCII_USTRINGPARAM( "." ) ) );
+ }
+ break;
+ case 7 :
+ {
+ rNumberFormat.SetNumberingType( SVX_NUM_ROMAN_UPPER );
+ rNumberFormat.SetSuffix( String( RTL_CONSTASCII_USTRINGPARAM( "." ) ) );
+ }
+ break;
+ case 8 :
+ {
+ rNumberFormat.SetNumberingType( SVX_NUM_CHARS_LOWER_LETTER );
+ rNumberFormat.SetSuffix( String( RTL_CONSTASCII_USTRINGPARAM( ")" ) ) );
+ rNumberFormat.SetPrefix( String( RTL_CONSTASCII_USTRINGPARAM( "(" ) ) );
+ }
+ break;
+ case 9 :
+ {
+ rNumberFormat.SetNumberingType( SVX_NUM_CHARS_LOWER_LETTER );
+ rNumberFormat.SetSuffix( String( RTL_CONSTASCII_USTRINGPARAM( ")" ) ) );
+ }
+ break;
+ case 10 :
+ {
+ rNumberFormat.SetNumberingType( SVX_NUM_CHARS_UPPER_LETTER );
+ rNumberFormat.SetSuffix( String( RTL_CONSTASCII_USTRINGPARAM( ")" ) ) );
+ rNumberFormat.SetPrefix( String( RTL_CONSTASCII_USTRINGPARAM( "(" ) ) );
+ }
+ break;
+ case 11 :
+ {
+ rNumberFormat.SetNumberingType( SVX_NUM_CHARS_UPPER_LETTER );
+ rNumberFormat.SetSuffix( String( RTL_CONSTASCII_USTRINGPARAM( ")" ) ) );
+ }
+ break;
+ case 12 :
+ {
+ rNumberFormat.SetNumberingType( SVX_NUM_ARABIC );
+ rNumberFormat.SetSuffix( String( RTL_CONSTASCII_USTRINGPARAM( ")" ) ) );
+ rNumberFormat.SetPrefix( String( RTL_CONSTASCII_USTRINGPARAM( "(" ) ) );
+ }
+ break;
+ case 13 :
+ {
+ rNumberFormat.SetNumberingType( SVX_NUM_ARABIC );
+ }
+ break;
+ case 14 :
+ {
+ rNumberFormat.SetNumberingType( SVX_NUM_ROMAN_UPPER );
+ rNumberFormat.SetSuffix( String( RTL_CONSTASCII_USTRINGPARAM( ")" ) ) );
+ rNumberFormat.SetPrefix( String( RTL_CONSTASCII_USTRINGPARAM( "(" ) ) );
+ }
+ break;
+ case 15 :
+ {
+ rNumberFormat.SetNumberingType( SVX_NUM_ROMAN_UPPER );
+ rNumberFormat.SetSuffix( String( RTL_CONSTASCII_USTRINGPARAM( ")" ) ) );
+ }
+ break;
+ }
+ rStartNumbering = boost::optional< sal_Int16 >( nAnmScheme >> 16 );
+ }
+ return bHardAttribute;
+}
+
+void PPTNumberFormatCreator::GetNumberFormat( SdrPowerPointImport& rManager, SvxNumberFormat& rNumberFormat, UINT32 nLevel, const PPTParaLevel& rParaLevel, const PPTCharLevel& rCharLevel, UINT32 nInstance )
+{
+ nIsBullet = ( rParaLevel.mnBuFlags & ( 1 << PPT_ParaAttr_BulletOn ) ) != 0 ? 1 : 0;
+ nBulletChar = rParaLevel.mnBulletChar;
+
+ sal_Bool bBuHardFont;
+ bBuHardFont = ( rParaLevel.mnBuFlags & ( 1 << PPT_ParaAttr_BuHardFont ) ) != 0;
+ if ( bBuHardFont )
+ nBulletFont = rParaLevel.mnBulletFont;
+ else
+ nBulletFont = rCharLevel.mnFont;
+ nBulletHeight = rParaLevel.mnBulletHeight;
+ nBulletColor = rParaLevel.mnBulletColor;
+ nTextOfs = rParaLevel.mnTextOfs;
+ nBulletOfs = rParaLevel.mnBulletOfs;
+
+ boost::optional< sal_Int16 > oStartNumbering;
+ ImplGetExtNumberFormat( rManager, rNumberFormat, nLevel, nInstance, 0xffffffff, oStartNumbering, rCharLevel.mnFontHeight, NULL );
+ if ( ( rNumberFormat.GetNumberingType() != SVX_NUM_BITMAP ) && ( nBulletHeight > 0x7fff ) )
+ nBulletHeight = rCharLevel.mnFontHeight ? ((-((sal_Int16)nBulletHeight)) * 100 ) / rCharLevel.mnFontHeight : 100;
+ ImplGetNumberFormat( rManager, rNumberFormat, nLevel );
+ switch ( rNumberFormat.GetNumberingType() )
+ {
+ case SVX_NUM_CHARS_UPPER_LETTER :
+ case SVX_NUM_CHARS_LOWER_LETTER :
+ case SVX_NUM_ROMAN_UPPER :
+ case SVX_NUM_ROMAN_LOWER :
+ case SVX_NUM_ARABIC :
+ case SVX_NUM_CHARS_UPPER_LETTER_N :
+ case SVX_NUM_CHARS_LOWER_LETTER_N :
+ {
+ sal_uInt32 nFont = rCharLevel.mnFont;
+ PptFontEntityAtom* pFontEnityAtom = rManager.GetFontEnityAtom( nFont );
+ if ( pFontEnityAtom )
+ {
+ Font aFont;
+ aFont.SetCharSet( pFontEnityAtom->eCharSet );
+ aFont.SetName( pFontEnityAtom->aName );
+ aFont.SetFamily( pFontEnityAtom->eFamily );
+ aFont.SetPitch( pFontEnityAtom->ePitch );
+ rNumberFormat.SetBulletFont( &aFont );
+ }
+ }
+ break;
+ }
+}
+
+BOOL PPTNumberFormatCreator::GetNumberFormat( SdrPowerPointImport& rManager, SvxNumberFormat& rNumberFormat, PPTParagraphObj* pParaObj,
+ UINT32 nDestinationInstance, boost::optional< sal_Int16 >& rStartNumbering )
+{
+ UINT32 nHardCount = 0;
+ nHardCount += pParaObj->GetAttrib( PPT_ParaAttr_BulletOn, nIsBullet, nDestinationInstance );
+ nHardCount += pParaObj->GetAttrib( PPT_ParaAttr_BulletChar, nBulletChar, nDestinationInstance );
+ nHardCount += pParaObj->GetAttrib( PPT_ParaAttr_BulletFont, nBulletFont, nDestinationInstance );
+ nHardCount += pParaObj->GetAttrib( PPT_ParaAttr_BulletHeight, nBulletHeight, nDestinationInstance );
+ nHardCount += pParaObj->GetAttrib( PPT_ParaAttr_BulletColor, nBulletColor, nDestinationInstance );
+ nHardCount += pParaObj->GetAttrib( PPT_ParaAttr_TextOfs, nTextOfs, nDestinationInstance );
+ nHardCount += pParaObj->GetAttrib( PPT_ParaAttr_BulletOfs, nBulletOfs, nDestinationInstance );
+
+ if ( nIsBullet )
+ rNumberFormat.SetNumberingType( SVX_NUM_CHAR_SPECIAL );
+
+ UINT32 nFontHeight = 24;
+ PPTPortionObj* pPtr = pParaObj->First();
+ if ( pPtr )
+ pPtr->GetAttrib( PPT_CharAttr_FontHeight, nFontHeight, nDestinationInstance );
+ if ( nIsBullet )
+ nHardCount += ImplGetExtNumberFormat( rManager, rNumberFormat, pParaObj->pParaSet->mnDepth,
+ pParaObj->mnInstance, nDestinationInstance, rStartNumbering, nFontHeight, pParaObj );
+
+ if ( rNumberFormat.GetNumberingType() != SVX_NUM_BITMAP )
+ pParaObj->UpdateBulletRelSize( nBulletHeight );
+ if ( nHardCount )
+ ImplGetNumberFormat( rManager, rNumberFormat, pParaObj->pParaSet->mnDepth );
+
+ if ( nHardCount )
+ {
+ switch ( rNumberFormat.GetNumberingType() )
+ {
+ case SVX_NUM_CHARS_UPPER_LETTER :
+ case SVX_NUM_CHARS_LOWER_LETTER :
+ case SVX_NUM_ROMAN_UPPER :
+ case SVX_NUM_ROMAN_LOWER :
+ case SVX_NUM_ARABIC :
+ case SVX_NUM_CHARS_UPPER_LETTER_N :
+ case SVX_NUM_CHARS_LOWER_LETTER_N :
+ {
+ if ( pPtr )
+ {
+ sal_uInt32 nFont;
+ pPtr->GetAttrib( PPT_CharAttr_Font, nFont, nDestinationInstance );
+ PptFontEntityAtom* pFontEnityAtom = rManager.GetFontEnityAtom( nFont );
+ if ( pFontEnityAtom )
+ {
+ Font aFont;
+ aFont.SetCharSet( pFontEnityAtom->eCharSet );
+ aFont.SetName( pFontEnityAtom->aName );
+ aFont.SetFamily( pFontEnityAtom->eFamily );
+ aFont.SetPitch( pFontEnityAtom->ePitch );
+ rNumberFormat.SetBulletFont( &aFont );
+ }
+ }
+ }
+ break;
+ }
+ }
+ return ( nHardCount ) ? TRUE : FALSE;
+}
+
+void PPTNumberFormatCreator::ImplGetNumberFormat( SdrPowerPointImport& rManager, SvxNumberFormat& rNumberFormat, UINT32 /*nLevel*/)
+{
+ Font aFont;
+ PptFontEntityAtom* pAtom = rManager.GetFontEnityAtom( nBulletFont );
+ if ( pAtom )
+ {
+ CharSet eCharSet( pAtom->eCharSet );
+ aFont.SetName( pAtom->aName );
+ aFont.SetCharSet( eCharSet );
+ aFont.SetFamily( pAtom->eFamily );
+ aFont.SetPitch( pAtom->ePitch );
+ }
+ Color aCol( rManager.MSO_TEXT_CLR_ToColor( nBulletColor ) );
+ aFont.SetColor( aCol );
+
+ sal_uInt16 nBuChar = (sal_uInt16)nBulletChar;
+ if ( aFont.GetCharSet() == RTL_TEXTENCODING_SYMBOL )
+ {
+ nBuChar &= 0x00ff;
+ nBuChar |= 0xf000;
+ }
+ rNumberFormat.SetBulletFont( &aFont );
+ rNumberFormat.SetBulletChar( nBuChar );
+ rNumberFormat.SetBulletRelSize( (UINT16)nBulletHeight );
+ rNumberFormat.SetBulletColor( aCol );
+ UINT16 nAbsLSpace = (UINT16)( ( (UINT32)nTextOfs * 2540 ) / 576 );
+ UINT16 nFirstLineOffset = nAbsLSpace - (UINT16)( ( (UINT32)nBulletOfs * 2540 ) / 576 );
+ rNumberFormat.SetAbsLSpace( nAbsLSpace );
+ rNumberFormat.SetFirstLineOffset( -nFirstLineOffset );
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+PPTCharSheet::PPTCharSheet( UINT32 nInstance )
+{
+ UINT32 nColor = PPT_COLSCHEME_TEXT_UND_ZEILEN;
+ UINT16 nFontHeight(0);
+ switch ( nInstance )
+ {
+ case TSS_TYPE_PAGETITLE :
+ case TSS_TYPE_TITLE :
+ {
+ nColor = PPT_COLSCHEME_TITELTEXT;
+ nFontHeight = 44;
+ }
+ break;
+ case TSS_TYPE_BODY :
+ case TSS_TYPE_SUBTITLE :
+ case TSS_TYPE_HALFBODY :
+ case TSS_TYPE_QUARTERBODY :
+ nFontHeight = 32;
+ break;
+ case TSS_TYPE_NOTES :
+ nFontHeight = 12;
+ break;
+ case TSS_TYPE_UNUSED :
+ case TSS_TYPE_TEXT_IN_SHAPE :
+ nFontHeight = 24;
+ break;
+ }
+ for ( UINT32 nDepth = 0; nDepth < 5; nDepth++ )
+ {
+ maCharLevel[ nDepth ].mnFlags = 0;
+ maCharLevel[ nDepth ].mnFont = 0;
+ maCharLevel[ nDepth ].mnAsianOrComplexFont = 0xffff;
+ maCharLevel[ nDepth ].mnFontHeight = nFontHeight;
+ maCharLevel[ nDepth ].mnFontColor = nColor;
+ maCharLevel[ nDepth ].mnFontColorInStyleSheet = Color( (BYTE)nColor, (BYTE)( nColor >> 8 ), (BYTE)( nColor >> 16 ) );
+ maCharLevel[ nDepth ].mnEscapement = 0;
+ }
+}
+
+PPTCharSheet::PPTCharSheet( const PPTCharSheet& rAttr )
+{
+ *this = rAttr;
+}
+
+void PPTCharSheet::Read( SvStream& rIn, sal_Bool /*bMasterStyle*/, sal_uInt32 nLevel, sal_Bool /*bFirst*/)
+{
+ // Zeichenattribute
+ sal_uInt32 nCMask;
+ sal_uInt16 nVal16;
+ rIn >> nCMask;
+
+ if ( nCMask & 0x0000FFFF )
+ {
+ sal_uInt16 nBitAttr;
+ maCharLevel[ nLevel ].mnFlags &= ~( (sal_uInt16)nCMask );
+ rIn >> nBitAttr; // Bit-Attribute (Fett, Unterstrichen, ...)
+ maCharLevel[ nLevel ].mnFlags |= nBitAttr;
+ }
+ if ( nCMask & ( 1 << PPT_CharAttr_Font ) ) // 0x00010000
+ rIn >> maCharLevel[ nLevel ].mnFont;
+ if ( nCMask & ( 1 << PPT_CharAttr_AsianOrComplexFont ) ) // 0x00200000
+ rIn >> maCharLevel[ nLevel ].mnAsianOrComplexFont;
+ if ( nCMask & ( 1 << PPT_CharAttr_ANSITypeface ) ) // 0x00400000
+ rIn >> nVal16;
+ if ( nCMask & ( 1 << PPT_CharAttr_Symbol ) ) // 0x00800000
+ rIn >> nVal16;
+ if ( nCMask & ( 1 << PPT_CharAttr_FontHeight ) ) // 0x00020000
+ rIn >> maCharLevel[ nLevel ].mnFontHeight;
+ if ( nCMask & ( 1 << PPT_CharAttr_FontColor ) ) // 0x00040000
+ {
+ rIn >> maCharLevel[ nLevel ].mnFontColor;
+ if( ! (maCharLevel[ nLevel ].mnFontColor & 0xff000000 ) )
+ maCharLevel[ nLevel ].mnFontColor = PPT_COLSCHEME_HINTERGRUND;
+ }
+ if ( nCMask & ( 1 << PPT_CharAttr_Escapement ) ) // 0x00080000
+ rIn >> maCharLevel[ nLevel ].mnEscapement;
+ if ( nCMask & 0x00100000 ) // 0x00100000
+ rIn >> nVal16;
+
+ nCMask >>= 24;
+ while( nCMask )
+ {
+ if ( nCMask & 1 )
+ {
+ DBG_ERROR( "PPTCharSheet::Read - unknown attribute, send me this document (SJ)" );
+ rIn >> nVal16;
+ }
+ nCMask >>= 1;
+ }
+}
+
+PPTParaSheet::PPTParaSheet( UINT32 nInstance )
+{
+ sal_uInt16 nBuFlags = 0;
+ sal_uInt32 nBulletColor = 0x8000000;
+ sal_uInt16 nUpperDist = 0;
+
+ switch ( nInstance )
+ {
+ case TSS_TYPE_PAGETITLE :
+ case TSS_TYPE_TITLE :
+ nBulletColor = PPT_COLSCHEME_TITELTEXT;
+ break;
+ case TSS_TYPE_BODY :
+ case TSS_TYPE_SUBTITLE :
+ case TSS_TYPE_HALFBODY :
+ case TSS_TYPE_QUARTERBODY :
+ {
+ nBuFlags = 1;
+ nUpperDist = 0x14;
+ }
+ break;
+ case TSS_TYPE_NOTES :
+ nUpperDist = 0x1e;
+ break;
+/*
+ default :
+ case TSS_TYPE_UNUSED :
+ case TSS_TYPE_TEXT_IN_SHAPE :
+ break;
+*/
+ }
+ for ( UINT32 i = 0; i < 5; i++ )
+ {
+ maParaLevel[ i ].mnBuFlags = nBuFlags;
+ maParaLevel[ i ].mnBulletChar = 0x2022;
+ maParaLevel[ i ].mnBulletFont = 0;
+ maParaLevel[ i ].mnBulletHeight = 100;
+ maParaLevel[ i ].mnBulletColor = nBulletColor;
+ maParaLevel[ i ].mnAdjust = 0;
+ maParaLevel[ i ].mnLineFeed = 100;
+ maParaLevel[ i ].mnLowerDist = 0;
+ maParaLevel[ i ].mnUpperDist = nUpperDist;
+ maParaLevel[ i ].mnTextOfs = 0;
+ maParaLevel[ i ].mnBulletOfs = 0;
+ maParaLevel[ i ].mnDefaultTab = 0x240;
+ maParaLevel[ i ].mnAsianLineBreak = 0;
+ maParaLevel[ i ].mnBiDi = 0;
+ }
+}
+
+PPTParaSheet::PPTParaSheet( const PPTParaSheet& rSheet )
+{
+ *this = rSheet;
+}
+
+void PPTParaSheet::Read( SdrPowerPointImport&
+#ifdef DBG_UTIL
+ rManager
+#endif
+ , SvStream& rIn, sal_Bool /*bMasterStyle*/,
+ sal_uInt32 nLevel, sal_Bool bFirst )
+{
+ // Absatzattribute
+ sal_uInt16 nVal16, i, nMask16;
+ sal_uInt32 nVal32, nPMask;
+ rIn >> nPMask;
+
+ nMask16 = (sal_uInt16)nPMask & 0xf;
+ if ( nMask16 )
+ {
+ rIn >> nVal16;
+ maParaLevel[ nLevel ].mnBuFlags &=~ nMask16;
+ nVal16 &= nMask16;
+ maParaLevel[ nLevel ].mnBuFlags |= nVal16;
+ }
+ if ( nPMask & 0x0080 )
+ rIn >> maParaLevel[ nLevel ].mnBulletChar;
+ if ( nPMask & 0x0010 )
+ rIn >> maParaLevel[ nLevel ].mnBulletFont;
+ if ( nPMask & 0x0040 )
+ {
+ rIn >> nVal16;
+ maParaLevel[ nLevel ].mnBulletHeight = nVal16;
+ }
+ if ( nPMask & 0x0020 )
+ {
+ rIn >> nVal32;
+ maParaLevel[ nLevel ].mnBulletColor = nVal32;
+ }
+ if ( bFirst )
+ {
+ if ( nPMask & 0xF00 )
+ { // AbsJust!
+ rIn >> nVal16;
+ maParaLevel[ nLevel ].mnAdjust = nVal16 & 3;
+ }
+ if ( nPMask & 0x1000 )
+ rIn >> maParaLevel[ nLevel ].mnLineFeed;
+ if ( nPMask & 0x2000 )
+ rIn >> maParaLevel[ nLevel ].mnUpperDist;
+ if ( nPMask & 0x4000 )
+ rIn >> maParaLevel[ nLevel ].mnLowerDist;
+ if ( nPMask & 0x8000 )
+ rIn >> maParaLevel[ nLevel ].mnTextOfs;
+ if ( nPMask & 0x10000 )
+ rIn >> maParaLevel[ nLevel ].mnBulletOfs;
+ if ( nPMask & 0x20000 )
+ rIn >> maParaLevel[ nLevel ].mnDefaultTab;
+ if ( nPMask & 0x200000 )
+ {
+ // number of tabulators
+ rIn >> nVal16;
+ for ( i = 0; i < nVal16; i++ )
+ rIn >> nVal32; // reading the tabulators
+ }
+ if ( nPMask & 0x40000 )
+ rIn >> nVal16;
+ if ( nPMask & 0x80000 )
+ rIn >> maParaLevel[ nLevel ].mnAsianLineBreak;
+ if ( nPMask & 0x100000 )
+ rIn >> maParaLevel[ nLevel ].mnBiDi;
+ }
+ else
+ {
+ if ( nPMask & 0x800 )
+ {
+ rIn >> nVal16;
+ maParaLevel[ nLevel ].mnAdjust = nVal16 & 3;
+ }
+ if ( nPMask & 0x1000 )
+ rIn >> maParaLevel[ nLevel ].mnLineFeed;
+ if ( nPMask & 0x2000 )
+ rIn >> maParaLevel[ nLevel ].mnUpperDist;
+ if ( nPMask & 0x4000 )
+ rIn >> maParaLevel[ nLevel ].mnLowerDist;
+ if ( nPMask & 0x8000 )
+ rIn >> nVal16;
+ if ( nPMask & 0x100 )
+ rIn >> maParaLevel[ nLevel ].mnTextOfs;
+ if ( nPMask & 0x200 )
+ rIn >> nVal16;
+ if ( nPMask & 0x400 )
+ rIn >> maParaLevel[ nLevel ].mnBulletOfs;
+ if ( nPMask & 0x10000 )
+ rIn >> nVal16;
+ if ( nPMask & 0xe0000 )
+ {
+ sal_uInt16 nFlagsToModifyMask = (sal_uInt16)( ( nPMask >> 17 ) & 7 );
+ rIn >> nVal16;
+ // bits that are not involved to zero
+ nVal16 &= nFlagsToModifyMask;
+ // bits that are to change to zero
+ maParaLevel[ nLevel ].mnAsianLineBreak &=~nFlagsToModifyMask;
+ // now set the corresponding bits
+ maParaLevel[ nLevel ].mnAsianLineBreak |= nVal16;
+ }
+ if ( nPMask & 0x100000 )
+ {
+ // number of tabulators
+ rIn >> nVal16;
+ for ( i = 0; i < nVal16; i++ )
+ rIn >> nVal32; // reading the tabulators
+ }
+ if ( nPMask & 0x200000 )
+ rIn >> maParaLevel[ nLevel ].mnBiDi; // #88602#
+ }
+
+ nPMask >>= 22;
+ while( nPMask )
+ {
+ if ( nPMask & 1 )
+ {
+#ifdef DBG_UTIL
+ if (!(rManager.rImportParam.nImportFlags & PPT_IMPORTFLAGS_NO_TEXT_ASSERT))
+ {
+ DBG_ERROR( "PPTParaSheet::Read - unknown attribute, send me this document (SJ)" );
+ }
+#endif
+ rIn >> nVal16;
+ }
+ nPMask >>= 1;
+ }
+}
+
+PPTStyleSheet::PPTStyleSheet( const DffRecordHeader& rSlideHd, SvStream& rIn, SdrPowerPointImport& rManager,
+ const PPTTextCharacterStyleAtomInterpreter& /*rTxCFStyle*/, const PPTTextParagraphStyleAtomInterpreter& rTxPFStyle,
+ const PPTTextSpecInfo& rTextSpecInfo ) :
+
+ PPTNumberFormatCreator ( new PPTExtParaProv( rManager, rIn, &rSlideHd ) ),
+ maTxSI ( rTextSpecInfo )
+{
+ UINT32 i;
+ UINT32 nOldFilePos = rIn.Tell();
+
+ // default stylesheets
+ mpCharSheet[ TSS_TYPE_PAGETITLE ] = new PPTCharSheet( TSS_TYPE_PAGETITLE );
+ mpCharSheet[ TSS_TYPE_BODY ] = new PPTCharSheet( TSS_TYPE_BODY );
+ mpCharSheet[ TSS_TYPE_NOTES ] = new PPTCharSheet( TSS_TYPE_NOTES );
+ mpCharSheet[ TSS_TYPE_UNUSED ] = new PPTCharSheet( TSS_TYPE_UNUSED ); // this entry is not used by ppt
+ mpCharSheet[ TSS_TYPE_TEXT_IN_SHAPE ] = new PPTCharSheet( TSS_TYPE_TEXT_IN_SHAPE );
+ mpParaSheet[ TSS_TYPE_PAGETITLE ] = new PPTParaSheet( TSS_TYPE_PAGETITLE );
+ mpParaSheet[ TSS_TYPE_BODY ] = new PPTParaSheet( TSS_TYPE_BODY );
+ mpParaSheet[ TSS_TYPE_NOTES ] = new PPTParaSheet( TSS_TYPE_NOTES );
+ mpParaSheet[ TSS_TYPE_UNUSED ] = new PPTParaSheet( TSS_TYPE_UNUSED );
+ mpParaSheet[ TSS_TYPE_TEXT_IN_SHAPE ] = new PPTParaSheet( TSS_TYPE_TEXT_IN_SHAPE );
+ mpCharSheet[ TSS_TYPE_QUARTERBODY ] = mpCharSheet[ TSS_TYPE_HALFBODY ] = mpCharSheet[ TSS_TYPE_TITLE ] = mpCharSheet[ TSS_TYPE_SUBTITLE ] = NULL;
+ mpParaSheet[ TSS_TYPE_QUARTERBODY ] = mpParaSheet[ TSS_TYPE_HALFBODY ] = mpParaSheet[ TSS_TYPE_TITLE ] = mpParaSheet[ TSS_TYPE_SUBTITLE ] = NULL;
+
+ /* SJ: try to locate the txMasterStyleAtom in the Environment
+
+ it seems that the environment TextStyle is having a higher priority
+ than the TextStyle that can be found within the master page
+ */
+ sal_Bool bFoundTxMasterStyleAtom04 = sal_False;
+ DffRecordHeader* pEnvHeader = rManager.aDocRecManager.GetRecordHeader( PPT_PST_Environment );
+ if ( pEnvHeader )
+ {
+ pEnvHeader->SeekToContent( rIn );
+ DffRecordHeader aTxMasterStyleHd;
+ while ( rIn.Tell() < pEnvHeader->GetRecEndFilePos() )
+ {
+ rIn >> aTxMasterStyleHd;
+ if ( aTxMasterStyleHd.nRecType == PPT_PST_TxMasterStyleAtom )
+ {
+ sal_uInt16 nLevelAnz;
+ rIn >> nLevelAnz;
+
+ sal_uInt16 nLev = 0;
+ sal_Bool bFirst = sal_True;
+ bFoundTxMasterStyleAtom04 = sal_True;
+ while ( rIn.GetError() == 0 && rIn.Tell() < aTxMasterStyleHd.GetRecEndFilePos() && nLev < nLevelAnz )
+ {
+ if ( nLev )
+ {
+ mpParaSheet[ TSS_TYPE_TEXT_IN_SHAPE ]->maParaLevel[ nLev ] = mpParaSheet[ TSS_TYPE_TEXT_IN_SHAPE ]->maParaLevel[ nLev - 1 ];
+ mpCharSheet[ TSS_TYPE_TEXT_IN_SHAPE ]->maCharLevel[ nLev ] = mpCharSheet[ TSS_TYPE_TEXT_IN_SHAPE ]->maCharLevel[ nLev - 1 ];
+ }
+ mpParaSheet[ TSS_TYPE_TEXT_IN_SHAPE ]->Read( rManager, rIn, sal_True, nLev, bFirst );
+ if ( !nLev )
+ {
+ // set paragraph defaults for instance 4 (TSS_TYPE_TEXT_IN_SHAPE)
+ if ( rTxPFStyle.bValid )
+ {
+ PPTParaLevel& rParaLevel = mpParaSheet[ TSS_TYPE_TEXT_IN_SHAPE ]->maParaLevel[ 0 ];
+ rParaLevel.mnAsianLineBreak = 0;
+ if ( rTxPFStyle.bForbiddenRules )
+ rParaLevel.mnAsianLineBreak |= 1;
+ if ( !rTxPFStyle.bLatinTextWrap )
+ rParaLevel.mnAsianLineBreak |= 2;
+ if ( rTxPFStyle.bHangingPunctuation )
+ rParaLevel.mnAsianLineBreak |= 4;
+ }
+ }
+ mpCharSheet[ TSS_TYPE_TEXT_IN_SHAPE ]->Read( rIn, sal_True, nLev, bFirst );
+ bFirst = sal_False;
+ nLev++;
+ }
+ break;
+ }
+ else
+ aTxMasterStyleHd.SeekToEndOfRecord( rIn );
+ }
+ }
+
+ rSlideHd.SeekToContent( rIn );
+ DffRecordHeader aTxMasterStyleHd;
+ while ( rIn.Tell() < rSlideHd.GetRecEndFilePos() )
+ {
+ rIn >> aTxMasterStyleHd;
+ if ( aTxMasterStyleHd.nRecType == PPT_PST_TxMasterStyleAtom )
+ break;
+ else
+ aTxMasterStyleHd.SeekToEndOfRecord( rIn );
+ }
+ while ( ( aTxMasterStyleHd.nRecType == PPT_PST_TxMasterStyleAtom ) && ( rIn.Tell() < rSlideHd.GetRecEndFilePos() ) ) //TODO: aTxMasterStyleHd may be used without having been properly initialized
+ {
+ sal_uInt32 nInstance = aTxMasterStyleHd.nRecInstance;
+ if ( ( nInstance < PPT_STYLESHEETENTRYS ) &&
+ ( ( nInstance != TSS_TYPE_TEXT_IN_SHAPE ) || ( bFoundTxMasterStyleAtom04 == sal_False ) ) )
+ {
+ if ( nInstance > 4 )
+ {
+ delete mpCharSheet[ nInstance ]; // be sure to delete the old one if this instance comes twice
+ delete mpParaSheet[ nInstance ];
+
+ switch ( nInstance )
+ {
+ case TSS_TYPE_SUBTITLE :
+ {
+ mpCharSheet[ TSS_TYPE_SUBTITLE ] = new PPTCharSheet( *( mpCharSheet[ TSS_TYPE_BODY ] ) );
+ mpParaSheet[ TSS_TYPE_SUBTITLE ] = new PPTParaSheet( *( mpParaSheet[ TSS_TYPE_BODY ] ) );
+ }
+ break;
+ case TSS_TYPE_TITLE :
+ {
+ mpCharSheet[ TSS_TYPE_TITLE ] = new PPTCharSheet( *( mpCharSheet[ TSS_TYPE_PAGETITLE ] ) );
+ mpParaSheet[ TSS_TYPE_TITLE ] = new PPTParaSheet( *( mpParaSheet[ TSS_TYPE_PAGETITLE ] ) );
+ }
+ break;
+ case TSS_TYPE_HALFBODY :
+ {
+ mpCharSheet[ TSS_TYPE_HALFBODY ] = new PPTCharSheet( *( mpCharSheet[ TSS_TYPE_BODY ] ) );
+ mpParaSheet[ TSS_TYPE_HALFBODY ] = new PPTParaSheet( *( mpParaSheet[ TSS_TYPE_BODY ] ) );
+ }
+ break;
+
+ case TSS_TYPE_QUARTERBODY :
+ {
+ mpCharSheet[ TSS_TYPE_QUARTERBODY ] = new PPTCharSheet( *( mpCharSheet[ TSS_TYPE_BODY ] ) );
+ mpParaSheet[ TSS_TYPE_QUARTERBODY ] = new PPTParaSheet( *( mpParaSheet[ TSS_TYPE_BODY ] ) );
+ }
+ break;
+ }
+ }
+ sal_uInt16 nLevelAnz;
+ rIn >> nLevelAnz;
+ if ( nLevelAnz > 5 )
+ {
+ DBG_ERROR( "PPTStyleSheet::Ppt-TextStylesheet hat mehr als 5 Ebenen! (SJ)" );
+ nLevelAnz = 5;
+ }
+ sal_uInt16 nLev = 0;
+ sal_Bool bFirst = sal_True;
+
+ while ( rIn.GetError() == 0 && rIn.Tell() < aTxMasterStyleHd.GetRecEndFilePos() && nLev < nLevelAnz )
+ {
+ if ( nLev && ( nInstance < 5 ) )
+ {
+ mpParaSheet[ nInstance ]->maParaLevel[ nLev ] = mpParaSheet[ nInstance ]->maParaLevel[ nLev - 1 ];
+ mpCharSheet[ nInstance ]->maCharLevel[ nLev ] = mpCharSheet[ nInstance ]->maCharLevel[ nLev - 1 ];
+ }
+
+ // Ausnahme: Vorlage 5, 6 (MasterTitle Titel und SubTitel)
+ if ( nInstance >= TSS_TYPE_SUBTITLE )
+ {
+ bFirst = sal_False;
+
+ sal_uInt16 nDontKnow;
+ rIn >> nDontKnow;
+ }
+ mpParaSheet[ nInstance ]->Read( rManager, rIn, sal_True, nLev, bFirst );
+ mpCharSheet[ nInstance ]->Read( rIn, sal_True, nLev, bFirst );
+ bFirst = sal_False;
+ nLev++;
+ }
+#ifdef DBG_UTIL
+ if (!(rManager.rImportParam.nImportFlags & PPT_IMPORTFLAGS_NO_TEXT_ASSERT))
+ {
+ if ( rIn.GetError() == 0 )
+ {
+ ByteString aMsg;
+ if ( rIn.Tell() > aTxMasterStyleHd.GetRecEndFilePos() )
+ {
+ aMsg += "\n ";
+ aMsg += "reading too many bytes:";
+ aMsg += ByteString::CreateFromInt32( rIn.Tell() - aTxMasterStyleHd.GetRecEndFilePos() );
+ }
+ if ( rIn.Tell() < aTxMasterStyleHd.GetRecEndFilePos() )
+ {
+ aMsg += "\n ";
+ aMsg += "reading too less bytes:";
+ aMsg += ByteString::CreateFromInt32( aTxMasterStyleHd.GetRecEndFilePos() - rIn.Tell() );
+ }
+ if ( aMsg.Len() != 0 )
+ {
+ aMsg.Insert( "]:", 0 );
+ aMsg.Insert( "PptStyleSheet::operator>>[", 0 );
+ DBG_ERROR(aMsg.GetBuffer());
+ }
+ }
+ if ( rIn.Tell() != aTxMasterStyleHd.GetRecEndFilePos() )
+ DBG_ASSERT(0, "SJ: Falsche Anzahl von Bytes gelesen beim Import der PPT-Formatvorlagen");
+ }
+#endif
+ }
+ aTxMasterStyleHd.SeekToEndOfRecord( rIn );
+ rIn >> aTxMasterStyleHd;
+ }
+ if ( !mpCharSheet[ TSS_TYPE_SUBTITLE ] )
+ {
+ mpCharSheet[ TSS_TYPE_SUBTITLE ] = new PPTCharSheet( *( mpCharSheet[ TSS_TYPE_BODY ] ) );
+ mpParaSheet[ TSS_TYPE_SUBTITLE ] = new PPTParaSheet( *( mpParaSheet[ TSS_TYPE_BODY ] ) );
+ }
+ if ( !mpCharSheet[ TSS_TYPE_TITLE ] )
+ {
+ mpCharSheet[ TSS_TYPE_TITLE ] = new PPTCharSheet( *( mpCharSheet[ TSS_TYPE_PAGETITLE ] ) );
+ mpParaSheet[ TSS_TYPE_TITLE ] = new PPTParaSheet( *( mpParaSheet[ TSS_TYPE_PAGETITLE ] ) );
+ }
+ if ( !mpCharSheet[ TSS_TYPE_HALFBODY ] )
+ {
+ mpCharSheet[ TSS_TYPE_HALFBODY ] = new PPTCharSheet( *( mpCharSheet[ TSS_TYPE_BODY ] ) );
+ mpParaSheet[ TSS_TYPE_HALFBODY ] = new PPTParaSheet( *( mpParaSheet[ TSS_TYPE_BODY ] ) );
+ }
+ if ( !mpCharSheet[ TSS_TYPE_QUARTERBODY ] )
+ {
+ mpCharSheet[ TSS_TYPE_QUARTERBODY ] = new PPTCharSheet( *( mpCharSheet[ TSS_TYPE_BODY ] ) );
+ mpParaSheet[ TSS_TYPE_QUARTERBODY ] = new PPTParaSheet( *( mpParaSheet[ TSS_TYPE_BODY ] ) );
+ }
+ if ( !bFoundTxMasterStyleAtom04 )
+ { // try to locate the txMasterStyleAtom in the Environment
+ DffRecordHeader* pEnvHeader2 = rManager.aDocRecManager.GetRecordHeader( PPT_PST_Environment );
+ if ( pEnvHeader2 )
+ {
+ pEnvHeader2->SeekToContent( rIn );
+ DffRecordHeader aTxMasterStyleHd2;
+ while ( rIn.Tell() < pEnvHeader2->GetRecEndFilePos() )
+ {
+ rIn >> aTxMasterStyleHd2;
+ if ( aTxMasterStyleHd2.nRecType == PPT_PST_TxMasterStyleAtom )
+ {
+ sal_uInt16 nLevelAnz;
+ rIn >> nLevelAnz;
+
+ sal_uInt16 nLev = 0;
+ sal_Bool bFirst = sal_True;
+ while ( rIn.GetError() == 0 && rIn.Tell() < aTxMasterStyleHd2.GetRecEndFilePos() && nLev < nLevelAnz )
+ {
+ if ( nLev )
+ {
+ mpParaSheet[ TSS_TYPE_TEXT_IN_SHAPE ]->maParaLevel[ nLev ] = mpParaSheet[ TSS_TYPE_TEXT_IN_SHAPE ]->maParaLevel[ nLev - 1 ];
+ mpCharSheet[ TSS_TYPE_TEXT_IN_SHAPE ]->maCharLevel[ nLev ] = mpCharSheet[ TSS_TYPE_TEXT_IN_SHAPE ]->maCharLevel[ nLev - 1 ];
+ }
+ mpParaSheet[ TSS_TYPE_TEXT_IN_SHAPE ]->Read( rManager, rIn, sal_True, nLev, bFirst );
+ if ( !nLev )
+ {
+ // set paragraph defaults for instance 4 (TSS_TYPE_TEXT_IN_SHAPE)
+ if ( rTxPFStyle.bValid )
+ {
+ PPTParaLevel& rParaLevel = mpParaSheet[ TSS_TYPE_TEXT_IN_SHAPE ]->maParaLevel[ 0 ];
+ rParaLevel.mnAsianLineBreak = 0;
+ if ( rTxPFStyle.bForbiddenRules )
+ rParaLevel.mnAsianLineBreak |= 1;
+ if ( !rTxPFStyle.bLatinTextWrap )
+ rParaLevel.mnAsianLineBreak |= 2;
+ if ( rTxPFStyle.bHangingPunctuation )
+ rParaLevel.mnAsianLineBreak |= 4;
+ }
+ }
+ mpCharSheet[ TSS_TYPE_TEXT_IN_SHAPE ]->Read( rIn, sal_True, nLev, bFirst );
+ bFirst = sal_False;
+ nLev++;
+ }
+ break;
+ }
+ else
+ aTxMasterStyleHd2.SeekToEndOfRecord( rIn );
+ }
+ }
+ }
+ rIn.Seek( nOldFilePos );
+
+ // will will create the default numbulletitem for each instance
+ for ( i = 0; i < PPT_STYLESHEETENTRYS; i++ )
+ {
+ UINT16 nLevels, nDepth = 0;
+ SvxNumRuleType eNumRuleType;
+
+ switch ( i )
+ {
+ case TSS_TYPE_PAGETITLE :
+ case TSS_TYPE_TITLE :
+ nLevels = 1;
+ eNumRuleType = SVX_RULETYPE_NUMBERING;
+ break;
+ case TSS_TYPE_SUBTITLE :
+ nLevels = 10;
+ eNumRuleType = SVX_RULETYPE_NUMBERING;
+ break;
+ case TSS_TYPE_BODY :
+ case TSS_TYPE_HALFBODY :
+ case TSS_TYPE_QUARTERBODY :
+ nLevels = 10;
+ eNumRuleType = SVX_RULETYPE_PRESENTATION_NUMBERING;
+ break;
+ default :
+ case TSS_TYPE_NOTES :
+ case TSS_TYPE_UNUSED :
+ case TSS_TYPE_TEXT_IN_SHAPE :
+ nLevels = 10;
+ eNumRuleType = SVX_RULETYPE_NUMBERING;
+ break;
+ }
+ SvxNumRule aRule( NUM_BULLET_REL_SIZE | NUM_BULLET_COLOR |
+ NUM_CHAR_TEXT_DISTANCE | NUM_SYMBOL_ALIGNMENT,
+ nLevels, FALSE, eNumRuleType );
+ for ( UINT16 nCount = 0; nDepth < nLevels; nCount++ )
+ {
+ const PPTParaLevel& rParaLevel = mpParaSheet[ i ]->maParaLevel[ nCount ];
+ const PPTCharLevel& rCharLevel = mpCharSheet[ i ]->maCharLevel[ nCount ];
+ SvxNumberFormat aNumberFormat( SVX_NUM_CHAR_SPECIAL );
+ aNumberFormat.SetBulletChar( ' ' );
+ GetNumberFormat( rManager, aNumberFormat, nCount, rParaLevel, rCharLevel, i );
+ aRule.SetLevel( nDepth++, aNumberFormat );
+ if ( nCount >= 4 )
+ {
+ for ( ;nDepth < nLevels; nDepth++ )
+ aRule.SetLevel( nDepth, aNumberFormat );
+ if ( eNumRuleType == SVX_RULETYPE_PRESENTATION_NUMBERING )
+ aRule.SetLevel( 0, aNumberFormat );
+ }
+ }
+ mpNumBulletItem[ i ] = new SvxNumBulletItem( aRule, EE_PARA_NUMBULLET );
+ }
+}
+
+PPTStyleSheet::~PPTStyleSheet()
+{
+ for ( UINT32 i = 0; i < PPT_STYLESHEETENTRYS; i++ )
+ {
+ delete mpCharSheet[ i ];
+ delete mpParaSheet[ i ];
+ delete mpNumBulletItem[ i ];
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+PPTParaPropSet::PPTParaPropSet() :
+ pParaSet( new ImplPPTParaPropSet )
+{
+ pParaSet->mnHasAnm = 1;
+}
+
+PPTParaPropSet::PPTParaPropSet( PPTParaPropSet& rParaPropSet )
+{
+ pParaSet = rParaPropSet.pParaSet;
+ pParaSet->mnRefCount++;
+
+ mnOriginalTextPos = rParaPropSet.mnOriginalTextPos;
+}
+
+PPTParaPropSet::~PPTParaPropSet()
+{
+ if ( ! ( --pParaSet->mnRefCount ) )
+ delete pParaSet;
+}
+
+PPTParaPropSet& PPTParaPropSet::operator=( PPTParaPropSet& rParaPropSet )
+{
+ if ( this != &rParaPropSet )
+ {
+ if ( ! ( --pParaSet->mnRefCount ) )
+ delete pParaSet;
+ pParaSet = rParaPropSet.pParaSet;
+ pParaSet->mnRefCount++;
+
+ mnOriginalTextPos = rParaPropSet.mnOriginalTextPos;
+ }
+ return *this;
+}
+
+PPTCharPropSet::PPTCharPropSet( sal_uInt32 nParagraph ) :
+ mnParagraph ( nParagraph ),
+ mpFieldItem ( NULL ),
+ pCharSet ( new ImplPPTCharPropSet )
+{
+ mnLanguage[ 0 ] = mnLanguage[ 1 ] = mnLanguage[ 2 ] = 0;
+}
+
+PPTCharPropSet::PPTCharPropSet( PPTCharPropSet& rCharPropSet )
+{
+ pCharSet = rCharPropSet.pCharSet;
+ pCharSet->mnRefCount++;
+
+ mnParagraph = rCharPropSet.mnParagraph;
+ mnOriginalTextPos = rCharPropSet.mnOriginalTextPos;
+ maString = rCharPropSet.maString;
+ mpFieldItem = ( rCharPropSet.mpFieldItem ) ? new SvxFieldItem( *rCharPropSet.mpFieldItem ) : NULL;
+ mnLanguage[ 0 ] = rCharPropSet.mnLanguage[ 0 ];
+ mnLanguage[ 1 ] = rCharPropSet.mnLanguage[ 1 ];
+ mnLanguage[ 2 ] = rCharPropSet.mnLanguage[ 2 ];
+}
+
+PPTCharPropSet::PPTCharPropSet( PPTCharPropSet& rCharPropSet, sal_uInt32 nParagraph )
+{
+ pCharSet = rCharPropSet.pCharSet;
+ pCharSet->mnRefCount++;
+
+ mnParagraph = nParagraph;
+ mnOriginalTextPos = rCharPropSet.mnOriginalTextPos;
+ maString = rCharPropSet.maString;
+ mpFieldItem = ( rCharPropSet.mpFieldItem ) ? new SvxFieldItem( *rCharPropSet.mpFieldItem ) : NULL;
+ mnLanguage[ 0 ] = mnLanguage[ 1 ] = mnLanguage[ 2 ] = 0;
+}
+
+PPTCharPropSet::~PPTCharPropSet()
+{
+ if ( ! ( --pCharSet->mnRefCount ) )
+ delete pCharSet;
+ delete mpFieldItem;
+}
+
+PPTCharPropSet& PPTCharPropSet::operator=( PPTCharPropSet& rCharPropSet )
+{
+ if ( this != &rCharPropSet )
+ {
+ if ( ! ( --pCharSet->mnRefCount ) )
+ delete pCharSet;
+ pCharSet = rCharPropSet.pCharSet;
+ pCharSet->mnRefCount++;
+
+ mnOriginalTextPos = rCharPropSet.mnOriginalTextPos;
+ mnParagraph = rCharPropSet.mnParagraph;
+ maString = rCharPropSet.maString;
+ mpFieldItem = ( rCharPropSet.mpFieldItem ) ? new SvxFieldItem( *rCharPropSet.mpFieldItem ) : NULL;
+ }
+ return *this;
+}
+
+void PPTCharPropSet::ImplMakeUnique()
+{
+ if ( pCharSet->mnRefCount > 1 )
+ {
+ ImplPPTCharPropSet& rOld = *pCharSet;
+ rOld.mnRefCount--;
+ pCharSet = new ImplPPTCharPropSet( rOld );
+ pCharSet->mnRefCount = 1;
+ }
+}
+
+void PPTCharPropSet::SetFont( UINT16 nFont )
+{
+ UINT32 nMask = 1 << PPT_CharAttr_Font;
+ UINT32 bDoNotMake = pCharSet->mnAttrSet & nMask;
+
+ if ( bDoNotMake )
+ bDoNotMake = nFont == pCharSet->mnFont;
+
+ if ( !bDoNotMake )
+ {
+ ImplMakeUnique();
+ pCharSet->mnFont = nFont;
+ pCharSet->mnAttrSet |= nMask;
+ }
+}
+
+void PPTCharPropSet::SetColor( sal_uInt32 nColor )
+{
+ ImplMakeUnique();
+ pCharSet->mnColor = nColor;
+ pCharSet->mnAttrSet |= 1 << PPT_CharAttr_FontColor;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+PPTRuler::PPTRuler() :
+ nRefCount ( 1 ),
+ nFlags ( 0 ),
+ pTab ( NULL ),
+ nTabCount ( 0 )
+{
+}
+
+PPTRuler::~PPTRuler()
+{
+ delete[] pTab;
+};
+
+
+PPTTextRulerInterpreter::PPTTextRulerInterpreter() :
+ mpImplRuler ( new PPTRuler() )
+{
+}
+
+PPTTextRulerInterpreter::PPTTextRulerInterpreter( PPTTextRulerInterpreter& rRuler )
+{
+ mpImplRuler = rRuler.mpImplRuler;
+ mpImplRuler->nRefCount++;
+}
+
+PPTTextRulerInterpreter::PPTTextRulerInterpreter( UINT32 nFileOfs, SdrPowerPointImport& rMan, DffRecordHeader& rHeader, SvStream& rIn ) :
+ mpImplRuler ( new PPTRuler() )
+{
+ if ( nFileOfs != 0xffffffff )
+ {
+ UINT32 nOldPos = rIn.Tell();
+ DffRecordHeader rHd;
+ if ( nFileOfs )
+ {
+ rIn.Seek( nFileOfs );
+ rIn >> rHd;
+ }
+ else
+ {
+ rHeader.SeekToContent( rIn );
+ if ( rMan.SeekToRec( rIn, PPT_PST_TextRulerAtom, rHeader.GetRecEndFilePos(), &rHd ) )
+ nFileOfs++;
+ }
+ if ( nFileOfs )
+ {
+ sal_Int16 nTCount;
+ sal_Int32 i;
+ rIn >> mpImplRuler->nFlags;
+ if ( mpImplRuler->nFlags & 1 )
+ rIn >> mpImplRuler->nDefaultTab;
+ if ( mpImplRuler->nFlags & 4 )
+ {
+ rIn >> nTCount;
+ if ( nTCount )
+ {
+ mpImplRuler->nTabCount = (UINT16)nTCount;
+ mpImplRuler->pTab = new PPTTabEntry[ mpImplRuler->nTabCount ];
+ for ( i = 0; i < nTCount; i++ )
+ {
+ rIn >> mpImplRuler->pTab[ i ].nOffset
+ >> mpImplRuler->pTab[ i ].nStyle;
+ }
+ }
+ }
+ for ( i = 0; i < 5; i++ )
+ {
+ if ( mpImplRuler->nFlags & ( 8 << i ) )
+ rIn >> mpImplRuler->nTextOfs[ i ];
+ if ( mpImplRuler->nFlags & ( 256 << i ) )
+ rIn >> mpImplRuler->nBulletOfs[ i ];
+ }
+ }
+ rIn.Seek( nOldPos );
+ }
+}
+
+BOOL PPTTextRulerInterpreter::GetDefaultTab( UINT32 /*nLevel*/, UINT16& nValue ) const
+{
+ if ( ! ( mpImplRuler->nFlags & 1 ) )
+ return FALSE;
+ nValue = mpImplRuler->nDefaultTab;
+ return TRUE;
+}
+
+BOOL PPTTextRulerInterpreter::GetTextOfs( UINT32 nLevel, UINT16& nValue ) const
+{
+ if ( ! ( ( nLevel < 5 ) && ( mpImplRuler->nFlags & ( 8 << nLevel ) ) ) )
+ return FALSE;
+ nValue = mpImplRuler->nTextOfs[ nLevel ];
+ return TRUE;
+}
+
+BOOL PPTTextRulerInterpreter::GetBulletOfs( UINT32 nLevel, UINT16& nValue ) const
+{
+ if ( ! ( ( nLevel < 5 ) && ( mpImplRuler->nFlags & ( 256 << nLevel ) ) ) )
+ return FALSE;
+ nValue = mpImplRuler->nBulletOfs[ nLevel ];
+ return TRUE;
+}
+
+PPTTextRulerInterpreter& PPTTextRulerInterpreter::operator=( PPTTextRulerInterpreter& rRuler )
+{
+ if ( this != &rRuler )
+ {
+ if ( ! ( --mpImplRuler->nRefCount ) )
+ delete mpImplRuler;
+ mpImplRuler = rRuler.mpImplRuler;
+ mpImplRuler->nRefCount++;
+ }
+ return *this;
+}
+
+PPTTextRulerInterpreter::~PPTTextRulerInterpreter()
+{
+ if ( ! ( --mpImplRuler->nRefCount ) )
+ delete mpImplRuler;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+PPTTextCharacterStyleAtomInterpreter::PPTTextCharacterStyleAtomInterpreter() :
+ nFlags1 ( 0 ),
+ nFlags2 ( 0 ),
+ nFlags3 ( 0 )
+{
+}
+
+sal_Bool PPTTextCharacterStyleAtomInterpreter::Read( SvStream& rIn, const DffRecordHeader& rRecHd )
+{
+ rRecHd.SeekToContent( rIn );
+
+ rIn >> nFlags1
+ >> nFlags2
+ >> nFlags3
+ >> n1
+ >> nFontHeight
+ >> nFontColor;
+
+ return sal_True;
+}
+
+PPTTextCharacterStyleAtomInterpreter::~PPTTextCharacterStyleAtomInterpreter()
+{
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+PPTTextParagraphStyleAtomInterpreter::PPTTextParagraphStyleAtomInterpreter() :
+ bValid ( sal_False ),
+ bForbiddenRules ( sal_False ),
+ bHangingPunctuation ( sal_False ),
+ bLatinTextWrap ( sal_False )
+{
+}
+
+sal_Bool PPTTextParagraphStyleAtomInterpreter::Read( SvStream& rIn, const DffRecordHeader& rRecHd )
+{
+ bValid = sal_False;
+ rRecHd.SeekToContent( rIn );
+ sal_uInt32 nDummy32, nFlags, nRecEndPos = rRecHd.GetRecEndFilePos();
+ sal_uInt16 nDummy16;
+
+ rIn >> nDummy16
+ >> nFlags;
+
+ if ( nFlags & 0xf && ( rIn.Tell() < nRecEndPos ) )
+ rIn >> nDummy16; // BuFlags
+ if ( nFlags & 0x80 && ( rIn.Tell() < nRecEndPos ) )
+ rIn >> nDummy16; // BuChar
+ if ( nFlags & 0x10 && ( rIn.Tell() < nRecEndPos ) )
+ rIn >> nDummy16; // nBuFont;
+ if ( nFlags & 0x40 && ( rIn.Tell() < nRecEndPos ) )
+ rIn >> nDummy16; // nBuHeight;
+ if ( nFlags & 0x0020 && ( rIn.Tell() < nRecEndPos ) )
+ rIn >> nDummy32; // nBuColor;
+ if ( nFlags & 0x800 && ( rIn.Tell() < nRecEndPos ) )
+ rIn >> nDummy16; // AbsJust!
+ if ( nFlags & 0x400 && ( rIn.Tell() < nRecEndPos ) )
+ rIn >> nDummy16;
+ if ( nFlags & 0x200 && ( rIn.Tell() < nRecEndPos ) )
+ rIn >> nDummy16;
+ if ( nFlags & 0x100 && ( rIn.Tell() < nRecEndPos ) )
+ rIn >> nDummy16;
+ if ( nFlags & 0x1000 && ( rIn.Tell() < nRecEndPos ) )
+ rIn >> nDummy16; // LineFeed
+ if ( nFlags & 0x2000 && ( rIn.Tell() < nRecEndPos ) )
+ rIn >> nDummy16; // nUpperDist
+ if ( nFlags & 0x4000 && ( rIn.Tell() < nRecEndPos ) )
+ rIn >> nDummy16; // nLowerDist
+ if ( nFlags & 0x8000 && ( rIn.Tell() < nRecEndPos ) )
+ rIn >> nDummy16;
+ if ( nFlags & 0x10000 && ( rIn.Tell() < nRecEndPos ) )
+ rIn >> nDummy16;
+ if ( nFlags & 0xe0000 && ( rIn.Tell() < nRecEndPos ) )
+ {
+ rIn >> nDummy16;
+ if ( nFlags & 0x20000 )
+ bForbiddenRules = ( nDummy16 & 1 ) == 1;
+ if ( nFlags & 0x40000 )
+ bLatinTextWrap = ( nDummy16 & 2 ) == 0;
+ if ( nFlags & 0x80000 )
+ bHangingPunctuation = ( nDummy16 & 4 ) == 4;
+ }
+ nFlags &=~ 0xfffff;
+ sal_uInt32 nMask = 0x100000;
+ while ( nFlags && nMask && ( rIn.Tell() < nRecEndPos ) )
+ {
+ if ( nFlags & nMask )
+ {
+ rIn >> nDummy16;
+ nFlags ^= nMask;
+ }
+ nMask <<= 1;
+ }
+ bValid = rIn.Tell() == nRecEndPos;
+ return bValid;
+}
+
+PPTTextParagraphStyleAtomInterpreter::~PPTTextParagraphStyleAtomInterpreter()
+{
+
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+PPTTextSpecInfo::PPTTextSpecInfo( sal_uInt32 _nCharIdx ) :
+ nCharIdx ( _nCharIdx ),
+ nDontKnow ( 1 )
+{
+ nLanguage[ 0 ] = 0x400;
+ nLanguage[ 1 ] = 0;
+ nLanguage[ 2 ] = 0;
+}
+
+PPTTextSpecInfo::~PPTTextSpecInfo()
+{
+}
+
+PPTTextSpecInfoAtomInterpreter::PPTTextSpecInfoAtomInterpreter() :
+ bValid ( sal_False )
+{
+}
+
+sal_Bool PPTTextSpecInfoAtomInterpreter::Read( SvStream& rIn, const DffRecordHeader& rRecHd,
+ sal_uInt16 nRecordType, const PPTTextSpecInfo* pTextSpecDefault )
+{
+ bValid = sal_False;
+ sal_uInt32 nCharIdx = 0;
+ rRecHd.SeekToContent( rIn );
+
+ while ( rIn.Tell() < rRecHd.GetRecEndFilePos() )
+ {
+ sal_uInt32 nCharCount,
+ nFlags, i;
+
+ if ( nRecordType == PPT_PST_TextSpecInfoAtom )
+ {
+ rIn >> nCharCount;
+ nCharIdx += nCharCount;
+ }
+ rIn >> nFlags;
+
+ PPTTextSpecInfo* pEntry = new PPTTextSpecInfo( nCharIdx );
+ if ( pTextSpecDefault )
+ {
+ pEntry->nDontKnow = pTextSpecDefault->nDontKnow;
+ pEntry->nLanguage[ 0 ] = pTextSpecDefault->nLanguage[ 0 ];
+ pEntry->nLanguage[ 1 ] = pTextSpecDefault->nLanguage[ 1 ];
+ pEntry->nLanguage[ 2 ] = pTextSpecDefault->nLanguage[ 2 ];
+ }
+ for ( i = 1; nFlags && i ; i <<= 1 )
+ {
+ sal_uInt16 nLang = 0;
+ switch( nFlags & i )
+ {
+ case 0 : break;
+ case 1 : rIn >> pEntry->nDontKnow; break;
+ case 2 : rIn >> nLang; break;
+ case 4 : rIn >> nLang; break;
+ default :
+ {
+ rIn.SeekRel( 2 );
+ }
+ }
+ if ( nLang )
+ {
+ sal_uInt16 nScriptType = GetI18NScriptTypeOfLanguage( nLang );
+ if ( nScriptType & SCRIPTTYPE_LATIN )
+ pEntry->nLanguage[ 0 ] = nLang;
+ if ( nScriptType & SCRIPTTYPE_ASIAN )
+ pEntry->nLanguage[ 1 ] = nLang;
+ if ( nScriptType & SCRIPTTYPE_COMPLEX )
+ pEntry->nLanguage[ 2 ] = nLang;
+ }
+ nFlags &= ~i;
+ }
+ aList.Insert( pEntry, LIST_APPEND );
+ }
+ bValid = rIn.Tell() == rRecHd.GetRecEndFilePos();
+ return bValid;
+}
+
+PPTTextSpecInfoAtomInterpreter::~PPTTextSpecInfoAtomInterpreter()
+{
+ void *pPtr;
+ for ( pPtr = aList.First(); pPtr; pPtr = aList.Next() )
+ delete (PPTTextSpecInfo*)pPtr;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void StyleTextProp9::Read( SvStream& rIn )
+{
+ rIn >> mnExtParagraphMask;
+ if ( mnExtParagraphMask & 0x800000 )
+ rIn >> mnBuBlip;
+ if ( mnExtParagraphMask & 0x2000000 )
+ rIn >> mnHasAnm;
+ if ( mnExtParagraphMask & 0x1000000 )
+ rIn >> mnAnmScheme;
+ if ( mnExtParagraphMask & 0x4000000 )
+ rIn >> mpfPP10Ext;
+ rIn >> mnExtCharacterMask;
+ if ( mnExtCharacterMask & 0x100000 )
+ rIn >> mncfPP10Ext;
+ rIn >> mnSpecialInfoMask;
+ if ( mnSpecialInfoMask & 0x20 )
+ rIn >> mnPP10Ext;
+ if ( mnSpecialInfoMask & 0x40 )
+ rIn >> mfBidi;
+}
+
+PPTStyleTextPropReader::PPTStyleTextPropReader( SvStream& rIn, SdrPowerPointImport& rMan, const DffRecordHeader& rTextHeader,
+ PPTTextRulerInterpreter& rRuler, const DffRecordHeader& rExtParaHd, sal_uInt32 nInstance )
+{
+ Init(rIn, rMan, rTextHeader, rRuler, rExtParaHd, nInstance);
+}
+
+void PPTStyleTextPropReader::ReadParaProps( SvStream& rIn, SdrPowerPointImport& rMan, const DffRecordHeader& rTextHeader,
+ const String& aString, PPTTextRulerInterpreter& rRuler,
+ sal_uInt32& nCharCount, sal_Bool& bTextPropAtom )
+{
+ sal_uInt32 nMask = 0; //TODO: nMask initialized here to suppress warning for now, see corresponding TODO below
+ sal_uInt32 nCharAnzRead = 0;
+ sal_uInt16 nDummy16;
+
+ sal_uInt16 nStringLen = aString.Len();
+
+ DffRecordHeader aTextHd2;
+ rTextHeader.SeekToContent( rIn );
+ if ( rMan.SeekToRec( rIn, PPT_PST_StyleTextPropAtom, rTextHeader.GetRecEndFilePos(), &aTextHd2 ) )
+ bTextPropAtom = sal_True;
+ while ( nCharAnzRead <= nStringLen )
+ {
+ PPTParaPropSet aParaPropSet;
+ ImplPPTParaPropSet& aSet = *aParaPropSet.pParaSet;
+ if ( bTextPropAtom )
+ {
+ rIn >> nCharCount
+ >> aParaPropSet.pParaSet->mnDepth; // Einruecktiefe
+
+ aParaPropSet.pParaSet->mnDepth =
+ std::min(sal_uInt16(9),
+ aParaPropSet.pParaSet->mnDepth);
+
+ nCharCount--;
+
+ rIn >> nMask;
+ aSet.mnAttrSet = nMask & 0x207df7;
+ sal_uInt16 nBulFlg = 0;
+ if ( nMask & 0xF )
+ rIn >> nBulFlg; // Bullet-HardAttr-Flags
+ aSet.mpArry[ PPT_ParaAttr_BulletOn ] = ( nBulFlg & 1 ) ? 1 : 0;
+ aSet.mpArry[ PPT_ParaAttr_BuHardFont ] = ( nBulFlg & 2 ) ? 1 : 0;
+ aSet.mpArry[ PPT_ParaAttr_BuHardColor ] = ( nBulFlg & 4 ) ? 1 : 0;
+
+ if ( nMask & 0x0080 ) // buChar
+ rIn >> aSet.mpArry[ PPT_ParaAttr_BulletChar ];
+ if ( nMask & 0x0010 ) // buTypeface
+ rIn >> aSet.mpArry[ PPT_ParaAttr_BulletFont ];
+ if ( nMask & 0x0040 ) // buSize
+ {
+ rIn >> aSet.mpArry[ PPT_ParaAttr_BulletHeight ];
+ if ( ! ( ( nMask & ( 1 << PPT_ParaAttr_BuHardHeight ) )
+ && ( nBulFlg && ( 1 << PPT_ParaAttr_BuHardHeight ) ) ) )
+ aSet.mnAttrSet ^= 0x40;
+ }
+ if ( nMask & 0x0020 ) // buColor
+ {
+ sal_uInt32 nVal32, nHiByte;
+ rIn >> nVal32;
+ nHiByte = nVal32 >> 24;
+ if ( nHiByte <= 8 )
+ nVal32 = nHiByte | PPT_COLSCHEME;
+ aSet.mnBulletColor = nVal32;
+ }
+ if ( nMask & 0x0800 ) // pfAlignment
+ {
+ rIn >> nDummy16;
+ aSet.mpArry[ PPT_ParaAttr_Adjust ] = nDummy16 & 3;
+ }
+ if ( nMask & 0x1000 ) // pfLineSpacing
+ rIn >> aSet.mpArry[ PPT_ParaAttr_LineFeed ];
+ if ( nMask & 0x2000 ) // pfSpaceBefore
+ rIn >> aSet.mpArry[ PPT_ParaAttr_UpperDist ];
+ if ( nMask & 0x4000 ) // pfSpaceAfter
+ rIn >> aSet.mpArry[ PPT_ParaAttr_LowerDist ];
+ if ( nMask & 0x100 ) // pfLeftMargin
+ rIn >> nDummy16;
+ if ( nMask & 0x400 ) // pfIndent
+ rIn >> nDummy16;
+ if ( nMask & 0x8000 ) // pfDefaultTabSize
+ rIn >> nDummy16;
+ if ( nMask & 0x100000 ) // pfTabStops
+ {
+ sal_uInt16 i, nDistance, nAlignment, nNumberOfTabStops = 0;
+ rIn >> nNumberOfTabStops;
+ for ( i = 0; i < nNumberOfTabStops; i++ )
+ {
+ rIn >> nDistance
+ >> nAlignment;
+ }
+ }
+ if ( nMask & 0x10000 ) // pfBaseLine
+ rIn >> nDummy16;
+ if ( nMask & 0xe0000 ) // pfCharWrap, pfWordWrap, pfOverflow
+ {
+ rIn >> nDummy16;
+ if ( nMask & 0x20000 )
+ aSet.mpArry[ PPT_ParaAttr_AsianLB_1 ] = nDummy16 & 1;
+ if ( nMask & 0x40000 )
+ aSet.mpArry[ PPT_ParaAttr_AsianLB_2 ] = ( nDummy16 >> 1 ) & 1;
+ if ( nMask & 0x80000 )
+ aSet.mpArry[ PPT_ParaAttr_AsianLB_3 ] = ( nDummy16 >> 2 ) & 1;
+ aSet.mnAttrSet |= ( ( nMask >> 17 ) & 7 ) << PPT_ParaAttr_AsianLB_1;
+ }
+ if ( nMask & 0x200000 ) // pfTextDirection
+ rIn >> aSet.mpArry[ PPT_ParaAttr_BiDi ];
+ }
+ else
+ nCharCount = nStringLen;
+
+ if ( rRuler.GetTextOfs( aParaPropSet.pParaSet->mnDepth, aSet.mpArry[ PPT_ParaAttr_TextOfs ] ) )
+ aSet.mnAttrSet |= 1 << PPT_ParaAttr_TextOfs;
+ if ( rRuler.GetBulletOfs( aParaPropSet.pParaSet->mnDepth, aSet.mpArry[ PPT_ParaAttr_BulletOfs ] ) )
+ aSet.mnAttrSet |= 1 << PPT_ParaAttr_BulletOfs;
+ if ( rRuler.GetDefaultTab( aParaPropSet.pParaSet->mnDepth, aSet.mpArry[ PPT_ParaAttr_DefaultTab ] ) )
+ aSet.mnAttrSet |= 1 << PPT_ParaAttr_DefaultTab;
+
+ if ( ( nCharCount > nStringLen ) || ( nStringLen < nCharAnzRead + nCharCount ) )
+ {
+ bTextPropAtom = sal_False;
+ nCharCount = nStringLen - nCharAnzRead;
+ // please fix the right hand side of
+ // PPTParaPropSet& PPTParaPropSet::operator=(PPTParaPropSet&),
+ // it should be a const reference
+ PPTParaPropSet aTmpPPTParaPropSet;
+ aParaPropSet = aTmpPPTParaPropSet;
+ DBG_ERROR( "SJ:PPTStyleTextPropReader::could not get this PPT_PST_StyleTextPropAtom by reading the paragraph attributes" );
+ }
+ PPTParaPropSet* pPara = new PPTParaPropSet( aParaPropSet );
+ pPara->mnOriginalTextPos = nCharAnzRead;
+ aParaPropList.Insert( pPara, LIST_APPEND );
+ if ( nCharCount )
+ {
+ sal_uInt32 nCount;
+ const sal_Unicode* pDat = aString.GetBuffer() + nCharAnzRead;
+ for ( nCount = 0; nCount < nCharCount; nCount++ )
+ {
+ if ( pDat[ nCount ] == 0xd )
+ {
+ pPara = new PPTParaPropSet( aParaPropSet );
+ pPara->mnOriginalTextPos = nCharAnzRead + nCount + 1;
+ aParaPropList.Insert( pPara, LIST_APPEND );
+ }
+ }
+ }
+ nCharAnzRead += nCharCount + 1;
+ }
+}
+
+void PPTStyleTextPropReader::ReadCharProps( SvStream& rIn, PPTCharPropSet& aCharPropSet, const String& aString,
+ sal_uInt32& nCharCount, sal_uInt32 nCharAnzRead,
+ sal_Bool& bTextPropAtom, sal_uInt32 nExtParaPos,
+ const std::vector< StyleTextProp9 >& aStyleTextProp9,
+ sal_uInt32& nExtParaFlags, sal_uInt16& nBuBlip,
+ sal_uInt16& nHasAnm, sal_uInt32& nAnmScheme )
+{
+ sal_uInt32 nMask = 0; //TODO: nMask initialized here to suppress warning for now, see corresponding TODO below
+ sal_uInt16 nDummy16;
+ sal_Int32 nCharsToRead;
+ sal_uInt32 nExtParaNibble = 0;
+
+ sal_uInt16 nStringLen = aString.Len();
+
+ rIn >> nDummy16;
+ nCharCount = nDummy16;
+ rIn >> nDummy16;
+ nCharsToRead = nStringLen - ( nCharAnzRead + nCharCount );
+ if ( nCharsToRead < 0 )
+ {
+ nCharCount = nStringLen - nCharAnzRead;
+ if ( nCharsToRead < -1 )
+ {
+ bTextPropAtom = sal_False;
+ DBG_ERROR( "SJ:PPTStyleTextPropReader::could not get this PPT_PST_StyleTextPropAtom by reading the character attributes" );
+ }
+ }
+ ImplPPTCharPropSet& aSet = *aCharPropSet.pCharSet;
+
+ // character attributes
+ rIn >> nMask;
+ if ( (sal_uInt16)nMask )
+ {
+ aSet.mnAttrSet |= (sal_uInt16)nMask;
+ rIn >> aSet.mnFlags;
+ }
+ if ( nMask & 0x10000 ) // cfTypeface
+ {
+ rIn >> aSet.mnFont;
+ aSet.mnAttrSet |= 1 << PPT_CharAttr_Font;
+ }
+ if ( nMask & 0x200000 ) // cfFEOldTypeface
+ {
+ rIn >> aSet.mnAsianOrComplexFont;
+ aSet.mnAttrSet |= 1 << PPT_CharAttr_AsianOrComplexFont;
+ }
+ if ( nMask & 0x400000 ) // cfANSITypeface
+ {
+ rIn >> aSet.mnANSITypeface;
+ aSet.mnAttrSet |= 1 << PPT_CharAttr_ANSITypeface;
+ }
+ if ( nMask & 0x800000 ) // cfSymbolTypeface
+ {
+ rIn >> aSet.mnSymbolFont;
+ aSet.mnAttrSet |= 1 << PPT_CharAttr_Symbol;
+ }
+ if ( nMask & 0x20000 ) // cfSize
+ {
+ rIn >> aSet.mnFontHeight;
+ aSet.mnAttrSet |= 1 << PPT_CharAttr_FontHeight;
+ }
+ if ( nMask & 0x40000 ) // cfColor
+ {
+ sal_uInt32 nVal;
+ rIn >> nVal;
+ if ( !( nVal & 0xff000000 ) )
+ nVal = PPT_COLSCHEME_HINTERGRUND;
+ aSet.mnColor = nVal;
+ aSet.mnAttrSet |= 1 << PPT_CharAttr_FontColor;
+ }
+ if ( nMask & 0x80000 ) // cfPosition
+ {
+ rIn >> aSet.mnEscapement;
+ aSet.mnAttrSet |= 1 << PPT_CharAttr_Escapement;
+ }
+ if ( nExtParaPos )
+ {
+ sal_uInt32 nExtBuInd = nMask & 0x3c00;
+ if ( nExtBuInd )
+ nExtBuInd = ( aSet.mnFlags & 0x3c00 ) >> 10;
+ if ( nExtBuInd < aStyleTextProp9.size() )
+ {
+ if ( nExtParaNibble && ( ( nExtBuInd + nExtParaNibble ) < aStyleTextProp9.size() ) )
+ nExtBuInd += nExtParaNibble;
+
+ nExtParaFlags = aStyleTextProp9[ nExtBuInd ].mnExtParagraphMask;
+ nBuBlip = aStyleTextProp9[ nExtBuInd ].mnBuBlip;
+ nHasAnm = aStyleTextProp9[ nExtBuInd ].mnHasAnm;
+ nAnmScheme = aStyleTextProp9[ nExtBuInd ].mnAnmScheme;
+ }
+ if ( ( nExtBuInd & 0xf ) == 0xf )
+ nExtParaNibble += 16;
+ }
+}
+
+void PPTStyleTextPropReader::Init( SvStream& rIn, SdrPowerPointImport& rMan, const DffRecordHeader& rTextHeader,
+ PPTTextRulerInterpreter& rRuler, const DffRecordHeader& rExtParaHd, sal_uInt32 nInstance )
+{
+ sal_uInt32 nMerk = rIn.Tell();
+ sal_uInt32 nExtParaPos = ( rExtParaHd.nRecType == PPT_PST_ExtendedParagraphAtom ) ? rExtParaHd.nFilePos + 8 : 0;
+
+ std::vector< StyleTextProp9 > aStyleTextProp9;
+ if ( rExtParaHd.nRecType == PPT_PST_ExtendedParagraphAtom )
+ {
+ rIn.Seek( rExtParaHd.nFilePos + 8 );
+ while( ( rIn.GetError() == 0 ) && ( rIn.Tell() < rExtParaHd.GetRecEndFilePos() ) )
+ {
+ aStyleTextProp9.resize( aStyleTextProp9.size() + 1 );
+ aStyleTextProp9.back().Read( rIn );
+ }
+ rIn.Seek( nMerk );
+ }
+
+ String aString;
+ DffRecordHeader aTextHd;
+ rIn >> aTextHd;
+ sal_uInt32 nMaxLen = aTextHd.nRecLen;
+ if ( nMaxLen >= 0xFFFF )
+ nMaxLen = 0xFFFE;
+
+ if( aTextHd.nRecType == PPT_PST_TextCharsAtom )
+ {
+ sal_uInt32 i;
+ sal_Unicode nChar,*pBuf = new sal_Unicode[ ( nMaxLen >> 1 ) + 1 ];
+ rIn.Read( pBuf, nMaxLen );
+ nMaxLen >>= 1;
+ pBuf[ nMaxLen ] = 0;
+ sal_Unicode* pPtr = pBuf;
+#ifdef OSL_BIGENDIAN
+ sal_Unicode nTemp;
+ for ( i = 0; i < nMaxLen; i++ )
+ {
+ nTemp = *pPtr;
+ *pPtr++ = ( nTemp << 8 ) | ( nTemp >> 8 );
+ }
+ pPtr = pBuf;
+#endif
+
+ for ( i = 0; i < nMaxLen; pPtr++, i++ )
+ {
+ nChar = *pPtr;
+ if ( !nChar )
+ break;
+ if ( ( nChar & 0xff00 ) == 0xf000 ) // in this special case we got a symbol
+ aSpecMarkerList.Insert( (void*)( i | PPT_SPEC_SYMBOL ), LIST_APPEND );
+ else if ( nChar == 0xd )
+ {
+ if ( nInstance == TSS_TYPE_PAGETITLE )
+ *pPtr = 0xb;
+ else
+ aSpecMarkerList.Insert( (void*)( i | PPT_SPEC_NEWLINE ), LIST_APPEND );
+ }
+ }
+ if ( i )
+ aString = String( pBuf, (sal_uInt16)i );
+ delete[] pBuf;
+ }
+ else if( aTextHd.nRecType == PPT_PST_TextBytesAtom )
+ {
+ sal_Char *pBuf = new sal_Char[ nMaxLen + 1 ];
+ pBuf[ nMaxLen ] = 0;
+ rIn.Read( pBuf, nMaxLen );
+ sal_Char* pPtr = pBuf;
+ for (;;)
+ {
+ sal_Char cLo = *pPtr;
+ if ( cLo == 0 )
+ break;
+ if ( cLo == 0xd )
+ {
+ if ( nInstance == TSS_TYPE_PAGETITLE )
+ *pPtr = 0xb;
+ else
+ aSpecMarkerList.Insert( (void*)( (pPtr - pBuf) | PPT_SPEC_NEWLINE ), LIST_APPEND );
+ }
+ pPtr++;
+ }
+ xub_StrLen nLen = sal::static_int_cast< xub_StrLen >( pPtr - pBuf );
+ if ( nLen )
+ aString = String( pBuf, nLen, RTL_TEXTENCODING_MS_1252 );
+ delete[] pBuf;
+ }
+ else
+ {
+ // no chars, but potentially char/para props?
+ sal_uInt32 nCharCount;
+ sal_Bool bTextPropAtom = sal_False;
+ ReadParaProps( rIn, rMan, rTextHeader, aString, rRuler, nCharCount, bTextPropAtom );
+
+ if ( bTextPropAtom )
+ {
+ // yeah, StyleTextProp is there, read it all & push to
+ // aParaPropList
+ PPTCharPropSet aCharPropSet(0);
+ aCharPropSet.mnOriginalTextPos = 0;
+
+ sal_uInt32 nCharAnzRead = 0;
+ sal_uInt32 nExtParaFlags = 0, nAnmScheme = 0;
+ sal_uInt16 nBuBlip = 0xffff, nHasAnm = 0;
+ ReadCharProps( rIn, aCharPropSet, aString, nCharCount, nCharAnzRead,
+ bTextPropAtom, nExtParaPos, aStyleTextProp9, nExtParaFlags,
+ nBuBlip, nHasAnm, nAnmScheme );
+
+ aCharPropList.Insert(
+ new PPTCharPropSet( aCharPropSet, 0 ), LIST_APPEND );
+ }
+ }
+
+ if ( aString.Len() )
+ {
+ sal_uInt32 nCharCount;
+ sal_Bool bTextPropAtom = sal_False;
+
+ ReadParaProps( rIn, rMan, rTextHeader, aString, rRuler, nCharCount, bTextPropAtom );
+
+ sal_Bool bEmptyParaPossible = sal_True;
+ sal_uInt32 nCharAnzRead = 0;
+ sal_uInt32 nCurrentPara = 0;
+ sal_uInt32 nCurrentSpecMarker = (sal_uInt32)(sal_uIntPtr)aSpecMarkerList.First();
+ sal_uInt16 nStringLen = aString.Len();
+
+ while ( nCharAnzRead < nStringLen )
+ {
+ sal_uInt32 nExtParaFlags = 0, nLatestParaUpdate = 0xffffffff, nAnmScheme = 0;
+ sal_uInt16 nBuBlip = 0xffff, nHasAnm = 0;
+
+ PPTCharPropSet aCharPropSet( nCurrentPara );
+ if ( bTextPropAtom )
+ ReadCharProps( rIn, aCharPropSet, aString, nCharCount, nCharAnzRead,
+ bTextPropAtom, nExtParaPos, aStyleTextProp9, nExtParaFlags,
+ nBuBlip, nHasAnm, nAnmScheme );
+ else
+ nCharCount = nStringLen;
+
+ sal_uInt32 nLen;
+ while( nCharCount )
+ {
+ if ( nExtParaPos && ( nLatestParaUpdate != nCurrentPara ) && ( nCurrentPara < aParaPropList.Count() ) )
+ {
+ PPTParaPropSet* pPropSet = (PPTParaPropSet*)aParaPropList.GetObject( nCurrentPara );
+ pPropSet->pParaSet->mnExtParagraphMask = nExtParaFlags;
+ if ( nExtParaFlags & 0x800000 )
+ pPropSet->pParaSet->mnBuBlip = nBuBlip;
+ if ( nExtParaFlags & 0x01000000 )
+ pPropSet->pParaSet->mnAnmScheme = nAnmScheme;
+ if ( nExtParaFlags & 0x02000000 )
+ pPropSet->pParaSet->mnHasAnm = nHasAnm;
+ nLatestParaUpdate = nCurrentPara;
+ }
+ aCharPropSet.mnOriginalTextPos = nCharAnzRead;
+ if ( nCurrentSpecMarker && ( ( nCurrentSpecMarker & 0xffff ) < ( nCharAnzRead + nCharCount ) ) )
+ {
+ if ( nCurrentSpecMarker & PPT_SPEC_NEWLINE )
+ {
+ nLen = ( nCurrentSpecMarker & 0xffff ) - nCharAnzRead;
+ if ( nLen )
+ aCharPropSet.maString = String( aString, (sal_uInt16)nCharAnzRead, (sal_uInt16)nLen );
+ else if ( bEmptyParaPossible )
+ aCharPropSet.maString = String();
+ if ( nLen || bEmptyParaPossible )
+ aCharPropList.Insert( new PPTCharPropSet( aCharPropSet, nCurrentPara ), LIST_APPEND );
+ nCurrentPara++;
+ nLen++;
+ nCharAnzRead += nLen;
+ nCharCount -= nLen;
+ bEmptyParaPossible = sal_True;
+ }
+ else if ( nCurrentSpecMarker & PPT_SPEC_SYMBOL )
+ {
+ if ( ( nCurrentSpecMarker & 0xffff ) != nCharAnzRead )
+ {
+ nLen = ( nCurrentSpecMarker & 0xffff ) - nCharAnzRead;
+ aCharPropSet.maString = String( aString, (sal_uInt16)nCharAnzRead, (sal_uInt16)nLen );
+ aCharPropList.Insert( new PPTCharPropSet( aCharPropSet, nCurrentPara ), LIST_APPEND );
+ nCharCount -= nLen;
+ nCharAnzRead += nLen;
+ }
+ PPTCharPropSet* pCPropSet = new PPTCharPropSet( aCharPropSet, nCurrentPara );
+ pCPropSet->maString = aString.GetChar( (sal_uInt16)nCharAnzRead );
+ if ( aCharPropSet.pCharSet->mnAttrSet & ( 1 << PPT_CharAttr_Symbol ) )
+ pCPropSet->SetFont( aCharPropSet.pCharSet->mnSymbolFont );
+ aCharPropList.Insert( pCPropSet, LIST_APPEND );
+ nCharCount--;
+ nCharAnzRead++;
+ bEmptyParaPossible = sal_False;
+ }
+ nCurrentSpecMarker = (sal_uInt32)(sal_uIntPtr)aSpecMarkerList.Next();
+ }
+ else
+ {
+ aCharPropSet.maString = String( aString, (sal_uInt16)nCharAnzRead, (sal_uInt16)nCharCount );
+ aCharPropList.Insert( new PPTCharPropSet( aCharPropSet, nCurrentPara ), LIST_APPEND );
+ nCharAnzRead += nCharCount;
+ bEmptyParaPossible = sal_False;
+ break;
+ }
+ }
+ }
+ if ( aCharPropList.Count() && ( ((PPTCharPropSet*)aCharPropList.Last())->mnParagraph != nCurrentPara ) )
+ {
+ PPTCharPropSet* pCharPropSet = new PPTCharPropSet( *(PPTCharPropSet*)aCharPropList.Last(), nCurrentPara );
+ pCharPropSet->maString = String();
+ pCharPropSet->mnOriginalTextPos = nStringLen - 1;
+ aCharPropList.Insert( pCharPropSet, LIST_APPEND );
+ }
+ }
+ rIn.Seek( nMerk );
+}
+
+PPTStyleTextPropReader::~PPTStyleTextPropReader()
+{
+ void* pTmp;
+ for ( pTmp = aParaPropList.First(); pTmp; pTmp = aParaPropList.Next() )
+ delete (PPTParaPropSet*)pTmp;
+ for ( pTmp = aCharPropList.First(); pTmp; pTmp = aCharPropList.Next() )
+ delete (PPTCharPropSet*)pTmp;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+struct FieldEntry
+{
+ UINT32 nFieldType;
+ UINT32 nFieldStartPos;
+ UINT32 nFieldEndPos;
+ String aFieldUrl;
+
+ FieldEntry( UINT32 nType, UINT32 nStart, UINT32 nEnd )
+ {
+ nFieldType = nType;
+ nFieldStartPos = nStart;
+ nFieldEndPos = nEnd;
+ }
+ FieldEntry( FieldEntry& rFieldEntry )
+ {
+ nFieldType = rFieldEntry.nFieldType;
+ nFieldStartPos = rFieldEntry.nFieldStartPos;
+ nFieldEndPos = rFieldEntry.nFieldEndPos;
+ aFieldUrl = rFieldEntry.aFieldUrl;
+ }
+};
+
+
+PPTPortionObj::PPTPortionObj( const PPTStyleSheet& rStyleSheet, UINT32 nInstance, UINT32 nDepth ) :
+ PPTCharPropSet ( 0 ),
+ mrStyleSheet ( rStyleSheet ),
+ mnInstance ( nInstance ),
+ mnDepth ( ( nDepth > 4 ) ? 4 : nDepth )
+{
+}
+
+PPTPortionObj::PPTPortionObj( PPTCharPropSet& rCharPropSet, const PPTStyleSheet& rStyleSheet, UINT32 nInstance, UINT32 nDepth ) :
+ PPTCharPropSet ( rCharPropSet ),
+ mrStyleSheet ( rStyleSheet ),
+ mnInstance ( nInstance ),
+ mnDepth ( nDepth )
+{
+}
+
+PPTPortionObj::PPTPortionObj( PPTPortionObj& rPortionObj ) :
+ PPTCharPropSet ( rPortionObj ),
+ mrStyleSheet ( rPortionObj.mrStyleSheet ),
+ mnInstance ( rPortionObj.mnInstance ),
+ mnDepth ( rPortionObj.mnDepth )
+{
+}
+
+PPTPortionObj::~PPTPortionObj()
+{
+}
+
+BOOL PPTPortionObj::HasTabulator()
+{
+ BOOL bRetValue = FALSE;
+ sal_Int32 nCount;
+ const sal_Unicode* pPtr = maString.GetBuffer();
+ for ( nCount = 0; nCount < maString.Len(); nCount++ )
+ {
+ if ( pPtr[ nCount ] == 0x9 )
+ {
+ bRetValue = TRUE;
+ break;
+ }
+
+ }
+ return bRetValue;
+}
+
+BOOL PPTPortionObj::GetAttrib( UINT32 nAttr, UINT32& nRetValue, UINT32 nDestinationInstance )
+{
+ UINT32 nMask = 1 << nAttr;
+ nRetValue = 0;
+
+ UINT32 bIsHardAttribute = ( ( pCharSet->mnAttrSet & nMask ) != 0 ) ? 1 : 0;
+
+ if ( bIsHardAttribute )
+ {
+ switch ( nAttr )
+ {
+ case PPT_CharAttr_Bold :
+ case PPT_CharAttr_Italic :
+ case PPT_CharAttr_Underline :
+ case PPT_CharAttr_Shadow :
+ case PPT_CharAttr_Strikeout :
+ case PPT_CharAttr_Embossed :
+ nRetValue = ( pCharSet->mnFlags & nMask ) ? 1 : 0;
+ break;
+ case PPT_CharAttr_Font :
+ nRetValue = pCharSet->mnFont;
+ break;
+ case PPT_CharAttr_AsianOrComplexFont :
+ nRetValue = pCharSet->mnAsianOrComplexFont;
+ break;
+ case PPT_CharAttr_FontHeight :
+ nRetValue = pCharSet->mnFontHeight;
+ break;
+ case PPT_CharAttr_FontColor :
+ nRetValue = pCharSet->mnColor;
+ break;
+ case PPT_CharAttr_Escapement :
+ nRetValue = pCharSet->mnEscapement;
+ break;
+ default :
+ DBG_ERROR( "SJ:PPTPortionObj::GetAttrib ( hard attribute does not exist )" );
+ }
+ }
+ else
+ {
+ const PPTCharLevel& rCharLevel = mrStyleSheet.mpCharSheet[ mnInstance ]->maCharLevel[ mnDepth ];
+ PPTCharLevel* pCharLevel = NULL;
+ if ( ( nDestinationInstance == 0xffffffff )
+ || ( mnDepth && ( ( mnInstance == TSS_TYPE_SUBTITLE ) || ( mnInstance == TSS_TYPE_TEXT_IN_SHAPE ) ) ) )
+ bIsHardAttribute = 1;
+ else if ( nDestinationInstance != mnInstance )
+ pCharLevel = &mrStyleSheet.mpCharSheet[ nDestinationInstance ]->maCharLevel[ mnDepth ];
+ switch( nAttr )
+ {
+ case PPT_CharAttr_Bold :
+ case PPT_CharAttr_Italic :
+ case PPT_CharAttr_Underline :
+ case PPT_CharAttr_Shadow :
+ case PPT_CharAttr_Strikeout :
+ case PPT_CharAttr_Embossed :
+ {
+ nRetValue = ( rCharLevel.mnFlags & nMask ) ? 1 : 0;
+ if ( pCharLevel )
+ {
+ UINT32 nTmp = ( pCharLevel->mnFlags & nMask ) ? 1 : 0;
+ if ( nRetValue != nTmp )
+ bIsHardAttribute = 1;
+ }
+ }
+ break;
+ case PPT_CharAttr_Font :
+ {
+ nRetValue = rCharLevel.mnFont;
+ if ( pCharLevel && ( nRetValue != pCharLevel->mnFont ) )
+ bIsHardAttribute = 1;
+ }
+ break;
+ case PPT_CharAttr_AsianOrComplexFont :
+ {
+ nRetValue = rCharLevel.mnAsianOrComplexFont;
+ if ( pCharLevel && ( nRetValue != pCharLevel->mnAsianOrComplexFont ) )
+ bIsHardAttribute = 1;
+ }
+ break;
+ case PPT_CharAttr_FontHeight :
+ {
+ nRetValue = rCharLevel.mnFontHeight;
+ if ( pCharLevel && ( nRetValue != pCharLevel->mnFontHeight ) )
+ bIsHardAttribute = 1;
+ }
+ break;
+ case PPT_CharAttr_FontColor :
+ {
+ nRetValue = rCharLevel.mnFontColor;
+ if ( pCharLevel && ( nRetValue != pCharLevel->mnFontColor ) )
+ bIsHardAttribute = 1;
+ }
+ break;
+ case PPT_CharAttr_Escapement :
+ {
+ nRetValue = rCharLevel.mnEscapement;
+ if ( pCharLevel && ( nRetValue != pCharLevel->mnEscapement ) )
+ bIsHardAttribute = 1;
+ }
+ break;
+ default :
+ DBG_ERROR( "SJ:PPTPortionObj::GetAttrib ( attribute does not exist )" );
+ }
+ }
+ return (BOOL)bIsHardAttribute;
+}
+
+void PPTPortionObj::ApplyTo( SfxItemSet& rSet, SdrPowerPointImport& rManager, UINT32 nDestinationInstance )
+{
+ ApplyTo( rSet, rManager, nDestinationInstance, NULL );
+}
+
+void PPTPortionObj::ApplyTo( SfxItemSet& rSet, SdrPowerPointImport& rManager, UINT32 nDestinationInstance, const PPTTextObj* pTextObj )
+{
+ UINT32 nVal;
+ if ( GetAttrib( PPT_CharAttr_Bold, nVal, nDestinationInstance ) )
+ {
+ rSet.Put( SvxWeightItem( nVal != 0 ? WEIGHT_BOLD : WEIGHT_NORMAL, EE_CHAR_WEIGHT ) );
+ rSet.Put( SvxWeightItem( nVal != 0 ? WEIGHT_BOLD : WEIGHT_NORMAL, EE_CHAR_WEIGHT_CJK ) );
+ rSet.Put( SvxWeightItem( nVal != 0 ? WEIGHT_BOLD : WEIGHT_NORMAL, EE_CHAR_WEIGHT_CTL ) );
+ }
+ if ( GetAttrib( PPT_CharAttr_Italic, nVal, nDestinationInstance ) )
+ {
+ rSet.Put( SvxPostureItem( nVal != 0 ? ITALIC_NORMAL : ITALIC_NONE, EE_CHAR_ITALIC ) );
+ rSet.Put( SvxPostureItem( nVal != 0 ? ITALIC_NORMAL : ITALIC_NONE, EE_CHAR_ITALIC_CJK ) );
+ rSet.Put( SvxPostureItem( nVal != 0 ? ITALIC_NORMAL : ITALIC_NONE, EE_CHAR_ITALIC_CTL ) );
+ }
+ if ( GetAttrib( PPT_CharAttr_Underline, nVal, nDestinationInstance ) )
+ rSet.Put( SvxUnderlineItem( nVal != 0 ? UNDERLINE_SINGLE : UNDERLINE_NONE, EE_CHAR_UNDERLINE ) );
+
+ if ( GetAttrib( PPT_CharAttr_Shadow, nVal, nDestinationInstance ) )
+ rSet.Put( SvxShadowedItem( nVal != 0, EE_CHAR_SHADOW ) );
+
+ if ( GetAttrib( PPT_CharAttr_Strikeout, nVal, nDestinationInstance ) )
+ rSet.Put( SvxCrossedOutItem( nVal != 0 ? STRIKEOUT_SINGLE : STRIKEOUT_NONE, EE_CHAR_STRIKEOUT ) );
+
+ sal_uInt32 nAsianFontId = 0xffff;
+ if ( GetAttrib( PPT_CharAttr_AsianOrComplexFont, nAsianFontId, nDestinationInstance ) )
+ {
+ if ( nAsianFontId != 0xffff )
+ {
+ PptFontEntityAtom* pFontEnityAtom = rManager.GetFontEnityAtom( nAsianFontId );
+ if ( pFontEnityAtom )
+ {
+ rSet.Put( SvxFontItem( pFontEnityAtom->eFamily, pFontEnityAtom->aName,
+ String(), pFontEnityAtom->ePitch, pFontEnityAtom->eCharSet, EE_CHAR_FONTINFO_CJK ) );
+ rSet.Put( SvxFontItem( pFontEnityAtom->eFamily, pFontEnityAtom->aName,
+ String(), pFontEnityAtom->ePitch, pFontEnityAtom->eCharSet, EE_CHAR_FONTINFO_CTL ) );
+ }
+ }
+ }
+ if ( GetAttrib( PPT_CharAttr_Font, nVal, nDestinationInstance ) )
+ {
+ PptFontEntityAtom* pFontEnityAtom = rManager.GetFontEnityAtom( nVal );
+ if ( pFontEnityAtom )
+ rSet.Put( SvxFontItem( pFontEnityAtom->eFamily, pFontEnityAtom->aName, String(), pFontEnityAtom->ePitch, pFontEnityAtom->eCharSet, EE_CHAR_FONTINFO ) );
+ }
+ if ( GetAttrib( PPT_CharAttr_FontHeight, nVal, nDestinationInstance ) ) // Schriftgrad in Point
+ {
+ sal_uInt32 nHeight = rManager.ScalePoint( nVal );
+ rSet.Put( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT ) );
+ rSet.Put( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT_CJK ) );
+ rSet.Put( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT_CTL ) );
+ }
+
+ if ( GetAttrib( PPT_CharAttr_Embossed, nVal, nDestinationInstance ) )
+ rSet.Put( SvxCharReliefItem( nVal != 0 ? RELIEF_EMBOSSED : RELIEF_NONE, EE_CHAR_RELIEF ) );
+ if ( nVal ) /* if Embossed is set, the font color depends to the fillstyle/color of the object,
+ if the object has no fillstyle, the font color depends to fillstyle of the background */
+ {
+ Color aDefColor( COL_BLACK );
+ MSO_FillType eFillType = mso_fillSolid;
+ if ( rManager.GetPropertyValue( DFF_Prop_fNoFillHitTest ) & 0x10 )
+ eFillType = (MSO_FillType)rManager.GetPropertyValue( DFF_Prop_fillType, mso_fillSolid );
+ else
+ eFillType = mso_fillBackground;
+ switch( eFillType )
+ {
+ case mso_fillShade :
+ case mso_fillShadeCenter :
+ case mso_fillShadeShape :
+ case mso_fillShadeScale :
+ case mso_fillShadeTitle :
+ case mso_fillSolid :
+ aDefColor = rManager.MSO_CLR_ToColor( rManager.GetPropertyValue( DFF_Prop_fillColor ) );
+ break;
+ case mso_fillPattern :
+ aDefColor = rManager.MSO_CLR_ToColor( rManager.GetPropertyValue( DFF_Prop_fillBackColor ) );
+ break;
+ case mso_fillTexture :
+ {
+ Graphic aGraf;
+ if ( rManager.GetBLIP( rManager.GetPropertyValue( DFF_Prop_fillBlip ), aGraf, NULL ) )
+ {
+ Bitmap aBmp( aGraf.GetBitmap() );
+ Size aSize( aBmp.GetSizePixel() );
+ if ( aSize.Width() && aSize.Height() )
+ {
+ if ( aSize.Width () > 64 )
+ aSize.Width () = 64;
+ if ( aSize.Height() > 64 )
+ aSize.Height() = 64;
+
+ ULONG nRt = 0, nGn = 0, nBl = 0;
+ BitmapReadAccess* pAcc = aBmp.AcquireReadAccess();
+ if( pAcc )
+ {
+ const long nWidth = aSize.Width();
+ const long nHeight = aSize.Height();
+
+ if( pAcc->HasPalette() )
+ {
+ for( long nY = 0L; nY < nHeight; nY++ )
+ {
+ for( long nX = 0L; nX < nWidth; nX++ )
+ {
+ const BitmapColor& rCol = pAcc->GetPaletteColor( (BYTE) pAcc->GetPixel( nY, nX ) );
+ nRt+=rCol.GetRed(); nGn+=rCol.GetGreen(); nBl+=rCol.GetBlue();
+ }
+ }
+ }
+ else
+ {
+ for( long nY = 0L; nY < nHeight; nY++ )
+ {
+ for( long nX = 0L; nX < nWidth; nX++ )
+ {
+ const BitmapColor aCol( pAcc->GetPixel( nY, nX ) );
+ nRt+=aCol.GetRed(); nGn+=aCol.GetGreen(); nBl+=aCol.GetBlue();
+ }
+ }
+ }
+ aBmp.ReleaseAccess( pAcc );
+ sal_uInt32 nC = ( aSize.Width() * aSize.Height() );
+ nRt /= nC;
+ nGn /= nC;
+ nBl /= nC;
+ aDefColor = Color(sal_uInt8( nRt ), sal_uInt8( nGn ),sal_uInt8( nBl ) );
+ }
+ }
+ }
+ }
+ break;
+ case mso_fillBackground :
+ {
+ if ( pTextObj ) // the textobject is needed
+ {
+ const SfxItemSet* pItemSet = pTextObj->GetBackground();
+ if ( pItemSet )
+ {
+ const SfxPoolItem* pFillStyleItem = NULL;
+ pItemSet->GetItemState( XATTR_FILLSTYLE, FALSE, &pFillStyleItem );
+ if ( pFillStyleItem )
+ {
+ XFillStyle eFillStyle = ((XFillStyleItem*)pFillStyleItem)->GetValue();
+ switch( eFillStyle )
+ {
+ case XFILL_SOLID :
+ {
+ const SfxPoolItem* pFillColorItem = NULL;
+ pItemSet->GetItemState( XATTR_FILLCOLOR, FALSE, &pFillColorItem );
+ if ( pFillColorItem )
+ aDefColor = ((XColorItem*)pFillColorItem)->GetColorValue();
+ }
+ break;
+ case XFILL_GRADIENT :
+ {
+ const SfxPoolItem* pGradientItem = NULL;
+ pItemSet->GetItemState( XATTR_FILLGRADIENT, FALSE, &pGradientItem );
+ if ( pGradientItem )
+ aDefColor = ((XFillGradientItem*)pGradientItem)->GetGradientValue().GetStartColor();
+ }
+ break;
+ case XFILL_HATCH :
+ case XFILL_BITMAP :
+ aDefColor = Color( COL_WHITE );
+ break;
+ default: break;
+ }
+ }
+ }
+ }
+ }
+ break;
+// case mso_fillPicture :
+ default: break;
+ }
+ rSet.Put( SvxColorItem( aDefColor, EE_CHAR_COLOR ) );
+ }
+ else
+ {
+ if ( GetAttrib( PPT_CharAttr_FontColor, nVal, nDestinationInstance ) ) // Textfarbe (4Byte-Arg)
+ {
+ Color aCol( rManager.MSO_TEXT_CLR_ToColor( nVal ) );
+ rSet.Put( SvxColorItem( aCol, EE_CHAR_COLOR ) );
+ if ( nDestinationInstance == 0xffffffff )
+ mrStyleSheet.mpCharSheet[ mnInstance ]->maCharLevel[ mnDepth ].mnFontColorInStyleSheet = aCol;
+ }
+ else if ( nVal & 0x0f000000 ) // this is not a hard attribute, but maybe the page has a different colerscheme,
+ { // so that in this case we must use a hard color attribute
+ Color aCol( rManager.MSO_TEXT_CLR_ToColor( nVal ) );
+ Color& aColorInSheet = mrStyleSheet.mpCharSheet[ mnInstance ]->maCharLevel[ mnDepth ].mnFontColorInStyleSheet;
+ if ( aColorInSheet != aCol )
+ rSet.Put( SvxColorItem( aCol, EE_CHAR_COLOR ) );
+ }
+ }
+
+ if ( GetAttrib( PPT_CharAttr_Escapement, nVal, nDestinationInstance ) ) // Hoch/Tiefstellung in %
+ {
+ sal_uInt16 nEsc = 0;
+ sal_uInt8 nProp = 100;
+
+ if ( nVal )
+ {
+ nEsc = (sal_Int16)nVal;
+ nProp = DFLT_ESC_PROP;
+ }
+ SvxEscapementItem aItem( nEsc, nProp, EE_CHAR_ESCAPEMENT );
+ rSet.Put( aItem );
+ }
+ if ( mnLanguage[ 0 ] )
+ rSet.Put( SvxLanguageItem( mnLanguage[ 0 ], EE_CHAR_LANGUAGE ) );
+ if ( mnLanguage[ 1 ] )
+ rSet.Put( SvxLanguageItem( mnLanguage[ 1 ], EE_CHAR_LANGUAGE_CJK ) );
+ if ( mnLanguage[ 2 ] )
+ rSet.Put( SvxLanguageItem( mnLanguage[ 2 ], EE_CHAR_LANGUAGE_CTL ) );
+}
+
+SvxFieldItem* PPTPortionObj::GetTextField()
+{
+ if ( mpFieldItem )
+ return new SvxFieldItem( *mpFieldItem );
+ return NULL;
+}
+
+// -----------------------------------------------------------------------
+
+PPTParagraphObj::PPTParagraphObj( const PPTStyleSheet& rStyleSheet, UINT32 nInstance, UINT16 nDepth ) :
+ PPTNumberFormatCreator ( NULL ),
+ mrStyleSheet ( rStyleSheet ),
+ mnInstance ( nInstance ),
+ mbTab ( TRUE ), // style sheets always have to get the right tabulator setting
+ mnPortionCount ( 0 ),
+ mpPortionList ( NULL )
+{
+ if ( nDepth > 4 )
+ nDepth = 4;
+ pParaSet->mnDepth = nDepth;
+}
+
+PPTParagraphObj::PPTParagraphObj( PPTStyleTextPropReader& rPropReader, const PPTStyleSheet& rStyleSheet,
+ UINT32 nInstance, PPTTextRulerInterpreter& rRuler ) :
+ PPTParaPropSet ( *( (PPTParaPropSet*)rPropReader.aParaPropList.GetCurObject() ) ),
+ PPTNumberFormatCreator ( NULL ),
+ PPTTextRulerInterpreter ( rRuler ),
+ mrStyleSheet ( rStyleSheet ),
+ mnInstance ( nInstance ),
+ mbTab ( FALSE ),
+ mnCurrentObject ( 0 ),
+ mnPortionCount ( 0 ),
+ mpPortionList ( NULL )
+{
+ sal_uInt32 nCurPos = rPropReader.aCharPropList.GetCurPos();
+ PPTCharPropSet* pCharPropSet = (PPTCharPropSet*)rPropReader.aCharPropList.GetCurObject();
+ if ( pCharPropSet )
+ {
+ sal_uInt32 nCurrentParagraph = pCharPropSet->mnParagraph;
+ for ( ; pCharPropSet && ( pCharPropSet->mnParagraph == nCurrentParagraph ); pCharPropSet = (PPTCharPropSet*)rPropReader.aCharPropList.Next() )
+ mnPortionCount++; // counting number of portions that are part of this paragraph
+ pCharPropSet = (PPTCharPropSet*)rPropReader.aCharPropList.Seek( nCurPos );
+
+ mpPortionList = new PPTPortionObj*[ mnPortionCount ];
+ for ( UINT32 i = 0; i < mnPortionCount; i++ )
+ {
+ if ( pCharPropSet )
+ {
+ PPTPortionObj* pPPTPortion = new PPTPortionObj( *pCharPropSet, rStyleSheet, nInstance, pParaSet->mnDepth );
+ mpPortionList[ i ] = pPPTPortion;
+ if ( !mbTab )
+ mbTab = mpPortionList[ i ]->HasTabulator();
+ }
+ else
+ {
+ DBG_ERROR( "SJ:PPTParagraphObj::It seems that there are missing some textportions" );
+ mpPortionList[ i ] = NULL;
+ }
+ pCharPropSet = (PPTCharPropSet*)rPropReader.aCharPropList.Next();
+ }
+ }
+}
+
+PPTParagraphObj::~PPTParagraphObj()
+{
+ ImplClear();
+}
+
+void PPTParagraphObj::AppendPortion( PPTPortionObj& rPPTPortion )
+{
+ UINT32 i;
+ PPTPortionObj** mpOldPortionList = mpPortionList;
+ mpPortionList = new PPTPortionObj*[ ++mnPortionCount ];
+ for ( i = 0; i < mnPortionCount - 1; i++ )
+ mpPortionList[ i ] = mpOldPortionList[ i ];
+ delete[] mpOldPortionList;
+ mpPortionList[ mnPortionCount - 1 ] = new PPTPortionObj( rPPTPortion );
+ if ( !mbTab )
+ mbTab = mpPortionList[ mnPortionCount - 1 ]->HasTabulator();
+}
+
+void PPTParagraphObj::UpdateBulletRelSize( sal_uInt32& nBulletRelSize ) const
+{
+ if ( nBulletRelSize > 0x7fff ) // a negative value is the absolute bullet height
+ {
+ sal_uInt16 nFontHeight = 0;
+ if ( mpPortionList )
+ {
+ PPTPortionObj* pPortion = mpPortionList[ 0 ];
+ if ( pPortion && ( pPortion->pCharSet->mnAttrSet & ( 1 << PPT_CharAttr_FontHeight ) ) )
+ nFontHeight = pPortion->pCharSet->mnFontHeight;
+ }
+ // if we do not have a hard attributed fontheight, the fontheight is taken from the style
+ if ( !nFontHeight )
+ nFontHeight = mrStyleSheet.mpCharSheet[ mnInstance ]->maCharLevel[ pParaSet->mnDepth ].mnFontHeight;
+ nBulletRelSize = nFontHeight ? ((-((sal_Int16)nBulletRelSize)) * 100 ) / nFontHeight : 100;
+ }
+}
+
+BOOL PPTParagraphObj::GetAttrib( UINT32 nAttr, UINT32& nRetValue, UINT32 nDestinationInstance )
+{
+ UINT32 nMask = 1 << nAttr;
+ nRetValue = 0;
+
+ if ( nAttr > 21 )
+ {
+ DBG_ERROR( "SJ:PPTParagraphObj::GetAttrib - attribute does not exist" );
+ return FALSE;
+ }
+
+ UINT32 bIsHardAttribute = ( ( pParaSet->mnAttrSet & nMask ) != 0 ) ? 1 : 0;
+
+ if ( bIsHardAttribute )
+ {
+ if ( nAttr == PPT_ParaAttr_BulletColor )
+ {
+ sal_Bool bHardBulletColor;
+ if ( pParaSet->mnAttrSet & ( 1 << PPT_ParaAttr_BuHardColor ) )
+ bHardBulletColor = pParaSet->mpArry[ PPT_ParaAttr_BuHardColor ] != 0;
+ else
+ bHardBulletColor = ( mrStyleSheet.mpParaSheet[ mnInstance ]->maParaLevel[ pParaSet->mnDepth ].mnBuFlags
+ & ( 1 << PPT_ParaAttr_BuHardColor ) ) != 0;
+ if ( bHardBulletColor )
+ nRetValue = pParaSet->mnBulletColor;
+ else
+ {
+ nRetValue = PPT_COLSCHEME_TEXT_UND_ZEILEN;
+ if ( ( nDestinationInstance != 0xffffffff ) && mnPortionCount )
+ {
+ PPTPortionObj* pPortion = mpPortionList[ 0 ];
+ if ( pPortion )
+ {
+ if ( pPortion->pCharSet->mnAttrSet & ( 1 << PPT_CharAttr_FontColor ) )
+ nRetValue = pPortion->pCharSet->mnColor;
+ else
+ nRetValue = mrStyleSheet.mpCharSheet[ nDestinationInstance ]->maCharLevel[ pParaSet->mnDepth ].mnFontColor;
+ }
+ }
+ }
+ }
+ else if ( nAttr == PPT_ParaAttr_BulletFont )
+ {
+ sal_Bool bHardBuFont;
+ if ( pParaSet->mnAttrSet & ( 1 << PPT_ParaAttr_BuHardFont ) )
+ bHardBuFont = pParaSet->mpArry[ PPT_ParaAttr_BuHardFont ] != 0;
+ else
+ bHardBuFont = ( mrStyleSheet.mpParaSheet[ mnInstance ]->maParaLevel[ pParaSet->mnDepth ].mnBuFlags
+ & ( 1 << PPT_ParaAttr_BuHardFont ) ) != 0;
+ if ( bHardBuFont )
+ nRetValue = pParaSet->mpArry[ PPT_ParaAttr_BulletFont ];
+ else
+ {
+ // it is the font used which assigned to the first character of the following text
+ nRetValue = 0;
+ if ( ( nDestinationInstance != 0xffffffff ) && mnPortionCount )
+ {
+ PPTPortionObj* pPortion = mpPortionList[ 0 ];
+ if ( pPortion )
+ {
+ if ( pPortion->pCharSet->mnAttrSet & ( 1 << PPT_CharAttr_Font ) )
+ nRetValue = pPortion->pCharSet->mnFont;
+ else
+ nRetValue = mrStyleSheet.mpCharSheet[ nDestinationInstance ]->maCharLevel[ pParaSet->mnDepth ].mnFont;
+ }
+ }
+ }
+ }
+ else
+ nRetValue = pParaSet->mpArry[ nAttr ];
+ }
+ else
+ {
+ const PPTParaLevel& rParaLevel = mrStyleSheet.mpParaSheet[ mnInstance ]->maParaLevel[ pParaSet->mnDepth ];
+
+ PPTParaLevel* pParaLevel = NULL;
+ if ( ( nDestinationInstance == 0xffffffff )
+ || ( pParaSet->mnDepth && ( ( mnInstance == TSS_TYPE_SUBTITLE ) || ( mnInstance == TSS_TYPE_TEXT_IN_SHAPE ) ) ) )
+ bIsHardAttribute = 1;
+ else if ( nDestinationInstance != mnInstance )
+ pParaLevel = &mrStyleSheet.mpParaSheet[ nDestinationInstance ]->maParaLevel[ pParaSet->mnDepth ];
+ switch ( nAttr )
+ {
+ case PPT_ParaAttr_BulletOn :
+ {
+ nRetValue = rParaLevel.mnBuFlags & ( 1 << PPT_ParaAttr_BulletOn );
+ if ( pParaLevel )
+ {
+ if ( nRetValue != ( (sal_uInt32)pParaLevel->mnBuFlags & ( 1 << PPT_ParaAttr_BulletOn ) ) )
+ bIsHardAttribute = 1;
+ }
+ }
+ break;
+ case PPT_ParaAttr_BuHardFont :
+ case PPT_ParaAttr_BuHardColor :
+ case PPT_ParaAttr_BuHardHeight :
+ DBG_ERROR( "SJ:PPTParagraphObj::GetAttrib - this attribute does not make sense" );
+ break;
+ case PPT_ParaAttr_BulletChar :
+ {
+ nRetValue = rParaLevel.mnBulletChar;
+ if ( pParaLevel && ( nRetValue != pParaLevel->mnBulletChar ) )
+ bIsHardAttribute = 1;
+ }
+ break;
+ case PPT_ParaAttr_BulletFont :
+ {
+ sal_Bool bHardBuFont;
+ if ( pParaSet->mnAttrSet & ( 1 << PPT_ParaAttr_BuHardFont ) )
+ bHardBuFont = pParaSet->mpArry[ PPT_ParaAttr_BuHardFont ] != 0;
+ else
+ bHardBuFont = ( rParaLevel.mnBuFlags & ( 1 << PPT_ParaAttr_BuHardFont ) ) != 0;
+ if ( bHardBuFont )
+ {
+ nRetValue = rParaLevel.mnBulletFont;
+ if ( pParaLevel && ( nRetValue != pParaLevel->mnBulletFont ) )
+ bIsHardAttribute = 1;
+ }
+ else
+ {
+ if ( mnPortionCount )
+ {
+ PPTPortionObj* pPortion = mpPortionList[ 0 ];
+ if ( pPortion )
+ bIsHardAttribute = pPortion->GetAttrib( PPT_CharAttr_Font, nRetValue, nDestinationInstance );
+ }
+ else
+ {
+ nRetValue = mrStyleSheet.mpCharSheet[ mnInstance ]->maCharLevel[ pParaSet->mnDepth ].mnFont;
+ bIsHardAttribute = 1;
+ }
+ }
+ }
+ break;
+ case PPT_ParaAttr_BulletHeight :
+ {
+ nRetValue = rParaLevel.mnBulletHeight;
+ if ( pParaLevel && ( nRetValue != pParaLevel->mnBulletHeight ) )
+ bIsHardAttribute = 1;
+ }
+ break;
+ case PPT_ParaAttr_BulletColor :
+ {
+ sal_Bool bHardBulletColor;
+ if ( pParaSet->mnAttrSet & ( 1 << PPT_ParaAttr_BuHardColor ) )
+ bHardBulletColor = pParaSet->mpArry[ PPT_ParaAttr_BuHardColor ] != 0;
+ else
+ bHardBulletColor = ( rParaLevel.mnBuFlags & ( 1 << PPT_ParaAttr_BuHardColor ) ) != 0;
+ if ( bHardBulletColor )
+ {
+ nRetValue = rParaLevel.mnBulletColor;
+ if ( pParaLevel && ( nRetValue != pParaLevel->mnBulletColor ) )
+ bIsHardAttribute = 1;
+ }
+ else
+ {
+ if ( mnPortionCount )
+ {
+ PPTPortionObj* pPortion = mpPortionList[ 0 ];
+ if ( pPortion )
+ bIsHardAttribute = pPortion->GetAttrib( PPT_CharAttr_FontColor, nRetValue, nDestinationInstance );
+ }
+ else
+ {
+ nRetValue = mrStyleSheet.mpCharSheet[ mnInstance ]->maCharLevel[ pParaSet->mnDepth ].mnFontColor;
+ bIsHardAttribute = 1;
+ }
+ }
+ }
+ break;
+ case PPT_ParaAttr_Adjust :
+ {
+ nRetValue = rParaLevel.mnAdjust;
+ if ( pParaLevel && ( nRetValue != pParaLevel->mnAdjust ) )
+ bIsHardAttribute = 1;
+ }
+ break;
+ case PPT_ParaAttr_LineFeed :
+ {
+ nRetValue = rParaLevel.mnLineFeed;
+ if ( pParaLevel && ( nRetValue != pParaLevel->mnLineFeed ) )
+ bIsHardAttribute = 1;
+ }
+ break;
+ case PPT_ParaAttr_UpperDist :
+ {
+ nRetValue = rParaLevel.mnUpperDist;
+ if ( pParaLevel && ( nRetValue != pParaLevel->mnUpperDist ) )
+ bIsHardAttribute = 1;
+ }
+ break;
+ case PPT_ParaAttr_LowerDist :
+ {
+ nRetValue = rParaLevel.mnLowerDist;
+ if ( pParaLevel && ( nRetValue != pParaLevel->mnLowerDist ) )
+ bIsHardAttribute = 1;
+ }
+ break;
+ case PPT_ParaAttr_TextOfs :
+ {
+ nRetValue = rParaLevel.mnTextOfs;
+ if ( pParaLevel && ( nRetValue != pParaLevel->mnTextOfs ) )
+ bIsHardAttribute = 1;
+ }
+ break;
+ case PPT_ParaAttr_BulletOfs :
+ {
+ nRetValue = rParaLevel.mnBulletOfs;
+ if ( pParaLevel && ( nRetValue != pParaLevel->mnBulletOfs ) )
+ bIsHardAttribute = 1;
+ }
+ break;
+ case PPT_ParaAttr_DefaultTab :
+ {
+ nRetValue = rParaLevel.mnDefaultTab;
+ if ( pParaLevel && ( nRetValue != pParaLevel->mnBulletOfs ) )
+ bIsHardAttribute = 1;
+ }
+ break;
+ case PPT_ParaAttr_AsianLB_1 :
+ {
+ nRetValue = rParaLevel.mnAsianLineBreak & 1;
+ if ( pParaLevel && ( nRetValue != ( (sal_uInt32)pParaLevel->mnAsianLineBreak & 1 ) ) )
+ bIsHardAttribute = 1;
+ }
+ break;
+ case PPT_ParaAttr_AsianLB_2 :
+ {
+ nRetValue = ( rParaLevel.mnAsianLineBreak >> 1 ) & 1;
+ if ( pParaLevel && ( nRetValue != ( ( (sal_uInt32)pParaLevel->mnAsianLineBreak >> 1 ) & 1 ) ) )
+ bIsHardAttribute = 1;
+ }
+ break;
+ case PPT_ParaAttr_AsianLB_3 :
+ {
+ nRetValue = ( rParaLevel.mnAsianLineBreak >> 2 ) & 1;
+ if ( pParaLevel && ( nRetValue != ( ( (sal_uInt32)pParaLevel->mnAsianLineBreak >> 2 ) & 1 ) ) )
+ bIsHardAttribute = 1;
+ }
+ break;
+ case PPT_ParaAttr_BiDi :
+ {
+ nRetValue = rParaLevel.mnBiDi;
+ if ( pParaLevel && ( nRetValue != pParaLevel->mnBiDi ) )
+ bIsHardAttribute = 1;
+ }
+ break;
+ }
+ }
+ return (BOOL)bIsHardAttribute;
+}
+
+void PPTParagraphObj::ApplyTo( SfxItemSet& rSet, boost::optional< sal_Int16 >& rStartNumbering, SdrPowerPointImport& rManager, sal_uInt32 nDestinationInstance, const PPTParagraphObj* /*pPrev*/)
+{
+ INT16 nVal2;
+ UINT32 nVal, nUpperDist, nLowerDist;
+ UINT32 nInstance = nDestinationInstance != 0xffffffff ? nDestinationInstance : mnInstance;
+
+ if ( ( nDestinationInstance != 0xffffffff ) || ( pParaSet->mnDepth <= 1 ) )
+ {
+ SvxNumBulletItem* pNumBulletItem = mrStyleSheet.mpNumBulletItem[ nInstance ];
+ if ( pNumBulletItem )
+ {
+ SvxNumberFormat aNumberFormat( SVX_NUM_NUMBER_NONE );
+ if ( GetNumberFormat( rManager, aNumberFormat, this, nDestinationInstance, rStartNumbering ) )
+ {
+ if ( aNumberFormat.GetNumberingType() == SVX_NUM_NUMBER_NONE )
+ {
+ aNumberFormat.SetLSpace( 0 );
+ aNumberFormat.SetAbsLSpace( 0 );
+ aNumberFormat.SetFirstLineOffset( 0 );
+ aNumberFormat.SetCharTextDistance( 0 );
+ aNumberFormat.SetFirstLineIndent( 0 );
+ aNumberFormat.SetIndentAt( 0 );
+ }
+ SvxNumBulletItem aNewNumBulletItem( *pNumBulletItem );
+ SvxNumRule* pRule = aNewNumBulletItem.GetNumRule();
+ if ( pRule )
+ {
+ pRule->SetLevel( pParaSet->mnDepth, aNumberFormat );
+ sal_uInt16 i, n;
+ for ( i = 0; i < pRule->GetLevelCount(); i++ )
+ {
+ if ( i != pParaSet->mnDepth )
+ {
+ n = i > 4 ? 4 : i;
+
+ SvxNumberFormat aNumberFormat2( pRule->GetLevel( i ) );
+ const PPTParaLevel& rParaLevel = mrStyleSheet.mpParaSheet[ nInstance ]->maParaLevel[ n ];
+ const PPTCharLevel& rCharLevel = mrStyleSheet.mpCharSheet[ nInstance ]->maCharLevel[ n ];
+ sal_uInt32 nColor;
+ if ( rParaLevel.mnBuFlags & ( 1 << PPT_ParaAttr_BuHardColor ) )
+ nColor = rParaLevel.mnBulletColor;
+ else
+ nColor = rCharLevel.mnFontColor;
+ aNumberFormat2.SetBulletColor( rManager.MSO_TEXT_CLR_ToColor( nColor ) );
+ pRule->SetLevel( i, aNumberFormat2 );
+ }
+ }
+ rSet.Put( aNewNumBulletItem );
+ }
+ }
+ }
+ }
+
+ UINT32 nIsBullet2, _nTextOfs, _nBulletOfs, nHardAttribute = 0;
+ GetAttrib( PPT_ParaAttr_BulletOn, nIsBullet2, nDestinationInstance );
+ nHardAttribute += GetAttrib( PPT_ParaAttr_TextOfs, _nTextOfs, nDestinationInstance );
+ nHardAttribute += GetAttrib( PPT_ParaAttr_BulletOfs, _nBulletOfs, nDestinationInstance );
+ if ( !nIsBullet2 )
+ {
+ SvxLRSpaceItem aLRSpaceItem( EE_PARA_LRSPACE );
+ UINT16 nAbsLSpace = (UINT16)( ( (UINT32)_nTextOfs * 2540 ) / 576 );
+ UINT16 nFirstLineOffset = nAbsLSpace - (UINT16)( ( (UINT32)_nBulletOfs * 2540 ) / 576 );
+ aLRSpaceItem.SetLeft( nAbsLSpace );
+ aLRSpaceItem.SetTxtFirstLineOfstValue( -nFirstLineOffset );
+ rSet.Put( aLRSpaceItem );
+ }
+ else
+ {
+ SvxLRSpaceItem aLRSpaceItem( EE_PARA_LRSPACE );
+ aLRSpaceItem.SetLeft( 0 );
+ aLRSpaceItem.SetTxtFirstLineOfstValue( 0 );
+ rSet.Put( aLRSpaceItem );
+ }
+ if ( GetAttrib( PPT_ParaAttr_Adjust, nVal, nDestinationInstance ) )
+ {
+ if ( nVal <= 3 )
+ { // Absatzausrichtung
+ static SvxAdjust __READONLY_DATA aAdj[ 4 ] = { SVX_ADJUST_LEFT, SVX_ADJUST_CENTER, SVX_ADJUST_RIGHT, SVX_ADJUST_BLOCK };
+ rSet.Put( SvxAdjustItem( aAdj[ nVal ], EE_PARA_JUST ) );
+ }
+ }
+
+ if ( GetAttrib( PPT_ParaAttr_AsianLB_1, nVal, nDestinationInstance ) )
+ rSet.Put( SfxBoolItem( EE_PARA_FORBIDDENRULES, nVal != 0 ) );
+ if ( GetAttrib( PPT_ParaAttr_AsianLB_3, nVal, nDestinationInstance ) )
+ rSet.Put( SfxBoolItem( EE_PARA_HANGINGPUNCTUATION, nVal != 0 ) );
+
+ if ( GetAttrib( PPT_ParaAttr_BiDi, nVal, nDestinationInstance ) )
+ rSet.Put( SvxFrameDirectionItem( nVal == 1 ? FRMDIR_HORI_RIGHT_TOP : FRMDIR_HORI_LEFT_TOP, EE_PARA_WRITINGDIR ) );
+
+ // LineSpacing
+ PPTPortionObj* pPortion = First();
+ BOOL bIsHardAttribute = GetAttrib( PPT_ParaAttr_LineFeed, nVal, nDestinationInstance );
+ nVal2 = (INT16)nVal;
+ sal_uInt32 nFont = sal_uInt32();
+ if ( pPortion && pPortion->GetAttrib( PPT_CharAttr_Font, nFont, nDestinationInstance ) )
+ bIsHardAttribute = TRUE;
+
+ if ( bIsHardAttribute )
+ {
+ if ( pPortion && ( nVal2 > 200 ) )
+ {
+ UINT32 nFontHeight;
+ pPortion->GetAttrib( PPT_CharAttr_FontHeight, nFontHeight, nDestinationInstance );
+ nVal2 = -(sal_Int16)( ( nFontHeight * nVal * 8 ) / 100 );
+ }
+ rSet.Put( SdrTextFixedCellHeightItem( TRUE ), SDRATTR_TEXT_USEFIXEDCELLHEIGHT );
+ SvxLineSpacingItem aItem( 200, EE_PARA_SBL );
+ if ( nVal2 <= 0 )
+ aItem.SetLineHeight( (UINT16)( rManager.ScalePoint( -nVal2 ) / 8 ) );
+ else
+ {
+ sal_uInt8 nPropLineSpace = (BYTE)nVal2;
+ aItem.SetPropLineSpace( nPropLineSpace );
+ aItem.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO;
+ }
+ rSet.Put( aItem );
+ }
+
+ // Paragraph Spacing
+ UINT32 nFontHeight = 0;
+ bIsHardAttribute = ( (UINT32)GetAttrib( PPT_ParaAttr_UpperDist, nUpperDist, nDestinationInstance ) +
+ (UINT32)GetAttrib( PPT_ParaAttr_LowerDist, nLowerDist, nDestinationInstance ) ) != 0;
+ if ( ( nUpperDist > 0 ) || ( nLowerDist > 0 ) )
+ {
+ if ( mnPortionCount )
+ {
+ mpPortionList[ mnPortionCount - 1 ]->GetAttrib( PPT_CharAttr_FontHeight, nFontHeight, nDestinationInstance );
+ if ( ((INT16)nUpperDist) > 0 )
+ nUpperDist = - (sal_Int16)( ( nFontHeight * nUpperDist * 100 ) / 1000 );
+ if ( ((INT16)nLowerDist) > 0 )
+ nLowerDist = - (sal_Int16)( ( nFontHeight * nLowerDist * 100 ) / 1000 );
+ }
+ bIsHardAttribute = TRUE;
+ }
+ if ( bIsHardAttribute )
+ {
+ SvxULSpaceItem aULSpaceItem( EE_PARA_ULSPACE );
+ nVal2 = (INT16)nUpperDist;
+ if ( nVal2 <= 0 )
+ aULSpaceItem.SetUpper( (UINT16)(((UINT32) - nVal2 * 2540 ) / ( 72 * 8 ) ) );
+ else
+ {
+ aULSpaceItem.SetUpperValue( 0 );
+ aULSpaceItem.SetPropUpper( (UINT16)nUpperDist == 100 ? 101 : (UINT16)nUpperDist );
+ }
+ nVal2 = (INT16)nLowerDist;
+ if ( nVal2 <= 0 )
+ aULSpaceItem.SetLower( (UINT16)(((UINT32) - nVal2 * 2540 ) / ( 72 * 8 ) ) );
+ else
+ {
+ aULSpaceItem.SetLowerValue( 0 );
+ aULSpaceItem.SetPropLower( (UINT16)nLowerDist == 100 ? 101 : (UINT16)nLowerDist );
+ }
+ rSet.Put( aULSpaceItem );
+ }
+
+ if ( mbTab ) // makes it sense to apply tabsettings
+ {
+ UINT32 i, nDefaultTab, nTab, nTextOfs2 = 0;
+ UINT32 nLatestManTab = 0;
+ GetAttrib( PPT_ParaAttr_TextOfs, nTextOfs2, nDestinationInstance );
+ GetAttrib( PPT_ParaAttr_BulletOfs, nTab, nDestinationInstance );
+ GetAttrib( PPT_ParaAttr_BulletOn, i, nDestinationInstance );
+ GetAttrib( PPT_ParaAttr_DefaultTab, nDefaultTab, nDestinationInstance );
+ SvxTabStopItem aTabItem( 0, 0, SVX_TAB_ADJUST_DEFAULT, EE_PARA_TABS );
+ if ( GetTabCount() )
+ {
+ for ( i = 0; i < GetTabCount(); i++ )
+ {
+ SvxTabAdjust eTabAdjust;
+ nTab = GetTabOffsetByIndex( (sal_uInt16)i );
+ switch( GetTabStyleByIndex( (sal_uInt16)i ) )
+ {
+ case 1 : eTabAdjust = SVX_TAB_ADJUST_CENTER; break;
+ case 2 : eTabAdjust = SVX_TAB_ADJUST_RIGHT; break;
+ case 3 : eTabAdjust = SVX_TAB_ADJUST_DECIMAL; break;
+ default : eTabAdjust = SVX_TAB_ADJUST_LEFT;
+ }
+ if ( nTab > nTextOfs2 )
+ aTabItem.Insert( SvxTabStop( (UINT16)( ( ( nTab - nTextOfs2 ) * 2540 ) / 576 ), eTabAdjust ) );
+ }
+ nLatestManTab = nTab;
+ }
+ if ( nIsBullet2 == 0 )
+ aTabItem.Insert( SvxTabStop( (sal_uInt16)0 ) );
+ if ( nDefaultTab )
+ {
+ nTab = ( nTextOfs2 > nLatestManTab ) ? nTextOfs2 : nLatestManTab;
+ nTab /= nDefaultTab;
+ nTab = nDefaultTab * ( 1 + nTab );
+ for ( i = 0; ( i < 20 ) && ( nTab < 0x1b00 ); i++ )
+ {
+ aTabItem.Insert( SvxTabStop( (UINT16)( ( ( nTab - nTextOfs2 ) * 2540 ) / 576 ) ) );
+ nTab += nDefaultTab;
+ }
+ }
+ rSet.Put( aTabItem );
+ }
+}
+
+UINT32 PPTParagraphObj::GetTextSize()
+{
+ UINT32 nCount, nRetValue = 0;
+ for ( UINT32 i = 0; i < mnPortionCount; i++ )
+ {
+ PPTPortionObj* pPortionObj = mpPortionList[ i ];
+ nCount = pPortionObj->Count();
+ if ( ( !nCount ) && pPortionObj->mpFieldItem )
+ nCount++;
+ nRetValue += nCount;
+ }
+ return nRetValue;
+}
+
+PPTPortionObj* PPTParagraphObj::First()
+{
+ mnCurrentObject = 0;
+ if ( !mnPortionCount )
+ return NULL;
+ return mpPortionList[ 0 ];
+}
+
+PPTPortionObj* PPTParagraphObj::Next()
+{
+ UINT32 i = mnCurrentObject + 1;
+ if ( i >= mnPortionCount )
+ return NULL;
+ mnCurrentObject++;
+ return mpPortionList[ i ];
+}
+
+void PPTParagraphObj::ImplClear()
+{
+ for ( void* pPtr = First(); pPtr; pPtr = Next() )
+ delete (PPTPortionObj*)pPtr;
+ delete[] mpPortionList;
+}
+
+PPTFieldEntry::~PPTFieldEntry()
+{
+ delete pField1;
+ delete pField2;
+ delete pString;
+};
+
+void PPTFieldEntry::GetDateTime( const sal_uInt32 nVal, SvxDateFormat& eDateFormat, SvxTimeFormat& eTimeFormat )
+{
+ eDateFormat = SVXDATEFORMAT_APPDEFAULT;
+ eTimeFormat = SVXTIMEFORMAT_APPDEFAULT;
+ // ID auswerten
+ switch( nVal )
+ {
+ case 0:
+ case 6:
+ eDateFormat = SVXDATEFORMAT_A;
+ break;
+ case 1:
+ eDateFormat = SVXDATEFORMAT_F;
+ break;
+ case 2:
+ case 3:
+ eDateFormat = SVXDATEFORMAT_D;
+ break;
+ case 4:
+ case 5:
+ eDateFormat = SVXDATEFORMAT_C;
+ break;
+ case 7:
+ eDateFormat = SVXDATEFORMAT_A;
+ case 9:
+ eTimeFormat = SVXTIMEFORMAT_24_HM;
+ break;
+ case 8:
+ eDateFormat = SVXDATEFORMAT_A;
+ case 11:
+ eTimeFormat = SVXTIMEFORMAT_12_HM;
+ break;
+ case 10:
+ eTimeFormat = SVXTIMEFORMAT_24_HMS;
+ break;
+ case 12:
+ eTimeFormat = SVXTIMEFORMAT_12_HMS;
+ break;
+ }
+}
+
+void PPTFieldEntry::SetDateTime( UINT32 nVal )
+{
+ SvxDateFormat eDateFormat;
+ SvxTimeFormat eTimeFormat;
+ GetDateTime( nVal, eDateFormat, eTimeFormat );
+ if ( eDateFormat != SVXDATEFORMAT_APPDEFAULT )
+ pField1 = new SvxFieldItem( SvxDateField( Date(), SVXDATETYPE_VAR, eDateFormat ), EE_FEATURE_FIELD );
+ if ( eTimeFormat != SVXTIMEFORMAT_APPDEFAULT )
+ {
+ SvxFieldItem* pFieldItem = new SvxFieldItem( SvxExtTimeField( Time(), SVXTIMETYPE_VAR, eTimeFormat ), EE_FEATURE_FIELD );
+ if ( pField1 )
+ pField2 = pFieldItem;
+ else
+ pField1 = pFieldItem;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport, PptSlidePersistEntry& rPersistEntry, DffObjData* pObjData ) :
+ mpImplTextObj ( new ImplPPTTextObj( rPersistEntry ) )
+{
+ mpImplTextObj->mnRefCount = 1;
+ mpImplTextObj->mnShapeId = 0;
+ mpImplTextObj->mnShapeMaster = 0;
+ mpImplTextObj->mpPlaceHolderAtom = NULL;
+ mpImplTextObj->mnDestinationInstance = mpImplTextObj->mnInstance = 4;
+ mpImplTextObj->mnCurrentObject = 0;
+ mpImplTextObj->mnParagraphCount = 0;
+ mpImplTextObj->mpParagraphList = NULL;
+ mpImplTextObj->mnTextFlags = 0;
+ mpImplTextObj->meShapeType = ( pObjData && pObjData->bShapeType ) ? pObjData->eShapeType : mso_sptMin;
+
+ DffRecordHeader aExtParaHd;
+ aExtParaHd.nRecType = 0; // set empty
+
+ UINT32 bStatus = TRUE;
+
+ DffRecordHeader aShapeContainerHd;
+ rIn >> aShapeContainerHd;
+
+ if ( ( pObjData == NULL ) || ( pObjData->bShapeType ) )
+ {
+ PPTExtParaProv* pExtParaProv = rSdrPowerPointImport.pPPTStyleSheet->pExtParaProv;
+ if ( pObjData )
+ {
+ mpImplTextObj->mnShapeId = pObjData->nShapeId;
+ if ( pObjData->nSpFlags & SP_FHAVEMASTER )
+ mpImplTextObj->mnShapeMaster = rSdrPowerPointImport.GetPropertyValue( DFF_Prop_hspMaster, 0 );
+ }
+ ////////////////
+ // ClientData //
+ ////////////////
+ if ( rSdrPowerPointImport.maShapeRecords.SeekToContent( rIn, DFF_msofbtClientData, SEEK_FROM_CURRENT_AND_RESTART ) )
+ {
+ UINT32 nOldPos = rIn.Tell();
+ DffRecordHeader& aClientDataContainerHd = *rSdrPowerPointImport.maShapeRecords.Current();
+ DffRecordHeader aPlaceHolderAtomHd;
+ if ( rSdrPowerPointImport.SeekToRec( rIn, PPT_PST_OEPlaceholderAtom, aClientDataContainerHd.GetRecEndFilePos(), &aPlaceHolderAtomHd ) )
+ {
+ mpImplTextObj->mpPlaceHolderAtom = new PptOEPlaceholderAtom;
+ rIn >> *( mpImplTextObj->mpPlaceHolderAtom );
+ }
+ rIn.Seek( nOldPos );
+ DffRecordHeader aProgTagHd;
+ if ( rSdrPowerPointImport.SeekToContentOfProgTag( 9, rIn, aClientDataContainerHd, aProgTagHd ) )
+ {
+ rIn >> aExtParaHd;
+ }
+ }
+
+ ///////////////////
+ // ClientTextBox //
+ ///////////////////
+ if ( rSdrPowerPointImport.maShapeRecords.SeekToContent( rIn, DFF_msofbtClientTextbox, SEEK_FROM_CURRENT_AND_RESTART ) )
+ {
+ DffRecordHeader aClientTextBoxHd( *rSdrPowerPointImport.maShapeRecords.Current() );
+ UINT32 nTextRulerAtomOfs = 0; // case of zero -> this atom may be found in aClientDataContainerHd;
+ // case of -1 -> ther is no atom of this kind
+ // else -> this is the fileofs where we can get it
+
+ //////////////////////////////////////
+ // checkout if this is a referenced //
+ // textobj, if so the we will patch //
+ // the ClientTextBoxHd for a //
+ // equivalent one //
+ //////////////////////////////////////
+ DffRecordHeader aTextHd;
+ if ( rSdrPowerPointImport.SeekToRec( rIn, PPT_PST_OutlineTextRefAtom, aClientTextBoxHd.GetRecEndFilePos(), &aTextHd ) )
+ {
+ UINT32 nRefNum;
+ rIn >> nRefNum;
+
+ if ( rSdrPowerPointImport.SeekToRec( rIn, PPT_PST_TextRulerAtom, aClientTextBoxHd.GetRecEndFilePos() ) )
+ nTextRulerAtomOfs = rIn.Tell();
+ else
+ nTextRulerAtomOfs = 0xffffffff;
+
+ UINT32 nInstance = 0;
+ switch( rSdrPowerPointImport.eAktPageKind )
+ {
+ case PPT_NOTEPAGE :
+ nInstance++;
+ case PPT_MASTERPAGE :
+ nInstance++;
+ case PPT_SLIDEPAGE :
+ break;
+ default :
+ bStatus = FALSE;
+ }
+ if ( bStatus )
+ {
+ sal_uInt32 nSlideId = rSdrPowerPointImport.GetAktPageId();
+ if ( !nSlideId )
+ bStatus = FALSE;
+ else
+ {
+ if ( !aExtParaHd.nRecType )
+ {
+ UINT32 nOldPos = rIn.Tell();
+ // try to locate the referenced ExtendedParaHd
+ DffRecordHeader* pHd = pExtParaProv->
+ aExtendedPresRules.GetRecordHeader( PPT_PST_ExtendedParagraphHeaderAtom,
+ SEEK_FROM_CURRENT_AND_RESTART );
+ DffRecordHeader aPresRuleHd;
+ DffRecordHeader* pFirst = pHd;
+
+ UINT32 nTmpSlideId, nTmpRef;
+ while ( pHd )
+ {
+ pHd->SeekToContent( rIn );
+ rIn >> nTmpSlideId
+ >> nTmpRef; // this seems to be the instance
+
+ if ( ( nTmpSlideId == nSlideId ) && ( pHd->nRecInstance == nRefNum ) )
+ {
+ pHd->SeekToEndOfRecord( rIn );
+ rIn >> aPresRuleHd;
+ if ( aPresRuleHd.nRecType == PPT_PST_ExtendedParagraphAtom )
+ {
+ aExtParaHd = aPresRuleHd;
+ break;
+ }
+ }
+ pHd = pExtParaProv->
+ aExtendedPresRules.GetRecordHeader( PPT_PST_ExtendedParagraphHeaderAtom,
+ SEEK_FROM_CURRENT_AND_RESTART );
+ if ( pHd == pFirst )
+ break;
+ }
+ rIn.Seek( nOldPos );
+ }
+ // now pHd points to the right SlideListWithText Container
+ PptSlidePersistList* pPageList = rSdrPowerPointImport.GetPageList( rSdrPowerPointImport.eAktPageKind );
+ PptSlidePersistEntry* pE = NULL;
+ if ( pPageList && ( rSdrPowerPointImport.nAktPageNum < pPageList->Count() ) )
+ pE = (*pPageList)[ rSdrPowerPointImport.nAktPageNum ];
+ if ( (!pE) || (!pE->nSlidePersistStartOffset) || ( pE->aPersistAtom.nSlideId != nSlideId ) )
+ bStatus = sal_False;
+ else
+ {
+ rIn.Seek( pE->nSlidePersistStartOffset );
+ // now we got the right page and are searching for the right
+ // TextHeaderAtom
+ while ( rIn.Tell() < pE->nSlidePersistEndOffset )
+ {
+ rIn >> aClientTextBoxHd;
+ if ( aClientTextBoxHd.nRecType == PPT_PST_TextHeaderAtom )
+ {
+ if ( aClientTextBoxHd.nRecInstance == nRefNum )
+ {
+ aClientTextBoxHd.SeekToEndOfRecord( rIn );
+ break;
+ }
+ }
+ aClientTextBoxHd.SeekToEndOfRecord( rIn );
+ }
+ if ( rIn.Tell() > pE->nSlidePersistEndOffset )
+ bStatus = FALSE;
+ else
+ { // patching the RecordHeader
+ aClientTextBoxHd.nFilePos -= DFF_COMMON_RECORD_HEADER_SIZE;
+ aClientTextBoxHd.nRecLen += DFF_COMMON_RECORD_HEADER_SIZE;
+ aClientTextBoxHd.nRecType = DFF_msofbtClientTextbox;
+ aClientTextBoxHd.nRecVer = DFF_PSFLAG_CONTAINER;
+
+ // we have to calculate the correct record len
+ DffRecordHeader aTmpHd;
+ while ( rIn.Tell() < pE->nSlidePersistEndOffset )
+ {
+ rIn >> aTmpHd;
+ if ( ( aTmpHd.nRecType == PPT_PST_SlidePersistAtom ) || ( aTmpHd.nRecType == PPT_PST_TextHeaderAtom ) )
+ break;
+ aTmpHd.SeekToEndOfRecord( rIn );
+ aClientTextBoxHd.nRecLen += aTmpHd.nRecLen + DFF_COMMON_RECORD_HEADER_SIZE;
+ }
+ aClientTextBoxHd.SeekToContent( rIn );
+ }
+ }
+ }
+ }
+ }
+
+ if ( bStatus )
+ {
+ if ( rSdrPowerPointImport.SeekToRec( rIn, PPT_PST_TextHeaderAtom, aClientTextBoxHd.GetRecEndFilePos(), &aTextHd ) )
+ {
+ // TextHeaderAtom is always the first Atom
+ UINT16 nInstance;
+ rIn >> nInstance; // this number tells us the TxMasterStyleAtom Instance
+ if ( nInstance > 8 )
+ nInstance = 4;
+ aTextHd.SeekToEndOfRecord( rIn );
+ mpImplTextObj->mnInstance = nInstance;
+
+ UINT32 nFilePos = rIn.Tell();
+ if ( rSdrPowerPointImport.SeekToRec2( PPT_PST_TextBytesAtom,
+ PPT_PST_TextCharsAtom,
+ aClientTextBoxHd.GetRecEndFilePos() )
+ || rSdrPowerPointImport.SeekToRec( rIn,
+ PPT_PST_StyleTextPropAtom,
+ aClientTextBoxHd.GetRecEndFilePos() ) )
+ {
+ PPTTextRulerInterpreter aTextRulerInterpreter( nTextRulerAtomOfs, rSdrPowerPointImport,
+ aClientTextBoxHd, rIn );
+
+ PPTStyleTextPropReader aStyleTextPropReader( rIn, rSdrPowerPointImport, aClientTextBoxHd,
+ aTextRulerInterpreter, aExtParaHd, nInstance );
+ sal_uInt32 nParagraphs = mpImplTextObj->mnParagraphCount = aStyleTextPropReader.aParaPropList.Count();
+ if ( nParagraphs )
+ {
+ // the language settings will be merged into the list of PPTCharPropSet
+ DffRecordHeader aTextSpecInfoHd;
+ PPTTextSpecInfoAtomInterpreter aTextSpecInfoAtomInterpreter;
+ if ( rSdrPowerPointImport.SeekToRec( rIn, PPT_PST_TextSpecInfoAtom,
+ aClientTextBoxHd.GetRecEndFilePos(), &aTextSpecInfoHd ) )
+ {
+ if ( aTextSpecInfoAtomInterpreter.Read( rIn, aTextSpecInfoHd, PPT_PST_TextSpecInfoAtom,
+ &(rSdrPowerPointImport.pPPTStyleSheet->maTxSI) ) )
+ {
+ sal_uInt32 nI = 0;
+ PPTTextSpecInfo* pSpecInfo;
+ for ( pSpecInfo = (PPTTextSpecInfo*)aTextSpecInfoAtomInterpreter.aList.First();
+ pSpecInfo; pSpecInfo =(PPTTextSpecInfo*)aTextSpecInfoAtomInterpreter.aList.Next() )
+ {
+ sal_uInt32 nCharIdx = pSpecInfo->nCharIdx;
+
+ // portions and text have to been splitted in some cases
+ for ( ; nI < aStyleTextPropReader.aCharPropList.Count(); )
+ {
+ PPTCharPropSet* pSet = (PPTCharPropSet*)aStyleTextPropReader.aCharPropList.GetObject( nI );
+ if ( pSet->mnOriginalTextPos < nCharIdx )
+ {
+ pSet->mnLanguage[ 0 ] = pSpecInfo->nLanguage[ 0 ];
+ pSet->mnLanguage[ 1 ] = pSpecInfo->nLanguage[ 1 ];
+ pSet->mnLanguage[ 2 ] = pSpecInfo->nLanguage[ 2 ];
+ // test if the current portion needs to be splitted
+ if ( pSet->maString.Len() > 1 )
+ {
+ sal_Int32 nIndexOfNextPortion = pSet->maString.Len() + pSet->mnOriginalTextPos;
+ sal_Int32 nNewLen = nIndexOfNextPortion - nCharIdx;
+ sal_Int32 nOldLen = pSet->maString.Len() - nNewLen;
+
+ if ( ( nNewLen > 0 ) && ( nOldLen > 0 ) )
+ {
+ String aString( pSet->maString );
+ PPTCharPropSet* pNew = new PPTCharPropSet( *pSet );
+ pSet->maString = String( aString, 0, (sal_uInt16)nOldLen );
+ pNew->maString = String( aString, (sal_uInt16)nOldLen, (sal_uInt16)nNewLen );
+ pNew->mnOriginalTextPos += nOldLen;
+ aStyleTextPropReader.aCharPropList.Insert( pNew, nI + 1 );
+ }
+ }
+ }
+ else
+ break;
+ nI++;
+ }
+ }
+ }
+#ifdef DBG_UTIL
+ else
+ {
+ if (!(rSdrPowerPointImport.rImportParam.nImportFlags & PPT_IMPORTFLAGS_NO_TEXT_ASSERT))
+ {
+ DBG_ERROR( "SdrTextSpecInfoAtomInterpreter::Ctor(): parsing error, this document needs to be analysed (SJ)" );
+ }
+ }
+#endif
+ }
+ //
+ // 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;
+ while ( rIn.Tell() < aClientTextBoxHd.GetRecEndFilePos() )
+ {
+ rIn >> aTextHd;
+ UINT16 nVal = 0;
+ PPTFieldEntry* pEntry = NULL;
+ switch ( aTextHd.nRecType )
+ {
+ case PPT_PST_DateTimeMCAtom :
+ {
+ pEntry = new PPTFieldEntry;
+ rIn >> pEntry->nPos
+ >> nVal
+ >> nVal;
+ pEntry->SetDateTime( nVal & 0xff );
+ }
+ break;
+
+ case PPT_PST_FooterMCAtom :
+ {
+ pEntry = new PPTFieldEntry;
+ rIn >> pEntry->nPos;
+ pEntry->pField1 = new SvxFieldItem( SvxFooterField(), EE_FEATURE_FIELD );
+ }
+ break;
+
+ case PPT_PST_HeaderMCAtom :
+ {
+ pEntry = new PPTFieldEntry;
+ rIn >> pEntry->nPos;
+ pEntry->pField1 = new SvxFieldItem( SvxHeaderField(), EE_FEATURE_FIELD );
+ }
+ break;
+
+ case PPT_PST_GenericDateMCAtom :
+ {
+ pEntry = new PPTFieldEntry;
+ rIn >> pEntry->nPos;
+ pEntry->pField1 = new SvxFieldItem( SvxDateTimeField(), EE_FEATURE_FIELD );
+ if ( rPersistEntry.pHeaderFooterEntry ) // sj: #i34111# on master pages it is possible
+ { // that there is no HeaderFooterEntry available
+ if ( rPersistEntry.pHeaderFooterEntry->nAtom & 0x20000 ) // auto date time
+ pEntry->SetDateTime( rPersistEntry.pHeaderFooterEntry->nAtom & 0xff );
+ else
+ pEntry->pString = new String( rPersistEntry.pHeaderFooterEntry->pPlaceholder[ nVal ] );
+ }
+ }
+ break;
+
+ case PPT_PST_SlideNumberMCAtom :
+ case PPT_PST_RTFDateTimeMCAtom :
+ {
+ pEntry = new PPTFieldEntry;
+ if ( aTextHd.nRecLen >= 4 )
+ {
+ rIn >> pEntry->nPos
+ >> nVal;
+
+ // ID auswerten
+ //SvxFieldItem* pFieldItem = NULL;
+ switch( aTextHd.nRecType )
+ {
+ case PPT_PST_SlideNumberMCAtom:
+ pEntry->pField1 = new SvxFieldItem( SvxPageField(), EE_FEATURE_FIELD );
+ break;
+
+ case PPT_PST_RTFDateTimeMCAtom:
+ {
+ // Rude workaround for one specal case reported
+ // by a customer. (#i75203#)
+
+ // Don't even attempt to handle the general use
+ // case for PPT_PST_RTFDateTimeMCAtom (a generic
+ // MS style date/time format string). Just handle
+ // the special case where the format string
+ // contains only one or several possibly empty
+ // quoted strings. I.e. something that doesn't
+ // expand to any date or time at all, but to a
+ // fixed string. How on earth somebody manages to
+ // produce such things in PPT slides I have no
+ // idea.
+ if (nVal == 0)
+ {
+ sal_Unicode n;
+ xub_StrLen nLen;
+ String aStr;
+ bool inquote = FALSE;
+ for (nLen = 0, n = 0; nLen < 64; nLen++)
+ {
+ rIn >> n;
+
+ // Collect quoted characters into aStr
+ if ( n == '\'')
+ inquote = !inquote;
+ else if (!n)
+ {
+ // End of format string
+ pEntry->pString = new String( aStr );
+ break;
+ }
+ else if (!inquote)
+ {
+ // Non-quoted character, i.e. a real
+ // format specifier. We don't handle
+ // those. Sorry.
+ break;
+ }
+ else
+ {
+ aStr += n;
+ }
+ }
+ }
+ if ( pEntry->pString == NULL )
+ {
+ // Handle as previously
+ pEntry->pField1 = new SvxFieldItem( SvxDateField( Date(), SVXDATETYPE_FIX ), EE_FEATURE_FIELD );
+ }
+ }
+ }
+ }
+ }
+ break;
+
+ case PPT_PST_InteractiveInfo :
+ {
+ DffRecordHeader aHdInteractiveInfoAtom;
+ if ( rSdrPowerPointImport.SeekToRec( rIn, PPT_PST_InteractiveInfoAtom, aTextHd.GetRecEndFilePos(), &aHdInteractiveInfoAtom ) )
+ {
+ PptInteractiveInfoAtom aInteractiveInfoAtom;
+ rIn >> aInteractiveInfoAtom;
+ for ( SdHyperlinkEntry* pHyperlink = (SdHyperlinkEntry*)rSdrPowerPointImport.aHyperList.First();
+ pHyperlink; pHyperlink = (SdHyperlinkEntry*)rSdrPowerPointImport.aHyperList.Next() )
+ {
+ if ( pHyperlink->nIndex == aInteractiveInfoAtom.nExHyperlinkId )
+ {
+ aTextHd.SeekToEndOfRecord( rIn );
+ rIn >> aTextHd;
+ if ( aTextHd.nRecType != PPT_PST_TxInteractiveInfoAtom )
+ {
+ aTextHd.SeekToBegOfRecord( rIn );
+ continue;
+ }
+ else
+ {
+ sal_uInt32 nStartPos, nEndPos;
+ rIn >> nStartPos
+ >> nEndPos;
+ if ( nEndPos )
+ {
+ pEntry = new PPTFieldEntry;
+ pEntry->nPos = (sal_uInt16)nStartPos;
+ pEntry->nTextRangeEnd = (sal_uInt16)nEndPos;
+ String aTarget( pHyperlink->aTarget );
+ if ( pHyperlink->aConvSubString.Len() )
+ {
+ aTarget.Append( (sal_Unicode)'#' );
+ aTarget.Append( pHyperlink->aConvSubString );
+ }
+ pEntry->pField1 = new SvxFieldItem( SvxURLField( aTarget, String(), SVXURLFORMAT_REPR ), EE_FEATURE_FIELD );
+ }
+ }
+ break;
+ }
+ }
+ }
+ }
+ break;
+ }
+ aTextHd.SeekToEndOfRecord( rIn );
+ if ( pEntry )
+ {
+ if ( !pFieldList )
+ pFieldList = new List;
+ UINT32 n;
+ for ( n = 0; n < pFieldList->Count(); n++ )
+ { // sorting fields ( hi >> lo )
+ if ( ( (PPTFieldEntry*)pFieldList->GetObject( n ) )->nPos < pEntry->nPos )
+ break;
+ }
+ pFieldList->Insert( pEntry, (UINT32)n );
+ }
+ }
+ if ( pFieldList )
+ {
+ PPTFieldEntry* pFE = (PPTFieldEntry*)pFieldList->First();
+ List& aCharPropList = aStyleTextPropReader.aCharPropList;
+
+ sal_Int32 i = nParagraphs - 1;
+ sal_Int32 n = aCharPropList.Count() - 1;
+
+ // 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 ) )
+ {
+ PPTCharPropSet* pSet = (PPTCharPropSet*)aCharPropList.GetObject( n );
+ String aString( pSet->maString );
+ UINT32 nCount = aString.Len();
+ UINT32 nPos = pSet->mnOriginalTextPos + nCount;
+ while ( pFE && nCount-- )
+ {
+ nPos--;
+ while ( pFE && ( pFE->nPos > nPos ) )
+ pFE = (PPTFieldEntry*)pFieldList->Next();
+ if ( !pFE )
+ break;
+
+ if ( pFE->nPos == nPos )
+ {
+ if ( aString.GetChar( (sal_uInt16)nCount ) == 0x2a )
+ {
+ UINT32 nBehind = aString.Len() - ( nCount + 1 );
+ pSet->maString = String();
+ if ( nBehind )
+ {
+ PPTCharPropSet* pNewCPS = new PPTCharPropSet( *pSet );
+ pNewCPS->maString = String( aString, (UINT16)nCount + 1, (UINT16)nBehind );
+ aCharPropList.Insert( pNewCPS, n + 1 );
+ }
+ if ( pFE->pField2 )
+ {
+ PPTCharPropSet* pNewCPS = new PPTCharPropSet( *pSet );
+ pNewCPS->mpFieldItem = pFE->pField2, pFE->pField2 = NULL;
+ aCharPropList.Insert( pNewCPS, n + 1 );
+
+ pNewCPS = new PPTCharPropSet( *pSet );
+ pNewCPS->maString = String( String( RTL_CONSTASCII_USTRINGPARAM( " " ) ) );
+ aCharPropList.Insert( pNewCPS, n + 1 );
+ }
+ if ( nCount )
+ {
+ PPTCharPropSet* pNewCPS = new PPTCharPropSet( *pSet );
+ pNewCPS->maString = String( aString, (UINT16)0, (UINT16)nCount );
+ aCharPropList.Insert( pNewCPS, n++ );
+ }
+ if ( pFE->pField1 )
+ {
+ pSet->mpFieldItem = pFE->pField1, pFE->pField1 = NULL;
+ }
+ else if ( pFE->pString )
+ pSet->maString = *pFE->pString;
+ }
+ else
+ {
+ if ( pFE->nTextRangeEnd ) // text range hyperlink
+ {
+ sal_uInt32 nHyperLen = pFE->nTextRangeEnd - nPos;
+ if ( nHyperLen )
+ {
+ PPTCharPropSet* pBefCPS = NULL;
+ if ( nCount )
+ {
+ pBefCPS = new PPTCharPropSet( *pSet );
+ pSet->maString = String( pSet->maString, (UINT16)nCount, (UINT16)( pSet->maString.Len() - nCount ) );
+ }
+ sal_uInt32 nIdx = n;
+ sal_Int32 nHyperLenLeft = nHyperLen;
+
+ while ( ( aCharPropList.Count() > nIdx ) && nHyperLenLeft )
+ {
+ // the textrange hyperlink can take more than 1 paragraph
+ // the solution here is to clone the hyperlink...
+
+ PPTCharPropSet* pCurrent = (PPTCharPropSet*)aCharPropList.GetObject( nIdx );
+ sal_Int32 nNextStringLen = pCurrent->maString.Len();
+
+ const SvxURLField* pField = (const SvxURLField*)pFE->pField1->GetField();
+
+ if ( pCurrent->mpFieldItem )
+ {
+ pCurrent->SetColor( PPT_COLSCHEME_A_UND_HYPERLINK );
+ if ( pCurrent->mpFieldItem->GetField()->ISA( SvxURLField ) )
+ break;
+ nHyperLenLeft--;
+ }
+ else if ( nNextStringLen )
+ {
+ if ( nNextStringLen <= nHyperLenLeft )
+ {
+ pCurrent->mpFieldItem = new SvxFieldItem( SvxURLField( pField->GetURL(), pCurrent->maString, SVXURLFORMAT_REPR ), EE_FEATURE_FIELD );
+ nHyperLenLeft -= nNextStringLen;
+
+ if ( nHyperLenLeft )
+ {
+ // if the next portion is in a higher paragraph,
+ // the textrange is to decrease (because of the LineBreak character)
+ if ( aCharPropList.Count() > ( nIdx + 1 ) )
+ {
+ PPTCharPropSet* pNext = (PPTCharPropSet*)aCharPropList.GetObject( nIdx + 1 );
+ if ( pNext->mnParagraph > pCurrent->mnParagraph )
+ nHyperLenLeft--;
+ }
+ }
+ }
+ else
+ {
+ PPTCharPropSet* pNewCPS = new PPTCharPropSet( *pCurrent );
+ pNewCPS->maString = String( pCurrent->maString, (UINT16)nHyperLenLeft, (UINT16)( nNextStringLen - nHyperLenLeft ) );
+ aCharPropList.Insert( pNewCPS, nIdx + 1 );
+ String aRepresentation( pCurrent->maString, 0, (UINT16)nHyperLenLeft );
+ pCurrent->mpFieldItem = new SvxFieldItem( SvxURLField( pField->GetURL(), aRepresentation, SVXURLFORMAT_REPR ), EE_FEATURE_FIELD );
+ nHyperLenLeft = 0;
+ }
+ pCurrent->maString = String();
+ pCurrent->SetColor( PPT_COLSCHEME_A_UND_HYPERLINK );
+ }
+ nIdx++;
+ }
+ delete pFE->pField1, pFE->pField1 = NULL;
+
+ if ( pBefCPS )
+ {
+ pBefCPS->maString = String( aString, (UINT16)0, (UINT16)nCount );
+ aCharPropList.Insert( pBefCPS, n++ );
+
+ }
+ }
+ }
+ }
+ break;
+ }
+ }
+ n--;
+ }
+ for ( void* pPtr = pFieldList->First(); pPtr; pPtr = pFieldList->Next() )
+ delete (PPTFieldEntry*)pPtr;
+ delete pFieldList;
+ }
+ mpImplTextObj->mpParagraphList = new PPTParagraphObj*[ nParagraphs ];
+ aStyleTextPropReader.aCharPropList.First();
+ UINT32 nCount = 0;
+ for ( void* pPtr = aStyleTextPropReader.aParaPropList.First();
+ pPtr;
+ pPtr = aStyleTextPropReader.aParaPropList.Next() )
+ {
+ PPTParagraphObj* pPara = new PPTParagraphObj( aStyleTextPropReader, *rSdrPowerPointImport.pPPTStyleSheet, nInstance, aTextRulerInterpreter );
+ mpImplTextObj->mpParagraphList[ nCount++ ] = pPara;
+
+ sal_uInt32 nParaAdjust, nFlags = 0;
+ pPara->GetAttrib( PPT_ParaAttr_Adjust, nParaAdjust, GetInstance() );
+
+ switch ( nParaAdjust )
+ {
+ case 0 : nFlags = PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_LEFT; break;
+ case 1 : nFlags = PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_CENTER; break;
+ case 2 : nFlags = PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_RIGHT; break;
+ case 3 : nFlags = PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_BLOCK; break;
+ }
+ mpImplTextObj->mnTextFlags |= nFlags;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+PPTTextObj::PPTTextObj( PPTTextObj& rTextObj )
+{
+ mpImplTextObj = rTextObj.mpImplTextObj;
+ mpImplTextObj->mnRefCount++;
+}
+
+PPTTextObj::~PPTTextObj()
+{
+ ImplClear();
+}
+
+PPTParagraphObj* PPTTextObj::First()
+{
+ mpImplTextObj->mnCurrentObject = 0;
+ if ( !mpImplTextObj->mnParagraphCount )
+ return NULL;
+ return mpImplTextObj->mpParagraphList[ 0 ];
+}
+
+PPTParagraphObj* PPTTextObj::Next()
+{
+ UINT32 i = mpImplTextObj->mnCurrentObject + 1;
+ if ( i >= mpImplTextObj->mnParagraphCount )
+ return NULL;
+ mpImplTextObj->mnCurrentObject++;
+ return mpImplTextObj->mpParagraphList[ i ];
+}
+
+const SfxItemSet* PPTTextObj::GetBackground() const
+{
+ if ( mpImplTextObj->mrPersistEntry.pBObj )
+ return &mpImplTextObj->mrPersistEntry.pBObj->GetMergedItemSet();
+ else
+ return NULL;
+}
+
+void PPTTextObj::ImplClear()
+{
+ if ( ! ( --mpImplTextObj->mnRefCount ) )
+ {
+ for ( PPTParagraphObj* pPtr = First(); pPtr; pPtr = Next() )
+ delete pPtr;
+ delete[] mpImplTextObj->mpParagraphList;
+ delete mpImplTextObj->mpPlaceHolderAtom;
+ delete mpImplTextObj;
+ }
+}
+
+PPTTextObj& PPTTextObj::operator=( PPTTextObj& rTextObj )
+{
+ if ( this != &rTextObj )
+ {
+ ImplClear();
+ mpImplTextObj = rTextObj.mpImplTextObj;
+ mpImplTextObj->mnRefCount++;
+ }
+ return *this;
+}
+
+sal_Bool IsLine( const SdrObject* pObj )
+{
+ return pObj->ISA( SdrPathObj ) && ((SdrPathObj*)pObj)->IsLine() && (((SdrPathObj*)pObj)->GetPointCount() == 2 );
+}
+
+sal_Bool GetCellPosition( const SdrObject* pObj, const std::set< sal_Int32 >& rRows, const std::set< sal_Int32 >& rColumns,
+ sal_Int32& nTableIndex, sal_Int32& nRow, sal_Int32& nRowCount, sal_Int32& nColumn, sal_Int32& nColumnCount )
+{
+ Rectangle aSnapRect( pObj->GetSnapRect() );
+ sal_Bool bCellObject = ( aSnapRect.GetWidth() > 1 ) && ( aSnapRect.GetHeight() > 1 );
+ if ( bCellObject )
+ {
+ std::set< sal_Int32 >::const_iterator aRowIter( rRows.find( aSnapRect.Top() ) );
+ std::set< sal_Int32 >::const_iterator aColumnIter( rColumns.find( aSnapRect.Left() ) );
+ if ( ( aRowIter == rRows.end() ) || ( aColumnIter == rColumns.end() ) )
+ bCellObject = sal_False;
+ else
+ {
+ nRowCount = 1;
+ nRow = std::distance( rRows.begin(), aRowIter );
+ while( ++aRowIter != rRows.end() )
+ {
+ if ( *aRowIter >= aSnapRect.Bottom() )
+ break;
+ nRowCount++;
+ }
+ nColumnCount = 1;
+ nColumn = std::distance( rColumns.begin(), aColumnIter );
+ while( ++aColumnIter != rColumns.end() )
+ {
+ if ( *aColumnIter >= aSnapRect.Right() )
+ break;
+ nColumnCount++;
+ }
+ nTableIndex = nRow * rColumns.size() + nColumn;
+ }
+ }
+ return bCellObject;
+}
+
+#define LinePositionLeft 0x01000000
+#define LinePositionTop 0x02000000
+#define LinePositionRight 0x04000000
+#define LinePositionBottom 0x08000000
+#define LinePositionTLBR 0x10000000
+#define LinePositionBLTR 0x20000000
+
+
+void GetRowPositions( const Rectangle& rSnapRect, const std::set< sal_Int32 >& rRows,
+ const std::set< sal_Int32 >& rColumns, std::vector< sal_Int32 >& rPositions, sal_Int32 nColumn, sal_Int32 nFlags )
+{
+ std::set< sal_Int32 >::const_iterator aRow( rRows.find( rSnapRect.Top() ) );
+ if ( aRow != rRows.end() )
+ {
+ sal_Int32 nRow = std::distance( rRows.begin(), aRow );
+ while( ( aRow != rRows.end() ) && ((*aRow) < rSnapRect.Bottom() ) )
+ {
+ if ( nFlags & LinePositionLeft )
+ rPositions.push_back( ( ( nRow * rColumns.size() ) + nColumn ) | LinePositionLeft );
+ if ( nFlags & LinePositionRight )
+ rPositions.push_back( ( ( nRow * rColumns.size() ) + ( nColumn - 1 ) ) | LinePositionRight );
+
+ nRow++;
+ aRow++;
+ }
+ }
+}
+
+
+void GetColumnPositions( const Rectangle& rSnapRect, const std::set< sal_Int32 >& /* rRows */,
+ const std::set< sal_Int32 >& rColumns, std::vector< sal_Int32 >& rPositions, sal_Int32 nRow, sal_Int32 nFlags )
+{
+ std::set< sal_Int32 >::const_iterator aColumn( rColumns.find( rSnapRect.Left() ) );
+ if ( aColumn != rColumns.end() )
+ {
+ sal_Int32 nColumn = std::distance( rColumns.begin(), aColumn );
+ while( ( aColumn != rColumns.end() ) && ((*aColumn) < rSnapRect.Right() ) )
+ {
+ if ( nFlags & LinePositionTop )
+ rPositions.push_back( ( ( nRow * rColumns.size() ) + nColumn ) | LinePositionTop );
+ if ( nFlags & LinePositionBottom )
+ rPositions.push_back( ( ( ( nRow - 1 ) * rColumns.size() ) + nColumn ) | LinePositionBottom );
+
+ nColumn++;
+ aColumn++;
+ }
+ }
+}
+
+void GetLinePositions( const SdrObject* pObj, const std::set< sal_Int32 >& rRows, const std::set< sal_Int32 >& rColumns,
+ std::vector< sal_Int32 >& rPositions, const Rectangle& rGroupSnap )
+{
+ Rectangle aSnapRect( pObj->GetSnapRect() );
+ if ( aSnapRect.Left() == aSnapRect.Right() )
+ {
+ std::set< sal_Int32 >::const_iterator aColumn( rColumns.find( aSnapRect.Left() ) );
+ if ( ( aColumn != rColumns.end() ) || ( aSnapRect.Left() == rGroupSnap.Right() ) )
+ {
+ sal_Int32 nColumn, nFlags;
+ if ( aColumn != rColumns.end() )
+ {
+ nColumn = std::distance( rColumns.begin(), aColumn );
+ nFlags = LinePositionLeft;
+ if ( aColumn != rColumns.begin() )
+ nFlags |= LinePositionRight;
+ }
+ else
+ {
+ nColumn = rColumns.size();
+ nFlags = LinePositionRight;
+ }
+ GetRowPositions( aSnapRect, rRows, rColumns, rPositions, nColumn, nFlags );
+ }
+ }
+ else if ( aSnapRect.Top() == aSnapRect.Bottom() )
+ {
+ std::set< sal_Int32 >::const_iterator aRow( rRows.find( aSnapRect.Top() ) );
+ if ( ( aRow != rRows.end() ) || ( aSnapRect.Top() == rGroupSnap.Bottom() ) )
+ {
+ sal_Int32 nRow, nFlags;
+ if ( aRow != rRows.end() )
+ {
+ nRow = std::distance( rRows.begin(), aRow );
+ nFlags = LinePositionTop;
+ if ( aRow != rRows.begin() )
+ nFlags |= LinePositionBottom;
+ }
+ else
+ {
+ nRow = rRows.size();
+ nFlags = LinePositionBottom;
+ }
+ GetColumnPositions( aSnapRect, rRows, rColumns, rPositions, nRow, nFlags );
+ }
+ }
+ else
+ {
+ sal_uInt32 nPosition = 0;
+ Point aPt1( ((SdrPathObj*)pObj)->GetPoint( 0 ) );
+ Point aPt2( ((SdrPathObj*)pObj)->GetPoint( 1 ) );
+ if ( aPt1.X() < aPt2.X() )
+ nPosition |= aPt1.Y() < aPt2.Y() ? LinePositionTLBR : LinePositionBLTR;
+ else
+ nPosition |= aPt1.Y() < aPt2.Y() ? LinePositionBLTR : LinePositionTLBR;
+
+ std::set< sal_Int32 >::const_iterator aRow( rRows.find( aPt1.Y() < aPt2.Y() ? aPt1.Y() : aPt2.Y() ) );
+ std::set< sal_Int32 >::const_iterator aColumn( rColumns.find( aPt1.X() < aPt2.X() ? aPt1.X() : aPt2.X() ) );
+ if ( ( aRow != rRows.end() ) && ( aColumn != rColumns.end() ) )
+ {
+ nPosition |= ( std::distance( rRows.begin(), aRow ) * rColumns.size() ) + std::distance( rColumns.begin(), aColumn );
+ rPositions.push_back( nPosition );
+ }
+ }
+}
+
+void CreateTableRows( Reference< XTableRows > xTableRows, const std::set< sal_Int32 >& rRows, sal_Int32 nTableBottom )
+{
+ if ( rRows.size() > 1 )
+ xTableRows->insertByIndex( 0, rRows.size() - 1 );
+
+ std::set< sal_Int32 >::const_iterator aIter( rRows.begin() );
+ sal_Int32 nLastPosition( *aIter );
+ Reference< XIndexAccess > xIndexAccess( xTableRows, UNO_QUERY_THROW );
+ for ( sal_Int32 n = 0; n < xIndexAccess->getCount(); n++ )
+ {
+ sal_Int32 nHeight;
+ if ( ++aIter != rRows.end() )
+ {
+ nHeight = *aIter - nLastPosition;
+ nLastPosition = *aIter;
+ }
+ else
+ nHeight = nTableBottom - nLastPosition;
+
+ static const rtl::OUString sWidth( RTL_CONSTASCII_USTRINGPARAM ( "Height" ) );
+ Reference< XPropertySet > xPropSet( xIndexAccess->getByIndex( n ), UNO_QUERY_THROW );
+ xPropSet->setPropertyValue( sWidth, Any( nHeight ) );
+ }
+}
+
+void CreateTableColumns( Reference< XTableColumns > xTableColumns, const std::set< sal_Int32 >& rColumns, sal_Int32 nTableRight )
+{
+ if ( rColumns.size() > 1 )
+ xTableColumns->insertByIndex( 0, rColumns.size() - 1 );
+
+ std::set< sal_Int32 >::const_iterator aIter( rColumns.begin() );
+ sal_Int32 nLastPosition( *aIter );
+ Reference< XIndexAccess > xIndexAccess( xTableColumns, UNO_QUERY_THROW );
+ for ( sal_Int32 n = 0; n < xIndexAccess->getCount(); n++ )
+ {
+ sal_Int32 nWidth;
+ if ( ++aIter != rColumns.end() )
+ {
+ nWidth = *aIter - nLastPosition;
+ nLastPosition = *aIter;
+ }
+ else
+ nWidth = nTableRight - nLastPosition;
+
+ static const rtl::OUString sWidth( RTL_CONSTASCII_USTRINGPARAM ( "Width" ) );
+ Reference< XPropertySet > xPropSet( xIndexAccess->getByIndex( n ), UNO_QUERY_THROW );
+ xPropSet->setPropertyValue( sWidth, Any( nWidth ) );
+ }
+}
+
+void MergeCells( const Reference< XTable >& xTable, sal_Int32 nCol, sal_Int32 nRow, sal_Int32 nColSpan, sal_Int32 nRowSpan )
+{
+ DBG_ASSERT( (nColSpan > 1) || (nRowSpan > 1), "nonsense parameter!!" );
+ DBG_ASSERT( (nCol >= 0) && (nCol < xTable->getColumnCount()) && (nRow >= 0) && (nRow < xTable->getRowCount()), "die celle gibts nicht!!" );
+ DBG_ASSERT( (nColSpan >= 1) && ((nCol + nColSpan - 1) < xTable->getColumnCount()), "nColSpan murks!" );
+ DBG_ASSERT( (nRowSpan >= 1) && ((nRow + nRowSpan - 1) < xTable->getRowCount()), "nRowSpan murks!" );
+
+ if( xTable.is() ) try
+ {
+ Reference< XMergeableCellRange > xRange( xTable->createCursorByRange( xTable->getCellRangeByPosition( nCol, nRow,nCol + nColSpan - 1, nRow + nRowSpan - 1 ) ), UNO_QUERY_THROW );
+ if( xRange->isMergeable() )
+ xRange->merge();
+ }
+ catch( Exception& )
+ {
+ DBG_ASSERT( false, "exception caught!" );
+ }
+}
+
+void ApplyCellAttributes( const SdrObject* pObj, Reference< XCell >& xCell )
+{
+ try
+ {
+ Reference< XPropertySet > xPropSet( xCell, UNO_QUERY_THROW );
+
+ const sal_Int32 nLeftDist(((const SdrTextLeftDistItem&)pObj->GetMergedItem(SDRATTR_TEXT_LEFTDIST)).GetValue());
+ const sal_Int32 nRightDist(((const SdrTextRightDistItem&)pObj->GetMergedItem(SDRATTR_TEXT_RIGHTDIST)).GetValue());
+ const sal_Int32 nUpperDist(((const SdrTextUpperDistItem&)pObj->GetMergedItem(SDRATTR_TEXT_UPPERDIST)).GetValue());
+ const sal_Int32 nLowerDist(((const SdrTextLowerDistItem&)pObj->GetMergedItem(SDRATTR_TEXT_LOWERDIST)).GetValue());
+ static const rtl::OUString sTopBorder( RTL_CONSTASCII_USTRINGPARAM( "TextUpperDistance" ) );
+ static const rtl::OUString sBottomBorder( RTL_CONSTASCII_USTRINGPARAM( "TextLowerDistance" ) );
+ static const rtl::OUString sLeftBorder( RTL_CONSTASCII_USTRINGPARAM( "TextLeftDistance" ) );
+ static const rtl::OUString sRightBorder( RTL_CONSTASCII_USTRINGPARAM( "TextRightDistance" ) );
+ xPropSet->setPropertyValue( sTopBorder, Any( nUpperDist ) );
+ xPropSet->setPropertyValue( sRightBorder, Any( nRightDist ) );
+ xPropSet->setPropertyValue( sLeftBorder, Any( nLeftDist ) );
+ xPropSet->setPropertyValue( sBottomBorder, Any( nLowerDist ) );
+
+ static const rtl::OUString sTextVerticalAdjust( RTL_CONSTASCII_USTRINGPARAM( "TextVerticalAdjust" ) );
+ const SdrTextVertAdjust eTextVertAdjust(((const SdrTextVertAdjustItem&)pObj->GetMergedItem(SDRATTR_TEXT_VERTADJUST)).GetValue());
+ drawing::TextVerticalAdjust eVA( drawing::TextVerticalAdjust_TOP );
+ if ( eTextVertAdjust == SDRTEXTVERTADJUST_CENTER )
+ eVA = drawing::TextVerticalAdjust_CENTER;
+ else if ( eTextVertAdjust == SDRTEXTVERTADJUST_BOTTOM )
+ eVA = drawing::TextVerticalAdjust_BOTTOM;
+ xPropSet->setPropertyValue( sTextVerticalAdjust, Any( eVA ) );
+
+ SfxItemSet aSet( pObj->GetMergedItemSet() );
+ XFillStyle eFillStyle(((XFillStyleItem&)pObj->GetMergedItem( XATTR_FILLSTYLE )).GetValue());
+ ::com::sun::star::drawing::FillStyle eFS( com::sun::star::drawing::FillStyle_NONE );
+ switch( eFillStyle )
+ {
+ case XFILL_SOLID :
+ {
+ static const rtl::OUString sFillColor( String( RTL_CONSTASCII_USTRINGPARAM( "FillColor" ) ) );
+ eFS = com::sun::star::drawing::FillStyle_SOLID;
+ Color aFillColor( ((XFillColorItem&)pObj->GetMergedItem( XATTR_FILLCOLOR )).GetColorValue() );
+ sal_Int32 nFillColor( aFillColor.GetColor() );
+ xPropSet->setPropertyValue( sFillColor, Any( nFillColor ) );
+ }
+ break;
+ case XFILL_GRADIENT :
+ {
+ eFS = com::sun::star::drawing::FillStyle_GRADIENT;
+ XGradient aXGradient(((const XFillGradientItem&)pObj->GetMergedItem(XATTR_FILLGRADIENT)).GetGradientValue());
+
+ com::sun::star::awt::Gradient aGradient;
+ aGradient.Style = (awt::GradientStyle) aXGradient.GetGradientStyle();
+ aGradient.StartColor = (INT32)aXGradient.GetStartColor().GetColor();
+ aGradient.EndColor = (INT32)aXGradient.GetEndColor().GetColor();
+ aGradient.Angle = (short)aXGradient.GetAngle();
+ aGradient.Border = aXGradient.GetBorder();
+ aGradient.XOffset = aXGradient.GetXOffset();
+ aGradient.YOffset = aXGradient.GetYOffset();
+ aGradient.StartIntensity = aXGradient.GetStartIntens();
+ aGradient.EndIntensity = aXGradient.GetEndIntens();
+ aGradient.StepCount = aXGradient.GetSteps();
+
+ static const rtl::OUString sFillGradient( String( RTL_CONSTASCII_USTRINGPARAM( "FillGradient" ) ) );
+ xPropSet->setPropertyValue( sFillGradient, Any( aGradient ) );
+ }
+ break;
+ case XFILL_HATCH :
+ eFS = com::sun::star::drawing::FillStyle_HATCH;
+ break;
+ case XFILL_BITMAP :
+ {
+ eFS = com::sun::star::drawing::FillStyle_BITMAP;
+
+ XFillBitmapItem aXFillBitmapItem((const XFillBitmapItem&)pObj->GetMergedItem( XATTR_FILLBITMAP ));
+ XOBitmap aLocalXOBitmap( aXFillBitmapItem.GetBitmapValue() );
+ rtl::OUString aURL( RTL_CONSTASCII_USTRINGPARAM(UNO_NAME_GRAPHOBJ_URLPREFIX));
+ aURL += rtl::OUString::createFromAscii( aLocalXOBitmap.GetGraphicObject().GetUniqueID().GetBuffer() );
+
+ static const rtl::OUString sFillBitmapURL( String( RTL_CONSTASCII_USTRINGPARAM( "FillBitmapURL" ) ) );
+ xPropSet->setPropertyValue( sFillBitmapURL, Any( aURL ) );
+ }
+ break;
+ case XFILL_NONE :
+ eFS = com::sun::star::drawing::FillStyle_NONE;
+ break;
+
+ }
+ static const rtl::OUString sFillStyle( String( RTL_CONSTASCII_USTRINGPARAM( "FillStyle" ) ) );
+ xPropSet->setPropertyValue( sFillStyle, Any( eFS ) );
+ if ( eFillStyle != XFILL_NONE )
+ {
+ sal_Int16 nFillTransparence( ( (const XFillTransparenceItem&)pObj->GetMergedItem( XATTR_FILLTRANSPARENCE ) ).GetValue() );
+ if ( nFillTransparence != 100 )
+ {
+ nFillTransparence *= 100;
+ static const rtl::OUString sFillTransparence( String( RTL_CONSTASCII_USTRINGPARAM( "FillTransparence" ) ) );
+ xPropSet->setPropertyValue( sFillTransparence, Any( nFillTransparence ) );
+ }
+ }
+ }
+ catch( Exception& )
+ {
+ }
+}
+
+void ApplyCellLineAttributes( const SdrObject* pLine, Reference< XTable >& xTable, const std::vector< sal_Int32 > vPositions, sal_Int32 nColumns )
+{
+ try
+ {
+ SfxItemSet aSet( pLine->GetMergedItemSet() );
+ XLineStyle eLineStyle(((XLineStyleItem&)pLine->GetMergedItem( XATTR_LINESTYLE )).GetValue());
+ com::sun::star::table::BorderLine aBorderLine;
+ switch( eLineStyle )
+ {
+ case XLINE_DASH :
+ case XLINE_SOLID :
+ {
+ Color aLineColor( ((XLineColorItem&)pLine->GetMergedItem( XATTR_LINECOLOR )).GetColorValue() );
+ aBorderLine.Color = aLineColor.GetColor();
+ aBorderLine.OuterLineWidth = static_cast< sal_Int16 >( ((const XLineWidthItem&)(pLine->GetMergedItem(XATTR_LINEWIDTH))).GetValue() / 4 );
+ aBorderLine.InnerLineWidth = static_cast< sal_Int16 >( ((const XLineWidthItem&)(pLine->GetMergedItem(XATTR_LINEWIDTH))).GetValue() / 4 );
+ aBorderLine.LineDistance = 0;
+ }
+ break;
+ case XLINE_NONE :
+ {
+ aBorderLine.OuterLineWidth = 0;
+ aBorderLine.InnerLineWidth = 0;
+ aBorderLine.LineDistance = 0;
+ }
+ break;
+ }
+ Reference< XCellRange > xCellRange( xTable, UNO_QUERY_THROW );
+ std::vector< sal_Int32 >::const_iterator aIter( vPositions.begin() );
+ while( aIter != vPositions.end() )
+ {
+ static const rtl::OUString sTopBorder( String( RTL_CONSTASCII_USTRINGPARAM( "TopBorder" ) ) );
+ static const rtl::OUString sBottomBorder( String( RTL_CONSTASCII_USTRINGPARAM( "BottomBorder" ) ) );
+ static const rtl::OUString sLeftBorder( String( RTL_CONSTASCII_USTRINGPARAM( "LeftBorder" ) ) );
+ static const rtl::OUString sRightBorder( String( RTL_CONSTASCII_USTRINGPARAM( "RightBorder" ) ) );
+ static const rtl::OUString sDiagonalTLBR( RTL_CONSTASCII_USTRINGPARAM ( "DiagonalTLBR" ) );
+ static const rtl::OUString sDiagonalBLTR( RTL_CONSTASCII_USTRINGPARAM ( "DiagonalBLTR" ) );
+
+ sal_Int32 nPosition = *aIter & 0xffffff;
+ sal_Int32 nFlags = *aIter &~0xffffff;
+ sal_Int32 nRow = nPosition / nColumns;
+ sal_Int32 nColumn = nPosition - ( nRow * nColumns );
+ Reference< XCell > xCell( xCellRange->getCellByPosition( nColumn, nRow ) );
+ Reference< XPropertySet > xPropSet( xCell, UNO_QUERY_THROW );
+
+ if ( nFlags & LinePositionLeft )
+ xPropSet->setPropertyValue( sLeftBorder, Any( aBorderLine ) );
+ if ( nFlags & LinePositionTop )
+ xPropSet->setPropertyValue( sTopBorder, Any( aBorderLine ) );
+ if ( nFlags & LinePositionRight )
+ xPropSet->setPropertyValue( sRightBorder, Any( aBorderLine ) );
+ if ( nFlags & LinePositionBottom )
+ xPropSet->setPropertyValue( sBottomBorder, Any( aBorderLine ) );
+ if ( nFlags & LinePositionTLBR )
+ xPropSet->setPropertyValue( sDiagonalTLBR, Any( sal_True ) );
+ if ( nFlags & LinePositionBLTR )
+ xPropSet->setPropertyValue( sDiagonalBLTR, Any( sal_True ) );
+ aIter++;
+ }
+ }
+ catch( Exception& )
+ {
+ }
+}
+
+SdrObject* SdrPowerPointImport::CreateTable( SdrObject* pGroup, sal_uInt32* pTableArry, SvxMSDffSolverContainer* pSolverContainer )
+{
+ SdrObject* pRet = pGroup;
+ sal_uInt32 nRows = pTableArry[ 1 ];
+ if ( nRows && pGroup->ISA( SdrObjGroup ) )
+ {
+ SdrObjList* pSubList(((SdrObjGroup*)pGroup)->GetSubList());
+ if ( pSubList )
+ {
+ std::set< sal_Int32 > aRows;
+ std::set< sal_Int32 > aColumns;
+
+ SdrObjListIter aGroupIter( *pSubList, IM_DEEPNOGROUPS, FALSE );
+ while( aGroupIter.IsMore() )
+ {
+ const SdrObject* pObj( aGroupIter.Next() );
+ if ( !IsLine( pObj ) )
+ {
+ Rectangle aSnapRect( pObj->GetSnapRect() );
+ aRows.insert( aSnapRect.Top() );
+ aColumns.insert( aSnapRect.Left() );
+ }
+ }
+ ::sdr::table::SdrTableObj* pTable = new ::sdr::table::SdrTableObj( pSdrModel );
+ pTable->uno_lock();
+ Reference< XTable > xTable( pTable->getTable() );
+ try
+ {
+ Reference< XColumnRowRange > xColumnRowRange( xTable, UNO_QUERY_THROW );
+
+ CreateTableRows( xColumnRowRange->getRows(), aRows, pGroup->GetSnapRect().Bottom() );
+ CreateTableColumns( xColumnRowRange->getColumns(), aColumns, pGroup->GetSnapRect().Right() );
+
+ sal_Int32 nCellCount = aRows.size() * aColumns.size();
+ sal_Int32 *pMergedCellIndexTable = new sal_Int32[ nCellCount ];
+ for ( sal_Int32 i = 0; i < nCellCount; i++ )
+ pMergedCellIndexTable[ i ] = i;
+
+ aGroupIter.Reset();
+ while( aGroupIter.IsMore() )
+ {
+ SdrObject* pObj( aGroupIter.Next() );
+ if ( !IsLine( pObj ) )
+ {
+ Rectangle aSnapRect( pObj->GetSnapRect() );
+ sal_Int32 nTableIndex = 0;
+ sal_Int32 nRow = 0;
+ sal_Int32 nRowCount = 0;
+ sal_Int32 nColumn = 0;
+ sal_Int32 nColumnCount = 0;
+ if ( GetCellPosition( pObj, aRows, aColumns, nTableIndex, nRow, nRowCount, nColumn, nColumnCount ) )
+ {
+ Reference< XCellRange > xCellRange( xTable, UNO_QUERY_THROW );
+ Reference< XCell > xCell( xCellRange->getCellByPosition( nColumn, nRow ) );
+
+ ApplyCellAttributes( pObj, xCell );
+
+ if ( ( nRowCount > 1 ) || ( nColumnCount > 1 ) ) // cell merging
+ {
+ MergeCells( xTable, nColumn, nRow, nColumnCount, nRowCount );
+ for ( sal_Int32 nRowIter = 0; nRowIter < nRowCount; nRowIter++ )
+ {
+ for ( sal_Int32 nColumnIter = 0; nColumnIter < nColumnCount; nColumnIter++ )
+ { // now set the correct index for the merged cell
+ pMergedCellIndexTable[ ( ( nRow + nRowIter ) * aColumns.size() ) + nColumn + nColumnIter ] = nTableIndex;
+ }
+ }
+ }
+
+ // applying text
+ OutlinerParaObject* pParaObject = pObj->GetOutlinerParaObject();
+ if ( pParaObject )
+ {
+ SdrText* pSdrText = pTable->getText( nTableIndex );
+ if ( pSdrText )
+ pSdrText->SetOutlinerParaObject(new OutlinerParaObject(*pParaObject) );
+ }
+ }
+ }
+ }
+ aGroupIter.Reset();
+ while( aGroupIter.IsMore() )
+ {
+ SdrObject* pObj( aGroupIter.Next() );
+ if ( IsLine( pObj ) )
+ {
+ std::vector< sal_Int32 > vPositions; // containing cell indexes + cell position
+ GetLinePositions( pObj, aRows, aColumns, vPositions, pGroup->GetSnapRect() );
+
+ // correcting merged cell position
+ std::vector< sal_Int32 >::iterator aIter( vPositions.begin() );
+ while( aIter != vPositions.end() )
+ {
+ sal_Int32 nOldPosition = *aIter & 0xffff;
+ sal_Int32 nOldFlags = *aIter & 0xffff0000;
+ sal_Int32 nNewPosition = pMergedCellIndexTable[ nOldPosition ] | nOldFlags;
+ *aIter++ = nNewPosition;
+ }
+ ApplyCellLineAttributes( pObj, xTable, vPositions, aColumns.size() );
+ }
+ }
+ delete[] pMergedCellIndexTable;
+
+ // we are replacing the whole group object by a single table object, so
+ // 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() )
+ {
+ SdrObjListIter aIter( *pGroup, IM_DEEPWITHGROUPS );
+ while( aIter.IsMore() )
+ {
+ SdrObject* pPartObj = aIter.Next();
+ if ( pPtr->pAObj == pPartObj )
+ pPtr->pAObj = NULL;
+ if ( pPtr->pBObj == pPartObj )
+ pPtr->pBObj = NULL;
+ }
+ }
+ }
+ pTable->uno_unlock();
+ pTable->SetSnapRect( pGroup->GetSnapRect() );
+ pRet = pTable;
+
+ //Remove Objects from shape map
+ SdrObjListIter aIter( *pGroup, IM_DEEPWITHGROUPS );
+ while( aIter.IsMore() )
+ {
+ SdrObject* pPartObj = aIter.Next();
+ removeShapeId( pPartObj );
+ }
+
+ SdrObject::Free( pGroup );
+ }
+ catch( Exception& )
+ {
+ pTable->uno_unlock();
+ SdrObject* pObj = pTable;
+ SdrObject::Free( pObj );
+ }
+ }
+ }
+ return pRet;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
diff --git a/filter/source/msfilter/svxmsbas.cxx b/filter/source/msfilter/svxmsbas.cxx
new file mode 100644
index 000000000000..49fd4a7544f3
--- /dev/null
+++ b/filter/source/msfilter/svxmsbas.cxx
@@ -0,0 +1,494 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
+#include <tools/debug.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/app.hxx>
+#include <basic/basmgr.hxx>
+#include <basic/sbmod.hxx>
+#include <svx/svxerr.hxx>
+#include <filter/msfilter/svxmsbas.hxx>
+#include <msvbasic.hxx>
+#include <filter/msfilter/msocximex.hxx>
+#include <sot/storinfo.hxx>
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/awt/Size.hpp>
+#include <com/sun/star/awt/XControlModel.hpp>
+using namespace com::sun::star::beans;
+using namespace com::sun::star::io;
+using namespace com::sun::star::awt;
+#include <comphelper/storagehelper.hxx>
+
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/script/XLibraryContainer.hpp>
+#include <com/sun/star/script/ModuleInfo.hpp>
+#include <com/sun/star/script/ModuleType.hpp>
+#include <com/sun/star/script/XVBAModuleInfo.hpp>
+#include <com/sun/star/script/XVBACompat.hpp>
+
+using namespace com::sun::star::container;
+using namespace com::sun::star::script;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star;
+
+using rtl::OUString;
+
+static ::rtl::OUString sVBAOption( RTL_CONSTASCII_USTRINGPARAM( "Option VBASupport 1\n" ) );
+
+int SvxImportMSVBasic::Import( const String& rStorageName,
+ const String &rSubStorageName,
+ BOOL bAsComment, BOOL bStripped )
+{
+ std::vector< String > codeNames;
+ return Import( rStorageName, rSubStorageName, codeNames, bAsComment, bStripped );
+}
+
+int SvxImportMSVBasic::Import( const String& rStorageName,
+ const String &rSubStorageName,
+ const std::vector< String >& codeNames,
+ BOOL bAsComment, BOOL bStripped )
+{
+ int nRet = 0;
+ if( bImport && ImportCode_Impl( rStorageName, rSubStorageName, codeNames,
+ bAsComment, bStripped ))
+ nRet |= 1;
+
+ if (bImport)
+ ImportForms_Impl(rStorageName, rSubStorageName);
+
+ if( bCopy && CopyStorage_Impl( rStorageName, rSubStorageName ))
+ nRet |= 2;
+
+ return nRet;
+}
+
+bool SvxImportMSVBasic::ImportForms_Impl(const String& rStorageName,
+ const String& rSubStorageName)
+{
+ SvStorageRef xVBAStg(xRoot->OpenSotStorage(rStorageName,
+ STREAM_READWRITE | STREAM_NOCREATE | STREAM_SHARE_DENYALL));
+ if (!xVBAStg.Is() || xVBAStg->GetError())
+ return false;
+
+ std::vector<String> aUserForms;
+ SvStorageInfoList aContents;
+ xVBAStg->FillInfoList(&aContents);
+ for (USHORT nI = 0; nI < aContents.Count(); ++nI)
+ {
+ SvStorageInfo& rInfo = aContents.GetObject(nI);
+ if (!rInfo.IsStream() && rInfo.GetName() != rSubStorageName)
+ aUserForms.push_back(rInfo.GetName());
+ }
+
+ if (aUserForms.empty())
+ return false;
+
+ bool bRet = true;
+ SFX_APP()->EnterBasicCall();
+ try
+ {
+ Reference<XMultiServiceFactory> xSF(comphelper::getProcessServiceFactory());
+
+ Reference<XComponentContext> xContext;
+ Reference<XPropertySet> xProps(xSF, UNO_QUERY);
+ xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext;
+
+
+ Reference<XLibraryContainer> xLibContainer = rDocSh.GetDialogContainer();
+ DBG_ASSERT( xLibContainer.is(), "No BasicContainer!" );
+
+ String aLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
+ Reference<XNameContainer> xLib;
+ if (xLibContainer.is())
+ {
+ if( !xLibContainer->hasByName(aLibName))
+ xLibContainer->createLibrary(aLibName);
+
+ Any aLibAny = xLibContainer->getByName( aLibName );
+ aLibAny >>= xLib;
+ }
+
+ if(xLib.is())
+ {
+ typedef std::vector<String>::iterator myIter;
+ myIter aEnd = aUserForms.end();
+ for (myIter aIter = aUserForms.begin(); aIter != aEnd; ++aIter)
+ {
+ SvStorageRef xForm (xVBAStg->OpenSotStorage(*aIter,
+ STREAM_READWRITE | STREAM_NOCREATE | STREAM_SHARE_DENYALL));
+
+ if (!xForm.Is() || xForm->GetError())
+ continue;
+
+ SvStorageStreamRef xFrame = xForm->OpenSotStream(
+ String( RTL_CONSTASCII_USTRINGPARAM( "\3VBFrame" ) ),
+ STREAM_STD_READ | STREAM_NOCREATE);
+
+ if (!xFrame.Is() || xFrame->GetError())
+ continue;
+
+ SvStorageStreamRef xTypes = xForm->OpenSotStream(
+ String( 'f' ), STREAM_STD_READ | STREAM_NOCREATE);
+
+ if (!xTypes.Is() || xTypes->GetError())
+ continue;
+
+ //<UserForm Name=""><VBFrame></VBFrame>"
+ String sData;
+ String sLine;
+ while(xFrame->ReadByteStringLine(sLine, RTL_TEXTENCODING_MS_1252))
+ {
+ sData += sLine;
+ sData += '\n';
+ }
+ sData.ConvertLineEnd();
+
+ Reference<container::XNameContainer> xDialog(
+ xSF->createInstance(
+ OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.awt.UnoControlDialogModel"))), uno::UNO_QUERY);
+
+ OCX_UserForm aForm(xVBAStg, *aIter, *aIter, xDialog, xSF );
+ aForm.pDocSh = &rDocSh;
+ sal_Bool bOk = aForm.Read(xTypes);
+ DBG_ASSERT(bOk, "Had unexpected content, not risking this module");
+ if (bOk)
+ aForm.Import(xLib);
+ }
+ }
+ }
+ catch(...)
+ {
+ DBG_ERRORFILE( "SvxImportMSVBasic::ImportForms_Impl - any exception caught" );
+ //bRet = false;
+ }
+ SFX_APP()->LeaveBasicCall();
+ return bRet;
+}
+
+
+BOOL SvxImportMSVBasic::CopyStorage_Impl( const String& rStorageName,
+ const String& rSubStorageName)
+{
+ BOOL bValidStg = FALSE;
+ {
+ SvStorageRef xVBAStg( xRoot->OpenSotStorage( rStorageName,
+ STREAM_READWRITE | STREAM_NOCREATE |
+ STREAM_SHARE_DENYALL ));
+ if( xVBAStg.Is() && !xVBAStg->GetError() )
+ {
+ SvStorageRef xVBASubStg( xVBAStg->OpenSotStorage( rSubStorageName,
+ STREAM_READWRITE | STREAM_NOCREATE |
+ STREAM_SHARE_DENYALL ));
+ if( xVBASubStg.Is() && !xVBASubStg->GetError() )
+ {
+ // then we will copy these storages into the (temporary) storage of the document
+ bValidStg = TRUE;
+ }
+ }
+ }
+
+ if( bValidStg )
+ {
+ String aDstStgName( GetMSBasicStorageName() );
+ SotStorageRef xDst = SotStorage::OpenOLEStorage( rDocSh.GetStorage(), aDstStgName, STREAM_READWRITE | STREAM_TRUNC );
+ SotStorageRef xSrc = xRoot->OpenSotStorage( rStorageName, STREAM_STD_READ );
+
+ // TODO/LATER: should we commit the storage?
+ xSrc->CopyTo( xDst );
+ xDst->Commit();
+ ErrCode nError = xDst->GetError();
+ if ( nError == ERRCODE_NONE )
+ nError = xSrc->GetError();
+ if ( nError != ERRCODE_NONE )
+ xRoot->SetError( nError );
+ else
+ bValidStg = TRUE;
+ }
+
+ return bValidStg;
+}
+
+BOOL SvxImportMSVBasic::ImportCode_Impl( const String& rStorageName,
+ const String &rSubStorageName,
+ const std::vector< String >& codeNames,
+ BOOL bAsComment, BOOL bStripped )
+{
+ BOOL bRet = FALSE;
+ VBA_Impl aVBA( *xRoot, bAsComment );
+ if( aVBA.Open(rStorageName,rSubStorageName) )
+ {
+ SFX_APP()->EnterBasicCall();
+ Reference<XLibraryContainer> xLibContainer = rDocSh.GetBasicContainer();
+ Reference<XVBACompat> xVBACompat( xLibContainer, UNO_QUERY );
+
+ if ( xVBACompat.is() && !bAsComment )
+ xVBACompat->setVBACompatModeOn( sal_True );
+
+ DBG_ASSERT( xLibContainer.is(), "No BasicContainer!" );
+
+ UINT16 nStreamCount = aVBA.GetNoStreams();
+ Reference<XNameContainer> xLib;
+ String aLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
+ if( xLibContainer.is() && nStreamCount )
+ {
+ if( !xLibContainer->hasByName( aLibName ) )
+ xLibContainer->createLibrary( aLibName );
+
+ Any aLibAny = xLibContainer->getByName( aLibName );
+ aLibAny >>= xLib;
+ }
+ if( xLib.is() )
+ {
+ Reference< script::XVBAModuleInfo > xVBAModuleInfo( xLib, UNO_QUERY );
+ Reference< container::XNameAccess > xVBACodeNamedObjectAccess;
+ if ( !bAsComment )
+ {
+ Reference< XMultiServiceFactory> xSF(rDocSh.GetModel(), UNO_QUERY);
+ if ( xSF.is() )
+ {
+ try
+ {
+ xVBACodeNamedObjectAccess.set( xSF->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAObjectModuleObjectProvider"))), UNO_QUERY );
+ }
+ catch( Exception& ) { }
+ }
+ }
+ typedef std::hash_map< rtl::OUString, uno::Any, ::rtl::OUStringHash,
+::std::equal_to< ::rtl::OUString > > NameModuleDataHash;
+ typedef std::hash_map< rtl::OUString, script::ModuleInfo, ::rtl::OUStringHash,
+::std::equal_to< ::rtl::OUString > > NameModuleInfoHash;
+
+ NameModuleDataHash moduleData;
+ NameModuleInfoHash moduleInfos;
+
+ for( UINT16 i=0; i<nStreamCount;i++)
+ {
+ StringArray aDecompressed = aVBA.Decompress(i);
+#if 0
+/* DR 2005-08-11 #124850# Do not filter special characters from module name.
+ Just put the original module name and let the Basic interpreter deal with
+ it. Needed for roundtrip...
+ */
+ ByteString sByteBasic(aVBA.GetStreamName(i),
+ RTL_TEXTENCODING_ASCII_US,
+ (RTL_UNICODETOTEXT_FLAGS_UNDEFINED_UNDERLINE|
+ RTL_UNICODETOTEXT_FLAGS_INVALID_UNDERLINE |
+ RTL_UNICODETOTEXT_FLAGS_PRIVATE_MAPTO0 |
+ RTL_UNICODETOTEXT_FLAGS_NOCOMPOSITE)
+ );
+
+ const String sBasicModule(sByteBasic,
+ RTL_TEXTENCODING_ASCII_US);
+#else
+ const String &sBasicModule = aVBA.GetStreamName( i);
+#endif
+ /* #117718# expose information regarding type of Module
+ * Class, Form or plain 'ould VBA module with a REM statment
+ * at the top of the module. Mapping of Module Name
+ * to type is performed in VBA_Impl::Open() method,
+ * ( msvbasic.cxx ) by examining the PROJECT stream.
+ */
+
+ // using name from aVBA.GetStreamName
+ // because the encoding of the same returned
+ // is the same as the encoding for the names
+ // that are keys in the map used by GetModuleType method
+ const String &sOrigVBAModName = aVBA.GetStreamName( i );
+ ModType mType = aVBA.GetModuleType( sOrigVBAModName );
+
+ rtl::OUString sClassRem( RTL_CONSTASCII_USTRINGPARAM( "Rem Attribute VBA_ModuleType=" ) );
+
+ rtl::OUString modeTypeComment;
+
+ switch( mType )
+ {
+ case ModuleType::CLASS:
+ modeTypeComment = sClassRem +
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBAClassModule\n" ) );
+ break;
+ case ModuleType::FORM:
+ modeTypeComment = sClassRem +
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBAFormModule\n" ) );
+ break;
+ case ModuleType::DOCUMENT:
+ modeTypeComment = sClassRem +
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBADocumentModule\n" ) );
+ break;
+ case ModuleType::NORMAL:
+ modeTypeComment = sClassRem +
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBAModule\n" ) );
+ break;
+ case ModuleType::UNKNOWN:
+ modeTypeComment = sClassRem +
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBAUnknown\n" ) );
+ break;
+ default:
+ DBG_ERRORFILE( "SvxImportMSVBasic::ImportCode_Impl - unknown module type" );
+ break;
+ }
+ static ::rtl::OUString sClassOption( RTL_CONSTASCII_USTRINGPARAM( "Option ClassModule\n" ) );
+ if ( !bAsComment )
+ {
+ modeTypeComment += sVBAOption;
+ if ( mType == ModuleType::CLASS )
+ modeTypeComment += sClassOption;
+ }
+
+ String sModule(sBasicModule); //#i52606# no need to split Macros in 64KB blocks any more!
+ String sTemp;
+ if (bAsComment)
+ {
+ sTemp+=String(RTL_CONSTASCII_USTRINGPARAM( "Sub " ));
+ String sMunge(sModule);
+ //Streams can have spaces in them, but modulenames
+ //cannot !
+ sMunge.SearchAndReplaceAll(' ','_');
+
+ sTemp += sMunge;
+ sTemp.AppendAscii("\n");
+ };
+ ::rtl::OUString aSource(sTemp);
+
+ for(ULONG j=0;j<aDecompressed.GetSize();j++)
+ {
+ if (bStripped)
+ {
+ String *pStr = aDecompressed.Get(j);
+ bool bMac = true;
+ xub_StrLen nBegin = pStr->Search('\x0D');
+ if ((STRING_NOTFOUND != nBegin) && (pStr->Len() > 1) && (pStr->GetChar(nBegin+1) == '\x0A'))
+ bMac = false;
+
+ const char cLineEnd = bMac ? '\x0D' : '\x0A';
+ const String sAttribute(String::CreateFromAscii(
+ bAsComment ? "Rem Attribute" : "Attribute"));
+ nBegin = 0;
+ while (STRING_NOTFOUND != (nBegin = pStr->Search(sAttribute, nBegin)))
+ {
+ if ((nBegin) && pStr->GetChar(nBegin-1) != cLineEnd)
+ {
+ // npower #i63766# Need to skip instances of Attribute
+ // that are NOT Attribute statements
+ nBegin = nBegin + sAttribute.Len();
+ continue;
+ }
+ xub_StrLen nEnd = pStr->Search(cLineEnd ,nBegin);
+ // DR #i26521# catch STRING_NOTFOUND, will loop endless otherwise
+ if( nEnd == STRING_NOTFOUND )
+ pStr->Erase();
+ else
+ pStr->Erase(nBegin, (nEnd-nBegin)+1);
+ }
+ }
+ if( aDecompressed.Get(j)->Len() )
+ {
+ aSource+=::rtl::OUString( *aDecompressed.Get(j) );
+ }
+
+ }
+ if (bAsComment)
+ {
+ aSource += rtl::OUString::createFromAscii("\nEnd Sub");
+ }
+ ::rtl::OUString aModName( sModule );
+ aSource = modeTypeComment + aSource;
+
+ Any aSourceAny;
+ OSL_TRACE("erm %d", mType );
+ aSourceAny <<= aSource;
+ if ( !bAsComment )
+ {
+ OSL_TRACE("vba processing %d", mType );
+ script::ModuleInfo sModuleInfo;
+ sModuleInfo.ModuleType = mType;
+ moduleInfos[ aModName ] = sModuleInfo;
+ }
+ moduleData[ aModName ] = aSourceAny;
+ }
+ // Hack for missing codenames ( only know to happen in excel but... )
+ // only makes sense to do this if we are importing non-commented basic
+ if ( !bAsComment )
+ {
+ for ( std::vector< String >::const_iterator it = codeNames.begin(); it != codeNames.end(); ++it )
+ {
+ script::ModuleInfo sModuleInfo;
+ sModuleInfo.ModuleType = ModuleType::DOCUMENT;
+ moduleInfos[ *it ] = sModuleInfo;
+ moduleData[ *it ] = uno::makeAny( sVBAOption );
+ }
+ }
+ NameModuleDataHash::iterator it_end = moduleData.end();
+ for ( NameModuleDataHash::iterator it = moduleData.begin(); it != it_end; ++it )
+ {
+ NameModuleInfoHash::iterator it_info = moduleInfos.find( it->first );
+ if ( it_info != moduleInfos.end() )
+ {
+ ModuleInfo& sModuleInfo = it_info->second;
+ if ( sModuleInfo.ModuleType == ModuleType::FORM )
+ // hack, the module ( imo document basic should...
+ // know the XModel... ) but it doesn't
+ sModuleInfo.ModuleObject.set( rDocSh.GetModel(), UNO_QUERY );
+ // document modules, we should be able to access
+ // the api objects at this time
+ else if ( sModuleInfo.ModuleType == ModuleType::DOCUMENT )
+ {
+ if ( xVBACodeNamedObjectAccess.is() )
+ {
+ try
+ {
+ sModuleInfo.ModuleObject.set( xVBACodeNamedObjectAccess->getByName( it->first ), uno::UNO_QUERY );
+ OSL_TRACE("** Straight up creation of Module");
+ }
+ catch(uno::Exception& e)
+ {
+ OSL_TRACE("Failed to get documument object for %s", rtl::OUStringToOString( it->first, RTL_TEXTENCODING_UTF8 ).getStr() );
+ }
+ }
+ }
+ xVBAModuleInfo->insertModuleInfo( it->first, sModuleInfo );
+ }
+
+ if( xLib->hasByName( it->first ) )
+ xLib->replaceByName( it->first, it->second );
+ else
+ xLib->insertByName( it->first, it->second );
+ }
+ bRet = true;
+ }
+ SFX_APP()->LeaveBasicCall();
+ }
+ return bRet;
+}
+
+/* vi:set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/filter/source/msfilter/svxmsbas2.cxx b/filter/source/msfilter/svxmsbas2.cxx
new file mode 100644
index 000000000000..8da475ed78c8
--- /dev/null
+++ b/filter/source/msfilter/svxmsbas2.cxx
@@ -0,0 +1,85 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include <basic/basmgr.hxx>
+#include <sfx2/objsh.hxx>
+#include <svx/svxerr.hxx>
+#include <filter/msfilter/svxmsbas.hxx>
+
+using namespace com::sun::star;
+
+ULONG SvxImportMSVBasic::SaveOrDelMSVBAStorage( BOOL bSaveInto,
+ const String& rStorageName )
+{
+ ULONG nRet = ERRCODE_NONE;
+ uno::Reference < embed::XStorage > xSrcRoot( rDocSh.GetStorage() );
+ String aDstStgName( GetMSBasicStorageName() );
+ SotStorageRef xVBAStg( SotStorage::OpenOLEStorage( xSrcRoot, aDstStgName,
+ STREAM_READWRITE | STREAM_NOCREATE | STREAM_SHARE_DENYALL ) );
+ if( xVBAStg.Is() && !xVBAStg->GetError() )
+ {
+ xVBAStg = 0;
+ if( bSaveInto )
+ {
+ BasicManager *pBasicMan = rDocSh.GetBasicManager();
+ if( pBasicMan && pBasicMan->IsBasicModified() )
+ nRet = ERRCODE_SVX_MODIFIED_VBASIC_STORAGE;
+
+ SotStorageRef xSrc = SotStorage::OpenOLEStorage( xSrcRoot, aDstStgName, STREAM_STD_READ );
+ SotStorageRef xDst = xRoot->OpenSotStorage( rStorageName, STREAM_READWRITE | STREAM_TRUNC );
+ xSrc->CopyTo( xDst );
+ xDst->Commit();
+ ErrCode nError = xDst->GetError();
+ if ( nError == ERRCODE_NONE )
+ nError = xSrc->GetError();
+ if ( nError != ERRCODE_NONE )
+ xRoot->SetError( nError );
+ }
+ }
+
+ return nRet;
+}
+
+// check if the MS-VBA-Storage exists in the RootStorage of the DocShell.
+// If it exists, then return the WarningId for losing the information.
+ULONG SvxImportMSVBasic::GetSaveWarningOfMSVBAStorage( SfxObjectShell &rDocSh)
+{
+ uno::Reference < embed::XStorage > xSrcRoot( rDocSh.GetStorage() );
+ SvStorageRef xVBAStg( SotStorage::OpenOLEStorage( xSrcRoot, GetMSBasicStorageName(),
+ STREAM_READ | STREAM_NOCREATE | STREAM_SHARE_DENYALL ));
+ return ( xVBAStg.Is() && !xVBAStg->GetError() )
+ ? ERRCODE_SVX_VBASIC_STORAGE_EXIST
+ : ERRCODE_NONE;
+}
+
+String SvxImportMSVBasic::GetMSBasicStorageName()
+{
+ return String( RTL_CONSTASCII_USTRINGPARAM( "_MS_VBA_Macros" ) );
+}
diff --git a/filter/source/msfilter/viscache.hxx b/filter/source/msfilter/viscache.hxx
new file mode 100644
index 000000000000..075c4c39cc38
--- /dev/null
+++ b/filter/source/msfilter/viscache.hxx
@@ -0,0 +1,82 @@
+/*************************************************************************
+ *
+ * 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 <tools/stream.hxx>
+#include <vcl/gdimtf.hxx>
+#include <vcl/bitmap.hxx>
+
+/************************************************************************
+|* Impl_CacheElement
+|* Impl_Cache
+|*
+|* Beschreibung
+*************************************************************************/
+class Impl_OlePres
+{
+ ULONG nFormat;
+ USHORT nAspect;
+ Bitmap * pBmp;
+ GDIMetaFile * pMtf;
+
+ UINT32 nAdvFlags;
+ INT32 nJobLen;
+ BYTE* pJob;
+ Size aSize; // Groesse in 100TH_MM
+public:
+ Impl_OlePres( ULONG nF )
+ : nFormat( nF )
+ , pBmp( NULL )
+ , pMtf( NULL )
+ , nAdvFlags( 0x2 ) // in Dokument gefunden
+ , nJobLen( 0 )
+ , pJob( NULL )
+ {}
+ ~Impl_OlePres()
+ {
+ delete pJob;
+ delete pBmp;
+ delete pMtf;
+ }
+ void SetMtf( const GDIMetaFile & rMtf )
+ {
+ if( pMtf )
+ delete pMtf;
+ pMtf = new GDIMetaFile( rMtf );
+ }
+ Bitmap *GetBitmap() const { return pBmp; }
+ GDIMetaFile *GetMetaFile() const { return pMtf; }
+ ULONG GetFormat() const { return nFormat; }
+ void SetAspect( USHORT nAsp ) { nAspect = nAsp; }
+ ULONG GetAdviseFlags() const { return nAdvFlags; }
+ void SetAdviseFlags( ULONG nAdv ) { nAdvFlags = nAdv; }
+ void SetSize( const Size & rSize ) { aSize = rSize; }
+ /// return FALSE => unknown format
+ BOOL Read( SvStream & rStm );
+ void Write( SvStream & rStm );
+};
+
+
diff --git a/filter/source/pdf/impdialog.cxx b/filter/source/pdf/impdialog.cxx
new file mode 100644
index 000000000000..bb125bd37a47
--- /dev/null
+++ b/filter/source/pdf/impdialog.cxx
@@ -0,0 +1,1553 @@
+ /*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include "impdialog.hxx"
+#include "impdialog.hrc"
+#include "vcl/svapp.hxx"
+#include "vcl/msgbox.hxx"
+#include "sfx2/passwd.hxx"
+#include "com/sun/star/uno/Sequence.hxx"
+#include "com/sun/star/text/XTextRange.hpp"
+#include "com/sun/star/drawing/XShapes.hpp"
+#include "com/sun/star/container/XIndexAccess.hpp"
+#include "com/sun/star/frame/XController.hpp"
+#include "com/sun/star/view/XSelectionSupplier.hpp"
+
+#include <boost/shared_ptr.hpp>
+
+static ResMgr& getPDFFilterResMgr()
+{
+ static ResMgr *pRes = ResMgr::CreateResMgr( "pdffilter", Application::GetSettings().GetUILocale());
+ return *pRes;
+}
+
+PDFFilterResId::PDFFilterResId( sal_uInt32 nId ) : ResId( nId, getPDFFilterResMgr() )
+{
+}
+
+// ----------------
+// - ImpPDFDialog -
+// ----------------
+
+using namespace ::com::sun::star;
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////
+// tabbed PDF dialog implementation
+// please note: the default used here are the same as per specification,
+// they should be the same in PDFFilter::implExport and in PDFExport::PDFExport
+// -----------------------------------------------------------------------------
+ImpPDFTabDialog::ImpPDFTabDialog( Window* pParent,
+ Sequence< PropertyValue >& rFilterData,
+ const Reference< XComponent >& rxDoc,
+ const Reference< lang::XMultiServiceFactory >& xFact
+ ) :
+ SfxTabDialog( pParent, PDFFilterResId( RID_PDF_EXPORT_DLG ), 0, FALSE, 0 ),
+ mxMSF( xFact ),
+ maConfigItem( String( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Filter/PDF/Export/" ) ), &rFilterData ),
+ maConfigI18N( String( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/I18N/CTL/" ) ) ),
+ mbIsPresentation( sal_False ),
+ mbIsWriter( sal_False ),
+
+ mbSelectionPresent( sal_False ),
+ mbUseCTLFont( sal_False ),
+ mbUseLosslessCompression( sal_True ),
+ mnQuality( 90 ),
+ mbReduceImageResolution( sal_False ),
+ mnMaxImageResolution( 300 ),
+ mbUseTaggedPDF( sal_False ),
+ mbExportNotes( sal_True ),
+ mbExportNotesPages( sal_False ),
+ mbUseTransitionEffects( sal_False ),
+ mbIsSkipEmptyPages( sal_True ),
+ mbAddStream( sal_False ),
+ mbEmbedStandardFonts( sal_False ),
+ mnFormsType( 0 ),
+ mbExportFormFields( sal_True ),
+ mbAllowDuplicateFieldNames( sal_False ),
+ mbExportBookmarks( sal_True ),
+ mnOpenBookmarkLevels( -1 ),
+
+ mbHideViewerToolbar( sal_False ),
+ mbHideViewerMenubar( sal_False ),
+ mbHideViewerWindowControls( sal_False ),
+ mbResizeWinToInit( sal_False ),
+ mbCenterWindow( sal_False ),
+ mbOpenInFullScreenMode( sal_False ),
+ mbDisplayPDFDocumentTitle( sal_False ),
+ mnMagnification( 0 ),
+ mnInitialView( 0 ),
+ mnZoom( 0 ),
+ mnInitialPage( 1 ),
+ mnPageLayout( 0 ),
+ mbFirstPageLeft( sal_False ),
+
+ mbEncrypt( false ),
+ mbRestrictPermissions( false ),
+ mnPrint( 0 ),
+ mnChangesAllowed( 0 ),
+ mbCanCopyOrExtract( false ),
+ mbCanExtractForAccessibility( true ),
+
+ mbIsRangeChecked( sal_False ),
+ msPageRange( ' ' ),
+
+ mbSelectionIsChecked( sal_False ),
+ mbExportRelativeFsysLinks( sal_False ),
+ mnViewPDFMode( 0 ),
+ mbConvertOOoTargets( sal_False ),
+ mbExportBmkToPDFDestination( sal_False )
+{
+ FreeResource();
+// check for selection
+ try
+ {
+ Reference< frame::XController > xController( Reference< frame::XModel >( rxDoc, UNO_QUERY )->getCurrentController() );
+ if( xController.is() )
+ {
+ Reference< view::XSelectionSupplier > xView( xController, UNO_QUERY );
+ if( xView.is() )
+ xView->getSelection() >>= maSelection;
+ }
+ }
+ catch( RuntimeException )
+ {
+ }
+ mbSelectionPresent = maSelection.hasValue();
+ if ( mbSelectionPresent )
+ {
+ Reference< drawing::XShapes > xShapes;
+ if ( ( maSelection >>= xShapes ) == sal_False ) // XShapes is always a selection
+ {
+ // even if nothing is selected in writer the selection is not empty
+ Reference< container::XIndexAccess > xIndexAccess;
+ if ( maSelection >>= xIndexAccess )
+ {
+ sal_Int32 nLen = xIndexAccess->getCount();
+ if ( !nLen )
+ mbSelectionPresent = sal_False;
+ else if ( nLen == 1 )
+ {
+ Reference< text::XTextRange > xTextRange( xIndexAccess->getByIndex( 0 ), UNO_QUERY );
+ if ( xTextRange.is() && ( xTextRange->getString().getLength() == 0 ) )
+ mbSelectionPresent = sal_False;
+ }
+ }
+ }
+ }
+
+// check if source document is a presentation
+ try
+ {
+ Reference< XServiceInfo > xInfo( rxDoc, UNO_QUERY );
+ if ( xInfo.is() )
+ {
+ if ( xInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.presentation.PresentationDocument" ) ) ) )
+ mbIsPresentation = sal_True;
+ if ( xInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.GenericTextDocument" ) ) ) )
+ mbIsWriter = sal_True;
+ }
+ }
+ catch( RuntimeException )
+ {
+ }
+
+//get the CTL (Complex Text Layout) from general options, returns TRUE if we have a CTL font on our hands.
+ mbUseCTLFont = maConfigI18N.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "CTLFont" ) ), sal_False );
+
+ mbUseLosslessCompression = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "UseLosslessCompression" ) ), sal_False );
+ mnQuality = maConfigItem.ReadInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "Quality" ) ), 90 );
+ mbReduceImageResolution = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ReduceImageResolution" ) ), sal_False );
+ mnMaxImageResolution = maConfigItem.ReadInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "MaxImageResolution" ) ), 300 );
+
+ mbUseTaggedPDF = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "UseTaggedPDF" ) ), sal_False );
+ mnPDFTypeSelection = maConfigItem.ReadInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "SelectPdfVersion" ) ), 0 );
+ if ( mbIsPresentation )
+ mbExportNotesPages = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportNotesPages" ) ), sal_False );
+ mbExportNotes = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportNotes" ) ), sal_False );
+
+ mbExportBookmarks = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportBookmarks" ) ), sal_True );
+ mnOpenBookmarkLevels = maConfigItem.ReadInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "OpenBookmarkLevels" ) ), -1 );
+ mbUseTransitionEffects = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "UseTransitionEffects" ) ), sal_True );
+ mbIsSkipEmptyPages = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsSkipEmptyPages" ) ), sal_False );
+ mbAddStream = maConfigItem.ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "IsAddStream" ) ), sal_False );
+ mbEmbedStandardFonts = maConfigItem.ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "EmbedStandardFonts" ) ), sal_False );
+
+ mnFormsType = maConfigItem.ReadInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "FormsType" ) ), 0 );
+ mbExportFormFields = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportFormFields" ) ), sal_True );
+ if ( ( mnFormsType < 0 ) || ( mnFormsType > 3 ) )
+ mnFormsType = 0;
+ mbAllowDuplicateFieldNames = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "AllowDuplicateFieldNames" ) ), sal_False );
+
+//prepare values for the Viewer tab page
+ mbHideViewerToolbar = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "HideViewerToolbar" ) ), sal_False );
+ mbHideViewerMenubar = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "HideViewerMenubar" ) ), sal_False );
+ mbHideViewerWindowControls = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "HideViewerWindowControls" ) ), sal_False );
+ mbResizeWinToInit = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ResizeWindowToInitialPage" ) ), sal_False );
+ mbCenterWindow = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "CenterWindow" ) ), sal_False );
+ mbOpenInFullScreenMode = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "OpenInFullScreenMode" ) ), sal_False );
+ mbDisplayPDFDocumentTitle = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "DisplayPDFDocumentTitle" ) ), sal_True );
+
+ mnInitialView = maConfigItem.ReadInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "InitialView" ) ), 0 );
+ mnMagnification = maConfigItem.ReadInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "Magnification" ) ), 0 );
+ mnZoom = maConfigItem.ReadInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "Zoom" ) ), 100 );
+ mnPageLayout = maConfigItem.ReadInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "PageLayout" ) ), 0 );
+ mbFirstPageLeft = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "FirstPageOnLeft" ) ), sal_False );
+ mnInitialPage = maConfigItem.ReadInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "InitialPage" ) ), 1 );
+ if( mnInitialPage < 1 )
+ mnInitialPage = 1;
+
+//prepare values for the security tab page
+ mnPrint = maConfigItem.ReadInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "Printing" ) ), 2 );
+ mnChangesAllowed = maConfigItem.ReadInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "Changes" ) ), 4 );
+ mbCanCopyOrExtract = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "EnableCopyingOfContent" ) ), sal_True );
+ mbCanExtractForAccessibility = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "EnableTextAccessForAccessibilityTools" ) ), sal_True );
+
+//prepare values for relative links
+ mbExportRelativeFsysLinks = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportLinksRelativeFsys" ) ), sal_False );
+
+ mnViewPDFMode = maConfigItem.ReadInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "PDFViewSelection" ) ), 0 );
+
+ mbConvertOOoTargets = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ConvertOOoTargetToPDFTarget" ) ), sal_False );
+ mbExportBmkToPDFDestination = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportBookmarksToPDFDestination" ) ), sal_False );
+
+//queue the tab pages for later creation (created when first shown)
+ AddTabPage( RID_PDF_TAB_SECURITY, ImpPDFTabSecurityPage::Create, 0 );
+ AddTabPage( RID_PDF_TAB_LINKS, ImpPDFTabLinksPage::Create, 0 );
+ AddTabPage( RID_PDF_TAB_VPREFER, ImpPDFTabViewerPage::Create, 0 );
+ AddTabPage( RID_PDF_TAB_OPNFTR, ImpPDFTabOpnFtrPage::Create, 0 );
+
+//last queued is the first to be displayed (or so it seems..)
+ AddTabPage( RID_PDF_TAB_GENER, ImpPDFTabGeneralPage::Create, 0 );
+
+//get the string property value (from sfx2/source/dialog/mailmodel.cxx) to overwrite the text for the Ok button
+ ::rtl::OUString sOkButtonText = maConfigItem.ReadString( OUString( RTL_CONSTASCII_USTRINGPARAM( "_OkButtonString" ) ), OUString() );
+
+//change text on the Ok button: get the relevant string from resources, update it on the button
+//according to the exported pdf file destination: send as e-mail or write to file?
+ GetOKButton().SetText( ( sOkButtonText.getLength() > 0 ) ?
+ sOkButtonText : OUString( String( PDFFilterResId( STR_PDF_EXPORT ) ) ));
+
+//remove the reset button, not needed in this tabbed dialog
+ RemoveResetButton();
+/////////////////
+}
+
+// -----------------------------------------------------------------------------
+ImpPDFTabDialog::~ImpPDFTabDialog()
+{
+//delete the pages, needed because otherwise the child tab pages
+//don't get destroyed
+ RemoveTabPage( RID_PDF_TAB_GENER );
+ RemoveTabPage( RID_PDF_TAB_VPREFER );
+ RemoveTabPage( RID_PDF_TAB_OPNFTR );
+ RemoveTabPage( RID_PDF_TAB_LINKS );
+ RemoveTabPage( RID_PDF_TAB_SECURITY );
+}
+
+// -----------------------------------------------------------------------------
+void ImpPDFTabDialog::PageCreated( USHORT _nId,
+ SfxTabPage& _rPage )
+{
+ switch( _nId )
+ {
+ case RID_PDF_TAB_GENER:
+ ( ( ImpPDFTabGeneralPage* )&_rPage )->SetFilterConfigItem( this );
+ break;
+ case RID_PDF_TAB_VPREFER:
+ ( ( ImpPDFTabViewerPage* )&_rPage )->SetFilterConfigItem( this );
+ break;
+ case RID_PDF_TAB_OPNFTR:
+ ( ( ImpPDFTabOpnFtrPage* )&_rPage )->SetFilterConfigItem( this );
+ break;
+ case RID_PDF_TAB_LINKS:
+ ( ( ImpPDFTabLinksPage* )&_rPage )->SetFilterConfigItem( this );
+ break;
+ case RID_PDF_TAB_SECURITY:
+ ( ( ImpPDFTabSecurityPage* )&_rPage )->SetFilterConfigItem( this );
+ break;
+ }
+}
+
+// -----------------------------------------------------------------------------
+short ImpPDFTabDialog::Ok( )
+{
+//here the whole mechanism of the base class is not used
+//when Ok is hit, the user means 'convert to PDF', so simply close with ok
+ return RET_OK;
+}
+
+// -----------------------------------------------------------------------------
+Sequence< PropertyValue > ImpPDFTabDialog::GetFilterData()
+{
+// updating the FilterData sequence and storing FilterData to configuration
+ if( GetTabPage( RID_PDF_TAB_GENER ) )
+ ( ( ImpPDFTabGeneralPage* )GetTabPage( RID_PDF_TAB_GENER ) )->GetFilterConfigItem( this );
+ if( GetTabPage( RID_PDF_TAB_VPREFER ) )
+ ( ( ImpPDFTabViewerPage* )GetTabPage( RID_PDF_TAB_VPREFER ) )->GetFilterConfigItem( this );
+ if( GetTabPage( RID_PDF_TAB_OPNFTR ) )
+ ( ( ImpPDFTabOpnFtrPage* )GetTabPage( RID_PDF_TAB_OPNFTR ) )->GetFilterConfigItem( this );
+ if( GetTabPage( RID_PDF_TAB_LINKS ) )
+ ( ( ImpPDFTabLinksPage* )GetTabPage( RID_PDF_TAB_LINKS ) )->GetFilterConfigItem( this );
+ if( GetTabPage( RID_PDF_TAB_SECURITY ) )
+ ( ( ImpPDFTabSecurityPage* )GetTabPage( RID_PDF_TAB_SECURITY ) )->GetFilterConfigItem( this );
+
+//prepare the items to be returned
+ maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "UseLosslessCompression" ) ), mbUseLosslessCompression );
+ maConfigItem.WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "Quality" ) ), mnQuality );
+ maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ReduceImageResolution" ) ), mbReduceImageResolution );
+ maConfigItem.WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "MaxImageResolution" ) ), mnMaxImageResolution );
+
+ maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "UseTaggedPDF" ) ), mbUseTaggedPDF );
+ maConfigItem.WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "SelectPdfVersion" ) ), mnPDFTypeSelection );
+
+ if ( mbIsPresentation )
+ maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportNotesPages" ) ), mbExportNotesPages );
+ maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportNotes" ) ), mbExportNotes );
+
+ maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportBookmarks" ) ), mbExportBookmarks );
+ maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "UseTransitionEffects" ) ), mbUseTransitionEffects );
+ maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsSkipEmptyPages" ) ), mbIsSkipEmptyPages );
+ maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsAddStream" ) ), mbAddStream );
+ maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "EmbedStandardFonts" ) ), mbEmbedStandardFonts );
+
+ /*
+ * FIXME: the entries are only implicitly defined by the resource file. Should there
+ * ever be an additional form submit format this could get invalid.
+ */
+ maConfigItem.WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "FormsType" ) ), mnFormsType );
+ maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportFormFields" ) ), mbExportFormFields );
+ maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "AllowDuplicateFieldNames" ) ), mbAllowDuplicateFieldNames );
+
+ maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "HideViewerToolbar" ) ), mbHideViewerToolbar );
+ maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "HideViewerMenubar" ) ), mbHideViewerMenubar );
+ maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "HideViewerWindowControls" ) ), mbHideViewerWindowControls );
+ maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ResizeWindowToInitialPage" ) ), mbResizeWinToInit );
+ maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "CenterWindow" ) ), mbCenterWindow );
+ maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "OpenInFullScreenMode" ) ), mbOpenInFullScreenMode );
+ maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "DisplayPDFDocumentTitle" ) ), mbDisplayPDFDocumentTitle );
+ maConfigItem.WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "InitialView" ) ), mnInitialView );
+ maConfigItem.WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "Magnification" ) ), mnMagnification);
+ maConfigItem.WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "Zoom" ) ), mnZoom );
+ maConfigItem.WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "InitialPage" ) ), mnInitialPage );
+ maConfigItem.WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "PageLayout" ) ), mnPageLayout );
+ maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "FirstPageOnLeft" ) ), mbFirstPageLeft );
+ maConfigItem.WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "OpenBookmarkLevels" ) ), mnOpenBookmarkLevels );
+
+ maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportLinksRelativeFsys" ) ), mbExportRelativeFsysLinks );
+ maConfigItem.WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "PDFViewSelection" ) ), mnViewPDFMode );
+ maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ConvertOOoTargetToPDFTarget" ) ), mbConvertOOoTargets );
+ maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportBookmarksToPDFDestination" ) ), mbExportBmkToPDFDestination );
+
+ maConfigItem.WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "Printing" ) ), mnPrint );
+ maConfigItem.WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "Changes" ) ), mnChangesAllowed );
+ maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "EnableCopyingOfContent" ) ), mbCanCopyOrExtract );
+ maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "EnableTextAccessForAccessibilityTools" ) ), mbCanExtractForAccessibility );
+
+ Sequence< PropertyValue > aRet( maConfigItem.GetFilterData() );
+
+ int nElementAdded = 5;
+
+ aRet.realloc( aRet.getLength() + nElementAdded );
+
+// add the encryption enable flag
+ aRet[ aRet.getLength() - nElementAdded ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "EncryptFile" ) );
+ aRet[ aRet.getLength() - nElementAdded ].Value <<= mbEncrypt;
+ nElementAdded--;
+
+// add the open password
+ aRet[ aRet.getLength() - nElementAdded ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "DocumentOpenPassword" ) );
+ aRet[ aRet.getLength() - nElementAdded ].Value <<= OUString( msUserPassword );
+ nElementAdded--;
+
+//the restrict permission flag (needed to have the scripting consistent with the dialog)
+ aRet[ aRet.getLength() - nElementAdded ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "RestrictPermissions" ) );
+ aRet[ aRet.getLength() - nElementAdded ].Value <<= mbRestrictPermissions;
+ nElementAdded--;
+
+//add the permission password
+ aRet[ aRet.getLength() - nElementAdded ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PermissionPassword" ) );
+ aRet[ aRet.getLength() - nElementAdded ].Value <<= OUString( msOwnerPassword );
+ nElementAdded--;
+
+// this should be the last added...
+ if( mbIsRangeChecked )
+ {
+ aRet[ aRet.getLength() - nElementAdded ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PageRange" ) );
+ aRet[ aRet.getLength() - nElementAdded ].Value <<= OUString( msPageRange );
+ }
+ else if( mbSelectionIsChecked )
+ {
+ aRet[ aRet.getLength() - nElementAdded ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Selection" ) );
+ aRet[ aRet.getLength() - nElementAdded ].Value <<= maSelection;
+ }
+
+ return aRet;
+}
+
+// -----------------------------------------------------------------------------
+ImpPDFTabGeneralPage::ImpPDFTabGeneralPage( Window* pParent,
+ const SfxItemSet& rCoreSet
+ ) :
+ SfxTabPage( pParent, PDFFilterResId( RID_PDF_TAB_GENER ), rCoreSet ),
+
+ maFlPages( this, PDFFilterResId( FL_PAGES ) ),
+ maRbAll( this, PDFFilterResId( RB_ALL ) ),
+ maRbRange( this, PDFFilterResId( RB_RANGE ) ),
+ maRbSelection( this, PDFFilterResId( RB_SELECTION ) ),
+ maEdPages( this, PDFFilterResId( ED_PAGES ) ),
+
+ maFlCompression( this, PDFFilterResId( FL_IMAGES ) ),
+ maRbLosslessCompression( this, PDFFilterResId( RB_LOSSLESSCOMPRESSION ) ),
+ maRbJPEGCompression( this, PDFFilterResId( RB_JPEGCOMPRESSION ) ),
+ maFtQuality( this, PDFFilterResId( FT_QUALITY ) ),
+ maNfQuality( this, PDFFilterResId( NF_QUALITY ) ),
+ maCbReduceImageResolution( this, PDFFilterResId( CB_REDUCEIMAGERESOLUTION ) ),
+ maCoReduceImageResolution( this, PDFFilterResId( CO_REDUCEIMAGERESOLUTION ) ),
+
+ maFlGeneral( this, PDFFilterResId( FL_GENERAL ) ),
+ maCbPDFA1b( this, PDFFilterResId( CB_PDFA_1B_SELECT ) ),
+
+ maCbTaggedPDF( this, PDFFilterResId( CB_TAGGEDPDF ) ),
+ mbTaggedPDFUserSelection( sal_False ),
+
+ maCbExportFormFields( this, PDFFilterResId( CB_EXPORTFORMFIELDS ) ),
+ mbExportFormFieldsUserSelection( sal_False ),
+ mbEmbedStandardFontsUserSelection( sal_False ),
+ maFtFormsFormat( this, PDFFilterResId( FT_FORMSFORMAT ) ),
+ maLbFormsFormat( this, PDFFilterResId( LB_FORMSFORMAT ) ),
+ maCbAllowDuplicateFieldNames( this, PDFFilterResId( CB_ALLOWDUPLICATEFIELDNAMES ) ),
+
+ maCbExportBookmarks( this, PDFFilterResId( CB_EXPORTBOOKMARKS ) ),
+ maCbExportNotes( this, PDFFilterResId( CB_EXPORTNOTES ) ),
+ maCbExportNotesPages( this, PDFFilterResId( CB_EXPORTNOTESPAGES ) ),
+ maCbExportEmptyPages( this, PDFFilterResId( CB_EXPORTEMPTYPAGES ) ),
+ maCbAddStream( this, PDFFilterResId( CB_ADDSTREAM ) ),
+ maCbEmbedStandardFonts( this, PDFFilterResId( CB_EMBEDSTANDARDFONTS ) ),
+ mbIsPresentation( sal_False ),
+ mbIsWriter( sal_False),
+ mpaParent( 0 )
+{
+ FreeResource();
+
+ // pb: #i91991# maCbExportEmptyPages double-spaced if necessary
+ Size aSize = maCbExportEmptyPages.GetSizePixel();
+ Size aMinSize = maCbExportEmptyPages.CalcMinimumSize();
+ if ( aSize.Width() > aMinSize.Width() )
+ {
+ Size aNewSize = maCbExportNotes.GetSizePixel();
+ long nDelta = aSize.Height() - aNewSize.Height();
+ maCbExportEmptyPages.SetSizePixel( aNewSize );
+ Point aNewPos = maCbAddStream.GetPosPixel();
+ aNewPos.Y() -= nDelta;
+ maCbAddStream.SetPosPixel( aNewPos );
+ aNewPos = maCbEmbedStandardFonts.GetPosPixel();
+ aNewPos.Y() -= nDelta;
+ maCbEmbedStandardFonts.SetPosPixel( aNewPos );
+ }
+ maCbExportEmptyPages.SetStyle( maCbExportEmptyPages.GetStyle() | WB_VCENTER );
+}
+
+// -----------------------------------------------------------------------------
+ImpPDFTabGeneralPage::~ImpPDFTabGeneralPage()
+{
+}
+
+// -----------------------------------------------------------------------------
+void ImpPDFTabGeneralPage::SetFilterConfigItem( const ImpPDFTabDialog* paParent )
+{
+ mpaParent = paParent;
+
+//init this class data
+ maRbRange.SetToggleHdl( LINK( this, ImpPDFTabGeneralPage, TogglePagesHdl ) );
+
+ maRbAll.Check();
+ TogglePagesHdl( NULL );
+
+ maNfQuality.SetUnit( FUNIT_PERCENT );
+ maNfQuality.SetMin( 1, FUNIT_PERCENT );
+ maNfQuality.SetMax( 100, FUNIT_PERCENT );
+
+ maRbSelection.Enable( paParent->mbSelectionPresent );
+ mbIsPresentation = paParent->mbIsPresentation;
+ mbIsWriter = paParent->mbIsWriter;
+
+ maCbExportEmptyPages.Enable( mbIsWriter );
+
+ maRbLosslessCompression.SetToggleHdl( LINK( this, ImpPDFTabGeneralPage, ToggleCompressionHdl ) );
+ const sal_Bool bUseLosslessCompression = paParent->mbUseLosslessCompression;
+ if ( bUseLosslessCompression )
+ maRbLosslessCompression.Check();
+ else
+ maRbJPEGCompression.Check();
+
+ maNfQuality.SetValue( paParent->mnQuality, FUNIT_PERCENT );
+ maNfQuality.Enable( bUseLosslessCompression == sal_False );
+
+ maCbReduceImageResolution.SetToggleHdl( LINK( this, ImpPDFTabGeneralPage, ToggleReduceImageResolutionHdl ) );
+ const sal_Bool bReduceImageResolution = paParent->mbReduceImageResolution;
+ maCbReduceImageResolution.Check( bReduceImageResolution );
+ String aStrRes( String::CreateFromInt32( paParent->mnMaxImageResolution ) );
+ aStrRes.Append( String( RTL_CONSTASCII_USTRINGPARAM( " DPI" ) ) );
+ maCoReduceImageResolution.SetText( aStrRes );
+ maCoReduceImageResolution.Enable( bReduceImageResolution );
+
+ maCbPDFA1b.SetToggleHdl( LINK( this, ImpPDFTabGeneralPage, ToggleExportPDFAHdl) );
+ switch( paParent->mnPDFTypeSelection )
+ {
+ default:
+ case 0: maCbPDFA1b.Check( FALSE ); // PDF 1.4
+ break;
+ case 1: maCbPDFA1b.Check(); // PDF/A-1a
+ break;
+ }
+ ToggleExportPDFAHdl( NULL );
+
+ maCbExportFormFields.SetToggleHdl( LINK( this, ImpPDFTabGeneralPage, ToggleExportFormFieldsHdl ) );
+
+// get the form values, for use with PDF/A-1 selection interface
+ mbTaggedPDFUserSelection = paParent->mbUseTaggedPDF;
+ mbExportFormFieldsUserSelection = paParent->mbExportFormFields;
+ mbEmbedStandardFontsUserSelection = paParent->mbEmbedStandardFonts;
+
+ if( !maCbPDFA1b.IsChecked() )
+ {// the value for PDF/A set by the ToggleExportPDFAHdl method called before
+ maCbTaggedPDF.Check( mbTaggedPDFUserSelection );
+ maCbExportFormFields.Check( mbExportFormFieldsUserSelection );
+ maCbEmbedStandardFonts.Check( mbEmbedStandardFontsUserSelection );
+ }
+
+ maLbFormsFormat.SelectEntryPos( (sal_uInt16)paParent->mnFormsType );
+ maLbFormsFormat.Enable( paParent->mbExportFormFields );
+ maCbAllowDuplicateFieldNames.Check( paParent->mbAllowDuplicateFieldNames );
+ maCbAllowDuplicateFieldNames.Enable( paParent->mbExportFormFields );
+
+ maCbExportBookmarks.Check( paParent->mbExportBookmarks );
+
+ maCbExportNotes.Check( paParent->mbExportNotes );
+
+ if ( mbIsPresentation )
+ {
+ maCbExportNotesPages.Show( TRUE );
+ maCbExportNotesPages.Check( paParent->mbExportNotesPages );
+ }
+ else
+ {
+ long nCheckBoxHeight =
+ maCbExportNotesPages.LogicToPixel( Size( 13, 13 ), MAP_APPFONT ).Height();
+
+ Point aPos = maCbExportEmptyPages.GetPosPixel();
+ maCbExportEmptyPages.SetPosPixel( Point( aPos.X(), aPos.Y() - nCheckBoxHeight ) );
+ aPos = maCbAddStream.GetPosPixel();
+ maCbAddStream.SetPosPixel( Point( aPos.X(), aPos.Y() - nCheckBoxHeight ) );
+ aPos = maCbEmbedStandardFonts.GetPosPixel();
+ maCbEmbedStandardFonts.SetPosPixel( Point( aPos.X(), aPos.Y() - nCheckBoxHeight ) );
+ maCbExportNotesPages.Show( FALSE );
+ maCbExportNotesPages.Check( FALSE );
+ }
+
+ maCbExportEmptyPages.Check( !paParent->mbIsSkipEmptyPages );
+
+ Reference< XMultiServiceFactory > xFactory = paParent->getServiceFactory();
+ Reference< XInterface > xIfc;
+ if( xFactory.is() )
+ {
+ xIfc = xFactory->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.documents.PDFDetector" ) ) );
+ }
+ if( xIfc.is() )
+ {
+ maCbAddStream.Show( TRUE );
+ maCbAddStream.Check( paParent->mbAddStream );
+ }
+ else
+ {
+ maCbAddStream.Show( FALSE );
+ maCbAddStream.Check( FALSE );
+ }
+ maCbAddStream.SetToggleHdl( LINK( this, ImpPDFTabGeneralPage, ToggleAddStreamHdl ) );
+ // init addstream dependencies
+ ToggleAddStreamHdl( NULL );
+}
+
+// -----------------------------------------------------------------------------
+void ImpPDFTabGeneralPage::GetFilterConfigItem( ImpPDFTabDialog* paParent )
+{
+// updating the FilterData sequence and storing FilterData to configuration
+ paParent->mbUseLosslessCompression = maRbLosslessCompression.IsChecked();
+ paParent->mnQuality = static_cast<sal_Int32>(maNfQuality.GetValue());
+ paParent->mbReduceImageResolution = maCbReduceImageResolution.IsChecked();
+ paParent->mnMaxImageResolution = maCoReduceImageResolution.GetText().ToInt32();
+ paParent->mbExportNotes = maCbExportNotes.IsChecked();
+ if ( mbIsPresentation )
+ paParent->mbExportNotesPages = maCbExportNotesPages.IsChecked();
+ paParent->mbExportBookmarks = maCbExportBookmarks.IsChecked();
+
+ paParent->mbIsSkipEmptyPages = !maCbExportEmptyPages.IsChecked();
+ paParent->mbAddStream = maCbAddStream.IsVisible() && maCbAddStream.IsChecked();
+
+ paParent->mbIsRangeChecked = sal_False;
+ if( maRbRange.IsChecked() )
+ {
+ paParent->mbIsRangeChecked = sal_True;
+ paParent->msPageRange = String( maEdPages.GetText() ); //FIXME all right on other languages ?
+ }
+ else if( maRbSelection.IsChecked() )
+ {
+ paParent->mbSelectionIsChecked = maRbSelection.IsChecked();
+ }
+
+ paParent->mnPDFTypeSelection = 0;
+ if( maCbPDFA1b.IsChecked() )
+ {
+ paParent->mnPDFTypeSelection = 1;
+ paParent->mbUseTaggedPDF = mbTaggedPDFUserSelection;
+ paParent->mbExportFormFields = mbExportFormFieldsUserSelection;
+ paParent->mbEmbedStandardFonts = mbEmbedStandardFontsUserSelection;
+ }
+ else
+ {
+ paParent->mbUseTaggedPDF = maCbTaggedPDF.IsChecked();
+ paParent->mbExportFormFields = maCbExportFormFields.IsChecked();
+ paParent->mbEmbedStandardFonts = maCbEmbedStandardFonts.IsChecked();
+ }
+
+ /*
+ * FIXME: the entries are only implicitly defined by the resource file. Should there
+ * ever be an additional form submit format this could get invalid.
+ */
+ paParent->mnFormsType = (sal_Int32) maLbFormsFormat.GetSelectEntryPos();
+ paParent->mbAllowDuplicateFieldNames = maCbAllowDuplicateFieldNames.IsChecked();
+}
+
+// -----------------------------------------------------------------------------
+SfxTabPage* ImpPDFTabGeneralPage::Create( Window* pParent,
+ const SfxItemSet& rAttrSet)
+{
+ return ( new ImpPDFTabGeneralPage( pParent, rAttrSet ) );
+}
+
+// -----------------------------------------------------------------------------
+IMPL_LINK( ImpPDFTabGeneralPage, TogglePagesHdl, void*, EMPTYARG )
+{
+ maEdPages.Enable( maRbRange.IsChecked() );
+ maEdPages.SetReadOnly( !maRbRange.IsChecked() );
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+IMPL_LINK( ImpPDFTabGeneralPage, ToggleExportFormFieldsHdl, void*, EMPTYARG )
+{
+ maLbFormsFormat.Enable( maCbExportFormFields.IsChecked() );
+ maCbAllowDuplicateFieldNames.Enable( maCbExportFormFields.IsChecked() );
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+IMPL_LINK( ImpPDFTabGeneralPage, ToggleCompressionHdl, void*, EMPTYARG )
+{
+ maNfQuality.Enable( maRbJPEGCompression.IsChecked() );
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+IMPL_LINK( ImpPDFTabGeneralPage, ToggleReduceImageResolutionHdl, void*, EMPTYARG )
+{
+ maCoReduceImageResolution.Enable( maCbReduceImageResolution.IsChecked() );
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+IMPL_LINK( ImpPDFTabGeneralPage, ToggleAddStreamHdl, void*, EMPTYARG )
+{
+ if( maCbAddStream.IsVisible() )
+ {
+ if( maCbAddStream.IsChecked() )
+ {
+ maRbAll.Check();
+ maRbRange.Enable( FALSE );
+ maRbSelection.Enable( FALSE );
+ maEdPages.Enable( FALSE );
+ maEdPages.SetReadOnly( TRUE );
+ maRbAll.Enable( FALSE );
+ }
+ else
+ {
+ maRbAll.Enable( TRUE );
+ maRbRange.Enable( TRUE );
+ maRbSelection.Enable( TRUE );
+ }
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+IMPL_LINK( ImpPDFTabGeneralPage, ToggleExportPDFAHdl, void*, EMPTYARG )
+{
+//set the security page status (and its controls as well)
+ if( mpaParent && mpaParent->GetTabPage( RID_PDF_TAB_SECURITY ) )
+ ( ( ImpPDFTabSecurityPage* )mpaParent->GetTabPage( RID_PDF_TAB_SECURITY ) )->ImplPDFASecurityControl( !maCbPDFA1b.IsChecked() );
+
+//PDF/A-1 needs tagged PDF, so force disable the control, will be forced in pdfexport.
+ sal_Bool bPDFA1Sel = maCbPDFA1b.IsChecked();
+ maFtFormsFormat.Enable( !bPDFA1Sel );
+ maLbFormsFormat.Enable( !bPDFA1Sel );
+ maCbAllowDuplicateFieldNames.Enable( !bPDFA1Sel );
+ if(bPDFA1Sel)
+ {
+//store the values of subordinate controls
+ mbTaggedPDFUserSelection = maCbTaggedPDF.IsChecked();
+ maCbTaggedPDF.Check();
+ maCbTaggedPDF.Enable( sal_False );
+ mbExportFormFieldsUserSelection = maCbExportFormFields.IsChecked();
+ maCbExportFormFields.Check( sal_False );
+ maCbExportFormFields.Enable( sal_False );
+ mbEmbedStandardFontsUserSelection = maCbEmbedStandardFonts.IsChecked();
+ maCbEmbedStandardFonts.Check( sal_True );
+ maCbEmbedStandardFonts.Enable( sal_False );
+ }
+ else
+ {
+//retrieve the values of subordinate controls
+ maCbTaggedPDF.Enable();
+ maCbTaggedPDF.Check( mbTaggedPDFUserSelection );
+ maCbExportFormFields.Check( mbExportFormFieldsUserSelection );
+ maCbExportFormFields.Enable();
+ maCbEmbedStandardFonts.Check( mbEmbedStandardFontsUserSelection );
+ maCbEmbedStandardFonts.Enable();
+ }
+// PDF/A-1 doesn't allow launch action, so enable/disable the selection on
+// Link page
+ if( mpaParent && mpaParent->GetTabPage( RID_PDF_TAB_LINKS ) )
+ ( ( ImpPDFTabLinksPage* )mpaParent->GetTabPage( RID_PDF_TAB_LINKS ) )->ImplPDFALinkControl( !maCbPDFA1b.IsChecked() );
+
+ return 0;
+}
+
+/////////////////////////////////////////////////////////////////
+// the option features tab page
+// -----------------------------------------------------------------------------
+ImpPDFTabOpnFtrPage::ImpPDFTabOpnFtrPage( Window* pParent,
+ const SfxItemSet& rCoreSet ) :
+ SfxTabPage( pParent, PDFFilterResId( RID_PDF_TAB_OPNFTR ), rCoreSet ),
+
+ maFlInitialView( this, PDFFilterResId( FL_INITVIEW ) ),
+ maRbOpnPageOnly( this, PDFFilterResId( RB_OPNMODE_PAGEONLY ) ),
+ maRbOpnOutline( this, PDFFilterResId( RB_OPNMODE_OUTLINE ) ),
+ maRbOpnThumbs( this, PDFFilterResId( RB_OPNMODE_THUMBS ) ),
+ maFtInitialPage( this, PDFFilterResId( FT_MAGNF_INITIAL_PAGE ) ),
+ maNumInitialPage( this, PDFFilterResId( NUM_MAGNF_INITIAL_PAGE ) ),
+
+ maFlMagnification( this, PDFFilterResId( FL_MAGNIFICATION ) ),
+ maRbMagnDefault( this, PDFFilterResId( RB_MAGNF_DEFAULT ) ),
+ maRbMagnFitWin( this, PDFFilterResId( RB_MAGNF_WIND ) ),
+ maRbMagnFitWidth( this, PDFFilterResId( RB_MAGNF_WIDTH ) ),
+ maRbMagnFitVisible( this, PDFFilterResId( RB_MAGNF_VISIBLE ) ),
+ maRbMagnZoom( this, PDFFilterResId( RB_MAGNF_ZOOM ) ),
+ maNumZoom( this, PDFFilterResId( NUM_MAGNF_ZOOM ) ),
+
+ maFlPageLayout( this, PDFFilterResId( FL_PAGE_LAYOUT ) ),
+ maRbPgLyDefault( this, PDFFilterResId( RB_PGLY_DEFAULT ) ),
+ maRbPgLySinglePage( this, PDFFilterResId( RB_PGLY_SINGPG ) ),
+ maRbPgLyContinue( this, PDFFilterResId( RB_PGLY_CONT ) ),
+ maRbPgLyContinueFacing( this, PDFFilterResId( RB_PGLY_CONTFAC ) ),
+ maCbPgLyFirstOnLeft( this, PDFFilterResId( CB_PGLY_FIRSTLEFT ) ),
+ mbUseCTLFont( sal_False )
+{
+ FreeResource();
+
+ maRbMagnDefault.SetToggleHdl( LINK( this, ImpPDFTabOpnFtrPage, ToggleRbMagnHdl ) );
+ maRbMagnFitWin.SetToggleHdl( LINK( this, ImpPDFTabOpnFtrPage, ToggleRbMagnHdl ) );
+ maRbMagnFitWidth.SetToggleHdl( LINK( this, ImpPDFTabOpnFtrPage, ToggleRbMagnHdl ) );
+ maRbMagnFitVisible.SetToggleHdl( LINK( this, ImpPDFTabOpnFtrPage, ToggleRbMagnHdl ) );
+ maRbMagnZoom.SetToggleHdl( LINK( this, ImpPDFTabOpnFtrPage, ToggleRbMagnHdl ) );
+}
+
+// -----------------------------------------------------------------------------
+ImpPDFTabOpnFtrPage::~ImpPDFTabOpnFtrPage()
+{
+}
+
+// -----------------------------------------------------------------------------
+SfxTabPage* ImpPDFTabOpnFtrPage::Create( Window* pParent,
+ const SfxItemSet& rAttrSet)
+{
+ return ( new ImpPDFTabOpnFtrPage( pParent, rAttrSet ) );
+}
+
+// -----------------------------------------------------------------------------
+void ImpPDFTabOpnFtrPage::GetFilterConfigItem( ImpPDFTabDialog* paParent )
+{
+ paParent->mnInitialView = 0;
+ if( maRbOpnOutline.IsChecked() )
+ paParent->mnInitialView = 1;
+ else if( maRbOpnThumbs.IsChecked() )
+ paParent->mnInitialView = 2;
+
+ paParent->mnMagnification = 0;
+ if( maRbMagnFitWin.IsChecked() )
+ paParent->mnMagnification = 1;
+ else if( maRbMagnFitWidth.IsChecked() )
+ paParent->mnMagnification = 2;
+ else if( maRbMagnFitVisible.IsChecked() )
+ paParent->mnMagnification = 3;
+ else if( maRbMagnZoom.IsChecked() )
+ {
+ paParent->mnMagnification = 4;
+ paParent->mnZoom = static_cast<sal_Int32>(maNumZoom.GetValue());
+ }
+
+ paParent->mnInitialPage = static_cast<sal_Int32>(maNumInitialPage.GetValue());
+
+ paParent->mnPageLayout = 0;
+ if( maRbPgLySinglePage.IsChecked() )
+ paParent->mnPageLayout = 1;
+ else if( maRbPgLyContinue.IsChecked() )
+ paParent->mnPageLayout = 2;
+ else if( maRbPgLyContinueFacing.IsChecked() )
+ paParent->mnPageLayout = 3;
+
+ paParent->mbFirstPageLeft = ( mbUseCTLFont ) ? maCbPgLyFirstOnLeft.IsChecked() : sal_False;
+}
+
+// -----------------------------------------------------------------------------
+void ImpPDFTabOpnFtrPage::SetFilterConfigItem( const ImpPDFTabDialog* paParent )
+{
+ mbUseCTLFont = paParent->mbUseCTLFont;
+ switch( paParent->mnPageLayout )
+ {
+ default:
+ case 0:
+ maRbPgLyDefault.Check();
+ break;
+ case 1:
+ maRbPgLySinglePage.Check();
+ break;
+ case 2:
+ maRbPgLyContinue.Check();
+ break;
+ case 3:
+ maRbPgLyContinueFacing.Check();
+ break;
+ };
+
+ switch( paParent->mnInitialView )
+ {
+ default:
+ case 0:
+ maRbOpnPageOnly.Check();
+ break;
+ case 1:
+ maRbOpnOutline.Check();
+ break;
+ case 2:
+ maRbOpnThumbs.Check();
+ break;
+ };
+
+ switch( paParent->mnMagnification )
+ {
+ default:
+ case 0:
+ maRbMagnDefault.Check();
+ maNumZoom.Enable( FALSE );
+ break;
+ case 1:
+ maRbMagnFitWin.Check();
+ maNumZoom.Enable( FALSE );
+ break;
+ case 2:
+ maRbMagnFitWidth.Check();
+ maNumZoom.Enable( FALSE );
+ break;
+ case 3:
+ maRbMagnFitVisible.Check();
+ maNumZoom.Enable( FALSE );
+ break;
+ case 4:
+ maRbMagnZoom.Check();
+ maNumZoom.Enable( TRUE );
+ break;
+ };
+
+ maNumZoom.SetValue( paParent->mnZoom );
+ maNumInitialPage.SetValue( paParent->mnInitialPage );
+
+ if( !mbUseCTLFont )
+ maCbPgLyFirstOnLeft.Hide( );
+ else
+ {
+ maRbPgLyContinueFacing.SetToggleHdl( LINK( this, ImpPDFTabOpnFtrPage, ToggleRbPgLyContinueFacingHdl ) );
+ maCbPgLyFirstOnLeft.Check( paParent->mbFirstPageLeft );
+ ToggleRbPgLyContinueFacingHdl( NULL );
+ }
+}
+
+IMPL_LINK( ImpPDFTabOpnFtrPage, ToggleRbPgLyContinueFacingHdl, void*, p )
+{
+ p = p; //for compiler warning
+ maCbPgLyFirstOnLeft.Enable( maRbPgLyContinueFacing.IsChecked() );
+ return 0;
+}
+
+IMPL_LINK( ImpPDFTabOpnFtrPage, ToggleRbMagnHdl, void*, )
+{
+ maNumZoom.Enable( maRbMagnZoom.IsChecked() );
+ return 0;
+}
+
+////////////////////////////////////////////////////////
+// The Viewer preferences tab page
+// -----------------------------------------------------------------------------
+ImpPDFTabViewerPage::ImpPDFTabViewerPage( Window* pParent,
+ const SfxItemSet& rCoreSet ) :
+ SfxTabPage( pParent, PDFFilterResId( RID_PDF_TAB_VPREFER ), rCoreSet ),
+
+ maFlWindowOptions( this, PDFFilterResId( FL_WINOPT ) ),
+ maCbResWinInit( this, PDFFilterResId( CB_WNDOPT_RESINIT ) ),
+ maCbCenterWindow( this, PDFFilterResId( CB_WNDOPT_CNTRWIN ) ),
+ maCbOpenFullScreen( this, PDFFilterResId( CB_WNDOPT_OPNFULL ) ),
+ maCbDispDocTitle( this, PDFFilterResId( CB_DISPDOCTITLE ) ),
+
+ maFlUIOptions( this, PDFFilterResId( FL_USRIFOPT ) ),
+ maCbHideViewerMenubar( this, PDFFilterResId( CB_UOP_HIDEVMENUBAR ) ),
+ maCbHideViewerToolbar( this, PDFFilterResId( CB_UOP_HIDEVTOOLBAR ) ),
+ maCbHideViewerWindowControls( this, PDFFilterResId( CB_UOP_HIDEVWINCTRL ) ),
+ maFlTransitions( this, PDFFilterResId( FL_TRANSITIONS ) ),
+ maCbTransitionEffects( this, PDFFilterResId( CB_TRANSITIONEFFECTS ) ),
+ mbIsPresentation( sal_True ),
+ maFlBookmarks( this, PDFFilterResId( FL_BOOKMARKS ) ),
+ maRbAllBookmarkLevels( this, PDFFilterResId( RB_ALLBOOKMARKLEVELS ) ),
+ maRbVisibleBookmarkLevels( this, PDFFilterResId( RB_VISIBLEBOOKMARKLEVELS ) ),
+ maNumBookmarkLevels( this, PDFFilterResId( NUM_BOOKMARKLEVELS ) )
+{
+ FreeResource();
+ maRbAllBookmarkLevels.SetToggleHdl( LINK( this, ImpPDFTabViewerPage, ToggleRbBookmarksHdl ) );
+ maRbVisibleBookmarkLevels.SetToggleHdl( LINK( this, ImpPDFTabViewerPage, ToggleRbBookmarksHdl ) );
+}
+
+// -----------------------------------------------------------------------------
+ImpPDFTabViewerPage::~ImpPDFTabViewerPage()
+{
+}
+
+// -----------------------------------------------------------------------------
+IMPL_LINK( ImpPDFTabViewerPage, ToggleRbBookmarksHdl, void*, )
+{
+ maNumBookmarkLevels.Enable( maRbVisibleBookmarkLevels.IsChecked() );
+ return 0;
+}
+// -----------------------------------------------------------------------------
+SfxTabPage* ImpPDFTabViewerPage::Create( Window* pParent,
+ const SfxItemSet& rAttrSet)
+{
+ return ( new ImpPDFTabViewerPage( pParent, rAttrSet ) );
+}
+
+// -----------------------------------------------------------------------------
+void ImpPDFTabViewerPage::GetFilterConfigItem( ImpPDFTabDialog* paParent )
+{
+ paParent->mbHideViewerMenubar = maCbHideViewerMenubar.IsChecked();
+ paParent->mbHideViewerToolbar = maCbHideViewerToolbar.IsChecked( );
+ paParent->mbHideViewerWindowControls = maCbHideViewerWindowControls.IsChecked();
+ paParent->mbResizeWinToInit = maCbResWinInit.IsChecked();
+ paParent->mbOpenInFullScreenMode = maCbOpenFullScreen.IsChecked();
+ paParent->mbCenterWindow = maCbCenterWindow.IsChecked();
+ paParent->mbDisplayPDFDocumentTitle = maCbDispDocTitle.IsChecked();
+ paParent->mbUseTransitionEffects = maCbTransitionEffects.IsChecked();
+ paParent->mnOpenBookmarkLevels = maRbAllBookmarkLevels.IsChecked() ?
+ -1 : static_cast<sal_Int32>(maNumBookmarkLevels.GetValue());
+}
+
+// -----------------------------------------------------------------------------
+void ImpPDFTabViewerPage::SetFilterConfigItem( const ImpPDFTabDialog* paParent )
+{
+ maCbHideViewerMenubar.Check( paParent->mbHideViewerMenubar );
+ maCbHideViewerToolbar.Check( paParent->mbHideViewerToolbar );
+ maCbHideViewerWindowControls.Check( paParent->mbHideViewerWindowControls );
+
+ maCbResWinInit.Check( paParent->mbResizeWinToInit );
+ maCbOpenFullScreen.Check( paParent->mbOpenInFullScreenMode );
+ maCbCenterWindow.Check( paParent->mbCenterWindow );
+ maCbDispDocTitle.Check( paParent->mbDisplayPDFDocumentTitle );
+ mbIsPresentation = paParent->mbIsPresentation;
+ maCbTransitionEffects.Check( paParent->mbUseTransitionEffects );
+ maCbTransitionEffects.Enable( mbIsPresentation );
+ if( paParent->mnOpenBookmarkLevels < 0 )
+ {
+ maRbAllBookmarkLevels.Check( TRUE );
+ maNumBookmarkLevels.Enable( FALSE );
+ }
+ else
+ {
+ maRbVisibleBookmarkLevels.Check( TRUE );
+ maNumBookmarkLevels.Enable( TRUE );
+ maNumBookmarkLevels.SetValue( paParent->mnOpenBookmarkLevels );
+ }
+}
+
+////////////////////////////////////////////////////////
+// The Security preferences tab page
+// -----------------------------------------------------------------------------
+ImpPDFTabSecurityPage::ImpPDFTabSecurityPage( Window* i_pParent,
+ const SfxItemSet& i_rCoreSet ) :
+ SfxTabPage( i_pParent, PDFFilterResId( RID_PDF_TAB_SECURITY ), i_rCoreSet ),
+ maPbUserPwd( this, PDFFilterResId( BTN_USER_PWD ) ),
+ maFtUserPwd( this, PDFFilterResId( FT_USER_PWD ) ),
+ maUserPwdSet( PDFFilterResId( STR_USER_PWD_SET ) ),
+ maUserPwdUnset( PDFFilterResId( STR_USER_PWD_UNSET ) ),
+
+ maPbOwnerPwd( this, PDFFilterResId( BTN_OWNER_PWD ) ),
+ maFtOwnerPwd( this, PDFFilterResId( FT_OWNER_PWD ) ),
+ maOwnerPwdSet( PDFFilterResId( STR_OWNER_PWD_SET ) ),
+ maOwnerPwdUnset( PDFFilterResId( STR_OWNER_PWD_UNSET ) ),
+
+ maFlPrintPermissions( this, PDFFilterResId( FL_PRINT_PERMISSIONS ) ),
+ maRbPrintNone( this, PDFFilterResId( RB_PRINT_NONE ) ),
+ maRbPrintLowRes( this, PDFFilterResId( RB_PRINT_LOWRES ) ),
+ maRbPrintHighRes( this, PDFFilterResId( RB_PRINT_HIGHRES ) ),
+
+ maFlChangesAllowed( this, PDFFilterResId( FL_CHANGES_ALLOWED ) ),
+ maRbChangesNone( this, PDFFilterResId( RB_CHANGES_NONE ) ),
+ maRbChangesInsDel( this, PDFFilterResId( RB_CHANGES_INSDEL ) ),
+ maRbChangesFillForm( this, PDFFilterResId( RB_CHANGES_FILLFORM ) ),
+ maRbChangesComment( this, PDFFilterResId( RB_CHANGES_COMMENT ) ),
+ maRbChangesAnyNoCopy( this, PDFFilterResId( RB_CHANGES_ANY_NOCOPY ) ),
+
+ maCbEnableCopy( this, PDFFilterResId( CB_ENDAB_COPY ) ),
+ maCbEnableAccessibility( this, PDFFilterResId( CB_ENAB_ACCESS ) ),
+
+ msUserPwdTitle( PDFFilterResId( STR_PDF_EXPORT_UDPWD ) ),
+
+ msOwnerPwdTitle( PDFFilterResId( STR_PDF_EXPORT_ODPWD ) )
+{
+ maUserPwdSet.Append( sal_Unicode( '\n' ) );
+ maUserPwdSet.Append( String( PDFFilterResId( STR_USER_PWD_ENC ) ) );
+
+ maUserPwdUnset.Append( sal_Unicode( '\n' ) );
+ maUserPwdUnset.Append( String( PDFFilterResId( STR_USER_PWD_UNENC ) ) );
+
+ maOwnerPwdSet.Append( sal_Unicode( '\n' ) );
+ maOwnerPwdSet.Append( String( PDFFilterResId( STR_OWNER_PWD_REST ) ) );
+
+ maOwnerPwdUnset.Append( sal_Unicode( '\n' ) );
+ maOwnerPwdUnset.Append( String( PDFFilterResId( STR_OWNER_PWD_UNREST ) ) );
+
+ FreeResource();
+
+ maFtUserPwd.SetText( maUserPwdUnset );
+ maFtOwnerPwd.SetText( maOwnerPwdUnset );
+
+ // pb: #i91991# maRbChangesComment double-spaced if necessary
+ Size aSize = maRbChangesComment.GetSizePixel();
+ Size aMinSize = maRbChangesComment.CalcMinimumSize();
+ if ( aSize.Width() > aMinSize.Width() )
+ {
+ Size aNewSize = maRbChangesFillForm.GetSizePixel();
+ long nDelta = aSize.Height() - aNewSize.Height();
+ maRbChangesComment.SetSizePixel( aNewSize );
+ Window* pWins[] =
+ { &maRbChangesAnyNoCopy, &maCbEnableCopy, &maCbEnableAccessibility, NULL };
+ Window** pCurrent = pWins;
+ while ( *pCurrent )
+ {
+ Point aNewPos = (*pCurrent)->GetPosPixel();
+ aNewPos.Y() -= nDelta;
+ (*pCurrent++)->SetPosPixel( aNewPos );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+ImpPDFTabSecurityPage::~ImpPDFTabSecurityPage()
+{
+}
+
+// -----------------------------------------------------------------------------
+SfxTabPage* ImpPDFTabSecurityPage::Create( Window* pParent,
+ const SfxItemSet& rAttrSet)
+{
+ return ( new ImpPDFTabSecurityPage( pParent, rAttrSet ) );
+}
+
+// -----------------------------------------------------------------------------
+void ImpPDFTabSecurityPage::GetFilterConfigItem( ImpPDFTabDialog* paParent )
+{
+// please note that in PDF/A-1a mode even if this are copied back,
+// the security settings are forced disabled in PDFExport::Export
+ paParent->mbEncrypt = (msUserPassword.Len() > 0);
+ if( paParent->mbEncrypt )
+ paParent->msUserPassword = msUserPassword;
+
+ paParent->mbRestrictPermissions = (msOwnerPassword.Len() > 0);
+ if( msOwnerPassword.Len() > 0 )
+ paParent->msOwnerPassword = msOwnerPassword;
+
+//verify print status
+ paParent->mnPrint = 0;
+ if( maRbPrintLowRes.IsChecked() )
+ paParent->mnPrint = 1;
+ else if( maRbPrintHighRes.IsChecked() )
+ paParent->mnPrint = 2;
+
+//verify changes permitted
+ paParent->mnChangesAllowed = 0;
+
+ if( maRbChangesInsDel.IsChecked() )
+ paParent->mnChangesAllowed = 1;
+ else if( maRbChangesFillForm.IsChecked() )
+ paParent->mnChangesAllowed = 2;
+ else if( maRbChangesComment.IsChecked() )
+ paParent->mnChangesAllowed = 3;
+ else if( maRbChangesAnyNoCopy.IsChecked() )
+ paParent->mnChangesAllowed = 4;
+
+ paParent->mbCanCopyOrExtract = maCbEnableCopy.IsChecked();
+ paParent->mbCanExtractForAccessibility = maCbEnableAccessibility.IsChecked();
+}
+
+
+// -----------------------------------------------------------------------------
+void ImpPDFTabSecurityPage::SetFilterConfigItem( const ImpPDFTabDialog* paParent )
+{
+ maPbUserPwd.SetClickHdl( LINK( this, ImpPDFTabSecurityPage, ClickmaPbUserPwdHdl ) );
+
+ maPbOwnerPwd.SetClickHdl( LINK( this, ImpPDFTabSecurityPage, ClickmaPbOwnerPwdHdl ) );
+
+ switch( paParent->mnPrint )
+ {
+ default:
+ case 0:
+ maRbPrintNone.Check();
+ break;
+ case 1:
+ maRbPrintLowRes.Check();
+ break;
+ case 2:
+ maRbPrintHighRes.Check();
+ break;
+ };
+
+ switch( paParent->mnChangesAllowed )
+ {
+ default:
+ case 0:
+ maRbChangesNone.Check();
+ break;
+ case 1:
+ maRbChangesInsDel.Check();
+ break;
+ case 2:
+ maRbChangesFillForm.Check();
+ break;
+ case 3:
+ maRbChangesComment.Check();
+ break;
+ case 4:
+ maRbChangesAnyNoCopy.Check();
+ break;
+ };
+
+ maCbEnableCopy.Check( paParent->mbCanCopyOrExtract );
+ maCbEnableAccessibility.Check( paParent->mbCanExtractForAccessibility );
+
+// set the status of this windows, according to the PDFA selection
+ enablePermissionControls();
+
+ if( paParent && paParent->GetTabPage( RID_PDF_TAB_GENER ) )
+ ImplPDFASecurityControl(
+ !( ( ImpPDFTabGeneralPage* )paParent->GetTabPage( RID_PDF_TAB_GENER ) )->IsPdfaSelected() );
+}
+
+//method common to both the password entry procedures
+void ImpPDFTabSecurityPage::ImplPwdPushButton( const String & i_rDlgTitle, String & io_rDestPassword )
+{
+// string needed: dialog title, message box text, depending on the button clicked
+ SfxPasswordDialog aPwdDialog( this );
+ aPwdDialog.SetMinLen( 0 );
+ aPwdDialog.ShowExtras( SHOWEXTRAS_CONFIRM );
+ aPwdDialog.SetText( i_rDlgTitle );
+ aPwdDialog.AllowAsciiOnly();
+ if( aPwdDialog.Execute() == RET_OK ) //OK issued get password and set it
+ io_rDestPassword = aPwdDialog.GetPassword();
+ enablePermissionControls();
+}
+
+IMPL_LINK( ImpPDFTabSecurityPage, ClickmaPbUserPwdHdl, void*, EMPTYARG )
+{
+ ImplPwdPushButton(msUserPwdTitle, msUserPassword );
+ return 0;
+}
+
+IMPL_LINK( ImpPDFTabSecurityPage, ClickmaPbOwnerPwdHdl, void*, EMPTYARG )
+{
+ ImplPwdPushButton( msOwnerPwdTitle, msOwnerPassword );
+
+ return 0;
+}
+
+void ImpPDFTabSecurityPage::enablePermissionControls()
+{
+ maFtUserPwd.SetText( (msUserPassword.Len() > 0 && IsEnabled()) ? maUserPwdSet : maUserPwdUnset );
+
+ sal_Bool bLocalEnable = (msOwnerPassword.Len() > 0) && IsEnabled();
+
+ maFtOwnerPwd.SetText( bLocalEnable ? maOwnerPwdSet : maOwnerPwdUnset );
+
+ maFlPrintPermissions.Enable( bLocalEnable );
+ maRbPrintNone.Enable( bLocalEnable );
+ maRbPrintLowRes.Enable( bLocalEnable );
+ maRbPrintHighRes.Enable( bLocalEnable );
+
+ maFlChangesAllowed.Enable( bLocalEnable );
+ maRbChangesNone.Enable( bLocalEnable );
+ maRbChangesInsDel.Enable( bLocalEnable );
+ maRbChangesFillForm.Enable( bLocalEnable );
+ maRbChangesComment.Enable( bLocalEnable );
+ maRbChangesAnyNoCopy.Enable( bLocalEnable );
+
+ maCbEnableCopy.Enable( bLocalEnable );
+ maCbEnableAccessibility.Enable( bLocalEnable );
+}
+
+////////////////////////////////////////////////////////
+// This tab page is under control of the PDF/A-1a checkbox:
+// implement a method to do it.
+// -----------------------------------------------------------------------------
+void ImpPDFTabSecurityPage::ImplPDFASecurityControl( sal_Bool bEnableSecurity )
+{
+ if( bEnableSecurity )
+ {
+ Enable();
+//after enable, check the status of control as if the dialog was initialized
+ }
+ else
+ Enable( sal_False );
+
+ enablePermissionControls();
+}
+
+////////////////////////////////////////////////////////
+// The link preferences tab page (relative and other stuff)
+// -----------------------------------------------------------------------------
+ImpPDFTabLinksPage::ImpPDFTabLinksPage( Window* pParent,
+ const SfxItemSet& rCoreSet ) :
+ SfxTabPage( pParent, PDFFilterResId( RID_PDF_TAB_LINKS ), rCoreSet ),
+
+ maCbExprtBmkrToNmDst( this, PDFFilterResId( CB_EXP_BMRK_TO_DEST ) ),
+ maCbOOoToPDFTargets( this, PDFFilterResId( CB_CNV_OOO_DOCTOPDF ) ),
+ maCbExportRelativeFsysLinks( this, PDFFilterResId( CB_ENAB_RELLINKFSYS ) ),
+
+ maFlDefaultTitle( this, PDFFilterResId( FL_DEFAULT_LINK_ACTION ) ),
+ maRbOpnLnksDefault( this, PDFFilterResId( CB_VIEW_PDF_DEFAULT ) ),
+ mbOpnLnksDefaultUserState( sal_False ),
+ maRbOpnLnksLaunch( this, PDFFilterResId( CB_VIEW_PDF_APPLICATION ) ),
+ mbOpnLnksLaunchUserState( sal_False ),
+ maRbOpnLnksBrowser( this, PDFFilterResId( CB_VIEW_PDF_BROWSER ) ),
+ mbOpnLnksBrowserUserState( sal_False )
+{
+ FreeResource();
+
+ // pb: #i91991# checkboxes only double-spaced if necessary
+ long nDelta = 0;
+ Size aSize = maCbExprtBmkrToNmDst.GetSizePixel();
+ Size aMinSize = maCbExprtBmkrToNmDst.CalcMinimumSize();
+ long nLineHeight =
+ maCbExprtBmkrToNmDst.LogicToPixel( Size( 10, 10 ), MAP_APPFONT ).Height();
+ if ( aSize.Width() > aMinSize.Width() )
+ {
+ Size aNewSize( aSize.Width(), nLineHeight );
+ nDelta += ( aSize.Height() - nLineHeight );
+ maCbExprtBmkrToNmDst.SetSizePixel( aNewSize );
+ Point aNewPos = maCbOOoToPDFTargets.GetPosPixel();
+ aNewPos.Y() -= nDelta;
+ maCbOOoToPDFTargets.SetPosPixel( aNewPos );
+ }
+
+ aSize = maCbOOoToPDFTargets.GetSizePixel();
+ aMinSize = maCbOOoToPDFTargets.CalcMinimumSize();
+ if ( aSize.Width() > aMinSize.Width() )
+ {
+ Size aNewSize( aSize.Width(), nLineHeight );
+ nDelta += ( aSize.Height() - nLineHeight );
+ maCbOOoToPDFTargets.SetSizePixel( aNewSize );
+ Point aNewPos = maCbExportRelativeFsysLinks.GetPosPixel();
+ aNewPos.Y() -= nDelta;
+ maCbExportRelativeFsysLinks.SetPosPixel( aNewPos );
+ }
+
+ aSize = maCbExportRelativeFsysLinks.GetSizePixel();
+ aMinSize = maCbExportRelativeFsysLinks.CalcMinimumSize();
+ if ( aSize.Width() > aMinSize.Width() )
+ {
+ Size aNewSize( aSize.Width(), nLineHeight );
+ nDelta += ( aSize.Height() - nLineHeight );
+ maCbExportRelativeFsysLinks.SetSizePixel( aNewSize );
+ }
+
+ if ( nDelta > 0 )
+ {
+ Window* pWins[] =
+ { &maFlDefaultTitle, &maRbOpnLnksDefault, &maRbOpnLnksLaunch, &maRbOpnLnksBrowser, NULL };
+ Window** pCurrent = pWins;
+ while ( *pCurrent )
+ {
+ Point aNewPos = (*pCurrent)->GetPosPixel();
+ aNewPos.Y() -= nDelta;
+ (*pCurrent++)->SetPosPixel( aNewPos );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+ImpPDFTabLinksPage::~ImpPDFTabLinksPage()
+{
+}
+
+// -----------------------------------------------------------------------------
+SfxTabPage* ImpPDFTabLinksPage::Create( Window* pParent,
+ const SfxItemSet& rAttrSet)
+{
+ return ( new ImpPDFTabLinksPage( pParent, rAttrSet ) );
+}
+
+// -----------------------------------------------------------------------------
+void ImpPDFTabLinksPage::GetFilterConfigItem( ImpPDFTabDialog* paParent )
+{
+ paParent->mbExportRelativeFsysLinks = maCbExportRelativeFsysLinks.IsChecked();
+
+ sal_Bool bIsPDFASel = sal_False;
+ if( paParent && paParent->GetTabPage( RID_PDF_TAB_GENER ) )
+ bIsPDFASel = ( ( ImpPDFTabGeneralPage* )paParent->
+ GetTabPage( RID_PDF_TAB_GENER ) )->IsPdfaSelected();
+// if PDF/A-1 was not selected while exiting dialog...
+ if( !bIsPDFASel )
+ {
+// ...get the control states
+ mbOpnLnksDefaultUserState = maRbOpnLnksDefault.IsChecked();
+ mbOpnLnksLaunchUserState = maRbOpnLnksLaunch.IsChecked();
+ mbOpnLnksBrowserUserState = maRbOpnLnksBrowser.IsChecked();
+ }
+// the control states, or the saved is used
+// to form the stored selection
+ paParent->mnViewPDFMode = 0;
+ if( mbOpnLnksBrowserUserState )
+ paParent->mnViewPDFMode = 2;
+ else if( mbOpnLnksLaunchUserState )
+ paParent->mnViewPDFMode = 1;
+
+ paParent->mbConvertOOoTargets = maCbOOoToPDFTargets.IsChecked();
+ paParent->mbExportBmkToPDFDestination = maCbExprtBmkrToNmDst.IsChecked();
+}
+
+// -----------------------------------------------------------------------------
+void ImpPDFTabLinksPage::SetFilterConfigItem( const ImpPDFTabDialog* paParent )
+{
+ maCbOOoToPDFTargets.Check( paParent->mbConvertOOoTargets );
+ maCbExprtBmkrToNmDst.Check( paParent->mbExportBmkToPDFDestination );
+
+ maRbOpnLnksDefault.SetClickHdl( LINK( this, ImpPDFTabLinksPage, ClickRbOpnLnksDefaultHdl ) );
+ maRbOpnLnksBrowser.SetClickHdl( LINK( this, ImpPDFTabLinksPage, ClickRbOpnLnksBrowserHdl ) );
+
+ maCbExportRelativeFsysLinks.Check( paParent->mbExportRelativeFsysLinks );
+ switch( paParent->mnViewPDFMode )
+ {
+ default:
+ case 0:
+ maRbOpnLnksDefault.Check();
+ mbOpnLnksDefaultUserState = sal_True;
+ break;
+ case 1:
+ maRbOpnLnksLaunch.Check();
+ mbOpnLnksLaunchUserState = sal_True;
+ break;
+ case 2:
+ maRbOpnLnksBrowser.Check();
+ mbOpnLnksBrowserUserState = sal_True;
+ break;
+ }
+// now check the status of PDF/A selection
+// and set the link action accordingly
+// PDF/A-1 doesn't allow launch action on links
+//
+ if( paParent && paParent->GetTabPage( RID_PDF_TAB_GENER ) )
+ ImplPDFALinkControl(
+ !( ( ImpPDFTabGeneralPage* )paParent->
+ GetTabPage( RID_PDF_TAB_GENER ) )->maCbPDFA1b.IsChecked() );
+}
+
+// -----------------------------------------------------------------------------
+// called from general tab, with PDFA/1 selection status
+// retrieves/store the status of Launch action selection
+void ImpPDFTabLinksPage::ImplPDFALinkControl( sal_Bool bEnableLaunch )
+{
+// set the value and position of link type selection
+ if( bEnableLaunch )
+ {
+ maRbOpnLnksLaunch.Enable();
+//restore user state with no PDF/A-1 selected
+ maRbOpnLnksDefault.Check( mbOpnLnksDefaultUserState );
+ maRbOpnLnksLaunch.Check( mbOpnLnksLaunchUserState );
+ maRbOpnLnksBrowser.Check( mbOpnLnksBrowserUserState );
+ }
+ else
+ {
+//save user state with no PDF/A-1 selected
+ mbOpnLnksDefaultUserState = maRbOpnLnksDefault.IsChecked();
+ mbOpnLnksLaunchUserState = maRbOpnLnksLaunch.IsChecked();
+ mbOpnLnksBrowserUserState = maRbOpnLnksBrowser.IsChecked();
+ maRbOpnLnksLaunch.Enable( sal_False );
+ if( mbOpnLnksLaunchUserState )
+ maRbOpnLnksBrowser.Check();
+ }
+}
+
+// -----------------------------------------------------------------------------
+// reset the memory of Launch action present
+// when PDF/A-1 was requested
+IMPL_LINK( ImpPDFTabLinksPage, ClickRbOpnLnksDefaultHdl, void*, EMPTYARG )
+{
+ mbOpnLnksDefaultUserState = maRbOpnLnksDefault.IsChecked();
+ mbOpnLnksLaunchUserState = maRbOpnLnksLaunch.IsChecked();
+ mbOpnLnksBrowserUserState = maRbOpnLnksBrowser.IsChecked();
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+// reset the memory of a launch action present
+// when PDF/A-1 was requested
+IMPL_LINK( ImpPDFTabLinksPage, ClickRbOpnLnksBrowserHdl, void*, EMPTYARG )
+{
+ mbOpnLnksDefaultUserState = maRbOpnLnksDefault.IsChecked();
+ mbOpnLnksLaunchUserState = maRbOpnLnksLaunch.IsChecked();
+ mbOpnLnksBrowserUserState = maRbOpnLnksBrowser.IsChecked();
+ return 0;
+}
+
+ImplErrorDialog::ImplErrorDialog( const std::set< vcl::PDFWriter::ErrorCode >& rErrors ) :
+ ModalDialog( NULL, PDFFilterResId( RID_PDF_ERROR_DLG ) ),
+ maFI( this, 0 ),
+ maProcessText( this, PDFFilterResId( FT_PROCESS ) ),
+ maErrors( this, WB_BORDER | WB_AUTOVSCROLL ),
+ maExplanation( this, WB_WORDBREAK ),
+ maButton( this, WB_DEFBUTTON )
+
+{
+ // load images
+ Image aWarnImg( BitmapEx( PDFFilterResId( IMG_WARN ) ) );
+ Image aErrImg( BitmapEx( PDFFilterResId( IMG_ERR ) ) );
+
+ for( std::set<vcl::PDFWriter::ErrorCode>::const_iterator it = rErrors.begin();
+ it != rErrors.end(); ++it )
+ {
+ switch( *it )
+ {
+ case vcl::PDFWriter::Warning_Transparency_Omitted_PDFA:
+ {
+ USHORT nPos = maErrors.InsertEntry( String( PDFFilterResId( STR_WARN_TRANSP_PDFA_SHORT ) ),
+ aWarnImg );
+ maErrors.SetEntryData( nPos, new String( PDFFilterResId( STR_WARN_TRANSP_PDFA ) ) );
+ }
+ break;
+ case vcl::PDFWriter::Warning_Transparency_Omitted_PDF13:
+ {
+ USHORT nPos = maErrors.InsertEntry( String( PDFFilterResId( STR_WARN_TRANSP_VERSION_SHORT ) ),
+ aWarnImg );
+ maErrors.SetEntryData( nPos, new String( PDFFilterResId( STR_WARN_TRANSP_VERSION ) ) );
+ }
+ break;
+ case vcl::PDFWriter::Warning_FormAction_Omitted_PDFA:
+ {
+ USHORT nPos = maErrors.InsertEntry( String( PDFFilterResId( STR_WARN_FORMACTION_PDFA_SHORT ) ),
+ aWarnImg );
+ maErrors.SetEntryData( nPos, new String( PDFFilterResId( STR_WARN_FORMACTION_PDFA ) ) );
+ }
+ break;
+ case vcl::PDFWriter::Warning_Transparency_Converted:
+ {
+ USHORT nPos = maErrors.InsertEntry( String( PDFFilterResId( STR_WARN_TRANSP_CONVERTED_SHORT ) ),
+ aWarnImg );
+ maErrors.SetEntryData( nPos, new String( PDFFilterResId( STR_WARN_TRANSP_CONVERTED ) ) );
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ FreeResource();
+
+ if( maErrors.GetEntryCount() > 0 )
+ {
+ maErrors.SelectEntryPos( 0 );
+ String* pStr = reinterpret_cast<String*>(maErrors.GetEntryData( 0 ));
+ maExplanation.SetText( pStr ? *pStr : String() );
+ }
+
+ // adjust layout
+ Image aWarnImage( WarningBox::GetStandardImage() );
+ Size aImageSize( aWarnImage.GetSizePixel() );
+ Size aDlgSize( GetSizePixel() );
+ aImageSize.Width() += 6;
+ aImageSize.Height() += 6;
+ maFI.SetImage( aWarnImage );
+ maFI.SetPosSizePixel( Point( 5, 5 ), aImageSize );
+ maFI.Show();
+
+ maProcessText.SetStyle( maProcessText.GetStyle() | WB_VCENTER );
+ maProcessText.SetPosSizePixel( Point( aImageSize.Width() + 10, 5 ),
+ Size( aDlgSize.Width() - aImageSize.Width() - 15, aImageSize.Height() ) );
+
+ Point aErrorLBPos( 5, aImageSize.Height() + 10 );
+ Size aErrorLBSize( aDlgSize.Width()/2 - 10, aDlgSize.Height() - aErrorLBPos.Y() - 35 );
+ maErrors.SetPosSizePixel( aErrorLBPos, aErrorLBSize );
+ maErrors.SetSelectHdl( LINK( this, ImplErrorDialog, SelectHdl ) );
+ maErrors.Show();
+
+ maExplanation.SetPosSizePixel( Point( aErrorLBPos.X() + aErrorLBSize.Width() + 5, aErrorLBPos.Y() ),
+ Size( aDlgSize.Width() - aErrorLBPos.X() - aErrorLBSize.Width() - 10, aErrorLBSize.Height() ) );
+ maExplanation.Show();
+
+ maButton.SetPosSizePixel( Point( (aDlgSize.Width() - 50)/2, aDlgSize.Height() - 30 ),
+ Size( 50, 25 ) );
+ maButton.Show();
+}
+
+ImplErrorDialog::~ImplErrorDialog()
+{
+ // free strings again
+ for( USHORT n = 0; n < maErrors.GetEntryCount(); n++ )
+ delete (String*)maErrors.GetEntryData( n );
+}
+
+IMPL_LINK( ImplErrorDialog, SelectHdl, ListBox*, EMPTYARG )
+{
+ String* pStr = reinterpret_cast<String*>(maErrors.GetEntryData( maErrors.GetSelectEntryPos() ));
+ maExplanation.SetText( pStr ? *pStr : String() );
+ return 0;
+}
diff --git a/filter/source/pdf/impdialog.hrc b/filter/source/pdf/impdialog.hrc
new file mode 100644
index 000000000000..cc438255650f
--- /dev/null
+++ b/filter/source/pdf/impdialog.hrc
@@ -0,0 +1,185 @@
+/*************************************************************************
+ *
+ * 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 <filter.hrc>
+
+#define RID_PDF_EXPORT_DLG (RID_PDF_DIALOG_START + 0)
+#define RID_PDF_TAB_GENER (RID_PDF_DIALOG_START + 1)
+#define RID_PDF_TAB_VPREFER (RID_PDF_DIALOG_START + 2)
+#define RID_PDF_TAB_OPNFTR (RID_PDF_DIALOG_START + 3)
+#define RID_PDF_TAB_SECURITY (RID_PDF_DIALOG_START + 4)
+#define RID_PDF_TAB_LINKS (RID_PDF_DIALOG_START + 12)
+//strings
+#define STR_PDF_EXPORT (RID_PDF_DIALOG_START + 5)
+
+//strings for PDF security, user password management
+#define STR_PDF_EXPORT_UDPWD (RID_PDF_DIALOG_START + 7)
+
+//strings for PDF security, owner password management
+#define STR_PDF_EXPORT_ODPWD (RID_PDF_DIALOG_START + 10)
+
+#define RID_PDF_ERROR_DLG (RID_PDF_DIALOG_START + 11)
+#define FT_PROCESS 1
+#define IMG_WARN 2
+#define IMG_ERR 3
+#define STR_WARN_TRANSP_PDFA 4
+#define STR_WARN_TRANSP_PDFA_SHORT 5
+#define STR_WARN_TRANSP_VERSION 6
+#define STR_WARN_TRANSP_VERSION_SHORT 7
+#define STR_WARN_FORMACTION_PDFA 8
+#define STR_WARN_FORMACTION_PDFA_SHORT 9
+#define STR_WARN_TRANSP_CONVERTED 10
+#define STR_WARN_TRANSP_CONVERTED_SHORT 11
+
+//ATTENTION: maximum allowed value is( RID_PDF_DIALOG_START + 19)
+
+//controls for General tab page
+#define FL_PAGES 1
+#define RB_ALL 2
+#define RB_RANGE 3
+#define RB_SELECTION 4
+#define ED_PAGES 5
+#define BT_OK 6
+#define BT_CANCEL 7
+#define BT_HELP 8
+#define FL_IMAGES 9
+#define RB_LOSSLESSCOMPRESSION 10
+#define RB_JPEGCOMPRESSION 11
+#define FT_QUALITY 12
+#define NF_QUALITY 13
+#define CB_REDUCEIMAGERESOLUTION 14
+#define CO_REDUCEIMAGERESOLUTION 15
+#define FL_GENERAL 16
+#define CB_TAGGEDPDF 17
+#define CB_EXPORTNOTES 18
+#define CB_EXPORTBOOKMARKS 19
+#define CB_EXPORTFORMFIELDS 20
+#define FT_FORMSFORMAT 21
+#define LB_FORMSFORMAT 22
+#define CB_ALLOWDUPLICATEFIELDNAMES 23
+#define CB_EXPORTEMPTYPAGES 24
+#define CB_ADDSTREAM 25
+#define CB_PDFA_1B_SELECT 26
+#define CB_EXPORTNOTESPAGES 27
+#define CB_EMBEDSTANDARDFONTS 28
+
+#define FL_OLD_PAGES 51
+#define RB_OLD_ALL 52
+#define RB_OLD_RANGE 53
+#define RB_OLD_SELECTION 54
+#define ED_OLD_PAGES 55
+#define BT_OLD_OK 56
+#define BT_OLD_CANCEL 57
+#define BT_OLD_HELP 58
+#define FL_OLD_COMPRESSION 59
+#define RB_OLD_SCREEN 60
+#define RB_OLD_PRINT 61
+#define RB_OLD_PRESS 62
+
+//controls for open options tab page
+#define FL_INITVIEW 80
+#define RB_OPNMODE_PAGEONLY 81
+#define RB_OPNMODE_OUTLINE 82
+#define RB_OPNMODE_THUMBS 83
+
+#define FL_MAGNIFICATION 84
+#define RB_MAGNF_DEFAULT 85
+#define RB_MAGNF_WIND 86
+#define RB_MAGNF_WIDTH 87
+#define RB_MAGNF_VISIBLE 88
+#define RB_MAGNF_ZOOM 89
+#define NUM_MAGNF_ZOOM 90
+#define FT_MAGNF_INITIAL_PAGE 91
+#define NUM_MAGNF_INITIAL_PAGE 92
+
+#define FL_PAGE_LAYOUT 93
+#define RB_PGLY_DEFAULT 94
+#define RB_PGLY_SINGPG 95
+#define RB_PGLY_CONT 96
+#define RB_PGLY_CONTFAC 97
+#define CB_PGLY_FIRSTLEFT 98
+
+//controls for viewer preferences tab page
+#define FL_WINOPT 100
+#define CB_WNDOPT_RESINIT 101
+#define CB_WNDOPT_CNTRWIN 102
+#define CB_WNDOPT_OPNFULL 103
+#define CB_DISPDOCTITLE 104
+
+#define FL_USRIFOPT 105
+#define CB_UOP_HIDEVMENUBAR 106
+#define CB_UOP_HIDEVTOOLBAR 107
+#define CB_UOP_HIDEVWINCTRL 108
+
+#define FL_TRANSITIONS 109
+#define CB_TRANSITIONEFFECTS 110
+
+#define FL_BOOKMARKS 111
+#define RB_ALLBOOKMARKLEVELS 112
+#define RB_VISIBLEBOOKMARKLEVELS 113
+#define NUM_BOOKMARKLEVELS 114
+
+//controls for security preferences tab page
+#define BTN_USER_PWD 120
+#define FT_USER_PWD 121
+#define STR_USER_PWD_SET 122
+#define STR_USER_PWD_ENC 123
+#define STR_USER_PWD_UNSET 124
+#define STR_USER_PWD_UNENC 125
+
+#define BTN_OWNER_PWD 127
+#define FT_OWNER_PWD 128
+#define STR_OWNER_PWD_SET 129
+#define STR_OWNER_PWD_REST 130
+#define STR_OWNER_PWD_UNSET 131
+#define STR_OWNER_PWD_UNREST 132
+
+#define FL_PRINT_PERMISSIONS 133
+#define RB_PRINT_NONE 134
+#define RB_PRINT_LOWRES 135
+#define RB_PRINT_HIGHRES 136
+
+#define FL_CHANGES_ALLOWED 137
+#define RB_CHANGES_NONE 138
+#define RB_CHANGES_INSDEL 139
+#define RB_CHANGES_FILLFORM 140
+#define RB_CHANGES_COMMENT 141
+#define RB_CHANGES_ANY_NOCOPY 142
+#define CB_ENDAB_COPY 143
+#define CB_ENAB_ACCESS 144
+
+//---> i56629 controls for link management
+#define CB_ENAB_RELLINKFSYS 150
+
+#define FL_DEFAULT_LINK_ACTION 151
+#define CB_VIEW_PDF_DEFAULT 152
+#define CB_VIEW_PDF_BROWSER 153
+#define CB_VIEW_PDF_APPLICATION 154
+
+#define CB_CNV_OOO_DOCTOPDF 155
+#define CB_EXP_BMRK_TO_DEST 156
+//<---
diff --git a/filter/source/pdf/impdialog.hxx b/filter/source/pdf/impdialog.hxx
new file mode 100644
index 000000000000..38da273c2fbd
--- /dev/null
+++ b/filter/source/pdf/impdialog.hxx
@@ -0,0 +1,406 @@
+/*************************************************************************
+ *
+ * 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 IMPDIALOG_HXX
+#define IMPDIALOG_HXX
+
+#include "pdffilter.hxx"
+
+#include "vcl/dialog.hxx"
+#include "vcl/button.hxx"
+#include "vcl/fixed.hxx"
+#include "vcl/field.hxx"
+#include "vcl/edit.hxx"
+#include "vcl/lstbox.hxx"
+#include "vcl/combobox.hxx"
+#include "vcl/group.hxx"
+#include "vcl/pdfwriter.hxx"
+
+#include "svtools/FilterConfigItem.hxx"
+
+#include "sfx2/tabdlg.hxx"
+
+// ----------------
+// - ImpPDFDialog -
+// ----------------
+
+class ResMgr;
+class ImpPDFTabGeneralPage;
+class ImpPDFTabViewerPage;
+class ImpPDFTabOpnFtrPage;
+class ImpPDFTabLinksPage;
+
+class PDFFilterResId : public ResId
+{
+public:
+ PDFFilterResId( sal_uInt32 nId );
+};
+
+class ImplErrorDialog : public ModalDialog
+{
+ FixedImage maFI;
+ FixedText maProcessText;
+ ListBox maErrors;
+ FixedText maExplanation;
+
+ OKButton maButton;
+
+ DECL_LINK( SelectHdl, ListBox* );
+ public:
+ ImplErrorDialog( const std::set< vcl::PDFWriter::ErrorCode >& );
+ ~ImplErrorDialog();
+};
+
+////////////////////////////////////////////////////////////////////////
+//class tabbed dialog
+class ImpPDFTabDialog : public SfxTabDialog
+{
+private:
+ com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > mxMSF;
+ FilterConfigItem maConfigItem;
+ FilterConfigItem maConfigI18N;
+
+ Any maSelection;
+
+protected:
+//the following data are the configuration used throughout the dialog and pages
+ sal_Bool mbIsPresentation;
+ sal_Bool mbIsWriter;
+ sal_Bool mbSelectionPresent;
+ sal_Bool mbUseCTLFont;
+ sal_Bool mbUseLosslessCompression;
+ sal_Int32 mnQuality;
+ sal_Bool mbReduceImageResolution;
+ sal_Int32 mnMaxImageResolution;
+ sal_Bool mbUseTaggedPDF;
+ sal_Int32 mnPDFTypeSelection;
+ sal_Bool mbExportNotes;
+ sal_Bool mbExportNotesPages;
+ sal_Bool mbUseTransitionEffects;
+ sal_Bool mbIsSkipEmptyPages;
+ sal_Bool mbAddStream;
+ sal_Bool mbEmbedStandardFonts;
+ sal_Int32 mnFormsType;
+ sal_Bool mbExportFormFields;
+ sal_Bool mbAllowDuplicateFieldNames;
+ sal_Bool mbExportBookmarks;
+ sal_Int32 mnOpenBookmarkLevels;
+
+ sal_Bool mbHideViewerToolbar;
+ sal_Bool mbHideViewerMenubar;
+ sal_Bool mbHideViewerWindowControls;
+ sal_Bool mbResizeWinToInit;
+ sal_Bool mbCenterWindow;
+ sal_Bool mbOpenInFullScreenMode;
+ sal_Bool mbDisplayPDFDocumentTitle;
+ sal_Int32 mnMagnification;
+ sal_Int32 mnInitialView;
+ sal_Int32 mnZoom;
+ sal_Int32 mnInitialPage;
+
+ sal_Int32 mnPageLayout;
+ sal_Bool mbFirstPageLeft;
+
+ sal_Bool mbEncrypt;
+ String msUserPassword;
+
+ sal_Bool mbRestrictPermissions;
+ String msOwnerPassword;
+ sal_Int32 mnPrint;
+ sal_Int32 mnChangesAllowed;
+ sal_Bool mbCanCopyOrExtract;
+ sal_Bool mbCanExtractForAccessibility;
+
+ sal_Bool mbIsRangeChecked;
+ String msPageRange;
+ sal_Bool mbSelectionIsChecked;
+
+ sal_Bool mbExportRelativeFsysLinks;
+ sal_Int32 mnViewPDFMode;
+ sal_Bool mbConvertOOoTargets;
+ sal_Bool mbExportBmkToPDFDestination;
+
+public:
+
+ friend class ImpPDFTabGeneralPage;
+ friend class ImpPDFTabViewerPage;
+ friend class ImpPDFTabOpnFtrPage;
+ friend class ImpPDFTabSecurityPage;
+ friend class ImpPDFTabLinksPage;
+
+ ImpPDFTabDialog( Window* pParent,
+ Sequence< PropertyValue >& rFilterData,
+ const Reference< XComponent >& rDoc,
+ const Reference< lang::XMultiServiceFactory >& xFact
+ );
+ ~ImpPDFTabDialog();
+
+ Sequence< PropertyValue > GetFilterData();
+ const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& getServiceFactory() const { return mxMSF; }
+
+protected:
+ virtual void PageCreated( USHORT _nId,
+ SfxTabPage& _rPage );
+ virtual short Ok();
+};
+
+//class tab page general
+class ImpPDFTabGeneralPage : public SfxTabPage
+{
+ friend class ImpPDFTabLinksPage;
+
+ FixedLine maFlPages;
+ RadioButton maRbAll;
+ RadioButton maRbRange;
+ RadioButton maRbSelection;
+ Edit maEdPages;
+
+ FixedLine maFlCompression;
+ RadioButton maRbLosslessCompression;
+ RadioButton maRbJPEGCompression;
+ FixedText maFtQuality;
+ MetricField maNfQuality;
+ CheckBox maCbReduceImageResolution;
+ ComboBox maCoReduceImageResolution;
+
+ FixedLine maFlGeneral;
+ CheckBox maCbPDFA1b;
+ CheckBox maCbTaggedPDF;
+ sal_Bool mbTaggedPDFUserSelection;
+
+ CheckBox maCbExportFormFields;
+ sal_Bool mbExportFormFieldsUserSelection;
+ sal_Bool mbEmbedStandardFontsUserSelection;
+ FixedText maFtFormsFormat;
+ ListBox maLbFormsFormat;
+ CheckBox maCbAllowDuplicateFieldNames;
+
+ CheckBox maCbExportBookmarks;
+ CheckBox maCbExportNotes;
+ CheckBox maCbExportNotesPages;
+
+ CheckBox maCbExportEmptyPages;
+ CheckBox maCbAddStream;
+ CheckBox maCbEmbedStandardFonts;
+
+ sal_Bool mbIsPresentation;
+ sal_Bool mbIsWriter;
+
+const ImpPDFTabDialog* mpaParent;
+
+ DECL_LINK( TogglePagesHdl, void* );
+ DECL_LINK( ToggleCompressionHdl, void* );
+ DECL_LINK( ToggleReduceImageResolutionHdl, void* );
+ DECL_LINK( ToggleAddStreamHdl, void* );
+ DECL_LINK( ToggleExportFormFieldsHdl, void* );
+
+public:
+ DECL_LINK( ToggleExportPDFAHdl, void* );
+
+ ImpPDFTabGeneralPage( Window* pParent,
+ const SfxItemSet& rSet );
+
+ ~ImpPDFTabGeneralPage();
+ static SfxTabPage* Create( Window* pParent,
+ const SfxItemSet& rAttrSet);
+
+ void GetFilterConfigItem( ImpPDFTabDialog* paParent );
+ void SetFilterConfigItem( const ImpPDFTabDialog* paParent );
+ sal_Bool IsPdfaSelected() { return maCbPDFA1b.IsChecked(); };
+};
+
+//class tab page viewer
+class ImpPDFTabOpnFtrPage : public SfxTabPage
+{
+ FixedLine maFlInitialView;
+ RadioButton maRbOpnPageOnly;
+ RadioButton maRbOpnOutline;
+ RadioButton maRbOpnThumbs;
+ FixedText maFtInitialPage;
+ NumericField maNumInitialPage;
+
+ FixedLine maFlMagnification;
+ RadioButton maRbMagnDefault;
+ RadioButton maRbMagnFitWin;
+ RadioButton maRbMagnFitWidth;
+ RadioButton maRbMagnFitVisible;
+ RadioButton maRbMagnZoom;
+ MetricField maNumZoom;
+
+ FixedLine maFlPageLayout;
+ RadioButton maRbPgLyDefault;
+ RadioButton maRbPgLySinglePage;
+ RadioButton maRbPgLyContinue;
+ RadioButton maRbPgLyContinueFacing;
+ CheckBox maCbPgLyFirstOnLeft;
+
+ sal_Bool mbUseCTLFont;
+
+ DECL_LINK( ToggleRbPgLyContinueFacingHdl, void* );
+ DECL_LINK( ToggleRbMagnHdl, void* );
+
+public:
+ ImpPDFTabOpnFtrPage( Window* pParent,
+ const SfxItemSet& rSet );
+
+ ~ImpPDFTabOpnFtrPage();
+ static SfxTabPage* Create( Window* pParent,
+ const SfxItemSet& rAttrSet );
+
+ void GetFilterConfigItem( ImpPDFTabDialog* paParent);
+ void SetFilterConfigItem( const ImpPDFTabDialog* paParent );
+};
+
+//class tab page viewer
+class ImpPDFTabViewerPage : public SfxTabPage
+{
+ FixedLine maFlWindowOptions;
+ CheckBox maCbResWinInit;
+ CheckBox maCbCenterWindow;
+ CheckBox maCbOpenFullScreen;
+ CheckBox maCbDispDocTitle;
+
+ FixedLine maFlUIOptions;
+ CheckBox maCbHideViewerMenubar;
+ CheckBox maCbHideViewerToolbar;
+ CheckBox maCbHideViewerWindowControls;
+
+ FixedLine maFlTransitions;
+ CheckBox maCbTransitionEffects;
+ sal_Bool mbIsPresentation;
+
+ FixedLine maFlBookmarks;
+ RadioButton maRbAllBookmarkLevels;
+ RadioButton maRbVisibleBookmarkLevels;
+ NumericField maNumBookmarkLevels;
+
+ DECL_LINK( ToggleRbBookmarksHdl, void* );
+public:
+ ImpPDFTabViewerPage( Window* pParent,
+ const SfxItemSet& rSet );
+
+ ~ImpPDFTabViewerPage();
+ static SfxTabPage* Create( Window* pParent,
+ const SfxItemSet& rAttrSet );
+
+ void GetFilterConfigItem( ImpPDFTabDialog* paParent);
+ void SetFilterConfigItem( const ImpPDFTabDialog* paParent );
+};
+
+//class security tab page
+class ImpPDFTabSecurityPage : public SfxTabPage
+{
+ PushButton maPbUserPwd;
+ FixedText maFtUserPwd;
+ String maUserPwdSet;
+ String maUserPwdUnset;
+
+ PushButton maPbOwnerPwd;
+ FixedText maFtOwnerPwd;
+ String maOwnerPwdSet;
+ String maOwnerPwdUnset;
+
+ FixedLine maFlPrintPermissions;
+ RadioButton maRbPrintNone;
+ RadioButton maRbPrintLowRes;
+ RadioButton maRbPrintHighRes;
+
+ FixedLine maFlChangesAllowed;
+ RadioButton maRbChangesNone;
+ RadioButton maRbChangesInsDel;
+ RadioButton maRbChangesFillForm;
+ RadioButton maRbChangesComment;
+ RadioButton maRbChangesAnyNoCopy;
+
+ CheckBox maCbEnableCopy;
+ CheckBox maCbEnableAccessibility;
+
+ String msUserPassword;
+ String msUserPwdTitle;
+
+ String msOwnerPassword;
+ String msOwnerPwdTitle;
+
+ long nWidth;
+
+ DECL_LINK( ClickmaPbUserPwdHdl, void* );
+ DECL_LINK( ClickmaPbOwnerPwdHdl, void* );
+
+ void enablePermissionControls();
+
+ void ImplPwdPushButton( const String &, String & );
+
+public:
+ ImpPDFTabSecurityPage( Window* pParent,
+ const SfxItemSet& rSet );
+
+ ~ImpPDFTabSecurityPage();
+ static SfxTabPage* Create( Window* pParent,
+ const SfxItemSet& rAttrSet );
+
+ void GetFilterConfigItem( ImpPDFTabDialog* paParent);
+ void SetFilterConfigItem( const ImpPDFTabDialog* paParent );
+ void ImplPDFASecurityControl( sal_Bool bEnableSecurity );
+};
+
+//class to implement the relative link stuff
+class ImpPDFTabLinksPage : public SfxTabPage
+{
+ CheckBox maCbExprtBmkrToNmDst;
+ CheckBox maCbOOoToPDFTargets;
+ CheckBox maCbExportRelativeFsysLinks;
+
+ FixedLine maFlDefaultTitle;
+ RadioButton maRbOpnLnksDefault;
+ sal_Bool mbOpnLnksDefaultUserState;
+ RadioButton maRbOpnLnksLaunch;
+ sal_Bool mbOpnLnksLaunchUserState;
+ RadioButton maRbOpnLnksBrowser;
+ sal_Bool mbOpnLnksBrowserUserState;
+
+ long nWidth;
+
+ DECL_LINK( ClickRbOpnLnksDefaultHdl, void* );
+ DECL_LINK( ClickRbOpnLnksBrowserHdl, void* );
+
+public:
+ ImpPDFTabLinksPage( Window* pParent,
+ const SfxItemSet& rSet );
+
+ ~ImpPDFTabLinksPage();
+ static SfxTabPage* Create( Window* pParent,
+ const SfxItemSet& rAttrSet );
+
+ void GetFilterConfigItem( ImpPDFTabDialog* paParent);
+ void SetFilterConfigItem( const ImpPDFTabDialog* paParent );
+
+ void ImplPDFALinkControl( sal_Bool bEnableLaunch );
+};
+
+#endif // IMPDIALOG_HXX
+
+
diff --git a/filter/source/pdf/impdialog.src b/filter/source/pdf/impdialog.src
new file mode 100644
index 000000000000..76e64e87c173
--- /dev/null
+++ b/filter/source/pdf/impdialog.src
@@ -0,0 +1,840 @@
+/*************************************************************************
+ *
+ * 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 "impdialog.hrc"
+
+#define TAB_PDF_SIZE Size = MAP_APPFONT ( 176, 268 )
+//string for TabDialog standard buttons
+String STR_PDF_EXPORT
+{
+ Text[ en-US ] = "E~xport";
+};
+
+//strings used in encryption UI
+
+//password dialog title
+String STR_PDF_EXPORT_UDPWD
+{
+ Text[ en-US ] = "Set Open Password";
+};
+
+//password dialog title
+String STR_PDF_EXPORT_ODPWD
+{
+ Text[ en-US ] = "Set Permission Password";
+};
+
+//////////////////////////////////////////////////////////////
+//tab page for PDF Export, general preferences
+TabPage RID_PDF_TAB_GENER
+{
+ HelpId = HID_FILTER_PDF_OPTIONS ;
+ Hide = TRUE ;
+ Text[ en-US ] = "General";
+ TAB_PDF_SIZE;
+
+ FixedLine FL_PAGES
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 164 , 8 ) ;
+ Text[ en-US ] = "Range";
+ };
+ RadioButton RB_ALL
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 158 , 10 ) ;
+ Text[ en-US ] = "~All";
+ };
+ RadioButton RB_RANGE
+ {
+ Pos = MAP_APPFONT ( 12 , 27 ) ;
+ Size = MAP_APPFONT ( 101 , 10 ) ;
+ Text[ en-US ] = "~Pages";
+ };
+ Edit ED_PAGES
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 116, 26 ) ;
+ Size = MAP_APPFONT ( 48 , 12 ) ;
+ };
+ RadioButton RB_SELECTION
+ {
+ Pos = MAP_APPFONT ( 12 , 40 ) ;
+ Size = MAP_APPFONT ( 158 , 10 ) ;
+ Text[ en-US ] = "~Selection";
+ };
+ FixedLine FL_IMAGES
+ {
+ Pos = MAP_APPFONT ( 6 , 53 ) ;
+ Size = MAP_APPFONT ( 164 , 8 ) ;
+ Text[ en-US ] = "Images";
+ };
+ RadioButton RB_LOSSLESSCOMPRESSION
+ {
+ Pos = MAP_APPFONT ( 12 , 64 ) ;
+ Size = MAP_APPFONT ( 158 , 10 ) ;
+ Text[ en-US ] = "~Lossless compression";
+ };
+ RadioButton RB_JPEGCOMPRESSION
+ {
+ Pos = MAP_APPFONT ( 12 , 76 ) ;
+ Size = MAP_APPFONT ( 158, 10 ) ;
+ Text[ en-US ] = "~JPEG compression";
+ };
+ FixedText FT_QUALITY
+ {
+ Pos = MAP_APPFONT ( 30 , 89 ) ;
+ Size = MAP_APPFONT ( 83, 10 ) ;
+ Text[ en-US ] = "~Quality";
+ };
+ MetricField NF_QUALITY
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 116, 88 ) ;
+ Size = MAP_APPFONT ( 48, 12 ) ;
+ TabStop = TRUE ;
+ Spin = TRUE ;
+ StrictFormat = TRUE ;
+ Last = 100 ;
+ Repeat = TRUE ;
+ };
+ CheckBox CB_REDUCEIMAGERESOLUTION
+ {
+ Pos = MAP_APPFONT ( 12 , 103 ) ;
+ Size = MAP_APPFONT ( 101 , 10 ) ;
+ TabStop = TRUE ;
+ Text[ en-US ] = "~Reduce image resolution";
+ };
+ ComboBox CO_REDUCEIMAGERESOLUTION
+ {
+ Pos = MAP_APPFONT ( 116 , 102 ) ;
+ Size = MAP_APPFONT ( 48 , 50 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ StringList =
+ {
+ "75 DPI" ;
+ "150 DPI" ;
+ "300 DPI" ;
+ "600 DPI" ;
+ "1200 DPI" ;
+ };
+ };
+ FixedLine FL_GENERAL
+ {
+ Pos = MAP_APPFONT ( 6 , 117 ) ;
+ Size = MAP_APPFONT ( 164 , 8 ) ;
+ Text[ en-US ] = "General";
+ };
+ CheckBox CB_PDFA_1B_SELECT
+ {
+ Pos = MAP_APPFONT ( 12, 128 ) ;
+ Size = MAP_APPFONT ( 158 , 10 ) ;
+ TabStop = TRUE ;
+ Text[ en-US ] = "P~DF/A-1a";
+ };
+ CheckBox CB_TAGGEDPDF
+ {
+ Pos = MAP_APPFONT ( 12 , 141 ) ;
+ Size = MAP_APPFONT ( 158 , 10 ) ;
+ TabStop = TRUE ;
+ Text[ en-US ] = "~Tagged PDF";
+ };
+ CheckBox CB_EXPORTFORMFIELDS
+ {
+ Pos = MAP_APPFONT ( 12 , 154 ) ;
+ Size = MAP_APPFONT ( 158 , 10 ) ;
+ TabStop = TRUE ;
+ Text[ en-US ] = "~Create PDF form";
+ };
+ FixedText FT_FORMSFORMAT
+ {
+ Pos = MAP_APPFONT ( 30 , 168 ) ;
+ Size = MAP_APPFONT ( 93, 8 ) ;
+ Text[ en-US ] = "Submit ~format";
+ };
+ ListBox LB_FORMSFORMAT
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 126, 166 ) ;
+ Size = MAP_APPFONT ( 38, 48 ) ;
+ DeltaLang = < Default ; Default ; Default ; Default ; > ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ StringList =
+ {
+ < "FDF" ; Default; > ;
+ < "PDF" ; > ;
+ < "HTML" ; > ;
+ < "XML" ; > ;
+ };
+ };
+ CheckBox CB_ALLOWDUPLICATEFIELDNAMES
+ {
+ Pos = MAP_APPFONT( 30, 178 );
+ Size = MAP_APPFONT( 128, 10 );
+ TabStop = TRUE;
+ Text [ en-US ] = "Allow duplicate field ~names";
+ };
+ CheckBox CB_EXPORTBOOKMARKS
+ {
+ Pos = MAP_APPFONT ( 12 , 190 ) ;
+ Size = MAP_APPFONT ( 158 , 10 ) ;
+ TabStop = TRUE ;
+ Text[ en-US ] = "Export ~bookmarks";
+ };
+ CheckBox CB_EXPORTNOTES
+ {
+ Pos = MAP_APPFONT ( 12 , 203 ) ;
+ Size = MAP_APPFONT ( 158 , 10 ) ;
+ TabStop = TRUE ;
+ Text[ en-US ] = "~Export comments";
+ };
+ CheckBox CB_EXPORTNOTESPAGES
+ {
+ Pos = MAP_APPFONT ( 12 , 216 ) ;
+ Size = MAP_APPFONT ( 158 , 10 ) ;
+ TabStop = TRUE ;
+ Text[ en-US ] = "Export ~notes pages";
+ };
+ CheckBox CB_EXPORTEMPTYPAGES
+ {
+ Pos = MAP_APPFONT ( 12 , 229 ) ;
+ Size = MAP_APPFONT ( 158 , 16 ) ;
+ TabStop = TRUE ;
+ WordBreak = TRUE ;
+ Text[ en-US ] = "Exp~ort automatically inserted blank pages";
+ };
+ CheckBox CB_EMBEDSTANDARDFONTS
+ {
+ Pos = MAP_APPFONT ( 12 , 248 ) ;
+ Size = MAP_APPFONT ( 158 , 10 ) ;
+ TabStop = TRUE ;
+ Text[ en-US ] = "E~mbed standard fonts";
+ };
+ CheckBox CB_ADDSTREAM
+ {
+ Pos = MAP_APPFONT ( 12 , 261 ) ;
+ Size = MAP_APPFONT ( 158 , 10 ) ;
+ TabStop = TRUE ;
+ Text[ en-US ] = "Create ~hybrid file";
+ };
+};
+
+//----------------------------------------------------------
+//tab page for PDF Export, opening features
+TabPage RID_PDF_TAB_OPNFTR
+{
+ HelpId = HID_FILTER_PDF_INITIAL_VIEW ;
+ Text[ en-US ] = "Initial View" ;
+ TAB_PDF_SIZE;
+ Hide = TRUE;
+
+////////////////////////////////////////
+ FixedLine FL_INITVIEW
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 164 , 8 ) ;
+ Text[ en-US ] = "Panes" ;
+ };
+ RadioButton RB_OPNMODE_PAGEONLY
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 158 , 10 ) ;
+ Text[ en-US ] = "~Page only" ;
+ };
+ RadioButton RB_OPNMODE_OUTLINE
+ {
+ Pos = MAP_APPFONT ( 12 , 26 ) ;
+ Size = MAP_APPFONT ( 158 , 10 ) ;
+ Text[ en-US ] = "~Bookmarks and page" ;
+ };
+ RadioButton RB_OPNMODE_THUMBS
+ {
+ Pos = MAP_APPFONT ( 12 , 38 ) ;
+ Size = MAP_APPFONT ( 158 , 10 ) ;
+ Text[ en-US ] = "~Thumbnails and page" ;
+ };
+
+ FixedText FT_MAGNF_INITIAL_PAGE
+ {
+ Pos = MAP_APPFONT( 12, 52 );
+ Size = MAP_APPFONT( 109, 10 );
+ Text[ en-US ] = "Open on page";
+ };
+ NumericField NUM_MAGNF_INITIAL_PAGE
+ {
+ Pos = MAP_APPFONT( 124, 52 );
+ Size = MAP_APPFONT( 40, 12 );
+ Value = 1;
+ Spin = TRUE;
+ Border = TRUE;
+ Minimum = 1;
+ };
+
+///////////////////////////////////////////////////
+ FixedLine FL_MAGNIFICATION
+ {
+ Pos = MAP_APPFONT ( 6 , 68 ) ;
+ Size = MAP_APPFONT ( 164 , 8 ) ;
+ Text[ en-US ] = "Magnification" ;
+ };
+ RadioButton RB_MAGNF_DEFAULT
+ {
+ // see PDF ref v 1.5 tab 8.2, pg. 542 ( /XYZ )
+ Pos = MAP_APPFONT ( 12 , 80 ) ;
+ Size = MAP_APPFONT ( 158 , 10 ) ;
+ Text[ en-US ] = "~Default" ;
+ };
+ RadioButton RB_MAGNF_WIND
+ {
+ // see PDF ref v 1.5 tab 8.2, pg. 542 ( /Fit )
+ Pos = MAP_APPFONT ( 12 , 92 ) ;
+ Size = MAP_APPFONT ( 158 , 10 ) ;
+ Text[ en-US ] = "~Fit in window" ;
+ };
+ RadioButton RB_MAGNF_WIDTH
+ {
+ // see PDF ref v 1.5 tab 8.2, pg. 542 ( /FitH top )
+ Pos = MAP_APPFONT ( 12 , 104 ) ;
+ Size = MAP_APPFONT ( 158 , 10 ) ;
+ Text[ en-US ] = "Fit ~width" ;
+ };
+ RadioButton RB_MAGNF_VISIBLE
+ {
+ // see PDF ref v 1.5 tab 8.2, pg. 542 ( /FitBH top )
+ Pos = MAP_APPFONT ( 12 , 116 ) ;
+ Size = MAP_APPFONT ( 158 , 10 ) ;
+ Text[ en-US ] = "Fit ~visible" ;
+ };
+ RadioButton RB_MAGNF_ZOOM
+ {
+ // see PDF ref v 1.6 tab 8.2, pg. 551 ( /XYZ left top zoom )
+ Pos = MAP_APPFONT ( 12 , 128 ) ;
+ Size = MAP_APPFONT ( 109 , 10 ) ;
+ Text[ en-US ] = "~Zoom factor" ;
+ };
+ MetricField NUM_MAGNF_ZOOM
+ {
+ Pos = MAP_APPFONT( 124, 128 ) ;
+ Size = MAP_APPFONT( 40, 12 ) ;
+ Unit = FUNIT_PERCENT;
+ Value = 100;
+ Spin = TRUE;
+ Border = TRUE;
+ Minimum = 50;
+ Maximum = 1600;
+ };
+////////////////////////////////////////
+ FixedLine FL_PAGE_LAYOUT
+ {
+ Pos = MAP_APPFONT ( 6 , 146 ) ;
+ Size = MAP_APPFONT (164 , 8 ) ;
+ Text[ en-US ] = "Page layout" ;
+ };
+ RadioButton RB_PGLY_DEFAULT
+ {
+ Pos = MAP_APPFONT ( 12 , 158 ) ;
+ Size = MAP_APPFONT ( 158 , 10 ) ;
+ Text[ en-US ] = "D~efault" ;
+ };
+ RadioButton RB_PGLY_SINGPG
+ {
+ Pos = MAP_APPFONT ( 12 , 170 ) ;
+ Size = MAP_APPFONT ( 158 , 10 ) ;
+ Text[ en-US ] = "~Single page" ;
+ };
+ RadioButton RB_PGLY_CONT
+ {
+ Pos = MAP_APPFONT ( 12 , 182 ) ;
+ Size = MAP_APPFONT ( 158 , 10 ) ;
+ Text[ en-US ] = "~Continuous" ;
+ };
+ RadioButton RB_PGLY_CONTFAC
+ {
+ Pos = MAP_APPFONT ( 12 , 194 ) ;
+ Size = MAP_APPFONT ( 158 , 10 ) ;
+ Text[ en-US ] = "C~ontinuous facing" ;
+ };
+ CheckBox CB_PGLY_FIRSTLEFT
+ {
+ Pos = MAP_APPFONT ( 22 , 206 ) ;
+ Size = MAP_APPFONT ( 148 , 10 ) ;
+ Text[ en-US ] = "First page is ~left" ;
+ };
+};
+
+//----------------------------------------------------------
+//tab page for PDF Export, viewer preferences
+TabPage RID_PDF_TAB_VPREFER
+{
+ HelpId = HID_FILTER_PDF_USER_INTERFACE ;
+ Text[ en-US ] = "User Interface" ;
+ TAB_PDF_SIZE;
+ Hide = TRUE;
+
+//////////////////////////////////////
+ FixedLine FL_WINOPT
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 164 , 8 ) ;
+ Text[ en-US ] = "Window options" ;
+ };
+
+ CheckBox CB_WNDOPT_RESINIT
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 158 , 10 ) ;
+ TabStop = TRUE ;
+ Text[ en-US ] = "~Resize window to initial page";
+ };
+ CheckBox CB_WNDOPT_CNTRWIN
+ {
+ Pos = MAP_APPFONT ( 12 , 26 ) ;
+ Size = MAP_APPFONT ( 158 , 10 ) ;
+ TabStop = TRUE ;
+ Text[ en-US ] = "~Center window on screen";
+ };
+ CheckBox CB_WNDOPT_OPNFULL
+ {
+ Pos = MAP_APPFONT ( 12 , 38 ) ;
+ Size = MAP_APPFONT ( 158 , 10 ) ;
+ Text[ en-US ] = "~Open in full screen mode" ;
+ };
+ CheckBox CB_DISPDOCTITLE
+ {
+ Pos = MAP_APPFONT ( 12 , 50 ) ;
+ Size = MAP_APPFONT ( 158 , 10 ) ;
+ TabStop = TRUE ;
+ Text[ en-US ] = "~Display document title";
+ };
+
+////////////////////////////////
+ FixedLine FL_USRIFOPT
+ {
+ Pos = MAP_APPFONT ( 6 , 64 ) ;
+ Size = MAP_APPFONT ( 164 , 8 ) ;
+ Text[ en-US ] = "User interface options" ;
+ };
+ CheckBox CB_UOP_HIDEVMENUBAR
+ {
+ Pos = MAP_APPFONT ( 12 , 76 ) ;
+ Size = MAP_APPFONT ( 158 , 10 ) ;
+ TabStop = TRUE ;
+ Text[ en-US ] = "Hide ~menubar";
+ };
+ CheckBox CB_UOP_HIDEVTOOLBAR
+ {
+ Pos = MAP_APPFONT ( 12 , 88 ) ;
+ Size = MAP_APPFONT ( 158 , 10 ) ;
+ TabStop = TRUE ;
+ Text[ en-US ] = "Hide ~toolbar";
+ };
+ CheckBox CB_UOP_HIDEVWINCTRL
+ {
+ Pos = MAP_APPFONT ( 12 , 100 ) ;
+ Size = MAP_APPFONT ( 158 , 10 ) ;
+ TabStop = TRUE ;
+ Text[ en-US ] = "Hide ~window controls";
+ };
+
+////////////////////////////////
+ FixedLine FL_TRANSITIONS
+ {
+ Pos = MAP_APPFONT ( 6 , 114 ) ;
+ Size = MAP_APPFONT ( 164 , 8 ) ;
+ Text[ en-US ] = "Transitions" ;
+ };
+ CheckBox CB_TRANSITIONEFFECTS
+ {
+ Pos = MAP_APPFONT ( 12 , 126 ) ;
+ Size = MAP_APPFONT ( 158 , 10 ) ;
+ TabStop = TRUE ;
+ Text[ en-US ] = "~Use transition effects";
+ };
+////////////////////////////////
+ FixedLine FL_BOOKMARKS
+ {
+ Pos = MAP_APPFONT ( 6 , 140 ) ;
+ Size = MAP_APPFONT ( 164 , 8 ) ;
+ Text[ en-US ] = "Bookmarks" ;
+ };
+ RadioButton RB_ALLBOOKMARKLEVELS
+ {
+ Pos = MAP_APPFONT ( 12 , 152 ) ;
+ Size = MAP_APPFONT ( 158 , 10 ) ;
+ Text[ en-US ] = "All bookmark levels";
+ };
+ RadioButton RB_VISIBLEBOOKMARKLEVELS
+ {
+ Pos = MAP_APPFONT ( 12 , 166 ) ;
+ Size = MAP_APPFONT ( 117 , 10 ) ;
+ Text[ en-US ] = "Visible bookmark levels";
+ };
+ NumericField NUM_BOOKMARKLEVELS
+ {
+ Pos = MAP_APPFONT ( 132 , 165 ) ;
+ Size = MAP_APPFONT ( 32 , 12 ) ;
+ Border = TRUE;
+ Spin = TRUE;
+ Minimum = 1;
+ Maximum = 10;
+ };
+};
+
+//----------------------------------------------------------
+//tab page for PDF Export, security
+TabPage RID_PDF_TAB_SECURITY
+{
+ HelpId = HID_FILTER_PDF_SECURITY ;
+ Text [ en-US ] = "Security";
+ TAB_PDF_SIZE;
+ Hide = TRUE;
+
+//////////////////////////////////////
+ PushButton BTN_USER_PWD
+ {
+ TabStop = TRUE ;
+ Disable = TRUE ;
+ Pos = MAP_APPFONT ( 12, 5 ) ;
+ Size = MAP_APPFONT ( 120 , 13 ) ;
+ Text[ en-US ] = "Set ~open password...";
+ };
+
+ FixedText FT_USER_PWD
+ {
+ Pos = MAP_APPFONT(12 , 25 );
+ Size = MAP_APPFONT( 160, 20 );
+ };
+
+ String STR_USER_PWD_SET
+ {
+ Text [ en-US ] = "Open password set";
+ };
+
+ String STR_USER_PWD_ENC
+ {
+ Text [ en-US ] = "PDF document will be encrypted";
+ };
+
+ String STR_USER_PWD_UNSET
+ {
+ Text [ en-US ] = "No open password set";
+ };
+
+ String STR_USER_PWD_UNENC
+ {
+ Text [ en-US ] = "PDF document will not be encrypted";
+ };
+
+ PushButton BTN_OWNER_PWD
+ {
+ TabStop = TRUE ;
+ Disable = TRUE ;
+ Pos = MAP_APPFONT ( 12, 45 ) ;
+ Size = MAP_APPFONT ( 120 , 13 ) ;
+ Text[ en-US ] = "Set ~permission password...";
+ };
+
+ FixedText FT_OWNER_PWD
+ {
+ Pos = MAP_APPFONT( 12 , 65 );
+ Size = MAP_APPFONT( 160, 20 );
+ };
+
+ String STR_OWNER_PWD_SET
+ {
+ Text [ en-US ] = "Permission password set";
+ };
+
+ String STR_OWNER_PWD_REST
+ {
+ Text [ en-US ] = "PDF document will be restricted";
+ };
+
+ String STR_OWNER_PWD_UNSET
+ {
+ Text [ en-US ] = "No permission password set";
+ };
+
+ String STR_OWNER_PWD_UNREST
+ {
+ Text [ en-US ] = "PDF document will be unrestricted";
+ };
+
+//////////////////////////////
+ FixedLine FL_PRINT_PERMISSIONS
+ {
+ Pos = MAP_APPFONT ( 12 , 90 ) ;
+ Size = MAP_APPFONT (156 , 8 ) ;
+ Text[ en-US ] = "Printing" ;
+ };
+ RadioButton RB_PRINT_NONE
+ {
+ Pos = MAP_APPFONT ( 18 , 101 ) ;
+ Size = MAP_APPFONT ( 150 , 10 ) ;
+ Text[ en-US ] = "~Not permitted";
+ };
+ RadioButton RB_PRINT_LOWRES
+ {
+ Pos = MAP_APPFONT ( 18 , 112 ) ;
+ Size = MAP_APPFONT ( 150 , 10 ) ;
+ Text[ en-US ] = "~Low resolution (150 dpi)";
+ };
+ RadioButton RB_PRINT_HIGHRES
+ {
+ Pos = MAP_APPFONT ( 18 , 123 ) ;
+ Size = MAP_APPFONT ( 150 , 10 ) ;
+ Text[ en-US ] = "~High resolution";
+ };
+
+/////////////////////////////
+ FixedLine FL_CHANGES_ALLOWED
+ {
+ Pos = MAP_APPFONT ( 12 , 134 ) ;
+ Size = MAP_APPFONT (156 , 8 ) ;
+ Text[ en-US ] = "Changes" ;
+ };
+ RadioButton RB_CHANGES_NONE
+ {
+ Pos = MAP_APPFONT ( 18 , 145 ) ;
+ Size = MAP_APPFONT ( 150 , 10 ) ;
+ Text[ en-US ] = "No~t permitted";
+ };
+ RadioButton RB_CHANGES_INSDEL
+ {
+ Pos = MAP_APPFONT ( 18 , 157 ) ;
+ Size = MAP_APPFONT ( 150 , 10 ) ;
+ Text[ en-US ] = "~Inserting, deleting, and rotating pages";
+ };
+ RadioButton RB_CHANGES_FILLFORM
+ {
+ Pos = MAP_APPFONT ( 18 , 168 ) ;
+ Size = MAP_APPFONT ( 150 , 10 ) ;
+ Text[ en-US ] = "~Filling in form fields";
+ };
+ RadioButton RB_CHANGES_COMMENT
+ {
+ Pos = MAP_APPFONT ( 18 , 179 ) ;
+ Size = MAP_APPFONT ( 152 , 16 ) ;
+ WordBreak = TRUE ;
+ Text[ en-US ] = "~Commenting, filling in form fields";
+ };
+ RadioButton RB_CHANGES_ANY_NOCOPY
+ {
+ Pos = MAP_APPFONT ( 18 , 198 ) ;
+ Size = MAP_APPFONT ( 152 , 10 ) ;
+ Text[ en-US ] = "~Any except extracting pages";
+ };
+
+ CheckBox CB_ENDAB_COPY
+ {
+ Pos = MAP_APPFONT ( 12 , 211 ) ;
+ Size = MAP_APPFONT ( 158 , 10 ) ;
+ TabStop = TRUE ;
+ Text[ en-US ] = "Ena~ble copying of content" ;
+ };
+
+ CheckBox CB_ENAB_ACCESS
+ {
+ Pos = MAP_APPFONT ( 12 , 224 ) ;
+ Size = MAP_APPFONT ( 158 , 10 ) ;
+ TabStop = TRUE ;
+ Text[ en-US ] = "Enable text access for acce~ssibility tools" ;
+ };
+};
+
+//----------------------------------------------------------
+//tab page for PDF Export, links management
+TabPage RID_PDF_TAB_LINKS
+{
+ HelpId = HID_FILTER_PDF_LINKS;
+ Text [ en-US ] = "---";
+ TAB_PDF_SIZE;
+ Hide = TRUE;
+
+ CheckBox CB_EXP_BMRK_TO_DEST
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 164 , 16 ) ;
+ TabStop = TRUE ;
+ WordBreak = TRUE ;
+ Text[ en-US ] = "Export bookmarks as named destinations" ;
+ };
+
+ CheckBox CB_CNV_OOO_DOCTOPDF
+ {
+ Pos = MAP_APPFONT ( 6 , 22 ) ;
+ Size = MAP_APPFONT ( 164 , 16 ) ;
+ TabStop = TRUE ;
+ WordBreak = TRUE ;
+ Text[ en-US ] = "Convert document references to PDF targets" ;
+ };
+
+ CheckBox CB_ENAB_RELLINKFSYS
+ {
+ Pos = MAP_APPFONT ( 6 , 41 ) ;
+ Size = MAP_APPFONT ( 164 , 16 ) ;
+ TabStop = TRUE ;
+ WordBreak = TRUE ;
+ Text[ en-US ] = "Export URLs relative to file system" ;
+ };
+
+ FixedLine FL_DEFAULT_LINK_ACTION
+ {
+ Pos = MAP_APPFONT ( 6 , 60 ) ;
+ Size = MAP_APPFONT ( 164 , 8 ) ;
+ Text[ en-US ] = "Cross-document links" ;
+ };
+
+ RadioButton CB_VIEW_PDF_DEFAULT
+ {
+ Pos = MAP_APPFONT ( 12 , 71 ) ;
+ Size = MAP_APPFONT ( 158 , 10 ) ;
+ TabStop = TRUE ;
+ Text[ en-US ] = "Default mode" ;
+ };
+
+ RadioButton CB_VIEW_PDF_APPLICATION
+ {
+ Pos = MAP_APPFONT ( 12 , 84 ) ;
+ Size = MAP_APPFONT ( 158 , 10 ) ;
+ TabStop = TRUE ;
+ Text[ en-US ] = "Open with PDF reader application" ;
+ };
+
+ RadioButton CB_VIEW_PDF_BROWSER
+ {
+ Pos = MAP_APPFONT ( 12 , 97 ) ;
+ Size = MAP_APPFONT ( 158 , 10 ) ;
+ TabStop = TRUE ;
+ Text[ en-US ] = "Open with Internet browser" ;
+ };
+};
+
+//----------------------------------------------------------
+TabDialog RID_PDF_EXPORT_DLG
+{
+ HelpId = HID_FILTER_PDF_OPTIONS ;
+ OutputSize = TRUE;
+ SVLook = TRUE;
+ Moveable = TRUE;
+ Text [ en-US ] = "PDF Options";
+
+ TabControl 1
+ {
+ HelpId = HID_FILTER_PDF_OPTIONS ;
+ OutputSize = TRUE;
+ PageList =
+ {
+ PageItem
+ {
+ Identifier = RID_PDF_TAB_GENER;
+ Text [ en-US ] = "General";
+ };
+ PageItem
+ {
+ Identifier = RID_PDF_TAB_OPNFTR;
+ Text [ en-US ] = "Initial View";
+ };
+ PageItem
+ {
+ Identifier = RID_PDF_TAB_VPREFER;
+ Text [ en-US ] = "User Interface";
+ };
+ PageItem
+ {
+ Identifier = RID_PDF_TAB_LINKS;
+ Text [ en-US ] = "Links";
+ };
+ PageItem
+ {
+ Identifier = RID_PDF_TAB_SECURITY;
+ Text [ en-US ] = "Security";
+ };
+ };
+ };
+};
+
+ModalDialog RID_PDF_ERROR_DLG
+{
+ OutputSize = TRUE;
+ SVLook = TRUE;
+ Moveable = TRUE;
+ Text [en-US] = "Problems during PDF export";
+ Size = MAP_APPFONT( 200, 150 );
+
+ FixedText FT_PROCESS
+ {
+ WordBreak = TRUE;
+ Pos = MAP_APPFONT( 5, 5 );
+ Size = MAP_APPFONT( 210, 24 );
+ Text [en-US] = "During PDF export the following problems occurred:";
+ };
+
+ Bitmap IMG_WARN
+ {
+ File = "ballgreen_7.png";
+ };
+ Bitmap IMG_ERR
+ {
+ File = "ballred_7.png";
+ };
+
+ String STR_WARN_TRANSP_PDFA_SHORT
+ {
+ Text [en-US] = "PDF/A transparency";
+ };
+ String STR_WARN_TRANSP_PDFA
+ {
+ Text [en-US] = "PDF/A forbids transparency. A transparent object was painted opaque instead.";
+ };
+ String STR_WARN_TRANSP_VERSION_SHORT
+ {
+ Text [en-US] = "PDF version conflict";
+ };
+ String STR_WARN_TRANSP_VERSION
+ {
+ Text [en-US] = "Transparency is not supported in PDF versions earlier than PDF 1.4. A transparent object was painted opaque instead";
+ };
+ String STR_WARN_FORMACTION_PDFA_SHORT
+ {
+ Text [en-US] = "PDF/A form action";
+ };
+ String STR_WARN_FORMACTION_PDFA
+ {
+ Text [en-US] = "A form control contained an action not supported by the PDF/A standard. The action was skipped";
+ };
+ String STR_WARN_TRANSP_CONVERTED
+ {
+ Text [en-US] = "Some objects were converted to an image in order to remove transparencies, because the target PDF format does not support transparencies. Possibly better results can be achieved if you remove the transparent objects before exporting.";
+ };
+ String STR_WARN_TRANSP_CONVERTED_SHORT
+ {
+ Text [en-US] = "Transparencies removed";
+ };
+};
diff --git a/filter/source/pdf/makefile.mk b/filter/source/pdf/makefile.mk
new file mode 100644
index 000000000000..edf3147a822c
--- /dev/null
+++ b/filter/source/pdf/makefile.mk
@@ -0,0 +1,83 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ=..$/..
+PRJNAME=filter
+TARGET=pdffilter
+GEN_HID=TRUE
+
+ENABLE_EXCEPTIONS=TRUE
+VISIBILITY_HIDDEN=TRUE
+
+# --- Settings ----------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Files -------------------------------------
+
+SRS1NAME=$(TARGET)
+SRC1FILES = impdialog.src \
+ pdf.src
+
+SLOFILES= $(SLO)$/pdfuno.obj \
+ $(SLO)$/pdfdialog.obj \
+ $(SLO)$/impdialog.obj \
+ $(SLO)$/pdffilter.obj \
+ $(SLO)$/pdfexport.obj
+
+# --- Library -----------------------------------
+
+RESLIB1NAME=$(TARGET)
+RESLIB1SRSFILES= $(SRS)$/$(TARGET).srs
+
+SHL1TARGET=$(TARGET)$(DLLPOSTFIX)
+
+SHL1STDLIBS=\
+ $(SVTOOLLIB) \
+ $(TKLIB) \
+ $(VCLLIB) \
+ $(SVLLIB) \
+ $(BASEGFXLIB) \
+ $(SFX2LIB) \
+ $(UNOTOOLSLIB) \
+ $(TOOLSLIB) \
+ $(COMPHELPERLIB) \
+ $(CPPUHELPERLIB) \
+ $(CPPULIB) \
+ $(SALLIB)
+
+SHL1DEPN=
+SHL1IMPLIB= i$(SHL1TARGET)
+SHL1LIBS= $(SLB)$/$(TARGET).lib
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+SHL1VERSIONMAP=$(SOLARENV)/src/component.map
+
+DEF1NAME=$(SHL1TARGET)
+
+# --- Targets ----------------------------------
+
+.INCLUDE : target.mk
diff --git a/filter/source/pdf/pdf.hrc b/filter/source/pdf/pdf.hrc
new file mode 100644
index 000000000000..0d4f74cbfcba
--- /dev/null
+++ b/filter/source/pdf/pdf.hrc
@@ -0,0 +1,29 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#define PDF_PROGRESS_BAR 260
+
diff --git a/filter/source/pdf/pdf.src b/filter/source/pdf/pdf.src
new file mode 100644
index 000000000000..0c7655c1c30c
--- /dev/null
+++ b/filter/source/pdf/pdf.src
@@ -0,0 +1,66 @@
+/*************************************************************************
+ *
+ * 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 "pdf.hrc"
+
+String PDF_PROGRESS_BAR
+{
+ Text [ en-US ] = "Export as PDF";
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/filter/source/pdf/pdfdialog.cxx b/filter/source/pdf/pdfdialog.cxx
new file mode 100644
index 000000000000..6703511ec914
--- /dev/null
+++ b/filter/source/pdf/pdfdialog.cxx
@@ -0,0 +1,222 @@
+ /*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include "pdfdialog.hxx"
+#include "impdialog.hxx"
+#include <vcl/svapp.hxx>
+#include <vcl/dialog.hxx>
+#include <svl/solar.hrc>
+#include <com/sun/star/view/XRenderable.hpp>
+
+using namespace ::rtl;
+using namespace ::vcl;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+
+// -----------------------
+// - PDFDialog functions -
+// -----------------------
+
+#define SERVICE_NAME "com.sun.star.document.PDFDialog"
+
+// -----------------------------------------------------------------------------
+
+OUString PDFDialog_getImplementationName ()
+ throw (RuntimeException)
+{
+ return OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.PDF.PDFDialog" ) );
+}
+
+// -----------------------------------------------------------------------------
+
+Sequence< sal_Int8 > SAL_CALL PDFDialog_getImplementationId()
+ throw(RuntimeException)
+{
+ static ::cppu::OImplementationId aId;
+ return aId.getImplementationId();
+}
+
+// -----------------------------------------------------------------------------
+
+Sequence< OUString > SAL_CALL PDFDialog_getSupportedServiceNames()
+ throw (RuntimeException)
+{
+ Sequence < OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME ) );
+ return aRet;
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XInterface > SAL_CALL PDFDialog_createInstance( const Reference< XMultiServiceFactory > & rSMgr)
+ throw( Exception )
+{
+ return (cppu::OWeakObject*) new PDFDialog( rSMgr );
+}
+
+// -----------------------------------------------------------------------------
+
+#undef SERVICE_NAME
+
+// -------------
+// - PDFDialog -
+// -------------
+
+PDFDialog::PDFDialog( const Reference< XMultiServiceFactory > &rxMSF )
+: PDFDialog_Base( rxMSF )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+PDFDialog::~PDFDialog()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+Sequence< sal_Int8 > SAL_CALL PDFDialog::getImplementationId()
+ throw(RuntimeException)
+{
+ return PDFDialog_getImplementationId();
+}
+
+// -----------------------------------------------------------------------------
+
+OUString SAL_CALL PDFDialog::getImplementationName()
+ throw (RuntimeException)
+{
+ return PDFDialog_getImplementationName();
+}
+
+// -----------------------------------------------------------------------------
+
+Sequence< OUString > SAL_CALL PDFDialog::getSupportedServiceNames()
+ throw (RuntimeException)
+{
+ return PDFDialog_getSupportedServiceNames();
+}
+
+// -----------------------------------------------------------------------------
+
+Dialog* PDFDialog::createDialog( Window* pParent )
+{
+ Dialog* pRet = NULL;
+
+ if( mxSrcDoc.is() )
+ {
+ ImpPDFTabDialog* pDlg = new ImpPDFTabDialog( pParent, maFilterData, mxSrcDoc, m_aContext.getLegacyServiceFactory() );
+ pRet = pDlg;
+ }
+
+ return pRet;
+}
+
+// -----------------------------------------------------------------------------
+
+void PDFDialog::executedDialog( sal_Int16 nExecutionResult )
+{
+ if( nExecutionResult && m_pDialog )
+ maFilterData = static_cast< ImpPDFTabDialog* >( m_pDialog )->GetFilterData();
+ destroyDialog();
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XPropertySetInfo > SAL_CALL PDFDialog::getPropertySetInfo()
+ throw(RuntimeException)
+{
+ Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+//-------------------------------------------------------------------------
+::cppu::IPropertyArrayHelper& PDFDialog::getInfoHelper()
+{
+ return *const_cast<PDFDialog*>(this)->getArrayHelper();
+}
+
+//------------------------------------------------------------------------------
+::cppu::IPropertyArrayHelper* PDFDialog::createArrayHelper() const
+{
+ Sequence< Property > aProps;
+ describeProperties(aProps);
+ return new ::cppu::OPropertyArrayHelper( aProps );
+}
+
+// -----------------------------------------------------------------------------
+
+Sequence< PropertyValue > SAL_CALL PDFDialog::getPropertyValues()
+ throw ( RuntimeException )
+{
+ sal_Int32 i, nCount;
+
+ for( i = 0, nCount = maMediaDescriptor.getLength(); i < nCount; i++ )
+ {
+ if( maMediaDescriptor[ i ].Name.equalsAscii( "FilterData" ) )
+ break;
+ }
+
+ if( i == nCount )
+ maMediaDescriptor.realloc( ++nCount );
+
+ maMediaDescriptor[ i ].Name = String( RTL_CONSTASCII_USTRINGPARAM( "FilterData" ) );
+ maMediaDescriptor[ i ].Value <<= maFilterData;
+
+ return maMediaDescriptor;
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL PDFDialog::setPropertyValues( const Sequence< PropertyValue >& rProps )
+ throw ( UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException )
+{
+ maMediaDescriptor = rProps;
+
+ for( sal_Int32 i = 0, nCount = maMediaDescriptor.getLength(); i < nCount; i++ )
+ {
+ if( maMediaDescriptor[ i ].Name.equalsAscii( "FilterData" ) )
+ {
+ maMediaDescriptor[ i ].Value >>= maFilterData;
+ break;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL PDFDialog::setSourceDocument( const Reference< XComponent >& xDoc )
+ throw(IllegalArgumentException, RuntimeException)
+{
+ mxSrcDoc = xDoc;
+}
diff --git a/filter/source/pdf/pdfdialog.hxx b/filter/source/pdf/pdfdialog.hxx
new file mode 100644
index 000000000000..29da770e65ff
--- /dev/null
+++ b/filter/source/pdf/pdfdialog.hxx
@@ -0,0 +1,91 @@
+/*************************************************************************
+ *
+ * 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 PDFDIALOG_HXX
+#define PDFDIALOG_HXX
+
+#include "pdffilter.hxx"
+#include <svtools/genericunodialog.hxx>
+
+#include <cppuhelper/implbase2.hxx>
+
+// -------------
+// - PDFDialog -
+// -------------
+
+class Window;
+class ResMgr;
+
+typedef ::svt::OGenericUnoDialog PDFDialog_DialogBase;
+typedef ::cppu::ImplInheritanceHelper2 <
+ PDFDialog_DialogBase,
+ XPropertyAccess,
+ XExporter
+ > PDFDialog_Base;
+
+class PDFDialog : public PDFDialog_Base,
+ public ::comphelper::OPropertyArrayUsageHelper< PDFDialog >
+{
+private:
+ Sequence< PropertyValue > maMediaDescriptor;
+ Sequence< PropertyValue > maFilterData;
+ Reference< XComponent > mxSrcDoc;
+
+protected:
+ // OGenericUnoDialog
+ virtual Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(RuntimeException);
+ virtual OUString SAL_CALL getImplementationName() throw (RuntimeException);
+ virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw (RuntimeException);
+ virtual Dialog* createDialog( Window* pParent );
+ virtual void executedDialog( sal_Int16 nExecutionResult );
+ virtual Reference< XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(RuntimeException);
+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
+
+ // XPropertyAccess
+ using OPropertySetHelper::getPropertyValues;
+ virtual Sequence< PropertyValue > SAL_CALL getPropertyValues( ) throw (RuntimeException);
+ using OPropertySetHelper::setPropertyValues;
+ virtual void SAL_CALL setPropertyValues( const Sequence< PropertyValue >& aProps ) throw (UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException);
+
+ // XExporter
+ virtual void SAL_CALL setSourceDocument( const Reference< XComponent >& xDoc ) throw(IllegalArgumentException, RuntimeException);
+
+public:
+
+ PDFDialog( const Reference< XMultiServiceFactory >& rxMSF );
+ virtual ~PDFDialog();
+};
+
+// -----------------------------------------------------------------------------
+
+OUString PDFDialog_getImplementationName () throw (RuntimeException);
+Sequence< sal_Int8 > SAL_CALL PDFDialog_getImplementationId() throw(RuntimeException);
+Sequence< OUString > SAL_CALL PDFDialog_getSupportedServiceNames() throw (RuntimeException);
+Reference< XInterface > SAL_CALL PDFDialog_createInstance( const Reference< XMultiServiceFactory > & rSMgr) throw( Exception );
+
+#endif // PDFDIALOG_HXX
diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx
new file mode 100644
index 000000000000..8115f36d76f8
--- /dev/null
+++ b/filter/source/pdf/pdfexport.cxx
@@ -0,0 +1,1975 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include "pdfexport.hxx"
+#include "impdialog.hxx"
+
+#include "pdf.hrc"
+#include <tools/urlobj.hxx>
+#include <tools/fract.hxx>
+#include <tools/poly.hxx>
+#include <vcl/mapmod.hxx>
+#include <vcl/virdev.hxx>
+#include <vcl/metaact.hxx>
+#include <vcl/gdimtf.hxx>
+#include <vcl/jobset.hxx>
+#include <vcl/salbtype.hxx>
+#include <vcl/bmpacc.hxx>
+#include "vcl/svapp.hxx"
+#include <toolkit/awt/vclxdevice.hxx>
+#include <unotools/localfilehelper.hxx>
+#include <unotools/processfactory.hxx>
+#include <svtools/FilterConfigItem.hxx>
+#include <svtools/filter.hxx>
+#include <svl/solar.hrc>
+#include <comphelper/string.hxx>
+#include "basegfx/polygon/b2dpolygon.hxx"
+#include "basegfx/polygon/b2dpolypolygon.hxx"
+#include "basegfx/polygon/b2dpolygontools.hxx"
+
+#include <unotools/saveopt.hxx> // only for testing of relative saving options in PDF
+
+#include <vcl/graphictools.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/awt/Rectangle.hpp>
+#include <com/sun/star/awt/XDevice.hpp>
+#include <com/sun/star/util/MeasureUnit.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/frame/XModuleManager.hpp>
+#include <com/sun/star/frame/XStorable.hpp>
+#include <com/sun/star/frame/XController.hpp>
+#include <com/sun/star/document/XDocumentProperties.hpp>
+#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/view/XViewSettingsSupplier.hpp>
+#include <unotools/configmgr.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/drawing/XShapes.hpp>
+
+using namespace ::rtl;
+using namespace ::vcl;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::view;
+
+// -------------
+// - PDFExport -
+// -------------
+
+PDFExport::PDFExport( const Reference< XComponent >& rxSrcDoc, Reference< task::XStatusIndicator >& rxStatusIndicator, const Reference< lang::XMultiServiceFactory >& xFactory ) :
+ mxSrcDoc ( rxSrcDoc ),
+ mxMSF ( xFactory ),
+ mxStatusIndicator ( rxStatusIndicator ),
+ mbUseTaggedPDF ( sal_False ),
+ mnPDFTypeSelection ( 0 ),
+ mbExportNotes ( sal_True ),
+ mbExportNotesPages ( sal_False ),
+ mbEmbedStandardFonts ( sal_False ),//in preparation for i54636 and i76458.
+ //already used for i59651 (PDF/A-1)
+ mbUseTransitionEffects ( sal_True ),
+ mbExportBookmarks ( sal_True ),
+ mnOpenBookmarkLevels ( -1 ),
+ mbUseLosslessCompression ( sal_False ),
+ mbReduceImageResolution ( sal_False ),
+ mbSkipEmptyPages ( sal_True ),
+ mbAddStream ( sal_False ),
+ mnMaxImageResolution ( 300 ),
+ mnQuality ( 90 ),
+ mnFormsFormat ( 0 ),
+ mbExportFormFields ( sal_True ),
+ mbAllowDuplicateFieldNames ( sal_False ),
+ mnProgressValue ( 0 ),
+ mbRemoveTransparencies ( sal_False ),
+ mbWatermark ( sal_False ),
+
+ mbHideViewerToolbar ( sal_False ),
+ mbHideViewerMenubar ( sal_False ),
+ mbHideViewerWindowControls ( sal_False ),
+ mbFitWindow ( sal_False ),
+ mbCenterWindow ( sal_False ),
+ mbOpenInFullScreenMode ( sal_False ),
+ mbDisplayPDFDocumentTitle ( sal_True ),
+ mnPDFDocumentMode ( 0 ),
+ mnPDFDocumentAction ( 0 ),
+ mnZoom ( 100 ),
+ mnInitialPage ( 1 ),
+ mnPDFPageLayout ( 0 ),
+ mbFirstPageLeft ( sal_False ),
+
+ mbEncrypt ( sal_False ),
+ msOpenPassword (),
+ mbRestrictPermissions ( sal_False ),
+ msPermissionPassword (),
+ mnPrintAllowed ( 2 ),
+ mnChangesAllowed ( 4 ),
+ mbCanCopyOrExtract ( sal_True ),
+ mbCanExtractForAccessibility( sal_True ),
+
+ mnCachePatternId ( -1 ),
+
+//--->i56629
+ mbExportRelativeFsysLinks ( sal_False ),
+ mnDefaultLinkAction ( 0 ),
+ mbConvertOOoTargetToPDFTarget( sal_False ),
+ mbExportBmkToDest ( sal_False )
+//<---
+{
+}
+
+// -----------------------------------------------------------------------------
+
+PDFExport::~PDFExport()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool PDFExport::ExportSelection( vcl::PDFWriter& rPDFWriter, Reference< com::sun::star::view::XRenderable >& rRenderable, Any& rSelection,
+ MultiSelection aMultiSelection, Sequence< PropertyValue >& rRenderOptions, sal_Int32 nPageCount )
+{
+ sal_Bool bRet = sal_False;
+ try
+ {
+ Any* pFirstPage = NULL;
+ Any* pLastPage = NULL;
+
+ for( sal_Int32 nData = 0, nDataCount = rRenderOptions.getLength(); nData < nDataCount; ++nData )
+ {
+ if( rRenderOptions[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "IsFirstPage" ) ) )
+ pFirstPage = &rRenderOptions[ nData ].Value;
+ else if( rRenderOptions[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "IsLastPage" ) ) )
+ pLastPage = &rRenderOptions[ nData ].Value;
+ }
+
+ OutputDevice* pOut = rPDFWriter.GetReferenceDevice();
+
+ if( pOut )
+ {
+ vcl::PDFExtOutDevData* pPDFExtOutDevData = PTR_CAST( vcl::PDFExtOutDevData, pOut->GetExtOutDevData() );
+ if ( nPageCount )
+ {
+ sal_Int32 nSel = aMultiSelection.FirstSelected();
+ while ( nSel != sal_Int32(SFX_ENDOFSELECTION) )
+ {
+ Sequence< PropertyValue > aRenderer( rRenderable->getRenderer( nSel - 1, rSelection, rRenderOptions ) );
+ awt::Size aPageSize;
+
+ for( sal_Int32 nProperty = 0, nPropertyCount = aRenderer.getLength(); nProperty < nPropertyCount; ++nProperty )
+ {
+ if( aRenderer[ nProperty ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "PageSize" ) ) )
+ aRenderer[ nProperty].Value >>= aPageSize;
+ }
+
+ pPDFExtOutDevData->SetCurrentPageNumber( nSel - 1 );
+
+ GDIMetaFile aMtf;
+ const MapMode aMapMode( MAP_100TH_MM );
+ const Size aMtfSize( aPageSize.Width, aPageSize.Height );
+
+ pOut->Push();
+ pOut->EnableOutput( FALSE );
+ pOut->SetMapMode( aMapMode );
+
+ aMtf.SetPrefSize( aMtfSize );
+ aMtf.SetPrefMapMode( aMapMode );
+ aMtf.Record( pOut );
+
+ // --> FME 2004-10-08 #i35176#
+ // IsLastPage property.
+ const sal_Int32 nCurrentRenderer = nSel - 1;
+ nSel = aMultiSelection.NextSelected();
+ if ( pLastPage && sal_Int32(SFX_ENDOFSELECTION) == nSel )
+ *pLastPage <<= sal_True;
+ // <--
+
+ rRenderable->render( nCurrentRenderer, rSelection, rRenderOptions );
+
+ aMtf.Stop();
+ aMtf.WindStart();
+
+ if( aMtf.GetActionCount() &&
+ ( !mbSkipEmptyPages || aPageSize.Width || aPageSize.Height ) )
+ bRet = ImplExportPage( rPDFWriter, *pPDFExtOutDevData, aMtf ) || bRet;
+
+ pOut->Pop();
+
+ if ( mxStatusIndicator.is() )
+ mxStatusIndicator->setValue( mnProgressValue );
+ if ( pFirstPage )
+ *pFirstPage <<= sal_False;
+
+ ++mnProgressValue;
+ }
+ }
+ else
+ {
+ bRet = sal_True; // #i18334# SJ: nPageCount == 0,
+ rPDFWriter.NewPage( 10000, 10000 ); // creating dummy page
+ rPDFWriter.SetMapMode( MAP_100TH_MM ); //
+ }
+ }
+ }
+ catch( RuntimeException )
+ {
+ }
+ return bRet;
+}
+
+class PDFExportStreamDoc : public vcl::PDFOutputStream
+{
+ Reference< XComponent > m_xSrcDoc;
+ rtl::OUString m_aPassWd;
+ public:
+ PDFExportStreamDoc( const Reference< XComponent >& xDoc, const rtl::OUString& rPwd )
+ : m_xSrcDoc( xDoc ),
+ m_aPassWd( rPwd )
+ {}
+ virtual ~PDFExportStreamDoc();
+
+ virtual void write( const Reference< XOutputStream >& xStream );
+};
+
+PDFExportStreamDoc::~PDFExportStreamDoc()
+{
+}
+
+void PDFExportStreamDoc::write( const Reference< XOutputStream >& xStream )
+{
+ Reference< com::sun::star::frame::XStorable > xStore( m_xSrcDoc, UNO_QUERY );
+ if( xStore.is() )
+ {
+ Sequence< beans::PropertyValue > aArgs( m_aPassWd.getLength() ? 3 : 2 );
+ aArgs.getArray()[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "FilterName" ) );
+ aArgs.getArray()[1].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "OutputStream" ) );
+ aArgs.getArray()[1].Value <<= xStream;
+ if( m_aPassWd.getLength() )
+ {
+ aArgs.getArray()[2].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Password" ) );
+ aArgs.getArray()[2].Value <<= m_aPassWd;
+ }
+ try
+ {
+ xStore->storeToURL( OUString( RTL_CONSTASCII_USTRINGPARAM( "private:stream" ) ),
+ aArgs );
+ }
+ catch( IOException& )
+ {
+ }
+ }
+}
+
+static OUString getMimetypeForDocument( const Reference< XMultiServiceFactory >& xFactory,
+ const Reference< XComponent >& xDoc ) throw()
+{
+ OUString aDocMimetype;
+ // get document service name
+ Reference< com::sun::star::frame::XStorable > xStore( xDoc, UNO_QUERY );
+ Reference< frame::XModuleManager > xModuleManager(
+ xFactory->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ModuleManager" ) ) ),
+ uno::UNO_QUERY );
+ if( xModuleManager.is() && xStore.is() )
+ {
+ OUString aDocServiceName = xModuleManager->identify( Reference< XInterface >( xStore, uno::UNO_QUERY ) );
+ if ( aDocServiceName.getLength() )
+ {
+ // get the actual filter name
+ OUString aFilterName;
+ Reference< lang::XMultiServiceFactory > xConfigProvider(
+ xFactory->createInstance(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationProvider" ) ) ),
+ uno::UNO_QUERY );
+ if( xConfigProvider.is() )
+ {
+ uno::Sequence< uno::Any > aArgs( 1 );
+ beans::PropertyValue aPathProp;
+ aPathProp.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ) );
+ aPathProp.Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Setup/Office/Factories/" ) );
+ aArgs[0] <<= aPathProp;
+
+ Reference< container::XNameAccess > xSOFConfig(
+ xConfigProvider->createInstanceWithArguments(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationAccess" ) ),
+ aArgs ),
+ uno::UNO_QUERY );
+
+ Reference< container::XNameAccess > xApplConfig;
+ xSOFConfig->getByName( aDocServiceName ) >>= xApplConfig;
+ if ( xApplConfig.is() )
+ {
+ xApplConfig->getByName( OUString( RTL_CONSTASCII_USTRINGPARAM( "ooSetupFactoryActualFilter" ) ) ) >>= aFilterName;
+ if( aFilterName.getLength() )
+ {
+ // find the related type name
+ OUString aTypeName;
+ Reference< container::XNameAccess > xFilterFactory(
+ xFactory->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.document.FilterFactory" ) ),
+ uno::UNO_QUERY );
+
+ Sequence< beans::PropertyValue > aFilterData;
+ xFilterFactory->getByName( aFilterName ) >>= aFilterData;
+ for ( sal_Int32 nInd = 0; nInd < aFilterData.getLength(); nInd++ )
+ if ( aFilterData[nInd].Name.equalsAscii( "Type" ) )
+ aFilterData[nInd].Value >>= aTypeName;
+
+ if ( aTypeName.getLength() )
+ {
+ // find the mediatype
+ Reference< container::XNameAccess > xTypeDetection(
+ xFactory->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.document.TypeDetection" ) ),
+ UNO_QUERY );
+
+ Sequence< beans::PropertyValue > aTypeData;
+ xTypeDetection->getByName( aTypeName ) >>= aTypeData;
+ for ( sal_Int32 nInd = 0; nInd < aTypeData.getLength(); nInd++ )
+ if ( aTypeData[nInd].Name.equalsAscii( "MediaType" ) )
+ aTypeData[nInd].Value >>= aDocMimetype;
+ }
+ }
+ }
+ }
+ }
+ }
+ return aDocMimetype;
+}
+
+sal_Bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >& rFilterData )
+{
+ INetURLObject aURL( rFile );
+ OUString aFile;
+ sal_Bool bRet = sal_False;
+
+ std::set< PDFWriter::ErrorCode > aErrors;
+
+ if( aURL.GetProtocol() != INET_PROT_FILE )
+ {
+ String aTmp;
+
+ if( ::utl::LocalFileHelper::ConvertPhysicalNameToURL( rFile, aTmp ) )
+ aURL = INetURLObject(aTmp);
+ }
+
+ if( aURL.GetProtocol() == INET_PROT_FILE )
+ {
+ Reference< XRenderable > xRenderable( mxSrcDoc, UNO_QUERY );
+
+ if( xRenderable.is() )
+ {
+ VCLXDevice* pXDevice = new VCLXDevice;
+ OUString aPageRange;
+ Any aSelection;
+
+ // getting the string for the creator
+ String aCreator;
+ Reference< XServiceInfo > xInfo( mxSrcDoc, UNO_QUERY );
+ if ( xInfo.is() )
+ {
+ if ( xInfo->supportsService( rtl::OUString::createFromAscii( "com.sun.star.presentation.PresentationDocument" ) ) )
+ aCreator.AppendAscii( "Impress" );
+ else if ( xInfo->supportsService( rtl::OUString::createFromAscii( "com.sun.star.drawing.DrawingDocument" ) ) )
+ aCreator.AppendAscii( "Draw" );
+ else if ( xInfo->supportsService( rtl::OUString::createFromAscii( "com.sun.star.text.TextDocument" ) ) )
+ aCreator.AppendAscii( "Writer" );
+ else if ( xInfo->supportsService( rtl::OUString::createFromAscii( "com.sun.star.sheet.SpreadsheetDocument" ) ) )
+ aCreator.AppendAscii( "Calc" );
+ else if ( xInfo->supportsService( rtl::OUString::createFromAscii( "com.sun.star.formula.FormulaProperties" ) ) )
+ aCreator.AppendAscii( "Math" );
+ }
+
+ PDFWriter::PDFWriterContext aContext;
+
+ for( sal_Int32 nData = 0, nDataCount = rFilterData.getLength(); nData < nDataCount; ++nData )
+ {
+ if( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "PageRange" ) ) )
+ rFilterData[ nData ].Value >>= aPageRange;
+ else if( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "Selection" ) ) )
+ rFilterData[ nData ].Value >>= aSelection;
+ else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "UseLosslessCompression" ) ) )
+ rFilterData[ nData ].Value >>= mbUseLosslessCompression;
+ else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "Quality" ) ) )
+ rFilterData[ nData ].Value >>= mnQuality;
+ else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "ReduceImageResolution" ) ) )
+ rFilterData[ nData ].Value >>= mbReduceImageResolution;
+ else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "IsSkipEmptyPages" ) ) )
+ rFilterData[ nData ].Value >>= mbSkipEmptyPages;
+ else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "MaxImageResolution" ) ) )
+ rFilterData[ nData ].Value >>= mnMaxImageResolution;
+ else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "UseTaggedPDF" ) ) )
+ rFilterData[ nData ].Value >>= mbUseTaggedPDF;
+ else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "SelectPdfVersion" ) ) )
+ rFilterData[ nData ].Value >>= mnPDFTypeSelection;
+ else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportNotes" ) ) )
+ rFilterData[ nData ].Value >>= mbExportNotes;
+ else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportNotesPages" ) ) )
+ rFilterData[ nData ].Value >>= mbExportNotesPages;
+ else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "EmbedStandardFonts" ) ) )
+ rFilterData[ nData ].Value >>= mbEmbedStandardFonts;
+ else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "UseTransitionEffects" ) ) )
+ rFilterData[ nData ].Value >>= mbUseTransitionEffects;
+ else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportFormFields" ) ) )
+ rFilterData[ nData ].Value >>= mbExportFormFields;
+ else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "FormsType" ) ) )
+ rFilterData[ nData ].Value >>= mnFormsFormat;
+ else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "AllowDuplicateFieldNames" ) ) )
+ rFilterData[ nData ].Value >>= mbAllowDuplicateFieldNames;
+//viewer properties
+ else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "HideViewerToolbar" ) ) )
+ rFilterData[ nData ].Value >>= mbHideViewerToolbar;
+ else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "HideViewerMenubar" ) ) )
+ rFilterData[ nData ].Value >>= mbHideViewerMenubar;
+ else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "HideViewerWindowControls" ) ) )
+ rFilterData[ nData ].Value >>= mbHideViewerWindowControls;
+ else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "ResizeWindowToInitialPage" ) ) )
+ rFilterData[ nData ].Value >>= mbFitWindow;
+ else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "CenterWindow" ) ) )
+ rFilterData[ nData ].Value >>= mbCenterWindow;
+ else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "OpenInFullScreenMode" ) ) )
+ rFilterData[ nData ].Value >>= mbOpenInFullScreenMode;
+ else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "DisplayPDFDocumentTitle" ) ) )
+ rFilterData[ nData ].Value >>= mbDisplayPDFDocumentTitle;
+ else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "InitialView" ) ) )
+ rFilterData[ nData ].Value >>= mnPDFDocumentMode;
+ else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "Magnification" ) ) )
+ rFilterData[ nData ].Value >>= mnPDFDocumentAction;
+ else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "Zoom" ) ) )
+ rFilterData[ nData ].Value >>= mnZoom;
+ else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "InitialPage" ) ) )
+ rFilterData[ nData ].Value >>= mnInitialPage;
+ else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "PageLayout" ) ) )
+ rFilterData[ nData ].Value >>= mnPDFPageLayout;
+ else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "FirstPageOnLeft" ) ) )
+ rFilterData[ nData ].Value >>= aContext.FirstPageLeft;
+ else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "IsAddStream" ) ) )
+ rFilterData[ nData ].Value >>= mbAddStream;
+ else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "Watermark" ) ) )
+ {
+ maWatermark = rFilterData[ nData ].Value;
+ mbWatermark = sal_True;
+ }
+//now all the security related properties...
+ else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "EncryptFile" ) ) )
+ rFilterData[ nData ].Value >>= mbEncrypt;
+ else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "DocumentOpenPassword" ) ) )
+ rFilterData[ nData ].Value >>= msOpenPassword;
+ else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "RestrictPermissions" ) ) )
+ rFilterData[ nData ].Value >>= mbRestrictPermissions;
+ else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "PermissionPassword" ) ) )
+ rFilterData[ nData ].Value >>= msPermissionPassword;
+ else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "Printing" ) ) )
+ rFilterData[ nData ].Value >>= mnPrintAllowed;
+ else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "Changes" ) ) )
+ rFilterData[ nData ].Value >>= mnChangesAllowed;
+ else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "EnableCopyingOfContent" ) ) )
+ rFilterData[ nData ].Value >>= mbCanCopyOrExtract;
+ else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "EnableTextAccessForAccessibilityTools" ) ) )
+ rFilterData[ nData ].Value >>= mbCanExtractForAccessibility;
+//--->i56629 links extra (relative links and other related stuff)
+ else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportLinksRelativeFsys" ) ) )
+ rFilterData[ nData ].Value >>= mbExportRelativeFsysLinks;
+ else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "PDFViewSelection" ) ) )
+ rFilterData[ nData ].Value >>= mnDefaultLinkAction;
+ else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "ConvertOOoTargetToPDFTarget" ) ) )
+ rFilterData[ nData ].Value >>= mbConvertOOoTargetToPDFTarget;
+ else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportBookmarksToPDFDestination" ) ) )
+ rFilterData[ nData ].Value >>= mbExportBmkToDest;
+//<---
+ else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportBookmarks" ) ) )
+ rFilterData[ nData ].Value >>= mbExportBookmarks;
+ else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "OpenBookmarkLevels" ) ) )
+ rFilterData[ nData ].Value >>= mnOpenBookmarkLevels;
+ }
+ aContext.URL = aURL.GetMainURL(INetURLObject::DECODE_TO_IURI);
+
+//set the correct version, depending on user request
+ switch( mnPDFTypeSelection )
+ {
+ default:
+ case 0:
+ aContext.Version = PDFWriter::PDF_1_4;
+ break;
+ case 1:
+ aContext.Version = PDFWriter::PDF_A_1;
+//force the tagged PDF as well
+ mbUseTaggedPDF = sal_True;
+//force embedding of standard fonts
+ mbEmbedStandardFonts = sal_True;
+//force disabling of form conversion
+ mbExportFormFields = sal_False;
+// PDF/A does not allow transparencies
+ mbRemoveTransparencies = sal_True;
+ break;
+ }
+
+//copy in context the values default in the contructor or set by the FilterData sequence of properties
+ aContext.Tagged = mbUseTaggedPDF;
+
+//values used in viewer
+ aContext.HideViewerToolbar = mbHideViewerToolbar;
+ aContext.HideViewerMenubar = mbHideViewerMenubar;
+ aContext.HideViewerWindowControls = mbHideViewerWindowControls;
+ aContext.FitWindow = mbFitWindow;
+ aContext.CenterWindow = mbCenterWindow;
+ aContext.OpenInFullScreenMode = mbOpenInFullScreenMode;
+ aContext.DisplayPDFDocumentTitle = mbDisplayPDFDocumentTitle;
+ aContext.InitialPage = mnInitialPage-1;
+ aContext.OpenBookmarkLevels = mnOpenBookmarkLevels;
+ aContext.EmbedStandardFonts = mbEmbedStandardFonts;
+
+ switch( mnPDFDocumentMode )
+ {
+ default:
+ case 0:
+ aContext.PDFDocumentMode = PDFWriter::ModeDefault;
+ break;
+ case 1:
+ aContext.PDFDocumentMode = PDFWriter::UseOutlines;
+ break;
+ case 2:
+ aContext.PDFDocumentMode = PDFWriter::UseThumbs;
+ break;
+ }
+ switch( mnPDFDocumentAction )
+ {
+ default:
+ case 0:
+ aContext.PDFDocumentAction = PDFWriter::ActionDefault;
+ break;
+ case 1:
+ aContext.PDFDocumentAction = PDFWriter::FitInWindow;
+ break;
+ case 2:
+ aContext.PDFDocumentAction = PDFWriter::FitWidth;
+ break;
+ case 3:
+ aContext.PDFDocumentAction = PDFWriter::FitVisible;
+ break;
+ case 4:
+ aContext.PDFDocumentAction = PDFWriter::ActionZoom;
+ aContext.Zoom = mnZoom;
+ break;
+ }
+
+ switch( mnPDFPageLayout )
+ {
+ default:
+ case 0:
+ aContext.PageLayout = PDFWriter::DefaultLayout;
+ break;
+ case 1:
+ aContext.PageLayout = PDFWriter::SinglePage;
+ break;
+ case 2:
+ aContext.PageLayout = PDFWriter::Continuous;
+ break;
+ case 3:
+ aContext.PageLayout = PDFWriter::ContinuousFacing;
+ break;
+ }
+
+ aContext.FirstPageLeft = mbFirstPageLeft;
+
+//check if PDF/A, which does not allow encryption
+ if( aContext.Version != PDFWriter::PDF_A_1 )
+ {
+//set values needed in encryption
+ aContext.Encrypt = mbEncrypt;
+//set encryption level, fixed, but here it can set by the UI if needed.
+// true is 128 bit, false 40
+//note that in 40 bit mode the UI needs reworking, since the current UI is meaningfull only for
+//128bit security mode
+ aContext.Security128bit = sal_True;
+
+//set the open password
+ if( aContext.Encrypt && msOpenPassword.getLength() > 0 )
+ aContext.UserPassword = msOpenPassword;
+
+//set check for permission change password
+// if not enabled and no permission password, force permissions to default as if PDF where without encryption
+ if( mbRestrictPermissions && msPermissionPassword.getLength() > 0 )
+ {
+ aContext.OwnerPassword = msPermissionPassword;
+ aContext.Encrypt = sal_True;
+//permission set as desired, done after
+ }
+ else
+ {
+//force permission to default
+ mnPrintAllowed = 2 ;
+ mnChangesAllowed = 4 ;
+ mbCanCopyOrExtract = sal_True;
+ mbCanExtractForAccessibility = sal_True ;
+ }
+
+ switch( mnPrintAllowed )
+ {
+ case 0: //initialized when aContext is build, means no printing
+ break;
+ default:
+ case 2:
+ aContext.AccessPermissions.CanPrintFull = sal_True;
+ case 1:
+ aContext.AccessPermissions.CanPrintTheDocument = sal_True;
+ break;
+ }
+
+ switch( mnChangesAllowed )
+ {
+ case 0: //already in struct PDFSecPermissions CTOR
+ break;
+ case 1:
+ aContext.AccessPermissions.CanAssemble = sal_True;
+ break;
+ case 2:
+ aContext.AccessPermissions.CanFillInteractive = sal_True;
+ break;
+ case 3:
+ aContext.AccessPermissions.CanAddOrModify = sal_True;
+ break;
+ default:
+ case 4:
+ aContext.AccessPermissions.CanModifyTheContent =
+ aContext.AccessPermissions.CanCopyOrExtract =
+ aContext.AccessPermissions.CanAddOrModify =
+ aContext.AccessPermissions.CanFillInteractive = sal_True;
+ break;
+ }
+
+ aContext.AccessPermissions.CanCopyOrExtract = mbCanCopyOrExtract;
+ aContext.AccessPermissions.CanExtractForAccessibility = mbCanExtractForAccessibility;
+ }
+ /*
+ * FIXME: the entries are only implicitly defined by the resource file. Should there
+ * ever be an additional form submit format this could get invalid.
+ */
+ switch( mnFormsFormat )
+ {
+ case 1:
+ aContext.SubmitFormat = PDFWriter::PDF;
+ break;
+ case 2:
+ aContext.SubmitFormat = PDFWriter::HTML;
+ break;
+ case 3:
+ aContext.SubmitFormat = PDFWriter::XML;
+ break;
+ default:
+ case 0:
+ aContext.SubmitFormat = PDFWriter::FDF;
+ break;
+ }
+ aContext.AllowDuplicateFieldNames = mbAllowDuplicateFieldNames;
+
+ //get model
+ Reference< frame::XModel > xModel( mxSrcDoc, UNO_QUERY );
+ {
+//---> i56629 Relative link stuff
+//set the base URL of the file:
+//then base URL
+ aContext.BaseURL = xModel->getURL();
+//relative link option is private to PDF Export filter and limited to local filesystem only
+ aContext.RelFsys = mbExportRelativeFsysLinks;
+//determine the default acton for PDF links
+ switch( mnDefaultLinkAction )
+ {
+ default:
+//default: URI, without fragment conversion (the bookmark in PDF may not work)
+ case 0:
+ aContext.DefaultLinkAction = PDFWriter::URIAction;
+ break;
+//view PDF through the reader application
+ case 1:
+ aContext.ForcePDFAction = sal_True;
+ aContext.DefaultLinkAction = PDFWriter::LaunchAction;
+ break;
+//view PDF through an Internet browser
+ case 2:
+ aContext.DefaultLinkAction = PDFWriter::URIActionDestination;
+ break;
+ }
+ aContext.ConvertOOoTargetToPDFTarget = mbConvertOOoTargetToPDFTarget;
+// check for Link Launch action, not allowed on PDF/A-1
+// this code chunk checks when the filter is called from scripting
+ if( aContext.Version == PDFWriter::PDF_A_1 &&
+ aContext.DefaultLinkAction == PDFWriter::LaunchAction )
+ { //force the similar allowed URI action
+ aContext.DefaultLinkAction = PDFWriter::URIActionDestination;
+ //and remove the remote goto action forced on PDF file
+ aContext.ForcePDFAction = sal_False;
+ }
+//<---
+ }
+// all context data set, time to create the printing device
+ PDFWriter* pPDFWriter = new PDFWriter( aContext );
+ OutputDevice* pOut = pPDFWriter->GetReferenceDevice();
+ vcl::PDFExtOutDevData* pPDFExtOutDevData = NULL;
+
+ DBG_ASSERT( pOut, "PDFExport::Export: no reference device" );
+ pXDevice->SetOutputDevice( pOut );
+
+ if( mbAddStream )
+ {
+ // export stream
+ // get mimetype
+ OUString aSrcMimetype = getMimetypeForDocument( mxMSF, mxSrcDoc );
+ pPDFWriter->AddStream( aSrcMimetype,
+ new PDFExportStreamDoc( mxSrcDoc, msPermissionPassword ),
+ false
+ );
+ }
+ PDFDocInfo aDocInfo;
+ Reference< document::XDocumentPropertiesSupplier > xDocumentPropsSupplier( mxSrcDoc, UNO_QUERY );
+ if ( xDocumentPropsSupplier.is() )
+ {
+ Reference< document::XDocumentProperties > xDocumentProps( xDocumentPropsSupplier->getDocumentProperties() );
+ if ( xDocumentProps.is() )
+ {
+ aDocInfo.Title = xDocumentProps->getTitle();
+ aDocInfo.Author = xDocumentProps->getAuthor();
+ aDocInfo.Subject = xDocumentProps->getSubject();
+ aDocInfo.Keywords = ::comphelper::string::convertCommaSeparated(xDocumentProps->getKeywords());
+ }
+ }
+ // getting the string for the producer
+ String aProducer;
+ ::utl::ConfigManager* pMgr = ::utl::ConfigManager::GetConfigManager();
+ if ( pMgr )
+ {
+ Any aProductName = pMgr->GetDirectConfigProperty( ::utl::ConfigManager::PRODUCTNAME );
+ ::rtl::OUString sProductName;
+ aProductName >>= sProductName;
+ aProducer = sProductName;
+ aProductName = pMgr->GetDirectConfigProperty( ::utl::ConfigManager::PRODUCTVERSION );
+ aProductName >>= sProductName;
+ aProducer.AppendAscii(" ");
+ aProducer += String( sProductName );
+ }
+ aDocInfo.Producer = aProducer;
+ aDocInfo.Creator = aCreator;
+
+ pPDFWriter->SetDocInfo( aDocInfo );
+
+ if ( pOut )
+ {
+ DBG_ASSERT( pOut->GetExtOutDevData() == NULL, "PDFExport: ExtOutDevData already set!!!" );
+ pPDFExtOutDevData = new vcl::PDFExtOutDevData( *pOut );
+ pOut->SetExtOutDevData( pPDFExtOutDevData );
+ pPDFExtOutDevData->SetIsExportNotes( mbExportNotes );
+ pPDFExtOutDevData->SetIsExportTaggedPDF( mbUseTaggedPDF );
+ pPDFExtOutDevData->SetIsExportTransitionEffects( mbUseTransitionEffects );
+ pPDFExtOutDevData->SetFormsFormat( mnFormsFormat );
+ pPDFExtOutDevData->SetIsExportFormFields( mbExportFormFields );
+ pPDFExtOutDevData->SetIsExportBookmarks( mbExportBookmarks );
+ pPDFExtOutDevData->SetIsLosslessCompression( mbUseLosslessCompression );
+ pPDFExtOutDevData->SetIsReduceImageResolution( mbReduceImageResolution );
+ pPDFExtOutDevData->SetIsExportNamedDestinations( mbExportBmkToDest );
+
+ Sequence< PropertyValue > aRenderOptions( 6 );
+ aRenderOptions[ 0 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "RenderDevice" ) );
+ aRenderOptions[ 0 ].Value <<= Reference< awt::XDevice >( pXDevice );
+ aRenderOptions[ 1 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportNotesPages" ) );
+ aRenderOptions[ 1 ].Value <<= sal_False;
+ Any& rExportNotesValue = aRenderOptions[ 1 ].Value;
+ aRenderOptions[ 2 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "IsFirstPage" ) );
+ aRenderOptions[ 2 ].Value <<= sal_True;
+ aRenderOptions[ 3 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "IsLastPage" ) );
+ aRenderOptions[ 3 ].Value <<= sal_False;
+ aRenderOptions[ 4 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PageRange" ) );
+ aRenderOptions[ 4 ].Value <<= aPageRange;
+ aRenderOptions[ 5 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "IsSkipEmptyPages" ) );
+ aRenderOptions[ 5 ].Value <<= mbSkipEmptyPages;
+
+ if( aPageRange.getLength() || !aSelection.hasValue() )
+ {
+ aSelection = Any();
+ aSelection <<= mxSrcDoc;
+ }
+ sal_Bool bSecondPassForImpressNotes = sal_False;
+ bool bReChangeToNormalView = false;
+ ::rtl::OUString sShowOnlineLayout( RTL_CONSTASCII_USTRINGPARAM( "ShowOnlineLayout"));
+ uno::Reference< beans::XPropertySet > xViewProperties;
+
+ if ( aCreator.EqualsAscii( "Writer" ) )
+ {
+ //i92835 if Writer is in web layout mode this has to be switched to normal view and back to web view in the end
+ try
+ {
+ Reference< view::XViewSettingsSupplier > xVSettingsSupplier( xModel->getCurrentController(), uno::UNO_QUERY_THROW );
+ xViewProperties = xVSettingsSupplier->getViewSettings();
+ xViewProperties->getPropertyValue( sShowOnlineLayout ) >>= bReChangeToNormalView;
+ if( bReChangeToNormalView )
+ {
+ xViewProperties->setPropertyValue( sShowOnlineLayout, uno::makeAny( false ) );
+ }
+ }
+ catch( const uno::Exception& )
+ {
+ }
+
+ }
+
+ const sal_Int32 nPageCount = xRenderable->getRendererCount( aSelection, aRenderOptions );
+ const Range aRange( 1, nPageCount );
+ MultiSelection aMultiSelection;
+
+ if ( mbExportNotesPages && aCreator.EqualsAscii( "Impress" ) )
+ {
+ uno::Reference< drawing::XShapes > xShapes; // sj: do not allow to export notes when
+ if ( ! ( aSelection >>= xShapes ) ) // exporting a selection -> todo: in the dialog
+ bSecondPassForImpressNotes = sal_True; // the export notes checkbox needs to be disabled
+ }
+
+ if( !aPageRange.getLength() )
+ {
+ aMultiSelection.SetTotalRange( aRange );
+ aMultiSelection.Select( aRange );
+ }
+ else
+ {
+ aMultiSelection = MultiSelection( aPageRange );
+ aMultiSelection.SetTotalRange( aRange );
+ }
+ if ( mxStatusIndicator.is() )
+ {
+ ByteString aResMgrName( "pdffilter" );
+ ResMgr* pResMgr = ResMgr::CreateResMgr( aResMgrName.GetBuffer(), Application::GetSettings().GetUILocale() );
+ if ( pResMgr )
+ {
+ sal_Int32 nTotalPageCount = aMultiSelection.GetSelectCount();
+ if ( bSecondPassForImpressNotes )
+ nTotalPageCount *= 2;
+ mxStatusIndicator->start( String( ResId( PDF_PROGRESS_BAR, *pResMgr ) ), nTotalPageCount );
+ delete pResMgr;
+ }
+ }
+
+ if( nPageCount > 0 )
+ bRet = ExportSelection( *pPDFWriter, xRenderable, aSelection, aMultiSelection, aRenderOptions, nPageCount );
+ else
+ bRet = FALSE;
+
+ if ( bRet && bSecondPassForImpressNotes )
+ {
+ rExportNotesValue <<= sal_True;
+ bRet = ExportSelection( *pPDFWriter, xRenderable, aSelection, aMultiSelection, aRenderOptions, nPageCount );
+ }
+ if ( mxStatusIndicator.is() )
+ mxStatusIndicator->end();
+
+ // if during the export the doc locale was set copy it to PDF writer
+ const com::sun::star::lang::Locale& rLoc( pPDFExtOutDevData->GetDocumentLocale() );
+ if( rLoc.Language.getLength() )
+ pPDFWriter->SetDocumentLocale( rLoc );
+
+ if( bRet )
+ {
+ pPDFExtOutDevData->PlayGlobalActions( *pPDFWriter );
+ pPDFWriter->Emit();
+ aErrors = pPDFWriter->GetErrors();
+ }
+ pOut->SetExtOutDevData( NULL );
+ if( bReChangeToNormalView )
+ {
+ try
+ {
+ xViewProperties->setPropertyValue( sShowOnlineLayout, uno::makeAny( true ) );
+ }
+ catch( const uno::Exception& )
+ {
+ }
+ }
+ }
+
+ delete pPDFExtOutDevData;
+ delete pPDFWriter;
+ }
+ }
+
+ // show eventual errors during export
+ showErrors( aErrors );
+
+ return bRet;
+}
+
+void PDFExport::showErrors( const std::set< PDFWriter::ErrorCode >& rErrors )
+{
+ if( ! rErrors.empty() )
+ {
+ ImplErrorDialog aDlg( rErrors );
+ aDlg.Execute();
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool PDFExport::ImplExportPage( PDFWriter& rWriter, PDFExtOutDevData& rPDFExtOutDevData, const GDIMetaFile& rMtf )
+{
+ VirtualDevice aDummyVDev;
+ const Size aSizePDF( OutputDevice::LogicToLogic( rMtf.GetPrefSize(), rMtf.GetPrefMapMode(), MAP_POINT ) );
+ Point aOrigin;
+ Rectangle aPageRect( aOrigin, rMtf.GetPrefSize() );
+ sal_Bool bRet = sal_False;
+
+ aDummyVDev.EnableOutput( sal_False );
+ aDummyVDev.SetMapMode( rMtf.GetPrefMapMode() );
+
+ rWriter.NewPage( aSizePDF.Width(), aSizePDF.Height() );
+ rWriter.SetMapMode( rMtf.GetPrefMapMode() );
+
+ basegfx::B2DRectangle aB2DRect( aPageRect.Left(), aPageRect.Top(), aPageRect.Right(), aPageRect.Bottom() );
+ rWriter.SetClipRegion( basegfx::B2DPolyPolygon( basegfx::tools::createPolygonFromRect( aB2DRect ) ) );
+ bRet = ImplWriteActions( rWriter, &rPDFExtOutDevData, rMtf, aDummyVDev );
+ rPDFExtOutDevData.ResetSyncData();
+
+ if( mbWatermark )
+ ImplWriteWatermark( rWriter, aSizePDF );
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+void PDFExport::ImplWriteWatermark( PDFWriter& rWriter, const Size& rPageSize )
+{
+ OUString aText( RTL_CONSTASCII_USTRINGPARAM( "Watermark" ) );
+ Font aFont( OUString( RTL_CONSTASCII_USTRINGPARAM( "Helvetica" ) ), Size( 0, 3*rPageSize.Height()/4 ) );
+ aFont.SetItalic( ITALIC_NONE );
+ aFont.SetWidthType( WIDTH_NORMAL );
+ aFont.SetWeight( WEIGHT_NORMAL );
+ aFont.SetAlign( ALIGN_BOTTOM );
+ long nTextWidth = rPageSize.Width();
+ if( rPageSize.Width() < rPageSize.Height() )
+ {
+ nTextWidth = rPageSize.Height();
+ aFont.SetOrientation( 2700 );
+ }
+
+ if( ! ( maWatermark >>= aText ) )
+ {
+ // more complicated watermark ?
+ }
+
+ // adjust font height for text to fit
+ OutputDevice* pDev = rWriter.GetReferenceDevice();
+ pDev->Push( PUSH_ALL );
+ pDev->SetFont( aFont );
+ pDev->SetMapMode( MapMode( MAP_POINT ) );
+ int w = 0;
+ while( ( w = pDev->GetTextWidth( aText ) ) > nTextWidth )
+ {
+ long nNewHeight = aFont.GetHeight() * nTextWidth / w;
+ if( nNewHeight == aFont.GetHeight() )
+ {
+ nNewHeight--;
+ if( nNewHeight <= 0 )
+ break;
+ }
+ aFont.SetHeight( nNewHeight );
+ pDev->SetFont( aFont );
+ }
+ long nTextHeight = pDev->GetTextHeight();
+ // leave some maneuvering room for rounding issues, also
+ // some fonts go a little outside ascent/descent
+ nTextHeight += nTextHeight/20;
+ pDev->Pop();
+
+ rWriter.Push( PUSH_ALL );
+ rWriter.SetMapMode( MapMode( MAP_POINT ) );
+ rWriter.SetFont( aFont );
+ rWriter.SetTextColor( COL_RED );
+ Point aTextPoint;
+ Rectangle aTextRect;
+ if( rPageSize.Width() > rPageSize.Height() )
+ {
+ aTextPoint = Point( (rPageSize.Width()-w)/2,
+ rPageSize.Height()-(rPageSize.Height()-nTextHeight)/2 );
+ aTextRect = Rectangle( Point( (rPageSize.Width()-w)/2,
+ (rPageSize.Height()-nTextHeight)/2 ),
+ Size( w, nTextHeight ) );
+ }
+ else
+ {
+ aTextPoint = Point( (rPageSize.Width()-nTextHeight)/2,
+ (rPageSize.Height()-w)/2 );
+ aTextRect = Rectangle( aTextPoint, Size( nTextHeight, w ) );
+ }
+ rWriter.SetClipRegion();
+ rWriter.BeginTransparencyGroup();
+ rWriter.DrawText( aTextPoint, aText );
+ rWriter.EndTransparencyGroup( aTextRect, 50 );
+ rWriter.Pop();
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool PDFExport::ImplWriteActions( PDFWriter& rWriter, PDFExtOutDevData* pPDFExtOutDevData,
+ const GDIMetaFile& rInMtf, VirtualDevice& rDummyVDev )
+{
+ bool bAssertionFired( false );
+
+ GDIMetaFile aMtf;
+ bool bTransparenciesRemoved = false;
+ if( mbRemoveTransparencies )
+ {
+ bTransparenciesRemoved = rWriter.GetReferenceDevice()->
+ RemoveTransparenciesFromMetaFile( rInMtf, aMtf, mnMaxImageResolution, mnMaxImageResolution,
+ false, true, mbReduceImageResolution );
+ }
+ else
+ {
+ aMtf = rInMtf;
+ }
+
+
+ for( sal_uInt32 i = 0, nCount = aMtf.GetActionCount(); i < nCount; )
+ {
+ if ( !pPDFExtOutDevData || !pPDFExtOutDevData->PlaySyncPageAct( rWriter, i ) )
+ {
+ const MetaAction* pAction = aMtf.GetAction( i );
+ const USHORT nType = pAction->GetType();
+
+ switch( nType )
+ {
+ case( META_PIXEL_ACTION ):
+ {
+ const MetaPixelAction* pA = (const MetaPixelAction*) pAction;
+ rWriter.DrawPixel( pA->GetPoint(), pA->GetColor() );
+ }
+ break;
+
+ case( META_POINT_ACTION ):
+ {
+ const MetaPointAction* pA = (const MetaPointAction*) pAction;
+ rWriter.DrawPixel( pA->GetPoint() );
+ }
+ break;
+
+ case( META_LINE_ACTION ):
+ {
+ const MetaLineAction* pA = (const MetaLineAction*) pAction;
+ if ( pA->GetLineInfo().IsDefault() )
+ rWriter.DrawLine( pA->GetStartPoint(), pA->GetEndPoint() );
+ else
+ rWriter.DrawLine( pA->GetStartPoint(), pA->GetEndPoint(), pA->GetLineInfo() );
+ }
+ break;
+
+ case( META_RECT_ACTION ):
+ {
+ const MetaRectAction* pA = (const MetaRectAction*) pAction;
+ rWriter.DrawRect( pA->GetRect() );
+ }
+ break;
+
+ case( META_ROUNDRECT_ACTION ):
+ {
+ const MetaRoundRectAction* pA = (const MetaRoundRectAction*) pAction;
+ rWriter.DrawRect( pA->GetRect(), pA->GetHorzRound(), pA->GetVertRound() );
+ }
+ break;
+
+ case( META_ELLIPSE_ACTION ):
+ {
+ const MetaEllipseAction* pA = (const MetaEllipseAction*) pAction;
+ rWriter.DrawEllipse( pA->GetRect() );
+ }
+ break;
+
+ case( META_ARC_ACTION ):
+ {
+ const MetaArcAction* pA = (const MetaArcAction*) pAction;
+ rWriter.DrawArc( pA->GetRect(), pA->GetStartPoint(), pA->GetEndPoint() );
+ }
+ break;
+
+ case( META_PIE_ACTION ):
+ {
+ const MetaArcAction* pA = (const MetaArcAction*) pAction;
+ rWriter.DrawPie( pA->GetRect(), pA->GetStartPoint(), pA->GetEndPoint() );
+ }
+ break;
+
+ case( META_CHORD_ACTION ):
+ {
+ const MetaChordAction* pA = (const MetaChordAction*) pAction;
+ rWriter.DrawChord( pA->GetRect(), pA->GetStartPoint(), pA->GetEndPoint() );
+ }
+ break;
+
+ case( META_POLYGON_ACTION ):
+ {
+ const MetaPolygonAction* pA = (const MetaPolygonAction*) pAction;
+ rWriter.DrawPolygon( pA->GetPolygon() );
+ }
+ break;
+
+ case( META_POLYLINE_ACTION ):
+ {
+ const MetaPolyLineAction* pA = (const MetaPolyLineAction*) pAction;
+ if ( pA->GetLineInfo().IsDefault() )
+ rWriter.DrawPolyLine( pA->GetPolygon() );
+ else
+ rWriter.DrawPolyLine( pA->GetPolygon(), pA->GetLineInfo() );
+ }
+ break;
+
+ case( META_POLYPOLYGON_ACTION ):
+ {
+ const MetaPolyPolygonAction* pA = (const MetaPolyPolygonAction*) pAction;
+ rWriter.DrawPolyPolygon( pA->GetPolyPolygon() );
+ }
+ break;
+
+ case( META_GRADIENT_ACTION ):
+ {
+ const MetaGradientAction* pA = (const MetaGradientAction*) pAction;
+ const PolyPolygon aPolyPoly( pA->GetRect() );
+
+ ImplWriteGradient( rWriter, aPolyPoly, pA->GetGradient(), rDummyVDev );
+ }
+ break;
+
+ case( META_GRADIENTEX_ACTION ):
+ {
+ const MetaGradientExAction* pA = (const MetaGradientExAction*) pAction;
+ ImplWriteGradient( rWriter, pA->GetPolyPolygon(), pA->GetGradient(), rDummyVDev );
+ }
+ break;
+
+ case META_HATCH_ACTION:
+ {
+ const MetaHatchAction* pA = (const MetaHatchAction*) pAction;
+ rWriter.DrawHatch( pA->GetPolyPolygon(), pA->GetHatch() );
+ }
+ break;
+
+ case( META_TRANSPARENT_ACTION ):
+ {
+ const MetaTransparentAction* pA = (const MetaTransparentAction*) pAction;
+ rWriter.DrawTransparent( pA->GetPolyPolygon(), pA->GetTransparence() );
+ }
+ break;
+
+ case( META_FLOATTRANSPARENT_ACTION ):
+ {
+ const MetaFloatTransparentAction* pA = (const MetaFloatTransparentAction*) pAction;
+
+ GDIMetaFile aTmpMtf( pA->GetGDIMetaFile() );
+ const Point& rPos = pA->GetPoint();
+ const Size& rSize= pA->GetSize();
+ const Gradient& rTransparenceGradient = pA->GetGradient();
+
+ // special case constant alpha value
+ if( rTransparenceGradient.GetStartColor() == rTransparenceGradient.GetEndColor() )
+ {
+ const Color aTransCol( rTransparenceGradient.GetStartColor() );
+ const USHORT nTransPercent = aTransCol.GetLuminance() * 100 / 255;
+ rWriter.BeginTransparencyGroup();
+ ImplWriteActions( rWriter, NULL, aTmpMtf, rDummyVDev );
+ rWriter.EndTransparencyGroup( Rectangle( rPos, rSize ), nTransPercent );
+ }
+ else
+ {
+ const Size aDstSizeTwip( rDummyVDev.PixelToLogic( rDummyVDev.LogicToPixel( rSize ), MAP_TWIP ) );
+ sal_Int32 nMaxBmpDPI = mbUseLosslessCompression ? 300 : 72;
+ if ( mbReduceImageResolution )
+ {
+ if ( nMaxBmpDPI > mnMaxImageResolution )
+ nMaxBmpDPI = mnMaxImageResolution;
+ }
+ const sal_Int32 nPixelX = (sal_Int32)((double)aDstSizeTwip.Width() * (double)nMaxBmpDPI / 1440.0);
+ const sal_Int32 nPixelY = (sal_Int32)((double)aDstSizeTwip.Height() * (double)nMaxBmpDPI / 1440.0);
+ if ( nPixelX && nPixelY )
+ {
+ Size aDstSizePixel( nPixelX, nPixelY );
+ VirtualDevice* pVDev = new VirtualDevice;
+ if( pVDev->SetOutputSizePixel( aDstSizePixel ) )
+ {
+ Bitmap aPaint, aMask;
+ AlphaMask aAlpha;
+ Point aPoint;
+
+ MapMode aMapMode( rDummyVDev.GetMapMode() );
+ aMapMode.SetOrigin( aPoint );
+ pVDev->SetMapMode( aMapMode );
+ Size aDstSize( pVDev->PixelToLogic( aDstSizePixel ) );
+
+ Point aMtfOrigin( aTmpMtf.GetPrefMapMode().GetOrigin() );
+ if ( aMtfOrigin.X() || aMtfOrigin.Y() )
+ aTmpMtf.Move( -aMtfOrigin.X(), -aMtfOrigin.Y() );
+ double fScaleX = (double)aDstSize.Width() / (double)aTmpMtf.GetPrefSize().Width();
+ double fScaleY = (double)aDstSize.Height() / (double)aTmpMtf.GetPrefSize().Height();
+ if( fScaleX != 1.0 || fScaleY != 1.0 )
+ aTmpMtf.Scale( fScaleX, fScaleY );
+ aTmpMtf.SetPrefMapMode( aMapMode );
+
+ // create paint bitmap
+ aTmpMtf.WindStart();
+ aTmpMtf.Play( pVDev, aPoint, aDstSize );
+ aTmpMtf.WindStart();
+
+ pVDev->EnableMapMode( FALSE );
+ aPaint = pVDev->GetBitmap( aPoint, aDstSizePixel );
+ pVDev->EnableMapMode( TRUE );
+
+ // create mask bitmap
+ pVDev->SetLineColor( COL_BLACK );
+ pVDev->SetFillColor( COL_BLACK );
+ pVDev->DrawRect( Rectangle( aPoint, aDstSize ) );
+ pVDev->SetDrawMode( DRAWMODE_WHITELINE | DRAWMODE_WHITEFILL | DRAWMODE_WHITETEXT |
+ DRAWMODE_WHITEBITMAP | DRAWMODE_WHITEGRADIENT );
+ aTmpMtf.WindStart();
+ aTmpMtf.Play( pVDev, aPoint, aDstSize );
+ aTmpMtf.WindStart();
+ pVDev->EnableMapMode( FALSE );
+ aMask = pVDev->GetBitmap( aPoint, aDstSizePixel );
+ pVDev->EnableMapMode( TRUE );
+
+ // create alpha mask from gradient
+ pVDev->SetDrawMode( DRAWMODE_GRAYGRADIENT );
+ pVDev->DrawGradient( Rectangle( aPoint, aDstSize ), rTransparenceGradient );
+ pVDev->SetDrawMode( DRAWMODE_DEFAULT );
+ pVDev->EnableMapMode( FALSE );
+ pVDev->DrawMask( aPoint, aDstSizePixel, aMask, Color( COL_WHITE ) );
+ aAlpha = pVDev->GetBitmap( aPoint, aDstSizePixel );
+ ImplWriteBitmapEx( rWriter, rDummyVDev, rPos, rSize, BitmapEx( aPaint, aAlpha ) );
+ }
+ delete pVDev;
+ }
+ }
+ }
+ break;
+
+ case( META_EPS_ACTION ):
+ {
+ const MetaEPSAction* pA = (const MetaEPSAction*) pAction;
+ const GDIMetaFile aSubstitute( pA->GetSubstitute() );
+
+ rWriter.Push();
+ rDummyVDev.Push();
+
+ MapMode aMapMode( aSubstitute.GetPrefMapMode() );
+ Size aOutSize( rDummyVDev.LogicToLogic( pA->GetSize(), rDummyVDev.GetMapMode(), aMapMode ) );
+ aMapMode.SetScaleX( Fraction( aOutSize.Width(), aSubstitute.GetPrefSize().Width() ) );
+ aMapMode.SetScaleY( Fraction( aOutSize.Height(), aSubstitute.GetPrefSize().Height() ) );
+ aMapMode.SetOrigin( rDummyVDev.LogicToLogic( pA->GetPoint(), rDummyVDev.GetMapMode(), aMapMode ) );
+
+ rWriter.SetMapMode( aMapMode );
+ rDummyVDev.SetMapMode( aMapMode );
+ ImplWriteActions( rWriter, NULL, aSubstitute, rDummyVDev );
+ rDummyVDev.Pop();
+ rWriter.Pop();
+ }
+ break;
+
+ case( META_COMMENT_ACTION ):
+ if( ! bTransparenciesRemoved )
+ {
+ const MetaCommentAction* pA = (const MetaCommentAction*) pAction;
+ String aSkipComment;
+
+ if( pA->GetComment().CompareIgnoreCaseToAscii( "XGRAD_SEQ_BEGIN" ) == COMPARE_EQUAL )
+ {
+ const MetaGradientExAction* pGradAction = NULL;
+ sal_Bool bDone = sal_False;
+
+ while( !bDone && ( ++i < nCount ) )
+ {
+ pAction = aMtf.GetAction( i );
+
+ if( pAction->GetType() == META_GRADIENTEX_ACTION )
+ pGradAction = (const MetaGradientExAction*) pAction;
+ else if( ( pAction->GetType() == META_COMMENT_ACTION ) &&
+ ( ( (const MetaCommentAction*) pAction )->GetComment().CompareIgnoreCaseToAscii( "XGRAD_SEQ_END" ) == COMPARE_EQUAL ) )
+ {
+ bDone = sal_True;
+ }
+ }
+
+ if( pGradAction )
+ ImplWriteGradient( rWriter, pGradAction->GetPolyPolygon(), pGradAction->GetGradient(), rDummyVDev );
+ }
+ else
+ {
+ const BYTE* pData = pA->GetData();
+ if ( pData )
+ {
+ SvMemoryStream aMemStm( (void*)pData, pA->GetDataSize(), STREAM_READ );
+ sal_Bool bSkipSequence = sal_False;
+ ByteString sSeqEnd;
+
+ if( pA->GetComment().Equals( "XPATHSTROKE_SEQ_BEGIN" ) )
+ {
+ sSeqEnd = ByteString( "XPATHSTROKE_SEQ_END" );
+ SvtGraphicStroke aStroke;
+ aMemStm >> aStroke;
+
+ Polygon aPath;
+ aStroke.getPath( aPath );
+
+ PolyPolygon aStartArrow;
+ PolyPolygon aEndArrow;
+ double fTransparency( aStroke.getTransparency() );
+ double fStrokeWidth( aStroke.getStrokeWidth() );
+ SvtGraphicStroke::DashArray aDashArray;
+
+ aStroke.getStartArrow( aStartArrow );
+ aStroke.getEndArrow( aEndArrow );
+ aStroke.getDashArray( aDashArray );
+
+ bSkipSequence = sal_True;
+ if ( aStartArrow.Count() || aEndArrow.Count() )
+ bSkipSequence = sal_False;
+ if ( aDashArray.size() && ( fStrokeWidth != 0.0 ) && ( fTransparency == 0.0 ) )
+ bSkipSequence = sal_False;
+ if ( bSkipSequence )
+ {
+ PDFWriter::ExtLineInfo aInfo;
+ aInfo.m_fLineWidth = fStrokeWidth;
+ aInfo.m_fTransparency = fTransparency;
+ aInfo.m_fMiterLimit = aStroke.getMiterLimit();
+ switch( aStroke.getCapType() )
+ {
+ default:
+ case SvtGraphicStroke::capButt: aInfo.m_eCap = PDFWriter::capButt;break;
+ case SvtGraphicStroke::capRound: aInfo.m_eCap = PDFWriter::capRound;break;
+ case SvtGraphicStroke::capSquare: aInfo.m_eCap = PDFWriter::capSquare;break;
+ }
+ switch( aStroke.getJoinType() )
+ {
+ default:
+ case SvtGraphicStroke::joinMiter: aInfo.m_eJoin = PDFWriter::joinMiter;break;
+ case SvtGraphicStroke::joinRound: aInfo.m_eJoin = PDFWriter::joinRound;break;
+ case SvtGraphicStroke::joinBevel: aInfo.m_eJoin = PDFWriter::joinBevel;break;
+ case SvtGraphicStroke::joinNone:
+ aInfo.m_eJoin = PDFWriter::joinMiter;
+ aInfo.m_fMiterLimit = 0.0;
+ break;
+ }
+ aInfo.m_aDashArray = aDashArray;
+
+ if(SvtGraphicStroke::joinNone == aStroke.getJoinType()
+ && fStrokeWidth > 0.0)
+ {
+ // emulate no edge rounding by handling single edges
+ const sal_uInt16 nPoints(aPath.GetSize());
+ const bool bCurve(aPath.HasFlags());
+
+ for(sal_uInt16 a(0); a + 1 < nPoints; a++)
+ {
+ if(bCurve
+ && POLY_NORMAL != aPath.GetFlags(a + 1)
+ && a + 2 < nPoints
+ && POLY_NORMAL != aPath.GetFlags(a + 2)
+ && a + 3 < nPoints)
+ {
+ const Polygon aSnippet(4,
+ aPath.GetConstPointAry() + a,
+ aPath.GetConstFlagAry() + a);
+ rWriter.DrawPolyLine( aSnippet, aInfo );
+ a += 2;
+ }
+ else
+ {
+ const Polygon aSnippet(2,
+ aPath.GetConstPointAry() + a);
+ rWriter.DrawPolyLine( aSnippet, aInfo );
+ }
+ }
+ }
+ else
+ {
+ rWriter.DrawPolyLine( aPath, aInfo );
+ }
+ }
+ }
+ else if ( pA->GetComment().Equals( "XPATHFILL_SEQ_BEGIN" ) )
+ {
+ sSeqEnd = ByteString( "XPATHFILL_SEQ_END" );
+ SvtGraphicFill aFill;
+ aMemStm >> aFill;
+
+ if ( ( aFill.getFillType() == SvtGraphicFill::fillSolid ) && ( aFill.getFillRule() == SvtGraphicFill::fillEvenOdd ) )
+ {
+ double fTransparency = aFill.getTransparency();
+ if ( fTransparency == 0.0 )
+ {
+ PolyPolygon aPath;
+ aFill.getPath( aPath );
+
+ bSkipSequence = sal_True;
+ rWriter.DrawPolyPolygon( aPath );
+ }
+ else if ( fTransparency == 1.0 )
+ bSkipSequence = sal_True;
+ }
+/* #i81548# removing optimization for fill textures, because most of the texture settings are not
+ exported properly. In OpenOffice 3.1 the drawing layer will support graphic primitives, then it
+ will not be a problem to optimize the filltexture export. But for wysiwyg is more important than
+ filesize.
+ else if( aFill.getFillType() == SvtGraphicFill::fillTexture && aFill.isTiling() )
+ {
+ sal_Int32 nPattern = mnCachePatternId;
+ Graphic aPatternGraphic;
+ aFill.getGraphic( aPatternGraphic );
+ bool bUseCache = false;
+ SvtGraphicFill::Transform aPatTransform;
+ aFill.getTransform( aPatTransform );
+
+ if( mnCachePatternId >= 0 )
+ {
+ SvtGraphicFill::Transform aCacheTransform;
+ maCacheFill.getTransform( aCacheTransform );
+ if( aCacheTransform.matrix[0] == aPatTransform.matrix[0] &&
+ aCacheTransform.matrix[1] == aPatTransform.matrix[1] &&
+ aCacheTransform.matrix[2] == aPatTransform.matrix[2] &&
+ aCacheTransform.matrix[3] == aPatTransform.matrix[3] &&
+ aCacheTransform.matrix[4] == aPatTransform.matrix[4] &&
+ aCacheTransform.matrix[5] == aPatTransform.matrix[5]
+ )
+ {
+ Graphic aCacheGraphic;
+ maCacheFill.getGraphic( aCacheGraphic );
+ if( aCacheGraphic == aPatternGraphic )
+ bUseCache = true;
+ }
+ }
+
+ if( ! bUseCache )
+ {
+
+ // paint graphic to metafile
+ GDIMetaFile aPattern;
+ rDummyVDev.SetConnectMetaFile( &aPattern );
+ rDummyVDev.Push();
+ rDummyVDev.SetMapMode( aPatternGraphic.GetPrefMapMode() );
+
+ aPatternGraphic.Draw( &rDummyVDev, Point( 0, 0 ) );
+ rDummyVDev.Pop();
+ rDummyVDev.SetConnectMetaFile( NULL );
+ aPattern.WindStart();
+
+ MapMode aPatternMapMode( aPatternGraphic.GetPrefMapMode() );
+ // prepare pattern from metafile
+ Size aPrefSize( aPatternGraphic.GetPrefSize() );
+ // FIXME: this magic -1 shouldn't be necessary
+ aPrefSize.Width() -= 1;
+ aPrefSize.Height() -= 1;
+ aPrefSize = rWriter.GetReferenceDevice()->
+ LogicToLogic( aPrefSize,
+ &aPatternMapMode,
+ &rWriter.GetReferenceDevice()->GetMapMode() );
+ // build bounding rectangle of pattern
+ Rectangle aBound( Point( 0, 0 ), aPrefSize );
+ rWriter.BeginPattern( aBound );
+ rWriter.Push();
+ rDummyVDev.Push();
+ rWriter.SetMapMode( aPatternMapMode );
+ rDummyVDev.SetMapMode( aPatternMapMode );
+ ImplWriteActions( rWriter, NULL, aPattern, rDummyVDev );
+ rDummyVDev.Pop();
+ rWriter.Pop();
+
+ nPattern = rWriter.EndPattern( aPatTransform );
+
+ // try some caching and reuse pattern
+ mnCachePatternId = nPattern;
+ maCacheFill = aFill;
+ }
+
+ // draw polypolygon with pattern fill
+ PolyPolygon aPath;
+ aFill.getPath( aPath );
+ rWriter.DrawPolyPolygon( aPath, nPattern, aFill.getFillRule() == SvtGraphicFill::fillEvenOdd );
+
+ bSkipSequence = sal_True;
+ }
+*/
+ }
+ if ( bSkipSequence )
+ {
+ while( ++i < nCount )
+ {
+ pAction = aMtf.GetAction( i );
+ if ( pAction->GetType() == META_COMMENT_ACTION )
+ {
+ ByteString sComment( ((MetaCommentAction*)pAction)->GetComment() );
+ if ( sComment.Equals( sSeqEnd ) )
+ break;
+ }
+ // #i44496#
+ // the replacement action for stroke is a filled rectangle
+ // the set fillcolor of the replacement is part of the graphics
+ // state and must not be skipped
+ else if( pAction->GetType() == META_FILLCOLOR_ACTION )
+ {
+ const MetaFillColorAction* pMA = (const MetaFillColorAction*) pAction;
+ if( pMA->IsSetting() )
+ rWriter.SetFillColor( pMA->GetColor() );
+ else
+ rWriter.SetFillColor();
+ }
+ }
+ }
+ }
+ }
+ }
+ break;
+
+ case( META_BMP_ACTION ):
+ {
+ const MetaBmpAction* pA = (const MetaBmpAction*) pAction;
+ BitmapEx aBitmapEx( pA->GetBitmap() );
+ Size aSize( OutputDevice::LogicToLogic( aBitmapEx.GetPrefSize(),
+ aBitmapEx.GetPrefMapMode(), rDummyVDev.GetMapMode() ) );
+ if( ! ( aSize.Width() && aSize.Height() ) )
+ aSize = rDummyVDev.PixelToLogic( aBitmapEx.GetSizePixel() );
+ ImplWriteBitmapEx( rWriter, rDummyVDev, pA->GetPoint(), aSize, aBitmapEx );
+ }
+ break;
+
+ case( META_BMPSCALE_ACTION ):
+ {
+ const MetaBmpScaleAction* pA = (const MetaBmpScaleAction*) pAction;
+ ImplWriteBitmapEx( rWriter, rDummyVDev, pA->GetPoint(), pA->GetSize(), BitmapEx( pA->GetBitmap() ) );
+ }
+ break;
+
+ case( META_BMPSCALEPART_ACTION ):
+ {
+ const MetaBmpScalePartAction* pA = (const MetaBmpScalePartAction*) pAction;
+ BitmapEx aBitmapEx( pA->GetBitmap() );
+ aBitmapEx.Crop( Rectangle( pA->GetSrcPoint(), pA->GetSrcSize() ) );
+ ImplWriteBitmapEx( rWriter, rDummyVDev, pA->GetDestPoint(), pA->GetDestSize(), aBitmapEx );
+ }
+ break;
+
+ case( META_BMPEX_ACTION ):
+ {
+ const MetaBmpExAction* pA = (const MetaBmpExAction*) pAction;
+ BitmapEx aBitmapEx( pA->GetBitmapEx() );
+ Size aSize( OutputDevice::LogicToLogic( aBitmapEx.GetPrefSize(),
+ aBitmapEx.GetPrefMapMode(), rDummyVDev.GetMapMode() ) );
+ ImplWriteBitmapEx( rWriter, rDummyVDev, pA->GetPoint(), aSize, aBitmapEx );
+ }
+ break;
+
+ case( META_BMPEXSCALE_ACTION ):
+ {
+ const MetaBmpExScaleAction* pA = (const MetaBmpExScaleAction*) pAction;
+ ImplWriteBitmapEx( rWriter, rDummyVDev, pA->GetPoint(), pA->GetSize(), pA->GetBitmapEx() );
+ }
+ break;
+
+ case( META_BMPEXSCALEPART_ACTION ):
+ {
+ const MetaBmpExScalePartAction* pA = (const MetaBmpExScalePartAction*) pAction;
+ BitmapEx aBitmapEx( pA->GetBitmapEx() );
+ aBitmapEx.Crop( Rectangle( pA->GetSrcPoint(), pA->GetSrcSize() ) );
+ ImplWriteBitmapEx( rWriter, rDummyVDev, pA->GetDestPoint(), pA->GetDestSize(), aBitmapEx );
+ }
+ break;
+
+ case( META_MASK_ACTION ):
+ case( META_MASKSCALE_ACTION ):
+ case( META_MASKSCALEPART_ACTION ):
+ {
+ DBG_ERROR( "MetaMask...Action not supported yet" );
+ }
+ break;
+
+ case( META_TEXT_ACTION ):
+ {
+ const MetaTextAction* pA = (const MetaTextAction*) pAction;
+ rWriter.DrawText( pA->GetPoint(), String( pA->GetText(), pA->GetIndex(), pA->GetLen() ) );
+ }
+ break;
+
+ case( META_TEXTRECT_ACTION ):
+ {
+ const MetaTextRectAction* pA = (const MetaTextRectAction*) pAction;
+ rWriter.DrawText( pA->GetRect(), String( pA->GetText() ), pA->GetStyle() );
+ }
+ break;
+
+ case( META_TEXTARRAY_ACTION ):
+ {
+ const MetaTextArrayAction* pA = (const MetaTextArrayAction*) pAction;
+ rWriter.DrawTextArray( pA->GetPoint(), pA->GetText(), pA->GetDXArray(), pA->GetIndex(), pA->GetLen() );
+ }
+ break;
+
+ case( META_STRETCHTEXT_ACTION ):
+ {
+ const MetaStretchTextAction* pA = (const MetaStretchTextAction*) pAction;
+ rWriter.DrawStretchText( pA->GetPoint(), pA->GetWidth(), pA->GetText(), pA->GetIndex(), pA->GetLen() );
+ }
+ break;
+
+
+ case( META_TEXTLINE_ACTION ):
+ {
+ const MetaTextLineAction* pA = (const MetaTextLineAction*) pAction;
+ rWriter.DrawTextLine( pA->GetStartPoint(), pA->GetWidth(), pA->GetStrikeout(), pA->GetUnderline(), pA->GetOverline() );
+
+ }
+ break;
+
+ case( META_CLIPREGION_ACTION ):
+ {
+ const MetaClipRegionAction* pA = (const MetaClipRegionAction*) pAction;
+
+ if( pA->IsClipping() )
+ {
+ if( pA->GetRegion().IsEmpty() )
+ rWriter.SetClipRegion( basegfx::B2DPolyPolygon() );
+ else
+ {
+ Region aReg( pA->GetRegion() );
+ rWriter.SetClipRegion( aReg.ConvertToB2DPolyPolygon() );
+ }
+ }
+ else
+ rWriter.SetClipRegion();
+ }
+ break;
+
+ case( META_ISECTRECTCLIPREGION_ACTION ):
+ {
+ const MetaISectRectClipRegionAction* pA = (const MetaISectRectClipRegionAction*) pAction;
+ rWriter.IntersectClipRegion( pA->GetRect() );
+ }
+ break;
+
+ case( META_ISECTREGIONCLIPREGION_ACTION ):
+ {
+ const MetaISectRegionClipRegionAction* pA = (const MetaISectRegionClipRegionAction*) pAction;
+ Region aReg( pA->GetRegion() );
+ rWriter.IntersectClipRegion( aReg.ConvertToB2DPolyPolygon() );
+ }
+ break;
+
+ case( META_MOVECLIPREGION_ACTION ):
+ {
+ const MetaMoveClipRegionAction* pA = (const MetaMoveClipRegionAction*) pAction;
+ rWriter.MoveClipRegion( pA->GetHorzMove(), pA->GetVertMove() );
+ }
+ break;
+
+ case( META_MAPMODE_ACTION ):
+ {
+ const_cast< MetaAction* >( pAction )->Execute( &rDummyVDev );
+ rWriter.SetMapMode( rDummyVDev.GetMapMode() );
+ }
+ break;
+
+ case( META_LINECOLOR_ACTION ):
+ {
+ const MetaLineColorAction* pA = (const MetaLineColorAction*) pAction;
+
+ if( pA->IsSetting() )
+ rWriter.SetLineColor( pA->GetColor() );
+ else
+ rWriter.SetLineColor();
+ }
+ break;
+
+ case( META_FILLCOLOR_ACTION ):
+ {
+ const MetaFillColorAction* pA = (const MetaFillColorAction*) pAction;
+
+ if( pA->IsSetting() )
+ rWriter.SetFillColor( pA->GetColor() );
+ else
+ rWriter.SetFillColor();
+ }
+ break;
+
+ case( META_TEXTLINECOLOR_ACTION ):
+ {
+ const MetaTextLineColorAction* pA = (const MetaTextLineColorAction*) pAction;
+
+ if( pA->IsSetting() )
+ rWriter.SetTextLineColor( pA->GetColor() );
+ else
+ rWriter.SetTextLineColor();
+ }
+ break;
+
+ case( META_OVERLINECOLOR_ACTION ):
+ {
+ const MetaOverlineColorAction* pA = (const MetaOverlineColorAction*) pAction;
+
+ if( pA->IsSetting() )
+ rWriter.SetOverlineColor( pA->GetColor() );
+ else
+ rWriter.SetOverlineColor();
+ }
+ break;
+
+ case( META_TEXTFILLCOLOR_ACTION ):
+ {
+ const MetaTextFillColorAction* pA = (const MetaTextFillColorAction*) pAction;
+
+ if( pA->IsSetting() )
+ rWriter.SetTextFillColor( pA->GetColor() );
+ else
+ rWriter.SetTextFillColor();
+ }
+ break;
+
+ case( META_TEXTCOLOR_ACTION ):
+ {
+ const MetaTextColorAction* pA = (const MetaTextColorAction*) pAction;
+ rWriter.SetTextColor( pA->GetColor() );
+ }
+ break;
+
+ case( META_TEXTALIGN_ACTION ):
+ {
+ const MetaTextAlignAction* pA = (const MetaTextAlignAction*) pAction;
+ rWriter.SetTextAlign( pA->GetTextAlign() );
+ }
+ break;
+
+ case( META_FONT_ACTION ):
+ {
+ const MetaFontAction* pA = (const MetaFontAction*) pAction;
+ rWriter.SetFont( pA->GetFont() );
+ }
+ break;
+
+ case( META_PUSH_ACTION ):
+ {
+ const MetaPushAction* pA = (const MetaPushAction*) pAction;
+
+ rDummyVDev.Push( pA->GetFlags() );
+ rWriter.Push( pA->GetFlags() );
+ }
+ break;
+
+ case( META_POP_ACTION ):
+ {
+ rDummyVDev.Pop();
+ rWriter.Pop();
+ }
+ break;
+
+ case( META_LAYOUTMODE_ACTION ):
+ {
+ const MetaLayoutModeAction* pA = (const MetaLayoutModeAction*) pAction;
+ rWriter.SetLayoutMode( pA->GetLayoutMode() );
+ }
+ break;
+
+ case META_TEXTLANGUAGE_ACTION:
+ {
+ const MetaTextLanguageAction* pA = (const MetaTextLanguageAction*) pAction;
+ rWriter.SetDigitLanguage( pA->GetTextLanguage() );
+ }
+ break;
+
+ case( META_WALLPAPER_ACTION ):
+ {
+ const MetaWallpaperAction* pA = (const MetaWallpaperAction*) pAction;
+ rWriter.DrawWallpaper( pA->GetRect(), pA->GetWallpaper() );
+ }
+ break;
+
+ case( META_RASTEROP_ACTION ):
+ {
+ // !!! >>> we don't want to support this actions
+ }
+ break;
+
+ case( META_REFPOINT_ACTION ):
+ {
+ // !!! >>> we don't want to support this actions
+ }
+ break;
+
+ default:
+ // #i24604# Made assertion fire only once per
+ // metafile. The asserted actions here are all
+ // deprecated
+ if( !bAssertionFired )
+ {
+ bAssertionFired = true;
+ DBG_ERROR( "PDFExport::ImplWriteActions: deprecated and unsupported MetaAction encountered" );
+ }
+ break;
+ }
+ i++;
+ }
+ }
+
+ return sal_True;
+}
+
+// -----------------------------------------------------------------------------
+
+void PDFExport::ImplWriteGradient( PDFWriter& rWriter, const PolyPolygon& rPolyPoly, const Gradient& rGradient, VirtualDevice& rDummyVDev )
+{
+ GDIMetaFile aTmpMtf;
+
+ rDummyVDev.AddGradientActions( rPolyPoly.GetBoundRect(), rGradient, aTmpMtf );
+
+ rWriter.Push();
+ rWriter.IntersectClipRegion( rPolyPoly.getB2DPolyPolygon() );
+ ImplWriteActions( rWriter, NULL, aTmpMtf, rDummyVDev );
+ rWriter.Pop();
+}
+
+// -----------------------------------------------------------------------------
+
+void PDFExport::ImplWriteBitmapEx( PDFWriter& rWriter, VirtualDevice& rDummyVDev,
+ const Point& rPoint, const Size& rSize, const BitmapEx& rBitmapEx )
+{
+ if ( !rBitmapEx.IsEmpty() && rSize.Width() && rSize.Height() )
+ {
+ BitmapEx aBitmapEx( rBitmapEx );
+ Point aPoint( rPoint );
+ Size aSize( rSize );
+
+ // #i19065# Negative sizes have mirror semantics on
+ // OutputDevice. BitmapEx and co. have no idea about that, so
+ // perform that _before_ doing anything with aBitmapEx.
+ ULONG nMirrorFlags(BMP_MIRROR_NONE);
+ if( aSize.Width() < 0 )
+ {
+ aSize.Width() *= -1;
+ aPoint.X() -= aSize.Width();
+ nMirrorFlags |= BMP_MIRROR_HORZ;
+ }
+ if( aSize.Height() < 0 )
+ {
+ aSize.Height() *= -1;
+ aPoint.Y() -= aSize.Height();
+ nMirrorFlags |= BMP_MIRROR_VERT;
+ }
+
+ if( nMirrorFlags != BMP_MIRROR_NONE )
+ {
+ aBitmapEx.Mirror( nMirrorFlags );
+ }
+ if ( mbReduceImageResolution )
+ {
+ // do downsampling if neccessary
+ const Size aDstSizeTwip( rDummyVDev.PixelToLogic( rDummyVDev.LogicToPixel( aSize ), MAP_TWIP ) );
+ const Size aBmpSize( aBitmapEx.GetSizePixel() );
+ const double fBmpPixelX = aBmpSize.Width();
+ const double fBmpPixelY = aBmpSize.Height();
+ const double fMaxPixelX = aDstSizeTwip.Width() * mnMaxImageResolution / 1440.0;
+ const double fMaxPixelY = aDstSizeTwip.Height() * mnMaxImageResolution / 1440.0;
+
+ // check, if the bitmap DPI exceeds the maximum DPI (allow 4 pixel rounding tolerance)
+ if( ( ( fBmpPixelX > ( fMaxPixelX + 4 ) ) ||
+ ( fBmpPixelY > ( fMaxPixelY + 4 ) ) ) &&
+ ( fBmpPixelY > 0.0 ) && ( fMaxPixelY > 0.0 ) )
+ {
+ // do scaling
+ Size aNewBmpSize;
+ const double fBmpWH = fBmpPixelX / fBmpPixelY;
+ const double fMaxWH = fMaxPixelX / fMaxPixelY;
+
+ if( fBmpWH < fMaxWH )
+ {
+ aNewBmpSize.Width() = FRound( fMaxPixelY * fBmpWH );
+ aNewBmpSize.Height() = FRound( fMaxPixelY );
+ }
+ else if( fBmpWH > 0.0 )
+ {
+ aNewBmpSize.Width() = FRound( fMaxPixelX );
+ aNewBmpSize.Height() = FRound( fMaxPixelX / fBmpWH);
+ }
+ if( aNewBmpSize.Width() && aNewBmpSize.Height() )
+ aBitmapEx.Scale( aNewBmpSize );
+ else
+ aBitmapEx.SetEmpty();
+ }
+ }
+
+ const Size aSizePixel( aBitmapEx.GetSizePixel() );
+ if ( aSizePixel.Width() && aSizePixel.Height() )
+ {
+ sal_Bool bUseJPGCompression = !mbUseLosslessCompression;
+ if ( ( aSizePixel.Width() < 32 ) || ( aSizePixel.Height() < 32 ) )
+ bUseJPGCompression = sal_False;
+
+ SvMemoryStream aStrm;
+ Bitmap aMask;
+
+ bool bTrueColorJPG = true;
+ if ( bUseJPGCompression )
+ {
+ sal_uInt32 nZippedFileSize; // sj: we will calculate the filesize of a zipped bitmap
+ { // to determine if jpeg compression is usefull
+ SvMemoryStream aTemp;
+ aTemp.SetCompressMode( aTemp.GetCompressMode() | COMPRESSMODE_ZBITMAP );
+ aTemp.SetVersion( SOFFICE_FILEFORMAT_40 ); // sj: up from version 40 our bitmap stream operator
+ aTemp << aBitmapEx; // is capable of zlib stream compression
+ aTemp.Seek( STREAM_SEEK_TO_END );
+ nZippedFileSize = aTemp.Tell();
+ }
+ if ( aBitmapEx.IsTransparent() )
+ {
+ if ( aBitmapEx.IsAlpha() )
+ aMask = aBitmapEx.GetAlpha().GetBitmap();
+ else
+ aMask = aBitmapEx.GetMask();
+ }
+ GraphicFilter aGraphicFilter;
+ Graphic aGraphic( aBitmapEx.GetBitmap() );
+ sal_uInt16 nFormatName = aGraphicFilter.GetExportFormatNumberForShortName( OUString( RTL_CONSTASCII_USTRINGPARAM( "JPG" ) ) );
+ sal_Int32 nColorMode = 0;
+
+ Sequence< PropertyValue > aFilterData( 2 );
+ aFilterData[ 0 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Quality" ) );
+ aFilterData[ 0 ].Value <<= mnQuality;
+ aFilterData[ 1 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "ColorMode" ) );
+ aFilterData[ 1 ].Value <<= nColorMode;
+
+ /*sal_uInt16 nError =*/ aGraphicFilter.ExportGraphic( aGraphic, String(), aStrm, nFormatName, &aFilterData );
+ bTrueColorJPG = ((aGraphicFilter.GetExportGraphicHint() & GRFILTER_OUTHINT_GREY) == 0);
+ aStrm.Seek( STREAM_SEEK_TO_END );
+ if ( aStrm.Tell() > nZippedFileSize )
+ bUseJPGCompression = sal_False;
+ }
+ if ( bUseJPGCompression )
+ rWriter.DrawJPGBitmap( aStrm, bTrueColorJPG, aSizePixel, Rectangle( aPoint, aSize ), aMask );
+ else if ( aBitmapEx.IsTransparent() )
+ rWriter.DrawBitmapEx( aPoint, aSize, aBitmapEx );
+ else
+ rWriter.DrawBitmap( aPoint, aSize, aBitmapEx.GetBitmap() );
+ }
+ }
+}
+
+
diff --git a/filter/source/pdf/pdfexport.hxx b/filter/source/pdf/pdfexport.hxx
new file mode 100644
index 000000000000..18c760b85675
--- /dev/null
+++ b/filter/source/pdf/pdfexport.hxx
@@ -0,0 +1,141 @@
+/*************************************************************************
+ *
+ * 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 PDFEXPORT_HXX
+#define PDFEXPORT_HXX
+
+#include "pdffilter.hxx"
+#include <tools/multisel.hxx>
+#include <vcl/pdfwriter.hxx>
+#include <vcl/pdfextoutdevdata.hxx>
+#include <com/sun/star/view/XRenderable.hpp>
+
+class SvEmbeddedObject;
+class GDIMetaFile;
+class VirtualDevice;
+class PolyPolygon;
+class Gradient;
+class BitmapEx;
+class Point;
+class Size;
+
+namespace vcl { class PDFWriter; }
+
+// -------------
+// - PDFExport -
+// -------------
+
+class PDFExport
+{
+private:
+
+ Reference< XComponent > mxSrcDoc;
+ Reference< lang::XMultiServiceFactory > mxMSF;
+ Reference< task::XStatusIndicator > mxStatusIndicator;
+
+ sal_Bool mbUseTaggedPDF;
+ sal_Int32 mnPDFTypeSelection;
+ sal_Bool mbExportNotes;
+ sal_Bool mbExportNotesPages;
+ sal_Bool mbEmbedStandardFonts;
+ sal_Bool mbUseTransitionEffects;
+ sal_Bool mbExportBookmarks;
+ sal_Int32 mnOpenBookmarkLevels;
+
+ sal_Bool mbUseLosslessCompression;
+ sal_Bool mbReduceImageResolution;
+ sal_Bool mbSkipEmptyPages;
+ sal_Bool mbAddStream;
+ sal_Int32 mnMaxImageResolution;
+ sal_Int32 mnQuality;
+ sal_Int32 mnFormsFormat;
+ sal_Bool mbExportFormFields;
+ sal_Bool mbAllowDuplicateFieldNames;
+ sal_Int32 mnProgressValue;
+ sal_Bool mbRemoveTransparencies;
+
+ sal_Bool mbWatermark;
+ uno::Any maWatermark;
+
+//these variable are here only to have a location in filter/pdf to set the default
+//to be used by the macro (when the FilterData are set by the macro itself)
+ sal_Bool mbHideViewerToolbar;
+ sal_Bool mbHideViewerMenubar;
+ sal_Bool mbHideViewerWindowControls;
+ sal_Bool mbFitWindow;
+ sal_Bool mbCenterWindow;
+ sal_Bool mbOpenInFullScreenMode;
+ sal_Bool mbDisplayPDFDocumentTitle;
+ sal_Int32 mnPDFDocumentMode;
+ sal_Int32 mnPDFDocumentAction;
+ sal_Int32 mnZoom;
+ sal_Int32 mnInitialPage;
+ sal_Int32 mnPDFPageLayout;
+ sal_Bool mbFirstPageLeft;
+
+ sal_Bool mbEncrypt;
+ rtl::OUString msOpenPassword;
+ sal_Bool mbRestrictPermissions;
+ rtl::OUString msPermissionPassword;
+ sal_Int32 mnPrintAllowed;
+ sal_Int32 mnChangesAllowed;
+ sal_Bool mbCanCopyOrExtract;
+ sal_Bool mbCanExtractForAccessibility;
+
+ SvtGraphicFill maCacheFill;
+ sal_Int32 mnCachePatternId;
+
+//--->i56629
+ sal_Bool mbExportRelativeFsysLinks;
+ sal_Int32 mnDefaultLinkAction;
+ sal_Bool mbConvertOOoTargetToPDFTarget;
+ sal_Bool mbExportBmkToDest;
+//<---
+ sal_Bool ImplExportPage( ::vcl::PDFWriter& rWriter, ::vcl::PDFExtOutDevData& rPDFExtOutDevData,
+ const GDIMetaFile& rMtf );
+ sal_Bool ImplWriteActions( ::vcl::PDFWriter& rWriter, ::vcl::PDFExtOutDevData* pPDFExtOutDevData,
+ const GDIMetaFile& rMtf, VirtualDevice& rDummyVDev );
+ void ImplWriteGradient( ::vcl::PDFWriter& rWriter, const PolyPolygon& rPolyPoly,
+ const Gradient& rGradient, VirtualDevice& rDummyVDev );
+ void ImplWriteBitmapEx( ::vcl::PDFWriter& rWriter, VirtualDevice& rDummyVDev,
+ const Point& rPoint, const Size& rSize, const BitmapEx& rBitmap );
+
+ void ImplWriteWatermark( ::vcl::PDFWriter& rWriter, const Size& rPageSize );
+public:
+
+ PDFExport( const Reference< XComponent >& rxSrcDoc, Reference< task::XStatusIndicator >& xStatusIndicator, const Reference< lang::XMultiServiceFactory >& xFact );
+ ~PDFExport();
+
+ sal_Bool ExportSelection( vcl::PDFWriter& rPDFWriter, Reference< com::sun::star::view::XRenderable >& rRenderable, Any& rSelection,
+ MultiSelection aMultiSelection, Sequence< PropertyValue >& rRenderOptions, sal_Int32 nPageCount );
+
+ sal_Bool Export( const OUString& rFile, const Sequence< PropertyValue >& rFilterData );
+
+ void showErrors( const std::set<vcl::PDFWriter::ErrorCode>& );
+};
+
+#endif
diff --git a/filter/source/pdf/pdffilter.cxx b/filter/source/pdf/pdffilter.cxx
new file mode 100644
index 000000000000..0c08be6d8a66
--- /dev/null
+++ b/filter/source/pdf/pdffilter.cxx
@@ -0,0 +1,267 @@
+ /*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include "pdffilter.hxx"
+#include "pdfexport.hxx"
+#include <vcl/svapp.hxx>
+#include <vcl/window.hxx>
+#include <svl/outstrm.hxx>
+#include <svtools/FilterConfigItem.hxx>
+
+// -------------
+// - PDFFilter -
+// -------------
+
+PDFFilter::PDFFilter( const Reference< XMultiServiceFactory > &rxMSF ) :
+ mxMSF( rxMSF )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+PDFFilter::~PDFFilter()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool PDFFilter::implExport( const Sequence< PropertyValue >& rDescriptor )
+{
+ Reference< XOutputStream > xOStm;
+ Sequence< PropertyValue > aFilterData;
+ sal_Int32 nLength = rDescriptor.getLength();
+ const PropertyValue* pValue = rDescriptor.getConstArray();
+ sal_Bool bRet = sal_False;
+ Reference< task::XStatusIndicator > xStatusIndicator;
+
+ for ( sal_Int32 i = 0 ; ( i < nLength ) && !xOStm.is(); ++i)
+ {
+ if( pValue[ i ].Name.equalsAscii( "OutputStream" ) )
+ pValue[ i ].Value >>= xOStm;
+ else if( pValue[ i ].Name.equalsAscii( "FilterData" ) )
+ pValue[ i ].Value >>= aFilterData;
+ else if ( pValue[ i ].Name.equalsAscii( "StatusIndicator" ) )
+ pValue[ i ].Value >>= xStatusIndicator;
+ }
+
+ /* we don't get FilterData if we are exporting directly
+ to pdf, but we have to use the last user settings (especially for the CompressMode) */
+ if ( !aFilterData.getLength() )
+ {
+ FilterConfigItem aCfgItem( String( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Filter/PDF/Export/" ) ) );
+ aCfgItem.ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "UseLosslessCompression" ) ), sal_False );
+ aCfgItem.ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Quality" ) ), 90 );
+ aCfgItem.ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "ReduceImageResolution" ) ), sal_False );
+ aCfgItem.ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "MaxImageResolution" ) ), 300 );
+ aCfgItem.ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "UseTaggedPDF" ) ), sal_False );
+ aCfgItem.ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "SelectPdfVersion" ) ), 0 );
+ aCfgItem.ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "ExportNotes" ) ), sal_False );
+ aCfgItem.ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "ExportNotesPages" ) ), sal_False );
+ aCfgItem.ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "UseTransitionEffects" ) ), sal_True );
+ aCfgItem.ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "IsSkipEmptyPages" ) ), sal_False );
+ aCfgItem.ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "ExportFormFields" ) ), sal_True );
+ aCfgItem.ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "FormsType" ) ), 0 );
+ aCfgItem.ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "HideViewerToolbar" ) ), sal_False );
+ aCfgItem.ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "HideViewerMenubar" ) ), sal_False );
+ aCfgItem.ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "HideViewerWindowControls" ) ), sal_False );
+ aCfgItem.ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "ResizeWindowToInitialPage" ) ), sal_False );
+ aCfgItem.ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "CenterWindow" ) ), sal_False );
+ aCfgItem.ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "OpenInFullScreenMode" ) ), sal_False );
+ aCfgItem.ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "DisplayPDFDocumentTitle" ) ), sal_True );
+ aCfgItem.ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "InitialView" ) ), 0 );
+ aCfgItem.ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Magnification" ) ), 0 );
+ aCfgItem.ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "PageLayout" ) ), 0 );
+ aCfgItem.ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "FirstPageOnLeft" ) ), sal_False );
+ aCfgItem.ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "IsAddStream" ) ), sal_False );
+//
+// the encryption is not available when exporting directly, since the encryption is off by default and the selection
+// (encrypt or not) is not persistent; it's available through macro though,
+// provided the correct property values are set, see help
+//
+// now, the relative link stuff
+ aCfgItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportLinksRelativeFsys" ) ), sal_False );
+ aCfgItem.ReadInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "PDFViewSelection" ) ), 0 );
+ aCfgItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ConvertOOoTargetToPDFTarget" ) ), sal_False );
+ aCfgItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportBookmarksToPDFDestination" ) ), sal_False );
+
+ aCfgItem.ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "ExportBookmarks" ) ), sal_True );
+ aCfgItem.ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "OpenBookmarkLevels" ) ), -1 );
+ aFilterData = aCfgItem.GetFilterData();
+ }
+ if( mxSrcDoc.is() && xOStm.is() )
+ {
+ PDFExport aExport( mxSrcDoc, xStatusIndicator, mxMSF );
+ ::utl::TempFile aTempFile;
+
+ aTempFile.EnableKillingFile();
+ bRet = aExport.Export( aTempFile.GetURL(), aFilterData );
+
+ if( bRet )
+ {
+ SvStream* pIStm = ::utl::UcbStreamHelper::CreateStream( aTempFile.GetURL(), STREAM_READ );
+
+ if( pIStm )
+ {
+ SvOutputStream aOStm( xOStm );
+
+ aOStm << *pIStm;
+ bRet = ( aOStm.Tell() && ( aOStm.GetError() == ERRCODE_NONE ) );
+
+ delete pIStm;
+ }
+ }
+ }
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+class FocusWindowWaitCursor
+{
+ Window* m_pFocusWindow;
+ public:
+ FocusWindowWaitCursor() :
+ m_pFocusWindow( Application::GetFocusWindow() )
+ {
+ if( m_pFocusWindow )
+ {
+ m_pFocusWindow->AddEventListener( LINK( this, FocusWindowWaitCursor, DestroyedLink ) );
+ m_pFocusWindow->EnterWait();
+ }
+ }
+ ~FocusWindowWaitCursor()
+ {
+ if( m_pFocusWindow )
+ {
+ m_pFocusWindow->LeaveWait();
+ m_pFocusWindow->RemoveEventListener( LINK( this, FocusWindowWaitCursor, DestroyedLink ) );
+ }
+ }
+
+ DECL_LINK( DestroyedLink, VclWindowEvent* );
+};
+
+IMPL_LINK( FocusWindowWaitCursor, DestroyedLink, VclWindowEvent*, pEvent )
+{
+ if( pEvent->GetId() == VCLEVENT_OBJECT_DYING )
+ m_pFocusWindow = NULL;
+ return 0;
+}
+
+sal_Bool SAL_CALL PDFFilter::filter( const Sequence< PropertyValue >& rDescriptor )
+ throw (RuntimeException)
+{
+ FocusWindowWaitCursor aCur;
+
+ const sal_Bool bRet = implExport( rDescriptor );
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL PDFFilter::cancel( ) throw (RuntimeException)
+{
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL PDFFilter::setSourceDocument( const Reference< XComponent >& xDoc )
+ throw (IllegalArgumentException, RuntimeException)
+{
+ mxSrcDoc = xDoc;
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL PDFFilter::initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& )
+ throw (Exception, RuntimeException)
+{
+}
+
+// -----------------------------------------------------------------------------
+
+OUString PDFFilter_getImplementationName ()
+ throw (RuntimeException)
+{
+ return OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.PDF.PDFFilter" ) );
+}
+
+// -----------------------------------------------------------------------------
+
+#define SERVICE_NAME "com.sun.star.document.PDFFilter"
+
+sal_Bool SAL_CALL PDFFilter_supportsService( const OUString& ServiceName )
+ throw (RuntimeException)
+{
+ return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SERVICE_NAME ) );
+}
+
+// -----------------------------------------------------------------------------
+
+Sequence< OUString > SAL_CALL PDFFilter_getSupportedServiceNames( ) throw (RuntimeException)
+{
+ Sequence < OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME ) );
+ return aRet;
+}
+
+#undef SERVICE_NAME
+
+// -----------------------------------------------------------------------------
+
+Reference< XInterface > SAL_CALL PDFFilter_createInstance( const Reference< XMultiServiceFactory > & rSMgr) throw( Exception )
+{
+ return (cppu::OWeakObject*) new PDFFilter( rSMgr );
+}
+
+// -----------------------------------------------------------------------------
+
+OUString SAL_CALL PDFFilter::getImplementationName()
+ throw (RuntimeException)
+{
+ return PDFFilter_getImplementationName();
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SAL_CALL PDFFilter::supportsService( const OUString& rServiceName )
+ throw (RuntimeException)
+{
+ return PDFFilter_supportsService( rServiceName );
+}
+
+// -----------------------------------------------------------------------------
+
+::com::sun::star::uno::Sequence< OUString > SAL_CALL PDFFilter::getSupportedServiceNames( ) throw (RuntimeException)
+{
+ return PDFFilter_getSupportedServiceNames();
+}
diff --git a/filter/source/pdf/pdffilter.hxx b/filter/source/pdf/pdffilter.hxx
new file mode 100644
index 000000000000..b4720c1627c7
--- /dev/null
+++ b/filter/source/pdf/pdffilter.hxx
@@ -0,0 +1,133 @@
+/*************************************************************************
+ *
+ * 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 PDFFILTER_HXX
+#define PDFFILTER_HXX
+
+#include <com/sun/star/document/XFilter.hpp>
+#include <com/sun/star/document/XExporter.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/implbase3.hxx>
+#include <cppuhelper/implbase4.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/beans/XPropertyAccess.hpp>
+#include <comphelper/property.hxx>
+#include <com/sun/star/task/XStatusIndicator.hpp>
+
+#include <osl/diagnose.h>
+#include <rtl/process.h>
+#include <tools/debug.hxx>
+#include <comphelper/processfactory.hxx>
+#include <unotools/tempfile.hxx>
+#include <unotools/localfilehelper.hxx>
+#include <unotools/ucbstreamhelper.hxx>
+#include <unotools/streamwrap.hxx>
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::document;
+using namespace ::com::sun::star::io;
+
+// -------------
+// - PDFFilter -
+// -------------
+
+class PDFFilter : public cppu::WeakImplHelper4 < XFilter,
+ XExporter,
+ XInitialization,
+ XServiceInfo >
+{
+private:
+
+ Reference< XMultiServiceFactory > mxMSF;
+ Reference< XComponent > mxSrcDoc;
+
+ sal_Bool implExport( const Sequence< PropertyValue >& rDescriptor );
+
+protected:
+
+ // XFilter
+ virtual sal_Bool SAL_CALL filter( const Sequence< PropertyValue >& rDescriptor ) throw(RuntimeException);
+ virtual void SAL_CALL cancel( ) throw (RuntimeException);
+
+ // XExporter
+ virtual void SAL_CALL setSourceDocument( const Reference< XComponent >& xDoc ) throw(IllegalArgumentException, RuntimeException);
+
+ // XInitialization
+ virtual void SAL_CALL initialize( const Sequence< Any >& aArguments ) throw(Exception, RuntimeException);
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() throw(RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(RuntimeException);
+ virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(RuntimeException);
+
+public:
+
+ PDFFilter( const Reference< XMultiServiceFactory >& rxMSF );
+ virtual ~PDFFilter();
+};
+
+// -----------------------------------------------------------------------------
+
+OUString PDFFilter_getImplementationName ()
+ throw ( RuntimeException );
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SAL_CALL PDFFilter_supportsService( const OUString& ServiceName )
+ throw ( RuntimeException );
+
+// -----------------------------------------------------------------------------
+
+Sequence< OUString > SAL_CALL PDFFilter_getSupportedServiceNames( )
+ throw ( RuntimeException );
+
+// -----------------------------------------------------------------------------
+
+Reference< XInterface >
+SAL_CALL PDFFilter_createInstance( const Reference< XMultiServiceFactory > & rSMgr)
+ throw ( Exception );
+
+#endif // PDFFILTER_HXX
+
+
+
+
+
+
+
+
+
+
diff --git a/filter/source/pdf/pdfuno.cxx b/filter/source/pdf/pdfuno.cxx
new file mode 100644
index 000000000000..10c0f7df293d
--- /dev/null
+++ b/filter/source/pdf/pdfuno.cxx
@@ -0,0 +1,124 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include <stdio.h>
+#include <osl/mutex.hxx>
+#include <osl/thread.h>
+#include <cppuhelper/factory.hxx>
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+
+#include <pdffilter.hxx>
+#include <pdfdialog.hxx>
+
+using namespace ::rtl;
+using namespace ::cppu;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+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 sal_Bool SAL_CALL component_writeInfo( void* /*pServiceManager*/, void* pRegistryKey )
+ {
+ if (pRegistryKey)
+ {
+ try
+ {
+ Reference< XRegistryKey > xNewKey;
+ sal_Int32 nPos;
+
+ xNewKey = reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( PDFFilter_getImplementationName() );
+ xNewKey = xNewKey->createKey( OUString::createFromAscii( "/UNO/SERVICES" ) );
+ const Sequence< OUString > & rSNL1 = PDFFilter_getSupportedServiceNames();
+ const OUString * pArray1 = rSNL1.getConstArray();
+ for ( nPos = rSNL1.getLength(); nPos--; )
+ xNewKey->createKey( pArray1[nPos] );
+
+ xNewKey = reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( PDFDialog_getImplementationName() );
+ xNewKey = xNewKey->createKey( OUString::createFromAscii( "/UNO/SERVICES" ) );
+ const Sequence< OUString > & rSNL2 = PDFDialog_getSupportedServiceNames();
+ const OUString * pArray2 = rSNL2.getConstArray();
+ for ( nPos = rSNL2.getLength(); nPos--; )
+ xNewKey->createKey( pArray2[nPos] );
+
+ return sal_True;
+ }
+ catch (InvalidRegistryException &)
+ {
+ OSL_ENSURE( sal_False, "### InvalidRegistryException!" );
+ }
+ }
+ return sal_False;
+ }
+
+ // -------------------------------------------------------------------------
+
+ SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ )
+ {
+ OUString aImplName( OUString::createFromAscii( pImplName ) );
+ void* pRet = 0;
+
+ if( pServiceManager )
+ {
+ Reference< XSingleServiceFactory > xFactory;
+
+ if( aImplName.equals( PDFFilter_getImplementationName() ) )
+ {
+ xFactory = createSingleFactory( reinterpret_cast< XMultiServiceFactory* >( pServiceManager ),
+ OUString::createFromAscii( pImplName ),
+ PDFFilter_createInstance, PDFFilter_getSupportedServiceNames() );
+
+ }
+ else if( aImplName.equals( PDFDialog_getImplementationName() ) )
+ {
+ xFactory = createSingleFactory( reinterpret_cast< XMultiServiceFactory* >( pServiceManager ),
+ OUString::createFromAscii( pImplName ),
+ PDFDialog_createInstance, PDFDialog_getSupportedServiceNames() );
+
+ }
+
+ if( xFactory.is() )
+ {
+ xFactory->acquire();
+ pRet = xFactory.get();
+ }
+ }
+
+ return pRet;
+ }
+}
diff --git a/filter/source/placeware/Base64Codec.cxx b/filter/source/placeware/Base64Codec.cxx
new file mode 100644
index 000000000000..624be24dc256
--- /dev/null
+++ b/filter/source/placeware/Base64Codec.cxx
@@ -0,0 +1,207 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+#include "Base64Codec.hxx"
+#include <rtl/ustrbuf.hxx>
+#include <osl/diagnose.h>
+using namespace rtl;
+using namespace osl;
+using namespace com::sun::star;
+
+const
+ sal_Char aBase64EncodeTable[] =
+ { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
+ 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
+ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
+ 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/' };
+
+const
+ sal_uInt8 aBase64DecodeTable[] =
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0-15
+
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 16-31
+
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 62, 0, 0, 0, 63, // 32-47
+// + /
+
+ 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 0, 0, 0, 0, 0, 0, // 48-63
+// 0 1 2 3 4 5 6 7 8 9 =
+
+ 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, // 64-79
+// A B C D E F G H I J K L M N O
+
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 0, 0, 0, 0, 0, // 80-95
+// P Q R S T U V W X Y Z
+
+ 0, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, // 96-111
+// a b c d e f g h i j k l m n o
+
+ 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 0, 0, 0, 0, 0, // 112-127
+// p q r s t u v w x y z
+
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+
+
+void ThreeByteToFourByte (const sal_uInt8* pBuffer, const sal_Int32 nStart, const sal_Int32 nFullLen, rtl::OUStringBuffer& sBuffer)
+{
+ sal_Int32 nLen(nFullLen - nStart);
+ if (nLen > 3)
+ nLen = 3;
+ if (nLen == 0)
+ {
+ sBuffer.setLength(0);
+ return;
+ }
+
+ sal_Int32 nBinaer;
+ switch (nLen)
+ {
+ case 1:
+ {
+ nBinaer = ((sal_uInt8)pBuffer[nStart + 0]) << 16;
+ }
+ break;
+ case 2:
+ {
+ nBinaer = (((sal_uInt8)pBuffer[nStart + 0]) << 16) +
+ (((sal_uInt8)pBuffer[nStart + 1]) << 8);
+ }
+ break;
+ default:
+ {
+ nBinaer = (((sal_uInt8)pBuffer[nStart + 0]) << 16) +
+ (((sal_uInt8)pBuffer[nStart + 1]) << 8) +
+ ((sal_uInt8)pBuffer[nStart + 2]);
+ }
+ break;
+ }
+
+ sBuffer.appendAscii("====");
+
+ sal_uInt8 nIndex = static_cast< sal_uInt8 >((nBinaer & 0xFC0000) >> 18);
+ sBuffer.setCharAt(0, aBase64EncodeTable [nIndex]);
+
+ nIndex = static_cast< sal_uInt8 >((nBinaer & 0x3F000) >> 12);
+ sBuffer.setCharAt(1, aBase64EncodeTable [nIndex]);
+ if (nLen == 1)
+ return;
+
+ nIndex = static_cast< sal_uInt8 >((nBinaer & 0xFC0) >> 6);
+ sBuffer.setCharAt(2, aBase64EncodeTable [nIndex]);
+ if (nLen == 2)
+ return;
+
+ nIndex = static_cast< sal_uInt8 >((nBinaer & 0x3F));
+ sBuffer.setCharAt(3, aBase64EncodeTable [nIndex]);
+}
+
+void Base64Codec::encodeBase64(rtl::OUStringBuffer& aStrBuffer, const uno::Sequence < sal_Int8 >& aPass)
+{
+ sal_Int32 i(0);
+ sal_Int32 nBufferLength(aPass.getLength());
+ const sal_Int8* pBuffer = aPass.getConstArray();
+ while (i < nBufferLength)
+ {
+ rtl::OUStringBuffer sBuffer;
+ ThreeByteToFourByte ((const sal_uInt8*)pBuffer, i, nBufferLength, sBuffer);
+ aStrBuffer.append(sBuffer);
+ i += 3;
+ }
+}
+
+const rtl::OUString s2equal(RTL_CONSTASCII_USTRINGPARAM("=="));
+const rtl::OUString s1equal(RTL_CONSTASCII_USTRINGPARAM("="));
+#if 0
+void FourByteToThreeByte (sal_uInt8* pBuffer, sal_Int32& nLength, const sal_Int32 nStart, const rtl::OUString& sString)
+{
+ nLength = 0;
+ sal_Int32 nLen (sString.getLength());
+
+ if (nLen != 4)
+ {
+ return;
+ }
+
+
+ if (sString.indexOf(s2equal) == 2)
+ nLength = 1;
+ else if (sString.indexOf(s1equal) == 3)
+ nLength = 2;
+ else
+ nLength = 3;
+
+ sal_Int32 nBinaer ((aBase64DecodeTable [sString [0]] << 18) +
+ (aBase64DecodeTable [sString [1]] << 12) +
+ (aBase64DecodeTable [sString [2]] << 6) +
+ (aBase64DecodeTable [sString [3]]));
+
+ sal_uInt8 OneByte = static_cast< sal_uInt8 >((nBinaer & 0xFF0000) >> 16);
+ pBuffer[nStart + 0] = (sal_uInt8)OneByte;
+
+ if (nLength == 1)
+ return;
+
+ OneByte = static_cast< sal_uInt8 >((nBinaer & 0xFF00) >> 8);
+ pBuffer[nStart + 1] = (sal_uInt8)OneByte;
+
+ if (nLength == 2)
+ return;
+
+ OneByte = static_cast< sal_uInt8 >(nBinaer & 0xFF);
+ pBuffer[nStart + 2] = (sal_uInt8)OneByte;
+}
+
+void Base64Codec::decodeBase64(uno::Sequence< sal_uInt8 >& aBuffer, const rtl::OUString& sBuffer)
+{
+ sal_Int32 nFirstLength((sBuffer.getLength() / 4) * 3);
+ sal_uInt8* pBuffer = new sal_uInt8[nFirstLength];
+ sal_Int32 nSecondLength(0);
+ sal_Int32 nLength(0);
+ sal_Int32 i = 0;
+ sal_Int32 k = 0;
+ while (i < sBuffer.getLength())
+ {
+ FourByteToThreeByte (pBuffer, nLength, k, sBuffer.copy(i, 4));
+ nSecondLength += nLength;
+ nLength = 0;
+ i += 4;
+ k += 3;
+ }
+ aBuffer = uno::Sequence<sal_uInt8>(pBuffer, nSecondLength);
+ delete[] pBuffer;
+}
+#endif
diff --git a/filter/source/placeware/Base64Codec.hxx b/filter/source/placeware/Base64Codec.hxx
new file mode 100644
index 000000000000..125b944876a9
--- /dev/null
+++ b/filter/source/placeware/Base64Codec.hxx
@@ -0,0 +1,47 @@
+/*************************************************************************
+ *
+ * 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 _BASE64_CODEC_HXX
+#define _BASE64_CODEC_HXX
+
+#include <com/sun/star/uno/Sequence.hxx>
+
+namespace rtl
+{
+class OUString;
+class OUStringBuffer;
+}
+
+class Base64Codec
+{
+public:
+ static void encodeBase64(rtl::OUStringBuffer& aStrBuffer, const com::sun::star::uno::Sequence<sal_Int8>& aPass);
+#if 0
+ static void decodeBase64(com::sun::star::uno::Sequence<sal_uInt8>& aPass, const rtl::OUString& sBuffer);
+#endif
+};
+#endif
diff --git a/filter/source/placeware/exporter.cxx b/filter/source/placeware/exporter.cxx
new file mode 100644
index 000000000000..964bc618af5d
--- /dev/null
+++ b/filter/source/placeware/exporter.cxx
@@ -0,0 +1,516 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
+#ifndef _COM_SUN_STAR_PRESENTATION_PRESENTATIONPAGE_HPP_
+#include <com/sun/star/presentation/XPresentationPage.hpp>
+#endif
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/document/XFilter.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/task/XStatusIndicatorFactory.hpp>
+#include <rtl/ustrbuf.hxx>
+#include <rtl/string.hxx>
+#include <osl/diagnose.h>
+
+#include <vector>
+
+#include "exporter.hxx"
+#include "Base64Codec.hxx"
+#include "zip.hxx"
+#include "tempfile.hxx"
+
+using rtl::OUString;
+using rtl::OString;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::document;
+using namespace ::com::sun::star::io;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::text;
+using namespace ::std;
+
+using com::sun::star::beans::PropertyValue;
+using com::sun::star::beans::XPropertySet;
+using com::sun::star::presentation::XPresentationPage;
+using com::sun::star::task::XStatusIndicator;
+
+// -----------------------------------------------------------------------------
+
+PlaceWareExporter::PlaceWareExporter(const Reference< XMultiServiceFactory > &rxMSF)
+: mxMSF( rxMSF )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+PlaceWareExporter::~PlaceWareExporter()
+{
+}
+
+// -----------------------------------------------------------------------------
+class PageEntry
+{
+private:
+ TempFile maTempFile;
+ rtl::OUString maName;
+ rtl::OUString maTitle;
+ rtl::OUString maNotes;
+ rtl::OUString maURL;
+
+public:
+ PageEntry();
+ ~PageEntry();
+
+ OUString getTempURL() { return maTempFile.getFileURL(); }
+
+ void setName( const rtl::OUString& rName ) { maName = rName; }
+ const rtl::OUString& getName() const { return maName; }
+
+ void setTitle( const rtl::OUString& rTitle ) { maTitle = rTitle; }
+ const rtl::OUString& getTitle() const { return maTitle; }
+
+ void setNotes( const rtl::OUString& rNotes ) { maNotes = rNotes; }
+ const rtl::OUString& getNotes() const { return maNotes; }
+
+ void setURL( const rtl::OUString& rURL ) { maURL = rURL; }
+ const rtl::OUString& getURL() const { return maURL; }
+};
+
+PageEntry::PageEntry()
+: maTempFile( TempFile::createTempFileURL() )
+{
+}
+
+PageEntry::~PageEntry()
+{
+}
+
+
+static void encodeFile( osl::File& rSourceFile, Reference< XOutputStream >& xOutputStream ) throw( ::com::sun::star::uno::Exception )
+{
+ if( xOutputStream.is() )
+ {
+ sal_uInt64 nTemp( 0 );
+
+ osl::File::RC nRC = rSourceFile.setPos( osl_Pos_End, 0 );
+ if( osl::File::E_None == nRC )
+ {
+ nRC = rSourceFile.getPos( nTemp );
+ if( osl::File::E_None == nRC )
+ {
+ nRC = rSourceFile.setPos( osl_Pos_Absolut, 0 );
+ }
+ }
+
+ sal_Int32 nLen = static_cast<sal_Int32>(nTemp);
+
+ if( osl::File::E_None != nRC )
+ throw IOException();
+
+ sal_Int32 nBufferSize = 3*1024; // !!! buffer size must be a factor of 3 for base64 to work
+ Sequence< sal_Int8 > aInBuffer( nBufferSize < nLen ? nBufferSize : nLen );
+ void* pInBuffer = aInBuffer.getArray();
+
+ Sequence< sal_Int8 > aOutBuffer;
+ sal_Int32 nRead;
+ while( nLen )
+ {
+ nRC = rSourceFile.read( pInBuffer, aInBuffer.getLength(), nTemp );
+
+ if( (nRC != osl::File::E_None) || (0 == nTemp) )
+ throw IOException();
+
+ nRead = static_cast<sal_Int32>( nTemp );
+
+ if( nRead < aInBuffer.getLength() )
+ {
+ aInBuffer.realloc( nRead );
+ pInBuffer = aInBuffer.getArray();
+ }
+
+ nLen -= nRead;
+
+ rtl::OUStringBuffer aStrBuffer;
+ Base64Codec::encodeBase64( aStrBuffer, aInBuffer );
+
+ sal_Int32 nCount = aStrBuffer.getLength();
+
+ if( aOutBuffer.getLength() != nCount )
+ aOutBuffer.realloc( nCount );
+
+ sal_Int8* pBytes = aOutBuffer.getArray();
+ const sal_Unicode* pUnicode = aStrBuffer.getStr();
+
+ while( nCount-- )
+ {
+ // since base64 is always ascii, we can cast safely
+ *pBytes++ = static_cast<sal_Int8>(*pUnicode++);
+ }
+
+ xOutputStream->writeBytes( aOutBuffer );
+ }
+ }
+}
+
+static OString convertString( OUString aInput )
+{
+ OString aRet( aInput.getStr(), aInput.getLength(), RTL_TEXTENCODING_ASCII_US );
+ aRet = aRet.replace( '\r', ' ' );
+ aRet = aRet.replace( '\n', ' ' );
+
+ return aRet;
+}
+
+static void createSlideFile( Reference< XComponent > xDoc, ZipFile& rZipFile, const rtl::OUString& rURL, vector< PageEntry* >& rPageEntries ) throw( ::com::sun::star::uno::Exception )
+{
+ OString aInfo;
+
+ const OString aNewLine( "\r\n" );
+ OUString aTemp;
+
+ Reference< XDocumentPropertiesSupplier > xDPS( xDoc, UNO_QUERY );
+ Reference< XDocumentProperties > xDocProps( xDPS->getDocumentProperties() );
+
+ aTemp = xDocProps->getTitle();
+ if( 0 == aTemp.getLength() )
+ {
+ sal_Int32 nPos1 = rURL.lastIndexOf( (sal_Unicode)'/' );
+ if( -1 != nPos1 )
+ {
+ sal_Int32 nPos2 = rURL.lastIndexOf( (sal_Unicode)'.' );
+ if( nPos2 > nPos1 )
+ {
+ aTemp = rURL.copy( nPos1 + 1, nPos2 - nPos1 - 1 );
+ }
+ else
+ {
+ aTemp = rURL.copy( nPos1 + 1 );
+ }
+ }
+ else
+ {
+ aTemp = rURL;
+ }
+ }
+
+ aInfo += OString( "SlideSetName: " );
+ aInfo += convertString( aTemp );
+ aInfo += aNewLine;
+
+ aTemp = xDocProps->getAuthor();
+
+ if( aTemp.getLength() )
+ {
+ aInfo += OString( "PresenterName: " );
+ aInfo += convertString( aTemp );
+ aInfo += aNewLine;
+ }
+
+ vector< PageEntry* >::iterator aIter( rPageEntries.begin() );
+ vector< PageEntry* >::iterator aEnd( rPageEntries.end() );
+ while( aIter != aEnd )
+ {
+ PageEntry* pEntry = (*aIter++);
+
+ aInfo += OString( "slide: " );
+ if( pEntry->getTitle().getLength() )
+ {
+ aInfo += convertString( pEntry->getTitle() );
+ }
+ else
+ {
+ aInfo += convertString( pEntry->getName() );
+ }
+ aInfo += aNewLine;
+
+ aInfo += OString( "type: gif");
+ aInfo += aNewLine;
+
+ aInfo += OString( "url: " );
+ aInfo += convertString( pEntry->getURL() );
+ aInfo += aNewLine;
+
+
+ if( pEntry->getNotes().getLength() )
+ {
+ aInfo += OString( "notes: " );
+ aInfo += convertString( pEntry->getNotes() );
+ aInfo += aNewLine;
+ }
+ }
+
+ TempFile aInfoFile( TempFile::createTempFileURL() );
+
+ osl::File::RC nRC;
+ sal_uInt64 nTemp;
+
+ nRC = aInfoFile.open( OpenFlag_Write );
+ if( osl::File::E_None == nRC )
+ {
+ nRC = aInfoFile.write( aInfo.getStr(), aInfo.getLength(), nTemp );
+ if( osl::File::E_None == nRC )
+ {
+ nRC = aInfoFile.setPos( osl_Pos_Absolut, 0 );
+ if( osl::File::E_None == nRC )
+ {
+ nRC = aInfoFile.close();
+ }
+ }
+ }
+
+ if( (osl::File::E_None != nRC) || !rZipFile.addFile( aInfoFile, OString( RTL_CONSTASCII_STRINGPARAM("slides.txt") ) ))
+ throw IOException();
+}
+
+//#define PLACEWARE_DEBUG 1
+
+sal_Bool PlaceWareExporter::doExport( Reference< XComponent > xDoc, Reference < XOutputStream > xOutputStream,
+ const rtl::OUString& rURL, Reference < XInterface > /* xHandler */, Reference < XStatusIndicator >& xStatusIndicator )
+{
+ sal_Bool bRet = sal_False;
+
+ mxGraphicExporter = Reference< XExporter >::query( mxMSF->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.GraphicExportFilter") ) ) );
+ Reference< XDrawPagesSupplier > xDrawPagesSupplier(xDoc, UNO_QUERY);
+ if(!xDrawPagesSupplier.is())
+ return sal_False;
+
+ Reference< XIndexAccess > xDrawPages( xDrawPagesSupplier->getDrawPages(), UNO_QUERY );
+ if(!xDrawPages.is())
+ return sal_False;
+
+ if(xStatusIndicator.is())
+ {
+ xStatusIndicator->start(OUString( RTL_CONSTASCII_USTRINGPARAM( "PlaceWare:" )),xDrawPages->getCount());
+ }
+
+ Reference< XDrawPage > xDrawPage;
+
+ osl::File::RC nRC;
+
+#ifndef PLACEWARE_DEBUG
+ TempFile aTempFile( TempFile::createTempFileURL() );
+ nRC = aTempFile.open( osl_File_OpenFlag_Write|osl_File_OpenFlag_Read );
+ OUString aURL( aTempFile.getFileURL() );
+#else
+ OUString aURL( RTL_CONSTASCII_USTRINGPARAM("file:///e:/test.zip") );
+ osl::File::remove( aURL );
+ osl::File aTempFile( aURL );
+ nRC = aTempFile.open( osl_File_OpenFlag_Create|osl_File_OpenFlag_Write|osl_File_OpenFlag_Read );
+#endif
+
+ if( osl::File::E_None != nRC )
+ return sal_False;
+
+ vector< PageEntry* > aPageEntries;
+
+ // Create new package...
+ try
+ {
+ ZipFile aZipFile(aTempFile);
+
+ // export slides as gifs and collect information for slides
+
+ const sal_Int32 nPageCount = xDrawPages->getCount();
+ sal_Int32 nPage;
+
+ for( nPage = 0; nPage < nPageCount; nPage++)
+ {
+ xDrawPages->getByIndex(nPage) >>= xDrawPage;
+
+ if( !xDrawPage.is() )
+ continue;
+
+ PageEntry* pEntry = exportPage( xDrawPage );
+ aPageEntries.push_back( pEntry );
+
+ OUString aName( RTL_CONSTASCII_USTRINGPARAM("i") );
+ aName += OUString::valueOf( nPage );
+ aName += OUString( RTL_CONSTASCII_USTRINGPARAM(".gif") );
+ pEntry->setURL( aName );
+
+ if(xStatusIndicator.is())
+ {
+ xStatusIndicator->setValue( nPage + 1 );
+ }
+ }
+
+ // create the slide.txt file
+
+ createSlideFile( xDoc, aZipFile, rURL, aPageEntries );
+
+ // add gifs to zip
+ vector< PageEntry* >::iterator aIter( aPageEntries.begin() );
+ vector< PageEntry* >::iterator aEnd( aPageEntries.end() );
+ while( aIter != aEnd )
+ {
+ PageEntry* pEntry = (*aIter++);
+
+ osl::File aFile(pEntry->getTempURL() );
+ const OUString aTemp( pEntry->getURL() );
+
+ if( (osl::File::E_None != nRC) || !aZipFile.addFile( aFile, OString( aTemp.getStr(), aTemp.getLength(), RTL_TEXTENCODING_ASCII_US ) ) )
+ throw IOException();
+ }
+
+ if(!aZipFile.close())
+ throw IOException();
+
+ encodeFile( aTempFile, xOutputStream );
+
+ bRet = sal_True;
+ }
+ catch ( RuntimeException const & )
+ {
+ }
+ catch ( Exception const & )
+ {
+ }
+
+ vector< PageEntry* >::iterator aIter( aPageEntries.begin() );
+ vector< PageEntry* >::iterator aEnd( aPageEntries.end() );
+ while( aIter != aEnd )
+ {
+ delete (*aIter++);
+ }
+
+ if( xStatusIndicator.is() )
+ xStatusIndicator->end();
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+PageEntry* PlaceWareExporter::exportPage( Reference< XDrawPage >&xDrawPage )
+{
+ Reference< XComponent > xComp( xDrawPage, UNO_QUERY );
+
+ PageEntry* pEntry = new PageEntry();
+
+ // get page name
+ Reference< XNamed > xNamed( xDrawPage, UNO_QUERY );
+ if( xNamed.is() )
+ pEntry->setName( xNamed->getName() );
+
+ // get title text from title presentation shape if available
+ const OUString szTitleTextShape( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.TitleTextShape") );
+ const OUString szIsEmptyPresObj( RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") );
+
+ sal_Int32 nShapeCount = xDrawPage->getCount();
+ sal_Int32 nShape;
+ for( nShape = 0; nShape < nShapeCount; nShape++ )
+ {
+ Reference< XShape > xShape;
+ xDrawPage->getByIndex( nShape ) >>= xShape;
+
+ if( xShape.is() && xShape->getShapeType() == szTitleTextShape )
+ {
+ Reference< XPropertySet > xPropSet( xShape, UNO_QUERY );
+ if( xPropSet.is() )
+ {
+ sal_Bool bIsEmpty = true;
+ xPropSet->getPropertyValue( szIsEmptyPresObj ) >>= bIsEmpty;
+
+ if( !bIsEmpty )
+ {
+ Reference< XText > xText( xShape, UNO_QUERY );
+ if( xText.is() )
+ {
+ pEntry->setTitle( xText->getString() );
+ }
+ }
+ }
+ break;
+ }
+ }
+
+ // get notes text if available
+ Reference< XPresentationPage > xPresPage( xDrawPage, UNO_QUERY );
+ if( xPresPage.is() )
+ {
+ Reference< XDrawPage > xNotesPage( xPresPage->getNotesPage() );
+
+ const OUString szNotesShape( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.NotesShape") );
+
+ nShapeCount = xNotesPage->getCount();
+ for( nShape = 0; nShape < nShapeCount; nShape++ )
+ {
+ Reference< XShape > xShape;
+ xNotesPage->getByIndex( nShape ) >>= xShape;
+
+ if( xShape.is() && (xShape->getShapeType() == szNotesShape) )
+ {
+ Reference< XPropertySet > xPropSet( xShape, UNO_QUERY );
+ if( xPropSet.is() )
+ {
+ sal_Bool bIsEmpty = true;
+ xPropSet->getPropertyValue( szIsEmptyPresObj ) >>= bIsEmpty;
+
+ if( !bIsEmpty )
+ {
+ Reference< XText > xText( xShape, UNO_QUERY );
+ if( xText.is() )
+ {
+ pEntry->setNotes( xText->getString() );
+ }
+ }
+ }
+ break;
+ }
+ }
+ }
+
+ // create the gif
+ Reference< XFilter > xFilter( mxGraphicExporter, UNO_QUERY );
+
+ Sequence< PropertyValue > aFilterData( 2 );
+ aFilterData[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM("Width") );
+ aFilterData[0].Value <<= (sal_Int32)704;
+ aFilterData[1].Name = OUString( RTL_CONSTASCII_USTRINGPARAM("Translucent") );
+ aFilterData[1].Value <<= (sal_Bool)sal_False;
+
+ Sequence< PropertyValue > aDescriptor( 3 );
+ aDescriptor[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM("FilterName") );
+ aDescriptor[0].Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM("GIF") );
+ aDescriptor[1].Name = OUString( RTL_CONSTASCII_USTRINGPARAM("URL") );
+ aDescriptor[1].Value <<= OUString( pEntry->getTempURL() );
+ aDescriptor[2].Name = OUString( RTL_CONSTASCII_USTRINGPARAM("FilterData") );
+ aDescriptor[2].Value <<= aFilterData;
+ mxGraphicExporter->setSourceDocument( xComp );
+ xFilter->filter( aDescriptor );
+
+ return pEntry;
+}
diff --git a/filter/source/placeware/exporter.hxx b/filter/source/placeware/exporter.hxx
new file mode 100644
index 000000000000..d52519cfcb4e
--- /dev/null
+++ b/filter/source/placeware/exporter.hxx
@@ -0,0 +1,60 @@
+/*************************************************************************
+ *
+ * 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 _PLACEWARE_EXPORTER_HXX
+#define _PLACEWARE_EXPORTER_HXX
+
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/document/XExporter.hpp>
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <com/sun/star/task/XInteractionHandler.hpp>
+#include <com/sun/star/task/XStatusIndicator.hpp>
+
+class PageEntry;
+
+class PlaceWareExporter
+{
+public:
+ PlaceWareExporter( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxMSF );
+ ~PlaceWareExporter();
+
+ sal_Bool doExport( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > xDoc,
+ ::com::sun::star::uno::Reference < ::com::sun::star::io::XOutputStream > xOutputStream,
+ const rtl::OUString& rURL,
+ ::com::sun::star::uno::Reference < ::com::sun::star::uno::XInterface > xHandler,
+ ::com::sun::star::uno::Reference < ::com::sun::star::task::XStatusIndicator >& rxStatusIndicator );
+
+private:
+ PageEntry* exportPage( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >&xDrawPage );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF;
+ ::com::sun::star::uno::Reference< ::com::sun::star::document::XExporter > mxGraphicExporter;
+ ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler > mxInteractionHandler;
+};
+
+#endif
diff --git a/filter/source/placeware/exports.dxp b/filter/source/placeware/exports.dxp
new file mode 100644
index 000000000000..9630d7e06768
--- /dev/null
+++ b/filter/source/placeware/exports.dxp
@@ -0,0 +1,3 @@
+component_getImplementationEnvironment
+component_writeInfo
+component_getFactory
diff --git a/filter/source/placeware/filter.cxx b/filter/source/placeware/filter.cxx
new file mode 100644
index 000000000000..b38927d793d6
--- /dev/null
+++ b/filter/source/placeware/filter.cxx
@@ -0,0 +1,217 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+#include <com/sun/star/document/XFilter.hpp>
+#include <com/sun/star/document/XExporter.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <cppuhelper/implbase4.hxx>
+
+#include "exporter.hxx"
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+
+using ::rtl::OUString;
+using ::com::sun::star::lang::XComponent;
+using ::com::sun::star::beans::PropertyValue;
+using ::com::sun::star::io::XOutputStream;
+using ::com::sun::star::task::XStatusIndicator;
+
+namespace pwp {
+
+// -----------------------------------------------------------------------------
+
+class PlaceWareExportFilter : public cppu::WeakImplHelper4
+<
+ com::sun::star::document::XFilter,
+ com::sun::star::document::XExporter,
+ com::sun::star::lang::XInitialization,
+ com::sun::star::lang::XServiceInfo
+>
+{
+ Reference< XComponent > mxDoc;
+ Reference< XMultiServiceFactory > mxMSF;
+
+public:
+ PlaceWareExportFilter( const Reference< XMultiServiceFactory > &rxMSF);
+
+ // XFilter
+ virtual sal_Bool SAL_CALL filter( const Sequence< PropertyValue >& aDescriptor ) throw(RuntimeException);
+ virtual void SAL_CALL cancel( ) throw (RuntimeException);
+
+ // XExporter
+ virtual void SAL_CALL setSourceDocument( const Reference< XComponent >& xDoc ) throw(IllegalArgumentException, RuntimeException);
+
+ // XInitialization
+ virtual void SAL_CALL initialize( const Sequence< Any >& aArguments ) throw(Exception, RuntimeException);
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() throw(RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(RuntimeException);
+ virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(RuntimeException);
+};
+
+// -----------------------------------------------------------------------------
+
+PlaceWareExportFilter::PlaceWareExportFilter(const Reference< XMultiServiceFactory > &rxMSF)
+: mxMSF( rxMSF )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SAL_CALL PlaceWareExportFilter::filter( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor )
+ throw (RuntimeException)
+{
+ sal_Int32 nLength = aDescriptor.getLength();
+ const PropertyValue * pValue = aDescriptor.getConstArray();
+ OUString sFileName, sURL;
+ Reference < XInterface > xInteractionHandler;
+ Reference < XOutputStream > xOutputStream;
+ Reference < XStatusIndicator > xStatusIndicator;
+ for ( sal_Int32 i = 0 ; i < nLength; i++)
+ {
+ if ( pValue[i].Name.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "OutputStream" ) ) )
+ {
+ pValue[i].Value >>= xOutputStream;
+ }
+ else if( pValue[i].Name.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "URL" ) ) )
+ {
+ pValue[i].Value >>= sURL;
+ }
+ else if( pValue[i].Name.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "InteractionHandler" ) ) )
+ {
+ pValue[i].Value >>= xInteractionHandler;
+ }
+ else if ( pValue[i].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "StatusIndicator" ) ) )
+ {
+ pValue[i].Value >>= xStatusIndicator;
+ }
+ }
+ if ( !xOutputStream.is() )
+ {
+ OSL_ASSERT ( 0 );
+ return sal_False;
+ }
+
+ PlaceWareExporter aExporter( mxMSF );
+ return aExporter.doExport( mxDoc, xOutputStream, sURL, xInteractionHandler, xStatusIndicator );
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL PlaceWareExportFilter::cancel( )
+ throw (RuntimeException)
+{
+}
+
+// -----------------------------------------------------------------------------
+
+// XExporter
+void SAL_CALL PlaceWareExportFilter::setSourceDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xDoc )
+ throw (::com::sun::star::lang::IllegalArgumentException, RuntimeException)
+{
+ mxDoc = xDoc;
+}
+
+// -----------------------------------------------------------------------------
+
+// XInitialization
+void SAL_CALL PlaceWareExportFilter::initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& /* aArguments */ )
+ throw (Exception, RuntimeException)
+{
+}
+
+// -----------------------------------------------------------------------------
+
+OUString PlaceWareExportFilter_getImplementationName ()
+ throw (RuntimeException)
+{
+ return OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Impress.PlaceWareExportFilter" ) );
+}
+
+// -----------------------------------------------------------------------------
+
+#define SERVICE_NAME "com.sun.star.document.ExportFilter"
+
+sal_Bool SAL_CALL PlaceWareExportFilter_supportsService( const OUString& ServiceName )
+ throw (RuntimeException)
+{
+ return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SERVICE_NAME ) );
+}
+
+// -----------------------------------------------------------------------------
+
+Sequence< OUString > SAL_CALL PlaceWareExportFilter_getSupportedServiceNames( )
+ throw (RuntimeException)
+{
+ Sequence < OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME ) );
+ return aRet;
+}
+#undef SERVICE_NAME
+
+// -----------------------------------------------------------------------------
+
+Reference< XInterface > SAL_CALL PlaceWareExportFilter_createInstance( const Reference< XMultiServiceFactory > & rSMgr)
+ throw( Exception )
+{
+ return (cppu::OWeakObject*) new PlaceWareExportFilter( rSMgr );
+}
+
+// -----------------------------------------------------------------------------
+
+// XServiceInfo
+OUString SAL_CALL PlaceWareExportFilter::getImplementationName( )
+ throw (RuntimeException)
+{
+ return PlaceWareExportFilter_getImplementationName();
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SAL_CALL PlaceWareExportFilter::supportsService( const OUString& rServiceName )
+ throw (RuntimeException)
+{
+ return PlaceWareExportFilter_supportsService( rServiceName );
+}
+
+// -----------------------------------------------------------------------------
+
+::com::sun::star::uno::Sequence< OUString > SAL_CALL PlaceWareExportFilter::getSupportedServiceNames( )
+ throw (RuntimeException)
+{
+ return PlaceWareExportFilter_getSupportedServiceNames();
+}
+
+// -----------------------------------------------------------------------------
+
+}
diff --git a/filter/source/placeware/makefile.mk b/filter/source/placeware/makefile.mk
new file mode 100644
index 000000000000..3238193c52ae
--- /dev/null
+++ b/filter/source/placeware/makefile.mk
@@ -0,0 +1,67 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ=..$/..
+PRJNAME=filter
+TARGET=placeware
+USE_DEFFILE= TRUE
+ENABLE_EXCEPTIONS=TRUE
+COMP1TYPELIST=$(TARGET)
+
+# --- Settings ----------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Files -------------------------------------
+
+SLOFILES= $(SLO)$/zip.obj \
+ $(SLO)$/filter.obj \
+ $(SLO)$/uno.obj \
+ $(SLO)$/exporter.obj \
+ $(SLO)$/Base64Codec.obj \
+ $(SLO)$/tempfile.obj
+
+# --- Library -----------------------------------
+
+SHL1TARGET=$(TARGET)$(DLLPOSTFIX)
+
+SHL1STDLIBS= \
+ $(CPPULIB) \
+ $(CPPUHELPERLIB) \
+ $(SALLIB)
+SHL1VERSIONMAP=$(SOLARENV)/src/component.map
+
+SHL1DEPN=
+SHL1IMPLIB= i$(TARGET)
+SHL1LIBS= $(SLB)$/$(TARGET).lib
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+
+DEF1NAME= $(SHL1TARGET)
+
+# --- Targets ----------------------------------
+
+.INCLUDE : target.mk
diff --git a/filter/source/placeware/placeware.xml b/filter/source/placeware/placeware.xml
new file mode 100644
index 000000000000..472abd18617f
--- /dev/null
+++ b/filter/source/placeware/placeware.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE module-description PUBLIC "-//StarOffice//DTD ComponentDescription 1.0//EN" "module-description.dtd">
+<module-description xmlns:xlink="http://www.w3.org/1999/xlink">
+ <module-name> placeware </module-name>
+ <component-description>
+ <author> Christian Lippka </author>
+ <name> com.sun.star.comp.Impress.PlaceWareExportFilter </name>
+ <description>
+ This service implements a filter to export com.sun.star.presentation.PresentationDocument into the
+ PlaceWare slide set format.
+ </description>
+ <loader-name> com.sun.star.loader.SharedLibrary </loader-name>
+ <language> C++ </language>
+ <status value="beta"/>
+ <supported-service> com.sun.star.document.ExportFilter </supported-service>
+ <service-dependency> ... </service-dependency>
+ <type> com.sun.star.document.XFilter </type>
+ <type> com.sun.star.document.XExporter </type>
+ <type> com.sun.star.lang.XInitialization </type>
+ <type> com.sun.star.lang.XServiceInfo </type>
+ <type> com.sun.star.container.XNamed </type>
+ <type> com.sun.star.beans.PropertyValue </type>
+ <type> com.sun.star.beans.XPropertySet </type>
+ <type> com.sun.star.drawing.XDrawPagesSupplier </type>
+ <type> com.sun.star.presentation.XPresentationPage </type>
+ <type> com.sun.star.container.XIndexAccess </type>
+ <type> com.sun.star.text.XText </type>
+ <type> com.sun.star.document.XDocumentPropertiesSupplier </type>
+ <type> com.sun.star.document.XDocumentProperties </type>
+ <type> com.sun.star.lang.XComponent </type>
+ <type> com.sun.star.drawing.XDrawPage </type>
+ <type> com.sun.star.task.XInteractionHandler </type>
+ <type> com.sun.star.lang.XSingleServiceFactory </type>
+ <type> com.sun.star.uno.XAggregation </type>
+ <type> com.sun.star.uno.XWeak </type>
+ <type> com.sun.star.uno.XComponentContext </type>
+ <type> com.sun.star.uno.TypeClass </type>
+ </component-description>
+ <project-build-dependency> cppuhelper </project-build-dependency>
+ <project-build-dependency> cppu </project-build-dependency>
+ <project-build-dependency> sal </project-build-dependency>
+ <runtime-module-dependency> cppuhelper2$(COM) </runtime-module-dependency>
+ <runtime-module-dependency> cppu2 </runtime-module-dependency>
+ <runtime-module-dependency> sal2 </runtime-module-dependency>
+</module-description>
diff --git a/filter/source/placeware/tempfile.cxx b/filter/source/placeware/tempfile.cxx
new file mode 100644
index 000000000000..46c01e80d4a4
--- /dev/null
+++ b/filter/source/placeware/tempfile.cxx
@@ -0,0 +1,189 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+
+#include <osl/file.h>
+
+#if defined( UNX) || defined(OS2)
+
+#include <stdio.h>
+#include <string.h>
+#include <osl/thread.h>
+
+oslFileError SAL_CALL my_getTempDirURL( rtl_uString** pustrTempDir )
+{
+ const char *pValue = getenv( "TEMP" );
+
+ if ( !pValue )
+ {
+ pValue = getenv( "TMP" );
+#if defined(SOLARIS) || defined (LINUX)
+ if ( !pValue )
+ pValue = P_tmpdir;
+#endif
+ }
+
+ if ( pValue )
+ {
+ oslFileError error;
+ rtl_uString *ustrTempPath = NULL;
+
+ rtl_string2UString( &ustrTempPath, pValue, strlen( pValue ), osl_getThreadTextEncoding(), OSTRING_TO_OUSTRING_CVTFLAGS );
+ error = osl_getFileURLFromSystemPath( ustrTempPath, pustrTempDir );
+ rtl_uString_release( ustrTempPath );
+
+ return error;
+ }
+ else
+ return osl_File_E_NOENT;
+}
+#else
+
+#ifdef NDEBUG
+# define NO_DEBUG_CRT
+#endif
+
+#ifndef _WIN32_WINNT
+# define _WIN32_WINNT 0x0400
+# define _CTYPE_DISABLE_MACROS /* wg. dynamischer C-Runtime MH */
+#endif
+
+#if defined _MSC_VER
+#pragma warning(push, 1)
+#endif
+
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#include <malloc.h>
+
+#if defined _MSC_VER
+#pragma warning(pop)
+#endif
+
+#define elementsof(arr) (sizeof(arr)/sizeof(arr[0]))
+
+oslFileError SAL_CALL my_getTempDirURL( rtl_uString** pustrTempDir )
+{
+ WCHAR szBuffer[MAX_PATH];
+ LPWSTR lpBuffer = szBuffer;
+ DWORD nBufferLength = elementsof(szBuffer) - 1;
+
+ DWORD nLength;
+ oslFileError error;
+
+ do
+ {
+ nLength = GetTempPathW( elementsof(szBuffer), lpBuffer );
+ if ( nLength > nBufferLength )
+ {
+ nLength++;
+ lpBuffer = (LPWSTR)alloca( sizeof(WCHAR) * nLength );
+ nBufferLength = nLength - 1;
+ }
+ } while ( nLength > nBufferLength );
+
+ if ( nLength )
+ {
+ rtl_uString *ustrTempPath = NULL;
+
+ if ( '\\' == lpBuffer[nLength-1] )
+ lpBuffer[nLength-1] = 0;
+
+ rtl_uString_newFromStr( &ustrTempPath, reinterpret_cast<const sal_Unicode*>(lpBuffer) );
+
+ error = osl_getFileURLFromSystemPath( ustrTempPath, pustrTempDir );
+
+ rtl_uString_release( ustrTempPath );
+ }
+ else
+ error = GetLastError() == ERROR_SUCCESS ? osl_File_E_None : osl_File_E_INVAL;
+
+ return error;
+}
+#endif
+
+#include "tempfile.hxx"
+
+using namespace rtl;
+
+TempFile::TempFile( const OUString& rTempFileURL )
+:osl::File( rTempFileURL ), maURL( rTempFileURL )
+{
+}
+
+TempFile::~TempFile()
+{
+ close();
+
+ if( maURL.getLength() )
+ osl::File::remove( maURL );
+}
+
+OUString TempFile::createTempFileURL()
+{
+ OUString aTempFileURL;
+
+ const sal_uInt32 nRadix = 26;
+
+ OUString aTempDirURL;
+ /* oslFileError nRC = */ my_getTempDirURL( &aTempDirURL.pData );
+
+ static sal_uInt32 u = osl_getGlobalTimer();
+ for ( sal_uInt32 nOld = u; ++u != nOld; )
+ {
+ u %= (nRadix*nRadix*nRadix);
+ OUString aTmp( aTempDirURL );
+ if( aTmp.getStr()[ aTmp.getLength() - 1 ] != sal_Unicode( '/' ) )
+ aTmp += OUString( RTL_CONSTASCII_USTRINGPARAM( "/" ));
+ aTmp += OUString::valueOf( (sal_Int32) (unsigned) u, nRadix );
+ aTmp += OUString::createFromAscii( ".tmp" );
+
+ osl::File aFile( aTmp );
+ osl::FileBase::RC err = aFile.open(osl_File_OpenFlag_Create);
+ if ( err == FileBase::E_None )
+ {
+ aTempFileURL = aTmp;
+ aFile.close();
+ break;
+ }
+ else if ( err != FileBase::E_EXIST )
+ {
+ // if f.e. name contains invalid chars stop trying to create files
+ break;
+ }
+ }
+
+ return aTempFileURL;
+}
+
+OUString TempFile::getFileURL()
+{
+ return maURL;
+}
diff --git a/filter/source/placeware/tempfile.hxx b/filter/source/placeware/tempfile.hxx
new file mode 100644
index 000000000000..d1f8335b38d5
--- /dev/null
+++ b/filter/source/placeware/tempfile.hxx
@@ -0,0 +1,48 @@
+/*************************************************************************
+ *
+ * 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 _PLACEWARE_TEMPFILE_HXX_
+#define _PLACEWARE_TEMPFILE_HXX_
+
+#include <osl/file.hxx>
+#include <rtl/ustring.hxx>
+
+class TempFile : public osl::File
+{
+public:
+ TempFile( const rtl::OUString& aURL );
+ ~TempFile();
+
+ static rtl::OUString createTempFileURL();
+ rtl::OUString getFileURL();
+
+private:
+ rtl::OUString maURL;
+};
+
+
+#endif
diff --git a/filter/source/placeware/uno.cxx b/filter/source/placeware/uno.cxx
new file mode 100644
index 000000000000..c11b4392a1b4
--- /dev/null
+++ b/filter/source/placeware/uno.cxx
@@ -0,0 +1,110 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include <stdio.h>
+
+#include <osl/mutex.hxx>
+#include <osl/thread.h>
+#include <cppuhelper/factory.hxx>
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+
+using namespace ::rtl;
+using namespace ::cppu;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::registry;
+
+namespace pwp {
+extern OUString PlaceWareExportFilter_getImplementationName() throw ( RuntimeException );
+extern sal_Bool SAL_CALL PlaceWareExportFilter_supportsService( const OUString& ServiceName ) throw ( RuntimeException );
+extern Sequence< OUString > SAL_CALL PlaceWareExportFilter_getSupportedServiceNames() throw ( RuntimeException );
+extern Reference< XInterface > SAL_CALL PlaceWareExportFilter_createInstance( const Reference< XMultiServiceFactory > & rSMgr) throw ( Exception );
+}
+
+using namespace ::pwp;
+
+extern "C"
+{
+//==================================================================================================
+void SAL_CALL component_getImplementationEnvironment(
+ const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */ )
+{
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+//==================================================================================================
+sal_Bool SAL_CALL component_writeInfo(
+ void * /* pServiceManager */, void * pRegistryKey )
+{
+ if (pRegistryKey)
+ {
+ try
+ {
+ Reference< XRegistryKey > xNewKey(
+ reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( PlaceWareExportFilter_getImplementationName() ) );
+ xNewKey = xNewKey->createKey( OUString::createFromAscii( "/UNO/SERVICES" ) );
+
+ const Sequence< OUString > & rSNL = PlaceWareExportFilter_getSupportedServiceNames();
+ const OUString * pArray = rSNL.getConstArray();
+ for ( sal_Int32 nPos = rSNL.getLength(); nPos--; )
+ xNewKey->createKey( pArray[nPos] );
+
+ return sal_True;
+ }
+ catch (InvalidRegistryException &)
+ {
+ OSL_ENSURE( sal_False, "### InvalidRegistryException!" );
+ }
+ }
+ return sal_False;
+}
+//==================================================================================================
+void * SAL_CALL component_getFactory(
+ const sal_Char * pImplName, void * pServiceManager, void * /* pRegistryKey */ )
+{
+ void * pRet = 0;
+
+ OUString implName = OUString::createFromAscii( pImplName );
+ if ( pServiceManager && implName.equals(PlaceWareExportFilter_getImplementationName()) )
+ {
+ Reference< XSingleServiceFactory > xFactory( createSingleFactory(
+ reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
+ OUString::createFromAscii( pImplName ),
+ PlaceWareExportFilter_createInstance, PlaceWareExportFilter_getSupportedServiceNames() ) );
+
+ if (xFactory.is())
+ {
+ xFactory->acquire();
+ pRet = xFactory.get();
+ }
+ }
+
+ return pRet;
+}
+}
diff --git a/filter/source/placeware/zip.cxx b/filter/source/placeware/zip.cxx
new file mode 100644
index 000000000000..494ce2e576c4
--- /dev/null
+++ b/filter/source/placeware/zip.cxx
@@ -0,0 +1,332 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+/*
+#include <tools/datetime.hxx>
+*/
+#include <osl/diagnose.h>
+#include <rtl/crc.h>
+
+#include "zip.hxx"
+#include "zipfile.hxx"
+
+using namespace rtl;
+
+/** this struct describes one entry in a zip file */
+struct ZipEntry
+{
+ OString name; /* the name we used */
+ sal_Int32 offset; /* where the header starts */
+ sal_Int32 endOffset; /* where the file data ends */
+ sal_Int32 crc;
+ sal_Int32 modTime; /* dos mod time & date */
+ sal_Int32 fileLen; /* file size, in bytes */
+};
+
+/** put one byte inside this stream */
+static osl::File::RC putC( unsigned char c, osl::File& rFile )
+{
+ sal_uInt64 nBytesWritten;
+ osl::File::RC nRC = rFile.write( &c, 1, nBytesWritten );
+
+ OSL_ASSERT( nBytesWritten == 1 );
+ return nRC;
+}
+
+/** write a short to the ZipFile */
+void ZipFile::writeShort( sal_Int16 s)
+{
+ if( !isError() )
+ {
+ mnRC = putC( static_cast< unsigned char >( s & 0xff ), mrFile );
+ if( !isError() )
+ mnRC = putC( static_cast< unsigned char >( (s >> 8) & 0xff ), mrFile );
+ }
+}
+
+/** write a long to the ZipFile */
+
+void ZipFile::writeLong( sal_Int32 l )
+{
+ if( !isError() )
+ {
+ mnRC = putC( static_cast< unsigned char >( l & 0xff ), mrFile);
+ if( !isError() )
+ {
+ mnRC = putC( static_cast< unsigned char >( (l >> 8) & 0xff ), mrFile);
+ if( !isError() )
+ {
+ mnRC = putC( static_cast< unsigned char >( (l >> 16) & 0xff ), mrFile);
+ if( !isError() )
+ {
+ mnRC = putC( static_cast< unsigned char >( (l >> 24) & 0xff ), mrFile);
+ }
+ }
+ }
+ }
+}
+
+/** copy the zipentries file to the zipfile and updates the crc of that zipentry */
+void ZipFile::copyAndCRC(ZipEntry *e, osl::File& rFile)
+{
+ char buf[2048];
+ sal_uInt64 n, nWritten;
+
+ e->crc = rtl_crc32( 0, 0L, 0 );
+
+ while( !isError() )
+ {
+ mnRC = rFile.read( buf, sizeof(buf), n );
+ if(n == 0)
+ break;
+
+ if( !isError() )
+ {
+ sal_uInt32 nTemp = static_cast<sal_uInt32>(n);
+ e->crc = rtl_crc32( e->crc, (const void *) buf, nTemp );
+ mnRC = mrFile.write( buf, n, nWritten );
+ OSL_ASSERT( n == nWritten );
+ }
+ }
+
+ if( !isError() )
+ {
+ sal_uInt64 nPosition = 0;
+ mnRC = mrFile.getPos( nPosition );
+ if( !isError() )
+ {
+ e->endOffset = static_cast< sal_Int32 >( nPosition );
+ }
+ }
+}
+
+/** write a yet empty local header for a zipentry to the zipfile */
+void ZipFile::writeDummyLocalHeader(ZipEntry *e)
+{
+ sal_Int32 len = zf_lfhSIZE + e->name.getLength();
+ sal_Int32 i;
+
+ sal_uInt64 nPosition = 0;
+ mnRC = mrFile.getPos( nPosition );
+ if( !isError() )
+ {
+ e->offset = static_cast< sal_Int32 >( nPosition );
+
+ for (i = 0; (i < len) && !isError(); ++i)
+ mnRC = putC(0, mrFile);
+ }
+}
+
+/** write the local header for a zipentry to the zipfile */
+void ZipFile::writeLocalHeader(ZipEntry *e)
+{
+ TimeValue aTime;
+ osl_getSystemTime( &aTime );
+
+ oslDateTime aDate;
+ osl_getDateTimeFromTimeValue( &aTime, &aDate );
+
+ e->modTime = ((aDate.Year - 1980) << 25) | (aDate.Month << 21) | (aDate.Day << 16) |
+ (aDate.Hours << 11) | (aDate.Minutes << 5) | (aDate.Seconds >> 1);
+
+ e->fileLen = e->endOffset - e->offset - zf_lfhSIZE - e->name.getLength();
+
+ if(!isError())
+ {
+ mnRC = mrFile.setPos( Pos_Absolut, e->offset );
+
+ writeLong(zf_LFHSIGValue); // magic number
+ writeShort(zf_Vers(1, 0)); // extract version
+ writeShort(0); // flags
+ writeShort(zf_compNone); // compression method
+ writeLong(e->modTime); // file mod date & time
+ writeLong(e->crc); // file crc
+ writeLong(e->fileLen); // compressed size
+ writeLong(e->fileLen); // uncompressed size
+ writeShort((sal_Int16) e->name.getLength()); // name length
+ writeShort(0); // extra length field
+
+ if( !isError() )
+ {
+ sal_uInt64 nWritten;
+ mnRC = mrFile.write( e->name.getStr(), e->name.getLength(), nWritten ); // file name
+ OSL_ASSERT( nWritten == (sal_uInt64)e->name.getLength() );
+ if( !isError() )
+ {
+ mnRC = mrFile.setPos( Pos_Absolut, e->endOffset );
+ }
+ }
+ }
+}
+
+/* write a zipentry in the central dir to the zipfile */
+void ZipFile::writeCentralDir(ZipEntry *e)
+{
+ writeLong(zf_CDHSIGValue); // magic number
+ writeShort(zf_Vers(1, 0)); // version made by
+ writeShort(zf_Vers(1, 0)); // vers to extract
+ writeShort(0); // flags
+ writeShort(zf_compNone); // compression method
+ writeLong(e->modTime); // file mod time & date
+ writeLong(e->crc);
+ writeLong(e->fileLen); // compressed file size
+ writeLong(e->fileLen); // uncompressed file size
+ writeShort((sal_Int16) e->name.getLength()); // name length
+ writeShort(0); // extra field length
+ writeShort(0); // file comment length
+ writeShort(0); // disk number start
+ writeShort(0); // internal file attributes
+ writeLong(0); // external file attributes
+ writeLong(e->offset); // offset w.r.t disk
+ if( !isError() )
+ {
+ sal_uInt64 nWritten;
+ mrFile.write( e->name.getStr(), e->name.getLength(), nWritten ); // file name
+ OSL_ASSERT( nWritten == (sal_uInt64)e->name.getLength() );
+ }
+}
+
+/* write the end of the central dir to the zipfile */
+void ZipFile::writeEndCentralDir(sal_Int32 nCdOffset, sal_Int32 nCdSize)
+{
+ writeLong(zf_ECDSIGValue); // magic number
+ writeShort(0); // disk num
+ writeShort(0); // disk with central dir
+ writeShort( static_cast< sal_Int16 >( maEntries.size() ) ); // number of file entries
+ writeShort( static_cast< sal_Int16 >( maEntries.size() ) ); // number of file entries
+ writeLong(nCdSize); // central dir size
+ writeLong(nCdOffset);
+ writeShort(0); // comment len
+}
+
+
+/****************************************************************
+ * The exported functions
+ ****************************************************************/
+
+/* Create a zip file for writing, return a handle for it.
+ * RETURNS: A new zip-file output object, or NULL if it failed, in
+ * which case *errMsgBuffer will contain an error message string. */
+ZipFile::ZipFile(osl::File& rFile )
+: mrFile( rFile ), mbOpen( true ), mnRC( osl::File::E_None )
+{
+}
+
+ZipFile::~ZipFile()
+{
+ if( mbOpen )
+ close();
+}
+
+/* Add a file to this zip with the given name.
+ * RETURNS: true if successful, else false. If false, the caller should
+ * call zip_Close() and delete the bum zip file.
+*/
+bool ZipFile::addFile( osl::File& rFile, const OString& rName )
+{
+ OSL_ASSERT( mbOpen );
+
+ if( !mbOpen )
+ return false;
+
+ OSL_ASSERT( 0 != rName.getLength() );
+
+ if(0 == rName.getLength())
+ return false;
+
+ mnRC = rFile.open( osl_File_OpenFlag_Read );
+
+ if( !isError() )
+ {
+ ZipEntry *e = new ZipEntry;
+ e->name = rName;
+ maEntries.push_back(e);
+
+ writeDummyLocalHeader(e);
+ if( !isError() )
+ {
+ copyAndCRC(e, rFile);
+ if(!isError())
+ {
+ writeLocalHeader(e);
+ }
+ }
+
+ rFile.close();
+ }
+
+ return !isError();
+}
+
+/* Finish up the zip file, close it, and deallocate the zip file object.
+ * RETURNS: true if successful, else false.
+*/
+bool ZipFile::close()
+{
+ OSL_ASSERT( mbOpen );
+
+ if( !mbOpen )
+ return false;
+
+ if( !isError() )
+ {
+ sal_uInt64 nCdOffset;
+ mrFile.getPos( nCdOffset );
+
+ std::vector< ZipEntry* >::iterator aIter( maEntries.begin() );
+ while((aIter != maEntries.end()) && !isError())
+ {
+ writeCentralDir( (*aIter++) );
+ }
+
+ if( !isError() )
+ {
+ sal_uInt64 nCdSize;
+ mrFile.getPos( nCdSize );
+
+ nCdSize -= nCdOffset;
+
+ if( !isError() )
+ {
+ writeEndCentralDir(static_cast<sal_Int32>(nCdOffset), static_cast<sal_Int32>(nCdSize));
+ }
+ }
+ }
+
+ std::vector< ZipEntry* >::iterator aIter( maEntries.begin() );
+ while( aIter != maEntries.end() )
+ {
+ delete (*aIter++);
+ }
+
+ mbOpen = false;
+
+ return !isError();
+}
diff --git a/filter/source/placeware/zip.hxx b/filter/source/placeware/zip.hxx
new file mode 100644
index 000000000000..b43ed32b8e7d
--- /dev/null
+++ b/filter/source/placeware/zip.hxx
@@ -0,0 +1,62 @@
+/*************************************************************************
+ *
+ * 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 <sal/types.h>
+#include <rtl/string.hxx>
+#include <osl/file.hxx>
+
+#include <vector>
+
+struct ZipEntry;
+
+class ZipFile
+{
+public:
+ ZipFile( osl::File& rFile );
+ ~ZipFile();
+
+ bool addFile( osl::File& rFile, const rtl::OString& rName );
+ bool close();
+
+private:
+ void writeShort( sal_Int16 s);
+ void writeLong( sal_Int32 l );
+
+ void copyAndCRC( ZipEntry *e, osl::File& rFile );
+ void writeDummyLocalHeader(ZipEntry *e);
+ void writeLocalHeader(ZipEntry *e);
+ void writeCentralDir(ZipEntry *e);
+ void writeEndCentralDir(sal_Int32 nCdOffset, sal_Int32 nCdSize);
+
+private:
+ bool isError() const { return osl::File::E_None != mnRC; }
+
+ osl::File& mrFile; /* file we're writing to */
+ bool mbOpen;
+ osl::File::RC mnRC;
+ std::vector<ZipEntry*> maEntries;
+};
diff --git a/filter/source/placeware/zipfile.hxx b/filter/source/placeware/zipfile.hxx
new file mode 100644
index 000000000000..33d9c1d1d587
--- /dev/null
+++ b/filter/source/placeware/zipfile.hxx
@@ -0,0 +1,91 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+/* Local file head offsets. The header is followed by the filename and
+ possibly the extra field. */
+#define zf_lfhSig 0
+#define zf_lfhExVers 4
+#define zf_lfhFlags 6
+#define zf_lfhComp 8
+#define zf_lfhModTime 10
+#define zf_lfhModDate 12
+#define zf_lfhCRC 14
+#define zf_lfhCompSize 18
+#define zf_lfhUncompSize 22
+#define zf_lfhNameLen 26
+#define zf_lfhExtraLen 28
+#define zf_lfhSIZE 30 /* total size of header */
+
+/* We don't write data descriptors. */
+
+/* Central dir file header offsets. Each entry is followed by the filename,
+ optional extra field, and file comment. */
+#define zf_cdhSig 0
+#define zf_cdhVers 4
+#define zf_cdhExVers 6
+#define zf_cdhFlags 8
+#define zf_cdhComp 10
+#define zf_cdhTime 12
+#define zf_cdhDate 14
+#define zf_cdhCRC 16
+#define zf_cdhCompSize 20
+#define zf_cdhUncompSize 24
+#define zf_cdhNameLen 28
+#define zf_cdhExtraLen 30
+#define zf_cdhCommentLen 32
+#define zf_cdhDiskNum 34
+#define zf_cdhIFAttrs 36
+#define zf_cdhEFAttrs 38
+#define zf_cdhLHOffset 42
+#define zf_cdhSIZE 46 /* total size of header */
+
+/* End of central dir record offsets. It is followed by the zipfile
+ comment. */
+#define zf_ecdSig 0
+#define zf_ecdDiskNum 4
+#define zf_ecdDirDiskNum 6
+#define zf_ecdNumEntries 8
+#define zf_ecdTotalEntries 10
+#define zf_ecdDirSize 12
+#define zf_ecdDirOffset 16
+#define zf_ecdCommentLen 20
+#define zf_ecdSIZE 22 /* total size */
+
+/* Magic constants to put in these structures. */
+#define zf_LFHSIGValue 0x04034b50
+#define zf_CDHSIGValue 0x02014b50
+#define zf_ECDSIGValue 0x06054b50
+
+/* OS values for upper byte of version field. */
+#define zf_osUnix 3
+
+/* Encode a major,minor version in a byte. */
+#define zf_Vers(major,minor) ((major) * 10 + (minor))
+
+/* Compression values. */
+#define zf_compNone 0
+
diff --git a/filter/source/svg/SOTranscoder.java b/filter/source/svg/SOTranscoder.java
new file mode 100644
index 000000000000..d0b3728e5978
--- /dev/null
+++ b/filter/source/svg/SOTranscoder.java
@@ -0,0 +1,45 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+import java.io.*;
+import org.apache.batik.transcoder.image.PNGTranscoder;
+import org.apache.batik.transcoder.TranscoderInput;
+import org.apache.batik.transcoder.TranscoderOutput;
+
+public class SOTranscoder
+{
+ public static void main(String [] args) throws Exception
+ {
+ PNGTranscoder aTranscoder = new PNGTranscoder();
+ OutputStream aOStm = new FileOutputStream( args[ 1 ] );
+
+ aTranscoder.transcode( new TranscoderInput( new File( args[ 0 ] ).toURL().toString() ), new TranscoderOutput( aOStm ) );
+
+ aOStm.flush();
+ aOStm.close();
+ }
+}
diff --git a/filter/source/svg/makefile.mk b/filter/source/svg/makefile.mk
new file mode 100644
index 000000000000..12c1210c18c4
--- /dev/null
+++ b/filter/source/svg/makefile.mk
@@ -0,0 +1,83 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ=..$/..
+PRJNAME=filter
+TARGET=svgfilter
+
+ENABLE_EXCEPTIONS=TRUE
+VISIBILITY_HIDDEN=TRUE
+
+# --- Settings ----------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Types -------------------------------------
+
+SLOFILES= $(SLO)$/svguno.obj \
+ $(SLO)$/svgfilter.obj \
+ $(SLO)$/svgexport.obj \
+ $(SLO)$/svgfontexport.obj \
+ $(SLO)$/svgwriter.obj
+.IF "$(SOLAR_JAVA)"!=""
+SLOFILES+= $(SLO)$/svgimport.obj
+.ENDIF
+
+# --- Library -----------------------------------
+
+SHL1TARGET=$(TARGET)$(DLLPOSTFIX)
+
+SHL1STDLIBS=\
+ $(EDITENGLIB) \
+ $(SVXCORELIB) \
+ $(XMLOFFLIB) \
+ $(SVTOOLLIB) \
+ $(VCLLIB) \
+ $(UNOTOOLSLIB) \
+ $(TOOLSLIB) \
+ $(COMPHELPERLIB) \
+ $(CPPUHELPERLIB) \
+ $(CPPULIB) \
+ $(SALLIB)
+
+.IF "$(SOLAR_JAVA)"!=""
+SHL1STDLIBS+=\
+ $(JVMACCESSLIB)
+.ENDIF
+
+
+SHL1DEPN=
+SHL1IMPLIB= i$(SHL1TARGET)
+SHL1LIBS= $(SLB)$/$(TARGET).lib
+SHL1VERSIONMAP=$(SOLARENV)/src/component.map
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+
+DEF1NAME=$(SHL1TARGET)
+
+# --- Targets ----------------------------------
+
+.INCLUDE : target.mk
diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx
new file mode 100644
index 000000000000..081a914934c7
--- /dev/null
+++ b/filter/source/svg/svgexport.cxx
@@ -0,0 +1,1007 @@
+ /*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#define ITEMID_FIELD 0
+
+#include "svgwriter.hxx"
+#include "svgfontexport.hxx"
+#include "svgfilter.hxx"
+
+#include <svx/unopage.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/svdoutl.hxx>
+#include <editeng/outliner.hxx>
+#include <editeng/flditem.hxx>
+#include <editeng/numitem.hxx>
+
+using ::rtl::OUString;
+
+// -------------
+// - SVGExport -
+// -------------
+
+// #110680#
+SVGExport::SVGExport(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
+ const Reference< XDocumentHandler >& rxHandler )
+: SvXMLExport( xServiceFactory, OUString(), rxHandler )
+{
+ GetDocHandler()->startDocument();
+}
+
+// -----------------------------------------------------------------------------
+
+SVGExport::~SVGExport()
+{
+ GetDocHandler()->endDocument();
+}
+
+// ------------------------
+// - ObjectRepresentation -
+// ------------------------
+
+ObjectRepresentation::ObjectRepresentation() :
+ mpMtf( NULL )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+ObjectRepresentation::ObjectRepresentation( const Reference< XInterface >& rxObject,
+ const GDIMetaFile& rMtf ) :
+ mxObject( rxObject ),
+ mpMtf( new GDIMetaFile( rMtf ) )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+ObjectRepresentation::ObjectRepresentation( const ObjectRepresentation& rPresentation ) :
+ mxObject( rPresentation.mxObject ),
+ mpMtf( rPresentation.mpMtf ? new GDIMetaFile( *rPresentation.mpMtf ) : NULL )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+ObjectRepresentation::~ObjectRepresentation()
+{
+ delete mpMtf;
+}
+
+// -----------------------------------------------------------------------------
+
+ObjectRepresentation& ObjectRepresentation::operator=( const ObjectRepresentation& rPresentation )
+{
+ mxObject = rPresentation.mxObject;
+ delete mpMtf, ( mpMtf = rPresentation.mpMtf ? new GDIMetaFile( *rPresentation.mpMtf ) : NULL );
+
+ return *this;
+}
+
+// -----------------------------------------------------------------------------
+
+bool ObjectRepresentation::operator==( const ObjectRepresentation& rPresentation ) const
+{
+ return( ( mxObject == rPresentation.mxObject ) &&
+ ( *mpMtf == *rPresentation.mpMtf ) );
+}
+
+// -------------
+// - SVGFilter -
+// -------------
+
+sal_Bool SVGFilter::implExport( const Sequence< PropertyValue >& rDescriptor )
+ throw (RuntimeException)
+{
+ Reference< XMultiServiceFactory > xServiceFactory( ::comphelper::getProcessServiceFactory() ) ;
+ Reference< XOutputStream > xOStm;
+ SvStream* pOStm = NULL;
+ sal_Int32 nLength = rDescriptor.getLength();
+ sal_Int32 nPageToExport = SVG_EXPORT_ALLPAGES;
+ const PropertyValue* pValue = rDescriptor.getConstArray();
+ sal_Bool bRet = sal_False;
+
+ for ( sal_Int32 i = 0 ; i < nLength; ++i)
+ {
+ if( pValue[ i ].Name.equalsAscii( "OutputStream" ) )
+ pValue[ i ].Value >>= xOStm;
+ else if( pValue[ i ].Name.equalsAscii( "FileName" ) )
+ {
+ ::rtl::OUString aFileName;
+
+ pValue[ i ].Value >>= aFileName;
+ pOStm = ::utl::UcbStreamHelper::CreateStream( aFileName, STREAM_WRITE | STREAM_TRUNC );
+
+ if( pOStm )
+ xOStm = Reference< XOutputStream >( new ::utl::OOutputStreamWrapper ( *pOStm ) );
+ }
+ else if( pValue[ i ].Name.equalsAscii( "PagePos" ) )
+ pValue[ i ].Value >>= nPageToExport;
+ }
+
+ if( xOStm.is() && xServiceFactory.is() )
+ {
+ Reference< XMasterPagesSupplier > xMasterPagesSupplier( mxSrcDoc, UNO_QUERY );
+ Reference< XDrawPagesSupplier > xDrawPagesSupplier( mxSrcDoc, UNO_QUERY );
+
+ if( xMasterPagesSupplier.is() && xDrawPagesSupplier.is() )
+ {
+ Reference< XDrawPages > xMasterPages( xMasterPagesSupplier->getMasterPages(), UNO_QUERY );
+ Reference< XDrawPages > xDrawPages( xDrawPagesSupplier->getDrawPages(), UNO_QUERY );
+
+ if( xMasterPages.is() && xDrawPages->getCount() &&
+ xDrawPages.is() && xDrawPages->getCount() )
+ {
+ Reference< XDocumentHandler > xDocHandler( implCreateExportDocumentHandler( xOStm ) );
+
+ if( xDocHandler.is() )
+ {
+ mbPresentation = Reference< XPresentationSupplier >( mxSrcDoc, UNO_QUERY ).is();
+ mpObjects = new ObjectMap;
+
+ // #110680#
+ // mpSVGExport = new SVGExport( xDocHandler );
+ mpSVGExport = new SVGExport( xServiceFactory, xDocHandler );
+
+ if( nPageToExport < 0 || nPageToExport >= xDrawPages->getCount() )
+ nPageToExport = SVG_EXPORT_ALLPAGES;
+
+ try
+ {
+ const sal_Int32 nDefaultPage = ( ( SVG_EXPORT_ALLPAGES == nPageToExport ) ? 0 : nPageToExport );
+
+ xDrawPages->getByIndex( nDefaultPage ) >>= mxDefaultPage;
+
+ if( mxDefaultPage.is() )
+ {
+ 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) );
+ }
+ }
+
+ if( implCreateObjects( xMasterPages, xDrawPages, nPageToExport ) )
+ {
+ ObjectMap::const_iterator aIter( mpObjects->begin() );
+ ::std::vector< ObjectRepresentation > aObjects( mpObjects->size() );
+ sal_uInt32 nPos = 0;
+
+ while( aIter != mpObjects->end() )
+ {
+ aObjects[ nPos++ ] = (*aIter).second;
+ ++aIter;
+ }
+
+ mpSVGFontExport = new SVGFontExport( *mpSVGExport, aObjects );
+ mpSVGWriter = new SVGActionWriter( *mpSVGExport, *mpSVGFontExport );
+
+ bRet = implExportDocument( xMasterPages, xDrawPages, nPageToExport );
+ }
+ }
+ }
+ catch( ... )
+ {
+ delete mpSVGDoc, mpSVGDoc = NULL;
+ DBG_ERROR( "Exception caught" );
+ }
+
+ 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 pOStm;
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XDocumentHandler > SVGFilter::implCreateExportDocumentHandler( const Reference< XOutputStream >& rxOStm )
+{
+ Reference< XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() );
+ Reference< XDocumentHandler > xSaxWriter;
+
+ if( xMgr.is() && rxOStm.is() )
+ {
+ xSaxWriter = Reference< XDocumentHandler >( xMgr->createInstance( B2UCONST( "com.sun.star.xml.sax.Writer" ) ), UNO_QUERY );
+
+ if( xSaxWriter.is() )
+ {
+ Reference< XActiveDataSource > xActiveDataSource( xSaxWriter, UNO_QUERY );
+
+ if( xActiveDataSource.is() )
+ xActiveDataSource->setOutputStream( rxOStm );
+ else
+ xSaxWriter = NULL;
+ }
+ }
+
+ return xSaxWriter;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SVGFilter::implExportDocument( const Reference< XDrawPages >& rxMasterPages,
+ const Reference< XDrawPages >& rxDrawPages,
+ sal_Int32 nPageToExport )
+{
+ DBG_ASSERT( rxMasterPages.is() && rxDrawPages.is(),
+ "SVGFilter::implExportDocument: invalid parameter" );
+
+ 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 ) );
+
+ const Reference< XPropertySet > xDefaultPagePropertySet( mxDefaultPage, UNO_QUERY );
+ const Reference< XExtendedDocumentHandler > xExtDocHandler( mpSVGExport->GetDocHandler(), UNO_QUERY );
+
+ if( xDefaultPagePropertySet.is() )
+ {
+ xDefaultPagePropertySet->getPropertyValue( B2UCONST( "Width" ) ) >>= nDocWidth;
+ xDefaultPagePropertySet->getPropertyValue( B2UCONST( "Height" ) ) >>= nDocHeight;
+ }
+
+ if( xExtDocHandler.is() )
+ xExtDocHandler->unknown( SVG_DTD_STRING );
+
+#ifdef _SVG_WRITE_EXTENTS
+ aAttr = OUString::valueOf( nDocWidth * 0.01 );
+ aAttr += B2UCONST( "mm" );
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "width", aAttr );
+
+ aAttr = OUString::valueOf( nDocHeight * 0.01 );
+ aAttr += B2UCONST( "mm" );
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "height", aAttr );
+#endif
+
+ aAttr = B2UCONST( "0 0 " );
+ aAttr += OUString::valueOf( nDocWidth );
+ aAttr += B2UCONST( " " );
+ aAttr += OUString::valueOf( nDocHeight );
+
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "version", B2UCONST( "1.1" ) );
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "viewBox", aAttr );
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "preserveAspectRatio", B2UCONST( "xMidYMid" ) );
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "fill-rule", B2UCONST( "evenodd" ) );
+
+ if( !bSinglePage )
+ {
+ 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)" ) );
+ }
+
+
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "xmlns", B2UCONST( "http://www.w3.org/2000/svg" ) );
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "xmlns:xlink", B2UCONST( "http://www.w3.org/1999/xlink" ) );
+
+ mpSVGDoc = new SvXMLElementExport( *mpSVGExport, XML_NAMESPACE_NONE, "svg", TRUE, TRUE );
+
+ while( ( nCurPage <= nLastPage ) && ( -1 == nVisible ) )
+ {
+ Reference< XDrawPage > xDrawPage;
+
+ rxDrawPages->getByIndex( nCurPage ) >>= xDrawPage;
+
+ if( xDrawPage.is() )
+ {
+ Reference< XPropertySet > xPropSet( xDrawPage, UNO_QUERY );
+
+ if( xPropSet.is() )
+ {
+ sal_Bool bVisible = sal_False;
+
+ if( !mbPresentation || bSinglePage ||
+ ( ( xPropSet->getPropertyValue( B2UCONST( "Visible" ) ) >>= bVisible ) && bVisible ) )
+ {
+ Reference< XMasterPageTarget > xMasterTarget( xDrawPage, UNO_QUERY );
+
+ if( xMasterTarget.is() )
+ {
+ Reference< XDrawPage > xMasterPage( xMasterTarget->getMasterPage() );
+
+ nVisible = nCurPage;
+
+ for( sal_Int32 nMaster = 0, nMasterCount = rxMasterPages->getCount();
+ ( nMaster < nMasterCount ) && ( -1 == nVisibleMaster );
+ ++nMaster )
+ {
+ Reference< XDrawPage > xMasterTestPage;
+
+ rxMasterPages->getByIndex( nMaster ) >>= xMasterTestPage;
+
+ if( xMasterTestPage == xMasterPage )
+ nVisibleMaster = nMaster;
+ }
+ }
+ }
+ }
+ }
+
+ ++nCurPage;
+ }
+
+#ifdef _SVG_EMBED_FONTS
+ mpSVGFontExport->EmbedFonts();
+#endif
+
+ if( -1 != nVisible )
+ {
+ if( bSinglePage )
+ implExportPages( rxMasterPages, nVisibleMaster, nVisibleMaster, nVisibleMaster, sal_True );
+ else
+ {
+ implGenerateMetaData( rxMasterPages, rxDrawPages );
+ implGenerateScript( rxMasterPages, rxDrawPages );
+ implExportPages( rxMasterPages, 0, rxMasterPages->getCount() - 1, nVisibleMaster, sal_True );
+ }
+
+ implExportPages( rxDrawPages, nFirstPage, nLastPage, nVisible, sal_False );
+
+ delete mpSVGDoc, mpSVGDoc = NULL;
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SVGFilter::implGenerateMetaData( const Reference< XDrawPages >& /* rxMasterPages */,
+ const Reference< XDrawPages >& rxDrawPages )
+{
+ sal_Bool bRet = sal_False;
+
+ if( rxDrawPages->getCount() )
+ {
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", B2UCONST( "meta_slides" ) );
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "numberOfSlides", OUString::valueOf( rxDrawPages->getCount() ) );
+
+ {
+ SvXMLElementExport aExp( *mpSVGExport, XML_NAMESPACE_NONE, "ooo:slidesInfo", TRUE, TRUE );
+ const OUString aId( B2UCONST( "meta_slide" ) );
+
+ for( sal_Int32 i = 0, nCount = rxDrawPages->getCount(); 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;
+
+ aSlideId += OUString::valueOf( i );
+
+ if( mbPresentation )
+ {
+ Reference< XPropertySet > xPropSet( xDrawPage, UNO_QUERY );
+
+ if( xPropSet.is() )
+ xPropSet->getPropertyValue( B2UCONST( "Background" ) ) >>= bMasterVisible;
+ }
+
+ if( bMasterVisible )
+ aMasterVisibility = B2UCONST( "visible" );
+ else
+ aMasterVisibility = B2UCONST( "hidden" );
+
+ 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 );
+
+ {
+ SvXMLElementExport aExp2( *mpSVGExport, XML_NAMESPACE_NONE, "ooo:slideInfo", TRUE, TRUE );
+ }
+ }
+ }
+
+
+ bRet =sal_True;
+ }
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SVGFilter::implGenerateScript( const Reference< XDrawPages >& /* rxMasterPages */,
+ const Reference< XDrawPages >& /* rxDrawPages */ )
+{
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "type", B2UCONST( "text/ecmascript" ) );
+
+ {
+ SvXMLElementExport aExp( *mpSVGExport, XML_NAMESPACE_NONE, "script", TRUE, TRUE );
+ Reference< XExtendedDocumentHandler > xExtDocHandler( mpSVGExport->GetDocHandler(), UNO_QUERY );
+
+ if( xExtDocHandler.is() )
+ {
+ xExtDocHandler->unknown( OUString::createFromAscii( aSVGScript1 ) );
+ xExtDocHandler->unknown( OUString::createFromAscii( aSVGScript2 ) );
+ }
+ }
+
+ return sal_True;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SVGFilter::implExportPages( const Reference< XDrawPages >& rxPages,
+ sal_Int32 nFirstPage, sal_Int32 nLastPage,
+ sal_Int32 nVisiblePage, sal_Bool bMaster )
+{
+ DBG_ASSERT( nFirstPage <= nLastPage,
+ "SVGFilter::implExportPages: nFirstPage > nLastPage" );
+
+ sal_Bool bRet = sal_False;
+
+ for( sal_Int32 i = nFirstPage; i <= nLastPage; ++i )
+ {
+ Reference< XDrawPage > xDrawPage;
+
+ rxPages->getByIndex( i ) >>= xDrawPage;
+
+ if( xDrawPage.is() )
+ {
+ Reference< XShapes > xShapes( xDrawPage, UNO_QUERY );
+
+ if( xShapes.is() )
+ {
+ OUString aAttr;
+
+ if( i == nVisiblePage )
+ aAttr = B2UCONST( "visible" );
+ else
+ aAttr = B2UCONST( "hidden" );
+
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "visibility", aAttr );
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", implGetValidIDFromInterface( xShapes ) );
+
+ {
+ SvXMLElementExport aExp( *mpSVGExport, XML_NAMESPACE_NONE, "g", TRUE, TRUE );
+ const Point aNullPt;
+
+ {
+ Reference< XExtendedDocumentHandler > xExtDocHandler( mpSVGExport->GetDocHandler(), UNO_QUERY );
+
+ if( xExtDocHandler.is() )
+ {
+ SvXMLElementExport aExp2( *mpSVGExport, XML_NAMESPACE_NONE, "desc", TRUE, TRUE );
+ OUString aDesc;
+
+ if( bMaster )
+ aDesc = B2UCONST( "Master slide" );
+ else
+ aDesc = B2UCONST( "Slide" );
+
+ xExtDocHandler->unknown( aDesc );
+ }
+ }
+
+ if( bMaster )
+ {
+ const GDIMetaFile& rMtf = (*mpObjects)[ xDrawPage ].GetRepresentation();
+ mpSVGWriter->WriteMetaFile( aNullPt, rMtf.GetPrefSize(), rMtf, SVGWRITER_WRITE_FILL );
+ }
+
+ bRet = implExportShapes( xShapes ) || bRet;
+ }
+ }
+ }
+ }
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SVGFilter::implExportShapes( const Reference< XShapes >& rxShapes )
+{
+ Reference< XShape > xShape;
+ sal_Bool bRet = sal_False;
+
+ for( sal_Int32 i = 0, nCount = rxShapes->getCount(); i < nCount; ++i )
+ {
+ if( ( rxShapes->getByIndex( i ) >>= xShape ) && xShape.is() )
+ bRet = implExportShape( xShape ) || bRet;
+
+ xShape = NULL;
+ }
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SVGFilter::implExportShape( const Reference< XShape >& rxShape )
+{
+ Reference< XPropertySet > xShapePropSet( rxShape, UNO_QUERY );
+ sal_Bool bRet = sal_False;
+
+ if( xShapePropSet.is() )
+ {
+ const ::rtl::OUString aShapeType( rxShape->getShapeType() );
+ bool bHideObj = false;
+
+ if( mbPresentation )
+ {
+ xShapePropSet->getPropertyValue( B2UCONST( "IsEmptyPresentationObject" ) ) >>= bHideObj;
+
+ if( !bHideObj )
+ {
+ const Reference< XPropertySet > xDefaultPagePropertySet( mxDefaultPage, UNO_QUERY );
+ Reference< XPropertySetInfo > xPagePropSetInfo( xDefaultPagePropertySet->getPropertySetInfo() );
+
+ if( xPagePropSetInfo.is() )
+ {
+ static const ::rtl::OUString aHeaderString( B2UCONST( "IsHeaderVisible" ) );
+ static const ::rtl::OUString aFooterString( B2UCONST( "IsFooterVisible" ) );
+ static const ::rtl::OUString aDateTimeString( B2UCONST( "IsDateTimeVisible" ) );
+ static const ::rtl::OUString aPageNumberString( B2UCONST( "IsPageNumberVisible" ) );
+
+ Any aProperty;
+ bool bValue = sal_False;
+
+ if( ( aShapeType.lastIndexOf( B2UCONST( "presentation.HeaderShape" ) ) != -1 ) &&
+ xPagePropSetInfo->hasPropertyByName( aHeaderString ) &&
+ ( ( aProperty = xDefaultPagePropertySet->getPropertyValue( aHeaderString ) ) >>= bValue ) &&
+ !bValue )
+ {
+ bHideObj = true;
+ }
+ else if( ( aShapeType.lastIndexOf( B2UCONST( "presentation.FooterShape" ) ) != -1 ) &&
+ xPagePropSetInfo->hasPropertyByName( aFooterString ) &&
+ ( ( aProperty = xDefaultPagePropertySet->getPropertyValue( aFooterString ) ) >>= bValue ) &&
+ !bValue )
+ {
+ bHideObj = true;
+ }
+ else if( ( aShapeType.lastIndexOf( B2UCONST( "presentation.DateTimeShape" ) ) != -1 ) &&
+ xPagePropSetInfo->hasPropertyByName( aDateTimeString ) &&
+ ( ( aProperty = xDefaultPagePropertySet->getPropertyValue( aDateTimeString ) ) >>= bValue ) &&
+ !bValue )
+ {
+ bHideObj = true;
+ }
+ else if( ( aShapeType.lastIndexOf( B2UCONST( "presentation.SlideNumberShape" ) ) != -1 ) &&
+ xPagePropSetInfo->hasPropertyByName( aPageNumberString ) &&
+ ( ( aProperty = xDefaultPagePropertySet->getPropertyValue( aPageNumberString ) ) >>= bValue ) &&
+ !bValue )
+ {
+ bHideObj = true;
+ }
+ }
+ }
+ }
+
+ if( !bHideObj )
+ {
+ OUString aObjName( implGetValidIDFromInterface( rxShape ) ), aObjDesc;
+
+ if( aObjName.getLength() )
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", aObjName );
+
+ if( aShapeType.lastIndexOf( B2UCONST( "drawing.GroupShape" ) ) != -1 )
+ {
+ Reference< XShapes > xShapes( rxShape, UNO_QUERY );
+
+ if( xShapes.is() )
+ {
+ SvXMLElementExport aExp( *mpSVGExport, XML_NAMESPACE_NONE, "g", TRUE, TRUE );
+
+ {
+ SvXMLElementExport aExp2( *mpSVGExport, XML_NAMESPACE_NONE, "desc", TRUE, TRUE );
+ Reference< XExtendedDocumentHandler > xExtDocHandler( mpSVGExport->GetDocHandler(), UNO_QUERY );
+
+ xExtDocHandler->unknown( B2UCONST( "Group" ) );
+ }
+
+ bRet = implExportShapes( xShapes );
+ }
+ }
+
+ if( !bRet )
+ {
+ Reference< XText > xText( rxShape, UNO_QUERY );
+ ::com::sun::star::awt::Rectangle aBoundRect;
+ const GDIMetaFile& rMtf = (*mpObjects)[ rxShape ].GetRepresentation();
+
+ xShapePropSet->getPropertyValue( B2UCONST( "BoundRect" ) ) >>= aBoundRect;
+ const Point aTopLeft( aBoundRect.X, aBoundRect.Y );
+ const Size aSize( aBoundRect.Width, aBoundRect.Height );
+
+ {
+ SvXMLElementExport aExp( *mpSVGExport, XML_NAMESPACE_NONE, "g", TRUE, TRUE );
+
+ {
+ SvXMLElementExport aExp2( *mpSVGExport, XML_NAMESPACE_NONE, "desc", TRUE, TRUE );
+ Reference< XExtendedDocumentHandler > xExtDocHandler( mpSVGExport->GetDocHandler(), UNO_QUERY );
+
+ xExtDocHandler->unknown( implGetDescriptionFromShape( rxShape ) );
+ }
+
+ if( rMtf.GetActionCount() )
+ {
+ if( ( aShapeType.lastIndexOf( B2UCONST( "drawing.OLE2Shape" ) ) != -1 ) ||
+ ( aShapeType.lastIndexOf( B2UCONST( "drawing.GraphicObjectShape" ) ) != -1 ) )
+ {
+ SvXMLElementExport aExp2( *mpSVGExport, XML_NAMESPACE_NONE, "g", TRUE, TRUE );
+ mpSVGWriter->WriteMetaFile( aTopLeft, aSize, rMtf, SVGWRITER_WRITE_ALL);
+ }
+ else
+ {
+ // write geometries
+ SvXMLElementExport aGeometryExp( *mpSVGExport, XML_NAMESPACE_NONE, "g", TRUE, TRUE );
+ mpSVGWriter->WriteMetaFile( aTopLeft, aSize, rMtf, SVGWRITER_WRITE_FILL );
+
+ // write text separately
+ SvXMLElementExport aTextExp( *mpSVGExport, XML_NAMESPACE_NONE, "g", TRUE, TRUE );
+ mpSVGWriter->WriteMetaFile( aTopLeft, aSize, rMtf, SVGWRITER_WRITE_TEXT );
+ }
+ }
+ }
+
+ bRet = sal_True;
+ }
+ }
+ }
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SVGFilter::implCreateObjects( const Reference< XDrawPages >& rxMasterPages,
+ const Reference< XDrawPages >& rxDrawPages,
+ sal_Int32 nPageToExport )
+{
+ 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 );
+
+ implCreateObjectsFromBackground( xMasterPage );
+
+ if( xShapes.is() )
+ implCreateObjectsFromShapes( xShapes );
+ }
+ }
+
+ for( i = 0, nCount = rxDrawPages->getCount(); i < nCount; ++i )
+ {
+ Reference< XDrawPage > xDrawPage;
+
+ rxDrawPages->getByIndex( i ) >>= xDrawPage;
+
+ if( xDrawPage.is() )
+ {
+ Reference< XShapes > xShapes( xDrawPage, UNO_QUERY );
+
+ 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 );
+
+ if( xMasterTarget.is() )
+ {
+ Reference< XDrawPage > xMasterPage( xMasterTarget->getMasterPage() );
+
+ if( xMasterPage.is() )
+ {
+ Reference< XShapes > xShapes( xMasterPage, UNO_QUERY );
+
+ implCreateObjectsFromBackground( xMasterPage );
+
+ if( xShapes.is() )
+ implCreateObjectsFromShapes( xShapes );
+ }
+ }
+
+ Reference< XShapes > xShapes( xDrawPage, UNO_QUERY );
+
+ if( xShapes.is() )
+ implCreateObjectsFromShapes( xShapes );
+ }
+ }
+
+ return sal_True;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SVGFilter::implCreateObjectsFromShapes( const Reference< XShapes >& rxShapes )
+{
+ Reference< XShape > xShape;
+ sal_Bool bRet = sal_False;
+
+ for( sal_Int32 i = 0, nCount = rxShapes->getCount(); i < nCount; ++i )
+ {
+ if( ( rxShapes->getByIndex( i ) >>= xShape ) && xShape.is() )
+ bRet = implCreateObjectsFromShape( xShape ) || bRet;
+
+ xShape = NULL;
+ }
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+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 );
+
+ if( xShapes.is() )
+ bRet = implCreateObjectsFromShapes( xShapes );
+ }
+ else
+ {
+ SdrObject* pObj = GetSdrObjectFromXShape( rxShape );
+
+ if( pObj )
+ {
+ Graphic aGraphic( SdrExchangeView::GetObjGraphic( pObj->GetModel(), pObj ) );
+
+ if( aGraphic.GetType() != GRAPHIC_NONE )
+ {
+ if( aGraphic.GetType() == GRAPHIC_BITMAP )
+ {
+ GDIMetaFile aMtf;
+ const Point aNullPt;
+ const Size aSize( pObj->GetCurrentBoundRect().GetSize() );
+
+ aMtf.AddAction( new MetaBmpExScaleAction( aNullPt, aSize, aGraphic.GetBitmapEx() ) );
+ aMtf.SetPrefSize( aSize );
+ aMtf.SetPrefMapMode( MAP_100TH_MM );
+
+ (*mpObjects)[ rxShape ] = ObjectRepresentation( rxShape, aMtf );
+ }
+ else
+ (*mpObjects)[ rxShape ] = ObjectRepresentation( rxShape, aGraphic.GetGDIMetaFile() );
+
+ bRet = sal_True;
+ }
+ }
+ }
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SVGFilter::implCreateObjectsFromBackground( const Reference< XDrawPage >& rxMasterPage )
+{
+ Reference< XExporter > xExporter( mxMSF->createInstance( B2UCONST( "com.sun.star.drawing.GraphicExportFilter" ) ), UNO_QUERY );
+ sal_Bool bRet = sal_False;
+
+ if( xExporter.is() )
+ {
+ GDIMetaFile aMtf;
+ Reference< XFilter > xFilter( xExporter, UNO_QUERY );
+
+ utl::TempFile aFile;
+ aFile.EnableKillingFile();
+
+ Sequence< PropertyValue > aDescriptor( 3 );
+ aDescriptor[0].Name = B2UCONST( "FilterName" );
+ aDescriptor[0].Value <<= B2UCONST( "SVM" );
+ aDescriptor[1].Name = B2UCONST( "URL" );
+ aDescriptor[1].Value <<= OUString( aFile.GetURL() );
+ aDescriptor[2].Name = B2UCONST( "ExportOnlyBackground" );
+ aDescriptor[2].Value <<= (sal_Bool) sal_True;
+
+ xExporter->setSourceDocument( Reference< XComponent >( rxMasterPage, UNO_QUERY ) );
+ xFilter->filter( aDescriptor );
+ aMtf.Read( *aFile.GetStream( STREAM_READ ) );
+
+ (*mpObjects)[ rxMasterPage ] = ObjectRepresentation( rxMasterPage, aMtf );
+
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+OUString SVGFilter::implGetDescriptionFromShape( const Reference< XShape >& rxShape )
+{
+ OUString aRet;
+ const OUString aShapeType( rxShape->getShapeType() );
+
+ if( aShapeType.lastIndexOf( B2UCONST( "drawing.GroupShape" ) ) != -1 )
+ aRet = B2UCONST( "Group" );
+ else if( aShapeType.lastIndexOf( B2UCONST( "drawing.GraphicObjectShape" ) ) != -1 )
+ aRet = B2UCONST( "Graphic" );
+ else if( aShapeType.lastIndexOf( B2UCONST( "drawing.OLE2Shape" ) ) != -1 )
+ aRet = B2UCONST( "OLE2" );
+ else if( aShapeType.lastIndexOf( B2UCONST( "presentation.HeaderShape" ) ) != -1 )
+ aRet = B2UCONST( "Header" );
+ else if( aShapeType.lastIndexOf( B2UCONST( "presentation.FooterShape" ) ) != -1 )
+ aRet = B2UCONST( "Footer" );
+ else if( aShapeType.lastIndexOf( B2UCONST( "presentation.DateTimeShape" ) ) != -1 )
+ aRet = B2UCONST( "Date/Time" );
+ else if( aShapeType.lastIndexOf( B2UCONST( "presentation.SlideNumberShape" ) ) != -1 )
+ aRet = B2UCONST( "Slide Number" );
+ else
+ aRet = B2UCONST( "Drawing" );
+
+ return aRet;
+}
+
+// -----------------------------------------------------------------------------
+
+OUString SVGFilter::implGetValidIDFromInterface( const Reference< XInterface >& rxIf )
+{
+ Reference< XNamed > xNamed( rxIf, UNO_QUERY );
+ OUString aRet;
+
+ if( xNamed.is() )
+ aRet = xNamed->getName().replace( ' ', '_' );
+
+ return aRet;
+}
+
+// -----------------------------------------------------------------------------
+
+IMPL_LINK( SVGFilter, CalcFieldHdl, EditFieldInfo*, pInfo )
+{
+ OUString aRepresentation;
+ bool bFieldProcessed = false;
+
+ if( pInfo )
+ {
+ static const ::rtl::OUString aHeaderText( B2UCONST( "HeaderText" ) );
+ static const ::rtl::OUString aFooterText( B2UCONST( "FooterText" ) );
+ static const ::rtl::OUString aDateTimeText( B2UCONST( "DateTimeText" ) );
+ static const ::rtl::OUString aPageNumberText( B2UCONST( "Number" ) );
+
+ const Reference< XPropertySet > xDefaultPagePropertySet( mxDefaultPage, UNO_QUERY );
+ Reference< XPropertySetInfo > xDefaultPagePropSetInfo( xDefaultPagePropertySet->getPropertySetInfo() );
+
+ if( xDefaultPagePropSetInfo.is() )
+ {
+ const SvxFieldData* pField = pInfo->GetField().GetField();
+ Any aProperty;
+
+ if( pField->ISA( SvxHeaderField ) &&
+ xDefaultPagePropSetInfo->hasPropertyByName( aHeaderText ) )
+ {
+ xDefaultPagePropertySet->getPropertyValue( aHeaderText ) >>= aRepresentation;
+ bFieldProcessed = true;
+ }
+ else if( pField->ISA( SvxFooterField ) &&
+ xDefaultPagePropSetInfo->hasPropertyByName( aFooterText ) )
+ {
+ xDefaultPagePropertySet->getPropertyValue( aFooterText ) >>= aRepresentation;
+ bFieldProcessed = true;
+ }
+ else if( pField->ISA( SvxDateTimeField ) &&
+ xDefaultPagePropSetInfo->hasPropertyByName( aDateTimeText ) )
+ {
+ xDefaultPagePropertySet->getPropertyValue( aDateTimeText ) >>= aRepresentation;
+ bFieldProcessed = true;
+ }
+ else if( pField->ISA( SvxPageField ) &&
+ xDefaultPagePropSetInfo->hasPropertyByName( aPageNumberText ) )
+ {
+ String aPageNumValue;
+ sal_Int16 nPageNumber = 0;
+
+ xDefaultPagePropertySet->getPropertyValue( aPageNumberText ) >>= nPageNumber;
+
+ if( mpSdrModel )
+ {
+ bool bUpper = false;
+
+ switch( mpSdrModel->GetPageNumType() )
+ {
+ case SVX_CHARS_UPPER_LETTER:
+ aPageNumValue += (sal_Unicode)(char)( ( nPageNumber - 1 ) % 26 + 'A' );
+ break;
+ case SVX_CHARS_LOWER_LETTER:
+ aPageNumValue += (sal_Unicode)(char)( ( nPageNumber- 1 ) % 26 + 'a' );
+ break;
+ case SVX_ROMAN_UPPER:
+ bUpper = true;
+ case SVX_ROMAN_LOWER:
+ aPageNumValue += SvxNumberFormat::CreateRomanString( nPageNumber, bUpper );
+ break;
+ case SVX_NUMBER_NONE:
+ aPageNumValue.Erase();
+ aPageNumValue += sal_Unicode(' ');
+ break;
+ default : break;
+ }
+ }
+
+ if( !aPageNumValue.Len() )
+ aPageNumValue += String::CreateFromInt32( nPageNumber );
+
+ aRepresentation = aPageNumValue;
+ bFieldProcessed = true;
+ }
+ }
+
+ pInfo->SetRepresentation( aRepresentation );
+ }
+
+ return( bFieldProcessed ? 0 : maOldFieldHdl.Call( pInfo ) );
+}
diff --git a/filter/source/svg/svgfilter.cxx b/filter/source/svg/svgfilter.cxx
new file mode 100644
index 000000000000..118474bbe2b0
--- /dev/null
+++ b/filter/source/svg/svgfilter.cxx
@@ -0,0 +1,229 @@
+ /*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include <cstdio>
+
+#include "svgfilter.hxx"
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <com/sun/star/drawing/XDrawView.hpp>
+#include <com/sun/star/frame/XDesktop.hdl>
+#include <com/sun/star/frame/XController.hdl>
+#include <vos/mutex.hxx>
+
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+
+// -------------
+// - SVGFilter -
+// -------------
+
+SVGFilter::SVGFilter( const Reference< XMultiServiceFactory > &rxMSF ) :
+ mxMSF( rxMSF ),
+ mpSVGDoc( NULL ),
+ mpSVGExport( NULL ),
+ mpSVGFontExport( NULL ),
+ mpSVGWriter( NULL ),
+ mpDefaultSdrPage( NULL ),
+ mpSdrModel( NULL ),
+ mbPresentation( sal_False )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+SVGFilter::~SVGFilter()
+{
+ DBG_ASSERT( mpSVGDoc == NULL, "mpSVGDoc not destroyed" );
+ DBG_ASSERT( mpSVGExport == NULL, "mpSVGExport not destroyed" );
+ DBG_ASSERT( mpSVGFontExport == NULL, "mpSVGFontExport not destroyed" );
+ DBG_ASSERT( mpSVGWriter == NULL, "mpSVGWriter not destroyed" );
+ DBG_ASSERT( mpObjects == NULL, "mpObjects not destroyed" );
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SAL_CALL SVGFilter::filter( const Sequence< PropertyValue >& rDescriptor )
+ throw (RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+ Window* pFocusWindow = Application::GetFocusWindow();
+ sal_Int16 nCurrentPageNumber = -1;
+ sal_Bool bRet;
+
+ if( pFocusWindow )
+ pFocusWindow->EnterWait();
+
+#ifdef SOLAR_JAVA
+ if( mxDstDoc.is() )
+ bRet = implImport( rDescriptor );
+ else
+#endif
+ if( mxSrcDoc.is() )
+ {
+ uno::Reference< frame::XDesktop > xDesktop( mxMSF->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.frame.Desktop" ) ),
+ uno::UNO_QUERY);
+ if( xDesktop.is() )
+ {
+ uno::Reference< frame::XFrame > xFrame( xDesktop->getCurrentFrame() );
+
+ if( xFrame.is() )
+ {
+ uno::Reference< frame::XController > xController( xFrame->getController() );
+
+ if( xController.is() )
+ {
+ uno::Reference< drawing::XDrawView > xDrawView( xController, uno::UNO_QUERY );
+
+ if( xDrawView.is() )
+ {
+ uno::Reference< drawing::XDrawPage > xDrawPage( xDrawView->getCurrentPage() );
+
+ if( xDrawPage.is() )
+ {
+ uno::Reference< beans::XPropertySet >( xDrawPage, uno::UNO_QUERY )->
+ getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Number" ) ) ) >>= nCurrentPageNumber;
+ }
+ }
+ }
+ }
+ }
+
+ Sequence< PropertyValue > aNewDescritor( rDescriptor );
+
+ if( nCurrentPageNumber > 0 )
+ {
+ const sal_uInt32 nOldLength = rDescriptor.getLength();
+
+ aNewDescritor.realloc( nOldLength + 1 );
+ aNewDescritor[ nOldLength ].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PagePos" ) );
+ aNewDescritor[ nOldLength ].Value <<= static_cast< sal_Int16 >( nCurrentPageNumber - 1 );
+ }
+
+ bRet = implExport( aNewDescritor );
+ }
+ else
+ bRet = sal_False;
+
+ if( pFocusWindow )
+ pFocusWindow->LeaveWait();
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL SVGFilter::cancel( ) throw (RuntimeException)
+{
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL SVGFilter::setSourceDocument( const Reference< XComponent >& xDoc )
+ throw (IllegalArgumentException, RuntimeException)
+{
+ mxSrcDoc = xDoc;
+}
+
+// -----------------------------------------------------------------------------
+
+#ifdef SOLAR_JAVA
+void SAL_CALL SVGFilter::setTargetDocument( const Reference< XComponent >& xDoc )
+ throw (::com::sun::star::lang::IllegalArgumentException, RuntimeException)
+{
+ mxDstDoc = xDoc;
+}
+#endif
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL SVGFilter::initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& /* aArguments */ )
+ throw (Exception, RuntimeException)
+{
+}
+
+// -----------------------------------------------------------------------------
+
+OUString SVGFilter_getImplementationName ()
+ throw (RuntimeException)
+{
+ return OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Draw.SVGFilter" ) );
+}
+
+// -----------------------------------------------------------------------------
+
+#define SERVICE_NAME "com.sun.star.document.SVGFilter"
+
+sal_Bool SAL_CALL SVGFilter_supportsService( const OUString& ServiceName )
+ throw (RuntimeException)
+{
+ return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SERVICE_NAME ) );
+}
+
+// -----------------------------------------------------------------------------
+
+Sequence< OUString > SAL_CALL SVGFilter_getSupportedServiceNames( ) throw (RuntimeException)
+{
+ Sequence < OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME ) );
+ return aRet;
+}
+
+#undef SERVICE_NAME
+
+// -----------------------------------------------------------------------------
+
+Reference< XInterface > SAL_CALL SVGFilter_createInstance( const Reference< XMultiServiceFactory > & rSMgr) throw( Exception )
+{
+ return (cppu::OWeakObject*) new SVGFilter( rSMgr );
+}
+
+// -----------------------------------------------------------------------------
+
+OUString SAL_CALL SVGFilter::getImplementationName( )
+ throw (RuntimeException)
+{
+ return SVGFilter_getImplementationName();
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SAL_CALL SVGFilter::supportsService( const OUString& rServiceName )
+ throw (RuntimeException)
+{
+ return SVGFilter_supportsService( rServiceName );
+}
+
+// -----------------------------------------------------------------------------
+
+::com::sun::star::uno::Sequence< OUString > SAL_CALL SVGFilter::getSupportedServiceNames( ) throw (RuntimeException)
+{
+ return SVGFilter_getSupportedServiceNames();
+}
diff --git a/filter/source/svg/svgfilter.hxx b/filter/source/svg/svgfilter.hxx
new file mode 100644
index 000000000000..0bbc64e2c244
--- /dev/null
+++ b/filter/source/svg/svgfilter.hxx
@@ -0,0 +1,296 @@
+/*************************************************************************
+ *
+ * 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 SVGFILTER_HXX
+#define SVGFILTER_HXX
+
+#include <com/sun/star/drawing/XMasterPageTarget.hpp>
+#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
+#include <com/sun/star/drawing/XMasterPagesSupplier.hpp>
+#include <com/sun/star/presentation/XPresentationSupplier.hpp>
+#include <com/sun/star/document/XFilter.hpp>
+#ifdef SOLAR_JAVA
+#include <com/sun/star/document/XImporter.hpp>
+#endif // SOLAR_JAVA
+#include <com/sun/star/document/XExporter.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <cppuhelper/implbase1.hxx>
+#ifdef SOLAR_JAVA
+#include <cppuhelper/implbase5.hxx>
+#else // !SOLAR_JAVA
+#include <cppuhelper/implbase4.hxx>
+#endif
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/io/XActiveDataSource.hpp>
+#include <com/sun/star/presentation/AnimationEffect.hpp>
+#include <com/sun/star/presentation/AnimationSpeed.hpp>
+#include <com/sun/star/presentation/ClickAction.hpp>
+#include <com/sun/star/presentation/FadeEffect.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/frame/XDesktop.hpp>
+#include <com/sun/star/java/XJavaVM.hpp>
+#include <com/sun/star/java/XJavaThreadRegister_11.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+#include <hash_map>
+#include <osl/diagnose.h>
+#include <rtl/process.h>
+#include <tools/debug.hxx>
+#include <comphelper/processfactory.hxx>
+#include <unotools/tempfile.hxx>
+#include <unotools/localfilehelper.hxx>
+#include <unotools/ucbstreamhelper.hxx>
+#include <unotools/streamwrap.hxx>
+#include <vcl/cvtgrf.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/outdev.hxx>
+#include <vcl/metaact.hxx>
+#include <svtools/grfmgr.hxx>
+#include <svx/unomodel.hxx>
+#include <svx/unoapi.hxx>
+#include <svx/svdxcgv.hxx>
+#include <svx/svdobj.hxx>
+#include <xmloff/xmlexp.hxx>
+
+#include "svgfilter.hxx"
+#include "svgscript.hxx"
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::java;
+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::io;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::std;
+
+// -----------
+// - Defines -
+// -----------
+
+#define SVG_EXPORT_ALLPAGES ((sal_Int32)-1)
+
+// -------------
+// - SVGExport -
+// -------------
+
+// #110680#
+class SVGExport : public SvXMLExport
+{
+private:
+
+ SVGExport();
+
+protected:
+
+ virtual void _ExportMeta() {}
+ virtual void _ExportStyles( BOOL /* bUsed */ ) {}
+ virtual void _ExportAutoStyles() {}
+ virtual void _ExportContent() {}
+ virtual void _ExportMasterStyles() {}
+ virtual sal_uInt32 exportDoc( enum ::xmloff::token::XMLTokenEnum /* eClass */ ) { return 0; }
+
+public:
+
+ SVGExport(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
+ const Reference< XDocumentHandler >& rxHandler );
+ virtual ~SVGExport();
+};
+
+// ------------------------
+// - ObjectRepresentation -
+// ------------------------
+
+class ObjectRepresentation
+{
+private:
+
+ Reference< XInterface > mxObject;
+ GDIMetaFile* mpMtf;
+
+public:
+
+ ObjectRepresentation();
+ ObjectRepresentation( const Reference< XInterface >& rxIf,
+ const GDIMetaFile& rMtf );
+ ObjectRepresentation( const ObjectRepresentation& rPresentation );
+ ~ObjectRepresentation();
+
+ ObjectRepresentation& operator=( const ObjectRepresentation& rPresentation );
+ 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; }
+};
+
+// ---------------------------
+// - HashReferenceXInterface -
+// ---------------------------
+
+struct HashReferenceXInterface
+{
+ size_t operator()( const Reference< XInterface >& rxIf ) const { return reinterpret_cast< size_t >( rxIf.get() ); }
+};
+
+// -------------
+// - SVGFilter -
+// -------------
+
+class SVGFontExport;
+class SVGActionWriter;
+class EditFieldInfo;
+
+#ifdef SOLAR_JAVA
+class SVGFilter : public cppu::WeakImplHelper5 < XFilter,
+ XImporter,
+ XExporter,
+ XInitialization,
+ XServiceInfo >
+#else // !SOLAR_JAVA
+class SVGFilter : public cppu::WeakImplHelper4 < XFilter,
+ XExporter,
+ XInitialization,
+ XServiceInfo >
+#endif
+{
+ typedef ::std::hash_map< Reference< XInterface >, ObjectRepresentation, HashReferenceXInterface > ObjectMap;
+
+private:
+
+ Reference< XMultiServiceFactory > mxMSF;
+ SvXMLElementExport* mpSVGDoc;
+ SVGExport* mpSVGExport;
+ SVGFontExport* mpSVGFontExport;
+ SVGActionWriter* mpSVGWriter;
+ SdrPage* mpDefaultSdrPage;
+ SdrModel* mpSdrModel;
+ sal_Bool mbPresentation;
+
+ ObjectMap* mpObjects;
+ Reference< XComponent > mxSrcDoc;
+#ifdef SOLAR_JAVA
+ Reference< XComponent > mxDstDoc;
+#endif
+ Reference< XDrawPage > mxDefaultPage;
+ Link maOldFieldHdl;
+
+#ifdef SOLAR_JAVA
+ sal_Bool implImport( const Sequence< PropertyValue >& rDescriptor ) throw (RuntimeException);
+#endif
+
+ 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 implExportDocument( const Reference< XDrawPages >& rxMasterPages,
+ const Reference< XDrawPages >& rxDrawPages,
+ sal_Int32 nPageToExport );
+
+ sal_Bool implExportPages( const Reference< XDrawPages >& 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 implCreateObjectsFromShapes( const Reference< XShapes >& rxShapes );
+ sal_Bool implCreateObjectsFromShape( const Reference< XShape >& rxShape );
+ sal_Bool implCreateObjectsFromBackground( const Reference< XDrawPage >& rxMasterPage );
+
+ ::rtl::OUString implGetDescriptionFromShape( const Reference< XShape >& rxShape );
+ ::rtl::OUString implGetValidIDFromInterface( const Reference< XInterface >& rxIf );
+
+ DECL_LINK( CalcFieldHdl, EditFieldInfo* );
+
+protected:
+
+ // XFilter
+ virtual sal_Bool SAL_CALL filter( const Sequence< PropertyValue >& rDescriptor ) throw(RuntimeException);
+ virtual void SAL_CALL cancel( ) throw (RuntimeException);
+
+#ifdef SOLAR_JAVA
+ // XImporter
+ virtual void SAL_CALL setTargetDocument( const Reference< XComponent >& xDoc ) throw(IllegalArgumentException, RuntimeException);
+#endif
+
+ // XExporter
+ virtual void SAL_CALL setSourceDocument( const Reference< XComponent >& xDoc ) throw(IllegalArgumentException, RuntimeException);
+
+ // XInitialization
+ virtual void SAL_CALL initialize( const Sequence< Any >& aArguments ) throw(Exception, RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw(RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(RuntimeException);
+ virtual Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(RuntimeException);
+
+public:
+
+ SVGFilter( const Reference< XMultiServiceFactory > &rxMSF );
+ virtual ~SVGFilter();
+};
+
+// -----------------------------------------------------------------------------
+
+::rtl::OUString SVGFilter_getImplementationName ()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SAL_CALL SVGFilter_supportsService( const ::rtl::OUString& ServiceName )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+// -----------------------------------------------------------------------------
+
+::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL SVGFilter_getSupportedServiceNames( )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+// -----------------------------------------------------------------------------
+
+::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
+SAL_CALL SVGFilter_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr)
+ throw ( ::com::sun::star::uno::Exception );
+
+#endif // SVGFILTER_HXX
diff --git a/filter/source/svg/svgfontexport.cxx b/filter/source/svg/svgfontexport.cxx
new file mode 100644
index 000000000000..8fa9db03eacf
--- /dev/null
+++ b/filter/source/svg/svgfontexport.cxx
@@ -0,0 +1,258 @@
+ /*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+
+#include "svgfontexport.hxx"
+
+static const sal_Int32 nFontEM = 2048;
+
+// -----------------
+// - SVGFontExport -
+// -----------------
+
+SVGFontExport::SVGFontExport( SvXMLExport& rExport, const ::std::vector< ObjectRepresentation >& rObjects ) :
+ mrExport( rExport ),
+ maObjects( rObjects ),
+ mnCurFontId( 0 )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+SVGFontExport::~SVGFontExport()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+void SVGFontExport::implCollectGlyphs()
+{
+ VirtualDevice aVDev;
+ ObjectVector::const_iterator aIter( maObjects.begin() );
+
+ aVDev.EnableOutput( sal_False );
+
+ while( aIter != maObjects.end() )
+ {
+ if( (*aIter).HasRepresentation() )
+ {
+ const GDIMetaFile& rMtf = (*aIter).GetRepresentation();
+
+ aVDev.Push();
+
+ for( sal_uInt32 i = 0, nCount = rMtf.GetActionCount(); i < nCount; ++i )
+ {
+ ::rtl::OUString aText;
+ MetaAction* pAction = rMtf.GetAction( i );
+ const USHORT nType = pAction->GetType();
+
+ switch( nType )
+ {
+ case( META_TEXT_ACTION ):
+ {
+ const MetaTextAction* pA = (const MetaTextAction*) pAction;
+ aText = String( pA->GetText(), pA->GetIndex(), pA->GetLen() );
+ }
+ break;
+
+ case( META_TEXTRECT_ACTION ):
+ {
+ const MetaTextRectAction* pA = (const MetaTextRectAction*) pAction;
+ aText = pA->GetText();
+ }
+ break;
+
+ case( META_TEXTARRAY_ACTION ):
+ {
+ const MetaTextArrayAction* pA = (const MetaTextArrayAction*) pAction;
+ aText = String( pA->GetText(), pA->GetIndex(), pA->GetLen() );
+ }
+ break;
+
+ case( META_STRETCHTEXT_ACTION ):
+ {
+ const MetaStretchTextAction* pA = (const MetaStretchTextAction*) pAction;
+ aText = String( pA->GetText(), pA->GetIndex(), pA->GetLen() );
+ }
+ break;
+
+ default:
+ pAction->Execute( &aVDev );
+ break;
+ }
+
+ if( aText.getLength() )
+ {
+ const String& rFontName = aVDev.GetFont().GetName();
+ const sal_Unicode* pStr = aText.getStr();
+
+ for( sal_uInt32 j = 0, nLen = aText.getLength(); j < nLen; ++j )
+ maGlyphs[ rFontName ].insert( pStr[ j ] );
+ }
+ }
+
+ aVDev.Pop();
+ }
+
+ ++aIter;
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void SVGFontExport::implEmbedFont( const ::rtl::OUString& rFontName, const ::std::set< sal_Unicode >& rGlyphs )
+{
+#ifdef _SVG_EMBED_FONTS
+ ::std::set< sal_Unicode >::const_iterator aIter( rGlyphs.begin() );
+ const ::rtl::OUString aEmbeddedFontStr( B2UCONST( "EmbeddedFont_" ) );
+
+ {
+ SvXMLElementExport aExp( mrExport, XML_NAMESPACE_NONE, "defs", TRUE, TRUE );
+ ::rtl::OUString aCurIdStr( aEmbeddedFontStr );
+ ::rtl::OUString aUnitsPerEM( SVGActionWriter::GetValueString( nFontEM ) );
+ VirtualDevice aVDev;
+ Font aFont( rFontName, Size( 0, nFontEM ) );
+
+ aVDev.SetMapMode( MAP_100TH_MM );
+ aFont.SetAlign( ALIGN_BASELINE );
+ aVDev.SetFont( aFont );
+
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, "id", aCurIdStr += SVGActionWriter::GetValueString( ++mnCurFontId ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, "horiz-adv-x", aUnitsPerEM );
+
+ {
+ SvXMLElementExport aExp2( mrExport, XML_NAMESPACE_NONE, "font", TRUE, TRUE );
+ Point aPos;
+ Size aSize( nFontEM, nFontEM );
+ PolyPolygon aMissingGlyphPolyPoly( Rectangle( aPos, aSize ) );
+
+ aMissingGlyphPolyPoly.Move( 0, -nFontEM );
+ aMissingGlyphPolyPoly.Scale( 1.0, -1.0 );
+
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, "font-family", GetMappedFontName( rFontName ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, "units-per-em", aUnitsPerEM );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, "ascent", SVGActionWriter::GetValueString( aVDev.GetFontMetric().GetAscent() ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, "descent", SVGActionWriter::GetValueString( aVDev.GetFontMetric().GetDescent() ) );
+
+ {
+ SvXMLElementExport aExp3( mrExport, XML_NAMESPACE_NONE, "font-face", TRUE, TRUE );
+ }
+
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, "horiz-adv-x", SVGActionWriter::GetValueString( aSize.Width() ) );
+
+ {
+ SvXMLElementExport aExp3( mrExport, XML_NAMESPACE_NONE, "missing-glyph", TRUE, TRUE );
+
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, "style", B2UCONST( "fill:none;stroke:black;stroke-width:33" ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, "d", SVGActionWriter::GetPathString( aMissingGlyphPolyPoly, sal_False ) );
+
+ {
+ SvXMLElementExport aExp4( mrExport, XML_NAMESPACE_NONE, "path", TRUE, TRUE );
+ }
+ }
+
+ while( aIter != rGlyphs.end() )
+ {
+ implEmbedGlyph( aVDev, ::rtl::OUString( *aIter ) );
+ ++aIter;
+ }
+ }
+ }
+#endif
+}
+
+// -----------------------------------------------------------------------------
+
+void SVGFontExport::implEmbedGlyph( OutputDevice& rOut, const ::rtl::OUString& rGlyphs )
+{
+ PolyPolygon aPolyPoly;
+ ::rtl::OUString aStr( rGlyphs );
+ const sal_Unicode nSpace = ' ';
+
+ if( rOut.GetTextOutline( aPolyPoly, aStr ) )
+ {
+ Rectangle aBoundRect;
+
+ aPolyPoly.Scale( 1.0, -1.0 );
+
+ if( !rOut.GetTextBoundRect( aBoundRect, aStr ) )
+ aBoundRect = Rectangle( Point( 0, 0 ), Size( rOut.GetTextWidth( aStr ), 0 ) );
+
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, "unicode", aStr );
+
+ if( rGlyphs[ 0 ] == nSpace )
+ aBoundRect = Rectangle( Point( 0, 0 ), Size( rOut.GetTextWidth( sal_Unicode( 'x' ) ), 0 ) );
+
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, "horiz-adv-x", SVGActionWriter::GetValueString( aBoundRect.GetWidth() ) );
+
+ {
+ SvXMLElementExport aExp( mrExport, XML_NAMESPACE_NONE, "glyph", TRUE, TRUE );
+ const ::rtl::OUString aPathString( SVGActionWriter::GetPathString( aPolyPoly, sal_False ) );
+
+ if( aPathString.getLength() )
+ {
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, "d", aPathString );
+
+ {
+ SvXMLElementExport aElem( mrExport, XML_NAMESPACE_NONE, B2UCONST( "path" ), TRUE, TRUE );
+ }
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void SVGFontExport::EmbedFonts()
+{
+ implCollectGlyphs();
+
+ GlyphMap::const_iterator aIter( maGlyphs.begin() );
+
+ while( aIter != maGlyphs.end() )
+ {
+ implEmbedFont( (*aIter).first, (*aIter).second );
+ ++aIter;
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+::rtl::OUString SVGFontExport::GetMappedFontName( const ::rtl::OUString& rFontName ) const
+{
+ ::rtl::OUString aRet( String( rFontName ).GetToken( 0, ';' ) );
+
+#ifdef _SVG_EMBED_FONTS
+ if( mnCurFontId )
+ aRet += B2UCONST( " embedded" );
+#endif
+
+ return aRet;
+}
diff --git a/filter/source/svg/svgfontexport.hxx b/filter/source/svg/svgfontexport.hxx
new file mode 100644
index 000000000000..9147efb27a55
--- /dev/null
+++ b/filter/source/svg/svgfontexport.hxx
@@ -0,0 +1,64 @@
+ /*************************************************************************
+ *
+ * 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 SVGFONTEXPORT_HXX
+#define SVGFONTEXPORT_HXX
+
+#include <comphelper/stl_types.hxx>
+#include "svgfilter.hxx"
+#include "svgwriter.hxx"
+
+// -----------------
+// - SVGFontExport -
+// -----------------
+
+class SVGFontExport
+{
+ typedef ::std::hash_map< ::rtl::OUString, ::std::set< sal_Unicode >, ::comphelper::UStringHash > GlyphMap;
+ typedef ::std::vector< ObjectRepresentation > ObjectVector;
+
+private:
+
+ SvXMLExport& mrExport;
+ GlyphMap maGlyphs;
+ ObjectVector maObjects;
+ sal_uInt32 mnCurFontId;
+
+ void implCollectGlyphs();
+ void implEmbedFont( const ::rtl::OUString& rFontName, const ::std::set< sal_Unicode >& rGlyphs );
+ void implEmbedGlyph( OutputDevice& rOut, const ::rtl::OUString& rGlyphs );
+
+public:
+
+ SVGFontExport( SvXMLExport& rExport, const ::std::vector< ObjectRepresentation >& rObjects );
+ ~SVGFontExport();
+
+ void EmbedFonts();
+ ::rtl::OUString GetMappedFontName( const ::rtl::OUString& rFontName ) const;
+};
+
+#endif
diff --git a/filter/source/svg/svgimport.cxx b/filter/source/svg/svgimport.cxx
new file mode 100644
index 000000000000..fd4f711cb085
--- /dev/null
+++ b/filter/source/svg/svgimport.cxx
@@ -0,0 +1,188 @@
+ /*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include "svgfilter.hxx"
+#include "rtl/ref.hxx"
+#include "jvmaccess/virtualmachine.hxx"
+// -------------
+// - SVGFilter -
+// -------------
+
+sal_Bool SVGFilter::implImport( const Sequence< PropertyValue >& rDescriptor )
+ throw (RuntimeException)
+{
+ Reference< XMultiServiceFactory > xServiceFactory( ::comphelper::getProcessServiceFactory() ) ;
+ rtl::OUString aTmpFileName;
+ String aFileName;
+ sal_Int32 nLength = rDescriptor.getLength();
+ const PropertyValue* pValue = rDescriptor.getConstArray();
+ sal_Bool bRet = sal_False;
+
+ for( sal_Int32 i = 0 ; ( i < nLength ) && !aTmpFileName.getLength(); i++)
+ if( pValue[ i ].Name.equalsAscii( "FileName" ) )
+ pValue[ i ].Value >>= aTmpFileName;
+
+ if( aTmpFileName.getLength() && xServiceFactory.is() )
+ {
+
+ Reference< XJavaVM > xJavaVM( xServiceFactory->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.java.JavaVirtualMachine") ) ), UNO_QUERY );
+ Sequence< sal_Int8 > aProcessID( 17 );
+ String aLocalFile;
+
+ if( ::utl::LocalFileHelper::ConvertURLToPhysicalName( aTmpFileName, aLocalFile ) && aLocalFile.Len() )
+ {
+ rtl_getGlobalProcessId( (sal_uInt8 *) aProcessID.getArray() );
+ aProcessID[16] = 0;
+
+ OSL_ENSURE(sizeof (sal_Int64)
+ >= sizeof (jvmaccess::VirtualMachine *),
+ "Pointer cannot be represented as sal_Int64");
+ sal_Int64 nPointer = reinterpret_cast< sal_Int64 >(
+ static_cast< jvmaccess::VirtualMachine * >(0));
+ xJavaVM->getJavaVM(aProcessID) >>= nPointer;
+ rtl::Reference<jvmaccess::VirtualMachine> _virtualMachine =
+ reinterpret_cast< jvmaccess::VirtualMachine * >(nPointer);
+ if (!_virtualMachine.is())
+ return bRet;
+
+ jobjectArray aArgs;
+ jclass aClass;
+ jmethodID aMId;
+ jstring aJStr;
+
+ try
+ {
+ jvmaccess::VirtualMachine::AttachGuard vmGuard(_virtualMachine);
+
+ JNIEnv * pEnv = vmGuard.getEnvironment();
+
+ aClass = pEnv->FindClass( "SOTranscoder" );
+
+ if( aClass )
+ {
+ aMId = pEnv->GetStaticMethodID( aClass, "main", "([Ljava/lang/String;)V" );
+ if ( aMId )
+ {
+
+ ::utl::TempFile aTempFile;
+ String aOutputURL( aTempFile.GetURL() );
+ String aOutputFile;
+
+ aTempFile.EnableKillingFile();
+
+ if( ::utl::LocalFileHelper::ConvertURLToPhysicalName( aOutputURL, aOutputFile ) && aOutputFile.Len() )
+ {
+ aJStr = pEnv->NewStringUTF( ByteString( aLocalFile.GetBuffer(), RTL_TEXTENCODING_UTF8 ).GetBuffer() );
+ aArgs = static_cast<jobjectArray>(pEnv->NewObjectArray( 2, pEnv->FindClass( "java/lang/String" ), aJStr ));
+ aJStr = pEnv->NewStringUTF( ByteString( aOutputFile.GetBuffer(), RTL_TEXTENCODING_UTF8 ).GetBuffer() );
+ pEnv->SetObjectArrayElement( aArgs, 1, aJStr );
+ pEnv->CallStaticVoidMethod( aClass, aMId, aArgs );
+
+ Graphic aGraphic;
+ SvStream* pIStm = ::utl::UcbStreamHelper::CreateStream( aOutputURL, STREAM_READ );
+
+ if( pIStm )
+ {
+ GraphicConverter::Import( *pIStm, aGraphic );
+ delete pIStm;
+ }
+
+ Reference< XDrawPagesSupplier > xDrawPagesSupplier( mxDstDoc, UNO_QUERY );
+
+ if( xDrawPagesSupplier.is() && ( aGraphic.GetType() != GRAPHIC_NONE ) )
+ {
+ Reference< XDrawPages > xDrawPages( xDrawPagesSupplier->getDrawPages() );
+
+ if( xDrawPages.is() && xDrawPages->getCount() )
+ {
+ Reference< XDrawPage > xDrawPage;
+
+ if( xDrawPages->getByIndex( 0 ) >>= xDrawPage )
+ {
+ Reference< XShapes > xShapes( xDrawPage, UNO_QUERY );
+ Reference< XPropertySet> xPagePropSet( xDrawPage, UNO_QUERY );
+ Reference< XShape > xShape( Reference< XMultiServiceFactory >( mxDstDoc, UNO_QUERY )->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.GraphicObjectShape" ) ) ), UNO_QUERY );
+
+ if( xPagePropSet.is() && xShapes.is() && xShape.is() )
+ {
+ Reference< XPropertySet > xPropSet( xShape, UNO_QUERY );
+ sal_Int32 nPageWidth = 0, nPageHeight = 0;
+
+ xPagePropSet->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Width" ) ) ) >>= nPageWidth;
+ xPagePropSet->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Height" ) ) ) >>= nPageHeight;
+
+ if( xPropSet.is() && nPageWidth && nPageHeight )
+ {
+ xShapes->add( xShape );
+
+ ::com::sun::star::awt::Point aPos;
+ ::com::sun::star::awt::Size aSize;
+ GraphicObject aGraphObj( aGraphic );
+ String aGraphURL( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.GraphicObject:" ) );
+ Any aValue;
+ Size aGraphicSize;
+ const MapMode aTargetMapMode( MAP_100TH_MM );
+
+ if( aGraphObj.GetPrefMapMode().GetMapUnit() == MAP_PIXEL )
+ aGraphicSize = Application::GetDefaultDevice()->PixelToLogic( aGraphObj.GetPrefSize(), aTargetMapMode );
+ else
+ aGraphicSize = OutputDevice::LogicToLogic( aGraphObj.GetPrefSize(), aGraphObj.GetPrefMapMode(), aTargetMapMode );
+
+ aGraphURL += String( aGraphObj.GetUniqueID(), RTL_TEXTENCODING_ASCII_US );
+ aValue <<= rtl::OUString( aGraphURL );
+ xPropSet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "GraphicURL" ) ), aValue );
+
+ aPos.X = ( nPageWidth - aGraphicSize.Width() ) >> 1;
+ aPos.Y = ( nPageHeight - aGraphicSize.Height() ) >> 1;
+
+ aSize.Width = aGraphicSize.Width();
+ aSize.Height = aGraphicSize.Height();
+
+ xShape->setPosition( aPos );
+ xShape->setSize( aSize );
+
+ bRet = sal_True;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ catch (jvmaccess::VirtualMachine::AttachGuard::CreationException &)
+ {
+ }
+ }
+ }
+ return bRet;
+}
+
diff --git a/filter/source/svg/svgscript.hxx b/filter/source/svg/svgscript.hxx
new file mode 100644
index 000000000000..9be9f268dd91
--- /dev/null
+++ b/filter/source/svg/svgscript.hxx
@@ -0,0 +1,209 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+static const char aSVGScript1[] =
+"<![CDATA[\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\
+ {\n\
+ var nOffset = 0;\n\
+\n\
+ if( aEvt.getButton() == 0 ) \n\
+ nOffset = 1;\n\
+ else if( aEvt.getButton() == 2 ) \n\
+ nOffset = -1;\n\
+\n\
+ if( 0 != nOffset )\n\
+ switchSlide( aEvt, nOffset );\n\
+ }\n\
+\n\
+ function onKeyPress( aEvt ) \n\
+ {\n\
+ var nCode = String.fromCharCode( aEvt.getCharCode() );\n\
+ var nOffset = 0;\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\
+ {\n\
+ nOffset = 1;\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\
+ {\n\
+ nOffset = -1\n\
+ }\n\
+\n\
+ if( 0 != nOffset )\n\
+ switchSlide( aEvt, nOffset );\n\
+ }\n\
+\n\
+";
+
+static const char aSVGScript2[] =
+" function switchSlide( aEvt, nOffset ) \n\
+ {\n\
+ var nNextSlide = nCurSlide + nOffset;\n\
+\n\
+ if( nNextSlide < 0 && nSlides > 0 )\n\
+ nNextSlide = nSlides - 1;\n\
+ else if( nNextSlide >= nSlides ) \n\
+ nNextSlide = 0;\n\
+\n\
+ aSlides[ nCurSlide ].setAttributeNS( null, \"visibility\", \"hidden\" );\n\
+ aSlides[ nNextSlide ].setAttributeNS( null, \"visibility\", \"visible\" );\n\
+\n\
+ var aCurMaster = aMasters[ nCurSlide ];\n\
+ var aCurMasterVisibility = aMasterVisibilities[ nCurSlide ];\n\
+ \n\
+ var aNextMaster = aMasters[ nNextSlide ];\n\
+ var aNextMasterVisibility = aMasterVisibilities[ nNextSlide ];\n\
+\n\
+ if( ( aCurMaster != aNextMaster ) || ( aCurMasterVisibility != aNextMasterVisibility ) ) \n\
+ {\n\
+ if( aCurMaster != aNextMaster )\n\
+ aCurMaster.setAttributeNS( null, \"visibility\", \"hidden\" );\n\
+ \n\
+ aNextMaster.setAttributeNS( null, \"visibility\", aNextMasterVisibility );\n\
+ }\n\
+\n\
+ nCurSlide = nNextSlide; \n\
+ }\n\
+\n\
+ function init() \n\
+ {\n\
+ nSlides = document.getElementById( \"meta_slides\" ).getAttributeNS( null, \"numberOfSlides\" );\n\
+\n\
+ for( i = 0; i < nSlides; i++ )\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\
+ }\n\
+ }\n\
+\n\
+ init();\n\
+]]>";
+
+/*
+<![CDATA[
+ var nCurSlide = 0;
+ var nSlides = 0;
+ var aSlides = new Object();
+ var aMasters = new Object();
+ var aMasterVisibilities;
+
+ function onClick( aEvt )
+ {
+ var nOffset = 0;
+
+ if( aEvt.getButton() == 0 )
+ nOffset = 1;
+ else if( aEvt.getButton() == 2 )
+ nOffset = -1;
+
+ if( 0 != nOffset )
+ switchSlide( aEvt, nOffset );
+ }
+
+ function onKeyPress( aEvt )
+ {
+ var nCode = String.fromCharCode( aEvt.getCharCode() );
+ var nOffset = 0;
+
+ if( ( ' ' == nCode ) ||
+ ( ( !aEvt.getCtrlKey() && !aEvt.getAltKey() && !aEvt.getMetaKey() && !aEvt.getShiftKey() ) &&
+ ( aEvt.getKeyCode() == aEvt.DOM_VK_PAGE_DOWN() ||
+ aEvt.getKeyCode() == aEvt.DOM_VK_PAGE_RIGHT() ) ) )
+ {
+ nOffset = 1;
+ }
+ else if( ( !aEvt.getCtrlKey() && !aEvt.getAltKey() && !aEvt.getMetaKey() && !aEvt.getShiftKey() ) &&
+ ( aEvt.getKeyCode() == aEvt.DOM_VK_PAGE_UP() ||
+ aEvt.getKeyCode() == aEvt.DOM_VK_LEFT() ) )
+ {
+ nOffset = -1
+ }
+
+ if( 0 != nOffset )
+ switchSlide( aEvt, nOffset );
+ }
+
+ function switchSlide( aEvt, nOffset )
+ {
+ var nNextSlide = nCurSlide + nOffset;
+
+ if( nNextSlide < 0 && nSlides > 0 )
+ nNextSlide = nSlides - 1;
+ else if( nNextSlide >= nSlides )
+ nNextSlide = 0;
+
+ aSlides[ nCurSlide ].setAttributeNS( null, "visibility", "hidden" );
+ aSlides[ nNextSlide ].setAttributeNS( null, "visibility", "visible" );
+
+ var aCurMaster = aMasters[ nCurSlide ];
+ var aCurMasterVisibility = aMasterVisibilities[ nCurSlide ];
+
+ var aNextMaster = aMasters[ nNextSlide ];
+ var aNextMasterVisibility = aMasterVisibilities[ nNextSlide ];
+
+ if( ( aCurMaster != aNextMaster ) || ( aCurMasterVisibility != aNextMasterVisibility ) )
+ {
+ if( aCurMaster != aNextMaster )
+ aCurMaster.setAttributeNS( null, "visibility", "hidden" );
+
+ aNextMaster.setAttributeNS( null, "visibility", aNextMasterVisibility );
+ }
+
+ nCurSlide = nNextSlide;
+ }
+
+ function init()
+ {
+ nSlides = document.getElementById( "meta_slides" ).getAttributeNS( null, "numberOfSlides" );
+
+ for( i = 0; i < nSlides; i++ )
+ {
+ var aSlide = document.getElementById( "meta_slide" + i );
+
+ aSlides[ i ] = document.getElementById( aSlide.getAttributeNS( null, "slide" ) );
+ aMasters[ i ] = document.getElementById( aSlide.getAttributeNS( null, "master" ) );
+ aMasterVisibilities[ i ] = aSlide.getAttributeNS( null, "master-visibility" );
+ }
+ }
+
+ init();
+]]*/
diff --git a/filter/source/svg/svguno.cxx b/filter/source/svg/svguno.cxx
new file mode 100644
index 000000000000..aa91889fc93f
--- /dev/null
+++ b/filter/source/svg/svguno.cxx
@@ -0,0 +1,102 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include <stdio.h>
+#include <osl/mutex.hxx>
+#include <osl/thread.h>
+#include <cppuhelper/factory.hxx>
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+
+#include <svgfilter.hxx>
+
+using ::rtl::OUString;
+using namespace ::cppu;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+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 sal_Bool SAL_CALL component_writeInfo(
+ void * /* pServiceManager */, void * pRegistryKey )
+ {
+ if (pRegistryKey)
+ {
+ try
+ {
+ Reference< XRegistryKey > xNewKey(
+ reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( SVGFilter_getImplementationName() ) );
+ xNewKey = xNewKey->createKey( OUString::createFromAscii( "/UNO/SERVICES" ) );
+
+ const Sequence< OUString > & rSNL = SVGFilter_getSupportedServiceNames();
+ const OUString * pArray = rSNL.getConstArray();
+ for ( sal_Int32 nPos = rSNL.getLength(); nPos--; )
+ xNewKey->createKey( pArray[nPos] );
+
+ return sal_True;
+ }
+ catch (InvalidRegistryException &)
+ {
+ OSL_ENSURE( sal_False, "### InvalidRegistryException!" );
+ }
+ }
+ return sal_False;
+ }
+ //==================================================================================================
+ SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
+ const sal_Char * pImplName, void * pServiceManager, void * /* pRegistryKey */ )
+ {
+ void * pRet = 0;
+
+ OUString implName = OUString::createFromAscii( pImplName );
+ if ( pServiceManager && implName.equals(SVGFilter_getImplementationName()) )
+ {
+ Reference< XSingleServiceFactory > xFactory( createSingleFactory(
+ reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
+ OUString::createFromAscii( pImplName ),
+ SVGFilter_createInstance, SVGFilter_getSupportedServiceNames() ) );
+
+ if (xFactory.is())
+ {
+ xFactory->acquire();
+ pRet = xFactory.get();
+ }
+ }
+
+ return pRet;
+ }
+}
diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx
new file mode 100644
index 000000000000..15f83c3be407
--- /dev/null
+++ b/filter/source/svg/svgwriter.cxx
@@ -0,0 +1,1657 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include "svgfontexport.hxx"
+#include "svgwriter.hxx"
+
+// -----------
+// - statics -
+// -----------
+
+static const char aXMLElemG[] = "g";
+static const char aXMLElemDefs[] = "defs";
+static const char aXMLElemClipPath[] = "clipPath";
+static const char aXMLElemLine[] = "line";
+static const char aXMLElemRect[] = "rect";
+static const char aXMLElemEllipse[] = "ellipse";
+static const char aXMLElemPath[] = "path";
+static const char aXMLElemPolygon[] = "polygon";
+static const char aXMLElemPolyLine[] = "polyline";
+static const char aXMLElemText[] = "text";
+static const char aXMLElemTSpan[] = "tspan";
+static const char aXMLElemImage[] = "image";
+
+static const char aXMLAttrTransform[] = "transform";
+static const char aXMLAttrStyle[] = "style";
+static const char aXMLAttrId[] = "id";
+static const char aXMLAttrD[] = "d";
+static const char aXMLAttrX[] = "x";
+static const char aXMLAttrY[] = "y";
+static const char aXMLAttrX1[] = "x1";
+static const char aXMLAttrY1[] = "y1";
+static const char aXMLAttrX2[] = "x2";
+static const char aXMLAttrY2[] = "y2";
+static const char aXMLAttrCX[] = "cx";
+static const char aXMLAttrCY[] = "cy";
+static const char aXMLAttrRX[] = "rx";
+static const char aXMLAttrRY[] = "ry";
+static const char aXMLAttrWidth[] = "width";
+static const char aXMLAttrHeight[] = "height";
+static const char aXMLAttrPoints[] = "points";
+static const char aXMLAttrXLinkHRef[] = "xlink:href";
+
+static const sal_Unicode pBase64[] =
+{
+ //0 1 2 3 4 5 6 7
+ 'A','B','C','D','E','F','G','H', // 0
+ 'I','J','K','L','M','N','O','P', // 1
+ 'Q','R','S','T','U','V','W','X', // 2
+ 'Y','Z','a','b','c','d','e','f', // 3
+ 'g','h','i','j','k','l','m','n', // 4
+ 'o','p','q','r','s','t','u','v', // 5
+ 'w','x','y','z','0','1','2','3', // 6
+ '4','5','6','7','8','9','+','/' // 7
+};
+
+// --------------
+// - FastString -
+// --------------
+
+FastString::FastString( sal_uInt32 nInitLen, sal_uInt32 nIncrement ) :
+ mnBufLen( nInitLen ),
+ mnCurLen( 0 ),
+ mnBufInc( nIncrement ),
+ mpBuffer( new sal_Unicode[ nInitLen * sizeof( sal_Unicode ) ] ),
+ mnPartPos( 0 )
+{
+ DBG_ASSERT( nInitLen, "invalid initial length" );
+ DBG_ASSERT( nIncrement, "invalid increment" );
+}
+
+// -----------------------------------------------------------------------------
+
+FastString::FastString( sal_Char* pBufferForBase64Encoding, sal_uInt32 nBufLen ) :
+ mnBufInc( 2048 ),
+ mnPartPos( 0 )
+{
+ DBG_ASSERT( pBufferForBase64Encoding && nBufLen, "invalid arguments" );
+
+ const sal_uInt32 nQuadCount = nBufLen / 3;
+ const sal_uInt32 nRest = nBufLen % 3;
+
+ if( nQuadCount || nRest )
+ {
+ mnBufLen = mnCurLen = ( ( nQuadCount + ( nRest ? 1 : 0 ) ) << 2 );
+ mpBuffer = new sal_Unicode[ mnBufLen * sizeof( sal_Unicode ) ];
+
+ sal_Char* pTmpSrc = pBufferForBase64Encoding;
+ sal_Unicode* pTmpDst = mpBuffer;
+
+ for( sal_uInt32 i = 0; i < nQuadCount; i++ )
+ {
+ const sal_Int32 nA = *pTmpSrc++;
+ const sal_Int32 nB = *pTmpSrc++;
+ const sal_Int32 nC = *pTmpSrc++;
+
+ *pTmpDst++ = pBase64[ ( nA >> 2 ) & 0x3f ];
+ *pTmpDst++ = pBase64[ ( ( nA << 4 ) & 0x30 ) + ( ( nB >> 4 ) & 0xf ) ];
+ *pTmpDst++ = pBase64[ ( ( nB << 2 ) & 0x3c ) + ( ( nC >> 6 ) & 0x3 ) ];
+ *pTmpDst++ = pBase64[ nC & 0x3f ];
+ }
+
+ if( 1 == nRest )
+ {
+ const sal_Int32 nA = *pTmpSrc;
+
+ *pTmpDst++ = pBase64[ ( nA >> 2 ) & 0x3f ];
+ *pTmpDst++ = pBase64[ ( nA << 4 ) & 0x30 ];
+ *pTmpDst++ = '=';
+ *pTmpDst = '=';
+ }
+ else if( 2 == nRest )
+ {
+ const sal_Int32 nA = *pTmpSrc++;
+ const sal_Int32 nB = *pTmpSrc;
+
+ *pTmpDst++ = pBase64[ ( nA >> 2 ) & 0x3f ];
+ *pTmpDst++ = pBase64[ ( ( nA << 4 ) & 0x30 ) + ( ( nB >> 4 ) & 0xf ) ];
+ *pTmpDst++ = pBase64[ ( nB << 2 ) & 0x3c ];
+ *pTmpDst = '=';
+ }
+ }
+ else
+ {
+ mpBuffer = new sal_Unicode[ ( mnBufLen = 1 ) * sizeof( sal_Unicode ) ];
+ mnCurLen = 0;
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+FastString::~FastString()
+{
+ delete[] mpBuffer;
+}
+
+// -----------------------------------------------------------------------------
+
+FastString& FastString::operator+=( const NMSP_RTL::OUString& rStr )
+{
+ if( rStr.getLength() )
+ {
+ if( ( mnCurLen + rStr.getLength() ) > mnBufLen )
+ {
+ const sal_uInt32 nNewBufLen = ( mnBufLen + ( ( ( mnCurLen + rStr.getLength() ) - mnBufLen ) / mnBufInc + 1 ) * mnBufInc );
+ sal_Unicode* pNewBuffer = new sal_Unicode[ nNewBufLen * sizeof( sal_Unicode ) ];
+
+ memcpy( pNewBuffer, mpBuffer, mnBufLen * sizeof( sal_Unicode ) );
+ delete[] mpBuffer;
+ mpBuffer = pNewBuffer;
+ mnBufLen = nNewBufLen;
+ }
+
+ memcpy( mpBuffer + mnCurLen, rStr.getStr(), rStr.getLength() * sizeof( sal_Unicode ) );
+ mnCurLen += rStr.getLength();
+
+ if( maString.getLength() )
+ maString = NMSP_RTL::OUString();
+ }
+
+ return *this;
+}
+
+// -----------------------------------------------------------------------------
+
+const NMSP_RTL::OUString& FastString::GetString() const
+{
+ if( !maString.getLength() && mnCurLen )
+ ( (FastString*) this )->maString = NMSP_RTL::OUString( mpBuffer, mnCurLen );
+
+ return maString;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool FastString::GetFirstPartString( const sal_uInt32 nPartLen, NMSP_RTL::OUString& rPartString )
+{
+ const sal_uInt32 nLength = Min( mnCurLen, nPartLen );
+
+ mnPartPos = 0;
+
+ if( nLength )
+ {
+ rPartString = NMSP_RTL::OUString( mpBuffer, nLength );
+ mnPartPos = nLength;
+ }
+
+ return( rPartString.getLength() > 0 );
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool FastString::GetNextPartString( const sal_uInt32 nPartLen, NMSP_RTL::OUString& rPartString )
+{
+ if( mnPartPos < mnCurLen )
+ {
+ const sal_uInt32 nLength = Min( mnCurLen - mnPartPos, nPartLen );
+ rPartString = NMSP_RTL::OUString( mpBuffer + mnPartPos, nLength );
+ mnPartPos += nLength;
+ }
+ else
+ rPartString = NMSP_RTL::OUString();
+
+ return( rPartString.getLength() > 0 );
+}
+
+// ----------------------
+// - SVGAttributeWriter -
+// ----------------------
+
+SVGAttributeWriter::SVGAttributeWriter( SvXMLExport& rExport, SVGFontExport& rFontExport ) :
+ mrExport( rExport ),
+ mrFontExport( rFontExport ),
+ mpElemFont( NULL ),
+ mpElemPaint( NULL )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+SVGAttributeWriter::~SVGAttributeWriter()
+{
+ delete mpElemPaint;
+ delete mpElemFont;
+}
+
+// -----------------------------------------------------------------------------
+
+NMSP_RTL::OUString SVGAttributeWriter::GetFontStyle( const Font& rFont )
+{
+ FastString aStyle;
+
+ // font family
+ aStyle += B2UCONST( "font-family:" );
+ aStyle += mrFontExport.GetMappedFontName( rFont.GetName() );
+
+ // font size
+ aStyle += B2UCONST( ";" );
+ aStyle += B2UCONST( "font-size:" );
+ aStyle += SVGActionWriter::GetValueString( rFont.GetHeight() );
+
+ // font style
+/*
+ if( rFont.GetItalic() != ITALIC_NONE )
+ {
+ aStyle += B2UCONST( ";" );
+ aStyle += B2UCONST( "font-style:" );
+
+ if( rFont.GetItalic() == ITALIC_OBLIQUE )
+ aStyle += B2UCONST( "oblique" );
+ else
+ aStyle += B2UCONST( "italic" );
+ }
+*/
+
+ // font weight
+ sal_Int32 nFontWeight;
+
+ switch( rFont.GetWeight() )
+ {
+ case WEIGHT_THIN: nFontWeight = 100; break;
+ case WEIGHT_ULTRALIGHT: nFontWeight = 200; break;
+ case WEIGHT_LIGHT: nFontWeight = 300; break;
+ case WEIGHT_SEMILIGHT: nFontWeight = 400; break;
+ case WEIGHT_NORMAL: nFontWeight = 400; break;
+ case WEIGHT_MEDIUM: nFontWeight = 500; break;
+ case WEIGHT_SEMIBOLD: nFontWeight = 600; break;
+ case WEIGHT_BOLD: nFontWeight = 700; break;
+ case WEIGHT_ULTRABOLD: nFontWeight = 800; break;
+ case WEIGHT_BLACK: nFontWeight = 900; break;
+ default: nFontWeight = 400; break;
+ }
+
+ aStyle += B2UCONST( ";" );
+ aStyle += B2UCONST( "font-weight:" );
+ aStyle += NMSP_RTL::OUString::valueOf( nFontWeight );
+
+ // !!!
+ // font-variant
+ // font-stretch
+ // font-size-adjust
+
+#ifdef _SVG_USE_NATIVE_TEXTDECORATION
+
+ if( rFont.GetUnderline() != UNDERLINE_NONE || rFont.GetStrikeout() != STRIKEOUT_NONE )
+ {
+ aStyle += B2UCONST( ";" );
+ aStyle += B2UCONST( "text-decoration:" );
+
+ if( rFont.GetUnderline() != UNDERLINE_NONE )
+ aStyle += B2UCONST( " underline" );
+
+ if( rFont.GetStrikeout() != STRIKEOUT_NONE )
+ aStyle += B2UCONST( " line-through" );
+ }
+
+#endif // _SVG_USE_NATIVE_TEXTDECORATION
+
+ return aStyle.GetString();
+}
+
+// -----------------------------------------------------------------------------
+
+NMSP_RTL::OUString SVGAttributeWriter::GetPaintStyle( const Color& rLineColor, const Color& rFillColor, const LineInfo* pLineInfo )
+{
+ FastString aStyle;
+
+ // line color
+ aStyle += B2UCONST( "stroke:" );
+
+ if( rLineColor.GetTransparency() == 255 )
+ aStyle += B2UCONST( "none" );
+ else
+ {
+ // line color value in rgb
+ aStyle += B2UCONST( "rgb(" );
+ aStyle += NMSP_RTL::OUString::valueOf( (sal_Int32) rLineColor.GetRed() );
+ aStyle += B2UCONST( "," );
+ aStyle += NMSP_RTL::OUString::valueOf( (sal_Int32) rLineColor.GetGreen() );
+ aStyle += B2UCONST( "," );
+ aStyle += NMSP_RTL::OUString::valueOf( (sal_Int32) rLineColor.GetBlue() );
+ aStyle += B2UCONST( ")" );
+
+ // line color opacity in percent if neccessary
+ if( rLineColor.GetTransparency() )
+ {
+ aStyle += B2UCONST( ";" );
+ aStyle += B2UCONST( "stroke-opacity:" );
+ aStyle += NMSP_RTL::OUString::valueOf( ( 255 - (double) rLineColor.GetTransparency() ) / 255.0 );
+ }
+
+ if(pLineInfo)
+ {
+ // more infos for line needed
+ if(pLineInfo->GetWidth() > 1)
+ {
+ aStyle += B2UCONST( ";" );
+ aStyle += B2UCONST( "stroke-width:" );
+ aStyle += NMSP_RTL::OUString::valueOf(pLineInfo->GetWidth());
+ }
+
+ if(LINE_DASH == pLineInfo->GetStyle())
+ {
+ aStyle += B2UCONST( ";" );
+ aStyle += B2UCONST( "stroke-dasharray:" );
+ const long nDashLen(pLineInfo->GetDashLen());
+ const long nDotLen(pLineInfo->GetDotLen());
+ const long nDistance(pLineInfo->GetDistance());
+ bool bIsFirst(true);
+
+ for(sal_uInt16 a(0); a < pLineInfo->GetDashCount(); a++)
+ {
+ if(bIsFirst)
+ aStyle += B2UCONST(" "), bIsFirst = false;
+ else
+ aStyle += B2UCONST(",");
+ aStyle += NMSP_RTL::OUString::valueOf(nDashLen);
+ aStyle += B2UCONST(",");
+ aStyle += NMSP_RTL::OUString::valueOf(nDistance);
+ }
+
+ for(sal_uInt16 b(0); b < pLineInfo->GetDotCount(); b++)
+ {
+ if(bIsFirst)
+ aStyle += B2UCONST(" "), bIsFirst = false;
+ else
+ aStyle += B2UCONST(",");
+ aStyle += NMSP_RTL::OUString::valueOf(nDotLen);
+ aStyle += B2UCONST(",");
+ aStyle += NMSP_RTL::OUString::valueOf(nDistance);
+ }
+ }
+
+ if(basegfx::B2DLINEJOIN_MITER != pLineInfo->GetLineJoin())
+ {
+ aStyle += B2UCONST( ";" );
+ aStyle += B2UCONST( "stroke-linejoin:" );
+
+ switch(pLineInfo->GetLineJoin())
+ {
+ default: // B2DLINEJOIN_NONE, B2DLINEJOIN_MIDDLE, B2DLINEJOIN_MITER
+ aStyle += B2UCONST( "miter" );
+ break;
+ case basegfx::B2DLINEJOIN_ROUND:
+ aStyle += B2UCONST( "round" );
+ break;
+ case basegfx::B2DLINEJOIN_BEVEL:
+ aStyle += B2UCONST( "bevel" );
+ break;
+ }
+ }
+ }
+ }
+
+ // fill color
+ aStyle += B2UCONST( ";" );
+ aStyle += B2UCONST( "fill:" );
+
+ if( rFillColor.GetTransparency() == 255 )
+ aStyle += B2UCONST( "none" );
+ else
+ {
+ // fill color value in rgb
+ aStyle += B2UCONST( "rgb(" );
+ aStyle += NMSP_RTL::OUString::valueOf( (sal_Int32) rFillColor.GetRed() );
+ aStyle += B2UCONST( "," );
+ aStyle += NMSP_RTL::OUString::valueOf( (sal_Int32) rFillColor.GetGreen() );
+ aStyle += B2UCONST( "," );
+ aStyle += NMSP_RTL::OUString::valueOf( (sal_Int32) rFillColor.GetBlue() );
+ aStyle += B2UCONST( ")" );
+
+ // fill color opacity in percent if neccessary
+ if( rFillColor.GetTransparency() )
+ {
+ aStyle += B2UCONST( ";" );
+ aStyle += B2UCONST( "fill-opacity:" );
+ aStyle += NMSP_RTL::OUString::valueOf( ( 255 - (double) rFillColor.GetTransparency() ) / 255.0 );
+ }
+ }
+
+ return aStyle.GetString();
+}
+
+// -----------------------------------------------------------------------------
+
+void SVGAttributeWriter::SetFontAttr( const Font& rFont )
+{
+ if( !mpElemFont || ( rFont != maCurFont ) )
+ {
+ delete mpElemPaint, mpElemPaint = NULL;
+ delete mpElemFont;
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStyle, GetFontStyle( maCurFont = rFont ) );
+ mpElemFont = new SvXMLElementExport( mrExport, XML_NAMESPACE_NONE, aXMLElemG, TRUE, TRUE );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void SVGAttributeWriter::SetPaintAttr( const Color& rLineColor, const Color& rFillColor, const LineInfo* pLineInfo )
+{
+ if( !mpElemPaint || ( rLineColor != maCurLineColor ) || ( rFillColor != maCurFillColor ) )
+ {
+ delete mpElemPaint;
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStyle, GetPaintStyle( maCurLineColor = rLineColor, maCurFillColor = rFillColor, pLineInfo ) );
+ mpElemPaint = new SvXMLElementExport( mrExport, XML_NAMESPACE_NONE, aXMLElemG, TRUE, TRUE );
+ }
+}
+
+// -------------------
+// - SVGActionWriter -
+// -------------------
+
+SVGActionWriter::SVGActionWriter( SvXMLExport& rExport, SVGFontExport& rFontExport ) :
+ mrExport( rExport ),
+ mrFontExport( rFontExport ),
+ mpContext( NULL ),
+ mbClipAttrChanged( sal_False ),
+ mnCurClipId( 1 )
+{
+ mpVDev = new VirtualDevice;
+ mpVDev->EnableOutput( sal_False );
+ maTargetMapMode = MAP_100TH_MM;
+}
+
+// -----------------------------------------------------------------------------
+
+SVGActionWriter::~SVGActionWriter()
+{
+ DBG_ASSERT( !mpContext, "Not all contexts are closed" );
+ delete mpVDev;
+}
+
+// -----------------------------------------------------------------------------
+
+long SVGActionWriter::ImplMap( sal_Int32 nVal ) const
+{
+ return ImplMap( Size( nVal, nVal ) ).Width();
+}
+
+// -----------------------------------------------------------------------------
+
+Point SVGActionWriter::ImplMap( const Point& rPt ) const
+{
+ return mpVDev->LogicToLogic( rPt, mpVDev->GetMapMode(), maTargetMapMode );
+}
+
+// -----------------------------------------------------------------------------
+
+Size SVGActionWriter::ImplMap( const Size& rSz ) const
+{
+ return mpVDev->LogicToLogic( rSz, mpVDev->GetMapMode(), maTargetMapMode );
+}
+
+// -----------------------------------------------------------------------------
+
+LineInfo SVGActionWriter::ImplMap( const LineInfo& rLineInfo ) const
+{
+ LineInfo aInfo(rLineInfo);
+ long aTemp(0);
+
+ if(aInfo.GetStyle() == LINE_DASH)
+ {
+ if(aInfo.GetDotCount() && aInfo.GetDotLen())
+ {
+ aTemp = aInfo.GetDotLen();
+ mpVDev->LogicToLogic(&aTemp, 1, &mpVDev->GetMapMode(), &maTargetMapMode);
+ aInfo.SetDotLen(Max(aTemp, 1L));
+ }
+ else
+ aInfo.SetDotCount(0);
+
+ if(aInfo.GetDashCount() && aInfo.GetDashLen())
+ {
+ aTemp = aInfo.GetDashLen();
+ mpVDev->LogicToLogic(&aTemp, 1, &mpVDev->GetMapMode(), &maTargetMapMode);
+ aInfo.SetDashLen(Max(aTemp, 1L));
+ }
+ else
+ aInfo.SetDashCount(0);
+
+ aTemp = aInfo.GetDistance();
+ mpVDev->LogicToLogic(&aTemp, 1, &mpVDev->GetMapMode(), &maTargetMapMode);
+ aInfo.SetDistance(aTemp);
+
+ if((!aInfo.GetDashCount() && !aInfo.GetDotCount()) || !aInfo.GetDistance())
+ aInfo.SetStyle(LINE_SOLID);
+ }
+
+ aTemp = aInfo.GetWidth();
+ mpVDev->LogicToLogic(&aTemp, 1, &mpVDev->GetMapMode(), &maTargetMapMode);
+ aInfo.SetWidth(aTemp);
+
+ return aInfo;
+}
+
+// -----------------------------------------------------------------------------
+
+NMSP_RTL::OUString SVGActionWriter::GetValueString( sal_Int32 nVal )
+{
+ return ::rtl::OUString::valueOf( nVal );
+}
+
+// -----------------------------------------------------------------------------
+
+NMSP_RTL::OUString SVGActionWriter::GetPathString( const PolyPolygon& rPolyPoly, sal_Bool bLine )
+{
+ FastString aPathData;
+ const NMSP_RTL::OUString aBlank( B2UCONST( " " ) );
+ const NMSP_RTL::OUString aComma( B2UCONST( "," ) );
+ Point aPolyPoint;
+
+ for( long i = 0, nCount = rPolyPoly.Count(); i < nCount; i++ )
+ {
+ const Polygon& rPoly = rPolyPoly[ (USHORT) i ];
+ USHORT n = 1, nSize = rPoly.GetSize();
+
+ if( nSize > 1 )
+ {
+ aPathData += B2UCONST( "M " );
+ aPathData += GetValueString( ( aPolyPoint = rPoly[ 0 ] ).X() );
+ aPathData += aComma;
+ aPathData += GetValueString( aPolyPoint.Y() );
+ sal_Char nCurrentMode = 0;
+
+ while( n < nSize )
+ {
+ aPathData += aBlank;
+ if ( ( rPoly.GetFlags( n ) == POLY_CONTROL ) && ( ( n + 2 ) < nSize ) )
+ {
+ if ( nCurrentMode != 'C' )
+ {
+ nCurrentMode = 'C';
+ aPathData += B2UCONST( "C " );
+ }
+ for ( int j = 0; j < 3; j++ )
+ {
+ if ( j )
+ aPathData += aBlank;
+ aPathData += GetValueString( ( aPolyPoint = rPoly[ n++ ] ).X() );
+ aPathData += aComma;
+ aPathData += GetValueString( aPolyPoint.Y() );
+ }
+ }
+ else
+ {
+ if ( nCurrentMode != 'L' )
+ {
+ nCurrentMode = 'L';
+ aPathData += B2UCONST( "L " );
+ }
+ aPathData += GetValueString( ( aPolyPoint = rPoly[ n++ ] ).X() );
+ aPathData += aComma;
+ aPathData += GetValueString( aPolyPoint.Y() );
+ }
+ }
+
+ if( !bLine )
+ aPathData += B2UCONST( " Z" );
+
+ if( i < ( nCount - 1 ) )
+ aPathData += aBlank;
+ }
+ }
+
+ return aPathData.GetString();
+}
+
+// -----------------------------------------------------------------------------
+
+void SVGActionWriter::ImplWriteLine( const Point& rPt1, const Point& rPt2, const Color* pLineColor,
+ const NMSP_RTL::OUString* pStyle )
+{
+ const Point aPt1( ImplMap( rPt1 ) );
+ const Point aPt2( ImplMap( rPt2 ) );
+
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrX1, GetValueString( aPt1.X() ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY1, GetValueString( aPt1.Y() ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrX2, GetValueString( aPt2.X() ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY2, GetValueString( aPt2.Y() ) );
+
+ // add additional style if requested
+ if( pStyle )
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStyle, *pStyle );
+
+ if( pLineColor )
+ {
+ // !!! mrExport.AddAttribute( XML_NAMESPACE_NONE, ... )
+ DBG_ERROR( "SVGActionWriter::ImplWriteLine: Line color not implemented" );
+ }
+
+ {
+ SvXMLElementExport aElem( mrExport, XML_NAMESPACE_NONE, aXMLElemLine, TRUE, TRUE );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void SVGActionWriter::ImplWriteRect( const Rectangle& rRect, long nRadX, long nRadY,
+ const NMSP_RTL::OUString* pStyle )
+{
+ const Rectangle aRect( ImplMap( rRect ) );
+
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrX, GetValueString( aRect.Left() ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY, GetValueString( aRect.Top() ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrWidth, GetValueString( aRect.GetWidth() ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrHeight, GetValueString( aRect.GetHeight() ) );
+
+ if( nRadX )
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrRX, GetValueString( ImplMap( nRadX ) ) );
+
+ if( nRadY )
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrRY, GetValueString( ImplMap( nRadY ) ) );
+
+ // add additional style if requested
+ if( pStyle )
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStyle, *pStyle );
+
+ {
+ SvXMLElementExport aElem( mrExport, XML_NAMESPACE_NONE, aXMLElemRect, TRUE, TRUE );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void SVGActionWriter::ImplWriteEllipse( const Point& rCenter, long nRadX, long nRadY,
+ const NMSP_RTL::OUString* pStyle )
+{
+ const Point aCenter( ImplMap( rCenter ) );
+
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrCX, GetValueString( aCenter.X() ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrCY, GetValueString( aCenter.Y() ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrRX, GetValueString( ImplMap( nRadX ) ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrRY, GetValueString( ImplMap( nRadY ) ) );
+
+ // add additional style if requested
+ if( pStyle )
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStyle, *pStyle );
+
+ {
+ SvXMLElementExport aElem( mrExport, XML_NAMESPACE_NONE, aXMLElemEllipse, TRUE, TRUE );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void SVGActionWriter::ImplWritePolyPolygon( const PolyPolygon& rPolyPoly, sal_Bool bLineOnly,
+ const NMSP_RTL::OUString* pStyle )
+{
+ if( rPolyPoly.Count() )
+ {
+ PolyPolygon aMappedPolyPoly;
+ FastString aStyle;
+
+ for( USHORT i = 0, nCount = rPolyPoly.Count(); i < nCount; i++ )
+ {
+ const Polygon& rPoly = rPolyPoly[ i ];
+ const USHORT nSize = rPoly.GetSize();
+
+ // #i102224# congratulations, this throws away the curve flags
+ // and makes ANY curved polygon look bad. The Flags HAVE to be
+ // copied, too. It's NOT enough to copy the mapped points. Just
+ // copy the original polygon completely and REPLACE the points
+
+ // old: Polygon aMappedPoly( nSize );
+ // new:
+ Polygon aMappedPoly(rPoly);
+
+ for( USHORT n = 0; n < nSize; n++ )
+ aMappedPoly[ n ] = ImplMap( rPoly[ n ] );
+
+ aMappedPolyPoly.Insert( aMappedPoly );
+ }
+
+ if( bLineOnly )
+ {
+ aStyle += B2UCONST( "fill:none" );
+ if( pStyle )
+ aStyle += B2UCONST( ";" );
+ }
+ if( pStyle )
+ aStyle += *pStyle;
+
+ // add style attribute
+ if( aStyle.GetLength() )
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStyle, aStyle.GetString() );
+
+ // add path data attribute
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrD, GetPathString( aMappedPolyPoly, bLineOnly ) );
+ {
+ // write polyline/polygon element
+ SvXMLElementExport aElem( mrExport, XML_NAMESPACE_NONE, aXMLElemPath, TRUE, TRUE );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void SVGActionWriter::ImplWriteGradientEx( const PolyPolygon& rPolyPoly, const Gradient& rGradient,
+ const NMSP_RTL::OUString* pStyle, sal_uInt32 nWriteFlags )
+{
+ if( rPolyPoly.Count() )
+ {
+ SvXMLElementExport aElemG( mrExport, XML_NAMESPACE_NONE, aXMLElemG, TRUE, TRUE );
+ FastString aClipId;
+ FastString aClipStyle;
+
+ aClipId += B2UCONST( "clip" );
+ aClipId += NMSP_RTL::OUString::valueOf( ImplGetNextClipId() );
+
+ {
+ SvXMLElementExport aElemDefs( mrExport, XML_NAMESPACE_NONE, aXMLElemDefs, TRUE, TRUE );
+
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrId, aClipId.GetString() );
+
+ {
+ SvXMLElementExport aElemClipPath( mrExport, XML_NAMESPACE_NONE, aXMLElemClipPath, TRUE, TRUE );
+ ImplWritePolyPolygon( rPolyPoly, sal_False );
+ }
+ }
+
+ // create new context with clippath set
+ aClipStyle += B2UCONST( "clip-path:URL(#" );
+ aClipStyle += aClipId.GetString();
+ aClipStyle += B2UCONST( ")" );
+
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStyle, aClipStyle.GetString() );
+
+ {
+ GDIMetaFile aTmpMtf;
+ SvXMLElementExport aElemG2( mrExport, XML_NAMESPACE_NONE, aXMLElemG, TRUE, TRUE );
+
+ mpVDev->AddGradientActions( rPolyPoly.GetBoundRect(), rGradient, aTmpMtf );
+ ImplWriteActions( aTmpMtf, pStyle, nWriteFlags );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void SVGActionWriter::ImplWriteText( const Point& rPos, const String& rText,
+ const sal_Int32* pDXArray, long nWidth,
+ const NMSP_RTL::OUString* pStyle )
+{
+ long nLen = rText.Len(), i;
+
+ if( nLen )
+ {
+ Size aNormSize;
+ sal_Int32* pOwnArray;
+ sal_Int32* pDX;
+
+ // get text sizes
+ if( pDXArray )
+ {
+ pOwnArray = NULL;
+ aNormSize = Size( mpVDev->GetTextWidth( rText ), 0 );
+ pDX = (sal_Int32*) pDXArray;
+ }
+ else
+ {
+ pOwnArray = new sal_Int32[ nLen ];
+ aNormSize = Size( mpVDev->GetTextArray( rText, pOwnArray ), 0 );
+ pDX = pOwnArray;
+ }
+
+ if( nLen > 1 )
+ {
+ aNormSize.Width() = pDX[ nLen - 2 ] + mpVDev->GetTextWidth( rText.GetChar( sal::static_int_cast<USHORT>( nLen - 1 ) ) );
+
+ if( nWidth && aNormSize.Width() && ( nWidth != aNormSize.Width() ) )
+ {
+ const double fFactor = (double) nWidth / aNormSize.Width();
+
+ for( i = 0; i < ( nLen - 1 ); i++ )
+ pDX[ i ] = FRound( pDX[ i ] * fFactor );
+ }
+ }
+
+ FastString aStyle;
+ const Font& rFont = mpVDev->GetFont();
+ const FontMetric aMetric( mpVDev->GetFontMetric() );
+ Point aBaseLinePos( rPos );
+ SvXMLElementExport* pTransform = NULL;
+
+ // always adjust text position to match baseline alignment
+ switch( rFont.GetAlign() )
+ {
+ case( ALIGN_TOP ):
+ aBaseLinePos.Y() += aMetric.GetAscent();
+ break;
+
+ case( ALIGN_BOTTOM ):
+ aBaseLinePos.Y() -= aMetric.GetDescent();
+ break;
+
+ default:
+ break;
+ }
+
+ // get mapped text position
+ const Point aPt( ImplMap( aBaseLinePos ) );
+
+ // if text is italic, set transform at new g element
+ if( ( rFont.GetItalic() != ITALIC_NONE ) || rFont.GetOrientation() )
+ {
+ String aTransform;
+
+ aTransform = NMSP_RTL::OUString::createFromAscii( "translate" );
+ aTransform += '(';
+ aTransform += String( GetValueString( aPt.X() ) );
+ aTransform += ',';
+ aTransform += String( GetValueString( aPt.Y() ) );
+ aTransform += ')';
+
+ if( rFont.GetOrientation() )
+ {
+ aTransform += String( NMSP_RTL::OUString::createFromAscii( " rotate" ) );
+ aTransform += '(';
+ aTransform += String( NMSP_RTL::OUString::valueOf( rFont.GetOrientation() * -0.1 ) );
+ aTransform += ')';
+ }
+
+ if( rFont.GetItalic() != ITALIC_NONE )
+ {
+ aTransform += String( NMSP_RTL::OUString::createFromAscii( " skewX" ) );
+ aTransform += '(';
+ aTransform += String( NMSP_RTL::OUString::valueOf( (sal_Int32) -10 ) );
+ aTransform += ')';
+ }
+
+ aTransform += String( NMSP_RTL::OUString::createFromAscii( " translate" ) );
+ aTransform += '(';
+ aTransform += String( GetValueString( -aPt.X() ) );
+ aTransform += ',';
+ aTransform += String( GetValueString( -aPt.Y() ) );
+ aTransform += ')';
+
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrTransform, aTransform );
+ pTransform = new SvXMLElementExport( mrExport, XML_NAMESPACE_NONE, aXMLElemG, TRUE, TRUE );
+ }
+
+ // add additional style if requested
+ if( pStyle && pStyle->getLength() )
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStyle, *pStyle );
+
+ // write text element
+ {
+#ifdef _SVG_USE_TSPANS
+ SvXMLElementExport aElem( mrExport, XML_NAMESPACE_NONE, aXMLElemText, TRUE, TRUE );
+ FastString aTSpanX;
+ const NMSP_RTL::OUString aSpace( ' ' );
+ String aOutputText( rText );
+ long nCurPos = 0;
+ bool bIgnoreWhitespace = true;
+
+ for( long j = 0, nX = aPt.X(); j < nLen; ++j )
+ {
+ const sal_Unicode cCode = rText.GetChar( sal::static_int_cast<USHORT>( j ) );
+
+ // don't take more than one whitespace into account
+ if( !bIgnoreWhitespace || ( ' ' != cCode ) )
+ {
+ aOutputText.SetChar( sal::static_int_cast<USHORT>( nCurPos++ ), cCode );
+ ( aTSpanX += GetValueString( nX + ( ( j > 0 ) ? pDX[ j - 1 ] : 0 ) ) ) += aSpace;
+ bIgnoreWhitespace = ( ' ' == cCode );
+ }
+ }
+
+ if( nCurPos < nLen )
+ aOutputText.Erase( sal::static_int_cast<USHORT>( nCurPos ) );
+
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrX, aTSpanX.GetString() );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY, GetValueString( aPt.Y() ) );
+
+ {
+ SvXMLElementExport aElem2( mrExport, XML_NAMESPACE_NONE, aXMLElemTSpan, TRUE, TRUE );
+ mrExport.GetDocHandler()->characters( aOutputText );
+ }
+#else
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrX, GetValueString( aPt.X() ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY, GetValueString( aPt.Y() ) );
+
+ {
+ SvXMLElementExport aElem2( mrExport, XML_NAMESPACE_NONE, aXMLElemText, TRUE, TRUE );
+ mrExport.GetDocHandler()->characters( rText );
+ }
+#endif
+ }
+
+#ifndef _SVG_USE_NATIVE_TEXTDECORATION
+ // write strikeout if neccessary
+ if( rFont.GetStrikeout() || rFont.GetUnderline() )
+ {
+ Polygon aPoly( 4 );
+ const long nLineHeight = Max( (long) FRound( aMetric.GetLineHeight() * 0.05 ), (long) 1 );
+
+ if( rFont.GetStrikeout() )
+ {
+ const long nYLinePos = aBaseLinePos.Y() - FRound( aMetric.GetAscent() * 0.26 );
+
+ aPoly[ 0 ].X() = aBaseLinePos.X(); aPoly[ 0 ].Y() = nYLinePos - ( nLineHeight >> 1 );
+ aPoly[ 1 ].X() = aBaseLinePos.X() + aNormSize.Width() - 1; aPoly[ 1 ].Y() = aPoly[ 0 ].Y();
+ aPoly[ 2 ].X() = aPoly[ 1 ].X(); aPoly[ 2 ].Y() = aPoly[ 0 ].Y() + nLineHeight - 1;
+ aPoly[ 3 ].X() = aPoly[ 0 ].X(); aPoly[ 3 ].Y() = aPoly[ 2 ].Y();
+
+ ImplWritePolyPolygon( aPoly, sal_False );
+ }
+
+ if( rFont.GetUnderline() )
+ {
+ const long nYLinePos = aBaseLinePos.Y() + ( nLineHeight << 1 );
+
+ aPoly[ 0 ].X() = aBaseLinePos.X(); aPoly[ 0 ].Y() = nYLinePos - ( nLineHeight >> 1 );
+ aPoly[ 1 ].X() = aBaseLinePos.X() + aNormSize.Width() - 1; aPoly[ 1 ].Y() = aPoly[ 0 ].Y();
+ aPoly[ 2 ].X() = aPoly[ 1 ].X(); aPoly[ 2 ].Y() = aPoly[ 0 ].Y() + nLineHeight - 1;
+ aPoly[ 3 ].X() = aPoly[ 0 ].X(); aPoly[ 3 ].Y() = aPoly[ 2 ].Y();
+
+ ImplWritePolyPolygon( aPoly, sal_False );
+ }
+ }
+#endif // _SVG_USE_NATIVE_TEXTDECORATION
+
+ delete[] pOwnArray;
+ delete pTransform;
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void SVGActionWriter::ImplWriteBmp( const BitmapEx& rBmpEx,
+ const Point& rPt, const Size& rSz,
+ const Point& rSrcPt, const Size& rSrcSz,
+ const NMSP_RTL::OUString* /* pStyle */ )
+{
+ if( !!rBmpEx )
+ {
+ BitmapEx aBmpEx( rBmpEx );
+ Point aPoint = Point();
+ const Rectangle aBmpRect( aPoint, rBmpEx.GetSizePixel() );
+ const Rectangle aSrcRect( rSrcPt, rSrcSz );
+
+ if( aSrcRect != aBmpRect )
+ aBmpEx.Crop( aSrcRect );
+
+ if( !!aBmpEx )
+ {
+ SvMemoryStream aOStm( 65535, 65535 );
+
+ if( GraphicConverter::Export( aOStm, rBmpEx, CVT_PNG ) == ERRCODE_NONE )
+ {
+ const Point aPt( ImplMap( rPt ) );
+ const Size aSz( ImplMap( rSz ) );
+ FastString aImageData( (sal_Char*) aOStm.GetData(), aOStm.Tell() );
+ REF( NMSP_SAX::XExtendedDocumentHandler ) xExtDocHandler( mrExport.GetDocHandler(), NMSP_UNO::UNO_QUERY );
+
+ if( xExtDocHandler.is() )
+ {
+ static const sal_uInt32 nPartLen = 64;
+ const NMSP_RTL::OUString aSpace( ' ' );
+ const NMSP_RTL::OUString aLineFeed( NMSP_RTL::OUString::valueOf( (sal_Unicode) 0x0a ) );
+ NMSP_RTL::OUString aString;
+ NMSP_RTL::OUString aImageString;
+
+ aString = aLineFeed;
+ aString += B2UCONST( "<" );
+ aString += NMSP_RTL::OUString::createFromAscii( aXMLElemImage );
+ aString += aSpace;
+
+ aString += NMSP_RTL::OUString::createFromAscii( aXMLAttrX );
+ aString += B2UCONST( "=\"" );
+ aString += GetValueString( aPt.X() );
+ aString += B2UCONST( "\" " );
+
+ aString += NMSP_RTL::OUString::createFromAscii( aXMLAttrY );
+ aString += B2UCONST( "=\"" );
+ aString += GetValueString( aPt.Y() );
+ aString += B2UCONST( "\" " );
+
+ aString += NMSP_RTL::OUString::createFromAscii( aXMLAttrWidth );
+ aString += B2UCONST( "=\"" );
+ aString += GetValueString( aSz.Width() );
+ aString += B2UCONST( "\" " );
+
+ aString += NMSP_RTL::OUString::createFromAscii( aXMLAttrHeight );
+ aString += B2UCONST( "=\"" );
+ aString += GetValueString( aSz.Height() );
+ aString += B2UCONST( "\" " );
+
+ aString += NMSP_RTL::OUString::createFromAscii( aXMLAttrXLinkHRef );
+ aString += B2UCONST( "=\"data:image/png;base64," );
+
+ if( aImageData.GetFirstPartString( nPartLen, aImageString ) )
+ {
+ xExtDocHandler->unknown( aString += aImageString );
+
+ while( aImageData.GetNextPartString( nPartLen, aImageString ) )
+ {
+ xExtDocHandler->unknown( aLineFeed );
+ xExtDocHandler->unknown( aImageString );
+ }
+ }
+
+ xExtDocHandler->unknown( B2UCONST( "\"/>" ) );
+ }
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
+ const NMSP_RTL::OUString* pStyle,
+ sal_uInt32 nWriteFlags )
+{
+ ImplAcquireContext();
+
+ for( ULONG i = 0, nCount = rMtf.GetActionCount(); i < nCount; i++ )
+ {
+ const MetaAction* pAction = rMtf.GetAction( i );
+ const USHORT nType = pAction->GetType();
+
+ switch( nType )
+ {
+ case( META_PIXEL_ACTION ):
+ {
+ if( nWriteFlags & SVGWRITER_WRITE_FILL )
+ {
+ const MetaPixelAction* pA = (const MetaPixelAction*) pAction;
+
+ mpContext->SetPaintAttr( pA->GetColor(), pA->GetColor() );
+ ImplWriteLine( pA->GetPoint(), pA->GetPoint(), &pA->GetColor(), pStyle );
+ }
+ }
+ break;
+
+ case( META_POINT_ACTION ):
+ {
+ if( nWriteFlags & SVGWRITER_WRITE_FILL )
+ {
+ const MetaPointAction* pA = (const MetaPointAction*) pAction;
+
+ mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetLineColor() );
+ ImplWriteLine( pA->GetPoint(), pA->GetPoint(), NULL, pStyle );
+ }
+ }
+ break;
+
+ case( META_LINE_ACTION ):
+ {
+ if( nWriteFlags & SVGWRITER_WRITE_FILL )
+ {
+ const MetaLineAction* pA = (const MetaLineAction*) pAction;
+
+ if(pA->GetLineInfo().IsDefault())
+ {
+ mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetLineColor() );
+ }
+ else
+ {
+ const LineInfo aMappedLineInfo(ImplMap(pA->GetLineInfo()));
+ mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetLineColor(), &aMappedLineInfo );
+ }
+
+ ImplWriteLine( pA->GetStartPoint(), pA->GetEndPoint(), NULL, pStyle );
+ }
+ }
+ break;
+
+ case( META_RECT_ACTION ):
+ {
+ if( nWriteFlags & SVGWRITER_WRITE_FILL )
+ {
+ mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
+ ImplWriteRect( ( (const MetaRectAction*) pAction )->GetRect(), 0, 0, pStyle );
+ }
+ }
+ break;
+
+ case( META_ROUNDRECT_ACTION ):
+ {
+ if( nWriteFlags & SVGWRITER_WRITE_FILL )
+ {
+ const MetaRoundRectAction* pA = (const MetaRoundRectAction*) pAction;
+
+ mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
+ ImplWriteRect( pA->GetRect(), pA->GetHorzRound(), pA->GetVertRound(), pStyle );
+ }
+ }
+ break;
+
+ case( META_ELLIPSE_ACTION ):
+ {
+ if( nWriteFlags & SVGWRITER_WRITE_FILL )
+ {
+ const MetaEllipseAction* pA = (const MetaEllipseAction*) pAction;
+ const Rectangle& rRect = pA->GetRect();
+
+ mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
+ ImplWriteEllipse( rRect.Center(), rRect.GetWidth() >> 1, rRect.GetHeight() >> 1, pStyle );
+ }
+ }
+ break;
+
+ case( META_ARC_ACTION ):
+ case( META_PIE_ACTION ):
+ case( META_CHORD_ACTION ):
+ case( META_POLYGON_ACTION ):
+ {
+ if( nWriteFlags & SVGWRITER_WRITE_FILL )
+ {
+ Polygon aPoly;
+
+ switch( nType )
+ {
+ case( META_ARC_ACTION ):
+ {
+ const MetaArcAction* pA = (const MetaArcAction*) pAction;
+ aPoly = Polygon( pA->GetRect(), pA->GetStartPoint(), pA->GetEndPoint(), POLY_ARC );
+ }
+ break;
+
+ case( META_PIE_ACTION ):
+ {
+ const MetaPieAction* pA = (const MetaPieAction*) pAction;
+ aPoly = Polygon( pA->GetRect(), pA->GetStartPoint(), pA->GetEndPoint(), POLY_PIE );
+ }
+ break;
+
+ case( META_CHORD_ACTION ):
+ {
+ const MetaChordAction* pA = (const MetaChordAction*) pAction;
+ aPoly = Polygon( pA->GetRect(), pA->GetStartPoint(), pA->GetEndPoint(), POLY_CHORD );
+ }
+ break;
+
+ case( META_POLYGON_ACTION ):
+ aPoly = ( (const MetaPolygonAction*) pAction )->GetPolygon();
+ break;
+ }
+
+ if( aPoly.GetSize() )
+ {
+ mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
+ ImplWritePolyPolygon( aPoly, sal_False, pStyle );
+ }
+ }
+ }
+ break;
+
+ case( META_POLYLINE_ACTION ):
+ {
+ if( nWriteFlags & SVGWRITER_WRITE_FILL )
+ {
+ const MetaPolyLineAction* pA = (const MetaPolyLineAction*) pAction;
+ const Polygon& rPoly = pA->GetPolygon();
+
+ if( rPoly.GetSize() )
+ {
+ bool bNoLineJoin(false);
+
+ if(pA->GetLineInfo().IsDefault())
+ {
+ mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
+ }
+ else
+ {
+ const LineInfo aMappedLineInfo(ImplMap(pA->GetLineInfo()));
+ bNoLineJoin = basegfx::B2DLINEJOIN_NONE == aMappedLineInfo.GetLineJoin();
+ mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor(), &aMappedLineInfo );
+ }
+
+ if(bNoLineJoin)
+ {
+ // emulate B2DLINEJOIN_NONE by creating single edges
+ const sal_uInt16 nPoints(rPoly.GetSize());
+ const bool bCurve(rPoly.HasFlags());
+
+ for(sal_uInt16 a(0); a + 1 < nPoints; a++)
+ {
+ if(bCurve
+ && POLY_NORMAL != rPoly.GetFlags(a + 1)
+ && a + 2 < nPoints
+ && POLY_NORMAL != rPoly.GetFlags(a + 2)
+ && a + 3 < nPoints)
+ {
+ const Polygon aSnippet(4,
+ rPoly.GetConstPointAry() + a,
+ rPoly.GetConstFlagAry() + a);
+ ImplWritePolyPolygon( aSnippet, sal_True, pStyle );
+ a += 2;
+ }
+ else
+ {
+ const Polygon aSnippet(2,
+ rPoly.GetConstPointAry() + a);
+ ImplWritePolyPolygon( aSnippet, sal_True, pStyle );
+ }
+ }
+ }
+ else
+ {
+ ImplWritePolyPolygon( rPoly, sal_True, pStyle );
+ }
+ }
+ }
+ }
+ break;
+
+ case( META_POLYPOLYGON_ACTION ):
+ {
+ if( nWriteFlags & SVGWRITER_WRITE_FILL )
+ {
+ const MetaPolyPolygonAction* pA = (const MetaPolyPolygonAction*) pAction;
+ const PolyPolygon& rPolyPoly = pA->GetPolyPolygon();
+
+ if( rPolyPoly.Count() )
+ {
+ mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
+ ImplWritePolyPolygon( rPolyPoly, sal_False, pStyle );
+ }
+ }
+ }
+ break;
+
+ case( META_GRADIENT_ACTION ):
+ {
+ if( nWriteFlags & SVGWRITER_WRITE_FILL )
+ {
+ const MetaGradientAction* pA = (const MetaGradientAction*) pAction;
+ const Polygon aRectPoly( pA->GetRect() );
+ const PolyPolygon aRectPolyPoly( aRectPoly );
+
+ ImplWriteGradientEx( aRectPolyPoly, pA->GetGradient(), pStyle, nWriteFlags );
+ }
+ }
+ break;
+
+ case( META_GRADIENTEX_ACTION ):
+ {
+ if( nWriteFlags & SVGWRITER_WRITE_FILL )
+ {
+ const MetaGradientExAction* pA = (const MetaGradientExAction*) pAction;
+ ImplWriteGradientEx( pA->GetPolyPolygon(), pA->GetGradient(), pStyle, nWriteFlags );
+ }
+ }
+ break;
+
+ case META_HATCH_ACTION:
+ {
+ if( nWriteFlags & SVGWRITER_WRITE_FILL )
+ {
+ const MetaHatchAction* pA = (const MetaHatchAction*) pAction;
+ GDIMetaFile aTmpMtf;
+
+ mpVDev->AddHatchActions( pA->GetPolyPolygon(), pA->GetHatch(), aTmpMtf );
+ ImplWriteActions( aTmpMtf, pStyle, nWriteFlags );
+ }
+ }
+ break;
+
+ case( META_TRANSPARENT_ACTION ):
+ {
+ if( nWriteFlags & SVGWRITER_WRITE_FILL )
+ {
+ const MetaTransparentAction* pA = (const MetaTransparentAction*) pAction;
+ const PolyPolygon& rPolyPoly = pA->GetPolyPolygon();
+
+ if( rPolyPoly.Count() )
+ {
+ const Color aOldLineColor( mpVDev->GetLineColor() ), aOldFillColor( mpVDev->GetFillColor() );
+ Color aNewLineColor( aOldLineColor ), aNewFillColor( aOldFillColor );
+
+ aNewLineColor.SetTransparency( sal::static_int_cast<UINT8>( FRound( pA->GetTransparence() * 2.55 ) ) );
+ aNewFillColor.SetTransparency( sal::static_int_cast<UINT8>( FRound( pA->GetTransparence() * 2.55 ) ) );
+
+ mpContext->SetPaintAttr( aNewLineColor, aNewFillColor );
+ ImplWritePolyPolygon( rPolyPoly, sal_False, pStyle );
+ mpContext->SetPaintAttr( aOldLineColor, aOldFillColor );
+ }
+ }
+ }
+ break;
+
+ case( META_FLOATTRANSPARENT_ACTION ):
+ {
+ if( nWriteFlags & SVGWRITER_WRITE_FILL )
+ {
+ const MetaFloatTransparentAction* pA = (const MetaFloatTransparentAction*) pAction;
+ GDIMetaFile aTmpMtf( pA->GetGDIMetaFile() );
+ Point aSrcPt( aTmpMtf.GetPrefMapMode().GetOrigin() );
+ const Size aSrcSize( aTmpMtf.GetPrefSize() );
+ const Point aDestPt( pA->GetPoint() );
+ const Size aDestSize( pA->GetSize() );
+ const double fScaleX = aSrcSize.Width() ? (double) aDestSize.Width() / aSrcSize.Width() : 1.0;
+ const double fScaleY = aSrcSize.Height() ? (double) aDestSize.Height() / aSrcSize.Height() : 1.0;
+ long nMoveX, nMoveY;
+
+ if( fScaleX != 1.0 || fScaleY != 1.0 )
+ {
+ aTmpMtf.Scale( fScaleX, fScaleY );
+ aSrcPt.X() = FRound( aSrcPt.X() * fScaleX ), aSrcPt.Y() = FRound( aSrcPt.Y() * fScaleY );
+ }
+
+ nMoveX = aDestPt.X() - aSrcPt.X(), nMoveY = aDestPt.Y() - aSrcPt.Y();
+
+ if( nMoveX || nMoveY )
+ aTmpMtf.Move( nMoveX, nMoveY );
+
+ mpVDev->Push();
+ ImplWriteActions( aTmpMtf, pStyle, nWriteFlags );
+ mpVDev->Pop();
+ }
+ }
+ break;
+
+ case( META_EPS_ACTION ):
+ {
+ if( nWriteFlags & SVGWRITER_WRITE_FILL )
+ {
+ const MetaEPSAction* pA = (const MetaEPSAction*) pAction;
+ const GDIMetaFile aGDIMetaFile( pA->GetSubstitute() );
+ sal_Bool bFound = sal_False;
+
+ for( ULONG j = 0, nC = aGDIMetaFile.GetActionCount(); ( j < nC ) && !bFound; j++ )
+ {
+ const MetaAction* pSubstAct = aGDIMetaFile.GetAction( j );
+
+ if( pSubstAct->GetType() == META_BMPSCALE_ACTION )
+ {
+ bFound = sal_True;
+ const MetaBmpScaleAction* pBmpScaleAction = (const MetaBmpScaleAction*) pSubstAct;
+ mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
+ ImplWriteBmp( pBmpScaleAction->GetBitmap(),
+ pA->GetPoint(), pA->GetSize(),
+ Point(), pBmpScaleAction->GetBitmap().GetSizePixel(), pStyle );
+ }
+ }
+ }
+ }
+ break;
+
+ case( META_COMMENT_ACTION ):
+ {
+ const MetaCommentAction* pA = (const MetaCommentAction*) pAction;
+ String aSkipComment;
+
+ if( ( pA->GetComment().CompareIgnoreCaseToAscii( "XGRAD_SEQ_BEGIN" ) == COMPARE_EQUAL ) &&
+ ( nWriteFlags & SVGWRITER_WRITE_FILL ) )
+ {
+ const MetaGradientExAction* pGradAction = NULL;
+ sal_Bool bDone = sal_False;
+
+ while( !bDone && ( ++i < nCount ) )
+ {
+ pAction = rMtf.GetAction( i );
+
+ if( pAction->GetType() == META_GRADIENTEX_ACTION )
+ pGradAction = (const MetaGradientExAction*) pAction;
+ else if( ( pAction->GetType() == META_COMMENT_ACTION ) &&
+ ( ( (const MetaCommentAction*) pAction )->GetComment().CompareIgnoreCaseToAscii( "XGRAD_SEQ_END" ) == COMPARE_EQUAL ) )
+ {
+ bDone = sal_True;
+ }
+ }
+
+ if( pGradAction )
+ ImplWriteGradientEx( pGradAction->GetPolyPolygon(), pGradAction->GetGradient(), pStyle, nWriteFlags );
+ }
+ }
+ break;
+
+ case( META_BMP_ACTION ):
+ {
+ if( nWriteFlags & SVGWRITER_WRITE_FILL )
+ {
+ const MetaBmpAction* pA = (const MetaBmpAction*) pAction;
+
+ mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
+ ImplWriteBmp( pA->GetBitmap(),
+ pA->GetPoint(), mpVDev->PixelToLogic( pA->GetBitmap().GetSizePixel() ),
+ Point(), pA->GetBitmap().GetSizePixel(), pStyle );
+ }
+ }
+ break;
+
+ case( META_BMPSCALE_ACTION ):
+ {
+ if( nWriteFlags & SVGWRITER_WRITE_FILL )
+ {
+ const MetaBmpScaleAction* pA = (const MetaBmpScaleAction*) pAction;
+
+ mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
+ ImplWriteBmp( pA->GetBitmap(),
+ pA->GetPoint(), pA->GetSize(),
+ Point(), pA->GetBitmap().GetSizePixel(), pStyle );
+ }
+ }
+ break;
+
+ case( META_BMPSCALEPART_ACTION ):
+ {
+ if( nWriteFlags & SVGWRITER_WRITE_FILL )
+ {
+ const MetaBmpScalePartAction* pA = (const MetaBmpScalePartAction*) pAction;
+
+ mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
+ ImplWriteBmp( pA->GetBitmap(),
+ pA->GetDestPoint(), pA->GetDestSize(),
+ pA->GetSrcPoint(), pA->GetSrcSize(), pStyle );
+ }
+ }
+ break;
+
+ case( META_BMPEX_ACTION ):
+ {
+ if( nWriteFlags & SVGWRITER_WRITE_FILL )
+ {
+ const MetaBmpExAction* pA = (const MetaBmpExAction*) pAction;
+
+ mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
+ ImplWriteBmp( pA->GetBitmapEx(),
+ pA->GetPoint(), mpVDev->PixelToLogic( pA->GetBitmapEx().GetSizePixel() ),
+ Point(), pA->GetBitmapEx().GetSizePixel(), pStyle );
+ }
+ }
+ break;
+
+ case( META_BMPEXSCALE_ACTION ):
+ {
+ if( nWriteFlags & SVGWRITER_WRITE_FILL )
+ {
+ const MetaBmpExScaleAction* pA = (const MetaBmpExScaleAction*) pAction;
+
+ mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
+ ImplWriteBmp( pA->GetBitmapEx(),
+ pA->GetPoint(), pA->GetSize(),
+ Point(), pA->GetBitmapEx().GetSizePixel(), pStyle );
+ }
+ }
+ break;
+
+ case( META_BMPEXSCALEPART_ACTION ):
+ {
+ if( nWriteFlags & SVGWRITER_WRITE_FILL )
+ {
+ const MetaBmpExScalePartAction* pA = (const MetaBmpExScalePartAction*) pAction;
+
+ mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
+ ImplWriteBmp( pA->GetBitmapEx(),
+ pA->GetDestPoint(), pA->GetDestSize(),
+ pA->GetSrcPoint(), pA->GetSrcSize(), pStyle );
+ }
+ }
+ break;
+
+ case( META_TEXT_ACTION ):
+ {
+ if( nWriteFlags & SVGWRITER_WRITE_TEXT )
+ {
+ const MetaTextAction* pA = (const MetaTextAction*) pAction;
+ Font aFont( mpVDev->GetFont() );
+
+ aFont.SetHeight( ImplMap( Size( 0, aFont.GetHeight() ) ).Height() );
+ mpContext->SetFontAttr( aFont );
+ mpContext->SetPaintAttr( COL_TRANSPARENT, aFont.GetColor() );
+ ImplWriteText( pA->GetPoint(), String( pA->GetText(), pA->GetIndex(), pA->GetLen() ), NULL, 0, pStyle );
+ }
+ }
+ break;
+
+ case( META_TEXTRECT_ACTION ):
+ {
+ if( nWriteFlags & SVGWRITER_WRITE_TEXT )
+ {
+ const MetaTextRectAction* pA = (const MetaTextRectAction*) pAction;
+ Font aFont( mpVDev->GetFont() );
+
+ aFont.SetHeight( ImplMap( Size( 0, aFont.GetHeight() ) ).Height() );
+ mpContext->SetFontAttr( aFont );
+ mpContext->SetPaintAttr( COL_TRANSPARENT, aFont.GetColor() );
+ ImplWriteText( pA->GetRect().TopLeft(), pA->GetText(), NULL, 0, pStyle );
+ }
+ }
+ break;
+
+ case( META_TEXTARRAY_ACTION ):
+ {
+ if( nWriteFlags & SVGWRITER_WRITE_TEXT )
+ {
+ const MetaTextArrayAction* pA = (const MetaTextArrayAction*) pAction;
+ const Point aPos( ImplMap( pA->GetPoint() ) );
+ Font aFont( mpVDev->GetFont() );
+
+ aFont.SetHeight( ImplMap( Size( 0, aFont.GetHeight() ) ).Height() );
+ mpContext->SetFontAttr( aFont );
+ mpContext->SetPaintAttr( COL_TRANSPARENT, aFont.GetColor() );
+ ImplWriteText( pA->GetPoint(), String( pA->GetText(), pA->GetIndex(), pA->GetLen() ), pA->GetDXArray(), 0, pStyle );
+ }
+ }
+ break;
+
+ case( META_STRETCHTEXT_ACTION ):
+ {
+ if( nWriteFlags & SVGWRITER_WRITE_TEXT )
+ {
+ const MetaStretchTextAction* pA = (const MetaStretchTextAction*) pAction;
+ Font aFont( mpVDev->GetFont() );
+
+ aFont.SetHeight( ImplMap( Size( 0, aFont.GetHeight() ) ).Height() );
+ mpContext->SetFontAttr( aFont );
+ mpContext->SetPaintAttr( COL_TRANSPARENT, aFont.GetColor() );
+ ImplWriteText( pA->GetPoint(), String( pA->GetText(), pA->GetIndex(), pA->GetLen() ), NULL, pA->GetWidth(), pStyle );
+ }
+ }
+ break;
+
+ case( META_CLIPREGION_ACTION ):
+ case( META_ISECTRECTCLIPREGION_ACTION ):
+ case( META_ISECTREGIONCLIPREGION_ACTION ):
+ case( META_MOVECLIPREGION_ACTION ):
+ {
+ ( (MetaAction*) pAction )->Execute( mpVDev );
+ mbClipAttrChanged = sal_True;
+ }
+ break;
+
+ case( META_REFPOINT_ACTION ):
+ case( META_MAPMODE_ACTION ):
+ case( META_LINECOLOR_ACTION ):
+ case( META_FILLCOLOR_ACTION ):
+ case( META_TEXTLINECOLOR_ACTION ):
+ case( META_TEXTFILLCOLOR_ACTION ):
+ case( META_TEXTCOLOR_ACTION ):
+ case( META_TEXTALIGN_ACTION ):
+ case( META_FONT_ACTION ):
+ case( META_PUSH_ACTION ):
+ case( META_POP_ACTION ):
+ case( META_LAYOUTMODE_ACTION ):
+ {
+ ( (MetaAction*) pAction )->Execute( mpVDev );
+ }
+ break;
+
+ case( META_RASTEROP_ACTION ):
+ case( META_MASK_ACTION ):
+ case( META_MASKSCALE_ACTION ):
+ case( META_MASKSCALEPART_ACTION ):
+ case( META_WALLPAPER_ACTION ):
+ case( META_TEXTLINE_ACTION ):
+ {
+ // !!! >>> we don't want to support these actions
+ }
+ break;
+
+ default:
+ DBG_ERROR( "SVGActionWriter::ImplWriteActions: unsupported MetaAction #" );
+ break;
+ }
+ }
+
+ ImplReleaseContext();
+}
+
+// -----------------------------------------------------------------------------
+
+void SVGActionWriter::WriteMetaFile( const Point& rPos100thmm,
+ const Size& rSize100thmm,
+ const GDIMetaFile& rMtf,
+ sal_uInt32 nWriteFlags )
+{
+ MapMode aMapMode( rMtf.GetPrefMapMode() );
+ Size aPrefSize( rMtf.GetPrefSize() );
+ Fraction aFractionX( aMapMode.GetScaleX() );
+ Fraction aFractionY( aMapMode.GetScaleY() );
+
+ mpVDev->Push();
+
+ Size aSize( OutputDevice::LogicToLogic( rSize100thmm, MAP_100TH_MM, aMapMode ) );
+ aMapMode.SetScaleX( aFractionX *= Fraction( aSize.Width(), aPrefSize.Width() ) );
+ aMapMode.SetScaleY( aFractionY *= Fraction( aSize.Height(), aPrefSize.Height() ) );
+
+ Point aOffset( OutputDevice::LogicToLogic( rPos100thmm, MAP_100TH_MM, aMapMode ) );
+ aMapMode.SetOrigin( aOffset += aMapMode.GetOrigin() );
+
+ mpVDev->SetMapMode( aMapMode );
+
+ ImplWriteActions( rMtf, NULL, nWriteFlags );
+
+ mpVDev->Pop();
+}
diff --git a/filter/source/svg/svgwriter.hxx b/filter/source/svg/svgwriter.hxx
new file mode 100644
index 000000000000..113448a551d5
--- /dev/null
+++ b/filter/source/svg/svgwriter.hxx
@@ -0,0 +1,225 @@
+/*************************************************************************
+ *
+ * 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 SVGWRITER_HXX
+#define SVGWRITER_HXX
+
+#include <cppuhelper/weak.hxx>
+#include <rtl/ustring.hxx>
+#include <tools/debug.hxx>
+#include <tools/stream.hxx>
+#include <tools/string.hxx>
+#include <tools/urlobj.hxx>
+#include <tools/stack.hxx>
+#ifndef _SALBTYPE_HXX
+#include <vcl/salbtype.hxx>
+#endif
+#ifndef _GDIMTF_HXX
+#include <vcl/gdimtf.hxx>
+#endif
+#ifndef _METAACT_HXX
+#include <vcl/metaact.hxx>
+#endif
+#ifndef _METAACT_HXX
+#include <vcl/metric.hxx>
+#endif
+#ifndef _VIRDEV_HXX
+#include <vcl/virdev.hxx>
+#endif
+#ifndef _CVTGRF_HXX
+#include <vcl/cvtgrf.hxx>
+#endif
+#include <xmloff/xmlexp.hxx>
+#include <xmloff/nmspmap.hxx>
+
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/registry/XRegistryKey.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
+
+// -----------------------------------------------------------------------------
+
+#define _SVG_USE_NATIVE_TEXTDECORATION
+#define _SVG_USE_TSPANS 1
+#undef _SVG_WRITE_EXTENTS
+#define _SVG_EMBED_FONTS 1
+
+// -----------------------------------------------------------------------------
+
+#define NMSP_CPPU cppu
+#define NMSP_RTL rtl
+#define NMSP_UNO com::sun::star::uno
+#define NMSP_LANG com::sun::star::lang
+#define NMSP_SAX com::sun::star::xml::sax
+#define NMSP_SVG com::sun::star::svg
+#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 ) (NMSP_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 SVGWRITER_WRITE_NONE 0x00000000
+#define SVGWRITER_WRITE_FILL 0x00000001
+#define SVGWRITER_WRITE_TEXT 0x00000002
+#define SVGWRITER_WRITE_ALL 0xFFFFFFFF
+
+// --------------
+// - FastString -
+// --------------
+
+class FastString
+{
+private:
+
+ sal_uInt32 mnBufLen;
+ sal_uInt32 mnCurLen;
+ sal_uInt32 mnBufInc;
+ sal_Unicode* mpBuffer;
+ sal_uInt32 mnPartPos;
+ rtl::OUString maString;
+
+public:
+
+ FastString( sal_uInt32 nInitLen = 2048, sal_uInt32 nIncrement = 2048 );
+ FastString( sal_Char* pBufferForBase64Encoding, sal_uInt32 nBufLen );
+ ~FastString();
+
+ FastString& operator+=( const ::rtl::OUString& rStr );
+
+ const ::rtl::OUString& GetString() const;
+ sal_Bool GetFirstPartString( const sal_uInt32 nPartLen, ::rtl::OUString& rPartString );
+ sal_Bool GetNextPartString( const sal_uInt32 nPartLen, ::rtl::OUString& rPartString );
+
+ sal_uInt32 GetLength() const { return mnCurLen; }
+ void Clear() { mnCurLen = 0, maString = ::rtl::OUString(); }
+};
+
+// ----------------------
+// - SVGAttributeWriter -
+// ----------------------
+
+class SVGActionWriter;
+class SVGFontExport;
+
+class SVGAttributeWriter
+{
+private:
+
+ Font maCurFont;
+ Color maCurLineColor;
+ Color maCurFillColor;
+ SvXMLExport& mrExport;
+ SVGFontExport& mrFontExport;
+ SvXMLElementExport* mpElemFont;
+ SvXMLElementExport* mpElemPaint;
+
+ SVGAttributeWriter();
+
+public:
+
+ SVGAttributeWriter( SvXMLExport& rExport, SVGFontExport& rFontExport );
+ virtual ~SVGAttributeWriter();
+
+ ::rtl::OUString GetFontStyle( const Font& rFont );
+ ::rtl::OUString GetPaintStyle( const Color& rLineColor, const Color& rFillColor, const LineInfo* pLineInfo );
+
+ void SetFontAttr( const Font& rFont );
+ void SetPaintAttr( const Color& rLineColor, const Color& rFillColor, const LineInfo* pLineInfo = 0);
+};
+
+// -------------------
+// - SVGActionWriter -
+// -------------------
+
+class SVGAttributeWriter;
+class SvXMLExport;
+class GDIMetaFile;
+
+class SVGActionWriter
+{
+private:
+
+ SvXMLExport& mrExport;
+ SVGFontExport& mrFontExport;
+ SVGAttributeWriter* mpContext;
+ sal_Bool mbClipAttrChanged;
+ sal_Int32 mnCurClipId;
+ Stack maContextStack;
+ VirtualDevice* mpVDev;
+ MapMode maTargetMapMode;
+ sal_Bool mbDestroyVDev;
+ sal_Bool mbPaintAttrChanged;
+ sal_Bool mbFontAttrChanged;
+
+ SVGAttributeWriter* ImplAcquireContext() { maContextStack.Push( mpContext = new SVGAttributeWriter( mrExport, mrFontExport ) ); return mpContext; }
+ void ImplReleaseContext() { delete (SVGAttributeWriter*) maContextStack.Pop(); mpContext = (SVGAttributeWriter*) maContextStack.Top(); }
+
+ long ImplMap( sal_Int32 nVal ) const;
+ Point ImplMap( const Point& rPt ) const;
+ Size ImplMap( const Size& rSz ) const;
+ LineInfo ImplMap( const LineInfo& rLineInfo ) const;
+ inline Rectangle ImplMap( const Rectangle& rRect ) const { return Rectangle( ImplMap( rRect.TopLeft() ), ImplMap( rRect.GetSize() ) ); }
+
+ void ImplWriteLine( const Point& rPt1, const Point& rPt2, const Color* pLineColor = NULL, const ::rtl::OUString* pStyle = NULL );
+ void ImplWriteRect( const Rectangle& rRect, long nRadX = 0, long nRadY = 0, const ::rtl::OUString* pStyle = NULL );
+ void ImplWriteEllipse( const Point& rCenter, long nRadX, long nRadY, const ::rtl::OUString* pStyle = NULL );
+ void ImplWritePolyPolygon( const PolyPolygon& rPolyPoly, sal_Bool bLineOnly, const ::rtl::OUString* pStyle = NULL );
+ void ImplWriteGradientEx( const PolyPolygon& rPolyPoly, const Gradient& rGradient, const ::rtl::OUString* pStyle, sal_uInt32 nWriteFlags );
+ void ImplWriteText( const Point& rPos, const String& rText, const sal_Int32* pDXArray, long nWidth, const ::rtl::OUString* pStyle = NULL );
+ void ImplWriteBmp( const BitmapEx& rBmpEx, const Point& rPt, const Size& rSz, const Point& rSrcPt, const Size& rSrcSz, const ::rtl::OUString* pStyle = NULL );
+
+ void ImplCheckFontAttributes();
+ void ImplCheckPaintAttributes();
+
+ void ImplWriteActions( const GDIMetaFile& rMtf, const ::rtl::OUString* pStyle, sal_uInt32 nWriteFlags );
+ sal_Int32 ImplGetNextClipId() { return mnCurClipId++; }
+
+public:
+
+ static ::rtl::OUString GetValueString( sal_Int32 nVal );
+ static ::rtl::OUString GetPathString( const PolyPolygon& rPolyPoly, sal_Bool bLine );
+
+public:
+
+ SVGActionWriter( SvXMLExport& rExport, SVGFontExport& rFontExport );
+ virtual ~SVGActionWriter();
+
+ void WriteMetaFile( const Point& rPos100thmm,
+ const Size& rSize100thmm,
+ const GDIMetaFile& rMtf,
+ sal_uInt32 nWriteFlags = SVGWRITER_WRITE_ALL );
+};
+
+#endif
diff --git a/filter/source/t602/filterenv.cxx b/filter/source/t602/filterenv.cxx
new file mode 100644
index 000000000000..f7fc319c27e3
--- /dev/null
+++ b/filter/source/t602/filterenv.cxx
@@ -0,0 +1,128 @@
+ /*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include <osl/mutex.hxx>
+#include <osl/thread.h>
+#include <cppuhelper/factory.hxx>
+
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+
+#include "t602filter.hxx"
+
+using namespace ::rtl;
+using namespace ::cppu;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::registry;
+
+using namespace T602ImportFilter;
+
+extern "C"
+{
+//==================================================================================================
+void SAL_CALL component_getImplementationEnvironment(
+ const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */ )
+{
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+//==================================================================================================
+sal_Bool SAL_CALL component_writeInfo(
+ void * /* pServiceManager */, void * pRegistryKey )
+{
+ if (pRegistryKey)
+ {
+ try
+ {
+ sal_Int32 nPos = 0;
+ Reference< XRegistryKey > xNewKey(
+ reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( T602ImportFilter_getImplementationName() ) );
+ xNewKey = xNewKey->createKey( OUString::createFromAscii( "/UNO/SERVICES" ) );
+
+ const Sequence< OUString > & rSNL = T602ImportFilter_getSupportedServiceNames();
+ const OUString * pArray = rSNL.getConstArray();
+ for ( nPos = rSNL.getLength(); nPos--; )
+ xNewKey->createKey( pArray[nPos] );
+
+ xNewKey = reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( T602ImportFilterDialog_getImplementationName() );
+ xNewKey = xNewKey->createKey( OUString::createFromAscii( "/UNO/SERVICES" ) );
+
+ const Sequence< OUString > & rSNL2 = T602ImportFilterDialog_getSupportedServiceNames();
+ pArray = rSNL2.getConstArray();
+ for ( nPos = rSNL2.getLength(); nPos--; )
+ xNewKey->createKey( pArray[nPos] );
+
+ return sal_True;
+ }
+ catch (InvalidRegistryException &)
+ {
+ OSL_ENSURE( sal_False, "### InvalidRegistryException!" );
+ }
+ }
+ return sal_False;
+}
+//==================================================================================================
+void * SAL_CALL component_getFactory(
+ const sal_Char * pImplName, void * pServiceManager, void * /* pRegistryKey */ )
+{
+ void * pRet = 0;
+
+ OUString implName = OUString::createFromAscii( pImplName );
+ if ( pServiceManager && implName.equals(T602ImportFilter_getImplementationName()) )
+ {
+ Reference< XSingleServiceFactory > xFactory( createSingleFactory(
+ reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
+ OUString::createFromAscii( pImplName ),
+ T602ImportFilter_createInstance, T602ImportFilter_getSupportedServiceNames() ) );
+
+ if (xFactory.is())
+ {
+ xFactory->acquire();
+ pRet = xFactory.get();
+ }
+ }
+ else if ( pServiceManager && implName.equals(T602ImportFilterDialog_getImplementationName()) )
+ {
+ Reference< XSingleServiceFactory > xFactory( createSingleFactory(
+ reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
+ OUString::createFromAscii( pImplName ),
+ T602ImportFilterDialog_createInstance, T602ImportFilterDialog_getSupportedServiceNames() ) );
+
+ if (xFactory.is())
+ {
+ xFactory->acquire();
+ pRet = xFactory.get();
+ }
+ }
+
+
+ return pRet;
+}
+}
+
+
diff --git a/filter/source/t602/makefile.mk b/filter/source/t602/makefile.mk
new file mode 100644
index 000000000000..c65de1bc9b7c
--- /dev/null
+++ b/filter/source/t602/makefile.mk
@@ -0,0 +1,62 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+PRJ = ..$/..
+PRJNAME = filter
+TARGET =t602filter
+ENABLE_EXCEPTIONS=TRUE
+LIBTARGET=NO
+
+# --- Settings -----------------------------------------------------
+.INCLUDE: settings.mk
+
+SRS1NAME = $(TARGET)
+SRC1FILES = $(SRS1NAME).src
+
+RESLIB1NAME=$(SRS1NAME)
+RESLIB1SRSFILES= $(SRS)$/$(RESLIB1NAME).srs
+
+SLOFILES=$(SLO)$/t602filter.obj \
+ $(SLO)$/filterenv.obj
+
+LIBNAME=$(TARGET)
+SHL1TARGETDEPN=makefile.mk
+SHL1OBJS=$(SLOFILES)
+SHL1TARGET=$(LIBNAME)$(DLLPOSTFIX)
+SHL1IMPLIB=i$(LIBNAME)
+SHL1VERSIONMAP=$(SOLARENV)/src/component.map
+#SHL1DEF=$(MISC)$/$(SHL1TARGET).def
+DEF1NAME=$(SHL1TARGET)
+
+SHL1STDLIBS= \
+ $(XMLOFFLIB) \
+ $(CPPULIB) \
+ $(CPPUHELPERLIB) \
+ $(SALLIB) \
+ $(TOOLSLIB)
+
+# --- Targets ------------------------------------------------------
+.INCLUDE : target.mk
diff --git a/filter/source/t602/t602filter.cxx b/filter/source/t602/t602filter.cxx
new file mode 100644
index 000000000000..6ee62e306208
--- /dev/null
+++ b/filter/source/t602/t602filter.cxx
@@ -0,0 +1,1266 @@
+ /*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include "t602filter.hxx"
+#include "t602filter.hrc"
+
+#include <ctype.h>
+#include <stdio.h>
+
+#include <cppuhelper/factory.hxx>
+#include <cppuhelper/bootstrap.hxx>
+#include <com/sun/star/bridge/XUnoUrlResolver.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/awt/XControl.hpp>
+#include <com/sun/star/awt/XDialog.hpp>
+#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
+
+using namespace ::rtl;
+using namespace ::cppu;
+using namespace ::osl;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::registry;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::awt;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::com::sun::star::document;
+using com::sun::star::io::XInputStream;
+
+namespace T602ImportFilter {
+
+ unsigned char kam2lat[129] =
+ // 0 1 2 3 4 5 6 7 8 9 A B C D E F
+ "\xAC\x81\x82\xD4\x84\xD2\x9B\x9F\xD8\xB7\x91\xD6\x96\x92\x8E\xB5" // 8
+ "\x90\xA7\xA6\x93\x94\xE0\x85\xE9\xEC\x99\x9A\xE6\x95\xED\xFC\x9C" // 9
+ "\xA0\xA1\xA2\xA3\xE5\xD5\xDE\xE2\xE7\xFD\xEA\xE8\xCE\xF5\xAE\xAF" // A
+ "\x80\x80\x83\xB3\xB4\xE1\x87\x88\x89\x8A\x8B\x8C\x8F\x97\x8D\xBF" // B
+ "\xC0\xC1\xC2\xC3\xC4\xC5\xCF\x98\x9D\x9E\xA4\xA5\xA8\xA9\x86\xF3" // C
+ "\xCD\xB1\xB2\xB6\xB8\xB9\xBA\xBB\xF7\xD9\xDA\xDB\xDC\xF8\xF9\xDF" // D
+ "\xD0\xD1\xD3\xD7\xAA\xAB\xDD\xB0\xE3\xE4\xEB\xEE\xEF\xF0\xF2\xF4" // E
+ "\xBC\xBD\xBE\xC6\xC7\xC8\xF6\xC9\xCA\xFA\xFB\xCB\xF1\xCC\xFE\xFF"; // F
+
+ unsigned char koi2lat[129] =
+ // 0 1 2 3 4 5 6 7 8 9 A B C D E F
+ "\x80\x83\x86\xF5\xE1\x87\x88\x89\x8A\x8B\x8C\x8F\x97\xCF\xCF\x98" // 8
+ "\x9D\x9E\xA4\xA5\xA8\xA9\xDB\xDC\xDF\xB1\xB2\xB6\xB8\xB9\xBA\xBB" // 9
+ "\xBC\xBD\xBE\xC6\xC7\xC8\xF6\xC9\xCA\xCB\xCC\xCD\xCE\xAD\xAE\xAF" // A
+ "\xD0\xD1\xD3\xD7\xAA\xAB\xDD\xB0\xE3\xE4\xEB\xEE\xEF\xF0\xF2\xF4" // B
+ "\xDA\xA0\xC0\x9F\xD4\xD8\xEA\xC4\x81\xA1\x85\x92\x96\x94\xE5\xA2" // C
+ "\x93\x84\xFD\xE7\x9C\xA3\xC3\x82\xF7\xEC\xA7\xC2\xF3\xF8\xF9\xC5" // D
+ "\xBF\xB5\xD9\xAC\xD2\xB7\xE8\xB3\x9A\xD6\xDE\x91\x95\x99\xD5\xE0" // E
+ "\xE2\x8E\xFC\xE6\x9B\xE9\xB4\x90\xFA\xED\xA6\xC1\xF1\xFB\xFE\xFF"; // F
+
+ unsigned char lat2UNC[257] =
+ // 0 1 2 3 4 5 6 7
+ // 8 9 A B C D E F
+ "\x00\xe7\x00\xfc\x00\xe9\x00\xf9\x00\xe4\x01\x6f\x00\xe8\x00\xa3" // 8
+ "\x00\xc6\x00\xd8\x00\xc5\x00\xe6\x00\xf8\x00\xc4\x00\xc4\x00\xe5"
+ "\x00\xc9\x01\x39\x00\xf4\x00\xf4\x00\xf6\x01\x3d\x01\x3e\x00\x20" // 9
+ "\x00\xf2\x00\xd6\x00\xdc\x01\x64\x01\x65\x00\xec\x20\xa7\x01\x0d"
+ "\x00\xe1\x00\xed\x00\xf3\x00\xfa\x00\xa1\x00\xd1\x01\x7d\x01\x7e" // A
+ "\x00\xbf\x00\xf1\x22\x11\x03\xc3\x01\x0c\x00\xa7\x00\xbb\x00\xab"
+ "\x25\x91\x25\x92\x25\x93\x25\x02\x25\x24\x00\xc1\x00\xc2\x01\x1a" // B
+ "\x00\x20\x00\x20\x00\x20\x00\x20\x22\x61\x00\xb1\x22\x65\x25\x10"
+ "\x25\x14\x25\x34\x25\x2c\x25\x1c\x25\x00\x25\x3c\x22\x64\x23\x20" // C
+ "\x23\x21\x22\x48\x00\xba\x22\x1a\x00\xb2\x00\xbd\x00\xbc\x00\xa4"
+ "\x03\xb1\x03\xb2\x01\x0e\x03\x93\x01\x0f\x01\x47\x00\xcd\x03\xc0" // D
+ "\x01\x1b\x25\x18\x25\x0c\x25\x88\x25\x84\x00\xb5\x01\x6e\x25\x80"
+ "\x00\xd3\x00\xdf\x00\xd4\x03\xa6\x03\x98\x01\x48\x01\x60\x01\x61" // E
+ "\x01\x54\x00\xda\x01\x55\x03\xa9\x00\xfd\x00\xdd\x03\xb4\x22\x1e"
+ "\x00\xf8\x02\xdd\x03\xb5\x02\xc7\x22\x29\x00\xa7\x00\xf7\x00\xe0" // F
+ "\x00\xb4\x00\xb0\x00\xc0\x02\xc6\x01\x58\x01\x59\x00\x20\x00\x20";
+
+ unsigned char rus2UNC[257] =
+ // 0 1 2 3 4 5 6 7
+ // 8 9 A B C D E F
+ "\x04\x11\x00\xfc\x00\xe9\x04\x12\x00\xe4\x01\x6f\x04\x13\x04\x14" // 8
+ "\x04\x01\x04\x16\x04\x17\x04\x18\x04\x19\x00\xc4\x00\xc4\x04\x1a"
+ "\x00\xc9\x01\x39\x01\x3a\x00\xf4\x00\xf6\x01\x3d\x01\x3e\x00\x20" // 9
+ "\x04\x1c\x00\xd6\x00\xdc\x01\x64\x01\x65\x04\x1d\x04\x1f\x01\x0a"
+ "\x00\xe1\x00\xed\x00\xf3\x00\xfa\x04\x20\x04\x22\x01\x7d\x01\x7e" // A
+ "\x04\x23\x04\x24\x04\x43\x04\x44\x01\x0c\x00\xa7\x04\x3b\x04\x3c"
+ "\x04\x47\x04\x26\x04\x27\x25\x02\x25\x24\x00\xc1\x04\x28\x01\x1a" // B
+ "\x04\x29\x04\x2a\x04\x2b\x04\x2c\x04\x2d\x04\x2e\x04\x2f\x25\x10"
+ "\x25\x14\x25\x34\x25\x2c\x25\x1c\x25\x00\x25\x3c\x04\x31\x04\x32" // C
+ "\x04\x33\x04\x51\x04\x36\x04\x37\x04\x38\x04\x39\x04\x3a\x04\x1b"
+ "\x04\x3d\x04\x3f\x01\x0e\x04\x40\x01\x0f\x01\x47\x00\xcd\x04\x42" // D
+ "\x01\x1b\x25\x18\x25\x0c\x25\x88\x25\x84\x04\x46\x01\x6e\x25\x80"
+ "\x00\xd3\x00\xdf\x00\xd4\x04\x48\x04\x49\x01\x48\x01\x60\x01\x61" // E
+ "\x01\x54\x00\xda\x01\x55\x04\x4a\x00\xfd\x00\xdd\x04\x4b\x04\x4c"
+ "\x04\x4d\x02\xdd\x04\x4e\x02\xc7\x04\x4f\x00\xa7\x04\x34\x00\xe0" // F
+ "\x00\xb4\x00\xb0\x00\xc0\x02\xc6\x01\x58\x01\x59\x00\x20\x00\x20";
+
+#define _AddAtt(_nam, _val) \
+ mpAttrList->AddAttribute(OUString::createFromAscii( _nam ),\
+ OUString::createFromAscii( _val ) );
+
+#define _Start(_nam) \
+ mxHandler->startElement(OUString::createFromAscii(_nam), mAttrList);\
+ mpAttrList->Clear();
+
+#define _End(_nam) \
+ mxHandler->endElement(OUString::createFromAscii(_nam));
+
+#define _Chars(_ch) \
+ mxHandler->characters(OUString::createFromAscii((sal_Char *) _ch) );
+
+inistruct ini;
+
+T602ImportFilter::T602ImportFilter(const ::com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory > &r ) :
+ mxMSF( r ) {}
+
+T602ImportFilter::~T602ImportFilter()
+{
+}
+
+// XExtendedTypeDetection
+::rtl::OUString T602ImportFilter::detect( Sequence<PropertyValue>& Descriptor)
+ throw(RuntimeException)
+{
+ // checks for filter or type name would be necessary in case we want to use the filter also for "602" files
+ // without the magic bytes at the beginning; I leave the code as comment in case of
+ // ::rtl::OUString aFilterName, aTypeName;
+ sal_Int32 nLength = Descriptor.getLength();
+ const PropertyValue * pValue = Descriptor.getConstArray();
+ for ( sal_Int32 i = 0 ; i < nLength; i++)
+ {
+ if ( pValue[i].Name.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "InputStream" ) ) )
+ pValue[i].Value >>= mxInputStream;
+/* else if ( pValue[i].Name.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "FilterName" ) ) )
+ pValue[i].Value >>= aFilterName;
+ else if ( pValue[i].Name.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "TypeName" ) ) )
+ pValue[i].Value >>= aTypeName; */
+ }
+
+ if (!mxInputStream.is())
+ return ::rtl::OUString();
+
+/* if ( aFilterName.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "T602Document" ) ) ||
+ aTypeName.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "writer_T602_Document" ) ) )
+ // preselection by type (extension) or filter name: no reason to check type
+ return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "writer_T602_Document" ) ); */
+
+ ::com::sun::star::uno::Sequence< sal_Int8 > aData;
+ size_t numBytes = 4;
+ size_t numBytesRead = 0;
+
+ numBytesRead = mxInputStream->readSomeBytes (aData, numBytes);
+
+ if ((numBytesRead != numBytes) || (aData[0] != '@') ||
+ (aData[1] != 'C') || (aData[2] != 'T') || (aData[3] != ' '))
+ return ::rtl::OUString();
+
+ return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "writer_T602_Document" ) );;
+}
+
+// XFilter
+sal_Bool SAL_CALL T602ImportFilter::filter( const Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor )
+ throw (RuntimeException)
+{
+ return importImpl ( aDescriptor );
+}
+
+// XImporter
+void SAL_CALL T602ImportFilter::setTargetDocument( const Reference< ::com::sun::star::lang::XComponent >& xDoc )
+ throw (::com::sun::star::lang::IllegalArgumentException, RuntimeException)
+{
+ mxDoc = xDoc;
+}
+
+// XInitialization
+void SAL_CALL T602ImportFilter::initialize( const Sequence< Any >& aArguments )
+ throw (Exception, RuntimeException)
+{
+ Sequence < PropertyValue > aAnySeq;
+ sal_Int32 nLength = aArguments.getLength();
+ if ( nLength && ( aArguments[0] >>= aAnySeq ) )
+ {
+ const PropertyValue * pValue = aAnySeq.getConstArray();
+ nLength = aAnySeq.getLength();
+ for ( sal_Int32 i = 0 ; i < nLength; i++)
+ {
+ if ( pValue[i].Name.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "Type" ) ) )
+ {
+ pValue[i].Value >>= msFilterName;
+ break;
+ }
+ }
+ }
+}
+
+// Other functions
+
+void T602ImportFilter::inschr(unsigned char ch)
+{
+ Reference < XAttributeList > mAttrList ( mpAttrList );
+
+ if(!ini.showcomm&&pst.comment) return;
+
+ if(ch==' ') {
+ setfnt(chngul,true);
+ pst.wasspace++;
+ return;
+ }
+
+ if(pst.wasspace > 0) {
+ if(ini.reformatpars) {
+ if(!pst.wasfdash)
+ inschrdef(' ');
+ pst.wasfdash = false;
+ } else {
+ char s[20];
+ sprintf(s,"%i",pst.wasspace);
+ _AddAtt("text:c",s);
+ _Start("text:s");
+ _End("text:s");
+ }
+ }
+
+ pst.wasspace = 0;
+ setfnt(chngul,true);
+ inschrdef(ch);
+}
+
+sal_Bool SAL_CALL T602ImportFilter::importImpl( const Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor )
+ throw (RuntimeException)
+{
+ Reset602();
+
+ sal_Int32 nLength = aDescriptor.getLength();
+ const PropertyValue * pValue = aDescriptor.getConstArray();
+ OUString sURL;
+ for ( sal_Int32 i = 0 ; i < nLength; i++)
+ {
+ if ( pValue[i].Name.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "InputStream" ) ) )
+ pValue[i].Value >>= mxInputStream;
+ }
+
+ if ( !mxInputStream.is() )
+ {
+ OSL_ASSERT( 0 );
+ return sal_False;
+ }
+
+ // An XML import service: what we push sax messages to..
+ OUString sXMLImportService ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Writer.XMLImporter" ) );
+
+ mxHandler = Reference< XDocumentHandler >( mxMSF->createInstance( sXMLImportService ), UNO_QUERY );
+
+ // The XImporter sets up an empty target document for XDocumentHandler to write to..
+ Reference < XImporter > xImporter(mxHandler, UNO_QUERY);
+ xImporter->setTargetDocument(mxDoc);
+
+ char fs[32], fs2[32];
+ sprintf(fs, "%ipt", ini.fontsize);
+ sprintf(fs2,"%ipt", 2*ini.fontsize);
+
+ mpAttrList = new SvXMLAttributeList;
+
+ Reference < XAttributeList > mAttrList ( mpAttrList );
+
+ mxHandler->startDocument();
+
+ _AddAtt("xmlns:office", "http://openoffice.org/2000/office");
+ _AddAtt("xmlns:style", "http://openoffice.org/2000/style");
+ _AddAtt("xmlns:text", "http://openoffice.org/2000/text");
+ _AddAtt("xmlns:table", "http://openoffice.org/2000/table");
+ _AddAtt("xmlns:draw", "http://openoffice.org/2000/draw");
+ _AddAtt("xmlns:fo", "http://www.w3.org/1999/XSL/Format");
+ _AddAtt("xmlns:xlink", "http://www.w3.org/1999/xlink");
+ _AddAtt("xmlns:number", "http://openoffice.org/2000/datastyle");
+ _AddAtt("xmlns:svg", "http://www.w3.org/2000/svg");
+ _AddAtt("xmlns:chart", "http://openoffice.org/2000/chart");
+ _AddAtt("xmlns:dr3d", "http://openoffice.org/2000/dr3d");
+ _AddAtt("xmlns:math", "http://www.w3.org/1998/Math/MathML");
+ _AddAtt("xmlns:form", "http://openoffice.org/2000/form");
+ _AddAtt("xmlns:script", "http://openoffice.org/2000/script");
+ _AddAtt("office:class", "text");
+ _AddAtt("office:version", "1.0");
+ _Start("office:document-content");
+
+ _Start("office:font-decls");
+ _AddAtt("style:name","Courier New");
+ _AddAtt("fo:font-family","Courier New");
+ _AddAtt("style:font-pitch","fixed");
+ _Start("style:font-decl");
+ _End("style:font-decl");
+ _End("office:font-decls");
+
+ _Start("office:automatic-styles");
+
+ // Standardni text
+ _AddAtt("style:name","P1");
+ _AddAtt("style:family","paragraph");
+ _AddAtt("style:parent-style-name","Standard");
+ _Start("style:style");
+ _AddAtt("style:font-name","Courier New");
+ _AddAtt("fo:font-size",fs);
+ _Start("style:properties");
+ _End("style:properties");
+ _End("style:style");
+
+ // Standardni text - konec stranky
+ _AddAtt("style:name","P2");
+ _AddAtt("style:family","paragraph");
+ _AddAtt("style:parent-style-name","Standard");
+ _Start("style:style");
+ _AddAtt("style:font-name","Courier New");
+ _AddAtt("fo:font-size",fs);
+ _AddAtt("fo:break-before","page");
+ _Start("style:properties");
+ _End("style:properties");
+ _End("style:style");
+
+ // T1 Normalni text
+ _AddAtt("style:name","T1");
+ _AddAtt("style:family","text");
+ _Start("style:style");
+ _Start("style:properties");
+ _End("style:properties");
+ _End("style:style");
+
+ // T2 Tucny text
+ _AddAtt("style:name","T2");
+ _AddAtt("style:family","text");
+ _Start("style:style");
+ _AddAtt("fo:font-weight","bold");
+ _Start("style:properties");
+ _End("style:properties");
+ _End("style:style");
+
+ // T3 Kurziva
+ _AddAtt("style:name","T3");
+ _AddAtt("style:family","text");
+ _Start("style:style");
+ _AddAtt("fo:font-style","italic");
+ _Start("style:properties");
+ _End("style:properties");
+ _End("style:style");
+
+ // T4 Siroky text
+ _AddAtt("style:name","T4");
+ _AddAtt("style:family","text");
+ _Start("style:style");
+ _AddAtt("fo:font-weight","bold");
+ _AddAtt("style:text-scale","200%");
+ _Start("style:properties");
+ _End("style:properties");
+ _End("style:style");
+
+ // T5 Vysoky text
+ _AddAtt("style:name","T5");
+ _AddAtt("style:family","text");
+ _Start("style:style");
+ _AddAtt("fo:font-size",fs2);
+ _AddAtt("fo:font-weight","bold");
+ _AddAtt("style:text-scale","50%");
+ _Start("style:properties");
+ _End("style:properties");
+ _End("style:style");
+
+ // T6 Velky text
+ _AddAtt("style:name","T6");
+ _AddAtt("style:family","text");
+ _Start("style:style");
+ _AddAtt("fo:font-size",fs2);
+ _AddAtt("fo:font-weight","bold");
+ _Start("style:properties");
+ _End("style:properties");
+ _End("style:style");
+
+ // T7 Podtrzeny text
+ _AddAtt("style:name","T7");
+ _AddAtt("style:family","text");
+ _Start("style:style");
+ _AddAtt("style:text-underline","single");
+ _Start("style:properties");
+ _End("style:properties");
+ _End("style:style");
+
+ // T8 Podtrzena tucny text
+ _AddAtt("style:name","T8");
+ _AddAtt("style:family","text");
+ _Start("style:style");
+ _AddAtt("fo:font-weight","bold");
+ _AddAtt("style:text-underline","single");
+ _Start("style:properties");
+ _End("style:properties");
+ _End("style:style");
+
+ // T9 Podtrzena kurziva
+ _AddAtt("style:name","T9");
+ _AddAtt("style:family","text");
+ _Start("style:style");
+ _AddAtt("fo:font-style","italic");
+ _AddAtt("style:text-underline","single");
+ _Start("style:properties");
+ _End("style:properties");
+ _End("style:style");
+
+ // T10 Horni index
+ _AddAtt("style:name","T10");
+ _AddAtt("style:family","text");
+ _Start("style:style");
+ _AddAtt("style:text-position","27% 100%");
+ _Start("style:properties");
+ _End("style:properties");
+ _End("style:style");
+
+ // T11 Dolni index
+ _AddAtt("style:name","T11");
+ _AddAtt("style:family","text");
+ _Start("style:style");
+ _AddAtt("style:text-position","-27% 100%");
+ _Start("style:properties");
+ _End("style:properties");
+ _End("style:style");
+
+ _End("office:automatic-styles");
+
+ _Start("office:styles");
+ _End("office:styles");
+
+ _Start("office:body");
+
+ Read602();
+
+ _End("office:body");
+ _End("office:document-content");
+
+ mxHandler->endDocument();
+
+ return sal_True;
+}
+
+void T602ImportFilter::Reset602()
+{
+ node = START;
+
+ format602.mt = 0;
+ format602.mb = 0;
+ format602.tb = 0;
+ format602.ct = 0;
+ format602.pn = 1;
+ format602.lh = 1;
+ format602.lm = 6;
+ format602.rm = 60;
+ format602.pl = 60;
+
+ ini.showcomm = false;
+ ini.forcecode = false;
+ ini.xcode = KAM;
+ ini.ruscode = false;
+ ini.reformatpars= false;
+ ini.fontsize = 10;
+
+ fst.nowfnt = fst.oldfnt = standard;
+ fst.uline = fst.olduline = false;
+
+ pst.pars = 0;
+ pst.comment = false;
+ pst.wasspace = 0;
+ pst.ccafterln = false;
+ pst.willbeeop = false;
+ pst.waspar = false;
+ pst.wasfdash = false;
+}
+
+void T602ImportFilter::inschrdef(unsigned char ch)
+{
+ static sal_Unicode xch[2];
+
+ xch[1] = 0;
+
+ if(ch > 127) {
+
+ switch(ini.xcode) {
+ case L2 : break;
+ case KOI: ch = koi2lat[ch-128]; break;
+ case KAM: ch = kam2lat[ch-128]; break;
+ default : ch = kam2lat[ch-128];
+ }
+
+ if(ini.ruscode)
+ xch[0] = (rus2UNC[(ch-128)*2] << 8) + rus2UNC[(ch-128)*2+1];
+ else
+ xch[0] = (lat2UNC[(ch-128)*2] << 8) + lat2UNC[(ch-128)*2+1];
+ } else
+ xch[0] = ch;
+
+ pst.waspar = false;
+ mxHandler->characters(OUString(xch));
+}
+
+void T602ImportFilter::wrtfnt()
+{
+ Reference < XAttributeList > mAttrList ( mpAttrList );
+ const sal_Char *style = "P1";
+
+ switch(fst.nowfnt) {
+ case standard : style = (char*)(fst.uline ? "T7" : "T1"); break;
+ case fat : style = (char*)(fst.uline ? "T8" : "T2"); break;
+ case cursive : style = (char*)(fst.uline ? "T9" : "T3"); break;
+ case bold : style = "T4"; break;
+ case tall : style = "T5"; break;
+ case big : style = "T6"; break;
+ case lindex : style = "T11";break;
+ case hindex : style = "T10";break;
+ default : style = "T1"; break;
+ }
+
+ _End("text:span");
+ _AddAtt("text:style-name", style);
+ _Start("text:span");
+}
+
+void T602ImportFilter::setfnt(fonts fnt,bool mustwrite)
+{
+ if( fnt == fst.oldfnt &&
+ fnt == fst.nowfnt &&
+ !mustwrite )
+ fst.nowfnt = standard;
+ else
+ if (fnt != chngul) fst.nowfnt = fnt;
+
+ if(mustwrite)
+ if(fst.oldfnt != fst.nowfnt || fst.olduline != fst.uline) {
+ wrtfnt();
+ fst.oldfnt = fst.nowfnt;
+ fst.olduline = fst.uline;
+ }
+}
+
+unsigned char T602ImportFilter::Readchar602()
+{
+ static Sequence< sal_Int8 > aData;
+
+ return (mxInputStream->readBytes(aData, 1) > 0) ?
+ ((unsigned char *) aData.getConstArray())[0] : 0;
+}
+
+void T602ImportFilter::par602(bool endofpage)
+{
+ sal_Int16 endp;
+ Reference < XAttributeList > mAttrList ( mpAttrList );
+
+ if(!endofpage || !pst.waspar) {
+ if(ini.showcomm||!pst.comment) {
+ if(pst.waspar||ini.reformatpars) {
+ _End("text:span");
+ _End("text:p");
+ _AddAtt("text:style-name", "P1");
+ _Start("text:p");
+ _Start("text:span");
+ wrtfnt();
+ } else {
+ _Start("text:line-break");
+ _End("text:line-break");
+ }
+ }
+
+ pst.waspar = true;
+ }
+
+ if(!pst.comment) {
+ switch(format602.lh) {
+ case 3: pst.pars += 4; break;
+ case 4: pst.pars += 3; break;
+ case 6: pst.pars += 2; break;
+ default: pst.pars +=2; break;
+ }
+ endp = format602.pl-format602.mt-format602.mb;
+ if(((pst.pars+1)/2) >= endp || endofpage) {
+ pst.pars = 0;
+ if(!ini.reformatpars) {
+ _End("text:span");
+ _End("text:p");
+ _AddAtt("text:style-name", "P2");
+ _Start("text:p");
+ _Start("text:span");
+ wrtfnt();
+ }
+ }
+ }
+}
+
+sal_Int16 T602ImportFilter::readnum(unsigned char *ch, bool show)
+{
+ unsigned char buff[21];
+ sal_Int16 i=0;
+
+ while((i<20) && *ch && (*ch!='\n') && (*ch!=','))
+ {
+ *ch = Readchar602();
+ if(show) inschr(*ch);
+ buff[i++] = *ch;
+ }
+ buff[i]='\0';
+
+ // mba: cast from unsigned char via int to sal_Int16 seems to be safe
+ return (sal_Int16) atoi((char *)buff);
+}
+
+unsigned char T602ImportFilter::Setformat602(char *cmd)
+{
+ unsigned char ch;
+ sal_Int16 i;
+
+ ch = Readchar602();
+
+ if (cmd[0]=='M' && cmd[1]=='T') format602.mt = readnum(&ch,false);
+ else if (cmd[0]=='M' && cmd[1]=='B') format602.mb = readnum(&ch,false);
+ // else if (cmd[0]=='T' && cmd[1]=='B') {}
+ // else if (cmd[0]=='H' && cmd[1]=='E') {}
+ // else if (cmd[0]=='F' && cmd[1]=='O') {}
+ else if (cmd[0]=='C' && cmd[1]=='T') {
+ format602.ct = readnum(&ch,false);
+ if (!ini.forcecode)
+ switch(format602.ct) {
+ case 0: ini.xcode = KAM; break;
+ case 1: ini.xcode = L2; break;
+ case 2: ini.xcode = KOI; break;
+ default: ini.xcode = KAM; break;
+ }
+ }
+ else if (cmd[0]=='P' && cmd[1]=='N') format602.pn = readnum(&ch,false);
+ else if (cmd[0]=='L' && cmd[1]=='H') format602.lh = readnum(&ch,false);
+ // else if(cmd[0]=='S' && cmd[1]=='T') {} //styl
+ else if (cmd[0]=='L' && cmd[1]=='M') format602.lm = readnum(&ch,false);
+ else if (cmd[0]=='R' && cmd[1]=='M') format602.rm = readnum(&ch,false);
+ else if (cmd[0]=='P' && cmd[1]=='L') format602.pl = readnum(&ch,false);
+ else if (cmd[0]=='P' && cmd[1]=='A') { if(pst.pars) par602(true); }
+ else if (cmd[0]=='C' && cmd[1]=='P') {
+ i = readnum(&ch,false);
+ if ((i+pst.pars/2) > (format602.pl-format602.mt-format602.mb))
+ if(pst.pars) par602(true);
+ }
+ while (ch && (ch != '\n')) ch = Readchar602();
+ return ch;
+}
+
+tnode T602ImportFilter::PointCmd602(unsigned char *ch)
+{
+ char pcmd[2];
+
+ // warning: uChar -> char
+ pcmd[0] = (char) toupper(*ch); inschr(*ch);
+ *ch = Readchar602();
+ if (!*ch) return EEND;
+ if (*ch=='\n') return EOL;
+ if (!isalpha(*ch)) return (*ch<32) ? SETCH : WRITE;
+
+ // warning: uChar -> char
+ pcmd[1] = (char) toupper(*ch); inschr(*ch);
+
+ if (pcmd[0]=='P' && pcmd[1]=='A') { if (pst.pars) pst.willbeeop = true; }
+ else if (pcmd[0]=='C' && pcmd[1]=='P') { if (pst.pars) pst.willbeeop = true; }
+ else if (pcmd[0]=='P' && pcmd[1]=='I') {
+ while (*ch && (*ch != '\n') && (*ch != ','))
+ { *ch = Readchar602(); inschr(*ch); }
+ if (!*ch) return EEND;
+ if (*ch=='\n') return EOL;
+ if (*ch==',') { *ch = Readchar602(); inschr(*ch); }
+ pst.pars += (readnum(ch,true)*2);
+ if (!*ch) return EEND;
+ if (*ch=='\n') return EOL;
+ }
+ // else if(pcmd[0]=='K'&&pcmd[1]=='P') {}
+ // else if(pcmd[0]=='H'&&pcmd[1]=='E') {}
+ // else if(pcmd[0]=='F'&&pcmd[1]=='O') {}
+
+ return READCH;
+}
+
+
+void T602ImportFilter::Read602()
+{
+ unsigned char ch=0;
+ char cmd602[3];
+
+ Reference < XAttributeList > mAttrList ( mpAttrList );
+
+ if (node==QUIT) return;
+
+ _AddAtt("text:style-name", "P1");
+ _Start("text:p");
+ _AddAtt("text:style-name", "T1");
+ _Start("text:span");
+
+ if (node==START) { node = EOL; }
+
+ while (node != EEND) {
+ switch (node) {
+ case READCH:
+ ch = Readchar602();
+ if (ch == 0) node = EEND;
+ else if (ch == '\n') {
+ if(!pst.willbeeop) par602(false);
+ node = EOL;
+ } else if (ch < 32) node = SETCH;
+ else node = WRITE;
+ break;
+ case EOL:
+ ch = Readchar602();
+ pst.comment = false;
+ if (pst.willbeeop) par602(true);
+ pst.willbeeop = false;
+ if(ch == 0) node = EEND;
+ else if (ch == '@') node = EXPCMD;
+ else if (ch == '\n') { par602(false); node = EOL; }
+ else if (ch < 32) {pst.ccafterln = true; node = SETCH; break;}
+ else node = WRITE;
+ if (ch == '.') { pst.comment = true; node = POCMD; }
+ pst.ccafterln = false;
+ break;
+
+ case POCMD: inschr('.');
+ ch = Readchar602();
+ if(ch == 0) node = EEND;
+ else if(isalpha(ch)) node = PointCmd602(&ch);
+ else if(ch <32) node=SETCH;
+ else node = WRITE;
+ break;
+
+ case EXPCMD: ch = Readchar602();
+ if(ch == 0) {inschr('@'); node = EEND; }
+ else if(isupper(ch)) {
+ cmd602[0] = ch;
+ ch = Readchar602();
+ cmd602[1] = ch;
+ cmd602[2] = '\0';
+ if(isupper(ch)) node = SETCMD; //nedodelano
+ else { inschr('@'); _Chars(cmd602); node = READCH; }
+ } else {
+ inschr('@');
+ if(ch<32) node = SETCH;
+ else node = WRITE;}
+ break;
+
+ case SETCMD:
+ ch = Setformat602(cmd602);
+ if(ch == 0) node = EEND;
+ else if(ch == '\n') node = EOL;
+ else node = READCH;
+ break;
+
+ case SETCH :
+ // warning: potentially uninitialized
+ switch(ch) {
+ case '\t' : _Start("text:tab-stop");
+ _End("text:tab-stop");
+ break;
+ case 0x03 : break; //condensed
+ case 0x01 : break; //elite
+ case 0x11 : break; //uzv1
+ case 0x12 : break; //uzv2
+ case 0x15 : break; //uzv3
+ case 0x17 : break; //uzv4
+ case 0x18 : break; //uzv5
+ case 0x19 : break; //uzv6
+ case 0x13 : fst.uline = !fst.uline;break;
+ case 0x02 : setfnt(fat,false); break;
+ case 0x04 : setfnt(cursive,false); break;
+ case 0x0f : setfnt(bold,false); break;
+ case 0x10 : setfnt(tall,false); break;
+ case 0x1d : setfnt(big,false); break;
+ case 0x14 : setfnt(hindex,false); break;
+ case 0x16 : setfnt(lindex,false); break;
+ default : break;
+ }
+ if(pst.ccafterln) node = EOL;
+ else node = READCH;
+ break;
+
+ case WRITE :
+ switch(ch) {
+ case 0x8d:
+ ch = Readchar602();
+ if( ch == 0x0a) {
+ if(ini.reformatpars) inschr(' ');
+ else par602(false); //formatovaci radek
+ node = EOL;
+ } else {
+ inschr(0x8d);//inschr(' ');
+ if(ch == 0) node = EEND;
+ else if(ch == '\n') {
+ if(!pst.willbeeop) par602(false);
+ node = EOL; }
+ else if(ch < 32) node = SETCH;
+ else node = WRITE;
+ }
+ break;
+ case 0xfe:
+ if (ini.showcomm||!pst.comment) inschr(' ');
+ node = READCH;
+ break;
+ case 0xad:
+ ch = Readchar602();
+ if( ch==0x8d ) {
+ if(ini.showcomm||!pst.comment) { //formatovaci pomlcka
+ if(!ini.reformatpars)
+ inschr('-');
+ else {
+ pst.wasspace--;
+ pst.wasfdash = true;
+ }
+ }
+ node=WRITE;
+ } else {
+ inschr(0xad);
+ if(ch == 0) node = EEND;
+ else if(ch == '\n') {
+ if(!pst.willbeeop) par602(false);
+ node = EOL; }
+ else if(ch < 32) node = SETCH;
+ else node = WRITE;
+ }
+ break;
+ default:
+ inschr(ch);
+ node = READCH;
+ break;
+ }
+ break;
+ default: break;
+ }
+ }
+
+ _End("text:span");
+ _End("text:p");
+ node = QUIT;
+}
+
+// XServiceInfo
+OUString SAL_CALL T602ImportFilter::getImplementationName( )
+ throw (RuntimeException)
+{
+ return T602ImportFilter_getImplementationName();
+}
+
+sal_Bool SAL_CALL T602ImportFilter::supportsService( const OUString& rServiceName )
+ throw (RuntimeException)
+{
+ return T602ImportFilter_supportsService( rServiceName );
+}
+
+Sequence< OUString > SAL_CALL T602ImportFilter::getSupportedServiceNames( )
+ throw (RuntimeException)
+{
+ return T602ImportFilter_getSupportedServiceNames();
+}
+
+#define IMPLEMENTATION_NAME "com.sun.star.comp.Writer.T602ImportFilter"
+
+OUString T602ImportFilter_getImplementationName ()
+ throw (RuntimeException)
+{
+ return OUString ( RTL_CONSTASCII_USTRINGPARAM ( IMPLEMENTATION_NAME ) );
+}
+
+#define SERVICE_NAME1 "com.sun.star.document.ImportFilter"
+#define SERVICE_NAME2 "com.sun.star.document.ExtendedTypeDetection"
+sal_Bool SAL_CALL T602ImportFilter_supportsService( const OUString& ServiceName )
+ throw (RuntimeException)
+{
+ return (ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SERVICE_NAME1 ) ) ||
+ ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SERVICE_NAME2 ) ) );
+}
+
+Sequence< OUString > SAL_CALL T602ImportFilter_getSupportedServiceNames( )
+ throw (RuntimeException)
+{
+ Sequence < OUString > aRet(2);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME1 ) );
+ pArray[1] = OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME2 ) );
+ return aRet;
+}
+#undef SERVICE_NAME2
+#undef SERVICE_NAME1
+#undef IMPLEMENTATION_NAME
+
+Reference< XInterface > SAL_CALL T602ImportFilter_createInstance( const Reference< XMultiServiceFactory > & rSMgr)
+ throw( Exception )
+{
+ return (cppu::OWeakObject*) new T602ImportFilter( rSMgr );
+}
+
+/* Reference < XInterface > SAL_CALL CreateInstance( const Reference< XMultiServiceFactory > &r)
+throw ( Exception )
+{
+ return Reference< XInterface > (( OWeakObject *) new T602ImportFilter(r));
+}
+
+Sequence < OUString > getSupportedServiceNames()
+throw ( RuntimeException )
+{
+ static Sequence < OUString > *pNames = 0;
+ if( ! pNames ) {
+ MutexGuard guard( Mutex::getGlobalMutex() );
+ if( !pNames ) {
+ static Sequence< OUString > seqNames(2);
+ seqNames.getArray()[0] = OUString::createFromAscii(IMPLEMENTATION_NAME);
+ pNames = &seqNames;
+ }
+ }
+ return *pNames;
+}*/
+
+T602ImportFilterDialog::T602ImportFilterDialog(const ::com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory > &r ) :
+ mxMSF( r ), mpResMgr( NULL ) {}
+
+T602ImportFilterDialog::~T602ImportFilterDialog()
+{
+ if (mpResMgr)
+ delete mpResMgr;
+}
+
+// XLocalizable
+
+void SAL_CALL T602ImportFilterDialog::setLocale( const Locale& eLocale )
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ meLocale = eLocale;
+ initLocale();
+}
+
+Locale SAL_CALL T602ImportFilterDialog::getLocale()
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ return meLocale;
+}
+
+sal_Bool T602ImportFilterDialog::OptionsDlg()
+{
+ sal_Bool ret = sal_False;
+
+ Any any;
+#define _propInt(_prop,_nam,_val) \
+ any <<= (sal_Int32)_val;\
+ _prop->setPropertyValue(OUString::createFromAscii(_nam), any);
+#define _propShort(_prop,_nam,_val) \
+ any <<= (sal_Int16)_val;\
+ _prop->setPropertyValue(OUString::createFromAscii(_nam), any);
+#define _propBool(_prop,_nam,_val) \
+ any <<= (sal_Bool)_val;\
+ _prop->setPropertyValue(OUString::createFromAscii(_nam), any);
+#define _propString(_prop,_nam,_val) \
+ any <<= OUString::createFromAscii(_val);\
+ _prop->setPropertyValue(OUString::createFromAscii(_nam), any);
+#define _propStringFromResId(_prop,_nam,_val) \
+ any <<= getResStr(_val);\
+ _prop->setPropertyValue(OUString::createFromAscii(_nam), any);
+#define _propGet(_prop,_nam) \
+ _prop->getPropertyValue(OUString::createFromAscii(_nam));
+#define _InstCtx(_path,_ctx)\
+ rServiceManager->createInstanceWithContext(\
+ OUString::createFromAscii(_path),_ctx);
+#define _Inst(_path)\
+ xMultiServiceFactory->createInstance(OUString::createFromAscii(_path) );
+#define _Insert(_cont,_nam,_obj) \
+ any <<= _obj;\
+ _cont->insertByName( OUString::createFromAscii(_nam), any );
+
+ Reference < XComponentContext > rComponentContext = defaultBootstrap_InitialComponentContext();
+ Reference < XMultiComponentFactory > rServiceManager = rComponentContext->getServiceManager();
+ Reference < XInterface > rInstance = _InstCtx("com.sun.star.awt.UnoControlDialogModel", rComponentContext );
+
+ Reference <XMultiServiceFactory> xMultiServiceFactory (rInstance,UNO_QUERY);
+
+ Reference < XPropertySet > xPSetDialog( rInstance, UNO_QUERY );
+ _propInt(xPSetDialog,"PositionX",100);
+ _propInt(xPSetDialog,"PositionY",100);
+ _propInt(xPSetDialog,"Width",130);
+ _propInt(xPSetDialog,"Height",90);
+ _propStringFromResId(xPSetDialog,"Title", T602FILTER_STR_IMPORT_DIALOG_TITLE);
+
+#define T602DLG_OK_BUTTON "ok_button"
+#define T602DLG_CANCEL_BUTTON "cancel_button"
+#define T602DLG_CODE_LB "code_lb"
+#define T602DLG_AZBUKA_CB "azbuka_cb"
+#define T602DLG_COMMENT_CB "comment_cb"
+#define T602DLG_REFORMAT_CB "reformat_cb"
+#define T602DLG_CODE_TXT "code_txt"
+
+ Reference < XInterface > TextModel = _Inst("com.sun.star.awt.UnoControlFixedTextModel");
+ Reference < XPropertySet > xPSetText( TextModel, UNO_QUERY );
+ _propInt(xPSetText,"PositionX",10);
+ _propInt(xPSetText,"PositionY",8);
+ _propInt(xPSetText,"Width",30);
+ _propInt(xPSetText,"Height",14);
+ _propString(xPSetText,"Name",T602DLG_CODE_TXT);
+ _propStringFromResId(xPSetText,"Label",T602FILTER_STR_ENCODING_LABEL);
+
+ Reference < XInterface > ListBoxModel = _Inst("com.sun.star.awt.UnoControlListBoxModel");
+ Reference < XPropertySet > xPSetCodeLB( ListBoxModel, UNO_QUERY );
+ _propInt(xPSetCodeLB,"PositionX",40);
+ _propInt(xPSetCodeLB,"PositionY",5);
+ _propInt(xPSetCodeLB,"Width",85);
+ _propInt(xPSetCodeLB,"Height",14);
+ _propString(xPSetCodeLB,"Name",T602DLG_CODE_LB);
+ _propShort(xPSetCodeLB,"TabIndex",1);
+ _propBool(xPSetCodeLB,"Dropdown",true);
+ _propBool(xPSetCodeLB,"MultiSelection",false);
+
+ Sequence< OUString > ous(4);
+ ous[0] = getResStr(T602FILTER_STR_ENCODING_AUTO);
+ ous[1] = getResStr(T602FILTER_STR_ENCODING_CP852);
+ ous[2] = getResStr(T602FILTER_STR_ENCODING_CP895);
+ ous[3] = getResStr(T602FILTER_STR_ENCODING_KOI8CS2);
+ any <<= ous;
+ xPSetCodeLB->setPropertyValue(OUString::createFromAscii("StringItemList"), any);
+
+ Sequence < sal_Int16 > shr(1);
+ shr[0] = ini.forcecode ? ((sal_Int16) ini.xcode) + 1 : 0;
+ any <<= shr;
+ xPSetCodeLB->setPropertyValue(OUString::createFromAscii("SelectedItems"), any);
+
+ Reference < XInterface > AzbCheckBoxModel = _Inst("com.sun.star.awt.UnoControlCheckBoxModel");
+ Reference < XPropertySet > xPSetAzbukaCB( AzbCheckBoxModel, UNO_QUERY );
+ _propInt(xPSetAzbukaCB,"PositionX",10);
+ _propInt(xPSetAzbukaCB,"PositionY",25);
+ _propInt(xPSetAzbukaCB,"Width",100);
+ _propInt(xPSetAzbukaCB,"Height",14);
+ _propString(xPSetAzbukaCB,"Name",T602DLG_AZBUKA_CB);
+ _propShort(xPSetAzbukaCB,"TabIndex",2);
+ _propStringFromResId(xPSetAzbukaCB,"Label",T602FILTER_STR_CYRILLIC_MODE);
+ _propShort(xPSetAzbukaCB,"State",ini.ruscode);
+
+ Reference < XInterface > RefCheckBoxModel = _Inst("com.sun.star.awt.UnoControlCheckBoxModel");
+ Reference < XPropertySet > xPSetRefCB( RefCheckBoxModel, UNO_QUERY );
+ _propInt(xPSetRefCB,"PositionX",10);
+ _propInt(xPSetRefCB,"PositionY",40);
+ _propInt(xPSetRefCB,"Width",100);
+ _propInt(xPSetRefCB,"Height",14);
+ _propString(xPSetRefCB,"Name",T602DLG_REFORMAT_CB);
+ _propShort(xPSetRefCB,"TabIndex",3);
+ _propStringFromResId(xPSetRefCB,"Label",T602FILTER_STR_REFORMAT_TEXT);
+ _propShort(xPSetRefCB,"State",ini.reformatpars);
+
+ Reference < XInterface > CommCheckBoxModel = _Inst("com.sun.star.awt.UnoControlCheckBoxModel");
+ Reference < XPropertySet > xPSetCommCB( CommCheckBoxModel, UNO_QUERY );
+ _propInt(xPSetCommCB,"PositionX",10);
+ _propInt(xPSetCommCB,"PositionY",55);
+ _propInt(xPSetCommCB,"Width",100);
+ _propInt(xPSetCommCB,"Height",14);
+ _propString(xPSetCommCB,"Name",T602DLG_COMMENT_CB);
+ _propShort(xPSetCommCB,"TabIndex",4);
+ _propStringFromResId(xPSetCommCB,"Label",T602FILTER_STR_DOT_COMMANDS);
+ _propShort(xPSetCommCB,"State",ini.showcomm);
+
+ Reference < XInterface > CancelButtonModel = _Inst("com.sun.star.awt.UnoControlButtonModel");
+ Reference < XPropertySet > xPSetCancelButton( CancelButtonModel, UNO_QUERY );
+ _propInt(xPSetCancelButton,"PositionX",10);
+ _propInt(xPSetCancelButton,"PositionY",70);
+ _propInt(xPSetCancelButton,"Width",50);
+ _propInt(xPSetCancelButton,"Height",14);
+ _propString(xPSetCancelButton,"Name",T602DLG_CANCEL_BUTTON);
+ _propShort(xPSetCancelButton,"TabIndex",5);
+ _propShort(xPSetCancelButton,"PushButtonType",2);
+ _propStringFromResId(xPSetCancelButton,"Label",T602FILTER_STR_CANCEL_BUTTON);
+
+ Reference < XInterface > OkButtonModel = _Inst("com.sun.star.awt.UnoControlButtonModel");
+ Reference < XPropertySet > xPSetOkButton( OkButtonModel, UNO_QUERY );
+ _propInt(xPSetOkButton,"PositionX",70);
+ _propInt(xPSetOkButton,"PositionY",70);
+ _propInt(xPSetOkButton,"Width",50);
+ _propInt(xPSetOkButton,"Height",14);
+ _propString(xPSetOkButton,"Name",T602DLG_OK_BUTTON);
+ _propShort(xPSetOkButton,"TabIndex",0);
+ _propShort(xPSetOkButton,"PushButtonType",1);
+ _propStringFromResId(xPSetOkButton,"Label",T602FILTER_STR_OK_BUTTON);
+ _propBool(xPSetOkButton,"DefaultButton",true);
+
+ Reference < XNameContainer > xNameCont (rInstance,UNO_QUERY);
+
+ _Insert(xNameCont, T602DLG_OK_BUTTON, OkButtonModel);
+ _Insert(xNameCont, T602DLG_CANCEL_BUTTON, CancelButtonModel);
+ _Insert(xNameCont, T602DLG_AZBUKA_CB, AzbCheckBoxModel);
+ _Insert(xNameCont, T602DLG_REFORMAT_CB, RefCheckBoxModel);
+ _Insert(xNameCont, T602DLG_COMMENT_CB, CommCheckBoxModel);
+ _Insert(xNameCont, T602DLG_CODE_LB, ListBoxModel);
+ _Insert(xNameCont, T602DLG_CODE_TXT, TextModel);
+
+ Reference< XInterface > dialog = _InstCtx("com.sun.star.awt.UnoControlDialog",rComponentContext);
+
+ Reference < XControl > xControl (dialog,UNO_QUERY);
+ Reference < XControlModel > xControlModel (rInstance,UNO_QUERY);
+
+ if(!xControl.is())
+ return sal_False;
+
+ xControl->setModel( xControlModel );
+
+ Reference< XInterface > toolkit = _InstCtx("com.sun.star.awt.ExtToolkit", rComponentContext);
+
+ Reference < XToolkit > xToolkit (toolkit,UNO_QUERY);
+ Reference < XWindow > xWindow (xControl,UNO_QUERY);
+
+ if(!xWindow.is())
+ return sal_False;
+
+ xWindow->setVisible( false );
+ xControl->createPeer( xToolkit, NULL );
+
+ Reference < XDialog > xDialog (dialog,UNO_QUERY);
+
+ if(!xDialog.is())
+ return sal_False;
+
+ ret = ( xDialog->execute() != 0 );
+ if ( ret ) {
+
+ sal_Int16 tt = 0;
+
+ any = _propGet(xPSetAzbukaCB, "State"); any >>= tt; ini.ruscode = tt;
+ any = _propGet(xPSetRefCB, "State"); any >>= tt; ini.reformatpars = tt;
+ any = _propGet(xPSetCommCB, "State"); any >>= tt; ini.showcomm = tt;
+
+ any = _propGet(xPSetCodeLB, "SelectedItems"); any >>= shr;
+
+ if( shr[0] > 0 ) {
+ ini.xcode = (tcode)(shr[0]-1);
+ ini.forcecode = true;
+ } else {
+ ini.forcecode = false;
+ }
+ }
+
+ Reference < XComponent > xComponent (dialog,UNO_QUERY);
+
+ xComponent->dispose();
+
+ return ret;
+}
+
+void T602ImportFilterDialog::initLocale()
+{
+ rtl::OString aModName( "t602filter" );
+ aModName += rtl::OString::valueOf( sal_Int32( SUPD ) );
+
+ mpResMgr = ResMgr::CreateResMgr( aModName.getStr(), meLocale );
+}
+
+ResMgr* T602ImportFilterDialog::getResMgr()
+{
+ if( !mpResMgr )
+ initLocale();
+ return mpResMgr;
+}
+
+void SAL_CALL T602ImportFilterDialog::setTitle( const ::rtl::OUString& )
+ throw (::com::sun::star::uno::RuntimeException)
+{
+}
+
+sal_Int16 SAL_CALL T602ImportFilterDialog::execute()
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ if (OptionsDlg())
+ return com::sun::star::ui::dialogs::ExecutableDialogResults::OK;
+ else
+ return com::sun::star::ui::dialogs::ExecutableDialogResults::CANCEL;
+}
+
+rtl::OUString T602ImportFilterDialog::getResStr( sal_Int16 resid )
+{
+ rtl::OUString sStr = String( ResId( resid, *getResMgr() ) );
+ return sStr;
+}
+
+uno::Sequence<beans::PropertyValue> SAL_CALL T602ImportFilterDialog::getPropertyValues() throw(uno::RuntimeException)
+{
+ return uno::Sequence<beans::PropertyValue>();
+}
+
+void SAL_CALL T602ImportFilterDialog::setPropertyValues( const uno::Sequence<beans::PropertyValue>& )
+ throw(beans::UnknownPropertyException, beans::PropertyVetoException,
+ lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+}
+
+
+// XServiceInfo
+OUString SAL_CALL T602ImportFilterDialog::getImplementationName( )
+ throw (RuntimeException)
+{
+ return T602ImportFilterDialog_getImplementationName();
+}
+
+sal_Bool SAL_CALL T602ImportFilterDialog::supportsService( const OUString& rServiceName )
+ throw (RuntimeException)
+{
+ return T602ImportFilterDialog_supportsService( rServiceName );
+}
+
+Sequence< OUString > SAL_CALL T602ImportFilterDialog::getSupportedServiceNames( )
+ throw (RuntimeException)
+{
+ return T602ImportFilterDialog_getSupportedServiceNames();
+}
+
+#define IMPLEMENTATION_NAME "com.sun.star.comp.Writer.T602ImportFilterDialog"
+
+OUString T602ImportFilterDialog_getImplementationName ()
+ throw (RuntimeException)
+{
+ return OUString ( RTL_CONSTASCII_USTRINGPARAM ( IMPLEMENTATION_NAME ) );
+}
+
+#define SERVICE_NAME "com.sun.star.ui.dialogs.FilterOptionsDialog"
+sal_Bool SAL_CALL T602ImportFilterDialog_supportsService( const OUString& ServiceName )
+ throw (RuntimeException)
+{
+ return ( ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SERVICE_NAME ) ) );
+}
+
+Sequence< OUString > SAL_CALL T602ImportFilterDialog_getSupportedServiceNames( )
+ throw (RuntimeException)
+{
+ Sequence < OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME ) );
+ return aRet;
+}
+#undef SERVICE_NAME
+
+Reference< XInterface > SAL_CALL T602ImportFilterDialog_createInstance( const Reference< XMultiServiceFactory > & rSMgr)
+ throw( Exception )
+{
+ return (cppu::OWeakObject*) new T602ImportFilterDialog( rSMgr );
+}
+
+}
+
diff --git a/filter/source/t602/t602filter.hrc b/filter/source/t602/t602filter.hrc
new file mode 100644
index 000000000000..5ddb1e158521
--- /dev/null
+++ b/filter/source/t602/t602filter.hrc
@@ -0,0 +1,45 @@
+ /*************************************************************************
+ *
+ * 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 T602FILTER_HRC
+#define T602FILTER_HRC
+
+#define T602FILTER_RES_START 1000
+
+#define T602FILTER_STR_IMPORT_DIALOG_TITLE (T602FILTER_RES_START)
+#define T602FILTER_STR_ENCODING_LABEL (T602FILTER_RES_START+1)
+#define T602FILTER_STR_ENCODING_AUTO (T602FILTER_RES_START+2)
+#define T602FILTER_STR_ENCODING_CP852 (T602FILTER_RES_START+3)
+#define T602FILTER_STR_ENCODING_CP895 (T602FILTER_RES_START+4)
+#define T602FILTER_STR_ENCODING_KOI8CS2 (T602FILTER_RES_START+5)
+#define T602FILTER_STR_CYRILLIC_MODE (T602FILTER_RES_START+6)
+#define T602FILTER_STR_REFORMAT_TEXT (T602FILTER_RES_START+7)
+#define T602FILTER_STR_DOT_COMMANDS (T602FILTER_RES_START+8)
+#define T602FILTER_STR_CANCEL_BUTTON (T602FILTER_RES_START+9)
+#define T602FILTER_STR_OK_BUTTON (T602FILTER_RES_START+10)
+
+#endif // T602FILTER_HRC
diff --git a/filter/source/t602/t602filter.hxx b/filter/source/t602/t602filter.hxx
new file mode 100644
index 000000000000..077787689bb2
--- /dev/null
+++ b/filter/source/t602/t602filter.hxx
@@ -0,0 +1,286 @@
+ /*************************************************************************
+ *
+ * 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 _T602FILTER_HXX
+#define _T602FILTER_HXX
+
+#include <com/sun/star/document/XFilter.hpp>
+#include <com/sun/star/document/XImporter.hpp>
+#include <com/sun/star/document/XExtendedFilterDetection.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XLocalizable.hpp>
+#include <com/sun/star/beans/XPropertyAccess.hpp>
+#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
+#include <cppuhelper/implbase5.hxx>
+#include <cppuhelper/implbase4.hxx>
+#include <xmloff/attrlist.hxx>
+#include <tools/resmgr.hxx>
+
+namespace T602ImportFilter {
+
+typedef enum {L2,KAM,KOI} tcode;
+
+typedef enum {
+ standard, // default
+ fat, // bold
+ cursive, // italic
+ bold, // wide
+ tall, // high
+ big, // big
+ lindex, // lower index
+ hindex, // upper index
+ err, // not set yet
+ chngul // change underline
+} fonts;
+
+typedef enum {START,READCH,EOL,POCMD,EXPCMD,SETCMD,SETCH,WRITE,EEND,QUIT} tnode;
+
+::rtl::OUString getImplementationName()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+::com::sun::star::uno::Sequence < ::rtl::OUString > getSupportedServiceNames()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+
+::com::sun::star::uno::Reference < ::com::sun::star::uno::XInterface > SAL_CALL
+ CreateInstance( const ::com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > &r)
+ throw ( ::com::sun::star::uno::Exception );
+
+
+//
+// class T602ImportFilter
+//
+
+struct inistruct
+{
+ bool showcomm; // true show comment lines
+ bool forcecode; // false the user has changed the encoding with something else than @CT
+ tcode xcode; // KAM encoding set - forced
+ bool ruscode; // false Russian tables turned on
+ bool reformatpars; // false Reformat paragraphs (whitespaces and line breaks)
+ sal_Int16 fontsize; // font size in points
+
+ inistruct()
+ : showcomm( true )
+ , forcecode( false )
+ , xcode ( KAM )
+ , ruscode ( false )
+ , reformatpars ( false )
+ , fontsize (10)
+ {
+ };
+};
+
+class T602ImportFilterDialog : public cppu::WeakImplHelper4 <
+ com::sun::star::ui::dialogs::XExecutableDialog,
+ com::sun::star::lang::XLocalizable,
+ com::sun::star::lang::XServiceInfo,
+ com::sun::star::beans::XPropertyAccess
+>
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF;
+ com::sun::star::lang::Locale meLocale;
+ ResMgr *mpResMgr;
+ sal_Bool OptionsDlg();
+ ResMgr* getResMgr();
+ rtl::OUString getResStr( sal_Int16 resid );
+ void initLocale();
+
+ ~T602ImportFilterDialog();
+
+ // XExecutableDialog
+ virtual void SAL_CALL setTitle( const ::rtl::OUString& aTitle )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL execute()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XLocalizable
+ virtual void SAL_CALL setLocale( const com::sun::star::lang::Locale& eLocale )
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual com::sun::star::lang::Locale SAL_CALL getLocale()
+ throw(::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XPropertyAccess
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >
+ SAL_CALL getPropertyValues() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue >& aProps )
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::beans::PropertyVetoException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+public:
+ T602ImportFilterDialog(const ::com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory > &r );
+
+};
+
+
+class T602ImportFilter : public cppu::WeakImplHelper5 <
+ com::sun::star::document::XFilter,
+ com::sun::star::document::XImporter,
+ com::sun::star::document::XExtendedFilterDetection,
+ com::sun::star::lang::XInitialization,
+ com::sun::star::lang::XServiceInfo
+>
+{
+private:
+// ::com::sun::star::uno::Reference<com::sun::star::io::XInputStream> xInputStream;
+ ::com::sun::star::uno::Reference<com::sun::star::xml::sax::XDocumentHandler> mxHandler;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > mxDoc;
+ ::com::sun::star::uno::Reference < ::com::sun::star::io::XInputStream > mxInputStream;
+ ::rtl::OUString msFilterName;
+
+ SvXMLAttributeList *mpAttrList;
+
+ tnode node; // START
+
+ struct {
+ sal_Int16 mt; // row for header
+ sal_Int16 mb; // row for footer
+ sal_Int16 tb; // tabs
+ sal_Int16 ct; // encoding (0-kamenik, 1-latin2, 2-koi8)
+ sal_Int16 pn; // from page number
+ sal_Int16 lh; // linespacing 3-2x, 4-1.5x, 6-1x
+ sal_Int16 lm; // left border
+ sal_Int16 rm; // right border
+ sal_Int16 pl; // page length
+ } format602;
+
+ // Initialisation constants - they are not changed during the conversion
+
+ inistruct ini;
+
+ // Font state - changes based on font
+
+ struct {
+ fonts nowfnt; // current font
+ fonts oldfnt; // previous font
+ bool uline; // underlined
+ bool olduline; // previous value of uline (font change)
+ } fst;
+
+ // Paragraph state
+
+ struct {
+ sal_Int16 pars; // the number of line endings times linespacing on the current page
+ bool comment; // in comments
+ sal_Int16 wasspace; // 0 there was a space - for reformatting
+ bool wasfdash; // 0 formatting dash
+ bool ccafterln; // false
+ bool willbeeop; // false
+ bool waspar; // false
+ } pst;
+
+ void Reset602();
+ unsigned char Readchar602();
+ void Read602();
+ void par602(bool endofpage);
+ void inschr(unsigned char ch);
+ void inschrdef(unsigned char ch);
+ unsigned char Setformat602(char *cmd);
+ sal_Int16 readnum(unsigned char *ch, bool show);
+ tnode PointCmd602(unsigned char *ch);
+ void setfnt(fonts fnt,bool mustwrite);
+ void wrtfnt();
+
+ sal_Bool SAL_CALL importImpl( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ public:
+ T602ImportFilter(const ::com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory > &r );
+ ~T602ImportFilter();
+
+ // XFilter
+ virtual sal_Bool SAL_CALL filter( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL cancel( )
+ throw (::com::sun::star::uno::RuntimeException) {};
+
+ // XImporter
+ virtual void SAL_CALL setTargetDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xDoc )
+ throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+
+ // XExtendedTypeDetection
+ virtual ::rtl::OUString SAL_CALL detect(
+ com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& Descriptor )
+ throw( com::sun::star::uno::RuntimeException );
+
+ // XInitialization
+ virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
+ throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( )
+ throw (::com::sun::star::uno::RuntimeException);
+};
+
+::rtl::OUString T602ImportFilter_getImplementationName()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+sal_Bool SAL_CALL T602ImportFilter_supportsService( const ::rtl::OUString& ServiceName )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL T602ImportFilter_getSupportedServiceNames( )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
+SAL_CALL T602ImportFilter_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr)
+ throw ( ::com::sun::star::uno::Exception );
+
+::rtl::OUString T602ImportFilterDialog_getImplementationName()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+sal_Bool SAL_CALL T602ImportFilterDialog_supportsService( const ::rtl::OUString& ServiceName )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL T602ImportFilterDialog_getSupportedServiceNames( )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
+SAL_CALL T602ImportFilterDialog_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr)
+ throw ( ::com::sun::star::uno::Exception );
+
+}
+
+#endif
diff --git a/filter/source/t602/t602filter.src b/filter/source/t602/t602filter.src
new file mode 100644
index 000000000000..1862bb2586c6
--- /dev/null
+++ b/filter/source/t602/t602filter.src
@@ -0,0 +1,83 @@
+ /*************************************************************************
+ *
+ * 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 "t602filter.hrc"
+
+String T602FILTER_STR_IMPORT_DIALOG_TITLE
+{
+ Text [ en-US ] = "Settings for T602 import";
+};
+
+String T602FILTER_STR_ENCODING_LABEL
+{
+ Text [ en-US ] = "Encoding";
+};
+
+String T602FILTER_STR_ENCODING_AUTO
+{
+ Text [ en-US ] = "Automatic";
+};
+
+String T602FILTER_STR_ENCODING_CP852
+{
+ Text [ en-US ] = "CP852 (Latin2)";
+};
+
+String T602FILTER_STR_ENCODING_CP895
+{
+ Text [ en-US ] = "CP895 (KEYB2CS, Kamenicky)";
+};
+
+String T602FILTER_STR_ENCODING_KOI8CS2
+{
+ Text [ en-US ] = "KOI8 CS2";
+};
+
+String T602FILTER_STR_CYRILLIC_MODE
+{
+ Text [ en-US ] = "Mode for Russian language (Cyrillic)";
+};
+
+String T602FILTER_STR_REFORMAT_TEXT
+{
+ Text [ en-US ] = "Reformat the text";
+};
+
+String T602FILTER_STR_DOT_COMMANDS
+{
+ Text [ en-US ] = "Display dot commands";
+};
+
+String T602FILTER_STR_CANCEL_BUTTON
+{
+ Text [ en-US ] = "Cancel";
+};
+
+String T602FILTER_STR_OK_BUTTON
+{
+ Text [ en-US ] = "OK";
+};
diff --git a/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx b/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx
new file mode 100644
index 000000000000..313c1e72dff5
--- /dev/null
+++ b/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx
@@ -0,0 +1,437 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+#include <iostream>
+#include <stdlib.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <rtl/ustring.hxx>
+#include <tools/urlobj.hxx>
+#include "XmlFilterAdaptor.hxx"
+#include <osl/diagnose.h>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <com/sun/star/io/XActiveDataSource.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <com/sun/star/xml/sax/InputSource.hpp>
+#include <com/sun/star/xml/sax/XParser.hpp>
+#include <com/sun/star/frame/XConfigManager.hpp>
+#include <com/sun/star/frame/XConfigManager.hpp>
+#include <com/sun/star/xml/XImportFilter.hpp>
+#include <com/sun/star/xml/XExportFilter.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/frame/XController.hpp>
+#include <com/sun/star/task/XStatusIndicator.hpp>
+#include <com/sun/star/task/XStatusIndicatorFactory.hpp>
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#include <com/sun/star/style/XStyleLoader.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <comphelper/sequenceashashmap.hxx>
+#include <comphelper/mediadescriptor.hxx>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <comphelper/genericpropertyset.hxx>
+#include <comphelper/propertysetinfo.hxx>
+
+using namespace rtl;
+using namespace comphelper;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::io;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::container;
+using namespace com::sun::star::document;
+using namespace com::sun::star::style;
+using namespace com::sun::star::xml;
+using namespace com::sun::star::xml::sax;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::task;
+
+#define MAP_LEN(x) x, sizeof(x) - 1
+
+Reference< com::sun::star::frame::XModel > xModel;
+
+sal_Bool SAL_CALL XmlFilterAdaptor::importImpl( const Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor )
+ throw (RuntimeException)
+{
+ OUString udConvertClass=msUserData[0];
+ OUString udImport =msUserData[2];
+ sal_Int32 nSteps= 0;
+ sal_Int32 nProgressRange = 4;
+
+ comphelper::MediaDescriptor aMediaMap(aDescriptor);
+ Reference< XStatusIndicator > xStatusIndicator(aMediaMap.getUnpackedValueOrDefault(
+ comphelper::MediaDescriptor::PROP_STATUSINDICATOR(), Reference< XStatusIndicator >()));
+
+ if (xStatusIndicator.is()){
+ xStatusIndicator->start(OUString( RTL_CONSTASCII_USTRINGPARAM( "Loading :" )),nProgressRange);
+ }
+
+ OUString sXMLImportService ( udImport );
+ const OUString sSaxParser ( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.sax.Parser") );
+ Reference < XParser > xSaxParser( mxMSF->createInstance( sSaxParser ), UNO_QUERY );
+
+ Sequence< Any > aAnys(1);
+ OUString aBaseURI;
+ if (aMediaMap.find(OUString::createFromAscii("URL"))->second >>= aBaseURI)
+ {
+ INetURLObject aURLObj(aBaseURI);
+ // base URI in this case is the URI of the actual saving location
+ // aURLObj.removeSegment();
+ aBaseURI = aURLObj.GetMainURL(INetURLObject::NO_DECODE);
+ }
+
+ // create an XProperty set to configure the exporter for pretty printing
+ PropertyMapEntry aImportInfoMap[] =
+ {
+ { MAP_LEN( "BaseURI" ), 0, &::getCppuType((const OUString*)0), PropertyAttribute::MAYBEVOID, 0},
+ { NULL, 0, 0, NULL, 0, 0 }
+ };
+
+ Reference< XPropertySet > xInfoSet(
+ GenericPropertySet_CreateInstance( new PropertySetInfo( aImportInfoMap ) ) );
+ xInfoSet->setPropertyValue(
+ OUString::createFromAscii( "BaseURI" ), makeAny( aBaseURI ));
+ aAnys[0] <<= xInfoSet;
+
+
+ Reference < XDocumentHandler > xHandler( mxMSF->createInstanceWithArguments( sXMLImportService, aAnys ), UNO_QUERY );
+ if(! xHandler.is()) {
+ OSL_ENSURE(sal_False, "XMLReader::Read: %s Unable to create service instance xHandler\n" );
+ return sal_False;
+ }
+ Reference < XImporter > xImporter( xHandler, UNO_QUERY );
+ xImporter->setTargetDocument ( mxDoc );
+
+ if (xStatusIndicator.is()){
+ xStatusIndicator->setValue(nSteps++);
+ }
+
+ //*********************
+ // Creating a ConverterBridge instance
+ //*********************
+ Reference< XInterface > xConvBridge(mxMSF->createInstance( udConvertClass ), UNO_QUERY);
+ if(! xConvBridge.is()){
+ OSL_ENSURE( sal_False,"XMLReader::Read: %s service missing\n" );
+ return sal_False;
+ }
+ if (xStatusIndicator.is())
+ xStatusIndicator->setValue(nSteps++);
+
+ Reference< XImportFilter > xConverter( xConvBridge, UNO_QUERY );
+
+ //********************
+ //Template Loading if Required
+ //********************
+ if (!msTemplateName.equalsAscii("")){
+ Reference< XStyleFamiliesSupplier > xstylefamiliessupplier(mxDoc, UNO_QUERY);
+
+ Reference< XNameAccess >xName;
+ if(xstylefamiliessupplier.is()){
+ xName=xstylefamiliessupplier->getStyleFamilies();
+ }
+ Reference< XStyleLoader > xstyleLoader (xstylefamiliessupplier->getStyleFamilies(), UNO_QUERY);
+
+
+ if(xstyleLoader.is()){
+ xName=xstylefamiliessupplier->getStyleFamilies();
+ }
+
+ Sequence < OUString > elementNames = xName->getElementNames();
+ if(xstyleLoader.is()){
+ Sequence<com::sun::star::beans::PropertyValue> pValue=xstyleLoader->getStyleLoaderOptions();
+
+ //Load the Styles from the Template URL Supplied in the TypeDetection file
+ if(msTemplateName.indexOf(OUString::createFromAscii("file:"))==-1)
+ {
+ Reference< XConfigManager >xCfgMgr ( mxMSF->createInstance(
+ OUString::createFromAscii("com.sun.star.config.SpecialConfigManager") ), UNO_QUERY );
+ OUString PathString=xCfgMgr->substituteVariables(OUString::createFromAscii("$(progurl)"));
+ PathString=PathString.concat(OUString::createFromAscii("/"));
+ msTemplateName=PathString.concat(msTemplateName);
+ }
+
+ xstyleLoader->loadStylesFromURL(msTemplateName,pValue);
+ }
+ }
+
+// sal_Bool xconv_ret = sal_True;
+
+ if (xStatusIndicator.is()){
+ xStatusIndicator->setValue(nSteps++);
+ }
+ //*********************
+ // Calling Filtering Component
+ //*********************
+ try {
+ if (!xConverter->importer(aDescriptor,xHandler,msUserData)) {
+ if (xStatusIndicator.is())
+ xStatusIndicator->end();
+ return sal_False;
+ }
+ }
+#if OSL_DEBUG_LEVEL > 0
+ catch( Exception& e )
+#else
+ catch( Exception& )
+#endif
+ {
+ if (xStatusIndicator.is())
+ xStatusIndicator->end();
+
+ OSL_ENSURE( sal_False, ::rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US).getStr());
+ return sal_False;
+ }
+ if (xStatusIndicator.is()) {
+ xStatusIndicator->setValue(nSteps++);
+ xStatusIndicator->end();
+ }
+ return sal_True;
+}
+
+sal_Bool SAL_CALL XmlFilterAdaptor::exportImpl( const Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor )
+ throw (RuntimeException)
+{
+
+ OUString udConvertClass = msUserData[0];
+ OUString udExport = msUserData[3];
+
+ // Status Bar
+ sal_Int32 nSteps= 1;
+ sal_Int32 nProgressRange(3);
+ comphelper::MediaDescriptor aMediaMap(aDescriptor);
+ Reference< XStatusIndicator > xStatusIndicator(aMediaMap.getUnpackedValueOrDefault(
+ comphelper::MediaDescriptor::PROP_STATUSINDICATOR(), Reference< XStatusIndicator >()));
+
+ if (xStatusIndicator.is())
+ xStatusIndicator->start(OUString( RTL_CONSTASCII_USTRINGPARAM( "Saving :" )),nProgressRange);
+
+ // Set up converter bridge.
+ Reference< com::sun::star::xml::XExportFilter > xConverter(mxMSF->createInstance(udConvertClass ), UNO_QUERY);
+ if(! xConverter.is()){
+ OSL_ENSURE( sal_False, "xml export sub service missing" );
+ return sal_False;
+ }
+
+ if (xStatusIndicator.is())
+ xStatusIndicator->setValue(nSteps++);
+
+ //put filter component into exporting state
+ if (!xConverter->exporter(aDescriptor, msUserData)) {
+ if (xStatusIndicator.is())
+ xStatusIndicator->end();
+ return sal_False;
+ }
+ if (xStatusIndicator.is())
+ xStatusIndicator->setValue(nSteps++);
+
+ try{
+ // create the xml exporter service and supply the converter component
+ // which implements the document handler
+ Sequence < Any > aAnys (2);
+ aAnys[0] <<= xConverter;
+
+
+ // pretty printing is confusing for some filters so it is disabled by default
+ sal_Bool bPrettyPrint =
+ (msUserData.getLength() > 6 && msUserData[6].equalsIgnoreAsciiCaseAscii("true"));
+
+ // --> OD 2008-11-25 #b6761284#
+ // export of <text:number> element for <text:list-item> elements are
+ // needed for certain filters.
+ sal_Bool bExportTextNumberElementForListItems =
+ ( msUserData.getLength() > 7 &&
+ msUserData[7].equalsIgnoreAsciiCaseAscii("true") );
+ // <--
+
+ // get the base URI, so we can use relative links
+ OUString aBaseURI;
+ if (aMediaMap.find(OUString::createFromAscii("URL"))->second >>= aBaseURI)
+ {
+ INetURLObject aURLObj(aBaseURI);
+ // base URI in this case is the URI of the actual saving location
+ // aURLObj.removeSegment();
+ aBaseURI = aURLObj.GetMainURL(INetURLObject::NO_DECODE);
+ }
+
+ // create an XProperty set to configure the exporter for pretty printing
+ PropertyMapEntry aImportInfoMap[] =
+ {
+ { MAP_LEN( "UsePrettyPrinting" ), 0, &::getCppuType((const sal_Bool*)0), PropertyAttribute::MAYBEVOID, 0},
+ // --> OD 2008-11-25 #b6761284#
+ { MAP_LEN( "ExportTextNumberElement" ), 0, &::getCppuType((const sal_Bool*)0), PropertyAttribute::MAYBEVOID, 0},
+ // <--
+ { MAP_LEN( "BaseURI" ), 0, &::getCppuType((const OUString*)0), PropertyAttribute::MAYBEVOID, 0},
+ { NULL, 0, 0, NULL, 0, 0 }
+ };
+
+ Reference< XPropertySet > xInfoSet(
+ GenericPropertySet_CreateInstance( new PropertySetInfo( aImportInfoMap ) ) );
+ xInfoSet->setPropertyValue(
+ OUString::createFromAscii( "UsePrettyPrinting" ), makeAny( bPrettyPrint ));
+ // --> OD 2008-11-25 #b6761284#
+ xInfoSet->setPropertyValue(
+ OUString::createFromAscii( "ExportTextNumberElement" ),
+ makeAny( bExportTextNumberElementForListItems ));
+ // <--
+ xInfoSet->setPropertyValue(
+ OUString::createFromAscii( "BaseURI" ), makeAny( aBaseURI ));
+ aAnys[1] <<= xInfoSet;
+
+ Reference< XExporter > xExporter( mxMSF->createInstanceWithArguments (
+ udExport, aAnys ), UNO_QUERY_THROW );
+
+ // attach to source document
+ xExporter->setSourceDocument( mxDoc );
+
+ // get XFilter interface
+ Reference< XFilter > xFilter( xExporter, UNO_QUERY_THROW );
+
+ if (xStatusIndicator.is())
+ xStatusIndicator->setValue(nSteps++);
+
+ // call the actual filtering component
+ if (!xFilter->filter(aDescriptor))
+ {
+ if (xStatusIndicator.is())
+ xStatusIndicator->end();
+ return sal_False;
+ }
+ }
+#if OSL_DEBUG_LEVEL > 0
+ catch( Exception& exE )
+#else
+ catch( Exception& )
+#endif
+ {
+ OSL_ENSURE( sal_False, ::rtl::OUStringToOString( exE.Message, RTL_TEXTENCODING_ASCII_US).getStr());
+ if (xStatusIndicator.is())
+ xStatusIndicator->end();
+ return sal_False;
+ }
+
+ // done
+ if (xStatusIndicator.is())
+ xStatusIndicator->end();
+ return sal_True;
+}
+
+sal_Bool SAL_CALL XmlFilterAdaptor::filter( const Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor )
+ throw (RuntimeException)
+{
+ return meType == FILTER_EXPORT ? exportImpl ( aDescriptor ) : importImpl ( aDescriptor );
+}
+void SAL_CALL XmlFilterAdaptor::cancel( )
+ throw (RuntimeException)
+{
+}
+// XExporter
+void SAL_CALL XmlFilterAdaptor::setSourceDocument( const Reference< ::com::sun::star::lang::XComponent >& xDoc )
+ throw (::com::sun::star::lang::IllegalArgumentException, RuntimeException)
+{
+ meType = FILTER_EXPORT;
+ mxDoc = xDoc;
+ com::sun::star::uno::Reference< com::sun::star::frame::XModel >rModel ( com::sun::star::uno::Reference< com::sun::star::frame::XModel >::query( xDoc ) );
+ xModel=rModel;
+
+}
+
+// XImporter
+void SAL_CALL XmlFilterAdaptor::setTargetDocument( const Reference< ::com::sun::star::lang::XComponent >& xDoc )
+ throw (::com::sun::star::lang::IllegalArgumentException, RuntimeException)
+{
+ meType = FILTER_IMPORT;
+ mxDoc = xDoc;
+ //xModel = uno::Reference< frame::XModel >::query( xDoc );
+}
+// XInitialization
+void SAL_CALL XmlFilterAdaptor::initialize( const Sequence< Any >& aArguments )
+ throw (Exception, RuntimeException)
+{
+ Sequence < PropertyValue > aAnySeq;
+ sal_Int32 nLength = aArguments.getLength();
+ if ( nLength && ( aArguments[0] >>= aAnySeq ) )
+ {
+ comphelper::SequenceAsHashMap aMap(aAnySeq);
+ msFilterName = aMap.getUnpackedValueOrDefault(
+ OUString::createFromAscii("Type"), OUString());
+ msUserData = aMap.getUnpackedValueOrDefault(
+ OUString::createFromAscii("UserData"), Sequence< OUString >());
+ msTemplateName = aMap.getUnpackedValueOrDefault(
+ OUString::createFromAscii("TemplateName"), OUString());
+ }
+}
+OUString XmlFilterAdaptor_getImplementationName ()
+ throw (RuntimeException)
+{
+ return OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Writer.XmlFilterAdaptor" ) );
+}
+#define SERVICE_NAME1 "com.sun.star.document.ExportFilter"
+#define SERVICE_NAME2 "com.sun.star.document.ImportFilter"
+sal_Bool SAL_CALL XmlFilterAdaptor_supportsService( const OUString& ServiceName )
+ throw (RuntimeException)
+{
+ return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SERVICE_NAME1 ) ) ||
+ ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SERVICE_NAME2 ) );
+}
+Sequence< OUString > SAL_CALL XmlFilterAdaptor_getSupportedServiceNames( )
+ throw (RuntimeException)
+{
+ Sequence < OUString > aRet(2);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME1 ) );
+ pArray[1] = OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME2 ) );
+ return aRet;
+}
+#undef SERVICE_NAME1
+#undef SERVICE_NAME2
+
+Reference< XInterface > SAL_CALL XmlFilterAdaptor_createInstance( const Reference< XMultiServiceFactory > & rSMgr)
+ throw( Exception )
+{
+ return (cppu::OWeakObject*) new XmlFilterAdaptor( rSMgr );
+}
+
+// XServiceInfo
+OUString SAL_CALL XmlFilterAdaptor::getImplementationName( )
+ throw (RuntimeException)
+{
+ return XmlFilterAdaptor_getImplementationName();
+}
+sal_Bool SAL_CALL XmlFilterAdaptor::supportsService( const OUString& rServiceName )
+ throw (RuntimeException)
+{
+ return XmlFilterAdaptor_supportsService( rServiceName );
+}
+Sequence< OUString > SAL_CALL XmlFilterAdaptor::getSupportedServiceNames( )
+ throw (RuntimeException)
+{
+ return XmlFilterAdaptor_getSupportedServiceNames();
+}
diff --git a/filter/source/xmlfilteradaptor/XmlFilterAdaptor.hxx b/filter/source/xmlfilteradaptor/XmlFilterAdaptor.hxx
new file mode 100644
index 000000000000..e949f7aa8982
--- /dev/null
+++ b/filter/source/xmlfilteradaptor/XmlFilterAdaptor.hxx
@@ -0,0 +1,184 @@
+/*************************************************************************
+ *
+ * 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 _XMLFILTERADAPTOR_HXX
+#define _XMLFILTERADAPTOR_HXX
+
+
+#include <com/sun/star/document/XFilter.hpp>
+#include <com/sun/star/document/XExporter.hpp>
+#include <com/sun/star/document/XImporter.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <cppuhelper/implbase5.hxx>
+
+
+
+enum FilterType
+{
+ FILTER_IMPORT,
+ FILTER_EXPORT
+};
+
+/* This component will be instantiated for both import or export. Whether it calls
+ * setSourceDocument or setTargetDocument determines which Impl function the filter
+ * member calls */
+
+class XmlFilterAdaptor : public cppu::WeakImplHelper5
+
+<
+
+ com::sun::star::document::XFilter,
+
+ com::sun::star::document::XExporter,
+
+ com::sun::star::document::XImporter,
+
+ com::sun::star::lang::XInitialization,
+
+ com::sun::star::lang::XServiceInfo
+
+>
+
+{
+
+protected:
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > mxDoc;
+
+ ::rtl::OUString msFilterName;
+
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > msUserData;
+
+ ::rtl::OUString msTemplateName;
+
+ FilterType meType;
+
+ sal_Bool SAL_CALL exportImpl( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor )
+
+ throw (::com::sun::star::uno::RuntimeException);
+
+ sal_Bool SAL_CALL importImpl( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor )
+
+ throw (::com::sun::star::uno::RuntimeException);
+
+
+
+public:
+
+ XmlFilterAdaptor( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > &rxMSF)
+
+ : mxMSF( rxMSF ) {}
+
+ virtual ~XmlFilterAdaptor() {}
+
+
+
+ // XFilter
+
+ virtual sal_Bool SAL_CALL filter( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor )
+
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL cancel( )
+
+ throw (::com::sun::star::uno::RuntimeException);
+
+
+
+ // XExporter
+
+ virtual void SAL_CALL setSourceDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xDoc )
+
+ throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+
+
+
+ // XImporter
+
+ virtual void SAL_CALL setTargetDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xDoc )
+
+ throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+
+
+
+ // XInitialization
+
+ virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
+
+ throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+
+
+
+ // XServiceInfo
+
+ virtual ::rtl::OUString SAL_CALL getImplementationName( )
+
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
+
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( )
+
+ throw (::com::sun::star::uno::RuntimeException);
+
+};
+
+
+
+::rtl::OUString XmlFilterAdaptor_getImplementationName()
+
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+
+
+sal_Bool SAL_CALL XmlFilterAdaptor_supportsService( const ::rtl::OUString& ServiceName )
+
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+
+
+::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL XmlFilterAdaptor_getSupportedServiceNames( )
+
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+
+
+::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
+
+SAL_CALL XmlFilterAdaptor_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr)
+
+ throw ( ::com::sun::star::uno::Exception );
+
+
+
+#endif
+
diff --git a/filter/source/xmlfilteradaptor/genericfilter.cxx b/filter/source/xmlfilteradaptor/genericfilter.cxx
new file mode 100644
index 000000000000..f91c7e4f296c
--- /dev/null
+++ b/filter/source/xmlfilteradaptor/genericfilter.cxx
@@ -0,0 +1,180 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include <stdio.h>
+
+
+
+#include <osl/mutex.hxx>
+
+#include <osl/thread.h>
+
+#include <cppuhelper/factory.hxx>
+
+
+
+#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_
+
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+
+#endif
+
+
+
+#include "XmlFilterAdaptor.hxx"
+
+
+
+using namespace ::rtl;
+
+using namespace ::cppu;
+
+using namespace ::com::sun::star::uno;
+
+using namespace ::com::sun::star::lang;
+
+using namespace ::com::sun::star::registry;
+
+
+
+extern "C"
+
+{
+
+//==================================================================================================
+
+void SAL_CALL component_getImplementationEnvironment(
+
+ const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */ )
+
+{
+
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+
+}
+
+//==================================================================================================
+
+sal_Bool SAL_CALL component_writeInfo(
+
+ void * /* pServiceManager */, void * pRegistryKey )
+
+{
+
+ if (pRegistryKey)
+
+ {
+
+ try
+
+ {
+
+ Reference< XRegistryKey > xNewKey(
+
+ reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( XmlFilterAdaptor_getImplementationName() ) );
+
+ xNewKey = xNewKey->createKey( OUString::createFromAscii( "/UNO/SERVICES" ) );
+
+
+
+ const Sequence< OUString > & rSNL = XmlFilterAdaptor_getSupportedServiceNames();
+
+ const OUString * pArray = rSNL.getConstArray();
+
+ for ( sal_Int32 nPos = rSNL.getLength(); nPos--; )
+
+ xNewKey->createKey( pArray[nPos] );
+
+
+
+ return sal_True;
+
+ }
+
+ catch (InvalidRegistryException &)
+
+ {
+
+ OSL_ENSURE( sal_False, "### InvalidRegistryException!" );
+
+ }
+
+ }
+
+ return sal_False;
+
+}
+
+//==================================================================================================
+
+void * SAL_CALL component_getFactory(
+
+ const sal_Char * pImplName, void * pServiceManager, void * /* pRegistryKey */ )
+
+{
+
+ void * pRet = 0;
+
+
+
+ OUString implName = OUString::createFromAscii( pImplName );
+
+ if ( pServiceManager && implName.equals(XmlFilterAdaptor_getImplementationName()) )
+
+ {
+
+ Reference< XSingleServiceFactory > xFactory( createSingleFactory(
+
+ reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
+
+ OUString::createFromAscii( pImplName ),
+
+ XmlFilterAdaptor_createInstance, XmlFilterAdaptor_getSupportedServiceNames() ) );
+
+
+
+ if (xFactory.is())
+
+ {
+
+ xFactory->acquire();
+
+ pRet = xFactory.get();
+
+ }
+
+ }
+
+ return pRet;
+
+}
+
+}
+
diff --git a/filter/source/xmlfilteradaptor/makefile.mk b/filter/source/xmlfilteradaptor/makefile.mk
new file mode 100644
index 000000000000..b3d39f860388
--- /dev/null
+++ b/filter/source/xmlfilteradaptor/makefile.mk
@@ -0,0 +1,62 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+PRJ=..$/..
+
+PRJNAME= filter
+TARGET= fl_xmlfilteradaptor
+
+ENABLE_EXCEPTIONS= TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- defines ------------------------------------------------------
+
+CDEFS+=-DCOMPMOD_NAMESPACE=framework
+
+# --- Targets ------------------------------------------------------
+
+SHL1TARGET= xmlfa$(DLLPOSTFIX)
+SHL1IMPLIB= i$(SHL1TARGET)
+
+SHL1VERSIONMAP= $(SOLARENV)/src/component.map
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+DEF1NAME= $(SHL1TARGET)
+
+SHL1OBJS= $(SLO)$/genericfilter.obj \
+ $(SLO)$/XmlFilterAdaptor.obj \
+ $(SLO)$/streamwrap.obj
+
+SHL1STDLIBS= $(COMPHELPERLIB) \
+ $(CPPUHELPERLIB) \
+ $(CPPULIB) \
+ $(TOOLSLIB) \
+ $(SALLIB)
+
+.INCLUDE : target.mk
+
diff --git a/filter/source/xmlfilteradaptor/streamwrap.cxx b/filter/source/xmlfilteradaptor/streamwrap.cxx
new file mode 100755
index 000000000000..42d2a6774057
--- /dev/null
+++ b/filter/source/xmlfilteradaptor/streamwrap.cxx
@@ -0,0 +1,70 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#ifndef _OSL_STREAM_WRAPPER_HXX_
+#include "streamwrap.hxx"
+#endif
+#include <osl/file.hxx>
+
+namespace foo
+{
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::io;
+using namespace ::com::sun::star::lang;
+using namespace ::osl;
+
+//==================================================================
+//= OOutputStreamWrapper
+//==================================================================
+//------------------------------------------------------------------------------
+void SAL_CALL OOutputStreamWrapper::writeBytes(const staruno::Sequence< sal_Int8 >& aData) throw( stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException )
+{
+ sal_uInt64 nWritten = 0;
+ rStream.write(aData.getConstArray(),aData.getLength(),nWritten);
+ if (nWritten != (sal_uInt64)aData.getLength())
+ {
+ throw stario::BufferSizeExceededException(::rtl::OUString(),static_cast<staruno::XWeak*>(this));
+ }
+}
+
+//------------------------------------------------------------------
+void SAL_CALL OOutputStreamWrapper::flush() throw( stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException )
+{
+}
+
+//------------------------------------------------------------------
+void SAL_CALL OOutputStreamWrapper::closeOutput() throw( stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException )
+{
+}
+
+} // namespace utl
+
+
diff --git a/filter/source/xmlfilteradaptor/streamwrap.hxx b/filter/source/xmlfilteradaptor/streamwrap.hxx
new file mode 100755
index 000000000000..dd87dbd13492
--- /dev/null
+++ b/filter/source/xmlfilteradaptor/streamwrap.hxx
@@ -0,0 +1,78 @@
+/*************************************************************************
+ *
+ * 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 _OSL_FILE_WRAPPER_HXX_
+#define _OSL_FILE_WRAPPER_HXX_
+
+#include <osl/mutex.hxx>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/io/XSeekable.hpp>
+#include <cppuhelper/implbase1.hxx>
+
+#define DECLARE_UNO3_AGG_DEFAULTS(classname, baseclass) \
+virtual void SAL_CALL acquire() throw() { baseclass::acquire(); } \
+virtual void SAL_CALL release() throw() { baseclass::release(); } \
+virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(const ::com::sun::star::uno::Type& _rType) throw (::com::sun::star::uno::RuntimeException) \
+{ return baseclass::queryInterface(_rType); } \
+void SAL_CALL PUT_SEMICOLON_AT_THE_END()
+
+namespace osl
+{
+ class File;
+}
+
+namespace foo
+{
+ namespace stario = ::com::sun::star::io;
+ namespace staruno = ::com::sun::star::uno;
+
+//==================================================================
+//= OOutputStreamWrapper
+//==================================================================
+typedef ::cppu::WeakImplHelper1<stario::XOutputStream> OutputStreamWrapper_Base;
+ // needed for some compilers
+class OOutputStreamWrapper : public OutputStreamWrapper_Base
+{
+ ::osl::File& rStream;
+
+public:
+ OOutputStreamWrapper(::osl::File& _rStream) :rStream(_rStream) { }
+
+// UNO Anbindung
+ DECLARE_UNO3_AGG_DEFAULTS(OOutputStreamWrapper, OutputStreamWrapper_Base);
+
+// stario::XOutputStream
+ virtual void SAL_CALL writeBytes(const staruno::Sequence< sal_Int8 >& aData) throw(stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException);
+ virtual void SAL_CALL flush() throw(stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException);
+ virtual void SAL_CALL closeOutput() throw(stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException);
+};
+
+} // namespace utl
+
+
+#endif // _UTL_STREAM_WRAPPER_HXX_
+
diff --git a/filter/source/xmlfilterdetect/fdcomp.cxx b/filter/source/xmlfilterdetect/fdcomp.cxx
new file mode 100644
index 000000000000..10820fc8f280
--- /dev/null
+++ b/filter/source/xmlfilterdetect/fdcomp.cxx
@@ -0,0 +1,180 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include <stdio.h>
+
+
+
+#include <osl/mutex.hxx>
+
+#include <osl/thread.h>
+
+#include <cppuhelper/factory.hxx>
+
+
+
+#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_
+
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+
+#endif
+
+
+
+#include "filterdetect.hxx"
+
+
+
+using namespace ::rtl;
+
+using namespace ::cppu;
+
+using namespace ::com::sun::star::uno;
+
+using namespace ::com::sun::star::lang;
+
+using namespace ::com::sun::star::registry;
+
+
+
+extern "C"
+
+{
+
+//==================================================================================================
+
+void SAL_CALL component_getImplementationEnvironment(
+
+ const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */ )
+
+{
+
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+
+}
+
+//==================================================================================================
+
+sal_Bool SAL_CALL component_writeInfo(
+
+ void * /* pServiceManager */, void * pRegistryKey )
+
+{
+
+ if (pRegistryKey)
+
+ {
+
+ try
+
+ {
+
+ Reference< XRegistryKey > xNewKey(
+
+ reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( FilterDetect_getImplementationName() ) );
+
+ xNewKey = xNewKey->createKey( OUString::createFromAscii( "/UNO/SERVICES" ) );
+
+
+
+ const Sequence< OUString > & rSNL = FilterDetect_getSupportedServiceNames();
+
+ const OUString * pArray = rSNL.getConstArray();
+
+ for ( sal_Int32 nPos = rSNL.getLength(); nPos--; )
+
+ xNewKey->createKey( pArray[nPos] );
+
+
+
+ return sal_True;
+
+ }
+
+ catch (InvalidRegistryException &)
+
+ {
+
+ OSL_ENSURE( sal_False, "### InvalidRegistryException!" );
+
+ }
+
+ }
+
+ return sal_False;
+
+}
+
+//==================================================================================================
+
+void * SAL_CALL component_getFactory(
+
+ const sal_Char * pImplName, void * pServiceManager, void * /* pRegistryKey */ )
+
+{
+
+ void * pRet = 0;
+
+
+
+ OUString implName = OUString::createFromAscii( pImplName );
+
+ if ( pServiceManager && implName.equals(FilterDetect_getImplementationName()) )
+
+ {
+
+ Reference< XSingleServiceFactory > xFactory( createSingleFactory(
+
+ reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
+
+ OUString::createFromAscii( pImplName ),
+
+ FilterDetect_createInstance, FilterDetect_getSupportedServiceNames() ) );
+
+
+
+ if (xFactory.is())
+
+ {
+
+ xFactory->acquire();
+
+ pRet = xFactory.get();
+
+ }
+
+ }
+
+ return pRet;
+
+}
+
+}
+
diff --git a/filter/source/xmlfilterdetect/filterdetect.cxx b/filter/source/xmlfilterdetect/filterdetect.cxx
new file mode 100644
index 000000000000..2509bc88f9af
--- /dev/null
+++ b/filter/source/xmlfilterdetect/filterdetect.cxx
@@ -0,0 +1,309 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+#include <iostream>
+#include <stdlib.h>
+#include <ctype.h>
+#include <stdio.h>
+#include "filterdetect.hxx"
+#include <osl/diagnose.h>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/io/XActiveDataSource.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <com/sun/star/xml/sax/InputSource.hpp>
+#include <com/sun/star/xml/sax/XParser.hpp>
+#include <com/sun/star/xml/XImportFilter.hpp>
+#include <com/sun/star/xml/XExportFilter.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/frame/XController.hpp>
+#include <com/sun/star/task/XStatusIndicator.hpp>
+#include <com/sun/star/task/XStatusIndicatorFactory.hpp>
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#include <com/sun/star/style/XStyleLoader.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/document/XExtendedFilterDetection.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/beans/PropertyState.hpp>
+
+#include <ucbhelper/content.hxx>
+#include <ucbhelper/contentbroker.hxx>
+#include <ucbhelper/commandenvironment.hxx>
+#include <unotools/ucbhelper.hxx>
+#include <com/sun/star/ucb/XCommandEnvironment.hpp>
+
+
+
+using rtl::OUString;
+using com::sun::star::uno::Sequence;
+using com::sun::star::uno::Reference;
+using com::sun::star::uno::Any;
+using com::sun::star::uno::UNO_QUERY;
+using com::sun::star::uno::XInterface;
+using com::sun::star::uno::Exception;
+using com::sun::star::uno::RuntimeException;
+using com::sun::star::lang::XMultiServiceFactory;
+using com::sun::star::io::XActiveDataSource;
+using com::sun::star::io::XOutputStream;
+using com::sun::star::beans::PropertyValue;
+using com::sun::star::document::XExporter;
+using com::sun::star::document::XFilter;
+using com::sun::star::document::XExtendedFilterDetection;
+
+using com::sun::star::io::XInputStream;
+using com::sun::star::document::XImporter;
+using com::sun::star::xml::sax::InputSource;
+using com::sun::star::xml::sax::XDocumentHandler;
+using com::sun::star::xml::sax::XParser;
+using com::sun::star::task::XInteractionHandler;
+
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star;
+using namespace com::sun::star::container;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::beans;
+
+
+Reference< com::sun::star::frame::XModel > xModel;
+
+::rtl::OUString SAL_CALL supportedByType( const ::rtl::OUString clipBoardFormat , const ::rtl::OString resultString, const ::rtl::OUString checkType);
+
+
+::rtl::OUString SAL_CALL FilterDetect::detect( com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& aArguments ) throw( com::sun::star::uno::RuntimeException )
+{
+ ::rtl::OUString sTypeName = OUString::createFromAscii("");
+ ::rtl::OUString sUrl = OUString::createFromAscii("");
+ ::rtl::OUString originalTypeName;
+ Sequence<PropertyValue > lProps ;
+
+ com::sun::star::uno::Reference< com::sun::star::io::XInputStream > xInStream;
+ ::rtl::OUString temp;
+ //OSL_ENSURE( sal_False, " starting Detect" );
+ const PropertyValue * pValue = aArguments.getConstArray();
+ sal_Int32 nLength;
+ ::rtl::OString resultString;
+
+ nLength = aArguments.getLength();
+ sal_Int32 location=nLength;
+ for ( sal_Int32 i = 0 ; i < nLength; i++)
+ {
+ //OSL_ENSURE( sal_False, ::rtl::OUStringToOString(pValue[i].Name,RTL_TEXTENCODING_ASCII_US).getStr() );
+ if ( pValue[i].Name.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "TypeName" ) ) )
+ {
+ //pValue[i].Value >>= originalTypeName;
+ location=i;
+ // OSL_ENSURE( sal_False, ::rtl::OUStringToOString(sTypeName,RTL_TEXTENCODING_ASCII_US).getStr() );
+
+ }
+ else if ( pValue[i].Name.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "URL" ) ) )
+ {
+
+ pValue[i].Value >>= sUrl;
+ //OSL_ENSURE( sal_False, ::rtl::OUStringToOString(sUrl,RTL_TEXTENCODING_ASCII_US).getStr() );
+
+ }
+ else if ( pValue[i].Name.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "InputStream" ) ) )
+ {
+ pValue[i].Value >>= xInStream ;
+ }
+
+
+ }
+ try{
+ Reference< com::sun::star::ucb::XCommandEnvironment > xEnv;
+ if (!xInStream.is())
+ {
+ ::ucbhelper::Content aContent(sUrl,xEnv);
+ xInStream = aContent.openStream();
+ if (!xInStream.is())
+ {
+ return sTypeName;
+ }
+ }
+ com::sun::star::uno::Sequence< sal_Int8 > aData;
+ /* long nBytesToRead= */ xInStream->available();
+ xInStream->skipBytes (0);
+ long bytestRead =xInStream->readBytes (aData, 4000);
+ resultString=::rtl::OString((const sal_Char *)aData.getConstArray(),bytestRead) ;
+
+
+ // test typedetect code
+ Reference <XNameAccess> xTypeCont(mxMSF->createInstance(OUString::createFromAscii("com.sun.star.document.TypeDetection")),UNO_QUERY);
+ Sequence < ::rtl::OUString > myTypes= xTypeCont->getElementNames();
+ nLength = myTypes.getLength();
+
+
+ sal_Int32 new_nlength=0;
+ sal_Int32 i = 0 ;
+ while( (i < nLength) && (sTypeName.equalsAscii("")))
+ {
+
+ Any elem = xTypeCont->getByName(myTypes[i]);
+ elem >>=lProps;
+ new_nlength = lProps.getLength();
+ sal_Int32 j =0;
+ while( j < new_nlength && sTypeName.equalsAscii(""))
+ {
+ ::rtl::OUString tmpStr =OUString::createFromAscii("");
+ lProps[j].Value >>=tmpStr;
+ if((lProps[j].Name.equalsAscii("ClipboardFormat")) && (!tmpStr.equalsAscii("")) )
+ {
+ sTypeName = supportedByType(tmpStr,resultString, myTypes[i]);
+ }
+ j++;
+ }
+ i++;
+ }
+ //end test
+
+ }
+ catch(Exception &)
+ {
+ OSL_ENSURE( sal_False, "An Exception occured while opening File stream" );
+ }
+ if(sTypeName.equalsAscii(""))
+ {
+ //sTypeName=::rtl::OUString::createFromAscii("writer_Flat_XML_File");
+ }
+ else
+ {
+ if ( location == aArguments.getLength() )
+ {
+ aArguments.realloc(nLength+1);
+ aArguments[location].Name = ::rtl::OUString::createFromAscii( "TypeName" );
+ }
+ aArguments[location].Value <<=sTypeName;
+ }
+ // OSL_ENSURE( sal_False, ::rtl::OUStringToOString(sTypeName,RTL_TEXTENCODING_ASCII_US).getStr() );
+
+
+ return sTypeName;
+}
+
+
+
+::rtl::OUString SAL_CALL supportedByType( const ::rtl::OUString clipBoardFormat , const ::rtl::OString resultString, const ::rtl::OUString checkType)
+{
+
+ ::rtl::OUString sTypeName= OUString::createFromAscii("");
+ if((clipBoardFormat.match(OUString::createFromAscii("doctype:"))))
+ {
+ ::rtl::OString tryStr = ::rtl::OUStringToOString(clipBoardFormat.copy(8),RTL_TEXTENCODING_ASCII_US).getStr();
+ // OSL_ENSURE( sal_False, tryStr);
+ if (resultString.indexOf(tryStr) >= 0)
+ {
+ sTypeName = checkType;
+ }
+ }
+ return sTypeName;
+}
+
+// XInitialization
+
+void SAL_CALL FilterDetect::initialize( const Sequence< Any >& aArguments )
+ throw (Exception, RuntimeException)
+{
+ Sequence < PropertyValue > aAnySeq;
+ sal_Int32 nLength = aArguments.getLength();
+ if ( nLength && ( aArguments[0] >>= aAnySeq ) )
+ {
+ const PropertyValue * pValue = aAnySeq.getConstArray();
+ nLength = aAnySeq.getLength();
+ for ( sal_Int32 i = 0 ; i < nLength; i++)
+ {
+
+ if ( pValue[i].Name.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "Type" ) ) )
+ {
+ pValue[i].Value >>= msFilterName;
+
+ }
+ else if ( pValue[i].Name.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "UserData" ) ) )
+ {
+
+ pValue[i].Value >>= msUserData;
+
+ }
+ else if ( pValue[i].Name.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "TemplateName" ) ) )
+ {
+
+ pValue[i].Value>>=msTemplateName;
+ }
+
+ }
+ }
+}
+
+
+
+OUString FilterDetect_getImplementationName ()
+ throw (RuntimeException)
+{
+ return OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.filters.XMLFilterDetect" ) );
+}
+#define SERVICE_NAME1 "com.sun.star.document.ExtendedTypeDetection"
+
+sal_Bool SAL_CALL FilterDetect_supportsService( const OUString& ServiceName )
+ throw (RuntimeException)
+{
+ return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SERVICE_NAME1 ) );
+}
+Sequence< OUString > SAL_CALL FilterDetect_getSupportedServiceNames( )
+ throw (RuntimeException)
+{
+ Sequence < OUString > aRet(2);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME1 ) );
+ return aRet;
+}
+#undef SERVICE_NAME1
+#undef SERVICE_NAME2
+
+Reference< XInterface > SAL_CALL FilterDetect_createInstance( const Reference< XMultiServiceFactory > & rSMgr)
+ throw( Exception )
+{
+ return (cppu::OWeakObject*) new FilterDetect( rSMgr );
+}
+
+// XServiceInfo
+OUString SAL_CALL FilterDetect::getImplementationName( )
+ throw (RuntimeException)
+{
+ return FilterDetect_getImplementationName();
+}
+sal_Bool SAL_CALL FilterDetect::supportsService( const OUString& rServiceName )
+ throw (RuntimeException)
+{
+ return FilterDetect_supportsService( rServiceName );
+}
+Sequence< OUString > SAL_CALL FilterDetect::getSupportedServiceNames( )
+ throw (RuntimeException)
+{
+ return FilterDetect_getSupportedServiceNames();
+}
diff --git a/filter/source/xmlfilterdetect/filterdetect.hxx b/filter/source/xmlfilterdetect/filterdetect.hxx
new file mode 100644
index 000000000000..965e2ceaa1d7
--- /dev/null
+++ b/filter/source/xmlfilterdetect/filterdetect.hxx
@@ -0,0 +1,168 @@
+/*************************************************************************
+ *
+ * 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 _FILTERDETECT_HXX
+#define _FILTERDETECT_HXX
+
+
+#include <com/sun/star/document/XFilter.hpp>
+#include <com/sun/star/document/XExporter.hpp>
+#include <com/sun/star/document/XExtendedFilterDetection.hpp>
+#include <com/sun/star/document/XImporter.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <cppuhelper/implbase5.hxx>
+
+#ifndef _CPPUHELPER_IMPLBASE4_HXX_
+#include <cppuhelper/implbase3.hxx>
+#endif
+
+
+
+enum FilterType
+{
+ FILTER_IMPORT,
+ FILTER_EXPORT
+};
+
+/* This component will be instantiated for both import or export. Whether it calls
+ * setSourceDocument or setTargetDocument determines which Impl function the filter
+ * member calls */
+
+class FilterDetect : public cppu::WeakImplHelper3
+
+<
+
+
+ com::sun::star::document::XExtendedFilterDetection,
+
+ com::sun::star::lang::XInitialization,
+
+ com::sun::star::lang::XServiceInfo
+
+>
+
+{
+
+protected:
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > mxDoc;
+
+ ::rtl::OUString msFilterName;
+
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > msUserData;
+
+ ::rtl::OUString msTemplateName;
+
+
+
+ sal_Bool SAL_CALL exportImpl( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor )
+
+ throw (::com::sun::star::uno::RuntimeException);
+
+ sal_Bool SAL_CALL importImpl( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor )
+
+ throw (::com::sun::star::uno::RuntimeException);
+
+
+
+
+
+public:
+
+ FilterDetect( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > &rxMSF)
+
+ : mxMSF( rxMSF ) {}
+
+ virtual ~FilterDetect() {}
+
+
+
+
+
+
+ //XExtendedFilterDetection
+ virtual ::rtl::OUString SAL_CALL detect( com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& lDescriptor )
+ throw( com::sun::star::uno::RuntimeException );
+
+
+ // XInitialization
+
+ virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
+
+ throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+
+
+
+ // XServiceInfo
+
+ virtual ::rtl::OUString SAL_CALL getImplementationName( )
+
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
+
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( )
+
+ throw (::com::sun::star::uno::RuntimeException);
+
+};
+
+
+
+::rtl::OUString FilterDetect_getImplementationName()
+
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+
+
+sal_Bool SAL_CALL FilterDetect_supportsService( const ::rtl::OUString& ServiceName )
+
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+
+
+::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL FilterDetect_getSupportedServiceNames( )
+
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+
+
+::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
+
+SAL_CALL FilterDetect_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr)
+
+ throw ( ::com::sun::star::uno::Exception );
+
+
+
+#endif
+
diff --git a/filter/source/xmlfilterdetect/makefile.mk b/filter/source/xmlfilterdetect/makefile.mk
new file mode 100644
index 000000000000..d13c4af5f576
--- /dev/null
+++ b/filter/source/xmlfilterdetect/makefile.mk
@@ -0,0 +1,60 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+PRJ=..$/..
+
+PRJNAME= filter
+TARGET= fl_xmlfilterdetect
+
+NO_BSYMBOLIC= TRUE
+ENABLE_EXCEPTIONS= TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- defines ------------------------------------------------------
+
+CDEFS+=-DCOMPMOD_NAMESPACE=framework
+
+# --- Targets ------------------------------------------------------
+
+SHL1TARGET= xmlfd$(DLLPOSTFIX)
+SHL1IMPLIB= i$(SHL1TARGET)
+
+SHL1VERSIONMAP= $(SOLARENV)/src/component.map
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+DEF1NAME= $(SHL1TARGET)
+
+SHL1OBJS= $(SLO)$/fdcomp.obj \
+ $(SLO)$/filterdetect.obj
+
+SHL1STDLIBS= $(UCBHELPERLIB) \
+ $(CPPUHELPERLIB) \
+ $(CPPULIB) \
+ $(SALLIB)
+
+.INCLUDE : target.mk
diff --git a/filter/source/xslt/common/copy.xsl b/filter/source/xslt/common/copy.xsl
new file mode 100644
index 000000000000..a608e2cc6925
--- /dev/null
+++ b/filter/source/xslt/common/copy.xsl
@@ -0,0 +1,9 @@
+<?xml version='1.0' encoding="UTF-8"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+ <xsl:output method="xml" encoding="UTF-8"/>
+
+ <xsl:template match="/">
+ <xsl:copy-of select="."/>
+ </xsl:template>
+</xsl:stylesheet>
+
diff --git a/filter/source/xslt/common/math.xsl b/filter/source/xslt/common/math.xsl
new file mode 100644
index 000000000000..2b6ce0c89ccf
--- /dev/null
+++ b/filter/source/xslt/common/math.xsl
@@ -0,0 +1,589 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+ -->
+<!--
+ xslt math lib by Wind Li
+Public Functions
+ sin(x,rounding-factor=100)
+ cos(x,rounding-factor=100)
+ tan(x,rounding-factor=100)
+ ctan(x,rounding-factor=100)
+ atan2(x, y ,rounding-factor=100)
+ atan(x,rounding-factor=100)
+ acos(x,rounding-factor=100)
+ asin(x,rounding-factor=100)
+ abs(x)
+ max(x1,x2)
+ min(x1,x2)
+ power(x,power(interger only), rounding-factor=100)
+ sqrt(x, rounding-factor=100)
+ convert2radian(x,rounding-factor=100)
+ convert2degree(x,rounding-factor=100)
+ convert2fd(x,rounding-factor=100)
+ -->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:draw="http://openoffice.org/2000/drawing" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:text="http://openoffice.org/2000/text" xmlns:style="http://openoffice.org/2000/style" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:office="http://openoffice.org/2000/office" exclude-result-prefixes="draw svg style office fo text">
+ <xsl:variable name="pi" select="3.1416"/>
+ <xsl:template name="math-test">
+ sin(34.8)
+ <xsl:call-template name="sin">
+ <xsl:with-param name="x" select="34.8"/>
+ <xsl:with-param name="rounding-factor" select="100000"/>
+ </xsl:call-template>
+ cos(34.8)
+ <xsl:call-template name="cos">
+ <xsl:with-param name="x" select="34.8"/>
+ <xsl:with-param name="rounding-factor" select="100000"/>
+ </xsl:call-template>
+ atan(2.74)
+ <xsl:call-template name="atan">
+ <xsl:with-param name="x" select="2.74"/>
+ <xsl:with-param name="rounding-factor" select="100000"/>
+ </xsl:call-template>
+ acos(0.5)
+ <xsl:call-template name="acos">
+ <xsl:with-param name="x" select="0.5"/>
+ <xsl:with-param name="rounding-factor" select="100000"/>
+ </xsl:call-template>
+ asin(0.5)
+ <xsl:call-template name="asin">
+ <xsl:with-param name="x" select="0.5"/>
+ <xsl:with-param name="rounding-factor" select="100000"/>
+ </xsl:call-template>
+ sqrt(1328.3414)
+ <xsl:call-template name="sqrt">
+ <xsl:with-param name="x" select="1328.3414"/>
+ <xsl:with-param name="rounding-factor" select="100000"/>
+ </xsl:call-template>
+ </xsl:template>
+ <!-- public functions start -->
+ <xsl:template name="sin">
+ <xsl:param name="x" select="0"/>
+ <xsl:param name="rounding-factor" select="100"/>
+ <xsl:variable name="angle" select="$x * 180 div $pi "/>
+ <xsl:variable name="mod-angle" select="$angle mod 360"/>
+ <xsl:variable name="sinx">
+ <xsl:call-template name="sin-private">
+ <xsl:with-param name="x" select=" ( $angle mod 360 ) * $pi div 180 "/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select=" round ( number($sinx) * $rounding-factor ) div $rounding-factor"/>
+ </xsl:template>
+ <xsl:template name="cos">
+ <xsl:param name="x" select="0"/>
+ <xsl:param name="rounding-factor" select="100"/>
+ <xsl:variable name="angle" select="$x * 180 div $pi "/>
+ <xsl:variable name="mod-angle" select="$angle mod 360"/>
+ <xsl:variable name="cosx">
+ <xsl:call-template name="cos-private">
+ <xsl:with-param name="x" select=" ( $angle mod 360 ) * $pi div 180 "/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select=" round ( number($cosx) * $rounding-factor ) div $rounding-factor"/>
+ </xsl:template>
+ <xsl:template name="tan">
+ <xsl:param name="x" select="0"/>
+ <xsl:param name="rounding-factor" select="100"/>
+ <xsl:variable name="sinx">
+ <xsl:call-template name="sin">
+ <xsl:with-param name="x" select="$x"/>
+ <xsl:with-param name="rounding-factor" select="$rounding-factor * 10"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="cosx">
+ <xsl:call-template name="cos">
+ <xsl:with-param name="x" select="$x"/>
+ <xsl:with-param name="rounding-factor" select="$rounding-factor * 10"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test=" $cosx = 0 ">
+ <xsl:message>tan error : tan(<xsl:value-of select="$x"/>) is infinite!</xsl:message>
+ <xsl:value-of select="63535"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select=" round( $sinx div $cosx * $rounding-factor) div $rounding-factor"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="ctan">
+ <xsl:param name="x" select="0"/>
+ <xsl:param name="rounding-factor" select="100"/>
+ <xsl:variable name="sinx">
+ <xsl:call-template name="sin">
+ <xsl:with-param name="x" select="$x"/>
+ <xsl:with-param name="rounding-factor" select="$rounding-factor * 10"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="cosx">
+ <xsl:call-template name="cos">
+ <xsl:with-param name="x" select="$x"/>
+ <xsl:with-param name="rounding-factor" select="$rounding-factor * 10"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test=" $sinx = 0 ">
+ <xsl:message>tan error : tan(<xsl:value-of select="$x"/>) is infinite!</xsl:message>
+ <xsl:value-of select="63535"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select=" round( $cosx div $sinx * $rounding-factor) div $rounding-factor"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="atan">
+ <xsl:param name="x" select="0"/>
+ <xsl:param name="rounding-factor" select="100"/>
+ <xsl:choose>
+ <xsl:when test="$x = 0">
+ <xsl:value-of select="0"/>
+ </xsl:when>
+ <xsl:when test="$x &lt; 0">
+ <xsl:variable name="atan-x">
+ <xsl:call-template name="atan">
+ <xsl:with-param name="x" select=" -1 * $x"/>
+ <xsl:with-param name="rounding-factor" select="$rounding-factor"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="-1 * $atan-x"/>
+ </xsl:when>
+ <xsl:when test="$x &gt; 1">
+ <xsl:variable name="atan-div-x">
+ <xsl:call-template name="atan">
+ <xsl:with-param name="x" select="1 div $x "/>
+ <xsl:with-param name="rounding-factor" select="$rounding-factor"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select=" $pi div 2 - $atan-div-x"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="arctanx">
+ <xsl:call-template name="atan-private">
+ <xsl:with-param name="x" select=" $x "/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select=" round ( number($arctanx) * $rounding-factor ) div $rounding-factor"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="atan2">
+ <xsl:param name="x"/>
+ <xsl:param name="y"/>
+ <xsl:param name="rounding-factor" select="100"/>
+ <xsl:choose>
+ <xsl:when test="$x = 0">
+ <xsl:value-of select=" $pi div 2"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="atan">
+ <xsl:with-param name="x" select="$y div $x"/>
+ <xsl:with-param name="rounding-factor" select="$rounding-factor"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="acos">
+ <xsl:param name="x"/>
+ <xsl:param name="rounding-factor" select="100"/>
+ <xsl:variable name="abs-x">
+ <xsl:call-template name="abs">
+ <xsl:with-param name="x" select="$x"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$abs-x &gt; 1">
+ <xsl:message>acos error : abs(<xsl:value-of select="$x"/>) greate then 1 !</xsl:message>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="atan2">
+ <xsl:with-param name="x" select="$x"/>
+ <xsl:with-param name="y">
+ <xsl:call-template name="sqrt">
+ <xsl:with-param name="x" select="1 - $x * $x"/>
+ <xsl:with-param name="rounding-factor" select=" concat($rounding-factor,'0') "/>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="asin">
+ <xsl:param name="x"/>
+ <xsl:param name="rounding-factor" select="100"/>
+ <xsl:variable name="abs-x">
+ <xsl:call-template name="abs">
+ <xsl:with-param name="x" select="$x"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$abs-x &gt; 1">
+ <xsl:message>asin error : abs(<xsl:value-of select="$x"/>) greate then 1 !</xsl:message>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="atan2">
+ <xsl:with-param name="y" select="$x"/>
+ <xsl:with-param name="x">
+ <xsl:call-template name="sqrt">
+ <xsl:with-param name="x" select="1 - $x * $x"/>
+ <xsl:with-param name="rounding-factor" select=" concat($rounding-factor,'0') "/>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="abs">
+ <xsl:param name="x"/>
+ <xsl:choose>
+ <xsl:when test="$x &gt; 0">
+ <xsl:value-of select="$x"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$x * -1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="max">
+ <xsl:param name="x1"/>
+ <xsl:param name="x2"/>
+ <xsl:choose>
+ <xsl:when test="$x1 &gt; $x2">
+ <xsl:value-of select="$x1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$x2"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="min">
+ <xsl:param name="x1"/>
+ <xsl:param name="x2"/>
+ <xsl:choose>
+ <xsl:when test="$x1 &lt; $x2">
+ <xsl:value-of select="$x1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$x2"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="power">
+ <xsl:param name="x"/>
+ <xsl:param name="y" select="1"/>
+ <xsl:param name="rounding-factor" select="100"/>
+ <!-- z is a private param -->
+ <xsl:param name="z" select="1"/>
+ <xsl:choose>
+ <xsl:when test="$y &gt; 0">
+ <xsl:call-template name="power">
+ <xsl:with-param name="x" select="$x"/>
+ <xsl:with-param name="y" select="$y - 1"/>
+ <xsl:with-param name="z" select="$z * $x"/>
+ <xsl:with-param name="rounding-factor" select="$rounding-factor"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select=" round( $z * $rounding-factor) div $rounding-factor"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="sqrt">
+ <xsl:param name="x"/>
+ <xsl:param name="rounding-factor" select="100"/>
+ <xsl:choose>
+ <xsl:when test="$x = 0">0</xsl:when>
+ <xsl:when test="$x &lt; 0">
+ <xsl:message>sqrt error : <xsl:value-of select="$x"/> less then 0!</xsl:message>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="sqrt-private">
+ <xsl:with-param name="x" select="$x"/>
+ <xsl:with-param name="rounding-factor" select="$rounding-factor"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- public functions end -->
+ <!--
+Private functions:
+sin-private
+cos-private
+atan-private
+sqrt-private
+integer-sqrt
+Sqrt-GetOneDigit
+-->
+ <xsl:template name="sin-private">
+ <xsl:param name="x" select="0"/>
+ <xsl:param name="n" select="0"/>
+ <xsl:param name="nx" select="1"/>
+ <xsl:param name="sign" select="1"/>
+ <xsl:param name="max-n" select="20"/>
+ <xsl:param name="sinx" select="0"/>
+ <xsl:choose>
+ <xsl:when test="not ($max-n &gt; $n) or $nx = 0 ">
+ <xsl:value-of select="$sinx"/>
+ </xsl:when>
+ <xsl:when test="$n = 0">
+ <xsl:call-template name="sin-private">
+ <xsl:with-param name="x" select="$x"/>
+ <xsl:with-param name="n" select="$n + 1"/>
+ <xsl:with-param name="sign" select="$sign * -1"/>
+ <xsl:with-param name="max-n" select="$max-n"/>
+ <xsl:with-param name="nx" select="$x "/>
+ <xsl:with-param name="sinx" select="$sinx + $x"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="new-nx" select="($nx * $x * $x) div ( 2 * $n ) div ( 2 * $n + 1) "/>
+ <xsl:call-template name="sin-private">
+ <xsl:with-param name="x" select="$x"/>
+ <xsl:with-param name="n" select="$n + 1"/>
+ <xsl:with-param name="sign" select="$sign * -1"/>
+ <xsl:with-param name="max-n" select="$max-n"/>
+ <xsl:with-param name="nx" select=" $new-nx "/>
+ <xsl:with-param name="sinx" select="$sinx + $new-nx * $sign"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="cos-private">
+ <xsl:param name="x" select="0"/>
+ <xsl:param name="n" select="0"/>
+ <xsl:param name="nx" select="1"/>
+ <xsl:param name="sign" select="1"/>
+ <xsl:param name="max-n" select="20"/>
+ <xsl:param name="cosx" select="0"/>
+ <xsl:choose>
+ <xsl:when test="not ($max-n &gt; $n) or $nx = 0 ">
+ <xsl:value-of select="$cosx"/>
+ </xsl:when>
+ <xsl:when test="$n = 0">
+ <xsl:call-template name="cos-private">
+ <xsl:with-param name="x" select="$x"/>
+ <xsl:with-param name="n" select="$n + 1"/>
+ <xsl:with-param name="sign" select="$sign * -1"/>
+ <xsl:with-param name="max-n" select="$max-n"/>
+ <xsl:with-param name="nx" select=" 1 "/>
+ <xsl:with-param name="cosx" select="1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="new-nx" select="($nx * $x * $x) div ( 2 * $n -1 ) div ( 2 * $n ) "/>
+ <xsl:call-template name="cos-private">
+ <xsl:with-param name="x" select="$x"/>
+ <xsl:with-param name="n" select="$n + 1"/>
+ <xsl:with-param name="sign" select="$sign * -1"/>
+ <xsl:with-param name="max-n" select="$max-n"/>
+ <xsl:with-param name="nx" select=" $new-nx "/>
+ <xsl:with-param name="cosx" select="$cosx + $new-nx * $sign"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="atan-private">
+ <xsl:param name="x" select="0"/>
+ <xsl:param name="n" select="0"/>
+ <xsl:param name="nx" select="1"/>
+ <xsl:param name="sign" select="1"/>
+ <xsl:param name="max-n" select="40"/>
+ <xsl:param name="arctanx" select="0"/>
+ <xsl:choose>
+ <xsl:when test="not ($max-n &gt; $n) or $nx = 0 ">
+ <xsl:value-of select="$arctanx"/>
+ </xsl:when>
+ <xsl:when test="$n = 0">
+ <xsl:call-template name="atan-private">
+ <xsl:with-param name="x" select="$x"/>
+ <xsl:with-param name="n" select="$n + 1"/>
+ <xsl:with-param name="sign" select="$sign * -1"/>
+ <xsl:with-param name="max-n" select="$max-n"/>
+ <xsl:with-param name="nx" select="$x "/>
+ <xsl:with-param name="arctanx" select="$arctanx + $x"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="new-nx" select=" $nx * $x * $x "/>
+ <xsl:call-template name="atan-private">
+ <xsl:with-param name="x" select="$x"/>
+ <xsl:with-param name="n" select="$n + 1"/>
+ <xsl:with-param name="sign" select="$sign * -1"/>
+ <xsl:with-param name="max-n" select="$max-n"/>
+ <xsl:with-param name="nx" select=" $new-nx "/>
+ <xsl:with-param name="arctanx" select="$arctanx + $new-nx div (2 * $n +1) * $sign"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="sqrt-private">
+ <xsl:param name="x"/>
+ <xsl:param name="rounding-factor" select="100"/>
+ <xsl:variable name="shift" select="string-length( $rounding-factor)"/>
+ <xsl:variable name="power">
+ <xsl:call-template name="power">
+ <xsl:with-param name="x" select="100"/>
+ <xsl:with-param name="y" select="$shift"/>
+ <xsl:with-param name="rounding-factor" select="1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="integer-x" select=" round( $power * $x )"/>
+ <xsl:variable name="integer-quotient">
+ <xsl:call-template name="integer-sqrt">
+ <xsl:with-param name="x" select="$integer-x"/>
+ <xsl:with-param name="length" select=" string-length( $integer-x ) "/>
+ <xsl:with-param name="curr-pos" select=" 2 - (round (string-length( $integer-x ) div 2 ) * 2 - string-length( $integer-x ) ) "/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="power-10">
+ <xsl:call-template name="power">
+ <xsl:with-param name="x" select="10"/>
+ <xsl:with-param name="y" select="$shift - 1"/>
+ <xsl:with-param name="rounding-factor" select="1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select=" round( $integer-quotient div 10) div $power-10 "/>
+ </xsl:template>
+ <xsl:template name="integer-sqrt">
+ <xsl:param name="x"/>
+ <xsl:param name="length"/>
+ <xsl:param name="curr-pos"/>
+ <xsl:param name="last-quotient" select="0"/>
+ <xsl:choose>
+ <xsl:when test="$curr-pos &gt; $length">
+ <xsl:value-of select="$last-quotient"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="curr-x" select="substring( $x, 1, $curr-pos )"/>
+ <xsl:variable name="new-quotient">
+ <xsl:call-template name="get-one-sqrt-digit">
+ <xsl:with-param name="x" select="$curr-x"/>
+ <xsl:with-param name="last-quotient" select="$last-quotient"/>
+ <xsl:with-param name="n" select="5"/>
+ <xsl:with-param name="direct" select="0"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="integer-sqrt">
+ <xsl:with-param name="x" select="$x"/>
+ <xsl:with-param name="length" select="$length"/>
+ <xsl:with-param name="curr-pos" select="$curr-pos + 2"/>
+ <xsl:with-param name="last-quotient" select="number($new-quotient)"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-one-sqrt-digit">
+ <xsl:param name="x"/>
+ <xsl:param name="last-quotient"/>
+ <xsl:param name="n"/>
+ <xsl:param name="direct" select="1"/>
+ <xsl:variable name="quotient" select=" concat( $last-quotient, $n) "/>
+ <xsl:variable name="accumulate" select="$quotient * $quotient "/>
+ <xsl:choose>
+ <xsl:when test="$accumulate = $x">
+ <xsl:value-of select="concat($last-quotient , $n )"/>
+ </xsl:when>
+ <xsl:when test="$direct = 0 and $accumulate &lt; $x">
+ <xsl:call-template name="get-one-sqrt-digit">
+ <xsl:with-param name="x" select="$x"/>
+ <xsl:with-param name="last-quotient" select="$last-quotient"/>
+ <xsl:with-param name="n" select="$n + 1"/>
+ <xsl:with-param name="direct" select="1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$direct = 0 and $accumulate &gt; $x">
+ <xsl:call-template name="get-one-sqrt-digit">
+ <xsl:with-param name="x" select="$x"/>
+ <xsl:with-param name="last-quotient" select="$last-quotient"/>
+ <xsl:with-param name="n" select="$n - 1"/>
+ <xsl:with-param name="direct" select="-1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test=" $accumulate * $direct &lt; $x * $direct ">
+ <xsl:call-template name="get-one-sqrt-digit">
+ <xsl:with-param name="x" select="$x"/>
+ <xsl:with-param name="last-quotient" select="$last-quotient"/>
+ <xsl:with-param name="n" select="$n+ $direct"/>
+ <xsl:with-param name="direct" select="$direct"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="not($n &lt; 9) or $n = -1">
+ <xsl:value-of select="concat($last-quotient , $n - $direct) "/>
+ </xsl:when>
+ <xsl:when test="$direct = 1">
+ <xsl:value-of select="concat($last-quotient , $n - 1) "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat($last-quotient , $n) "/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="convert2redian">
+ <xsl:param name="x" select="'0'"/>
+ <xsl:param name="rounding-factor" select="100"/>
+ <xsl:choose>
+ <xsl:when test="contains($x,'deg')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($x, 'deg') div 180 * $pi)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($x,'fd')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($x, 'fd') div 180 div 65536 * $pi)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="round($rounding-factor * number($x) div 180 * $pi) div $rounding-factor"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="convert2degree">
+ <xsl:param name="x" select="'0'"/>
+ <xsl:param name="rounding-factor" select="100"/>
+ <xsl:choose>
+ <xsl:when test="contains($x,'deg')">
+ <xsl:value-of select="round($rounding-factor * substring-before($x,'deg')) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($x,'fd')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($x, 'fd')) div 65536 ) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="round($rounding-factor * number($x) * 180 div $pi) div $rounding-factor"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="convert2fd">
+ <xsl:param name="x" select="'0'"/>
+ <xsl:param name="rounding-factor" select="100"/>
+ <xsl:choose>
+ <xsl:when test="contains($x,'deg')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($x, 'deg') * 65535)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($x,'fd')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($x, 'fd'))) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="round($rounding-factor * number($x) * 180 div $pi * 65535) div $rounding-factor"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/filter/source/xslt/common/measure_conversion.xsl b/filter/source/xslt/common/measure_conversion.xsl
new file mode 100644
index 000000000000..4533013a5a06
--- /dev/null
+++ b/filter/source/xslt/common/measure_conversion.xsl
@@ -0,0 +1,387 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<!--
+ For further documentation and updates visit http://xml.openoffice.org/odf2xhtml
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+ <!-- DPI (dots per inch) the standard resolution of given pictures (necessary for the conversion of 'cm' into 'pixel')
+ Although many pictures have a 96 dpi resolution, a higher resoltion give better results for common browsers -->
+ <xsl:param name="dpi" select="111"/>
+ <xsl:param name="centimeter-in-mm" select="10"/>
+ <xsl:param name="inch-in-mm" select="25.4"/>
+ <xsl:param name="didot-point-in-mm" select="0.376065"/>
+ <xsl:param name="pica-in-mm" select="4.2333333"/>
+ <xsl:param name="point-in-mm" select="0.3527778"/>
+ <xsl:param name="twip-in-mm" select="0.017636684"/>
+ <xsl:param name="pixel-in-mm" select="$inch-in-mm div $dpi"/>
+ <!-- ***** MEASUREMENT CONVERSIONS *****
+ PARAM 'value'
+ The measure to be converted.
+ The current measure is judged by a substring (e.g. 'mm', 'cm', 'in', 'pica'...)
+ directly added to the number.
+
+ PARAM 'rounding-factor'
+ Is used for the rounding of decimal places.
+ The parameter number is the product of 1 and some '10', where
+ every zero represents a decimal place.
+
+ For example, providing as parameter:
+ <xsl:param name="rounding-factor" select="10000" />
+ Gives by default four decimal places.
+
+ To round two decimal places, basically the following is done:
+ <xsl:value-of select="round(100 * value) div 100"/>
+
+ RETURN The converted number, by default rounded to four decimal places.
+ In case the input measure could not be matched the same value is
+ returned and a warning message is written out.
+
+
+
+ MEASURE LIST:
+ * 1 milimeter (mm), the basic measure
+
+ * 1 centimeter (cm) = 10 mm
+
+ * 1 inch (in) = 25.4 mm
+ While the English have already seen the light (read: the metric system), the US
+ remains loyal to this medieval system.
+
+ * 1 point (pt) = 0.35277777.. mm
+ Sometimes called PostScript point (ppt), as when Adobe created PostScript, they added their own system of points.
+ There are exactly 72 PostScript points in 1 inch.
+
+ * 1 twip = twentieth of a (PostScript) point
+ A twip (twentieth of a point) is a 1/20th of a PostScript point, a traditional measure in printing.
+
+ * 1 didot point (dpt) = 0.376065 mm
+ Didot point after the French typographer Firmin Didot (1764-1836).
+
+ More details under
+ http://www.unc.edu/~rowlett/units/dictP.html:
+ "A unit of length used by typographers and printers. When printing was done
+ from hand-set metal type, one point represented the smallest element of type
+ that could be handled, roughly 1/64 inch. Eventually, the point was standardized
+ in Britain and America as exactly 1/72.27 = 0.013 837 inch, which is
+ about 0.35 mm (351.46 micrometers). In continental Europe, typographers
+ traditionally used a slightly larger point of 0.014 83 inch (about
+ 1/72 pouce, 0.377 mm, or roughly 1/67 English inch), called a Didot point
+ after the French typographer Firmin Didot (1764-1836). In the U.S.,
+ Adobe software defines the point to be exactly 1/72 inch (0.013 888 9 inch
+ or 0.352 777 8 millimeters) and TeX software uses a slightly smaller point
+ of 0.351 459 8035 mm. The German standards agency DIN has proposed that
+ all these units be replaced by multiples of 0.25 millimeters (1/101.6 inch).
+
+ * 1 pica = 4.233333 mm
+ 1/6 inch or 12 points
+
+ * 1 pixel (px) = 0.26458333.. mm (relative to 'DPI', here: 96 dpi)
+ Most pictures have the 96 dpi resolution, but the dpi variable may vary by stylesheet parameter
+
+
+ -->
+ <!-- changing measure to mm -->
+ <xsl:template name="convert2mm">
+ <xsl:param name="value"/>
+ <xsl:param name="rounding-factor" select="10000"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="substring-before($value, 'mm')"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'cm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm' ) * $centimeter-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in' ) * $inch-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') * $point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') * $twip-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') * $didot-point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') * $pica-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') * $pixel-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'mm'!</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- changing measure to cm -->
+ <xsl:template name="convert2cm">
+ <xsl:param name="value"/>
+ <xsl:param name="rounding-factor" select="10000"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $centimeter-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'cm')">
+ <xsl:value-of select="substring-before($value, 'cm')"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $centimeter-in-mm * $inch-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $centimeter-in-mm * $point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $centimeter-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $centimeter-in-mm * $pica-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $centimeter-in-mm * $twip-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $centimeter-in-mm * $pixel-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'cm'!</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- changing measure to inch (cp. section comment) -->
+ <xsl:template name="convert2in">
+ <xsl:param name="value"/>
+ <xsl:param name="rounding-factor" select="10000"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $inch-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'cm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $inch-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="substring-before($value, 'in')"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $inch-in-mm * $point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $inch-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $inch-in-mm * $pica-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $inch-in-mm * $twip-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $inch-in-mm * $pixel-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'in'!</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- changing measure to dpt (cp. section comment) -->
+ <xsl:template name="convert2dpt">
+ <xsl:param name="value"/>
+ <xsl:param name="rounding-factor" select="10000"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $didot-point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'cm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $didot-point-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $didot-point-in-mm * $inch-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $didot-point-in-mm * $point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="substring-before($value, 'dpt')"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $didot-point-in-mm * $pica-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $didot-point-in-mm * $twip-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $didot-point-in-mm * $pixel-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'dpt'!</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- changing measure to pica (cp. section comment) -->
+ <xsl:template name="convert2pica">
+ <xsl:param name="value"/>
+ <xsl:param name="rounding-factor" select="10000"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $pica-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'cm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $pica-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $pica-in-mm * $inch-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $pica-in-mm * $point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $pica-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="substring-before($value, 'pica')"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $pica-in-mm * $twip-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $pica-in-mm * $pixel-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'pica'!</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- changing measure to pt (cp. section comment) -->
+ <xsl:template name="convert2pt">
+ <xsl:param name="value"/>
+ <xsl:param name="rounding-factor" select="10000"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'cm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $point-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $point-in-mm * $inch-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="substring-before($value, 'pt')"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $point-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $point-in-mm * $pica-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $point-in-mm * $twip-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $point-in-mm * $pixel-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'pt'!</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- changing measure to twip (cp. section comment) -->
+ <xsl:template name="convert2twip">
+ <xsl:param name="value"/>
+ <xsl:param name="rounding-factor" select="10000"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $twip-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'cm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $twip-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $twip-in-mm * $inch-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $twip-in-mm * $point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $twip-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $twip-in-mm * $pica-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="substring-before($value, 'twip')"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $twip-in-mm * $pixel-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'twip'!</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- changing measure to pixel by via parameter provided dpi (dots per inch) standard factor (cp. section comment) -->
+ <xsl:template name="convert2px">
+ <xsl:param name="value"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="round(number(substring-before($value, 'mm')) div $pixel-in-mm)"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'cm')">
+ <xsl:value-of select="round(number(substring-before($value, 'cm')) div $pixel-in-mm * $centimeter-in-mm)"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="round(number(substring-before($value, 'in')) div $pixel-in-mm * $inch-in-mm)"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="round(number(substring-before($value, 'pt')) div $pixel-in-mm * $point-in-mm)"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="round(number(substring-before($value, 'dpt')) div $pixel-in-mm * $didot-point-in-mm)"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="round(number(substring-before($value, 'pica')) div $pixel-in-mm * $pica-in-mm)"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="round(number(substring-before($value, 'twip')) div $pixel-in-mm * $twip-in-mm)"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="$value"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'px'!</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/filter/source/xslt/export/common/ooo2ms_docpr.xsl b/filter/source/xslt/export/common/ooo2ms_docpr.xsl
new file mode 100644
index 000000000000..cdf5ed9e8f32
--- /dev/null
+++ b/filter/source/xslt/export/common/ooo2ms_docpr.xsl
@@ -0,0 +1,137 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw">
+ <xsl:template match="office:meta">
+ <o:DocumentProperties>
+ <o:Title>
+ <xsl:value-of select="dc:title"/>
+ </o:Title>
+ <o:Subject>
+ <xsl:value-of select="dc:subject"/>
+ </o:Subject>
+ <o:Keywords>
+ <xsl:for-each select="meta:keywords/meta:keyword">
+ <xsl:value-of select="."/>
+ <xsl:if test="position()!=last()">, </xsl:if>
+ </xsl:for-each>
+ </o:Keywords>
+ <o:Description>
+ <xsl:value-of select="dc:description"/>
+ </o:Description>
+ <o:Category>
+ <xsl:value-of select="meta:user-defined[@meta:name = 'Category']"/>
+ </o:Category>
+ <o:Author>
+ <xsl:value-of select="meta:initial-creator"/>
+ </o:Author>
+ <o:LastAuthor>
+ <xsl:value-of select="dc:creator"/>
+ </o:LastAuthor>
+ <o:Manager>
+ <xsl:value-of select="meta:user-defined[@meta:name = 'Manager']"/>
+ </o:Manager>
+ <o:Company>
+ <xsl:value-of select="meta:user-defined[@meta:name = 'Company']"/>
+ </o:Company>
+ <o:HyperlinkBase>
+ <xsl:value-of select="meta:user-defined[@meta:name = 'HyperlinkBase']"/>
+ </o:HyperlinkBase>
+ <o:Revision>
+ <xsl:value-of select="meta:editing-cycles"/>
+ </o:Revision>
+ <!-- PresentationFormat, Guid, AppName, Version -->
+ <o:TotalTime>
+ <xsl:if test="meta:editing-duration">
+ <xsl:variable name="hours">
+ <xsl:choose>
+ <xsl:when test="contains(meta:editing-duration, 'H')">
+ <xsl:value-of select="substring-before( substring-after( meta:editing-duration, 'PT'), 'H')"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="minutes">
+ <xsl:choose>
+ <xsl:when test="contains(meta:editing-duration, 'M') and contains(meta:editing-duration, 'H')">
+ <xsl:value-of select="substring-before( substring-after( meta:editing-duration, 'H'), 'M')"/>
+ </xsl:when>
+ <xsl:when test="contains(meta:editing-duration, 'M')">
+ <xsl:value-of select="substring-before( substring-after( meta:editing-duration, 'PT'), 'M')"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:value-of select="$hours * 60 + $minutes"/>
+ </xsl:if>
+ </o:TotalTime>
+ <o:LastPrinted>
+ <xsl:if test="meta:print-date">
+ <xsl:value-of select="concat( meta:print-date, 'Z')"/>
+ </xsl:if>
+ </o:LastPrinted>
+ <o:Created>
+ <xsl:if test="meta:creation-date">
+ <xsl:value-of select="concat( meta:creation-date, 'Z')"/>
+ </xsl:if>
+ </o:Created>
+ <o:LastSaved>
+ <xsl:if test="dc:date">
+ <xsl:value-of select="concat( dc:date, 'Z')"/>
+ </xsl:if>
+ </o:LastSaved>
+ <o:Pages>
+ <xsl:value-of select="meta:document-statistic/@meta:page-count"/>
+ </o:Pages>
+ <o:Words>
+ <xsl:value-of select="meta:document-statistic/@meta:word-count"/>
+ </o:Words>
+ <o:Characters>
+ <xsl:value-of select="meta:document-statistic/@meta:character-count"/>
+ </o:Characters>
+ <!-- CharactersWithSpaces, Bytes, Lines -->
+ <o:Paragraphs>
+ <xsl:value-of select="meta:document-statistic/@meta:paragraph-count"/>
+ </o:Paragraphs>
+ </o:DocumentProperties>
+ <o:CustomDocumentProperties>
+ <o:Editor dt:dt="string">
+ <xsl:value-of select="meta:generator"/>
+ </o:Editor>
+ <o:Language dt:dt="string">
+ <xsl:value-of select="dc:language"/>
+ </o:Language>
+ <xsl:for-each select="meta:user-defined">
+ <!-- transfer strings to XML QName, necessary to convert several characters -->
+ <xsl:element name="{concat( 'o:', translate(@meta:name,'.,| ~`!@#$%^&amp;&lt;&gt;*()+=[]{};:&quot;/\?','_'))}">
+ <xsl:attribute name="dt:dt">string</xsl:attribute>
+ <xsl:value-of select="."/>
+ </xsl:element>
+ </xsl:for-each>
+ </o:CustomDocumentProperties>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/filter/source/xslt/export/spreadsheetml/formular.xsl b/filter/source/xslt/export/spreadsheetml/formular.xsl
new file mode 100644
index 000000000000..8134412ec8d9
--- /dev/null
+++ b/filter/source/xslt/export/spreadsheetml/formular.xsl
@@ -0,0 +1,640 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
+ xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0"
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:dom="http://www.w3.org/2001/xml-events"
+ xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
+ xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
+ xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
+ xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
+ xmlns:math="http://www.w3.org/1998/Math/MathML"
+ xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
+ xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
+ xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
+ xmlns:ooo="http://openoffice.org/2004/office"
+ xmlns:oooc="http://openoffice.org/2004/calc"
+ xmlns:ooow="http://openoffice.org/2004/writer"
+ xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
+ xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
+ xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
+ xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
+ xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:xt="http://www.jclark.com/xt"
+ xmlns:common="http://exslt.org/common"
+ xmlns:xalan="http://xml.apache.org/xalan"
+ xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:c="urn:schemas-microsoft-com:office:component:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:x2="http://schemas.microsoft.com/office/excel/2003/xml" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ exclude-result-prefixes="chart config dc dom dr3d draw fo form math meta number office ooo oooc ooow script style svg table text xlink xt common xalan">
+
+
+ <!-- Mapping @table:formula to @ss:Formula translating the expression syntax -->
+ <xsl:template match="@table:formula">
+ <xsl:param name="calculatedCellPosition" />
+ <xsl:param name="calculatedRowPosition" />
+
+ <xsl:attribute name="ss:Formula">
+ <xsl:call-template name="translate-formular-expression">
+ <xsl:with-param name="rowPos" select="$calculatedRowPosition" />
+ <xsl:with-param name="columnPos" select="$calculatedCellPosition" />
+ <xsl:with-param name="expression" select="." />
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:template>
+
+
+ <!-- Translate OOOC formula expressions of table cells to spreadsheetml expression
+
+ For example:
+ "oooc:=ROUNDDOWN(123.321;2)"
+ to "=ROUNDDOWN(123.321,2)"
+ "oooc:=([.B2]-[.C2])"
+ to "=(RC[-2]-RC[-1])"
+ "oooc:=DCOUNTA([.E14:.F21];[.F14];[.H14:.I15])"
+ to "=DCOUNTA(R[-17]C[3]:R[-10]C[4],R[-17]C[4],R[-17]C[6]:R[-16]C[7])" -->
+ <xsl:template name="translate-formular-expression">
+ <!-- return position or range for formula or other -->
+ <xsl:param name="rowPos" /> <!-- the position in row (vertical) of cell -->
+ <xsl:param name="columnPos" /> <!-- the position in column (horizontal of cell) -->
+ <xsl:param name="expression" /> <!-- the expression string to be converted -->
+
+ <xsl:choose>
+ <xsl:when test="$expression != ''">
+ <xsl:choose>
+ <!-- OASIS Open Document XML formular expressions -->
+ <xsl:when test="starts-with($expression,'oooc:')">
+ <!-- giving out the '=', which will be removed with 'oooc:=' to enable recursive string parsing -->
+ <xsl:text>=</xsl:text>
+ <xsl:call-template name="function-parameter-mapping">
+ <xsl:with-param name="rowPos" select="$rowPos" />
+ <xsl:with-param name="columnPos" select="$columnPos" />
+ <!-- 1) remove 'oooc:=' prefix and exchange ';' with ',' -->
+ <xsl:with-param name="expression" select="translate(substring($expression,7),';',',')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$expression" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$expression" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- As the function API of our Office and MS Office show differences in the argumentlists,
+ - sometimes the last parameter have to be neglected
+ - sometimes a default have to be added
+ these exchanges have to be done as well -->
+ <xsl:template name="function-parameter-mapping">
+ <xsl:param name="rowPos" /> <!-- the position in row (vertical of cell) -->
+ <xsl:param name="columnPos" /> <!-- the position in column (horizontal of cell) -->
+ <xsl:param name="expression" /> <!-- expression to be exchanged -->
+
+ <!-- Choose if the expression contains one of the function, which might need changes -->
+ <xsl:choose>
+ <!-- if not contain one of the functions, which need parameter mapping -->
+ <xsl:when test="not(contains($expression, 'ADDRESS(') or
+ contains($expression, 'CEILING(') or
+ contains($expression, 'FLOOR(') or
+ contains($expression, 'IF(') or
+ contains($expression, 'ROUND('))">
+ <!-- simply translate possily exisiting column & row references -->
+ <xsl:call-template name="translate-oooc-expression">
+ <xsl:with-param name="rowPos" select="$rowPos" />
+ <xsl:with-param name="columnPos" select="$columnPos" />
+ <xsl:with-param name="expression" select="$expression"/>
+ </xsl:call-template>
+ </xsl:when>
+ <!-- functions to be mapped -->
+ <xsl:otherwise>
+ <xsl:variable name="functionPrefix" select="substring-before($expression, '(')" />
+ <xsl:variable name="expressionSuffix" select="substring-after($expression, '(')" />
+
+ <!-- translate in case the expression contains row/cell references aside of the function name -->
+ <xsl:call-template name="translate-oooc-expression">
+ <xsl:with-param name="rowPos" select="$rowPos" />
+ <xsl:with-param name="columnPos" select="$columnPos" />
+ <xsl:with-param name="expression" select="$functionPrefix"/>
+ </xsl:call-template>
+ <!-- Prefix do not include the bracket -->
+ <xsl:text>(</xsl:text>
+ <xsl:choose>
+ <xsl:when test="not(contains($functionPrefix, 'ADDRESS') or
+ contains($functionPrefix, 'CEILING') or
+ contains($functionPrefix, 'FLOOR') or
+ (contains($functionPrefix, 'IF') and not(
+ contains($functionPrefix, 'COUNTIF') or
+ contains($functionPrefix, 'SUMIF'))) or
+ contains($functionPrefix, 'ROUND'))">
+ <xsl:call-template name="function-parameter-mapping">
+ <xsl:with-param name="rowPos" select="$rowPos" />
+ <xsl:with-param name="columnPos" select="$columnPos" />
+ <xsl:with-param name="expression" select="$expressionSuffix"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="contains($functionPrefix, 'ADDRESS')">
+ <xsl:call-template name="find-parameters">
+ <xsl:with-param name="rowPos" select="$rowPos" />
+ <xsl:with-param name="columnPos" select="$columnPos" />
+ <xsl:with-param name="expressionSuffix" select="$expressionSuffix"/>
+ <xsl:with-param name="parameterRemoval" select="4" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="contains($functionPrefix, 'CEILING') or
+ contains($functionPrefix, 'FLOOR')">
+ <xsl:call-template name="find-parameters">
+ <xsl:with-param name="rowPos" select="$rowPos" />
+ <xsl:with-param name="columnPos" select="$columnPos" />
+ <xsl:with-param name="expressionSuffix" select="$expressionSuffix"/>
+ <xsl:with-param name="parameterRemoval" select="3" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="contains($functionPrefix, 'IF')">
+ <xsl:if test="not(contains($functionPrefix, 'COUNTIF') or
+ contains($functionPrefix, 'SUMIF'))">
+ <xsl:call-template name="find-parameters">
+ <xsl:with-param name="rowPos" select="$rowPos" />
+ <xsl:with-param name="columnPos" select="$columnPos" />
+ <xsl:with-param name="expressionSuffix" select="$expressionSuffix"/>
+ <xsl:with-param name="parameterAddition" select="'true'" />
+ <xsl:with-param name="additonAfterLastParameter" select="2" />
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:when>
+ <xsl:when test="contains($functionPrefix, 'ROUND')">
+ <xsl:call-template name="find-parameters">
+ <xsl:with-param name="rowPos" select="$rowPos" />
+ <xsl:with-param name="columnPos" select="$columnPos" />
+ <xsl:with-param name="expressionSuffix" select="$expressionSuffix"/>
+ <xsl:with-param name="parameterAddition" select="'null'" />
+ <xsl:with-param name="additonAfterLastParameter" select="1" />
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- Each parameter of the argumentlist have to be determined.
+ Due to the low level string functionlity in XSLT it becomes a clumsy task -->
+ <xsl:template name="find-parameters">
+ <!-- used for mapping of row/column reference -->
+ <xsl:param name="rowPos" /> <!-- the position in row (vertical of cell) -->
+ <xsl:param name="columnPos" /> <!-- the position in column (horizontal of cell) -->
+ <!-- used for mapping of parameter -->
+ <xsl:param name="parameterRemoval" />
+ <xsl:param name="parameterAddition" />
+ <xsl:param name="additonAfterLastParameter" />
+ <!-- used as helper to find a parameter -->
+ <xsl:param name="expressionSuffix" />
+ <xsl:param name="parameterNumber" select="1" />
+
+ <xsl:variable name="parameter">
+ <xsl:call-template name="getParameter">
+ <xsl:with-param name="expressionSuffix" select="$expressionSuffix"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:choose>
+ <!-- if it is not the last parameter -->
+ <xsl:when test="starts-with(substring-after($expressionSuffix, $parameter), ',')">
+ <!-- searches the argument for functions to be mapped -->
+ <xsl:if test="not($parameterRemoval = $parameterNumber)">
+ <xsl:call-template name="function-parameter-mapping">
+ <xsl:with-param name="rowPos" select="$rowPos" />
+ <xsl:with-param name="columnPos" select="$columnPos" />
+ <xsl:with-param name="expression">
+ <xsl:choose>
+ <!-- in case a character will be removed the preceding won't make a comma -->
+ <xsl:when test="$parameterRemoval = ($parameterNumber + 1)">
+ <xsl:value-of select="$parameter" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat($parameter, ',')" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:if>
+ <!-- searches for the next parameter -->
+ <xsl:call-template name="find-parameters">
+ <xsl:with-param name="rowPos" select="$rowPos" />
+ <xsl:with-param name="columnPos" select="$columnPos" />
+ <xsl:with-param name="expressionSuffix" select="substring-after(substring-after($expressionSuffix, $parameter),',')"/>
+ <xsl:with-param name="parameterAddition" select="$parameterAddition" />
+ <xsl:with-param name="parameterRemoval" select="$parameterRemoval" />
+ <xsl:with-param name="additonAfterLastParameter" select="$additonAfterLastParameter" />
+ <xsl:with-param name="parameterNumber" select="$parameterNumber + 1" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- the last parameter -->
+ <xsl:choose>
+ <xsl:when test="$parameterRemoval = $parameterNumber">
+ <!-- searches the rest of the expression for functions to be mapped -->
+ <xsl:call-template name="function-parameter-mapping">
+ <xsl:with-param name="rowPos" select="$rowPos" />
+ <xsl:with-param name="columnPos" select="$columnPos" />
+ <xsl:with-param name="expression" select="substring-after($expressionSuffix, $parameter)"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$parameterAddition and ($parameterNumber = $additonAfterLastParameter)">
+ <!-- searches the rest of the expression for functions to be mapped -->
+ <xsl:call-template name="function-parameter-mapping">
+ <xsl:with-param name="rowPos" select="$rowPos" />
+ <xsl:with-param name="columnPos" select="$columnPos" />
+ <xsl:with-param name="expression" select="$parameter" />
+ </xsl:call-template>
+ <!-- searches last parameter and additional parameters for functions to be mapped -->
+ <xsl:call-template name="function-parameter-mapping">
+ <xsl:with-param name="rowPos" select="$rowPos" />
+ <xsl:with-param name="columnPos" select="$columnPos" />
+ <!-- for the final parameter the latter substring is the ')' -->
+ <xsl:with-param name="expression" select="concat(',', $parameterAddition, substring-after($expressionSuffix, $parameter))"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- searches the argument for functions to be mapped -->
+ <xsl:call-template name="function-parameter-mapping">
+ <xsl:with-param name="rowPos" select="$rowPos" />
+ <xsl:with-param name="columnPos" select="$columnPos" />
+ <xsl:with-param name="expression" select="$parameter" />
+ </xsl:call-template>
+ <!-- searches the rest of the expression for functions to be mapped -->
+ <xsl:call-template name="function-parameter-mapping">
+ <xsl:with-param name="rowPos" select="$rowPos" />
+ <xsl:with-param name="columnPos" select="$columnPos" />
+ <xsl:with-param name="expression" select="substring-after($expressionSuffix, $parameter)"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="getParameter">
+ <xsl:param name="closingBracketCount" select="0" />
+ <xsl:param name="openingBracketCount" select="0" />
+ <xsl:param name="expressionSuffix" />
+ <xsl:param name="parameterCandidate">
+ <xsl:choose>
+ <!-- if there are multiple parameter -->
+ <xsl:when test="contains(substring-before($expressionSuffix, ')'), ',')">
+ <xsl:value-of select="substring-before($expressionSuffix, ',')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-before($expressionSuffix, ')')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:param>
+ <xsl:param name="earlierCandidate" select="$parameterCandidate" />
+
+ <xsl:choose>
+ <xsl:when test="contains($parameterCandidate, '(') or contains($parameterCandidate, ')')">
+ <xsl:choose>
+ <!-- contains only closing bracket(s) -->
+ <xsl:when test="contains($parameterCandidate, '(') and not(contains($parameterCandidate, ')'))">
+ <xsl:call-template name="getParameter">
+ <xsl:with-param name="openingBracketCount" select="$openingBracketCount + 1" />
+ <xsl:with-param name="closingBracketCount" select="$closingBracketCount" />
+ <xsl:with-param name="parameterCandidate" select="substring-after($parameterCandidate, '(')" />
+ <xsl:with-param name="earlierCandidate" select="$earlierCandidate" />
+ <xsl:with-param name="expressionSuffix" select="$expressionSuffix"/>
+ </xsl:call-template>
+ </xsl:when>
+ <!-- contains only opening bracket(s) -->
+ <xsl:when test="not(contains($parameterCandidate, '(')) and contains($parameterCandidate, ')')">
+ <xsl:call-template name="getParameter">
+ <xsl:with-param name="openingBracketCount" select="$openingBracketCount" />
+ <xsl:with-param name="closingBracketCount" select="$closingBracketCount + 1" />
+ <xsl:with-param name="parameterCandidate" select="substring-after($parameterCandidate, ')')" />
+ <xsl:with-param name="earlierCandidate" select="$earlierCandidate" />
+ <xsl:with-param name="expressionSuffix" select="$expressionSuffix"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="string-length(substring-before($parameterCandidate, '(')) &lt;
+ string-length(substring-before($parameterCandidate, ')'))">
+ <xsl:call-template name="getParameter">
+ <xsl:with-param name="openingBracketCount" select="$openingBracketCount + 1" />
+ <xsl:with-param name="closingBracketCount" select="$closingBracketCount" />
+ <xsl:with-param name="parameterCandidate" select="substring-after($parameterCandidate, '(')" />
+ <xsl:with-param name="earlierCandidate" select="$earlierCandidate" />
+ <xsl:with-param name="expressionSuffix" select="$expressionSuffix"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="getParameter">
+ <xsl:with-param name="openingBracketCount" select="$openingBracketCount" />
+ <xsl:with-param name="closingBracketCount" select="$closingBracketCount + 1" />
+ <xsl:with-param name="parameterCandidate" select="substring-after($parameterCandidate, ')')" />
+ <xsl:with-param name="earlierCandidate" select="$earlierCandidate" />
+ <xsl:with-param name="expressionSuffix" select="$expressionSuffix"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="$openingBracketCount = $closingBracketCount">
+ <xsl:value-of select="$earlierCandidate" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$earlierCandidate" />
+ <xsl:variable name="parameterCandidate2">
+ <xsl:variable name="formularAfterCandidate" select="substring-after($expressionSuffix, $earlierCandidate)" />
+ <xsl:variable name="parameterTillBracket" select="concat(substring-before($formularAfterCandidate,')'),')')" />
+ <xsl:variable name="parameterTillComma" select="substring-before(substring-after($expressionSuffix, $parameterTillBracket),',')" />
+ <xsl:choose>
+ <xsl:when test="string-length($parameterTillComma) &gt; 0 and
+ not(contains($parameterTillComma, '('))">
+ <xsl:choose>
+ <xsl:when test="starts-with($formularAfterCandidate, ',')">
+ <xsl:value-of select="concat(',',substring-before(substring-after($formularAfterCandidate,','),','))"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-before($formularAfterCandidate,',')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$parameterTillBracket"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:call-template name="getParameter">
+ <xsl:with-param name="closingBracketCount" select="$closingBracketCount" />
+ <xsl:with-param name="openingBracketCount" select="$openingBracketCount" />
+ <xsl:with-param name="parameterCandidate" select="$parameterCandidate2" />
+ <xsl:with-param name="earlierCandidate" select="$parameterCandidate2" />
+ <xsl:with-param name="expressionSuffix" select="$expressionSuffix" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- Mapping table-cell definitions by exchangomg all table cell definitions:
+ a) a pair of cells e.g. "[.E14:.F21]" to "R[-17]C[3]:R[-10]C[4]"
+ b) a single cell e.g. "[.F14]" to "R[-17]"-->
+ <xsl:template name="translate-oooc-expression">
+ <xsl:param name="rowPos" /> <!-- the position in row (vertical of cell) -->
+ <xsl:param name="columnPos" /> <!-- the position in column (horizontal of cell) -->
+ <xsl:param name="expression" /> <!-- expression to be exchanged -->
+
+ <xsl:choose>
+ <xsl:when test="contains($expression, '[')">
+
+ <!-- Giving out the part before '[.' -->
+ <xsl:value-of select="substring-before($expression, '[')" />
+
+ <!-- Mapping cell definitions
+ 1) a pair of cells e.g. "[.E14:.F21]" to "R[-17]C[3]:R[-10]C[4]"
+ 2) a single cell e.g. "[.F14]" to "R[-17]"-->
+ <xsl:variable name="remainingExpression" select="substring-after($expression, '[')"/>
+ <xsl:choose>
+ <xsl:when test="contains(substring-before($remainingExpression, ']'), ':')">
+ <xsl:call-template name="translate-cell-expression">
+ <xsl:with-param name="rowPos" select="$rowPos" />
+ <xsl:with-param name="columnPos" select="$columnPos" />
+ <xsl:with-param name="expression" select="substring-before($remainingExpression, ':')" />
+ </xsl:call-template>
+ <xsl:value-of select="':'" />
+ <xsl:call-template name="translate-cell-expression">
+ <xsl:with-param name="rowPos" select="$rowPos" />
+ <xsl:with-param name="columnPos" select="$columnPos" />
+ <xsl:with-param name="expression" select="substring-after(substring-before($remainingExpression, ']'), ':')" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="translate-cell-expression">
+ <xsl:with-param name="rowPos" select="$rowPos" />
+ <xsl:with-param name="columnPos" select="$columnPos" />
+ <xsl:with-param name="expression" select="substring-before($remainingExpression, ']')" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:call-template name="translate-oooc-expression">
+ <xsl:with-param name="rowPos" select="$rowPos" />
+ <xsl:with-param name="columnPos" select="$columnPos" />
+ <xsl:with-param name="expression" select="substring-after($remainingExpression,']')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- Giving out the remaining part -->
+ <xsl:value-of select="$expression" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <!-- A cell expression has usually starts with a '.' otherwise it references to a sheet -->
+ <xsl:template name="translate-cell-expression">
+ <xsl:param name="rowPos" /> <!-- the vertical position of the current cell -->
+ <xsl:param name="columnPos" /> <!-- the horizontal position of the current cell -->
+ <xsl:param name="targetRowPos" select="0"/> <!-- the vertical position of the target cell -->
+ <xsl:param name="targetColumnPos" select="0"/> <!-- the horizontal position of the target cell -->
+ <xsl:param name="charPos" select="0"/> <!-- current column position (needed for multiplying) -->
+ <xsl:param name="digitPos" select="0"/> <!-- current row position (needed for multiplying) -->
+ <xsl:param name="expression" /> <!-- expression to be parsed by character -->
+ <xsl:param name="isRow" select="true()"/> <!-- the string (e.g. $D39 is parsed character per character from the back,
+ first the row, later the column is parsed -->
+
+ <xsl:choose>
+ <xsl:when test="starts-with($expression, '.')">
+ <xsl:variable name="expLength" select="string-length($expression)" />
+ <xsl:choose>
+ <!-- parsing from the end, till only the '.' remains -->
+ <xsl:when test="$expLength != 1">
+ <xsl:variable name="token" select="substring($expression, $expLength)" />
+ <xsl:choose>
+ <xsl:when test="$token='0' or $token='1' or $token='2' or $token='3' or $token='4' or $token='5' or $token='6' or $token='7' or $token='8' or $token='9'">
+ <xsl:variable name="multiplier">
+ <xsl:call-template name="calculate-square-numbers">
+ <xsl:with-param name="base" select="10" />
+ <xsl:with-param name="exponent" select="$digitPos"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="translate-cell-expression">
+ <xsl:with-param name="columnPos" select="$columnPos" />
+ <xsl:with-param name="rowPos" select="$rowPos" />
+ <xsl:with-param name="targetColumnPos" select="$targetColumnPos" />
+ <xsl:with-param name="targetRowPos" select="$targetRowPos + $multiplier * $token" />
+ <xsl:with-param name="digitPos" select="$digitPos + 1" />
+ <xsl:with-param name="charPos" select="$charPos" />
+ <!-- removing the last character-->
+ <xsl:with-param name="expression" select="substring($expression, 1, $expLength - 1)" />
+ <xsl:with-param name="isRow" select="true()" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$token = '$'">
+ <xsl:choose>
+ <!-- if this is the first '$' after '.' (column-->
+ <xsl:when test="$expLength = 2">
+ <xsl:text>C</xsl:text><xsl:value-of select="$targetColumnPos"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>R</xsl:text><xsl:value-of select="$targetRowPos"/>
+ <xsl:call-template name="translate-cell-expression">
+ <xsl:with-param name="columnPos" select="$columnPos" />
+ <xsl:with-param name="rowPos" select="$rowPos" />
+ <xsl:with-param name="targetColumnPos" select="$targetColumnPos" />
+ <xsl:with-param name="targetRowPos" select="$targetRowPos" />
+ <xsl:with-param name="charPos" select="$charPos" />
+ <!-- removing the last character-->
+ <xsl:with-param name="expression" select="substring($expression, 1, $expLength - 1)" />
+ <xsl:with-param name="isRow" select="false()" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <!-- in case of a letter -->
+ <xsl:otherwise>
+ <xsl:if test="$isRow">
+ <xsl:text>R</xsl:text>
+ <xsl:if test="$targetRowPos != $rowPos">
+ <xsl:text>[</xsl:text><xsl:value-of select="$targetRowPos - $rowPos"/><xsl:text>]</xsl:text>
+ </xsl:if>
+ </xsl:if>
+ <xsl:variable name="multiplier">
+ <xsl:call-template name="calculate-square-numbers">
+ <xsl:with-param name="base" select="26" />
+ <xsl:with-param name="exponent" select="$charPos"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="tokenNumber">
+ <xsl:call-template name="character-to-number">
+ <xsl:with-param name="character" select="$token" />
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:call-template name="translate-cell-expression">
+ <xsl:with-param name="columnPos" select="$columnPos" />
+ <xsl:with-param name="rowPos" select="$rowPos" />
+ <xsl:with-param name="targetColumnPos" select="$targetColumnPos + $multiplier * $tokenNumber" />
+ <xsl:with-param name="targetRowPos" select="$targetRowPos" />
+ <xsl:with-param name="digitPos" select="$digitPos" />
+ <xsl:with-param name="charPos" select="$charPos + 1" />
+ <!-- removing the last character-->
+ <xsl:with-param name="expression" select="substring($expression, 1, $expLength - 1)" />
+ <xsl:with-param name="isRow" select="false()" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>C</xsl:text>
+ <xsl:if test="$targetColumnPos != $columnPos">
+ <xsl:text>[</xsl:text><xsl:value-of select="$targetColumnPos - $columnPos"/><xsl:text>]</xsl:text>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="sheetName" select="substring-before($expression, '.')" />
+ <xsl:value-of select="$sheetName"/><xsl:text>!</xsl:text>
+ <xsl:call-template name="translate-cell-expression">
+ <xsl:with-param name="rowPos" select="$rowPos" />
+ <xsl:with-param name="columnPos" select="$columnPos" />
+ <xsl:with-param name="expression" select="substring-after($expression, $sheetName)" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <xsl:template name="calculate-square-numbers">
+ <xsl:param name="base" />
+ <xsl:param name="exponent" />
+ <xsl:param name="return" select="1" />
+
+ <xsl:choose>
+ <xsl:when test="$exponent > '1'">
+ <xsl:call-template name="calculate-square-numbers">
+ <xsl:with-param name="base" select="$base" />
+ <xsl:with-param name="exponent" select="$exponent - 1"/>
+ <xsl:with-param name="return" select="$return * $base" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$exponent = '1'">
+ <xsl:value-of select="$return * $base"/>
+ </xsl:when>
+ <!-- if exponent is equal '0' -->
+ <xsl:otherwise>
+ <xsl:value-of select="1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <xsl:template name="character-to-number">
+ <xsl:param name="character" />
+ <xsl:choose>
+ <xsl:when test="$character = 'A'">1</xsl:when>
+ <xsl:when test="$character = 'B'">2</xsl:when>
+ <xsl:when test="$character = 'C'">3</xsl:when>
+ <xsl:when test="$character = 'D'">4</xsl:when>
+ <xsl:when test="$character = 'E'">5</xsl:when>
+ <xsl:when test="$character = 'F'">6</xsl:when>
+ <xsl:when test="$character = 'G'">7</xsl:when>
+ <xsl:when test="$character = 'H'">8</xsl:when>
+ <xsl:when test="$character = 'I'">9</xsl:when>
+ <xsl:when test="$character = 'J'">10</xsl:when>
+ <xsl:when test="$character = 'K'">11</xsl:when>
+ <xsl:when test="$character = 'L'">12</xsl:when>
+ <xsl:when test="$character = 'M'">13</xsl:when>
+ <xsl:when test="$character = 'N'">14</xsl:when>
+ <xsl:when test="$character = 'O'">15</xsl:when>
+ <xsl:when test="$character = 'P'">16</xsl:when>
+ <xsl:when test="$character = 'Q'">17</xsl:when>
+ <xsl:when test="$character = 'R'">18</xsl:when>
+ <xsl:when test="$character = 'S'">19</xsl:when>
+ <xsl:when test="$character = 'T'">20</xsl:when>
+ <xsl:when test="$character = 'U'">21</xsl:when>
+ <xsl:when test="$character = 'V'">22</xsl:when>
+ <xsl:when test="$character = 'W'">23</xsl:when>
+ <xsl:when test="$character = 'X'">24</xsl:when>
+ <xsl:when test="$character = 'Y'">25</xsl:when>
+ <xsl:when test="$character = 'Z'">26</xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/filter/source/xslt/export/spreadsheetml/ooo2spreadsheetml.xsl b/filter/source/xslt/export/spreadsheetml/ooo2spreadsheetml.xsl
new file mode 100644
index 000000000000..420d06474a3a
--- /dev/null
+++ b/filter/source/xslt/export/spreadsheetml/ooo2spreadsheetml.xsl
@@ -0,0 +1,417 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
+ xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0"
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:dom="http://www.w3.org/2001/xml-events"
+ xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
+ xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
+ xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
+ xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
+ xmlns:math="http://www.w3.org/1998/Math/MathML"
+ xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
+ xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
+ xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
+ xmlns:ooo="http://openoffice.org/2004/office"
+ xmlns:oooc="http://openoffice.org/2004/calc"
+ xmlns:ooow="http://openoffice.org/2004/writer"
+ xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
+ xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
+ xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
+ xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
+ xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:c="urn:schemas-microsoft-com:office:component:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:x2="http://schemas.microsoft.com/office/excel/2003/xml" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ exclude-result-prefixes="chart config dc dom dr3d draw fo form math meta number office ooo oooc ooow script style svg table text xlink">
+
+
+ <!--+++++ INCLUDED XSL MODULES +++++-->
+
+ <!-- helper collection, to convert measures (e.g. inch to pixel using DPI (dots per inch) parameter)-->
+ <xsl:import href="../../common/measure_conversion.xsl" />
+
+ <!-- excel table handling -->
+ <xsl:include href="table.xsl" />
+
+ <!-- mapping rules of office style properties to Excel style properties -->
+ <xsl:include href="style_mapping.xsl" />
+
+ <!-- creating the Excel styles element -->
+ <xsl:include href="styles.xsl" />
+
+ <!-- mapping formalar Expressions -->
+ <xsl:include href="formular.xsl" />
+
+ <xsl:output method = "xml"
+ indent = "no"
+ encoding = "UTF-8"
+ omit-xml-declaration = "no" />
+
+ <xsl:strip-space elements="ss:Data html:Data" />
+
+
+ <!-- common table handling -->
+ <xsl:variable name="namespace" select="'urn:schemas-microsoft-com:office:spreadsheet'" />
+
+ <!--+++++ PARAMETER SECTION +++++-->
+
+ <!-- OPTIONAL: (MANDATORY: for all input document with relative external links): parameter is a (relative) URL to the target directory.
+ Relative links from the office document (e.g. to external graphics) will get this parameter as a prefix -->
+ <xsl:param name="targetBaseURL" select="'./'" />
+
+ <!-- OPTIONAL: (MANDATORY: for input document with relative internal links)
+ To access contents of a office file (content like the meta.xml, styles.xml file or graphics) a URL could be choosen.
+ This could be even a JAR URL. The sourceBase of the content URL "jar:file:/C:/temp/Test.sxw!/content.xml" would be
+ "jar:file:/C:/temp/Test.sxw!/" for example.
+ When working with OpenOffice API a Package-URL encoded over HTTP can be used to access the jared contents of the the jared document. -->
+ <xsl:param name="sourceBaseURL" select="'./'" />
+
+ <!-- OPTIONAL: (MANDATORY: for session management by URL rewriting)
+ Useful for WebApplications: if a HTTP session is not cookie based, URL rewriting is beeing used (the session is appended to the URL).
+ This URL session is used for example when links to graphics are created by XSLT. Otherwise the user havt to log again in for every graphic he liks to see. -->
+ <xsl:param name="optionalURLSuffix" />
+
+ <!-- OPTIONAL: URL to office meta file (flat xml use the URL to the input file) -->
+ <xsl:param name="metaFileURL" />
+
+ <!-- OPTIONAL: URL to office meta file (flat xml use the URL to the input file) -->
+ <xsl:param name="stylesFileURL" />
+
+ <!-- OPTIONAL: in case of using a different processor than a JAVA XSLT, you can unable the Java functionality
+ (e.g. encoding chapter names for the content-table as href and anchors ) -->
+ <xsl:param name="java" select="true()" />
+ <xsl:param name="javaEnabled" select="boolean($java)" />
+
+ <!-- OPTIONAL: for activating the debug mode set the variable here to 'true()' or give any value from outside -->
+ <xsl:param name="debug" select="false()" />
+ <xsl:param name="debugEnabled" select="boolean($debug)" />
+
+ <!-- matching configuration entries -->
+ <xsl:key name="config" use="@config:name"
+ match="/*/office:settings/config:config-item-set/config:config-item-map-indexed/config:config-item-map-entry/config:config-item |
+ /*/office:settings/config:config-item-set/config:config-item-map-indexed/config:config-item-map-entry/config:config-item-map-named/config:config-item-map-entry/config:config-item" />
+
+ <xsl:key name="colors" match="/*/office:styles//@*[name() = 'fo:background-color' or name() = 'fo:color'] |
+ /*/office:automatic-styles//@*[name() = 'fo:background-color' or name() = 'fo:color']" use="/" />
+ <xsl:key name="colorRGB" match="@fo:background-color | @fo:color" use="." />
+ <!-- *************************** -->
+ <!-- *** Built up Excel file *** -->
+ <!-- *************************** -->
+ <xsl:template match="/">
+ <xsl:processing-instruction name="mso-application">progid="Excel.Sheet"</xsl:processing-instruction>
+ <!-- Note: for debugging purpose include schema location
+ <Workbook xsi:schemaLocation="urn:schemas-microsoft-com:office:spreadsheet <YOUR_SCHEMA_URL>/excelss.xsd"> -->
+ <Workbook>
+ <!-- adding some default settings -->
+ <OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">
+ <Colors>
+ <xsl:for-each select="key('colors', /)
+ [generate-id(.) =
+ generate-id(key('colorRGB', .)[1]) and starts-with(., '#')] ">
+ <xsl:sort select="." />
+ <Color>
+ <Index><xsl:value-of select="position() + 2" /></Index>
+ <RGB><xsl:value-of select="." /></RGB>
+ </Color>
+ </xsl:for-each>
+ <xsl:for-each select="key('config', 'TabColor')[not(.=preceding::config:config-item)]">
+ <xsl:sort select="." />
+ <Color>
+ <Index><xsl:value-of select="56 - position()" /></Index>
+ <RGB>
+ <xsl:call-template name="colordecimal2rgb">
+ <xsl:with-param name="colordecimal" select="."/>
+ </xsl:call-template>
+ </RGB>
+ </Color>
+ </xsl:for-each>
+ </Colors>
+ </OfficeDocumentSettings>
+ <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
+ <xsl:if test="key('config', 'HasSheetTabs') = 'false'">
+ <xsl:element name="HideWorkbookTabs" />
+ </xsl:if>
+ <WindowHeight>9000</WindowHeight>
+ <WindowWidth>13860</WindowWidth>
+ <WindowTopX>240</WindowTopX>
+ <WindowTopY>75</WindowTopY>
+ <ProtectStructure>False</ProtectStructure>
+ <ProtectWindows>False</ProtectWindows>
+ </ExcelWorkbook>
+ <!-- Note: the following handling will exchange the default, later
+ <x:ExcelWorkbook>
+ <xsl:apply-templates select="table:calculation-settings" />
+ </x:ExcelWorkbook>
+ -->
+ <xsl:element name="Styles">
+ <!-- our application default will not be used for export to Excel
+ <xsl:apply-templates select="/*/office:styles/style:default-style" mode="styles" />-->
+ <xsl:apply-templates select="/*/office:styles/style:style" mode="styles" />
+ <xsl:apply-templates select="/*/office:automatic-styles/style:style" mode="styles" >
+ <xsl:with-param name="isAutomatic" select="true()" />
+ </xsl:apply-templates>
+ </xsl:element>
+ <xsl:apply-templates select="/*/office:body" />
+ </Workbook>
+ </xsl:template>
+
+ <xsl:template name="colordecimal2rgb">
+ <xsl:param name="colordecimal"/>
+ <xsl:choose>
+ <xsl:when test="$colordecimal &lt;= 16777215 and $colordecimal &gt;= 65536">
+ <xsl:variable name="redValue" select="floor(($colordecimal) div 65536)"/>
+ <xsl:variable name="greenValue" select="floor(($colordecimal - ($redValue*65536)) div 256)"/>
+ <xsl:variable name="blueValue" select="$colordecimal - ($redValue*65536) - ($greenValue*256)"/>
+ <xsl:call-template name="dec_rgb2Hex">
+ <xsl:with-param name="decRedValue" select="$redValue"/>
+ <xsl:with-param name="decGreenValue" select="$greenValue"/>
+ <xsl:with-param name="decBlueValue" select="$blueValue"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$colordecimal &lt;= 65535 and $colordecimal &gt;= 256">
+ <xsl:variable name="redValue" select="0"/>
+ <xsl:variable name="greenValue" select="$colordecimal div 256"/>
+ <xsl:variable name="blueValue" select="$colordecimal - ($greenValue*256)"/>
+ <xsl:call-template name="dec_rgb2Hex">
+ <xsl:with-param name="decRedValue" select="$redValue"/>
+ <xsl:with-param name="decGreenValue" select="$greenValue"/>
+ <xsl:with-param name="decBlueValue" select="$blueValue"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$colordecimal &lt;= 255 and $colordecimal &gt;= 0">
+ <xsl:variable name="redValue" select="0"/>
+ <xsl:variable name="greenValue" select="0"/>
+ <xsl:variable name="blueValue" select="$colordecimal"/>
+ <xsl:call-template name="dec_rgb2Hex">
+ <xsl:with-param name="decRedValue" select="$redValue"/>
+ <xsl:with-param name="decGreenValue" select="$greenValue"/>
+ <xsl:with-param name="decBlueValue" select="$blueValue"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="dec_rgb2Hex">
+ <xsl:param name="decRedValue"/>
+ <xsl:param name="decGreenValue"/>
+ <xsl:param name="decBlueValue"/>
+ <xsl:variable name="hexRedValue">
+ <xsl:variable name="tmpHexRedValue">
+ <xsl:call-template name="decimal2hex">
+ <xsl:with-param name="dec-number" select="$decRedValue"/>
+ <xsl:with-param name="last-value" select="'H'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="string-length($tmpHexRedValue) = 1">
+ <xsl:value-of select="concat('0',$tmpHexRedValue)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$tmpHexRedValue"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="hexGreenValue">
+ <xsl:variable name="tmpHexGreenValue">
+ <xsl:call-template name="decimal2hex">
+ <xsl:with-param name="dec-number" select="$decGreenValue"/>
+ <xsl:with-param name="last-value" select="'H'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="string-length($tmpHexGreenValue) = 1">
+ <xsl:value-of select="concat('0',$tmpHexGreenValue)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$tmpHexGreenValue"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="hexBlueValue">
+ <xsl:variable name="tmpHexBlueValue">
+ <xsl:call-template name="decimal2hex">
+ <xsl:with-param name="dec-number" select="$decBlueValue"/>
+ <xsl:with-param name="last-value" select="'H'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="string-length($tmpHexBlueValue) = 1">
+ <xsl:value-of select="concat('0',$tmpHexBlueValue)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$tmpHexBlueValue"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:value-of select="concat('#',$hexRedValue,$hexGreenValue,$hexBlueValue)"/>
+ </xsl:template>
+ <xsl:template name="decimal2hex">
+ <!-- transforms a decimal number to a hex number,only for two-bit hex(less than 256 in decimal) currently -->
+ <xsl:param name="dec-number"/>
+ <xsl:param name="last-value"/>
+ <xsl:variable name="current-value">
+ <xsl:call-template name="decNumber2hex">
+ <xsl:with-param name="dec-value">
+ <xsl:if test="$dec-number &gt; 15">
+ <xsl:value-of select="floor($dec-number div 16)"/>
+ </xsl:if>
+ <xsl:if test="$dec-number &lt; 16">
+ <xsl:value-of select="$dec-number"/>
+ </xsl:if>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="$dec-number &gt; 15">
+ <xsl:call-template name="decimal2hex">
+ <xsl:with-param name="dec-number" select="$dec-number mod 16"/>
+ <xsl:with-param name="last-value" select="concat($last-value,$current-value)"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="$dec-number &lt; 16">
+ <xsl:value-of select="substring-after(concat($last-value,$current-value),'H')"/>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template name="decNumber2hex">
+ <!-- return a hex number for a decimal character -->
+ <xsl:param name="dec-value"/>
+ <xsl:choose>
+ <xsl:when test="$dec-value = 10">
+ <xsl:value-of select="'A'"/>
+ </xsl:when>
+ <xsl:when test="$dec-value = 11">
+ <xsl:value-of select="'B'"/>
+ </xsl:when>
+ <xsl:when test="$dec-value = 12">
+ <xsl:value-of select="'C'"/>
+ </xsl:when>
+ <xsl:when test="$dec-value = 13">
+ <xsl:value-of select="'D'"/>
+ </xsl:when>
+ <xsl:when test="$dec-value = 14">
+ <xsl:value-of select="'E'"/>
+ </xsl:when>
+ <xsl:when test="$dec-value = 15">
+ <xsl:value-of select="'F'"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$dec-value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="GetTabColorIndex">
+ <xsl:param name="SheetColor"/>
+ <xsl:for-each select="key('config', 'TabColor')[not(.=preceding::config:config-item)]">
+ <xsl:sort select="." />
+ <xsl:variable name="tmpColor" select="."/>
+ <xsl:if test=". = $SheetColor" >
+ <xsl:value-of select="56 - position()"/>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template match="office:body">
+ <!-- office:body table:table children are spreadsheets -->
+ <xsl:apply-templates />
+ </xsl:template>
+
+ <xsl:template match="office:spreadsheet">
+ <xsl:apply-templates />
+ </xsl:template>
+
+ <!-- office:body table:table children are spreadsheets -->
+ <xsl:template match="office:spreadsheet/table:table">
+ <xsl:element name="ss:Worksheet">
+ <xsl:variable name="TableName">
+ <xsl:value-of select="@table:name" />
+ </xsl:variable>
+ <xsl:attribute name="ss:Name">
+ <xsl:value-of select="$TableName" />
+ </xsl:attribute>
+ <xsl:call-template name="table:table" />
+ <xsl:element name="x:WorksheetOptions">
+ <xsl:if test="key('config', 'ShowGrid') = 'false'">
+ <xsl:element name="x:DoNotDisplayGridlines" />
+ </xsl:if>
+ <xsl:if test="key('config', 'HasColumnRowHeaders') = 'false'">
+ <xsl:element name="x:DoNotDisplayHeadings" />
+ </xsl:if>
+ <xsl:if test="key('config', 'IsOutlineSymbolsSet') = 'false'">
+ <xsl:element name="x:DoNotDisplayOutline" />
+ </xsl:if>
+ <xsl:if test="key('config', 'ShowZeroValues') = 'false'">
+ <xsl:element name="x:DoNotDisplayZeros" />
+ </xsl:if>
+ <xsl:if test="/*/office:settings/config:config-item-set/config:config-item-map-indexed/config:config-item-map-entry/config:config-item-map-named/config:config-item-map-entry[@config:name=$TableName]/config:config-item[@config:name='TabColor']">
+ <xsl:element name="x:TabColorIndex">
+ <xsl:variable name="TabColorIndex">
+ <xsl:call-template name="GetTabColorIndex">
+ <xsl:with-param name="SheetColor" select="/*/office:settings/config:config-item-set/config:config-item-map-indexed/config:config-item-map-entry/config:config-item-map-named/config:config-item-map-entry[@config:name=$TableName]/config:config-item[@config:name='TabColor']"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="$TabColorIndex"/>
+ </xsl:element>
+ </xsl:if>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="table:decls" mode="ExcelWorkbook">
+ <xsl:apply-templates mode="ExcelWorkbook" />
+ </xsl:template>
+
+ <xsl:template match="table:calculation-settings" mode="ExcelWorkbook">
+ <xsl:if test="table:precision-as-shown">
+ <x:PrecisionAsDisplayed/>
+ </xsl:if>
+ <xsl:if test="table:null-date/@office:date-value='1904-01-01'">
+ <x:Date1904/>
+ </xsl:if>
+ <xsl:apply-templates select="table:iteration" />
+ </xsl:template>
+
+ <xsl:template match="table:iteration" mode="ExcelWorkbook">
+ <xsl:element name="x:ExcelWorkbook">
+ <xsl:if test="@table:status = 'enable'">
+ <x:Iteration/>
+ </xsl:if>
+ <xsl:if test="@table:steps">
+ <xsl:element name="x:MaxIterations">
+ <xsl:value-of select="@table:steps" />
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="@table:maximum-difference">
+ <xsl:element name="x:MaxChange">
+ <xsl:value-of select="@table:maximum-difference" />
+ </xsl:element>
+ </xsl:if>
+ </xsl:element>
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/filter/source/xslt/export/spreadsheetml/style_mapping.xsl b/filter/source/xslt/export/spreadsheetml/style_mapping.xsl
new file mode 100644
index 000000000000..a3396f1f9ac3
--- /dev/null
+++ b/filter/source/xslt/export/spreadsheetml/style_mapping.xsl
@@ -0,0 +1,390 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
+ xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0"
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:dom="http://www.w3.org/2001/xml-events"
+ xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
+ xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
+ xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
+ xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
+ xmlns:math="http://www.w3.org/1998/Math/MathML"
+ xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
+ xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
+ xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
+ xmlns:ooo="http://openoffice.org/2004/office"
+ xmlns:oooc="http://openoffice.org/2004/calc"
+ xmlns:ooow="http://openoffice.org/2004/writer"
+ xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
+ xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
+ xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
+ xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
+ xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:xt="http://www.jclark.com/xt"
+ xmlns:common="http://exslt.org/common"
+ xmlns:xalan="http://xml.apache.org/xalan"
+ xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:c="urn:schemas-microsoft-com:office:component:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:x2="http://schemas.microsoft.com/office/excel/2003/xml" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ exclude-result-prefixes="chart config dc dom dr3d draw fo form math meta number office ooo oooc ooow script style svg table text xlink xt common xalan">
+
+ <xsl:variable name="namespace-html" select="'http://www.w3.org/TR/REC-html40'" />
+
+ <xsl:template match="@table:style-name | @table:default-cell-style-name">
+ <xsl:if test="not(name() = 'Default')">
+ <xsl:attribute name="ss:StyleID">
+ <xsl:value-of select="." />
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:key match="table:table-cell" name="getCellByStyle" use="@table:style-name"/>
+ <xsl:template match="@table:style-name" mode="table-row">
+ <!-- only row styles used by cells are exported,
+ as usual row style properties are already written as row attributes -->
+ <xsl:if test="key('getCellByStyle', '.')">
+ <xsl:attribute name="ss:StyleID">
+ <xsl:value-of select="." />
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template name="style-and-contents">
+ <xsl:param name="cellStyleName" />
+
+ <!-- WorkAround of Excel2003 issue:
+ Styles from the CellStyle will not be inherited to HTML content (e.g. Colour style).
+ -->
+ <xsl:choose>
+ <xsl:when test="@text:style-name">
+ <xsl:variable name="styles">
+ <xsl:copy-of select="key('styles', @text:style-name)/*" />
+ <xsl:copy-of select="key('styles', $cellStyleName)/*" />
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="function-available('xalan:nodeset')">
+ <xsl:call-template name="create-nested-format-tags">
+ <xsl:with-param name="styles" select="xalan:nodeset($styles)" />
+ <xsl:with-param name="cellStyleName" select="$cellStyleName" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="function-available('xt:node-set')">
+ <xsl:call-template name="create-nested-format-tags">
+ <xsl:with-param name="styles" select="xt:node-set($styles)" />
+ <xsl:with-param name="cellStyleName" select="$cellStyleName" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="function-available('common:node-set')">
+ <xsl:call-template name="create-nested-format-tags">
+ <xsl:with-param name="styles" select="common:node-set($styles)" />
+ <xsl:with-param name="cellStyleName" select="$cellStyleName" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message terminate="yes">The required node-set function was not found!</xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="@table:style-name">
+ <xsl:variable name="styles">
+ <xsl:copy-of select="key('styles', @text:style-name)/*" />
+ <xsl:copy-of select="key('styles', $cellStyleName)/*" />
+ </xsl:variable>
+
+ <xsl:choose>
+ <xsl:when test="function-available('xalan:nodeset')">
+ <xsl:call-template name="create-nested-format-tags">
+ <xsl:with-param name="styles" select="xalan:nodeset($styles)" />
+ <xsl:with-param name="cellStyleName" select="$cellStyleName" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="function-available('xt:node-set')">
+ <xsl:call-template name="create-nested-format-tags">
+ <xsl:with-param name="styles" select="xt:node-set($styles)" />
+ <xsl:with-param name="cellStyleName" select="$cellStyleName" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="function-available('common:node-set')">
+ <xsl:call-template name="create-nested-format-tags">
+ <xsl:with-param name="styles" select="common:node-set($styles)" />
+ <xsl:with-param name="cellStyleName" select="$cellStyleName" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message terminate="yes">The required node-set function was not found!</xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates>
+ <xsl:with-param name="cellStyleName" select="$cellStyleName" />
+ </xsl:apply-templates>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <!-- *********************************** -->
+ <!-- *** creating nested format tags *** -->
+ <!-- *********************************** -->
+
+ <!-- Bold -->
+ <xsl:template name="create-nested-format-tags">
+ <xsl:param name="styles" />
+ <xsl:param name="cellStyleName" />
+
+ <xsl:choose>
+ <xsl:when test="$styles/*/@fo:font-weight = 'bold' or $styles/*/@fo:font-weight = 'bolder'">
+ <xsl:element namespace="{$namespace-html}" name="B">
+ <xsl:call-template name="italic">
+ <xsl:with-param name="styles" select="$styles" />
+ <xsl:with-param name="cellStyleName" select="$cellStyleName" />
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="italic">
+ <xsl:with-param name="styles" select="$styles" />
+ <xsl:with-param name="cellStyleName" select="$cellStyleName" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <!-- Italic -->
+ <xsl:template name="italic">
+ <xsl:param name="styles" />
+ <xsl:param name="cellStyleName" />
+
+ <xsl:choose>
+ <xsl:when test="$styles/*/@fo:font-style = 'italic' or $styles/*/@fo:font-style = 'oblique'">
+ <xsl:element namespace="{$namespace-html}" name="I">
+ <xsl:call-template name="underline">
+ <xsl:with-param name="styles" select="$styles" />
+ <xsl:with-param name="cellStyleName" select="$cellStyleName" />
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="underline">
+ <xsl:with-param name="styles" select="$styles" />
+ <xsl:with-param name="cellStyleName" select="$cellStyleName" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <!-- Underline -->
+ <xsl:template name="underline">
+ <xsl:param name="styles" />
+ <xsl:param name="cellStyleName" />
+
+ <xsl:choose>
+ <xsl:when test="$styles/*/@style:text-underline-type and not($styles/*/@style:text-underline-type = 'none')">
+ <xsl:element namespace="{$namespace-html}" name="U">
+ <xsl:call-template name="strikethrough">
+ <xsl:with-param name="styles" select="$styles" />
+ <xsl:with-param name="cellStyleName" select="$cellStyleName" />
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="strikethrough">
+ <xsl:with-param name="styles" select="$styles" />
+ <xsl:with-param name="cellStyleName" select="$cellStyleName" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ </xsl:template>
+
+
+ <!-- strikethrough -->
+ <xsl:template name="strikethrough">
+ <xsl:param name="styles" />
+ <xsl:param name="cellStyleName" />
+
+ <xsl:choose>
+ <xsl:when test="$styles/*/@style:text-line-through-style and not($styles/*/@style:text-line-through-style = 'none')">
+ <xsl:element namespace="{$namespace-html}" name="S">
+ <xsl:call-template name="super-subscript">
+ <xsl:with-param name="styles" select="$styles" />
+ <xsl:with-param name="cellStyleName" select="$cellStyleName" />
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="super-subscript">
+ <xsl:with-param name="styles" select="$styles" />
+ <xsl:with-param name="cellStyleName" select="$cellStyleName" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+
+ <!-- superscript & subscript -->
+ <xsl:template name="super-subscript">
+ <xsl:param name="styles" />
+ <xsl:param name="cellStyleName" />
+
+ <xsl:choose>
+ <xsl:when test="$styles/*/@style:text-position">
+ <xsl:variable name="textPosition" select="number(substring-before($styles/*/@style:text-position, '% '))" />
+ <xsl:choose>
+ <xsl:when test="$textPosition &gt; 0">
+ <xsl:element namespace="{$namespace-html}" name="Sup">
+ <xsl:call-template name="align">
+ <xsl:with-param name="styles" select="$styles" />
+ <xsl:with-param name="cellStyleName" select="$cellStyleName" />
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="$textPosition &lt; 0">
+ <xsl:element namespace="{$namespace-html}" name="Sub">
+ <xsl:call-template name="align">
+ <xsl:with-param name="styles" select="$styles" />
+ <xsl:with-param name="cellStyleName" select="$cellStyleName" />
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="align">
+ <xsl:with-param name="styles" select="$styles" />
+ <xsl:with-param name="cellStyleName" select="$cellStyleName" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="align">
+ <xsl:with-param name="styles" select="$styles" />
+ <xsl:with-param name="cellStyleName" select="$cellStyleName" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <!-- Alignment - normally called by strikethrough, but no DIV elements in HTML -->
+ <xsl:template name="align">
+ <xsl:param name="styles" />
+ <xsl:param name="cellStyleName" />
+
+ <xsl:choose>
+ <xsl:when test="$styles/*/@fo:font-align">
+ <xsl:element namespace="{$namespace-html}" name="DIV">
+ <xsl:attribute name="html:style">
+ <xsl:choose>
+ <xsl:when test="$styles/*/@fo:font-align = 'start'">
+ <xsl:text>text-align:left;</xsl:text>
+ </xsl:when>
+ <xsl:when test="$styles/*/@fo:font-align = 'end'">
+ <xsl:text>text-align:right;</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>text-align:center;</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:call-template name="font">
+ <xsl:with-param name="styles" select="$styles" />
+ <xsl:with-param name="cellStyleName" select="$cellStyleName" />
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="font">
+ <xsl:with-param name="styles" select="$styles" />
+ <xsl:with-param name="cellStyleName" select="$cellStyleName" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <!-- Font (size and color) -->
+ <xsl:template name="font">
+ <xsl:param name="styles" />
+ <xsl:param name="cellStyleName" />
+
+ <xsl:choose>
+ <xsl:when test="$styles/*/@style:font-name or
+ $styles/*/@fo:font-size or
+ $styles/*/@fo:color">
+ <xsl:element namespace="{$namespace-html}" name="Font">
+ <xsl:if test="$styles/*/@style:font-name">
+ <xsl:attribute name="html:Face">
+ <xsl:value-of select="$styles/*/@style:font-name" />
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$styles/*/@fo:color">
+ <xsl:attribute name="html:Color">
+ <xsl:value-of select="$styles/*/@fo:color" />
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$styles/*/@fo:font-size">
+ <!-- WORKAROUND TO EXCEL2003 issue where nested FONT elements with size attributes result in unloadable documents -->
+ <!-- Only create size attribute if parent do not have already one -->
+
+ <!--<xsl:choose>
+ <xsl:when test="not(key('styles', parent::*/@text:style-name)/*/@fo:font-size)"> -->
+ <xsl:if test="not(key('styles', parent::*/@text:style-name)/*/@fo:font-size)">
+ <xsl:attribute name="html:Size">
+ <xsl:call-template name="convert2pt">
+ <xsl:with-param name="value" select="$styles/*/@fo:font-size" />
+ <xsl:with-param name="cellStyleName" select="$cellStyleName" />
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ <!--</xsl:when>
+ <xsl:otherwise>
+ <xsl:message>Due Excel issue we have to neglect size from @text:style-name '<xsl:value-of select="@text:style-name"/>'!</xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>-->
+ </xsl:if>
+ <!-- get the embedded content -->
+ <xsl:apply-templates>
+ <xsl:with-param name="cellStyleName" select="$cellStyleName" />
+ </xsl:apply-templates>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- get the embedded content -->
+ <xsl:apply-templates>
+ <xsl:with-param name="cellStyleName" select="$cellStyleName" />
+ </xsl:apply-templates>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/filter/source/xslt/export/spreadsheetml/styles.xsl b/filter/source/xslt/export/spreadsheetml/styles.xsl
new file mode 100644
index 000000000000..8b8875d0de61
--- /dev/null
+++ b/filter/source/xslt/export/spreadsheetml/styles.xsl
@@ -0,0 +1,695 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
+ xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0"
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:dom="http://www.w3.org/2001/xml-events"
+ xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
+ xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
+ xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
+ xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
+ xmlns:math="http://www.w3.org/1998/Math/MathML"
+ xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
+ xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
+ xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
+ xmlns:ooo="http://openoffice.org/2004/office"
+ xmlns:oooc="http://openoffice.org/2004/calc"
+ xmlns:ooow="http://openoffice.org/2004/writer"
+ xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
+ xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
+ xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
+ xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
+ xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:xt="http://www.jclark.com/xt"
+ xmlns:common="http://exslt.org/common"
+ xmlns:xalan="http://xml.apache.org/xalan"
+ xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:c="urn:schemas-microsoft-com:office:component:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:x2="http://schemas.microsoft.com/office/excel/2003/xml" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ exclude-result-prefixes="chart config dc dom dr3d draw fo form math meta number office ooo oooc ooow script style svg table text xlink xt common xalan">
+
+ <!-- Used in case of 'style:map', conditional formatting, where a style references to another -->
+ <xsl:key name="styles" match="/*/office:styles/style:style | /*/office:automatic-styles/style:style" use="@style:name" />
+ <!--
+ Mapping of OOo style:name and style:family to excel ss:ID
+ Styles form style:style map from style:name to ss:Name
+ style:parent-style map to ss:Parent
+ -->
+ <!-- default styles of the application
+ <xsl:template match="style:default-style" mode="styles" >
+ <xsl:call-template name="style:style">
+ <xsl:with-param name="styleName" select="'Default'" />
+ </xsl:call-template>
+ </xsl:template>
+ -->
+
+ <xsl:template match="style:style" mode="styles">
+ <xsl:param name="isAutomatic" />
+ <xsl:param name="styleName" select="@style:name" />
+ <xsl:param name="styleParentName" select="@style:parent-style-name" />
+
+ <!-- only row styles used by cells are exported,
+ as usual row style properties are already exported as row attributes -->
+ <xsl:if test="not(@style:family='table-row') or @style:family='table-row' and key('getCellByStyle', '.')">
+ <xsl:element name="Style">
+ <xsl:attribute name="ss:ID">
+ <!-- neglecting that a style is only unique in conjunction with it's family name -->
+ <xsl:value-of select="@style:name" />
+ </xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="not($isAutomatic)">
+ <xsl:choose>
+ <xsl:when test="@style:display-name">
+ <xsl:attribute name="ss:Name"><xsl:value-of select="@style:display-name"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="ss:Name"><xsl:value-of select="@style:name" /></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <!-- when a non-allowed parent style is found
+ (in spreadsheetml no style with ss:Name is able to have a ss:Parent) -->
+ <xsl:when test="@style:parent-style-name">
+ <!-- styles have to be merged (flatting heritance tree) -->
+ <xsl:variable name="stylePropertiesContainer">
+ <xsl:call-template name="merge-all-parent-styles">
+ <xsl:with-param name="currentStyle" select="." />
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="function-available('xalan:nodeset')">
+ <xsl:call-template name="write-style-properties">
+ <xsl:with-param name="styleProperties" select="xalan:nodeset($stylePropertiesContainer)/*" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="function-available('common:node-set')">
+ <xsl:call-template name="write-style-properties">
+ <xsl:with-param name="styleProperties" select="common:node-set($stylePropertiesContainer)/*" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="function-available('xt:node-set')">
+ <xsl:call-template name="write-style-properties">
+ <xsl:with-param name="styleProperties" select="xt:node-set($stylePropertiesContainer)/*" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message terminate="yes">WARNING: The required node set function was not found!</xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="write-style-properties" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- automatic styles are implicit inherting from a style called 'Default',
+ furthermore nor in spreadsheetml nor in OpenDocument automatic styles are able to inherit from each other -->
+ <xsl:choose>
+ <xsl:when test="@style:parent-style-name and not(@style:parent-style-name = 'Default')">
+ <xsl:attribute name="ss:Parent"><xsl:value-of select="@style:parent-style-name" /></xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:call-template name="write-style-properties" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+
+ <!-- resolving the style inheritance by starting from uppermost parent and
+ overriding exisiting style properties by new found child properties -->
+ <xsl:template name="merge-all-parent-styles">
+ <xsl:param name="currentStyle" />
+
+ <xsl:choose>
+ <!-- in case of a parent, styles have to be merged (flatting heritance tree) -->
+ <xsl:when test="$currentStyle/@style:parent-style-name">
+ <!-- collect parent style properties -->
+ <xsl:variable name="parentStyleContainer">
+ <!-- take a look if the parent style has a parent himself -->
+ <xsl:call-template name="merge-all-parent-styles" >
+ <xsl:with-param name="currentStyle" select="key('styles', $currentStyle/@style:parent-style-name)" />
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="function-available('xalan:nodeset')">
+ <xsl:call-template name="merge-style-properties">
+ <xsl:with-param name="childStyleContainer" select="$currentStyle" />
+ <xsl:with-param name="parentStyleContainer" select="xalan:nodeset($parentStyleContainer)" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="function-available('common:node-set')">
+ <xsl:call-template name="merge-style-properties">
+ <xsl:with-param name="childStyleContainer" select="$currentStyle" />
+ <xsl:with-param name="parentStyleContainer" select="common:node-set($parentStyleContainer)" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="function-available('xt:node-set')">
+ <xsl:call-template name="merge-style-properties">
+ <xsl:with-param name="childStyleContainer" select="$currentStyle" />
+ <xsl:with-param name="parentStyleContainer" select="xt:node-set($parentStyleContainer)" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message terminate="yes">WARNING: The required node-set function was not found!</xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <!-- called for top parents (or styles without parents) -->
+ <xsl:otherwise>
+ <xsl:copy-of select="$currentStyle/*"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="merge-style-properties">
+ <xsl:param name="childStyleContainer" />
+ <xsl:param name="parentStyleContainer" />
+
+ <xsl:choose>
+ <xsl:when test="$parentStyleContainer/*">
+ <xsl:apply-templates select="$parentStyleContainer/*" mode="inheritance">
+ <xsl:with-param name="childStyleContainer" select="$childStyleContainer" />
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:copy-of select="$childStyleContainer/*"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="*" mode="inheritance">
+ <xsl:param name="childStyleContainer" />
+
+ <!-- create an element named equal to the current properties parent element (e.g. style:table-cell-properties) -->
+ <xsl:element name="{name()}" namespace="urn:oasis:names:tc:opendocument:xmlns:style:1.0">
+ <!-- attributes will be automatically replaced -->
+ <xsl:copy-of select="@*" />
+ <xsl:copy-of select="$childStyleContainer/*[name() = name(current() )]/@*"/>
+
+ <!-- elements are not needed yet, will be neglected for simplicity reasons -->
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:key match="/*/office:styles/number:date-style |
+ /*/office:styles/number:time-style |
+ /*/office:styles/number:number-style |
+ /*/office:styles/number:percentage-style |
+ /*/office:styles/number:currency-style |
+ /*/office:automatic-styles/number:date-style |
+ /*/office:automatic-styles/number:time-style |
+ /*/office:automatic-styles/number:number-style |
+ /*/office:automatic-styles/number:percentage-style |
+ /*/office:automatic-styles/number:currency-style" name="number-style" use="@style:name" />
+
+
+ <xsl:template name="write-style-properties">
+ <xsl:param name="styleProperties" select="key('styles', @style:name)/*" />
+
+ <xsl:call-template name="Alignment">
+ <xsl:with-param name="styleProperties" select="$styleProperties" />
+ </xsl:call-template>
+ <xsl:call-template name="Border">
+ <xsl:with-param name="styleProperties" select="$styleProperties" />
+ </xsl:call-template>
+ <xsl:call-template name="Font">
+ <xsl:with-param name="styleProperties" select="$styleProperties" />
+ <xsl:with-param name="styleParentName" select="@style:parent-style-name" />
+ </xsl:call-template>
+ <xsl:call-template name="Interior">
+ <xsl:with-param name="styleProperties" select="$styleProperties" />
+ </xsl:call-template>
+ <xsl:call-template name="NumberFormat">
+ <xsl:with-param name="styleProperties" select="$styleProperties" />
+ </xsl:call-template>
+ </xsl:template>
+
+ <!-- context is element 'style:style' -->
+ <xsl:template name="NumberFormat">
+ <xsl:if test="@style:data-style-name">
+ <xsl:variable name="numberStyleName" select="@style:data-style-name" />
+ <xsl:variable name="numberStyle" select="key('number-style', $numberStyleName)" />
+
+ <xsl:element name="NumberFormat">
+ <xsl:attribute name="ss:Format">
+ <xsl:choose>
+ <xsl:when test="not($numberStyle/node())">
+ <!-- Excel2003sp1 issue: 'General' and 'General Number' is not supported -->
+ <xsl:text>General</xsl:text>
+ </xsl:when>
+ <xsl:when test="name($numberStyle) = 'number:number-style'">
+ <xsl:choose>
+ <xsl:when test="$numberStyle/number:scientific-number">
+ <xsl:text>Scientific</xsl:text>
+ </xsl:when>
+ <!-- Excel2003sp1 issue: 'General Number' not supported -->
+ <xsl:when test="$numberStyle/number:number/@number:decimal-places and
+ $numberStyle/number:number/@number:decimal-places='0'">
+ <xsl:text>General</xsl:text>
+ </xsl:when>
+ <xsl:when test="$numberStyle/number:text">
+ <xsl:choose>
+ <xsl:when test="$numberStyle/number:text = 'No' or $numberStyle/number:text = 'Nein'">
+ <xsl:text>Yes/No</xsl:text>
+ </xsl:when>
+ <xsl:when test="$numberStyle/number:text = 'False' or $numberStyle/number:text = 'Falsch'">
+ <xsl:text>True/False</xsl:text>
+ </xsl:when>
+ <xsl:when test="$numberStyle/number:text = 'Off' or $numberStyle/number:text = 'Aus'">
+ <xsl:text>On/Off</xsl:text>
+ </xsl:when>
+ <!-- Excel2003sp1 issue: currency is saved as 'float' -->
+ <xsl:when test="$numberStyle/number:currency-symbol">
+ <xsl:choose>
+ <xsl:when test="contains($numberStyle/number:currency-symbol, '€')">
+ <xsl:text>Euro Currency</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>Currency</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <!-- Excel2003sp1 issue: 'Currency' is saved as 'float' -->
+ <xsl:when test="contains($numberStyle/number:text, '$')">
+ <xsl:text>Currency</xsl:text>
+ </xsl:when>
+ <!-- OASIS XML adapation -->
+ <xsl:otherwise>
+ <xsl:text>General</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$numberStyle/number:grouping">
+ <xsl:text>Standard</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>Fixed</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="name($numberStyle) = 'number:time-style'">
+ <xsl:choose>
+ <xsl:when test="$numberStyle/number:am-pm">
+ <xsl:choose>
+ <xsl:when test="$numberStyle/number:seconds">
+ <xsl:text>Long Time</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>Medium Time</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>Short Time</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="name($numberStyle) = 'number:percentage-style'">
+ <xsl:text>Percent</xsl:text>
+ </xsl:when>
+ <xsl:when test="name($numberStyle) = 'number:currency-style'">
+ <xsl:choose>
+ <xsl:when test="contains($numberStyle/number:currency-symbol, '€')">
+ <xsl:text>Euro Currency</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>Currency</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="$numberStyle/number:month">
+ <xsl:choose>
+ <xsl:when test="$numberStyle/number:month/@number:textual and
+ $numberStyle/number:month/@number:textual=true()">
+ <xsl:text>Medium Date</xsl:text>
+ <!-- Excel2003 sp1 issue: No difference between 'Long Date' and 'Medium Date' -->
+ </xsl:when>
+ <xsl:when test="$numberStyle/number:hours">
+ <xsl:text>General Date</xsl:text>
+ </xsl:when>
+ <xsl:when test="$numberStyle/number:year/@number:style and
+ $numberStyle/number:year/@number:style='long'">
+ <xsl:text>Short Date</xsl:text>
+ </xsl:when>
+ <!-- OASIS XML adapation -->
+ <xsl:otherwise>
+ <xsl:text>Short Date</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <!-- OASIS XML adapation -->
+ <xsl:otherwise>
+ <xsl:text>General</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template name="Alignment">
+ <xsl:param name="styleProperties" />
+
+ <!-- An empty Alignment element, might overwrite parents setting by
+ the default attributes -->
+ <xsl:if test="$styleProperties/@fo:text-align or
+ $styleProperties/@style:vertical-align or
+ $styleProperties/@fo:wrap-option or
+ $styleProperties/@fo:margin-left or
+ $styleProperties/@style:rotation-angle or
+ $styleProperties/@style:direction">
+ <xsl:element name="Alignment">
+ <xsl:if test="$styleProperties/@fo:text-align">
+ <xsl:attribute name="ss:Horizontal">
+ <xsl:choose>
+ <xsl:when test="$styleProperties/@fo:text-align = 'center'">Center</xsl:when>
+ <xsl:when test="$styleProperties/@fo:text-align = 'end'">Right</xsl:when>
+ <xsl:when test="$styleProperties/@fo:text-align = 'justify'">Justify</xsl:when>
+ <xsl:otherwise>Left</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$styleProperties/@style:vertical-align">
+ <xsl:attribute name="ss:Vertical">
+ <xsl:choose>
+ <xsl:when test="$styleProperties/@style:vertical-align = 'top'">Top</xsl:when>
+ <xsl:when test="$styleProperties/@style:vertical-align = 'bottom'">Bottom</xsl:when>
+ <xsl:when test="$styleProperties/@style:vertical-align = 'middle'">Center</xsl:when>
+ <xsl:otherwise>Automatic</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$styleProperties/@fo:wrap-option = 'wrap'">
+ <xsl:attribute name="ss:WrapText">1</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$styleProperties/@fo:margin-left">
+ <xsl:attribute name="ss:Indent">
+ <xsl:variable name="margin">
+ <xsl:call-template name="convert2pt">
+ <xsl:with-param name="value" select="$styleProperties/@fo:margin-left" />
+ <xsl:with-param name="rounding-factor" select="1" />
+ </xsl:call-template>
+ </xsl:variable>
+ <!-- one ss:Indent is equal to 10 points -->
+ <xsl:value-of select="number($margin) div 10"/>
+ </xsl:attribute>
+ </xsl:if>
+ <!-- Excel is only able to rotate between 90 and -90 degree (inclusive).
+ Other degrees will be mapped by 180 degrees -->
+ <xsl:if test="$styleProperties/@style:rotation-angle">
+ <xsl:attribute name="ss:Rotate">
+ <xsl:choose>
+ <xsl:when test="$styleProperties/@style:rotation-angle &gt; 90">
+ <xsl:choose>
+ <xsl:when test="$styleProperties/@style:rotation-angle &gt;= 270">
+ <xsl:value-of select="$styleProperties/@style:rotation-angle - 360" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$styleProperties/@style:rotation-angle - 180" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$styleProperties/@style:rotation-angle &lt; -90">
+ <xsl:choose>
+ <xsl:when test="$styleProperties/@style:rotation-angle &lt;= -270">
+ <xsl:value-of select="$styleProperties/@style:rotation-angle + 360" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$styleProperties/@style:rotation-angle + 180" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$styleProperties/@style:rotation-angle" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$styleProperties/@style:direction = 'ttb'">
+ <xsl:attribute name="ss:VerticalText">1</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+
+
+ <xsl:template name="Border">
+ <xsl:param name="styleProperties" />
+
+ <!-- An empty border element, might overwrite parents setting by
+ the default attributes -->
+ <xsl:if test="$styleProperties/@fo:border or
+ $styleProperties/@fo:border-bottom or
+ $styleProperties/@fo:border-left or
+ $styleProperties/@fo:border-right or
+ $styleProperties/@fo:border-top">
+ <xsl:element name="Borders">
+ <xsl:if test="$styleProperties/@fo:border-bottom and not($styleProperties/@fo:border-bottom = 'none')">
+ <xsl:element name="Border">
+ <xsl:attribute name="ss:Position">Bottom</xsl:attribute>
+ <xsl:call-template name="border-attributes">
+ <xsl:with-param name="border_properties" select="$styleProperties/@fo:border-bottom" />
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="$styleProperties/@fo:border-left and not($styleProperties/@fo:border-left = 'none')">
+ <xsl:element name="Border">
+ <xsl:attribute name="ss:Position">Left</xsl:attribute>
+ <xsl:call-template name="border-attributes">
+ <xsl:with-param name="border_properties" select="$styleProperties/@fo:border-left" />
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="$styleProperties/@fo:border-right and not($styleProperties/@fo:border-right = 'none')">
+ <xsl:element name="Border">
+ <xsl:attribute name="ss:Position">Right</xsl:attribute>
+ <xsl:call-template name="border-attributes">
+ <xsl:with-param name="border_properties" select="$styleProperties/@fo:border-right" />
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="$styleProperties/@fo:border-top and not($styleProperties/@fo:border-top = 'none')">
+ <xsl:element name="Border">
+ <xsl:attribute name="ss:Position">Top</xsl:attribute>
+ <xsl:call-template name="border-attributes">
+ <xsl:with-param name="border_properties" select="$styleProperties/@fo:border-top" />
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:if>
+ <!-- write out all table border -->
+ <xsl:if test="$styleProperties/@fo:border and not($styleProperties/@fo:border = 'none')">
+ <xsl:element name="Border">
+ <xsl:attribute name="ss:Position">Bottom</xsl:attribute>
+ <xsl:call-template name="border-attributes">
+ <xsl:with-param name="border_properties" select="$styleProperties/@fo:border" />
+ </xsl:call-template>
+ </xsl:element>
+ <xsl:element name="Border">
+ <xsl:attribute name="ss:Position">Left</xsl:attribute>
+ <xsl:call-template name="border-attributes">
+ <xsl:with-param name="border_properties" select="$styleProperties/@fo:border" />
+ </xsl:call-template>
+ </xsl:element>
+ <xsl:element name="Border">
+ <xsl:attribute name="ss:Position">Right</xsl:attribute>
+ <xsl:call-template name="border-attributes">
+ <xsl:with-param name="border_properties" select="$styleProperties/@fo:border" />
+ </xsl:call-template>
+ </xsl:element>
+ <xsl:element name="Border">
+ <xsl:attribute name="ss:Position">Top</xsl:attribute>
+ <xsl:call-template name="border-attributes">
+ <xsl:with-param name="border_properties" select="$styleProperties/@fo:border" />
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+
+
+ <xsl:template name="border-attributes">
+ <xsl:param name="border_properties" />
+
+ <xsl:variable name="border-width">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="substring-before($border_properties, ' ')" />
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="border-style" select="substring-before(substring-after($border_properties, ' '), ' ')" />
+ <xsl:variable name="border-color" select="substring-after(substring-after($border_properties, ' '), ' ')" />
+<!--
+ <xsl:message>border-width:<xsl:value-of select="$border-width" /></xsl:message>
+ <xsl:message>border-style:<xsl:value-of select="$border-style" /></xsl:message>
+ <xsl:message>border-color:<xsl:value-of select="$border-color" /></xsl:message>
+ -->
+
+ <!-- Dash, Dot, DashDot, DashDotDot, SlantDashDot are not supported yet -->
+ <xsl:attribute name="ss:LineStyle">
+ <xsl:choose>
+ <xsl:when test="$border-style = 'none'">None</xsl:when>
+ <xsl:when test="$border-style = 'double'">Double</xsl:when>
+ <xsl:otherwise>Continuous</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+
+ <xsl:attribute name="ss:Weight">
+ <xsl:choose>
+ <!-- 0: Hairline -->
+ <xsl:when test="$border-width &lt;= 0.002">0</xsl:when>
+ <!-- 1: Thin -->
+ <xsl:when test="$border-width &lt;= 0.035">1</xsl:when>
+ <!-- 2: Medium -->
+ <xsl:when test="$border-width &lt;= 0.088">2</xsl:when>
+ <!-- 3: Thick -->
+ <xsl:otherwise>3</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+
+ <xsl:attribute name="ss:Color">
+ <xsl:choose>
+ <xsl:when test="$border-color"><xsl:value-of select="$border-color" /></xsl:when>
+ <xsl:otherwise>Automatic</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:template>
+
+
+ <xsl:template name="Font">
+ <xsl:param name="styleProperties" />
+ <xsl:param name="styleParentName" />
+
+ <!-- An empty font element, might overwrite parents setting by
+ the default attributes -->
+ <xsl:if test="$styleProperties/@style:font-weight or
+ $styleProperties/@fo:color or
+ $styleProperties/@style:font-name or
+ $styleProperties/@fo:font-style or
+ $styleProperties/@style:text-outline or
+ $styleProperties/@style:text-shadow or
+ $styleProperties/@style:font-size or
+ $styleProperties/@style:text-line-through-style or
+ $styleProperties/@style:text-underline-type or
+ $styleProperties/@style:text-underline-style or
+ $styleProperties/@style:text-position">
+
+
+ <xsl:element name="Font">
+ <xsl:call-template name="getParentBold">
+ <xsl:with-param name="styleProperties" select="$styleProperties" />
+ <xsl:with-param name="styleParentName" select="$styleParentName" />
+ </xsl:call-template>
+ <xsl:if test="$styleProperties/@fo:color">
+ <xsl:attribute name="ss:Color"><xsl:value-of select="$styleProperties/@fo:color" /></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$styleProperties/@style:font-name">
+ <xsl:attribute name="ss:FontName"><xsl:value-of select="$styleProperties/@style:font-name" /></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$styleProperties/@fo:font-style = 'italic'">
+ <xsl:attribute name="ss:Italic">1</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$styleProperties/@style:text-outline = 'true'">
+ <xsl:attribute name="ss:Outline">1</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$styleProperties/@style:text-shadow = 'shadow'">
+ <xsl:attribute name="ss:Shadow">1</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$styleProperties/@fo:font-size">
+ <xsl:attribute name="ss:Size">
+ <xsl:call-template name="convert2pt">
+ <xsl:with-param name="value" select="$styleProperties/@fo:font-size" />
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$styleProperties/@style:text-line-through-style and $styleProperties/@style:text-line-through-style != 'none'">
+ <xsl:attribute name="ss:StrikeThrough">1</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="($styleProperties/@style:text-underline-type and $styleProperties/@style:text-underline-type != 'none') or
+ ($styleProperties/@style:text-underline-style and $styleProperties/@style:text-underline-style != 'none')">
+ <xsl:attribute name="ss:Underline">
+ <xsl:choose>
+ <xsl:when test="$styleProperties/@style:text-underline-type = 'double'">Double</xsl:when>
+ <xsl:otherwise>Single</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$styleProperties/@style:text-position">
+ <xsl:attribute name="ss:VerticalAlign">
+ <xsl:choose>
+ <xsl:when test="substring-before($styleProperties/@style:text-position, '% ') &gt; 0">Superscript</xsl:when>
+ <xsl:otherwise>Subscript</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template name="Interior">
+ <xsl:param name="styleProperties" />
+ <xsl:if test="$styleProperties/@fo:background-color and not($styleProperties/@fo:background-color = 'transparent')">
+ <xsl:element name="Interior">
+ <xsl:attribute name="ss:Color">
+ <xsl:value-of select="$styleProperties/@fo:background-color" />
+ </xsl:attribute>
+ <!-- Background color (i.e. Interior/ss:Color) not shown without ss:Pattern (or with 'none')
+ Therefore a default is set -->
+ <xsl:attribute name="ss:Pattern">Solid</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+
+ <!-- Excel issue workaround: <Font ss:Bold="1"> is not inherited -->
+ <xsl:template name="getParentBold">
+ <xsl:param name="styleProperties" />
+ <xsl:param name="styleParentName" />
+ <xsl:param name="styleName" />
+
+ <xsl:if test="$styleParentName and $styleParentName != $styleName">
+ <xsl:choose>
+ <xsl:when test="$styleProperties/@fo:font-weight = 'bold'">
+ <xsl:attribute name="ss:Bold">1</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="getParentBold">
+ <xsl:with-param name="styleProperties" select="key('styles', $styleParentName)/*" />
+ <xsl:with-param name="styleParentName" select="key('styles', $styleParentName)/@style:parent-style-name" />
+ <xsl:with-param name="styleName" select="$styleParentName" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/filter/source/xslt/export/spreadsheetml/table.xsl b/filter/source/xslt/export/spreadsheetml/table.xsl
new file mode 100644
index 000000000000..6813b2510e1c
--- /dev/null
+++ b/filter/source/xslt/export/spreadsheetml/table.xsl
@@ -0,0 +1,937 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
+ xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0"
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:dom="http://www.w3.org/2001/xml-events"
+ xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
+ xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
+ xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
+ xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
+ xmlns:math="http://www.w3.org/1998/Math/MathML"
+ xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
+ xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
+ xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
+ xmlns:ooo="http://openoffice.org/2004/office"
+ xmlns:oooc="http://openoffice.org/2004/calc"
+ xmlns:ooow="http://openoffice.org/2004/writer"
+ xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
+ xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
+ xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
+ xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
+ xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:xt="http://www.jclark.com/xt"
+ xmlns:common="http://exslt.org/common"
+ xmlns:xalan="http://xml.apache.org/xalan"
+ xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:c="urn:schemas-microsoft-com:office:component:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:x2="http://schemas.microsoft.com/office/excel/2003/xml" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ exclude-result-prefixes="chart config dc dom dr3d draw fo form math meta number office ooo oooc ooow script style svg table text xlink xt common xalan">
+
+
+ <!-- ************** -->
+ <!-- *** Table *** -->
+ <!-- ************** -->
+
+ <!-- check existence of default cell style -->
+ <xsl:variable name="firstDefaultCellStyle" select="descendant::table:table-column/@table:default-cell-style-name" />
+
+
+ <xsl:template match="table:table" name="table:table">
+ <xsl:element name="Table">
+ <xsl:apply-templates select="@table:style-name" />
+
+ <!-- find all columns in the table -->
+ <xsl:variable name="columnNodes" select="descendant::table:table-column" />
+ <!-- calculate the overall column amount -->
+ <xsl:variable name="maxColumnNo">
+ <xsl:choose>
+ <xsl:when test="$columnNodes/@table:number-columns-repeated">
+ <xsl:value-of select="count($columnNodes)
+ + number(sum($columnNodes/@table:number-columns-repeated))
+ - count($columnNodes/@table:number-columns-repeated)" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="count($columnNodes)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <!-- create columns -->
+ <xsl:apply-templates select="$columnNodes[1]">
+ <xsl:with-param name="columnNodes" select="$columnNodes" />
+ <xsl:with-param name="maxColumnNo" select="$maxColumnNo" />
+ </xsl:apply-templates>
+
+ <!-- create rows -->
+ <xsl:choose>
+ <xsl:when test="not($columnNodes/@table:number-columns-repeated)">
+ <xsl:call-template name="optimized-row-handling">
+ <xsl:with-param name="rowNodes" select="descendant::table:table-row" />
+ <xsl:with-param name="columnNodes" select="$columnNodes" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- To be able to match from a cell to the corresponding column to match @table:default-cell-style-name,
+ the repeated columns are being resolved by copying them in a helper variable -->
+ <xsl:variable name="columnNodes-RTF">
+ <xsl:for-each select="$columnNodes">
+ <xsl:call-template name="adding-column-styles-entries" />
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="function-available('xalan:nodeset')">
+ <xsl:call-template name="optimized-row-handling">
+ <xsl:with-param name="rowNodes" select="descendant::table:table-row" />
+ <xsl:with-param name="columnNodes" select="xalan:nodeset($columnNodes-RTF)" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="function-available('common:node-set')">
+ <xsl:call-template name="optimized-row-handling">
+ <xsl:with-param name="rowNodes" select="descendant::table:table-row" />
+ <xsl:with-param name="columnNodes" select="common:node-set($columnNodes-RTF)" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="function-available('xt:node-set')">
+ <xsl:call-template name="optimized-row-handling">
+ <xsl:with-param name="rowNodes" select="descendant::table:table-row" />
+ <xsl:with-param name="columnNodes" select="xt:node-set($columnNodes-RTF)" />
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:template>
+
+
+ <!-- **************** -->
+ <!-- *** Columns *** -->
+ <!-- **************** -->
+
+ <xsl:template match="table:table-column">
+ <xsl:param name="columnNodes" />
+ <xsl:param name="currentColumnNumber" select="1" />
+ <xsl:param name="setIndex" select="false()" />
+ <xsl:param name="maxColumnNo" />
+
+ <xsl:element name="Column">
+ <xsl:if test="@table:visibility = 'collapse' or @table:visibility = 'filter'">
+ <xsl:attribute name="ss:Hidden">1</xsl:attribute>
+ </xsl:if>
+
+ <xsl:if test="@table:number-columns-repeated">
+ <xsl:attribute name="ss:Span">
+ <xsl:value-of select="@table:number-columns-repeated - 1" />
+ </xsl:attribute>
+ </xsl:if>
+
+ <xsl:if test="$setIndex">
+ <xsl:attribute name="ss:Index">
+ <xsl:value-of select="$currentColumnNumber" />
+ </xsl:attribute>
+ </xsl:if>
+
+ <xsl:choose>
+ <xsl:when test="@style:use-optimal-column-width = 'true'">
+ <xsl:attribute name="ss:AutoFitWidth">1</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="width" select="key('styles', @table:style-name)/style:table-column-properties/@style:column-width" />
+ <xsl:if test="$width">
+ <xsl:attribute name="ss:Width">
+ <!-- using the absolute width in point -->
+ <xsl:call-template name="convert2pt">
+ <xsl:with-param name="value" select="$width" />
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ <xsl:if test="@table:number-columns-repeated">
+ <xsl:attribute name="ss:Span">
+ <xsl:value-of select="@table:number-columns-repeated - 1" />
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+
+ <xsl:variable name="columnNumber">
+ <xsl:choose>
+ <xsl:when test="@table:number-columns-repeated">
+ <xsl:value-of select="$currentColumnNumber + @table:number-columns-repeated"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$currentColumnNumber"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="$columnNumber &lt; $maxColumnNo">
+ <xsl:variable name="nextColumnNodes" select="$columnNodes[position() != 1]" />
+ <xsl:choose>
+ <xsl:when test="@table:number-columns-repeated">
+ <xsl:apply-templates select="$nextColumnNodes[1]">
+ <xsl:with-param name="columnNodes" select="$nextColumnNodes" />
+ <xsl:with-param name="currentColumnNumber" select="$columnNumber" />
+ <xsl:with-param name="maxColumnNo" select="$maxColumnNo" />
+ <xsl:with-param name="setIndex" select="true()" />
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="$nextColumnNodes[1]">
+ <xsl:with-param name="columnNodes" select="$nextColumnNodes" />
+ <xsl:with-param name="currentColumnNumber" select="$columnNumber + 1" />
+ <xsl:with-param name="maxColumnNo" select="$maxColumnNo" />
+ </xsl:apply-templates>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:template>
+
+ <!-- current node is a table:table-column -->
+ <xsl:template name="adding-column-styles-entries">
+ <xsl:choose>
+ <xsl:when test="not(@table:number-columns-repeated and @table:number-columns-repeated > 1)">
+ <!-- writes an entry of a column in the columns-variable -->
+ <xsl:copy-of select="." />
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- repeated colums will be written explicit several times in the variable-->
+ <xsl:call-template name="repeat-adding-table-column">
+ <xsl:with-param name="numberColumnsRepeated" select="@table:number-columns-repeated" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <!-- current node is a table:table-column -->
+ <!-- dublicates column elements in case of column-repeated attribute -->
+ <xsl:template name="repeat-adding-table-column">
+ <xsl:param name="table:table-column" />
+ <xsl:param name="numberColumnsRepeated" />
+
+ <xsl:choose>
+ <xsl:when test="$numberColumnsRepeated > 1">
+ <!-- writes an entry of a column in the columns-variable -->
+ <xsl:copy-of select="." />
+ <!-- repeat calling this method until all elements written out -->
+ <xsl:call-template name="repeat-adding-table-column">
+ <xsl:with-param name="numberColumnsRepeated" select="$numberColumnsRepeated - 1" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- writes an entry of a column in the columns-variable -->
+ <xsl:copy-of select="." />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <!-- ************* -->
+ <!-- *** Rows *** -->
+ <!-- ************* -->
+
+
+ <!-- Recursions are much faster when the stack size is small -->
+ <xsl:template name="optimized-row-handling">
+ <xsl:param name="rowNodes" />
+ <xsl:param name="columnNodes" />
+ <xsl:param name="offset" select="0"/>
+ <xsl:param name="threshold" select="10"/>
+
+ <xsl:variable name="rowCount" select="count($rowNodes)"/>
+ <xsl:choose>
+ <xsl:when test="$rowCount &lt;= $threshold">
+ <xsl:apply-templates select="$rowNodes[1]">
+ <xsl:with-param name="rowNodes" select="$rowNodes" />
+ <xsl:with-param name="offset" select="$offset" />
+ <xsl:with-param name="columnNodes" select="$columnNodes" />
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="rowCountHalf" select="floor($rowCount div 2)"/>
+ <xsl:variable name="rowNodesSetA" select="$rowNodes[position() &lt;= $rowCountHalf]"/>
+ <xsl:variable name="rowNodesSetB" select="$rowNodes[position() &gt; $rowCountHalf]"/>
+ <!-- to keep track of the rownumber, the repeteated rows have to kept into accounts -->
+ <xsl:variable name="rowsCreatedByRepetition">
+ <xsl:choose>
+ <xsl:when test="$rowNodesSetA/@table:number-rows-repeated">
+ <xsl:value-of select="number(sum($rowNodesSetA/@table:number-rows-repeated))
+ - count($rowNodesSetA/@table:number-rows-repeated)" />
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$rowCountHalf &gt; $threshold">
+ <xsl:call-template name="optimized-row-handling">
+ <xsl:with-param name="rowNodes" select="$rowNodesSetA"/>
+ <xsl:with-param name="offset" select="$offset" />
+ <xsl:with-param name="columnNodes" select="$columnNodes" />
+ </xsl:call-template>
+ <xsl:call-template name="optimized-row-handling">
+ <xsl:with-param name="rowNodes" select="$rowNodesSetB"/>
+ <xsl:with-param name="offset" select="$offset + $rowCountHalf + $rowsCreatedByRepetition" />
+ <xsl:with-param name="columnNodes" select="$columnNodes" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="$rowNodesSetA[1]">
+ <xsl:with-param name="rowNodes" select="$rowNodesSetA"/>
+ <xsl:with-param name="offset" select="$offset" />
+ <xsl:with-param name="columnNodes" select="$columnNodes" />
+ </xsl:apply-templates>
+ <xsl:apply-templates select="$rowNodesSetB[1]">
+ <xsl:with-param name="rowNodes" select="$rowNodesSetB" />
+ <xsl:with-param name="offset" select="$offset + $rowCountHalf + $rowsCreatedByRepetition" />
+ <xsl:with-param name="columnNodes" select="$columnNodes" />
+ </xsl:apply-templates>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!--
+ Rows as "table:table-row" might be grouped in
+ "table:table-header-rows" or "table:table-row-group"
+ This row-tree will be traversed providing each Row with it's
+ calculatedRowPosition and earlierRowNumber.
+ By this repeated empty rows might be neglected in the spreadsheetml output,
+ as the following row will notice the 'gap' and provide @ss:Index,
+ which results in filling up the gap by a row without style and content.
+
+ In Excel created rows by ss:Index are 'default' rows.
+ -->
+ <xsl:template match="table:table-row">
+ <xsl:param name="earlierRowNumber" select="0" />
+ <xsl:param name="offset" />
+ <xsl:param name="calculatedRowPosition" select="$offset + 1" />
+ <xsl:param name="rowNodes" />
+ <xsl:param name="columnNodes" />
+
+ <xsl:choose>
+ <xsl:when test="@table:number-rows-repeated &gt; 1">
+ <xsl:call-template name="write-table-row">
+ <xsl:with-param name="earlierRowNumber" select="$earlierRowNumber" />
+ <xsl:with-param name="calculatedRowPosition" select="$calculatedRowPosition" />
+ <xsl:with-param name="columnNodes" select="$columnNodes" />
+ </xsl:call-template>
+ <xsl:if test="@table:number-rows-repeated &gt; 2 and (table:table-cell/@office:value-type or $firstDefaultCellStyle != '')">
+ <!-- In case a cell is being repeated, the cell will be created
+ in a variabel, which is as many times given out, as being repeated -->
+ <xsl:variable name="tableRow">
+ <xsl:call-template name="write-table-row">
+ <xsl:with-param name="columnNodes" select="$columnNodes" />
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="optimized-row-repeating">
+ <xsl:with-param name="tableRow" select="$tableRow" />
+ <xsl:with-param name="repetition" select="@table:number-rows-repeated - 1" />
+ <xsl:with-param name="columnNodes" select="$columnNodes" />
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="write-table-row">
+ <xsl:with-param name="earlierRowNumber" select="$earlierRowNumber" />
+ <xsl:with-param name="calculatedRowPosition" select="$calculatedRowPosition" />
+ <xsl:with-param name="columnNodes" select="$columnNodes" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ <xsl:variable name="nextRowNodes" select="$rowNodes[position()!=1]" />
+ <xsl:choose>
+ <xsl:when test="@table:number-rows-repeated &gt; 1">
+ <xsl:apply-templates select="$nextRowNodes[1]">
+ <xsl:with-param name="earlierRowNumber" select="$calculatedRowPosition" />
+ <xsl:with-param name="calculatedRowPosition" select="$calculatedRowPosition + @table:number-rows-repeated" />
+ <xsl:with-param name="rowNodes" select="$nextRowNodes" />
+ <xsl:with-param name="columnNodes" select="$columnNodes" />
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="$nextRowNodes[1]">
+ <xsl:with-param name="earlierRowNumber" select="$calculatedRowPosition" />
+ <xsl:with-param name="calculatedRowPosition" select="$calculatedRowPosition + 1" />
+ <xsl:with-param name="rowNodes" select="$nextRowNodes" />
+ <xsl:with-param name="columnNodes" select="$columnNodes" />
+ </xsl:apply-templates>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="write-table-row">
+ <xsl:param name="earlierRowNumber" select="0" />
+ <xsl:param name="calculatedRowPosition" select="1" />
+ <xsl:param name="columnNodes" />
+
+ <xsl:element name="Row">
+ <xsl:if test="@table:visibility = 'collapse' or @table:visibility = 'filter'">
+ <xsl:attribute name="ss:Hidden">1</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="not($earlierRowNumber + 1 = $calculatedRowPosition)">
+ <xsl:attribute name="ss:Index"><xsl:value-of select="$calculatedRowPosition" /></xsl:attribute>
+ </xsl:if>
+
+ <!-- writing the style of the row -->
+ <xsl:apply-templates select="@table:style-name" mode="table-row" />
+
+ <xsl:variable name="rowProperties" select="key('styles', @table:style-name)/*" />
+ <xsl:if test="$rowProperties/@style:use-optimal-row-height = 'false'">
+ <!-- default is '1', therefore write only '0' -->
+ <xsl:attribute name="ss:AutoFitHeight">0</xsl:attribute>
+ </xsl:if>
+
+ <xsl:variable name="height" select="$rowProperties/@style:row-height" />
+ <xsl:if test="$height">
+ <xsl:attribute name="ss:Height">
+ <!-- using the absolute height in point -->
+ <xsl:call-template name="convert2pt">
+ <xsl:with-param name="value" select="$height" />
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates select="table:table-cell[1]">
+ <xsl:with-param name="calculatedRowPosition" select="$calculatedRowPosition" />
+ <xsl:with-param name="cellNodes" select="table:table-cell" />
+ <xsl:with-param name="columnNodes" select="$columnNodes" />
+ </xsl:apply-templates>
+ </xsl:element>
+ </xsl:template>
+
+
+ <!-- Recursions are much faster when the stack size is small -->
+ <xsl:template name="optimized-row-repeating">
+ <xsl:param name="tableRow" />
+ <xsl:param name="repetition" />
+ <!-- resource optimation: instead of '1' it will be '1000' and the column is not full -->
+ <xsl:param name="thresholdmax" select="512"/>
+ <xsl:param name="thresholdmin" select="256"/>
+
+ <xsl:choose>
+ <xsl:when test="$repetition &lt;= $thresholdmax">
+ <xsl:copy-of select="$tableRow" />
+ <xsl:if test="$repetition &lt;= $thresholdmin">
+ <xsl:call-template name="optimized-row-repeating">
+ <xsl:with-param name="repetition" select="$repetition - 1"/>
+ <xsl:with-param name="tableRow" select="$tableRow" />
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="$repetition mod 2 = 1">
+ <xsl:copy-of select="$tableRow" />
+ </xsl:if>
+ <xsl:variable name="repetitionHalf" select="floor($repetition div 2)"/>
+ <xsl:call-template name="optimized-row-repeating">
+ <xsl:with-param name="repetition" select="$repetitionHalf"/>
+ <xsl:with-param name="tableRow" select="$tableRow" />
+ </xsl:call-template>
+ <xsl:call-template name="optimized-row-repeating">
+ <xsl:with-param name="repetition" select="$repetitionHalf"/>
+ <xsl:with-param name="tableRow" select="$tableRow" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+
+ <!-- ************** -->
+ <!-- *** Cells *** -->
+ <!-- ************** -->
+
+ <!-- Table cells are able to be repeated by attribute in StarOffice,
+ but not in Excel. If more cells are repeated -->
+ <xsl:template name="table:table-cell" match="table:table-cell">
+ <xsl:param name="calculatedCellPosition" select="1" /><!-- the later table position of the current cell -->
+ <xsl:param name="calculatedRowPosition" /><!-- the later table position of the current row -->
+ <xsl:param name="setIndex" select="false()" /> <!-- if not '0' @ss:Index used for neglecting repeteated empty cells -->
+ <xsl:param name="repetition" select="@table:number-columns-repeated" /> <!-- used for explicit writen out cells -->
+ <xsl:param name="repetitionCellPosition" select="$calculatedCellPosition" /><!-- during repetition formula needs exact cell positioning -->
+ <xsl:param name="nextMatchedCellPosition"><!-- the later table position of the next cell -->
+ <xsl:choose>
+ <xsl:when test="not(@table:number-columns-repeated) and not(@table:number-columns-spanned)">
+ <xsl:value-of select="$calculatedCellPosition + 1" />
+ </xsl:when>
+ <xsl:when test="not(@table:number-columns-spanned)">
+ <xsl:value-of select="$calculatedCellPosition + @table:number-columns-repeated" />
+ </xsl:when>
+ <xsl:when test="not(@table:number-columns-repeated)">
+ <xsl:value-of select="$calculatedCellPosition + @table:number-columns-spanned" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$calculatedCellPosition + @table:number-columns-spanned * @table:number-columns-repeated" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:param>
+ <xsl:param name="cellNodes" /><!-- cells to be handled -->
+ <xsl:param name="columnNodes" />
+
+ <xsl:choose>
+ <!-- in case a repetition took place -->
+ <xsl:when test="$repetition &gt; 0">
+ <xsl:choose>
+ <!-- In case of no cell content (text, subelements, attribute, except repeated style) the ss:Index could be used -->
+ <xsl:when test="not(text()) and not(*) and not(@*[name() != 'table:number-columns-repeated'])">
+ <xsl:choose>
+ <xsl:when test="count($cellNodes) = 1">
+ <xsl:call-template name="create-table-cell">
+ <xsl:with-param name="setIndex" select="true()" />
+ <xsl:with-param name="calculatedCellPosition" select="$nextMatchedCellPosition - 1" />
+ <xsl:with-param name="calculatedRowPosition" select="$calculatedRowPosition" />
+ <xsl:with-param name="columnNodes" select="$columnNodes" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="$cellNodes[2]">
+ <xsl:with-param name="calculatedCellPosition" select="$nextMatchedCellPosition" />
+ <xsl:with-param name="calculatedRowPosition" select="$calculatedRowPosition" />
+ <xsl:with-param name="setIndex" select="true()" />
+ <xsl:with-param name="cellNodes" select="$cellNodes[position() != 1]" />
+ <xsl:with-param name="columnNodes" select="$columnNodes" />
+ </xsl:apply-templates>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <!-- Fastest cell repetition by creating cell once and copying, works not for
+ a) cells with formula (need of actual cell postition)
+ b) cells, which start with ss:Index (as ss:Index is not allowed to be repeated) -->
+ <xsl:when test="not(@table:formula) and not($setIndex)">
+ <!-- In case a non-empty cell is being repeated, the cell will be created
+ in a variabel, which is as many times given out, as being repeated -->
+ <xsl:variable name="tableCell">
+ <xsl:call-template name="create-table-cell">
+ <xsl:with-param name="setIndex" select="false()" /><!-- copied cells may not have indices -->
+ <xsl:with-param name="columnNodes" select="$columnNodes" />
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="repeat-copy-table-cell">
+ <xsl:with-param name="tableCell" select="$tableCell" />
+ <xsl:with-param name="repetition" select="$repetition" />
+ <xsl:with-param name="columnNodes" select="$columnNodes" />
+ </xsl:call-template>
+ <xsl:apply-templates select="$cellNodes[2]">
+ <xsl:with-param name="calculatedCellPosition" select="$nextMatchedCellPosition" />
+ <xsl:with-param name="calculatedRowPosition" select="$calculatedRowPosition" />
+ <xsl:with-param name="cellNodes" select="$cellNodes[position() != 1]" />
+ <xsl:with-param name="columnNodes" select="$columnNodes" />
+ </xsl:apply-templates>
+ </xsl:when>
+ <!-- explicit writing (instead of copying) of cell for the cases mentioned above -->
+ <xsl:otherwise>
+ <xsl:call-template name="create-table-cell">
+ <xsl:with-param name="setIndex" select="$setIndex" /><!-- a possible Index will be created -->
+ <xsl:with-param name="calculatedCellPosition" select="$repetitionCellPosition" />
+ <xsl:with-param name="calculatedRowPosition" select="$calculatedRowPosition" />
+ <xsl:with-param name="columnNodes" select="$columnNodes" />
+ </xsl:call-template>
+ <xsl:choose>
+ <!-- as long there is a repetition (higher '1') stay on the same cell node -->
+ <xsl:when test="$repetition &gt; 1">
+ <xsl:call-template name="table:table-cell">
+ <xsl:with-param name="calculatedCellPosition" select="$nextMatchedCellPosition" />
+ <xsl:with-param name="calculatedRowPosition" select="$calculatedRowPosition" />
+ <xsl:with-param name="repetitionCellPosition">
+ <xsl:choose>
+ <xsl:when test="@table:number-columns-spanned">
+ <xsl:value-of select="$repetitionCellPosition + @table:number-columns-spanned" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$repetitionCellPosition + 1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="nextMatchedCellPosition" select="$nextMatchedCellPosition" />
+ <xsl:with-param name="repetition" select="$repetition - 1" />
+ <xsl:with-param name="cellNodes" select="$cellNodes" />
+ <xsl:with-param name="columnNodes" select="$columnNodes" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="$cellNodes[2]">
+ <xsl:with-param name="calculatedCellPosition" select="$nextMatchedCellPosition" />
+ <xsl:with-param name="calculatedRowPosition" select="$calculatedRowPosition" />
+ <xsl:with-param name="cellNodes" select="$cellNodes[position() != 1]" />
+ <xsl:with-param name="columnNodes" select="$columnNodes" />
+ </xsl:apply-templates>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- in case no repetition took place -->
+ <xsl:choose>
+ <!-- neglect en empty cells by using ss:Index Attribut -->
+ <xsl:when test="not(text()) and not(*) and not(@*)">
+ <xsl:choose>
+ <!-- if it is the last cell, write this cell -->
+ <xsl:when test="count($cellNodes) = 1">
+ <xsl:call-template name="create-table-cell">
+ <xsl:with-param name="setIndex" select="true()" />
+ <xsl:with-param name="calculatedCellPosition" select="$nextMatchedCellPosition - 1" />
+ <xsl:with-param name="calculatedRowPosition" select="$calculatedRowPosition" />
+ <xsl:with-param name="columnNodes" select="$columnNodes" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="$cellNodes[2]">
+ <xsl:with-param name="setIndex" select="true()" />
+ <xsl:with-param name="calculatedCellPosition" select="$nextMatchedCellPosition" />
+ <xsl:with-param name="calculatedRowPosition" select="$calculatedRowPosition" />
+ <xsl:with-param name="cellNodes" select="$cellNodes[position() != 1]" />
+ <xsl:with-param name="columnNodes" select="$columnNodes" />
+ </xsl:apply-templates>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- create cell and use/unset the ss:Index -->
+ <xsl:call-template name="create-table-cell">
+ <xsl:with-param name="setIndex" select="$setIndex" />
+ <xsl:with-param name="calculatedCellPosition" select="$calculatedCellPosition" />
+ <xsl:with-param name="calculatedRowPosition" select="$calculatedRowPosition" />
+ <xsl:with-param name="columnNodes" select="$columnNodes" />
+ </xsl:call-template>
+ <xsl:apply-templates select="$cellNodes[2]">
+ <xsl:with-param name="calculatedCellPosition" select="$nextMatchedCellPosition" />
+ <xsl:with-param name="calculatedRowPosition" select="$calculatedRowPosition" />
+ <xsl:with-param name="cellNodes" select="$cellNodes[position() != 1]" />
+ <xsl:with-param name="columnNodes" select="$columnNodes" />
+ </xsl:apply-templates>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- Copies the variable 'tableCell' to the output as often as 'repetition' -->
+ <xsl:template name="repeat-copy-table-cell">
+ <xsl:param name="tableCell" />
+ <xsl:param name="repetition" />
+
+ <xsl:if test="$repetition &gt; 0">
+ <xsl:copy-of select="$tableCell"/>
+ <xsl:call-template name="repeat-copy-table-cell">
+ <xsl:with-param name="tableCell" select="$tableCell" />
+ <xsl:with-param name="repetition" select="$repetition - 1" />
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template name="create-table-cell">
+ <xsl:param name="setIndex" select="false()" />
+ <xsl:param name="calculatedCellPosition" />
+ <xsl:param name="calculatedRowPosition" />
+ <xsl:param name="columnNodes" />
+
+ <xsl:element name="Cell" namespace="urn:schemas-microsoft-com:office:spreadsheet">
+ <xsl:if test="$setIndex">
+ <xsl:attribute name="ss:Index">
+ <xsl:value-of select="$calculatedCellPosition"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@table:number-columns-spanned &gt; 1">
+ <xsl:attribute name="ss:MergeAcross">
+ <xsl:value-of select="@table:number-columns-spanned - 1" />
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@table:number-rows-spanned &gt; 1">
+ <xsl:attribute name="ss:MergeDown">
+ <xsl:value-of select="@table:number-rows-spanned - 1" />
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:variable name="link" select="descendant::text:a/@xlink:href" />
+ <xsl:if test="$link">
+ <xsl:attribute name="ss:HRef">
+ <xsl:value-of select="$link" />
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="@table:style-name">
+ <xsl:apply-templates select="@table:style-name" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="$firstDefaultCellStyle != ''">
+ <xsl:variable name="defaultCellStyle" select="$columnNodes/table:table-column[position() = $calculatedCellPosition]/@table:default-cell-style-name" />
+ <xsl:if test="$defaultCellStyle">
+ <xsl:if test="not($defaultCellStyle = 'Default')">
+ <xsl:attribute name="ss:StyleID"><xsl:value-of select="$defaultCellStyle"/></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:apply-templates select="@table:formula">
+ <xsl:with-param name="calculatedCellPosition" select="$calculatedCellPosition" />
+ <xsl:with-param name="calculatedRowPosition" select="$calculatedRowPosition" />
+ </xsl:apply-templates>
+ <xsl:choose>
+ <xsl:when test="*">
+ <!-- in case it is not an empty cell
+
+ As the sequence of comment and data is opposite in Excel and Calc no match work here, in both comments exist only once
+ Possible Table Content of interest: text:h|text:p|text:list -->
+ <xsl:if test="text:h | text:p | text:list">
+ <xsl:variable name="valueType">
+ <xsl:choose>
+ <xsl:when test="@office:value-type">
+ <xsl:value-of select="@office:value-type" />
+ </xsl:when>
+ <xsl:otherwise>string</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:call-template name="ss:Data">
+ <xsl:with-param name="valueType" select="$valueType" />
+ <xsl:with-param name="cellStyleName" select="@table:style-name" />
+ </xsl:call-template>
+ </xsl:if>
+
+ <xsl:if test="office:annotation">
+ <xsl:element name="Comment">
+ <xsl:if test="office:annotation/@office:author">
+ <xsl:attribute name="ss:Author"><xsl:value-of select="office:annotation/@office:author" /></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="office:annotation/@office:display = 'true'">
+ <xsl:attribute name="ss:ShowAlways">1</xsl:attribute>
+ </xsl:if>
+ <!-- ss:Data is oblicatory, but not the same as the ss:Cell ss:Data child, as it has no attributes -->
+ <ss:Data xmlns="http://www.w3.org/TR/REC-html40">
+ <xsl:for-each select="office:annotation/text:p">
+ <xsl:choose>
+ <xsl:when test="*">
+ <!-- paragraph style have to be neglected due to Excel error,
+ which does not allow shadowing their HTML attributes -->
+ <xsl:for-each select="*">
+ <xsl:call-template name="style-and-contents" />
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:when test="@text:style-name">
+ <xsl:call-template name="style-and-contents" />
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- if no style is set, BOLD is set as default -->
+ <B>
+ <xsl:call-template name="style-and-contents" />
+ </B>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </ss:Data>
+ </xsl:element>
+ </xsl:if>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:template>
+
+ <!-- comments are handled separately in the cell -->
+ <xsl:template match="office:annotation" />
+ <xsl:template match="dc:date" />
+
+ <xsl:template name="ss:Data">
+ <!-- the default value is 'String' in the office -->
+ <xsl:param name="valueType" select="'string'" />
+ <xsl:param name="cellStyleName" />
+
+ <xsl:choose>
+ <xsl:when test="descendant::*/@text:style-name">
+ <xsl:choose>
+ <xsl:when test="$valueType = 'string'">
+ <ss:Data ss:Type="String" xmlns="http://www.w3.org/TR/REC-html40">
+ <xsl:apply-templates>
+ <xsl:with-param name="cellStyleName" select="$cellStyleName" />
+ </xsl:apply-templates>
+ </ss:Data>
+ </xsl:when>
+ <xsl:when test="$valueType = 'boolean'">
+ <ss:Data ss:Type="Boolean" xmlns="http://www.w3.org/TR/REC-html40">
+ <xsl:apply-templates>
+ <xsl:with-param name="cellStyleName" select="$cellStyleName" />
+ </xsl:apply-templates>
+ </ss:Data>
+ </xsl:when>
+ <xsl:when test="$valueType = 'date'">
+ <ss:Data ss:Type="DateTime" xmlns="http://www.w3.org/TR/REC-html40">
+ <xsl:apply-templates>
+ <xsl:with-param name="cellStyleName" select="$cellStyleName" />
+ </xsl:apply-templates>
+ </ss:Data>
+ </xsl:when>
+ <!-- float, time, percentage, currency (no 'Error' setting) -->
+ <xsl:otherwise>
+ <ss:Data ss:Type="Number" xmlns="http://www.w3.org/TR/REC-html40">
+ <xsl:apply-templates>
+ <xsl:with-param name="cellStyleName" select="$cellStyleName" />
+ </xsl:apply-templates>
+ </ss:Data>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="Data">
+ <xsl:call-template name="ss:Type">
+ <xsl:with-param name="valueType" select="$valueType" />
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <xsl:template name="ss:Type">
+ <xsl:param name="valueType" select="'string'" />
+
+ <xsl:choose>
+ <xsl:when test="$valueType = 'string'">
+ <xsl:attribute name="ss:Type">String</xsl:attribute>
+ <xsl:apply-templates select="*"/>
+ </xsl:when>
+ <xsl:when test="$valueType = 'boolean'">
+ <xsl:attribute name="ss:Type">Boolean</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="@office:boolean-value = 'true'">1</xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$valueType = 'date' or $valueType = 'time'">
+ <!-- issue in Excel: can not have an empty 'DateTime' cell -->
+ <xsl:attribute name="ss:Type">DateTime</xsl:attribute>
+ <!-- Gathering information of two StarOffice date/time attributes
+ Excel always needs both informations in one attribute -->
+ <xsl:choose>
+ <xsl:when test="@office:date-value">
+ <!-- office:date-value may contain time (after 'T')-->
+ <xsl:choose>
+ <xsl:when test="contains(@office:date-value, 'T')">
+ <!-- in case time is also part of the date -->
+ <xsl:value-of select="substring-before(@office:date-value, 'T')" />
+ <xsl:text>T</xsl:text>
+ <xsl:value-of select="substring-after(@office:date-value,'T')" />
+ <xsl:if test="not(contains(@office:date-value,'.'))">
+ <xsl:text>.</xsl:text>
+ </xsl:if>
+ <xsl:text>000</xsl:text>
+ </xsl:when>
+ <xsl:when test="@office:time-value">
+ <!-- conatains date and time (time will be evaluated later -->
+ <xsl:value-of select="@office:date-value" />
+ <xsl:text>T</xsl:text>
+ <xsl:choose>
+ <xsl:when test="@table:formula or contains(@office:time-value,',')">
+ <!-- customized number types not implemented yet -->
+ <xsl:text>00:00:00.000</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="translate(substring-after(@office:time-value,'PT'),'HMS','::.')" />
+ <xsl:if test="not(contains(@office:time-value,'S'))">
+ <xsl:text>.</xsl:text>
+ </xsl:if>
+ <xsl:text>000</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="@office:date-value" />
+ <xsl:text>T00:00:00.000</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="@office:time-value">
+ <xsl:text>1899-12-31T</xsl:text>
+ <xsl:choose>
+ <xsl:when test="@table:formula or contains(@office:time-value,',')">
+ <!-- customized number types not implemented yet -->
+ <xsl:text>00:00:00.000</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="translate(substring-after(@office:time-value,'PT'),'HMS','::.')" />
+ <xsl:if test="not(contains(@office:time-value,'S'))">
+ <xsl:text>.</xsl:text>
+ </xsl:if>
+ <xsl:text>000</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <!-- float, percentage, currency (no 'Error' setting) -->
+ <xsl:otherwise>
+ <xsl:attribute name="ss:Type">Number</xsl:attribute>
+ <xsl:value-of select="@office:value" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <!-- ******************** -->
+ <!-- *** Common Rules *** -->
+ <!-- ******************** -->
+
+ <xsl:template match="*">
+ <xsl:param name="cellStyleName" />
+
+<!-- LineBreak in Cell -->
+ <xsl:if test="preceding-sibling::text:p[1]"><xsl:text>&#10;</xsl:text></xsl:if>
+ <xsl:call-template name="style-and-contents">
+ <xsl:with-param name="cellStyleName" select="$cellStyleName" />
+ </xsl:call-template>
+ </xsl:template>
+
+ <!-- disabling draw:frames -->
+ <xsl:template match="draw:frame" />
+
+ <xsl:template match="text:s">
+ <xsl:call-template name="write-breakable-whitespace">
+ <xsl:with-param name="whitespaces" select="@text:c" />
+ </xsl:call-template>
+ </xsl:template>
+
+ <!--write the number of 'whitespaces' -->
+ <xsl:template name="write-breakable-whitespace">
+ <xsl:param name="whitespaces" />
+
+ <xsl:text> </xsl:text>
+ <xsl:if test="$whitespaces >= 1">
+ <xsl:call-template name="write-breakable-whitespace">
+ <xsl:with-param name="whitespaces" select="$whitespaces - 1" />
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+
+ <!-- allowing all matched text nodes -->
+ <xsl:template match="text()"><xsl:value-of select="." /></xsl:template>
+
+</xsl:stylesheet>
+
diff --git a/filter/source/xslt/export/uof/odf2uof_presentation.xsl b/filter/source/xslt/export/uof/odf2uof_presentation.xsl
new file mode 100644
index 000000000000..4cc71aea5d8c
--- /dev/null
+++ b/filter/source/xslt/export/uof/odf2uof_presentation.xsl
@@ -0,0 +1,3375 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:smil="urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0" xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" xmlns:uof="http://schemas.uof.org/cn/2003/uof" xmlns:表="http://schemas.uof.org/cn/2003/uof-spreadsheet" xmlns:演="http://schemas.uof.org/cn/2003/uof-slideshow" xmlns:字="http://schemas.uof.org/cn/2003/uof-wordproc" xmlns:数="http://www.w3.org/1998/Math/MathML" xmlns:图="http://schemas.uof.org/cn/2003/graph" exclude-result-prefixes="office style text table draw fo xlink dc meta number presentation svg chart dr3d math form script config ooo ooow oooc dom xforms smil anim">
+ <xsl:output method="xml" indent="no" encoding="UTF-8" version="1.0" standalone="no" omit-xml-declaration="no"/>
+ <xsl:variable name="impresswithUnit">
+ <xsl:value-of select="/office:document/office:styles/style:style[@style:family='graphic']/style:graphic-properties/@svg:stroke-width"/>
+ </xsl:variable>
+ <xsl:variable name="uofUnit">
+ <xsl:choose>
+ <xsl:when test="contains($impresswithUnit,'inch')">inch</xsl:when>
+ <xsl:when test="contains($impresswithUnit,'cm')">cm</xsl:when>
+ <xsl:when test="contains($impresswithUnit,'mm')">mm</xsl:when>
+ <xsl:when test="contains($impresswithUnit,'pt')">pt</xsl:when>
+ <xsl:otherwise>cm</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="cm-to-other">
+ <xsl:choose>
+ <xsl:when test="$uofUnit='cm'">1</xsl:when>
+ <xsl:when test="$uofUnit='inch'">0.394</xsl:when>
+ <xsl:when test="$uofUnit='pt'">28.346</xsl:when>
+ <xsl:when test="$uofUnit='mm'">10</xsl:when>
+ <xsl:when test="$uofUnit='pica'">2.364</xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:key match="/office:document/office:automatic-styles/style:style | /office:document/office:styles/style:style" name="graphicset" use="@style:name"/>
+ <xsl:template match="/">
+ <xsl:apply-templates select="office:document"/>
+ </xsl:template>
+ <xsl:template match="office:document">
+ <uof:UOF xmlns:uof="http://schemas.uof.org/cn/2003/uof" xmlns:图="http://schemas.uof.org/cn/2003/graph" xmlns:数="http://www.w3.org/1998/Math/MathML" xmlns:字="http://schemas.uof.org/cn/2003/uof-wordproc" xmlns:演="http://schemas.uof.org/cn/2003/uof-slideshow" xmlns:表="http://schemas.uof.org/cn/2003/uof-spreadsheet" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" uof:language="cn" uof:version="1.0" uof:locID="u0000" uof:mimetype="vnd.uof.presentation">
+ <xsl:apply-templates select="office:meta"/>
+ <xsl:if test="//text:bookmark|//text:bookmark-start">
+ <uof:书签集 uof:locID="u0027">
+ <xsl:for-each select="//text:bookmark|//text:bookmark-start">
+ <uof:书签 uof:å称="{@text:name}" uof:locID="u0028" uof:attrList="å称">
+ <uof:文本ä½ç½® uof:区域引用="{generate-id(.)}" uof:locID="u0029" uof:attrList="区域引用"/>
+ </uof:书签>
+ </xsl:for-each>
+ </uof:书签集>
+ </xsl:if>
+ <xsl:if test="/office:document/office:body/text:p/text:a | /office:document/office:body/text:p/draw:a">
+ <uof:链接集 uof:locID="u0031">
+ <xsl:for-each select="/office:document/office:body/text:p/text:a | /office:document/office:body/text:p/draw:a">
+ <xsl:variable name="hyperStr" select="@xlink:href"/>
+ <uof:超级链接 uof:locID="u0032" uof:attrList="标识符 目标 书签 å¼æ ·å¼•ç”¨ 已访问å¼æ ·å¼•ç”¨ æ示 链æº">
+ <xsl:if test="contains($hyperStr,'#')">
+ <xsl:attribute name="uof:书签"><xsl:value-of select="substring-after($hyperStr,'#')"/></xsl:attribute>
+ <xsl:attribute name="uof:æ示"><xsl:value-of select="."/></xsl:attribute>
+ </xsl:if>
+ <xsl:variable name="num">
+ <xsl:number from="/office:document/office:body" level="any" count="text:p[text:a]"/>
+ </xsl:variable>
+ <xsl:attribute name="uof:链æº"><xsl:value-of select="concat('hlnk',$num)"/></xsl:attribute>
+ <xsl:attribute name="uof:标识符"><xsl:value-of select="concat('hyk_','hlnk',$num)"/></xsl:attribute>
+ <xsl:if test="not(contains($hyperStr,'#'))">
+ <xsl:attribute name="uof:目标"><xsl:value-of select="$hyperStr"/></xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="contains($hyperStr,'@')">
+ <xsl:attribute name="uof:æ示">链接到邮件地å€</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="uof:æ示">链接文件</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="@text:style-name">
+ <xsl:attribute name="uof:å¼æ ·å¼•ç”¨"><xsl:value-of select="@text:style-name"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@text:visited-style-name">
+ <xsl:attribute name="uof:已访问å¼æ ·å¼•ç”¨"><xsl:value-of select="@text:visited-style-name"/></xsl:attribute>
+ </xsl:if>
+ </uof:超级链接>
+ </xsl:for-each>
+ </uof:链接集>
+ </xsl:if>
+ <uof:对象集 uof:locID="u0033">
+ <xsl:apply-templates select="office:master-styles/style:handout-master" mode="styles"/>
+ <xsl:apply-templates select="office:master-styles/style:master-page" mode="styles"/>
+ <xsl:apply-templates select="office:body/office:presentation/draw:page" mode="styles"/>
+ <xsl:apply-templates select="office:styles/style:presentation-page-layout/presentation:placeholder" mode="graphic"/>
+ <xsl:apply-templates select="office:body/office:presentation/draw:page/presentation:notes" mode="styles"/>
+ <xsl:for-each select="(/office:document/office:styles/draw:fill-image) | (/office:document/office:automatic-styles/draw:fill-image)">
+ <uof:其他对象 uof:locID="u0036" uof:attrList="标识符 内嵌 公共类型 ç§æœ‰ç±»åž‹">
+ <xsl:attribute name="uof:标识符"><xsl:value-of select="@draw:name"/></xsl:attribute>
+ <xsl:attribute name="uof:公共类型">jpg</xsl:attribute>
+ <xsl:attribute name="uof:内嵌">true</xsl:attribute>
+ <uof:æ•°æ® uof:locID="u0037">
+ <xsl:value-of select="office:binary-data"/>
+ </uof:æ•°æ®>
+ </uof:其他对象>
+ </xsl:for-each>
+ <xsl:for-each select="(/office:document/office:styles/style:style/style:graphic-properties/text:list-style/text:list-level-style-image) | (/office:document/office:automatic-styles/style:style/style:graphic-properties/text:list-style/text:list-level-style-image)">
+ <uof:其他对象 uof:locID="u0036" uof:attrList="标识符 内嵌 公共类型 ç§æœ‰ç±»åž‹">
+ <xsl:attribute name="uof:标识符"><xsl:value-of select="concat('image_numbering_',count(preceding::text:list-level-style-image))"/></xsl:attribute>
+ <xsl:attribute name="uof:公共类型">jpg</xsl:attribute>
+ <xsl:attribute name="uof:内嵌">true</xsl:attribute>
+ <uof:æ•°æ® uof:locID="u0037">
+ <xsl:value-of select="office:binary-data"/>
+ </uof:æ•°æ®>
+ </uof:其他对象>
+ </xsl:for-each>
+ </uof:对象集>
+ <uof:å¼æ ·é›† uof:locID="u0039">
+ <xsl:apply-templates select="office:font-face-decls"/>
+ <xsl:element name="uof:自动编å·é›†">
+ <xsl:attribute name="uof:locID">u0042</xsl:attribute>
+ <xsl:for-each select="/office:document//text:list-style">
+ <xsl:element name="å­—:自动编å·">
+ <xsl:attribute name="uof:locID">t0169</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符 å称 父编å·å¼•ç”¨ 多级编å·</xsl:attribute>
+ <xsl:attribute name="字:标识符">
+ <xsl:variable name="count1" select="count(preceding::text:list-style)"/>
+ <xsl:choose><xsl:when test="@style:name"><xsl:value-of select="concat(@style:name,$count1)"/></xsl:when><xsl:otherwise><xsl:value-of select="concat(../../@style:name,$count1)"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="å­—:å称"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <xsl:attribute name="å­—:多级编å·">true</xsl:attribute>
+ <xsl:for-each select="./* ">
+ <xsl:if test="number(@text:level) &lt; 10">
+ <xsl:element name="字:级别">
+ <xsl:attribute name="uof:locID">t0159</xsl:attribute>
+ <xsl:attribute name="uof:attrList">级别值 ç¼–å·å¯¹é½æ–¹å¼ å°¾éšå­—符</xsl:attribute>
+ <xsl:attribute name="字:级别值"><xsl:value-of select="number(@text:level)"/></xsl:attribute>
+ <xsl:if test="style:list-level-properties/@fo:text-align">
+ <xsl:attribute name="å­—:ç¼–å·å¯¹é½æ–¹å¼"><xsl:value-of select="style:list-level-properties/@fo:text-align"/></xsl:attribute>
+ </xsl:if>
+ <xsl:variable name="level">
+ <xsl:value-of select="@text:level"/>
+ </xsl:variable>
+ <xsl:if test="office:binary-data">
+ <xsl:element name="å­—:图片符å·å¼•ç”¨" uof:locID="t0164" uof:attrList="宽度 高度">
+ <xsl:attribute name="字:宽度"><xsl:value-of select="substring-before(style:list-level-properties/@fo:width,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="字:高度"><xsl:value-of select="substring-before(style:list-level-properties/@fo:height,$uofUnit)"/></xsl:attribute>
+ <xsl:value-of select="concat('image_numbering_',count(preceding::text:list-level-style-image))"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="@text:bullet-char">
+ <xsl:element name="å­—:项目符å·">
+ <xsl:attribute name="uof:locID">t0171</xsl:attribute>
+ <xsl:value-of select="@text:bullet-char"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="å­—:符å·å­—体">
+ <xsl:attribute name="uof:locID">t0160</xsl:attribute>
+ <xsl:attribute name="uof:attrList">å¼æ ·å¼•ç”¨</xsl:attribute>
+ <xsl:call-template name="å­—:å¥å±žæ€§"/>
+ </xsl:element>
+ <xsl:if test="@style:num-format">
+ <xsl:choose>
+ <xsl:when test="string(@style:num-format)='a'">
+ <xsl:element name="å­—:ç¼–å·æ ¼å¼" uof:locID="t0162">lower-letter</xsl:element>
+ </xsl:when>
+ <xsl:when test="string(@style:num-format)='A'">
+ <xsl:element name="å­—:ç¼–å·æ ¼å¼" uof:locID="t0162">upper-letter</xsl:element>
+ </xsl:when>
+ <xsl:when test="string(@style:num-format)='i'">
+ <xsl:element name="å­—:ç¼–å·æ ¼å¼" uof:locID="t0162">lower-roman</xsl:element>
+ </xsl:when>
+ <xsl:when test="string(@style:num-format)='I'">
+ <xsl:element name="å­—:ç¼–å·æ ¼å¼" uof:locID="t0162">upper-roman</xsl:element>
+ </xsl:when>
+ <xsl:when test="string(@style:num-format)='â‘ , â‘¡, â‘¢, ...'">
+ <xsl:element name="å­—:ç¼–å·æ ¼å¼" uof:locID="t0162">decimal-enclosed-circle</xsl:element>
+ </xsl:when>
+ <xsl:when test="string(@style:num-format)='甲, 乙, 丙, ...'">
+ <xsl:element name="å­—:ç¼–å·æ ¼å¼" uof:locID="t0162">ideograph-traditional</xsl:element>
+ </xsl:when>
+ <xsl:when test="string(@style:num-format)='å­, 丑, 寅, ...'">
+ <xsl:element name="å­—:ç¼–å·æ ¼å¼" uof:locID="t0162">ideograph-zodiac</xsl:element>
+ </xsl:when>
+ <xsl:when test="string(@style:num-format)='一, 二, 三, ...'">
+ <xsl:element name="å­—:ç¼–å·æ ¼å¼" uof:locID="t0162">chinese-counting</xsl:element>
+ </xsl:when>
+ <xsl:when test="string(@style:num-format)='壹, è´°, å, ...'">
+ <xsl:element name="å­—:ç¼–å·æ ¼å¼" uof:locID="t0162">chinese-legal-simplified</xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="å­—:ç¼–å·æ ¼å¼" uof:locID="t0162">decimal</xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:variable name="jibie">
+ <xsl:value-of select="position()"/>
+ </xsl:variable>
+ <xsl:variable name="xianshijibie">
+ <xsl:choose>
+ <xsl:when test="@text:display-levels">
+ <xsl:value-of select="@text:display-levels"/>
+ </xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <å­—:ç¼–å·æ ¼å¼è¡¨ç¤º uof:locID="t0163">
+ <xsl:call-template name="å­—:ç¼–å·æ ¼å¼è¡¨ç¤º">
+ <xsl:with-param name="bubianjibie" select="$jibie"/>
+ <xsl:with-param name="jibie" select="$jibie"/>
+ <xsl:with-param name="xianshijibie" select="$xianshijibie"/>
+ <xsl:with-param name="biaoshi" select="concat(string(@style:num-prefix),'%',$jibie,string(@style:num-suffix))"/>
+ </xsl:call-template>
+ </å­—:ç¼–å·æ ¼å¼è¡¨ç¤º>
+ <xsl:element name="字:缩进">
+ <xsl:attribute name="uof:locID">t0165</xsl:attribute>
+ <xsl:call-template name="字:缩进类型"/>
+ </xsl:element>
+ <xsl:element name="å­—:制表符ä½ç½®">
+ <xsl:attribute name="uof:locID">t0166</xsl:attribute>
+ <xsl:value-of select="substring-before(style:list-level-properties/@text:min-label-width,$uofUnit)"/>
+ </xsl:element>
+ <xsl:if test="@text:start-value">
+ <xsl:element name="å­—:起始编å·">
+ <xsl:value-of select="@text:start-value"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="@text:num-regular-exp">
+ <xsl:element name="å­—:正规格å¼" uof:locID="t0168" uof:attrList="值">
+ <xsl:attribute name="值"><xsl:value-of select="@text:num-regular-exp"/></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:element>
+ <xsl:for-each select="/office:document//text:list-style/*">
+ <xsl:if test="style:text-properties/@fo:font-family">
+ <xsl:element name="uof:å¥å¼æ ·">
+ <xsl:attribute name="uof:locID">u0043</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符 å称 类型 别å 基å¼æ ·å¼•ç”¨</xsl:attribute>
+ <xsl:variable name="count"><xsl:value-of select="count(preceding::node())"/></xsl:variable>
+ <xsl:attribute name="字:标识符"><xsl:value-of select="concat('ID',$count)"/></xsl:attribute>
+ <xsl:attribute name="å­—:å称"><xsl:value-of select="concat(ancestor::style:style/@style:name,@text:level)"/></xsl:attribute>
+ <xsl:attribute name="字:类型">auto</xsl:attribute>
+ <xsl:if test="ancestor::style:style/@style:parent-style-name">
+ <xsl:attribute name="å­—:基å¼æ ·å¼•ç”¨"><xsl:value-of select="ancestor::style:style/@style:parent-style-name"/></xsl:attribute>
+ </xsl:if>
+ <xsl:call-template name="å­—:å¥å±žæ€§"/>
+ </xsl:element>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:apply-templates select="office:styles | office:automatic-styles" mode="style"/>
+ <xsl:for-each select="/office:document/office:master-styles/style:master-page">
+ <xsl:for-each select="child::draw:frame">
+ <xsl:variable name="stylename" select="@presentation:style-name"/>
+ <xsl:variable name="parent" select="/office:document/office:automatic-styles/style:style[@style:name=$stylename]/@style:parent-style-name"/>
+ <xsl:for-each select="/office:document/*/style:style[@style:name=$parent]">
+ <xsl:if test="not(contains(@style:name,'outline'))">
+ <xsl:call-template name="段è½å¼æ ·"/>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:for-each>
+ </xsl:for-each>
+ <xsl:for-each select="/office:document/office:styles/style:style[contains(@style:name,'outline')]">
+ <xsl:call-template name="段è½å¼æ ·"/>
+ </xsl:for-each>
+ </uof:å¼æ ·é›†>
+ <uof:演示文稿 uof:locID="u0048">
+ <æ¼”:公用处ç†è§„则 uof:locID="p0000">
+ <xsl:element name="æ¼”:度é‡å•ä½">
+ <xsl:attribute name="uof:locID">p0055</xsl:attribute>
+ <xsl:value-of select="$uofUnit"/>
+ </xsl:element>
+ <æ¼”:页é¢è®¾ç½®é›† uof:locID="p0001">
+ <xsl:apply-templates select="office:automatic-styles/style:page-layout"/>
+ </æ¼”:页é¢è®¾ç½®é›†>
+ <æ¼”:é…色方案集 uof:locID="p0007">
+ <xsl:for-each select="/office:document/office:master-styles/*[@draw:style-name]">
+ <xsl:call-template name="é…色方案"/>
+ </xsl:for-each>
+ <xsl:for-each select="/office:document/office:body/office:presentation/draw:page">
+ <xsl:call-template name="é…色方案"/>
+ </xsl:for-each>
+ </æ¼”:é…色方案集>
+ <æ¼”:页é¢ç‰ˆå¼é›† uof:locID="p0017">
+ <xsl:apply-templates select="office:styles/style:presentation-page-layout" mode="pagestyle"/>
+ </æ¼”:页é¢ç‰ˆå¼é›†>
+ <xsl:if test="office:styles/style:style='标准-title' or office:styles/style:style='标准-outline'" >
+ <æ¼”:文本å¼æ ·é›† uof:locID="p0131">
+ <xsl:for-each select="office:styles/style:style">
+ <xsl:variable name="name"><xsl:value-of select="@style:name"/></xsl:variable>
+ <xsl:if test="$name='标准-title' or contains($name,'标准-outline')">
+ <æ¼”:文本å¼æ · uof:locID="p0132" uof:attrList="标识符 å称">
+ <xsl:attribute name="演:标识符">text-style</xsl:attribute>
+ <xsl:attribute name="æ¼”:å称">文本å¼æ ·</xsl:attribute>
+ <xsl:element name="æ¼”:段è½å¼æ ·">
+ <xsl:attribute name="字:标识符"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <xsl:attribute name="字:类型">auto</xsl:attribute>
+ <xsl:if test="@style:parent-style-name">
+ <xsl:attribute name="å­—:基å¼æ ·å¼•ç”¨"><xsl:value-of select="@style:parent-style-name"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="å­—:å称"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <xsl:attribute name="å­—:别å"><xsl:value-of select="@style:class"/></xsl:attribute>
+ <xsl:call-template name="ParaAttribute">
+ <xsl:with-param name="text-style-name" select="@text:style-name"/>
+ </xsl:call-template>
+ <xsl:call-template name="å­—:å¥å±žæ€§"/>
+ </xsl:element>
+ </æ¼”:文本å¼æ ·>
+ </xsl:if>
+ </xsl:for-each>
+ </æ¼”:文本å¼æ ·é›†>
+ </xsl:if>
+ <演:显示比例 uof:locID="p0020">
+ <xsl:variable name="VisibleAreaWidth">
+ <xsl:value-of select="/office:document/office:settings/config:config-item-set/config:config-item-map-indexed/config:config-item-map-entry/config:config-item[@config:name='VisibleAreaWidth']"/>
+ </xsl:variable>
+ <xsl:value-of select="substring-before((13997 div $VisibleAreaWidth)*100,'.')"/>
+ </演:显示比例>
+ <演:放映设置 uof:locID="p0021">
+ <æ¼”:å¹»ç¯ç‰‡åºåˆ— uof:locID="p0022" uof:attrList="标识符 å称 自定义">
+ <xsl:attribute name="演:标识符">customList</xsl:attribute>
+ <xsl:attribute name="æ¼”:å称">å¹»ç¯ç‰‡åºåˆ—</xsl:attribute>
+ <xsl:attribute name="演:自定义">true</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="office:body/office:presentation/presentation:settings/@presentation:start-page">
+ <xsl:variable name="start-page">
+ <xsl:value-of select="office:body/office:presentation/presentation:settings/@presentation:start-page"/>
+ </xsl:variable>
+ <xsl:variable name="before-slides">
+ <xsl:call-template name="å¹»ç¯ç‰‡åºåˆ—">
+ <xsl:with-param name="start-node" select="office:body/office:presentation/draw:page[@draw:name=$start-page]"/>
+ <xsl:with-param name="end-node" select="office:body/office:presentation/draw:page[last()]"/>
+ <xsl:with-param name="value"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="after-slides">
+ <xsl:for-each select="office:body/office:presentation/draw:page[@draw:name=$start-page]">
+ <xsl:call-template name="å¹»ç¯ç‰‡åºåˆ—">
+ <xsl:with-param name="start-node" select="/office:document/office:body/office:presentation/draw:page[1]"/>
+ <xsl:with-param name="end-node" select="preceding-sibling::node()[1]"/>
+ <xsl:with-param name="value"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:value-of select="concat($before-slides,' ',$after-slides)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="å¹»ç¯ç‰‡åºåˆ—">
+ <xsl:with-param name="start-node" select="office:body/office:presentation/draw:page[1]"/>
+ <xsl:with-param name="end-node" select="office:body/office:presentation/draw:page[last()]"/>
+ <xsl:with-param name="value"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </æ¼”:å¹»ç¯ç‰‡åºåˆ—>
+ <æ¼”:æ”¾æ˜ é¡ºåº uof:locID="p0023" uof:attrList="å称 åºåˆ—引用">
+ <xsl:attribute name="æ¼”:å称">放映顺åº</xsl:attribute>
+ <xsl:attribute name="æ¼”:åºåˆ—引用">customList</xsl:attribute>
+ </æ¼”:放映顺åº>
+ <æ¼”:å…¨å±æ”¾æ˜  uof:locID="p0024">
+ <xsl:choose>
+ <xsl:when test="office:body/office:presentation/presentation:settings/@presentation:full-screen='false'">false</xsl:when>
+ <xsl:otherwise>true</xsl:otherwise>
+ </xsl:choose>
+ </æ¼”:å…¨å±æ”¾æ˜ >
+ <演:循环放映 uof:locID="p0025">
+ <xsl:choose>
+ <xsl:when test="office:body/office:presentation/presentation:settings/@presentation:endless='true'">true</xsl:when>
+ <xsl:otherwise>false</xsl:otherwise>
+ </xsl:choose>
+ </演:循环放映>
+ <xsl:if test="office:body/office:presentation/presentation:settings/@presentation:pause">
+ <演:放映间隔 uof:locID="p0026">
+ <xsl:variable name="hms">
+ <xsl:value-of select="substring-after(office:body/office:presentation/presentation:settings/@presentation:pause,'PT')"/>
+ </xsl:variable>
+ <xsl:value-of select="concat('P0Y0M0DT',$hms)"/>
+ </演:放映间隔>
+ </xsl:if>
+ <æ¼”:æ‰‹åŠ¨æ–¹å¼ uof:locID="p0027">
+ <xsl:choose>
+ <xsl:when test="office:body/office:presentation/presentation:settings/@presentation:force-manual='true'">true</xsl:when>
+ <xsl:otherwise>false</xsl:otherwise>
+ </xsl:choose>
+ </æ¼”:手动方å¼>
+ <演:导航帮助 uof:locID="p0029">
+ <xsl:choose>
+ <xsl:when test="office:body/office:presentation/presentation:settings/@presentation:start-with-navigator='true'">true</xsl:when>
+ <xsl:otherwise>false</xsl:otherwise>
+ </xsl:choose>
+ </演:导航帮助>
+ <演:放映动画 uof:locID="p0030">
+ <xsl:choose>
+ <xsl:when test="office:body/office:presentation/presentation:settings/@presentation:animations='disabled'">false</xsl:when>
+ <xsl:otherwise>true</xsl:otherwise>
+ </xsl:choose>
+ </演:放映动画>
+ <æ¼”:å‰ç«¯æ˜¾ç¤º uof:locID="p0031">
+ <xsl:choose>
+ <xsl:when test="office:body/office:presentation/presentation:settings/@presentation:stay-on-top='true'">true</xsl:when>
+ <xsl:otherwise>false</xsl:otherwise>
+ </xsl:choose>
+ </æ¼”:å‰ç«¯æ˜¾ç¤º>
+ </演:放映设置>
+ </æ¼”:公用处ç†è§„则>
+ <演:主体 uof:locID="p0034">
+ <æ¼”:æ¯ç‰ˆé›† uof:locID="p0035">
+ <xsl:apply-templates select="office:master-styles"/>
+ </æ¼”:æ¯ç‰ˆé›†>
+ <æ¼”:å¹»ç¯ç‰‡é›† uof:locID="p0039">
+ <xsl:apply-templates select="office:body/office:presentation/draw:page"/>
+ </æ¼”:å¹»ç¯ç‰‡é›†>
+ </演:主体>
+ </uof:演示文稿>
+ </uof:UOF>
+ </xsl:template>
+<xsl:template name="é…色方案">
+ <xsl:variable name="page-name"><xsl:value-of select="@draw:style-name"/></xsl:variable>
+ <æ¼”:é…色方案 uof:locID="p0008" uof:attrList="标识符 å称 类型">
+ <xsl:attribute name="演:标识符">
+ <xsl:choose>
+ <xsl:when test="@draw:name"><xsl:value-of select="@draw:name"/></xsl:when>
+ <xsl:otherwise><xsl:value-of select="@draw:style-name"/></xsl:otherwise>
+ </xsl:choose>
+
+ </xsl:attribute>
+ <xsl:for-each select="/office:document/office:automatic-styles/style:style[@style:name = $page-name]">
+ <xsl:attribute name="æ¼”:å称"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <xsl:attribute name="演:类型"><xsl:choose><xsl:when test="not(contains(@style:name,'color'))">custom</xsl:when><xsl:otherwise>standard</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="style:drawing-page-properties/@draw:fill-color">
+ <演:背景色 uof:locID="p0009">
+ <xsl:value-of select="style:drawing-page-properties/@draw:fill-color"/>
+ </演:背景色>
+ </xsl:if>
+ <xsl:if test="style:drawing-page-properties/@svg:stroke-color">
+ <æ¼”:æ–‡æœ¬å’Œçº¿æ¡ uof:locID="p0010">
+ <xsl:value-of select="style:drawing-page-properties/@svg:stroke-color"/>
+ </æ¼”:文本和线æ¡>
+ </xsl:if>
+ <xsl:if test="style:drawing-page-properties/@draw:shadow-color">
+ <演:阴影 uof:locID="p0011">
+ <xsl:value-of select="style:drawing-page-properties/@draw:shadow-color"/>
+ </演:阴影>
+ </xsl:if>
+ <xsl:if test="style:drawing-page-properties/@svg:stroke-color">
+ <演:标题文本 uof:locID="p0012">
+ <xsl:value-of select="style:drawing-page-properties/@svg:stroke-color"/>
+ </演:标题文本>
+ </xsl:if>
+ <xsl:if test="style:drawing-page-properties/@draw:fill-color">
+ <æ¼”:å¡«å…… uof:locID="p0013">
+ <xsl:value-of select="style:drawing-page-properties/@draw:fill-color"/>
+ </æ¼”:å¡«å……>
+ </xsl:if>
+ <演:强调 uof:locID="p0014">#FFFFFF</演:强调>
+ <演:强调和超级链接 uof:locID="p0015">#FF0000</演:强调和超级链接>
+ <æ¼”:强调和尾éšè¶…级链接 uof:locID="p0016">#FF00FF</æ¼”:强调和尾éšè¶…级链接>
+ </xsl:for-each>
+ </æ¼”:é…色方案>
+</xsl:template>
+ <xsl:template name="å¹»ç¯ç‰‡åºåˆ—">
+ <xsl:param name="start-node"/>
+ <xsl:param name="end-node"/>
+ <xsl:param name="value"/>
+ <xsl:choose>
+ <xsl:when test="not($start-node/@draw:name = $end-node/@draw:name)">
+ <xsl:for-each select="$start-node">
+ <xsl:variable name="value1">
+ <xsl:value-of select="concat($value,@draw:name,'_',@draw:style-name,' ')"/>
+ </xsl:variable>
+ <xsl:call-template name="å¹»ç¯ç‰‡åºåˆ—">
+ <xsl:with-param name="start-node" select="following-sibling::node()[1]"/>
+ <xsl:with-param name="end-node" select="$end-node"/>
+ <xsl:with-param name="value" select="$value1"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat($value,$start-node/@draw:name)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="å­—:ç¼–å·æ ¼å¼è¡¨ç¤º">
+ <xsl:param name="bubianjibie"/>
+ <xsl:param name="jibie"/>
+ <xsl:param name="xianshijibie"/>
+ <xsl:param name="biaoshi"/>
+ <xsl:choose>
+ <xsl:when test="number($xianshijibie)= 1">
+ <xsl:value-of select="$biaoshi"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="num-prefix">
+ <xsl:value-of select="preceding-sibling::*[number($bubianjibie -$jibie +1)]/@style:num-prefix"/>
+ </xsl:variable>
+ <xsl:variable name="num-suffix">
+ <xsl:value-of select="preceding-sibling::*[number($bubianjibie -$jibie +1)]/@style:num-suffix"/>
+ </xsl:variable>
+ <xsl:call-template name="å­—:ç¼–å·æ ¼å¼è¡¨ç¤º">
+ <xsl:with-param name="bubianjibie" select="$bubianjibie"/>
+ <xsl:with-param name="jibie" select="$jibie -1"/>
+ <xsl:with-param name="xianshijibie" select="$xianshijibie -1"/>
+ <xsl:with-param name="biaoshi" select="concat($num-prefix,'%',number($jibie -1),$num-suffix,'.',$biaoshi)"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="å­—:å¥å±žæ€§">
+ <xsl:element name="字:字体">
+ <xsl:attribute name="uof:locID">t0088</xsl:attribute>
+ <xsl:attribute name="uof:attrList">西文字体引用 中文字体引用 特殊字体引用 西文绘制 å­—å· ç›¸å¯¹å­—å· é¢œè‰²</xsl:attribute>
+ <xsl:if test=".//@fo:font-size or .//@style:font-size-asian or .//@style:font-size-complex">
+ <xsl:choose>
+ <xsl:when test="contains(.//@fo:font-size,'%') or contains(.//@style:font-size-asian,'%')">
+ <xsl:attribute name="å­—:相对字å·"><xsl:choose><xsl:when test=".//@fo:font-size"><xsl:value-of select="substring-before(.//@fo:font-size,'%')"/></xsl:when><xsl:when test=".//@style:font-size-asian"><xsl:value-of select="substring-before(.//@style:font-size-asian,'%')"/></xsl:when></xsl:choose></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="å­—:å­—å·"><xsl:choose><xsl:when test=".//@fo:font-size"><xsl:value-of select="substring-before(.//@fo:font-size,'pt')"/></xsl:when><xsl:when test=".//@style:font-size-asian"><xsl:value-of select="substring-before(.//@style:font-size-asian,'pt')"/></xsl:when><xsl:when test=".//@style:font-size-complex"><xsl:value-of select="substring-before(.//@style:font-size-complex,'pt')"/></xsl:when></xsl:choose></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test=".//@style:font-name">
+ <xsl:attribute name="字:西文字体引用"><xsl:value-of select=".//@style:font-name"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test=".//@style:font-name-asian">
+ <xsl:attribute name="字:中文字体引用"><xsl:value-of select=".//@style:font-name-asian"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test=".//@fo:color">
+ <xsl:attribute name="字:颜色"><xsl:value-of select=".//@fo:color"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:if test=".//@style:text-background-color and not(.//@style:text-background-color='transparent')">
+ <xsl:element name="å­—:å¡«å……">
+ <xsl:element name="图:图案">
+ <xsl:attribute name="uof:locID">g0036</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 图形引用 å‰æ™¯è‰² 背景色</xsl:attribute>
+ <xsl:if test=".//@style:text-background-color">
+ <xsl:attribute name="图:å‰æ™¯è‰²"><xsl:value-of select=".//@style:text-background-color"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test=".//@fo:font-weight or .//@style:font-weight-asian">
+ <xsl:element name="字:粗体">
+ <xsl:attribute name="uof:locID">t0089</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test=".//@style:font-weight-asian='bold' or .//@fo:font-weight='bold'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test=".//@fo:font-style or .//@style:font-style-asian">
+ <xsl:element name="字:斜体">
+ <xsl:attribute name="uof:locID">t0090</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test=".//@fo:font-style='italic' or .//@style:font-style-asian='italic'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test=".//@style:text-crossing-out">
+ <xsl:element name="字:删除线">
+ <xsl:attribute name="uof:locID">t0094</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型</xsl:attribute>
+ <xsl:attribute name="字:类型"><xsl:call-template name="uof:线型类型"><xsl:with-param name="lineType" select=".//@style:text-crossing-out"/></xsl:call-template></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test=".//@style:text-underline">
+ <xsl:element name="字:下划线">
+ <xsl:attribute name="字:类型"><xsl:call-template name="uof:线型类型"><xsl:with-param name="lineType" select=".//@style:text-underline"/></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="uof:locID">t0095</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型</xsl:attribute>
+ <xsl:if test=".//@style:text-underline-color">
+ <xsl:attribute name="字:颜色"><xsl:value-of select=".//@style:text-underline-color"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test=".//@fo:text-shadow and not(.//@fo:text-shadow='none')">
+ <xsl:element name="字:阴影">
+ <xsl:attribute name="uof:locID">t0100</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test=".//@fo:text-shadow='none'">false</xsl:when><xsl:otherwise>true</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test=".//@style:text-emphasize">
+ <xsl:element name="å­—:ç€é‡å·">
+ <xsl:attribute name="uof:locID">t0096</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 颜色 å­—ç€é‡å·</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test=".//@style:text-emphasize='none'">
+ <xsl:attribute name="å­—:å­—ç€é‡å·">false</xsl:attribute>
+ <xsl:attribute name="字:类型">none</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="å­—:å­—ç€é‡å·">true</xsl:attribute>
+ <xsl:attribute name="字:类型">dot</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test=".//@fo:color">
+ <xsl:attribute name="字:颜色"><xsl:value-of select=".//@fo:color"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test=".//@text:display and not(.//@text:display='none')">
+ <xsl:element name="å­—:éšè—文字">
+ <xsl:attribute name="uof:locID">t0097</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值">true</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test=".//@style:text-outline and not(.//@style:text-outline='none')">
+ <xsl:element name="字:空心">
+ <xsl:attribute name="uof:locID">t0098</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:value-of select=".//@style:text-outline"/></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test=".//@style:font-relief and not(.//@style:font-relief='none')">
+ <xsl:element name="字:浮雕">
+ <xsl:attribute name="uof:locID">t0099</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型</xsl:attribute>
+ <xsl:attribute name="字:类型"><xsl:choose><xsl:when test=".//@style:font-relief='embossed'">emboss</xsl:when><xsl:when test=".//@style:font-relief='engraved'">engrave</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test=".//@fo:text-transform or .//@fo:font-variant">
+ <xsl:element name="字:醒目字体">
+ <xsl:attribute name="uof:locID">t0101</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型</xsl:attribute>
+ <xsl:attribute name="字:类型"><xsl:choose><xsl:when test=".//@fo:text-transform='uppercase'">uppercase</xsl:when><xsl:when test=".//@fo:text-transform='lowercase'">lowercase</xsl:when><xsl:when test=".//@fo:text-transform='capitalize'">capital</xsl:when><xsl:when test=".//@fo:font-variant='small-caps'">small-caps</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test=".//@style:text-position">
+ <xsl:element name="å­—:ä½ç½®">
+ <xsl:attribute name="uof:locID">t0102</xsl:attribute>
+ <xsl:value-of select=".//@style:text-position"/>
+ </xsl:element>
+ <字:上下标 uof:locID="t0205" uof:attrList="值">
+ <xsl:attribute name="字:值">none</xsl:attribute>
+ </字:上下标>
+ </xsl:if>
+ <xsl:if test=".//@style:text-scale">
+ <xsl:element name="字:缩放">
+ <xsl:attribute name="uof:locID">t0103</xsl:attribute>
+ <xsl:value-of select=".//@style:text-scale"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test=".//@fo:letter-spacing">
+ <xsl:element name="å­—:字符间è·">
+ <xsl:attribute name="uof:locID">t0104</xsl:attribute>
+ <xsl:value-of select=".//@fo:letter-spacing"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test=".//@style:letter-kerning">
+ <xsl:element name="å­—:调整字间è·">
+ <xsl:attribute name="uof:locID">t015</xsl:attribute>
+ <xsl:value-of select=".//@style:letter-kerning"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="å­—:字符对é½ç½‘æ ¼">
+ <xsl:attribute name="字:值">false</xsl:attribute>
+ <xsl:attribute name="uof:locID">t0106</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="style:presentation-page-layout" mode="pagestyle">
+ <æ¼”:页é¢ç‰ˆå¼ uof:locID="p0018" uof:attrList="标识符 å称">
+ <xsl:attribute name="演:标识符"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <xsl:attribute name="æ¼”:å称"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <演:布局 uof:locID="p0129" uof:attrList="类型">
+ <xsl:attribute name="演:类型">
+ <xsl:variable name="layout" select="substring-after(@style:name,'T')"/>
+ <xsl:choose>
+ <xsl:when test="$layout='0'">title-subtitle</xsl:when><xsl:when test="$layout='1'">title-body</xsl:when><xsl:when test="$layout='19'">title-only</xsl:when><xsl:when test="$layout='12'">column-2-rows</xsl:when><xsl:when test="$layout='15'">2-rows-column</xsl:when><xsl:when test="$layout='16'">2-columns-row</xsl:when><xsl:when test="$layout='17'">2-rows</xsl:when><xsl:when test="$layout='18'">4-objects</xsl:when><xsl:when test="$layout='27'">v-2-rows</xsl:when><xsl:when test="$layout='28'">v-title-body</xsl:when><xsl:when test="$layout='29'">big-object</xsl:when><xsl:when test="$layout='30'">2-columns</xsl:when>
+ <xsl:otherwise>title-only</xsl:otherwise>
+ </xsl:choose></xsl:attribute>
+ </演:布局>
+ <xsl:apply-templates select="presentation:placeholder" mode="anchor"/>
+ </æ¼”:页é¢ç‰ˆå¼>
+ </xsl:template>
+ <xsl:template match="presentation:placeholder" mode="anchor">
+ <æ¼”:å ä½ç¬¦ uof:locID="p0130" uof:attrList="类型">
+ <xsl:attribute name="演:类型"><xsl:choose><xsl:when test="@presentation:object = 'vertical_outline'">vertical_text</xsl:when><xsl:when test="@presentation:object = 'date-time'">date</xsl:when><xsl:when test="@presentation:object = 'page_number'">number</xsl:when><xsl:otherwise><xsl:value-of select="@presentation:object"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <uof:锚点 uof:locID="u0064" uof:attrList="xåæ ‡ yåæ ‡ 宽度 高度 图形引用 éšåŠ¨æ–¹å¼ 缩略图 å ä½ç¬¦">
+ <xsl:attribute name="uof:xåæ ‡"><xsl:value-of select="substring-before(@svg:x,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="uof:yåæ ‡"><xsl:value-of select="substring-before(@svg:y,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="uof:宽度"><xsl:value-of select="substring-before(@svg:width,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="uof:高度"><xsl:value-of select="substring-before(@svg:height,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="uof:图形引用"><xsl:variable name="number"><xsl:value-of select="concat('_',count(preceding-sibling::presentation:placeholder))"/></xsl:variable><xsl:value-of select="concat(parent::style:presentation-page-layout/@style:name,$number)"/></xsl:attribute>
+ </uof:锚点>
+ </æ¼”:å ä½ç¬¦>
+ </xsl:template>
+ <xsl:template match="presentation:placeholder" mode="graphic">
+ <图:图形 uof:locID="g0000" uof:attrList="层次 标识符 组åˆåˆ—表 其他对象" 图:层次="3">
+ <xsl:attribute name="图:标识符"><xsl:variable name="number"><xsl:value-of select="concat('_',count(preceding-sibling::presentation:placeholder))"/></xsl:variable><xsl:value-of select="concat(parent::style:presentation-page-layout/@style:name,$number)"/></xsl:attribute>
+ </图:图形>
+ </xsl:template>
+ <xsl:template match="office:master-styles">
+ <xsl:apply-templates select="style:handout-master"/>
+ <xsl:apply-templates select="style:master-page"/>
+ <xsl:if test="style:master-page/presentation:notes">
+ <xsl:apply-templates select="style:master-page/presentation:notes"/>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="style:handout-master">
+ <æ¼”:æ¯ç‰ˆ uof:locID="p0036" uof:attrList="标识符 å称 类型 页é¢è®¾ç½®å¼•ç”¨ é…色方案引用 页é¢ç‰ˆå¼å¼•ç”¨ 文本å¼æ ·å¼•ç”¨" æ¼”:å称="handoutæ¯ç‰ˆ" æ¼”:类型="handout">
+ <xsl:attribute name="æ¼”:页é¢è®¾ç½®å¼•ç”¨"><xsl:value-of select="@style:page-layout-name"/></xsl:attribute>
+ <xsl:if test="@draw:style-name">
+ <xsl:attribute name="æ¼”:é…色方案引用"><xsl:value-of select="@draw:style-name"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@presentation:presentation-page-layout-name">
+ <xsl:attribute name="æ¼”:页é¢ç‰ˆå¼å¼•ç”¨"><xsl:value-of select="@presentation:presentation-page-layout-name"/></xsl:attribute>
+ </xsl:if>
+ <xsl:call-template name="产生锚点"/>
+ </æ¼”:æ¯ç‰ˆ>
+ </xsl:template>
+ <xsl:template match="style:master-page">
+ <æ¼”:æ¯ç‰ˆ uof:locID="p0036" uof:attrList="标识符 å称 类型 页é¢è®¾ç½®å¼•ç”¨ é…色方案引用 页é¢ç‰ˆå¼å¼•ç”¨ 文本å¼æ ·å¼•ç”¨" æ¼”:å称="slideæ¯ç‰ˆ" æ¼”:类型="slide">
+ <xsl:attribute name="演:标识符"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <xsl:attribute name="æ¼”:页é¢è®¾ç½®å¼•ç”¨"><xsl:value-of select="@style:page-layout-name"/></xsl:attribute>
+ <xsl:if test="@draw:style-name">
+ <xsl:attribute name="æ¼”:é…色方案引用"><xsl:value-of select="@draw:style-name"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@presentation:presentation-page-layout-name">
+ <xsl:attribute name="æ¼”:页é¢ç‰ˆå¼å¼•ç”¨"><xsl:value-of select="@presentation:presentation-page-layout-name"/></xsl:attribute>
+ </xsl:if>
+ <xsl:call-template name="产生锚点"/>
+ <xsl:variable name="stylename">
+ <xsl:value-of select="@draw:style-name"/>
+ </xsl:variable>
+ <xsl:variable name="name">
+ <xsl:value-of select="name(.)"/>
+ </xsl:variable>
+ <xsl:for-each select="/office:document/*/style:style[@style:name=$stylename]/style:drawing-page-properties">
+ <xsl:if test="@draw:fill and not(@draw:fill='none')">
+ <演:背景 uof:locID="p0057">
+ <xsl:call-template name="å¡«å……">
+ <xsl:with-param name="picname" select="$stylename"/>
+ <xsl:with-param name="nodename" select="$name"/>
+ </xsl:call-template>
+ </演:背景>
+ </xsl:if>
+ </xsl:for-each>
+ </æ¼”:æ¯ç‰ˆ>
+ </xsl:template>
+ <xsl:template match="presentation:notes">
+ <æ¼”:æ¯ç‰ˆ uof:locID="p0036" uof:attrList="标识符 å称 类型 页é¢è®¾ç½®å¼•ç”¨ é…色方案引用 页é¢ç‰ˆå¼å¼•ç”¨ 文本å¼æ ·å¼•ç”¨" æ¼”:å称="notesæ¯ç‰ˆ" æ¼”:类型="notes">
+ <xsl:attribute name="演:标识符"><xsl:value-of select="concat('note-',parent::style:master-page/@style:name)"/></xsl:attribute>
+ <xsl:attribute name="æ¼”:页é¢è®¾ç½®å¼•ç”¨"><xsl:value-of select="@style:page-layout-name"/></xsl:attribute>
+ <xsl:if test="@draw:style-name">
+ <xsl:attribute name="æ¼”:é…色方案引用"><xsl:value-of select="@draw:style-name"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@presentation:presentation-page-layout-name">
+ <xsl:attribute name="æ¼”:页é¢ç‰ˆå¼å¼•ç”¨"><xsl:value-of select="@presentation:presentation-page-layout-name"/></xsl:attribute>
+ </xsl:if>
+ <xsl:call-template name="产生锚点"/>
+ </æ¼”:æ¯ç‰ˆ>
+ </xsl:template>
+ <xsl:template match="draw:page">
+ <æ¼”:å¹»ç¯ç‰‡ uof:locID="p0040" uof:attrList="å称 标识符 æ¯ç‰ˆå¼•ç”¨ é…色方案引用 页é¢ç‰ˆå¼å¼•ç”¨ 显示 显示背景 显示背景对象">
+ <xsl:attribute name="演:标识符"><xsl:value-of select="concat(@draw:name,'_',@draw:style-name)"/></xsl:attribute>
+ <xsl:attribute name="æ¼”:å称"><xsl:value-of select="@draw:name"/></xsl:attribute>
+ <xsl:attribute name="æ¼”:æ¯ç‰ˆå¼•ç”¨"><xsl:value-of select="@draw:master-page-name"/></xsl:attribute>
+ <xsl:if test="@presentation:presentation-page-layout-name">
+ <xsl:attribute name="æ¼”:页é¢ç‰ˆå¼å¼•ç”¨"><xsl:value-of select="@presentation:presentation-page-layout-name"/></xsl:attribute>
+ </xsl:if>
+ <xsl:call-template name="产生锚点"/>
+ <xsl:apply-templates select="presentation:notes" mode="page"/>
+ <xsl:variable name="stylename">
+ <xsl:value-of select="@draw:style-name"/>
+ </xsl:variable>
+ <xsl:variable name="name">
+ <xsl:value-of select="name(.)"/>
+ </xsl:variable>
+ <xsl:for-each select="/office:document/*/style:style[@style:name=$stylename]/style:drawing-page-properties">
+ <xsl:if test="@draw:fill and not(@draw:fill='none')">
+ <演:背景 uof:locID="p0057">
+ <xsl:call-template name="å¡«å……">
+ <xsl:with-param name="picname" select="$stylename"/>
+ <xsl:with-param name="nodename" select="$name"/>
+ </xsl:call-template>
+ </演:背景>
+ </xsl:if>
+ </xsl:for-each>
+ <æ¼”:åˆ‡æ¢ uof:locID="p0058" uof:attrList="效果 速度">
+ <xsl:for-each select="key('graphicset',$stylename)/style:drawing-page-properties">
+ <xsl:attribute name="演:速度"><xsl:choose><xsl:when test="@presentation:transition-speed='slow'">slow</xsl:when><xsl:otherwise>fast</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="演:效果"><xsl:variable name="type"><xsl:value-of select="@smil:type"/></xsl:variable><xsl:variable name="subtype"><xsl:value-of select="@smil:subtype"/></xsl:variable><xsl:choose><xsl:when test="$type='irisWipe' and $subtype='rectangle' and @smil:direction='reverse'">box in</xsl:when><xsl:when test="$type='irisWipe' and $subtype='rectangle'">box out</xsl:when><xsl:when test="$type='checkerBoardWipe' and $subtype='across'">checkerboard across</xsl:when><xsl:when test="$type='checkerBoardWipe' and $subtype='down'">checkerboard down</xsl:when><xsl:when test="$type='pushWipe' and $subtype='combHorizontal'">comb horizontal</xsl:when><xsl:when test="$type='pushWipe' and $subtype='combVertical'">comb vertical</xsl:when><xsl:when test="$type='slideWipe' and $subtype='fromTop' and @smil:direction='reverse'">uncover down</xsl:when><xsl:when test="$type='slideWipe' and $subtype='fromRight' and @smil:direction='reverse'">uncover left</xsl:when><xsl:when test="$type='slideWipe' and $subtype='fromLeft' and @smil:direction='reverse'">uncover right</xsl:when><xsl:when test="$type='slideWipe' and $subtype='fromBottom' and @smil:direction='reverse'">uncover up</xsl:when><xsl:when test="$type='slideWipe' and $subtype='fromTopRight' and @smil:direction='reverse'">uncover left-down</xsl:when><xsl:when test="$type='slideWipe' and $subtype='fromBottomRight' and @smil:direction='reverse'">uncover left-up</xsl:when><xsl:when test="$type='slideWipe' and $subtype='fromTopLeft' and @smil:direction='reverse'">uncover right-down</xsl:when><xsl:when test="$type='slideWipe' and $subtype='fromBottomLeft' and @smil:direction='reverse'">uncover right-up</xsl:when><xsl:when test="$type='slideWipe' and $subtype='fromTop'">cover down</xsl:when><xsl:when test="$type='slideWipe' and $subtype='fromRight'">cover left</xsl:when><xsl:when test="$type='slideWipe' and $subtype='fromLeft'">cover right</xsl:when><xsl:when test="$type='slideWipe' and $subtype='fromBottom'">cover up</xsl:when><xsl:when test="$type='slideWipe' and $subtype='fromTopRight'">cover left-down</xsl:when><xsl:when test="$type='slideWipe' and $subtype='fromBottomRight'">cover left-up</xsl:when><xsl:when test="$type='slideWipe' and $subtype='fromTopLeft'">cover right-down</xsl:when><xsl:when test="$type='slideWipe' and $subtype='fromBottomLeft'">cover right-up</xsl:when><xsl:when test="$type='fade' and $subtype='fadeOverColor'">fade through black</xsl:when><xsl:when test="$type='pushWipe' and $subtype='fromTop'">push down</xsl:when><xsl:when test="$type='pushWipe' and $subtype='fromRight'">push left</xsl:when><xsl:when test="$type='pushWipe' and $subtype='fromLeft'">push right</xsl:when><xsl:when test="$type='pushWipe' and $subtype='fromBottom'">push up</xsl:when><xsl:when test="$type='randomBarWipe' and $subtype='horizontal'">random bars horizontal</xsl:when><xsl:when test="$type='randomBarWipe' and $subtype='vertical'">random bars vertical</xsl:when><xsl:when test="$type='ellipseWipe' and $subtype='circle'">shape circle</xsl:when><xsl:when test="$type='irisWipe' and $subtype='diamond'">shape diamond</xsl:when><xsl:when test="$type='fourBoxWipe' and $subtype='cornersOut'">shape plus</xsl:when><xsl:when test="$type='barnDoorWipe' and $subtype='horizontal' and @smil:direction='reverse'">split horizontal in</xsl:when><xsl:when test="$type='barnDoorWipe' and $subtype='horizontal'">split horizontal out</xsl:when><xsl:when test="$type='barnDoorWipe' and $subtype='vertical' and @smil:direction='reverse'">split vertical in</xsl:when><xsl:when test="$type='barnDoorWipe' and $subtype='vertical'">split vertical out</xsl:when><xsl:when test="$type='fanWipe' and $subtype='centerTop'">wedge</xsl:when><xsl:when test="$type='pinWheelWipe' and $subtype='oneBlade'">wheel clockwise – 1 spoke</xsl:when><xsl:when test="$type='pinWheelWipe' and $subtype='twoBladeVertical'">wheel clockwise – 2 spoke</xsl:when><xsl:when test="$type='pinWheelWipe' and $subtype='threeBlade'">wheel clockwise – 3 spoke</xsl:when><xsl:when test="$type='pinWheelWipe' and $subtype='fourBlade'">wheel clockwise – 4 spoke</xsl:when><xsl:when test="$type='pinWheelWipe' and $subtype='eightBlade'">wheel clockwise – 8 spoke</xsl:when><xsl:when test="$type='barWipe' and $subtype='leftToRight' and @smil:direction='reverse'">wipe left</xsl:when><xsl:when test="$type='barWipe' and $subtype='leftToRight'">wipe right</xsl:when><xsl:when test="$type='barWipe' and $subtype='topToBottom' and @smil:direction='reverse'">wipe up</xsl:when><xsl:when test="$type='barWipe' and $subtype='topToBottom'">wipe down</xsl:when><xsl:when test="$type='blindsWipe' and $subtype='vertical'">blinds vertical</xsl:when><xsl:when test="$type='blindsWipe' and $subtype='horizontal'">blinds horizontal</xsl:when><xsl:when test="$type='dissolve'">dissolve</xsl:when><xsl:when test="$type='random'">random transition</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ <演:声音 uof:locID="p0061" uof:attrList="预定义声音 自定义声音">
+ <xsl:choose>
+ <xsl:when test="not(presentation:sound)">
+ <xsl:attribute name="演:预定义声音">none</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="lujing">
+ <xsl:value-of select="substring-after(presentation:sound/@xlink:href,'share/gallery/sounds/')"/>
+ </xsl:variable>
+ <xsl:variable name="ming">
+ <xsl:value-of select="substring-before($lujing,'.wav')"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$ming='applause'">
+ <xsl:attribute name="演:预定义声音">applause</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$ming='explos'">
+ <xsl:attribute name="演:预定义声音">explosion</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$ming='laser'">
+ <xsl:attribute name="演:预定义声音">laser</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="演:自定义声音"><xsl:value-of select="presentation:sound/@xlink:href"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </演:声音>
+ <æ¼”:æ–¹å¼ uof:locID="p0062">
+ <æ¼”:å•å‡»é¼ æ ‡ uof:locID="p0065">
+ <xsl:choose>
+ <xsl:when test="@presentation:transition-type='automatic'">false</xsl:when>
+ <xsl:otherwise>true</xsl:otherwise>
+ </xsl:choose>
+ </æ¼”:å•å‡»é¼ æ ‡>
+ <xsl:if test="@presentation:duration">
+ <演:时间间隔 uof:locID="p0066">
+ <xsl:variable name="hms">
+ <xsl:value-of select="substring-after(@presentation:duration,'PT')"/>
+ </xsl:variable>
+ <xsl:variable name="h">
+ <xsl:value-of select="number(substring-before($hms,'H'))"/>
+ </xsl:variable>
+ <xsl:variable name="ms">
+ <xsl:value-of select="substring-after($hms,'H')"/>
+ </xsl:variable>
+ <xsl:variable name="m">
+ <xsl:value-of select="number(substring-before($ms,'M'))"/>
+ </xsl:variable>
+ <xsl:variable name="s">
+ <xsl:value-of select="number(substring-before(substring-after($ms,'M'),'S'))"/>
+ </xsl:variable>
+ <xsl:value-of select="$h *3600 + $m * 60 + $s"/>
+ </演:时间间隔>
+ </xsl:if>
+ </æ¼”:æ–¹å¼>
+ </xsl:for-each>
+ </æ¼”:切æ¢>
+ </æ¼”:å¹»ç¯ç‰‡>
+ </xsl:template>
+ <xsl:template match="presentation:notes" mode="page">
+ <æ¼”:å¹»ç¯ç‰‡å¤‡æ³¨ uof:locID="p0054" uof:attrList="备注æ¯ç‰ˆå¼•ç”¨">
+ <xsl:attribute name="æ¼”:备注æ¯ç‰ˆå¼•ç”¨"><xsl:variable name="cute"><xsl:value-of select="parent::node()/@draw:master-page-name"/></xsl:variable><xsl:value-of select="concat('note-',$cute)"/></xsl:attribute>
+ <xsl:call-template name="产生锚点"/>
+ <演:背景 uof:locID="p0057">
+ <图:颜色 uof:locID="g0034">#ffffff</图:颜色>
+ </演:背景>
+ </æ¼”:å¹»ç¯ç‰‡å¤‡æ³¨>
+ </xsl:template>
+ <xsl:template name="产生锚点">
+ <xsl:for-each select="child::node( )">
+ <xsl:choose>
+ <xsl:when test="substring-before(name(),':')='draw'">
+ <uof:锚点 uof:locID="u0064" uof:attrList="xåæ ‡ yåæ ‡ 宽度 高度 图形引用 éšåŠ¨æ–¹å¼ 缩略图 å ä½ç¬¦">
+ <xsl:variable name="nodename">
+ <xsl:value-of select="name(.)"/>
+ </xsl:variable>
+ <xsl:variable name="refpicname">
+ <xsl:choose>
+ <xsl:when test="@draw:style-name">
+ <xsl:value-of select="@draw:style-name"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="@presentation:style-name"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="picnumber">
+ <xsl:choose>
+ <xsl:when test="@draw:style-name">
+ <xsl:value-of select="count(preceding::*[@draw:style-name=$refpicname])"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="count(preceding::*[@presentation:style-name=$refpicname])"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="uof:xåæ ‡"><xsl:choose><xsl:when test="name(.)='draw:g'"><xsl:call-template name="groupminx"><xsl:with-param name="value" select="number(substring-before(descendant::node()[@svg:x][1]/@svg:x,$uofUnit))"/><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:when><xsl:otherwise><xsl:choose><xsl:when test="@svg:x"><xsl:value-of select="substring-before(@svg:x,$uofUnit)"/></xsl:when><xsl:when test="@svg:x1"><xsl:value-of select="substring-before(@svg:x1,$uofUnit)"/></xsl:when></xsl:choose></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="uof:yåæ ‡"><xsl:choose><xsl:when test="name(.)='draw:g'"><xsl:call-template name="groupminx"><xsl:with-param name="value" select="number(substring-before(descendant::node()[@svg:y][1]/@svg:y,$uofUnit))"/><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:when><xsl:otherwise><xsl:choose><xsl:when test="@svg:y"><xsl:value-of select="substring-before(@svg:y,$uofUnit)"/></xsl:when><xsl:when test="@svg:y1"><xsl:value-of select="substring-before(@svg:y1,$uofUnit)"/></xsl:when></xsl:choose></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="uof:宽度"><xsl:choose><xsl:when test="@svg:width"><xsl:value-of select="substring-before(@svg:width,$uofUnit)"/></xsl:when><xsl:when test="@svg:x1"><xsl:value-of select="substring-before(@svg:x2,$uofUnit) - substring-before(@svg:x1,$uofUnit)"/></xsl:when><xsl:when test="name(.)='draw:g'"><xsl:variable name="minx"><xsl:call-template name="groupminx"><xsl:with-param name="value" select="number(substring-before(descendant::node()[@svg:x][1]/@svg:x,$uofUnit))"/><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:variable><xsl:variable name="svgx"><xsl:value-of select="number(substring-before(descendant::node()[@svg:x][1]/@svg:x,$uofUnit))"/></xsl:variable><xsl:variable name="width"><xsl:value-of select="number(substring-before(descendant::node()[@svg:x][1]/@svg:width,$uofUnit))"/></xsl:variable><xsl:variable name="maxx"><xsl:call-template name="groupmaxx"><xsl:with-param name="value" select="$svgx + $width"/><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:variable><xsl:value-of select="$maxx - $minx"/></xsl:when></xsl:choose></xsl:attribute>
+ <xsl:attribute name="uof:高度"><xsl:choose><xsl:when test="@svg:height"><xsl:value-of select="substring-before(@svg:height,$uofUnit)"/></xsl:when><xsl:when test="@svg:x1"><xsl:value-of select="substring-before(@svg:y2,$uofUnit) - substring-before(@svg:y1,$uofUnit)"/></xsl:when><xsl:when test="name(.)='draw:g'"><xsl:variable name="miny"><xsl:call-template name="groupminy"><xsl:with-param name="value" select="number(substring-before(descendant::node()[@svg:y][1]/@svg:y,$uofUnit))"/><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:variable><xsl:variable name="svgy"><xsl:value-of select="number(substring-before(descendant::node()[@svg:y][1]/@svg:y,$uofUnit))"/></xsl:variable><xsl:variable name="height"><xsl:value-of select="number(substring-before(descendant::node()[@svg:y][1]/@svg:height,$uofUnit))"/></xsl:variable><xsl:variable name="maxy"><xsl:call-template name="groupmaxy"><xsl:with-param name="value" select="$svgy + $height"/><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:variable><xsl:value-of select="$maxy - $miny"/></xsl:when></xsl:choose></xsl:attribute>
+ <xsl:attribute name="uof:图形引用"><xsl:choose><xsl:when test="@draw:id"><xsl:value-of select="@draw:id"/></xsl:when><xsl:when test="not(@draw:style-name) and name()='draw:g'"><xsl:value-of select="concat(child::node()[1]/@draw:style-name,'_',$picnumber)"/></xsl:when><xsl:otherwise><xsl:value-of select="concat($refpicname,'_',$picnumber)"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="uof:éšåŠ¨æ–¹å¼"><xsl:choose><xsl:when test="key('graphicset',$refpicname)/node()/@style:protect"><xsl:for-each select="key('graphicset',$refpicname)/node()"><xsl:choose><xsl:when test="@style:protect='size'">move</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:for-each></xsl:when><xsl:otherwise>movesize</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="name(.)='draw:page-thumbnail'">
+ <xsl:attribute name="uof:缩略图">true</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="not(name(parent::node())='style:handout-master')">
+ <xsl:attribute name="uof:å ä½ç¬¦"><xsl:choose><xsl:when test="@presentation:object"><xsl:value-of select="@presentation:object"/></xsl:when><xsl:when test=".//draw:image">graphic</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:if test="@presentation:class">
+ <xsl:attribute name="uof:å ä½ç¬¦"><xsl:value-of select="@presentation:class"/></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ </uof:锚点>
+ </xsl:when>
+ <xsl:when test="name()= 'anim:par'">
+ <演:动画 uof:locID="p0042">
+ <xsl:apply-templates select="anim:seq"/>
+ </演:动画>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template match="anim:seq">
+ <xsl:apply-templates select="anim:par/anim:par/anim:par"/>
+ <xsl:apply-templates select="anim:par/anim:par/anim:iterate"/>
+ </xsl:template>
+ <xsl:template match="anim:par | anim:iterate">
+ <æ¼”:åºåˆ— uof:locID="p0043" uof:attrList="段è½å¼•ç”¨ 动画对象">
+ <xsl:attribute name="演:动画对象"><xsl:choose>
+ <xsl:when test=".//@smil:targetElement"><xsl:value-of select=".//@smil:targetElement"/></xsl:when><xsl:when test="@anim:id"><xsl:value-of select="@anim:id"/></xsl:when><xsl:otherwise><xsl:value-of select="../@smil:targetElement"/></xsl:otherwise></xsl:choose></xsl:attribute>
+
+ <æ¼”:定时 uof:locID="p0067" uof:attrList="事件 延时 速度 é‡å¤ 回å·">
+ <xsl:attribute name="演:事件">
+ <xsl:choose>
+ <xsl:when test="@presentation:node-type='on-click'">on click</xsl:when>
+ <xsl:when test="@presentation:node-type='with-previous'">with previous</xsl:when>
+ <xsl:otherwise><xsl:value-of select="@presentation:node-type"/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:attribute name="演:延时"><xsl:value-of select="substring-before(@smil:begin,'s')"/></xsl:attribute>
+ <xsl:attribute name="演:速度"><xsl:choose><xsl:when test="anim:animate/@smil:dur='0.5s'">very fast</xsl:when><xsl:when test="anim:animate/@smil:dur='1s'">fast</xsl:when><xsl:when test="anim:animate/@smil:dur='2s'">medium</xsl:when><xsl:when test="anim:animate/@smil:dur='3s'">slow</xsl:when><xsl:when test="anim:animate/@smil:dur='5s'">very slow</xsl:when><xsl:otherwise>medium</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="æ¼”:é‡å¤"><xsl:choose><xsl:when test="@smil:repeatCount = 'indefinite' "><xsl:choose><xsl:when test="@smil:end='next'">until next click</xsl:when><xsl:otherwise>until next slide</xsl:otherwise></xsl:choose></xsl:when><xsl:when test="@smil:repeatCount ='2' or @smil:repeatCount ='3' or @smil:repeatCount ='4' or @smil:repeatCount ='5' or @smil:repeatCount ='10' "><xsl:value-of select="@smil:repeatCount"/></xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="æ¼”:回å·"><xsl:choose><xsl:when test="@smil:fill='remove'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </演:定时>
+ <演:增强 uof:locID="p0068">
+ <æ¼”:åŠ¨ç”»æ’­æ”¾åŽ uof:locID="p0070" uof:attrList="颜色 å˜æš— 播放åŽéšè— å•å‡»åŽéšè—">
+ <xsl:if test="../anim:animateColor">
+ <xsl:attribute name="演:颜色"><xsl:value-of select="../anim:animateColor/@smil:to"/></xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="../anim:animateColor">
+ <xsl:attribute name="æ¼”:å˜æš—">true</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="æ¼”:å˜æš—">false</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="@presentation:preset-property='Direction;Accelerate;Decelerate' ">
+ <xsl:attribute name="æ¼”:播放åŽéšè—">true</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="æ¼”:播放åŽéšè—">false</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="../anim:set/@smil:to">
+ <xsl:attribute name="æ¼”:å•å‡»åŽéšè—">true</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="æ¼”:å•å‡»åŽéšè—">false</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </æ¼”:动画播放åŽ>
+ <æ¼”:动画文本 uof:locID="p0071" uof:attrList="å‘é€ é—´éš” 动画形状 相å顺åº">
+ <xsl:attribute name="æ¼”:å‘é€"><xsl:choose><xsl:when test="@anim:iterate-type = 'by-word' ">by word</xsl:when><xsl:when test="@anim:iterate-type = 'by-letter' ">by letter</xsl:when><xsl:otherwise>all at once</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="æ¼”:é—´éš”"><xsl:choose><xsl:when test="@anim:iterate-interval"><xsl:value-of select="substring-before(@anim:iterate-interval,'s')"/>
+</xsl:when><xsl:otherwise>0</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="演:动画形状">false</xsl:attribute>
+ <xsl:attribute name="æ¼”:相å顺åº">false</xsl:attribute>
+ </演:动画文本>
+ <xsl:if test="anim:audio">
+ <演:声音 uof:locID="p0061" uof:attrList="预定义声音 自定义声音">
+ <xsl:variable name="audioname">
+ <xsl:value-of select="substring-after(anim:audio/@xlink:href,'gallery/sounds/')"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="not($audioname='')">
+ <xsl:attribute name="演:预定义声音"><xsl:choose><xsl:when test="anim:audio/@xlink:href"><xsl:value-of select="anim:audio/@xlink:href"/></xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="演:自定义声音"><xsl:value-of select="anim:audio/@xlink:href"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </演:声音>
+ </xsl:if>
+ </演:增强>
+ <演:效果 uof:locID="p0069">
+ <xsl:choose>
+ <xsl:when test="./@presentation:preset-class = 'entrance'">
+ <演:进入 uof:locID="p0073">
+ <xsl:apply-templates select="@presentation:preset-id"/>
+ </演:进入>
+ </xsl:when>
+ <xsl:when test="./@presentation:preset-class = 'exit'">
+ <演:退出 uof:locID="p0074">
+ <xsl:apply-templates select="@presentation:preset-id"/>
+ </演:退出>
+ </xsl:when>
+ <xsl:when test="./@presentation:preset-class = 'emphasis' ">
+ <演:强调 uof:locID="p0075">
+ <xsl:apply-templates select="@presentation:preset-id"/>
+ </演:强调>
+ </xsl:when>
+ <xsl:otherwise>
+ <演:动作路径 uof:locID="p0133" uof:attrList="路径">
+ <xsl:attribute name="演:路径">
+ <xsl:value-of select="anim:animateMotion/@svg:path"/>
+ </xsl:attribute>
+ </演:动作路径>
+ </xsl:otherwise>
+ </xsl:choose>
+ </演:效果>
+ </æ¼”:åºåˆ—>
+ </xsl:template>
+ <xsl:template name="anim_speed">
+ <xsl:param name="speed"/>
+ <xsl:choose>
+ <xsl:when test="$speed='0.5s' or $speed='0.25s'">very fast</xsl:when>
+ <xsl:when test="$speed='1s'">fast</xsl:when>
+ <xsl:when test="$speed='2s'">medium</xsl:when>
+ <xsl:when test="$speed='3s'">slow</xsl:when>
+ <xsl:when test="$speed='5s'">very slow</xsl:when>
+ <xsl:otherwise>medium</xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-venetian-blinds']">
+ <æ¼”:百å¶çª— uof:locID="p0080" uof:attrList="速度 æ–¹å‘">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="æ¼”:æ–¹å‘"><xsl:value-of select="../@presentation:preset-sub-type"/></xsl:attribute>
+ </æ¼”:百å¶çª—>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-appear']">
+ <演:出现 uof:locID="p0081">
+ </演:出现>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-box']">
+ <æ¼”:盒状 uof:locID="p0082" uof:attrList="速度 æ–¹å‘">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="æ¼”:æ–¹å‘"><xsl:value-of select="../@presentation:preset-sub-type"/></xsl:attribute>
+ </演:盒状>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-diagonal-squares']">
+ <æ¼”:阶梯状 uof:locID="p0083" uof:attrList="速度 æ–¹å‘">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="æ¼”:æ–¹å‘"><xsl:choose><xsl:when test="../@presentation:preset-sub-type = 'left-to-bottom' ">left down</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'left-to-top' ">left up</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'right-to-bottom' ">right down</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'right-to-top' ">right up</xsl:when></xsl:choose></xsl:attribute>
+ </演:阶梯状>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-wheel']">
+ <æ¼”:è½®å­ uof:locID="p0084" uof:attrList="速度 è¾å°„状">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="æ¼”:è¾å°„状"><xsl:value-of select="../@presentation:preset-sub-type"/></xsl:attribute>
+ </æ¼”:è½®å­>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-checkerboard']">
+ <æ¼”:棋盘 uof:locID="p0085" uof:attrList="速度 æ–¹å‘">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="æ¼”:æ–¹å‘"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:subtype"/></xsl:attribute>
+ </演:棋盘>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-flash-once']">
+ <æ¼”:é—ªçƒä¸€æ¬¡ uof:locID="p0086" uof:attrList="速度">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:set/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ </æ¼”:é—ªçƒä¸€æ¬¡>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-plus']">
+ <æ¼”:å字形扩展 uof:locID="p0087" uof:attrList="速度 æ–¹å‘">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="æ¼”:æ–¹å‘"><xsl:value-of select="../@presentation:preset-sub-type"/></xsl:attribute>
+ </æ¼”:å字形扩展>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-random']">
+ <æ¼”:éšæœºæ•ˆæžœ uof:locID="p0088">
+ </æ¼”:éšæœºæ•ˆæžœ>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-circle']">
+ <æ¼”:圆形扩展 uof:locID="p0089" uof:attrList="速度 æ–¹å‘">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="æ¼”:æ–¹å‘"><xsl:value-of select="../@presentation:preset-sub-type"/></xsl:attribute>
+ </演:圆形扩展>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-wipe']">
+ <æ¼”:擦除 uof:locID="p0090" uof:attrList="速度 æ–¹å‘">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="æ¼”:æ–¹å‘"><xsl:choose><xsl:when test="../@presentation:preset-sub-type = 'from-right'">from right</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-left'">from left</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-top'">from top</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-bottom'">from bottom</xsl:when></xsl:choose></xsl:attribute>
+ </演:擦除>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-fly-in']">
+ <æ¼”:飞入 uof:locID="p0091" uof:attrList="速度 æ–¹å‘">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:animate/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="æ¼”:æ–¹å‘"><xsl:choose><xsl:when test="../@presentation:preset-sub-type = 'from-bottom'">from bottom</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-top-right'">from top-right</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-top-left'">from top-left</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-bottom-left'">from bottom-left</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-bottom-right'">from bottom-right</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-right'">from right</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-left'">from left</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-top'">from top</xsl:when></xsl:choose></xsl:attribute>
+ </演:飞入>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-fly-in-slow']">
+ <æ¼”:缓慢飞入 uof:locID="p0092" uof:attrList="速度 æ–¹å‘">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:animate/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="æ¼”:æ–¹å‘"><xsl:choose><xsl:when test="../@presentation:preset-sub-type = 'from-right'">from right</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-left'">from left</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-top'">from top</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-bottom'">from bottom</xsl:when></xsl:choose></xsl:attribute>
+ </演:缓慢飞入>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-diamond']">
+ <æ¼”:è±å½¢ uof:locID="p0093" uof:attrList="速度 æ–¹å‘">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="æ¼”:æ–¹å‘"><xsl:value-of select="../@presentation:preset-sub-type"/></xsl:attribute>
+ </æ¼”:è±å½¢>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-split']">
+ <æ¼”:劈裂 uof:locID="p0094" uof:attrList="速度 æ–¹å‘">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="æ¼”:æ–¹å‘"><xsl:choose><xsl:when test="../@presentation:preset-sub-type = 'horizontal-out'">horizontal out</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'horizontal-in'">horizontal in</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'vertical-in'">vertical in</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'vertical-out'">vertical out</xsl:when></xsl:choose></xsl:attribute>
+ </演:劈裂>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-peek-in']">
+ <æ¼”:切入 uof:locID="p0095" uof:attrList="速度 æ–¹å‘">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="æ¼”:æ–¹å‘"><xsl:choose><xsl:when test="../@presentation:preset-sub-type = 'from-right'">from right</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-left'">from left</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-top'">from top</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-bottom'">from bottom</xsl:when></xsl:choose></xsl:attribute>
+ </演:切入>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-wedge']">
+ <演:扇形展开 uof:locID="p0096" uof:attrList="速度">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ </演:扇形展开>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-random-bars']">
+ <æ¼”:éšæœºçº¿æ¡ uof:locID="p0097" uof:attrList="速度 æ–¹å‘">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="æ¼”:æ–¹å‘"><xsl:value-of select="../@presentation:preset-sub-type"/></xsl:attribute>
+ </æ¼”:éšæœºçº¿æ¡>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-dissolve-in']">
+ <æ¼”:å‘内溶解 uof:locID="p0098" uof:attrList="速度">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ </æ¼”:å‘内溶解>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-boomerang']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-bounce']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-curve-up']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-falling-in']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-flip']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-float']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-fold']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-glide']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-magnify']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-movie-credits']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-pinwheel']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-breaks']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-sling']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-spiral-in']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-swivel']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-thread']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-whip']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'oooo-entrance-ascend']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-center-revolve']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-colored-lettering']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-compress']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-descend']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-ease-in']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-rise-up']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-spin-in']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-stretchy']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-turn-and-grow']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-unfold']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-colored-lettering']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-expand']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-fade-in']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-fade-in-and-swivel']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-fade-in-and-zoom']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-fill-color']">
+ <演:更改填充颜色 uof:locID="p0124" uof:attrList="速度 颜色">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="../anim:animateColor/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="演:颜色"><xsl:value-of select="../anim:animateColor/@smil:to"/></xsl:attribute>
+ </演:更改填充颜色>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-font-color']">
+ <演:更改字体颜色 uof:locID="p0126" uof:attrList="速度 颜色">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="../anim:animateColor/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="演:颜色"><xsl:value-of select="../anim:animateColor/@smil:to"/></xsl:attribute>
+ </演:更改字体颜色>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-grow-and-shrink']">
+ <æ¼”:缩放 uof:locID="p0120" uof:attrList="速度 æ–¹å‘ é¢„å®šä¹‰å°ºå¯¸ 自定义尺寸">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="../anim:animateTransform/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="æ¼”:æ–¹å‘">horizontal</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="../anim:animateTransform/@smil:to='0.25,1' ">
+ <xsl:attribute name="演:预定义尺寸">tiny</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="../anim:animateTransform/@smil:to='0.5,1' ">
+ <xsl:attribute name="演:预定义尺寸">smaller</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="../anim:animateTransform/@smil:to='1.5,1' ">
+ <xsl:attribute name="演:预定义尺寸">larger</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="../anim:animateTransform/@smil:to='4,1' ">
+ <xsl:attribute name="演:预定义尺寸">huge</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="演:自定义尺寸"><xsl:choose><xsl:when test="../anim:animateTransform/@smil:to"><xsl:value-of select="../anim:animateTransform/@smil:to"/></xsl:when><xsl:otherwise>1</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </演:缩放>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-font-size']">
+ <æ¼”:æ›´æ”¹å­—å· uof:locID="p0125" uof:attrList="速度 预定义尺寸 自定义尺寸">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="../anim:animate/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="parent::anim:par/anim:animate/@smil:to='0.25,1' ">
+ <xsl:attribute name="演:预定义尺寸">tiny</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="parent::anim:par/anim:animate/@smil:to='0.5,1' ">
+ <xsl:attribute name="演:预定义尺寸">smaller</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="parent::anim:par/anim:animate/@smil:to='1.5,1' ">
+ <xsl:attribute name="演:预定义尺寸">larger</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="parent::anim:par/anim:animate/@smil:to='4,1' ">
+ <xsl:attribute name="演:预定义尺寸">huge</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="演:自定义尺寸"><xsl:choose><xsl:when test="parent::anim:par/anim:animate/@smil:to"><xsl:value-of select="parent::anim:par/anim:animate/@smil:to"/></xsl:when><xsl:otherwise>1</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </æ¼”:更改字å·>
+ </xsl:template>
+ <xsl:template name="getfontstyle_emphasis">
+ <xsl:value-of select="concat(@smil:to,' ')"/>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-font-style']">
+ <演:更改字形 uof:locID="p0122" uof:attrList="字形 期间">
+ <xsl:attribute name="æ¼”:å­—å½¢"><xsl:variable name="fontstyle"><xsl:for-each select="../anim:set"><xsl:call-template name="getfontstyle_emphasis"/></xsl:for-each></xsl:variable><xsl:value-of select="$fontstyle"/></xsl:attribute>
+ <xsl:attribute name="演:期间"><xsl:choose><xsl:when test="../@smil:repeatCount = 'indefinite' "><xsl:choose><xsl:when test="../@smil:end='next'">until next click</xsl:when><xsl:otherwise>until next slide</xsl:otherwise></xsl:choose></xsl:when><xsl:when test="../@smil:repeatCount ='2' or ../@smil:repeatCount ='3' or ../@smil:repeatCount ='4' or ../@smil:repeatCount ='5' or ../@smil:repeatCount ='10'"><xsl:value-of select="../@smil:repeatCount"/></xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ </演:更改字形>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-line-color']">
+ <æ¼”:更改线æ¡é¢œè‰² uof:locID="p0121" uof:attrList="速度 颜色">
+ <xsl:attribute name="演:速度">medium</xsl:attribute>
+ <xsl:attribute name="演:颜色"><xsl:value-of select="../anim:animateColor/@smil:to"/></xsl:attribute>
+ </æ¼”:更改线æ¡é¢œè‰²>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-spin']">
+ <æ¼”:陀螺旋 uof:locID="p0123" uof:attrList="速度 é¡ºæ—¶é’ˆæ–¹å‘ é¢„å®šä¹‰è§’åº¦ 自定义角度">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:animateTransform/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="æ¼”:顺时针方å‘">true</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="parent::anim:par/anim:animateTransform/@smil:by='90'">
+ <xsl:attribute name="演:预定义角度">quarter spin</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="parent::anim:par/anim:animateTransform/@smil:by='180'">
+ <xsl:attribute name="演:预定义角度">half spin</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="parent::anim:par/anim:animateTransform/@smil:by='360'">
+ <xsl:attribute name="演:预定义角度">full spin</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="parent::anim:par/anim:animateTransform/@smil:by='720'">
+ <xsl:attribute name="演:预定义角度">two spins</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="演:自定义角度"><xsl:value-of select="parent::anim:par/anim:animateTransform/@smil:by"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </演:陀螺旋>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-transparency']">
+ <æ¼”:é€æ˜Ž uof:locID="p0127" uof:attrList="预定义é€æ˜Žåº¦ 自定义é€æ˜Žåº¦ 期间">
+ <xsl:choose>
+ <xsl:when test="../anim:set/@smil:to='0.25' ">
+ <xsl:attribute name="æ¼”:预定义é€æ˜Žåº¦">25</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="../anim:set/@smil:to='0.5' ">
+ <xsl:attribute name="æ¼”:预定义é€æ˜Žåº¦">50</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="../anim:set/@smil:to='0.75' ">
+ <xsl:attribute name="æ¼”:预定义é€æ˜Žåº¦">75</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="../anim:set/@smil:to='1' ">
+ <xsl:attribute name="æ¼”:预定义é€æ˜Žåº¦">100</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="æ¼”:自定义é€æ˜Žåº¦"><xsl:value-of select="../anim:set/@smil:to"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="演:期间"><xsl:choose><xsl:when test="../@smil:repeatCount = 'indefinite' "><xsl:choose><xsl:when test="../@smil:end='next'">until next click</xsl:when><xsl:otherwise>until next slide</xsl:otherwise></xsl:choose></xsl:when><xsl:when test="../@smil:repeatCount ='2' or ../@smil:repeatCount ='3' or ../@smil:repeatCount ='4' or ../@smil:repeatCount ='5' or ../@smil:repeatCount ='10'"><xsl:value-of select="../@smil:repeatCount"/></xsl:when><xsl:otherwise>until next click</xsl:otherwise></xsl:choose></xsl:attribute>
+ </æ¼”:é€æ˜Ž>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-font']">
+ <演:其他 uof:locID="p0128">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-blast']">
+ <演:其他 uof:locID="p0128">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-blink']">
+ <演:其他 uof:locID="p0128">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-bold-reveal']">
+ <演:其他 uof:locID="p0128">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-style-emphasis']">
+ <演:其他 uof:locID="p0128">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-wave']">
+ <演:其他 uof:locID="p0128">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-flicker']">
+ <演:其他 uof:locID="p0128">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-grow-with-color']">
+ <演:其他 uof:locID="p0128">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-shimmer']">
+ <演:其他 uof:locID="p0128">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-teeter']">
+ <演:其他 uof:locID="p0128">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-bold-flash']">
+ <演:其他 uof:locID="p0128">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-color-blend']">
+ <演:其他 uof:locID="p0128">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-color-over-by-letter']">
+ <演:其他 uof:locID="p0128">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-color-over-by-word']">
+ <演:其他 uof:locID="p0128">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-complementary-color']">
+ <演:其他 uof:locID="p0128">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-complementary-color-2']">
+ <演:其他 uof:locID="p0128">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-contrasting-color']">
+ <演:其他 uof:locID="p0128">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-darken']">
+ <演:其他 uof:locID="p0128">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-desaturate']">
+ <演:其他 uof:locID="p0128">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-flash-bulb']">
+ <演:其他 uof:locID="p0128">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-lighten']">
+ <演:其他 uof:locID="p0128">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-reveal-underline']">
+ <演:其他 uof:locID="p0128">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-box']">
+ <æ¼”:盒状 uof:locID="p0111" uof:attrList="速度 æ–¹å‘">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="æ¼”:æ–¹å‘"><xsl:value-of select="../@presentation:preset-sub-type"/></xsl:attribute>
+ </演:盒状>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-checkerboard']">
+ <æ¼”:棋盘 uof:locID="p0114" uof:attrList="速度 æ–¹å‘">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="æ¼”:æ–¹å‘"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:subtype"/></xsl:attribute>
+ </演:棋盘>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-circle']">
+ <æ¼”:圆形扩展 uof:locID="p0109" uof:attrList="速度 æ–¹å‘">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="æ¼”:æ–¹å‘"><xsl:value-of select="../@presentation:preset-sub-type"/></xsl:attribute>
+ </演:圆形扩展>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-crawl-out']">
+ <æ¼”:缓慢移出 uof:locID="p0102" uof:attrList="速度 æ–¹å‘">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="../anim:animate/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="æ¼”:æ–¹å‘"><xsl:choose><xsl:when test="../@presentation:preset-sub-type = 'from-right'">to right</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-left'">to left</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-top'">to top</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-bottom'">to bottom</xsl:when></xsl:choose></xsl:attribute>
+ </演:缓慢移出>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-diagonal-squares']">
+ <æ¼”:阶梯状 uof:locID="p0112" uof:attrList="速度 æ–¹å‘">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="æ¼”:æ–¹å‘"><xsl:choose><xsl:when test="../@presentation:preset-sub-type = 'left-to-bottom' ">left down</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'left-to-top' ">left up</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'right-to-bottom' ">right down</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'right-to-top' ">right up</xsl:when></xsl:choose></xsl:attribute>
+ </演:阶梯状>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-diamond']">
+ <æ¼”:è±å½¢ uof:locID="p0103" uof:attrList="速度 æ–¹å‘">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="æ¼”:æ–¹å‘"><xsl:value-of select="../@presentation:preset-sub-type"/></xsl:attribute>
+ </æ¼”:è±å½¢>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-disappear']">
+ <演:消失 uof:locID="p0118">
+ </演:消失>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-dissolve']">
+ <æ¼”:å‘外溶解 uof:locID="p0108" uof:attrList="速度">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ </æ¼”:å‘外溶解>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-flash-once']">
+ <æ¼”:é—ªçƒä¸€æ¬¡ uof:locID="p0115" uof:attrList="速度 æ–¹å‘">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="../anim:animate/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ </æ¼”:é—ªçƒä¸€æ¬¡>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-fly-out']">
+ <æ¼”:飞出 uof:locID="p0101" uof:attrList="速度 æ–¹å‘">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="../anim:animate/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="æ¼”:æ–¹å‘"><xsl:choose><xsl:when test="../@presentation:preset-sub-type = 'from-bottom'">to bottom</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-top-right'">to top-right</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-top-left'">to top-left</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-bottom-left'">to bottom-left</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-bottom-right'">to bottom-right</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-right'">to right</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-left'">to left</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-top'">to top</xsl:when></xsl:choose></xsl:attribute>
+ </演:飞出>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-peek-out']">
+ <æ¼”:切出 uof:locID="p0105" uof:attrList="速度 æ–¹å‘">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="æ¼”:æ–¹å‘"><xsl:choose><xsl:when test="../@presentation:preset-sub-type = 'from-right'">to right</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-left'">to left</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-top'">to top</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-bottom'">to bottom</xsl:when></xsl:choose></xsl:attribute>
+ </演:切出>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-plus']">
+ <æ¼”:å字形扩展 uof:locID="p0116" uof:attrList="速度 æ–¹å‘">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="æ¼”:æ–¹å‘"><xsl:value-of select="../@presentation:preset-sub-type"/></xsl:attribute>
+ </æ¼”:å字形扩展>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-random-bars']">
+ <æ¼”:éšæœºçº¿æ¡ uof:locID="p0107" uof:attrList="速度 æ–¹å‘">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="æ¼”:æ–¹å‘"><xsl:value-of select="../@presentation:preset-sub-type"/></xsl:attribute>
+ </æ¼”:éšæœºçº¿æ¡>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-random']">
+ <æ¼”:éšæœºæ•ˆæžœ uof:locID="p0117">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:choose><xsl:when test="parent::anim:par/anim:transitionFilter/@smil:dur"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:when><xsl:otherwise><xsl:value-of select="../anim:animate/@smil:dur"/></xsl:otherwise></xsl:choose></xsl:with-param></xsl:call-template></xsl:attribute>
+ </æ¼”:éšæœºæ•ˆæžœ>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-split']">
+ <æ¼”:劈裂 uof:locID="p0104" uof:attrList="速度 æ–¹å‘">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="æ¼”:æ–¹å‘"><xsl:choose><xsl:when test="../@presentation:preset-sub-type = 'horizontal-out'">horizontal out</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'horizontal-in'">horizontal in</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'vertical-in'">vertical in</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'vertical-out'">vertical out</xsl:when></xsl:choose></xsl:attribute>
+ </演:劈裂>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-venetian-blinds']">
+ <æ¼”:百å¶çª— uof:locID="p0100" uof:attrList="速度 æ–¹å‘">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="æ¼”:æ–¹å‘"><xsl:value-of select="../@presentation:preset-sub-type"/></xsl:attribute>
+ </æ¼”:百å¶çª—>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-wedge']">
+ <演:扇形展开 uof:locID="p0106" uof:attrList="速度">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ </演:扇形展开>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-wheel']">
+ <æ¼”:è½®å­ uof:locID="p0113" uof:attrList="速度 è½®è¾">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="æ¼”:è½®è¾"><xsl:value-of select="../@presentation:preset-sub-type"/></xsl:attribute>
+ </æ¼”:è½®å­>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-wipe']">
+ <æ¼”:擦除 uof:locID="p0110" uof:attrList="速度 æ–¹å‘">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="æ¼”:æ–¹å‘"><xsl:choose><xsl:when test="../@presentation:preset-sub-type = 'from-right'">from right</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-left'">from left</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-top'">from top</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-bottom'">from bottom</xsl:when></xsl:choose></xsl:attribute>
+ </演:擦除>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-boomerang']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-bounce']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-curve-down']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-flip']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-float']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-fold']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-glide']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-magnify']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-movie-credits']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-pinwheel']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-breaks']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-sling']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-swish']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-swivel']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-thread']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-whip']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-ascend']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-center-revolve']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-collapse']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-colored-lettering']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-descend']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-ease-out']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-sink-down']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-spin-out']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-stretchy']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-turn-and-grow ']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-unfold']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-zoom']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-contract']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-fade-out']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-fade-out-and-swivel']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-fade-out-and-zoom']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="draw:page" mode="styles">
+ <xsl:call-template name="creategraphicstyles"/>
+ </xsl:template>
+ <xsl:template match="style:handout-master" mode="styles">
+ <xsl:call-template name="creategraphicstyles"/>
+ </xsl:template>
+ <xsl:template match="style:master-page" mode="styles">
+ <xsl:apply-templates select="presentation:notes" mode="styles"/>
+ <xsl:call-template name="creategraphicstyles"/>
+ </xsl:template>
+ <xsl:template match="presentation:notes" mode="styles">
+ <xsl:call-template name="creategraphicstyles"/>
+ </xsl:template>
+ <xsl:template name="creategraphicstyles">
+ <xsl:for-each select="node()">
+ <xsl:variable name="nodename1">
+ <xsl:value-of select="name()"/>
+ </xsl:variable>
+ <xsl:if test="(substring-before($nodename1,':') = 'draw')">
+ <xsl:call-template name="draw">
+ <xsl:with-param name="nodename1" select="$nodename1"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="draw">
+ <xsl:param name="nodename1"/>
+ <xsl:choose>
+ <xsl:when test="substring-after($nodename1,':') = 'a'">
+ <xsl:for-each select="child::*">
+ <xsl:call-template name="draw">
+ <xsl:with-param name="nodename">
+ <xsl:value-of select="name()"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:when test="substring-after($nodename1,':') = 'g'">
+ <xsl:call-template name="draw:g"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="creategraphic"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="draw:g">
+ <xsl:for-each select="child::*">
+ <xsl:choose>
+ <xsl:when test="name()='draw:g'">
+ <xsl:call-template name="draw:g"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="creategraphic"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ <xsl:call-template name="creategraphic"/>
+ </xsl:template>
+ <xsl:template name="zuheliebiao">
+ <xsl:param name="allnode"/>
+ <xsl:param name="pos"/>
+ <xsl:choose>
+ <xsl:when test="../child::*[$pos]">
+ <xsl:for-each select="../child::*[$pos]">
+ <xsl:variable name="nodepos">
+ <xsl:value-of select="@draw:style-name"/>
+ </xsl:variable>
+ <xsl:variable name="picnumber1">
+ <xsl:value-of select="count(preceding::*[@draw:style-name=$nodepos])"/>
+ </xsl:variable>
+ <xsl:variable name="pic-name1">
+ <xsl:value-of select="concat($nodepos,'_',$picnumber1)"/>
+ </xsl:variable>
+ <xsl:variable name="allnode1">
+ <xsl:value-of select="concat($allnode,',',$pic-name1)"/>
+ </xsl:variable>
+ <xsl:call-template name="zuheliebiao">
+ <xsl:with-param name="allnode" select="$allnode1"/>
+ <xsl:with-param name="pos" select="$pos+1"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$allnode"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="creategraphic">
+ <xsl:variable name="nodename">
+ <xsl:value-of select="name()"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="@draw:style-name or name()='draw:g'">
+ <xsl:variable name="pic-name">
+ <xsl:value-of select="@draw:style-name"/>
+ </xsl:variable>
+ <xsl:variable name="pic-num">
+ <xsl:value-of select="count(/descendant::*[@draw:style-name=$pic-name])"/>
+ </xsl:variable>
+ <xsl:variable name="picnumber">
+ <xsl:value-of select="count(preceding::*[@draw:style-name=$pic-name])"/>
+ </xsl:variable>
+ <xsl:call-template name="pic-process">
+ <xsl:with-param name="pic-name" select="$pic-name"/>
+ <xsl:with-param name="nodename" select="$nodename"/>
+ <xsl:with-param name="picnumber" select="$picnumber"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="@presentation:style-name">
+ <xsl:variable name="pic-name">
+ <xsl:value-of select="@presentation:style-name"/>
+ </xsl:variable>
+ <xsl:variable name="pic-num">
+ <xsl:value-of select="count(/descendant::*[@presentation:style-name=$pic-name])"/>
+ </xsl:variable>
+ <xsl:variable name="picnumber">
+ <xsl:value-of select="count(preceding::*[@presentation:style-name=$pic-name])"/>
+ </xsl:variable>
+ <xsl:call-template name="pic-process">
+ <xsl:with-param name="pic-name" select="$pic-name"/>
+ <xsl:with-param name="picnumber" select="$picnumber"/>
+ <xsl:with-param name="nodename" select="$nodename"/>
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="pic-process">
+ <xsl:param name="pic-name"/>
+ <xsl:param name="nodename"/>
+ <xsl:param name="picnumber"/>
+ <图:图形 uof:locID="g0000" uof:attrList="层次 标识符 组åˆåˆ—表 其他对象">
+ <xsl:attribute name="图:标识符"><xsl:choose><xsl:when test="@draw:id"><xsl:value-of select="@draw:id"/></xsl:when><xsl:when test="not(@draw:style-name) and name()='draw:g'"><xsl:value-of select="concat(child::node()[1]/@draw:style-name,'-',$picnumber)"/></xsl:when><xsl:otherwise><xsl:value-of select="concat($pic-name,'_',$picnumber)"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="图:层次"><xsl:choose><xsl:when test="name(parent::node())='draw:g'"><xsl:value-of select="position()"/></xsl:when><xsl:when test="@draw:z-index"><xsl:value-of select="@draw:z-index"/></xsl:when>
+ <xsl:otherwise><xsl:value-of select="position()"/></xsl:otherwise>
+ </xsl:choose></xsl:attribute>
+ <xsl:if test="$nodename='draw:g'">
+ <xsl:attribute name="图:组åˆåˆ—表"><xsl:for-each select="child::*[1]"><xsl:variable name="node1"><xsl:value-of select="@draw:style-name"/></xsl:variable><xsl:variable name="picnumber2"><xsl:value-of select="count(preceding::*[@draw:style-name=$node1])"/></xsl:variable><xsl:call-template name="zuheliebiao"><xsl:with-param name="allnode"><xsl:value-of select="concat($node1,'_',$picnumber2)"/></xsl:with-param><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:for-each></xsl:attribute>
+ </xsl:if>
+ <xsl:if test=".//office:binary-data">
+ <xsl:attribute name="图:其他对象"><xsl:choose><xsl:when test="@draw:name"><xsl:value-of select="@draw:name"/></xsl:when><xsl:otherwise><xsl:value-of select="concat($pic-name,'_b1')"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:variable name="arrow-sign">
+ <xsl:choose>
+ <xsl:when test="key('graphicset',$pic-name)/style:graphic-properties/@draw:marker-start or key('graphicset',$pic-name)/style:graphic-properties/@draw:marker-end">
+ <xsl:value-of select="'1'"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$nodename='draw:line' or $nodename='draw:rect' or $nodename='draw:circle' or $nodename='draw:polygon' or $nodename='draw:polyline' or $nodename='draw:ellipse' or $nodename='draw:page-thumbnail' or $nodename='draw:frame' or $nodename='draw:path'or $nodename='draw:g'">
+ <图:预定义图形 uof:locID="g0005">
+ <图:类别 uof:locID="g0006">
+ <xsl:choose>
+ <xsl:when test="$nodename='draw:rect'">11</xsl:when>
+ <xsl:when test="$nodename='draw:line'">61</xsl:when>
+ <xsl:when test="$nodename='draw:circle'">19</xsl:when>
+ <xsl:when test="$nodename='draw:polygon'">65</xsl:when>
+ <xsl:when test="$nodename='draw:polyline'">66</xsl:when>
+ <xsl:when test="$nodename='draw:ellipse'">19</xsl:when>
+ <xsl:when test="$nodename='draw:page-thumbnail'">67</xsl:when>
+ <xsl:when test="$nodename='draw:frame'">3</xsl:when>
+ <xsl:when test="$nodename='draw:path'">64</xsl:when>
+ <xsl:when test="$nodename='draw:g'">4</xsl:when>
+ </xsl:choose>
+ </图:类别>
+ <图:å称 uof:locID="g0007">
+ <xsl:choose>
+ <xsl:when test="$nodename='draw:rect'">Rectangle</xsl:when>
+ <xsl:when test="$nodename='draw:line'">Line</xsl:when>
+ <xsl:when test="$nodename='draw:circle'">Oval</xsl:when>
+ <xsl:when test="$nodename='draw:polygon'">Freeform</xsl:when>
+ <xsl:when test="$nodename='draw:polyline'">Scribble</xsl:when>
+ <xsl:when test="$nodename='draw:ellipse'">Oval</xsl:when>
+ <xsl:when test="$nodename='draw:page-thumbnail'">缩略图</xsl:when>
+ <xsl:when test="$nodename='draw:frame'">文本框</xsl:when>
+ <xsl:when test="$nodename='draw:path'">Curve</xsl:when>
+ <xsl:when test="$nodename='draw:g'">group</xsl:when>
+ </xsl:choose>
+ </图:å称>
+ <图:生æˆè½¯ä»¶ uof:locID="g0008">PNG</图:生æˆè½¯ä»¶>
+ <xsl:if test="./@draw:points or ./@svg:d">
+ <图:关键点åæ ‡ uof:locID="g0009" uofattrList="路径">
+ <xsl:attribute name="图:路径"><xsl:choose><xsl:when test="@svg:d"><xsl:value-of select="@svg:d"/></xsl:when><xsl:when test="@draw:points"><xsl:call-template name="draw:points"><xsl:with-param name="point" select="@draw:points"/><xsl:with-param name="lujing"/></xsl:call-template></xsl:when></xsl:choose></xsl:attribute>
+ </图:关键点åæ ‡>
+ </xsl:if>
+ <图:属性 uof:locID="g0011">
+ <xsl:for-each select="(/office:document/office:styles/descendant::*[@style:name=$pic-name]) | (/office:document/*/style:style[@style:name=$pic-name]) ">
+ <xsl:for-each select="style:graphic-properties">
+ <xsl:if test="not(@draw:fill='none')">
+ <图:填充 uof:locID="g0012">
+ <xsl:call-template name="å¡«å……">
+ <xsl:with-param name="nodename" select="$nodename"/>
+ <xsl:with-param name="picname" select="$pic-name"/>
+ </xsl:call-template>
+ </图:填充>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:if test="style:graphic-properties/@svg:stroke-color">
+ <图:线颜色 uof:locID="g0013">
+ <xsl:value-of select="style:graphic-properties/@svg:stroke-color"/>
+ </图:线颜色>
+ </xsl:if>
+ <图:线型 uof:locID="g0014">
+ <xsl:variable name="linetype" select="style:graphic-properties/@draw:stroke-dash"/>
+ <xsl:choose>
+ <xsl:when test="not(style:graphic-properties/@draw:stroke)">
+ <xsl:choose>
+ <xsl:when test="not(style:graphic-properties/@svg:stroke-width)">single</xsl:when>
+ <xsl:otherwise>thick</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="style:graphic-properties/@draw:stroke = 'none'">none</xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="$linetype='Fine_20_Dashed' and style:graphic-properties/@svg:stroke-width">dash-long-heavy</xsl:when>
+ <xsl:when test="$linetype='Fine_20_Dashed'">dash-long</xsl:when>
+ <xsl:when test="$linetype='_32__20_Dots_20_1_20_Dash' and style:graphic-properties/@svg:stroke-width">dash-dot-dot-heavy</xsl:when>
+ <xsl:when test="$linetype='_32__20_Dots_20_1_20_Dash'">dot-dot-dash</xsl:when>
+ <xsl:when test="$linetype='Ultrafine_20_Dashed' and style:graphic-properties/@svg:stroke-width">dashed-heavy</xsl:when>
+ <xsl:when test="$linetype='Ultrafine_20_Dotted_20__28_var_29_'and style:graphic-properties/@svg:stroke-width">dotted-heavy</xsl:when>
+ <xsl:when test="$linetype='Ultrafine_20_Dotted_20__28_var_29_'">dotted</xsl:when>
+ <xsl:when test="$linetype='Line_20_with_20_Fine_20_Dots'">double</xsl:when>
+ <xsl:when test="$linetype='_33__20_Dashes_20_3_20_Dots_20__28_var_29_' and style:graphic-properties/@svg:stroke-width">dash-dot-heavy</xsl:when>
+ <xsl:when test="$linetype='_33__20_Dashes_20_3_20_Dots_20__28_var_29_'">dot-dash</xsl:when>
+ <xsl:when test="$linetype='Ultrafine_20_2_20_Dots_20_3_20_Dashes'and style:graphic-properties/@svg:stroke-width">wavy-heavy</xsl:when>
+ <xsl:when test="$linetype='Ultrafine_20_2_20_Dots_20_3_20_Dashes'">wave</xsl:when>
+ <xsl:when test="$linetype='Fine_20_Dashed_20__28_var_29_'">wavy-double</xsl:when>
+ <xsl:otherwise>dash</xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </图:线型>
+ <xsl:if test="style:graphic-properties/@svg:stroke-width">
+ <图:线粗细 uof:locID="g0016">
+ <xsl:value-of select="substring-before(style:graphic-properties/@svg:stroke-width,$uofUnit)"/>
+ </图:线粗细>
+ </xsl:if>
+ <xsl:if test="style:graphic-properties/@draw:marker-start and string-length(style:graphic-properties/@draw:marker-start)&gt;0">
+ <图:å‰ç«¯ç®­å¤´ uof:locID="g0017">
+ <图:å¼æ · uof:locID="g0018">
+ <xsl:choose>
+ <xsl:when test="style:graphic-properties/@draw:marker-start='Arrow'">normal</xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:marker-start='Line_20_Arrow'">open</xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:marker-start='Arrow_20_concave'">stealth</xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:marker-start='Circle'">oval</xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:marker-start='Square_20_45'">diamond</xsl:when>
+ <xsl:otherwise>normal</xsl:otherwise>
+ </xsl:choose>
+ </图:å¼æ ·>
+ <xsl:if test="style:graphic-properties/@draw:marker-start-width">
+ <图:å¤§å° uof:locID="g0019">
+ <xsl:variable name="width">
+ <xsl:value-of select="substring-before(style:graphic-properties/@draw:marker-start-width,$uofUnit)"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="($width&lt;0.05 and 0&lt;$width) or $width=0.05">1</xsl:when>
+ <xsl:when test="($width&lt;0.10 and 0.05&lt;$width) or $width=0.10">2</xsl:when>
+ <xsl:when test="($width&lt;0.15 and 0.10&lt;$width) or $width=0.15">3</xsl:when>
+ <xsl:when test="($width&lt;0.20 and 0.15&lt;$width) or $width=0.20">4</xsl:when>
+ <xsl:when test="($width&lt;0.25 and 0.20&lt;$width) or $width=0.25">5</xsl:when>
+ <xsl:when test="($width&lt;0.30 and 0.25&lt;$width) or $width=0.30">6</xsl:when>
+ <xsl:when test="($width&lt;0.35 and 0.30&lt;$width) or $width=0.35">7</xsl:when>
+ <xsl:when test="($width&lt;0.40 and 0.35&lt;$width) or $width=0.40">8</xsl:when>
+ <xsl:otherwise>9</xsl:otherwise>
+ </xsl:choose>
+ </图:大å°>
+ </xsl:if>
+ </图:å‰ç«¯ç®­å¤´>
+ </xsl:if>
+ <xsl:if test="style:graphic-properties/@draw:marker-end">
+ <图:åŽç«¯ç®­å¤´ uof:locID="g0020">
+ <图:å¼æ · uof:locID="g0021">
+ <xsl:choose>
+ <xsl:when test="style:graphic-properties/@draw:marker-end='Arrow'">normal</xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:marker-end='Line_20_Arrow'">open</xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:marker-end='Arrow_20_concave'">stealth</xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:marker-end='Circle'">oval</xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:marker-end='Square_20_45'">diamond</xsl:when>
+ <xsl:otherwise>normal</xsl:otherwise>
+ </xsl:choose>
+ </图:å¼æ ·>
+ <xsl:if test="style:graphic-properties/@draw:marker-end-width">
+ <图:å¤§å° uof:locID="g0022">
+ <xsl:variable name="width">
+ <xsl:value-of select="number(substring-before(style:graphic-properties/@draw:marker-end-width,$uofUnit))"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="($width&lt;0.05 and 0&lt;$width) or $width=0.05">1</xsl:when>
+ <xsl:when test="($width&lt;0.10 and 0.05&lt;$width) or $width=0.10">2</xsl:when>
+ <xsl:when test="($width&lt;0.15 and 0.10&lt;$width) or $width=0.15">3</xsl:when>
+ <xsl:when test="($width&lt;0.20 and 0.15&lt;$width) or $width=0.20">4</xsl:when>
+ <xsl:when test="($width&lt;0.25 and 0.20&lt;$width) or $width=0.25">5</xsl:when>
+ <xsl:when test="($width&lt;0.30 and 0.25&lt;$width) or $width=0.30">6</xsl:when>
+ <xsl:when test="($width&lt;0.35 and 0.30&lt;$width) or $width=0.35">7</xsl:when>
+ <xsl:when test="($width&lt;0.40 and 0.35&lt;$width) or $width=0.40">8</xsl:when>
+ <xsl:otherwise>9</xsl:otherwise>
+ </xsl:choose>
+ </图:大å°>
+ </xsl:if>
+ </图:åŽç«¯ç®­å¤´>
+ </xsl:if>
+ <xsl:if test="style:graphic-properties/@draw:opacity or style:graphic-properties/@svg:stroke-opacity or style:graphic-properties/@svg:stroke-opacity">
+ <图:é€æ˜Žåº¦ uof:locID="g0038">
+ <xsl:choose>
+ <xsl:when test="style:graphic-properties/@draw:opacity">
+ <xsl:variable name="transparency">
+ <xsl:value-of select="substring-before(style:graphic-properties/@draw:opacity,'%')"/>
+ </xsl:variable>
+ <xsl:value-of select="(100 - $transparency) div 100"/>
+ </xsl:when>
+ <xsl:when test="style:graphic-properties/@svg:stroke-opacity">
+ <xsl:variable name="transparency">
+ <xsl:value-of select="substring-before(style:graphic-properties/@svg:stroke-opacity,'%')"/>
+ </xsl:variable>
+ <xsl:value-of select="(100 - $transparency) div 100"/>
+ </xsl:when>
+ <xsl:when test="style:properties/@svg:stroke-opacity">
+ <xsl:value-of select="substring-before(style:properties/@svg:stroke-opacity,'%')"/>
+ </xsl:when>
+ </xsl:choose>
+ </图:é€æ˜Žåº¦>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:choose>
+ <xsl:when test="@svg:x1">
+ <图:宽度 uof:locID="g0023">
+ <xsl:value-of select="substring-before(@svg:x2,$uofUnit) - substring-before(@svg:x1,$uofUnit)"/>
+ </图:宽度>
+ <图:高度 uof:locID="g0024">
+ <xsl:value-of select="substring-before(@svg:y2,$uofUnit) - substring-before(@svg:y1,$uofUnit)"/>
+ </图:高度>
+ </xsl:when>
+ <xsl:when test="@svg:x">
+ <图:宽度 uof:locID="g0023">
+ <xsl:value-of select="substring-before(@svg:width,$uofUnit)"/>
+ </图:宽度>
+ <图:高度 uof:locID="g0024">
+ <xsl:value-of select="substring-before(@svg:height,$uofUnit)"/>
+ </图:高度>
+ </xsl:when>
+ <xsl:when test="@svg:width">
+ <图:宽度 uof:locID="g0023">
+ <xsl:value-of select="substring-before(@svg:width,$uofUnit)"/>
+ </图:宽度>
+ <图:高度 uof:locID="g0024">
+ <xsl:value-of select="substring-before(@svg:height,$uofUnit)"/>
+ </图:高度>
+ </xsl:when>
+ </xsl:choose>
+ <图:旋转角度 uof:locID="g0025">
+ <xsl:choose>
+ <xsl:when test="@draw:transform">
+ <xsl:variable name="rotate-angle">
+ <xsl:value-of select="@draw:transform"/>
+ </xsl:variable>
+ <xsl:variable name="rotate-temp">
+ <xsl:value-of select="substring-before(substring-after($rotate-angle,'rotate ('),')')"/>
+ </xsl:variable>
+ <xsl:value-of select="($rotate-temp * 360) div (2 * 3.14159265)"/>
+ </xsl:when>
+ <xsl:otherwise>0.0</xsl:otherwise>
+ </xsl:choose>
+ </图:旋转角度>
+ <图:X-缩放比例 uof:locID="g0026">1</图:X-缩放比例>
+ <图:Y-缩放比例 uof:locID="g0027">1</图:Y-缩放比例>
+ <图:é”定纵横比 uof:locID="g0028">0</图:é”定纵横比>
+ <图:相对原始比例 uof:locID="g0029">1</图:相对原始比例>
+ <图:打å°å¯¹è±¡ uof:locID="g0032">true</图:打å°å¯¹è±¡>
+ <图:Web文字 uof:locID="g0033"/>
+ </图:属性>
+ </图:预定义图形>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="./text:p or ./draw:text-box">
+ <图:文本内容 uof:locID="g0002" uof:attrList="文本框 å·¦è¾¹è· å³è¾¹è· ä¸Šè¾¹è· ä¸‹è¾¹è· æ°´å¹³å¯¹é½ åž‚ç›´å¯¹é½ æ–‡å­—æŽ’åˆ—æ–¹å‘ è‡ªåŠ¨æ¢è¡Œ 大å°é€‚应文字 å‰ä¸€é“¾æŽ¥ åŽä¸€é“¾æŽ¥">
+ <xsl:if test="$nodename='draw:text-box'">
+ <xsl:attribute name="图:文本框">true</xsl:attribute>
+ <xsl:if test="./@draw:name = /office:document/office:body
+//draw:text-box/@draw:chain-next-name">
+ <xsl:attribute name="图:å‰ä¸€é“¾æŽ¥"><xsl:variable name="drawname"><xsl:value-of select="./@draw:name"/></xsl:variable><xsl:variable name="befor-link-name"><xsl:value-of select="/office:document/office:body
+//draw:text-box[@draw:name=$drawname]/@draw:style-name"/></xsl:variable><xsl:value-of select="concat($befor-link-name,'_',$picnumber)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="./@draw:chain-next-name">
+ <xsl:attribute name="图:åŽä¸€é“¾æŽ¥"><xsl:variable name="next-link"><xsl:value-of select="./@draw:chain-next-name"/></xsl:variable><xsl:variable name="link-name"><xsl:value-of select="/office:document/office:body
+//draw:text-box[@draw:name=$next-link]/@draw:style-name"/></xsl:variable><xsl:value-of select="concat($link-name,'_',$picnumber)"/></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:for-each select="(/office:document/office:styles/descendant::*[@style:name=$pic-name]) | (/office:document/office:automatic-styles/descendant::*[@style:name=$pic-name]) ">
+ <xsl:if test="style:graphic-properties/@fo:padding-left">
+ <xsl:attribute name="图:左边è·"><xsl:value-of select="substring-before(style:graphic-properties/@fo:padding-left,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="图:å³è¾¹è·"><xsl:value-of select="substring-before(style:graphic-properties/@fo:padding-right,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="图:上边è·"><xsl:value-of select="substring-before(style:graphic-properties/@fo:padding-top,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="图:下边è·"><xsl:value-of select="substring-before(style:graphic-properties/@fo:padding-bottom,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="图:文字排列方å‘">
+ <xsl:choose>
+ <xsl:when test="style:paragraph-properties/@style:writing-mode">
+ <xsl:choose>
+ <xsl:when test="style:paragraph-properties/@style:writing-mode='tb-rl' and style:graphic-properties/@draw:textarea-vertical-align='bottom'">vert-l2r</xsl:when>
+ <xsl:when test="style:paragraph-properties/@style:writing-mode='tb-rl'">vert-r2l</xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:textarea-horizontal-align='right'">hori-r2l</xsl:when>
+ <xsl:otherwise>hori-l2r</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:if test="style:graphic-properties/@fo:wrap-option">
+ <xsl:attribute name="图:自动æ¢è¡Œ">true</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:graphic-properties/@draw:auto-grow-width='true'">
+ <xsl:attribute name="图:大å°é€‚应文字">true</xsl:attribute>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:if test="./draw:text-box">
+ <xsl:for-each select="draw:text-box/node( )">
+ <xsl:choose>
+ <xsl:when test="name()='text:list'">
+ <xsl:call-template name="unordered-ordered-list">
+ <xsl:with-param name="currlistlvl" select="number('1')"/>
+ <xsl:with-param name="liststylename" select="@text:style-name"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name()='text:p'or name()='text:h'">
+ <xsl:call-template name="execParagraph">
+ <xsl:with-param name="currlistlvl" select="number('0')"/>
+ <xsl:with-param name="liststylename" select="string('00000')"/>
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:if test="./text:p">
+ <xsl:call-template name="execParagraph">
+ <xsl:with-param name="currlistlvl" select="number('0')"/>
+ <xsl:with-param name="liststylename" select="string('00000')"/>
+ </xsl:call-template>
+ </xsl:if>
+ </图:文本内容>
+ </xsl:if>
+ <图:控制点 uof:locID="g0003" uof:attrList="xåæ ‡ yåæ ‡">
+ <xsl:attribute name="图:xåæ ‡"><xsl:value-of select="substring-before(@svg:x,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="图:yåæ ‡"><xsl:value-of select="substring-before(@svg:y,$uofUnit)"/></xsl:attribute>
+ </图:控制点>
+ <图:翻转 uof:locID="g0040" uof:attrList="æ–¹å‘" 图:æ–¹å‘="x"/>
+ </图:图形>
+ <xsl:if test="name(..)='draw:g'">
+ <图:组åˆä½ç½® uof:locID="g0041" uof:attrList="xåæ ‡ yåæ ‡">
+ <xsl:attribute name="图:xåæ ‡"><xsl:variable name="minx"><xsl:for-each select="parent::node()"><xsl:call-template name="groupminx"><xsl:with-param name="value" select="number(substring-before(descendant::node()[@svg:x][1]/@svg:x,$uofUnit))"/><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:for-each></xsl:variable><xsl:choose><xsl:when test="name(.)='draw:g'"><xsl:variable name="current-minx"><xsl:call-template name="groupminx"><xsl:with-param name="value" select="number(substring-before(descendant::node()[@svg:x][1]/@svg:x,$uofUnit))"/><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:variable><xsl:value-of select="$current-minx - $minx"/></xsl:when><xsl:otherwise><xsl:variable name="current-x" select="number(substring-before(@svg:x,$uofUnit))"/><xsl:value-of select="$current-x - $minx"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="图:yåæ ‡"><xsl:variable name="miny"><xsl:for-each select="parent::node()"><xsl:call-template name="groupminy"><xsl:with-param name="value" select="number(substring-before(descendant::node()[@svg:y][1]/@svg:y,$uofUnit))"/><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:for-each></xsl:variable><xsl:choose><xsl:when test="name(.)='draw:g'"><xsl:variable name="current-miny"><xsl:call-template name="groupminy"><xsl:with-param name="value" select="number(substring-before(descendant::node()[@svg:y][1]/@svg:y,$uofUnit))"/><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:variable><xsl:value-of select="$current-miny - $miny"/></xsl:when><xsl:otherwise><xsl:variable name="current-y" select="number(substring-before(@svg:y,$uofUnit))"/><xsl:value-of select="$current-y - $miny"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </图:组åˆä½ç½®>
+ </xsl:if>
+ <xsl:if test="name()='draw:frame' and ./draw:image">
+ <uof:其他对象 uof:locID="u0036" uof:attrList="标识符 内嵌 公共类型 ç§æœ‰ç±»åž‹">
+ <xsl:attribute name="uof:标识符"><xsl:choose><xsl:when test="@draw:id"><xsl:value-of select="@draw:id"/></xsl:when><xsl:otherwise><xsl:value-of select="concat($pic-name,'_',$picnumber)"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="uof:内嵌">true</xsl:attribute>
+ <xsl:attribute name="uof:公共类型">jpg</xsl:attribute>
+ <xsl:if test="./draw:image/office:binary-data">
+ <uof:æ•°æ® uof:locID="u0037">
+ <xsl:value-of select="./draw:image/office:binary-data"/>
+ </uof:æ•°æ®>
+ </xsl:if>
+ <xsl:if test="./draw:image/@xlink:href">
+ <uof:路径 uof:locID="u0038">
+ <xsl:value-of select="./draw:image/@xlink:href"/>
+ </uof:路径>
+ </xsl:if>
+ </uof:其他对象>
+ </xsl:if>
+ <xsl:for-each select="(/office:document/office:styles/descendant::*[@style:name=$pic-name]) | (/office:document/office:automatic-styles/descendant::*[@style:name=$pic-name]) ">
+ <xsl:if test="style:graphic-properties/@draw:fill-image-name and @draw:fill='bitmap'">
+ <uof:其他对象 uof:locID="u0036" uof:attrList="标识符 内嵌 公共类型 ç§æœ‰ç±»åž‹">
+ <xsl:attribute name="uof:标识符"><xsl:choose><xsl:when test="@draw:id"><xsl:value-of select="@draw:id"/></xsl:when><xsl:otherwise><xsl:value-of select="concat($pic-name,'_',$picnumber)"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="uof:公共类型">jpg</xsl:attribute>
+ <xsl:attribute name="uof:内嵌">true</xsl:attribute>
+ <xsl:variable name="fill-name">
+ <xsl:value-of select="style:graphic-properties/@draw:fill-image-name"/>
+ </xsl:variable>
+ <uof:æ•°æ® uof:locID="u0037">
+ <xsl:for-each select="/office:document/office:styles/draw:fill-image[@draw:name=$fill-name]">
+ <xsl:value-of select="office:binary-data"/>
+ </xsl:for-each>
+ </uof:æ•°æ®>
+ <uof:路径 uof:locID="u0038">
+ <xsl:value-of select="@xlink:href"/>
+ </uof:路径>
+ </uof:其他对象>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="unordered-ordered-list">
+ <xsl:param name="currlistlvl"/>
+ <xsl:param name="liststylename"/>
+ <xsl:for-each select="text:list-item">
+ <xsl:if test="text:p">
+ <xsl:for-each select="text:p">
+ <xsl:call-template name="execParagraph">
+ <xsl:with-param name="currlistlvl" select="$currlistlvl"/>
+ <xsl:with-param name="liststylename" select="$liststylename"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:for-each select="node( )">
+ <xsl:if test="name()='text:list'">
+ <xsl:call-template name="unordered-ordered-list">
+ <xsl:with-param name="currlistlvl" select="$currlistlvl +1"/>
+ <xsl:with-param name="liststylename" select="$liststylename"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="groupminx">
+ <xsl:param name="value"/>
+ <xsl:param name="pos"/>
+ <xsl:choose>
+ <xsl:when test="descendant::node()[@svg:x][position()=$pos]">
+ <xsl:variable name="othervalue" select="number(substring-before(descendant::node()[@svg:x][position()=$pos]/@svg:x,$uofUnit))"/>
+ <xsl:call-template name="groupminx">
+ <xsl:with-param name="value">
+ <xsl:choose>
+ <xsl:when test="$value&gt;$othervalue">
+ <xsl:value-of select="$othervalue"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="pos" select="$pos+1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="groupminy">
+ <xsl:param name="value"/>
+ <xsl:param name="pos"/>
+ <xsl:choose>
+ <xsl:when test="descendant::node()[@svg:y][position()=$pos]">
+ <xsl:variable name="othervalue" select="number(substring-before(descendant::node()[@svg:y][position()=$pos]/@svg:y,$uofUnit))"/>
+ <xsl:call-template name="groupminy">
+ <xsl:with-param name="value">
+ <xsl:choose>
+ <xsl:when test="$value&gt;$othervalue">
+ <xsl:value-of select="$othervalue"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="pos" select="$pos+1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="groupmaxx">
+ <xsl:param name="value"/>
+ <xsl:param name="pos"/>
+ <xsl:choose>
+ <xsl:when test="descendant::node()[@svg:x][position()=$pos]">
+ <xsl:variable name="svgx">
+ <xsl:value-of select="number(substring-before(descendant::node()[@svg:x][position()=$pos]/@svg:x,$uofUnit))"/>
+ </xsl:variable>
+ <xsl:variable name="width">
+ <xsl:value-of select="number(substring-before(descendant::node()[@svg:x][position()=$pos]/@svg:width,$uofUnit))"/>
+ </xsl:variable>
+ <xsl:variable name="othervalue" select="$svgx + $width"/>
+ <xsl:call-template name="groupminx">
+ <xsl:with-param name="value">
+ <xsl:choose>
+ <xsl:when test="$value&gt;$othervalue">
+ <xsl:value-of select="$value"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$othervalue"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="pos" select="$pos+1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="groupmaxy">
+ <xsl:param name="value"/>
+ <xsl:param name="pos"/>
+ <xsl:choose>
+ <xsl:when test="descendant::node()[@svg:y][position()=$pos]">
+ <xsl:variable name="svgy">
+ <xsl:value-of select="number(substring-before(descendant::node()[@svg:y][position()=$pos]/@svg:y,$uofUnit))"/>
+ </xsl:variable>
+ <xsl:variable name="height">
+ <xsl:value-of select="number(substring-before(descendant::node()[@svg:y][position()=$pos]/@svg:height,$uofUnit))"/>
+ </xsl:variable>
+ <xsl:variable name="othervalue" select="$svgy + $height"/>
+ <xsl:call-template name="groupminy">
+ <xsl:with-param name="value">
+ <xsl:choose>
+ <xsl:when test="$value&gt;$othervalue">
+ <xsl:value-of select="$value"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$othervalue"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="pos" select="$pos+1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="draw:points">
+ <xsl:param name="point"/>
+ <xsl:param name="lujing"/>
+ <xsl:choose>
+ <xsl:when test="contains($point,' ' )">
+ <xsl:variable name="first-point" select="substring-before($point,' ')"/>
+ <xsl:variable name="other-point" select="substring-after($point,' ')"/>
+ <xsl:variable name="xzuobiao">
+ <xsl:value-of select="substring-before($first-point,',') div 1000"/>
+ </xsl:variable>
+ <xsl:variable name="yzuobiao">
+ <xsl:value-of select="substring-after($first-point,',') div 1000"/>
+ </xsl:variable>
+ <xsl:call-template name="draw:points">
+ <xsl:with-param name="point" select="$other-point"/>
+ <xsl:with-param name="lujing" select="concat($lujing,$xzuobiao,' ',$yzuobiao,'lineto')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="xzuobiao">
+ <xsl:value-of select="substring-before($point,',') div 1000"/>
+ </xsl:variable>
+ <xsl:variable name="yzuobiao">
+ <xsl:value-of select="substring-after($point,',') div 1000"/>
+ </xsl:variable>
+ <xsl:value-of select="concat($lujing,$xzuobiao,' ',$yzuobiao)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="execParagraph">
+ <xsl:param name="currlistlvl"/>
+ <xsl:param name="liststylename"/>
+ <å­—:æ®µè½ uof:locID="t0051" uof:attrList="标识符">
+ <xsl:if test="@text:id">
+ <xsl:attribute name="字:动画标识"><xsl:value-of select="@text:id"/></xsl:attribute>
+ </xsl:if>
+ <xsl:element name="å­—:段è½å±žæ€§">
+ <xsl:attribute name="uof:locID">t0052</xsl:attribute>
+ <xsl:attribute name="uof:attrList">å¼æ ·å¼•ç”¨</xsl:attribute>
+ <xsl:attribute name="å­—:å¼æ ·å¼•ç”¨"><xsl:choose><xsl:when test="@text:id"><xsl:value-of select="@text:id"/></xsl:when><xsl:otherwise><xsl:value-of select="@text:style-name"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="not(number($currlistlvl) =number('0'))">
+ <xsl:variable name="parent-position">
+ <xsl:number from="/office:document/office:body/text:ordered-list" level="any" count="text:list-item/text:p" format="1"/>
+ </xsl:variable>
+ <xsl:element name="å­—:自动编å·ä¿¡æ¯">
+ <xsl:attribute name="uof:locID">t0059</xsl:attribute>
+ <xsl:attribute name="uof:attrList">ç¼–å·å¼•ç”¨ ç¼–å·çº§åˆ« é‡æ–°ç¼–å· èµ·å§‹ç¼–å·</xsl:attribute>
+ <xsl:attribute name="å­—:ç¼–å·å¼•ç”¨"><xsl:value-of select="$liststylename"/></xsl:attribute>
+ <xsl:attribute name="å­—:ç¼–å·çº§åˆ«"><xsl:value-of select="$currlistlvl"/></xsl:attribute>
+ <xsl:attribute name="å­—:é‡æ–°ç¼–å·"><xsl:choose><xsl:when test="number($parent-position)=number('1')">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="å­—:起始编å·"><xsl:for-each select="//text:list-style[$liststylename=@style:name]/*[number($currlistlvl)=number(@text:level)]"><xsl:choose><xsl:when test="@text:start-value"><xsl:value-of select="@text:start-value"/></xsl:when><xsl:otherwise>1</xsl:otherwise></xsl:choose></xsl:for-each></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:variable name="stylename">
+ <xsl:value-of select="@text:style-name"/>
+ </xsl:variable>
+ <xsl:for-each select="(//style:style[@style:name=$stylename])">
+ <xsl:call-template name="ParaAttribute">
+ <xsl:with-param name="text-style-name" select="@text:style-name"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:element>
+ <xsl:for-each select="node( )">
+ <xsl:choose>
+ <xsl:when test="self::node( )[name(.)='text:span']">
+ <xsl:call-template name="textspan"/>
+ </xsl:when>
+ <xsl:when test="self::node()[name(.)='text:time']">
+ <xsl:apply-templates select="."/>
+ </xsl:when>
+ <xsl:when test="self::node()[name(.)='text:s']">
+ <xsl:apply-templates select="."/>
+ </xsl:when>
+ <xsl:when test="substring-before(name(.),':')='draw' and not(name(.)='draw:a')">
+ </xsl:when>
+ <xsl:when test="name(.)='text:a'">
+ <å­—:å¥ uof:locID="t0085">
+ <xsl:element name="å­—:å¥å±žæ€§">
+ <xsl:attribute name="uof:locID">t0086</xsl:attribute>
+ <xsl:attribute name="uof:attrList">å¼æ ·å¼•ç”¨</xsl:attribute>
+ <å­—:字体 uof:locID="t0088" uof:attrList="西文字体引用 中文字体引用 å­—å· é¢œè‰²" å­—:颜色="#0000ff"/>
+ <字:下划线 uof:locID="t0095" 字:类型="single" 字:颜色="#0000ff" uof:attrList="类型 颜色 字下划线"/>
+ </xsl:element>
+ <xsl:element name="字:区域开始">
+ <xsl:attribute name="字:标识符">hlnk<xsl:number from="/office:document/office:body" level="any" count="text:p[text:a]"/></xsl:attribute>
+ <xsl:attribute name="å­—:å称">Hyperlink</xsl:attribute>
+ <xsl:attribute name="字:类型">hyperlink</xsl:attribute>
+ <xsl:attribute name="uof:locID">t0121</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符 å称 类型</xsl:attribute>
+ </xsl:element>
+ <字:文本串 uof:locID="t0109" uof:attrList="udsPath">
+ <xsl:value-of select="."/>
+ </字:文本串>
+ <xsl:element name="å­—:区域结æŸ">
+ <xsl:attribute name="字:标识符引用">hlnk<xsl:number from="/office:document/office:body" level="any" count="text:p[text:a]"/></xsl:attribute>
+ <xsl:attribute name="uof:locID">t0122</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符引用</xsl:attribute>
+ </xsl:element>
+ </å­—:å¥>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="å­—:å¥"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </å­—:段è½>
+ </xsl:template>
+ <xsl:template name="å­—:å¥">
+ <xsl:if test="not(name(.)='text:bookmark-start' or name(.)='text:bookmark-end' or name(.)='draw:image' or name(.)='office:binary-data')">
+ <å­—:å¥ uof:locID="t0085">
+ <å­—:å¥å±žæ€§ uof:locID="t0086" uof:attrList="å¼æ ·å¼•ç”¨">
+ <xsl:choose>
+ <xsl:when test="@text:style-name">
+ <xsl:attribute name="å­—:å¼æ ·å¼•ç”¨"><xsl:value-of select="@text:style-name"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="å­—:å¼æ ·å¼•ç”¨"><xsl:value-of select="parent::node( )/@text:style-name"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </å­—:å¥å±žæ€§>
+ <xsl:choose>
+ <xsl:when test="(preceding-sibling::text:bookmark-start) and (following-sibling::text:bookmark-end)">
+ <å­—:区域开始 uof:locID="t0121" uof:attrList="标识符 å称 类型">
+ <xsl:attribute name="字:标识符"><xsl:value-of select="preceding-sibling::text:bookmark-start/@text:name"/></xsl:attribute>
+ <xsl:attribute name="å­—:å称">Bookmark</xsl:attribute>
+ <xsl:attribute name="字:类型">bookmark</xsl:attribute>
+ </字:区域开始>
+ <字:文本串 uof:locID="t0109" uof:attrList="udsPath">
+ <xsl:value-of select="string(.)"/>
+ </字:文本串>
+ <å­—:åŒºåŸŸç»“æŸ uof:locID="t0122" uof:attrList="标识符引用">
+ <xsl:attribute name="字:标识符引用"><xsl:value-of select="following-sibling::text:bookmark-end/@text:name"/></xsl:attribute>
+ </å­—:区域结æŸ>
+ </xsl:when>
+ <xsl:when test="preceding-sibling::text:bookmark">
+ <å­—:区域开始 uof:locID="t0121" uof:attrList="标识符 å称 类型">
+ <xsl:attribute name="字:标识符"><xsl:value-of select="preceding-sibling::text:bookmark/@text:name"/></xsl:attribute>
+ <xsl:attribute name="å­—:å称">Bookmark</xsl:attribute>
+ <xsl:attribute name="字:类型">bookmark</xsl:attribute>
+ </字:区域开始>
+ <å­—:åŒºåŸŸç»“æŸ uof:locID="t0122" uof:attrList="标识符引用">
+ <xsl:attribute name="字:标识符引用"><xsl:value-of select="preceding-sibling::text:bookmark/@text:name"/></xsl:attribute>
+ </å­—:区域结æŸ>
+ <字:文本串 uof:locID="t0109" uof:attrList="udsPath">
+ <xsl:value-of select="string(.)"/>
+ </字:文本串>
+ </xsl:when>
+ <xsl:when test="name(.)='draw:a'">
+ <xsl:variable name="link-name">
+ <xsl:value-of select="substring-after(@xlink:href,'#')"/>
+ </xsl:variable>
+ <å­—:区域开始 uof:locID="t0121" uof:attrList="标识符 å称 类型">
+ <xsl:attribute name="字:标识符"><xsl:value-of select="$link-name"/></xsl:attribute>
+ <xsl:attribute name="å­—:å称">Bookmark</xsl:attribute>
+ <xsl:attribute name="字:类型">bookmark</xsl:attribute>
+ </字:区域开始>
+ <å­—:åŒºåŸŸç»“æŸ uof:locID="t0122" uof:attrList="标识符引用">
+ <xsl:attribute name="字:标识符引用"><xsl:value-of select="$link-name"/></xsl:attribute>
+ </å­—:区域结æŸ>
+ </xsl:when>
+ <xsl:when test="self::node( )[name(.)='text:tab-stop']">
+ <xsl:element name="字:制表符">
+ <xsl:attribute name="uof:locID">t0123</xsl:attribute>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="name(.)='text:bookmark-start' or name(.)='text:bookmark-end' or name(.)='draw:image' or name(.)='office:binary-data'">
+ </xsl:when>
+ <xsl:otherwise>
+ <字:文本串 uof:locID="t0109" uof:attrList="udsPath">
+ <xsl:value-of select="string(.)"/>
+ </字:文本串>
+ </xsl:otherwise>
+ </xsl:choose>
+ </å­—:å¥>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="jiaozhu">
+ <字:脚注 uof:locID="t0107" uof:attrList="引文体">
+ <xsl:call-template name="execParagraph">
+ <xsl:with-param name="currlistlvl" select="number('0')"/>
+ <xsl:with-param name="liststylename" select="string('00000')"/>
+ </xsl:call-template>
+ </字:脚注>
+ </xsl:template>
+ <xsl:template match="text:s">
+ <xsl:param name="bText"/>
+ <xsl:choose>
+ <xsl:when test="$bText='0'">
+ <xsl:variable name="count">
+ <xsl:choose>
+ <xsl:when test="not(@text:c)">1</xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="@text:c+1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <å­—:å¥ uof:locID="t0085">
+ <字:空格符 uof:locID="t0126" uof:attrList="个数" 字:个数="{$count}"/>
+ </å­—:å¥>
+ </xsl:when>
+ <xsl:otherwise>
+ <字:空格符 uof:locID="t0126" uof:attrList="个数" 字:个数="{@text:c}"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="weizhu">
+ <字:尾注 uof:locID="t0108" uof:attrList="引文体">
+ <xsl:call-template name="execParagraph">
+ <xsl:with-param name="currlistlvl" select="number('0')"/>
+ <xsl:with-param name="liststylename" select="string('00000')"/>
+ </xsl:call-template>
+ </字:尾注>
+ </xsl:template>
+ <xsl:template match="text:time">
+ <xsl:element name="字:域开始">
+ <xsl:attribute name="字:类型"><xsl:value-of select="'TIME'"/></xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="text:fixed='1'">
+ <xsl:attribute name="å­—:é”定">true</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="å­—:é”定">false</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="uof:locID">t0079</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 é”定</xsl:attribute>
+ </xsl:element>
+ <xsl:element name="å­—:域代ç ">
+ <å­—:æ®µè½ uof:locID="t0051">
+ <å­—:å¥ uof:locID="t0085">
+ <å­—:å¥å±žæ€§ uof:locID="t0086" uof:attrList="å¼æ ·å¼•ç”¨"/>
+ <xsl:variable name="timefmt">
+ <xsl:variable name="aa" select="@style:data-style-name"/>
+ <xsl:for-each select="key('geshi',$aa)/number:hours | key('geshi',$aa)/number:minutes | key('geshi',$aa)/number:am-pm | key('geshi',$aa)/number:seconds | key('geshi',$aa)/number:text">
+ <xsl:choose>
+ <xsl:when test="@number:style='long' ">
+ <xsl:if test="self::node( )[name(.)='number:hours']">HH</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:minutes']">MM</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:seconds']">SS</xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="self::node( )[name(.)='number:text']">
+ <xsl:value-of select="."/>
+ </xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:hours']">H</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:minutes']">M</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:seconds']">S</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:am-pm']">AMPM</xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:variable name="quote">"</xsl:variable>
+ <字:文本串 uof:locID="t0109" uof:attrList="udsPath">
+ <xsl:value-of select="concat('TIME \@ ',$quote,$timefmt,$quote,' \* MERGEFORMAT ')"/>
+ </字:文本串>
+ </å­—:å¥>
+ </å­—:段è½>
+ </xsl:element>
+ <å­—:å¥ uof:locID="t0085">
+ <字:文本串 uof:locID="t0109" uof:attrList="udsPath">
+ <xsl:value-of select="."/>
+ </字:文本串>
+ </å­—:å¥>
+ <xsl:element name="å­—:域结æŸ">
+ <xsl:attribute name="uof:locID">t0081</xsl:attribute>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="ParaAttribute">
+ <xsl:param name="text-style-name"/>
+ <xsl:for-each select="/office:document/office:styles/style:style">
+ <xsl:if test="@style:name=$text-style-name and not($text-style-name='Standard')">
+ <xsl:element name="å­—:æ ¼å¼ä¿®è®¢">
+ <xsl:attribute name="uof:locID">t0053</xsl:attribute>
+ <xsl:attribute name="uof:attrList">修订信æ¯å¼•ç”¨</xsl:attribute>
+ <xsl:attribute name="å­—:修订信æ¯å¼•ç”¨"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <xsl:element name="å­—:段è½å±žæ€§">
+ <xsl:attribute name="uof:locID">t0052</xsl:attribute>
+ <xsl:attribute name="uof:attrList">å¼æ ·å¼•ç”¨</xsl:attribute>
+ <xsl:attribute name="å­—:å¼æ ·å¼•ç”¨"><xsl:value-of select="@style:name"/></xsl:attribute>
+ </xsl:element>
+ </xsl:element>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:if test="@style:name='Heading'">
+ <xsl:element name="字:大纲级别">
+ <xsl:attribute name="uof:locID">t0054</xsl:attribute>
+ <xsl:value-of select="substring-after(@style:name,'Heading')"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test=".//@fo:text-align or .//@style:vertical-align">
+ <xsl:element name="å­—:对é½">
+ <xsl:attribute name="uof:locID">t0055</xsl:attribute>
+ <xsl:attribute name="uof:attrList">æ°´å¹³å¯¹é½ æ–‡å­—å¯¹é½</xsl:attribute>
+ <xsl:attribute name="å­—:水平对é½"><xsl:choose><xsl:when test=".//@fo:text-align='end'">right</xsl:when><xsl:when test=".//@fo:text-align='center'">center</xsl:when><xsl:when test=".//@fo:text-align='justify' and not(.//@fo:text-align-last='justify')">justified</xsl:when><xsl:when test=".//@fo:text-align='justify' and .//@fo:text-align-last='justify'">distributed</xsl:when><xsl:otherwise>left</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="å­—:文字对é½"><xsl:choose><xsl:when test=".//@style:vertical-align='baseline'">base</xsl:when><xsl:when test=".//@style:vertical-align='top'">top</xsl:when><xsl:when test=".//@style:vertical-align='middle'">center</xsl:when><xsl:when test=".//@style:vertical-align='bottom'">bottom</xsl:when><xsl:otherwise>auto</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test=".//@fo:margin-left or .//@fo:margin-right or .//@fo:text-indent">
+ <xsl:element name="字:缩进">
+ <xsl:attribute name="uof:locID">t0056</xsl:attribute>
+ <xsl:call-template name="字:缩进类型"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="å­—:è¡Œè·">
+ <xsl:attribute name="uof:locID">t0057</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 值</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="contains(.//@fo:line-height,$uofUnit)">
+ <xsl:attribute name="字:类型">fixed</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:value-of select="substring-before(.//@fo:line-height,$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="contains(.//@fo:line-height,'%')">
+ <xsl:attribute name="字:类型">multi-lines</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:value-of select="substring-before(.//@fo:line-height,'%') div 100"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test=".//@style:line-height-at-least">
+ <xsl:attribute name="字:类型">at-least</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:value-of select="substring-before(.//@style:line-height-at-least,$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test=".//@style:line-spacing">
+ <xsl:attribute name="字:类型">line-space</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:value-of select="substring-before(.//@style:line-spacing,$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="字:类型">multi-lines</xsl:attribute>
+ <xsl:attribute name="字:值">1.0</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:if test=".//@fo:orphans">
+ <xsl:element name="字:孤行控制">
+ <xsl:attribute name="uof:locID">t0060</xsl:attribute>
+ <xsl:value-of select=".//@fo:orphans"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test=".//@fo:widows">
+ <xsl:element name="字:寡行控制">
+ <xsl:attribute name="uof:locID">t0061</xsl:attribute>
+ <xsl:value-of select=".//@fo:widows"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test=".//@style:break-inside">
+ <xsl:element name="å­—:段中ä¸åˆ†é¡µ">
+ <xsl:attribute name="uof:locID">t0062</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值">true</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test=".//@fo:keep-with-next">
+ <xsl:element name="å­—:与下段åŒé¡µ">
+ <xsl:attribute name="uof:locID">t0063</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值">true</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test=".//@fo:break-before">
+ <xsl:element name="å­—:段å‰åˆ†é¡µ">
+ <xsl:attribute name="uof:locID">t0064</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值">true</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test=".//@style:snap-to-layout-grid">
+ <xsl:element name="å­—:对é½ç½‘æ ¼">
+ <xsl:attribute name="uof:locID">t0069</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test=".//@style:snap-to-layout-grid='true'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test=".//style:drop-cap">
+ <xsl:element name="字:首字下沉">
+ <xsl:attribute name="uof:locID">t0070</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 字体引用 字符数 行数 é—´è·</xsl:attribute>
+ <xsl:attribute name="字:类型">dropped</xsl:attribute>
+ <xsl:if test=".//style:drop-cap/@style:style-name">
+ <xsl:attribute name="字:字体引用"><xsl:value-of select=".//style:drop-cap/@style:style-name"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test=".//style:drop-cap/@style:distance">
+ <xsl:attribute name="å­—:é—´è·"><xsl:value-of select="substring-before(.//style:drop-cap/@style:distance,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test=".//style:drop-cap/@style:length">
+ <xsl:attribute name="字:字符数"><xsl:value-of select=".//style:drop-cap/@style:length"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test=".//style:drop-cap/@style:lines">
+ <xsl:attribute name="字:行数"><xsl:value-of select=".//style:drop-cap/@style:lines"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test=".//@fo:hyphenate">
+ <xsl:element name="å­—:å–消断字">
+ <xsl:attribute name="uof:locID">t0071</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:value-of select=".//@fo:hyphenate"/></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test=".//@text:number-lines">
+ <xsl:element name="å­—:å–消行å·">
+ <xsl:attribute name="字:值"><xsl:value-of select=".//@text:number-lines"/></xsl:attribute>
+ <xsl:attribute name="uof:locID">t0072</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="å­—:å…许å•è¯æ–­å­—">
+ <xsl:attribute name="字:值">true</xsl:attribute>
+ <xsl:attribute name="uof:locID">t0073</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ </xsl:element>
+ <xsl:if test=".//@style:punctuation-wrap">
+ <xsl:element name="字:行首尾标点控制">
+ <xsl:attribute name="uof:locID">t0074</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test=".//@style:punctuation-wrap='hanging'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="å­—:是å¦è¡Œé¦–标点压缩">
+ <xsl:attribute name="uof:locID">t0075</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值">false</xsl:attribute>
+ </xsl:element>
+ <xsl:if test=".//@style:line-break ">
+ <xsl:element name="字:中文习惯首尾字符">
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test=".//@style:line-break='strict'">true</xsl:when><xsl:when test=".//@style:line-break='normal'">false</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:attribute name="uof:locID">t0076</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test=".//@style:text-autospace">
+ <xsl:element name="å­—:自动调整中英文字符间è·">
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test=".//@style:text-autospace='ideograph-alpha'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="uof:locID">t0077</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test=".//@style:text-autospace">
+ <xsl:element name="å­—:自动调整中文与数字间è·">
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test=".//@style:text-autospace='ideograph-alpha'">true </xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="uof:locID">t0078</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="å­—:有网格自动调整å³ç¼©è¿›">
+ <xsl:attribute name="字:值">false</xsl:attribute>
+ <xsl:attribute name="uof:locID">t0195</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ </xsl:element>
+ <xsl:if test=".//@fo:border or .//@fo:border-top or .//@fo:border-bottom or .//@fo:border-left or .//@fo:border-right or .//@style:shadow[.!='none']">
+ <xsl:element name="字:边框">
+ <xsl:attribute name="uof:locID">t0065</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test=".//@fo:background-color">
+ <xsl:element name="å­—:å¡«å……">
+ <xsl:attribute name="uof:locID">t0066</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test=".//@fo:margin-top or .//@fo:margin-bottom">
+ <å­—:æ®µé—´è· uof:locID="t0058">
+ <xsl:if test=".//@fo:margin-top">
+ <å­—:段å‰è· uof:locID="t0196">
+ <å­—:ç»å¯¹å€¼ uof:locID="t0199" uof:attrList="值">
+ <xsl:attribute name="字:值"><xsl:value-of select="substring-before(.//@fo:margin-top,$uofUnit)"/></xsl:attribute>
+ </å­—:ç»å¯¹å€¼>
+ </å­—:段å‰è·>
+ </xsl:if>
+ <xsl:if test=".//@fo:margin-bottom">
+ <å­—:段åŽè· uof:locID="t0196">
+ <å­—:ç»å¯¹å€¼ uof:locID="t0202" uof:attrList="值">
+ <xsl:attribute name="字:值"><xsl:value-of select="substring-before(.//@fo:margin-bottom,$uofUnit)"/></xsl:attribute>
+ </å­—:ç»å¯¹å€¼>
+ </å­—:段åŽè·>
+ </xsl:if>
+ </å­—:段间è·>
+ </xsl:if>
+ <xsl:if test=".//style:tab-stops">
+ <xsl:element name="å­—:制表ä½è®¾ç½®">
+ <xsl:attribute name="uof:locID">t0067</xsl:attribute>
+ <xsl:for-each select=".//style:tab-stops/style:tab-stop">
+ <xsl:element name="å­—:制表ä½">
+ <xsl:attribute name="uof:locID">t0068</xsl:attribute>
+ <xsl:attribute name="uof:attrList">ä½ç½® 类型 å‰å¯¼ç¬¦</xsl:attribute>
+ <xsl:attribute name="å­—:ä½ç½®"><xsl:value-of select="@style:position"/></xsl:attribute>
+ <xsl:variable name="aa">
+ <xsl:value-of select="@style:type"/>
+ </xsl:variable>
+ <xsl:variable name="zbflx">
+ <xsl:choose>
+ <xsl:when test="$aa='right'">right</xsl:when>
+ <xsl:when test="$aa='center'">center</xsl:when>
+ <xsl:when test="$aa='char'and @style:char!=''">decimal</xsl:when>
+ <xsl:otherwise>left</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="字:类型"><xsl:value-of select="$zbflx"/></xsl:attribute>
+ <xsl:if test="$zbflx='decimal'">
+ <xsl:attribute name="å­—:制表ä½å­—符"><xsl:value-of select="@style:char"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@style:leader-char">
+ <xsl:attribute name="å­—:å‰å¯¼ç¬¦"><xsl:value-of select="@style:leader-char"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="textspan">
+ <å­—:å¥ uof:locID="t0085">
+ <xsl:choose>
+ <xsl:when test="./text:footnote">
+ <xsl:call-template name="jiaozhu"/>
+ </xsl:when>
+ <xsl:when test="./text:endnote">
+ <xsl:call-template name="weizhu"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="å­—:å¥å±žæ€§">
+ <xsl:attribute name="uof:locID">t0086</xsl:attribute>
+ <xsl:attribute name="uof:attrList">å¼æ ·å¼•ç”¨</xsl:attribute>
+ <xsl:variable name="textstyle">
+ <xsl:value-of select="@text:style-name"/>
+ </xsl:variable>
+ <xsl:attribute name="å­—:å¼æ ·å¼•ç”¨"><xsl:value-of select="@text:style-name"/></xsl:attribute>
+ <xsl:for-each select="/office:document/office:automatic-styles//style:style[@style:family='text']">
+ <xsl:if test="@style:name=$textstyle and not(@style:parent-style-name='Standard')">
+ <xsl:if test="@style:parent-style-name=/office:document/office:styles/style:style/@style:name">
+ <xsl:call-template name="SentenceXD">
+ <xsl:with-param name="Sentencestyle" select="@style:parent-style-name"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:for-each select="/office:document/office:styles//style:style[@style:family='text']">
+ <xsl:if test="@style:name=$textstyle">
+ <xsl:call-template name="SentenceXD">
+ <xsl:with-param name="Sentencestyle" select="@style:name"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:element>
+ <字:文本串 uof:locID="t0109" uof:attrList="udsPath">
+ <xsl:value-of select="string(.)"/>
+ </字:文本串>
+ </xsl:otherwise>
+ </xsl:choose>
+ </å­—:å¥>
+ </xsl:template>
+ <xsl:template name="SentenceXD">
+ <xsl:param name="Sentencestyle"/>
+ <xsl:element name="å­—:æ ¼å¼ä¿®è®¢">
+ <xsl:attribute name="uof:locID">t0087</xsl:attribute>
+ <xsl:attribute name="uof:attrList">修订信æ¯å¼•ç”¨</xsl:attribute>
+ <xsl:attribute name="å­—:修订信æ¯å¼•ç”¨"><xsl:value-of select="$Sentencestyle"/></xsl:attribute>
+ <xsl:element name="å­—:å¥å±žæ€§">
+ <xsl:attribute name="uof:locID">t0086</xsl:attribute>
+ <xsl:attribute name="uof:attrList">å¼æ ·å¼•ç”¨</xsl:attribute>
+ <xsl:attribute name="å­—:å¼æ ·å¼•ç”¨"><xsl:value-of select="$Sentencestyle"/></xsl:attribute>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="add-space">
+ <xsl:param name="number"/>
+ <xsl:if test="$number &gt; 1">
+ <xsl:call-template name="add-space">
+ <xsl:with-param name="number" select="$number - 1"/>
+ </xsl:call-template>
+ <xsl:text> </xsl:text>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="office:styles | office:automatic-styles" mode="style">
+ <xsl:for-each select="style:style[@style:family= 'paragraph' or @style:family= 'text']">
+ <xsl:choose>
+ <xsl:when test="@style:family = 'text'">
+ <xsl:call-template name="å¥å¼æ ·"/>
+ </xsl:when>
+ <xsl:when test="@style:family = 'paragraph'">
+ <xsl:call-template name="段è½å¼æ ·"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="段è½å¼æ ·">
+ <xsl:element name="uof:段è½å¼æ ·">
+ <xsl:attribute name="uof:locID">u0044</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符 å称 类型 别å 基å¼æ ·å¼•ç”¨</xsl:attribute>
+ <xsl:variable name="count"><xsl:value-of select="count(preceding::style:style)"/></xsl:variable>
+ <xsl:attribute name="字:标识符"><xsl:value-of select="concat(@style:name,$count)"/></xsl:attribute>
+ <xsl:attribute name="字:类型">default</xsl:attribute>
+ <xsl:attribute name="å­—:基å¼æ ·å¼•ç”¨"><xsl:variable name="stylename" select="@style:name"/><xsl:variable name="frame-parent"><xsl:choose><xsl:when test="/office:document/office:master-styles/style:master-page/draw:frame[draw:text-box//text:p/@text:style-name = $stylename]"><xsl:for-each select="/office:document/office:master-styles/style:master-page/draw:frame[draw:text-box//text:p/@text:style-name = $stylename][1]"><xsl:variable name="frame-style" select="@presentation:style-name"/><xsl:value-of select="/office:document/*/style:style[@style:name=$frame-style]/@style:parent-style-name"/></xsl:for-each></xsl:when><xsl:otherwise>not-master</xsl:otherwise></xsl:choose></xsl:variable><xsl:choose><xsl:when test="@style:parent-style-name"><xsl:value-of select="@style:parent-style-name"/></xsl:when><xsl:when test="not($frame-parent='not-master')"><xsl:value-of select="$frame-parent"/></xsl:when></xsl:choose></xsl:attribute>
+ <xsl:attribute name="å­—:å称"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <xsl:apply-templates select="style:paragraph-properties"/>
+ <xsl:for-each select="style:text-properties">
+ <xsl:element name="å­—:å¥å±žæ€§">
+ <xsl:attribute name="uof:locID">t0086</xsl:attribute>
+ <xsl:attribute name="uof:attrList">å¼æ ·å¼•ç”¨</xsl:attribute>
+ <xsl:call-template name="å­—:å¥å±žæ€§"/>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="style:paragraph-properties">
+ <xsl:element name="字:缩进">
+ <xsl:attribute name="uof:locID">t0056</xsl:attribute>
+ <xsl:call-template name="字:缩进类型"/>
+ </xsl:element>
+ <xsl:if test="@fo:text-align | @fotext-align-last">
+ <xsl:element name="å­—:对é½">
+ <xsl:attribute name="uof:locID">t0055</xsl:attribute>
+ <xsl:if test="@fo:text-align">
+ <xsl:attribute name="å­—:水平对é½"><xsl:choose><xsl:when test=".//@fo:text-align='end'">right</xsl:when><xsl:when test=".//@fo:text-align='center'">center</xsl:when><xsl:when test=".//@fo:text-align='justify' and not(.//@fo:text-align-last='justify')">justified</xsl:when><xsl:when test=".//@fo:text-align='justify' and .//@fo:text-align-last='justify'">distributed</xsl:when><xsl:otherwise>left</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@style:vertical-align">
+ <xsl:attribute name="å­—:文字对é½"><xsl:choose><xsl:when test=".//@style:vertical-align='baseline'">base</xsl:when><xsl:when test=".//@style:vertical-align='top'">top</xsl:when><xsl:when test=".//@style:vertical-align='middle'">center</xsl:when><xsl:when test=".//@style:vertical-align='bottom'">bottom</xsl:when><xsl:otherwise>auto</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="uof:attrList">æ°´å¹³å¯¹é½ æ–‡å­—å¯¹é½</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="å¥å¼æ ·">
+ <xsl:element name="uof:å¥å¼æ ·">
+ <xsl:attribute name="uof:locID">u0043</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符 å称 类型 别å 基å¼æ ·å¼•ç”¨</xsl:attribute>
+ <xsl:attribute name="字:标识符"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <xsl:attribute name="å­—:å称"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <xsl:attribute name="字:类型">auto</xsl:attribute>
+ <xsl:call-template name="å­—:å¥å±žæ€§"/>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="style:text-properties">
+ <xsl:element name="字:字体">
+ <xsl:attribute name="uof:locID">t0088</xsl:attribute>
+ <xsl:attribute name="uof:attrList">西文字体引用 中文字体引用 特殊字体引用 西文绘制 å­—å· ç›¸å¯¹å­—å· é¢œè‰²</xsl:attribute>
+ <xsl:if test=".//@fo:font-size or .//@style:font-size-asian or .//@style:font-size-complex">
+ <xsl:choose>
+ <xsl:when test="contains(.//@fo:font-size,'%') or contains(.//@style:font-size-asian,'%')">
+ <xsl:attribute name="å­—:相对字å·"><xsl:choose><xsl:when test=".//@fo:font-size"><xsl:value-of select="substring-before(.//@fo:font-size,'%')"/></xsl:when><xsl:when test=".//@style:font-size-asian"><xsl:value-of select="substring-before(.//@style:font-size-asian,'%')"/></xsl:when></xsl:choose></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="å­—:å­—å·"><xsl:choose><xsl:when test=".//@fo:font-size"><xsl:value-of select="substring-before(.//@fo:font-size,'pt')"/></xsl:when><xsl:when test=".//@style:font-size-asian"><xsl:value-of select="substring-before(.//@style:font-size-asian,'pt')"/></xsl:when><xsl:when test=".//@style:font-size-complex"><xsl:value-of select="substring-before(.//@style:font-size-complex,'pt')"/></xsl:when></xsl:choose></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test=".//@style:font-name">
+ <xsl:attribute name="字:西文字体引用"><xsl:value-of select=".//@style:font-name"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test=".//@style:font-name-asian">
+ <xsl:attribute name="字:中文字体引用"><xsl:value-of select=".//@style:font-name-asian"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test=".//@fo:color">
+ <xsl:attribute name="字:颜色"><xsl:value-of select=".//@fo:color"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:if test="(@fo:font-weight='bold') or (@fo:font-weight-asian='bold') or (@style:font-weight-asian='bold') or (@style:font-weight-complex='bold')">
+ <xsl:element name="字:粗体">
+ <xsl:attribute name="字:值">1</xsl:attribute>
+ <xsl:attribute name="uof:locID">t0089</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="(@style:font-style-asian='italic') or (@style:font-style-complex='italic') or (@fo:font-style-asian='italic') or (@fo:font-style='italic')">
+ <xsl:element name="字:斜体">
+ <xsl:attribute name="字:值">1</xsl:attribute>
+ <xsl:attribute name="uof:locID">t0090</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="style:page-layout">
+ <xsl:element name="æ¼”:页é¢è®¾ç½®">
+ <xsl:attribute name="uof:locID">p0002</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符 å称</xsl:attribute>
+ <xsl:attribute name="æ¼”:å称"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <xsl:attribute name="演:标识符"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <xsl:attribute name="æ¼”:å称">页é¢è®¾ç½®</xsl:attribute>
+ <xsl:element name="演:纸张">
+ <xsl:attribute name="uof:locID">p0003</xsl:attribute>
+ <xsl:attribute name="uof:attrList">宽度 高度 纸型</xsl:attribute>
+ <xsl:attribute name="uof:宽度"><xsl:value-of select="substring-before(style:page-layout-properties/@fo:page-width,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="uof:高度"><xsl:value-of select="substring-before(style:page-layout-properties/@fo:page-height,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="uof:纸型"><xsl:variable name="height"><xsl:value-of select="style:page-layout-properties/@fo:page-height"/></xsl:variable><xsl:variable name="width"><xsl:value-of select="style:page-layout-properties/@fo:page-width"/></xsl:variable><xsl:choose><xsl:when test="$height='29.7cm' and $width='42cm'">A3</xsl:when><xsl:when test="$height='21cm' and $width='29.7cm'">A4</xsl:when><xsl:when test="$height='14.8cm' and $width='21cm'">A5</xsl:when><xsl:when test="$height='25cm' and $width='35.3cm'">B4</xsl:when><xsl:when test="$height='17.6cm' and $width='25cm'">B5</xsl:when><xsl:when test="$height='12.5cm' and $width='17.6cm'">B6</xsl:when><xsl:otherwise>使用者</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ <xsl:element name="æ¼”:页边è·">
+ <xsl:attribute name="uof:locID">p0004</xsl:attribute>
+ <xsl:attribute name="uof:attrList">å·¦ 上 å³ ä¸‹</xsl:attribute>
+ <xsl:attribute name="uof:å·¦"><xsl:value-of select="substring-before(style:page-layout-properties/@fo:margin-left,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="uof:上"><xsl:value-of select="substring-before(style:page-layout-properties/@fo:margin-top,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="uof:å³"><xsl:value-of select="substring-before(style:page-layout-properties/@fo:margin-right,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="uof:下"><xsl:value-of select="substring-before(style:page-layout-properties/@fo:margin-bottom,$uofUnit)"/></xsl:attribute>
+ </xsl:element>
+ <xsl:variable name="PageNumberFormat">
+ <xsl:value-of select="/office:document/office:settings/config:config-item-set/config:config-item[@config:name='PageNumberFormat']"/>
+ </xsl:variable>
+ <xsl:if test="not($PageNumberFormat='5')">
+ <xsl:element name="æ¼”:页ç æ ¼å¼">
+ <xsl:attribute name="uof:locID">p0005</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="$PageNumberFormat='0'">upper-letter</xsl:when>
+ <xsl:when test="$PageNumberFormat='1'">lower-letter</xsl:when>
+ <xsl:when test="$PageNumberFormat='2'">upper-roman</xsl:when>
+ <xsl:when test="$PageNumberFormat='3'">lower-letter</xsl:when>
+ <xsl:when test="$PageNumberFormat='4'">decimal</xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="æ¼”:纸张方å‘">
+ <xsl:attribute name="uof:locID">p0006</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="style:page-layout-properties/@style:print-orientation">
+ <xsl:value-of select="style:page-layout-properties/@style:print-orientation"/>
+ </xsl:when>
+ <xsl:otherwise>portrait</xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="obtain_anim_type">
+ <xsl:param name="flytype"/>
+ <xsl:variable name="flytypestr" select="substring-after($flytype,'from-')"/>
+ <xsl:choose>
+ <xsl:when test="contains($flytypestr,'-')">
+ <xsl:value-of select="concat(substring-before($flytypestr,'-'),substring-after($flytypestr,'-'))"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$flytypestr"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="cm2pt">
+ <xsl:param name="cmval"/>
+ <xsl:value-of select="substring-before($cmval,$uofUnit)* $cm-to-other "/>
+ </xsl:template>
+ <xsl:template match="office:font-face-decls">
+ <uof:字体集 uof:locID="u0040">
+ <uof:默认字体 uof:ascii="Times New Roman" uof:fareast="宋体" uof:h-ansi="宋体" uof:cs="宋体"/>
+ <xsl:for-each select="style:font-face">
+ <xsl:element name="uof:字体声明">
+ <xsl:attribute name="uof:attrList">标识符 å称 字体æ—</xsl:attribute>
+ <xsl:attribute name="uof:locID">u0041</xsl:attribute>
+ <xsl:attribute name="uof:å称"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <xsl:attribute name="uof:字体æ—"><xsl:value-of select="@svg:font-family"/></xsl:attribute>
+ <xsl:if test="@style:font-charset= '02'">
+ <xsl:attribute name="uof:字符集">x-symbol</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@style:font-family-generic">
+ <xsl:choose>
+ <xsl:when test="@style:font-family-generic = 'swiss'">
+ <xsl:attribute name="uof:字体æ—">Swiss</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@style:font-family-generic ='modern'">
+ <xsl:attribute name="uof:字符集">Modern</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@style:font-family-generic='roman'">
+ <xsl:attribute name="uof:字符集">Roman</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@style:font-family-generic ='script'">
+ <xsl:attribute name="uof:字符集">Script</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@style:font-family-generic ='decorative'">
+ <xsl:attribute name="uof:字符集">Decorative</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@style:font-family-generic ='system'">
+ <xsl:attribute name="uof:字符集">System</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="uof:字符集">System</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:element>
+ </xsl:for-each>
+ <xsl:apply-templates select="style:font-decl"/>
+ </uof:字体集>
+ </xsl:template>
+ <xsl:template match="office:meta">
+ <uof:å…ƒæ•°æ® uof:locID="u0001">
+ <uof:标题 uof:locID="u0002">
+ <xsl:value-of select="dc:title"/>
+ </uof:标题>
+ <uof:åˆ›å»ºåº”ç”¨ç¨‹åº uof:locID="u0011">
+ <xsl:value-of select="meta:generator"/>
+ </uof:创建应用程åº>
+ <uof:æ‘˜è¦ uof:locID="u0007">
+ <xsl:value-of select="dc:description"/>
+ </uof:摘è¦>
+ <uof:主题 uof:locID="u0003">
+ <xsl:value-of select="dc:subject"/>
+ </uof:主题>
+ <uof:创建者 uof:locID="u0004"/>
+ <uof:作者 uof:locID="u0005">
+ <xsl:value-of select="meta:initial-creator"/>
+ </uof:作者>
+ <uof:创建日期 uof:locID="u0008">
+ <xsl:value-of select="meta:creation-date"/>
+ </uof:创建日期>
+ <uof:最åŽä½œè€… uof:locID="u0006">
+ <xsl:value-of select="dc:creator"/>
+ </uof:最åŽä½œè€…>
+ <uof:关键字集 uof:locID="u0014">
+ <xsl:for-each select=".">
+ <uof:关键字 uof:locID="u0015">
+ <xsl:value-of select="meta:keywords/@meta:keyword"/>
+ </uof:关键字>
+ </xsl:for-each>
+ </uof:关键字集>
+ <uof:编辑次数 uof:locID="u0009">
+ <xsl:value-of select="meta:editing-cycles"/>
+ </uof:编辑次数>
+ <xsl:if test="meta:editing-duration">
+ <uof:编辑时间 uof:locID="u0010">
+ <xsl:value-of select="meta:editing-duration"/>
+ </uof:编辑时间>
+ </xsl:if>
+ <xsl:if test="meta:template/@xlink:href">
+ <uof:æ–‡æ¡£æ¨¡æ¿ uof:locID="u0013">
+ <xsl:value-of select="meta:template/@xlink:href"/>
+ </uof:文档模æ¿>
+ </xsl:if>
+ <xsl:if test="meta:user-defined/@meta:name">
+ <uof:用户自定义元数æ®é›† uof:locID="u0016">
+ <xsl:for-each select="meta:user-defined">
+ <uof:ç”¨æˆ·è‡ªå®šä¹‰å…ƒæ•°æ® uof:locID="u0017" uof:attrList="å称 类型">
+ <xsl:attribute name="uof:å称"><xsl:value-of select="@meta:name"/></xsl:attribute>
+ <xsl:attribute name="uof:类型"><xsl:value-of select="'string'"/></xsl:attribute>
+ </uof:用户自定义元数æ®>
+ </xsl:for-each>
+ </uof:用户自定义元数æ®é›†>
+ </xsl:if>
+ <xsl:if test="meta:document-statistic/@meta:page-count">
+ <uof:页数 uof:locID="u0020">
+ <xsl:value-of select="meta:document-statistic/@meta:page-count"/>
+ </uof:页数>
+ </xsl:if>
+ <xsl:if test="meta:document-statistic/@meta:paragraph-count">
+ <uof:段è½æ•° uof:locID="u0025">
+ <xsl:value-of select="meta:document-statistic/@meta:paragraph-count"/>
+ </uof:段è½æ•°>
+ </xsl:if>
+ <xsl:if test="meta:document-statistic/@meta:object-count">
+ <uof:对象数 uof:locID="u0026">
+ <xsl:value-of select="meta:document-statistic/@meta:object-count"/>
+ </uof:对象数>
+ </xsl:if>
+ <xsl:if test="meta:document-statistic/@meta:character-count">
+ <uof:å­—æ•° uof:locID="u0021">
+ <xsl:value-of select="meta:document-statistic/@meta:character-count"/>
+ </uof:å­—æ•°>
+ </xsl:if>
+ <xsl:if test="meta:document-statistic/@meta:word-count">
+ <uof:中文字符数 uof:locID="u0023">
+ <xsl:value-of select="meta:document-statistic/@meta:word-count"/>
+ </uof:中文字符数>
+ </xsl:if>
+ </uof:元数æ®>
+ </xsl:template>
+ <xsl:template name="å¡«å……">
+ <xsl:param name="picname"/>
+ <xsl:param name="nodename"/>
+ <xsl:choose>
+ <xsl:when test="@draw:fill='gradient'">
+ <xsl:variable name="gradient-name">
+ <xsl:value-of select="@draw:fill-gradient-name"/>
+ </xsl:variable>
+ <xsl:for-each select="/descendant::draw:gradient[@draw:name=$gradient-name]">
+ <图:æ¸å˜ uof:locID="g0037" uof:attrList="起始色 终止色 ç§å­ç±»åž‹ 起始浓度 终止浓度 æ¸å˜æ–¹å‘ 边界 ç§å­Xä½ç½® ç§å­Yä½ç½® 类型">
+ <xsl:attribute name="图:起始色"><xsl:value-of select="@draw:start-color"/></xsl:attribute>
+ <xsl:attribute name="图:终止色"><xsl:value-of select="@draw:end-color"/></xsl:attribute>
+ <xsl:attribute name="图:ç§å­ç±»åž‹"><xsl:choose><xsl:when test="@draw:style='linear' or @draw:style='axial'">linear</xsl:when><xsl:when test="@draw:style='radial'">radar</xsl:when><xsl:when test="@draw:style='ellipsoid'">oval</xsl:when><xsl:when test="@draw:style='square'">square</xsl:when><xsl:when test="@draw:style='rectangular'">rectangle</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:attribute name="图:起始浓度"><xsl:value-of select="substring-before(@draw:start-intensity,'%')"/></xsl:attribute>
+ <xsl:attribute name="图:终止浓度"><xsl:value-of select="substring-before(@draw:end-intensity,'%')"/></xsl:attribute>
+ <xsl:variable name="angle">
+ <xsl:value-of select="@draw:angle div 10"/>
+ </xsl:variable>
+ <xsl:attribute name="图:æ¸å˜æ–¹å‘"><xsl:choose><xsl:when test="0&lt;$angle and $angle&lt;25">0</xsl:when><xsl:when test="25&lt;$angle and $angle&lt;70">45</xsl:when><xsl:when test="70&lt;$angle and $angle&lt;115">90</xsl:when><xsl:when test="115&lt;$angle and $angle&lt;160">135</xsl:when><xsl:when test="160&lt;$angle and $angle&lt;205">180</xsl:when><xsl:when test="205&lt;$angle and $angle&lt;250">225</xsl:when><xsl:when test="250&lt;$angle and $angle&lt;295">270</xsl:when><xsl:when test="295&lt;$angle and $angle&lt;340">315</xsl:when><xsl:when test="340&lt;$angle and $angle&lt;360">360</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:attribute name="图:边界"><xsl:value-of select="substring-before(@draw:border,'%')"/></xsl:attribute>
+ <xsl:if test="@draw:cx">
+ <xsl:attribute name="图:ç§å­Xä½ç½®"><xsl:value-of select="substring-before(@draw:cx,'%')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@draw:cy">
+ <xsl:attribute name="图:ç§å­Yä½ç½®"><xsl:value-of select="substring-before(@draw:cy,'%')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="图:类型">-2</xsl:attribute>
+ </图:æ¸å˜>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:when test="@draw:fill='bitmap'">
+ <图:图片 uof:locID="g0035" uof:attrList="ä½ç½® 图形引用 类型 å称">
+ <xsl:attribute name="图:ä½ç½®"><xsl:choose><xsl:when test="not(@style:repeat)">title</xsl:when><xsl:otherwise><xsl:choose><xsl:when test="@style:repeat = 'stretch'">stretch</xsl:when><xsl:when test="@style:repeat = 'repeat'">title</xsl:when><xsl:when test="@style:repeat = 'no-repeat'">center</xsl:when></xsl:choose></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="图:图形引用"><xsl:value-of select="@draw:fill-image-name"/></xsl:attribute>
+ <xsl:attribute name="图:类型">png</xsl:attribute>
+ <xsl:attribute name="图:å称"><xsl:value-of select="concat($picname,'_b1')"/></xsl:attribute>
+ </图:图片>
+ </xsl:when>
+ <xsl:when test="@draw:fill='hatch'">
+ <图:图案 uof:locID="g0036" uof:attrList="类型 图形引用 å‰æ™¯è‰² 背景色">
+ <xsl:attribute name="图:类型"><xsl:value-of select="/office:document/office:styles/draw:hatch/@draw:name"/></xsl:attribute>
+ <xsl:attribute name="图:图形引用"/>
+ <xsl:attribute name="图:å‰æ™¯è‰²"><xsl:value-of select="/office:document/office:styles/draw:hatch/@draw:color"/></xsl:attribute>
+ <xsl:attribute name="图:背景色"><xsl:choose><xsl:when test="@draw:fill-color"><xsl:value-of select="@draw:fill-color"/></xsl:when><xsl:otherwise>#ffffff</xsl:otherwise></xsl:choose></xsl:attribute>
+ </图:图案>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="$nodename='draw:frame'">
+ <xsl:if test="@draw:fill='solid'">
+ <图:颜色 uof:locID="g0034">
+ <xsl:value-of select="@draw:fill-color"/>
+ </图:颜色>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <图:颜色 uof:locID="g0034">
+ <xsl:choose>
+ <xsl:when test="@draw:fill-color">
+ <xsl:value-of select="@draw:fill-color"/>
+ </xsl:when>
+ <xsl:otherwise>#99ccff</xsl:otherwise>
+ </xsl:choose>
+ </图:颜色>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="字:缩进类型">
+ <xsl:if test="style:list-level-properties/@text:space-before">
+ <å­—:å·¦ uof:locID="t0182">
+ <å­—:ç»å¯¹ uof:locID="t0185" uof:attrList="值">
+ <xsl:attribute name="字:值"><xsl:value-of select="substring-before(style:list-level-properties/@text:space-before,$uofUnit)"/></xsl:attribute>
+ </å­—:ç»å¯¹>
+ </å­—:å·¦>
+ </xsl:if>
+ <xsl:if test="style:list-level-properties/@text:min-label-width">
+ <å­—:å³ uof:locID="t0183">
+ <å­—:ç»å¯¹ uof:locID="t0187" uof:attrList="值">
+ <xsl:attribute name="字:值"><xsl:value-of select="substring-before(style:list-level-properties/@text:min-label-width,$uofUnit)"/></xsl:attribute>
+ </å­—:ç»å¯¹>
+ </å­—:å³>
+ </xsl:if>
+ <xsl:if test="style:list-level-properties/@text:min-label-distance">
+ <字:首行 uof:locID="t0184">
+ <å­—:ç»å¯¹ uof:locID="t0189" uof:attrList="值">
+ <xsl:attribute name="字:值"><xsl:value-of select="substring-before(style:list-level-properties/@text:min-label-distance,$uofUnit)"/></xsl:attribute>
+ </å­—:ç»å¯¹>
+ </字:首行>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="uof:线型类型">
+ <xsl:param name="lineType"/>
+ <xsl:choose>
+ <xsl:when test="$lineType='single-line'">single</xsl:when>
+ <xsl:when test="$lineType='double-line'">double</xsl:when>
+ <xsl:when test="$lineType='single'">single</xsl:when>
+ <xsl:when test="$lineType='double'">double</xsl:when>
+ <xsl:when test="$lineType='dash'">dash</xsl:when>
+ <xsl:when test="$lineType='long-dash'">dash-long</xsl:when>
+ <xsl:when test="$lineType='dot-dash'">dot-dash</xsl:when>
+ <xsl:when test="$lineType='dot-dot-dash'">dot-dot-dash</xsl:when>
+ <xsl:when test="$lineType='wave'">wave</xsl:when>
+ <xsl:when test="$lineType='bold-dotted'">dotted-heavy</xsl:when>
+ <xsl:when test="$lineType='bold-dash'">dashed-heavy</xsl:when>
+ <xsl:when test="$lineType='bold-long-dash'">dash-long-heavy</xsl:when>
+ <xsl:when test="$lineType='bold-dot-dash'">dash-dot-heavy</xsl:when>
+ <xsl:when test="$lineType='bold-dot-dot-dash'">dash-dot-dot-heavy</xsl:when>
+ <xsl:when test="$lineType='bold-wave'">wavy-heavy</xsl:when>
+ <xsl:when test="$lineType='double-wave'">wavy-double</xsl:when>
+ <xsl:when test="$lineType='bold'">bold</xsl:when>
+ <xsl:when test="$lineType='small-wave'">wave</xsl:when>
+ <xsl:when test="$lineType='dotted'">dotted</xsl:when>
+ <xsl:when test="$lineType='none'">none</xsl:when>
+ </xsl:choose>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/filter/source/xslt/export/uof/odf2uof_spreadsheet.xsl b/filter/source/xslt/export/uof/odf2uof_spreadsheet.xsl
new file mode 100644
index 000000000000..1507305a8bd5
--- /dev/null
+++ b/filter/source/xslt/export/uof/odf2uof_spreadsheet.xsl
@@ -0,0 +1,6194 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:uof="http://schemas.uof.org/cn/2003/uof" xmlns:表="http://schemas.uof.org/cn/2003/uof-spreadsheet" xmlns:演="http://schemas.uof.org/cn/2003/uof-slideshow" xmlns:字="http://schemas.uof.org/cn/2003/uof-wordproc" xmlns:图="http://schemas.uof.org/cn/2003/graph" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:smil="urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0" xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" office:version="1.0" exclude-result-prefixes="office style text table draw fo xlink dc meta number presentation svg chart dr3d math form script config ooo ooow oooc dom xforms smil anim">
+ <xsl:output method="xml" indent="no" encoding="UTF-8" version="1.0"/>
+ <xsl:variable name="scValueWithUnit">
+ <xsl:value-of select="/office:document/office:automatic-styles/style:style[@style:name='co1']/style:table-column-properties/@style:column-width"/>
+ </xsl:variable>
+ <xsl:variable name="uofUnit">
+ <xsl:choose>
+ <xsl:when test="contains($scValueWithUnit,'in')">inch</xsl:when>
+ <xsl:when test="contains($scValueWithUnit,'cm')">cm</xsl:when>
+ <xsl:when test="contains($scValueWithUnit,'mm')">mm</xsl:when>
+ <xsl:when test="contains($scValueWithUnit,'pt')">pt</xsl:when>
+ <xsl:otherwise>inch</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="ooUnit">
+ <xsl:choose>
+ <xsl:when test="contains($scValueWithUnit,'inch')">inch</xsl:when>
+ <xsl:when test="contains($scValueWithUnit,'cm')">cm</xsl:when>
+ <xsl:when test="contains($scValueWithUnit,'mm')">mm</xsl:when>
+ <xsl:when test="contains($scValueWithUnit,'pt')">pt</xsl:when>
+ <xsl:otherwise>inch</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:template match="office:document">
+ <uof:UOF xmlns:uof="http://schemas.uof.org/cn/2003/uof" xmlns:表="http://schemas.uof.org/cn/2003/uof-spreadsheet" xmlns:演="http://schemas.uof.org/cn/2003/uof-slideshow" xmlns:字="http://schemas.uof.org/cn/2003/uof-wordproc" xmlns:图="http://schemas.uof.org/cn/2003/graph" uof:language="cn" uof:locID="u0000" uof:version="1.0" uof:mimetype="vnd.uof.spreadsheet">
+ <xsl:apply-templates select="/office:document/office:meta"/>
+ <uof:对象集 uof:locID="u0033">
+ <xsl:if test="/office:document/office:body/office:spreadsheet/table:table//table:table-cell/office:annotation">
+ <xsl:for-each select="/office:document/office:body/office:spreadsheet/table:table//table:table-cell/office:annotation">
+ <xsl:variable name="num">
+ <xsl:value-of select="substring-after(@draw:style-name,'gr')"/>
+ </xsl:variable>
+ <图:图形 uof:locID="g0000" uof:attrList="层次 标识符 组åˆåˆ—表 其他对象">
+ <xsl:attribute name="图:标识符"><xsl:value-of select="concat('pz',$num)"/></xsl:attribute>
+ <xsl:variable name="name" select="@draw:style-name"/>
+ <图:预定义图形 uof:locID="g0005">
+ <图:属性 uof:locID="g0011">
+ <xsl:for-each select="/office:document/office:automatic-styles/style:style[@style:name=$name]">
+ <xsl:call-template name="graphicattr"/>
+ </xsl:for-each>
+ <xsl:choose>
+ <xsl:when test="@svg:x1">
+ <图:宽度 uof:locID="g0023">
+ <xsl:value-of select="substring-before(@svg:x2,$uofUnit) - substring-before(@svg:x1,$uofUnit)"/>
+ </图:宽度>
+ <图:高度 uof:locID="g0024">
+ <xsl:value-of select="substring-before(@svg:y2,$uofUnit) - substring-before(@svg:y1,$uofUnit)"/>
+ </图:高度>
+ </xsl:when>
+ <xsl:when test="@svg:x">
+ <图:宽度 uof:locID="g0023">
+ <xsl:value-of select="substring-before(@svg:width,$uofUnit)"/>
+ </图:宽度>
+ <图:高度 uof:locID="g0024">
+ <xsl:value-of select="substring-before(@svg:height,$uofUnit)"/>
+ </图:高度>
+ </xsl:when>
+ <xsl:when test="@svg:width">
+ <图:宽度 uof:locID="g0023">
+ <xsl:value-of select="substring-before(@svg:width,$uofUnit)"/>
+ </图:宽度>
+ <图:高度 uof:locID="g0024">
+ <xsl:value-of select="substring-before(@svg:height,$uofUnit)"/>
+ </图:高度>
+ </xsl:when>
+ </xsl:choose>
+ <图:旋转角度 uof:locID="g0025">
+ <xsl:choose>
+ <xsl:when test="@draw:transform">
+ <xsl:variable name="rotate-angle">
+ <xsl:value-of select="@draw:transform"/>
+ </xsl:variable>
+ <xsl:variable name="rotate-temp">
+ <xsl:value-of select="substring-before(substring-after($rotate-angle,'rotate ('),')')"/>
+ </xsl:variable>
+ <xsl:value-of select="($rotate-temp * 360) div (2 * 3.14159265)"/>
+ </xsl:when>
+ <xsl:otherwise>0.0</xsl:otherwise>
+ </xsl:choose>
+ </图:旋转角度>
+ <图:X-缩放比例 uof:locID="g0026">1</图:X-缩放比例>
+ <图:Y-缩放比例 uof:locID="g0027">1</图:Y-缩放比例>
+ <图:é”定纵横比 uof:locID="g0028">0</图:é”定纵横比>
+ <图:相对原始比例 uof:locID="g0029">1</图:相对原始比例>
+ <图:打å°å¯¹è±¡ uof:locID="g0032">true</图:打å°å¯¹è±¡>
+ <图:Web文字 uof:locID="g0033"/>
+ </图:属性>
+ </图:预定义图形>
+ <图:文本内容 uof:locID="g0002" uof:attrList="文本框 å·¦è¾¹è· å³è¾¹è· ä¸Šè¾¹è· ä¸‹è¾¹è· æ°´å¹³å¯¹é½ åž‚ç›´å¯¹é½ æ–‡å­—æŽ’åˆ—æ–¹å‘ è‡ªåŠ¨æ¢è¡Œ 大å°é€‚应文字 å‰ä¸€é“¾æŽ¥ åŽä¸€é“¾æŽ¥">
+ <xsl:for-each select="/office:document/office:automatic-styles/style:style[@style:name=$name]">
+ <xsl:attribute name="图:文字排列方å‘"><xsl:choose><xsl:when test="style:paragraph-properties/@style:writing-mode"><xsl:choose><xsl:when test="style:paragraph-properties/@style:writing-mode='tb-rl'">vert-r2l</xsl:when><xsl:when test="style:paragraph-properties/@style:writing-mode='tb-lr'">vert-l2r</xsl:when></xsl:choose></xsl:when><xsl:when test="style:graphic-properties/@draw:textarea-horizontal-align='right'">hori-r2l</xsl:when><xsl:otherwise>hori-l2r</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="style:graphic-properties/@draw:textarea-horizontal-align">
+ <xsl:attribute name="图:水平对é½"><xsl:value-of select="style:graphic-properties/@draw:textarea-horizontal-align"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:graphic-properties/@draw:textarea-vertical-align">
+ <xsl:attribute name="图:垂直对é½"><xsl:value-of select="style:graphic-properties/@draw:textarea-vertical-align"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:graphic-properties/@fo:wrap-option">
+ <xsl:attribute name="图:自动æ¢è¡Œ">true</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:graphic-properties/@draw:auto-grow-width='true' and style:graphic-properties/@draw:auto-grow-height='true'">
+ <xsl:attribute name="图:大å°é€‚应文字">true</xsl:attribute>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:for-each select="./text:p">
+ <xsl:call-template name="textp"/>
+ </xsl:for-each>
+ </图:文本内容>
+ </图:图形>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:for-each select="/office:document/office:body/office:spreadsheet/table:table//table:table-cell/office:annotation">
+ <xsl:variable name="name1" select="@draw:style-name"/>
+ <xsl:for-each select="/office:document/office:automatic-styles/style:style[@style:name=$name1]">
+ <xsl:if test="style:graphic-properties/@draw:fill-image-name">
+ <xsl:variable name="bsh">
+ <xsl:value-of select="style:graphic-properties/@draw:fill-image-name"/>
+ </xsl:variable>
+ <xsl:for-each select="/office:document/office:styles/draw:fill-image">
+ <xsl:if test="@draw:name=$bsh">
+ <uof:其他对象 uof:locID="u0036" uof:attrList="标识符 内嵌 公共类型 ç§æœ‰ç±»åž‹">
+ <xsl:attribute name="uof:标识符"><xsl:value-of select="concat($name1,'_b1')"/></xsl:attribute>
+ <xsl:attribute name="uof:公共类型">png</xsl:attribute>
+ <xsl:attribute name="uof:内嵌">true</xsl:attribute>
+ <uof:æ•°æ® uof:locID="u0037">
+ <xsl:value-of select="office:binary-data"/>
+ </uof:æ•°æ®>
+ </uof:其他对象>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:for-each>
+ <xsl:for-each select="/office:document/office:body/office:spreadsheet/table:table/table:shapes/child::* | /office:document/office:body/office:spreadsheet/table:table/table:table-row/table:table-cell/child::*">
+ <xsl:if test="starts-with(name(.),'draw:')">
+ <xsl:choose>
+ <xsl:when test="name(.)='draw:frame' and self::node()/draw:object">
+ <xsl:for-each select="draw:image">
+ <uof:其他对象 uof:locID="u0036" uof:attrList="标识符 内嵌 公共类型 ç§æœ‰ç±»åž‹">
+ <xsl:attribute name="uof:标识符"><xsl:value-of select="concat('chart_image_',count(preceding::draw:fill-image))"/></xsl:attribute>
+ <xsl:attribute name="uof:公共类型">png</xsl:attribute>
+ <xsl:attribute name="uof:内嵌">true</xsl:attribute>
+ <uof:æ•°æ® uof:locID="u0037">
+ <xsl:value-of select="office:binary-data"/>
+ </uof:æ•°æ®>
+ </uof:其他对象>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="draw">
+ <xsl:with-param name="nodename1" select="name(.)"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:for-each>
+ </uof:对象集>
+ <xsl:if test="/office:document/office:body//text:bookmark-start">
+ <uof:书签集 uof:locID="u0027">
+ <xsl:for-each select="/office:document/office:body//text:bookmark-start">
+ <xsl:element name="uof:书签">
+ <xsl:attribute name="uof:å称"><xsl:value-of select="@text:name"/></xsl:attribute>
+ <xsl:attribute name="uof:locID">u0028</xsl:attribute>
+ <xsl:attribute name="uof:attrList">å称</xsl:attribute>
+ <xsl:element name="uof:文本ä½ç½®">
+ <xsl:attribute name="字:区域引用"><xsl:value-of select="concat('bk_',@text:name)"/></xsl:attribute>
+ <xsl:attribute name="uof:locID">u0029</xsl:attribute>
+ <xsl:attribute name="uof:attrList">区域引用</xsl:attribute>
+ </xsl:element>
+ </xsl:element>
+ </xsl:for-each>
+ </uof:书签集>
+ </xsl:if>
+ <xsl:if test="/office:document/office:body/text:p/text:a">
+ <uof:链接集 uof:locID="u0031">
+ <xsl:for-each select="/office:document/office:body/text:p/text:a">
+ <!--chengxz è¦æ”¹-->
+ <xsl:variable name="hyperStr" select="@xlink:href"/>
+ <xsl:element name="uof:超级链接">
+ <xsl:if test="contains($hyperStr,'#')">
+ <xsl:attribute name="uof:书签"><xsl:value-of select="substring-after($hyperStr,'#')"/></xsl:attribute>
+ </xsl:if>
+ <!--æš‚æ—¶ä¸å†™uof:æ示-->
+ <xsl:attribute name="uof:链æº">hlnk<xsl:number from="/office:document/office:body" level="any" count="text:p[text:a]"/></xsl:attribute>
+ <xsl:if test="contains($hyperStr,'http://') or contains($hyperStr,'mailto')">
+ <xsl:attribute name="uof:目标"><xsl:value-of select="$hyperStr"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="uof:locID">u0032</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符 目标 书签 å¼æ ·å¼•ç”¨ 已访问å¼æ ·å¼•ç”¨ æ示 链æº</xsl:attribute>
+ </xsl:element>
+ </xsl:for-each>
+ </uof:链接集>
+ </xsl:if>
+ <uof:å¼æ ·é›† uof:locID="u0039">
+ <xsl:apply-templates select="/office:document/office:font-face-decls"/>
+ <xsl:apply-templates select="/office:document/office:styles/style:style" mode="styles"/>
+ <xsl:apply-templates select="/office:document/office:automatic-styles/style:style" mode="styles">
+ <xsl:with-param name="isAutomatic" select="true()"/>
+ </xsl:apply-templates>
+ </uof:å¼æ ·é›†>
+ <uof:电å­è¡¨æ ¼ uof:locID="u0049">
+ <表:公用处ç†è§„则 uof:locID="s0000">
+ <表:度é‡å•ä½ uof:locID="s0001">
+ <xsl:value-of select="$uofUnit"/>
+ </表:度é‡å•ä½>
+ <xsl:apply-templates select="/office:document/office:body/office:spreadsheet/table:calculation-settings" mode="common"/>
+ <xsl:apply-templates select="/office:document/office:body/office:spreadsheet/table:content-validations" mode="common"/>
+ <xsl:if test="/office:document/office:automatic-styles/style:style[@style:family='table-cell' and style:map]">
+ <xsl:element name="表:æ¡ä»¶æ ¼å¼åŒ–集">
+ <xsl:attribute name="uof:locID">s0016</xsl:attribute>
+ <xsl:call-template name="create-condition-format"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="/office:document/office:body/office:spreadsheet/table:database-ranges/table:database-range">
+ <表:区域公å¼é›† uof:locID="s0122">
+ <表:åŒºåŸŸå…¬å¼ uof:locID="s0123" uof:attrList="类型">
+ <xsl:attribute name="表:类型">table</xsl:attribute>
+ <xsl:for-each select="/office:document/office:body/office:spreadsheet/table:database-ranges/table:database-range">
+ <表:区域 uof:locID="s0007">
+ <xsl:value-of select="@table:target-range-address"/>
+ </表:区域>
+ <表:å…¬å¼ uof:locID="s0125"/>
+ </xsl:for-each>
+ </表:区域公å¼>
+ </表:区域公å¼é›†>
+ </xsl:if>
+ <表:是å¦RC引用 uof:locID="s0124" uof:attrList="值" 表:值="false"/>
+ </表:公用处ç†è§„则>
+ <表:主体 uof:locID="s0024">
+ <xsl:apply-templates select="office:body"/>
+ </表:主体>
+ </uof:电å­è¡¨æ ¼>
+ </uof:UOF>
+ </xsl:template>
+ <xsl:template match="office:body">
+ <xsl:apply-templates select="office:spreadsheet"/>
+ </xsl:template>
+ <xsl:template match="office:spreadsheet">
+ <xsl:apply-templates select="./*"/>
+ </xsl:template>
+ <xsl:template match="office:meta">
+ <uof:å…ƒæ•°æ® uof:locID="u0001">
+ <uof:标题 uof:locID="u0002">
+ <xsl:value-of select="dc:title"/>
+ </uof:标题>
+ <uof:åˆ›å»ºåº”ç”¨ç¨‹åº uof:locID="u0011">
+ <xsl:value-of select="meta:generator"/>
+ </uof:创建应用程åº>
+ <uof:æ‘˜è¦ uof:locID="u0007">
+ <xsl:value-of select="dc:description"/>
+ </uof:摘è¦>
+ <uof:主题 uof:locID="u0003">
+ <xsl:value-of select="dc:subject"/>
+ </uof:主题>
+ <uof:创建者 uof:locID="u0004"/>
+ <uof:作者 uof:locID="u0005">
+ <xsl:value-of select="meta:initial-creator"/>
+ </uof:作者>
+ <uof:创建日期 uof:locID="u0008">
+ <xsl:value-of select="meta:creation-date"/>
+ </uof:创建日期>
+ <xsl:if test="dc:creator">
+ <uof:最åŽä½œè€… uof:locID="u0006">
+ <xsl:value-of select="dc:creator"/>
+ </uof:最åŽä½œè€…>
+ </xsl:if>
+ <uof:关键字集 uof:locID="u0014">
+ <uof:关键字 uof:locID="u0015">
+ <xsl:value-of select="meta:keyword"/>
+ </uof:关键字>
+ </uof:关键字集>
+ <uof:编辑次数 uof:locID="u0009">
+ <xsl:value-of select="meta:editing-cycles"/>
+ </uof:编辑次数>
+ <xsl:if test="meta:editing-duration">
+ <uof:编辑时间 uof:locID="u0010">
+ <xsl:value-of select="meta:editing-duration"/>
+ </uof:编辑时间>
+ </xsl:if>
+ <xsl:if test="meta:template/@xlink:href">
+ <uof:æ–‡æ¡£æ¨¡æ¿ uof:locID="u0013">
+ <xsl:value-of select="meta:template/@xlink:href"/>
+ </uof:文档模æ¿>
+ </xsl:if>
+ <xsl:if test="meta:user-defined/@meta:name">
+ <uof:用户自定义元数æ®é›† uof:locID="u0016">
+ <xsl:for-each select="meta:user-defined">
+ <uof:ç”¨æˆ·è‡ªå®šä¹‰å…ƒæ•°æ® uof:locID="u0017" uof:attrList="å称 类型">
+ <xsl:attribute name="uof:å称"><xsl:value-of select="@meta:name"/></xsl:attribute>
+ <xsl:attribute name="uof:类型"><xsl:value-of select="'string'"/></xsl:attribute>
+ <xsl:value-of select="."/>
+ </uof:用户自定义元数æ®>
+ </xsl:for-each>
+ </uof:用户自定义元数æ®é›†>
+ </xsl:if>
+ <xsl:if test="meta:document-statistic/@meta:page-count">
+ <uof:页数 uof:locID="u0020">
+ <xsl:value-of select="meta:document-statistic/@meta:page-count"/>
+ </uof:页数>
+ </xsl:if>
+ <xsl:if test="meta:document-statistic/@meta:paragraph-count">
+ <uof:段è½æ•° uof:locID="u0025">
+ <xsl:value-of select="meta:document-statistic/@meta:paragraph-count"/>
+ </uof:段è½æ•°>
+ </xsl:if>
+ <xsl:if test="meta:document-statistic/@meta:object-count">
+ <uof:对象数 uof:locID="u0026">
+ <xsl:value-of select="meta:document-statistic/@meta:object-count"/>
+ </uof:对象数>
+ </xsl:if>
+ <xsl:if test="meta:document-statistic/@meta:character-count">
+ <uof:å­—æ•° uof:locID="u0021">
+ <xsl:value-of select="meta:document-statistic/@meta:character-count"/>
+ </uof:å­—æ•°>
+ </xsl:if>
+ <xsl:if test="meta:document-statistic/@meta:word-count">
+ <uof:中文字符数 uof:locID="u0023">
+ <xsl:value-of select="meta:document-statistic/@meta:word-count"/>
+ </uof:中文字符数>
+ </xsl:if>
+ <xsl:if test="meta:document-statistic/@meta:character-count - meta:document-statistic/@meta:word-count">
+ <uof:英文字符数 uof:locID="u0022">
+ <xsl:value-of select="meta:document-statistic/@meta:character-count - meta:document-statistic/@meta:word-count"/>
+ </uof:英文字符数>
+ </xsl:if>
+ <xsl:if test="meta:document-statistic/@meta:character-count">
+ <uof:行数 uof:locID="u0024">
+ <xsl:variable name="quzhi">
+ <xsl:value-of select="(meta:document-statistic/@meta:character-count div 39) + 0.9"/>
+ </xsl:variable>
+ <xsl:value-of select="substring-before($quzhi,'.')"/>
+ </uof:行数>
+ </xsl:if>
+ <xsl:if test="meta:user-defined[@meta:name='Category']">
+ <uof:分类 uof:locID="u0012">
+ <xsl:value-of select="meta:user-defined[@meta:name='Category']"/>
+ </uof:分类>
+ </xsl:if>
+ <xsl:if test="meta:user-defined[@meta:name='Manager']">
+ <uof:ç»ç†å称 uof:locID="u0019">
+ <xsl:value-of select="meta:user-defined[meta:name='Manager']"/>
+ </uof:ç»ç†å称>
+ </xsl:if>
+ <xsl:if test="meta:user-defined[@meta:name='Company']">
+ <uof:å…¬å¸å称 uof:locID="u0018">
+ <xsl:value-of select="meta:user-defined[meta:name='Company']"/>
+ </uof:å…¬å¸å称>
+ </xsl:if>
+ </uof:元数æ®>
+ </xsl:template>
+ <xsl:template match="table:table">
+ <xsl:element name="表:工作表">
+ <xsl:attribute name="uof:locID">s0025</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符 å称 éšè— 背景 å¼æ ·å¼•ç”¨</xsl:attribute>
+ <xsl:attribute name="表:标识符"><xsl:value-of select="@table:name"/></xsl:attribute>
+ <xsl:attribute name="表:å称"><xsl:value-of select="@table:name"/></xsl:attribute>
+ <xsl:attribute name="表:éšè—"><xsl:choose><xsl:when test="@table:style-name='ta1'"><xsl:value-of select="'false'"/></xsl:when><xsl:otherwise><xsl:value-of select="'true'"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="表:背景"><xsl:choose><xsl:when test="/office:document/office:automatic-styles/style:page-master/style:table-properties/@fo:background-color"><xsl:value-of select="/office:document/office:automatic-styles/style:page-master/style:table-properties/@fo:background-color"/></xsl:when><xsl:otherwise>#ffffff</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="表:å¼æ ·å¼•ç”¨"><xsl:value-of select="@table:style-name"/></xsl:attribute>
+ <xsl:element name="表:工作表属性">
+ <xsl:attribute name="uof:locID">s0026</xsl:attribute>
+ <表:标签å‰æ™¯è‰² uof:locID="s0027">#000000</表:标签å‰æ™¯è‰²>
+ <表:标签背景色 uof:locID="s0028">#ffffff</表:标签背景色>
+ <xsl:call-template name="creat-page-setting">
+ <xsl:with-param name="master-page" select="/*/office:master-styles/style:master-page"/>
+ <xsl:with-param name="page-master-style" select="/*/office:automatic-styles/style:page-layout/style:page-layout-properties"/>
+ </xsl:call-template>
+ <xsl:call-template name="create-view">
+ <xsl:with-param name="table-name" select="/*/office:body/office:spreadsheet/table:table/@table:name"/>
+ <xsl:with-param name="view-id" select="count(preceding-sibling::table:table) + 1"/>
+ <xsl:with-param name="aaa" select="/*/office:settings/config:config-item-set/config:config-item-map-indexed/config:config-item-map-entry"/>
+ </xsl:call-template>
+ </xsl:element>
+ <xsl:call-template name="table"/>
+ <xsl:variable name="filter" select="/*/office:body/office:spreadsheet/table:database-ranges/table:database-range"/>
+ <xsl:if test="$filter">
+ <xsl:variable name="target-range-address" select="//table:database-range[table:filter]/@table:target-range-address"/>
+ <xsl:element name="表:筛选">
+ <xsl:attribute name="uof:locID">s0101</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型</xsl:attribute>
+ <xsl:attribute name="表:类型"><xsl:choose><xsl:when test="$filter/@table:display-filter-buttons">auto</xsl:when><xsl:otherwise>advance</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:element name="表:范围">
+ <xsl:attribute name="uof:locID">s0102</xsl:attribute>
+ <xsl:value-of select="$filter/@table:target-range-address"/>
+ </xsl:element>
+ <xsl:variable name="column-and-row" select="substring-before(substring-after($target-range-address,'.'),':')"/>
+ <xsl:variable name="dd" select="number(substring($column-and-row,2,1))"/>
+ <xsl:variable name="zone-left-column-string">
+ <xsl:choose>
+ <xsl:when test="contains($dd,'NaN') ">
+ <xsl:value-of select="substring($column-and-row,1,2)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring($column-and-row,1,1)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="zone-left-column-num">
+ <xsl:call-template name="translate-column-char-to-number">
+ <xsl:with-param name="string" select="$zone-left-column-string"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="create-filter-conditions">
+ <xsl:with-param name="filter-condition-set" select="$filter//table:filter-condition"/>
+ <xsl:with-param name="zone-left-column-num" select="$zone-left-column-num"/>
+ </xsl:call-template>
+ <xsl:if test="$filter/@table:condition-source-range-address">
+ <xsl:element name="表:æ¡ä»¶åŒºåŸŸ">
+ <xsl:attribute name="uof:locID">s0108</xsl:attribute>
+ <xsl:value-of select="$filter/@table:condition-source-range-address"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="$filter/@table:display-duplicates">
+ <xsl:element name="表:结果区域">
+ <xsl:attribute name="uof:locID">s0109</xsl:attribute>
+ <xsl:value-of select="$filter/@table:display-duplicates"/>
+ </xsl:element>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="key('styles', .//@table:style-name)/style:table-row-properties/@fo:break-before = 'page' or key('styles',.//@table:style-name)/style:table-column-properties/@fo:break-before='page'">
+ <xsl:element name="表:分页符集">
+ <xsl:attribute name="uof:locID">s0111</xsl:attribute>
+ <xsl:call-template name="分页符集"/>
+ </xsl:element>
+ </xsl:if>
+ </xsl:element>
+ </xsl:template>
+ <xsl:param name="tableElement" select="'表:工作表内容'"/>
+ <xsl:param name="rowElement" select="'表:行'"/>
+ <!--xsl:param name="cellElement" select="'表:å•å…ƒæ ¼'" /-->
+ <!-- ************** -->
+ <!-- *** Table *** -->
+ <!-- ************** -->
+ <xsl:template name="table">
+ <!-- The table will only be created if the table:scenario is active -->
+ <xsl:if test="not(table:scenario) or table:scenario/@table:is-active">
+ <xsl:call-template name="create-table"/>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="create-table">
+ <!-- collecting all visible "table:table-row" elements of the table -->
+ <xsl:variable name="allVisibleTableRows" select="table:table-row[not(@table:visibility = 'collapse' or @table:visibility = 'filter')] | table:table-header-rows/descendant::table:table-row[not(@table:visibility = 'collapse' or @table:visibility = 'filter')] | table:table-row-group/descendant::table:table-row[not(@table:visibility = 'collapse' or @table:visibility = 'filter')]"/>
+ <xsl:call-template name="create-table-element">
+ <xsl:with-param name="allVisibleTableRows" select="$allVisibleTableRows"/>
+ </xsl:call-template>
+ </xsl:template>
+ <xsl:template name="create-table-element">
+ <xsl:param name="allVisibleTableRows"/>
+ <xsl:element name="表:工作表内容">
+ <xsl:attribute name="uof:locID">s0018</xsl:attribute>
+ <xsl:attribute name="uof:attrList">最大行 最大列 缺çœè¡Œé«˜ 缺çœåˆ—宽</xsl:attribute>
+ <xsl:variable name="group-column" select="./table:table-column-group"/>
+ <xsl:variable name="group-row" select="./table:table-row-group"/>
+ <xsl:apply-templates select="@table:style-name"/>
+ <xsl:for-each select="table:table-column">
+ <表:列 uof:locID="s0048" uof:attrList="åˆ—å· éšè— 列宽 å¼æ ·å¼•ç”¨ 跨度">
+ <xsl:attribute name="表:列å·"><xsl:value-of select="position()"/></xsl:attribute>
+ <xsl:if test="@table:visibility">
+ <xsl:attribute name="表:éšè—"><xsl:choose><xsl:when test="@table:visibility='collapse'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="表:列宽"><xsl:value-of select="substring-before(key('styles',@table:style-name)/style:table-column-properties/@style:column-width,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="表:å¼æ ·å¼•ç”¨"><xsl:value-of select="@table:style-name"/></xsl:attribute>
+ <xsl:attribute name="表:跨度"><xsl:choose><xsl:when test="@table:number-columns-repeated"><xsl:value-of select="@table:number-columns-repeated"/></xsl:when><xsl:otherwise>1</xsl:otherwise></xsl:choose></xsl:attribute>
+ </表:列>
+ </xsl:for-each>
+ <xsl:variable name="columnNodes" select="table:table-column"/>
+ <xsl:variable name="columnsRepeated" select="table:table-column/@table:number-columns-repeated"/>
+ <xsl:variable name="columnCount">
+ <xsl:choose>
+ <xsl:when test="$columnNodes[last()]/@table:number-columns-repeated &gt; 99">
+ <xsl:value-of select="count($columnNodes)+ number(sum($columnsRepeated))- count($columnsRepeated)- $columnNodes[last()]/@table:number-columns-repeated+ 1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="count($columnNodes)+ number(sum($columnsRepeated))- count($columnsRepeated)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="table-name" select="@table:name"/>
+ <xsl:apply-templates select="table:table-row">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="columnCount" select="$columnCount"/>
+ </xsl:apply-templates>
+ <xsl:if test="table:table-row-group//table:table-row">
+ <xsl:apply-templates select="table:table-row-group//table:table-row">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="columnCount" select="$columnCount"/>
+ </xsl:apply-templates>
+ </xsl:if>
+ <xsl:for-each select="table:shapes/child::*">
+ <xsl:if test="starts-with(name(.),'draw:')">
+ <xsl:choose>
+ <xsl:when test="name(.)='draw:frame' and self::node()/draw:object">
+ <xsl:call-template name="draw:chart-frame">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="uof锚点"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:if test="table:table-row-group or table:table-column-group">
+ <xsl:element name="表:分组集">
+ <xsl:attribute name="uof:locID">s0098</xsl:attribute>
+ <xsl:for-each select="table:table-column-group">
+ <xsl:variable name="numcolumnrep" select="count(descendant::table:table-column[@table:number-columns-repeated])"/>
+ <xsl:variable name="numrep" select="sum(descendant::table:table-column/@table:number-columns-repeated)"/>
+ <xsl:variable name="numcolumn" select="count(descendant::table:table-column)"/>
+ <xsl:call-template name="table:table-column-group">
+ <xsl:with-param name="start" select="count(preceding::table:table-column)"/>
+ <xsl:with-param name="end" select="count(preceding::table:table-column) + $numrep + $numcolumn - $numcolumnrep"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ <xsl:for-each select="table:table-row-group">
+ <xsl:variable name="numrowrep" select="count(descendant::table:table-row[@table:number-rows-repeated])"/>
+ <xsl:variable name="numrep" select="sum(descendant::table:table-row/@table:number-rows-repeated)"/>
+ <xsl:variable name="numrow" select="count(descendant::table:table-row)"/>
+ <xsl:call-template name="table:table-row-group">
+ <xsl:with-param name="start" select="count(preceding::table:table-row)"/>
+ <xsl:with-param name="end" select="count(preceding::table:table-row) + $numrep + $numrow - $numrowrep"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:if>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="table:table-row-group">
+ <xsl:param name="start"/>
+ <xsl:param name="end"/>
+ <xsl:element name="表:行">
+ <xsl:attribute name="uof:locID">s0100</xsl:attribute>
+ <xsl:attribute name="uof:attrList">起始 终止 éšè—</xsl:attribute>
+ <xsl:attribute name="表:起始"><xsl:value-of select="$start + 1"/></xsl:attribute>
+ <xsl:attribute name="表:终止"><xsl:value-of select="$end"/></xsl:attribute>
+ <xsl:attribute name="表:éšè—"><xsl:choose><xsl:when test="@table:display"><xsl:value-of select="'true'"/></xsl:when><xsl:otherwise><xsl:value-of select="'false'"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ <xsl:for-each select="table:table-row-group">
+ <xsl:call-template name="table:table-row-group">
+ <xsl:with-param name="start" select="count(preceding::table:table-row) + number(sum(preceding::table:table-row/@table:number-rows-repeated)) - count(preceding::table:table-row[@table:number-rows-repeated])"/>
+ <xsl:with-param name="end" select="count(preceding::table:table-row) + number(sum(preceding::table:table-row/@table:number-rows-repeated)) - count(preceding::table:table-row[@table:number-rows-repeated]) + number(sum(descendant::table:table-row/@table:number-rows-repeated)) + count(descendant::table:table-row) - count(descendant::table:table-row[@table:number-rows-repeated])"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="table:table-column-group">
+ <xsl:param name="start"/>
+ <xsl:param name="end"/>
+ <xsl:element name="表:列">
+ <xsl:attribute name="uof:locID">s0099</xsl:attribute>
+ <xsl:attribute name="uof:attrList">起始 终止 éšè—</xsl:attribute>
+ <xsl:attribute name="表:起始"><xsl:value-of select="$start + 1"/></xsl:attribute>
+ <xsl:attribute name="表:终止"><xsl:value-of select="$end"/></xsl:attribute>
+ <xsl:attribute name="表:éšè—"><xsl:choose><xsl:when test="@table:display"><xsl:value-of select="'true'"/></xsl:when><xsl:otherwise><xsl:value-of select="'false'"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ <xsl:for-each select="table:table-column-group">
+ <xsl:call-template name="table:table-column-group">
+ <xsl:with-param name="start" select="count(preceding::table:table-column) + number(sum(preceding::table:table-column/@table:number-columns-repeated)) - count(preceding::table:table-column[@table:number-columns-repeated])"/>
+ <xsl:with-param name="end" select="count(preceding::table:table-column) + number(sum(preceding::table:table-column/@table:number-columns-repeated)) - count(preceding::table:table-column[@table:number-columns-repeated]) + number(sum(descendant::table:table-column/@table:number-columns-repeated)) + count(descendant::table:table-column) - count(descendant::table:table-column[@table:number-columns-repeated])"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="uof锚点">
+ <xsl:if test="not(name(.)='draw:glue-point')">
+ <xsl:variable name="name">
+ <xsl:value-of select="name(.)"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="name='draw:a'">
+ <xsl:for-each select="child::node( )">
+ <xsl:call-template name="uof锚点"/>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <uof:锚点 uof:locID="u0064" uof:attrList="xåæ ‡ yåæ ‡ 宽度 高度 图形引用 éšåŠ¨æ–¹å¼ 缩略图 å ä½ç¬¦">
+ <xsl:attribute name="uof:xåæ ‡"><xsl:choose><xsl:when test="name(.)='draw:g'"><xsl:call-template name="groupminx"><xsl:with-param name="value" select="number(substring-before(descendant::node()[@svg:x][1]/@svg:x,$uofUnit))"/><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:when><xsl:otherwise><xsl:choose><xsl:when test="@svg:x"><xsl:value-of select="substring-before(@svg:x,$uofUnit)"/></xsl:when><xsl:when test="@svg:x1"><xsl:value-of select="substring-before(@svg:x1,$uofUnit)"/></xsl:when></xsl:choose></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="uof:yåæ ‡"><xsl:choose><xsl:when test="name(.)='draw:g'"><xsl:call-template name="groupminx"><xsl:with-param name="value" select="number(substring-before(descendant::node()[@svg:y][1]/@svg:y,$uofUnit))"/><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:when><xsl:otherwise><xsl:choose><xsl:when test="@svg:y"><xsl:value-of select="substring-before(@svg:y,$uofUnit)"/></xsl:when><xsl:when test="@svg:y1"><xsl:value-of select="substring-before(@svg:y1,$uofUnit)"/></xsl:when></xsl:choose></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="uof:宽度"><xsl:choose><xsl:when test="@svg:width"><xsl:value-of select="substring-before(@svg:width,$uofUnit)"/></xsl:when><xsl:when test="@svg:x1"><xsl:value-of select="substring-before(@svg:x2,$uofUnit) - substring-before(@svg:x1,$uofUnit)"/></xsl:when><xsl:when test="name(.)='draw:g'"><xsl:variable name="minx"><xsl:call-template name="groupminx"><xsl:with-param name="value" select="number(substring-before(descendant::node()[@svg:x][1]/@svg:x,$uofUnit))"/><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:variable><xsl:variable name="svgx"><xsl:value-of select="number(substring-before(descendant::node()[@svg:x][1]/@svg:x,$uofUnit))"/></xsl:variable><xsl:variable name="width"><xsl:value-of select="number(substring-before(descendant::node()[@svg:x][1]/@svg:width,$uofUnit))"/></xsl:variable><xsl:variable name="maxx"><xsl:call-template name="groupmaxx"><xsl:with-param name="value" select="$svgx + $width"/><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:variable><xsl:value-of select="$maxx - $minx"/></xsl:when></xsl:choose></xsl:attribute>
+ <xsl:attribute name="uof:高度"><xsl:choose><xsl:when test="@svg:height"><xsl:value-of select="substring-before(@svg:height,$uofUnit)"/></xsl:when><xsl:when test="@svg:x1"><xsl:value-of select="substring-before(@svg:y2,$uofUnit) - substring-before(@svg:y1,$uofUnit)"/></xsl:when><xsl:when test="name(.)='draw:g'"><xsl:variable name="miny"><xsl:call-template name="groupminy"><xsl:with-param name="value" select="number(substring-before(descendant::node()[@svg:y][1]/@svg:y,$uofUnit))"/><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:variable><xsl:variable name="svgy"><xsl:value-of select="number(substring-before(descendant::node()[@svg:y][1]/@svg:y,$uofUnit))"/></xsl:variable><xsl:variable name="height"><xsl:value-of select="number(substring-before(descendant::node()[@svg:y][1]/@svg:height,$uofUnit))"/></xsl:variable><xsl:variable name="maxy"><xsl:call-template name="groupmaxy"><xsl:with-param name="value" select="$svgy + $height"/><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:variable><xsl:value-of select="$maxy - $miny"/></xsl:when></xsl:choose></xsl:attribute>
+ <xsl:variable name="refpicname">
+ <xsl:choose>
+ <xsl:when test="./@draw:style-name">
+ <xsl:value-of select="@draw:style-name"/>
+ </xsl:when>
+ <xsl:when test="./@table:end-cell-address">
+ <xsl:value-of select="@table:end-cell-address"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="./@draw:id"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="uof:图形引用"><xsl:variable name="picnumber"><xsl:value-of select="count(preceding::*[@draw:style-name=$refpicname])"/></xsl:variable><xsl:value-of select="concat($refpicname,'_',$picnumber)"/></xsl:attribute>
+ <xsl:attribute name="uof:éšåŠ¨æ–¹å¼"><xsl:choose><xsl:when test="key('graphicset',$refpicname)/style:graphic-properties/@style:protect"><xsl:for-each select="key('graphicset',$refpicname)/style:graphic-properties"><xsl:choose><xsl:when test="@style:protect='size'">move</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:for-each></xsl:when><xsl:otherwise>movesize</xsl:otherwise></xsl:choose></xsl:attribute>
+ </uof:锚点>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:template>
+ <!--end 06.02.14 -->
+ <!-- **************** -->
+ <!-- *** Columns *** -->
+ <!-- **************** -->
+ <!--Redoffice comment liliang 06.05.23-->
+ <!--xsl:template name="create-table-column">
+ <xsl:param name="columnNodes"/>
+ <xsl:param name="currentColumn"/>
+ <xsl:param name="columnCount"/>
+ <xsl:param name="columnNo"/>
+ <xsl:param name="columnNodeNo"/>
+ <xsl:param name="index"/>
+ <xsl:element name="表:列">
+ <xsl:attribute name="locID">s0048</xsl:attribute>
+ <xsl:attribute name="attrList">åˆ—å· éšè— 列宽 å¼æ ·å¼•ç”¨ 跨度</xsl:attribute>
+ <xsl:if test="$currentColumn/@table:visibility = 'collapse' or $currentColumn/@table:visibility = 'filter'">
+ <xsl:attribute name="表:éšè—">true</xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="表:跨度"><xsl:choose><xsl:when test="$currentColumn/@table:number-columns-repeated"><xsl:value-of select="$currentColumn/@table:number-columns-repeated - 1"/></xsl:when><xsl:otherwise><xsl:value-of select="'0'"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="$index">
+ <xsl:attribute name="表:列å·"><xsl:value-of select="$columnNo"/></xsl:attribute>
+ </xsl:if-->
+ <!--自动列宽没有,暂略 autofitwidth-->
+ <!--Redoffice comment liliang 06.05.22-->
+ <!--xsl:variable name="width">
+ <xsl:value-of select="key('styles', $currentColumn/@table:style-name)/style:properties/@style:column-width"/>
+ </xsl:variable-->
+ <!--end-->
+ <!--xsl:if test="$width">
+ <xsl:attribute name="表:宽度"><xsl:call-template name="convert2pt"><xsl:with-param name="value" select="$width"/></xsl:call-template></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="表:跨度"><xsl:choose><xsl:when test="$currentColumn/@table:number-columns-repeated"><xsl:value-of select="$currentColumn/@table:number-columns-repeated - 1"/></xsl:when><xsl:otherwise><xsl:value-of select="'0'"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ <xsl:if test="$columnNo &lt; $columnCount">
+ <xsl:choose>
+ <xsl:when test="@table:number-columns-repeated">
+ <xsl:call-template name="create-table-column">
+ <xsl:with-param name="columnNodes" select="$columnNodes"/>
+ <xsl:with-param name="columnCount" select="$columnCount"/>
+ <xsl:with-param name="columnNo" select="$columnNo + $currentColumn/@table:number-columns-repeated"/>
+ <xsl:with-param name="columnNodeNo" select="$columnNodeNo + 1"/>
+ <xsl:with-param name="currentColumn" select="$columnNodes[$columnNodeNo + 1]"/>
+ <xsl:with-param name="index" select="true()"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="create-table-column">
+ <xsl:with-param name="columnNodes" select="$columnNodes"/>
+ <xsl:with-param name="columnCount" select="$columnCount"/>
+ <xsl:with-param name="columnNo" select="$columnNo + 1"/>
+ <xsl:with-param name="columnNodeNo" select="$columnNodeNo + 1"/>
+ <xsl:with-param name="currentColumn" select="$columnNodes[$columnNodeNo + 1]"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:template-->
+ <!-- ************* -->
+ <!-- *** Rows *** -->
+ <!-- ************* -->
+ <xsl:template match="table:table-row">
+ <xsl:param name="table-name"/>
+ <xsl:param name="columnCount"/>
+ <xsl:choose>
+ <xsl:when test="@table:number-rows-repeated &gt; 1">
+ <xsl:choose>
+ <xsl:when test="(last() or (last() - 1)) and @table:number-rows-repeated &gt; 99">
+ <xsl:call-template name="write-table-row">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="columnCount" select="$columnCount"/>
+ <xsl:with-param name="lastRow" select="true()"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- In case a cell is being repeated, the cell will be created
+ in a variabel, which is as many times given out, as being repeated -->
+ <xsl:variable name="tableRow">
+ <xsl:call-template name="write-table-row">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="columnCount" select="$columnCount"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="repeat-write-table-row">
+ <xsl:with-param name="tableRow" select="$tableRow"/>
+ <xsl:with-param name="repetition" select="@table:number-rows-repeated"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="write-table-row">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="columnCount" select="$columnCount"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="write-table-row">
+ <xsl:param name="table-name"/>
+ <xsl:param name="columnCount"/>
+ <xsl:param name="lastRow"/>
+ <xsl:element name="表:行">
+ <xsl:attribute name="uof:locID">s0049</xsl:attribute>
+ <xsl:attribute name="uof:attrList">è¡Œå· éšè— 行高 å¼æ ·å¼•ç”¨ 跨度</xsl:attribute>
+ <xsl:if test="./table:table-cell/@office:value-type">
+ <xsl:attribute name="表:è¡Œå·"><xsl:value-of select="count(preceding::table:table-row[not(@table:number-rows-repeated)])+1+number(sum(preceding::table:table-row[@table:number-rows-repeated]/@table:number-rows-repeated))"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@table:visibility = 'collapse' or @table:visibility = 'filter'">
+ <xsl:attribute name="表:éšè—">true</xsl:attribute>
+ </xsl:if>
+ <!-- although valid, can not be opened with Excel - issue i31949)
+ <xsl:if test="$lastRow">
+ <xsl:attribute name="ss:Span"><xsl:value-of select="@table:number-rows-repeated - 1" /></xsl:attribute>
+ </xsl:if>-->
+ <!-- writing the style of the row -->
+ <xsl:apply-templates select="@table:style-name"/>
+ <xsl:variable name="rowProperties" select="key('styles', @table:style-name)/*"/>
+ <!--xsl:if test="$rowProperties/@style:use-optimal-row-height = 'false'">
+ <! - - default is '1', therefore write only '0' - ->
+ <xsl:attribute name="ss:AutoFitHeight">0</xsl:attribute>
+ </xsl:if-->
+ <xsl:variable name="height" select="$rowProperties/@style:row-height"/>
+ <xsl:if test="$height">
+ <xsl:attribute name="表:行高"><!-- using the absolute height in point --><xsl:call-template name="convert2pt"><xsl:with-param name="value" select="$height"/></xsl:call-template></xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates select="table:table-cell">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="columnCount" select="$columnCount"/>
+ </xsl:apply-templates>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="repeat-write-table-row">
+ <xsl:param name="tableRow"/>
+ <xsl:param name="repetition"/>
+ <xsl:copy-of select="$tableRow"/>
+ <xsl:if test="$repetition &gt; 1">
+ <xsl:call-template name="repeat-write-table-row">
+ <xsl:with-param name="tableRow" select="$tableRow"/>
+ <xsl:with-param name="repetition" select="$repetition - 1"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <!-- ************** -->
+ <!-- *** Cells *** -->
+ <!-- ************** -->
+ <!-- Table cells are able to be repeated by attribute in StarOffice,
+ but not in Excel. If more cells are repeated
+ (e.g. for emulating background) only as many cells as columns are
+ allowed to be written out. -->
+ <xsl:template match="table:table-cell">
+ <xsl:param name="table-name"/>
+ <xsl:param name="columnCount"/>
+ <!--xsl:choose>
+ <xsl:when test="@table:number-columns-repeated &gt; 1">
+ <xsl:variable name="tableCell">
+ <xsl:call-template name="write-table-cell"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="not(following-sibling::table:table-cell)">
+ <xsl:call-template name="repeat-write-table-cell">
+ <xsl:with-param name="tableCell" select="$tableCell"/>
+ <xsl:with-param name="repetition" select="@table:number-columns-repeated"/>
+ <xsl:with-param name="columnCount" select="$columnCount"/>
+ <xsl:with-param name="cellNo" select="position()+ sum(preceding-sibling::table:table-cell/@table:number-columns-repeated)- count(preceding-sibling::table:table-cell/@table:number-columns-repeated)"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="repeat-write-table-cell">
+ <xsl:with-param name="tableCell" select="$tableCell"/>
+ <xsl:with-param name="repetition" select="@table:number-columns-repeated"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="write-table-cell"/>
+ </xsl:otherwise>
+ </xsl:choose-->
+ <xsl:choose>
+ <xsl:when test="@table:number-columns-repeated">
+ <xsl:call-template name="write-table-cell">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="repeat-table-cell-no" select="@table:number-columns-repeated"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="write-table-cell">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="repeat-table-cell-no" select="number(1)"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!--xsl:template name="repeat-write-table-cell">
+ <xsl:param name="tableCell"/>
+ <xsl:param name="repetition"/>
+ <xsl:param name="columnCount"/>
+ <xsl:param name="cellNo"/>
+ <xsl:copy-of select="$tableCell"/>
+ <xsl:if test="$repetition &gt; 1">
+ <xsl:choose>
+ <xsl:when test="$cellNo">
+ <xsl:if test="$cellNo &lt; $columnCount">
+ <xsl:call-template name="repeat-write-table-cell">
+ <xsl:with-param name="tableCell" select="$tableCell"/>
+ <xsl:with-param name="repetition" select="$repetition - 1"/>
+ <xsl:with-param name="columnCount" select="$columnCount"/>
+ <xsl:with-param name="cellNo" select="$cellNo + 1"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="repeat-write-table-cell">
+ <xsl:with-param name="tableCell" select="$tableCell"/>
+ <xsl:with-param name="repetition" select="$repetition - 1"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:template-->
+ <xsl:template name="write-table-cell">
+ <xsl:param name="table-name"/>
+ <xsl:param name="repeat-table-cell-no"/>
+ <xsl:if test="$repeat-table-cell-no &gt; 0">
+ <表:å•å…ƒæ ¼ uof:locID="s0050" uof:attrList="åˆ—å· å¼æ ·å¼•ç”¨ 超链接引用 åˆå¹¶åˆ—æ•° åˆå¹¶è¡Œæ•°">
+ <xsl:if test="@table:number-columns-spanned &gt; 1">
+ <xsl:attribute name="表:åˆå¹¶åˆ—æ•°"><xsl:value-of select="@table:number-columns-spanned - 1"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@table:number-rows-spanned &gt; 1">
+ <xsl:attribute name="表:åˆå¹¶è¡Œæ•°"><xsl:value-of select="@table:number-rows-spanned - 1"/></xsl:attribute>
+ </xsl:if>
+ <xsl:variable name="link" select="descendant::text:a/@xlink:href"/>
+ <xsl:if test="$link">
+ <xsl:attribute name="表:超链接引用"><xsl:value-of select="$link"/></xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="@table:style-name">
+ <xsl:apply-templates select="@table:style-name"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="ancestor::table:table/table:table-column/@table:default-cell-style-name"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="*">
+ <xsl:if test="text:p">
+ <xsl:variable name="valueType">
+ <xsl:choose>
+ <xsl:when test="@office:value-type">
+ <xsl:value-of select="@office:value-type"/>
+ </xsl:when>
+ <xsl:otherwise>string</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:call-template name="表的数æ®">
+ <xsl:with-param name="valueType" select="$valueType"/>
+ <xsl:with-param name="cellStyleName" select="@table:style-name"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="office:annotation">
+ <xsl:element name="表:批注">
+ <xsl:attribute name="uof:locID">s0053</xsl:attribute>
+ <xsl:attribute name="uof:attrList">是å¦æ˜¾ç¤º</xsl:attribute>
+ <xsl:attribute name="表:是å¦æ˜¾ç¤º"><xsl:choose><xsl:when test="office:annotation/@office:display = 'true'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ <uof:锚点 uof:locID="u0064" uof:attrList="xåæ ‡ yåæ ‡ 宽度 高度 图形引用 éšåŠ¨æ–¹å¼ 缩略图 å ä½ç¬¦">
+ <xsl:variable name="num">
+ <xsl:value-of select="substring-after(office:annotation/@draw:style-name,'gr')"/>
+ </xsl:variable>
+ <xsl:attribute name="uof:图形引用"><xsl:value-of select="concat('pz',$num)"/></xsl:attribute>
+ <xsl:attribute name="uof:xåæ ‡"><xsl:value-of select="substring-before(office:annotation/@svg:x,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="uof:yåæ ‡"><xsl:value-of select="substring-before(office:annotation/@svg:y,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="uof:宽度"><xsl:value-of select="substring-before(office:annotation/@svg:width,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="uof:高度"><xsl:value-of select="substring-before(office:annotation/@svg:height,$uofUnit)"/></xsl:attribute>
+ </uof:锚点>
+ </xsl:element>
+ </xsl:if>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:for-each select="child::*">
+ <xsl:if test="starts-with(name(.),'draw:')">
+ <xsl:choose>
+ <xsl:when test="name(.)='draw:frame' and self::node()/draw:object">
+ <xsl:call-template name="draw:chart-frame">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="uof锚点"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:if test="/office:document/office:body/office:spreadsheet/table:tracked-changes and not(self::node()/@table:style-name) and self::node()/text:p">
+ <xsl:element name="表:æ•°æ®">
+ <xsl:attribute name="uof:locID">s0051</xsl:attribute>
+ <xsl:attribute name="uof:attrList">æ•°æ®ç±»åž‹</xsl:attribute>
+ <xsl:element name="å­—:å¥">
+ <xsl:attribute name="uof:locID">t0085</xsl:attribute>
+ <xsl:call-template name="table:tracked-changes"/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:if>
+ </表:å•å…ƒæ ¼>
+ <xsl:variable name="repeat-table-cell-no1">
+ <xsl:value-of select="$repeat-table-cell-no - 1"/>
+ </xsl:variable>
+ <xsl:call-template name="write-table-cell">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="repeat-table-cell-no" select="$repeat-table-cell-no1"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="office:annotation"/>
+ <xsl:template match="dc:date"/>
+ <xsl:template name="表的数æ®">
+ <xsl:param name="valueType"/>
+ <xsl:param name="cellStyleName"/>
+ <xsl:choose>
+ <xsl:when test="descendant::*/@text:style-name">
+ <xsl:choose>
+ <xsl:when test="$valueType = 'string'">
+ <表:æ•°æ® è¡¨:æ•°æ®ç±»åž‹="string" uof:locID="s0051" uof:attrList="æ•°æ®ç±»åž‹">
+ <xsl:apply-templates>
+ <xsl:with-param name="cellStyleName" select="$cellStyleName"/>
+ </xsl:apply-templates>
+ </表:æ•°æ®>
+ </xsl:when>
+ <xsl:when test="$valueType = 'boolean'">
+ <表:æ•°æ® è¡¨:æ•°æ®ç±»åž‹="boolean" uof:locID="s0051" uof:attrList="æ•°æ®ç±»åž‹">
+ <xsl:apply-templates>
+ <xsl:with-param name="cellStyleName" select="$cellStyleName"/>
+ </xsl:apply-templates>
+ </表:æ•°æ®>
+ </xsl:when>
+ <xsl:when test="$valueType = 'date'">
+ <表:æ•°æ® è¡¨:æ•°æ®ç±»åž‹="date" uof:locID="s0051" uof:attrList="æ•°æ®ç±»åž‹">
+ <xsl:apply-templates>
+ <xsl:with-param name="cellStyleName" select="$cellStyleName"/>
+ </xsl:apply-templates>
+ </表:æ•°æ®>
+ </xsl:when>
+ <xsl:otherwise>
+ <表:æ•°æ® è¡¨:æ•°æ®ç±»åž‹="number" uof:locID="s0051" uof:attrList="æ•°æ®ç±»åž‹">
+ <xsl:apply-templates>
+ <xsl:with-param name="cellStyleName" select="$cellStyleName"/>
+ </xsl:apply-templates>
+ </表:æ•°æ®>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <表:æ•°æ® uof:locID="s0051" uof:attrList="æ•°æ®ç±»åž‹">
+ <xsl:choose>
+ <xsl:when test="$valueType = 'string'">
+ <xsl:attribute name="表:æ•°æ®ç±»åž‹">text</xsl:attribute>
+ <!--xsl:attribute name="表:æ•°æ®æ•°å€¼"><xsl:value-of select="@office:string-value"/></xsl:attribute-->
+ <!--chengxz schema no this attr-->
+ <å­—:å¥ uof:locID="t0085">
+ <字:文本串 uof:locID="t0109" uof:attrList="udsPath">
+ <xsl:value-of select="text:p"/>
+ </字:文本串>
+ </å­—:å¥>
+ </xsl:when>
+ <xsl:when test="$valueType = 'boolean'">
+ <xsl:attribute name="表:æ•°æ®ç±»åž‹">boolean</xsl:attribute>
+ <å­—:å¥ uof:locID="t0085">
+ <xsl:choose>
+ <xsl:when test="@table:boolean-value = 'true'">
+ <字:文本串 uof:locID="t0109" uof:attrList="udsPath">true</字:文本串>
+ </xsl:when>
+ <xsl:otherwise>
+ <字:文本串 uof:locID="t0109" uof:attrList="udsPath">false</字:文本串>
+ </xsl:otherwise>
+ </xsl:choose>
+ </å­—:å¥>
+ </xsl:when>
+ <xsl:when test="$valueType = 'date'">
+ <xsl:attribute name="表:æ•°æ®ç±»åž‹">date</xsl:attribute>
+ <xsl:attribute name="表:æ•°æ®æ•°å€¼"><xsl:value-of select="@office:date-value"/></xsl:attribute>
+ <å­—:å¥ uof:locID="t0085">
+ <字:文本串 uof:locID="t0109" uof:attrList="udsPath">
+ <xsl:value-of select="text:p"/>
+ </字:文本串>
+ </å­—:å¥>
+ </xsl:when>
+ <xsl:when test="$valueType = 'time'">
+ <xsl:attribute name="表:æ•°æ®ç±»åž‹">time</xsl:attribute>
+ <xsl:attribute name="表:æ•°æ®æ•°å€¼"><xsl:value-of select="@office:time-value"/></xsl:attribute>
+ <å­—:å¥ uof:locID="t0085">
+ <字:文本串 uof:locID="t0109" uof:attrList="udsPath">
+ <xsl:value-of select="text:p"/>
+ </字:文本串>
+ </å­—:å¥>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="表:æ•°æ®ç±»åž‹">number</xsl:attribute>
+ <xsl:attribute name="表:æ•°æ®æ•°å€¼"><xsl:value-of select="@office:value"/></xsl:attribute>
+ <å­—:å¥ uof:locID="t0085">
+ <字:文本串 uof:locID="t0109" uof:attrList="udsPath">
+ <xsl:value-of select="text:p"/>
+ </字:文本串>
+ </å­—:å¥>
+ </xsl:otherwise>
+ </xsl:choose>
+ </表:æ•°æ®>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="分页符集">
+ <xsl:for-each select="table:table-row">
+ <xsl:if test="key('styles', @table:style-name)/style:table-row-properties/@fo:break-before">
+ <xsl:variable name="table-break-before">
+ <xsl:value-of select="key('styles', @table:style-name)/style:table-row-properties/@fo:break-before"/>
+ </xsl:variable>
+ <xsl:if test="$table-break-before = 'page'">
+ <xsl:element name="表:分页符">
+ <xsl:attribute name="uof:locID">s0112</xsl:attribute>
+ <xsl:attribute name="uof:attrList">è¡Œå· åˆ—å·</xsl:attribute>
+ <xsl:if test="preceding-sibling::table:table-row/@table:number-rows-repeated">
+ <xsl:attribute name="表:è¡Œå·"><xsl:value-of select="sum(preceding-sibling::table:table-row/@table:number-rows-repeated)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="not(preceding-sibling::table:table-row/@table:number-rows-repeated)">
+ <xsl:attribute name="表:è¡Œå·">1</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="key('styles', @table:style-name)/style:table-row-properties/@fo:break-after">
+ <xsl:variable name="table-break-after" select="key('styles', @table:style-name)/style:table-row-properties/@fo:break-after"/>
+ <xsl:if test="$table-break-after = 'page'">
+ <xsl:element name="表:分页符">
+ <xsl:attribute name="uof:locID">s0112</xsl:attribute>
+ <xsl:attribute name="uof:attrList">è¡Œå· åˆ—å·</xsl:attribute>
+ <xsl:if test="preceding-sibling::table:table-row/@table:number-rows-repeated">
+ <xsl:attribute name="表:è¡Œå·"><xsl:value-of select="sum(preceding-sibling::table:table-row/@table:number-rows-repeated)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="not(preceding-sibling::table:table-row/@table:number-rows-repeated)">
+ <xsl:attribute name="表:è¡Œå·">1</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:for-each select="table:table-column">
+ <xsl:if test="key('styles', @table:style-name)/style:table-column-properties/@fo:break-before">
+ <xsl:variable name="table-break-before" select="key('styles', @table:style-name)/style:table-column-properties/@fo:break-before"/>
+ <xsl:if test="$table-break-before = 'page'">
+ <xsl:element name="表:分页符">
+ <xsl:attribute name="uof:locID">s0112</xsl:attribute>
+ <xsl:attribute name="uof:attrList">è¡Œå· åˆ—å·</xsl:attribute>
+ <xsl:if test="preceding-sibling::table:table-column/@table:number-columns-repeated">
+ <xsl:attribute name="表:列å·"><xsl:value-of select="sum(preceding-sibling::table:table-column/@table:number-columns-repeated)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="not(preceding-sibling::table:table-column/@table:number-columns-repeated)">
+ <xsl:attribute name="表:列å·">1</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="key('styles', @table:style-name)/style:table-column-properties/@fo:break-after">
+ <xsl:variable name="table-break-after" select="key('styles', @table:style-name)/style:table-column-properties/@fo:break-after"/>
+ <xsl:if test="$table-break-after = 'page'">
+ <xsl:element name="表:分页符">
+ <xsl:attribute name="uof:locID">s0112</xsl:attribute>
+ <xsl:attribute name="uof:attrList">è¡Œå· åˆ—å·</xsl:attribute>
+ <xsl:if test="preceding-sibling::table:table-column/@table:number-columns-repeated">
+ <xsl:attribute name="表:列å·"><xsl:value-of select="sum(preceding-sibling::table:table-column/@table:number-columns-repeated)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="not(preceding-sibling::table:table-column/@table:number-columns-repeated)">
+ <xsl:attribute name="表:列å·">1</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template match="text:s">
+ <xsl:call-template name="write-breakable-whitespace">
+ <xsl:with-param name="whitespaces" select="@text:c"/>
+ </xsl:call-template>
+ </xsl:template>
+ <!--write the number of 'whitespaces' -->
+ <xsl:template name="write-breakable-whitespace">
+ <xsl:param name="whitespaces"/>
+ <xsl:text> </xsl:text>
+ <xsl:if test="$whitespaces >= 1">
+ <xsl:call-template name="write-breakable-whitespace">
+ <xsl:with-param name="whitespaces" select="$whitespaces - 1"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <!-- allowing all matched text nodes -->
+ <!--chengxz0630-->
+ <!--xsl:template match="text()">
+ <å­—:å¥ uof:locID="t0085">
+ <xsl:element name="字:文本串">
+ <xsl:attribute name="locID">t0109</xsl:attribute>
+
+ <xsl:value-of select="." />
+ </xsl:element>
+ </å­—:å¥>
+ </xsl:template-->
+ <xsl:variable name="namespace-html" select="'http://www.w3.org/TR/REC-html40'"/>
+ <xsl:template match="@table:style-name | @table:default-cell-style-name">
+ <xsl:attribute name="表:å¼æ ·å¼•ç”¨"><!--ss:styleID--><xsl:value-of select="."/><!--chengxz 060114--></xsl:attribute>
+ </xsl:template>
+ <xsl:template name="style-and-contents">
+ <xsl:param name="cellStyleName"/>
+ <å­—:å¥ uof:locID="t0085">
+ <xsl:element name="字:文本串">
+ <!--chengxz0630-->
+ </xsl:element>
+ </å­—:å¥>
+ </xsl:template>
+ <!-- *************88-->
+ <xsl:param name="dpi" select="111"/>
+ <xsl:param name="centimeter-in-mm" select="10"/>
+ <xsl:param name="inch-in-mm" select="25.4"/>
+ <xsl:param name="didot-point-in-mm" select="0.376065"/>
+ <xsl:param name="pica-in-mm" select="4.2333333"/>
+ <xsl:param name="point-in-mm" select="0.3527778"/>
+ <xsl:param name="twip-in-mm" select="0.017636684"/>
+ <xsl:param name="pixel-in-mm" select="$inch-in-mm div $dpi"/>
+ <!-- ***** MEASUREMENT CONVERSIONS *****
+ PARAM 'value'
+ The measure to be converted.
+ The current measure is judged by a substring (e.g. 'mm', 'cm', 'in', 'pica'...)
+ directly added to the number.
+
+ PARAM 'rounding-factor'
+ Is used for the rounding of decimal places.
+ The parameter number is the product of 1 and some '10', where
+ every zero represents a decimal place.
+
+ For example, providing as parameter:
+ <xsl:param name="rounding-factor" select="10000" />
+ Gives by default four decimal places.
+
+ To round two decimal places, basically the following is done:
+ <xsl:value-of select="round(100 * value) div 100"/>
+
+ RETURN The converted number, by default rounded to four decimal places.
+ In case the input measure could not be matched the same value is
+ returned and a warning message is written out.
+
+
+
+ MEASURE LIST:
+ * 1 milimeter (mm), the basic measure
+
+ * 1 centimeter (cm) = 10 mm
+
+ * 1 inch (in) = 25.4 mm
+ While the English have already seen the light (read: the metric system), the US
+ remains loyal to this medieval system.
+
+ * 1 point (pt) = 0.35277777.. mm
+ Sometimes called PostScript point (ppt), as when Adobe created PostScript, they added their own system of points.
+ There are exactly 72 PostScript points in 1 inch.
+
+ * 1 twip = twentieth of a (PostScript) point
+ A twip (twentieth of a point) is a 1/20th of a PostScript point, a traditional measure in printing.
+
+ * 1 didot point (dpt) = 0.376065 mm
+ Didot point after the French typographer Firmin Didot (1764-1836).
+
+ More details under
+ http://www.unc.edu/~rowlett/units/dictP.html:
+ "A unit of length used by typographers and printers. When printing was done
+ from hand-set metal type, one point represented the smallest element of type
+ that could be handled, roughly 1/64 inch. Eventually, the point was standardized
+ in Britain and America as exactly 1/72.27 = 0.013 837 inch, which is
+ about 0.35 mm (351.46 micrometers). In continental Europe, typographers
+ traditionally used a slightly larger point of 0.014 83 inch (about
+ 1/72 pouce, 0.377 mm, or roughly 1/67 English inch), called a Didot point
+ after the French typographer Firmin Didot (1764-1836). In the U.S.,
+ Adobe software defines the point to be exactly 1/72 inch (0.013 888 9 inch
+ or 0.352 777 8 millimeters) and TeX software uses a slightly smaller point
+ of 0.351 459 8035 mm. The German standards agency DIN has proposed that
+ all these units be replaced by multiples of 0.25 millimeters (1/101.6 inch).
+
+ * 1 pica = 4.233333 mm
+ 1/6 inch or 12 points
+
+ * 1 pixel (px) = 0.26458333.. mm (relative to 'DPI', here: 96 dpi)
+ Most pictures have the 96 dpi resolution, but the dpi variable may vary by stylesheet parameter
+
+
+ -->
+ <!-- changing measure to mm -->
+ <xsl:template name="convert2mm">
+ <xsl:param name="value"/>
+ <xsl:param name="rounding-factor" select="10000"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="substring-before($value, 'mm')"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'cm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm' ) * $centimeter-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in' ) * $inch-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') * $point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') * $twip-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') * $didot-point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') * $pica-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') * $pixel-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'mm'!</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- changing measure to cm -->
+ <xsl:template name="convert2cm">
+ <xsl:param name="value"/>
+ <xsl:param name="rounding-factor" select="10000"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $centimeter-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'cm')">
+ <xsl:value-of select="substring-before($value, 'cm')"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $centimeter-in-mm * $inch-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $centimeter-in-mm * $point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $centimeter-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $centimeter-in-mm * $pica-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $centimeter-in-mm * $twip-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $centimeter-in-mm * $pixel-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'cm'!</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- changing measure to inch (cp. section comment) -->
+ <xsl:template name="convert2in">
+ <xsl:param name="value"/>
+ <xsl:param name="rounding-factor" select="10000"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $inch-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'cm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $inch-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="substring-before($value, 'in')"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $inch-in-mm * $point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $inch-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $inch-in-mm * $pica-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $inch-in-mm * $twip-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $inch-in-mm * $pixel-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'in'!</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- changing measure to dpt (cp. section comment) -->
+ <xsl:template name="convert2dpt">
+ <xsl:param name="value"/>
+ <xsl:param name="rounding-factor" select="10000"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $didot-point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'cm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $didot-point-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $didot-point-in-mm * $inch-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $didot-point-in-mm * $point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="substring-before($value, 'dpt')"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $didot-point-in-mm * $pica-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $didot-point-in-mm * $twip-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $didot-point-in-mm * $pixel-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'dpt'!</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- changing measure to pica (cp. section comment) -->
+ <xsl:template name="convert2pica">
+ <xsl:param name="value"/>
+ <xsl:param name="rounding-factor" select="10000"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $pica-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'cm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $pica-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $pica-in-mm * $inch-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $pica-in-mm * $point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $pica-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="substring-before($value, 'pica')"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $pica-in-mm * $twip-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $pica-in-mm * $pixel-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'pica'!</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- changing measure to pt (cp. section comment) -->
+ <xsl:template name="convert2pt">
+ <xsl:param name="value"/>
+ <xsl:param name="rounding-factor" select="10000"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'cm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $point-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $point-in-mm * $inch-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="substring-before($value, 'pt')"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $point-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $point-in-mm * $pica-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $point-in-mm * $twip-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $point-in-mm * $pixel-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'pt'!</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- changing measure to pt (cp. section comment) -->
+ <xsl:template name="convert2twip">
+ <xsl:param name="value"/>
+ <xsl:param name="rounding-factor" select="10000"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $twip-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'cm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $twip-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $twip-in-mm * $inch-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $twip-in-mm * $point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $twip-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $twip-in-mm * $pica-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="substring-before($value, 'twip')"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $twip-in-mm * $pixel-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'twip'!</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="convert2px">
+ <xsl:param name="value"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="round(number(substring-before($value, 'mm')) div $pixel-in-mm)"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'cm')">
+ <xsl:value-of select="round(number(substring-before($value, 'cm')) div $pixel-in-mm * $centimeter-in-mm)"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="round(number(substring-before($value, 'in')) div $pixel-in-mm * $inch-in-mm)"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="round(number(substring-before($value, 'pt')) div $pixel-in-mm * $point-in-mm)"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="round(number(substring-before($value, 'dpt')) div $pixel-in-mm * $didot-point-in-mm)"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="round(number(substring-before($value, 'pica')) div $pixel-in-mm * $pica-in-mm)"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="round(number(substring-before($value, 'twip')) div $pixel-in-mm * $twip-in-mm)"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="$value"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'px'!</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:key match="draw:object/office:document/office:automatic-styles/style:style" name="chart-style-name" use="@style:name"/>
+ <xsl:template name="draw:chart-frame">
+ <xsl:param name="table-name"/>
+ <表:图表 uof:locID="s0055" uof:attrList="类型 å­ç±»åž‹ 宽度 高度 xåæ ‡ yåæ ‡ éšåŠ¨æ–¹å¼">
+ <xsl:variable name="plot-area">
+ <xsl:value-of select="draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/@chart:style-name"/>
+ </xsl:variable>
+ <xsl:variable name="data-area">
+ <xsl:value-of select="draw:object/@draw:notify-on-update-of-ranges"/>
+ </xsl:variable>
+ <xsl:variable name="series-generate">
+ <xsl:for-each select="key('chart-style-name',$plot-area)">
+ <xsl:choose>
+ <xsl:when test="style:chart-properties/@chart:series-source='columns'">col</xsl:when>
+ <xsl:otherwise>row</xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:call-template name="表:图表">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="data-area" select="$data-area"/>
+ <xsl:with-param name="series-generate" select="$series-generate"/>
+ </xsl:call-template>
+ <表:图表区 uof:locID="s0056">
+ <xsl:call-template name="表:图表区">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="data-area" select="$data-area"/>
+ <xsl:with-param name="series-generate" select="$series-generate"/>
+ </xsl:call-template>
+ </表:图表区>
+ <表:绘图区 uof:locID="s0060">
+ <xsl:attribute name="表:宽度"><xsl:value-of select="substring-before(draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/@svg:width,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="表:高度"><xsl:value-of select="substring-before(draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/@svg:height,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="表:xåæ ‡"><xsl:value-of select="substring-before(draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/@svg:x,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="表:yåæ ‡"><xsl:value-of select="substring-before(draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/@svg:y,$uofUnit)"/></xsl:attribute>
+ <xsl:call-template name="表:绘图区">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="data-area" select="$data-area"/>
+ <xsl:with-param name="series-generate" select="$series-generate"/>
+ </xsl:call-template>
+ </表:绘图区>
+ <表:分类轴 uof:locID="s0061" uof:attrList="主刻度类型 次刻度类型 刻度线标志">
+ <xsl:variable name="axis-style-name">
+ <xsl:value-of select="draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/chart:axis[child::chart:categories]/@chart:style-name"/>
+ </xsl:variable>
+ <xsl:for-each select="draw:object/office:document/office:automatic-styles/style:style[@style:name=$axis-style-name]">
+ <xsl:attribute name="表:主刻度类型"><xsl:choose><xsl:when test="style:chart-properties/@chart:tick-marks-major-inner='true' and style:chart-properties/@chart:tick-marks-major-outer='true'">cross</xsl:when><xsl:when test="style:chart-properties/@chart:tick-marks-major-inner='false'">inside</xsl:when><xsl:when test="style:chart-properties/@chart:tick-marks-major-inner='true'">outside</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="表:次刻度类型"><xsl:choose><xsl:when test="style:chart-properties/@chart:tick-marks-minor-inner='true' and style:chart-properties/@chart:tick-marks-minor-outer='true'">cross</xsl:when><xsl:when test="style:chart-properties/@chart:tick-marks-minor-inner='true'">inside</xsl:when><xsl:when test="style:chart-properties/@chart:tick-marks-minor-inner='true'">outside</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="表:刻度线标志"><xsl:choose><xsl:when test="style:chart-properties/@chart:display-label='true'">next to axis</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:call-template name="表:å标轴类型">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="data-area" select="$data-area"/>
+ <xsl:with-param name="series-generate" select="$series-generate"/>
+ <xsl:with-param name="axis-type" select="category-axis"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </表:分类轴>
+ <表:数值轴 uof:locID="s0082" uof:attrList="主刻度类型 次刻度类型 刻度线标志">
+ <xsl:variable name="axis-style-name">
+ <xsl:value-of select="draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/chart:axis[child::chart:grid]/@chart:style-name"/>
+ </xsl:variable>
+ <xsl:for-each select="draw:object/office:document/office:automatic-styles/style:style[@style:name=$axis-style-name]">
+ <xsl:attribute name="表:主刻度类型"><xsl:choose><xsl:when test="style:chart-properties/@chart:tick-marks-major-inner='true' and style:chart-properties/@chart:tick-marks-major-outer='true'">cross</xsl:when><xsl:when test="style:chart-properties/@chart:tick-marks-major-inner='true'">inside</xsl:when><xsl:when test="style:chart-properties/@chart:tick-marks-major-inner='true'">outside</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="表:次刻度类型"><xsl:choose><xsl:when test="style:chart-properties/@chart:tick-marks-minor-inner='true' and style:chart-properties/@chart:tick-marks-minor-outer='true'">cross</xsl:when><xsl:when test="style:chart-properties/@chart:tick-marks-minor-inner='true'">inside</xsl:when><xsl:when test="style:chart-properties/@chart:tick-marks-minor-inner='true'">outside</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="表:刻度线标志"><xsl:choose><xsl:when test="style:chart-properties/@chart:display-label='true'">next to axis</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:call-template name="表:å标轴类型">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="data-area" select="$data-area"/>
+ <xsl:with-param name="series-generate" select="$series-generate"/>
+ <xsl:with-param name="axis-type" select="category-axis"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </表:数值轴>
+ <表:图例 uof:locID="s0083" uof:attrList="ä½ç½®">
+ <xsl:attribute name="表:ä½ç½®"><xsl:value-of select="draw:object/office:document/office:body/office:chart/chart:chart/chart:legend/@chart:legend-position"/></xsl:attribute>
+ <xsl:attribute name="表:xåæ ‡"><xsl:value-of select="substring-before(draw:object/office:document/office:body/office:chart/chart:chart/chart:legend/@svg:x,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="表:yåæ ‡"><xsl:value-of select="substring-before(draw:object/office:document/office:body/office:chart/chart:chart/chart:legend/@svg:y,$uofUnit)"/></xsl:attribute>
+ <xsl:call-template name="表:图例">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="data-area" select="$data-area"/>
+ <xsl:with-param name="series-generate" select="$series-generate"/>
+ </xsl:call-template>
+ </表:图例>
+ <!--表:æ•°æ®è¡¨ uof:locID="s0085">
+ <xsl:call-template name="表:æ•°æ®è¡¨">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="data-area" select="$data-area"/>
+ <xsl:with-param name="series-generate" select="$series-generate"/>
+ </xsl:call-template>
+ </表:æ•°æ®è¡¨-->
+ <表:æ•°æ®ç³»åˆ—集 uof:locID="s0086">
+ <xsl:variable name="data-series-path" select="draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/chart:series"/>
+ <xsl:call-template name="表:æ•°æ®ç³»åˆ—">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="data-area" select="$data-area"/>
+ <xsl:with-param name="series-generate" select="$series-generate"/>
+ <xsl:with-param name="data-series-path" select="$data-series-path"/>
+ </xsl:call-template>
+ </表:æ•°æ®ç³»åˆ—集>
+ <!--0825 by lil -->
+ <xsl:if test="draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/chart:series">
+ <表:æ•°æ®ç‚¹é›† uof:locID="s0090">
+ <xsl:variable name="data-series-path" select="draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/chart:series"/>
+ <xsl:call-template name="表:æ•°æ®ç‚¹">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="data-area" select="$data-area"/>
+ <xsl:with-param name="series-generate" select="$series-generate"/>
+ <xsl:with-param name="data-series-path" select="$data-series-path"/>
+ </xsl:call-template>
+ </表:æ•°æ®ç‚¹é›†>
+ </xsl:if>
+ <!--end-->
+ <表:网格线集 uof:locID="s0092">
+ <xsl:if test="draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/chart:axis[@chart:dimension='x' and @chart:style-name]/chart:grid">
+ <xsl:call-template name="表:网格线">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="data-area" select="$data-area"/>
+ <xsl:with-param name="series-generate" select="$series-generate"/>
+ <xsl:with-param name="grid-type" select="'category axis'"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/chart:axis[@chart:dimension='y']/@chart:style-name">
+ <xsl:call-template name="表:网格线">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="data-area" select="$data-area"/>
+ <xsl:with-param name="series-generate" select="$series-generate"/>
+ <xsl:with-param name="grid-type" select="'value axis'"/>
+ </xsl:call-template>
+ </xsl:if>
+ </表:网格线集>
+ <表:æ•°æ®æº uof:locID="s0094" uof:attrList="æ•°æ®åŒºåŸŸ 系列产生">
+ <xsl:variable name="series-row-start">
+ <xsl:call-template name="General-Char-Transition">
+ <xsl:with-param name="input-char" select="substring-before(substring(substring-after($data-area,'.'),2),':')"/>
+ <xsl:with-param name="output-type" select="'ARABIC'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="series-row-end">
+ <xsl:call-template name="General-Char-Transition">
+ <xsl:with-param name="input-char" select="substring(substring-after(substring-after($data-area,'.'),'.'),2)"/>
+ <xsl:with-param name="output-type" select="'ARABIC'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="series-col-start">
+ <xsl:call-template name="General-Char-Transition">
+ <xsl:with-param name="input-char" select="substring(substring-after($data-area,'.'),1,1)"/>
+ <xsl:with-param name="output-type" select="'ARABIC'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="series-col-end">
+ <xsl:call-template name="General-Char-Transition">
+ <xsl:with-param name="input-char" select="substring(substring-after(substring-after($data-area,'.'),'.'),1,1)"/>
+ <xsl:with-param name="output-type" select="'ARABIC'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="series-value-count">
+ <xsl:choose>
+ <xsl:when test="$series-generate='col'">
+ <xsl:value-of select="$series-col-end -$series-col-start +1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$series-row-end -$series-row-start +1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="表:æ•°æ®åŒºåŸŸ"><xsl:value-of select="draw:object/@draw:notify-on-update-of-ranges"/></xsl:attribute>
+ <xsl:attribute name="表:系列产生"><xsl:choose><xsl:when test="contains($series-generate,'col')">col</xsl:when><xsl:when test="contains($series-generate,'row')">row</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:call-template name="表:系列">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="data-area" select="$data-area"/>
+ <xsl:with-param name="series-generate" select="$series-generate"/>
+ <xsl:with-param name="series-row-start" select="$series-row-start"/>
+ <xsl:with-param name="series-row-end" select="$series-row-end"/>
+ <xsl:with-param name="series-col-start" select="$series-col-start"/>
+ <xsl:with-param name="series-col-end" select="$series-col-end"/>
+ <xsl:with-param name="series-value-current" select="'1'"/>
+ <xsl:with-param name="series-value-count" select="$series-value-count"/>
+ </xsl:call-template>
+ </表:æ•°æ®æº>
+ <表:标题集 uof:locID="s0096">
+ <xsl:if test="draw:object/office:document/office:body/office:chart/chart:chart/chart:title">
+ <xsl:call-template name="表:标题">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="data-area" select="$data-area"/>
+ <xsl:with-param name="series-generate" select="$series-generate"/>
+ <xsl:with-param name="caption-type" select="'chart'"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/chart:axis[@chart:dimension='x']">
+ <xsl:call-template name="表:标题">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="data-area" select="$data-area"/>
+ <xsl:with-param name="series-generate" select="$series-generate"/>
+ <xsl:with-param name="caption-type" select="'category axis'"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/chart:axis[@chart:dimension='y']">
+ <xsl:call-template name="表:标题">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="data-area" select="$data-area"/>
+ <xsl:with-param name="series-generate" select="$series-generate"/>
+ <xsl:with-param name="caption-type" select="'value axis'"/>
+ </xsl:call-template>
+ </xsl:if>
+ </表:标题集>
+ </表:图表>
+ </xsl:template>
+ <xsl:template name="表:图表">
+ <xsl:param name="table-name"/>
+ <xsl:param name="data-area"/>
+ <xsl:param name="series-generate"/>
+ <xsl:variable name="chart-class">
+ <xsl:value-of select="draw:object/office:document/office:body/office:chart/chart:chart/@chart:class"/>
+ </xsl:variable>
+ <xsl:variable name="chart-area">
+ <xsl:value-of select="draw:object/office:document/office:body/office:chart/chart:chart/@chart:style-name"/>
+ </xsl:variable>
+ <xsl:variable name="plot-area">
+ <xsl:value-of select="draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/@chart:style-name"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$chart-class='chart:bar'">
+ <xsl:variable name="chart-sub-class">
+ <xsl:value-of select="key('chart-style-name',$plot-area)/style:chart-properties/@chart:vertical"/>
+ </xsl:variable>
+ <xsl:attribute name="表:类型"><xsl:choose><xsl:when test="$chart-sub-class='true'">bar</xsl:when><xsl:when test="$chart-sub-class='false'">column</xsl:when><xsl:otherwise/></xsl:choose></xsl:attribute>
+ <xsl:attribute name="表:å­ç±»åž‹"><xsl:choose><xsl:when test="$chart-sub-class='true'"><xsl:choose><xsl:when test="key('chart-style-name',$plot-area)/style:chart-properties/@chart:percentage">bar_percent</xsl:when><xsl:when test="key('chart-style-name',$plot-area)/style:chart-properties/@chart:stacked">bar_stacked</xsl:when><xsl:otherwise>bar_standard</xsl:otherwise></xsl:choose></xsl:when><xsl:when test="$chart-sub-class='false'"><xsl:choose><xsl:when test="key('chart-style-name',$plot-area)/style:chart-properties/@chart:percentage">column_percent</xsl:when><xsl:when test="key('chart-style-name',$plot-area)/style:chart-properties/@chart:stacked">column_stacked</xsl:when><xsl:otherwise>column_standard</xsl:otherwise></xsl:choose></xsl:when></xsl:choose></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$chart-class='chart:line'">
+ <xsl:attribute name="表:类型">line</xsl:attribute>
+ <xsl:attribute name="表:å­ç±»åž‹"><xsl:choose><xsl:when test="key('chart-style-name',$plot-area)/style:chart-properties/@chart:percentage">line_percent</xsl:when><xsl:when test="key('chart-style-name',$plot-area)/style:chart-properties/@chart:stacked">line_stacked</xsl:when><xsl:otherwise>line_standard</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$chart-class='chart:circle'">
+ <xsl:attribute name="表:类型">pie</xsl:attribute>
+ <xsl:variable name="data-point-end" select="draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/chart:series[1]/chart:data-point"/>
+ <xsl:choose>
+ <xsl:when test="count($data-point-end) &lt;=1">
+ <xsl:attribute name="表:å­ç±»åž‹">pie_standard</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="data-point-position-1">
+ <xsl:for-each select="$data-point-end[position()=1]">
+ <xsl:choose>
+ <xsl:when test="@chart:style-name">
+ <xsl:for-each select="key('chart-style-name',@chart:style-name)">
+ <xsl:choose>
+ <xsl:when test="style:chart-properties/@chart:pie-offset">1</xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$data-point-position-1='0'">
+ <xsl:attribute name="表:å­ç±»åž‹">pie_standard</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:for-each select="$data-point-end[position()=2]">
+ <xsl:choose>
+ <xsl:when test="@chart:style-name">
+ <xsl:for-each select="key('chart-style-name',@chart:style-name)">
+ <xsl:choose>
+ <xsl:when test="style:chart-properties/@chart:pie-offset">
+ <xsl:attribute name="表:å­ç±»åž‹">pie_offset2</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="表:å­ç±»åž‹">pie_offset1</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="表:å­ç±»åž‹">pie_offset1</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$chart-class='chart:ring'">
+ <xsl:attribute name="表:类型">pie</xsl:attribute>
+ <xsl:attribute name="表:å­ç±»åž‹">pie_ring</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ <xsl:attribute name="表:宽度"><xsl:value-of select="substring-before(@svg:width,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="表:高度"><xsl:value-of select="substring-before(@svg:height,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="表:xåæ ‡"><xsl:value-of select="substring-before(@svg:x,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="表:yåæ ‡"><xsl:value-of select="substring-before(@svg:y,$uofUnit)"/></xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="@draw:style-name">
+ <xsl:variable name="draw-style-name" select="@draw:style-name"/>
+ <xsl:for-each select="draw:object//office:document/office:automatic-styles/style:style[@style:name=$draw-style-name]">
+ <xsl:choose>
+ <xsl:when test="style:graphic-properties/@draw:move-protect='true' and style:graphic-properties/@draw:size-protect='true'">
+ <xsl:attribute name="表:éšåŠ¨æ–¹å¼">none</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:size-protect='true'">
+ <xsl:attribute name="表:éšåŠ¨æ–¹å¼">move</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="表:éšåŠ¨æ–¹å¼">move and re-size</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="表:éšåŠ¨æ–¹å¼">move and re-size</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="表:图表区">
+ <xsl:param name="table-name"/>
+ <xsl:param name="data-area"/>
+ <xsl:param name="series-generate"/>
+ <xsl:variable name="chart-style-name" select="draw:object/office:document/office:body/office:chart/chart:chart/@chart:style-name"/>
+ <xsl:for-each select="draw:object/office:document/office:automatic-styles/style:style[@style:name=$chart-style-name]">
+ <表:边框 uof:locID="s0057" uof:attrList="类型 宽度 è¾¹è· é¢œè‰² 阴影">
+ <xsl:call-template name="表:边框"/>
+ </表:边框>
+ <xsl:if test="style:graphic-properties/@draw:fill-color or (style:graphic-properties/@draw:fill and not(style:graphic-properties/@draw:fill='none'))">
+ <表:填充 uof:locID="s0058">
+ <xsl:call-template name="图:填充类型"/>
+ </表:填充>
+ </xsl:if>
+ <表:字体 uof:locID="s0059" uof:attrList="å¼æ ·å¼•ç”¨">
+ <xsl:call-template name="å­—:å¥å±žæ€§ç±»åž‹">
+ </xsl:call-template>
+ </表:字体>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="表:绘图区">
+ <xsl:param name="table-name"/>
+ <xsl:param name="data-area"/>
+ <xsl:param name="series-generate"/>
+ <xsl:variable name="plot-style-name" select="draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/chart:wall/@chart:style-name"/>
+ <xsl:for-each select="draw:object/office:document/office:automatic-styles/style:style[@style:name=$plot-style-name]">
+ <表:边框 uof:locID="s0057" uof:attrList="类型 宽度 è¾¹è· é¢œè‰² 阴影">
+ <xsl:call-template name="表:边框"/>
+ </表:边框>
+ <xsl:if test="style:graphic-properties/@draw:fill-color or (style:graphic-properties/@draw:fill and not(style:graphic-properties/@draw:fill='none'))">
+ <表:填充 uof:locID="s0058">
+ <xsl:call-template name="图:填充类型2"/>
+ </表:填充>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="表:图例">
+ <xsl:param name="table-name"/>
+ <xsl:param name="data-area"/>
+ <xsl:param name="series-generate"/>
+ <xsl:variable name="legend">
+ <xsl:value-of select="draw:object/office:document/office:body/office:chart/chart:chart/chart:legend/@chart:style-name"/>
+ </xsl:variable>
+ <xsl:for-each select="draw:object/office:document/office:automatic-styles/style:style[@style:name=$legend]">
+ <表:边框 uof:locID="s0057" uof:attrList="类型 宽度 è¾¹è· é¢œè‰² 阴影">
+ <xsl:call-template name="表:边框"/>
+ </表:边框>
+ <xsl:if test="style:graphic-properties/@draw:fill-color or (style:graphic-properties/@draw:fill and not(style:graphic-properties/@draw:fill='none'))">
+ <表:填充 uof:locID="s0058">
+ <xsl:call-template name="图:填充类型"/>
+ </表:填充>
+ </xsl:if>
+ <表:字体 uof:locID="s0059" uof:attrList="å¼æ ·å¼•ç”¨">
+ <xsl:call-template name="å­—:å¥å±žæ€§ç±»åž‹"/>
+ </表:字体>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="表:图例项">
+ <xsl:param name="table-name"/>
+ <xsl:param name="data-area"/>
+ <xsl:param name="series-generate"/>
+ <表:图例项 uof:locID="s0084" uof:attrList="系列">
+ <表:字体 uof:locID="s0059" uof:attrList="å¼æ ·å¼•ç”¨">
+ <xsl:call-template name="å­—:å¥å±žæ€§ç±»åž‹"/>
+ </表:字体>
+ </表:图例项>
+ </xsl:template>
+ <xsl:template name="表:æ•°æ®è¡¨">
+ <xsl:param name="table-name"/>
+ <xsl:param name="data-area"/>
+ <xsl:param name="series-generate"/>
+ <xsl:if test="style:graphic-properties/@draw:fill-color or (style:graphic-properties/@draw:fill and not(style:graphic-properties/@draw:fill='none'))">
+ <表:填充 uof:locID="s0058">
+ <xsl:call-template name="图:填充类型"/>
+ </表:填充>
+ </xsl:if>
+ <表:字体 uof:locID="s0059" uof:attrList="å¼æ ·å¼•ç”¨">
+ <xsl:call-template name="å­—:å¥å±žæ€§ç±»åž‹"/>
+ </表:字体>
+ </xsl:template>
+ <xsl:template name="表:æ•°æ®ç³»åˆ—">
+ <xsl:param name="table-name"/>
+ <xsl:param name="data-area"/>
+ <xsl:param name="series-generate"/>
+ <xsl:param name="data-series-path"/>
+ <xsl:for-each select="$data-series-path">
+ <表:æ•°æ®ç³»åˆ— uof:locID="s0087" uof:attrList="系列">
+ <xsl:variable name="data-series-position">
+ <xsl:value-of select="position()"/>
+ </xsl:variable>
+ <xsl:attribute name="表:系列"><xsl:value-of select="$data-series-position"/></xsl:attribute>
+ <xsl:variable name="data-series-point" select="@chart:style-name"/>
+ <xsl:call-template name="表:æ•°æ®ç‚¹ç±»åž‹">
+ <xsl:with-param name="data-series-point" select="$data-series-point"/>
+ <xsl:with-param name="data-series-position" select="$data-series-position"/>
+ </xsl:call-template>
+ </表:æ•°æ®ç³»åˆ—>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="表:æ•°æ®ç‚¹">
+ <xsl:param name="table-name"/>
+ <xsl:param name="data-area"/>
+ <xsl:param name="series-generate"/>
+ <xsl:param name="data-series-path"/>
+ <xsl:for-each select="$data-series-path">
+ <xsl:variable name="data-series-position" select="position()"/>
+ <xsl:for-each select="chart:data-point">
+ <!--xsl:if test="@chart:style-name"-->
+ <xsl:variable name="data-point-position">
+ <xsl:call-template name="count-chart-data-point">
+ <xsl:with-param name="data-point-count" select="'1'"/>
+ <xsl:with-param name="data-point-position-temp" select="position() -1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <表:æ•°æ®ç‚¹ uof:locID="s0091" uof:attrList="系列 点">
+ <xsl:attribute name="表:系列"><xsl:value-of select="$data-series-position"/></xsl:attribute>
+ <xsl:attribute name="表:点"><xsl:value-of select="$data-point-position"/></xsl:attribute>
+ <xsl:variable name="data-series-point" select="@chart:style-name"/>
+ <xsl:for-each select="../../../../../office:automatic-styles/style:style[@style:name=$data-series-point]">
+ <表:边框 uof:locID="s0057" uof:attrList="类型 宽度 è¾¹è· é¢œè‰² 阴影">
+ <xsl:call-template name="表:边框"/>
+ </表:边框>
+ <xsl:if test="style:graphic-properties/@draw:fill-color or (style:graphic-properties/@draw:fill and not(style:graphic-properties/@draw:fill='none'))">
+ <表:填充 uof:locID="s0058">
+ <xsl:call-template name="图:填充类型"/>
+ </表:填充>
+ </xsl:if>
+ <表:字体 uof:locID="s0059" uof:attrList="å¼æ ·å¼•ç”¨">
+ <xsl:call-template name="å­—:å¥å±žæ€§ç±»åž‹"/>
+ </表:字体>
+ <表:显示标志 uof:locID="s0088" uof:attrList="系列å 类别å 数值 百分数 分隔符 图例标志">
+ <xsl:attribute name="表:系列å"/>
+ <xsl:attribute name="表:分隔符"/>
+ <xsl:if test="style:chart-properties/@chart:data-label-text">
+ <xsl:attribute name="表:类别å"><xsl:value-of select="style:chart-properties/@chart:data-label-text"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:chart-properties/@chart:data-label-number">
+ <xsl:choose>
+ <xsl:when test="style:chart-properties/@chart:data-label-number='value'">
+ <xsl:attribute name="表:数值">true</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="style:chart-properties/@chart:data-label-number='percentage'">
+ <xsl:attribute name="表:百分数">true</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="style:chart-properties/@chart:data-label-symbol">
+ <xsl:attribute name="表:图例标志"><xsl:value-of select="style:chart-properties/@chart:data-label-symbol"/></xsl:attribute>
+ </xsl:if>
+ </表:显示标志>
+ <表:系列å uof:locID="s0089">
+ <xsl:value-of select="concat('系列',$data-series-position)"/>
+ </表:系列å>
+ </xsl:for-each>
+ </表:æ•°æ®ç‚¹>
+ <!--/xsl:if-->
+ </xsl:for-each>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="表:网格线">
+ <xsl:param name="table-name"/>
+ <xsl:param name="data-area"/>
+ <xsl:param name="series-generate"/>
+ <xsl:param name="grid-type"/>
+ <xsl:if test="$grid-type='category axis'">
+ <xsl:variable name="category-axis-grid">
+ <xsl:value-of select="draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/chart:axis[@chart:dimension='x']/@chart:style-name"/>
+ </xsl:variable>
+ <xsl:for-each select="key('chart-style-name',$category-axis-grid)">
+ <表:网格线 uof:locID="s0093" uof:attrList="类型 宽度 è¾¹è· é¢œè‰² 阴影 ä½ç½®">
+ <xsl:call-template name="表:边框"/>
+ <xsl:attribute name="表:ä½ç½®"><xsl:value-of select="$grid-type"/></xsl:attribute>
+ </表:网格线>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:if test="$grid-type='value axis'">
+ <xsl:variable name="value-axis-grid">
+ <xsl:value-of select="draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/chart:axis[@chart:dimension='y']/@chart:style-name"/>
+ </xsl:variable>
+ <xsl:for-each select="key('chart-style-name',$value-axis-grid)">
+ <表:网格线 uof:locID="s0093" uof:attrList="类型 宽度 è¾¹è· é¢œè‰² 阴影 ä½ç½®">
+ <xsl:call-template name="表:边框"/>
+ <xsl:attribute name="表:ä½ç½®"><xsl:value-of select="$grid-type"/></xsl:attribute>
+ </表:网格线>
+ </xsl:for-each>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="表:系列">
+ <xsl:param name="table-name"/>
+ <xsl:param name="data-area"/>
+ <xsl:param name="series-generate"/>
+ <xsl:param name="series-row-start"/>
+ <xsl:param name="series-row-end"/>
+ <xsl:param name="series-col-start"/>
+ <xsl:param name="series-col-end"/>
+ <xsl:param name="series-value-current"/>
+ <xsl:param name="series-value-count"/>
+ <xsl:choose>
+ <xsl:when test="$series-value-current>$series-value-count"/>
+ <xsl:otherwise>
+ <表:系列 uof:locID="s0095" uof:attrList="系列å 系列值 分类å">
+ <xsl:attribute name="表:系列å"><xsl:value-of select="concat('系列',$series-value-current)"/></xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="$series-generate='col'">
+ <xsl:variable name="series-col-letter-start">
+ <xsl:call-template name="General-Char-Transition">
+ <xsl:with-param name="input-char" select="$series-col-start +$series-value-current -1"/>
+ <xsl:with-param name="output-type" select="'CHARS_UPPER_LETTER'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="表:系列值"><xsl:value-of select="concat($table-name,'!',$series-col-letter-start,$series-row-start,':',$series-col-letter-start,$series-row-end)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="series-col-letter-start">
+ <xsl:value-of select="substring(substring-after($data-area,'.'),1,1)"/>
+ </xsl:variable>
+ <xsl:variable name="series-col-letter-end">
+ <xsl:value-of select="substring(substring-after(substring-after($data-area,'.'),'.'),1,1)"/>
+ </xsl:variable>
+ <xsl:attribute name="表:系列值"><xsl:value-of select="concat($table-name,'!',$series-col-letter-start,$series-row-start +$series-value-current -1,':',$series-col-letter-end,$series-row-start +$series-value-current -1)"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </表:系列>
+ <xsl:call-template name="表:系列">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="data-area" select="$data-area"/>
+ <xsl:with-param name="series-generate" select="$series-generate"/>
+ <xsl:with-param name="series-row-start" select="$series-row-start"/>
+ <xsl:with-param name="series-row-end" select="$series-row-end"/>
+ <xsl:with-param name="series-col-start" select="$series-col-start"/>
+ <xsl:with-param name="series-col-end" select="$series-col-end"/>
+ <xsl:with-param name="series-value-current" select="$series-value-current +1"/>
+ <xsl:with-param name="series-value-count" select="$series-value-count"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="表:标题">
+ <xsl:param name="table-name"/>
+ <xsl:param name="data-area"/>
+ <xsl:param name="series-generate"/>
+ <xsl:param name="caption-type"/>
+ <xsl:if test="$caption-type='chart'">
+ <xsl:variable name="chart-title">
+ <xsl:value-of select="draw:object/office:document/office:body/office:chart/chart:chart/chart:title/@chart:style-name"/>
+ </xsl:variable>
+ <xsl:variable name="chart-title-name">
+ <xsl:value-of select="draw:object/office:document/office:body/office:chart/chart:chart/chart:title/text:p"/>
+ </xsl:variable>
+ <xsl:for-each select="key('chart-style-name',$chart-title)">
+ <表:标题 uof:locID="s0097" uof:attrList="å称 ä½ç½®">
+ <xsl:attribute name="表:å称"><xsl:value-of select="$chart-title-name"/></xsl:attribute>
+ <xsl:attribute name="表:ä½ç½®"><xsl:value-of select="$caption-type"/></xsl:attribute>
+ <xsl:call-template name="表:标题类型"/>
+ </表:标题>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:if test="$caption-type='category axis'">
+ <xsl:variable name="category-axis-title">
+ <xsl:value-of select="draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/chart:axis[@chart:dimension='x']/chart:title/@chart:style-name"/>
+ </xsl:variable>
+ <xsl:variable name="category-axis-title-name">
+ <xsl:value-of select="draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/chart:axis[@chart:dimension='x']/chart:title/text:p"/>
+ </xsl:variable>
+ <xsl:for-each select="key('chart-style-name',$category-axis-title)">
+ <表:标题 uof:locID="s0097" uof:attrList="å称 ä½ç½®">
+ <xsl:attribute name="表:å称"><xsl:value-of select="$category-axis-title-name"/></xsl:attribute>
+ <xsl:attribute name="表:ä½ç½®"><xsl:value-of select="$caption-type"/></xsl:attribute>
+ <xsl:call-template name="表:标题类型"/>
+ </表:标题>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:if test="$caption-type='value axis'">
+ <xsl:variable name="value-axis-title">
+ <xsl:value-of select="draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/chart:axis[@chart:dimension='y']/chart:title/@chart:style-name"/>
+ </xsl:variable>
+ <xsl:variable name="value-axis-title-name">
+ <xsl:value-of select="draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/chart:axis[@chart:dimension='y']/chart:title/text:p"/>
+ </xsl:variable>
+ <xsl:for-each select="key('chart-style-name',$value-axis-title)">
+ <表:标题 uof:locID="s0097" uof:attrList="å称 ä½ç½®">
+ <xsl:attribute name="表:å称"><xsl:value-of select="$value-axis-title-name"/></xsl:attribute>
+ <xsl:attribute name="表:ä½ç½®"><xsl:value-of select="$caption-type"/></xsl:attribute>
+ <xsl:call-template name="表:标题类型"/>
+ </表:标题>
+ </xsl:for-each>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="表:å标轴类型">
+ <xsl:param name="table-name"/>
+ <xsl:param name="data-area"/>
+ <xsl:param name="series-generate"/>
+ <xsl:param name="axis-type"/>
+ <表:线型 uof:locID="s0062" uof:attrList="类型 宽度 è¾¹è· é¢œè‰² 阴影">
+ <xsl:attribute name="uof:类型"><xsl:call-template name="表:线型"/></xsl:attribute>
+ </表:线型>
+ <表:数值 uof:locID="s0063" uof:attrList="é“¾æŽ¥åˆ°æº åˆ†ç±»å称 æ ¼å¼ç ">
+ <xsl:attribute name="表:链接到æº"><xsl:choose><xsl:when test="style:chart-properties/@chart:link-data-style-to-source"><xsl:value-of select="style:chart-properties/@chart:link-data-style-to-source"/></xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="@style:data-style-name">
+ <xsl:call-template name="Chart-NumberFormat">
+ <xsl:with-param name="temp-style" select="@style:data-style-name"/>
+ </xsl:call-template>
+ </xsl:if>
+ </表:数值>
+ <表:字体 uof:locID="s0059" uof:attrList="å¼æ ·å¼•ç”¨">
+ <xsl:call-template name="å­—:å¥å±žæ€§ç±»åž‹"/>
+ </表:字体>
+ <表:刻度 uof:locID="s0064">
+ <xsl:call-template name="表:刻度类型"/>
+ </表:刻度>
+ <表:å¯¹é½ uof:locID="s0078">
+ <xsl:if test="style:chart-properties/@style:direction">
+ <xsl:element name="表:文字方å‘">
+ <xsl:attribute name="uof:locID">s0079</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="style:chart-properties/@style:direction = 'ttb'">vertical</xsl:when>
+ <xsl:otherwise>horizontal</xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:chart-properties/@text:rotation-angle">
+ <表:旋转角度 uof:locID="s0080">
+ <xsl:value-of select="style:chart-properties/@text:rotation-angle"/>
+ </表:旋转角度>
+ </xsl:if>
+ <表:åç§»é‡ uof:locID="s0081"/>
+ </表:对é½>
+ </xsl:template>
+ <xsl:template name="Chart-NumberFormat">
+ <xsl:param name="temp-style"/>
+ <xsl:for-each select="(preceding-sibling::*[@style:name=$temp-style]) | (following-sibling::*[@style:name=$temp-style])">
+ <xsl:attribute name="表:分类å称"><xsl:choose><xsl:when test="name(.)='number:currency-style'">currency</xsl:when><xsl:when test="name(.)='number:percentage-style'">percentage</xsl:when><xsl:when test="name(.)='number:date-style'">date</xsl:when><xsl:when test="name(.)='number:time-style'">time</xsl:when><xsl:when test="name(.)='number:boolean-style'">custom</xsl:when><xsl:when test="name(.)='number:text-style'">text</xsl:when><xsl:when test="name(.)='number:number-style'"><xsl:choose><xsl:when test="number:fraction">fraction</xsl:when><xsl:when test="number:scientific-number">scientific</xsl:when><xsl:otherwise>number</xsl:otherwise></xsl:choose></xsl:when><xsl:otherwise>general</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="表:æ ¼å¼ç "><xsl:call-template name="element-attribute"/><xsl:for-each select="style:map"><xsl:text>[</xsl:text><xsl:value-of select="@style:condition"/><xsl:text>]</xsl:text><xsl:variable name="apply-style" select="@style:apply-style-name"/><xsl:for-each select="../../child::*[@style:name=$apply-style]/*"><xsl:call-template name="general-number-format"/></xsl:for-each><xsl:text>;</xsl:text></xsl:for-each><xsl:for-each select="*[not(name(.)='style:map')]"><xsl:call-template name="general-number-format"/></xsl:for-each></xsl:attribute>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="表:æ•°æ®ç‚¹ç±»åž‹">
+ <xsl:param name="data-series-point"/>
+ <xsl:param name="data-series-position"/>
+ <xsl:for-each select="ancestor::draw:object/office:document/office:automatic-styles/style:style[@style:name=$data-series-point]">
+ <表:边框 uof:locID="s0057" uof:attrList="类型 宽度 è¾¹è· é¢œè‰² 阴影">
+ <xsl:call-template name="表:边框"/>
+ </表:边框>
+ <xsl:if test="style:graphic-properties/@draw:fill-color or (style:graphic-properties/@draw:fill and not(style:graphic-properties/@draw:fill='none'))">
+ <表:填充 uof:locID="s0058">
+ <xsl:call-template name="图:填充类型"/>
+ </表:填充>
+ </xsl:if>
+ <表:字体 uof:locID="s0059" uof:attrList="å¼æ ·å¼•ç”¨">
+ <xsl:call-template name="å­—:å¥å±žæ€§ç±»åž‹"/>
+ </表:字体>
+ <表:显示标志 uof:locID="s0088" uof:attrList="系列å 类别å 数值 百分数 分隔符 图例标志">
+ <xsl:attribute name="表:系列å">true</xsl:attribute>
+ <xsl:if test="style:chart-properties/@chart:data-label-text">
+ <xsl:attribute name="表:类别å"><xsl:value-of select="style:chart-properties/@chart:data-label-text"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:chart-properties/@chart:data-label-number">
+ <xsl:choose>
+ <xsl:when test="style:chart-properties/@chart:data-label-number='value'">
+ <xsl:attribute name="表:数值">true</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="style:chart-properties/@chart:data-label-number='percentage'">
+ <xsl:attribute name="表:百分数">true</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="style:chart-properties/@chart:data-label-symbol">
+ <xsl:attribute name="表:图例标志"><xsl:value-of select="style:chart-properties/@chart:data-label-symbol"/></xsl:attribute>
+ </xsl:if>
+ </表:显示标志>
+ <表:系列å uof:locID="s0089">
+ <xsl:value-of select="concat('系列',$data-series-position)"/>
+ </表:系列å>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="表:标题类型">
+ <表:边框 uof:locID="s0057" uof:attrList="类型 宽度 è¾¹è· é¢œè‰² 阴影">
+ <xsl:call-template name="表:边框"/>
+ </表:边框>
+ <xsl:if test="style:graphic-properties/@draw:fill-color or (style:graphic-properties/@draw:fill and not(style:graphic-properties/@draw:fill='none'))">
+ <表:填充 uof:locID="s0058">
+ <xsl:call-template name="图:填充类型"/>
+ </表:填充>
+ </xsl:if>
+ <表:字体 uof:locID="s0059" uof:attrList="å¼æ ·å¼•ç”¨">
+ <xsl:call-template name="å­—:å¥å±žæ€§ç±»åž‹"/>
+ </表:字体>
+ <表:å¯¹é½ uof:locID="s0020">
+ <xsl:call-template name="表:对é½æ ¼å¼ç±»åž‹"/>
+ </表:对é½>
+ </xsl:template>
+ <xsl:template name="count-chart-data-point">
+ <xsl:param name="data-point-count"/>
+ <xsl:param name="data-point-position-temp"/>
+ <xsl:choose>
+ <xsl:when test="$data-point-position-temp=0">
+ <xsl:value-of select="$data-point-count"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="temp">
+ <xsl:for-each select="../chart:data-point[position()=$data-point-position-temp]">
+ <xsl:choose>
+ <xsl:when test="@chart:repeated">
+ <xsl:value-of select="@chart:repeated"/>
+ </xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:call-template name="count-chart-data-point">
+ <xsl:with-param name="data-point-count" select="$data-point-count +$temp"/>
+ <xsl:with-param name="data-point-position-temp" select="$data-point-position-temp -1"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="表:边框">
+ <xsl:attribute name="uof:类型"><xsl:call-template name="表:线型"/></xsl:attribute>
+ <xsl:if test="style:graphic-properties/@svg:stroke-width">
+ <xsl:attribute name="uof:宽度"><xsl:value-of select="substring-before(style:graphic-properties/@svg:stroke-width,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:graphic-properties/@svg:stroke-color">
+ <xsl:attribute name="uof:颜色"><xsl:value-of select="style:graphic-properties/@svg:stroke-color"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="uof:阴影">false</xsl:attribute>
+ </xsl:template>
+ <xsl:template name="图:填充类型">
+ <xsl:choose>
+ <xsl:when test="style:graphic-properties/@draw:fill='gradient'">
+ <xsl:variable name="gradient-name">
+ <xsl:value-of select="style:graphic-properties/@draw:fill-gradient-name"/>
+ </xsl:variable>
+ <xsl:for-each select="/descendant::draw:gradient[@draw:name=$gradient-name]">
+ <图:æ¸å˜ uof:locID="g0037" uof:attrList="起始色 终止色 ç§å­ç±»åž‹ 起始浓度 终止浓度 æ¸å˜æ–¹å‘ 边界 ç§å­Xä½ç½® ç§å­Yä½ç½® 类型">
+ <xsl:attribute name="图:起始色"><xsl:value-of select="@draw:start-color"/></xsl:attribute>
+ <xsl:attribute name="图:终止色"><xsl:value-of select="@draw:end-color"/></xsl:attribute>
+ <xsl:attribute name="图:ç§å­ç±»åž‹"><xsl:choose><xsl:when test="@draw:style='linear' or @draw:style='axial'">linear</xsl:when><xsl:when test="@draw:style='radial'">radar</xsl:when><xsl:when test="@draw:style='ellipsoid'">oval</xsl:when><xsl:when test="@draw:style='square'">square</xsl:when><xsl:when test="@draw:style='rectangular'">rectangle</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:attribute name="图:起始浓度"><xsl:value-of select="substring-before(@draw:start-intensity,'%')"/></xsl:attribute>
+ <xsl:attribute name="图:终止浓度"><xsl:value-of select="substring-before(@draw:end-intensity,'%')"/></xsl:attribute>
+ <xsl:variable name="angle">
+ <xsl:value-of select="@draw:angle div 10"/>
+ </xsl:variable>
+ <xsl:attribute name="图:æ¸å˜æ–¹å‘"><xsl:choose><xsl:when test="0&lt;$angle and $angle&lt;25">0</xsl:when><xsl:when test="25&lt;$angle and $angle&lt;70">45</xsl:when><xsl:when test="70&lt;$angle and $angle&lt;115">90</xsl:when><xsl:when test="115&lt;$angle and $angle&lt;160">135</xsl:when><xsl:when test="160&lt;$angle and $angle&lt;205">180</xsl:when><xsl:when test="205&lt;$angle and $angle&lt;250">225</xsl:when><xsl:when test="250&lt;$angle and $angle&lt;295">270</xsl:when><xsl:when test="295&lt;$angle and $angle&lt;340">315</xsl:when><xsl:when test="340&lt;$angle and $angle&lt;360">360</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:attribute name="图:边界"><xsl:value-of select="substring-before(@draw:border,'%')"/></xsl:attribute>
+ <xsl:if test="@draw:cx">
+ <xsl:attribute name="图:ç§å­Xä½ç½®"><xsl:value-of select="substring-before(@draw:cx,'%')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@draw:cy">
+ <xsl:attribute name="图:ç§å­Yä½ç½®"><xsl:value-of select="substring-before(@draw:cy,'%')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="图:类型">-2</xsl:attribute>
+ </图:æ¸å˜>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:fill-image-name">
+ <图:图片 uof:locID="g0035" uof:attrList="ä½ç½® 图形引用 类型 å称">
+ <xsl:attribute name="图:ä½ç½®"><xsl:choose><xsl:when test="not(style:graphic-properties/@style:repeat)">tile</xsl:when><xsl:otherwise><xsl:choose><xsl:when test="style:graphic-properties/@style:repeat = 'stretch'">stretch</xsl:when><xsl:when test="style:graphic-properties/@style:repeat = 'repeat'">tile</xsl:when><xsl:when test="style:graphic-properties/@style:repeat = 'no-repeat'">center</xsl:when></xsl:choose></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="图:图形引用"><xsl:value-of select="concat('chart_image_',count(preceding::draw:fill-image))"/></xsl:attribute>
+ <xsl:attribute name="图:类型">png</xsl:attribute>
+ <xsl:attribute name="图:å称"><xsl:value-of select="style:graphic-properties/@draw:fill-image-name"/></xsl:attribute>
+ </图:图片>
+ </xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:fill='hatch'">
+ <图:图案 uof:locID="g0036" uof:attrList="类型 图形引用 å‰æ™¯è‰² 背景色">
+ <xsl:attribute name="图:类型"><xsl:value-of select="../../office:styles/draw:hatch/@draw:name"/></xsl:attribute>
+ <xsl:attribute name="图:图形引用">gr1</xsl:attribute>
+ <xsl:attribute name="图:å‰æ™¯è‰²"><xsl:value-of select="../../office:styles/draw:hatch/@draw:color"/></xsl:attribute>
+ <xsl:attribute name="图:背景色"><xsl:choose><xsl:when test="style:graphic-properties/@draw:fill-color"><xsl:value-of select="style:graphic-properties/@draw:fill-color"/></xsl:when><xsl:otherwise>#ffffff</xsl:otherwise></xsl:choose></xsl:attribute>
+ </图:图案>
+ </xsl:when>
+ <xsl:otherwise>
+ <图:颜色 uof:locID="g0034">
+ <xsl:choose>
+ <xsl:when test="style:graphic-properties/@draw:fill-color">
+ <xsl:value-of select="style:graphic-properties/@draw:fill-color"/>
+ </xsl:when>
+ <xsl:otherwise>#99ccff</xsl:otherwise>
+ </xsl:choose>
+ </图:颜色>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="图:填充类型2">
+ <xsl:if test="style:graphic-properties/@draw:fill-color">
+ <图:颜色 uof:locID="g0034">
+ <xsl:value-of select="style:graphic-properties/@draw:fill-color"/>
+ </图:颜色>
+ </xsl:if>
+ <xsl:if test="style:graphic-properties/@draw:fill-image-name">
+ <xsl:variable name="chart-image-name" select="style:graphic-properties/@draw:fill-image-name"/>
+ <图:图片 uof:locID="g0035" uof:attrList="ä½ç½® 图形引用 类型 å称">
+ <xsl:attribute name="图:ä½ç½®"><xsl:choose><xsl:when test="not(style:graphic-properties/@style:repeat)">tile</xsl:when><xsl:otherwise><xsl:choose><xsl:when test="style:graphic-properties/@style:repeat = 'stretch'">stretch</xsl:when><xsl:when test="style:graphic-properties/@style:repeat = 'repeat'">tile</xsl:when><xsl:when test="style:graphic-properties/@style:repeat = 'no-repeat'">center</xsl:when></xsl:choose></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:for-each select="../../office:styles/draw:fill-image[@draw:name=$chart-image-name]">
+ <xsl:attribute name="图:图形引用"><xsl:value-of select="concat('chart_image_',count(preceding::draw:fill-image))"/></xsl:attribute>
+ </xsl:for-each>
+ <xsl:attribute name="图:类型">png</xsl:attribute>
+ <xsl:attribute name="图:å称"><xsl:value-of select="$chart-image-name"/></xsl:attribute>
+ </图:图片>
+ </xsl:if>
+ <xsl:if test="style:graphic-properties/@draw:fill-hatch-name">
+ <xsl:variable name="chart-hatch-name" select="style:graphic-properties/@draw:fill-hatch-name"/>
+ <图:图案 uof:locID="g0036" uof:attrList="类型 图形引用 å‰æ™¯è‰² 背景色">
+ <xsl:for-each select="../../office:styles/draw:hatch[@draw:name=$chart-hatch-name]">
+ <xsl:attribute name="图:类型"><xsl:value-of select="@draw:style"/></xsl:attribute>
+ <xsl:attribute name="图:å‰æ™¯è‰²"><xsl:value-of select="@draw:color"/></xsl:attribute>
+ <xsl:attribute name="图:背景色"/>
+ <xsl:attribute name="图:è·ç¦»"><xsl:value-of select="@draw:distance"/></xsl:attribute>
+ <xsl:attribute name="图:旋转度"><xsl:value-of select="@draw:rotation"/></xsl:attribute>
+ </xsl:for-each>
+ <xsl:attribute name="图:图形引用"><xsl:value-of select="$chart-hatch-name"/></xsl:attribute>
+ </图:图案>
+ </xsl:if>
+ <xsl:if test="style:graphic-properties/@draw:fill-gradient-name">
+ <xsl:variable name="chart-gradient-name" select="style:graphic-properties/@draw:fill-gradient-name"/>
+ <图:æ¸å˜ uof:locID="g0037" uof:attrList="起始色 终止色 ç§å­ç±»åž‹ 起始浓度 终止浓度 æ¸å˜æ–¹å‘ 边界 ç§å­Xä½ç½® ç§å­Yä½ç½® 类型">
+ <xsl:for-each select="../../office:styles/draw:gradient[@draw:name=$chart-gradient-name]">
+ <xsl:attribute name="图:起始色"><xsl:value-of select="@draw:start-color"/></xsl:attribute>
+ <xsl:attribute name="图:终止色"><xsl:value-of select="@draw:end-color"/></xsl:attribute>
+ <xsl:attribute name="图:ç§å­ç±»åž‹"><xsl:choose><xsl:when test="@draw:style='linear' or @draw:style='axial'">linear</xsl:when><xsl:when test="@draw:style='radial'">radar</xsl:when><xsl:when test="@draw:style='ellipsoid'">oval</xsl:when><xsl:when test="@draw:style='square'">square</xsl:when><xsl:when test="@draw:style='rectangular'">rectangle</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:attribute name="图:起始浓度"><xsl:value-of select="substring-before(@draw:start-intensity,'%')"/></xsl:attribute>
+ <xsl:attribute name="图:终止浓度"><xsl:value-of select="substring-before(@draw:end-intensity,'%')"/></xsl:attribute>
+ <xsl:variable name="angle">
+ <xsl:value-of select="@draw:angle div 10"/>
+ </xsl:variable>
+ <xsl:attribute name="图:æ¸å˜æ–¹å‘"><xsl:choose><xsl:when test="0&lt;$angle and $angle&lt;25">0</xsl:when><xsl:when test="25&lt;$angle and $angle&lt;70">45</xsl:when><xsl:when test="70&lt;$angle and $angle&lt;115">90</xsl:when><xsl:when test="115&lt;$angle and $angle&lt;160">135</xsl:when><xsl:when test="160&lt;$angle and $angle&lt;205">180</xsl:when><xsl:when test="205&lt;$angle and $angle&lt;250">225</xsl:when><xsl:when test="250&lt;$angle and $angle&lt;295">270</xsl:when><xsl:when test="295&lt;$angle and $angle&lt;340">315</xsl:when><xsl:when test="340&lt;$angle and $angle&lt;360">360</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:attribute name="图:边界"><xsl:value-of select="substring-before(@draw:border,'%')"/></xsl:attribute>
+ <xsl:if test="@draw:cx">
+ <xsl:attribute name="图:ç§å­Xä½ç½®"><xsl:value-of select="substring-before(@draw:cx,'%')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@draw:cy">
+ <xsl:attribute name="图:ç§å­Yä½ç½®"><xsl:value-of select="substring-before(@draw:cy,'%')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="图:类型">-2</xsl:attribute>
+ </xsl:for-each>
+ <xsl:attribute name="图:图形引用"><xsl:value-of select="$chart-gradient-name"/></xsl:attribute>
+ </图:æ¸å˜>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="表:对é½æ ¼å¼ç±»åž‹">
+ <xsl:if test="style:chart-properties/@style:rotation-angle">
+ <表:文字旋转角度 uof:locID="s0080">
+ <xsl:value-of select="style:chart-properties/@style:rotation-angle"/>
+ </表:文字旋转角度>
+ </xsl:if>
+ <xsl:if test="style:chart-properties/@fo:text-align">
+ <xsl:element name="表:水平对é½æ–¹å¼">
+ <xsl:attribute name="uof:locID">s0115</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="style:chart-properties/@fo:text-align = 'center'">center</xsl:when>
+ <xsl:when test="style:chart-properties/@fo:text-align = 'end'">right</xsl:when>
+ <xsl:when test="style:chart-properties/@fo:text-align = 'justify'">justify</xsl:when>
+ <xsl:when test="style:chart-properties/@fo:text-align = 'start'">left</xsl:when>
+ <xsl:otherwise>fill</xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="(style:chart-properties/@style:vertical-align) or (style:chart-properties/@fo:vertical-align)">
+ <xsl:element name="表:垂直对é½æ–¹å¼">
+ <xsl:attribute name="uof:locID">s0116</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="style:chart-properties/@fo:vertical-align = 'top'">top</xsl:when>
+ <xsl:when test="style:chart-propeoperties/@fo:vertical-align = 'middle'">center</xsl:when>
+ <xsl:when test="style:charties/@fo:vertical-align = 'bottom'">bottom</xsl:when>
+ <xsl:when test="style:chart-prrt-properties/@fo:vertical-align = 'justify'">justify</xsl:when>
+ <xsl:when test="style:chart-properties/@fo:vertical-align = 'top'">top</xsl:when>
+ <xsl:otherwise>distributed</xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:paragraph-properties/@fo:margin-left">
+ <表:缩进 uof:locID="s0117">
+ <xsl:value-of select="substring-before(style:paragraph-properties/@fo:margin-left,$uofUnit)"/>
+ </表:缩进>
+ </xsl:if>
+ <xsl:element name="表:文字方å‘">
+ <xsl:attribute name="uof:locID">s0118</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="style:chart-properties/@style:direction = 'ttb'">vertical</xsl:when>
+ <xsl:otherwise>horizontal</xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <表:自动æ¢è¡Œ uof:locID="s0120" uof:attrList="值">
+ <xsl:attribute name="表:值">true</xsl:attribute>
+ </表:自动æ¢è¡Œ>
+ <表:缩å°å­—体填充 uof:locID="s0121" uof:attrList="值">
+ <xsl:attribute name="表:值">true</xsl:attribute>
+ </表:缩å°å­—体填充>
+ </xsl:template>
+ <xsl:template name="表:线型">
+ <xsl:variable name="linetype" select="style:graphic-properties/@draw:stroke-dash"/>
+ <xsl:variable name="stroke" select="style:graphic-properties/@draw:stroke"/>
+ <xsl:choose>
+ <xsl:when test="$stroke='solid'">single</xsl:when>
+ <xsl:when test="$stroke='none'">none</xsl:when>
+ <xsl:when test="$stroke='dash'">
+ <xsl:choose>
+ <xsl:when test="$linetype='Ultrafine_20_Dashed'">dash</xsl:when>
+ <xsl:when test="$linetype='Fine_20_Dashed'">dashed-heavy</xsl:when>
+ <xsl:when test="$linetype='Ultrafine_20_2_20_Dots_20_3_20_Dashes'">dot-dash</xsl:when>
+ <xsl:when test="$linetype='Fine_20_Dotted'">dotted</xsl:when>
+ <xsl:when test="$linetype='Line_20_with_20_Fine_20_Dots'">dash-long-heavy</xsl:when>
+ <xsl:when test="$linetype='Fine_20_Dashed_20__28_var_29_'">dash-long</xsl:when>
+ <xsl:when test="$linetype='_33__20_Dashes_20_3_20_Dots_20__28_var_29_'">dash-dot-dot</xsl:when>
+ <xsl:when test="$linetype='Ultrafine_20_Dotted_20__28_var_29_'">dotted-heavy</xsl:when>
+ <xsl:when test="$linetype='Line_20_Style_20_9'">thick</xsl:when>
+ <xsl:when test="$linetype='_32__20_Dots_20_1_20_Dash'">dot-dot-dash</xsl:when>
+ <xsl:when test="$linetype='Dashed_20__28_var_29_'">dash-dot-dot-heavy</xsl:when>
+ <xsl:when test="$linetype='Dash_20_10'">dash-dot-heavy</xsl:when>
+ <xsl:otherwise>single</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>single</xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="表:刻度类型">
+ <xsl:if test="style:chart-properties/@chart:minimum">
+ <表:最å°å€¼ uof:locID="s0065">
+ <xsl:value-of select="style:chart-properties/@chart:minimum"/>
+ </表:最å°å€¼>
+ </xsl:if>
+ <xsl:if test="style:chart-properties/@chart:maximum">
+ <表:最大值 uof:locID="s0066">
+ <xsl:value-of select="style:chart-properties/@chart:maximum"/>
+ </表:最大值>
+ </xsl:if>
+ <xsl:if test="style:chart-properties/@chart:interval-major">
+ <表:主å•ä½ uof:locID="s0067">
+ <xsl:value-of select="style:chart-properties/@chart:interval-major"/>
+ </表:主å•ä½>
+ </xsl:if>
+ <xsl:if test="style:chart-properties/@chart:interval-minor">
+ <表:次å•ä½ uof:locID="s0068">
+ <xsl:value-of select="style:chart-properties/@chart:interval-minor"/>
+ </表:次å•ä½>
+ </xsl:if>
+ <xsl:if test="style:chart-properties/@chart:origin">
+ <表:分类交å‰ç‚¹ uof:locID="s0069">
+ <xsl:value-of select="style:chart-properties/@chart:origin"/>
+ </表:分类交å‰ç‚¹>
+ </xsl:if>
+ <表:å•ä½ uof:locID="s0070">none</表:å•ä½>
+ <表:显示å•ä½ uof:locID="s0071" uof:attrList="值" 表:值="false"/>
+ <表:对数 uof:locID="s0072" uof:attrList="值" 表:值="false"/>
+ </xsl:template>
+ <xsl:template name="å­—:å¥å±žæ€§ç±»åž‹">
+ <xsl:element name="字:字体">
+ <xsl:attribute name="uof:locID">t0088</xsl:attribute>
+ <xsl:attribute name="uof:attrList">西文字体引用 中文字体引用 特殊字体引用 西文绘制 å­—å· ç›¸å¯¹å­—å· é¢œè‰²</xsl:attribute>
+ <xsl:if test="style:text-properties/@fo:font-size or style:text-properties/@style:font-size-asian or style:text-properties/@style:font-size-complex">
+ <xsl:choose>
+ <xsl:when test="contains(style:text-properties/@fo:font-size,'%') or contains(style:text-properties/@style:font-size-asian,'%')">
+ <xsl:attribute name="å­—:相对字å·"><xsl:choose><xsl:when test="style:text-properties/@fo:font-size"><xsl:value-of select="substring-before(style:text-properties/@fo:font-size,'%')"/></xsl:when><xsl:when test="style:text-properties/@style:font-size-asian"><xsl:value-of select="substring-before(style:text-properties/@style:font-size-asian,'%')"/></xsl:when></xsl:choose></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="å­—:å­—å·"><xsl:choose><xsl:when test="style:text-properties/@fo:font-size"><xsl:value-of select="substring-before(style:text-properties/@fo:font-size,'pt')"/></xsl:when><xsl:when test="style:text-properties/@style:font-size-asian"><xsl:value-of select="substring-before(style:text-properties/@style:font-size-asian,'pt')"/></xsl:when><xsl:when test="style:text-properties/@style:font-size-complex"><xsl:value-of select="substring-before(style:text-properties/@style:font-size-complex,'pt')"/></xsl:when></xsl:choose></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@fo:font-family">
+ <xsl:attribute name="字:西文字体引用"><xsl:value-of select="style:text-properties/@fo:font-family"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@style:font-family-asian">
+ <xsl:attribute name="字:中文字体引用"><xsl:value-of select="style:text-properties/@style:font-family-asian"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@fo:color">
+ <xsl:attribute name="字:颜色"><xsl:value-of select="style:text-properties/@fo:color"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:if test="style:text-properties/@style:text-background-color and not(style:text-properties/@style:text-background-color='transparent')">
+ <xsl:element name="å­—:å¡«å……">
+ <xsl:element name="图:图案">
+ <xsl:attribute name="uof:locID">g0036</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 图形引用 å‰æ™¯è‰² 背景色</xsl:attribute>
+ <xsl:if test="style:text-properties/@style:text-background-color">
+ <xsl:attribute name="图:å‰æ™¯è‰²"><xsl:value-of select="style:text-properties/@style:text-background-color"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@fo:font-weight or style:text-properties/@style:font-weight-asian">
+ <xsl:element name="字:粗体">
+ <xsl:attribute name="uof:locID">t0089</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test="style:text-properties/@style:font-weight-asian='bold' or style:text-properties/@fo:font-weight='bold'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@fo:font-style or style:text-properties/@style:font-style-asian">
+ <xsl:element name="字:斜体">
+ <xsl:attribute name="uof:locID">t0090</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test="style:text-properties/@fo:font-style='italic' or style:text-properties/@style:font-style-asian='italic'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@style:text-line-through-style and not(style:text-properties/@style:text-line-through-style='none')">
+ <xsl:element name="字:删除线">
+ <xsl:attribute name="uof:locID">t0094</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型</xsl:attribute>
+ <xsl:attribute name="字:类型"><xsl:call-template name="uof:delete线型类型"/></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@style:text-underline">
+ <xsl:element name="字:下划线">
+ <xsl:attribute name="字:类型"><xsl:call-template name="uof:线型类型"/></xsl:attribute>
+ <xsl:attribute name="uof:locID">t0095</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型</xsl:attribute>
+ <xsl:if test="style:text-properties/@style:text-underline-color">
+ <xsl:attribute name="字:颜色"><xsl:choose><xsl:when test="style:text-properties/@style:text-underline-color='font-color'">auto</xsl:when><xsl:otherwise><xsl:value-of select="style:text-properties/@style:text-underline-color"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@fo:text-shadow">
+ <xsl:element name="字:阴影">
+ <xsl:attribute name="uof:locID">t0100</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test="style:text-properties/@fo:text-shadow='none'">false</xsl:when><xsl:otherwise>true</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@style:text-emphasize">
+ <xsl:element name="å­—:ç€é‡å·">
+ <xsl:attribute name="uof:locID">t0096</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 颜色 å­—ç€é‡å·</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="style:text-properties/@style:text-emphasize='none'">
+ <xsl:attribute name="å­—:å­—ç€é‡å·">false</xsl:attribute>
+ <xsl:attribute name="字:类型">none</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="å­—:å­—ç€é‡å·">true</xsl:attribute>
+ <xsl:attribute name="å­—:类型"><xsl:call-template name="uof:ç€é‡å·ç±»åž‹"><xsl:with-param name="te" select="style:text-properties/@style:text-emphasize"/></xsl:call-template></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="style:text-properties/@fo:color">
+ <xsl:attribute name="字:颜色"><xsl:value-of select="style:text-properties/@fo:color"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@text:display">
+ <xsl:element name="å­—:éšè—文字">
+ <xsl:attribute name="uof:locID">t0097</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值">true</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@style:text-outline">
+ <xsl:element name="字:空心">
+ <xsl:attribute name="uof:locID">t0098</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:value-of select="style:text-properties/@style:text-outline"/></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@style:font-relief">
+ <xsl:element name="字:浮雕">
+ <xsl:attribute name="uof:locID">t0099</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型</xsl:attribute>
+ <xsl:attribute name="字:类型"><xsl:choose><xsl:when test="style:text-properties/@style:font-relief='embossed'">emboss</xsl:when><xsl:when test="style:text-properties/@style:font-relief='engraved'">engrave</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@fo:text-transform or style:text-properties/@fo:font-variant">
+ <xsl:element name="字:醒目字体">
+ <xsl:attribute name="uof:locID">t0101</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型</xsl:attribute>
+ <xsl:attribute name="字:类型"><xsl:choose><xsl:when test="style:text-properties/@fo:text-transform='uppercase'">uppercase</xsl:when><xsl:when test="style:text-properties/@fo:text-transform='lowercase'">lowercase</xsl:when><xsl:when test="style:text-properties/@fo:text-transform='capitalize'">capital</xsl:when><xsl:when test="style:text-properties/@fo:font-variant='small-caps'">small-caps</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@style:text-position">
+ <xsl:element name="å­—:ä½ç½®">
+ <xsl:attribute name="uof:locID">t0102</xsl:attribute>
+ <xsl:value-of select="style:text-properties/@style:text-position"/>
+ </xsl:element>
+ <字:上下标 uof:locID="t0205" uof:attrList="值">
+ <xsl:attribute name="字:值">none</xsl:attribute>
+ </字:上下标>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@style:text-scale">
+ <xsl:element name="字:缩放">
+ <xsl:attribute name="uof:locID">t0103</xsl:attribute>
+ <xsl:value-of select="style:text-properties/@style:text-scale"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@fo:letter-spacing">
+ <xsl:element name="å­—:字符间è·">
+ <xsl:attribute name="uof:locID">t0104</xsl:attribute>
+ <xsl:value-of select="style:text-properties/@fo:letter-spacing"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@style:letter-kerning">
+ <xsl:element name="å­—:调整字间è·">
+ <xsl:attribute name="uof:locID">t015</xsl:attribute>
+ <xsl:value-of select="style:text-properties/@style:letter-kerning"/>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="uof:ç€é‡å·ç±»åž‹">
+ <xsl:param name="te"/>
+ <xsl:choose>
+ <xsl:when test="$te='disc above' ">disc above</xsl:when>
+ <xsl:when test="$te='circle above' ">circle above</xsl:when>
+ <xsl:when test="$te='dot above' ">dot above</xsl:when>
+ <xsl:when test="$te='accent above' ">accent above</xsl:when>
+ <xsl:when test="$te='dot below' ">dot below</xsl:when>
+ <xsl:when test="$te='circle below' ">circle below</xsl:when>
+ <xsl:when test="$te='disc below' ">disc below</xsl:when>
+ <xsl:when test="$te='accent below' ">accent below</xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="uof:线型类型">
+ <xsl:variable name="spath" select="style:text-properties/@style:text-underline-style"/>
+ <xsl:variable name="wpath" select="style:text-properties/@style:text-underline-width"/>
+ <xsl:variable name="tpath" select="style:text-properties/@style:text-underline-type"/>
+ <xsl:choose>
+ <xsl:when test="$spath='solid' and not($tpath='double' ) and $wpath='auto' ">single</xsl:when>
+ <xsl:when test="$spath='solid' and $tpath='double' and $wpath='auto' ">double</xsl:when>
+ <xsl:when test="$spath='solid' and not($tpath='double' )and $wpath='bold' ">thick</xsl:when>
+ <xsl:when test="$spath='dotted' and not($tpath='double' )and $wpath='auto' ">dotted</xsl:when>
+ <xsl:when test="$spath='dotted' and not($tpath='double' )and $wpath='bold' ">dotted-heavy</xsl:when>
+ <xsl:when test="$spath='dash' and not($tpath='double' )and $wpath='auto' ">dash</xsl:when>
+ <xsl:when test="$spath='dash' and not($tpath='double' )and $wpath='bold' ">dashed-heavy</xsl:when>
+ <xsl:when test="$spath='long-dash' and not($tpath='double' )and $wpath='auto' ">dash-long</xsl:when>
+ <xsl:when test="$spath='long-dash' and not($tpath='double' )and $wpath='bold' ">dash-long-heavy</xsl:when>
+ <xsl:when test="$spath='dot-dash' and not($tpath='double' )and $wpath='auto' ">dot-dash</xsl:when>
+ <xsl:when test="$spath='dot-dash' and not($tpath='double' )and $wpath='bold' ">dash-dot-heavy</xsl:when>
+ <xsl:when test="$spath='dot-dot-dash' and not($tpath='double' )and $wpath='auto' ">dot-dot-dash</xsl:when>
+ <xsl:when test="$spath='dot-dot-dash' and not($tpath='double' )and $wpath='bold' ">dash-dot-dot-heavy</xsl:when>
+ <xsl:when test="$spath='wave' and not($tpath='double' )and $wpath='auto' ">wave</xsl:when>
+ <xsl:when test="$spath='wave' and not($tpath='double' )and $wpath='bold' ">wavy-heavy</xsl:when>
+ <xsl:when test="$spath='wave' and $tpath='double' and $wpath='auto' ">wavy-double</xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="uof:delete线型类型">
+ <xsl:variable name="wpath" select="style:text-properties/@style:text-line-through-width"/>
+ <xsl:variable name="textpath" select="style:text-properties/@style:text-line-through-text"/>
+ <xsl:variable name="umpath" select="style:text-properties/@style:text-underline-mode"/>
+ <xsl:variable name="tmpath" select="style:text-properties/@style:text-line-through-mode"/>
+ <xsl:variable name="tpath" select="style:text-properties/@style:text-line-through-type"/>
+ <xsl:choose>
+ <xsl:when test="$umpath='continuous' and $tmpath='continuous'">single</xsl:when>
+ <xsl:when test="$tpath='double'">double</xsl:when>
+ <xsl:when test="$wpath='bold'">bold</xsl:when>
+ <xsl:when test="$textpath='/'">带/</xsl:when>
+ <xsl:when test="$textpath='X'">带X</xsl:when>
+ <xsl:otherwise>none</xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!--comment: if input char is Roman,please add a prefix 'Roman_'-->
+ <xsl:template name="General-Char-Transition">
+ <xsl:param name="input-char"/>
+ <xsl:param name="output-type"/>
+ <xsl:choose>
+ <xsl:when test="$input-char='A' or $input-char='a' or $input-char='1' or $input-char='Roman_I' or $input-char='Roman_i' or $input-char='一' or $input-char='壹' or $input-char='甲' or $input-char='å­'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">1</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">a</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">A</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">I</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">i</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">1</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">一</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">1</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">壹</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">1</xsl:when>
+ <xsl:when test="$output-type='TIAN_GAN_ZH'">甲</xsl:when>
+ <xsl:when test="$output-type='DI_ZI_ZH'">å­</xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='B' or $input-char='b' or $input-char='2' or $input-char='Roman_II' or $input-char='Roman_ii' or $input-char='二' or $input-char='贰' or $input-char='乙' or $input-char='丑'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">2</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">b</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">B</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">II</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">ii</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">ï¼’</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">二</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">2</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">è´°</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">2</xsl:when>
+ <xsl:when test="$output-type='TIAN_GAN_ZH'">ä¹™</xsl:when>
+ <xsl:when test="$output-type='DI_ZI_ZH'">丑</xsl:when>
+ <xsl:otherwise>2</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='C' or $input-char='c' or $input-char='3' or $input-char='Roman_III' or $input-char='Roman_iii' or $input-char='三' or $input-char='å' or $input-char='丙' or $input-char='寅'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">3</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">c</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">C</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">III</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">iii</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">3</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">三</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">3</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">å</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">3</xsl:when>
+ <xsl:when test="$output-type='TIAN_GAN_ZH'">丙</xsl:when>
+ <xsl:when test="$output-type='DI_ZI_ZH'">寅</xsl:when>
+ <xsl:otherwise>3</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='D' or $input-char='d' or $input-char='4' or $input-char='Roman_IV' or $input-char='Roman_iv' or $input-char='å››' or $input-char='肆' or $input-char='ä¸' or $input-char='å¯'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">4</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">d</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">D</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">IV</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">iv</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">ï¼”</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">å››</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">4</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">肆</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">4</xsl:when>
+ <xsl:when test="$output-type='TIAN_GAN_ZH'">ä¸</xsl:when>
+ <xsl:when test="$output-type='DI_ZI_ZH'">å¯</xsl:when>
+ <xsl:otherwise>4</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='E' or $input-char='e' or $input-char='5' or $input-char='Roman_V' or $input-char='Roman_v' or $input-char='五' or $input-char='ä¼' or $input-char='戊' or $input-char='è¾°'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">5</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">e</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">E</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">V</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">v</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">5</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">五</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">5</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">ä¼</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">5</xsl:when>
+ <xsl:when test="$output-type='TIAN_GAN_ZH'">戊</xsl:when>
+ <xsl:when test="$output-type='DI_ZI_ZH'">è¾°</xsl:when>
+ <xsl:otherwise>5</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='F' or $input-char='f' or $input-char='6' or $input-char='Roman_VI' or $input-char='Roman_vi' or $input-char='六' or $input-char='陆' or $input-char='己' or $input-char='巳'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">6</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">f</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">F</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">VI</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">vi</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">ï¼–</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">å…­</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">ï¼–</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">陆</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">ï¼–</xsl:when>
+ <xsl:when test="$output-type='TIAN_GAN_ZH'">å·±</xsl:when>
+ <xsl:when test="$output-type='DI_ZI_ZH'">å·³</xsl:when>
+ <xsl:otherwise>6</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='G' or $input-char='g' or $input-char='7' or $input-char='Roman_VII' or $input-char='Roman_vii' or $input-char='七' or $input-char='柒' or $input-char='庚' or $input-char='åˆ'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">7</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">g</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">G</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">VII</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">vii</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">ï¼—</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">七</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">7</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">柒</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">7</xsl:when>
+ <xsl:when test="$output-type='TIAN_GAN_ZH'">庚</xsl:when>
+ <xsl:when test="$output-type='DI_ZI_ZH'">åˆ</xsl:when>
+ <xsl:otherwise>7</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='H' or $input-char='h' or $input-char='8' or $input-char='Roman_VIII' or $input-char='Roman_viii' or $input-char='å…«' or $input-char='æŒ' or $input-char='è¾›' or $input-char='未'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">8</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">h</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">H</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">VIII</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">viii</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">8</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">å…«</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">8</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">æŒ</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">8</xsl:when>
+ <xsl:when test="$output-type='TIAN_GAN_ZH'">è¾›</xsl:when>
+ <xsl:when test="$output-type='DI_ZI_ZH'">未</xsl:when>
+ <xsl:otherwise>8</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='I' or $input-char='i' or $input-char='9' or $input-char='Roman_IX' or $input-char='Roman_ix' or $input-char='ä¹' or $input-char='玖' or $input-char='壬' or $input-char='申'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">9</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">i</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">I</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">IX</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">ix</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">ï¼™</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">ä¹</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">ï¼™</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">玖</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">ï¼™</xsl:when>
+ <xsl:when test="$output-type='TIAN_GAN_ZH'">壬</xsl:when>
+ <xsl:when test="$output-type='DI_ZI_ZH'">申</xsl:when>
+ <xsl:otherwise>9</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='J' or $input-char='j' or $input-char='10' or $input-char='Roman_X' or $input-char='Roman_x' or $input-char='å' or $input-char='拾' or $input-char='癸' or $input-char='é…‰'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">10</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">j</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">J</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">X</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">x</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">10</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">å</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">10</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">拾</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">10</xsl:when>
+ <xsl:when test="$output-type='TIAN_GAN_ZH'">癸</xsl:when>
+ <xsl:when test="$output-type='DI_ZI_ZH'">é…‰</xsl:when>
+ <xsl:otherwise>10</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='K' or $input-char='k' or $input-char='11' or $input-char='Roman_XI' or $input-char='Roman_xi' or $input-char='å一' or $input-char='拾壹' or $input-char='戌'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">11</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">k</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">K</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XI</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xi</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">11</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">å一</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">11</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">拾壹</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">11</xsl:when>
+ <xsl:when test="$output-type='DI_ZI_ZH'">戌</xsl:when>
+ <xsl:otherwise>11</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='L' or $input-char='l' or $input-char='12' or $input-char='Roman_XII' or $input-char='Roman_xii' or $input-char='å二' or $input-char='拾贰' or $input-char='亥'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">12</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">l</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">L</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XII</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xii</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">12</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">å二</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">12</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">拾贰</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">12</xsl:when>
+ <xsl:when test="$output-type='DI_ZI_ZH'">亥</xsl:when>
+ <xsl:otherwise>12</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='M' or $input-char='m' or $input-char='13' or $input-char='Roman_XIII' or $input-char='Roman_xiii' or $input-char='å三' or $input-char='拾å'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">13</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">m</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">M</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XIII</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xiii</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">13</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">å三</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">13</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">拾å</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">13</xsl:when>
+ <xsl:otherwise>13</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='N' or $input-char='n' or $input-char='14' or $input-char='Roman_XIV' or $input-char='Roman_xiv' or $input-char='åå››' or $input-char='拾肆'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">14</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">n</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">N</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XIV</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xiv</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">14</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">åå››</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">14</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">拾肆</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">14</xsl:when>
+ <xsl:otherwise>14</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='O' or $input-char='o' or $input-char='15' or $input-char='Roman_XV' or $input-char='Roman_xv' or $input-char='å五' or $input-char='拾ä¼'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">15</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">o</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">O</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XV</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xv</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">15</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">å五</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">15</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">拾ä¼</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">15</xsl:when>
+ <xsl:otherwise>15</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='P' or $input-char='p' or $input-char='16' or $input-char='Roman_XVI' or $input-char='Roman_xvi' or $input-char='åå…­' or $input-char='拾陆'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">16</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">p</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">P</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XVI</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xvi</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">16</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">åå…­</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">16</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">拾陆</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">16</xsl:when>
+ <xsl:otherwise>16</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='Q' or $input-char='q' or $input-char='17' or $input-char='Roman_XVII' or $input-char='Roman_xvii' or $input-char='å七' or $input-char='拾柒'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">17</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">q</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">Q</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XVII</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xvii</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">17</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">å七</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">17</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">拾柒</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">17</xsl:when>
+ <xsl:otherwise>17</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='R' or $input-char='r' or $input-char='18' or $input-char='Roman_XVIII' or $input-char='Roman_xviii' or $input-char='åå…«' or $input-char='拾æŒ'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">18</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">r</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">R</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XVIII</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xviii</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">18</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">åå…«</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">18</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">拾æŒ</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">18</xsl:when>
+ <xsl:otherwise>18</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='S' or $input-char='s' or $input-char='19' or $input-char='Roman_XIX' or $input-char='Roman_xix' or $input-char='åä¹' or $input-char='拾玖'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">19</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">s</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">S</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XIX</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xix</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">19</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">åä¹</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">19</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">拾玖</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">19</xsl:when>
+ <xsl:otherwise>19</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='T' or $input-char='t' or $input-char='20' or $input-char='Roman_XX' or $input-char='Roman_xx' or $input-char='二å' or $input-char='贰拾'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">20</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">t</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">T</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XX</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xx</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">20</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">二å</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">20</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">贰拾</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">20</xsl:when>
+ <xsl:otherwise>20</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='U' or $input-char='u' or $input-char='21' or $input-char='Roman_XXI' or $input-char='Roman_xxi' or $input-char='二å一' or $input-char='贰拾壹'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">21</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">u</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">U</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XXI</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xxi</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">21</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">二å一</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">21</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">贰拾壹</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">21</xsl:when>
+ <xsl:otherwise>21</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='V' or $input-char='v' or $input-char='22' or $input-char='Roman_XXII' or $input-char='Roman_xxii' or $input-char='二å二' or $input-char='贰拾贰'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">22</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">v</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">V</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XXII</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xxii</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">22</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">二å二</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">22</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">贰拾贰</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">22</xsl:when>
+ <xsl:otherwise>22</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='W' or $input-char='w' or $input-char='23' or $input-char='Roman_XXIII' or $input-char='Roman_xxiii' or $input-char='二å三' or $input-char='贰拾å'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">23</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">w</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">W</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XXIII</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xxiii</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">23</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">二å三</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">23</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">贰拾å</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">23</xsl:when>
+ <xsl:otherwise>23</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='X' or $input-char='x' or $input-char='24' or $input-char='Roman_XXIV' or $input-char='Roman_xxiv' or $input-char='二åå››' or $input-char='贰拾肆'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">24</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">x</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">X</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XXIV</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xxiv</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">24</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">二åå››</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">24</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">贰拾肆</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">24</xsl:when>
+ <xsl:otherwise>24</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='Y' or $input-char='y' or $input-char='25' or $input-char='Roman_XXV' or $input-char='Roman_xxv' or $input-char='二å五' or $input-char='贰拾ä¼'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">25</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">y</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">Y</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XXV</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xxv</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">25</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">二å五</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">25</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">贰拾ä¼</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">25</xsl:when>
+ <xsl:otherwise>25</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='Z' or $input-char='z' or $input-char='26' or $input-char='Roman_XXVI' or $input-char='Roman_xxvi' or $input-char='二åå…­' or $input-char='贰拾陆'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">26</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">z</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">Z</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XXVI</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xxvi</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">26</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">二åå…­</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">26</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">贰拾陆</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">26</xsl:when>
+ <xsl:otherwise>26</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">1</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">a</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">A</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">I</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">i</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">1</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">一</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">1</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">壹</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">1</xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!--RedOffice comment (Zengjh) end charts-->
+ <!-- 以下模æ¿çš„作用是将网格线的R或者G或者B颜色从å进制转æ¢ä¸º16进制-->
+ <xsl:template name="transform-decimal-to-hexadecimal">
+ <xsl:param name="color-decimal"/>
+ <xsl:variable name="first-number" select="floor($color-decimal div 16)"/>
+ <xsl:variable name="first-char">
+ <xsl:call-template name="decimal-to-hex">
+ <xsl:with-param name="number" select="$first-number"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="second-number" select="$color-decimal - ($first-number * 16)"/>
+ <xsl:variable name="second-char">
+ <xsl:call-template name="decimal-to-hex">
+ <xsl:with-param name="number" select="$second-number"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="concat($first-char,$second-char)"/>
+ </xsl:template>
+ <!-- 以下模æ¿çš„作用为将0到15的整数转æ¢ä¸º16进制数-->
+ <xsl:template name="decimal-to-hex">
+ <xsl:param name="number"/>
+ <xsl:choose>
+ <xsl:when test="$number=0">0</xsl:when>
+ <xsl:when test="$number=1">1</xsl:when>
+ <xsl:when test="$number=2">2</xsl:when>
+ <xsl:when test="$number=3">3</xsl:when>
+ <xsl:when test="$number=4">4</xsl:when>
+ <xsl:when test="$number=5">5</xsl:when>
+ <xsl:when test="$number=6">6</xsl:when>
+ <xsl:when test="$number=7">7</xsl:when>
+ <xsl:when test="$number=8">8</xsl:when>
+ <xsl:when test="$number=9">9</xsl:when>
+ <xsl:when test="$number=10">a</xsl:when>
+ <xsl:when test="$number=11">b</xsl:when>
+ <xsl:when test="$number=12">c</xsl:when>
+ <xsl:when test="$number=13">d</xsl:when>
+ <xsl:when test="$number=14">e</xsl:when>
+ <xsl:when test="$number='15'">f</xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="setDefaultPageWidth">
+ <xsl:choose>
+ <xsl:when test="$uofUnit='inch'">
+ <xsl:value-of select="'7.9'"/>
+ </xsl:when>
+ <xsl:when test="$uofUnit='cm'">
+ <xsl:value-of select="'20.999'"/>
+ </xsl:when>
+ <xsl:when test="$uofUnit='mm'">
+ <xsl:value-of select="'200.99'"/>
+ </xsl:when>
+ <xsl:when test="$uofUnit='pt'">
+ <xsl:value-of select="'7870'"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="'20.990'"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="setDefaultPageHeight">
+ <xsl:choose>
+ <xsl:when test="$uofUnit='inch'">
+ <xsl:value-of select="'10.14'"/>
+ </xsl:when>
+ <xsl:when test="$uofUnit='cm'">
+ <xsl:value-of select="'26.999'"/>
+ </xsl:when>
+ <xsl:when test="$uofUnit='mm'">
+ <xsl:value-of select="'269.99'"/>
+ </xsl:when>
+ <xsl:when test="$uofUnit='pt'">
+ <xsl:value-of select="'1023'"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="'26.990'"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!--ro000179 chenjh-->
+ <xsl:template name="create-condition-format">
+ <xsl:variable name="unique-map-cellstyle" select="/office:document/office:automatic-styles/style:style[style:map and not(style:map/@style:condition=preceding-sibling::style:style/style:map/@style:condition and style:map/@style:apply-style-name=preceding-sibling::style:style/style:map/@style:apply-style-name and style:map/@style:base-cell-address=preceding-sibling::style:style/style:map/@style:base-cell-address)]"/>
+ <xsl:for-each select="$unique-map-cellstyle">
+ <xsl:call-template name="create-cell-condition-format"/>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="create-cell-condition-format">
+ <xsl:element name="表:æ¡ä»¶æ ¼å¼åŒ–">
+ <xsl:attribute name="uof:locID">s0017</xsl:attribute>
+ <xsl:element name="表:区域">
+ <xsl:attribute name="uof:locID">s0007</xsl:attribute>
+ <xsl:variable name="cellstylenamelist">
+ <xsl:call-template name="createcellnamelist">
+ <xsl:with-param name="list">
+ <xsl:value-of select="/office:document/office:automatic-styles/style:style[style:map and (style:map/@style:condition=current()/style:map/@style:condition and style:map/@style:apply-style-name=current()/style:map/@style:apply-style-name and style:map/@style:base-cell-address=current()/style:map/@style:base-cell-address)]"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+ <!-- <xsl:value-of select="concat($cellstylenamelist,'end')"/>-->
+ <xsl:variable name="left-top">
+ <xsl:call-template name="search-left-top">
+ <xsl:with-param name="cellstylenamelist" select="$cellstylenamelist"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <!-- <xsl:value-of select="concat('qqqqqqqq ',$left-top)"/> -->
+ <xsl:variable name="after-tanslated-left-top">
+ <xsl:call-template name="translate-left-top-condition">
+ <xsl:with-param name="left-top" select="$left-top"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="concat($after-tanslated-left-top,':',style:map/@style:base-cell-address)"/>
+ </xsl:element>
+ <xsl:for-each select="style:map">
+ <xsl:element name="表:æ¡ä»¶">
+ <xsl:attribute name="uof:locID">s0019</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型</xsl:attribute>
+ <xsl:variable name="conditiontext" select="@style:condition"/>
+ <xsl:attribute name="表:类型"><xsl:choose><xsl:when test="contains($conditiontext,'cell-content')">cell value</xsl:when><xsl:when test="contains($conditiontext,'is-true-formula')">formula</xsl:when><xsl:otherwise>æ¡ä»¶å­—符串错误!</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:element name="表:æ“作ç ">
+ <xsl:attribute name="uof:locID">s0009</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="starts-with($conditiontext,'is-true-formula')">equal to</xsl:when>
+ <xsl:when test="starts-with($conditiontext,'cell-content()')">
+ <xsl:variable name="operatortext" select="substring-after($conditiontext,'cell-content()')"/>
+ <xsl:choose>
+ <xsl:when test="starts-with($operatortext,'&lt;=')">less than or equal to</xsl:when>
+ <xsl:when test="starts-with($operatortext,'&gt;=')">greater than or equal to</xsl:when>
+ <xsl:when test="starts-with($operatortext,'&lt;')">less than</xsl:when>
+ <xsl:when test="starts-with($operatortext,'&gt;')">greater than</xsl:when>
+ <xsl:when test="starts-with($operatortext,'!=')">not equal to</xsl:when>
+ <xsl:when test="starts-with($operatortext,'=')">equal to</xsl:when>
+ <!-- 注æ„:uof有的å¦å‡ ç§æ“作ç åœ¨oo中没有,他们是contain,not contain,start with,not start with, end with,not end with-->
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="starts-with($conditiontext,'cell-content-is-between')">between</xsl:when>
+ <xsl:when test="starts-with($conditiontext,'cell-content-is-not-between')">not between</xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:element name="表:第一æ“作数">
+ <xsl:attribute name="uof:locID">s0010</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="starts-with($conditiontext,'is-true-formula')">
+ <xsl:value-of select="substring(substring-after($conditiontext,'is-true-formula('),1,string-length($conditiontext)-1-string-length('is-true-formula('))"/>
+ </xsl:when>
+ <xsl:when test="starts-with($conditiontext,'cell-content-is-between')">
+ <xsl:value-of select="substring-before(substring-after($conditiontext,'cell-content-is-between('),',')"/>
+ </xsl:when>
+ <xsl:when test="starts-with($conditiontext,'cell-content-is-not-between')">
+ <xsl:value-of select="substring-before(substring-after($conditiontext,'cell-content-is-not-between('),',')"/>
+ </xsl:when>
+ <xsl:when test="starts-with($conditiontext,'cell-content()')">
+ <xsl:variable name="operatortext" select="substring-after($conditiontext,'cell-content()')"/>
+ <xsl:choose>
+ <xsl:when test="starts-with($operatortext,'&lt;=')">
+ <xsl:value-of select="substring-after($conditiontext,'&lt;=')"/>
+ </xsl:when>
+ <xsl:when test="starts-with($operatortext,'&gt;=')">
+ <xsl:value-of select="substring-after($conditiontext,'&gt;=')"/>
+ </xsl:when>
+ <xsl:when test="starts-with($operatortext,'&lt;')">
+ <xsl:value-of select="substring-after($conditiontext,'&lt;')"/>
+ </xsl:when>
+ <xsl:when test="starts-with($operatortext,'&gt;')">
+ <xsl:value-of select="substring-after($conditiontext,'&gt;')"/>
+ </xsl:when>
+ <xsl:when test="starts-with($operatortext,'!=')">
+ <xsl:value-of select="substring-after($conditiontext,'!=')"/>
+ </xsl:when>
+ <xsl:when test="starts-with($operatortext,'=')">
+ <xsl:value-of select="substring-after($conditiontext,'=')"/>
+ </xsl:when>
+ <!-- 注æ„:uof有的å¦å‡ ç§æ“作ç åœ¨oo中没有,他们是contain,not contain,start with,not start with, end with,not end with-->
+ </xsl:choose>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:if test="starts-with($conditiontext,'cell-content-is-between') or starts-with($conditiontext,'cell-content-is-not-between')">
+ <xsl:element name="表:第二æ“作数">
+ <xsl:attribute name="uof:locID">s0011</xsl:attribute>
+ <xsl:value-of select="substring(substring-after($conditiontext,','),1,string-length(substring-after($conditiontext,','))-1)"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="表:æ ¼å¼">
+ <xsl:variable name="apply-style-name" select="@style:apply-style-name"/>
+ <xsl:attribute name="uof:locID">s0023</xsl:attribute>
+ <xsl:attribute name="uof:attrList">å¼æ ·å¼•ç”¨</xsl:attribute>
+ <xsl:attribute name="表:å¼æ ·å¼•ç”¨"><xsl:value-of select="$apply-style-name"/></xsl:attribute>
+ <!--xsl:attribute name="表:å¼æ ·å¼•ç”¨"><xsl:value-of select="generate-id(//style:style[@style:name=$apply-style-name])"/></xsl:attribute-->
+ </xsl:element>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="createcellnamelist">
+ <xsl:param name="list"/>
+ <xsl:choose>
+ <xsl:when test="$list">
+ <xsl:variable name="first" select="$list[1]"/>
+ <xsl:variable name="stringlist-of-rest">
+ <xsl:call-template name="createcellnamelist">
+ <xsl:with-param name="list" select="$list[position()!=1]"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="concat($first/@style:name,' ',$stringlist-of-rest)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="''"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="search-left-top">
+ <xsl:param name="cellstylenamelist"/>
+ <xsl:choose>
+ <xsl:when test="$cellstylenamelist!=''">
+ <xsl:variable name="first-cellstylename" select="substring-before($cellstylenamelist, ' ')"/>
+ <xsl:variable name="tableslist" select="/office:document/office:body/office:spreadsheet/table:table"/>
+ <xsl:variable name="first-left-top">
+ <xsl:call-template name="search-left-top-with-one-cellstyle">
+ <xsl:with-param name="cellstylename" select="$first-cellstylename"/>
+ <xsl:with-param name="tableslist" select="$tableslist"/>
+ <xsl:with-param name="return" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="rest-left-top">
+ <xsl:call-template name="search-left-top">
+ <xsl:with-param name="cellstylenamelist" select="substring-after($cellstylenamelist,' ')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="final-left-top">
+ <xsl:choose>
+ <xsl:when test="$rest-left-top =''">
+ <xsl:value-of select="$first-left-top"/>
+ </xsl:when>
+ <xsl:when test="$first-left-top =''">
+ <xsl:value-of select="$rest-left-top"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="after-compared-left-top">
+ <xsl:call-template name="compare-two-left-top">
+ <xsl:with-param name="first" select="$first-left-top"/>
+ <xsl:with-param name="second" select="$rest-left-top"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="$after-compared-left-top"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:value-of select="$final-left-top"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="''"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="translate-left-top-condition">
+ <xsl:param name="left-top"/>
+ <xsl:variable name="column-number" select="substring-before(substring-after($left-top,'.'),' ')"/>
+ <xsl:variable name="column-number1">
+ <xsl:value-of select="floor( $column-number div 26 )"/>
+ </xsl:variable>
+ <xsl:variable name="column-number2">
+ <xsl:value-of select="$column-number mod 26"/>
+ </xsl:variable>
+ <xsl:variable name="column-character1">
+ <xsl:call-template name="number-to-character">
+ <xsl:with-param name="number" select="$column-number1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="column-character2">
+ <xsl:call-template name="number-to-character">
+ <xsl:with-param name="number" select="$column-number2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="concat(substring-before($left-top,'.'),'.',$column-character1,$column-character2,substring-after($left-top,' '))"/>
+ </xsl:template>
+ <xsl:template name="search-left-top-with-one-cellstyle">
+ <xsl:param name="cellstylename"/>
+ <xsl:param name="tableslist"/>
+ <xsl:param name="return"/>
+ <xsl:choose>
+ <xsl:when test="$tableslist and $return=''">
+ <xsl:variable name="firsttablerows" select="$tableslist[1]//table:table-row"/>
+ <xsl:variable name="first-left-top">
+ <xsl:call-template name="search-left-top-with-one-cellstyle-inatable">
+ <xsl:with-param name="row-num" select="'1'"/>
+ <xsl:with-param name="firsttablerows" select="$firsttablerows"/>
+ <xsl:with-param name="cellstylename" select="$cellstylename"/>
+ <xsl:with-param name="return" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="rest-left-top">
+ <xsl:call-template name="search-left-top-with-one-cellstyle">
+ <xsl:with-param name="cellstylename" select="$cellstylename"/>
+ <xsl:with-param name="tableslist" select="$tableslist[position()!=1]"/>
+ <xsl:with-param name="return" select="$first-left-top"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$first-left-top!=''">
+ <xsl:value-of select="$first-left-top"/>
+ </xsl:when>
+ <xsl:when test="$rest-left-top!=''">
+ <xsl:value-of select="$rest-left-top"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="''"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$return"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="compare-two-left-top">
+ <xsl:param name="first"/>
+ <xsl:param name="second"/>
+ <xsl:variable name="first-column" select="substring-before(substring-after($first,'.'),' ')"/>
+ <xsl:variable name="first-row" select="substring-after($first,' ')"/>
+ <xsl:variable name="second-column" select="substring-before(substring-after($second,'.'),' ')"/>
+ <xsl:variable name="second-row" select="substring-after($second,' ')"/>
+ <xsl:choose>
+ <xsl:when test="$first-row&lt;$second-row">
+ <xsl:value-of select="$first"/>
+ </xsl:when>
+ <xsl:when test="$first-row=$second-row">
+ <xsl:choose>
+ <xsl:when test="$first-column&lt;=$second-column">
+ <xsl:value-of select="$first"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$second"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$second"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="search-left-top-with-one-cellstyle-inatable">
+ <xsl:param name="row-num"/>
+ <xsl:param name="firsttablerows"/>
+ <xsl:param name="cellstylename"/>
+ <xsl:param name="return"/>
+ <xsl:choose>
+ <xsl:when test="$firsttablerows and $return=''">
+ <xsl:variable name="firstcells" select="$firsttablerows[1]/table:table-cell"/>
+ <xsl:variable name="first-left-top">
+ <xsl:call-template name="search-left-top-with-one-cellstyle-inarow">
+ <xsl:with-param name="row-num" select="$row-num"/>
+ <xsl:with-param name="column-num" select="'1'"/>
+ <xsl:with-param name="firstcells" select="$firstcells"/>
+ <xsl:with-param name="cellstylename" select="$cellstylename"/>
+ <xsl:with-param name="return" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="row-num-p">
+ <xsl:choose>
+ <xsl:when test="$firsttablerows[1]/@table:number-rows-repeated">
+ <xsl:value-of select="$row-num+ $firsttablerows[1]/@table:number-rows-repeated"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$row-num+1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="rest-left-top">
+ <xsl:call-template name="search-left-top-with-one-cellstyle-inatable">
+ <xsl:with-param name="row-num" select="$row-num-p"/>
+ <xsl:with-param name="firsttablerows" select="$firsttablerows[position()!=1]"/>
+ <xsl:with-param name="cellstylename" select="$cellstylename"/>
+ <xsl:with-param name="return" select="$first-left-top"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$first-left-top!=''">
+ <xsl:value-of select="$first-left-top"/>
+ </xsl:when>
+ <xsl:when test="$rest-left-top !=''">
+ <xsl:value-of select="$rest-left-top "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="''"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$return"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="search-left-top-with-one-cellstyle-inarow">
+ <xsl:param name="row-num"/>
+ <xsl:param name="column-num"/>
+ <xsl:param name="firstcells"/>
+ <xsl:param name="cellstylename"/>
+ <xsl:param name="return"/>
+ <xsl:choose>
+ <xsl:when test="$firstcells and $return=''">
+ <xsl:variable name="firstcell" select="$firstcells[1]"/>
+ <xsl:variable name="first-left-top">
+ <xsl:call-template name="search-left-top-with-one-cellstyle-inacell">
+ <xsl:with-param name="row-num" select="$row-num"/>
+ <xsl:with-param name="column-num" select="$column-num"/>
+ <xsl:with-param name="cell" select="$firstcell"/>
+ <xsl:with-param name="cellstylename" select="$cellstylename"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="column-num-p">
+ <xsl:choose>
+ <xsl:when test="$firstcell/@table:number-columns-repeated">
+ <xsl:value-of select="$column-num+ $firstcell/@table:number-columns-repeated"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$column-num+ 1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="rest-left-top">
+ <xsl:call-template name="search-left-top-with-one-cellstyle-inarow">
+ <xsl:with-param name="row-num" select="$row-num"/>
+ <xsl:with-param name="column-num" select="$column-num-p"/>
+ <xsl:with-param name="firstcells" select="$firstcells[position()!=1]"/>
+ <xsl:with-param name="cellstylename" select="$cellstylename"/>
+ <xsl:with-param name="return" select="$first-left-top"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$first-left-top!=''">
+ <xsl:value-of select="$first-left-top"/>
+ </xsl:when>
+ <xsl:when test="$rest-left-top !=''">
+ <xsl:value-of select="$rest-left-top "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="''"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$return"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="search-left-top-with-one-cellstyle-inacell">
+ <xsl:param name="row-num"/>
+ <xsl:param name="column-num"/>
+ <xsl:param name="cell"/>
+ <xsl:param name="cellstylename"/>
+ <xsl:choose>
+ <xsl:when test="$cell/@table:style-name">
+ <xsl:if test="$cell/@table:style-name=$cellstylename">
+ <xsl:value-of select="concat($cell/ancestor::table:table/@table:name,'.',$column-num,' ',$row-num)"/>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="style-is-default">
+ <xsl:call-template name="is-default-or-not">
+ <xsl:with-param name="column-num" select="$column-num"/>
+ <xsl:with-param name="cell" select="$cell"/>
+ <xsl:with-param name="preceding-cellstylename" select="''"/>
+ <xsl:with-param name="temp-num" select="'0'"/>
+ <xsl:with-param name="cellstylename" select="$cellstylename"/>
+ <xsl:with-param name="table-collumns" select="$cell/ancestor::table:table//table:table-column "/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$style-is-default='yes' ">
+ <xsl:value-of select="concat($cell/ancestor::table:table/@table:name,'.',$column-num,' ',$row-num)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="''"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="is-default-or-not">
+ <xsl:param name="column-num"/>
+ <xsl:param name="cell"/>
+ <xsl:param name="preceding-cellstylename"/>
+ <xsl:param name="temp-num"/>
+ <xsl:param name="cellstylename"/>
+ <xsl:param name="table-collumns"/>
+ <xsl:choose>
+ <xsl:when test="$temp-num&lt;$column-num">
+ <xsl:variable name="firstcolumn">
+ <xsl:choose>
+ <xsl:when test="$table-collumns[1]/@table:number-columns-repeated">
+ <xsl:value-of select="$table-collumns[1]/@table:number-columns-repeated"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="'1'"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="preceding-cellstylename-to-param">
+ <xsl:choose>
+ <xsl:when test="$table-collumns[1]/@table:default-cell-style-name">
+ <xsl:value-of select="$table-collumns[1]/@table:default-cell-style-name"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="''"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:call-template name="is-default-or-not">
+ <xsl:with-param name="column-num" select="$column-num"/>
+ <xsl:with-param name="temp-num" select="$temp-num + $firstcolumn"/>
+ <xsl:with-param name="preceding-cellstylename" select="$preceding-cellstylename-to-param"/>
+ <xsl:with-param name="cellstylename" select="$cellstylename"/>
+ <xsl:with-param name="table-collumns" select="$table-collumns[position()!=1]"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="$cellstylename=$preceding-cellstylename">
+ <xsl:value-of select="'yes'"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="'no'"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="table:tracked-changes">
+ <xsl:for-each select="/office:document/office:body/office:spreadsheet/table:tracked-changes">
+ <xsl:if test="table:cell-content-change/table:cell-address">
+ <xsl:variable name="row" select="table:cell-content-change/table:cell-address/@table:row"/>
+ <xsl:variable name="column" select="table:cell-content-change/table:cell-address/@table:column"/>
+ <xsl:element name="字:修订开始">
+ <xsl:attribute name="uof:locID">t0206</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符 类型 修订信æ¯å¼•ç”¨</xsl:attribute>
+ <xsl:attribute name="字:标识符"><xsl:value-of select="concat($row,'-',$column)"/></xsl:attribute>
+ <xsl:attribute name="字:类型">format</xsl:attribute>
+ <xsl:if test="table:cell-content-change/office:change-info and table:cell-content-change/table:previous">
+ <xsl:variable name="creator" select="table:cell-content-change/office:change-info/dc:creator"/>
+ <xsl:variable name="date" select="table:cell-content-change/office:change-info/dc:date"/>
+ <xsl:variable name="text" select="table:cell-content-change/table:previous/table:change-track-table-cell/text:p"/>
+ <xsl:attribute name="å­—:修订信æ¯å¼•ç”¨"><xsl:value-of select="concat($creator,'+',$date,'%',$text)"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:element name="å­—:修订结æŸ">
+ <xsl:attribute name="uof:locID">t0207</xsl:attribute>
+ <xsl:attribute name="uof:attrList">开始标识引用</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template match="office:font-face-decls">
+ <uof:字体集 uof:locID="u0040">
+ <xsl:for-each select="style:font-face">
+ <xsl:element name="uof:字体声明">
+ <xsl:attribute name="uof:attrList">标识符 å称 字体æ—</xsl:attribute>
+ <xsl:attribute name="uof:locID">u0041</xsl:attribute>
+ <xsl:attribute name="uof:标识符"><xsl:value-of select="translate(@style:name,' ','_')"/></xsl:attribute>
+ <xsl:attribute name="uof:å称"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <xsl:attribute name="uof:字体æ—"><xsl:value-of select="@svg:font-family"/></xsl:attribute>
+ <!-- added by glu, for process special fonts e.g. Marlett, -->
+ <!--chengxz 060821 delete uof:字符集,because there is no this attr-->
+ <!--xsl:if test="@style:font-charset= '02'">
+ <xsl:attribute name="uof:字符集">x-symbol</xsl:attribute>
+ </xsl:if-->
+ <!--xsl:if test="@style:font-family-generic">
+ <xsl:choose>
+ <xsl:when test="@style:font-family-generic = 'swiss'">
+ <xsl:attribute name="uof:字体æ—">Swiss</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@style:font-family-generic ='modern'">
+ <xsl:attribute name="uof:字体æ—">Modern</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@style:font-family-generic='roman'">
+ <xsl:attribute name="uof:字体æ—">Roman</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@style:font-family-generic ='script'">
+ <xsl:attribute name="uof:字体æ—">Script</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@style:font-family-generic ='decorative'">
+ <xsl:attribute name="uof:字体æ—">Decorative</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@style:font-family-generic ='system'">
+ <xsl:attribute name="uof:字体æ—">System</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="uof:字体æ—">System</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if-->
+ <!--xsl:if test="@style:font-pitch">
+ <xsl:attribute name="uof:å­—å·">12</xsl:attribute>
+ </xsl:if-->
+ </xsl:element>
+ </xsl:for-each>
+ <xsl:apply-templates select="style:font-face"/>
+ </uof:字体集>
+ </xsl:template>
+ <xsl:key name="styles" match="/*/office:styles/style:style | /*/office:automatic-styles/style:style" use="@style:name"/>
+ <xsl:template match="style:style" mode="styles">
+ <xsl:param name="isAutomatic"/>
+ <xsl:param name="styleName" select="@style:name"/>
+ <xsl:choose>
+ <xsl:when test="@style:family='text'">
+ <xsl:element name="uof:å¥å¼æ ·">
+ <xsl:attribute name="uof:locID">u0043</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符 å称 类型 别å 基å¼æ ·å¼•ç”¨</xsl:attribute>
+ <xsl:attribute name="字:标识符"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <xsl:attribute name="å­—:å称"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <xsl:attribute name="字:类型">auto</xsl:attribute>
+ <xsl:call-template name="字:字体"/>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="@style:family='paragraph'">
+ <xsl:element name="uof:段è½å¼æ ·">
+ <xsl:attribute name="uof:locID">u0044</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符 å称 类型 别å 基å¼æ ·å¼•ç”¨ åŽç»§å¼æ ·å¼•ç”¨</xsl:attribute>
+ <xsl:attribute name="字:标识符"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <xsl:attribute name="字:类型">auto</xsl:attribute>
+ <xsl:attribute name="å­—:基å¼æ ·å¼•ç”¨"><xsl:value-of select="@style:parent-style-name"/></xsl:attribute>
+ <xsl:attribute name="å­—:å称"><xsl:value-of select="@style:name"/></xsl:attribute>
+ </xsl:element>
+ <xsl:if test="style:text-properties">
+ <xsl:element name="uof:å¥å¼æ ·">
+ <xsl:attribute name="uof:locID">u0043</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符 å称 类型 别å 基å¼æ ·å¼•ç”¨</xsl:attribute>
+ <xsl:attribute name="字:标识符"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <xsl:attribute name="å­—:å称"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <xsl:attribute name="字:类型">custum</xsl:attribute>
+ <xsl:attribute name="å­—:基å¼æ ·å¼•ç”¨"><xsl:value-of select="@style:parent-style-name"/></xsl:attribute>
+ <xsl:call-template name="字:字体"/>
+ </xsl:element>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="uof:å•å…ƒæ ¼å¼æ ·">
+ <xsl:attribute name="uof:locID">u0046</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符 å称 类型</xsl:attribute>
+ <xsl:attribute name="表:标识符"><xsl:value-of select="$styleName"/></xsl:attribute>
+ <xsl:attribute name="表:类型"><xsl:choose><xsl:when test="ancestor::office:automatic-styles">auto</xsl:when><xsl:when test="ancestor::office:styles">custom</xsl:when><xsl:otherwise>default</xsl:otherwise></xsl:choose></xsl:attribute>
+ <!--xsl:attribute name="表:基å¼æ ·å¼•ç”¨"><xsl:value-of select="@style:parent-style-name"/></xsl:attribute-->
+ <xsl:choose>
+ <xsl:when test="style:map">
+ <xsl:attribute name="表:å称"><xsl:value-of select="style:map/@style:apply-style-name"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="表:å称"><xsl:value-of select="@style:name"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="not($isAutomatic)">
+ <xsl:choose>
+ <xsl:when test="$styleName='Default'">
+ <xsl:attribute name="表:å称"><xsl:value-of select="'Normal'"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="表:å称"><xsl:value-of select="$styleName"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <!--xsl:if test="@style:parent-style-name">
+ <xsl:attribute name="表:基å¼æ ·å¼•ç”¨"><xsl:value-of select="@style:parent-style-name"/></xsl:attribute>
+ </xsl:if-->
+ <!--chengxz chang the order-->
+ <xsl:variable name="styleProperties" select="key('styles', $styleName)/*"/>
+ <xsl:call-template name="Font">
+ <xsl:with-param name="styleProperties" select="$styleProperties"/>
+ </xsl:call-template>
+ <xsl:call-template name="Alignment">
+ <xsl:with-param name="styleProperties" select="$styleProperties"/>
+ </xsl:call-template>
+ <!--chenjh changed 1103-->
+ <!--xsl:if test="/*/office:automatic-styles/style:style[@style:name=/*/office:body/table:table/table:table-row/table:table-cell/@table:style-name]/style:properties/@fo:border"-->
+ <xsl:if test="@style:data-style-name">
+ <!--RedOffice Comment from Zengjh:UOF0020 2006-04-26-->
+ <xsl:call-template name="NumberFormat">
+ <xsl:with-param name="temp-style" select="@style:data-style-name"/>
+ </xsl:call-template>
+ <!--RedOffice comment (Zengjh) end-->
+ </xsl:if>
+ <xsl:call-template name="Border">
+ <xsl:with-param name="styleProperties" select="$styleProperties"/>
+ <!--xsl:with-param name="styleProperties" select="/*/office:automatic-styles/style:style"/-->
+ </xsl:call-template>
+ <!--/xsl:if-->
+ <!--chenjh end 1103-->
+ <xsl:call-template name="Interior">
+ <xsl:with-param name="styleProperties" select="$styleProperties"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="字:字体">
+ <xsl:element name="字:字体">
+ <xsl:attribute name="uof:locID">t0088</xsl:attribute>
+ <xsl:attribute name="uof:attrList">西文字体引用 中文字体引用 特殊字体引用 西文绘制 å­—å· ç›¸å¯¹å­—å· é¢œè‰²</xsl:attribute>
+ <xsl:if test="style:text-properties/@fo:font-size or style:text-properties/@fo:font-size-asian or style:text-properties/@style:font-size-asian or style:text-properties/@style:font-size">
+ <xsl:attribute name="å­—:å­—å·"><xsl:choose><xsl:when test="style:text-properties/@fo:font-size"><xsl:value-of select="substring-before(style:text-properties/@fo:font-size,'pt')"/></xsl:when><xsl:when test="style:text-properties/@fo:font-size-asian"><xsl:value-of select="substring-before(style:text-properties/@fo:font-size-asian,'pt')"/></xsl:when><xsl:when test="style:text-properties/@style:font-size-asian"><xsl:value-of select="substring-before(style:text-properties/@style:font-size-asian,'pt')"/></xsl:when><xsl:when test="style:text-properties/@style:font-size"><xsl:value-of select="substring-before(style:text-properties/@style:font-size,'pt')"/></xsl:when></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@style:font-name">
+ <xsl:attribute name="字:西文字体引用"><xsl:value-of select="style:text-properties/@style:font-name"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@style:font-name-complex">
+ <xsl:attribute name="字:中文字体引用"><xsl:value-of select="style:text-properties/@style:font-name-complex"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@fo:color">
+ <xsl:attribute name="字:颜色"><xsl:value-of select="style:text-properties/@fo:color"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:if test="style:text-properties/@fo:font-weight or style:text-properties/@style:font-weight-asian">
+ <xsl:element name="字:粗体">
+ <xsl:attribute name="uof:locID">t0089</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test="style:text-properties/@style:font-weight-asian='bold' or style:text-properties/@fo:font-weight='bold'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@fo:font-style or style:text-properties/@style:font-style-asian">
+ <xsl:element name="字:斜体">
+ <xsl:attribute name="uof:locID">t0090</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test="style:text-properties/@fo:font-style='italic' or style:text-properties/@style:font-style-asian='italic'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@style:text-line-through-style and not(style:text-properties/@style:text-line-through-style='none')">
+ <xsl:element name="字:删除线">
+ <xsl:attribute name="uof:locID">t0094</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型</xsl:attribute>
+ <xsl:attribute name="字:类型"><xsl:call-template name="uof:delete线型类型"/></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@style:text-underline-style">
+ <xsl:element name="字:下划线">
+ <xsl:attribute name="字:类型"><xsl:call-template name="uof:线型类型"/></xsl:attribute>
+ <xsl:attribute name="uof:locID">t0095</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型</xsl:attribute>
+ <xsl:if test="style:text-properties/@style:text-underline-color">
+ <xsl:attribute name="字:颜色"><xsl:choose><xsl:when test="style:text-properties/@style:text-underline-color='font-color'">auto</xsl:when><xsl:otherwise><xsl:value-of select="style:text-properties/@style:text-underline-color"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@fo:text-shadow">
+ <xsl:element name="字:阴影">
+ <xsl:attribute name="uof:locID">t0100</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test="style:text-properties/@fo:text-shadow='none'">false</xsl:when><xsl:otherwise>true</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@style:text-position">
+ <xsl:element name="å­—:ä½ç½®">
+ <xsl:attribute name="uof:locID">t0102</xsl:attribute>
+ <xsl:value-of select="style:text-properties/@style:text-position"/>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <!--RedOffice Comment from Zengjh:UOF0020 2006-04-01 Based on Original-->
+ <xsl:template name="NumberFormat">
+ <xsl:param name="temp-style"/>
+ <xsl:for-each select="(/*/office:styles/child::*[@style:name=$temp-style]) | (/*/office:automatic-styles/child::*[@style:name=$temp-style])">
+ <表:æ•°å­—æ ¼å¼ uof:locID="s0021" uof:attrList="分类å称 æ ¼å¼ç ">
+ <xsl:attribute name="表:分类å称"><xsl:choose><xsl:when test="name(.)='number:currency-style'">currency</xsl:when><xsl:when test="name(.)='number:percentage-style'">percentage</xsl:when><xsl:when test="name(.)='number:date-style'">date</xsl:when><xsl:when test="name(.)='number:time-style'">time</xsl:when><xsl:when test="name(.)='number:boolean-style'">custom</xsl:when><xsl:when test="name(.)='number:text-style'">text</xsl:when><xsl:when test="name(.)='number:number-style'"><xsl:choose><xsl:when test="number:fraction">fraction</xsl:when><xsl:when test="number:scientific-number">scientific</xsl:when><xsl:otherwise>number</xsl:otherwise></xsl:choose></xsl:when><xsl:otherwise>general</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="表:æ ¼å¼ç "><xsl:call-template name="element-attribute"/><xsl:for-each select="style:map"><xsl:text>[</xsl:text><xsl:value-of select="@style:condition"/><xsl:text>]</xsl:text><xsl:variable name="apply-style" select="@style:apply-style-name"/><xsl:for-each select="../../child::*[@style:name=$apply-style]/*"><xsl:call-template name="general-number-format"/></xsl:for-each><xsl:text>;</xsl:text></xsl:for-each><xsl:for-each select="*[not(name(.)='style:map')]"><xsl:call-template name="general-number-format"/></xsl:for-each></xsl:attribute>
+ </表:æ•°å­—æ ¼å¼>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="general-number-format">
+ <xsl:choose>
+ <xsl:when test="name(.)='style:text-properties'">
+ <xsl:call-template name="general-color-format"/>
+ </xsl:when>
+ <xsl:when test="name(.)='number:text'">&quot;<xsl:value-of select="text()"/>&quot;</xsl:when>
+ <xsl:when test="name(.)='number:text-content' ">@</xsl:when>
+ <xsl:when test="name(.)='number:boolean'">boolean</xsl:when>
+ <xsl:when test="name(.)='number:currency-symbol'">
+ <xsl:call-template name="general-currency-format"/>
+ </xsl:when>
+ <xsl:when test="name(.)='number:fraction' or name(.)='number:number' or name(.)='number:scientific-number'">
+ <xsl:if test="@number:min-integer-digits and not(@number:grouping)">
+ <xsl:choose>
+ <xsl:when test="@number:min-integer-digits='0'">#</xsl:when>
+ <xsl:when test="@number:min-integer-digits='1'">0</xsl:when>
+ <xsl:when test="@number:min-integer-digits='2'">00</xsl:when>
+ <xsl:when test="@number:min-integer-digits='3'">000</xsl:when>
+ <xsl:when test="@number:min-integer-digits='4'">0000</xsl:when>
+ <xsl:when test="@number:min-integer-digits='5'">00000</xsl:when>
+ <xsl:when test="@number:min-integer-digits='6'">000000</xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="@number:min-integer-digits and @number:grouping">
+ <xsl:choose>
+ <xsl:when test="@number:min-integer-digits='0'">#,###</xsl:when>
+ <xsl:when test="@number:min-integer-digits='1'">#,##0</xsl:when>
+ <xsl:when test="@number:min-integer-digits='2'">#,#00</xsl:when>
+ <xsl:when test="@number:min-integer-digits='3'">#,000</xsl:when>
+ <xsl:when test="@number:min-integer-digits='4'">##0,000</xsl:when>
+ <xsl:when test="@number:min-integer-digits='5'">#00,000</xsl:when>
+ <xsl:when test="@number:min-integer-digits='6'">#,000,000</xsl:when>
+ <xsl:when test="@number:min-integer-digits='7'">##0,000,000</xsl:when>
+ <xsl:when test="@number:min-integer-digits='8'">#,#00,000,000</xsl:when>
+ <xsl:otherwise>#,##0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="@number:decimal-places and not(@number:decimal-replacement)">
+ <xsl:choose>
+ <xsl:when test="@number:decimal-places='0'"/>
+ <xsl:when test="@number:decimal-places='1'">.0</xsl:when>
+ <xsl:when test="@number:decimal-places='2'">.00</xsl:when>
+ <xsl:when test="@number:decimal-places='3'">.000</xsl:when>
+ <xsl:when test="@number:decimal-places='4'">.0000</xsl:when>
+ <xsl:when test="@number:decimal-places='5'">.00000</xsl:when>
+ <xsl:when test="@number:decimal-places='6'">.000000</xsl:when>
+ <xsl:otherwise>.00</xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="@number:decimal-places and @number:decimal-replacement">
+ <xsl:choose>
+ <xsl:when test="@number:decimal-places='0'"/>
+ <xsl:when test="@number:decimal-places='1'">.#</xsl:when>
+ <xsl:when test="@number:decimal-places='2'">.##</xsl:when>
+ <xsl:when test="@number:decimal-places='3'">.###</xsl:when>
+ <xsl:when test="@number:decimal-places='4'">.####</xsl:when>
+ <xsl:when test="@number:decimal-places='5'">.#####</xsl:when>
+ <xsl:when test="@number:decimal-places='6'">.######</xsl:when>
+ <xsl:otherwise>.##</xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="@number:display-factor">
+ <xsl:choose>
+ <xsl:when test="@number:display-factor='1000'">,</xsl:when>
+ <xsl:when test="@number:display-factor='1000000'">,,</xsl:when>
+ <xsl:when test="@number:display-factor='1000000000'">,,,</xsl:when>
+ <xsl:when test="@number:display-factor='1000000000000000'">,,,,</xsl:when>
+ <xsl:when test="@number:display-factor='1000000000000000000'">,,,,,</xsl:when>
+ <xsl:when test="@number:display-factor='1000000000000000000000'">,,,,,</xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="@number:min-exponent-digits">
+ <xsl:choose>
+ <xsl:when test="@number:min-exponent-digits='1'">E+0</xsl:when>
+ <xsl:when test="@number:min-exponent-digits='2'">E+00</xsl:when>
+ <xsl:when test="@number:min-exponent-digits='3'">E+000</xsl:when>
+ <xsl:when test="@number:min-exponent-digits='4'">E+0000</xsl:when>
+ <xsl:when test="@number:min-exponent-digits='5'">E+00000</xsl:when>
+ <xsl:when test="@number:min-exponent-digits='6'">E+000000</xsl:when>
+ <xsl:otherwise>E+00</xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="@number:min-numerator-digits">
+ <xsl:choose>
+ <xsl:when test="@number:min-numerator-digits='1' "> ?</xsl:when>
+ <xsl:when test="@number:min-numerator-digits='2' "> ??</xsl:when>
+ <xsl:when test="@number:min-numerator-digits='3' "> ???</xsl:when>
+ <xsl:when test="@number:min-numerator-digits='4' "> ????</xsl:when>
+ <xsl:when test="@number:min-numerator-digits='5' "> ?????</xsl:when>
+ <xsl:when test="@number:min-numerator-digits='6' "> ??????</xsl:when>
+ <xsl:otherwise> ???</xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="@number:min-denominator-digits">
+ <xsl:choose>
+ <xsl:when test="@number:min-denominator-digits='1' ">/?</xsl:when>
+ <xsl:when test="@number:min-denominator-digits='2' ">/??</xsl:when>
+ <xsl:when test="@number:min-denominator-digits='3' ">/???</xsl:when>
+ <xsl:when test="@number:min-denominator-digits='4' ">/????</xsl:when>
+ <xsl:when test="@number:min-denominator-digits='5' ">/?????</xsl:when>
+ <xsl:when test="@number:min-denominator-digits='6' ">/??????</xsl:when>
+ <xsl:otherwise>/???</xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:when>
+ <xsl:when test="name(.)='number:year'">
+ <xsl:choose>
+ <xsl:when test="@number:style='long'">YYYY</xsl:when>
+ <xsl:otherwise>YY</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="name(.)='number:month'">
+ <xsl:choose>
+ <xsl:when test="@number:style='long' and @number:textual='true'">MMMM</xsl:when>
+ <xsl:when test="not(@number:style='long') and @number:textual='true'">MMM</xsl:when>
+ <xsl:when test="@number:style='long' and not(@number:textual)">MM</xsl:when>
+ <xsl:when test="not(@number:style='long') and not(@number:textual)">M</xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="name(.)='number:day'">
+ <xsl:choose>
+ <xsl:when test="@number:style='long'">DD</xsl:when>
+ <xsl:otherwise>D</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="name(.)='number:day-of-week'">
+ <xsl:choose>
+ <xsl:when test="@number:style='long'">NNNN</xsl:when>
+ <xsl:otherwise>NNN</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="name(.)='number:quarter'">
+ <xsl:choose>
+ <xsl:when test="@number:style='long'">QQ</xsl:when>
+ <xsl:otherwise>Q</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="name(.)='number:hours'">
+ <xsl:choose>
+ <xsl:when test="@number:style='long' and ../@number:truncate-on-overflow='false'">[HH]</xsl:when>
+ <xsl:when test="@number:style='long'">HH</xsl:when>
+ <xsl:otherwise>H</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="name(.)='number:minutes'">
+ <xsl:choose>
+ <xsl:when test="@number:style='long'">MM</xsl:when>
+ <xsl:otherwise>M</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="name(.)='number:seconds'">
+ <xsl:choose>
+ <xsl:when test="@number:style='long' and @number:decimal-places='2'">SS.00</xsl:when>
+ <xsl:when test="@number:style='long'">SS</xsl:when>
+ <xsl:otherwise>S</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="name(.)='number:am-pm'">AM/PM</xsl:when>
+ <xsl:when test="name(.)='number:week-of-year'">
+ <xsl:choose>
+ <xsl:when test="@number:style='long'">WW</xsl:when>
+ <xsl:otherwise>WW</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="general-color-format">
+ <xsl:choose>
+ <xsl:when test="@fo:color='#000000'">[Black]</xsl:when>
+ <xsl:when test="@fo:color='#0000ff'">[Blue]</xsl:when>
+ <xsl:when test="@fo:color='#00ffff'">[Cyan]</xsl:when>
+ <xsl:when test="@fo:color='#00ff00'">[Green]</xsl:when>
+ <xsl:when test="@fo:color='#ff00ff'">[Magenta]</xsl:when>
+ <xsl:when test="@fo:color='#ff0000'">[Red]</xsl:when>
+ <xsl:when test="@fo:color='#ffffff'">[White]</xsl:when>
+ <xsl:when test="@fo:color='#ffff00'">[Yellow]</xsl:when>
+ <xsl:otherwise>[Black]</xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="general-currency-format">
+ <xsl:choose>
+ <xsl:when test="text()='ï¿¥' and @number:language='zh' and @number:country='CN'">[$ï¿¥-804]</xsl:when>
+ <xsl:when test="text()='$' and @number:language='en' and @number:country='US'">[$$-409]</xsl:when>
+ <xsl:when test="text()='$' and @number:language='es' and @number:country='AR'">[$$-2C0A]</xsl:when>
+ <xsl:when test="text()='$' and @number:language='fr' and @number:country='CA'">[$$-C0C]</xsl:when>
+ <xsl:when test="text()='CNY'">[$CNY]</xsl:when>
+ <xsl:when test="text()='AFA'">[$AFA]</xsl:when>
+ <xsl:when test="text()='CCC'">CCC</xsl:when>
+ <xsl:otherwise>ï¿¥</xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="element-attribute">
+ <xsl:if test="@number:transliteration-format='一' and @number:transliteration-style='short'">[NatNum1]</xsl:if>
+ <xsl:if test="@number:transliteration-format='一' and @number:transliteration-style='medium'">[NatNum7]</xsl:if>
+ <xsl:if test="@number:transliteration-format='一' and @number:transliteration-style='long'">[NatNum4]</xsl:if>
+ <xsl:if test="@number:transliteration-format='壹' and @number:transliteration-style='short'">[NatNum2]</xsl:if>
+ <xsl:if test="@number:transliteration-format='壹' and @number:transliteration-style='medium'">[NatNum8]</xsl:if>
+ <xsl:if test="@number:transliteration-format='壹' and @number:transliteration-style='long'">[NatNum5]</xsl:if>
+ <xsl:if test="@number:transliteration-format='1' and @number:transliteration-style='short'">[NatNum3]</xsl:if>
+ <xsl:if test="@number:transliteration-format='1' and @number:transliteration-style='medium'">[NatNum0]</xsl:if>
+ <xsl:if test="@number:transliteration-format='1' and @number:transliteration-style='long'">[NatNum6]</xsl:if>
+ <xsl:if test="@number:transliteration-format='1' and @number:transliteration-style='short'">[NatNum0]</xsl:if>
+ <xsl:if test="@number:transliteration-format='1' and @number:transliteration-style='medium'">[NatNum0]</xsl:if>
+ <xsl:if test="@number:transliteration-format='1' and @number:transliteration-style='long'">[NatNum0]</xsl:if>
+ <xsl:if test="@number:transliteration-language='zh' and @number:transliteration-country='CN'">[$-804]</xsl:if>
+ </xsl:template>
+ <!--RedOffice comment (Zengjh) end-->
+ <!--huangzf0715-->
+ <xsl:template name="Alignment">
+ <xsl:param name="styleProperties"/>
+ <xsl:if test="($styleProperties/@fo:text-align) or ($styleProperties/@style:vertical-align) or ($styleProperties/@fo:wrap-option) or($styleProperties/@fo:margin-left) or ($styleProperties/@style:rotation-angle) or ($styleProperties/@style:direction)">
+ <xsl:element name="表:对é½æ ¼å¼">
+ <xsl:attribute name="uof:locID">s0114</xsl:attribute>
+ <xsl:if test="$styleProperties/@fo:margin-left">
+ <xsl:attribute name="表:缩进"><xsl:variable name="margin"><xsl:call-template name="convert2pt"><xsl:with-param name="value" select="$styleProperties/@fo:margin-left"/><xsl:with-param name="rounding-factor" select="1"/></xsl:call-template></xsl:variable><xsl:value-of select="number($margin) div 10"/></xsl:attribute>
+ </xsl:if>
+ <xsl:element name="表:水平对é½æ–¹å¼">
+ <xsl:attribute name="uof:locID">s0115</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="$styleProperties/@fo:text-align">
+ <xsl:choose>
+ <xsl:when test="$styleProperties/@fo:text-align = 'center'">center</xsl:when>
+ <xsl:when test="$styleProperties/@fo:text-align = 'end'">right</xsl:when>
+ <xsl:when test="$styleProperties/@fo:text-align = 'justify'">justify</xsl:when>
+ <xsl:when test="$styleProperties/@fo:text-align = 'start'">left</xsl:when>
+ <xsl:otherwise>fill</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>general</xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:if test="($styleProperties/@style:vertical-align) or ($styleProperties/@fo:vertical-align)">
+ <xsl:element name="表:垂直对é½æ–¹å¼">
+ <xsl:attribute name="uof:locID">s0116</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="$styleProperties/@fo:vertical-align = 'top'">top</xsl:when>
+ <xsl:when test="$styleProperties/@fo:vertical-align = 'bottom'">bottom</xsl:when>
+ <xsl:when test="$styleProperties/@fo:vertical-align = 'middle'">center</xsl:when>
+ <xsl:when test="$styleProperties/@fo:vertical-align = 'justify'">justify</xsl:when>
+ <xsl:when test="$styleProperties/@fo:vertical-align = 'top'">top</xsl:when>
+ <xsl:otherwise>distributed</xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="表:文字方å‘">
+ <xsl:attribute name="uof:locID">s0118</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="$styleProperties/@style:direction = 'ttb'">vertical</xsl:when>
+ <xsl:otherwise>horizontal</xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:if test="$styleProperties/@style:rotation-angle">
+ <xsl:element name="表:文字旋转角度">
+ <xsl:attribute name="uof:locID">s0119</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="$styleProperties/@style:rotation-angle &gt; 90">
+ <xsl:choose>
+ <xsl:when test="$styleProperties/@style:rotation-angle &gt;= 270">
+ <xsl:value-of select="$styleProperties/@style:rotation-angle - 360"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$styleProperties/@style:rotation-angle - 180"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$styleProperties/@style:rotation-angle &lt; -90">
+ <xsl:choose>
+ <xsl:when test="$styleProperties/@style:rotation-angle &lt;= -270">
+ <xsl:value-of select="$styleProperties/@style:rotation-angle + 360"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$styleProperties/@style:rotation-angle + 180"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$styleProperties/@style:rotation-angle"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="$styleProperties/@fo:wrap-option = 'wrap'">
+ <xsl:element name="表:自动æ¢è¡Œ">
+ <xsl:attribute name="uof:locID">s0120</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="表:值">true</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="$styleProperties/@style:shrink-to-fit">
+ <xsl:element name="表:缩å°å­—体填充">
+ <xsl:attribute name="uof:locID">s0121</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="表:值"><xsl:value-of select="$styleProperties/@style:shrink-to-fit"/></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="Font">
+ <xsl:param name="styleProperties"/>
+ <!--xsl:if test="(style:text-properties/@fo:font-weight) or (style:text-properties/@fo:color) or ($styleProperties/@style:font-name) or ($styleProperties/@fo:font-style) or ($styleProperties/@style:text-outline) or ($styleProperties/@style:text-shadow) or ($styleProperties/@style:font-size) or ($styleProperties/@style:text-crossing-out) or ($styleProperties/@style:text-underline) or ($styleProperties/@style:text-underline-style) or ($styleProperties/@style:text-position)"-->
+ <xsl:if test="not(@style:name='Default')">
+ <xsl:element name="表:字体格å¼">
+ <xsl:attribute name="uof:locID">s0113</xsl:attribute>
+ <xsl:attribute name="uof:attrList">å¼æ ·å¼•ç”¨</xsl:attribute>
+ <xsl:if test="$styleProperties/@fo:font-weight or $styleProperties/@style:font-weight-asian">
+ <xsl:element name="字:粗体">
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test="$styleProperties/@style:font-weight-asian='bold' or $styleProperties/@fo:font-weight='bold'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="uof:locID">t0089</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="$styleProperties/@fo:font-style or $styleProperties/@style:font-style-asian">
+ <xsl:element name="字:斜体">
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test="$styleProperties/@fo:font-style='italic' or $styleProperties/@style:font-style-asian='italic'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="uof:locID">t0090</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="$styleProperties/@style:text-outline = 'true'">
+ <字:空心 uof:locID="t0098" uof:attrList="值" 字:值="true"/>
+ </xsl:if>
+ <xsl:if test="$styleProperties/@style:text-shadow = 'shadow'">
+ <字:阴影 uof:locID="t0100" uof:attrList="值" 字:值="true"/>
+ </xsl:if>
+ <xsl:if test="(style:text-properties/@style:text-underline-style) and ($styleProperties/@style:text-underline-style != 'none')">
+ <xsl:element name="字:下划线">
+ <xsl:attribute name="uof:locID">t0095</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 颜色 字下划线</xsl:attribute>
+ <xsl:attribute name="字:类型"><xsl:call-template name="uof:线型类型"/></xsl:attribute>
+ <xsl:attribute name="字:字下划线">true</xsl:attribute>
+ <xsl:if test="$styleProperties/@style:text-underline-color">
+ <xsl:attribute name="字:颜色"><xsl:choose><xsl:when test="$styleProperties/@style:text-underline-color='font-color'">auto</xsl:when><xsl:otherwise><xsl:value-of select="$styleProperties/@style:text-underline-color"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="$styleProperties/@style:text-line-through-style and not($styleProperties/@style:text-line-through-style='none')">
+ <xsl:element name="字:删除线">
+ <xsl:attribute name="uof:locID">t0094</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型</xsl:attribute>
+ <xsl:attribute name="字:类型"><xsl:call-template name="uof:delete线型类型"/></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="$styleProperties/@style:text-emphasize">
+ <xsl:element name="å­—:ç€é‡å·">
+ <xsl:attribute name="uof:locID">t0096</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 颜色 å­—ç€é‡å·</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="$styleProperties/@style:text-emphasize='none'">
+ <xsl:attribute name="å­—:å­—ç€é‡å·">false</xsl:attribute>
+ <xsl:attribute name="字:类型">none</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="å­—:å­—ç€é‡å·">true</xsl:attribute>
+ <xsl:attribute name="å­—:类型"><xsl:call-template name="uof:ç€é‡å·ç±»åž‹"><xsl:with-param name="te" select="$styleProperties/@style:text-emphasize"/></xsl:call-template></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="$styleProperties/@fo:color">
+ <xsl:attribute name="字:颜色"><xsl:value-of select="$styleProperties/@fo:color"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="$styleProperties/@style:text-position">
+ <xsl:element name="字:上下标">
+ <xsl:choose>
+ <xsl:when test="substring-before($styleProperties/@style:text-position, '% ') &gt; 0">
+ <xsl:attribute name="字:上下标">sup</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="字:上下标">sub</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="字:字体">
+ <xsl:attribute name="uof:locID">t0088</xsl:attribute>
+ <xsl:attribute name="uof:attrList">西文字体引用 中文字体引用 特殊字体引用 西文绘制 å­—å· ç›¸å¯¹å­—å· é¢œè‰²</xsl:attribute>
+ <xsl:if test="$styleProperties/@style:font-name-asian">
+ <xsl:attribute name="字:中文字体引用"><xsl:value-of select="translate($styleProperties/@style:font-name-asian,' ','_')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$styleProperties/@style:font-name or $styleProperties/@fo:font-family">
+ <xsl:choose>
+ <xsl:when test="$styleProperties/@style:font-name">
+ <xsl:attribute name="字:西文字体引用"><xsl:value-of select="translate($styleProperties/@style:font-name,' ','_')"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="字:西文字体引用"><xsl:value-of select="translate($styleProperties/@fo:font-family,' ','_')"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="$styleProperties/@fo:color">
+ <xsl:attribute name="字:颜色"><xsl:value-of select="$styleProperties/@fo:color"/></xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="$styleProperties/@fo:font-size">
+ <xsl:attribute name="å­—:å­—å·"><xsl:call-template name="convert2pt"><xsl:with-param name="value" select="$styleProperties/@fo:font-size"/></xsl:call-template></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$styleProperties/@style:font-size-asian">
+ <xsl:attribute name="å­—:å­—å·"><xsl:call-template name="convert2pt"><xsl:with-param name="value" select="$styleProperties/@style:font-size-asian"/></xsl:call-template></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$styleProperties/@style:font-size-complex">
+ <xsl:attribute name="å­—:å­—å·"><xsl:call-template name="convert2pt"><xsl:with-param name="value" select="$styleProperties/@style:font-size-complex"/></xsl:call-template></xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:if test="style:text-properties/@style:font-relief">
+ <xsl:element name="字:浮雕">
+ <xsl:attribute name="uof:locID">t0099</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型</xsl:attribute>
+ <xsl:attribute name="字:类型"><xsl:choose><xsl:when test="style:text-properties/@style:font-relief='embossed'">emboss</xsl:when><xsl:when test="style:text-properties/@style:font-relief='engraved'">engrave</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@fo:text-transform or style:text-properties/@fo:font-variant">
+ <xsl:element name="字:醒目字体">
+ <xsl:attribute name="uof:locID">t0101</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型</xsl:attribute>
+ <xsl:attribute name="字:类型"><xsl:choose><xsl:when test="style:text-properties/@fo:text-transform='uppercase'">uppercase</xsl:when><xsl:when test="style:text-properties/@fo:text-transform='lowercase'">lowercase</xsl:when><xsl:when test="style:text-properties/@fo:text-transform='capitalize'">capital</xsl:when><xsl:when test="style:text-properties/@fo:font-variant='small-caps'">small-caps</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@fo:text-shadow">
+ <xsl:element name="字:阴影">
+ <xsl:attribute name="uof:locID">t0100</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test="style:text-properties/@fo:text-shadow='none'">false</xsl:when><xsl:otherwise>true</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="Border">
+ <xsl:param name="styleProperties"/>
+ <xsl:if test="style:table-cell-properties/@fo:border and not($styleProperties/@fo:border-top or $styleProperties/@fo:border-left or $styleProperties/@fo:border-bottom or $styleProperties/@fo:border-right)">
+ <xsl:element name="表:边框">
+ <xsl:attribute name="uof:locID">s0022</xsl:attribute>
+ <xsl:variable name="border">
+ <xsl:value-of select="$styleProperties/@fo:border"/>
+ </xsl:variable>
+ <xsl:element name="uof:å·¦">
+ <xsl:attribute name="uof:locID">u0057</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 宽度 è¾¹è· é¢œè‰² 阴影</xsl:attribute>
+ <xsl:attribute name="uof:类型"><xsl:choose><xsl:when test="$border!='none'"><xsl:choose><xsl:when test="substring-before(substring-after($border,' '),' ')='solid'">single</xsl:when><xsl:when test="substring-before(substring-after($border,' '),' ')='double'">double</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="$border!='none'">
+ <xsl:attribute name="uof:宽度"><xsl:value-of select="substring-before(substring-before($border,' '),$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="uof:颜色"><xsl:value-of select="substring-after(substring-after($border,' '),' ')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="contains(substring-before(substring-after($styleProperties/@style:shadow,' '),' '),'-')">
+ <xsl:attribute name="uof:阴影">true</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:element name="uof:上">
+ <xsl:attribute name="uof:locID">u0058</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 宽度 è¾¹è· é¢œè‰² 阴影</xsl:attribute>
+ <xsl:attribute name="uof:类型"><xsl:choose><xsl:when test="$border!='none'"><xsl:choose><xsl:when test="substring-before(substring-after($border,' '),' ')='solid'">single</xsl:when><xsl:when test="substring-before(substring-after($border,' '),' ')='double'">double</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="$border!='none'">
+ <xsl:attribute name="uof:宽度"><xsl:value-of select="substring-before(substring-before($border,' '),$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="uof:颜色"><xsl:value-of select="substring-after(substring-after($border,' '),' ')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="contains(substring-after(substring-after($styleProperties/@style:shadow,' '),' '),'-')">
+ <xsl:attribute name="uof:阴影">true</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:element name="uof:å³">
+ <xsl:attribute name="uof:locID">u0059</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 宽度 è¾¹è· é¢œè‰² 阴影</xsl:attribute>
+ <xsl:attribute name="uof:类型"><xsl:choose><xsl:when test="$border!='none'"><xsl:choose><xsl:when test="substring-before(substring-after($border,' '),' ')='solid'">single</xsl:when><xsl:when test="substring-before(substring-after($border,' '),' ')='double'">double</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="$border!='none'">
+ <xsl:attribute name="uof:宽度"><xsl:value-of select="substring-before(substring-before($border,' '),$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="uof:颜色"><xsl:value-of select="substring-after(substring-after($border,' '),' ')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="substring-before(substring-before(substring-after($styleProperties/@style:shadow,' '),' '),$uofUnit) &gt;0 or contains(substring-before(substring-after($styleProperties/@style:shadow,' '),' '),'+')">
+ <xsl:attribute name="uof:阴影">true</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:element name="uof:下">
+ <xsl:attribute name="uof:locID">u0060</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 宽度 è¾¹è· é¢œè‰² 阴影</xsl:attribute>
+ <xsl:attribute name="uof:类型"><xsl:choose><xsl:when test="$border!='none'"><xsl:choose><xsl:when test="substring-before(substring-after($border,' '),' ')='solid'">single</xsl:when><xsl:when test="substring-before(substring-after($border,' '),' ')='double'">double</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="$border!='none'">
+ <xsl:attribute name="uof:宽度"><xsl:value-of select="substring-before(substring-before($border,' '),$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="uof:颜色"><xsl:value-of select="substring-after(substring-after($border,' '),' ')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="substring-before(substring-after(substring-after($styleProperties/@style:shadow,' '),' '),$uofUnit) &gt;0 or contains(substring-after(substring-after($styleProperties/@style:shadow,' '),' '),'+')">
+ <xsl:attribute name="uof:阴影">true</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:if test="$styleProperties/@style:diagonal-bl-tr">
+ <xsl:element name="uof:对角线1">
+ <xsl:attribute name="uof:locID">u0061</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 宽度 è¾¹è· é¢œè‰² 阴影</xsl:attribute>
+ <xsl:variable name="border-width">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="substring-before($styleProperties/@style:diagonal-bl-tr, ' ')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="border-style" select="substring-before(substring-after($styleProperties/@style:diagonal-bl-tr, ' '), ' ')"/>
+ <xsl:variable name="border-color" select="substring-after(substring-after($styleProperties/@style:diagonal-bl-tr, ' '), ' ')"/>
+ <xsl:attribute name="uof:类型"><xsl:choose><xsl:when test="$border-style = 'none'">none</xsl:when><xsl:when test="$border-style = 'none'">none</xsl:when><xsl:when test="$border-style='solid'">single</xsl:when><xsl:when test="$border-style='double'">double</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="uof:宽度"><xsl:value-of select="$border-width"/></xsl:attribute>
+ <xsl:attribute name="uof:颜色"><xsl:choose><xsl:when test="$border-color"><xsl:value-of select="$border-color"/></xsl:when><xsl:otherwise>Automatic</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <!--end of uo:对角线1-->
+ <!--xsl:if test="$styleProperties/@fo:border and $styleProperties/@style:diagonal-tl-br"-->
+ <xsl:if test="$styleProperties/@style:diagonal-tl-br">
+ <xsl:element name="uof:对角线2">
+ <xsl:attribute name="uof:locID">u0062</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 宽度 è¾¹è· é¢œè‰² 阴影</xsl:attribute>
+ <xsl:variable name="border-width">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="substring-before($styleProperties/@style:diagonal-tl-br, ' ')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="border-style" select="substring-before(substring-after($styleProperties/@style:diagonal-tl-br, ' '), ' ')"/>
+ <xsl:variable name="border-color" select="substring-after(substring-after($styleProperties/@style:diagonal-tl-br, ' '), ' ')"/>
+ <xsl:attribute name="uof:类型"><xsl:choose><xsl:when test="$border-style = 'none'">none</xsl:when><xsl:when test="$border-style = 'none'">none</xsl:when><xsl:when test="$border-style='solid'">single</xsl:when><xsl:when test="$border-style='double'">double</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="uof:宽度"><xsl:value-of select="$border-width"/></xsl:attribute>
+ <xsl:attribute name="uof:颜色"><xsl:choose><xsl:when test="$border-color"><xsl:value-of select="$border-color"/></xsl:when><xsl:otherwise>Automatic</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <!--end of uo:对角线2-->
+ </xsl:element>
+ </xsl:if>
+ <!--end of fo:border-->
+ <xsl:if test="$styleProperties/@fo:border-top or $styleProperties/@fo:border-left or $styleProperties/@fo:border-bottom or $styleProperties/@fo:border-right or $styleProperties/@style:diagonal-tl-br or $styleProperties/@style:diagonal-bl-tr">
+ <xsl:element name="表:边框">
+ <xsl:attribute name="uof:locID">s0022</xsl:attribute>
+ <xsl:if test="$styleProperties/@fo:border-left or $styleProperties/@style:shadow">
+ <xsl:element name="uof:å·¦">
+ <xsl:attribute name="uof:locID">u0057</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 宽度 è¾¹è· é¢œè‰² 阴影</xsl:attribute>
+ <xsl:variable name="borderleft">
+ <xsl:value-of select="$styleProperties/@fo:border-left"/>
+ </xsl:variable>
+ <xsl:attribute name="uof:类型"><xsl:choose><xsl:when test="$borderleft!='none'"><xsl:choose><xsl:when test="substring-before(substring-after($borderleft,' '),' ')='solid'">single</xsl:when><xsl:when test="substring-before(substring-after($borderleft,' '),' ')='double'">double</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="$borderleft!='none'">
+ <xsl:attribute name="uof:宽度"><xsl:value-of select="substring-before(substring-before($borderleft,' '),$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="uof:颜色"><xsl:value-of select="substring-after(substring-after($borderleft,' '),' ')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="contains(substring-before(substring-after($styleProperties/@style:shadow,' '),' '),'-')">
+ <xsl:attribute name="uof:阴影">true</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ <!--end of uof:å·¦-->
+ <xsl:if test="$styleProperties/@fo:border-top or $styleProperties/@style:shadow">
+ <xsl:element name="uof:上">
+ <xsl:attribute name="uof:locID">u0058</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 宽度 è¾¹è· é¢œè‰² 阴影</xsl:attribute>
+ <xsl:variable name="bordertop">
+ <xsl:value-of select="$styleProperties/@fo:border-top"/>
+ </xsl:variable>
+ <xsl:attribute name="uof:类型"><xsl:choose><xsl:when test="$bordertop!='none'"><xsl:choose><xsl:when test="substring-before(substring-after($bordertop,' '),' ')='solid'">single</xsl:when><xsl:when test="substring-before(substring-after($bordertop,' '),' ')='double'">double</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="$bordertop!='none'">
+ <xsl:attribute name="uof:宽度"><xsl:value-of select="substring-before(substring-before($bordertop,' '),$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="uof:颜色"><xsl:value-of select="substring-after(substring-after($bordertop,' '),' ')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="contains(substring-after(substring-after($styleProperties/@style:shadow,' '),' '),'-')">
+ <xsl:attribute name="uof:阴影">true</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ <!--end of uof:上-->
+ <xsl:if test="$styleProperties/@fo:border-right or $styleProperties/@style:shadow">
+ <xsl:element name="uof:å³">
+ <xsl:attribute name="uof:locID">u0059</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 宽度 è¾¹è· é¢œè‰² 阴影</xsl:attribute>
+ <xsl:variable name="borderright">
+ <xsl:value-of select="$styleProperties/@fo:border-right"/>
+ </xsl:variable>
+ <xsl:attribute name="uof:类型"><xsl:choose><xsl:when test="$borderright!='none'"><xsl:choose><xsl:when test="substring-before(substring-after($borderright,' '),' ')='solid'">single</xsl:when><xsl:when test="substring-before(substring-after($borderright,' '),' ')='double'">double</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="$borderright!='none'">
+ <xsl:attribute name="uof:宽度"><xsl:value-of select="substring-before(substring-before($borderright,' '),$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="uof:颜色"><xsl:value-of select="substring-after(substring-after($borderright,' '),' ')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="substring-before(substring-before(substring-after($styleProperties/@style:shadow,' '),' '),$uofUnit)&gt;0 or contains(substring-before(substring-after($styleProperties/@style:shadow,' '),' '),'+')">
+ <xsl:attribute name="uof:阴影">true</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ <!--end of uof:å³-->
+ <xsl:if test="$styleProperties/@fo:border-bottom or $styleProperties/@style:shadow">
+ <xsl:element name="uof:下">
+ <xsl:attribute name="uof:locID">u0060</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 宽度 è¾¹è· é¢œè‰² 阴影</xsl:attribute>
+ <xsl:variable name="borderbottom">
+ <xsl:value-of select="$styleProperties/@fo:border-bottom"/>
+ </xsl:variable>
+ <xsl:attribute name="uof:类型"><xsl:choose><xsl:when test="$borderbottom!='none'"><xsl:choose><xsl:when test="substring-before(substring-after($borderbottom,' '),' ')='solid'">single</xsl:when><xsl:when test="substring-before(substring-after($borderbottom,' '),' ')='double'">double</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="$borderbottom!='none'">
+ <xsl:attribute name="uof:宽度"><xsl:value-of select="substring-before(substring-before($borderbottom,' '),$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="uof:颜色"><xsl:value-of select="substring-after(substring-after($borderbottom,' '),' ')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="substring-before(substring-after(substring-after($styleProperties/@style:shadow,' '),' '),$uofUnit) &gt;0 or contains(substring-after(substring-after($styleProperties/@style:shadow,' '),' '),'+')">
+ <xsl:attribute name="uof:阴影">true</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ <!--end of uof:下-->
+ <xsl:if test="$styleProperties/@style:diagonal-bl-tr">
+ <xsl:element name="uof:对角线1">
+ <xsl:attribute name="uof:locID">u0061</xsl:attribute>
+ <xsl:attribute name="attrList">类型 宽度 è¾¹è· é¢œè‰² 阴影</xsl:attribute>
+ <xsl:variable name="border-width">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="substring-before($styleProperties/@style:diagonal-bl-tr, ' ')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="border-style" select="substring-before(substring-after($styleProperties/@style:diagonal-bl-tr, ' '), ' ')"/>
+ <xsl:variable name="border-color" select="substring-after(substring-after($styleProperties/@style:diagonal-bl-tr, ' '), ' ')"/>
+ <xsl:attribute name="uof:类型"><xsl:choose><xsl:when test="$border-style = 'none'">none</xsl:when><xsl:when test="$border-style='solid'">single</xsl:when><xsl:when test="$border-style='double'">double</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="uof:宽度"><xsl:value-of select="$border-width"/></xsl:attribute>
+ <xsl:attribute name="uof:颜色"><xsl:choose><xsl:when test="$border-color"><xsl:value-of select="$border-color"/></xsl:when><xsl:otherwise>Automatic</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <!--end of uo:对角线1-->
+ <xsl:if test="$styleProperties/@style:diagonal-tl-br">
+ <xsl:element name="uof:对角线2">
+ <xsl:attribute name="uof:locID">u0062</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 宽度 è¾¹è· é¢œè‰² 阴影</xsl:attribute>
+ <xsl:variable name="border-width">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="substring-before($styleProperties/@style:diagonal-tl-br, ' ')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="border-style" select="substring-before(substring-after($styleProperties/@style:diagonal-tl-br, ' '), ' ')"/>
+ <xsl:variable name="border-color" select="substring-after(substring-after($styleProperties/@style:diagonal-tl-br, ' '), ' ')"/>
+ <xsl:attribute name="uof:类型"><xsl:choose><xsl:when test="$border-style = 'none'">none</xsl:when><xsl:when test="$border-style='solid'">single</xsl:when><xsl:when test="$border-style='double'">double</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="uof:宽度"><xsl:value-of select="$border-width"/></xsl:attribute>
+ <xsl:attribute name="uof:颜色"><xsl:choose><xsl:when test="$border-color"><xsl:value-of select="$border-color"/></xsl:when><xsl:otherwise>Automatic</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <!--end of uo:对角线2-->
+ </xsl:element>
+ <!--end of 表:边框-->
+ </xsl:if>
+ <!--chenjh 边框 E -->
+ </xsl:template>
+ <xsl:template name="border-attributes">
+ <xsl:param name="border_properties"/>
+ <xsl:attribute name="attrList">类型 宽度 è¾¹è· é¢œè‰² 阴影</xsl:attribute>
+ <xsl:variable name="border-width">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="substring-before($border_properties, ' ')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="border-style" select="substring-before(substring-after($border_properties, ' '), ' ')"/>
+ <xsl:variable name="border-color" select="substring-after(substring-after($border_properties, ' '), ' ')"/>
+ <xsl:attribute name="uof:类型"><xsl:choose><xsl:when test="$border-style = 'none'">none</xsl:when><xsl:otherwise><xsl:value-of select="$border-style"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="uof:宽度"><xsl:value-of select="$border-width"/></xsl:attribute>
+ <xsl:attribute name="uof:颜色"><xsl:choose><xsl:when test="$border-color"><xsl:value-of select="$border-color"/></xsl:when><xsl:otherwise>Automatic</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:template>
+ <xsl:template name="Interior">
+ <xsl:param name="styleProperties"/>
+ <xsl:if test="style:table-cell-properties/@fo:background-color and not($styleProperties/@fo:background-color = 'transparent')">
+ <xsl:element name="表:填充">
+ <!--chenp modify redo0000047-->
+ <xsl:attribute name="uof:locID">s0058</xsl:attribute>
+ <!--0821 by lil -->
+ <xsl:choose>
+ <xsl:when test="$styleProperties/@fo:background-color">
+ <xsl:element name="图:颜色">
+ <xsl:attribute name="uof:locID">g0034</xsl:attribute>
+ <xsl:value-of select="$styleProperties/@fo:background-color"/>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="表:图案">
+ <xsl:value-of select="' Solid'"/>
+ <xsl:attribute name="xsl:lodID">g0036</xsl:attribute>
+ <xsl:attribute name="attrList">类型 图形引用 å‰æ™¯è‰² 背景色</xsl:attribute>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!--end-->
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <!--chengxz 0621 E-->
+ <!--xsl:template name="image">
+
+ <xsl:element name="图:图形">
+ <xsl:attribute name="图:标识符"><xsl:value-of select="@draw:name"/></xsl:attribute>
+ <xsl:attribute name="uof:locID">g0000</xsl:attribute>
+ <xsl:attribute name="uof:attrList">层次 标识符 组åˆåˆ—表 其他对象</xsl:attribute>
+ <xsl:element name="图:预定义图形">
+ <xsl:attribute name="uof:locID">g0005</xsl:attribute>
+ <xsl:element name="图:类别">图片</xsl:element>
+ <xsl:element name="图:生æˆè½¯ä»¶"><xsl:value-of select="office:binary-data" ></xsl:value-of></xsl:element>
+ <xsl:element name="图:属性">
+ <xsl:element name="图:宽度"><xsl:value-of select="substring-before(@svg:width,'cm')"/></xsl:element>
+ <xsl:element name="图:高度"><xsl:value-of select="substring-before(@svg:height,'cm')"/></xsl:element>
+ </xsl:element>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template-->
+ <!--1新增内容-->
+ <xsl:key match="/office:document/office:automatic-styles/style:style | /office:document/office:styles/style:style" name="graphicset" use="@style:name"/>
+ <xsl:template name="draw">
+ <xsl:param name="nodename1"/>
+ <xsl:choose>
+ <xsl:when test="substring-after($nodename1,':') = 'a'">
+ <xsl:for-each select="child::*">
+ <xsl:call-template name="draw">
+ <xsl:with-param name="nodename">
+ <xsl:value-of select="name()"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:when test="substring-after($nodename1,':') = 'g'">
+ <xsl:call-template name="draw:g"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="creategraphicstyles"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="draw:g">
+ <!--xsl:variable name="picnumber1">
+ <xsl:value-of select="count(preceding::draw:g)"/>
+ </xsl:variable>
+ <图:图形 uof:locID="g0000" uof:attrList="层次 标识符 组åˆåˆ—表 其他对象">
+ <xsl:attribute name="图:标识符"><xsl:value-of select="concat(@draw:style-name,'_',$picnumber1)"/></xsl:attribute>
+ <xsl:attribute name="图:层次"><xsl:value-of select="@draw:z-index"/></xsl:attribute>
+ <xsl:attribute name="图:组åˆåˆ—表"><xsl:for-each select="child::*[1]"><xsl:variable name="node1"><xsl:value-of select="@draw:style-name"/></xsl:variable><xsl:variable name="picnumber2"><xsl:value-of select="count(preceding::*[@draw:style-name=$node1])"/></xsl:variable><xsl:call-template name="zuheliebiao"><xsl:with-param name="allnode"><xsl:value-of select="concat($node1,'_',$picnumber2)"/></xsl:with-param><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:for-each></xsl:attribute>
+ </图:图形>
+ <xsl:for-each select="child::*">
+ <xsl:choose>
+ <xsl:when test="name()='draw:g'">
+ <xsl:call-template name="draw:g"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="creategraphicstyles"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each-->
+ <!--æ ¹æ®æ–°ä¿®æ”¹çš„Schemaåšçš„修改-->
+ <xsl:for-each select="child::*">
+ <xsl:choose>
+ <xsl:when test="name()='draw:g'">
+ <xsl:call-template name="draw:g"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="creategraphicstyles"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ <xsl:call-template name="creategraphicstyles"/>
+ </xsl:template>
+ <xsl:template name="zuheliebiao">
+ <xsl:param name="allnode"/>
+ <xsl:param name="pos"/>
+ <xsl:choose>
+ <xsl:when test="../child::*[$pos]">
+ <xsl:for-each select="../child::*[$pos]">
+ <xsl:variable name="nodepos">
+ <!--add by lvxg -->
+ <xsl:choose>
+ <xsl:when test="./@draw:style-name">
+ <xsl:value-of select="@draw:style-name"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="@draw:id"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!--end-->
+ </xsl:variable>
+ <xsl:variable name="picnumber1">
+ <xsl:value-of select="count(preceding::*[@draw:style-name=$nodepos])"/>
+ </xsl:variable>
+ <xsl:variable name="pic-name1">
+ <xsl:value-of select="concat($nodepos,'_',$picnumber1)"/>
+ </xsl:variable>
+ <xsl:variable name="allnode1">
+ <xsl:value-of select="concat($allnode,',',$pic-name1)"/>
+ </xsl:variable>
+ <xsl:call-template name="zuheliebiao">
+ <xsl:with-param name="allnode" select="$allnode1"/>
+ <xsl:with-param name="pos" select="$pos+1"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$allnode"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="creategraphicstyles">
+ <xsl:variable name="nodename">
+ <xsl:value-of select="name()"/>
+ </xsl:variable>
+ <xsl:variable name="pic-name">
+ <xsl:choose>
+ <xsl:when test="./@draw:style-name">
+ <xsl:value-of select="@draw:style-name"/>
+ </xsl:when>
+ <xsl:when test="./@table:end-cell-address">
+ <xsl:value-of select="@table:end-cell-address"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="./@draw:id"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!--end -->
+ </xsl:variable>
+ <xsl:variable name="pic-num">
+ <xsl:value-of select="count(/descendant::*[@draw:style-name=$pic-name])"/>
+ </xsl:variable>
+ <xsl:variable name="picnumber">
+ <xsl:value-of select="count(preceding::*[@draw:style-name=$pic-name])"/>
+ </xsl:variable>
+ <xsl:call-template name="pic-process">
+ <xsl:with-param name="pic-name" select="$pic-name"/>
+ <xsl:with-param name="nodename" select="$nodename"/>
+ <xsl:with-param name="picnumber" select="$picnumber"/>
+ </xsl:call-template>
+ </xsl:template>
+ <xsl:template name="pic-process">
+ <xsl:param name="pic-name"/>
+ <xsl:param name="nodename"/>
+ <xsl:param name="picnumber"/>
+ <xsl:variable name="aa">
+ <xsl:choose>
+ <xsl:when test="./@draw:style-name">
+ <xsl:value-of select="@draw:style-name"/>
+ </xsl:when>
+ <xsl:when test="./@table:end-cell-address">
+ <xsl:value-of select="@table:end-cell-address"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="./@draw:id"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <图:图形 uof:locID="g0000" uof:attrList="层次 标识符 组åˆåˆ—表 其他对象">
+ <xsl:attribute name="图:标识符"><xsl:value-of select="concat($pic-name,'_',$picnumber)"/></xsl:attribute>
+ <xsl:attribute name="图:层次"><xsl:choose><xsl:when test="name(parent::node())='draw:g'"><xsl:value-of select="position()"/></xsl:when><xsl:when test="@draw:z-index"><xsl:value-of select="@draw:z-index"/></xsl:when></xsl:choose></xsl:attribute>
+ <xsl:if test="$nodename='draw:g'">
+ <xsl:attribute name="图:组åˆåˆ—表"><xsl:for-each select="child::*[1]"><xsl:variable name="node1"><xsl:value-of select="@draw:style-name | @draw:id"/></xsl:variable><xsl:variable name="picnumber2"><xsl:value-of select="count(preceding::*[@draw:style-name=$node1 or @draw:id=$node1])"/></xsl:variable><xsl:call-template name="zuheliebiao"><xsl:with-param name="allnode"><xsl:value-of select="concat($node1,'_',$picnumber2)"/></xsl:with-param><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:for-each></xsl:attribute>
+ </xsl:if>
+ <xsl:if test=".//office:binary-data">
+ <xsl:attribute name="图:其他对象"><xsl:choose><xsl:when test="@draw:name"><xsl:value-of select="@draw:name"/></xsl:when><xsl:otherwise><xsl:value-of select="concat($pic-name,'_b1')"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:variable name="arrow-sign">
+ <xsl:choose>
+ <xsl:when test="key('graphicset',$pic-name)/style:graphic-properties/@draw:marker-start or key('graphicset',$pic-name)/style:graphic-properties/@draw:marker-end">
+ <xsl:value-of select="'1'"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$nodename='draw:line' or $nodename='draw:rect' or $nodename='draw:circle' or $nodename='draw:polygon' or $nodename='draw:polyline' or $nodename='draw:ellipse' or $nodename='draw:path'or $nodename='draw:g'">
+ <图:预定义图形 uof:locID="g0005">
+ <图:类别 uof:locID="g0006">
+ <xsl:choose>
+ <xsl:when test="$nodename='draw:line' and $arrow-sign='1'">62</xsl:when>
+ <xsl:when test="$nodename='draw:rect'">11</xsl:when>
+ <xsl:when test="$nodename='draw:line'">61</xsl:when>
+ <xsl:when test="$nodename='draw:circle'">19</xsl:when>
+ <xsl:when test="$nodename='draw:polygon'">65</xsl:when>
+ <xsl:when test="$nodename='draw:polyline'">66</xsl:when>
+ <xsl:when test="$nodename='draw:ellipse'">19</xsl:when>
+ <xsl:when test="$nodename='draw:path'">64</xsl:when>
+ <xsl:when test="$nodename='draw:g'">4</xsl:when>
+ </xsl:choose>
+ </图:类别>
+ <图:å称 uof:locID="g0007">
+ <xsl:choose>
+ <xsl:when test="$nodename='draw:rect'">Rectangle</xsl:when>
+ <xsl:when test="$nodename='draw:line'">Line</xsl:when>
+ <xsl:when test="$nodename='draw:circle'">Oval</xsl:when>
+ <xsl:when test="$nodename='draw:polygon'">Freeform</xsl:when>
+ <xsl:when test="$nodename='draw:polyline'">Scribble</xsl:when>
+ <xsl:when test="$nodename='draw:ellipse'">Oval</xsl:when>
+ <xsl:when test="$nodename='draw:path'">Curve</xsl:when>
+ <xsl:when test="$nodename='draw:g'">group</xsl:when>
+ </xsl:choose>
+ </图:å称>
+ <图:生æˆè½¯ä»¶ uof:locID="g0008">PNG</图:生æˆè½¯ä»¶>
+ <xsl:if test="./@draw:points or ./@svg:d">
+ <图:关键点åæ ‡ uof:locID="g0009" uofattrList="路径">
+ <!--xsl:call-template name="draw:points">
+ <xsl:with-param name="point" select="./@draw:points"/>
+ </xsl:call-template-->
+ <xsl:attribute name="图:路径"><xsl:choose><xsl:when test="@svg:d"><xsl:value-of select="@svg:d"/></xsl:when><xsl:when test="@draw:points"><xsl:call-template name="draw:points"><xsl:with-param name="point" select="@draw:points"/><xsl:with-param name="lujing"/></xsl:call-template></xsl:when></xsl:choose></xsl:attribute>
+ </图:关键点åæ ‡>
+ </xsl:if>
+ <图:属性 uof:locID="g0011">
+ <xsl:for-each select="(/office:document/office:styles/descendant::*[@style:name=$aa]) | (/office:document/office:automatic-styles/descendant::*[@style:name=$aa]) ">
+ <xsl:call-template name="graphicattr"/>
+ </xsl:for-each>
+ <xsl:choose>
+ <xsl:when test="@svg:x1">
+ <图:宽度 uof:locID="g0023">
+ <xsl:value-of select="substring-before(@svg:x2,$uofUnit) - substring-before(@svg:x1,$uofUnit)"/>
+ </图:宽度>
+ <图:高度 uof:locID="g0024">
+ <xsl:value-of select="substring-before(@svg:y2,$uofUnit) - substring-before(@svg:y1,$uofUnit)"/>
+ </图:高度>
+ </xsl:when>
+ <xsl:when test="@svg:x">
+ <图:宽度 uof:locID="g0023">
+ <xsl:value-of select="substring-before(@svg:width,$uofUnit)"/>
+ </图:宽度>
+ <图:高度 uof:locID="g0024">
+ <xsl:value-of select="substring-before(@svg:height,$uofUnit)"/>
+ </图:高度>
+ </xsl:when>
+ <xsl:when test="@svg:width">
+ <图:宽度 uof:locID="g0023">
+ <xsl:value-of select="substring-before(@svg:width,$uofUnit)"/>
+ </图:宽度>
+ <图:高度 uof:locID="g0024">
+ <xsl:value-of select="substring-before(@svg:height,$uofUnit)"/>
+ </图:高度>
+ </xsl:when>
+ </xsl:choose>
+ <图:旋转角度 uof:locID="g0025">
+ <xsl:choose>
+ <xsl:when test="@draw:transform">
+ <xsl:variable name="rotate-angle">
+ <xsl:value-of select="@draw:transform"/>
+ </xsl:variable>
+ <xsl:variable name="rotate-temp">
+ <xsl:value-of select="substring-before(substring-after($rotate-angle,'rotate ('),')')"/>
+ </xsl:variable>
+ <xsl:value-of select="($rotate-temp * 360) div (2 * 3.14159265)"/>
+ </xsl:when>
+ <xsl:otherwise>0.0</xsl:otherwise>
+ </xsl:choose>
+ </图:旋转角度>
+ <图:X-缩放比例 uof:locID="g0026">1</图:X-缩放比例>
+ <图:Y-缩放比例 uof:locID="g0027">1</图:Y-缩放比例>
+ <图:é”定纵横比 uof:locID="g0028">0</图:é”定纵横比>
+ <图:相对原始比例 uof:locID="g0029">1</图:相对原始比例>
+ <图:打å°å¯¹è±¡ uof:locID="g0032">true</图:打å°å¯¹è±¡>
+ <图:Web文字 uof:locID="g0033"/>
+ <!--0820 by lil -->
+ </图:属性>
+ </图:预定义图形>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="string(.//text:p)">
+ <图:文本内容 uof:locID="g0002" uof:attrList="文本框 å·¦è¾¹è· å³è¾¹è· ä¸Šè¾¹è· ä¸‹è¾¹è· æ°´å¹³å¯¹é½ åž‚ç›´å¯¹é½ æ–‡å­—æŽ’åˆ—æ–¹å‘ è‡ªåŠ¨æ¢è¡Œ 大å°é€‚应文字 å‰ä¸€é“¾æŽ¥ åŽä¸€é“¾æŽ¥">
+ <xsl:if test="$nodename='draw:text-box'">
+ <xsl:attribute name="图:文本框">true</xsl:attribute>
+ <xsl:if test="./@draw:name = /office:document/office:body
+//draw:text-box/@draw:chain-next-name">
+ <xsl:attribute name="图:å‰ä¸€é“¾æŽ¥"><xsl:variable name="drawname"><xsl:value-of select="./@draw:name"/></xsl:variable><xsl:variable name="befor-link-name"><xsl:value-of select="/office:document/office:body
+//draw:text-box[@draw:name=$drawname]/@draw:style-name"/></xsl:variable><xsl:value-of select="concat($befor-link-name,'_',$picnumber)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="./@draw:chain-next-name">
+ <xsl:attribute name="图:åŽä¸€é“¾æŽ¥"><xsl:variable name="next-link"><xsl:value-of select="./@draw:chain-next-name"/></xsl:variable><xsl:variable name="link-name"><xsl:value-of select="/office:document/office:body
+//draw:text-box[@draw:name=$next-link]/@draw:style-name"/></xsl:variable><xsl:value-of select="concat($link-name,'_',$picnumber)"/></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:for-each select="(/office:document/office:styles/descendant::*[@style:name=$pic-name]) | (/office:document/office:automatic-styles/descendant::*[@style:name=$pic-name]) ">
+ <xsl:if test="style:graphic-properties/@fo:padding-left">
+ <xsl:attribute name="图:左边è·"><xsl:value-of select="substring-before(style:graphic-properties/@fo:padding-left,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="图:å³è¾¹è·"><xsl:value-of select="substring-before(style:graphic-properties/@fo:padding-right,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="图:上边è·"><xsl:value-of select="substring-before(style:graphic-properties/@fo:padding-top,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="图:下边è·"><xsl:value-of select="substring-before(style:graphic-properties/@fo:padding-bottom,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="图:文字排列方å‘"><xsl:choose><xsl:when test="style:paragraph-properties/@style:writing-mode"><xsl:choose><xsl:when test="style:paragraph-properties/@style:writing-mode='tb-lr'">vert-l2r</xsl:when><xsl:when test="style:paragraph-properties/@style:writing-mode='tb-rl'">vert-r2l</xsl:when></xsl:choose></xsl:when><xsl:when test="style:graphic-properties/@draw:textarea-horizontal-align='right'">hori-r2l</xsl:when><xsl:otherwise>hori-l2r</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="style:graphic-properties/@fo:wrap-option">
+ <xsl:attribute name="图:自动æ¢è¡Œ">true</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:graphic-properties/@draw:auto-grow-width='true' or style:graphic-properties/@draw:auto-grow-height='true'">
+ <xsl:attribute name="图:大å°é€‚应文字">true</xsl:attribute>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:for-each select="text:p">
+ <xsl:attribute name="字:标识符"><xsl:value-of select="@text:style-name"/></xsl:attribute>
+ <xsl:if test="style:paragraph-properties">
+ <xsl:apply-templates select="style:paragraph-properties"/>
+ </xsl:if>
+ <xsl:call-template name="textp"/>
+ </xsl:for-each>
+ </图:文本内容>
+ </xsl:if>
+ <图:控制点 uof:locID="g0003" uof:attrList="xåæ ‡ yåæ ‡">
+ <xsl:attribute name="图:xåæ ‡"><xsl:value-of select="substring-before(@svg:x,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="图:yåæ ‡"><xsl:value-of select="substring-before(@svg:y,$uofUnit)"/></xsl:attribute>
+ </图:控制点>
+ <!--新增内容-->
+ <xsl:if test="name(..)='draw:g'">
+ <图:组åˆä½ç½® uof:locID="g0041" uof:attrList="xåæ ‡ yåæ ‡">
+ <xsl:attribute name="图:xåæ ‡"><xsl:variable name="minx"><xsl:for-each select="parent::node()"><xsl:call-template name="groupminx"><xsl:with-param name="value" select="number(substring-before(descendant::node()[@svg:x][1]/@svg:x,$uofUnit))"/><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:for-each></xsl:variable><xsl:choose><xsl:when test="name(.)='draw:g'"><xsl:variable name="current-minx"><xsl:call-template name="groupminx"><xsl:with-param name="value" select="number(substring-before(descendant::node()[@svg:x][1]/@svg:x,$uofUnit))"/><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:variable><xsl:value-of select="$current-minx - $minx"/></xsl:when><xsl:otherwise><xsl:variable name="current-x" select="number(substring-before(@svg:x,$uofUnit))"/><xsl:value-of select="$current-x - $minx"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="图:yåæ ‡"><xsl:variable name="miny"><xsl:for-each select="parent::node()"><xsl:call-template name="groupminy"><xsl:with-param name="value" select="number(substring-before(descendant::node()[@svg:y][1]/@svg:y,$uofUnit))"/><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:for-each></xsl:variable><xsl:choose><xsl:when test="name(.)='draw:g'"><xsl:variable name="current-miny"><xsl:call-template name="groupminy"><xsl:with-param name="value" select="number(substring-before(descendant::node()[@svg:y][1]/@svg:y,$uofUnit))"/><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:variable><xsl:value-of select="$current-miny - $miny"/></xsl:when><xsl:otherwise><xsl:variable name="current-y" select="number(substring-before(@svg:y,$uofUnit))"/><xsl:value-of select="$current-y - $miny"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </图:组åˆä½ç½®>
+ </xsl:if>
+ <!--Redoffice comment liliang 06.03.28 end-->
+ </图:图形>
+ <xsl:if test="name()='draw:image'">
+ <uof:其他对象 uof:locID="u0036" uof:attrList="标识符 内嵌 公共类型 ç§æœ‰ç±»åž‹">
+ <xsl:attribute name="uof:标识符"><xsl:value-of select="concat($pic-name,'_',$picnumber)"/></xsl:attribute>
+ <xsl:attribute name="uof:内嵌">true</xsl:attribute>
+ <xsl:attribute name="uof:公共类型">png</xsl:attribute>
+ <xsl:if test="./office:binary-data">
+ <uof:æ•°æ® uof:locID="u0037">
+ <xsl:value-of select="./office:binary-data"/>
+ </uof:æ•°æ®>
+ </xsl:if>
+ <xsl:if test="@xlink:href">
+ <uof:路径 uof:locID="u0038">
+ <xsl:value-of select="@xlink:href"/>
+ </uof:路径>
+ </xsl:if>
+ </uof:其他对象>
+ </xsl:if>
+ <xsl:if test="name()='draw:frame'">
+ <uof:其他对象 uof:locID="u0036" uof:attrList="标识符 内嵌 公共类型 ç§æœ‰ç±»åž‹">
+ <xsl:attribute name="uof:标识符"><xsl:value-of select="concat($pic-name,'_',$picnumber)"/></xsl:attribute>
+ <xsl:attribute name="uof:内嵌">true</xsl:attribute>
+ <xsl:attribute name="uof:公共类型">png</xsl:attribute>
+ <xsl:if test="draw:image/office:binary-data">
+ <uof:æ•°æ® uof:locID="u0037">
+ <xsl:value-of select="draw:image/office:binary-data"/>
+ </uof:æ•°æ®>
+ </xsl:if>
+ <xsl:if test="@xlink:href">
+ <uof:路径 uof:locID="u0038">
+ <xsl:value-of select="@xlink:href"/>
+ </uof:路径>
+ </xsl:if>
+ </uof:其他对象>
+ </xsl:if>
+ <xsl:for-each select="(/office:document/office:styles/descendant::*[@style:name=$pic-name]) | (/office:document/office:automatic-styles/descendant::*[@style:name=$pic-name]) ">
+ <xsl:if test="style:graphic-properties/@draw:fill-image-name">
+ <uof:其他对象 uof:locID="u0036" uof:attrList="标识符 内嵌 公共类型 ç§æœ‰ç±»åž‹">
+ <xsl:attribute name="uof:标识符"><xsl:value-of select="concat($pic-name,'_b1')"/></xsl:attribute>
+ <xsl:attribute name="uof:公共类型">png</xsl:attribute>
+ <xsl:attribute name="uof:内嵌">true</xsl:attribute>
+ <xsl:variable name="fill-name">
+ <xsl:value-of select="style:graphic-properties/@draw:fill-image-name"/>
+ </xsl:variable>
+ <uof:æ•°æ® uof:locID="u0037">
+ <xsl:for-each select="/office:document/office:styles/draw:fill-image[@draw:name=$fill-name]">
+ <xsl:value-of select="office:binary-data"/>
+ </xsl:for-each>
+ </uof:æ•°æ®>
+ <uof:路径 uof:locID="u0038">
+ <xsl:value-of select="@xlink:href"/>
+ </uof:路径>
+ </uof:其他对象>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:template>
+ <!--Redoffice comment liliang 06.03.29-->
+ <!--新增内容-->
+ <xsl:template name="graphicattr">
+ <xsl:variable name="aa" select="@style:name"/>
+ <xsl:if test="not(style:graphic-properties/@draw:fill='none')">
+ <图:填充 uof:locID="g0012">
+ <xsl:choose>
+ <xsl:when test="style:graphic-properties/@draw:fill='gradient'">
+ <xsl:variable name="gradient-name">
+ <xsl:value-of select="style:graphic-properties/@draw:fill-gradient-name"/>
+ </xsl:variable>
+ <xsl:for-each select="/descendant::draw:gradient[@draw:name=$gradient-name]">
+ <图:æ¸å˜ uof:locID="g0037" uof:attrList="起始色 终止色 ç§å­ç±»åž‹ 起始浓度 终止浓度 æ¸å˜æ–¹å‘ 边界 ç§å­Xä½ç½® ç§å­Yä½ç½® 类型">
+ <xsl:attribute name="图:起始色"><xsl:value-of select="@draw:start-color"/></xsl:attribute>
+ <xsl:attribute name="图:终止色"><xsl:value-of select="@draw:end-color"/></xsl:attribute>
+ <xsl:attribute name="图:ç§å­ç±»åž‹"><xsl:choose><xsl:when test="@draw:style='linear' or @draw:style='axial'">linear</xsl:when><xsl:when test="@draw:style='radial'">radar</xsl:when><xsl:when test="@draw:style='ellipsoid'">oval</xsl:when><xsl:when test="@draw:style='square'">square</xsl:when><xsl:when test="@draw:style='rectangular'">rectangle</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:attribute name="图:起始浓度"><xsl:value-of select="substring-before(@draw:start-intensity,'%')"/></xsl:attribute>
+ <xsl:attribute name="图:终止浓度"><xsl:value-of select="substring-before(@draw:end-intensity,'%')"/></xsl:attribute>
+ <xsl:variable name="angle">
+ <xsl:value-of select="@draw:angle div 10"/>
+ </xsl:variable>
+ <xsl:attribute name="图:æ¸å˜æ–¹å‘"><xsl:choose><xsl:when test="0&lt;$angle and $angle&lt;25">0</xsl:when><xsl:when test="25&lt;$angle and $angle&lt;70">45</xsl:when><xsl:when test="70&lt;$angle and $angle&lt;115">90</xsl:when><xsl:when test="115&lt;$angle and $angle&lt;160">135</xsl:when><xsl:when test="160&lt;$angle and $angle&lt;205">180</xsl:when><xsl:when test="205&lt;$angle and $angle&lt;250">225</xsl:when><xsl:when test="250&lt;$angle and $angle&lt;295">270</xsl:when><xsl:when test="295&lt;$angle and $angle&lt;340">315</xsl:when><xsl:when test="340&lt;$angle and $angle&lt;360">360</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:attribute name="图:边界"><xsl:value-of select="substring-before(@draw:border,'%')"/></xsl:attribute>
+ <xsl:if test="@draw:cx">
+ <xsl:attribute name="图:ç§å­Xä½ç½®"><xsl:value-of select="substring-before(@draw:cx,'%')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@draw:cy">
+ <xsl:attribute name="图:ç§å­Yä½ç½®"><xsl:value-of select="substring-before(@draw:cy,'%')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="图:类型">-2</xsl:attribute>
+ </图:æ¸å˜>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:fill-image-name">
+ <图:图片 uof:locID="g0035" uof:attrList="ä½ç½® 图形引用 类型 å称">
+ <xsl:attribute name="图:ä½ç½®"><xsl:choose><xsl:when test="not(style:graphic-properties/@style:repeat)">tile</xsl:when><xsl:otherwise><xsl:choose><xsl:when test="style:graphic-properties/@style:repeat = 'stretch'">stretch</xsl:when><xsl:when test="style:graphic-properties/@style:repeat = 'repeat'">tile</xsl:when><xsl:when test="style:graphic-properties/@style:repeat = 'no-repeat'">center</xsl:when></xsl:choose></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="图:图形引用"><xsl:value-of select="concat($aa,'_b1')"/></xsl:attribute>
+ <xsl:attribute name="图:类型">png</xsl:attribute>
+ <xsl:attribute name="图:å称"><xsl:value-of select="style:graphic-properties/@draw:fill-image-name"/></xsl:attribute>
+ </图:图片>
+ </xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:fill='hatch'">
+ <图:图案 uof:locID="g0036" uof:attrList="类型 图形引用 å‰æ™¯è‰² 背景色">
+ <xsl:if test="/office:document/office:styles/draw:hatch/@draw:name">
+ <xsl:attribute name="图:类型"><xsl:value-of select="/office:document/office:styles/draw:hatch/@draw:name"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="图:图形引用">rogr1</xsl:attribute>
+ <xsl:if test="/office:document/office:styles/draw:hatch/@draw:color">
+ <xsl:attribute name="图:å‰æ™¯è‰²"><xsl:value-of select="/office:document/office:styles/draw:hatch/@draw:color"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="图:背景色"><xsl:choose><xsl:when test="style:graphic-properties/@draw:fill-color"><xsl:value-of select="style:graphic-properties/@draw:fill-color"/></xsl:when><xsl:otherwise>#ffffff</xsl:otherwise></xsl:choose></xsl:attribute>
+ </图:图案>
+ </xsl:when>
+ <xsl:otherwise>
+ <图:颜色 uof:locID="g0034">
+ <xsl:choose>
+ <xsl:when test="style:graphic-properties/@draw:fill-color">
+ <xsl:value-of select="style:graphic-properties/@draw:fill-color"/>
+ </xsl:when>
+ <xsl:otherwise>#99ccff</xsl:otherwise>
+ </xsl:choose>
+ </图:颜色>
+ </xsl:otherwise>
+ </xsl:choose>
+ </图:填充>
+ </xsl:if>
+ <xsl:if test="style:graphic-properties/@svg:stroke-color">
+ <图:线颜色 uof:locID="g0013">
+ <xsl:value-of select="style:graphic-properties/@svg:stroke-color"/>
+ </图:线颜色>
+ </xsl:if>
+ <图:线型 uof:locID="g0014">
+ <xsl:call-template name="表:线型"/>
+ </图:线型>
+ <xsl:if test="style:graphic-properties/@svg:stroke-width">
+ <图:线粗细 uof:locID="g0016">
+ <xsl:value-of select="substring-before(style:graphic-properties/@svg:stroke-width,$uofUnit)"/>
+ </图:线粗细>
+ </xsl:if>
+ <xsl:if test="style:graphic-properties/@draw:marker-start and string-length(style:graphic-properties/@draw:marker-start)&gt;0">
+ <图:å‰ç«¯ç®­å¤´ uof:locID="g0017">
+ <图:å¼æ · uof:locID="g0018">
+ <xsl:choose>
+ <xsl:when test="style:graphic-properties/@draw:marker-start='Arrow'">normal</xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:marker-start='Line Arrow'">open</xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:marker-start='Arrow concave'">stealth</xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:marker-start='Circle'">oval</xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:marker-start='Square 45'">diamond</xsl:when>
+ <xsl:otherwise>normal</xsl:otherwise>
+ </xsl:choose>
+ </图:å¼æ ·>
+ <xsl:if test="style:graphic-properties/@draw:marker-start-width">
+ <图:å¤§å° uof:locID="g0019">
+ <xsl:variable name="width">
+ <xsl:value-of select="substring-before(style:graphic-properties/@draw:marker-start-width,$uofUnit)"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="($width&lt;0.05 and 0&lt;$width) or $width=0.05">1</xsl:when>
+ <xsl:when test="($width&lt;0.10 and 0.05&lt;$width) or $width=0.10">2</xsl:when>
+ <xsl:when test="($width&lt;0.15 and 0.10&lt;$width) or $width=0.15">3</xsl:when>
+ <xsl:when test="($width&lt;0.20 and 0.15&lt;$width) or $width=0.20">4</xsl:when>
+ <xsl:when test="($width&lt;0.25 and 0.20&lt;$width) or $width=0.25">5</xsl:when>
+ <xsl:when test="($width&lt;0.30 and 0.25&lt;$width) or $width=0.30">6</xsl:when>
+ <xsl:when test="($width&lt;0.35 and 0.30&lt;$width) or $width=0.35">7</xsl:when>
+ <xsl:when test="($width&lt;0.40 and 0.35&lt;$width) or $width=0.40">8</xsl:when>
+ <xsl:otherwise>9</xsl:otherwise>
+ </xsl:choose>
+ </图:大å°>
+ </xsl:if>
+ </图:å‰ç«¯ç®­å¤´>
+ </xsl:if>
+ <xsl:if test="style:graphic-properties/@draw:marker-end">
+ <!--0820 by lil -->
+ <图:åŽç«¯ç®­å¤´ uof:locID="g0020">
+ <图:å¼æ · uof:locID="g0021">
+ <xsl:choose>
+ <xsl:when test="style:graphic-properties/@draw:marker-end='Arrow'">normal</xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:marker-end='Line Arrow'">open</xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:marker-end='Arrow concave'">stealth</xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:marker-end='Circle'">oval</xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:marker-end='Square 45'">diamond</xsl:when>
+ <xsl:otherwise>normal</xsl:otherwise>
+ </xsl:choose>
+ </图:å¼æ ·>
+ <xsl:if test="style:graphic-properties/@draw:marker-end-width">
+ <图:å¤§å° uof:locID="g0022">
+ <xsl:variable name="width">
+ <xsl:value-of select="number(substring-before(style:graphic-properties/@draw:marker-end-width,$uofUnit))"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="($width&lt;0.05 and 0&lt;$width) or $width=0.05">1</xsl:when>
+ <xsl:when test="($width&lt;0.10 and 0.05&lt;$width) or $width=0.10">2</xsl:when>
+ <xsl:when test="($width&lt;0.15 and 0.10&lt;$width) or $width=0.15">3</xsl:when>
+ <xsl:when test="($width&lt;0.20 and 0.15&lt;$width) or $width=0.20">4</xsl:when>
+ <xsl:when test="($width&lt;0.25 and 0.20&lt;$width) or $width=0.25">5</xsl:when>
+ <xsl:when test="($width&lt;0.30 and 0.25&lt;$width) or $width=0.30">6</xsl:when>
+ <xsl:when test="($width&lt;0.35 and 0.30&lt;$width) or $width=0.35">7</xsl:when>
+ <xsl:when test="($width&lt;0.40 and 0.35&lt;$width) or $width=0.40">8</xsl:when>
+ <xsl:otherwise>9</xsl:otherwise>
+ </xsl:choose>
+ </图:大å°>
+ </xsl:if>
+ </图:åŽç«¯ç®­å¤´>
+ </xsl:if>
+ <xsl:if test="style:graphic-properties/@draw:opacity">
+ <xsl:variable name="trans" select="style:graphic-properties/@draw:opacity"/>
+ <图:é€æ˜Žåº¦ uof:locID="g0038">
+ <xsl:value-of select="substring($trans,1,2)"/>
+ </图:é€æ˜Žåº¦>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="groupminx">
+ <xsl:param name="value"/>
+ <xsl:param name="pos"/>
+ <xsl:choose>
+ <xsl:when test="descendant::node()[@svg:x][position()=$pos]">
+ <xsl:variable name="othervalue" select="number(substring-before(descendant::node()[@svg:x][position()=$pos]/@svg:x,$uofUnit))"/>
+ <xsl:call-template name="groupminx">
+ <xsl:with-param name="value">
+ <xsl:choose>
+ <xsl:when test="$value&gt;$othervalue">
+ <xsl:value-of select="$othervalue"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="pos" select="$pos+1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!--Redoffice comment liliang end 06.03.29-->
+ <!--Redoffice comment liliang 06.03.29-->
+ <!--新增内容-->
+ <xsl:template name="groupminy">
+ <xsl:param name="value"/>
+ <xsl:param name="pos"/>
+ <xsl:choose>
+ <xsl:when test="descendant::node()[@svg:y][position()=$pos]">
+ <xsl:variable name="othervalue" select="number(substring-before(descendant::node()[@svg:y][position()=$pos]/@svg:y,$uofUnit))"/>
+ <xsl:call-template name="groupminy">
+ <xsl:with-param name="value">
+ <xsl:choose>
+ <xsl:when test="$value&gt;$othervalue">
+ <xsl:value-of select="$othervalue"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="pos" select="$pos+1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="groupmaxx">
+ <xsl:param name="value"/>
+ <xsl:param name="pos"/>
+ <xsl:choose>
+ <xsl:when test="descendant::node()[@svg:x][position()=$pos]">
+ <xsl:variable name="svgx">
+ <xsl:value-of select="number(substring-before(descendant::node()[@svg:x][position()=$pos]/@svg:x,$uofUnit))"/>
+ </xsl:variable>
+ <xsl:variable name="width">
+ <xsl:value-of select="number(substring-before(descendant::node()[@svg:x][position()=$pos]/@svg:width,$uofUnit))"/>
+ </xsl:variable>
+ <xsl:variable name="othervalue" select="$svgx + $width"/>
+ <xsl:call-template name="groupminx">
+ <xsl:with-param name="value">
+ <xsl:choose>
+ <xsl:when test="$value&gt;$othervalue">
+ <xsl:value-of select="$value"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$othervalue"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="pos" select="$pos+1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="groupmaxy">
+ <xsl:param name="value"/>
+ <xsl:param name="pos"/>
+ <xsl:choose>
+ <xsl:when test="descendant::node()[@svg:y][position()=$pos]">
+ <xsl:variable name="svgy">
+ <xsl:value-of select="number(substring-before(descendant::node()[@svg:y][position()=$pos]/@svg:y,$uofUnit))"/>
+ </xsl:variable>
+ <xsl:variable name="height">
+ <xsl:value-of select="number(substring-before(descendant::node()[@svg:y][position()=$pos]/@svg:height,$uofUnit))"/>
+ </xsl:variable>
+ <xsl:variable name="othervalue" select="$svgy + $height"/>
+ <xsl:call-template name="groupminy">
+ <xsl:with-param name="value">
+ <xsl:choose>
+ <xsl:when test="$value&gt;$othervalue">
+ <xsl:value-of select="$value"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$othervalue"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="pos" select="$pos+1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!--Redoffice comment liliang end 06.03.29-->
+ <xsl:template name="draw:points">
+ <xsl:param name="point"/>
+ <xsl:param name="lujing"/>
+ <xsl:choose>
+ <xsl:when test="contains($point,' ' )">
+ <xsl:variable name="first-point" select="substring-before($point,' ')"/>
+ <xsl:variable name="other-point" select="substring-after($point,' ')"/>
+ <xsl:variable name="xzuobiao">
+ <xsl:value-of select="substring-before($first-point,',') div 1000"/>
+ </xsl:variable>
+ <xsl:variable name="yzuobiao">
+ <xsl:value-of select="substring-after($first-point,',') div 1000"/>
+ </xsl:variable>
+ <xsl:call-template name="draw:points">
+ <xsl:with-param name="point" select="$other-point"/>
+ <xsl:with-param name="lujing" select="concat($lujing,$xzuobiao,' ',$yzuobiao,'lineto')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="xzuobiao">
+ <xsl:value-of select="substring-before($point,',') div 1000"/>
+ </xsl:variable>
+ <xsl:variable name="yzuobiao">
+ <xsl:value-of select="substring-after($point,',') div 1000"/>
+ </xsl:variable>
+ <xsl:value-of select="concat($lujing,$xzuobiao,' ',$yzuobiao)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!--Redoffice comment end liliang-->
+ <!--chenjh add 20050624-->
+ <xsl:template name="creat-page-setting">
+ <xsl:param name="master-page"/>
+ <xsl:param name="page-master-style"/>
+ <xsl:element name="表:页é¢è®¾ç½®">
+ <xsl:attribute name="uof:locID">s0029</xsl:attribute>
+ <xsl:attribute name="uof:attrList">å称</xsl:attribute>
+ <xsl:attribute name="表:å称"><xsl:value-of select="$master-page/@style:name"/></xsl:attribute>
+ <xsl:element name="表:纸张">
+ <xsl:attribute name="uof:locID">s0030</xsl:attribute>
+ <xsl:attribute name="uof:attrList">纸型 宽度 高度</xsl:attribute>
+ <xsl:attribute name="uof:纸型"><xsl:variable name="height"><xsl:value-of select="$page-master-style/@fo:page-height"/></xsl:variable><xsl:variable name="width"><xsl:value-of select="$page-master-style/@fo:page-width"/></xsl:variable><xsl:choose><xsl:when test="$width='29.699cm' and $height='42cm'">A3</xsl:when><xsl:when test="not($page-master-style/@fo:page-height) and not($page-master-style/@fo:page-width)">A4</xsl:when><xsl:when test="$width='14.799cm' and $height='20.999cm'">A5</xsl:when><xsl:when test="$width='25cm' and $height='35.299cm'">B4</xsl:when><xsl:when test="$width='17.598cm' and $height='25cm'">B5</xsl:when><xsl:when test="$width='12.499cm' and $height='17.598cm'">B6</xsl:when><xsl:otherwise>使用者</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="uof:宽度"><xsl:choose><xsl:when test="$page-master-style/@fo:page-width"><xsl:value-of select="substring-before($page-master-style/@fo:page-width,$uofUnit)"/></xsl:when><xsl:otherwise><xsl:call-template name="setDefaultPageWidth"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="uof:高度"><xsl:choose><xsl:when test="$page-master-style/@fo:page-height"><xsl:value-of select="substring-before($page-master-style/@fo:page-height,$uofUnit)"/></xsl:when><xsl:otherwise><xsl:call-template name="setDefaultPageHeight"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ <xsl:element name="表:纸张方å‘">
+ <xsl:attribute name="uof:locID">s0031</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="$page-master-style/@style:print-orientation">
+ <xsl:value-of select="$page-master-style/@style:print-orientation"/>
+ </xsl:when>
+ <xsl:otherwise>portrait</xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:element name="表:缩放">
+ <xsl:attribute name="uof:locID">s0032</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="$page-master-style/@style:scale-to">
+ <xsl:value-of select="$page-master-style/@style:scale-to"/>
+ </xsl:when>
+ <xsl:otherwise>100</xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:if test="$page-master-style/@fo:margin-left or $page-master-style/@fo:margin-top or $page-master-style/@fo:margin-right or $page-master-style/@fo:margin-bottom">
+ <xsl:element name="表:页边è·">
+ <xsl:attribute name="uof:locID">s0033</xsl:attribute>
+ <xsl:attribute name="uof:attrList">å·¦ 上 å³ ä¸‹</xsl:attribute>
+ <xsl:attribute name="uof:å·¦"><xsl:value-of select="substring-before($page-master-style/@fo:margin-left,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="uof:上"><xsl:value-of select="substring-before($page-master-style/@fo:margin-top,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="uof:å³"><xsl:value-of select="substring-before($page-master-style/@fo:margin-right,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="uof:下"><xsl:value-of select="substring-before($page-master-style/@fo:margin-bottom,$uofUnit)"/></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:for-each select="$master-page[@style:page-layout-name='pm1']/style:header/child::*">
+ <表:页眉页脚 uof:locID="s0034" uof:attrList="ä½ç½®">
+ <xsl:attribute name="表:ä½ç½®"><xsl:choose><xsl:when test="name()='style:region-left'">headerleft</xsl:when><xsl:when test="name()='style:region-right'">headerright</xsl:when><xsl:otherwise>headercenter</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:call-template name="create-page-header-footer-paragraph">
+ <xsl:with-param name="paragraph-set" select="text:p"/>
+ </xsl:call-template>
+ </表:页眉页脚>
+ </xsl:for-each>
+ <xsl:for-each select="$master-page[@style:page-layout-name='pm1']/style:footer/child::*">
+ <表:页眉页脚 uof:locID="s0034" uof:attrList="ä½ç½®">
+ <xsl:attribute name="表:ä½ç½®"><xsl:choose><xsl:when test="name()='style:region-left'">footerleft</xsl:when><xsl:when test="name()='style:region-right'">footerright</xsl:when><xsl:otherwise>footercenter</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:call-template name="create-page-header-footer-paragraph">
+ <xsl:with-param name="paragraph-set" select="text:p"/>
+ </xsl:call-template>
+ </表:页眉页脚>
+ </xsl:for-each>
+ <xsl:if test="$page-master-style/@style:print-page-order or $page-master-style/@style:print">
+ <表:æ‰“å° uof:locID="s126" uof:attrList="网格线 è¡Œå·åˆ—æ ‡ 按è‰ç¨¿æ–¹å¼ 先列åŽè¡Œ">
+ <xsl:if test="$page-master-style/@style:print-page-order='ltr'">
+ <xsl:attribute name="表:先列åŽè¡Œ">true</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="contains($page-master-style/@style:print,'grid')">
+ <xsl:attribute name="表:网格线">true</xsl:attribute>
+ </xsl:if>
+ </表:打å°>
+ </xsl:if>
+ <xsl:if test="$page-master-style/@style:table-centering='vertical' or $page-master-style/@style:table-centering='both'">
+ <表:åž‚ç›´å¯¹é½ uof:locID="s0128" uof:attrList="对é½æ–¹å¼">
+ <xsl:attribute name="表:对é½æ–¹å¼">center</xsl:attribute>
+ </表:垂直对é½>
+ </xsl:if>
+ <xsl:if test="$page-master-style/@style:table-centering='horizontal' or $page-master-style/@style:table-centering='both'">
+ <表:æ°´å¹³å¯¹é½ uof:locID="s0129" uof:attrList="对é½æ–¹å¼">
+ <xsl:attribute name="表:对é½æ–¹å¼">center</xsl:attribute>
+ </表:水平对é½>
+ </xsl:if>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="create-page-header-footer-paragraph">
+ <xsl:param name="paragraph-set"/>
+ <xsl:choose>
+ <xsl:when test="$paragraph-set">
+ <xsl:element name="å­—:段è½">
+ <xsl:attribute name="uof:locID">t0051</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符</xsl:attribute>
+ <xsl:element name="å­—:å¥">
+ <xsl:attribute name="uof:locID">t0085</xsl:attribute>
+ <xsl:apply-templates select="$paragraph-set//text()">
+ <xsl:with-param name="bText" select="'0'"/>
+ </xsl:apply-templates>
+ </xsl:element>
+ </xsl:element>
+ <xsl:call-template name="create-page-header-footer-paragraph">
+ <xsl:with-param name="paragraph-set" select="$paragraph-set[position()!=1]"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="text:p" name="textp">
+ <xsl:apply-templates select="text()|text:span|text:tab-stop|text:line-break|text:s|text:ruby|text:bookmark|text:bookmark-start|text:bookmark-end|text:a|text:footnote|text:endnote">
+ <xsl:with-param name="bText" select="'1'"/>
+ <xsl:with-param name="sText" select="'1'"/>
+ </xsl:apply-templates>
+ </xsl:template>
+ <xsl:template match="text:a">
+ <xsl:param name="bText"/>
+ <xsl:choose>
+ <xsl:when test="$bText='0'">
+ <xsl:element name="å­—:å¥">
+ <xsl:attribute name="uof:locID">t0085</xsl:attribute>
+ <xsl:element name="字:区域开始">
+ <xsl:attribute name="字:标识符"><xsl:value-of select="generate-id(.)"/></xsl:attribute>
+ <xsl:attribute name="字:类型">hyperlink</xsl:attribute>
+ <xsl:attribute name="uof:locID">t0121</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符 å称 类型</xsl:attribute>
+ </xsl:element>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="字:区域开始">
+ <xsl:attribute name="字:标识符"><xsl:value-of select="generate-id(.)"/></xsl:attribute>
+ <xsl:attribute name="字:类型">hyperlink</xsl:attribute>
+ <xsl:attribute name="uof:locID">t0121</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符 å称 类型</xsl:attribute>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="text()">
+ <xsl:param name="bText"/>
+ <xsl:param name="sText"/>
+ <xsl:if test="normalize-space(.)!=''">
+ <xsl:choose>
+ <xsl:when test="$bText='1' and $sText='1'">
+ <å­—:å¥ uof:locID="t0085">
+ <字:文本串 uof:locID="t0109" uof:attrList="udsPath">
+ <xsl:value-of select="."/>
+ </字:文本串>
+ </å­—:å¥>
+ </xsl:when>
+ <xsl:otherwise>
+ <字:文本串 uof:locID="t0109" uof:attrList="udsPath">
+ <xsl:value-of select="."/>
+ </字:文本串>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="text:span">
+ <xsl:param name="bText"/>
+ <xsl:choose>
+ <xsl:when test="$bText='0'">
+ <å­—:å¥å±žæ€§ uof:locID="t0086" uof:attrList="å¼æ ·å¼•ç”¨">
+ <xsl:attribute name="å­—:å¼æ ·å¼•ç”¨"><xsl:value-of select="@text:style-name"/></xsl:attribute>
+ </å­—:å¥å±žæ€§>
+ <xsl:apply-templates select="text:s|text()|text:line-break|text:tab-stop| text:a | text:footnote|text:endnote|draw:image|office:annotation|draw:frame">
+ <xsl:with-param name="bText" select="1"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
+ <å­—:å¥ uof:locID="t0085">
+ <å­—:å¥å±žæ€§ uof:locID="t0086" uof:attrList="å¼æ ·å¼•ç”¨" å­—:å¼æ ·å¼•ç”¨="{@text:style-name}"/>
+ <xsl:apply-templates select="text:s|text()|text:line-break|text:tab-stop| text:a |text:footnote|text:endnote|draw:image|office:annotation|draw:frame">
+ <xsl:with-param name="bText" select="1"/>
+ </xsl:apply-templates>
+ </å­—:å¥>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="text:s">
+ <xsl:param name="bText"/>
+ <xsl:choose>
+ <xsl:when test="$bText='0'">
+ <xsl:variable name="count">
+ <xsl:choose>
+ <xsl:when test="not(@text:c)">1</xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="@text:c"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <å­—:å¥ uof:locID="t0085">
+ <字:空格符 uof:locID="t0126" uof:attrList="个数" 字:个数="{$count}"/>
+ </å­—:å¥>
+ </xsl:when>
+ <xsl:otherwise>
+ <字:空格符 uof:locID="t0126" uof:attrList="个数" 字:个数="{@text:c}"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="text:line-break">
+ <xsl:param name="bText"/>
+ <xsl:choose>
+ <xsl:when test="$bText='0'">
+ <å­—:å¥ uof:locID="t0085">
+ <å­—:æ¢è¡Œç¬¦ uof:locID="t0124"/>
+ </å­—:å¥>
+ </xsl:when>
+ <xsl:otherwise>
+ <å­—:æ¢è¡Œç¬¦ uof:locID="t0124"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="text:tab-stop">
+ <xsl:param name="bText"/>
+ <xsl:choose>
+ <xsl:when test="$bText='0'">
+ <å­—:å¥ uof:locID="t0085">
+ <字:制表符 uof:locID="t0123"/>
+ </å­—:å¥>
+ </xsl:when>
+ <xsl:otherwise>
+ <字:制表符 uof:locID="t0123"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!--chenjh0713-->
+ <!--chenjh0629E-->
+ <!--chenjh add 20050629 -->
+ <!--字符串转æ¢ä¸ºæ•°å­—-->
+ <xsl:template name="translate-column-char-to-number">
+ <xsl:param name="string"/>
+ <xsl:choose>
+ <xsl:when test="string-length($string)=1">
+ <xsl:call-template name="char-to-number">
+ <xsl:with-param name="char" select="$string"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="tens-place">
+ <xsl:call-template name="char-to-number">
+ <xsl:with-param name="char" select="substring($string,1,1)"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="units-place">
+ <xsl:call-template name="char-to-number">
+ <xsl:with-param name="char" select="substring($string,2,1)"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="$tens-place * 26 + $units-place"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="char-to-number">
+ <xsl:param name="char"/>
+ <xsl:choose>
+ <xsl:when test="$char='A'">1</xsl:when>
+ <xsl:when test="$char='B'">2</xsl:when>
+ <xsl:when test="$char='C'">3</xsl:when>
+ <xsl:when test="$char='D'">4</xsl:when>
+ <xsl:when test="$char='E'">5</xsl:when>
+ <xsl:when test="$char='F'">6</xsl:when>
+ <xsl:when test="$char='G'">7</xsl:when>
+ <xsl:when test="$char='H'">8</xsl:when>
+ <xsl:when test="$char='I'">9</xsl:when>
+ <xsl:when test="$char='J'">10</xsl:when>
+ <xsl:when test="$char='K'">11</xsl:when>
+ <xsl:when test="$char='L'">12</xsl:when>
+ <xsl:when test="$char='M'">13</xsl:when>
+ <xsl:when test="$char='N'">14</xsl:when>
+ <xsl:when test="$char='O'">15</xsl:when>
+ <xsl:when test="$char='P'">16</xsl:when>
+ <xsl:when test="$char='Q'">17</xsl:when>
+ <xsl:when test="$char='R'">18</xsl:when>
+ <xsl:when test="$char='S'">19</xsl:when>
+ <xsl:when test="$char='T'">20</xsl:when>
+ <xsl:when test="$char='U'">21</xsl:when>
+ <xsl:when test="$char='V'">22</xsl:when>
+ <xsl:when test="$char='W'">23</xsl:when>
+ <xsl:when test="$char='X'">24</xsl:when>
+ <xsl:when test="$char='Y'">25</xsl:when>
+ <xsl:when test="$char='Z'">26</xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="create-filter-conditions">
+ <xsl:param name="filter-condition-set"/>
+ <xsl:param name="zone-left-column-num"/>
+ <xsl:if test="$filter-condition-set">
+ <xsl:variable name="first-condition" select="$filter-condition-set"/>
+ <xsl:element name="表:æ¡ä»¶">
+ <xsl:attribute name="uof:locID">s0103</xsl:attribute>
+ <xsl:attribute name="uof:attrList">列å·</xsl:attribute>
+ <xsl:attribute name="表:列å·"><xsl:value-of select="$zone-left-column-num + $first-condition/@table:field-number"/></xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="$first-condition/@table:operator ='top values'">
+ <xsl:element name="表:普通">
+ <xsl:attribute name="uof:locID">s0104</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 值</xsl:attribute>
+ <xsl:attribute name="表:类型">topitem</xsl:attribute>
+ <xsl:attribute name="表:值"><xsl:value-of select="$first-condition/@table:value"/></xsl:attribute>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="表:自定义">
+ <xsl:attribute name="uof:locID">s0105</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型</xsl:attribute>
+ <xsl:element name="表:æ“作æ¡ä»¶">
+ <xsl:attribute name="uof:locID">s0106</xsl:attribute>
+ <!--redoffice comment from lvxg 8.27-->
+ <xsl:if test="$first-condition/@table:operator">
+ <xsl:element name="表:æ“作ç ">
+ <xsl:attribute name="uof:locID">s0009</xsl:attribute>
+ <xsl:variable name="operator-text" select="$first-condition/@table:operator"/>
+ <xsl:choose>
+ <xsl:when test="$operator-text ='&lt;' ">less than</xsl:when>
+ <xsl:when test="$operator-text ='&gt;' ">greater than</xsl:when>
+ <xsl:when test="$operator-text ='=' ">equal to</xsl:when>
+ <xsl:when test="$operator-text ='&gt;=' ">greater than or equal to</xsl:when>
+ <xsl:when test="$operator-text ='&lt;=' ">less than or equal to</xsl:when>
+ <xsl:when test="$operator-text ='!=' ">not equal to</xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="表:值">
+ <xsl:attribute name="uof:locID">s0107</xsl:attribute>
+ <xsl:value-of select="$first-condition/@table:value"/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:call-template name="create-filter-conditions">
+ <xsl:with-param name="filter-condition-set" select="$filter-condition-set[position()!=1]"/>
+ <xsl:with-param name="zone-left-column-num" select="$zone-left-column-num"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="create-view">
+ <xsl:param name="table-name"/>
+ <xsl:param name="view-id"/>
+ <!--xsl:param name="ActiveTable"/-->
+ <xsl:param name="aaa"/>
+ <!--xsl:variable name="aaa" select="/*/office:settings/config:config-item-set/config:config-item-map-indexed"-->
+ <xsl:element name="表:视图">
+ <xsl:attribute name="uof:locID">s0035</xsl:attribute>
+ <xsl:attribute name="uof:attrList">窗å£æ ‡è¯†ç¬¦</xsl:attribute>
+ <xsl:attribute name="表:窗å£æ ‡è¯†ç¬¦"><xsl:value-of select="$view-id"/></xsl:attribute>
+ <xsl:if test="$table-name='ActiveTable'">
+ <xsl:element name="表:选中">
+ <xsl:attribute name="uof:locID">s0036</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="表:值">1</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:variable name="name" select="./@table:name"/>
+ <xsl:choose>
+ <xsl:when test="$aaa/config:config-item-map-named/config:config-item-map-entry[@config:name=$name]/config:config-item[@config:name='HorizontalSplitMode']/text()='2' or $aaa/config:config-item-map-named/config:config-item-map-entry[@config:name=name]/config:config-item[@config:name='VerticalSplitMode']/text()='2' ">
+ <xsl:element name="表:冻结">
+ <xsl:attribute name="uof:locID">s0038</xsl:attribute>
+ <xsl:attribute name="uof:attrList">è¡Œå· åˆ—å·</xsl:attribute>
+ <xsl:attribute name="表:è¡Œå·"><xsl:value-of select="$aaa/config:config-item-map-named/config:config-item-map-entry[@config:name=$name]/config:config-item[@config:name='VerticalSplitPosition']/text()"/></xsl:attribute>
+ <xsl:attribute name="表:列å·"><xsl:value-of select="$aaa/config:config-item-map-named/config:config-item-map-entry[@config:name=$name]/config:config-item[@config:name='HorizontalSplitPosition']/text()"/></xsl:attribute>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="表:拆分">
+ <xsl:attribute name="uof:locID">s0037</xsl:attribute>
+ <xsl:attribute name="uof:attrList">宽度 高度</xsl:attribute>
+ <xsl:attribute name="表:宽度"><xsl:choose><xsl:when test="$aaa/config:config-item-map-named/config:config-item-map-entry[@config:name=$name]/config:config-item[@config:name='HorizontalSplitMode']/text()='1'"><xsl:value-of select="$aaa/config:config-item-map-named/config:config-item-map-entry[@config:name=$name]/config:config-item[@config:name='HorizontalSplitPosition']/text()"/></xsl:when><xsl:otherwise>0</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="表:高度"><xsl:choose><xsl:when test="$aaa/config:config-item-map-named/config:config-item-map-entry[@config:name=$name]/config:config-item[@config:name='VerticalSplitMode']/text()='1'"><xsl:value-of select="$aaa/config:config-item-map-named/config:config-item-map-entry[@config:name=$name]/config:config-item[@config:name='VerticalSplitPosition']/text()"/></xsl:when><xsl:otherwise>0</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:element name="表:最上行">
+ <xsl:attribute name="uof:locID">s0039</xsl:attribute>
+ <!--xsl:value-of select="$aaa/config:config-item-map-named/config:config-item-map-entry[@config:name=$table-name]/config:config-item[@config:name='PositionBottom']/text()+1"/-->
+ <xsl:choose>
+ <xsl:when test="$aaa/config:config-item-map-named/config:config-item-map-entry/config:config-item[@config:name='PositionBottom']/text()">
+ <xsl:value-of select="$aaa/config:config-item-map-named/config:config-item-map-entry/config:config-item[@config:name='PositionBottom']/text()"/>
+ </xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:element name="表:最左列">
+ <xsl:attribute name="uof:locID">s0040</xsl:attribute>
+ <!--xsl:value-of select="$aaa/config:config-item-map-named/config:config-item-map-entry[@config:name=$table-name]/config:config-item[@config:name='PositionLeft']/text() + 1"/-->
+ <xsl:choose>
+ <xsl:when test="$aaa/config:config-item-map-named/config:config-item-map-entry/config:config-item[@config:name='PositionRight']/text()">
+ <xsl:value-of select="$aaa/config:config-item-map-named/config:config-item-map-entry/config:config-item[@config:name='PositionRight']/text()"/>
+ </xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:element name="表:当å‰è§†å›¾">
+ <xsl:attribute name="uof:locID">s0041</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型</xsl:attribute>
+ <xsl:attribute name="表:类型"><xsl:choose><xsl:when test="$aaa/config:config-item[@config:name='ShowPageBreakPreview']/text()='true'">page</xsl:when><xsl:otherwise>normal</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ <xsl:element name="表:网格">
+ <xsl:attribute name="uof:locID">s0043</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="表:值"><xsl:choose><xsl:when test="/*/office:settings/config:config-item-set[@config:name='ooo:view-settings']//config:config-item[@config:name='ShowGrid']/text()='true'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ <xsl:element name="表:网格颜色">
+ <xsl:attribute name="uof:locID">s0044</xsl:attribute>
+ <xsl:variable name="GridColor-text">
+ <xsl:value-of select="//config:config-item-set[@config:name='ooo:view-settings']//config:config-item[@config:name='GridColor']/text()"/>
+ </xsl:variable>
+ <xsl:variable name="R-color" select="floor($GridColor-text div 65536)"/>
+ <xsl:variable name="G-color" select="floor(($GridColor-text - ($R-color * 65536)) div 256)"/>
+ <xsl:variable name="B-color" select="$GridColor-text - ($R-color * 65536)- ($G-color * 256)"/>
+ <xsl:variable name="R-color-in-16">
+ <xsl:call-template name="transform-decimal-to-hexadecimal">
+ <xsl:with-param name="color-decimal" select="$R-color"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="G-color-in-16">
+ <xsl:call-template name="transform-decimal-to-hexadecimal">
+ <xsl:with-param name="color-decimal" select="$G-color"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="B-color-in-16">
+ <xsl:call-template name="transform-decimal-to-hexadecimal">
+ <xsl:with-param name="color-decimal" select="$B-color"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="concat('#',$R-color-in-16,$G-color-in-16,$B-color-in-16)"/>
+ </xsl:element>
+ <xsl:if test="/*/office:settings/config:config-item-set[@config:name='ooo:view-settings']//config:config-item[@config:name='ZoomType']/text()=0">
+ <xsl:element name="表:缩放">
+ <xsl:attribute name="uof:locID">s0045</xsl:attribute>
+ <xsl:value-of select="/*/office:settings/config:config-item-set[@config:name='ooo:view-settings']//config:config-item[@config:name='ZoomValue']/text()"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="/*/office:settings/config:config-item-set[@config:name='ooo:view-settings']//config:config-item[@config:name='ZoomType']/text()=1">
+ <xsl:element name="表:分页缩放">
+ <xsl:attribute name="uof:locID">s0046</xsl:attribute>
+ <xsl:value-of select="/*/office:settings/config:config-item-set[@config:name='ooo:view-settings']//config:config-item[@config:name='ZoomValue']/text()"/>
+ </xsl:element>
+ </xsl:if>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="hexNumber2dec">
+ <xsl:param name="hex-value"/>
+ <xsl:choose>
+ <xsl:when test="$hex-value = 'A' or ($hex-value = 'a')">
+ <xsl:value-of select="10"/>
+ </xsl:when>
+ <xsl:when test="$hex-value = 'B' or ($hex-value = 'b')">
+ <xsl:value-of select="11"/>
+ </xsl:when>
+ <xsl:when test="$hex-value = 'C' or ($hex-value = 'c')">
+ <xsl:value-of select="12"/>
+ </xsl:when>
+ <xsl:when test="$hex-value = 'D' or ($hex-value = 'd')">
+ <xsl:value-of select="13"/>
+ </xsl:when>
+ <xsl:when test="$hex-value = 'E' or ($hex-value = 'e')">
+ <xsl:value-of select="14"/>
+ </xsl:when>
+ <xsl:when test="$hex-value = 'F' or ($hex-value = 'f')">
+ <xsl:value-of select="15"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$hex-value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="hex2decimal">
+ <xsl:param name="hex-number"/>
+ <xsl:param name="index"/>
+ <xsl:param name="str-length"/>
+ <xsl:param name="last-value"/>
+ <xsl:variable name="dec-char">
+ <xsl:call-template name="hexNumber2dec">
+ <xsl:with-param name="hex-value" select="substring($hex-number, $index ,1)"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="current-value" select="$last-value * 16 + $dec-char"/>
+ <xsl:if test="$index &lt; $str-length">
+ <xsl:call-template name="hex2decimal">
+ <xsl:with-param name="hex-number" select="$hex-number"/>
+ <xsl:with-param name="index" select="$index + 1"/>
+ <xsl:with-param name="str-length" select="$str-length"/>
+ <xsl:with-param name="last-value" select="$current-value"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="$index = $str-length">
+ <xsl:value-of select="$current-value"/>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="table:calculation-settings" mode="common">
+ <xsl:if test="@table:precision-as-shown">
+ <xsl:element name="表:精确度以显示值为准">
+ <xsl:attribute name="uof:locID">s0002</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="表:值"><xsl:value-of select="@table:precision-as-shown"/></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="表:日期系统-1904">
+ <xsl:attribute name="uof:locID">s0003</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="表:值"><xsl:choose><xsl:when test="table:null-date/@table:date-value='1904-01-01'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ <xsl:if test="table:iteration/@table:status='enable'">
+ <表:计算设置 uof:locID="s0004" uof:attrList="迭代次数 å差值">
+ <xsl:attribute name="表:迭代次数"><xsl:value-of select="table:iteration/@table:steps"/></xsl:attribute>
+ <xsl:attribute name="表:å差值"><xsl:choose><xsl:when test="table:iteration/@table:maximum-difference"><xsl:value-of select="table:iteration/@table:maximum-difference"/></xsl:when><xsl:otherwise>0.001</xsl:otherwise></xsl:choose><!--xsl:value-of select="table:iteration/@table:maximum-difference"/--></xsl:attribute>
+ </表:计算设置>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="office:automatic-styles" mode="common">
+ <xsl:element name="表:æ¡ä»¶æ ¼å¼åŒ–集">
+ <xsl:attribute name="uof:locID">s0016</xsl:attribute>
+ <xsl:variable name="temp-path" select="../office:automatic-styles/style:style"/>
+ <xsl:for-each select="$temp-path/style:map">
+ <xsl:element name="表:æ¡ä»¶æ ¼å¼åŒ–">
+ <xsl:attribute name="uof:locID">s0017</xsl:attribute>
+ <xsl:element name="表:区域">
+ <xsl:attribute name="uof:locID">s0007</xsl:attribute>
+ <xsl:variable name="range-name">
+ <xsl:value-of select="substring-before(@style:base-cell-address,'.')"/>
+ </xsl:variable>
+ <xsl:variable name="range-value">
+ <xsl:value-of select="substring-after(@style:base-cell-address,'.')"/>
+ </xsl:variable>
+ <xsl:value-of select="concat(&quot;&apos;&quot;,$range-name,&quot;&apos;&quot;,'!$',substring($range-value,1,1),'$',substring($range-value,2))"/>
+ </xsl:element>
+ <xsl:element name="表:æ¡ä»¶">
+ <xsl:attribute name="uof:locID">s0019</xsl:attribute>
+ <xsl:attribute name="表:类型"><xsl:choose><xsl:when test="contains(@style:condition,'formula')"><xsl:value-of select="'formula'"/></xsl:when><xsl:otherwise><xsl:value-of select="'cell value'"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:element name="表:æ“作ç ">
+ <xsl:attribute name="uof:locID">s0009</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="contains(@style:condition,'!=')">
+ <xsl:value-of select="'not equal to'"/>
+ </xsl:when>
+ <xsl:when test="contains(@style:condition,'&lt;=')">
+ <xsl:value-of select="'less than or equal to'"/>
+ </xsl:when>
+ <xsl:when test="contains(@style:condition,'&gt;=')">
+ <xsl:value-of select="'greater than or equal to'"/>
+ </xsl:when>
+ <xsl:when test="contains(@style:condition,'&lt;')">
+ <xsl:value-of select="'less than'"/>
+ </xsl:when>
+ <xsl:when test="contains(@style:condition,'&gt;')">
+ <xsl:value-of select="'greater than'"/>
+ </xsl:when>
+ <xsl:when test="contains(@style:condition,'=')">
+ <xsl:value-of select="'equal to'"/>
+ </xsl:when>
+ <xsl:when test="contains(@style:condition,'not-between')">
+ <xsl:value-of select="'not-between'"/>
+ </xsl:when>
+ <xsl:when test="contains(@style:condition,'between')">
+ <xsl:value-of select="'between'"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:element name="表:第一æ“作数">
+ <xsl:attribute name="uof:locID">s0010</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="contains(@style:condition,'formula')">
+ <xsl:value-of select="substring-after(substring-before(@style:condition,')'),'(')"/>
+ </xsl:when>
+ <xsl:when test="contains(@style:condition,'=')">
+ <xsl:value-of select="substring-after(@style:condition,'=')"/>
+ </xsl:when>
+ <xsl:when test="contains(@style:condition,'&lt;') and not(contains(@style:condition,'&lt;='))">
+ <xsl:value-of select="substring-after(@style:condition,'&lt;')"/>
+ </xsl:when>
+ <xsl:when test="contains(@style:condition,'&gt;') and not(contains(@style:condition,'&gt;='))">
+ <xsl:value-of select="substring-after(@style:condition,'&gt;')"/>
+ </xsl:when>
+ <xsl:when test="contains(@style:condition,'between')">
+ <xsl:value-of select="substring-before(substring-after(@style:condition,'('),',')"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:if test="contains(@style:condition,',')">
+ <xsl:element name="表:第二æ“作数">
+ <xsl:attribute name="uof:locID">s0011</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="contains(@style:condition,'between')">
+ <xsl:value-of select="substring-before(substring-after(@style:condition,','),')')"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="表:æ ¼å¼">
+ <xsl:attribute name="uof:locID">s0023</xsl:attribute>
+ <xsl:attribute name="uof:attrList">å¼æ ·å¼•ç”¨</xsl:attribute>
+ <xsl:attribute name="表:å¼æ ·å¼•ç”¨"><xsl:value-of select="@style:apply-style-name"/></xsl:attribute>
+ </xsl:element>
+ </xsl:element>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="table:content-validations" mode="common">
+ <xsl:element name="表:æ•°æ®æœ‰æ•ˆæ€§é›†">
+ <xsl:attribute name="uof:locID">s0005</xsl:attribute>
+ <xsl:call-template name="create-validation-set">
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="create-validation-set">
+ <xsl:for-each select="//table:content-validation">
+ <xsl:element name="表:æ•°æ®æœ‰æ•ˆæ€§">
+ <xsl:attribute name="uof:locID">s0006</xsl:attribute>
+ <xsl:variable name="conditiontext" select="@table:condition"/>
+ <xsl:variable name="operatortext" select="substring-after($conditiontext,'and ')"/>
+ <xsl:element name="表:区域">
+ <xsl:attribute name="uof:locID">s0007</xsl:attribute>
+ <xsl:variable name="left-top">
+ <xsl:call-template name="search-left-top-validation">
+ <xsl:with-param name="validation-name" select="@table:name"/>
+ <xsl:with-param name="tableslist" select="/*/office:body/office:spreadsheet/table:table"/>
+ <xsl:with-param name="return" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="after-translated-left-top">
+ <xsl:call-template name="translate-left-top">
+ <xsl:with-param name="left-top" select="$left-top"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="base" select="@table:base-cell-address"/>
+ <xsl:variable name="base-column-and-row" select="substring-after($base,'.')"/>
+ <xsl:variable name="dd" select="number(substring($base-column-and-row,2,1))"/>
+ <xsl:variable name="base-column">
+ <xsl:choose>
+ <xsl:when test="contains($dd,'NaN') ">
+ <xsl:value-of select="substring($base-column-and-row,1,2)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring($base-column-and-row,1,1)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="base-row" select="substring-after($base,$base-column)"/>
+ <xsl:variable name="after-translated-base-left-top">
+ <xsl:value-of select="concat('$',substring-before($base,'.'),'.$',$base-column,'$',$base-row)"/>
+ </xsl:variable>
+ <xsl:value-of select="concat('$',$after-translated-left-top,':',$after-translated-base-left-top)"/>
+ </xsl:element>
+ <xsl:element name="表:校验类型">
+ <xsl:attribute name="uof:locID">s0008</xsl:attribute>
+ <xsl:variable name="listtest">cell-content-is-in-list("</xsl:variable>
+ <xsl:choose>
+ <xsl:when test="contains($conditiontext,'cell-content-is-whole-number()')">whole number</xsl:when>
+ <xsl:when test="contains($conditiontext,'cell-content-is-decimal-number()')">decimal</xsl:when>
+ <xsl:when test="contains($conditiontext,'cell-content-is-date()')">date</xsl:when>
+ <xsl:when test="contains($conditiontext,'cell-content-is-time()')">time</xsl:when>
+ <xsl:when test="contains($conditiontext,'cell-content-is-in-list') and not(contains($conditiontext,$listtest))">cell range</xsl:when>
+ <xsl:when test="contains($conditiontext,'cell-content-is-in-list') and contains($conditiontext,$listtest)">list</xsl:when>
+ <xsl:when test="contains($conditiontext,'cell-content-text-length')">text length</xsl:when>
+ <xsl:otherwise>any value</xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:element name="表:æ“作ç ">
+ <xsl:attribute name="uof:locID">s0009</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="starts-with($operatortext,'cell-content()&lt;=')">less than or equal to</xsl:when>
+ <xsl:when test="starts-with($operatortext,'cell-content()&gt;=')">greater than or equal to</xsl:when>
+ <xsl:when test="starts-with($operatortext,'cell-content()&lt;')">less than</xsl:when>
+ <xsl:when test="starts-with($operatortext,'cell-content()&gt;')">greater than</xsl:when>
+ <xsl:when test="starts-with($operatortext,'cell-content()!=')">not equal to</xsl:when>
+ <xsl:when test="starts-with($operatortext,'cell-content()=')">equal to</xsl:when>
+ <xsl:when test="starts-with($conditiontext,'oooc:cell-content-text-length()')">
+ <xsl:variable name="operator" select="substring-after($conditiontext,'oooc:cell-content-text-length()')"/>
+ <xsl:choose>
+ <xsl:when test="starts-with($operator,'&lt;=')">less than or equal to</xsl:when>
+ <xsl:when test="starts-with($operator,'&gt;=')">greater than or equal to</xsl:when>
+ <xsl:when test="starts-with($operator,'&lt;')">less than</xsl:when>
+ <xsl:when test="starts-with($operator,'&gt;')">greater than</xsl:when>
+ <xsl:when test="starts-with($operator,'!=')">not equal to</xsl:when>
+ <xsl:when test="starts-with($operator,'=')">equal to</xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="contains($conditiontext,'is-between')">between</xsl:when>
+ <xsl:when test="contains($conditiontext,'is-not-between')">not between</xsl:when>
+ <!-- 注æ„:uof有的å¦å‡ ç§æ“作ç åœ¨oo中没有,他们是contain,not contain,start with,not start with, end with,not end with-->
+ </xsl:choose>
+ </xsl:element>
+ <xsl:element name="表:第一æ“作数">
+ <xsl:attribute name="uof:locID">s0010</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="starts-with($operatortext,'cell-content-is-between')">
+ <xsl:value-of select="substring-before(substring-after($operatortext,'cell-content-is-between('),',')"/>
+ </xsl:when>
+ <xsl:when test="starts-with($operatortext,'cell-content-is-not-between')">
+ <xsl:value-of select="substring-before(substring-after($operatortext,'cell-content-is-not-between('),',')"/>
+ </xsl:when>
+ <xsl:when test="starts-with($conditiontext,'oooc:cell-content-text-length()')">
+ <xsl:variable name="operator" select="substring-after($conditiontext,'cell-content-text-length()')"/>
+ <xsl:choose>
+ <xsl:when test="starts-with($operator,'&lt;=')">
+ <xsl:value-of select="substring-after($operator,'&lt;=')"/>
+ </xsl:when>
+ <xsl:when test="starts-with($operator,'&gt;=')">
+ <xsl:value-of select="substring-after($operator,'&gt;=')"/>
+ </xsl:when>
+ <xsl:when test="starts-with($operator,'&lt;')">
+ <xsl:value-of select="substring-after($operator,'&lt;')"/>
+ </xsl:when>
+ <xsl:when test="starts-with($operator,'&gt;')">
+ <xsl:value-of select="substring-after($operator,'&gt;')"/>
+ </xsl:when>
+ <xsl:when test="starts-with($operator,'!=')">
+ <xsl:value-of select="substring-after($operator,'!=')"/>
+ </xsl:when>
+ <xsl:when test="starts-with($operator,'=')">
+ <xsl:value-of select="substring-after($operator,'=')"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="starts-with($conditiontext,'oooc:cell-content-is-in-list')">
+ <xsl:value-of select="substring-after($conditiontext,'oooc:cell-content-is-in-list')"/>
+ </xsl:when>
+ <xsl:when test="starts-with($conditiontext,'oooc:cell-content-text-length-is-not-between')">
+ <xsl:value-of select="substring-before(substring-after($conditiontext,'oooc:cell-content-text-length-is-not-between('),',')"/>
+ </xsl:when>
+ <xsl:when test="starts-with($conditiontext,'oooc:cell-content-text-length-is-between')">
+ <xsl:value-of select="substring-before(substring-after($conditiontext,'oooc:cell-content-text-length-is-between('),',')"/>
+ </xsl:when>
+ <xsl:when test="starts-with($operatortext,'cell-content()')">
+ <xsl:variable name="operator" select="substring-after($conditiontext,'oooc:cell-content()')"/>
+ <xsl:choose>
+ <xsl:when test="starts-with($operator,'&lt;=')">
+ <xsl:value-of select="substring-after($operator,'&lt;=')"/>
+ </xsl:when>
+ <xsl:when test="starts-with($operator,'&gt;=')">
+ <xsl:value-of select="substring-after($operator,'&gt;=')"/>
+ </xsl:when>
+ <xsl:when test="starts-with($operator,'&lt;')">
+ <xsl:value-of select="substring-after($operator,'&lt;')"/>
+ </xsl:when>
+ <xsl:when test="starts-with($operator,'&gt;')">
+ <xsl:value-of select="substring-after($operator,'&gt;')"/>
+ </xsl:when>
+ <xsl:when test="starts-with($operator,'!=')">
+ <xsl:value-of select="substring-after($operator,'!=')"/>
+ </xsl:when>
+ <xsl:when test="starts-with($operator,'=')">
+ <xsl:value-of select="substring-after($operator,'=')"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:if test="starts-with($operatortext,'cell-content-is-between') or starts-with($operatortext,'cell-content-is-not-between')">
+ <xsl:element name="表:第二æ“作数">
+ <xsl:attribute name="uof:locID">s0011</xsl:attribute>
+ <xsl:value-of select="substring-before(substring-after($operatortext,','),')')"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="starts-with($conditiontext,'oooc:cell-content-text-length-is-not-between') or starts-with($conditiontext,'oooc:cell-content-text-length-is-between')">
+ <xsl:element name="表:第二æ“作数">
+ <xsl:attribute name="uof:locID">s0011</xsl:attribute>
+ <xsl:value-of select="substring-before(substring-after($conditiontext,','),')')"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="表:忽略空格">
+ <xsl:attribute name="uof:locID">s0012</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="表:值"><xsl:value-of select="@table:allow-empty-cell"/></xsl:attribute>
+ </xsl:element>
+ <xsl:if test="contains($conditiontext,'cell-content-is-in-list') ">
+ <xsl:element name="表:下拉箭头">
+ <xsl:attribute name="uof:locID">s0013</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="表:值">false</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="table:help-message">
+ <xsl:element name="表:输入æ示">
+ <xsl:attribute name="uof:locID">s0014</xsl:attribute>
+ <xsl:attribute name="uof:attrList">显示 标题 内容</xsl:attribute>
+ <xsl:attribute name="表:显示"><xsl:value-of select="table:help-message/@table:display"/></xsl:attribute>
+ <xsl:attribute name="表:标题"><xsl:choose><xsl:when test="table:help-message/@table:title"><xsl:value-of select="table:help-message/@table:title"/></xsl:when><xsl:otherwise><xsl:value-of select="''"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:variable name="content">
+ <xsl:call-template name="create-help-error-message-content">
+ <xsl:with-param name="text-p-set" select="table:help-message/text:p"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="表:内容"><xsl:value-of select="$content"/></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="table:error-message">
+ <xsl:element name="表:错误æ示">
+ <xsl:attribute name="uof:locID">s0015</xsl:attribute>
+ <xsl:attribute name="uof:attrList">显示 类型 标题 内容</xsl:attribute>
+ <xsl:attribute name="表:显示"><xsl:value-of select="table:error-message/@table:display"/></xsl:attribute>
+ <xsl:attribute name="表:类型"><xsl:value-of select="table:error-message/@table:message-type"/></xsl:attribute>
+ <xsl:attribute name="表:标题"><xsl:choose><xsl:when test="table:error-message/@table:title"><xsl:value-of select="table:error-message/@table:title"/></xsl:when><xsl:otherwise><xsl:value-of select="''"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:variable name="content">
+ <xsl:call-template name="create-help-error-message-content">
+ <xsl:with-param name="text-p-set" select="table:error-message/text:p"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="表:内容"><xsl:value-of select="$content"/></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="search-left-top-validation">
+ <xsl:param name="validation-name"/>
+ <xsl:param name="tableslist"/>
+ <xsl:param name="return"/>
+ <xsl:choose>
+ <xsl:when test="$tableslist and $return=''">
+ <xsl:variable name="firsttablerows" select="$tableslist[1]//table:table-row"/>
+ <xsl:variable name="first-left-top">
+ <xsl:call-template name="search-left-top-validation-inatable">
+ <xsl:with-param name="row-num" select="'1'"/>
+ <xsl:with-param name="firsttablerows" select="$firsttablerows"/>
+ <xsl:with-param name="validation-name" select="$validation-name"/>
+ <xsl:with-param name="return" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="rest-left-top">
+ <xsl:call-template name="search-left-top-validation">
+ <xsl:with-param name="validation-name" select="$validation-name"/>
+ <xsl:with-param name="tableslist" select="$tableslist[position()!=1]"/>
+ <xsl:with-param name="return" select="$first-left-top"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$first-left-top!=''">
+ <xsl:value-of select="$first-left-top"/>
+ </xsl:when>
+ <xsl:when test="$rest-left-top!=''">
+ <xsl:value-of select="$rest-left-top"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="''"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$return"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="translate-left-top">
+ <xsl:param name="left-top"/>
+ <xsl:variable name="column-number" select="substring-before(substring-after($left-top,'.'),' ')"/>
+ <xsl:variable name="column-number1">
+ <xsl:value-of select="floor( $column-number div 26 )"/>
+ </xsl:variable>
+ <xsl:variable name="column-number2">
+ <xsl:value-of select="$column-number mod 26"/>
+ </xsl:variable>
+ <xsl:variable name="column-character1">
+ <xsl:call-template name="number-to-character">
+ <xsl:with-param name="number" select="$column-number1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="column-character2">
+ <xsl:call-template name="number-to-character">
+ <xsl:with-param name="number" select="$column-number2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="concat(substring-before($left-top,'.'),'.','$',$column-character1,$column-character2,'$',substring-after($left-top,' '))"/>
+ </xsl:template>
+ <xsl:template name="create-help-error-message-content">
+ <xsl:param name="text-p-set"/>
+ <xsl:if test="$text-p-set">
+ <!--此处有问题ï¼ï¼ï¼ï¼åº”该是有一个模å—调用等-->
+ <!--xsl:value-of select="'&#10;'"/-->
+ <xsl:value-of select="$text-p-set"/>
+ <xsl:call-template name="create-help-error-message-content">
+ <xsl:with-param name="text-p-set" select="$text-p-set[position()!=1]"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="search-left-top-validation-inatable">
+ <xsl:param name="row-num"/>
+ <xsl:param name="firsttablerows"/>
+ <xsl:param name="validation-name"/>
+ <xsl:param name="return"/>
+ <xsl:choose>
+ <xsl:when test="$firsttablerows and $return=''">
+ <xsl:variable name="firstcells" select="$firsttablerows[1]/table:table-cell"/>
+ <xsl:variable name="first-left-top">
+ <xsl:call-template name="search-left-top-validation-inarow">
+ <xsl:with-param name="row-num" select="$row-num"/>
+ <xsl:with-param name="column-num" select="'1'"/>
+ <xsl:with-param name="firstcells" select="$firstcells"/>
+ <xsl:with-param name="validation-name" select="$validation-name"/>
+ <xsl:with-param name="return" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="row-num-p">
+ <xsl:choose>
+ <xsl:when test="$firsttablerows[1]/@table:number-rows-repeated">
+ <xsl:value-of select="$row-num+ $firsttablerows[1]/@table:number-rows-repeated"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$row-num+1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="rest-left-top">
+ <xsl:call-template name="search-left-top-validation-inatable">
+ <xsl:with-param name="row-num" select="$row-num-p"/>
+ <xsl:with-param name="firsttablerows" select="$firsttablerows[position()!=1]"/>
+ <xsl:with-param name="validation-name" select="$validation-name"/>
+ <xsl:with-param name="return" select="$first-left-top"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$first-left-top!=''">
+ <xsl:value-of select="$first-left-top"/>
+ </xsl:when>
+ <xsl:when test="$rest-left-top !=''">
+ <xsl:value-of select="$rest-left-top "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="''"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$return"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="number-to-character">
+ <xsl:param name="number"/>
+ <xsl:choose>
+ <xsl:when test="$number = 0"/>
+ <xsl:when test="$number = 1">A</xsl:when>
+ <xsl:when test="$number = 2">B</xsl:when>
+ <xsl:when test="$number = 3">C</xsl:when>
+ <xsl:when test="$number = 4">D</xsl:when>
+ <xsl:when test="$number = 5">E</xsl:when>
+ <xsl:when test="$number = 6">F</xsl:when>
+ <xsl:when test="$number = 7">G</xsl:when>
+ <xsl:when test="$number = 8">H</xsl:when>
+ <xsl:when test="$number = 9">I</xsl:when>
+ <xsl:when test="$number = 10">J</xsl:when>
+ <xsl:when test="$number = 11">K</xsl:when>
+ <xsl:when test="$number = 12">L</xsl:when>
+ <xsl:when test="$number = 13">M</xsl:when>
+ <xsl:when test="$number = 14">N</xsl:when>
+ <xsl:when test="$number = 15">O</xsl:when>
+ <xsl:when test="$number = 16">P</xsl:when>
+ <xsl:when test="$number = 17">Q</xsl:when>
+ <xsl:when test="$number = 18">R</xsl:when>
+ <xsl:when test="$number = 19">S</xsl:when>
+ <xsl:when test="$number = 20">T</xsl:when>
+ <xsl:when test="$number = 21">U</xsl:when>
+ <xsl:when test="$number = 22">V</xsl:when>
+ <xsl:when test="$number = 23">W</xsl:when>
+ <xsl:when test="$number = 24">X</xsl:when>
+ <xsl:when test="$number = 25">Y</xsl:when>
+ <xsl:when test="$number = 26">Z</xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="search-left-top-validation-inacell">
+ <xsl:param name="row-num"/>
+ <xsl:param name="column-num"/>
+ <xsl:param name="cell"/>
+ <xsl:param name="validation-name"/>
+ <xsl:choose>
+ <xsl:when test="$cell/@table:content-validation-name=$validation-name">
+ <xsl:value-of select="concat($cell/ancestor::table:table/@table:name,'.',$column-num,' ',$row-num)"/>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="search-left-top-validation-inarow">
+ <xsl:param name="row-num"/>
+ <xsl:param name="column-num"/>
+ <xsl:param name="firstcells"/>
+ <xsl:param name="validation-name"/>
+ <xsl:param name="return"/>
+ <xsl:choose>
+ <xsl:when test="$firstcells and $return=''">
+ <xsl:variable name="firstcell" select="$firstcells[1]"/>
+ <xsl:variable name="first-left-top">
+ <xsl:call-template name="search-left-top-validation-inacell">
+ <xsl:with-param name="row-num" select="$row-num"/>
+ <xsl:with-param name="column-num" select="$column-num"/>
+ <xsl:with-param name="cell" select="$firstcell"/>
+ <xsl:with-param name="validation-name" select="$validation-name"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="column-num-p">
+ <xsl:choose>
+ <xsl:when test="$firstcell/@table:number-columns-repeated">
+ <xsl:value-of select="$column-num+ $firstcell/@table:number-columns-repeated"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$column-num+ 1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="rest-left-top">
+ <xsl:call-template name="search-left-top-validation-inarow">
+ <xsl:with-param name="row-num" select="$row-num"/>
+ <xsl:with-param name="column-num" select="$column-num-p"/>
+ <xsl:with-param name="firstcells" select="$firstcells[position()!=1]"/>
+ <xsl:with-param name="validation-name" select="$validation-name"/>
+ <xsl:with-param name="return" select="$first-left-top"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$first-left-top!=''">
+ <xsl:value-of select="$first-left-top"/>
+ </xsl:when>
+ <xsl:when test="$rest-left-top !=''">
+ <xsl:value-of select="$rest-left-top "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="''"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$return"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/filter/source/xslt/export/uof/odf2uof_text.xsl b/filter/source/xslt/export/uof/odf2uof_text.xsl
new file mode 100644
index 000000000000..cea93c8a0864
--- /dev/null
+++ b/filter/source/xslt/export/uof/odf2uof_text.xsl
@@ -0,0 +1,4445 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:uof="http://schemas.uof.org/cn/2003/uof" xmlns:表="http://schemas.uof.org/cn/2003/uof-spreadsheet" xmlns:演="http://schemas.uof.org/cn/2003/uof-slideshow" xmlns:字="http://schemas.uof.org/cn/2003/uof-wordproc" xmlns:图="http://schemas.uof.org/cn/2003/graph" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:smil="urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0" xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" office:version="1.0" exclude-result-prefixes="office style text table draw fo xlink dc meta number presentation svg chart dr3d math form script config ooo ooow oooc dom xforms smil anim">
+ <xsl:output method="xml" indent="no" encoding="UTF-8" version="1.0"/>
+ <!--xsl:key name="colWidth" match="/office:automatic/style:style/" use="@style:column-width"/-->
+ <xsl:variable name="swValueWithUnit">
+ <xsl:value-of select="/office:document/office:automatic-styles/style:page-layout/style:page-layout-properties/@fo:page-width"/>
+ </xsl:variable>
+ <xsl:variable name="uofUnit">
+ <xsl:choose>
+ <xsl:when test="contains($swValueWithUnit,'in')">inch</xsl:when>
+ <xsl:when test="contains($swValueWithUnit,'cm')">cm</xsl:when>
+ <xsl:when test="contains($swValueWithUnit,'mm')">mm</xsl:when>
+ <xsl:when test="contains($swValueWithUnit,'pt')">pt</xsl:when>
+ <xsl:otherwise>inch</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="ooUnit">
+ <xsl:choose>
+ <xsl:when test="contains($swValueWithUnit,'in')">inch</xsl:when>
+ <xsl:when test="contains($swValueWithUnit,'cm')">cm</xsl:when>
+ <xsl:when test="contains($swValueWithUnit,'mm')">mm</xsl:when>
+ <xsl:when test="contains($swValueWithUnit,'pt')">pt</xsl:when>
+ <xsl:otherwise>inch</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:template match="/">
+ <xsl:apply-templates select="office:document"/>
+ </xsl:template>
+ <xsl:template match="office:document">
+ <uof:UOF xmlns:uof="http://schemas.uof.org/cn/2003/uof" xmlns:表="http://schemas.uof.org/cn/2003/uof-spreadsheet" xmlns:演="http://schemas.uof.org/cn/2003/uof-slideshow" xmlns:字="http://schemas.uof.org/cn/2003/uof-wordproc" xmlns:图="http://schemas.uof.org/cn/2003/graph" uof:language="cn" uof:locID="u0000" uof:version="1.0" uof:mimetype="vnd.uof.text">
+ <xsl:apply-templates select="office:meta"/>
+ <xsl:if test="/office:document/office:body/office:text/text:p/text:bookmark-start|/office:document/office:body/office:text/text:p/text:bookmark">
+ <uof:书签集 uof:locID="u0027">
+ <xsl:for-each select="/office:document/office:body/office:text/text:p/text:bookmark-start|/office:document/office:body/office:text/text:p/text:bookmark">
+ <uof:书签 uof:locID="u0028" uof:attrList="å称">
+ <xsl:attribute name="uof:å称"><xsl:value-of select="@text:name"/></xsl:attribute>
+ <uof:文本ä½ç½® uof:locID="u0029" uof:attrList="区域引用">
+ <xsl:attribute name="字:区域引用"><xsl:value-of select="generate-id()"/></xsl:attribute>
+ </uof:文本ä½ç½®>
+ </uof:书签>
+ </xsl:for-each>
+ </uof:书签集>
+ </xsl:if>
+ <xsl:if test="/office:document/office:body/office:text/text:p/text:a | /office:document/office:body/office:text/text:p/draw:a | /office:document/office:body/office:text/table:table/table:table-row/table:table-cell/text:p/text:a | /office:document/office:body/office:text/text:table-of-content/text:index-body/text:p/text:a">
+ <uof:链接集 uof:locID="u0031">
+ <xsl:for-each select="/office:document/office:body/office:text/text:p/text:a | /office:document/office:body/office:text/text:p/draw:a | /office:document/office:body/office:text/table:table/table:table-row/table:table-cell/text:p/text:a | /office:document/office:body/office:text/text:table-of-content/text:index-body/text:p/text:a">
+ <xsl:variable name="hyperStr" select="@xlink:href"/>
+ <uof:超级链接 uof:locID="u0032" uof:attrList="标识符 目标 书签 å¼æ ·å¼•ç”¨ 已访问å¼æ ·å¼•ç”¨ æ示 链æº">
+ <xsl:if test="contains($hyperStr,'#')">
+ <xsl:attribute name="uof:书签"><xsl:value-of select="substring-after($hyperStr,'#')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:variable name="num">
+ <xsl:number from="/office:document/office:body/office:text" level="any" count="text:a | table:table/table:table-row/table:table-cell/text:a"/>
+ </xsl:variable>
+ <xsl:attribute name="uof:链æº"><xsl:value-of select="concat('hlnk',$num)"/></xsl:attribute>
+ <xsl:attribute name="uof:标识符"><xsl:value-of select="concat('hyk_','hlnk',$num)"/></xsl:attribute>
+ <xsl:if test="not(contains($hyperStr,'#'))">
+ <xsl:attribute name="uof:目标"><xsl:value-of select="$hyperStr"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@office:name">
+ <xsl:attribute name="uof:æ示"><xsl:value-of select="@office:name"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@text:style-name">
+ <xsl:attribute name="uof:å¼æ ·å¼•ç”¨"><xsl:value-of select="@text:style-name"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@text:visited-style-name">
+ <xsl:attribute name="uof:已访问å¼æ ·å¼•ç”¨"><xsl:value-of select="@text:visited-style-name"/></xsl:attribute>
+ </xsl:if>
+ </uof:超级链接>
+ </xsl:for-each>
+ </uof:链接集>
+ </xsl:if>
+ <uof:å¼æ ·é›† uof:locID="u0039">
+ <xsl:apply-templates select="office:font-face-decls"/>
+ <xsl:call-template name="自动编å·é›†"/>
+ <xsl:call-template name="shiyang"/>
+ <xsl:apply-templates select="office:automatic-styles/style:style" mode="style"/>
+ </uof:å¼æ ·é›†>
+ <uof:对象集 uof:locID="u0033">
+ <xsl:for-each select="/office:document/office:body/office:text/draw:*">
+ <xsl:variable name="nodename1">
+ <xsl:value-of select="name()"/>
+ </xsl:variable>
+ <xsl:call-template name="draw">
+ <xsl:with-param name="nodename1" select="$nodename1"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ <xsl:apply-templates select="/office:document/office:body/office:text//text:p" mode="styles"/>
+ <xsl:apply-templates select="/office:document/office:master-styles/style:master-page/style:header/text:p" mode="styles"/>
+ <xsl:apply-templates select="/office:document/office:master-styles/style:master-page/style:footer/text:p" mode="styles"/>
+ <xsl:for-each select="(/office:document/office:styles/style:style/style:paragraph-properties/style:background-image) | (/office:document/office:automatic-styles/style:style/style:paragraph-properties/style:background-image) | (/office:document/office:automatic-styles/style:page-layout/style:page-layout-properties/style:background-image) | /office:document/office:automatic-styles/style:style/style:table-cell-properties/style:background-image | /office:document/office:automatic-styles/style:style/style:table-properties/style:background-image | /office:document/office:automatic-styles/style:style/style:graphic-properties/style:background-image">
+ <uof:其他对象 uof:locID="u0036" uof:attrList="标识符 内嵌 公共类型 ç§æœ‰ç±»åž‹">
+ <xsl:attribute name="uof:标识符"><xsl:value-of select="concat('background-image_',count(preceding::style:background-image))"/></xsl:attribute>
+ <xsl:attribute name="uof:公共类型">png</xsl:attribute>
+ <xsl:attribute name="uof:内嵌">true</xsl:attribute>
+ <uof:æ•°æ® uof:locID="u0037">
+ <xsl:value-of select="office:binary-data"/>
+ </uof:æ•°æ®>
+ </uof:其他对象>
+ </xsl:for-each>
+ <xsl:for-each select="(/office:document/office:styles/text:list-style/text:list-level-style-image) | (/office:document/office:automatic-styles/text:list-style/text:list-level-style-image)">
+ <uof:其他对象 uof:locID="u0036" uof:attrList="标识符 内嵌 公共类型 ç§æœ‰ç±»åž‹">
+ <xsl:attribute name="uof:标识符"><xsl:value-of select="concat('image_numbering_',count(preceding::text:list-level-style-image))"/></xsl:attribute>
+ <xsl:attribute name="uof:公共类型">png</xsl:attribute>
+ <xsl:attribute name="uof:内嵌">true</xsl:attribute>
+ <uof:æ•°æ® uof:locID="u0037">
+ <xsl:value-of select="office:binary-data"/>
+ </uof:æ•°æ®>
+ </uof:其他对象>
+ </xsl:for-each>
+ <xsl:for-each select="/office:document/office:styles/draw:fill-image">
+ <uof:其他对象 uof:locID="u0036" uof:attrList="标识符 内嵌 公共类型 ç§æœ‰ç±»åž‹">
+ <xsl:attribute name="uof:标识符"><xsl:value-of select="@draw:name"/></xsl:attribute>
+ <xsl:attribute name="uof:公共类型">png</xsl:attribute>
+ <xsl:attribute name="uof:内嵌">true</xsl:attribute>
+ <uof:æ•°æ® uof:locID="u0037">
+ <xsl:value-of select="office:binary-data"/>
+ </uof:æ•°æ®>
+ </uof:其他对象>
+ </xsl:for-each>
+ <!--xsl:apply-templates select="/office:document/office:automatic-styles/style:style[@style:family = 'graphics']"/>
+ <xsl:apply-templates select="office:styles/style:style[@style:family = 'graphics']"/>
+ <xsl:apply-templates select="office:styles/style:default-style [@style:family = 'graphics']"/-->
+ </uof:对象集>
+ <uof:æ–‡å­—å¤„ç† uof:locID="u0047">
+ <å­—:公用处ç†è§„则 uof:locID="t0000">
+ <xsl:apply-templates select="office:settings"/>
+ <xsl:call-template name="GetUsers"/>
+ <xsl:call-template name="GetTrackChanges"/>
+ <xsl:call-template name="GetAnnotations"/>
+ </å­—:公用处ç†è§„则>
+ <字:主体 uof:locID="t0016">
+ <xsl:for-each select="office:automatic-styles/style:page-layout[@style:name='pm1']">
+ <xsl:call-template name="style:page-layout"/>
+ </xsl:for-each>
+ <!--xsl:call-template name="office:automatic-styles/style:page-layout[@style:name='pm1']"/-->
+ <!--xsl:apply-templates select="office:automatic-styles/style:page-layout[@style:name='pm1']"/-->
+ <xsl:apply-templates select="office:body/office:text"/>
+ <xsl:call-template name="logic-chapter"/>
+ </字:主体>
+ </uof:文字处ç†>
+ </uof:UOF>
+ </xsl:template>
+ <xsl:template name="logic-chapter">
+ <xsl:element name="字:逻辑章节">
+ <xsl:attribute name="uof:locID">t0050</xsl:attribute>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="GetAnnotations">
+ <xsl:if test="/*/office:body/office:text//office:annotation ">
+ <字:批注集 uof:locID="t0014">
+ <xsl:for-each select="/*/office:body/office:text//office:annotation">
+ <字:批注 uof:locID="t0015" uof:attrList="区域引用 作者 日期 作者缩写">
+ <xsl:attribute name="字:作者"><xsl:value-of select="generate-id()"/></xsl:attribute>
+ <xsl:attribute name="字:日期"><xsl:value-of select="dc:date"/></xsl:attribute>
+ <xsl:attribute name="字:区域引用">cmt<xsl:number from="/office:document/office:body/office:text" level="any" count="office:annotation"/></xsl:attribute>
+ <xsl:for-each select="./node()">
+ <xsl:choose>
+ <xsl:when test="name()='text:p'">
+ <xsl:call-template name="execParagraph">
+ <xsl:with-param name="currlistlvl" select="number('0')"/>
+ <xsl:with-param name="liststylename" select="string('00000')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name()='table:table'">
+ <xsl:call-template name="exec_table"/>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:for-each>
+ </字:批注>
+ </xsl:for-each>
+ </字:批注集>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="GetTrackChanges">
+ <xsl:if test="/*/office:body/office:text/text:tracked-changes">
+ <å­—:修订信æ¯é›† uof:locID="t0012">
+ <xsl:for-each select="/*/office:body/office:text/text:tracked-changes/text:changed-region">
+ <å­—:ä¿®è®¢ä¿¡æ¯ å­—:标识符="{@text:id}" å­—:作者="{generate-id()}" å­—:日期="{node()//office:change-info/dc:date}" uof:locID="t0013" uof:attrList="标识符 作者 日期"/>
+ </xsl:for-each>
+ </å­—:修订信æ¯é›†>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="GetUsers">
+ <xsl:if test="/*/office:body/office:text/text:tracked-changes//office:change-info/dc:creator or //office:annotation/@office:author or //office:annotation/dc:creator">
+ <字:用户集 uof:locID="t0010">
+ <xsl:for-each select="/*/office:body/office:text/text:tracked-changes/text:changed-region">
+ <å­—:用户 å­—:标识符="{generate-id()}" å­—:姓å="{node()//office:change-info/dc:creator}" uof:locID="t0011" uof:attrList="标识符 姓å"/>
+ </xsl:for-each>
+ <xsl:for-each select="//office:annotation">
+ <å­—:用户 å­—:标识符="{generate-id()}" å­—:姓å="{dc:creator}" uof:locID="t0011" uof:attrList="标识符 姓å"/>
+ </xsl:for-each>
+ </字:用户集>
+ </xsl:if>
+ </xsl:template>
+ <xsl:key match="/office:document/office:automatic-styles/style:style | /office:document/office:styles/style:style" name="graphicset" use="@style:name"/>
+ <xsl:template match="text:p" mode="styles">
+ <xsl:for-each select="child::*">
+ <xsl:variable name="nodename1">
+ <xsl:value-of select="name()"/>
+ </xsl:variable>
+ <xsl:if test="(substring-before($nodename1,':') = 'draw')">
+ <xsl:call-template name="draw">
+ <xsl:with-param name="nodename1" select="$nodename1"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="draw">
+ <xsl:param name="nodename1"/>
+ <xsl:choose>
+ <xsl:when test="substring-after($nodename1,':') = 'a'">
+ <xsl:for-each select="child::*">
+ <xsl:call-template name="draw">
+ <xsl:with-param name="nodename">
+ <xsl:value-of select="name()"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:when test="substring-after($nodename1,':') = 'g'">
+ <xsl:call-template name="draw:g"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="creategraphicstyles"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="draw:g">
+ <xsl:variable name="picnumber1">
+ <xsl:value-of select="count(preceding::draw:g)"/>
+ </xsl:variable>
+ <图:图形 uof:locID="g0000" uof:attrList="层次 标识符 组åˆåˆ—表 其他对象">
+ <xsl:attribute name="图:标识符"><xsl:value-of select="concat(@draw:style-name,'_',$picnumber1)"/></xsl:attribute>
+ <xsl:attribute name="图:层次"><xsl:choose><xsl:when test="name(parent::node())='draw:g'"><xsl:value-of select="position()"/></xsl:when><xsl:when test="@draw:z-index"><xsl:value-of select="@draw:z-index"/></xsl:when><xsl:otherwise><xsl:value-of select="position()"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="图:组åˆåˆ—表"><xsl:for-each select="child::*[1]"><xsl:variable name="node1"><xsl:value-of select="@draw:style-name"/></xsl:variable><xsl:variable name="picnumber2"><xsl:value-of select="count(preceding::*[@draw:style-name=$node1])"/></xsl:variable><xsl:call-template name="zuheliebiao"><xsl:with-param name="allnode"><xsl:value-of select="concat($node1,'_',$picnumber2)"/></xsl:with-param><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:for-each></xsl:attribute>
+ </图:图形>
+ <xsl:for-each select="child::*">
+ <xsl:choose>
+ <xsl:when test="name()='draw:g'">
+ <xsl:call-template name="draw:g"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="creategraphicstyles"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="zuheliebiao">
+ <xsl:param name="allnode"/>
+ <xsl:param name="pos"/>
+ <xsl:choose>
+ <xsl:when test="../child::*[$pos]">
+ <xsl:for-each select="../child::*[$pos]">
+ <xsl:variable name="nodepos">
+ <xsl:value-of select="@draw:style-name"/>
+ </xsl:variable>
+ <xsl:variable name="picnumber1">
+ <xsl:value-of select="count(preceding::*[@draw:style-name=$nodepos])"/>
+ </xsl:variable>
+ <xsl:variable name="pic-name1">
+ <xsl:value-of select="concat($nodepos,'_',$picnumber1)"/>
+ </xsl:variable>
+ <xsl:variable name="allnode1">
+ <xsl:value-of select="concat($allnode,',',$pic-name1)"/>
+ </xsl:variable>
+ <xsl:call-template name="zuheliebiao">
+ <xsl:with-param name="allnode" select="$allnode1"/>
+ <xsl:with-param name="pos" select="$pos+1"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$allnode"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="creategraphicstyles">
+ <xsl:variable name="nodename">
+ <xsl:value-of select="name()"/>
+ </xsl:variable>
+ <xsl:variable name="pic-name">
+ <xsl:value-of select="@draw:style-name"/>
+ </xsl:variable>
+ <xsl:variable name="pic-num">
+ <xsl:value-of select="count(/descendant::*[@draw:style-name=$pic-name])"/>
+ </xsl:variable>
+ <xsl:variable name="picnumber">
+ <xsl:value-of select="count(preceding::*[@draw:style-name=$pic-name])"/>
+ </xsl:variable>
+ <xsl:call-template name="pic-process">
+ <xsl:with-param name="pic-name" select="$pic-name"/>
+ <xsl:with-param name="nodename" select="$nodename"/>
+ <xsl:with-param name="picnumber" select="$picnumber"/>
+ </xsl:call-template>
+ </xsl:template>
+ <!--xsl:key match="/office:document/office:automatic-styles/style:style" name="graphicset" use="@style:name"/>
+
+ <xsl:template match="style:style[@style:family = 'graphics']">
+ <xsl:variable name="pic-name">
+ <xsl:value-of select="@style:name"/>
+ </xsl:variable>
+ <xsl:variable name="pic-num">
+ <xsl:value-of select="count(/descendant::*[@draw:style-name=$pic-name])"/>
+ </xsl:variable>
+ <xsl:call-template name="pic-process">
+ <xsl:with-param name="pic-name" select="$pic-name"/>
+ <xsl:with-param name="pic-num" select="$pic-num"/>
+ <xsl:with-param name="current-num" select="1"/>
+ </xsl:call-template>
+ </xsl:template-->
+ <xsl:template name="pic-process">
+ <xsl:param name="pic-name"/>
+ <xsl:param name="nodename"/>
+ <xsl:param name="picnumber"/>
+ <图:图形 uof:locID="g0000" uof:attrList="层次 标识符 组åˆåˆ—表 其他对象">
+ <xsl:attribute name="图:标识符"><xsl:value-of select="concat($pic-name,'_',$picnumber)"/></xsl:attribute>
+ <xsl:attribute name="图:层次"><xsl:value-of select="@draw:z-index"/></xsl:attribute>
+ <xsl:if test=".//office:binary-data">
+ <xsl:attribute name="图:其他对象"><xsl:choose><xsl:when test="@draw:name"><xsl:value-of select="@draw:name"/></xsl:when><xsl:otherwise><xsl:value-of select="concat($pic-name,'_b1')"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:variable name="arrow-sign">
+ <xsl:choose>
+ <xsl:when test="key('graphicset',$pic-name)/style:graphic-properties/@draw:marker-start or key('graphicset',$pic-name)/style:graphic-properties/@draw:marker-end">
+ <xsl:value-of select="'1'"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$nodename='draw:line' or $nodename='draw:rect' or $nodename='draw:circle' or $nodename='draw:polygon' or $nodename='draw:polyline' or $nodename='draw:ellipse' or $nodename='draw:path'or $nodename='draw:g' or $nodename='draw:text-box' or child::draw:text-box">
+ <图:预定义图形 uof:locID="g0005">
+ <图:类别 uof:locID="g0006">
+ <xsl:choose>
+ <xsl:when test="$nodename='draw:line' and $arrow-sign='1'">62</xsl:when>
+ <xsl:when test="$nodename='draw:rect'">11</xsl:when>
+ <xsl:when test="$nodename='draw:line'">61</xsl:when>
+ <xsl:when test="$nodename='draw:circle'">19</xsl:when>
+ <xsl:when test="$nodename='draw:polygon'">65</xsl:when>
+ <xsl:when test="$nodename='draw:polyline'">66</xsl:when>
+ <xsl:when test="$nodename='draw:ellipse'">19</xsl:when>
+ <xsl:when test="child::draw:text-box[@fo:min-height]">22</xsl:when>
+ <xsl:when test="child::draw:text-box">23</xsl:when>
+ </xsl:choose>
+ </图:类别>
+ <图:å称 uof:locID="g0007">
+ <xsl:choose>
+ <xsl:when test="$nodename='draw:rect'">Rectangle</xsl:when>
+ <xsl:when test="$nodename='draw:line'">Line</xsl:when>
+ <xsl:when test="$nodename='draw:circle'">Oval</xsl:when>
+ <xsl:when test="$nodename='draw:polygon'">Freeform</xsl:when>
+ <xsl:when test="$nodename='draw:polyline'">Scribble</xsl:when>
+ <xsl:when test="$nodename='draw:ellipse'">Oval</xsl:when>
+ <xsl:when test="$nodename='draw:frame' and child::draw:text-box[@fo:min-height]">排版框</xsl:when>
+ <xsl:when test="$nodename='draw:frame' and child::draw:text-box">排版框</xsl:when>
+ </xsl:choose>
+ </图:å称>
+ <图:生æˆè½¯ä»¶ uof:locID="g0008">PNG</图:生æˆè½¯ä»¶>
+ <xsl:if test="./@draw:points or ./@svg:d">
+ <图:关键点åæ ‡ uof:locID="g0009" uof:attrList="路径">
+ <xsl:attribute name="图:路径"><xsl:choose><xsl:when test="@svg:d"><xsl:value-of select="@svg:d"/></xsl:when><xsl:when test="@draw:points"><xsl:call-template name="draw:points"><xsl:with-param name="point" select="@draw:points"/><xsl:with-param name="lujing"/></xsl:call-template></xsl:when></xsl:choose></xsl:attribute>
+ </图:关键点åæ ‡>
+ </xsl:if>
+ <图:属性 uof:locID="g0011">
+ <xsl:for-each select="(/office:document/office:styles/descendant::*[@style:name=$pic-name]) | (/office:document/office:automatic-styles/descendant::*[@style:name=$pic-name]) ">
+ <xsl:if test="style:graphic-properties/@draw:fill-color or style:graphic-properties/@fo:background-color or style:graphic-properties/@draw:fill-image-name or style:graphic-properties/@draw:fill-gradient-name">
+ <图:填充 uof:locID="g0012">
+ <xsl:choose>
+ <xsl:when test="style:graphic-properties/@draw:fill='gradient'">
+ <xsl:variable name="gradient-name">
+ <xsl:value-of select="style:graphic-properties/@draw:fill-gradient-name"/>
+ </xsl:variable>
+ <xsl:for-each select="/descendant::draw:gradient[@draw:name=$gradient-name]">
+ <图:æ¸å˜ uof:locID="g0037" uof:attrList="起始色 终止色 ç§å­ç±»åž‹ 起始浓度 终止浓度 æ¸å˜æ–¹å‘ 边界 ç§å­Xä½ç½® ç§å­Yä½ç½® 类型">
+ <xsl:attribute name="图:起始色"><xsl:value-of select="@draw:start-color"/></xsl:attribute>
+ <xsl:attribute name="图:终止色"><xsl:value-of select="@draw:end-color"/></xsl:attribute>
+ <xsl:attribute name="图:ç§å­ç±»åž‹"><xsl:choose><xsl:when test="@draw:style='linear' or @draw:style='axial'">linear</xsl:when><xsl:when test="@draw:style='radial'">radar</xsl:when><xsl:when test="@draw:style='ellipsoid'">oval</xsl:when><xsl:when test="@draw:style='square'">square</xsl:when><xsl:when test="@draw:style='rectangular'">rectangle</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:attribute name="图:起始浓度"><xsl:value-of select="substring-before(@draw:start-intensity,'%')"/></xsl:attribute>
+ <xsl:attribute name="图:终止浓度"><xsl:value-of select="substring-before(@draw:end-intensity,'%')"/></xsl:attribute>
+ <xsl:variable name="angle">
+ <xsl:value-of select="@draw:angle div 10"/>
+ </xsl:variable>
+ <xsl:attribute name="图:æ¸å˜æ–¹å‘"><xsl:choose><xsl:when test="0&lt;$angle and $angle&lt;25">0</xsl:when><xsl:when test="25&lt;$angle and $angle&lt;70">45</xsl:when><xsl:when test="70&lt;$angle and $angle&lt;115">90</xsl:when><xsl:when test="115&lt;$angle and $angle&lt;160">135</xsl:when><xsl:when test="160&lt;$angle and $angle&lt;205">180</xsl:when><xsl:when test="205&lt;$angle and $angle&lt;250">225</xsl:when><xsl:when test="250&lt;$angle and $angle&lt;295">270</xsl:when><xsl:when test="295&lt;$angle and $angle&lt;340">315</xsl:when><xsl:when test="340&lt;$angle and $angle&lt;360">360</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:attribute name="图:边界"><xsl:value-of select="substring-before(@draw:border,'%')"/></xsl:attribute>
+ <xsl:if test="@draw:cx">
+ <xsl:attribute name="图:ç§å­Xä½ç½®"><xsl:value-of select="substring-before(@draw:cx,'%')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@draw:cy">
+ <xsl:attribute name="图:ç§å­Yä½ç½®"><xsl:value-of select="substring-before(@draw:cy,'%')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="图:类型">-2</xsl:attribute>
+ </图:æ¸å˜>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:fill-image-name or style:graphic-properties/style:background-image/office:binary-data">
+ <xsl:choose>
+ <xsl:when test="style:graphic-properties/@draw:fill-image-name">
+ <图:图片 uof:locID="g0035" uof:attrList="ä½ç½® 图形引用 类型 å称">
+ <xsl:attribute name="图:ä½ç½®"><xsl:choose><xsl:when test="not(style:graphic-properties/@style:repeat)">tile</xsl:when><xsl:otherwise><xsl:choose><xsl:when test="style:graphic-properties/@style:repeat = 'stretch'">stretch</xsl:when><xsl:when test="style:graphic-properties/@style:repeat = 'repeat'">tile</xsl:when><xsl:when test="style:graphic-properties/@style:repeat = 'no-repeat'">center</xsl:when></xsl:choose></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="图:图形引用"><xsl:value-of select="concat($pic-name,'_b1')"/></xsl:attribute>
+ <xsl:attribute name="图:类型">png</xsl:attribute>
+ <xsl:attribute name="图:å称"><xsl:value-of select="style:graphic-properties/@draw:fill-image-name"/></xsl:attribute>
+ </图:图片>
+ </xsl:when>
+ <xsl:when test="style:graphic-properties/style:background-image/office:binary-data">
+ <xsl:for-each select="style:graphic-properties">
+ <xsl:call-template name="图:填充"/>
+ </xsl:for-each>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:fill='hatch'">
+ <图:图案 uof:locID="g0036" uof:attrList="类型 图形引用 å‰æ™¯è‰² 背景色">
+ <xsl:attribute name="图:类型"><xsl:value-of select="/office:document/office:styles/draw:hatch/@draw:name"/></xsl:attribute>
+ <xsl:attribute name="图:图形引用"/>
+ <xsl:attribute name="图:å‰æ™¯è‰²"><xsl:value-of select="/office:document/office:styles/draw:hatch/@draw:color"/></xsl:attribute>
+ <xsl:attribute name="图:背景色"><xsl:choose><xsl:when test="style:graphic-properties/@draw:fill-color"><xsl:value-of select="style:graphic-properties/@draw:fill-color"/></xsl:when><xsl:otherwise>#ffffff</xsl:otherwise></xsl:choose></xsl:attribute>
+ </图:图案>
+ </xsl:when>
+ <xsl:otherwise>
+ <图:颜色 uof:locID="g0034">
+ <xsl:choose>
+ <xsl:when test="style:graphic-properties/@draw:fill-color">
+ <xsl:value-of select="style:graphic-properties/@draw:fill-color"/>
+ </xsl:when>
+ <xsl:when test="style:graphic-properties/@fo:background-color">
+ <xsl:value-of select="style:graphic-properties/@fo:background-color"/>
+ </xsl:when>
+ <xsl:otherwise>#99ccff</xsl:otherwise>
+ </xsl:choose>
+ </图:颜色>
+ </xsl:otherwise>
+ </xsl:choose>
+ </图:填充>
+ </xsl:if>
+ <xsl:if test="style:graphic-properties/@svg:stroke-color">
+ <图:线颜色 uof:locID="g0013">
+ <xsl:value-of select="style:graphic-properties/@svg:stroke-color"/>
+ </图:线颜色>
+ </xsl:if>
+ <图:线型 uof:locID="g0014">
+ <xsl:variable name="linetype" select="style:graphic-properties/@draw:stroke-dash"/>
+ <xsl:choose>
+ <xsl:when test="style:graphic-properties/@fo:border='none'">none</xsl:when>
+ <xsl:when test="not(style:graphic-properties/@draw:stroke)">
+ <xsl:choose>
+ <xsl:when test="not(style:graphic-properties/@svg:stroke-width)">single</xsl:when>
+ <xsl:otherwise>thick</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="style:graphic-properties/@draw:stroke = 'none'">none</xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="$linetype='Fine_20_Dashed' and style:graphic-properties/@svg:stroke-width">dash-long-heavy</xsl:when>
+ <xsl:when test="$linetype='Fine_20_Dashed'">dash-long</xsl:when>
+ <xsl:when test="$linetype='2 Dots 1 Dash' and style:graphic-properties/@svg:stroke-width">dash-dot-dot-heavy</xsl:when>
+ <xsl:when test="$linetype='2 Dots 1 Dash'">dot-dot-dash</xsl:when>
+ <xsl:when test="$linetype='Ultrafine Dashed' and style:graphic-properties/@svg:stroke-width">dashed-heavy</xsl:when>
+ <xsl:when test="$linetype='Ultrafine Dotted (var)'and style:graphic-properties/@svg:stroke-width">dotted-heavy</xsl:when>
+ <xsl:when test="$linetype='Ultrafine Dotted (var)'">dotted</xsl:when>
+ <xsl:when test="$linetype='Line with Fine Dots'">double</xsl:when>
+ <xsl:when test="$linetype='3 Dashes 3 Dots (var)' and style:graphic-properties/@svg:stroke-width">dash-dot-heavy</xsl:when>
+ <xsl:when test="$linetype='3 Dashes 3 Dots (var)'">dot-dash</xsl:when>
+ <xsl:when test="$linetype='Ultrafine 2 Dots 3 Dashes'and style:graphic-properties/@svg:stroke-width">wavy-heavy</xsl:when>
+ <xsl:when test="$linetype='Ultrafine 2 Dots 3 Dashes'">wave</xsl:when>
+ <xsl:when test="$linetype='Fine Dashed (var)'">wavy-double</xsl:when>
+ <xsl:otherwise>dash</xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </图:线型>
+ <xsl:if test="style:graphic-properties/@svg:stroke-width">
+ <图:线粗细 uof:locID="g0016">
+ <xsl:value-of select="substring-before(style:graphic-properties/@svg:stroke-width,$uofUnit)"/>
+ </图:线粗细>
+ </xsl:if>
+ <xsl:if test="style:graphic-properties/@draw:marker-start and string-length(style:graphic-properties/@draw:marker-start)&gt;0">
+ <图:å‰ç«¯ç®­å¤´ uof:locID="g0017">
+ <图:å¼æ · uof:locID="g0018">
+ <xsl:choose>
+ <xsl:when test="style:graphic-properties/@draw:marker-start='Arrow'">normal</xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:marker-start='Line Arrow'">open</xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:marker-start='Arrow concave'">stealth</xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:marker-start='Circle'">oval</xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:marker-start='Square 45'">diamond</xsl:when>
+ <xsl:otherwise>normal</xsl:otherwise>
+ </xsl:choose>
+ </图:å¼æ ·>
+ <图:å¤§å° uof:locID="g0019">
+ <xsl:choose>
+ <xsl:when test="not(style:graphic-properties/@draw:marker-start-width)">4</xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="graphsize">
+ <xsl:with-param name="width" select="substring-before(style:graphic-properties/@draw:marker-start-width,$uofUnit)"/>
+ <xsl:with-param name="Unitofsize" select="$uofUnit"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </图:大å°>
+ </图:å‰ç«¯ç®­å¤´>
+ </xsl:if>
+ <xsl:if test="style:graphic-properties/@draw:marker-end">
+ <图:åŽç«¯ç®­å¤´ uof:locID="g0017">
+ <图:å¼æ · uof:locID="g0018">
+ <xsl:choose>
+ <xsl:when test="style:graphic-properties/@draw:marker-end='Arrow'">normal</xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:marker-end='Line Arrow'">open</xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:marker-end='Arrow concave'">stealth</xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:marker-end='Circle'">oval</xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:marker-end='Square 45'">diamond</xsl:when>
+ <xsl:otherwise>normal</xsl:otherwise>
+ </xsl:choose>
+ </图:å¼æ ·>
+ <图:å¤§å° uof:locID="g0022">
+ <xsl:choose>
+ <xsl:when test="not(style:properties/@draw:marker-start-width)">4</xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="width">
+ <xsl:value-of select="substring-before(style:graphic-properties/@draw:marker-end-width,$uofUnit)"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="(not($width&gt;0.05) and 0&lt;$width) or $width=0.05">1</xsl:when>
+ <xsl:when test="(not($width&gt;0.10) and 0.05&lt;$width) or $width=0.10">2</xsl:when>
+ <xsl:when test="(not($width&gt;0.15) and 0.10&lt;$width) or $width=0.15">3</xsl:when>
+ <xsl:when test="(not($width&gt;0.20) and 0.15&lt;$width) or $width=0.20">4</xsl:when>
+ <xsl:when test="(not($width&gt;0.25) and 0.20&lt;$width) or $width=0.25">5</xsl:when>
+ <xsl:when test="(not($width&gt;0.30) and 0.25&lt;$width) or $width=0.30">6</xsl:when>
+ <xsl:when test="(not($width&gt;0.35) and 0.30&lt;$width) or $width=0.35">7</xsl:when>
+ <xsl:when test="(not($width&gt;0.40) and 0.35&lt;$width) or $width=0.40">8</xsl:when>
+ <xsl:otherwise>9</xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </图:大å°>
+ </图:åŽç«¯ç®­å¤´>
+ </xsl:if>
+ <xsl:if test="style:graphic-properties/@draw:opacity or style:graphic-properties/@draw:transparency">
+ <图:é€æ˜Žåº¦ uof:locID="g0038">
+ <xsl:choose>
+ <xsl:when test="style:graphic-properties/@draw:transparency">
+ <xsl:value-of select="substring-before(style:graphic-properties/@draw:transparency,'%')"/>
+ </xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:opacity">
+ <xsl:value-of select="100 - substring-before(style:graphic-properties/@draw:opacity,'%')"/>
+ </xsl:when>
+ </xsl:choose>
+ </图:é€æ˜Žåº¦>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:choose>
+ <xsl:when test="@svg:x1">
+ <图:宽度 uof:locID="g0023">
+ <xsl:value-of select="substring-before(@svg:x2,$uofUnit) - substring-before(@svg:x1,$uofUnit)"/>
+ </图:宽度>
+ <图:高度 uof:locID="g0024">
+ <xsl:value-of select="substring-before(@svg:y2,$uofUnit) - substring-before(@svg:y1,$uofUnit)"/>
+ </图:高度>
+ </xsl:when>
+ <xsl:when test="@svg:x">
+ <图:宽度 uof:locID="g0023">
+ <xsl:value-of select="substring-before(@svg:width,$uofUnit)"/>
+ </图:宽度>
+ <图:高度 uof:locID="g0024">
+ <xsl:value-of select="substring-before(@svg:height,$uofUnit)"/>
+ </图:高度>
+ </xsl:when>
+ <xsl:when test="child::draw:text-box/@fo:min-height">
+ <图:宽度 uof:locID="g0023">
+ <xsl:value-of select="substring-before(@svg:width,$uofUnit)"/>
+ </图:宽度>
+ <图:高度 uof:locID="g0024">
+ <xsl:value-of select="substring-before(child::draw:text-box/@fo:min-height,$uofUnit)"/>
+ </图:高度>
+ </xsl:when>
+ <xsl:when test="@svg:width">
+ <图:宽度 uof:locID="g0023">
+ <xsl:value-of select="substring-before(@svg:width,$uofUnit)"/>
+ </图:宽度>
+ <图:高度 uof:locID="g0024">
+ <xsl:value-of select="substring-before(@svg:height,$uofUnit)"/>
+ </图:高度>
+ </xsl:when>
+ </xsl:choose>
+ <图:旋转角度 uof:locID="g0025">
+ <xsl:choose>
+ <xsl:when test="@draw:transform">
+ <xsl:variable name="rotate-angle">
+ <xsl:value-of select="@draw:transform"/>
+ </xsl:variable>
+ <xsl:variable name="rotate-temp">
+ <xsl:value-of select="substring-before(substring-after($rotate-angle,'rotate ('),')')"/>
+ </xsl:variable>
+ <xsl:value-of select="($rotate-temp * 360) div (2 * 3.14159265)"/>
+ </xsl:when>
+ <xsl:otherwise>0.0</xsl:otherwise>
+ </xsl:choose>
+ </图:旋转角度>
+ <图:X-缩放比例 uof:locID="g0026">1</图:X-缩放比例>
+ <图:Y-缩放比例 uof:locID="g0027">1</图:Y-缩放比例>
+ <图:é”定纵横比 uof:locID="g0028">0</图:é”定纵横比>
+ <图:相对原始比例 uof:locID="g0029">1</图:相对原始比例>
+ <图:打å°å¯¹è±¡ uof:locID="g0032">true</图:打å°å¯¹è±¡>
+ <图:Web文字 uof:locID="g0033"/>
+ </图:属性>
+ </图:预定义图形>
+ </xsl:when>
+ <xsl:when test="name()='draw:path'">
+ <图:svg图形对象 图:version="1.1" 图:xmlns_xlink="http://www.w3.org/1999/xlink">
+ <xsl:attribute name="图:x"><xsl:value-of select="@svg:x"/></xsl:attribute>
+ <xsl:attribute name="图:y"><xsl:value-of select="@svg:y"/></xsl:attribute>
+ <xsl:attribute name="图:width"><xsl:value-of select="@svg:width"/></xsl:attribute>
+ <xsl:attribute name="图:height"><xsl:value-of select="@svg:height"/></xsl:attribute>
+ <xsl:attribute name="图:viewBox"><xsl:value-of select="@svg:viewBox"/></xsl:attribute>
+ <图:path>
+ <xsl:attribute name="图:d"><xsl:value-of select="@svg:d"/></xsl:attribute>
+ </图:path>
+ </图:svg图形对象>
+ </xsl:when>
+ </xsl:choose>
+ <图:文本内容 uof:locID="g0002" uof:attrList="文本框 å·¦è¾¹è· å³è¾¹è· ä¸Šè¾¹è· ä¸‹è¾¹è· æ°´å¹³å¯¹é½ åž‚ç›´å¯¹é½ æ–‡å­—æŽ’åˆ—æ–¹å‘ è‡ªåŠ¨æ¢è¡Œ 大å°é€‚应文字 å‰ä¸€é“¾æŽ¥ åŽä¸€é“¾æŽ¥">
+ <xsl:if test="./draw:text-box">
+ <xsl:attribute name="图:文本框">true</xsl:attribute>
+ <xsl:if test="./@draw:name = /office:document/office:body/office:text//draw:text-box/@draw:chain-next-name">
+ <xsl:attribute name="图:å‰ä¸€é“¾æŽ¥"><xsl:variable name="drawname"><xsl:value-of select="./@draw:name"/></xsl:variable><xsl:variable name="befor-link-name"><xsl:value-of select="/office:document/office:body/office:text//draw:text-box[@draw:name=$drawname]/@draw:style-name"/></xsl:variable><xsl:value-of select="concat($befor-link-name,'_',$picnumber)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="./@draw:chain-next-name">
+ <xsl:attribute name="图:åŽä¸€é“¾æŽ¥"><xsl:variable name="next-link"><xsl:value-of select="./@draw:chain-next-name"/></xsl:variable><xsl:variable name="link-name"><xsl:value-of select="/office:document/office:body/office:text//draw:text-box[@draw:name=$next-link]/@draw:style-name"/></xsl:variable><xsl:value-of select="concat($link-name,'_',$picnumber)"/></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:for-each select="(/office:document/office:styles/descendant::*[@style:name=$pic-name]) | (/office:document/office:automatic-styles/descendant::*[@style:name=$pic-name]) ">
+ <xsl:if test="style:text-properties/@fo:padding-left">
+ <xsl:attribute name="图:左边è·"><xsl:value-of select="style:text-properties/@fo:padding-left"/></xsl:attribute>
+ <xsl:attribute name="图:å³è¾¹è·"><xsl:value-of select="style:text-properties/@fo:padding-right"/></xsl:attribute>
+ <xsl:attribute name="图:上边è·"><xsl:value-of select="style:text-properties/@fo:padding-top"/></xsl:attribute>
+ <xsl:attribute name="图:下边è·"><xsl:value-of select="style:text-properties/@fo:padding-bottom"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="图:文字排列方å‘"><xsl:choose><xsl:when test="style:paragraph-properties/@style:writing-mode"><xsl:choose><xsl:when test="style:paragraph-properties/@style:writing-mode='tb-lr'">vert-l2r</xsl:when><xsl:when test="style:paragraph-properties/@style:writing-mode='tb-rl'">vert-r2l</xsl:when></xsl:choose></xsl:when><xsl:when test="style:graphic-properties/@style:writing-mode='tb-lr'">vert-l2r</xsl:when><xsl:when test="style:graphic-properties/@style:writing-mode='tb-rl'">vert-r2l</xsl:when><xsl:when test="style:paragraph-properties/@draw:textarea-horizontal-align='right'">hori-r2l</xsl:when><xsl:otherwise>hori-l2r</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="style:text-properties/@fo:wrap-option">
+ <xsl:attribute name="图:自动æ¢è¡Œ">true</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:graphic-properties/@draw:textarea-horizontal-align">
+ <xsl:attribute name="图:水平对é½"><xsl:value-of select="style:graphic-properties/@draw:textarea-horizontal-align"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:graphic-properties/@draw:textarea-vertical-align">
+ <xsl:attribute name="图:垂直对é½"><xsl:value-of select="style:graphic-properties/@draw:textarea-vertical-align"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:graphic-properties/@draw:auto-grow-width='true' and style:graphic-properties/@draw:auto-grow-height='true'">
+ <xsl:attribute name="图:大å°é€‚应文字"><xsl:choose><xsl:when test="style:graphic-properties/@draw:auto-grow-width='true' and style:graphic-properties/@draw:auto-grow-height='true'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:for-each select="text:p">
+ <å­—:æ®µè½ uof:locID="t0051" uof:attrList="标识符">
+ <xsl:if test="style:paragraph-properties">
+ <å­—:段è½å±žæ€§ uof:locID="t0052" uof:attrList="å¼æ ·å¼•ç”¨">
+ <xsl:apply-templates select="style:paragraph-properties"/>
+ </å­—:段è½å±žæ€§>
+ </xsl:if>
+ <xsl:call-template name="textp"/>
+ </å­—:段è½>
+ </xsl:for-each>
+ <xsl:for-each select="draw:text-box/text:p">
+ <å­—:æ®µè½ uof:locID="t0051" uof:attrList="标识符">
+ <xsl:if test="style:paragraph-properties">
+ <å­—:段è½å±žæ€§ uof:locID="t0052" uof:attrList="å¼æ ·å¼•ç”¨">
+ <xsl:apply-templates select="style:paragraph-properties"/>
+ </å­—:段è½å±žæ€§>
+ </xsl:if>
+ <xsl:call-template name="textp"/>
+ </å­—:段è½>
+ </xsl:for-each>
+ </图:文本内容>
+ <xsl:if test="@svg:x and @svg:y">
+ <图:控制点 uof:locID="g0003" uof:attrList="xåæ ‡ yåæ ‡">
+ <xsl:attribute name="图:xåæ ‡"><xsl:value-of select="substring-before(@svg:x,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="图:yåæ ‡"><xsl:value-of select="substring-before(@svg:y,$uofUnit)"/></xsl:attribute>
+ </图:控制点>
+ </xsl:if>
+ </图:图形>
+ <xsl:if test="name()='draw:frame' and ./draw:image">
+ <uof:其他对象 uof:locID="u0036" uof:attrList="标识符 内嵌 公共类型 ç§æœ‰ç±»åž‹">
+ <xsl:attribute name="uof:标识符"><xsl:value-of select="concat($pic-name,'_',$picnumber)"/></xsl:attribute>
+ <xsl:attribute name="uof:内嵌">true</xsl:attribute>
+ <xsl:variable name="pic">
+ <xsl:choose>
+ <xsl:when test="contains(./draw:image/@xlink:href,'.png')">png</xsl:when>
+ <xsl:when test="contains(./draw:image/@xlink:href,'.jpg')">jpg</xsl:when>
+ <xsl:when test="contains(./draw:image/@xlink:href,'.gif')">gif</xsl:when>
+ <xsl:when test="contains(./draw:image/@xlink:href,'.bmp')">bmp</xsl:when>
+ <xsl:when test="contains(./draw:image/@xlink:href,'.pbm')">pbm</xsl:when>
+ <xsl:when test="contains(./draw:image/@xlink:href,'.ras')">ras</xsl:when>
+ <xsl:when test="contains(./draw:image/@xlink:href,'.txt')">text</xsl:when>
+ <xsl:when test="contains(./draw:image/@xlink:href,'.xml')">xml</xsl:when>
+ <xsl:when test="contains(./draw:image/@xlink:href,'.htm')">html</xsl:when>
+ <xsl:when test="contains(./draw:image/@xlink:href,'.html')">html</xsl:when>
+ <xsl:when test="contains(./draw:image/@xlink:href,'.wav')">wav</xsl:when>
+ <xsl:when test="contains(./draw:image/@xlink:href,'.mid')">midi</xsl:when>
+ <xsl:when test="contains(./draw:image/@xlink:href,'.ra')">ra</xsl:when>
+ <xsl:when test="contains(./draw:image/@xlink:href,'.au')">au</xsl:when>
+ <xsl:when test="contains(./draw:image/@xlink:href,'.mp3')">mp3</xsl:when>
+ <xsl:when test="contains(./draw:image/@xlink:href,'.snd')">snd</xsl:when>
+ <xsl:when test="contains(./draw:image/@xlink:href,'.svg')">svg</xsl:when>
+ <xsl:when test="contains(./draw:image/@xlink:href,'.avi')">avi</xsl:when>
+ <xsl:when test="contains(./draw:image/@xlink:href,'.mpeg')">mpeg4</xsl:when>
+ <xsl:when test="contains(./draw:image/@xlink:href,'.qt')">qt</xsl:when>
+ <xsl:when test="contains(./draw:image/@xlink:href,'.rm')">rm</xsl:when>
+ <xsl:when test="contains(./draw:image/@xlink:href,'.asf')">asf</xsl:when>
+ <xsl:otherwise>图片</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$pic!='图片'">
+ <xsl:attribute name="uof:公共类型"><xsl:value-of select="$pic"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="uof:ç§æœ‰ç±»åž‹">图片</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="./draw:image/office:binary-data">
+ <uof:æ•°æ® uof:locID="u0037">
+ <xsl:value-of select="./draw:image/office:binary-data"/>
+ </uof:æ•°æ®>
+ </xsl:if>
+ <xsl:if test="./draw:image/@xlink:href">
+ <uof:路径 uof:locID="u0038">
+ <xsl:value-of select="./draw:image/@xlink:href"/>
+ </uof:路径>
+ </xsl:if>
+ </uof:其他对象>
+ </xsl:if>
+ <xsl:for-each select="(/office:document/office:styles/descendant::*[@style:name=$pic-name]) | (/office:document/office:automatic-styles/descendant::*[@style:name=$pic-name]) ">
+ <xsl:if test="style:text-properties/@draw:fill-image-name">
+ <uof:其他对象 uof:locID="u0036" uof:attrList="标识符 内嵌 公共类型 ç§æœ‰ç±»åž‹">
+ <xsl:attribute name="uof:标识符"><xsl:value-of select="concat($pic-name,'-b1')"/></xsl:attribute>
+ <xsl:attribute name="uof:公共类型">png</xsl:attribute>
+ <xsl:attribute name="uof:内嵌">true</xsl:attribute>
+ <xsl:variable name="fill-name">
+ <xsl:value-of select="style:text-properties/@draw:fill-image-name"/>
+ </xsl:variable>
+ <uof:æ•°æ® uof:locID="u0037">
+ <xsl:for-each select="/office:document/office:styles/draw:fill-image[@draw:name=$fill-name]">
+ <xsl:value-of select="office:binary-data"/>
+ </xsl:for-each>
+ </uof:æ•°æ®>
+ <uof:路径 uof:locID="u0038">
+ <xsl:value-of select="@xlink:href"/>
+ </uof:路径>
+ </uof:其他对象>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="draw:points">
+ <xsl:param name="point"/>
+ <xsl:param name="lujing"/>
+ <xsl:choose>
+ <xsl:when test="contains($point,' ' )">
+ <xsl:variable name="first-point" select="substring-before($point,' ')"/>
+ <xsl:variable name="other-point" select="substring-after($point,' ')"/>
+ <xsl:variable name="xzuobiao">
+ <xsl:value-of select="substring-before($first-point,',') div 1000"/>
+ </xsl:variable>
+ <xsl:variable name="yzuobiao">
+ <xsl:value-of select="substring-after($first-point,',') div 1000"/>
+ </xsl:variable>
+ <xsl:call-template name="draw:points">
+ <xsl:with-param name="point" select="$other-point"/>
+ <xsl:with-param name="lujing" select="concat($lujing,$xzuobiao,' ',$yzuobiao,'lineto')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="xzuobiao">
+ <xsl:value-of select="substring-before($point,',') div 1000"/>
+ </xsl:variable>
+ <xsl:variable name="yzuobiao">
+ <xsl:value-of select="substring-after($point,',') div 1000"/>
+ </xsl:variable>
+ <xsl:value-of select="concat($lujing,$xzuobiao,' ',$yzuobiao)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="office:meta">
+ <uof:å…ƒæ•°æ® uof:locID="u0001">
+ <uof:标题 uof:locID="u0002">
+ <xsl:value-of select="dc:title"/>
+ </uof:标题>
+ <uof:åˆ›å»ºåº”ç”¨ç¨‹åº uof:locID="u0011">
+ <xsl:value-of select="meta:generator"/>
+ </uof:创建应用程åº>
+ <uof:æ‘˜è¦ uof:locID="u0007">
+ <xsl:value-of select="dc:description"/>
+ </uof:摘è¦>
+ <uof:主题 uof:locID="u0003">
+ <xsl:value-of select="dc:subject"/>
+ </uof:主题>
+ <uof:创建者 uof:locID="u0004">
+ <xsl:value-of select="meta:initial-creator"/>
+ </uof:创建者>
+ <!--uof:作者 uof:locID="u0005">
+ <xsl:value-of select="meta:initial-creator"/>
+ </uof:作者-->
+ <uof:创建日期 uof:locID="u0008">
+ <xsl:value-of select="meta:creation-date"/>
+ </uof:创建日期>
+ <uof:最åŽä½œè€… uof:locID="u0006">
+ <xsl:value-of select="dc:creator"/>
+ </uof:最åŽä½œè€…>
+ <uof:关键字集 uof:locID="u0014">
+ <xsl:for-each select=".">
+ <uof:关键字 uof:locID="u0015">
+ <xsl:value-of select="meta:keywords/@meta:keyword"/>
+ </uof:关键字>
+ </xsl:for-each>
+ </uof:关键字集>
+ <uof:编辑次数 uof:locID="u0009">
+ <xsl:value-of select="meta:editing-cycles"/>
+ </uof:编辑次数>
+ <xsl:if test="meta:editing-duration">
+ <uof:编辑时间 uof:locID="u0010">
+ <xsl:value-of select="meta:editing-duration"/>
+ </uof:编辑时间>
+ </xsl:if>
+ <xsl:if test="meta:template/@xlink:href">
+ <uof:æ–‡æ¡£æ¨¡æ¿ uof:locID="u0013">
+ <xsl:value-of select="meta:template/@xlink:href"/>
+ </uof:文档模æ¿>
+ </xsl:if>
+ <xsl:if test="meta:user-defined/@meta:name">
+ <uof:用户自定义元数æ®é›† uof:locID="u0016">
+ <xsl:for-each select="meta:user-defined">
+ <uof:ç”¨æˆ·è‡ªå®šä¹‰å…ƒæ•°æ® uof:locID="u0017" uof:attrList="å称 类型">
+ <xsl:attribute name="uof:å称"><xsl:value-of select="@meta:name"/></xsl:attribute>
+ <xsl:attribute name="uof:类型"><xsl:value-of select="'string'"/></xsl:attribute>
+ </uof:用户自定义元数æ®>
+ </xsl:for-each>
+ </uof:用户自定义元数æ®é›†>
+ </xsl:if>
+ <!--xsl:if test="meta:document-statistic/@meta:page-count"-->
+ <uof:页数 uof:locID="u0020">
+ <xsl:value-of select="meta:document-statistic/@meta:page-count"/>
+ </uof:页数>
+ <!--/xsl:if-->
+ <!--xsl:if test="meta:document-statistic/@meta:paragraph-count"-->
+ <uof:段è½æ•° uof:locID="u0025">
+ <xsl:value-of select="meta:document-statistic/@meta:paragraph-count"/>
+ </uof:段è½æ•°>
+ <!--/xsl:if-->
+ <!--xsl:if test="meta:document-statistic/@meta:object-count"-->
+ <uof:对象数 uof:locID="u0026">
+ <xsl:value-of select="meta:document-statistic/@meta:object-count"/>
+ </uof:对象数>
+ <!--/xsl:if-->
+ <!--xsl:if test="meta:document-statistic/@meta:character-count"-->
+ <uof:å­—æ•° uof:locID="u0021">
+ <xsl:value-of select="meta:document-statistic/@meta:character-count"/>
+ </uof:å­—æ•°>
+ <!--/xsl:if-->
+ <!--xsl:if test="meta:document-statistic/@meta:word-count"-->
+ <uof:中文字符数 uof:locID="u0023">
+ <xsl:value-of select="meta:document-statistic/@meta:word-count"/>
+ </uof:中文字符数>
+ <!--/xsl:if-->
+ <uof:英文字符数 uof:locID="u0022">
+ <xsl:value-of select="meta:document-statistic/@meta:character-count - meta:document-statistic/@meta:word-count"/>
+ </uof:英文字符数>
+ <uof:行数 uof:locID="u0024">
+ <xsl:variable name="quzhi">
+ <xsl:value-of select="(meta:document-statistic/@meta:character-count div 39) + 0.9"/>
+ </xsl:variable>
+ <xsl:value-of select="substring-before($quzhi,'.')"/>
+ </uof:行数>
+ <uof:分类 uof:locID="u0012">
+ <xsl:value-of select="meta:user-defined[@meta:name='Category']"/>
+ </uof:分类>
+ <uof:ç»ç†å称 uof:locID="u0019">
+ <xsl:value-of select="meta:user-defined[meta:name='Manager']"/>
+ </uof:ç»ç†å称>
+ <uof:å…¬å¸å称 uof:locID="u0018">
+ <xsl:value-of select="meta:user-defined[meta:name='Company']"/>
+ </uof:å…¬å¸å称>
+ </uof:元数æ®>
+ </xsl:template>
+ <xsl:template match="office:font-face-decls">
+ <uof:字体集 uof:locID="u0040">
+ <xsl:for-each select="style:font-face">
+ <xsl:element name="uof:字体声明">
+ <xsl:attribute name="uof:attrList">标识符 å称 字体æ—</xsl:attribute>
+ <xsl:attribute name="uof:locID">u0041</xsl:attribute>
+ <xsl:attribute name="uof:å称"><xsl:value-of select="@svg:font-family"/></xsl:attribute>
+ <xsl:attribute name="uof:标识符"><xsl:value-of select="translate(@style:name,' ','_')"/></xsl:attribute>
+ <xsl:if test="@style:font-charset= '02'">
+ <xsl:attribute name="uof:字符集">x-symbol</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@style:font-family-generic">
+ <xsl:choose>
+ <xsl:when test="@style:font-family-generic = 'swiss'">
+ <xsl:attribute name="uof:字体æ—">Swiss</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@style:font-family-generic ='modern'">
+ <xsl:attribute name="uof:字体æ—">Modern</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@style:font-family-generic='roman'">
+ <xsl:attribute name="uof:字体æ—">Roman</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@style:font-family-generic ='script'">
+ <xsl:attribute name="uof:字体æ—">Script</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@style:font-family-generic ='decorative'">
+ <xsl:attribute name="uof:字体æ—">Decorative</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@style:font-family-generic ='system'">
+ <xsl:attribute name="uof:字体æ—">System</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="uof:字体æ—">System</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:element>
+ </xsl:for-each>
+ <xsl:apply-templates select="style:font-decl"/>
+ </uof:字体集>
+ </xsl:template>
+ <xsl:template name="自动编å·é›†">
+ <xsl:element name="uof:自动编å·é›†">
+ <xsl:attribute name="uof:locID">u0042</xsl:attribute>
+ <xsl:for-each select="/office:document//text:list-style">
+ <xsl:element name="å­—:自动编å·">
+ <xsl:attribute name="uof:locID">t0169</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符 å称 父编å·å¼•ç”¨ 多级编å·</xsl:attribute>
+ <xsl:attribute name="字:标识符"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <xsl:if test=".//@text:style-name">
+ <xsl:attribute name="å­—:å称"><xsl:value-of select=".//@text:style-name"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="å­—:多级编å·">true</xsl:attribute>
+ <xsl:for-each select="./* ">
+ <xsl:if test="not(number(@text:level)=10)">
+ <xsl:element name="字:级别">
+ <xsl:attribute name="uof:locID">t0159</xsl:attribute>
+ <xsl:attribute name="uof:attrList">级别值 ç¼–å·å¯¹é½æ–¹å¼ å°¾éšå­—符</xsl:attribute>
+ <xsl:attribute name="字:级别值"><xsl:value-of select="number(@text:level) - 1"/></xsl:attribute>
+ <xsl:if test="@style:num-suffix">
+ <xsl:attribute name="å­—:å°¾éšå­—符"><xsl:choose><xsl:when test="@style:num-suffix=' '">space</xsl:when><xsl:when test="@style:num-suffix=' '">tab</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:list-level-properties/@fo:text-align">
+ <xsl:attribute name="å­—:ç¼–å·å¯¹é½æ–¹å¼"><xsl:variable name="vv"><xsl:value-of select="style:list-level-properties/@fo:text-align"/></xsl:variable><xsl:choose><xsl:when test="$vv='center' ">center</xsl:when><xsl:when test="$vv='end' ">right</xsl:when><xsl:otherwise>left</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@text:bullet-char">
+ <xsl:element name="å­—:项目符å·">
+ <xsl:attribute name="uof:locID">t0171</xsl:attribute>
+ <xsl:value-of select="@text:bullet-char"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="@text:style-name">
+ <xsl:element name="å­—:符å·å­—体">
+ <xsl:attribute name="uof:locID">t0160</xsl:attribute>
+ <xsl:attribute name="uof:attrList">å¼æ ·å¼•ç”¨</xsl:attribute>
+ <xsl:attribute name="å­—:å¼æ ·å¼•ç”¨"><xsl:value-of select="@text:style-name"/></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="@style:num-format">
+ <xsl:choose>
+ <xsl:when test="string(@style:num-format)='a'">
+ <xsl:element name="å­—:ç¼–å·æ ¼å¼">
+ <xsl:attribute name="uof:locID">t0162</xsl:attribute>lower-letter</xsl:element>
+ </xsl:when>
+ <xsl:when test="string(@style:num-format)='A'">
+ <xsl:element name="å­—:ç¼–å·æ ¼å¼">
+ <xsl:attribute name="uof:locID">t0162</xsl:attribute>upper-letter</xsl:element>
+ </xsl:when>
+ <xsl:when test="string(@style:num-format)='i'">
+ <xsl:element name="å­—:ç¼–å·æ ¼å¼">
+ <xsl:attribute name="uof:locID">t0162</xsl:attribute>lower-roman</xsl:element>
+ </xsl:when>
+ <xsl:when test="string(@style:num-format)='I'">
+ <xsl:element name="å­—:ç¼–å·æ ¼å¼">
+ <xsl:attribute name="uof:locID">t0162</xsl:attribute>upper-roman</xsl:element>
+ </xsl:when>
+ <xsl:when test="string(@style:num-format)='â‘ , â‘¡, â‘¢, ...'">
+ <xsl:element name="å­—:ç¼–å·æ ¼å¼">
+ <xsl:attribute name="uof:locID">t0162</xsl:attribute>decimal-enclosed-circle</xsl:element>
+ </xsl:when>
+ <xsl:when test="string(@style:num-format)='甲, 乙, 丙, ...'">
+ <xsl:element name="å­—:ç¼–å·æ ¼å¼">
+ <xsl:attribute name="uof:locID">t0162</xsl:attribute>ideograph-traditional</xsl:element>
+ </xsl:when>
+ <xsl:when test="string(@style:num-format)='å­, 丑, 寅, ...'">
+ <xsl:element name="å­—:ç¼–å·æ ¼å¼">
+ <xsl:attribute name="uof:locID">t0162</xsl:attribute>ideograph-zodiac</xsl:element>
+ </xsl:when>
+ <xsl:when test="string(@style:num-format)='一, 二, 三, ...'">
+ <xsl:element name="å­—:ç¼–å·æ ¼å¼">
+ <xsl:attribute name="uof:locID">t0162</xsl:attribute>chinese-counting</xsl:element>
+ </xsl:when>
+ <xsl:when test="string(@style:num-format)='壹, è´°, å, ...'">
+ <xsl:element name="å­—:ç¼–å·æ ¼å¼">
+ <xsl:attribute name="uof:locID">t0162</xsl:attribute>chinese-legal-simplified</xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="å­—:ç¼–å·æ ¼å¼">
+ <xsl:attribute name="uof:locID">t0162</xsl:attribute>decimal</xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:variable name="jibie">
+ <xsl:value-of select="position()"/>
+ </xsl:variable>
+ <xsl:variable name="xianshijibie">
+ <xsl:choose>
+ <xsl:when test="@text:display-levels">
+ <xsl:value-of select="@text:display-levels"/>
+ </xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:element name="å­—:ç¼–å·æ ¼å¼è¡¨ç¤º">
+ <xsl:attribute name="uof:locID">t0163</xsl:attribute>
+ <xsl:call-template name="å­—:ç¼–å·æ ¼å¼è¡¨ç¤º">
+ <xsl:with-param name="bubianjibie" select="$jibie"/>
+ <xsl:with-param name="jibie" select="$jibie"/>
+ <xsl:with-param name="xianshijibie" select="$xianshijibie"/>
+ <xsl:with-param name="biaoshi" select="concat(string(@style:num-prefix),'%',$jibie,string(@style:num-suffix))"/>
+ </xsl:call-template>
+ </xsl:element>
+ <xsl:if test="office:binary-data">
+ <xsl:element name="å­—:图片符å·å¼•ç”¨">
+ <xsl:attribute name="uof:locID">t0164</xsl:attribute>
+ <xsl:attribute name="uof:attrList">宽度 高度</xsl:attribute>
+ <xsl:if test="style:list-level-properties/@fo:width">
+ <xsl:attribute name="字:宽度"><xsl:value-of select="substring-before(style:list-level-properties/@fo:width,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:list-level-properties/@fo:height">
+ <xsl:attribute name="字:高度"><xsl:value-of select="substring-before(style:list-level-properties/@fo:height,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:value-of select="concat('image_numbering_',count(preceding::text:list-level-style-image))"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:paragraph-properties/@fo:margin-left or style:paragraph-properties/@fo:margin-right or style:paragraph-properties/@fo:text-indent">
+ <xsl:element name="字:缩进">
+ <xsl:attribute name="uof:locID">t0165</xsl:attribute>
+ <xsl:for-each select="style:paragraph-properties">
+ <xsl:call-template name="字:缩进类型"/>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:list-level-properties/@text:min-label-width">
+ <xsl:element name="å­—:制表符ä½ç½®">
+ <xsl:attribute name="uof:locID">t0166</xsl:attribute>
+ <xsl:value-of select="substring-before(style:list-level-properties/@text:min-label-width,$uofUnit)"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="@text:start-value">
+ <xsl:element name="å­—:起始编å·">
+ <xsl:attribute name="uof:locID">t0167</xsl:attribute>
+ <xsl:value-of select="@text:start-value"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="@text:num-regular-exp">
+ <xsl:element name="å­—:正规格å¼">
+ <xsl:attribute name="uof:locID">t0168</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:value-of select="@text:num-regular-exp"/></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="shiyang">
+ <xsl:for-each select="office:styles/style:style">
+ <xsl:choose>
+ <xsl:when test="@style:family='text'">
+ <xsl:element name="uof:å¥å¼æ ·">
+ <xsl:attribute name="uof:locID">u0043</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符 å称 类型 别å 基å¼æ ·å¼•ç”¨ åŽç»§å¼æ ·å¼•ç”¨</xsl:attribute>
+ <xsl:attribute name="字:标识符"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <xsl:attribute name="å­—:å称"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <xsl:attribute name="字:类型">auto</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="@style:parent-style-name">
+ <xsl:attribute name="å­—:基å¼æ ·å¼•ç”¨"><xsl:value-of select="@style:parent-style-name"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="å­—:基å¼æ ·å¼•ç”¨"><xsl:value-of select="@style:name"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:call-template name="å­—:å¥å±žæ€§"/>
+ </xsl:element>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+ <xsl:for-each select="office:automatic-styles/style:style">
+ <xsl:choose>
+ <xsl:when test="@style:family='text'">
+ <xsl:element name="uof:å¥å¼æ ·">
+ <xsl:attribute name="uof:locID">u0043</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符 å称 类型 别å 基å¼æ ·å¼•ç”¨ åŽç»§å¼æ ·å¼•ç”¨</xsl:attribute>
+ <xsl:attribute name="字:标识符"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <xsl:attribute name="å­—:å称"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <xsl:attribute name="字:类型">custom</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="@style:parent-style-name">
+ <xsl:attribute name="å­—:基å¼æ ·å¼•ç”¨"><xsl:value-of select="@style:parent-style-name"/></xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="@style:parent-style-name and not(@style:parent-style-name='Standard')">
+ <xsl:variable name="stylename" select="@style:parent-style-name"/>
+ <xsl:for-each select="/office:document/office:styles/style:style[@style:name=$stylename]">
+ <xsl:call-template name="å­—:å¥å±žæ€§"/>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="å­—:å¥å±žæ€§"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+ <xsl:for-each select="office:styles/style:style">
+ <xsl:choose>
+ <xsl:when test="@style:family='paragraph'">
+ <xsl:element name="uof:段è½å¼æ ·">
+ <xsl:attribute name="uof:locID">u0044</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符 å称 类型 别å 基å¼æ ·å¼•ç”¨ åŽç»§å¼æ ·å¼•ç”¨</xsl:attribute>
+ <xsl:attribute name="字:标识符"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <xsl:attribute name="字:类型">auto</xsl:attribute>
+ <xsl:if test="@style:parent-style-name">
+ <xsl:attribute name="å­—:基å¼æ ·å¼•ç”¨"><xsl:value-of select="@style:parent-style-name"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="å­—:å称"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <xsl:if test="@style:display-name">
+ <xsl:attribute name="å­—:别å"><xsl:value-of select="@style:display-name"/></xsl:attribute>
+ </xsl:if>
+ <xsl:element name="å­—:å¥å±žæ€§">
+ <xsl:attribute name="uof:locID">t0086</xsl:attribute>
+ <xsl:attribute name="uof:attrList">å¼æ ·å¼•ç”¨</xsl:attribute>
+ <xsl:call-template name="å­—:å¥å±žæ€§"/>
+ </xsl:element>
+ <xsl:call-template name="ParaAttribute"/>
+ </xsl:element>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+ <xsl:for-each select="office:automatic-styles/style:style">
+ <xsl:choose>
+ <xsl:when test="@style:family='paragraph'">
+ <xsl:element name="uof:段è½å¼æ ·">
+ <xsl:attribute name="uof:locID">u0044</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符 å称 类型 别å 基å¼æ ·å¼•ç”¨ åŽç»§å¼æ ·å¼•ç”¨</xsl:attribute>
+ <xsl:attribute name="字:标识符"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <xsl:attribute name="字:类型">custom</xsl:attribute>
+ <xsl:if test="@style:parent-style-name">
+ <xsl:attribute name="å­—:基å¼æ ·å¼•ç”¨"><xsl:value-of select="@style:parent-style-name"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="å­—:å称"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <xsl:element name="å­—:å¥å±žæ€§">
+ <xsl:attribute name="uof:locID">t0086</xsl:attribute>
+ <xsl:attribute name="uof:attrList">å¼æ ·å¼•ç”¨</xsl:attribute>
+ <xsl:call-template name="å­—:å¥å±žæ€§"/>
+ </xsl:element>
+ <xsl:call-template name="ParaAttribute"/>
+ </xsl:element>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="å­—:ç¼–å·æ ¼å¼è¡¨ç¤º">
+ <xsl:param name="bubianjibie"/>
+ <xsl:param name="jibie"/>
+ <xsl:param name="xianshijibie"/>
+ <xsl:param name="biaoshi"/>
+ <xsl:choose>
+ <xsl:when test="number($xianshijibie)= 1">
+ <xsl:value-of select="$biaoshi"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="num-prefix">
+ <xsl:value-of select="preceding-sibling::*[number($bubianjibie -$jibie +1)]/@style:num-prefix"/>
+ </xsl:variable>
+ <xsl:variable name="num-suffix">
+ <xsl:value-of select="preceding-sibling::*[number($bubianjibie -$jibie +1)]/@style:num-suffix"/>
+ </xsl:variable>
+ <xsl:call-template name="å­—:ç¼–å·æ ¼å¼è¡¨ç¤º">
+ <xsl:with-param name="bubianjibie" select="$bubianjibie"/>
+ <xsl:with-param name="jibie" select="$jibie -1"/>
+ <xsl:with-param name="xianshijibie" select="$xianshijibie -1"/>
+ <xsl:with-param name="biaoshi" select="concat($num-prefix,'%',number($jibie -1),$num-suffix,'.',$biaoshi)"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="style:style[ancestor::office:automatic-styles]" mode="style">
+ <xsl:for-each select=".">
+ <xsl:choose>
+ <xsl:when test="@style:family='table' ">
+ <xsl:element name="uof:文字表å¼æ ·">
+ <xsl:attribute name="uof:locID">u0045</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符 å称 类型 别å 基å¼æ ·å¼•ç”¨ åŽç»§å¼æ ·å¼•ç”¨</xsl:attribute>
+ <xsl:attribute name="字:标识符"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <xsl:attribute name="å­—:å称"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <xsl:attribute name="å­—:别å"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <xsl:attribute name="字:类型">auto</xsl:attribute>
+ <xsl:if test="style:table-properties">
+ <xsl:element name="字:宽度">
+ <xsl:attribute name="å­—:ç»å¯¹å®½åº¦"><xsl:value-of select="substring-before(style:table-properties/@style:width,$ooUnit)"/></xsl:attribute>
+ <xsl:attribute name="uof:locID">t0130</xsl:attribute>
+ <xsl:attribute name="uof:attrList">ç»å¯¹å®½åº¦ 相对宽度</xsl:attribute>
+ </xsl:element>
+ <å­—:å¯¹é½ uof:locID="t0133">
+ <xsl:choose>
+ <xsl:when test="style:table-properties/@table:align='right'">right</xsl:when>
+ <xsl:when test="style:table-properties/@table:align='center'">center</xsl:when>
+ <xsl:otherwise>left</xsl:otherwise>
+ </xsl:choose>
+ </å­—:对é½>
+ </xsl:if>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template match="office:settings">
+ <字:文档设置 uof:locID="t0001">
+ <å­—:度é‡å•ä½ uof:locID="t0006">
+ <xsl:value-of select="$ooUnit"/>
+ </å­—:度é‡å•ä½>
+ <å­—:默认制表ä½ä½ç½® uof:locID="t0004">
+ <xsl:variable name="aa" select="substring-before(/office:document/office:styles/style:default-style[@style:family='paragraph']/style:paragraph-properties/@style:tab-stop-distance,$ooUnit)"/>
+ <xsl:variable name="bb" select="$aa - 0.74"/>
+ <xsl:value-of select="substring($bb,1,4)"/>
+ </å­—:默认制表ä½ä½ç½®>
+ <å­—:当å‰è§†å›¾ uof:locID="t0002">
+ <xsl:choose>
+ <xsl:when test="config:config-item-set[@config:name='ooo:view-settings']/config:config-item[@config:name='InBrowseMode']='false'">page</xsl:when>
+ <xsl:when test="config:config-item-set[@config:name='ooo:view-settings']/config:config-item[@config:name='InBrowseMode']='true'">web</xsl:when>
+ <xsl:otherwise>page</xsl:otherwise>
+ </xsl:choose>
+ </å­—:当å‰è§†å›¾>
+ <xsl:if test="config:config-item-set[@config:name='ooo:view-settings']/config:config-item-map-indexed[@config:name='Views']/config:config-item-map-entry/config:config-item[@config:name='ZoomFactor']">
+ <字:缩放 uof:locID="t0003">
+ <xsl:value-of select="config:config-item-set[@config:name='ooo:view-settings']/config:config-item-map-indexed[@config:name='Views']/config:config-item-map-entry/config:config-item[@config:name='ZoomFactor']"/>
+ </字:缩放>
+ </xsl:if>
+ <字:修订 uof:locID="t0005">
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test="/office:document/office:body/office:text/text:tracked-changes">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </字:修订>
+ <xsl:if test="config:config-item-set[@config:name='configuration-settings']/config:config-item-map-indexed[@config:name='ForbiddenCharacters']/config:config-item-map-entry[config:config-item='CN']">
+ <å­—:标点ç¦åˆ™ uof:locID="t0007">
+ <字:行首字符 uof:locID="t0008">
+ <xsl:value-of select="config:config-item-set[@config:name='configuration-settings']/config:config-item-map-indexed[@config:name='ForbiddenCharacters']/config:config-item-map-entry[config:config-item='CN']/config:config-item[@config:name='BeginLine']"/>
+ </字:行首字符>
+ <字:行尾字符 uof:locID="t0009">
+ <xsl:value-of select="config:config-item-set[@config:name='configuration-settings']/config:config-item-map-indexed[@config:name='ForbiddenCharacters']/config:config-item-map-entry[config:config-item='CN']/config:config-item[@config:name='EndLine']"/>
+ </字:行尾字符>
+ </å­—:标点ç¦åˆ™>
+ <xsl:if test="/office:document/office:styles/text:notes-configuration[@text:note-class='endnote']">
+ <å­—:尾注ä½ç½® uof:locID="t0210" uof:attrList="ä½ç½®">
+ <xsl:attribute name="å­—:ä½ç½®">doc-end</xsl:attribute>
+ </å­—:尾注ä½ç½®>
+ </xsl:if>
+ </xsl:if>
+ </字:文档设置>
+ </xsl:template>
+ <xsl:template name="style:page-layout">
+ <å­—:分节 uof:locID="t0017" uof:attrList="å称">
+ <xsl:attribute name="å­—:å称"><xsl:variable name="stylename"><xsl:value-of select="@style:name"/></xsl:variable><xsl:value-of select="/office:document/office:master-styles/style:master-page[@style:page-layout-name=$stylename]/@style:name"/></xsl:attribute>
+ <字:节属性 uof:locID="t0018">
+ <字:节类型 uof:locID="t0020">new-page</字:节类型>
+ <xsl:element name="å­—:页边è·">
+ <xsl:attribute name="uof:locID">t0021</xsl:attribute>
+ <xsl:attribute name="uof:attrList">å·¦ 上 å³ ä¸‹</xsl:attribute>
+ <xsl:attribute name="uof:上"><xsl:value-of select="substring-before(style:page-layout-properties/@fo:margin-top,$ooUnit)"/></xsl:attribute>
+ <xsl:attribute name="uof:å·¦"><xsl:value-of select="substring-before(style:page-layout-properties/@fo:margin-left,$ooUnit)"/></xsl:attribute>
+ <xsl:attribute name="uof:下"><xsl:value-of select="substring-before(style:page-layout-properties/@fo:margin-bottom,$ooUnit)"/></xsl:attribute>
+ <xsl:attribute name="uof:å³"><xsl:value-of select="substring-before(style:page-layout-properties/@fo:margin-right,$ooUnit)"/></xsl:attribute>
+ </xsl:element>
+ <xsl:element name="字:纸张">
+ <xsl:attribute name="uof:locID">t0022</xsl:attribute>
+ <xsl:attribute name="uof:attrList">纸型 宽度 高度</xsl:attribute>
+ <xsl:attribute name="uof:宽度"><xsl:value-of select="substring-before(style:page-layout-properties/@fo:page-width,$ooUnit)"/></xsl:attribute>
+ <xsl:attribute name="uof:高度"><xsl:value-of select="substring-before(style:page-layout-properties/@fo:page-height,$ooUnit)"/></xsl:attribute>
+ <xsl:attribute name="uof:纸型"><xsl:variable name="height"><xsl:value-of select="style:page-layout-properties/@fo:page-height"/></xsl:variable><xsl:variable name="width"><xsl:value-of select="style:page-layout-properties/@fo:page-width"/></xsl:variable><xsl:choose><xsl:when test="$width='29.702cm' and $height='42cm'">A3</xsl:when><xsl:when test="$width='21.001cm' and $height='29.7cm'">A4</xsl:when><xsl:when test="$width='14.799cm' and $height='20.999cm'">A5</xsl:when><xsl:when test="$width='25cm' and $height='35.3cm'">B4</xsl:when><xsl:when test="$width='17.598cm' and $height='25cm'">B5</xsl:when><xsl:when test="$width='12.5cm' and $height='17.6cm'">B6</xsl:when><xsl:otherwise>使用者</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ <xsl:if test="/office:document/office:master-styles/style:master-page/style:header-left">
+ <xsl:element name="å­—:奇å¶é¡µé¡µçœ‰é¡µè„šä¸åŒ">
+ <xsl:attribute name="uof:locID">t0023</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值">true</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="å­—:首页页眉页脚ä¸åŒ">
+ <xsl:attribute name="uof:locID">t0024</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值">false</xsl:attribute>
+ </xsl:element>
+ <xsl:if test="style:header-style/style:header-footer-properties">
+ <xsl:element name="å­—:页眉ä½ç½®">
+ <xsl:attribute name="uof:locID">t0025</xsl:attribute>
+ <xsl:attribute name="uof:attrList">è·è¾¹ç•Œ è·ç‰ˆèŠ¯</xsl:attribute>
+ <xsl:attribute name="å­—:è·è¾¹ç•Œ"><xsl:value-of select="substring-before(style:header-style/style:header-footer-properties/@fo:margin-bottom,$ooUnit)"/></xsl:attribute>
+ <xsl:variable name="long1" select="substring-before(style:header-style/style:header-footer-properties/@fo:margin-bottom,$ooUnit)"/>
+ <xsl:variable name="long2" select="substring-before(style:header-style/style:header-footer-properties/@svg:height,$ooUnit)"/>
+ <xsl:attribute name="å­—:è·ç‰ˆèŠ¯"><xsl:value-of select="$long2 - $long1"/></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:footer-style/style:header-footer-properties">
+ <xsl:element name="å­—:页脚ä½ç½®">
+ <xsl:attribute name="uof:locID">t0026</xsl:attribute>
+ <xsl:attribute name="uof:attrList">è·è¾¹ç•Œ è·ç‰ˆèŠ¯</xsl:attribute>
+ <xsl:attribute name="å­—:è·è¾¹ç•Œ"><xsl:value-of select="substring-before(style:footer-style/style:header-footer-properties/@fo:margin-top,$ooUnit)"/></xsl:attribute>
+ <xsl:variable name="long1" select="substring-before(style:footer-style/style:header-footer-properties/@fo:margin-top,$ooUnit)"/>
+ <xsl:variable name="long2" select="substring-before(style:footer-style/style:header-footer-properties/@svg:height,$ooUnit)"/>
+ <xsl:attribute name="å­—:è·ç‰ˆèŠ¯"><xsl:value-of select="$long2 - $long1"/></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:variable name="masterPages" select="'Standard'"/>
+ <xsl:variable name="mp">
+ <xsl:value-of select="@style:name"/>
+ </xsl:variable>
+ <xsl:for-each select="/office:document/office:master-styles/style:master-page[@style:page-layout-name=$mp and @style:name=$masterPages]">
+ <xsl:if test="style:header-left or style:header">
+ <字:页眉 uof:locID="t0027">
+ <xsl:choose>
+ <xsl:when test="style:header-left">
+ <xsl:for-each select="style:header">
+ <字:首页页眉 uof:locID="t0030">
+ <xsl:if test="text:p">
+ <xsl:for-each select="text:p">
+ <xsl:call-template name="execParagraph">
+ <xsl:with-param name="currlistlvl" select="number('0')"/>
+ <xsl:with-param name="liststylename" select="string('00000')"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:if test="table:table">
+ <xsl:for-each select="table:table">
+ <xsl:call-template name="exec_table"/>
+ </xsl:for-each>
+ </xsl:if>
+ </字:首页页眉>
+ </xsl:for-each>
+ <xsl:for-each select="style:header-left">
+ <å­—:å¶æ•°é¡µé¡µçœ‰ uof:locID="t0029">
+ <xsl:if test="text:p">
+ <xsl:for-each select="text:p">
+ <xsl:call-template name="execParagraph">
+ <xsl:with-param name="currlistlvl" select="number('0')"/>
+ <xsl:with-param name="liststylename" select="string('00000')"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:if test="table:table">
+ <xsl:for-each select="table:table">
+ <xsl:call-template name="exec_table"/>
+ </xsl:for-each>
+ </xsl:if>
+ </å­—:å¶æ•°é¡µé¡µçœ‰>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:for-each select="style:header">
+ <字:奇数页页眉 uof:locID="t0028">
+ <xsl:if test="text:p">
+ <xsl:for-each select="text:p">
+ <xsl:call-template name="execParagraph">
+ <xsl:with-param name="currlistlvl" select="number('0')"/>
+ <xsl:with-param name="liststylename" select="string('00000')"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:if test="table:table">
+ <xsl:for-each select="table:table">
+ <xsl:call-template name="exec_table"/>
+ </xsl:for-each>
+ </xsl:if>
+ </字:奇数页页眉>
+ </xsl:for-each>
+ </xsl:otherwise>
+ </xsl:choose>
+ </字:页眉>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:for-each select="/office:document/office:master-styles/style:master-page[@style:page-layout-name=$mp and @style:name=$masterPages]">
+ <xsl:if test="style:footer-left or style:footer">
+ <字:页脚 uof:locID="t0031">
+ <xsl:choose>
+ <xsl:when test="style:footer-left">
+ <xsl:for-each select="style:footer">
+ <字:首页页脚 uof:locID="t0034">
+ <xsl:if test="text:p">
+ <xsl:for-each select="text:p">
+ <xsl:call-template name="execParagraph">
+ <xsl:with-param name="currlistlvl" select="number('0')"/>
+ <xsl:with-param name="liststylename" select="string('00000')"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:if test="table:table">
+ <xsl:for-each select="table:table">
+ <xsl:call-template name="exec_table"/>
+ </xsl:for-each>
+ </xsl:if>
+ </字:首页页脚>
+ </xsl:for-each>
+ <xsl:for-each select="style:footer-left">
+ <å­—:å¶æ•°é¡µé¡µè„š uof:locID="t0033">
+ <xsl:if test="text:p">
+ <xsl:for-each select="text:p">
+ <xsl:call-template name="execParagraph">
+ <xsl:with-param name="currlistlvl" select="number('0')"/>
+ <xsl:with-param name="liststylename" select="string('00000')"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:if test="table:table">
+ <xsl:for-each select="table:table">
+ <xsl:call-template name="exec_table"/>
+ </xsl:for-each>
+ </xsl:if>
+ </å­—:å¶æ•°é¡µé¡µè„š>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:for-each select="style:footer">
+ <字:奇数页页脚 uof:locID="t0032">
+ <xsl:if test="text:p">
+ <xsl:for-each select="text:p">
+ <xsl:call-template name="execParagraph">
+ <xsl:with-param name="currlistlvl" select="number('0')"/>
+ <xsl:with-param name="liststylename" select="string('00000')"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:if test="table:table">
+ <xsl:for-each select="table:table">
+ <xsl:call-template name="exec_table"/>
+ </xsl:for-each>
+ </xsl:if>
+ </字:奇数页页脚>
+ </xsl:for-each>
+ </xsl:otherwise>
+ </xsl:choose>
+ </字:页脚>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:if test="@style:page-usage">
+ <å­—:å¯¹ç§°é¡µè¾¹è· uof:locID="t0036" uof:attrList="值">
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test="@style:page-usage='mirrored'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </å­—:对称页边è·>
+ </xsl:if>
+ <xsl:if test="@style:page-usage='mirrored'">
+ <xsl:element name="字:拼页">
+ <xsl:attribute name="uof:locID">t0037</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值">1</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="å­—:纸张方å‘">
+ <xsl:attribute name="uof:locID">t0038</xsl:attribute>
+ <xsl:value-of select="style:page-layout-properties/@style:print-orientation"/>
+ </xsl:element>
+ <xsl:if test="style:page-layout-properties/@style:paper-tray-name">
+ <å­—:纸张æ¥æº uof:locID="t0039" uof:attrList="首页 其他页" å­—:首页="false" å­—:其他页="style:page-layout-properties/@style:paper-tray-name"/>
+ </xsl:if>
+ <xsl:if test="style:page-layout-properties/@style:num-format">
+ <xsl:element name="å­—:页ç è®¾ç½®">
+ <xsl:attribute name="uof:locID">t0042</xsl:attribute>
+ <xsl:attribute name="uof:attrList">首页显示 æ ¼å¼ åŒ…å«ç« èŠ‚å· ç« èŠ‚èµ·å§‹æ ·å¼å¼•ç”¨ 分隔符 起始编å·</xsl:attribute>
+ <xsl:attribute name="字:首页显示">1</xsl:attribute>
+ <xsl:attribute name="å­—:æ ¼å¼"><xsl:variable name="format"><xsl:value-of select="style:page-layout-properties/@style:num-format"/></xsl:variable><xsl:call-template name="ooæ•°å­—æ ¼å¼"><xsl:with-param name="oo_format" select="$format"/></xsl:call-template></xsl:attribute>
+ <xsl:if test="style:text-properties/@style:first-page-number">
+ <xsl:attribute name="å­—:起始编å·"><xsl:value-of select="style:text-properties/@style:first-page-number"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="å­—:包å«ç« èŠ‚å·">false</xsl:attribute>
+ <!--xsl:attribute name="å­—:章节起始样å¼å¼•ç”¨">false</xsl:attribute-->
+ <xsl:attribute name="字:分隔符">hyphen</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="/office:document/office:styles/text:notes-configuration[@text:note-class='footnote']">
+ <xsl:element name="字:脚注设置">
+ <xsl:attribute name="uof:locID">t0040</xsl:attribute>
+ <xsl:attribute name="uof:attrList">ä½ç½® æ ¼å¼ èµ·å§‹ç¼–å· ç¼–å·æ–¹å¼</xsl:attribute>
+ <xsl:for-each select="/office:document/office:styles/text:notes-configuration[@text:note-class='footnote']">
+ <xsl:attribute name="å­—:ä½ç½®"><xsl:choose><xsl:when test="@text:footnotes-position='page'">page-bottom</xsl:when><xsl:when test="@text:footnotes-position='document'">below-text</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:attribute name="å­—:ç¼–å·æ–¹å¼"><xsl:choose><xsl:when test="@text:start-numbering-at='document'">continuous</xsl:when><xsl:when test="@text:start-numbering-at='chapter'">section</xsl:when><xsl:when test="@text:start-numbering-at='page'">page</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:attribute name="å­—:起始编å·"><xsl:value-of select="@text:start-value + 1"/></xsl:attribute>
+ <xsl:attribute name="å­—:æ ¼å¼"><xsl:variable name="format"><xsl:value-of select="@style:num-format"/></xsl:variable><xsl:call-template name="ooæ•°å­—æ ¼å¼"><xsl:with-param name="oo_format" select="$format"/></xsl:call-template></xsl:attribute>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="/office:document/office:styles/text:notes-configuration[@text:note-class='endnote']">
+ <å­—:尾注设置 uof:locID="t0041" uof:attrList="æ ¼å¼ èµ·å§‹ç¼–å· ç¼–å·æ–¹å¼">
+ <xsl:for-each select="/office:document/office:styles/text:notes-configuration[@text:note-class='endnote']">
+ <xsl:attribute name="å­—:æ ¼å¼"><xsl:variable name="format"><xsl:value-of select="@style:num-format"/></xsl:variable><xsl:call-template name="ooæ•°å­—æ ¼å¼"><xsl:with-param name="oo_format" select="$format"/></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="å­—:起始编å·"><xsl:value-of select="@text:start-value + 1"/></xsl:attribute>
+ </xsl:for-each>
+ </字:尾注设置>
+ </xsl:if>
+ <xsl:if test="/office:document/office:styles/text:linenumbering-configuration">
+ <å­—:è¡Œå·è®¾ç½® uof:locID="t0043" uof:attrList="ä½¿ç”¨è¡Œå· ç¼–å·æ–¹å¼ èµ·å§‹ç¼–å· è·è¾¹ç•Œ è¡Œå·é—´éš”">
+ <xsl:for-each select="/office:document/office:styles/text:linenumbering-configuration">
+ <xsl:choose>
+ <xsl:when test="@text:number-lines='false'">
+ <xsl:attribute name="å­—:使用行å·">false</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="å­—:使用行å·">true</xsl:attribute>
+ <xsl:attribute name="å­—:ç¼–å·æ–¹å¼"><xsl:choose><xsl:when test="@text:count-in-floating-frames='true'">section</xsl:when><xsl:when test="@text:restart-on-page='true'">page</xsl:when><xsl:when test="@text:count-empty-lines='false'"/><xsl:otherwise>continuous</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="@style:num-format">
+ <xsl:attribute name="å­—:起始编å·"><xsl:value-of select="@style:num-format"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@text:offset">
+ <xsl:attribute name="å­—:è·è¾¹ç•Œ"><xsl:value-of select="substring-before(@text:offset,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@text:increment">
+ <xsl:attribute name="å­—:è¡Œå·é—´éš”"><xsl:value-of select="@text:increment"/></xsl:attribute>
+ </xsl:if>
+ </xsl:for-each>
+ </å­—:è¡Œå·è®¾ç½®>
+ </xsl:if>
+ <xsl:variable name="aa">
+ <xsl:value-of select="substring-before(style:page-layout-properties/@style:layout-grid-ruby-height,$ooUnit)"/>
+ </xsl:variable>
+ <xsl:if test="style:page-layout-properties/@style:layout-grid-display and $aa='0' ">
+ <å­—:网格设置 uof:locID="t0044" uof:attrList="网格类型 宽度 高度 显示网格 打å°ç½‘æ ¼">
+ <xsl:if test="style:page-layout-properties/@style:layout-grid-mode">
+ <xsl:attribute name="字:网格类型"><xsl:choose><xsl:when test="style:page-layout-properties/@style:layout-grid-mode='both-nosnap'">line-char</xsl:when><xsl:when test="style:page-layout-properties/@style:layout-grid-mode='both'">char</xsl:when><xsl:when test="style:page-layout-properties/@style:layout-grid-mode='line'">line</xsl:when><xsl:when test="style:page-layout-properties/@style:layout-grid-mode='none'">none</xsl:when></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:page-layout-properties/@style:layout-grid-base-width">
+ <xsl:attribute name="字:宽度"><xsl:value-of select="substring-before(style:page-layout-properties/@style:layout-grid-base-width,$ooUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:page-layout-properties/@style:layout-grid-base-height">
+ <xsl:attribute name="字:高度"><xsl:value-of select="substring-before(style:page-layout-properties/@style:layout-grid-base-height,$ooUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:page-layout-properties/@style:layout-grid-display">
+ <xsl:attribute name="字:显示网格"><xsl:choose><xsl:when test="style:page-layout-properties/@style:layout-grid-display='true'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:page-layout-properties/@style:layout-grid-print">
+ <xsl:attribute name="å­—:打å°ç½‘æ ¼"><xsl:choose><xsl:when test="style:page-layout-properties/@style:layout-grid-print='true'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ </字:网格设置>
+ </xsl:if>
+ <xsl:if test="style:page-layout-properties/@style:layout-grid-display and not($aa = '0')">
+ <å­—:稿纸设置 uof:locID="t0211" uof:attrList="类型 æ ¼å¼ çº¿åž‹ 颜色 æ–¹å‘">
+ <xsl:variable name="mode">
+ <xsl:value-of select="style:page-layout-properties/@style:layout-grid-mode"/>
+ </xsl:variable>
+ <xsl:variable name="ruby">
+ <xsl:value-of select="substring-before(style:page-layout-properties/@style:layout-grid-ruby-height,$ooUnit)"/>
+ </xsl:variable>
+ <xsl:variable name="width">
+ <xsl:value-of select="substring-before(style:page-layout-properties/@style:layout-grid-base-width,$ooUnit)"/>
+ </xsl:variable>
+ <xsl:variable name="height">
+ <xsl:value-of select="substring-before(style:page-layout-properties/@style:layout-grid-base-height,$ooUnit)"/>
+ </xsl:variable>
+ <xsl:attribute name="字:类型"><xsl:choose><xsl:when test="style:page-layout-properties/@style:layout-grid-mode='line'">letter-paper</xsl:when><xsl:when test="style:page-layout-properties/@style:layout-grid-mode='both'">draft-paper</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="style:page-layout-properties/@style:layout-grid-mode">
+ <xsl:attribute name="å­—:æ ¼å¼"><xsl:choose><xsl:when test="$mode='both' and $width='0.728' and $height='0.728' and $ruby='0.496' ">fourth-gear</xsl:when><xsl:when test="$mode='both' and $width='0.584' and $height='0.584' and $ruby='0.64' ">third-gear</xsl:when><xsl:when test="$mode='both' and $width='0.728' and $height='0.728' and $ruby='0.905' ">second-gear</xsl:when><xsl:when test="$mode='both' and $width='0.728' and $height='0.728' and $ruby='1.633' ">first-gear</xsl:when></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:page-layout-properties/@style:layout-grid-color">
+ <xsl:attribute name="字:颜色"><xsl:value-of select="style:page-layout-properties/@style:layout-grid-color"/></xsl:attribute>
+ </xsl:if>
+ </字:稿纸设置>
+ </xsl:if>
+ <xsl:if test="/office:document/office:automatic-styles/style:page-layout/style:page-layout-properties/@style:writing-mode='lr-tb' or style:text-properties/@style:writing-mode='rl-tb'">
+ <å­—:垂直对é½æ–¹å¼ uof:locID="t0045">
+ <xsl:variable name="path" select="/office:document/office:automatic-styles/style:style/style:paragraph-properties"/>
+ <xsl:choose>
+ <xsl:when test="$path/@fo:text-align='start'">top</xsl:when>
+ <xsl:when test="$path/@fo:text-align='end'">bottom</xsl:when>
+ <xsl:when test="$path/@fo:text-align='center'">center</xsl:when>
+ <xsl:otherwise>justified</xsl:otherwise>
+ </xsl:choose>
+ </å­—:垂直对é½æ–¹å¼>
+ </xsl:if>
+ <å­—:æ–‡å­—æŽ’åˆ—æ–¹å‘ uof:locID="t0046">
+ <xsl:variable name="writing_mode">
+ <xsl:value-of select="style:page-layout-properties/@style:writing-mode"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$writing_mode='lr-tb' or $writing_mode='lr'">hori-l2r</xsl:when>
+ <xsl:when test="$writing_mode='rl-tb' or $writing_mode='rl'">hori-r2l</xsl:when>
+ <xsl:when test="$writing_mode='tb-rl'">vert-r2l</xsl:when>
+ <xsl:when test="$writing_mode='tb-lr'">vert-l2r</xsl:when>
+ <xsl:otherwise>hori-l2r</xsl:otherwise>
+ </xsl:choose>
+ </å­—:文字排列方å‘>
+ <xsl:if test="style:page-layout-properties/@fo:border or style:page-layout-properties/@fo:border-top or style:page-layout-properties/@fo:border-bottom or style:page-layout-properties/@fo:border-left or style:page-layout-properties/@fo:border-right or style:page-layout-properties/@style:shadow[.!='none']">
+ <xsl:element name="字:边框">
+ <xsl:attribute name="uof:locID">t0047</xsl:attribute>
+ <xsl:for-each select="style:page-layout-properties">
+ <xsl:call-template name="uof:边框"/>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:page-layout-properties/@fo:background-color">
+ <xsl:element name="å­—:å¡«å……">
+ <xsl:attribute name="uof:locID">t0048</xsl:attribute>
+ <xsl:for-each select="style:page-layout-properties">
+ <xsl:call-template name="图:填充"/>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:page-layout-properties/style:columns">
+ <xsl:element name="å­—:分æ ">
+ <xsl:attribute name="uof:locID">t0049</xsl:attribute>
+ <xsl:attribute name="uof:attrList">æ æ•° 等宽 分隔线 分隔线宽度 分隔线颜色</xsl:attribute>
+ <xsl:if test="//@fo:column-count">
+ <xsl:attribute name="å­—:æ æ•°"><xsl:choose><xsl:when test="//@fo:column-count='0'">1</xsl:when><xsl:otherwise><xsl:value-of select="//@fo:column-count"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:variable name="第一宽度">
+ <xsl:value-of select="style:page-layout-properties/style:columns/style:column/@style:rel-width"/>
+ </xsl:variable>
+ <xsl:variable name="dkm">
+ <xsl:for-each select="style:page-layout-properties/style:columns/style:column">
+ <xsl:if test="$第一宽度 != @style:rel-width">
+ <xsl:value-of select="boolean($第一宽度 = @style:rel-width)"/>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="style:page-layout-properties/style:columns/@fo:column-gap">
+ <xsl:attribute name="字:等宽">true</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="字:等宽">false</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="style:page-layout-properties/style:columns/style:column-sep">
+ <xsl:attribute name="字:分隔线宽度"><xsl:value-of select="substring-before(style:page-layout-properties/style:columns/style:column-sep/@style:width,$ooUnit)"/></xsl:attribute>
+ <xsl:attribute name="字:分隔线颜色"><xsl:value-of select="style:page-layout-properties/style:columns/style:column-sep/@style:color"/></xsl:attribute>
+ <xsl:attribute name="字:分隔线">single</xsl:attribute>
+ </xsl:if>
+ <xsl:for-each select="style:page-layout-properties/style:columns/style:column">
+ <xsl:element name="å­—:æ ">
+ <xsl:variable name="left">
+ <xsl:value-of select="substring-before(@fo:start-indent,$uofUnit)"/>
+ </xsl:variable>
+ <xsl:variable name="right">
+ <xsl:value-of select="substring-before(@fo:end-indent,$uofUnit)"/>
+ </xsl:variable>
+ <xsl:if test="@style:rel-width">
+ <xsl:attribute name="字:宽度"><xsl:value-of select="substring-before(@style:rel-width,'*')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@fo:start-indent or @fo:end-indent">
+ <xsl:choose>
+ <xsl:when test="parent::style:columns/@fo:column-gap">
+ <xsl:attribute name="å­—:é—´è·"><xsl:choose><xsl:when test="$left - $right &gt;0 "><xsl:value-of select="$left - $right"/></xsl:when><xsl:when test="$right - $left &gt; 0 "><xsl:value-of select="$right - $left"/></xsl:when><xsl:otherwise><xsl:value-of select="$right"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="å­—:é—´è·"><xsl:value-of select="$right"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:attribute name="uof:locID">t0050</xsl:attribute>
+ <xsl:attribute name="uof:attrList">宽度 é—´è·</xsl:attribute>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:if>
+ </字:节属性>
+ </字:分节>
+ </xsl:template>
+ <xsl:template match="office:text">
+ <xsl:for-each select="node( )">
+ <xsl:choose>
+ <xsl:when test="name()='text:list'or name()='text:ordered-list'">
+ <xsl:call-template name="unordered-ordered-list">
+ <xsl:with-param name="currlistlvl" select="number('1')"/>
+ <xsl:with-param name="liststylename" select="@text:style-name"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name()='text:p'or name()='text:h'">
+ <xsl:variable name="bs" select="./@text:style-name"/>
+ <xsl:if test="/office:document/office:automatic-styles/style:style[@style:name=$bs]/@style:master-page-name">
+ <xsl:variable name="bs1" select="/office:document/office:automatic-styles/style:style[@style:name=$bs]/@style:master-page-name"/>
+ <xsl:if test="/office:document/office:master-styles/style:master-page[@style:name=$bs1]/@style:page-layout-name">
+ <xsl:variable name="bs2" select="/office:document/office:master-styles/style:master-page[@style:name=$bs1]/@style:page-layout-name"/>
+ <xsl:for-each select="/office:document/office:automatic-styles/style:page-layout[@style:name=$bs2]">
+ <xsl:call-template name="style:page-layout"/>
+ </xsl:for-each>
+ </xsl:if>
+ </xsl:if>
+ <xsl:call-template name="execParagraph">
+ <xsl:with-param name="currlistlvl" select="number('0')"/>
+ <xsl:with-param name="liststylename" select="string('00000')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name()='table:table'">
+ <xsl:variable name="tbs" select="./@table:style-name"/>
+ <xsl:if test="/office:document/office:automatic-styles/style:style[@style:name=$tbs]/@style:master-page-name">
+ <xsl:variable name="tbs1" select="/office:document/office:automatic-styles/style:style[@style:name=$tbs]/@style:master-page-name"/>
+ <xsl:if test="/office:document/office:master-styles/style:master-page[@style:name=$tbs1]/@style:page-layout-name">
+ <xsl:variable name="tbs2" select="/office:document/office:master-styles/style:master-page[@style:name=$tbs1]/@style:page-layout-name"/>
+ <xsl:for-each select="/office:document/office:automatic-styles/style:page-layout[@style:name=$tbs2]">
+ <xsl:call-template name="style:page-layout"/>
+ </xsl:for-each>
+ </xsl:if>
+ </xsl:if>
+ <xsl:call-template name="exec_table"/>
+ </xsl:when>
+ <xsl:when test="name()='text:table-of-content'">
+ <xsl:call-template name="text:table-of-content"/>
+ </xsl:when>
+ <xsl:when test="name()='text:alphabetical-index'">
+ <xsl:call-template name="text:alphabetical-index"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="jiaozhu">
+ <字:脚注 uof:locID="t0107" uof:attrList="引文体">
+ <xsl:for-each select="text:note-citation">
+ <xsl:attribute name="字:引文体"><xsl:value-of select="."/></xsl:attribute>
+ </xsl:for-each>
+ <xsl:for-each select="text:note-body/text:p">
+ <xsl:call-template name="execParagraph">
+ <xsl:with-param name="currlistlvl" select="number('0')"/>
+ <xsl:with-param name="liststylename" select="string('00000')"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </字:脚注>
+ </xsl:template>
+ <xsl:template name="weizhu">
+ <字:尾注 uof:locID="t0108" uof:attrList="引文体">
+ <xsl:for-each select="text:note-citation">
+ <xsl:attribute name="字:引文体"><xsl:value-of select="."/></xsl:attribute>
+ </xsl:for-each>
+ <xsl:for-each select="text:note-body/text:p">
+ <xsl:call-template name="execParagraph">
+ <xsl:with-param name="currlistlvl" select="number('0')"/>
+ <xsl:with-param name="liststylename" select="string('00000')"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </字:尾注>
+ </xsl:template>
+ <xsl:template name="unordered-ordered-list">
+ <xsl:param name="currlistlvl"/>
+ <xsl:param name="liststylename"/>
+ <xsl:for-each select="text:list-item">
+ <xsl:if test="text:p">
+ <xsl:for-each select="text:p">
+ <xsl:call-template name="execParagraph">
+ <xsl:with-param name="currlistlvl" select="$currlistlvl"/>
+ <xsl:with-param name="liststylename" select="$liststylename"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:for-each select="node( )">
+ <xsl:if test="name()='text:list'">
+ <xsl:call-template name="unordered-ordered-list">
+ <xsl:with-param name="currlistlvl" select="$currlistlvl +1"/>
+ <xsl:with-param name="liststylename" select="$liststylename"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="execParagraph">
+ <xsl:param name="currlistlvl"/>
+ <xsl:param name="liststylename"/>
+ <å­—:æ®µè½ uof:locID="t0051" uof:attrList="标识符">
+ <xsl:element name="å­—:段è½å±žæ€§">
+ <xsl:attribute name="uof:locID">t0052</xsl:attribute>
+ <xsl:attribute name="uof:attrList">å¼æ ·å¼•ç”¨</xsl:attribute>
+ <xsl:if test="@text:style-name">
+ <xsl:attribute name="å­—:å¼æ ·å¼•ç”¨"><xsl:value-of select="@text:style-name"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="not(number($currlistlvl) =number('0'))">
+ <xsl:variable name="parent-position">
+ <xsl:number from="/office:document/office:body/office:text/text:list" level="any" count="text:list-item/text:p" format="1"/>
+ </xsl:variable>
+ <xsl:element name="å­—:自动编å·ä¿¡æ¯">
+ <xsl:attribute name="uof:locID">t0059</xsl:attribute>
+ <xsl:attribute name="uof:attrList">ç¼–å·å¼•ç”¨ ç¼–å·çº§åˆ« é‡æ–°ç¼–å· èµ·å§‹ç¼–å·</xsl:attribute>
+ <xsl:attribute name="å­—:ç¼–å·å¼•ç”¨"><xsl:value-of select="$liststylename"/></xsl:attribute>
+ <xsl:attribute name="å­—:ç¼–å·çº§åˆ«"><xsl:value-of select="$currlistlvl - 1"/></xsl:attribute>
+ <xsl:attribute name="å­—:é‡æ–°ç¼–å·"><xsl:choose><xsl:when test="number($parent-position)=number('1')">1</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="å­—:起始编å·"><xsl:for-each select="/office:document//text:list-style[$liststylename=@style:name]/*[number($currlistlvl)=number(@text:level)]"><xsl:choose><xsl:when test="@text:start-value"><xsl:value-of select="@text:start-value"/></xsl:when><xsl:otherwise>1</xsl:otherwise></xsl:choose></xsl:for-each></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:variable name="stylename">
+ <xsl:value-of select="@text:style-name"/>
+ </xsl:variable>
+ <xsl:for-each select="/office:document//style:style">
+ <xsl:if test="@style:name=$stylename">
+ <xsl:element name="å­—:å¥å±žæ€§">
+ <xsl:attribute name="uof:locID">t0086</xsl:attribute>
+ <xsl:attribute name="uof:attrList">å¼æ ·å¼•ç”¨</xsl:attribute>
+ <xsl:attribute name="å­—:å¼æ ·å¼•ç”¨"><xsl:value-of select="$stylename"/></xsl:attribute>
+ <xsl:call-template name="å­—:å¥å±žæ€§"/>
+ </xsl:element>
+ <xsl:call-template name="ParaAttribute">
+ <xsl:with-param name="text-style-name" select="@style:name"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:element>
+ <xsl:call-template name="textp"/>
+ <xsl:if test="parent::office:text and not(preceding-sibling::text:p) and preceding-sibling::*[substring-before(name(),':')='draw']">
+ <xsl:for-each select="preceding-sibling::*[substring-before(name(),':')='draw']">
+ <å­—:å¥ uof:locID="t0085">
+ <xsl:call-template name="字:锚点"/>
+ </å­—:å¥>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:if test="draw:frame/draw:text-box/text:p">
+ <xsl:for-each select="draw:frame/draw:text-box/text:p">
+ <xsl:for-each select="child::*[substring-before(name(),':')='draw']">
+ <å­—:å¥ uof:locID="t0085">
+ <xsl:call-template name="字:锚点"/>
+ </å­—:å¥>
+ </xsl:for-each>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:variable name="aa">
+ <xsl:value-of select="@text:style-name"/>
+ </xsl:variable>
+ <xsl:if test="//office:document/office:automatic-styles/style:style[@style:name=$aa]/style:paragraph-properties/@fo:break-before='column'">
+ <å­—:å¥ uof:locID="t0085">
+ <xsl:element name="å­—:分æ ç¬¦">
+ <xsl:attribute name="uof:locID">t0125</xsl:attribute>
+ </xsl:element>
+ </å­—:å¥>
+ </xsl:if>
+ <xsl:if test="//office:document/office:automatic-styles/style:style[@style:name=$aa]/style:paragraph-properties/@fo:break-before='page'">
+ <å­—:å¥ uof:locID="t0085">
+ <xsl:element name="字:分页符">
+ <xsl:attribute name="uof:locID">t0127</xsl:attribute>
+ </xsl:element>
+ </å­—:å¥>
+ </xsl:if>
+ <xsl:if test="/office:document/office:body/office:text/text:p/text:initial-creator">
+ <xsl:apply-templates select="text:initial-creator"/>
+ </xsl:if>
+ <xsl:if test="/office:document/office:body/office:text/text:p/text:title">
+ <xsl:apply-templates select="text:title"/>
+ </xsl:if>
+ <xsl:if test="/office:document/office:body/office:text/text:p/text:subject">
+ <xsl:apply-templates select="text:subject"/>
+ </xsl:if>
+ <xsl:if test="/office:document/office:body/office:text/text:p/text:file-name">
+ <xsl:apply-templates select="text:file-name"/>
+ </xsl:if>
+ <xsl:if test="/office:document/office:body/office:text/text:p/text:author-name">
+ <xsl:apply-templates select="text:author-name"/>
+ </xsl:if>
+ <xsl:if test="/office:document/office:body/office:text/text:p/text:author-initials">
+ <xsl:apply-templates select="text:author-initials"/>
+ </xsl:if>
+ <xsl:if test="/office:document/office:body/office:text/text:p/text:span/text:date">
+ <xsl:apply-templates select="text:date"/>
+ </xsl:if>
+ </å­—:段è½>
+ </xsl:template>
+ <xsl:template name="ParaAttribute">
+ <xsl:param name="text-style-name"/>
+ <xsl:if test="substring-after(@style:display-name,'Heading')">
+ <xsl:element name="字:大纲级别">
+ <xsl:attribute name="uof:locID">t0054</xsl:attribute>
+ <xsl:value-of select="substring-after(@style:display-name,'Heading ')"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:paragraph-properties/@fo:text-align or style:paragraph-properties/@style:vertical-align">
+ <xsl:element name="å­—:对é½">
+ <xsl:attribute name="uof:locID">t0055</xsl:attribute>
+ <xsl:attribute name="uof:attrList">æ°´å¹³å¯¹é½ æ–‡å­—å¯¹é½</xsl:attribute>
+ <xsl:attribute name="å­—:水平对é½"><xsl:choose><xsl:when test="style:paragraph-properties/@fo:text-align='end'">right</xsl:when><xsl:when test="style:paragraph-properties/@fo:text-align='center'">center</xsl:when><xsl:when test="style:paragraph-properties/@fo:text-align='justify' and not(style:paragraph-properties/@fo:text-align-last='justify')">justified</xsl:when><xsl:when test="style:paragraph-properties/@fo:text-align='justify' and style:paragraph-properties/@fo:text-align-last='justify'">distributed</xsl:when><xsl:otherwise>left</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="å­—:文字对é½"><xsl:choose><xsl:when test="style:paragraph-properties/@style:vertical-align='baseline'">base</xsl:when><xsl:when test="style:paragraph-properties/@style:vertical-align='top'">top</xsl:when><xsl:when test="style:paragraph-properties/@style:vertical-align='middle'">center</xsl:when><xsl:when test="style:paragraph-properties/@style:vertical-align='bottom'">bottom</xsl:when><xsl:otherwise>auto</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:paragraph-properties/@fo:margin-left or style:paragraph-properties/@fo:margin-right or style:paragraph-properties/@fo:text-indent">
+ <xsl:element name="字:缩进">
+ <xsl:attribute name="uof:locID">t0056</xsl:attribute>
+ <xsl:for-each select="style:paragraph-properties">
+ <xsl:call-template name="字:缩进类型"/>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="å­—:è¡Œè·">
+ <xsl:attribute name="uof:locID">t0057</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 值</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="contains(style:paragraph-properties/@fo:line-height,$ooUnit)">
+ <xsl:attribute name="字:类型">fixed</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:value-of select="substring-before(style:paragraph-properties/@fo:line-height,$ooUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="contains(style:paragraph-properties/@fo:line-height,'%')">
+ <xsl:attribute name="字:类型">multi-lines</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:value-of select="substring-before(style:paragraph-properties/@fo:line-height,'%') div 100"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="style:paragraph-properties/@style:line-height-at-least">
+ <xsl:attribute name="字:类型">at-least</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:value-of select="substring-before(style:paragraph-properties/@style:line-height-at-least,$ooUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="style:paragraph-properties/@style:line-spacing">
+ <xsl:attribute name="字:类型">line-space</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:value-of select="substring-before(style:paragraph-properties/@style:line-spacing,$ooUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="字:类型">multi-lines</xsl:attribute>
+ <xsl:attribute name="字:值">1.0</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:if test="style:paragraph-properties/@fo:widows">
+ <xsl:element name="字:孤行控制">
+ <xsl:attribute name="uof:locID">t0060</xsl:attribute>
+ <xsl:value-of select="style:paragraph-properties/@fo:widows"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:paragraph-properties/@fo:orphans">
+ <xsl:element name="字:寡行控制">
+ <xsl:attribute name="uof:locID">t0061</xsl:attribute>
+ <xsl:value-of select="style:paragraph-properties/@fo:orphans"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="å­—:段中ä¸åˆ†é¡µ">
+ <xsl:attribute name="uof:locID">t0062</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test="style:paragraph-properties/@fo:keep-together='always'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ <xsl:if test="style:paragraph-properties/@fo:keep-with-next">
+ <xsl:element name="å­—:与下段åŒé¡µ">
+ <xsl:attribute name="uof:locID">t0063</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值">true</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:paragraph-properties/@fo:break-before">
+ <xsl:element name="å­—:段å‰åˆ†é¡µ">
+ <xsl:attribute name="uof:locID">t0064</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值">true</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:paragraph-properties/@style:snap-to-layout-grid">
+ <xsl:element name="å­—:对é½ç½‘æ ¼">
+ <xsl:attribute name="uof:locID">t0069</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test="style:paragraph-properties/@style:snap-to-layout-grid='true'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:paragraph-properties/style:drop-cap/@style:lines">
+ <xsl:element name="字:首字下沉">
+ <xsl:attribute name="uof:locID">t0070</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 字体引用 字符数 行数 é—´è·</xsl:attribute>
+ <xsl:attribute name="字:类型">dropped</xsl:attribute>
+ <xsl:if test="style:paragraph-properties/style:drop-cap/@style:style-name">
+ <xsl:attribute name="字:字体引用"><xsl:value-of select="translate(style:paragraph-properties/style:drop-cap/@style:style-name,' ','_')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="å­—:é—´è·"><xsl:choose><xsl:when test="style:paragraph-properties/style:drop-cap/@style:distance"><xsl:value-of select="substring-before(style:paragraph-properties/style:drop-cap/@style:distance,$ooUnit)"/></xsl:when><xsl:otherwise>0.00</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="style:paragraph-properties/style:drop-cap/@style:length">
+ <xsl:attribute name="字:字符数"><xsl:value-of select="style:paragraph-properties/style:drop-cap/@style:length"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:paragraph-properties/style:drop-cap/@style:lines">
+ <xsl:attribute name="字:行数"><xsl:value-of select="style:paragraph-properties/style:drop-cap/@style:lines"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="å­—:å–消断字">
+ <xsl:attribute name="uof:locID">t0071</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test="style:paragraph-properties/@fo:hyphenate"><xsl:value-of select="style:paragraph-properties/@fo:hyphenate"/></xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ <xsl:element name="å­—:å–消行å·">
+ <xsl:attribute name="uof:locID">t0072</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:variable name="aa">
+ <xsl:value-of select="style:paragraph-properties/@text:number-lines"/>
+ </xsl:variable>
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test="$aa='false'">false</xsl:when><xsl:otherwise>true</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ <xsl:element name="å­—:å…许å•è¯æ–­å­—">
+ <xsl:attribute name="字:值">true</xsl:attribute>
+ <xsl:attribute name="uof:locID">t0073</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ </xsl:element>
+ <xsl:if test="style:paragraph-properties/@style:punctuation-wrap">
+ <xsl:element name="字:行首尾标点控制">
+ <xsl:attribute name="uof:locID">t0074</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test="style:paragraph-properties/@style:punctuation-wrap='hanging'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="å­—:是å¦è¡Œé¦–标点压缩">
+ <xsl:attribute name="uof:locID">t0075</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值">false</xsl:attribute>
+ </xsl:element>
+ <xsl:if test="style:paragraph-properties/@style:line-break ">
+ <xsl:element name="字:中文习惯首尾字符">
+ <xsl:attribute name="uof:locID">t0076</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test="style:paragraph-properties/@style:line-break='strict'">true</xsl:when><xsl:when test="style:paragraph-properties/@style:line-break='normal'">false</xsl:when></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:paragraph-properties/@style:text-autospace">
+ <xsl:element name="å­—:自动调整中英文字符间è·">
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test="style:paragraph-properties/@style:text-autospace='ideograph-alpha'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="uof:locID">t0077</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:paragraph-properties/@style:text-autospace">
+ <xsl:element name="å­—:自动调整中文与数字间è·">
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test="style:paragraph-properties/@style:text-autospace='ideograph-alpha'">true </xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="uof:locID">t0078</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="å­—:有网格自动调整å³ç¼©è¿›">
+ <xsl:attribute name="字:值">false</xsl:attribute>
+ <xsl:attribute name="uof:locID">t0195</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ </xsl:element>
+ <xsl:if test="style:paragraph-properties/@fo:border or style:paragraph-properties/@fo:border-top or style:paragraph-properties/@fo:border-bottom or style:paragraph-properties/@fo:border-left or style:paragraph-properties/@fo:border-right or style:paragraph-properties/@style:shadow[.!='none']">
+ <xsl:element name="字:边框">
+ <xsl:attribute name="uof:locID">t0065</xsl:attribute>
+ <xsl:for-each select="style:paragraph-properties">
+ <xsl:call-template name="uof:边框"/>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:paragraph-properties/@fo:background-color">
+ <xsl:element name="å­—:å¡«å……">
+ <xsl:attribute name="uof:locID">t0066</xsl:attribute>
+ <xsl:for-each select="style:paragraph-properties">
+ <xsl:call-template name="图:填充"/>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:paragraph-properties/@fo:margin-top or style:paragraph-properties/@fo:margin-bottom">
+ <å­—:æ®µé—´è· uof:locID="t0058">
+ <xsl:if test="style:paragraph-properties/@fo:margin-top">
+ <å­—:段å‰è· uof:locID="t0196">
+ <å­—:ç»å¯¹å€¼ uof:locID="t0199" uof:attrList="值">
+ <xsl:attribute name="字:值"><xsl:value-of select="substring-before(style:paragraph-properties/@fo:margin-top,$ooUnit)"/></xsl:attribute>
+ </å­—:ç»å¯¹å€¼>
+ </å­—:段å‰è·>
+ </xsl:if>
+ <xsl:if test="style:paragraph-properties/@fo:margin-bottom">
+ <å­—:段åŽè· uof:locID="t0197">
+ <å­—:ç»å¯¹å€¼ uof:locID="t0202" uof:attrList="值">
+ <xsl:attribute name="字:值"><xsl:value-of select="substring-before(style:paragraph-properties/@fo:margin-bottom,$ooUnit)"/></xsl:attribute>
+ </å­—:ç»å¯¹å€¼>
+ </å­—:段åŽè·>
+ </xsl:if>
+ </å­—:段间è·>
+ </xsl:if>
+ <xsl:if test="style:paragraph-properties/style:tab-stops">
+ <xsl:element name="å­—:制表ä½è®¾ç½®">
+ <xsl:attribute name="uof:locID">t0067</xsl:attribute>
+ <xsl:for-each select="style:paragraph-properties/style:tab-stops/style:tab-stop">
+ <xsl:element name="å­—:制表ä½">
+ <xsl:attribute name="uof:locID">t0068</xsl:attribute>
+ <xsl:attribute name="uof:attrList">ä½ç½® 类型 å‰å¯¼ç¬¦ 制表ä½å­—符</xsl:attribute>
+ <xsl:attribute name="å­—:ä½ç½®"><xsl:value-of select="substring-before(@style:position,$ooUnit)"/></xsl:attribute>
+ <xsl:variable name="aa">
+ <xsl:value-of select="@style:type"/>
+ </xsl:variable>
+ <xsl:variable name="zbflx">
+ <xsl:choose>
+ <xsl:when test="$aa='right'">right</xsl:when>
+ <xsl:when test="$aa='center'">center</xsl:when>
+ <xsl:when test="$aa='char'and @style:char!=''">decimal</xsl:when>
+ <xsl:otherwise>left</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="字:类型"><xsl:value-of select="$zbflx"/></xsl:attribute>
+ <xsl:attribute name="å­—:制表ä½å­—符"><xsl:value-of select="@style:leader-text"/></xsl:attribute>
+ <xsl:if test="@style:leader-style">
+ <xsl:attribute name="å­—:å‰å¯¼ç¬¦"><xsl:value-of select="@style:leader-style"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="text:s">
+ <xsl:param name="bText"/>
+ <xsl:choose>
+ <xsl:when test="$bText='0'">
+ <xsl:variable name="count">
+ <xsl:choose>
+ <xsl:when test="not(@text:c)">1</xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="@text:c"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <å­—:å¥ uof:locID="t0085">
+ <字:空格符 uof:locID="t0126" uof:attrList="个数" 字:个数="{$count}"/>
+ </å­—:å¥>
+ </xsl:when>
+ <xsl:otherwise>
+ <字:空格符 uof:locID="t0126" uof:attrList="个数" 字:个数="{@text:c}"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="textp" match="text:p">
+ <xsl:variable name="parentstyle">
+ <xsl:value-of select="@text:style-name"/>
+ </xsl:variable>
+ <xsl:for-each select="node( )">
+ <xsl:choose>
+ <xsl:when test="self::node()[name(.)='text:span']">
+ <xsl:call-template name="textspan"/>
+ </xsl:when>
+ <xsl:when test="self::node()[name(.)='text:sequence']">
+ <xsl:apply-templates select="."/>
+ </xsl:when>
+ <xsl:when test="self::node()/draw:text-box/text:p/text:sequence">
+ <xsl:for-each select="draw:text-box/text:p/node()">
+ <xsl:choose>
+ <xsl:when test="self::node()[name(.)='text:sequence']">
+ <xsl:apply-templates select="."/>
+ </xsl:when>
+ <xsl:when test="not(self::node()[substring-before(name(.),':')='draw'])">
+ <xsl:call-template name="å­—:å¥">
+ <xsl:with-param name="parentstyle" select="$parentstyle"/>
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:when test="self::node()[name(.)='text:date']">
+ <xsl:apply-templates select="."/>
+ </xsl:when>
+ <xsl:when test="self::node()[name(.)='text:time']">
+ <xsl:apply-templates select="."/>
+ </xsl:when>
+ <xsl:when test="self::node()[name(.)='text:s']">
+ <xsl:apply-templates select=".">
+ <xsl:with-param name="bText" select="0"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:when test="self::node()[name(.)='text:file-name']">
+ <xsl:apply-templates select="."/>
+ </xsl:when>
+ <xsl:when test="self::node()[name(.)='text:chapter']">
+ <xsl:apply-templates select="."/>
+ </xsl:when>
+ <xsl:when test="self::node()[name(.)='text:editing-duration']">
+ <xsl:apply-templates select="."/>
+ </xsl:when>
+ <xsl:when test="self::node()[name(.)='text:creation-time']">
+ <xsl:apply-templates select="."/>
+ </xsl:when>
+ <xsl:when test="self::node()[name(.)='text:creation-date']">
+ <xsl:apply-templates select="."/>
+ </xsl:when>
+ <xsl:when test="self::node()[name(.)='text:character-count']">
+ <xsl:apply-templates select="."/>
+ </xsl:when>
+ <xsl:when test="self::node()[name(.)='text:page-count']">
+ <xsl:apply-templates select="."/>
+ </xsl:when>
+ <xsl:when test="self::node()[name(.)='text:page-number']">
+ <xsl:apply-templates select="."/>
+ </xsl:when>
+ <xsl:when test="substring-before(name(.),':')='draw' and not(name(.)='draw:a')">
+ <å­—:å¥ uof:locID="t0085">
+ <xsl:call-template name="字:锚点"/>
+ </å­—:å¥>
+ </xsl:when>
+ <xsl:when test="self::node()[name(.)='text:note']/@text:note-class='footnote'">
+ <å­—:å¥ uof:locID="t0085">
+ <xsl:call-template name="jiaozhu"/>
+ </å­—:å¥>
+ </xsl:when>
+ <xsl:when test="self::node()[name(.)='text:note']/@text:note-class='endnote'">
+ <å­—:å¥ uof:locID="t0085">
+ <xsl:call-template name="weizhu"/>
+ </å­—:å¥>
+ </xsl:when>
+ <xsl:when test="name(.)='text:alphabetical-index-mark-start'">
+ <xsl:element name="å­—:å¥">
+ <xsl:element name="字:区域开始">
+ <xsl:attribute name="uof:locId">t0121</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符 å称 类型</xsl:attribute>
+ <xsl:attribute name="字:类型">user-data</xsl:attribute>
+ <xsl:attribute name="å­—:å称"><xsl:value-of select="@text:string-value-phonetic"/></xsl:attribute>
+ <xsl:attribute name="字:标识符"><xsl:value-of select="@text:id"/></xsl:attribute>
+ </xsl:element>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="name(.)='text:alphabetical-index-mark-end'">
+ <xsl:element name="å­—:å¥">
+ <xsl:element name="å­—:区域结æŸ" uof:locID="t0122" uof:attrList="标识符引用">
+ <xsl:attribute name="字:标识符引用"><xsl:value-of select="@text:id"/></xsl:attribute>
+ </xsl:element>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="name(.)='text:bookmark' ">
+ <å­—:å¥ uof:locID="t0085">
+ <xsl:element name="å­—:å¥å±žæ€§">
+ <xsl:attribute name="uof:locID">t0086</xsl:attribute>
+ <xsl:attribute name="uof:attrList">å¼æ ·å¼•ç”¨</xsl:attribute>
+ </xsl:element>
+ <å­—:区域开始 uof:locID="t0121" uof:attrList="标识符 å称 类型" å­—:å称="{@text:name}" å­—:类型="bookmark" å­—:标识符="{generate-id()}"/>
+ <å­—:åŒºåŸŸç»“æŸ uof:locID="t0122" uof:attrList="标识符引用" å­—:标识符引用="{generate-id()}"/>
+ </å­—:å¥>
+ </xsl:when>
+ <xsl:when test="name(.)='text:a'">
+ <å­—:å¥ uof:locID="t0085">
+ <xsl:element name="å­—:å¥å±žæ€§">
+ <xsl:attribute name="uof:locID">t0086</xsl:attribute>
+ <xsl:attribute name="uof:attrList">å¼æ ·å¼•ç”¨</xsl:attribute>
+ </xsl:element>
+ <xsl:element name="字:区域开始">
+ <xsl:attribute name="字:标识符">hlnk<xsl:number from="/office:document/office:body/office:text" level="any" count="text:a"/></xsl:attribute>
+ <xsl:attribute name="å­—:å称">Hyperlink</xsl:attribute>
+ <xsl:attribute name="字:类型">hyperlink</xsl:attribute>
+ <xsl:attribute name="uof:locID">t0121</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符 å称 类型</xsl:attribute>
+ </xsl:element>
+ <xsl:element name="字:文本串">
+ <xsl:attribute name="uof:locID">t0109</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符</xsl:attribute>
+ <xsl:value-of select="."/>
+ </xsl:element>
+ <xsl:element name="å­—:区域结æŸ">
+ <xsl:attribute name="字:标识符引用">hlnk<xsl:number from="/office:document/office:body/office:text" level="any" count="text:a"/></xsl:attribute>
+ <xsl:attribute name="uof:locID">t0122</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符引用</xsl:attribute>
+ </xsl:element>
+ </å­—:å¥>
+ </xsl:when>
+ <xsl:when test="name(.)='office:annotation'">
+ <å­—:å¥ uof:locID="t0085">
+ <xsl:element name="å­—:å¥å±žæ€§">
+ <xsl:attribute name="uof:locID">t0086</xsl:attribute>
+ <xsl:attribute name="uof:attrList">å¼æ ·å¼•ç”¨</xsl:attribute>
+ </xsl:element>
+ <xsl:element name="字:区域开始">
+ <xsl:attribute name="字:标识符">cmt<xsl:number from="/office:document/office:body/office:text" level="any" count="office:annotation"/></xsl:attribute>
+ <xsl:attribute name="å­—:å称">Comment</xsl:attribute>
+ <xsl:attribute name="字:类型">annotation</xsl:attribute>
+ <xsl:attribute name="uof:locID">t0121</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符 å称 类型</xsl:attribute>
+ </xsl:element>
+ <xsl:element name="å­—:区域结æŸ">
+ <xsl:attribute name="字:标识符引用">cmt<xsl:number from="/office:document/office:body/office:text" level="any" count="office:annotation"/></xsl:attribute>
+ <xsl:attribute name="uof:locID">t0122</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符引用</xsl:attribute>
+ </xsl:element>
+ </å­—:å¥>
+ </xsl:when>
+ <xsl:when test="self::node()[name(.)='text:change-start'] or self::node()[name(.)='text:change'] or self::node()[name(.)='text:change-end']">
+ <xsl:call-template name="xiuding"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="å­—:å¥">
+ <xsl:with-param name="parentstyle" select="$parentstyle"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="xiuding">
+ <xsl:choose>
+ <xsl:when test="self::node()[name(.)='text:change-start']or self::node()[name(.)='text:change']">
+ <xsl:variable name="changeID">
+ <xsl:value-of select="@text:change-id"/>
+ </xsl:variable>
+ <xsl:for-each select="/office:document/office:body/office:text/text:tracked-changes/text:changed-region">
+ <xsl:if test="$changeID=@text:id">
+ <xsl:choose>
+ <xsl:when test="text:insertion">
+ <xsl:element name="字:修订开始">
+ <xsl:attribute name="uof:locID">t0206</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符 类型 修订信æ¯å¼•ç”¨</xsl:attribute>
+ <xsl:attribute name="字:标识符"><xsl:value-of select="@text:id"/></xsl:attribute>
+ <xsl:attribute name="字:类型">insert</xsl:attribute>
+ <xsl:attribute name="å­—:修订信æ¯å¼•ç”¨"><xsl:value-of select="@text:id"/></xsl:attribute>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="text:format-change">
+ <xsl:element name="字:修订开始">
+ <xsl:attribute name="uof:locID">t0206</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符 类型 修订信æ¯å¼•ç”¨</xsl:attribute>
+ <xsl:attribute name="字:标识符"><xsl:value-of select="@text:id"/></xsl:attribute>
+ <xsl:attribute name="字:类型">format</xsl:attribute>
+ <xsl:attribute name="å­—:修订信æ¯å¼•ç”¨"><xsl:value-of select="@text:id"/></xsl:attribute>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="text:deletion">
+ <xsl:element name="字:修订开始">
+ <xsl:attribute name="uof:locID">t0206</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符 类型 修订信æ¯å¼•ç”¨</xsl:attribute>
+ <xsl:attribute name="字:标识符"><xsl:value-of select="@text:id"/></xsl:attribute>
+ <xsl:attribute name="字:类型">delete</xsl:attribute>
+ <xsl:attribute name="å­—:修订信æ¯å¼•ç”¨"><xsl:value-of select="@text:id"/></xsl:attribute>
+ </xsl:element>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:when test="self::node()[name(.)='text:change-end']">
+ <xsl:variable name="changeendID">
+ <xsl:value-of select="@text:change-id"/>
+ </xsl:variable>
+ <xsl:for-each select="/office:document/office:body/office:text/text:tracked-changes/text:changed-region">
+ <xsl:if test="$changeendID=@text:id">
+ <xsl:choose>
+ <xsl:when test="text:insertion">
+ <xsl:element name="å­—:修订结æŸ">
+ <xsl:attribute name="uof:locID">t0207</xsl:attribute>
+ <xsl:attribute name="uof:attrList">开始标识引用</xsl:attribute>
+ <xsl:attribute name="字:开始标识引用"><xsl:value-of select="@text:id"/></xsl:attribute>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="text:deletion">
+ <xsl:element name="å­—:修订结æŸ">
+ <xsl:attribute name="uof:locID">t0207</xsl:attribute>
+ <xsl:attribute name="uof:attrList">开始标识引用</xsl:attribute>
+ <xsl:attribute name="字:开始标识引用"><xsl:value-of select="@text:id"/></xsl:attribute>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="text:format-change">
+ <xsl:element name="å­—:修订结æŸ">
+ <xsl:attribute name="uof:locID">t0207</xsl:attribute>
+ <xsl:attribute name="uof:attrList">开始标识引用</xsl:attribute>
+ <xsl:attribute name="字:开始标识引用"><xsl:value-of select="@text:id"/></xsl:attribute>
+ </xsl:element>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="å­—:å¥">
+ <xsl:param name="parentstyle"/>
+ <xsl:if test="not(name(.)='text:bookmark-start' or name(.)='text:bookmark-end' or name(.)='draw:image' or name(.)='office:binary-data' or name(.)='text:page-number' or name(.)='text:page-count' or name(.)='text:initial-creator' or name(.)='text:author-name' or name(.)='text:author-initials' or name(.)='text:creation-time' or name(.)='text:creation-date' or name(.)='text:title' or name(.)='text:subject' or name(.)='text:file-name' or name(.)='text:editing-duration' or name(.)='text:character-count' or name(.)='text:chapter')">
+ <å­—:å¥ uof:locID="t0085">
+ <å­—:å¥å±žæ€§ uof:locID="t0086" uof:attrList="å¼æ ·å¼•ç”¨">
+ <xsl:choose>
+ <xsl:when test="@text:style-name">
+ <xsl:attribute name="å­—:å¼æ ·å¼•ç”¨"><xsl:value-of select="@text:style-name"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="parent::text:h/@text:outline-level">
+ <xsl:attribute name="å­—:å¼æ ·å¼•ç”¨"><xsl:value-of select="concat('Heading_20_',parent::text:h/@text:outline-level)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="parent::node()/@text:style-name">
+ <xsl:attribute name="å­—:å¼æ ·å¼•ç”¨"><xsl:value-of select="parent::node( )/@text:style-name"/></xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </å­—:å¥å±žæ€§>
+ <xsl:if test="ancestor::text:note-body">
+ <å­—:引文符å·>
+ <xsl:value-of select="ancestor::text:note/text:note-citation"/>
+ </å­—:引文符å·>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="(preceding-sibling::text:bookmark-start) and (following-sibling::text:bookmark-end)">
+ <å­—:区域开始 uof:locID="t0121" uof:attrList="标识符 å称 类型">
+ <xsl:attribute name="字:标识符"><xsl:value-of select="preceding-sibling::text:bookmark-start/@text:name"/></xsl:attribute>
+ <xsl:attribute name="å­—:å称">Bookmark</xsl:attribute>
+ <xsl:attribute name="字:类型">bookmark</xsl:attribute>
+ </字:区域开始>
+ <xsl:element name="字:文本串">
+ <xsl:attribute name="uof:locID">t0109</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符</xsl:attribute>
+ <xsl:value-of select="string(.)"/>
+ </xsl:element>
+ <å­—:åŒºåŸŸç»“æŸ uof:locID="t0122" uof:attrList="标识符引用">
+ <xsl:attribute name="字:标识符引用"><xsl:value-of select="following-sibling::text:bookmark-end/@text:name"/></xsl:attribute>
+ </å­—:区域结æŸ>
+ </xsl:when>
+ <xsl:when test="name(.)='draw:a'">
+ <xsl:variable name="link-name">
+ <xsl:value-of select="substring-after(@xlink:href,'#')"/>
+ </xsl:variable>
+ <å­—:区域开始 uof:locID="t0121" uof:attrList="标识符 å称 类型">
+ <xsl:attribute name="字:标识符"><xsl:value-of select="$link-name"/></xsl:attribute>
+ <xsl:attribute name="å­—:å称">Bookmark</xsl:attribute>
+ <xsl:attribute name="字:类型">bookmark</xsl:attribute>
+ </字:区域开始>
+ <xsl:call-template name="字:锚点"/>
+ <å­—:åŒºåŸŸç»“æŸ uof:locID="t0122" uof:attrList="标识符引用">
+ <xsl:attribute name="字:标识符引用"><xsl:value-of select="$link-name"/></xsl:attribute>
+ </å­—:区域结æŸ>
+ </xsl:when>
+ <xsl:when test="self::node( )[name(.)='text:tab']">
+ <xsl:element name="字:制表符">
+ <xsl:attribute name="uof:locID">t0123</xsl:attribute>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="self::node( )[name(.)='text:line-break']">
+ <xsl:element name="å­—:æ¢è¡Œç¬¦">
+ <xsl:attribute name="uof:locID">t0124</xsl:attribute>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="name(.)='text:bookmark-start' or name(.)='text:bookmark-end' or name(.)='draw:image' or name(.)='office:binary-data'">
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="字:文本串">
+ <xsl:attribute name="uof:locID">t0109</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符</xsl:attribute>
+ <xsl:value-of select="string(.)"/>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </å­—:å¥>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="draw:text-box">
+ <xsl:apply-templates/>
+ </xsl:template>
+ <xsl:template name="text">
+ <xsl:element name="å­—:å¥å±žæ€§">
+ <xsl:attribute name="uof:locID">t0086</xsl:attribute>
+ <xsl:attribute name="uof:attrList">å¼æ ·å¼•ç”¨</xsl:attribute>
+ <xsl:attribute name="å­—:å¼æ ·å¼•ç”¨"><xsl:value-of select="parent::node( )/@text:style-name"/></xsl:attribute>
+ </xsl:element>
+ <xsl:element name="字:文本串">
+ <xsl:attribute name="uof:locID">t0109</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符</xsl:attribute>
+ <xsl:value-of select="string(.)"/>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="textspan">
+ <å­—:å¥ uof:locID="t0085">
+ <xsl:choose>
+ <xsl:when test="./text:note/@text:note-class='footnote'">
+ <xsl:for-each select="text:note">
+ <xsl:call-template name="jiaozhu"/>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:when test="./text:note/@text:note-class='endnote'">
+ <xsl:for-each select="text:note">
+ <xsl:call-template name="weizhu"/>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="å­—:å¥å±žæ€§">
+ <xsl:attribute name="uof:locID">t0086</xsl:attribute>
+ <xsl:attribute name="uof:attrList">å¼æ ·å¼•ç”¨</xsl:attribute>
+ <xsl:variable name="textstyle">
+ <xsl:value-of select="@text:style-name"/>
+ </xsl:variable>
+ <xsl:attribute name="å­—:å¼æ ·å¼•ç”¨"><xsl:value-of select="@text:style-name"/></xsl:attribute>
+ <xsl:for-each select="/office:document/office:automatic-styles//style:style[@style:family='text']">
+ <xsl:if test="@style:name=$textstyle and not(@style:parent-style-name='Standard')">
+ <xsl:if test="@style:parent-style-name=/office:document/office:styles/style:style/@style:name">
+ <xsl:call-template name="SentenceXD">
+ <xsl:with-param name="Sentencestyle" select="@style:parent-style-name"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:for-each select="/office:document/office:automatic-styles//style:style[@style:family='text']">
+ <xsl:if test="@style:name=$textstyle">
+ <xsl:call-template name="SentenceXD">
+ <xsl:with-param name="Sentencestyle" select="@style:name"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:element>
+ <xsl:element name="字:文本串">
+ <xsl:attribute name="uof:locID">t0109</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符</xsl:attribute>
+ <xsl:value-of select="string(.)"/>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </å­—:å¥>
+ </xsl:template>
+ <xsl:template name="SentenceXD">
+ <xsl:param name="Sentencestyle"/>
+ </xsl:template>
+ <xsl:template name="字:锚点">
+ <xsl:if test="not(name(.)='draw:glue-point')">
+ <xsl:variable name="name">
+ <xsl:value-of select="name(.)"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="name='draw:a'">
+ <xsl:for-each select="child::node( )">
+ <xsl:call-template name="字:锚点"/>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="$name = 'draw:g'">
+ <xsl:for-each select="child::*">
+ <xsl:call-template name="字:锚点"/>
+ </xsl:for-each>
+ </xsl:if>
+ <字:锚点 uof:locID="t0110" uof:attrList="标识符 类型">
+ <xsl:choose>
+ <xsl:when test="@text:anchor-type='as-char'">
+ <xsl:attribute name="字:类型">inline</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="字:类型">normal</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <字:锚点属性 uof:locID="t0111">
+ <字:宽度 uof:locID="t0112">
+ <xsl:choose>
+ <xsl:when test="@svg:width">
+ <xsl:value-of select="substring-before(@svg:width,$uofUnit)"/>
+ </xsl:when>
+ <xsl:when test="@svg:x1">
+ <xsl:value-of select="substring-before(@svg:x2,$uofUnit) - substring-before(@svg:x1,$uofUnit)"/>
+ </xsl:when>
+ </xsl:choose>
+ </字:宽度>
+ <字:高度 uof:locID="t0113">
+ <xsl:choose>
+ <xsl:when test="@svg:height">
+ <xsl:value-of select="substring-before(@svg:height,$uofUnit)"/>
+ </xsl:when>
+ <xsl:when test="@svg:x1">
+ <xsl:value-of select="substring-before(@svg:y2,$uofUnit) - substring-before(@svg:y1,$uofUnit)"/>
+ </xsl:when>
+ <xsl:when test="child::draw:text-box/@fo:min-height">
+ <xsl:value-of select="substring-before(child::draw:text-box/@fo:min-height,$uofUnit)"/>
+ </xsl:when>
+ </xsl:choose>
+ </字:高度>
+ <xsl:if test="not(@text:anchor-type='as-char')">
+ <å­—:ä½ç½® uof:locID="t0114">
+ <字:水平 uof:locID="t0176" uof:attrList="相对于">
+ <xsl:for-each select="key('graphicset',@draw:style-name)/style:graphic-properties">
+ <xsl:attribute name="字:相对于"><xsl:choose><xsl:when test="@style:horizontal-rel='page'">page</xsl:when><xsl:when test="@style:horizontal-rel='paragraph'">margin</xsl:when><xsl:when test="@style:horizontal-rel='page-content'">margin</xsl:when><xsl:when test="@style:horizontal-rel='paragraph-content'">margin</xsl:when><xsl:when test="@style:horizontal-rel='char'">char</xsl:when><xsl:otherwise>paragraph</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:for-each>
+ <xsl:choose>
+ <xsl:when test="@svg:x or @svg:x1">
+ <å­—:ç»å¯¹ uof:locID="t0177" uof:attrList="值">
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test="@svg:x"><xsl:value-of select="substring-before(@svg:x,$uofUnit)"/></xsl:when><xsl:when test="@svg:x1"><xsl:value-of select="substring-before(@svg:x1,$uofUnit)"/></xsl:when></xsl:choose></xsl:attribute>
+ </å­—:ç»å¯¹>
+ </xsl:when>
+ <xsl:otherwise>
+ <å­—:相对 uof:locID="t0178" uof:attrList="å‚考点 值">
+ <xsl:for-each select="key('graphicset',@draw:style-name)/style:graphic-properties">
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test="@style:horizontal-pos='left'">left</xsl:when><xsl:when test="@style:horizontal-pos='right'">right</xsl:when><xsl:when test="@style:horizontal-pos='center'">center</xsl:when></xsl:choose></xsl:attribute>
+ </xsl:for-each>
+ </字:相对>
+ </xsl:otherwise>
+ </xsl:choose>
+ </å­—:æ°´å¹³>
+ <字:垂直 uof:locID="t0179" uof:attrList="相对于">
+ <xsl:for-each select="key('graphicset',@draw:style-name)/style:graphic-properties">
+ <xsl:attribute name="字:相对于"><xsl:choose><xsl:when test="@style:vertical-rel='page'">page</xsl:when><xsl:when test="@style:vertical-rel='paragraph'">paragraph</xsl:when><xsl:when test="@style:vertical-rel='page-content'">margin</xsl:when><xsl:when test="@style:vertical-rel='paragraph-content'">margin</xsl:when><xsl:when test="@style:vertical-rel='line'">line</xsl:when><xsl:otherwise>paragraph</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:for-each>
+ <xsl:choose>
+ <xsl:when test="@svg:y or @svg:y1">
+ <å­—:ç»å¯¹ uof:locID="t0180" uof:attrList="值">
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test="@svg:y"><xsl:value-of select="substring-before(@svg:y,$uofUnit)"/></xsl:when><xsl:when test="@svg:y1"><xsl:value-of select="substring-before(@svg:y1,$uofUnit)"/></xsl:when></xsl:choose></xsl:attribute>
+ </å­—:ç»å¯¹>
+ </xsl:when>
+ <xsl:otherwise>
+ <å­—:相对 uof:locID="t0181" uof:attrList="å‚考点 值">
+ <xsl:for-each select="key('graphicset',@draw:style-name)/style:graphic-properties">
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test="@style:vertical-pos='bottom'">bottom</xsl:when><xsl:when test="@style:vertical-pos='top'">top</xsl:when><xsl:when test="@style:vertical-pos='middle'">center</xsl:when><xsl:when test="@style:vertical-pos='below'">inside</xsl:when></xsl:choose></xsl:attribute>
+ </xsl:for-each>
+ </字:相对>
+ </xsl:otherwise>
+ </xsl:choose>
+ </å­—:åž‚ç›´>
+ </å­—:ä½ç½®>
+ </xsl:if>
+ <xsl:for-each select="key('graphicset',@draw:style-name)/style:graphic-properties">
+ <å­—:绕排 uof:locID="t0115" uof:attrList="ç»•æŽ’æ–¹å¼ çŽ¯ç»•æ–‡å­— 绕排顶点">
+ <xsl:variable name="wrap_type1">
+ <xsl:value-of select="@style:wrap"/>
+ </xsl:variable>
+ <xsl:variable name="wrap_type2">
+ <xsl:value-of select="@style:run-through"/>
+ </xsl:variable>
+ <xsl:variable name="a">
+ <xsl:value-of select="@style:number-wrapped-paragraphs"/>
+ </xsl:variable>
+ <xsl:if test="$wrap_type1">
+ <xsl:attribute name="å­—:绕排方å¼"><xsl:choose><xsl:when test="$wrap_type1='run-through' and $wrap_type2='background' ">behindtext</xsl:when><xsl:when test="$wrap_type1='run-through' and $a='1'">infrontoftext</xsl:when><xsl:when test="$wrap_type1='run-through'">through</xsl:when><xsl:when test="$wrap_type1='dynamic' ">top-bottom</xsl:when><xsl:when test="$wrap_type1='parallel' ">square</xsl:when><xsl:when test="$wrap_type1='left' or $wrap_type1='right'">tight</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$wrap_type1='left' or $wrap_type1='right'">
+ <xsl:attribute name="字:环绕文字"><xsl:choose><xsl:when test="$wrap_type1='left'">left</xsl:when><xsl:when test="$wrap_type1='right'">right</xsl:when></xsl:choose></xsl:attribute>
+ </xsl:if>
+ </字:绕排>
+ <å­—:è¾¹è· uof:locID="t0116" uof:attrList="上 å·¦ å³ ä¸‹">
+ <xsl:choose>
+ <xsl:when test="@fo:margin-top">
+ <xsl:attribute name="字:上"><xsl:value-of select="substring-before(@fo:margin-top,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="字:下"><xsl:value-of select="substring-before(@fo:margin-bottom,$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="字:上">0.0</xsl:attribute>
+ <xsl:attribute name="字:下">0.0</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="@fo:margin-right">
+ <xsl:attribute name="å­—:å³"><xsl:value-of select="substring-before(@fo:margin-right,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="å­—:å·¦"><xsl:value-of select="substring-before(@fo:margin-left,$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="å­—:å³">0.0</xsl:attribute>
+ <xsl:attribute name="å­—:å·¦">0.0</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </å­—:è¾¹è·>
+ <å­—:é”定 uof:attrList="值" uof:locID="t0117">
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test="@draw:move-protect='false'">false</xsl:when><xsl:otherwise>true</xsl:otherwise></xsl:choose></xsl:attribute>
+ </å­—:é”定>
+ <å­—:ä¿æŠ¤ uof:locID="t0118" uof:attrList="值">
+ <xsl:choose>
+ <xsl:when test="$name='draw:image' or $name='draw:text-box'">
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test="@style:protect = 'content size position' or @style:protect = 'content' or @style:protect = 'content size' or @style:protect = 'size position' or @style:protect = 'size' or @style:protect = 'position' or @style:protect = 'content position' and @draw:size-protect= 'true'and @draw:move-protect= 'true'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test="@style:protect = 'position size'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </å­—:ä¿æŠ¤>
+ </xsl:for-each>
+ <å­—:å…许é‡å  uof:locID="t0119" uof:attrList="值" å­—:值="true"/>
+ </字:锚点属性>
+ <字:图形 uof:locID="t0120" uof:attrList="图形引用">
+ <xsl:variable name="refpicname">
+ <xsl:if test="@draw:style-name">
+ <xsl:value-of select="@draw:style-name"/>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:variable name="picnumber">
+ <xsl:if test="@draw:style-name">
+ <xsl:value-of select="count(preceding::*[@draw:style-name=$refpicname])"/>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:attribute name="字:图形引用"><xsl:value-of select="concat($refpicname,'_',$picnumber)"/></xsl:attribute>
+ </字:图形>
+ </字:锚点>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="liekuan">
+ <xsl:param name="count"/>
+ <xsl:param name="width"/>
+ <xsl:if test="$count &gt; 0">
+ <字:列宽 uof:locID="t0132">
+ <xsl:value-of select="$width"/>
+ </字:列宽>
+ <xsl:call-template name="liekuan">
+ <xsl:with-param name="count" select="$count -1"/>
+ <xsl:with-param name="width" select="$width"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="exec_table" match="table:table">
+ <xsl:param name="tabletype"/>
+ <字:文字表 uof:locID="t0128" uof:attrList="类型">
+ <xsl:choose>
+ <xsl:when test="@table:is-sub-table='true'">
+ <xsl:attribute name="字:类型">sub-table</xsl:attribute>
+ <xsl:element name="字:文字表属性">
+ <xsl:attribute name="uof:locID">t0129</xsl:attribute>
+ <xsl:attribute name="uof:attrList">å¼æ ·å¼•ç”¨</xsl:attribute>
+ <xsl:element name="字:列宽集">
+ <xsl:attribute name="uof:locID">t0131</xsl:attribute>
+ <xsl:for-each select="table:table-column">
+ <xsl:variable name="tableColName" select="@table:style-name"/>
+ <xsl:variable name="colWidth" select="substring-before(//style:style[@style:name=$tableColName and @style:family='table-column']/style:table-column-properties/@style:column-width,$ooUnit)"/>
+ <xsl:choose>
+ <xsl:when test="@table:number-columns-repeated">
+ <xsl:call-template name="liekuan">
+ <xsl:with-param name="count" select="@table:number-columns-repeated"/>
+ <xsl:with-param name="width" select="$colWidth"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <字:列宽 uof:locID="t0132">
+ <xsl:value-of select="$colWidth"/>
+ </字:列宽>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="字:类型">table</xsl:attribute>
+ <xsl:element name="字:文字表属性">
+ <xsl:attribute name="uof:locID">t0129</xsl:attribute>
+ <xsl:attribute name="uof:attrList">å¼æ ·å¼•ç”¨</xsl:attribute>
+ <xsl:attribute name="å­—:å¼æ ·å¼•ç”¨"><xsl:value-of select="@table:style-name"/></xsl:attribute>
+ <xsl:variable name="tableName" select="@table:style-name"/>
+ <xsl:element name="字:列宽集">
+ <xsl:attribute name="uof:locID">t0131</xsl:attribute>
+ <xsl:for-each select="table:table-column">
+ <xsl:variable name="tableColName" select="@table:style-name"/>
+ <xsl:variable name="colWidth" select="substring-before(//style:style[@style:name=$tableColName and @style:family='table-column']/style:table-column-properties/@style:column-width,$ooUnit)"/>
+ <xsl:choose>
+ <xsl:when test="@table:number-columns-repeated">
+ <xsl:call-template name="liekuan">
+ <xsl:with-param name="count" select="@table:number-columns-repeated"/>
+ <xsl:with-param name="width" select="$colWidth"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <字:列宽 uof:locID="t0132">
+ <xsl:value-of select="$colWidth"/>
+ </字:列宽>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:element>
+ <xsl:for-each select="key('set_styleStyle',$tableName)">
+ <xsl:element name="字:宽度">
+ <xsl:attribute name="uof:locID">t0130</xsl:attribute>
+ <xsl:attribute name="uof:attrList">ç»å¯¹å®½åº¦ 相对宽度</xsl:attribute>
+ <xsl:attribute name="å­—:ç»å¯¹å®½åº¦"><xsl:value-of select="substring-before(style:table-properties/@style:width,$ooUnit)"/></xsl:attribute>
+ <xsl:if test="style:table-properties/@style:rel-width">
+ <xsl:attribute name="字:相对宽度"><xsl:value-of select="substring-before(style:table-properties/@style:rel-width,'%') div 100"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:element name="å­—:对é½">
+ <xsl:attribute name="uof:locID">t0133</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="style:table-properties/@table:align='right'">right</xsl:when>
+ <xsl:when test="style:table-properties/@table:align='center'">center</xsl:when>
+ <xsl:otherwise>left</xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:if test="style:table-properties/@fo:margin-left">
+ <xsl:element name="字:左缩进">
+ <xsl:attribute name="uof:locID">t0134</xsl:attribute>
+ <xsl:value-of select="substring-before(style:table-properties/@fo:margin-left,$ooUnit)"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="字:绕排">
+ <xsl:attribute name="uof:locID">t0135</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值">around</xsl:attribute>
+ </xsl:element>
+ <xsl:element name="字:边框">
+ <xsl:attribute name="uof:locID">t0137</xsl:attribute>
+ <xsl:for-each select="style:table-properties">
+ <xsl:call-template name="uof:边框"/>
+ </xsl:for-each>
+ </xsl:element>
+ <xsl:if test="style:table-properties/style:background-image/office:binary-data or style:table-properties/@fo:background-color or style:page-layout-properties/@fo:background-color">
+ <å­—:å¡«å…… uof:locID="t0138">
+ <xsl:for-each select="style:table-properties">
+ <xsl:call-template name="图:填充">
+ <xsl:with-param name="style-name" select="$tableName"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </å­—:å¡«å……>
+ </xsl:if>
+ <xsl:element name="å­—:绕排边è·">
+ <xsl:attribute name="uof:locID">t0139</xsl:attribute>
+ <xsl:attribute name="uof:attrList">上 å·¦ å³ ä¸‹</xsl:attribute>
+ <xsl:if test="style:table-properties/@fo:margin-top">
+ <xsl:attribute name="字:上"><xsl:value-of select="substring-before(style:table-properties/@fo:margin-top,$ooUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:table-properties/@fo:margin-left">
+ <xsl:attribute name="å­—:å·¦"><xsl:value-of select="substring-before(style:table-properties/@fo:margin-left,$ooUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:table-properties/@fo:margin-right">
+ <xsl:attribute name="å­—:å³"><xsl:value-of select="substring-before(style:table-properties/@fo:margin-right,$ooUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:table-properties/@fo:margin-bottom">
+ <xsl:attribute name="字:下"><xsl:value-of select="substring-before(style:table-properties/@fo:margin-bottom,$ooUnit)"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:element name="å­—:自动调整大å°">
+ <xsl:attribute name="字:值">true</xsl:attribute>
+ <xsl:attribute name="uof:locID">t0140</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ </xsl:element>
+ <xsl:element name="å­—:默认å•å…ƒæ ¼è¾¹è·">
+ <xsl:attribute name="uof:locID">t0141</xsl:attribute>
+ <xsl:attribute name="uof:attrList">上 å·¦ å³ ä¸‹</xsl:attribute>
+ <xsl:attribute name="字:上">0.10</xsl:attribute>
+ <xsl:attribute name="å­—:å·¦">0.10</xsl:attribute>
+ <xsl:attribute name="å­—:å³">0.10</xsl:attribute>
+ <xsl:attribute name="字:下">0.10</xsl:attribute>
+ </xsl:element>
+ <xsl:element name="å­—:默认å•å…ƒæ ¼é—´è·">
+ <xsl:attribute name="uof:locID">t0142</xsl:attribute>
+ <xsl:value-of select="'0.00'"/>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:apply-templates select="table:table-header-rows/table:table-row"/>
+ <xsl:apply-templates select="table:table-row"/>
+ </字:文字表>
+ </xsl:template>
+ <xsl:key name="set_colWidth" match="//office:automatic-styles/style:style[@style:family='table-column']" use="@style:name"/>
+ <xsl:key name="set_styleStyle" match="//office:automatic-styles/style:style" use="@style:name"/>
+ <xsl:template match="table:table-row">
+ <xsl:element name="字:行">
+ <xsl:attribute name="uof:locID">t0143</xsl:attribute>
+ <xsl:variable name="rowStyleName" select="@table:style-name|table:table-row/@table:style-name"/>
+ <xsl:element name="字:表行属性">
+ <xsl:attribute name="uof:locID">t0144</xsl:attribute>
+ <xsl:for-each select="key('set_styleStyle',$rowStyleName)/style:table-row-properties[@style:row-height or @style:min-row-height]">
+ <xsl:element name="字:高度">
+ <xsl:if test="@style:row-height">
+ <xsl:attribute name="字:固定值"><xsl:value-of select="substring-before(@style:row-height,$ooUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@style:min-row-height">
+ <xsl:attribute name="å­—:最å°å€¼"><xsl:value-of select="substring-before(@style:min-row-height,$ooUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="uof:locID">t0145</xsl:attribute>
+ <xsl:attribute name="uof:attrList">固定值 最å°å€¼</xsl:attribute>
+ </xsl:element>
+ </xsl:for-each>
+ <xsl:if test="key('set_styleStyle',$rowStyleName)/style:table-row-properties[@style:keep-together]">
+ <xsl:element name="字:跨页">
+ <xsl:attribute name="uof:locID">t0146</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:for-each select="key('set_styleStyle',$rowStyleName)/style:table-row-properties[@style:keep-together]">
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test="@style:keep-together='false'">false</xsl:when><xsl:otherwise>true</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="name(..)='table:table-header-rows'">
+ <xsl:element name="字:表头行">
+ <xsl:attribute name="uof:locID">t0147</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值">true</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ </xsl:element>
+ <xsl:for-each select="node()">
+ <xsl:choose>
+ <xsl:when test="name()='table:table-cell'">
+ <xsl:element name="å­—:å•å…ƒæ ¼">
+ <xsl:attribute name="uof:locID">t0148</xsl:attribute>
+ <xsl:call-template name="execTableCellAttribute"/>
+ <xsl:for-each select="node( )">
+ <xsl:choose>
+ <xsl:when test="name()='text:p'">
+ <xsl:call-template name="execParagraph">
+ <xsl:with-param name="currlistlvl" select="number('0')"/>
+ <xsl:with-param name="liststylename" select="string('00000')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name()='table:table' or name()='table:sub-table' or self::node()/@table:is-sub-table='true'">
+ <xsl:call-template name="exec_table">
+ <xsl:with-param name="tabletype" select="name()"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="execTableCellAttribute">
+ <xsl:element name="å­—:å•å…ƒæ ¼å±žæ€§">
+ <xsl:attribute name="uof:locID">t0149</xsl:attribute>
+ <xsl:variable name="StyleName" select="@table:style-name"/>
+ <xsl:element name="字:宽度">
+ <xsl:attribute name="uof:locID">t0150</xsl:attribute>
+ <xsl:attribute name="uof:attrList">ç»å¯¹å€¼ 相对值</xsl:attribute>
+ <xsl:variable name="sn">
+ <xsl:number from="/office:document/office:body/office:text" level="single" count="table:table-cell" format="1"/>
+ </xsl:variable>
+ <xsl:variable name="sn1">
+ <xsl:choose>
+ <xsl:when test="../../table:table-column[number($sn)]/@table:style-name">
+ <xsl:value-of select="$sn"/>
+ </xsl:when>
+ <xsl:when test=" name(../..)='table:table-header-rows' and ../../../table:table-column[number($sn)]/@table:style-name">
+ <xsl:value-of select="$sn"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="'1'"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="KuanDu">
+ <xsl:choose>
+ <xsl:when test=" name(../..)='table:table-header-rows' and ../../../table:table-column[number($sn)]/@table:style-name">
+ <xsl:value-of select="../../../table:table-column[number($sn1)]/@table:style-name"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="../../table:table-column[number($sn1)]/@table:style-name"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="å­—:ç»å¯¹å€¼"><xsl:value-of select="substring-before(key('set_colWidth',$KuanDu)/style:table-column-properties/@style:column-width,$ooUnit)"/></xsl:attribute>
+ <xsl:if test="key('set_colWidth',$KuanDu)/style:table-column-properties/@style:rel-column-width">
+ <xsl:attribute name="字:相对值"><xsl:value-of select="substring-before(key('set_colWidth',$KuanDu)/style:table-column-properties/@style:rel-column-width,'*')"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:if test="@table:number-columns-spanned">
+ <xsl:element name="字:跨列">
+ <xsl:attribute name="uof:locID">t0156</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:value-of select="@table:number-columns-spanned"/></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:for-each select="key('set_styleStyle',$StyleName)">
+ <xsl:element name="å­—:å•å…ƒæ ¼è¾¹è·">
+ <xsl:attribute name="uof:locID">t0151</xsl:attribute>
+ <xsl:attribute name="uof:attrList">上 å·¦ å³ ä¸‹</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="style:table-cell-properties/@fo:padding">
+ <xsl:attribute name="字:上"><xsl:value-of select="substring-before(style:table-cell-properties/@fo:padding,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="å­—:å·¦"><xsl:value-of select="substring-before(style:table-cell-properties/@fo:padding,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="å­—:å³"><xsl:value-of select="substring-before(style:table-cell-properties/@fo:padding,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="字:下"><xsl:value-of select="substring-before(style:table-cell-properties/@fo:padding,$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="字:上"><xsl:value-of select="substring-before(style:table-cell-properties/@fo:padding-top,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="å­—:å·¦"><xsl:value-of select="substring-before(style:table-cell-properties/@fo:padding-left,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="å­—:å³"><xsl:value-of select="substring-before(style:table-cell-properties/@fo:padding-right,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="字:下"><xsl:value-of select="substring-before(style:table-cell-properties/@fo:padding-bottom,$uofUnit)"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:if test="style:table-cell-properties/@fo:border or style:table-cell-properties/@fo:border-top or style:table-cell-properties/@fo:border-bottom or style:table-cell-properties/@fo:border-left or style:table-cell-properties/@fo:border-right or style:table-cell-properties/@style:shadow">
+ <xsl:element name="字:边框">
+ <xsl:attribute name="uof:locID">t0152</xsl:attribute>
+ <xsl:for-each select="style:table-cell-properties">
+ <xsl:call-template name="uof:边框"/>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:table-cell-properties/style:background-image/office:binary-data or style:table-cell-properties/@fo:background-color">
+ <å­—:å¡«å…… uof:locID="t0153">
+ <xsl:for-each select="style:table-cell-properties">
+ <xsl:call-template name="图:填充"/>
+ </xsl:for-each>
+ </å­—:å¡«å……>
+ </xsl:if>
+ <å­—:垂直对é½æ–¹å¼ uof:locID="t0154">
+ <xsl:choose>
+ <xsl:when test="style:table-cell-properties/@style:vertical-align='middle'">center</xsl:when>
+ <xsl:when test="style:table-cell-properties/@style:vertical-align='bottom'">bottom</xsl:when>
+ <xsl:otherwise>top</xsl:otherwise>
+ </xsl:choose>
+ </å­—:垂直对é½æ–¹å¼>
+ <xsl:element name="å­—:自动æ¢è¡Œ">
+ <xsl:attribute name="字:值">true</xsl:attribute>
+ <xsl:attribute name="uof:locID">t0157</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ </xsl:element>
+ <xsl:element name="字:适应文字">
+ <xsl:attribute name="字:值">true</xsl:attribute>
+ <xsl:attribute name="uof:locID">t0158</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:template>
+ <xsl:key name="bpath" match="//office:document/office:body/office:text/text:p/text:span" use="@text:style-name"/>
+ <xsl:template name="å­—:å¥å±žæ€§">
+ <xsl:element name="字:字体">
+ <xsl:attribute name="uof:locID">t0088</xsl:attribute>
+ <xsl:attribute name="uof:attrList">西文字体引用 中文字体引用 特殊字体引用 西文绘制 å­—å· ç›¸å¯¹å­—å· é¢œè‰²</xsl:attribute>
+ <xsl:if test="contains(@style:parent-style-name,'Header') or contains(@style:parent-style-name,'Foot') or contains(@style:parent-style-name,'Endnote')">
+ <xsl:attribute name="å­—:å­—å·">9</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@fo:font-size or style:text-properties/@style:font-size-asian or style:text-properties/@style:font-size-complex">
+ <xsl:choose>
+ <xsl:when test="contains(style:text-properties/@fo:font-size,'%') or contains(style:text-properties/@style:font-size-asian,'%')">
+ <xsl:attribute name="å­—:相对字å·"><xsl:choose><xsl:when test="style:text-properties/@fo:font-size"><xsl:value-of select="substring-before(style:text-properties/@fo:font-size,'%')"/></xsl:when><xsl:when test="style:text-properties/@style:font-size-asian"><xsl:value-of select="substring-before(style:text-properties/@style:font-size-asian,'%')"/></xsl:when></xsl:choose></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="å­—:å­—å·"><xsl:choose><xsl:when test="style:text-properties/@fo:font-size"><xsl:value-of select="substring-before(style:text-properties/@fo:font-size,'pt')"/></xsl:when><xsl:when test="style:text-properties/@style:font-size-asian"><xsl:value-of select="substring-before(style:text-properties/@style:font-size-asian,'pt')"/></xsl:when><xsl:when test="style:text-properties/@style:font-size-complex"><xsl:value-of select="substring-before(style:text-properties/@style:font-size-complex,'pt')"/></xsl:when></xsl:choose></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@style:font-name">
+ <xsl:variable name="xiwen" select="style:text-properties/@style:font-name"/>
+ <xsl:attribute name="字:西文字体引用"><xsl:value-of select="translate($xiwen,' ','_')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@style:font-name-asian">
+ <xsl:attribute name="字:中文字体引用"><xsl:value-of select="style:text-properties/@style:font-name-asian"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@fo:color">
+ <xsl:attribute name="字:颜色"><xsl:value-of select="style:text-properties/@fo:color"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:if test="style:text-properties/@fo:background-color and not(style:text-properties/@style:text-background-color='transparent')">
+ <xsl:element name="å­—:å¡«å……">
+ <xsl:attribute name="uof:locID">t0093</xsl:attribute>
+ <xsl:element name="图:图案">
+ <xsl:attribute name="uof:locID">g0036</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 图形引用 å‰æ™¯è‰² 背景色</xsl:attribute>
+ <xsl:if test="style:text-properties/@fo:background-color">
+ <xsl:attribute name="图:å‰æ™¯è‰²"><xsl:choose><xsl:when test="style:text-properties/@fo:background-color='transparent'">auto</xsl:when><xsl:otherwise><xsl:value-of select="style:text-properties/@fo:background-color"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@fo:font-weight or style:text-properties/@style:font-weight-asian">
+ <xsl:element name="字:粗体">
+ <xsl:attribute name="uof:locID">t0089</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test="style:text-properties/@style:font-weight-asian='bold' or style:text-properties/@fo:font-weight='bold'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@fo:font-style or style:text-properties/@style:font-style-asian">
+ <xsl:element name="字:斜体">
+ <xsl:attribute name="uof:locID">t0090</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test="style:text-properties/@fo:font-style='italic' or style:text-properties/@style:font-style-asian='italic'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@fo:background-color|style:text-properties/@style:text-background-color">
+ <xsl:element name="å­—:çªå‡ºæ˜¾ç¤º">
+ <xsl:attribute name="字:颜色"><xsl:choose><xsl:when test="style:text-properties/@fo:background-color='transparent' or style:text-properties/@style:text-background-color='transparent'">auto</xsl:when><xsl:otherwise><xsl:value-of select="style:text-properties/@fo:background-color|style:text-properties/@style:text-background-color"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="uof:locID">t0091</xsl:attribute>
+ <xsl:attribute name="uof:attrList">颜色</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@style:text-line-through-style">
+ <xsl:element name="字:删除线">
+ <xsl:attribute name="uof:locID">t0094</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型</xsl:attribute>
+ <xsl:attribute name="字:类型"><xsl:call-template name="uof:删除线类型"><xsl:with-param name="lineType" select="style:text-properties/@style:text-line-through-style"/></xsl:call-template></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@style:text-underline-style">
+ <xsl:element name="字:下划线">
+ <xsl:attribute name="uof:locID">t0095</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 颜色 字下划线</xsl:attribute>
+ <xsl:attribute name="字:类型"><xsl:call-template name="uof:线型类型"/></xsl:attribute>
+ <xsl:if test="style:text-properties/@style:text-underline-color">
+ <xsl:attribute name="字:颜色"><xsl:choose><xsl:when test="style:text-properties/@style:text-underline-color='font-color'">auto</xsl:when><xsl:otherwise><xsl:value-of select="style:text-properties/@style:text-underline-color"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@fo:text-shadow">
+ <xsl:element name="字:阴影">
+ <xsl:attribute name="uof:locID">t0100</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test="style:text-properties/@fo:text-shadow='none'">false</xsl:when><xsl:otherwise>true</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@style:text-emphasize">
+ <xsl:element name="å­—:ç€é‡å·">
+ <xsl:attribute name="uof:locID">t0096</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 颜色 å­—ç€é‡å·</xsl:attribute>
+ <xsl:attribute name="å­—:类型"><xsl:call-template name="uof:ç€é‡å·ç±»åž‹"><xsl:with-param name="te" select="style:text-properties/@style:text-emphasize"/></xsl:call-template></xsl:attribute>
+ <xsl:if test="style:text-properties/@fo:color">
+ <xsl:attribute name="字:颜色"><xsl:value-of select="style:text-properties/@fo:color"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@text:display">
+ <xsl:element name="å­—:éšè—文字">
+ <xsl:attribute name="uof:locID">t0097</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值">true</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@style:text-outline">
+ <xsl:element name="字:空心">
+ <xsl:attribute name="uof:locID">t0098</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:value-of select="style:text-properties/@style:text-outline"/></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@style:font-relief">
+ <xsl:element name="字:浮雕">
+ <xsl:attribute name="uof:locID">t0099</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型</xsl:attribute>
+ <xsl:attribute name="字:类型"><xsl:choose><xsl:when test="style:text-properties/@style:font-relief='embossed'">emboss</xsl:when><xsl:when test="style:text-properties/@style:font-relief='engraved'">engrave</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@fo:text-transform or style:text-properties/@fo:font-variant">
+ <xsl:element name="字:醒目字体">
+ <xsl:attribute name="uof:locID">t0101</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型</xsl:attribute>
+ <xsl:attribute name="字:类型"><xsl:choose><xsl:when test="style:text-properties/@fo:text-transform='uppercase'">uppercase</xsl:when><xsl:when test="style:text-properties/@fo:text-transform='lowercase'">lowercase</xsl:when><xsl:when test="style:text-properties/@fo:text-transform='capitalize'">capital</xsl:when><xsl:when test="style:text-properties/@fo:font-variant='small-caps'">small-caps</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@style:text-position">
+ <xsl:element name="å­—:ä½ç½®">
+ <xsl:attribute name="uof:locID">t0102</xsl:attribute>
+ <xsl:variable name="aa">
+ <xsl:value-of select="style:text-properties/@style:text-position"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="contains($aa,'sub')">
+ <xsl:value-of select="substring-before($aa,' ')"/>
+ </xsl:when>
+ <xsl:when test="contains($aa,'super')">
+ <xsl:value-of select="substring-before($aa,' ')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="translate($aa,'%','')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@style:text-scale">
+ <xsl:element name="字:缩放">
+ <xsl:attribute name="uof:locID">t0103</xsl:attribute>
+ <xsl:variable name="scale" select="style:text-properties/@style:text-scale"/>
+ <xsl:choose>
+ <xsl:when test="contains($scale,'%')">
+ <xsl:value-of select="substring-before($scale,'%')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="style:text-properties/@style:text-scale"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@fo:letter-spacing">
+ <xsl:element name="å­—:字符间è·">
+ <xsl:attribute name="uof:locID">t0104</xsl:attribute>
+ <xsl:value-of select="substring-before(style:text-properties/@fo:letter-spacing,$uofUnit)"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@style:letter-kerning">
+ <xsl:element name="å­—:调整字间è·">
+ <xsl:variable name="tt" select="style:text-properties/@style:letter-kerning"/>
+ <xsl:attribute name="uof:locID">t0105</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="$tt='true'">1</xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="å­—:字符对é½ç½‘æ ¼">
+ <xsl:attribute name="字:值">false</xsl:attribute>
+ <xsl:attribute name="uof:locID">t0106</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="uof:线型类型">
+ <xsl:variable name="spath" select="style:text-properties/@style:text-underline-style"/>
+ <xsl:variable name="wpath" select="style:text-properties/@style:text-underline-width"/>
+ <xsl:variable name="tpath" select="style:text-properties/@style:text-underline-type"/>
+ <xsl:choose>
+ <xsl:when test="$spath='solid' and not($tpath='double' ) and $wpath='auto' ">single</xsl:when>
+ <xsl:when test="$spath='solid' and $tpath='double' and $wpath='auto' ">double</xsl:when>
+ <xsl:when test="$spath='solid' and not($tpath='double' )and $wpath='bold' ">thick</xsl:when>
+ <xsl:when test="$spath='dotted' and not($tpath='double' )and $wpath='auto' ">dotted</xsl:when>
+ <xsl:when test="$spath='dotted' and not($tpath='double' )and $wpath='bold' ">dotted-heavy</xsl:when>
+ <xsl:when test="$spath='dash' and not($tpath='double' )and $wpath='auto' ">dash</xsl:when>
+ <xsl:when test="$spath='dash' and not($tpath='double' )and $wpath='bold' ">dashed-heavy</xsl:when>
+ <xsl:when test="$spath='long-dash' and not($tpath='double' )and $wpath='auto' ">dash-long</xsl:when>
+ <xsl:when test="$spath='long-dash' and not($tpath='double' )and $wpath='bold' ">dash-long-heavy</xsl:when>
+ <xsl:when test="$spath='dot-dash' and not($tpath='double' )and $wpath='auto' ">dot-dash</xsl:when>
+ <xsl:when test="$spath='dot-dash' and not($tpath='double' )and $wpath='bold' ">dash-dot-heavy</xsl:when>
+ <xsl:when test="$spath='dot-dot-dash' and not($tpath='double' )and $wpath='auto' ">dot-dot-dash</xsl:when>
+ <xsl:when test="$spath='dot-dot-dash' and not($tpath='double' )and $wpath='bold' ">dash-dot-dot-heavy</xsl:when>
+ <xsl:when test="$spath='wave' and not($tpath='double' )and $wpath='auto' ">wave</xsl:when>
+ <xsl:when test="$spath='wave' and not($tpath='double' )and $wpath='bold' ">wavy-heavy</xsl:when>
+ <xsl:when test="$spath='wave' and $tpath='double' and $wpath='auto' ">wavy-double</xsl:when>
+ <xsl:otherwise>none</xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="uof:删除线类型">
+ <xsl:param name="lineType"/>
+ <xsl:variable name="tw" select="style:text-properties/@style:text-line-through-width"/>
+ <xsl:variable name="tt" select="style:text-properties/@style:text-line-through-text"/>
+ <xsl:variable name="ttp" select="style:text-properties/@style:text-line-through-type"/>
+ <xsl:choose>
+ <xsl:when test="$lineType='solid'and $ttp='double'">double</xsl:when>
+ <xsl:when test="$lineType='solid'and $tw='bold'">bold</xsl:when>
+ <xsl:when test="$lineType='solid'and $tt='X'">xl</xsl:when>
+ <xsl:when test="$lineType='solid'and $tt='/'">/l</xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="not($lineType='none') ">single</xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="uof:ç€é‡å·ç±»åž‹">
+ <xsl:param name="te"/>
+ <xsl:choose>
+ <xsl:when test="$te='disc above' ">disc above</xsl:when>
+ <xsl:when test="$te='circle above' ">circle above</xsl:when>
+ <xsl:when test="$te='dot above' ">dot above</xsl:when>
+ <xsl:when test="$te='accent above' ">accent above</xsl:when>
+ <xsl:when test="$te='dot below' ">dot</xsl:when>
+ <xsl:when test="$te='circle below' ">circle below</xsl:when>
+ <xsl:when test="$te='disc below' ">disc below</xsl:when>
+ <xsl:when test="$te='accent below' ">accent below</xsl:when>
+ <xsl:otherwise>none</xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="uof:边框">
+ <xsl:choose>
+ <xsl:when test="@fo:border">
+ <xsl:call-template name="uof:左边框">
+ <xsl:with-param name="border" select="@fo:border"/>
+ </xsl:call-template>
+ <xsl:call-template name="uof:上边框">
+ <xsl:with-param name="border" select="@fo:border"/>
+ </xsl:call-template>
+ <xsl:call-template name="uof:å³è¾¹æ¡†">
+ <xsl:with-param name="border" select="@fo:border"/>
+ </xsl:call-template>
+ <xsl:call-template name="uof:下边框">
+ <xsl:with-param name="border" select="@fo:border"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="@fo:border-left or contains(substring-before(substring-after(@style:shadow,' '),' '),'-')">
+ <xsl:call-template name="uof:左边框">
+ <xsl:with-param name="border" select="@fo:border-left"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="@fo:border-top or contains(substring-after(substring-after(@style:shadow,' '),' '),'-')">
+ <xsl:call-template name="uof:上边框">
+ <xsl:with-param name="border" select="@fo:border-top"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="@fo:border-right or substring-before(substring-before(substring-after(@style:shadow,' '),' '),$ooUnit) &gt;0 or contains(substring-before(substring-after(@style:shadow,' '),' '),'+')">
+ <xsl:call-template name="uof:å³è¾¹æ¡†">
+ <xsl:with-param name="border" select="@fo:border-right"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="@fo:border-bottom or substring-before(substring-after(substring-after(@style:shadow,' '),' '),$ooUnit) &gt;0 or contains(substring-after(substring-after(@style:shadow,' '),' '),'+')">
+ <xsl:call-template name="uof:下边框">
+ <xsl:with-param name="border" select="@fo:border-bottom"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="uof:左边框">
+ <xsl:param name="border"/>
+ <xsl:element name="uof:å·¦">
+ <xsl:attribute name="uof:locID">u0057</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 宽度 è¾¹è· é¢œè‰² 阴影</xsl:attribute>
+ <xsl:attribute name="uof:类型"><xsl:choose><xsl:when test="$border!='none'"><xsl:choose><xsl:when test="substring-before(substring-after($border,' '),' ')='solid'">single</xsl:when><xsl:when test="substring-before(substring-after($border,' '),' ')='double'">double</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="$border!='none'">
+ <xsl:attribute name="uof:宽度"><xsl:value-of select="substring-before(substring-before($border,' '),substring($ooUnit,1,2))"/></xsl:attribute>
+ <xsl:attribute name="uof:颜色"><xsl:value-of select="substring-after(substring-after($border,' '),' ')"/></xsl:attribute>
+ <xsl:if test="@fo:padding or @fo:padding-left">
+ <xsl:attribute name="uof:è¾¹è·"><xsl:choose><xsl:when test="@fo:padding-left"><xsl:value-of select="substring-before(@fo:padding-left,$ooUnit)"/></xsl:when><xsl:otherwise><xsl:value-of select="substring-before(@fo:padding,$ooUnit)"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="contains(substring-before(substring-after(@style:shadow,' '),' '),'-')">
+ <xsl:attribute name="uof:阴影">true</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="uof:上边框">
+ <xsl:param name="border"/>
+ <xsl:element name="uof:上">
+ <xsl:attribute name="uof:locID">u0058</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 宽度 è¾¹è· é¢œè‰² 阴影</xsl:attribute>
+ <xsl:attribute name="uof:类型"><xsl:choose><xsl:when test="$border!='none'"><xsl:choose><xsl:when test="substring-before(substring-after($border,' '),' ')='solid'">single</xsl:when><xsl:when test="substring-before(substring-after($border,' '),' ')='double'">double</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="$border!='none'">
+ <xsl:attribute name="uof:宽度"><xsl:value-of select="substring-before(substring-before($border,' '),substring($ooUnit,1,2))"/></xsl:attribute>
+ <xsl:attribute name="uof:颜色"><xsl:value-of select="substring-after(substring-after($border,' '),' ')"/></xsl:attribute>
+ <xsl:if test="@fo:padding or @fo:padding-top">
+ <xsl:attribute name="uof:è¾¹è·"><xsl:choose><xsl:when test="@fo:padding-top"><xsl:value-of select="substring-before(@fo:padding-top,$ooUnit)"/></xsl:when><xsl:otherwise><xsl:value-of select="substring-before(@fo:padding,$ooUnit)"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="contains(substring-after(substring-after(@style:shadow,' '),' '),'-')">
+ <xsl:attribute name="uof:阴影">true</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="uof:å³è¾¹æ¡†">
+ <xsl:param name="border"/>
+ <xsl:element name="uof:å³">
+ <xsl:attribute name="uof:locID">u0059</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 宽度 è¾¹è· é¢œè‰² 阴影</xsl:attribute>
+ <xsl:attribute name="uof:类型"><xsl:choose><xsl:when test="$border!='none'"><xsl:choose><xsl:when test="substring-before(substring-after($border,' '),' ')='solid'">single</xsl:when><xsl:when test="substring-before(substring-after($border,' '),' ')='double'">double</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="$border!='none'">
+ <xsl:attribute name="uof:宽度"><xsl:value-of select="substring-before(substring-before($border,' '),substring($ooUnit,1,2))"/></xsl:attribute>
+ <xsl:attribute name="uof:颜色"><xsl:value-of select="substring-after(substring-after($border,' '),' ')"/></xsl:attribute>
+ <xsl:if test="@fo:padding or @fo:padding-right">
+ <xsl:attribute name="uof:è¾¹è·"><xsl:choose><xsl:when test="@fo:padding-right"><xsl:value-of select="substring-before(@fo:padding-right,$ooUnit)"/></xsl:when><xsl:otherwise><xsl:value-of select="substring-before(@fo:padding,$ooUnit)"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="substring-before(substring-before(substring-after(@style:shadow,' '),' '),$ooUnit) &gt;0 or contains(substring-before(substring-after(@style:shadow,' '),' '),'+')">
+ <xsl:attribute name="uof:阴影">true</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="uof:下边框">
+ <xsl:param name="border"/>
+ <xsl:element name="uof:下">
+ <xsl:attribute name="uof:locID">u0060</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 宽度 è¾¹è· é¢œè‰² 阴影</xsl:attribute>
+ <xsl:attribute name="uof:类型"><xsl:choose><xsl:when test="$border!='none'"><xsl:choose><xsl:when test="substring-before(substring-after($border,' '),' ')='solid'">single</xsl:when><xsl:when test="substring-before(substring-after($border,' '),' ')='double'">double</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="$border!='none'">
+ <xsl:attribute name="uof:宽度"><xsl:value-of select="substring-before(substring-before($border,' '),substring($ooUnit,1,2))"/></xsl:attribute>
+ <xsl:attribute name="uof:颜色"><xsl:value-of select="substring-after(substring-after($border,' '),' ')"/></xsl:attribute>
+ <xsl:if test="@fo:padding or @fo:padding-bottom">
+ <xsl:attribute name="uof:è¾¹è·"><xsl:choose><xsl:when test="@fo:padding-bottom"><xsl:value-of select="substring-before(@fo:padding-bottom,$ooUnit)"/></xsl:when><xsl:otherwise><xsl:value-of select="substring-before(@fo:padding,$ooUnit)"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="substring-before(substring-after(substring-after(@style:shadow,' '),' '),$ooUnit) &gt;0 or contains(substring-after(substring-after(@style:shadow,' '),' '),'+')">
+ <xsl:attribute name="uof:阴影">true</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:template>
+ <xsl:key name="geshi" match="//office:document/office:automatic-styles/number:date-style | //office:document/office:automatic-styles/number:time-style" use="@style:name"/>
+ <xsl:template name="inline-text">
+ <xsl:param name="pStyleName"/>
+ <xsl:param name="bText"/>
+ <xsl:apply-templates select="text()|textspan|jiaozhu|weizhu|office:annotation|text:sequence|text:date|text:time|text:page-number|text:page-count|text:subject|text:title|text:initial-creator|text:author-name|text:author-initials|text:file-name|text:change-start|text:change-end|text:change">
+ <xsl:with-param name="pStyleName" select="$pStyleName"/>
+ <xsl:with-param name="bText" select="$bText"/>
+ </xsl:apply-templates>
+ </xsl:template>
+ <xsl:template match="text:sequence">
+ <xsl:param name="tStyle"/>
+ <xsl:if test="@text:name='Illustration' or @text:name='Text' or @text:name='Drawing' or @text:name='Table'">
+ <xsl:element name="字:域开始">
+ <xsl:attribute name="字:类型"><xsl:value-of select="'seq'"/></xsl:attribute>
+ <xsl:attribute name="uof:locID">t0079</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 é”定</xsl:attribute>
+ </xsl:element>
+ <xsl:element name="å­—:域代ç ">
+ <xsl:attribute name="uof:locID">t0080</xsl:attribute>
+ <å­—:æ®µè½ uof:locID="t0051" uof:attrList="标识符">
+ <å­—:å¥ uof:locID="t0085">
+ <xsl:if test="$tStyle!=''">
+ <å­—:å¥å±žæ€§ å­—:å¼æ ·å¼•ç”¨="{$tStyle}" uof:locID="t0086" uof:attrList="å¼æ ·å¼•ç”¨"/>
+ </xsl:if>
+ <xsl:variable name="fmt">
+ <xsl:call-template name="ooæ•°å­—æ ¼å¼åŸŸå¼€å…³">
+ <xsl:with-param name="oo_format" select="@style:num-format"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <字:文本串>
+ <xsl:attribute name="uof:locID">t0109</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符</xsl:attribute>
+ <xsl:value-of select="concat('SEQ ',@text:name,' \* ',$fmt,' \f ',@text:formula)"/>
+ </字:文本串>
+ </å­—:å¥>
+ </å­—:段è½>
+ </xsl:element>
+ <å­—:å¥ uof:locID="t0085">
+ <字:文本串>
+ <xsl:attribute name="uof:locID">t0109</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符</xsl:attribute>
+ <xsl:value-of select="string(.)"/>
+ </字:文本串>
+ </å­—:å¥>
+ <xsl:element name="å­—:域结æŸ">
+ <xsl:attribute name="uof:locID">t0081</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="text:time">
+ <xsl:element name="字:域开始">
+ <xsl:attribute name="字:类型"><xsl:value-of select="'time'"/></xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="text:fixed='1'">
+ <xsl:attribute name="å­—:é”定">true</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="å­—:é”定">false</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="uof:locID">t0079</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 é”定</xsl:attribute>
+ </xsl:element>
+ <xsl:element name="å­—:域代ç ">
+ <xsl:attribute name="uof:locID">t0080</xsl:attribute>
+ <å­—:æ®µè½ uof:locID="t0051" uof:attrList="标识符">
+ <å­—:å¥ uof:locID="t0085">
+ <å­—:å¥å±žæ€§ uof:locID="t0086" uof:attrList="å¼æ ·å¼•ç”¨"/>
+ <xsl:variable name="timefmt">
+ <xsl:variable name="aa" select="@style:data-style-name"/>
+ <xsl:for-each select="key('geshi',$aa)/number:hours | key('geshi',$aa)/number:minutes | key('geshi',$aa)/number:am-pm | key('geshi',$aa)/number:seconds | key('geshi',$aa)/number:text">
+ <xsl:choose>
+ <xsl:when test="@number:style='long' ">
+ <xsl:if test="self::node( )[name(.)='number:hours']">HH</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:minutes']">MM</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:seconds']">SS</xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="self::node( )[name(.)='number:text']">
+ <xsl:value-of select="."/>
+ </xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:hours']">H</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:minutes']">M</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:seconds']">S</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:am-pm']">am/pm</xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:variable name="quote">"</xsl:variable>
+ <字:文本串>
+ <xsl:attribute name="uof:locID">t0109</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符</xsl:attribute>
+ <xsl:value-of select="concat('TIME \@ ',$quote,$timefmt,$quote)"/>
+ </字:文本串>
+ </å­—:å¥>
+ </å­—:段è½>
+ </xsl:element>
+ <å­—:å¥ uof:locID="t0085">
+ <字:文本串>
+ <xsl:attribute name="uof:locID">t0109</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符</xsl:attribute>
+ <xsl:value-of select="string(.)"/>
+ </字:文本串>
+ </å­—:å¥>
+ <xsl:element name="å­—:域结æŸ">
+ <xsl:attribute name="uof:locID">t0081</xsl:attribute>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="text:date">
+ <xsl:element name="字:域开始">
+ <xsl:attribute name="字:类型"><xsl:value-of select="'date'"/></xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="text:fixed='1'">
+ <xsl:attribute name="å­—:é”定">true</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="å­—:é”定">false</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="uof:locID">t0079</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 é”定</xsl:attribute>
+ </xsl:element>
+ <xsl:element name="å­—:域代ç ">
+ <xsl:attribute name="uof:locID">t0080</xsl:attribute>
+ <å­—:æ®µè½ uof:locID="t0051" uof:attrList="标识符">
+ <å­—:å¥ uof:locID="t0085">
+ <å­—:å¥å±žæ€§ uof:locID="t0086" uof:attrList="å¼æ ·å¼•ç”¨"/>
+ <xsl:variable name="datefmt">
+ <xsl:variable name="bb" select="@style:data-style-name"/>
+ <xsl:for-each select="key('geshi',$bb)/number:year | key('geshi',$bb)/number:month | key('geshi',$bb)/number:day | key('geshi',$bb)/number:hours | key('geshi',$bb)/number:minutes | key('geshi',$bb)/number:seconds | key('geshi',$bb)/number:quarter | key('geshi',$bb)/number:day-of-week | key('geshi',$bb)/number:week-of-year | key('geshi',$bb)/number:text | key('geshi',$bb)/number:am-pm">
+ <xsl:choose>
+ <xsl:when test="@number:style='long' ">
+ <xsl:if test="self::node( )[name(.)='number:year']">yyyy</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:month']">MM</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:day']">dd</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:hours']">hh</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:minutes']">mm</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:seconds']">ss</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:quarter']">第QQ季度</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:day-of-week']">星期N</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:week-of-year']">WW</xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="self::node( )[name(.)='number:text']">
+ <xsl:value-of select="."/>
+ </xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:year']">yy</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:month']">M</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:day']">d</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:hours']">h</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:minutes']">m</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:seconds']">s</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:quarter']">Qå­£</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:day-of-week']">星期N</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:week-of-year']">WW</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:am-pm']">am/pm</xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:variable name="quote">"</xsl:variable>
+ <字:文本串>
+ <xsl:attribute name="uof:locID">t0109</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符</xsl:attribute>
+ <xsl:value-of select="concat('CREATEDATE \@ ',$quote,$datefmt,$quote)"/>
+ </字:文本串>
+ </å­—:å¥>
+ </å­—:段è½>
+ </xsl:element>
+ <å­—:å¥ uof:locID="t0085">
+ <字:文本串>
+ <xsl:attribute name="uof:locID">t0109</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符</xsl:attribute>
+ <xsl:value-of select="string(.)"/>
+ </字:文本串>
+ </å­—:å¥>
+ <xsl:element name="å­—:域结æŸ">
+ <xsl:attribute name="uof:locID">t0081</xsl:attribute>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="ooæ•°å­—æ ¼å¼åŸŸå¼€å…³">
+ <xsl:param name="oo_format"/>
+ <xsl:choose>
+ <xsl:when test="$oo_format='1'">Arabic</xsl:when>
+ <xsl:when test="$oo_format='I'">ROMAN</xsl:when>
+ <xsl:when test="$oo_format='i'">roman</xsl:when>
+ <xsl:when test="$oo_format='A'">ALPHABETIC</xsl:when>
+ <xsl:when test="$oo_format='a'">alphabetic</xsl:when>
+ <xsl:when test="$oo_format='1, 2, 3, ...'">GB1</xsl:when>
+ <xsl:when test="$oo_format='â‘ , â‘¡, â‘¢, ...'">GB3</xsl:when>
+ <xsl:when test="$oo_format='一, 二, 三, ...'">CHINESENUM3</xsl:when>
+ <xsl:when test="$oo_format='壹, è´°, å, ...'">CHINESENUM2</xsl:when>
+ <xsl:when test="$oo_format='甲, 乙, 丙, ...'">ZODIAC1</xsl:when>
+ <xsl:when test="$oo_format='å­, 丑, 寅, ...'">ZODIAC2</xsl:when>
+ <xsl:otherwise>Arabic</xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="text:page-number">
+ <xsl:element name="字:域开始">
+ <xsl:attribute name="字:类型"><xsl:value-of select="'page'"/></xsl:attribute>
+ <xsl:attribute name="uof:locID">t0079</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 é”定</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="text:fixed='1'">
+ <xsl:attribute name="å­—:é”定">true</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="å­—:é”定">false</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:element name="å­—:域代ç ">
+ <xsl:attribute name="uof:locID">t0080</xsl:attribute>
+ <å­—:æ®µè½ uof:locID="t0051" uof:attrList="标识符">
+ <å­—:å¥ uof:locID="t0085">
+ <å­—:å¥å±žæ€§ uof:locID="t0086" uof:attrList="å¼æ ·å¼•ç”¨"/>
+ <xsl:variable name="fmt">
+ <xsl:call-template name="ooæ•°å­—æ ¼å¼åŸŸå¼€å…³">
+ <xsl:with-param name="oo_format" select="@style:num-format"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <字:文本串>
+ <xsl:attribute name="uof:locID">t0109</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="@style:num-format">
+ <xsl:value-of select="concat('PAGE \* ',$fmt)"/>
+ </xsl:when>
+ <xsl:otherwise>PAGE</xsl:otherwise>
+ </xsl:choose>
+ </字:文本串>
+ </å­—:å¥>
+ </å­—:段è½>
+ </xsl:element>
+ <å­—:å¥ uof:locID="t0085">
+ <字:文本串>
+ <xsl:attribute name="uof:locID">t0109</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符</xsl:attribute>
+ <xsl:value-of select="string(.)"/>
+ </字:文本串>
+ </å­—:å¥>
+ <xsl:element name="å­—:域结æŸ">
+ <xsl:attribute name="uof:locID">t0081</xsl:attribute>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="text:page-count">
+ <xsl:element name="字:域开始">
+ <xsl:attribute name="字:类型"><xsl:value-of select="'numpages'"/></xsl:attribute>
+ <xsl:attribute name="uof:locID">t0079</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 é”定</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="text:fixed='1'or text:fixed='true'">
+ <xsl:attribute name="å­—:é”定">true</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="å­—:é”定">false</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:element name="å­—:域代ç ">
+ <xsl:attribute name="uof:locID">t0080</xsl:attribute>
+ <å­—:æ®µè½ uof:locID="t0051" uof:attrList="标识符">
+ <å­—:å¥ uof:locID="t0085">
+ <å­—:å¥å±žæ€§ uof:locID="t0086" uof:attrList="å¼æ ·å¼•ç”¨"/>
+ <xsl:variable name="fmt">
+ <xsl:call-template name="ooæ•°å­—æ ¼å¼åŸŸå¼€å…³">
+ <xsl:with-param name="oo_format" select="@style:num-format"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <字:文本串>
+ <xsl:attribute name="uof:locID">t0109</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="@style:num-format">
+ <xsl:value-of select="concat('NumPages \* ',$fmt,' \* Upper')"/>
+ </xsl:when>
+ <xsl:otherwise>NumPages</xsl:otherwise>
+ </xsl:choose>
+ </字:文本串>
+ </å­—:å¥>
+ </å­—:段è½>
+ </xsl:element>
+ <å­—:å¥ uof:locID="t0085">
+ <字:文本串>
+ <xsl:attribute name="uof:locID">t0109</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符</xsl:attribute>
+ <xsl:value-of select="string(.)"/>
+ </字:文本串>
+ </å­—:å¥>
+ <xsl:element name="å­—:域结æŸ">
+ <xsl:attribute name="uof:locID">t0081</xsl:attribute>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="text:initial-creator">
+ <xsl:element name="字:域开始">
+ <xsl:attribute name="字:类型"><xsl:value-of select="'author'"/></xsl:attribute>
+ <xsl:attribute name="uof:locID">t0079</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 é”定</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="text:fixed='1'or text:fixed='true'">
+ <xsl:attribute name="å­—:é”定">true</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="å­—:é”定">false</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:element name="å­—:域代ç ">
+ <xsl:attribute name="uof:locID">t0080</xsl:attribute>
+ <å­—:æ®µè½ uof:locID="t0051" uof:attrList="标识符">
+ <å­—:å¥ uof:locID="t0085">
+ <å­—:å¥å±žæ€§ uof:locID="t0086" uof:attrList="å¼æ ·å¼•ç”¨"/>
+ <字:文本串>
+ <xsl:attribute name="uof:locID">t0109</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符</xsl:attribute>
+ <!--xsl:value-of select="concat('AUTHOR \* ','Caps',' \* MERGEFORMAT')"/-->
+ <xsl:value-of select="'AUTHOR'"/>
+ </字:文本串>
+ </å­—:å¥>
+ </å­—:段è½>
+ </xsl:element>
+ <å­—:å¥ uof:locID="t0085">
+ <字:文本串>
+ <xsl:attribute name="uof:locID">t0109</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符</xsl:attribute>
+ <xsl:value-of select="string(.)"/>
+ </字:文本串>
+ </å­—:å¥>
+ <xsl:element name="å­—:域结æŸ">
+ <xsl:attribute name="uof:locID">t0081</xsl:attribute>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="text:author-name">
+ <xsl:param name="tStyle"/>
+ <xsl:element name="字:域开始">
+ <xsl:attribute name="字:类型"><xsl:value-of select="'username'"/></xsl:attribute>
+ <xsl:attribute name="uof:locID">t0079</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 é”定</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="text:fixed='1'or text:fixed='true'">
+ <xsl:attribute name="å­—:é”定">true</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="å­—:é”定">false</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:element name="å­—:域代ç ">
+ <xsl:attribute name="uof:locID">t0080</xsl:attribute>
+ <å­—:æ®µè½ uof:locID="t0051" uof:attrList="标识符">
+ <å­—:å¥ uof:locID="t0085">
+ <xsl:if test="$tStyle!=''">
+ <å­—:å¥å±žæ€§ å­—:å¼æ ·å¼•ç”¨="{$tStyle}" uof:locID="t0086" uof:attrList="å¼æ ·å¼•ç”¨"/>
+ </xsl:if>
+ <字:文本串 uof:locID="t0109" uof:attrList="标识符">AUTHOR</字:文本串>
+ </å­—:å¥>
+ </å­—:段è½>
+ </xsl:element>
+ <å­—:å¥ uof:locID="t0085">
+ <字:文本串 uof:locID="t0109" uof:attrList="标识符">
+ <xsl:value-of select="."/>
+ </字:文本串>
+ </å­—:å¥>
+ <xsl:element name="å­—:域结æŸ">
+ <xsl:attribute name="uof:locID">t0081</xsl:attribute>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="text:author-initials">
+ <xsl:param name="tStyle"/>
+ <xsl:element name="字:域开始">
+ <xsl:attribute name="字:类型"><xsl:value-of select="'userinitials'"/></xsl:attribute>
+ <xsl:attribute name="uof:locID">t0079</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 é”定</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="text:fixed='1'or text:fixed='true'">
+ <xsl:attribute name="å­—:é”定">true</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="å­—:é”定">false</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:element name="å­—:域代ç ">
+ <xsl:attribute name="uof:locID">t0080</xsl:attribute>
+ <å­—:æ®µè½ uof:locID="t0051" uof:attrList="标识符">
+ <å­—:å¥ uof:locID="t0085">
+ <xsl:if test="$tStyle!=''">
+ <å­—:å¥å±žæ€§ å­—:å¼æ ·å¼•ç”¨="{$tStyle}" uof:locID="t0086" uof:attrList="å¼æ ·å¼•ç”¨"/>
+ </xsl:if>
+ <字:文本串 uof:locID="t0109" uof:attrList="标识符">AUTHOR</字:文本串>
+ </å­—:å¥>
+ </å­—:段è½>
+ </xsl:element>
+ <å­—:å¥ uof:locID="t0085">
+ <字:文本串 uof:locID="t0109" uof:attrList="标识符">
+ <xsl:value-of select="."/>
+ </字:文本串>
+ </å­—:å¥>
+ <xsl:element name="å­—:域结æŸ">
+ <xsl:attribute name="uof:locID">t0081</xsl:attribute>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="text:title">
+ <xsl:element name="字:域开始">
+ <xsl:attribute name="字:类型"><xsl:value-of select="'title'"/></xsl:attribute>
+ <xsl:attribute name="uof:locID">t0079</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 é”定</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="text:fixed='1'or text:fixed='true'">
+ <xsl:attribute name="å­—:é”定">true</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="å­—:é”定">false</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:element name="å­—:域代ç ">
+ <xsl:attribute name="uof:locID">t0080</xsl:attribute>
+ <å­—:æ®µè½ uof:locID="t0051" uof:attrList="标识符">
+ <å­—:å¥ uof:locID="t0085">
+ <å­—:å¥å±žæ€§ uof:locID="t0086" uof:attrList="å¼æ ·å¼•ç”¨"/>
+ <xsl:variable name="titlename" select="/office:document/office:meta/dc:title"/>
+ <字:文本串 uof:locID="t0109" uof:attrList="标识符">
+ <xsl:value-of select="concat('TITLE',' \* Upper')"/>
+ </字:文本串>
+ </å­—:å¥>
+ </å­—:段è½>
+ </xsl:element>
+ <å­—:å¥ uof:locID="t0085">
+ <字:文本串 uof:locID="t0109" uof:attrList="标识符">
+ <xsl:value-of select="."/>
+ </字:文本串>
+ </å­—:å¥>
+ <xsl:element name="å­—:域结æŸ">
+ <xsl:attribute name="uof:locID">t0081</xsl:attribute>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="text:subject">
+ <xsl:element name="字:域开始">
+ <xsl:attribute name="字:类型"><xsl:value-of select="'subject'"/></xsl:attribute>
+ <xsl:attribute name="uof:locID">t0079</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 é”定</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="text:fixed='1'or text:fixed='true'">
+ <xsl:attribute name="å­—:é”定">true</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="å­—:é”定">false</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:element name="å­—:域代ç ">
+ <xsl:attribute name="uof:locID">t0080</xsl:attribute>
+ <å­—:æ®µè½ uof:locID="t0051" uof:attrList="标识符">
+ <å­—:å¥ uof:locID="t0085">
+ <å­—:å¥å±žæ€§ uof:locID="t0086" uof:attrList="å¼æ ·å¼•ç”¨"/>
+ <字:文本串 uof:locID="t0109" uof:attrList="标识符">
+ <xsl:value-of select="concat('SUBJECT \* ','Caps',' \* MERGEFORMAT')"/>
+ </字:文本串>
+ </å­—:å¥>
+ </å­—:段è½>
+ </xsl:element>
+ <å­—:å¥ uof:locID="t0085">
+ <字:文本串 uof:locID="t0109" uof:attrList="标识符">
+ <xsl:value-of select="."/>
+ </字:文本串>
+ </å­—:å¥>
+ <xsl:element name="å­—:域结æŸ">
+ <xsl:attribute name="uof:locID">t0081</xsl:attribute>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="text:file-name">
+ <xsl:element name="字:域开始">
+ <xsl:attribute name="字:类型"><xsl:value-of select="'filename'"/></xsl:attribute>
+ <xsl:attribute name="uof:locID">t0079</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 é”定</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="text:fixed='1'or text:fixed='true'">
+ <xsl:attribute name="å­—:é”定">true</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="å­—:é”定">false</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:element name="å­—:域代ç ">
+ <xsl:attribute name="uof:locID">t0080</xsl:attribute>
+ <å­—:æ®µè½ uof:locID="t0051" uof:attrList="标识符">
+ <å­—:å¥ uof:locID="t0085">
+ <å­—:å¥å±žæ€§ uof:locID="t0086" uof:attrList="å¼æ ·å¼•ç”¨"/>
+ <字:文本串 uof:locID="t0109" uof:attrList="标识符">
+ <!--xsl:value-of select="concat('FILENAME \* ','Caps',' \* MERGEFORMAT')"/-->
+ <xsl:value-of select="concat('FILENAME',' \p')"/>
+ </字:文本串>
+ </å­—:å¥>
+ </å­—:段è½>
+ </xsl:element>
+ <å­—:å¥ uof:locID="t0085">
+ <字:文本串 uof:locID="t0109" uof:attrList="标识符">
+ <xsl:value-of select="."/>
+ </字:文本串>
+ </å­—:å¥>
+ <xsl:element name="å­—:域结æŸ">
+ <xsl:attribute name="uof:locID">t0081</xsl:attribute>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="text:editing-duration">
+ <xsl:element name="字:域开始">
+ <xsl:attribute name="字:类型"><xsl:value-of select="'edittime'"/></xsl:attribute>
+ <xsl:attribute name="uof:locID">t0079</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 é”定</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="text:fixed='1'or text:fixed='true'">
+ <xsl:attribute name="å­—:é”定">true</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="å­—:é”定">false</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:element name="å­—:域代ç ">
+ <xsl:attribute name="uof:locID">t0080</xsl:attribute>
+ <å­—:æ®µè½ uof:locID="t0051" uof:attrList="标识符">
+ <å­—:å¥ uof:locID="t0085">
+ <å­—:å¥å±žæ€§ uof:locID="t0086" uof:attrList="å¼æ ·å¼•ç”¨"/>
+ <xsl:variable name="timefmt">
+ <xsl:variable name="aa" select="@style:data-style-name"/>
+ <xsl:for-each select="key('geshi',$aa)/number:hours | key('geshi',$aa)/number:minutes | key('geshi',$aa)/number:am-pm | key('geshi',$aa)/number:seconds | key('geshi',$aa)/number:text">
+ <xsl:choose>
+ <xsl:when test="@number:style='long' ">
+ <xsl:if test="self::node( )[name(.)='number:hours']">HH</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:minutes']">MM</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:seconds']">SS</xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="self::node( )[name(.)='number:text']">
+ <xsl:value-of select="."/>
+ </xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:hours']">H</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:minutes']">M</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:seconds']">S</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:am-pm']">am/pm</xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:variable name="quote">"</xsl:variable>
+ <字:文本串>
+ <xsl:attribute name="uof:locID">t0109</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符</xsl:attribute>
+ <xsl:value-of select="concat('EDITTIME \@ ',$quote,$timefmt,$quote,' \* MERGEFORMAT ')"/>
+ </字:文本串>
+ </å­—:å¥>
+ </å­—:段è½>
+ </xsl:element>
+ <å­—:å¥ uof:locID="t0085">
+ <字:文本串>
+ <xsl:attribute name="uof:locID">t0109</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符</xsl:attribute>
+ <xsl:value-of select="."/>
+ </字:文本串>
+ </å­—:å¥>
+ <xsl:element name="å­—:域结æŸ">
+ <xsl:attribute name="uof:locID">t0081</xsl:attribute>
+ </xsl:element>
+ </xsl:template>
+ <xsl:key name="path" match="//office:document/office:automatic-styles/style:style" use="@style:name"/>
+ <xsl:template name="text:table-of-content">
+ <xsl:element name="å­—:段è½">
+ <xsl:attribute name="uof:locID">t0051</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符</xsl:attribute>
+ <xsl:element name="å­—:段è½å±žæ€§">
+ <xsl:attribute name="uof:locID">t0052</xsl:attribute>
+ <xsl:attribute name="uof:attrList">å¼æ ·å¼•ç”¨</xsl:attribute>
+ <xsl:attribute name="å­—:å¼æ ·å¼•ç”¨"><xsl:value-of select="text:index-body/text:p/@text:style-name"/></xsl:attribute>
+ <xsl:element name="å­—:制表ä½è®¾ç½®">
+ <xsl:attribute name="uof:locID">t0067</xsl:attribute>
+ <xsl:element name="å­—:制表ä½">
+ <xsl:attribute name="uof:locID">t0068</xsl:attribute>
+ <xsl:attribute name="uof:attrList">ä½ç½® 类型 å‰å¯¼ç¬¦ 制表ä½å­—符</xsl:attribute>
+ <xsl:variable name="aa" select="text:index-body/text:p/@text:style-name"/>
+ <xsl:attribute name="å­—:ä½ç½®"><xsl:value-of select="substring-before(key('path',$aa)/style:paragraph-properties/style:tab-stops/style:tab-stop/@style:position,$ooUnit)"/></xsl:attribute>
+ <xsl:attribute name="字:类型"><xsl:value-of select="key('path',$aa)/style:paragraph-properties/style:tab-stops/style:tab-stop/@style:type"/></xsl:attribute>
+ <xsl:attribute name="å­—:制表ä½å­—符"><xsl:value-of select="key('path',$aa)/style:paragraph-properties/style:tab-stops/style:tab-stop/@style:leader-text"/></xsl:attribute>
+ <xsl:if test="key('path',$aa)/style:paragraph-properties/style:tab-stops/style:tab-stop/@style:leader-style">
+ <xsl:attribute name="å­—:å‰å¯¼ç¬¦"><xsl:value-of select="key('path',$aa)/style:paragraph-properties/style:tab-stops/style:tab-stop/@style:leader-style"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:element>
+ <xsl:element name="å­—:是å¦è¡Œé¦–标点压缩">
+ <xsl:attribute name="uof:locID">t0075</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值">true</xsl:attribute>
+ </xsl:element>
+ <xsl:element name="字:中文习惯首尾字符">
+ <xsl:attribute name="字:值">true</xsl:attribute>
+ <xsl:attribute name="uof:locID">t0076</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ </xsl:element>
+ </xsl:element>
+ <xsl:element name="字:域开始">
+ <xsl:attribute name="字:类型"><xsl:value-of select="'REF'"/></xsl:attribute>
+ <xsl:if test="@text:protected">
+ <xsl:attribute name="å­—:é”定"><xsl:value-of select="@text:protected"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="uof:locID">t0079</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 é”定</xsl:attribute>
+ </xsl:element>
+ <xsl:element name="å­—:域代ç ">
+ <xsl:attribute name="uof:locID">t0080</xsl:attribute>
+ <å­—:æ®µè½ uof:locID="t0051" uof:attrList="标识符">
+ <å­—:å¥ uof:locID="t0085">
+ <字:文本串>
+ <xsl:attribute name="uof:locID">t0109</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符</xsl:attribute>
+ <xsl:value-of select="'TOC \o 1-10 \h \z'"/>
+ </字:文本串>
+ </å­—:å¥>
+ </å­—:段è½>
+ <xsl:for-each select="text:index-body/text:index-title/text:p">
+ <xsl:element name="å­—:段è½" uof:locID="t0051" uof:attrList="标识符">
+ <xsl:element name="å­—:段è½å±žæ€§">
+ <xsl:attribute name="uof:locID">t0052</xsl:attribute>
+ <xsl:attribute name="uof:attrList">å¼æ ·å¼•ç”¨</xsl:attribute>
+ <xsl:attribute name="å­—:å¼æ ·å¼•ç”¨"><xsl:value-of select="@text:style-name"/></xsl:attribute>
+ </xsl:element>
+ <xsl:element name="å­—:å¥">
+ <å­—:å¥å±žæ€§ uof:locID="t0086" uof:attrList="å¼æ ·å¼•ç”¨">
+ <xsl:attribute name="å­—:å¼æ ·å¼•ç”¨"><xsl:value-of select="@text:style-name"/></xsl:attribute>
+ </å­—:å¥å±žæ€§>
+ <xsl:element name="字:文本串">
+ <xsl:attribute name="uof:locID">t0109</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符</xsl:attribute>
+ <xsl:value-of select="self::node()"/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:element>
+ </xsl:for-each>
+ <xsl:for-each select="text:index-body/text:p">
+ <xsl:element name="å­—:段è½" uof:locID="t0051" uof:attrList="标识符">
+ <xsl:element name="å­—:段è½å±žæ€§">
+ <xsl:attribute name="uof:locID">t0052</xsl:attribute>
+ <xsl:attribute name="uof:attrList">å¼æ ·å¼•ç”¨</xsl:attribute>
+ <xsl:attribute name="å­—:å¼æ ·å¼•ç”¨"><xsl:value-of select="@text:style-name"/></xsl:attribute>
+ <xsl:element name="å­—:制表ä½è®¾ç½®">
+ <xsl:attribute name="uof:locID">t0067</xsl:attribute>
+ <xsl:element name="å­—:制表ä½">
+ <xsl:attribute name="uof:locID">t0068</xsl:attribute>
+ <xsl:attribute name="uof:attrList">ä½ç½® 类型 å‰å¯¼ç¬¦</xsl:attribute>
+ <xsl:variable name="aa" select="@text:style-name"/>
+ <xsl:attribute name="å­—:ä½ç½®"><xsl:value-of select="substring-before(key('path',$aa)/style:paragraph-properties/style:tab-stops/style:tab-stop/@style:position,$ooUnit)"/></xsl:attribute>
+ <xsl:attribute name="字:类型"><xsl:value-of select="key('path',$aa)/style:paragraph-properties/style:tab-stops/style:tab-stop/@style:type"/></xsl:attribute>
+ <xsl:attribute name="å­—:制表ä½å­—符"><xsl:value-of select="key('path',$aa)/style:paragraph-properties/style:tab-stops/style:tab-stop/@style:leader-text"/></xsl:attribute>
+ <xsl:if test="key('path',$aa)/style:paragraph-properties/style:tab-stops/style:tab-stop/@style:leader-style">
+ <xsl:attribute name="å­—:å‰å¯¼ç¬¦"><xsl:value-of select="key('path',$aa)/style:paragraph-properties/style:tab-stops/style:tab-stop/@style:leader-style"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:element>
+ <xsl:element name="å­—:是å¦è¡Œé¦–标点压缩">
+ <xsl:attribute name="uof:locID">t0075</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值">true</xsl:attribute>
+ </xsl:element>
+ <xsl:element name="字:中文习惯首尾字符">
+ <xsl:attribute name="字:值">true</xsl:attribute>
+ <xsl:attribute name="uof:locID">t0076</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ </xsl:element>
+ </xsl:element>
+ <xsl:if test="self::node()/text:a">
+ <å­—:å¥ uof:locID="t0085">
+ <xsl:variable name="num">
+ <xsl:number from="/office:document/office:body/office:text" level="any" count="text:a"/>
+ </xsl:variable>
+ <xsl:element name="字:区域开始">
+ <xsl:attribute name="字:标识符"><xsl:value-of select="concat('hlnk',$num + 1)"/></xsl:attribute>
+ <xsl:attribute name="å­—:å称">Hyperlink</xsl:attribute>
+ <xsl:attribute name="字:类型">hyperlink</xsl:attribute>
+ <xsl:attribute name="uof:locID">t0121</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符 å称 类型</xsl:attribute>
+ </xsl:element>
+ <xsl:for-each select="text:a/node()">
+ <xsl:choose>
+ <xsl:when test="name(.)='text:tab-stop' or name(.)='text:tab'">
+ <xsl:element name="字:制表符" uof:locID="t0123"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="字:文本串">
+ <xsl:attribute name="uof:locID">t0109</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符</xsl:attribute>
+ <xsl:value-of select="."/>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ <xsl:element name="å­—:区域结æŸ">
+ <xsl:attribute name="字:标识符引用"><xsl:value-of select="concat('hlnk',$num + 1)"/></xsl:attribute>
+ <xsl:attribute name="uof:locID">t0122</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符引用</xsl:attribute>
+ </xsl:element>
+ <xsl:variable name="stt">
+ <xsl:value-of select="./text:a"/>
+ </xsl:variable>
+ <xsl:variable name="end">
+ <xsl:value-of select="."/>
+ </xsl:variable>
+ <xsl:variable name="bijiao">
+ <xsl:value-of select="substring-after($end,$stt)"/>
+ </xsl:variable>
+ <xsl:if test="not($bijiao='')">
+ <xsl:element name="字:文本串">
+ <xsl:attribute name="uof:locID">t0109</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符</xsl:attribute>
+ <xsl:variable name="stt">
+ <xsl:value-of select="./text:a"/>
+ </xsl:variable>
+ <xsl:variable name="end">
+ <xsl:value-of select="."/>
+ </xsl:variable>
+ <xsl:value-of select="substring-after($end,$stt)"/>
+ </xsl:element>
+ </xsl:if>
+ </å­—:å¥>
+ </xsl:if>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:element>
+ <xsl:element name="å­—:域结æŸ">
+ <xsl:attribute name="uof:locID">t0081</xsl:attribute>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="text:alphabetical-index">
+ <xsl:element name="å­—:段è½">
+ <xsl:attribute name="uof:locID">t0051</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符</xsl:attribute>
+ <xsl:element name="å­—:段è½å±žæ€§">
+ <xsl:attribute name="uof:locID">t0052</xsl:attribute>
+ <xsl:attribute name="uof:attrList">å¼æ ·å¼•ç”¨</xsl:attribute>
+ <xsl:attribute name="å­—:å¼æ ·å¼•ç”¨"><xsl:value-of select="text:index-body/text:p/@text:style-name"/></xsl:attribute>
+ <xsl:element name="å­—:制表ä½è®¾ç½®">
+ <xsl:attribute name="uof:locID">t0067</xsl:attribute>
+ <xsl:element name="å­—:制表ä½">
+ <xsl:attribute name="uof:locID">t0068</xsl:attribute>
+ <xsl:attribute name="uof:attrList">ä½ç½® 类型 å‰å¯¼ç¬¦ 制表ä½å­—符</xsl:attribute>
+ <xsl:variable name="aa" select="text:index-body/text:p/@text:style-name"/>
+ <xsl:attribute name="å­—:ä½ç½®"><xsl:value-of select="substring-before(key('path',$aa)/style:paragraph-properties/style:tab-stops/style:tab-stop/@style:position,$ooUnit)"/></xsl:attribute>
+ <xsl:attribute name="字:类型"><xsl:value-of select="key('path',$aa)/style:paragraph-properties/style:tab-stops/style:tab-stop/@style:type"/></xsl:attribute>
+ <xsl:attribute name="å­—:制表ä½å­—符"><xsl:value-of select="key('path',$aa)/style:paragraph-properties/style:tab-stops/style:tab-stop/@style:leader-text"/></xsl:attribute>
+ <xsl:if test="key('path',$aa)/style:paragraph-properties/style:tab-stops/style:tab-stop/@style:leader-style">
+ <xsl:attribute name="å­—:å‰å¯¼ç¬¦"><xsl:value-of select="key('path',$aa)/style:paragraph-properties/style:tab-stops/style:tab-stop/@style:leader-style"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:element>
+ </xsl:element>
+ <xsl:element name="字:域开始">
+ <xsl:attribute name="字:类型"><xsl:value-of select="'INDEX'"/></xsl:attribute>
+ <xsl:if test="@text:protected">
+ <xsl:attribute name="å­—:é”定"><xsl:value-of select="@text:protected"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="uof:locID">t0079</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 é”定</xsl:attribute>
+ </xsl:element>
+ <xsl:element name="å­—:域代ç ">
+ <xsl:attribute name="uof:locID">t0080</xsl:attribute>
+ <å­—:æ®µè½ uof:locID="t0051" uof:attrList="标识符">
+ <å­—:å¥ uof:locID="t0085">
+ <字:文本串>
+ <xsl:attribute name="uof:locID">t0109</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符</xsl:attribute>
+ <xsl:value-of select="'TOC \o 1-10 \h \z'"/>
+ </字:文本串>
+ </å­—:å¥>
+ </å­—:段è½>
+ <xsl:for-each select="text:index-body/text:index-title/text:p">
+ <xsl:element name="å­—:段è½" uof:locID="t0051" uof:attrList="标识符">
+ <xsl:element name="å­—:段è½å±žæ€§">
+ <xsl:attribute name="uof:locID">t0052</xsl:attribute>
+ <xsl:attribute name="uof:attrList">å¼æ ·å¼•ç”¨</xsl:attribute>
+ <xsl:attribute name="å­—:å¼æ ·å¼•ç”¨"><xsl:value-of select="@text:style-name"/></xsl:attribute>
+ </xsl:element>
+ <xsl:element name="å­—:å¥">
+ <å­—:å¥å±žæ€§ uof:locID="t0086" uof:attrList="å¼æ ·å¼•ç”¨">
+ <xsl:attribute name="å­—:å¼æ ·å¼•ç”¨"><xsl:value-of select="@text:style-name"/></xsl:attribute>
+ </å­—:å¥å±žæ€§>
+ <xsl:element name="字:文本串">
+ <xsl:attribute name="uof:attrList">标识符</xsl:attribute>
+ <xsl:value-of select="self::node()"/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:element>
+ </xsl:for-each>
+ <xsl:for-each select="text:index-body/text:p">
+ <xsl:element name="å­—:段è½" uof:locID="t0051" uof:attrList="标识符">
+ <xsl:element name="å­—:段è½å±žæ€§">
+ <xsl:attribute name="uof:locID">t0052</xsl:attribute>
+ <xsl:attribute name="uof:attrList">å¼æ ·å¼•ç”¨</xsl:attribute>
+ <xsl:attribute name="å­—:å¼æ ·å¼•ç”¨"><xsl:value-of select="@text:style-name"/></xsl:attribute>
+ <xsl:element name="å­—:制表ä½è®¾ç½®">
+ <xsl:attribute name="uof:locID">t0067</xsl:attribute>
+ <xsl:element name="å­—:制表ä½">
+ <xsl:attribute name="uof:locID">t0068</xsl:attribute>
+ <xsl:attribute name="uof:attrList">ä½ç½® 类型 å‰å¯¼ç¬¦ 制表ä½å­—符</xsl:attribute>
+ <xsl:variable name="aa" select="@text:style-name"/>
+ <xsl:attribute name="å­—:ä½ç½®"><xsl:value-of select="substring-before(key('path',$aa)/style:paragraph-properties/style:tab-stops/style:tab-stop/@style:position,$ooUnit)"/></xsl:attribute>
+ <xsl:attribute name="字:类型"><xsl:value-of select="key('path',$aa)/style:paragraph-properties/style:tab-stops/style:tab-stop/@style:type"/></xsl:attribute>
+ <xsl:attribute name="å­—:制表ä½å­—符"><xsl:value-of select="key('path',$aa)/style:paragraph-properties/style:tab-stops/style:tab-stop/@style:leader-text"/></xsl:attribute>
+ <xsl:if test="key('path',$aa)/style:paragraph-properties/style:tab-stops/style:tab-stop/@style:leader-style">
+ <xsl:attribute name="å­—:å‰å¯¼ç¬¦"><xsl:value-of select="key('path',$aa)/style:paragraph-properties/style:tab-stops/style:tab-stop/@style:leader-style"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:element>
+ </xsl:element>
+ <xsl:for-each select="node()">
+ <å­—:å¥ uof:locID="t0085">
+ <xsl:choose>
+ <xsl:when test="name(.)='text:tab-stop' or name(.)='text:tab'">
+ <xsl:element name="字:制表符" uof:locID="t0123"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="字:文本串">
+ <xsl:attribute name="uof:locID">t0109</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符</xsl:attribute>
+ <xsl:value-of select="."/>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </å­—:å¥>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:element>
+ <xsl:element name="å­—:域结æŸ">
+ <xsl:attribute name="uof:locID">t0081</xsl:attribute>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="ooæ•°å­—æ ¼å¼">
+ <xsl:param name="oo_format"/>
+ <xsl:choose>
+ <xsl:when test="$oo_format='1'">decimal</xsl:when>
+ <xsl:when test="$oo_format='I'">upper-roman</xsl:when>
+ <xsl:when test="$oo_format='i'">lower-roman</xsl:when>
+ <xsl:when test="$oo_format='A'">upper-letter</xsl:when>
+ <xsl:when test="$oo_format='a'">lower-letter</xsl:when>
+ <xsl:when test="$oo_format='1, 2, 3, ...'">decimal-full-width</xsl:when>
+ <xsl:when test="$oo_format='â‘ , â‘¡, â‘¢, ...'">decimal-enclosed-circle</xsl:when>
+ <xsl:when test="$oo_format='一, 二, 三, ...'">chinese-counting</xsl:when>
+ <xsl:when test="$oo_format='壹, è´°, å, ...'">chinese-legal-simplified</xsl:when>
+ <xsl:when test="$oo_format='甲, 乙, 丙, ...'">ideograph-traditional</xsl:when>
+ <xsl:when test="$oo_format='å­, 丑, 寅, ...'">ideograph-zodiac</xsl:when>
+ <xsl:otherwise>decimal</xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="图:填充">
+ <xsl:param name="style-name"/>
+ <xsl:choose>
+ <xsl:when test="style:background-image/office:binary-data">
+ <图:图片 uof:locID="g0035" uof:attrList="ä½ç½® 图形引用 类型 å称">
+ <xsl:attribute name="图:ä½ç½®"><xsl:choose><xsl:when test="not(style:background-image/@style:repeat)">tile</xsl:when><xsl:otherwise><xsl:choose><xsl:when test="style:background-image/@style:repeat = 'stretch'">stretch</xsl:when><xsl:when test="style:background-image/@style:repeat = 'repeat'">tile</xsl:when><xsl:when test="style:background-image/@style:repeat = 'no-repeat'">center</xsl:when></xsl:choose></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="图:图形引用"><xsl:value-of select="concat('background-image_',count(preceding::style:background-image))"/></xsl:attribute>
+ <xsl:attribute name="图:类型">png</xsl:attribute>
+ <xsl:attribute name="图:å称">background-image</xsl:attribute>
+ </图:图片>
+ </xsl:when>
+ <xsl:when test="@fo:background-color">
+ <图:颜色 uof:locID="g0034">
+ <xsl:choose>
+ <xsl:when test="@fo:background-color='transparent' ">auto</xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="@fo:background-color"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </图:颜色>
+ </xsl:when>
+ <xsl:when test="@draw:fill='gradient'">
+ </xsl:when>
+ <xsl:when test="@draw:fill='hatch'">
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="字:缩进类型">
+ <xsl:if test="@text:space-before or @fo:margin-left">
+ <å­—:å·¦ uof:locID="t0182">
+ <å­—:ç»å¯¹ uof:locID="t0185" uof:attrList="值">
+ <xsl:if test="@text:space-before">
+ <xsl:attribute name="字:值"><xsl:value-of select="substring-before(@text:space-before,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@fo:margin-left">
+ <xsl:attribute name="字:值"><xsl:value-of select="substring-before(@fo:margin-left,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ </å­—:ç»å¯¹>
+ </å­—:å·¦>
+ </xsl:if>
+ <xsl:if test="@text:min-label-width or @fo:margin-right">
+ <å­—:å³ uof:locID="t0183">
+ <å­—:ç»å¯¹ uof:locID="t0187" uof:attrList="值">
+ <xsl:if test="@text:min-label-width">
+ <xsl:attribute name="字:值"><xsl:value-of select="substring-before(@text:min-label-width,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@fo:margin-right">
+ <xsl:attribute name="字:值"><xsl:value-of select="substring-before(@fo:margin-right,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ </å­—:ç»å¯¹>
+ </å­—:å³>
+ </xsl:if>
+ <xsl:if test="@text:min-label-distance or @fo:text-indent">
+ <字:首行 uof:locID="t0184">
+ <å­—:ç»å¯¹ uof:locID="t0189" uof:attrList="值">
+ <xsl:if test="@text:min-label-distance">
+ <xsl:attribute name="字:值"><xsl:value-of select="substring-before(@text:min-label-distance,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@fo:text-indent">
+ <xsl:attribute name="字:值"><xsl:value-of select="substring-before(@fo:text-indent,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ </å­—:ç»å¯¹>
+ </字:首行>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="graphsize">
+ <xsl:param name="width"/>
+ <xsl:param name="Unitofsize"/>
+ <xsl:if test="$Unitofsize='pt'">
+ <xsl:choose>
+ <xsl:when test="(not($width&gt;1.42) and 0&lt;$width)">1</xsl:when>
+ <xsl:when test="(not($width&gt;2.84) and 1.42&lt;$width)">2</xsl:when>
+ <xsl:when test="(not($width&gt;4.26) and 2.84&lt;$width)">3</xsl:when>
+ <xsl:when test="(not($width&gt;5.68) and 4.26&lt;$width)">4</xsl:when>
+ <xsl:when test="(not($width&gt;7.10) and 5.68&lt;$width)">5</xsl:when>
+ <xsl:when test="(not($width&gt;8.52) and 7.10&lt;$width)">6</xsl:when>
+ <xsl:when test="(not($width&gt;9.94) and 8.52&lt;$width)">7</xsl:when>
+ <xsl:when test="(not($width&gt;11.36) and 9.94&lt;$width)">8</xsl:when>
+ <xsl:otherwise>9</xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="$uofUnit='in'">
+ <xsl:choose>
+ <xsl:when test="(not($width&gt;0.02) and 0&lt;$width)">1</xsl:when>
+ <xsl:when test="(not($width&gt;0.04) and 0.02&lt;$width)">2</xsl:when>
+ <xsl:when test="(not($width&gt;0.06) and 0.04&lt;$width)">3</xsl:when>
+ <xsl:when test="(not($width&gt;0.08) and 0.06&lt;$width)">4</xsl:when>
+ <xsl:when test="(not($width&gt;0.10) and 0.08&lt;$width)">5</xsl:when>
+ <xsl:when test="(not($width&gt;0.12) and 0.10&lt;$width)">6</xsl:when>
+ <xsl:when test="(not($width&gt;0.14) and 0.12&lt;$width)">7</xsl:when>
+ <xsl:when test="(not($width&gt;0.16) and 0.14&lt;$width)">8</xsl:when>
+ <xsl:otherwise>9</xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="$uofUnit='mm'">
+ <xsl:choose>
+ <xsl:when test="(not($width&gt;0.5) and 0&lt;$width) or $width=0.5">1</xsl:when>
+ <xsl:when test="(not($width&gt;1.0) and 0.5&lt;$width) or $width=1.0">2</xsl:when>
+ <xsl:when test="(not($width&gt;1.5) and 0.10&lt;$width) or $width=1.5">3</xsl:when>
+ <xsl:when test="(not($width&gt;2.0) and 1.5&lt;$width) or $width=2.0">4</xsl:when>
+ <xsl:when test="(not($width&gt;2.5) and 2.0&lt;$width) or $width=2.5">5</xsl:when>
+ <xsl:when test="(not($width&gt;3.0) and 2.5&lt;$width) or $width=3.0">6</xsl:when>
+ <xsl:when test="(not($width&gt;3.5) and 3.0&lt;$width) or $width=3.5">7</xsl:when>
+ <xsl:when test="(not($width&gt;4.0) and 3.5&lt;$width) or $width=4.0">8</xsl:when>
+ <xsl:otherwise>9</xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="$uofUnit='cm'">
+ <xsl:choose>
+ <xsl:when test="(not($width&gt;0.05) and 0&lt;$width) or $width=0.05">1</xsl:when>
+ <xsl:when test="(not($width&gt;0.10) and 0.05&lt;$width) or $width=0.10">2</xsl:when>
+ <xsl:when test="(not($width&gt;0.15) and 0.10&lt;$width) or $width=0.15">3</xsl:when>
+ <xsl:when test="(not($width&gt;0.20) and 0.15&lt;$width) or $width=0.20">4</xsl:when>
+ <xsl:when test="(not($width&gt;0.25) and 0.20&lt;$width) or $width=0.25">5</xsl:when>
+ <xsl:when test="(not($width&gt;0.30) and 0.25&lt;$width) or $width=0.30">6</xsl:when>
+ <xsl:when test="(not($width&gt;0.35) and 0.30&lt;$width) or $width=0.35">7</xsl:when>
+ <xsl:when test="(not($width&gt;0.40) and 0.35&lt;$width) or $width=0.40">8</xsl:when>
+ <xsl:otherwise>9</xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="text:character-count">
+ <xsl:element name="字:域开始">
+ <xsl:attribute name="字:类型"><xsl:value-of select="'numchars'"/></xsl:attribute>
+ <xsl:attribute name="uof:locID">t0079</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 é”定</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="text:fixed='1'or text:fixed='true'">
+ <xsl:attribute name="å­—:é”定">true</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="å­—:é”定">false</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:element name="å­—:域代ç ">
+ <xsl:attribute name="uof:locID">t0080</xsl:attribute>
+ <å­—:æ®µè½ uof:locID="t0051" uof:attrList="标识符">
+ <å­—:å¥ uof:locID="t0085">
+ <å­—:å¥å±žæ€§ uof:locID="t0086" uof:attrList="å¼æ ·å¼•ç”¨"/>
+ <xsl:variable name="quote" select="'&quot;'"/>
+ <xsl:variable name="fmt">
+ <xsl:call-template name="ooæ•°å­—æ ¼å¼åŸŸå¼€å…³">
+ <xsl:with-param name="oo_format" select="@style:num-format"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <字:文本串 uof:locID="t0109" uof:attrList="标识符">
+ <xsl:value-of select="concat('NUMCHARS \* ',$fmt,' \# ',$quote,0,$quote)"/>
+ </字:文本串>
+ </å­—:å¥>
+ </å­—:段è½>
+ </xsl:element>
+ <å­—:å¥ uof:locID="t0085">
+ <字:文本串 uof:locID="t0109" uof:attrList="标识符">
+ <xsl:value-of select="."/>
+ </字:文本串>
+ </å­—:å¥>
+ <xsl:element name="å­—:域结æŸ">
+ <xsl:attribute name="uof:locID">t0081</xsl:attribute>
+ </xsl:element>
+ </xsl:template>
+ <!-- measure_conversion.xsl Begin-->
+ <!--xsl:param name="dpi" select="111"/>
+ <xsl:param name="centimeter-in-mm" select="10"/>
+ <xsl:param name="inch-in-mm" select="25.4"/>
+ <xsl:param name="didot-point-in-mm" select="0.376065"/>
+ <xsl:param name="pica-in-mm" select="4.2333333"/>
+ <xsl:param name="point-in-mm" select="0.3527778"/>
+ <xsl:param name="twip-in-mm" select="0.017636684"/>
+ <xsl:param name="pixel-in-mm" select="$inch-in-mm div $dpi"/-->
+ <!-- ***** MEASUREMENT CONVERSIONS *****
+ PARAM 'value'
+ The measure to be converted.
+ The current measure is judged by a substring (e.g. 'mm', 'cm', 'in', 'pica'...)
+ directly added to the number.
+
+ PARAM 'rounding-factor'
+ Is used for the rounding of decimal places.
+ The parameter number is the product of 1 and some '10', where
+ every zero represents a decimal place.
+
+ For example, providing as parameter:
+ <xsl:param name="rounding-factor" select="10000" />
+ Gives by default four decimal places.
+
+ To round two decimal places, basically the following is done:
+ <xsl:value-of select="round(100 * value) div 100"/>
+
+ RETURN The converted number, by default rounded to four decimal places.
+ In case the input measure could not be matched the same value is
+ returned and a warning message is written out.
+
+
+
+ MEASURE LIST:
+ * 1 milimeter (mm), the basic measure
+
+ * 1 centimeter (cm) = 10 mm
+
+ * 1 inch (in) = 25.4 mm
+ While the English have already seen the light (read: the metric system), the US
+ remains loyal to this medieval system.
+
+ * 1 point (pt) = 0.35277777.. mm
+ Sometimes called PostScript point (ppt), as when Adobe created PostScript, they added their own system of points.
+ There are exactly 72 PostScript points in 1 inch.
+
+ * 1 twip = twentieth of a (PostScript) point
+ A twip (twentieth of a point) is a 1/20th of a PostScript point, a traditional measure in printing.
+
+ * 1 didot point (dpt) = 0.376065 mm
+ Didot point after the French typographer Firmin Didot (1764-1836).
+
+ More details under
+ http://www.unc.edu/~rowlett/units/dictP.html:
+ "A unit of length used by typographers and printers. When printing was done
+ from hand-set metal type, one point represented the smallest element of type
+ that could be handled, roughly 1/64 inch. Eventually, the point was standardized
+ in Britain and America as exactly 1/72.27 = 0.013 837 inch, which is
+ about 0.35 mm (351.46 micrometers). In continental Europe, typographers
+ traditionally used a slightly larger point of 0.014 83 inch (about
+ 1/72 pouce, 0.377 mm, or roughly 1/67 English inch), called a Didot point
+ after the French typographer Firmin Didot (1764-1836). In the U.S.,
+ Adobe software defines the point to be exactly 1/72 inch (0.013 888 9 inch
+ or 0.352 777 8 millimeters) and TeX software uses a slightly smaller point
+ of 0.351 459 8035 mm. The German standards agency DIN has proposed that
+ all these units be replaced by multiples of 0.25 millimeters (1/101.6 inch).
+
+ * 1 pica = 4.233333 mm
+ 1/6 inch or 12 points
+
+ * 1 pixel (px) = 0.26458333.. mm (relative to 'DPI', here: 96 dpi)
+ Most pictures have the 96 dpi resolution, but the dpi variable may vary by stylesheet parameter
+
+
+ -->
+ <!-- changing measure to mm -->
+ <!--xsl:template name="convert2cm">
+ <xsl:param name="value"/>
+ <xsl:param name="rounding-factor" select="10000"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $centimeter-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, $uofUnit)">
+ <xsl:value-of select="substring-before($value, $uofUnit)"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $centimeter-in-mm * $inch-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $centimeter-in-mm * $point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $centimeter-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $centimeter-in-mm * $pica-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $centimeter-in-mm * $twip-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $centimeter-in-mm * $pixel-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'cm'!</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template-->
+</xsl:stylesheet>
diff --git a/filter/source/xslt/export/wordml/ooo2wordml.xsl b/filter/source/xslt/export/wordml/ooo2wordml.xsl
new file mode 100644
index 000000000000..416581b5e3ed
--- /dev/null
+++ b/filter/source/xslt/export/wordml/ooo2wordml.xsl
@@ -0,0 +1,218 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw">
+ <xsl:output method="xml" indent="no" encoding="UTF-8" version="1.0" standalone="yes"/>
+ <xsl:include href="../../common/measure_conversion.xsl"/>
+ <xsl:include href="../common/ooo2ms_docpr.xsl"/>
+ <xsl:include href="ooo2wordml_settings.xsl"/>
+ <xsl:include href="ooo2wordml_border.xsl"/>
+ <xsl:include href="ooo2wordml_page.xsl"/>
+ <xsl:include href="ooo2wordml_text.xsl"/>
+ <xsl:include href="ooo2wordml_list.xsl"/>
+ <xsl:include href="ooo2wordml_field.xsl"/>
+ <xsl:include href="ooo2wordml_table.xsl"/>
+ <xsl:include href="ooo2wordml_draw.xsl"/>
+ <xsl:include href="ooo2wordml_path.xsl"/>
+ <xsl:key name="paragraph-style" match="style:style[@style:family='paragraph']" use="@style:name"/>
+ <xsl:key name="text-style" match="style:style[@style:family='text']" use="@style:name"/>
+ <xsl:key name="section-style" match="style:style[@style:family='section']" use="@style:name"/>
+ <xsl:key name="master-page" match="style:master-page" use="@style:name"/>
+ <xsl:key name="page-layout" match="style:page-layout" use="@style:name"/>
+ <xsl:key name="slave-style" match="style:style[string-length(normalize-space(@style:master-page-name)) &gt; 0]" use="@style:name"/>
+ <xsl:key name="list-style" match="office:styles/text:list-style | office:automatic-styles/text:list-style" use="@style:name"/>
+ <xsl:key name="graphics-style" match="style:style[@style:family='graphic']" use="@style:name"/>
+ <xsl:template match="/">
+ <xsl:apply-templates select="office:document"/>
+ </xsl:template>
+ <xsl:template match="office:document">
+ <xsl:processing-instruction name="mso-application">progid="Word.Document"</xsl:processing-instruction>
+ <xsl:variable name="embeddedObjPresent">
+ <xsl:choose>
+ <xsl:when test="//draw:object-ole[1]">yes</xsl:when>
+ <xsl:otherwise>no</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <w:wordDocument xml:space="preserve" w:embeddedObjPresent="{$embeddedObjPresent}">
+ <xsl:apply-templates select="office:meta"/>
+ <xsl:apply-templates select="office:font-face-decls"/>
+ <xsl:if test="office:styles/text:outline-style | office:styles/text:list-style | office:automatic-styles/text:list-style">
+ <xsl:call-template name="ListStyles"/>
+ </xsl:if>
+ <w:styles>
+ <xsl:apply-templates select="office:styles"/>
+ <xsl:apply-templates select="office:automatic-styles"/>
+ <xsl:call-template name="add_hyperlink_style"/>
+ <!--add for hyperlink character style G.Y.-->
+ <xsl:call-template name="add_comments_style"/>
+ <!--add for comments style G.Y.-->
+ </w:styles>
+ <xsl:call-template name="export-oledata"/>
+ <xsl:apply-templates select="office:settings"/>
+ <xsl:apply-templates select="office:body"/>
+ </w:wordDocument>
+ </xsl:template>
+ <xsl:template match="office:body">
+ <xsl:call-template name="page-background"/>
+ <xsl:apply-templates select="office:text"/>
+ </xsl:template>
+ <xsl:template match="office:font-face-decls">
+ <!-- get default font from default paragraph properties -->
+ <w:fonts>
+ <xsl:variable name="default-paragraph-properties" select="/office:document/office:styles/style:default-style[@style:family = 'paragraph']/style:paragraph-properties"/>
+ <w:defaultFonts w:ascii="{$default-paragraph-properties/@style:font-name}" w:h-ansi="{$default-paragraph-properties/@style:font-name}" w:fareast="{$default-paragraph-properties/@style:font-name-asian}" w:cs="{$default-paragraph-properties/@style:font-name-complex}"/>
+ <xsl:for-each select="style:font-face">
+ <w:font w:name="{@style:name}">
+ <xsl:if test="@style:font-charset = 'x-symbol'">
+ <w:charset w:val="02"/>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="@style:font-family-generic = 'swiss'">
+ <w:family w:val="Swiss"/>
+ </xsl:when>
+ <xsl:when test="@style:font-family-generic = 'modern'">
+ <w:family w:val="Modern"/>
+ </xsl:when>
+ <xsl:when test="@style:font-family-generic = 'roman'">
+ <w:family w:val="Roman"/>
+ </xsl:when>
+ <xsl:when test="@style:font-family-generic = 'script'">
+ <w:family w:val="Script"/>
+ </xsl:when>
+ <xsl:when test="@style:font-family-generic = 'decorative'">
+ <w:family w:val="Decorative"/>
+ </xsl:when>
+ <xsl:when test="@style:font-family-generic = 'system'">
+ <w:family w:val="System"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <w:family w:val="System"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <w:pitch w:val="{@style:font-pitch}"/>
+ </w:font>
+ </xsl:for-each>
+ </w:fonts>
+ </xsl:template>
+ <xsl:template match="office:styles | office:automatic-styles">
+ <xsl:for-each select="*[(name()='style:style' or name()='style:default-style') and (@style:family= 'paragraph' or @style:family= 'text' or @style:family='table')]">
+ <xsl:variable name="style-name">
+ <xsl:choose>
+ <xsl:when test="name() = 'style:default-style'">
+ <xsl:value-of select="concat('default-', @style:family, '-style')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="@style:name"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <w:style w:styleId="{$style-name}">
+ <xsl:choose>
+ <xsl:when test="@style:family = 'paragraph'">
+ <xsl:attribute name="w:type">paragraph</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@style:family = 'text'">
+ <xsl:attribute name="w:type">character</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@style:family = 'table'">
+ <xsl:attribute name="w:type">table</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="name() = 'style:default-style'">
+ <xsl:attribute name="w:default">on</xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="@style:parent-style-name">
+ <w:basedOn w:val="{@style:parent-style-name}"/>
+ </xsl:when>
+ <xsl:when test="name() = 'style:style' and @style:family= 'paragraph'">
+ <w:basedOn w:val="{concat('default-', @style:family, '-style')}"/>
+ </xsl:when>
+ </xsl:choose>
+ <w:name w:val="{$style-name}"/>
+ <xsl:if test="parent::office:automatic-styles">
+ <w:hidden w:val="on"/>
+ </xsl:if>
+ <xsl:if test="@style:next-style-name">
+ <w:next w:val="{@style:next-style-name}"/>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="@style:family = 'paragraph'">
+ <xsl:apply-templates select="style:paragraph-properties" mode="paragraph"/>
+ </xsl:when>
+ <xsl:when test="@style:family = 'table'">
+ <w:tblPr>
+ <xsl:apply-templates select="style:table-properties" mode="table"/>
+ </w:tblPr>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:apply-templates select="style:text-properties" mode="character"/>
+ </w:style>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template match="office:text">
+ <w:body>
+ <xsl:apply-templates select="text:p | text:h | text:section | text:unordered-list | text:ordered-list | text:list |table:table"/>
+ <xsl:variable name="paragraph-heading-table" select=".//*[name() = 'text:p' or name() = 'text:h' or name() = 'table:table']"/>
+ <xsl:variable name="page" select="$paragraph-heading-table[key( 'slave-style', @*[name()='text:style-name' or name()='table:style-name'])]"/>
+ <w:sectPr>
+ <!--w:type w:val="continuous"/ -->
+ <xsl:apply-templates select="/office:document/office:styles/text:footnotes-configuration">
+ <xsl:with-param name="within-section" select="'yes'"/>
+ </xsl:apply-templates>
+ <xsl:apply-templates select="/office:document/office:styles/text:endnotes-configuration">
+ <xsl:with-param name="within-section" select="'yes'"/>
+ </xsl:apply-templates>
+ <xsl:choose>
+ <xsl:when test="count($page) &gt; 0">
+ <xsl:apply-templates select="key('master-page', key( 'slave-style', $page[last()]/@*[name()='text:style-name' or name()='table:style-name'])/@style:master-page-name)"/>
+ <xsl:if test="key( 'slave-style', $page[last()]/@*[name()='text:style-name' or name()='table:style-name'])/style:paragraph-properties/@style:page-number">
+ <!-- in M$ word the header and footer associate with the w:sectPr, but in StarOffice writer the header and footer associate with the style:master-page -->
+ <xsl:variable name="pagenumber_start">
+ <xsl:value-of select=" key( 'slave-style', $page[last()]/@*[name()='text:style-name' or name()='table:style-name'])/style:paragraph-properties/@style:page-number"/>
+ </xsl:variable>
+ <xsl:if test=" number($pagenumber_start) &gt; 0 ">
+ <w:pgNumType w:start="{$pagenumber_start}"/>
+ </xsl:if>
+ <!-- comment out the below line to enable the header and footer display normally when style:page-number =0 -->
+ <!-- w:pgNumType w:start="{key( 'slave-style', $page[last()]/@*[name()='text:style-name' or name()='table:style-name'])/style:paragraph-properties/@style:page-number}"/-->
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="/office:document/office:master-styles/style:master-page[1]"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="$paragraph-heading-table[last()]/ancestor::text:section">
+ <xsl:apply-templates select="key('section-style',$paragraph-heading-table[last()]/ancestor::text:section[1]/@text:style-name)" mode="section"/>
+ </xsl:if>
+ </w:sectPr>
+ </w:body>
+ </xsl:template>
+ <xsl:template match="text:section">
+ <xsl:apply-templates select="text:p | text:h | text:section | text:unordered-list | text:ordered-list | text:list | table:table"/>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/filter/source/xslt/export/wordml/ooo2wordml_border.xsl b/filter/source/xslt/export/wordml/ooo2wordml_border.xsl
new file mode 100644
index 000000000000..9eb2fd4dcbd1
--- /dev/null
+++ b/filter/source/xslt/export/wordml/ooo2wordml_border.xsl
@@ -0,0 +1,153 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw">
+ <!-- multiple usage: get size, type, color of table-cell, paragraph, and page borders. -->
+ <xsl:template name="get-border-size">
+ <xsl:param name="border"/>
+ <xsl:param name="border-line-width"/>
+ <xsl:choose>
+ <xsl:when test="$border = 'none' or $border = 'hidden'">
+ <xsl:text>none;0</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="border-value">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="$border"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="border-style">
+ <xsl:choose>
+ <xsl:when test="contains($border,'solid')">solid</xsl:when>
+ <xsl:when test="contains($border,'double')">double</xsl:when>
+ <xsl:otherwise>none</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <!-- MS word and SO wirter borders Mapping
+ MS word Borders SO borders
+ w:val="single" w:sz="0" 0.05pt(0.002cm);solid
+ w:val="single" w:sz="12" 1.00pt(0.035cm);solid
+ w:val="single" w:sz="18" 2.50pt(0.088cm);solid
+ w:val="single" w:sz="36" 4.00pt(0.141cm);solid
+ w:val="single" w:sz="48" 5.00pt(0.176cm);solid
+ w:val="double" w:sz="2" 1.10pt(0.039cm);double
+ w:val="double" w:sz="6" 2.60pt(0.092cm);double
+ w:val="thin-thick-small-gap" w:sz="12" 3.00pt(0.105cm);double
+ w:val="thin-thick-large-gap" w:sz="18" 3.55pt(0.125cm);double
+ w:val="thick-thin-medium-gap" w:sz="24" 4.50pt(0.158cm);double
+ w:val="thin-thick-medium-gap" w:sz="24" 5.05pt(0.178cm);double
+ w:val="thin-thick-small-gap" w:sz="24" 6.00pt(0.211cm);double
+ w:val="thin-thick-medium-gap" w:sz="36 " 6.55pt(0.231cm);double
+ w:val="double" w:sz="18" 7.50pt(0.264cm);double
+ w:val="thin-thick-medium-gap" w:sz="48" 9.00pt(0.317cm);double;style:border-line-width="0.088cm 0.088cm 0.141cm"
+ w:val="double" w:sz="24" 9.00pt(0.317cm);double;style:border-line-width="0.141cm 0.088cm 0.088cm"
+ we adjust the criteria by adding about 1/2 range of this current criteria and next criteria. Gary. Yang -->
+ <xsl:variable name="microsoft-border-style-size">
+ <xsl:choose>
+ <xsl:when test=" $border-style = 'solid'">
+ <xsl:choose>
+ <xsl:when test="$border-value &lt;= 0.018">single;0</xsl:when>
+ <xsl:when test="$border-value &lt;= 0.055">single;12</xsl:when>
+ <xsl:when test="$border-value &lt;= 0.110">single;18</xsl:when>
+ <xsl:when test="$border-value &lt;= 0.155">single;36</xsl:when>
+ <xsl:when test="$border-value &lt;= 0.198">single;48</xsl:when>
+ <xsl:otherwise>single;48</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$border-style = 'double'">
+ <xsl:choose>
+ <xsl:when test="$border-value &lt; 0.064">double;2</xsl:when>
+ <xsl:when test="$border-value &lt; 0.098">double;6</xsl:when>
+ <xsl:when test="$border-value &lt; 0.115">thin-thick-small-gap;12</xsl:when>
+ <xsl:when test="$border-value &lt; 0.135">thin-thick-large-gap;18</xsl:when>
+ <xsl:when test="$border-value &lt; 0.168">thick-thin-medium-gap;24</xsl:when>
+ <xsl:when test="$border-value &lt; 0.190">thin-thick-medium-gap;24</xsl:when>
+ <xsl:when test="$border-value &lt; 0.221">thin-thick-small-gap;24</xsl:when>
+ <xsl:when test="$border-value &lt; 0.241">thin-thick-medium-gap;36</xsl:when>
+ <xsl:when test="$border-value &lt; 0.300">double;18</xsl:when>
+ <xsl:when test="$border-value &lt; 0.430">
+ <xsl:variable name="border-inner-line-value">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="$border-line-width"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="$border-inner-line-value &lt; 0.10">thin-thick-medium-gap;48</xsl:if>
+ <xsl:if test="$border-inner-line-value &gt; 0.10">double;24</xsl:if>
+ </xsl:when>
+ <xsl:otherwise>double;24</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>none;0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:value-of select="$microsoft-border-style-size"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- get bottom and right border style, size, color -->
+ <xsl:template name="get-border">
+ <xsl:param name="so-border"/>
+ <xsl:param name="so-border-line-width"/>
+ <xsl:param name="so-border-position"/>
+ <xsl:variable name="ms-style-width">
+ <xsl:call-template name="get-border-size">
+ <xsl:with-param name="border" select="$so-border"/>
+ <xsl:with-param name="border-line-width" select="$so-border-line-width"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$so-border-position = 'bottom' or $so-border-position = 'right'">
+ <!-- if border style is bottom or right border we need to change the thin-thick to thick-thin; Vice Versa -->
+ <xsl:choose>
+ <xsl:when test="substring-before($ms-style-width, '-')='thin'">
+ <xsl:attribute name="w:val"><xsl:value-of select="concat( 'thick-thin', substring-after(substring-before($ms-style-width, ';'), 'k' ))"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="substring-before($ms-style-width, '-')='thick'">
+ <xsl:attribute name="w:val"><xsl:value-of select="concat( 'thin-thick', substring-after(substring-before($ms-style-width, ';'), 'n' ))"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="w:val"><xsl:value-of select="substring-before($ms-style-width, ';')"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="w:sz"><xsl:value-of select="substring-after($ms-style-width,';')"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$so-border-position = 'top' or $so-border-position = 'left'">
+ <xsl:attribute name="w:val"><xsl:value-of select="substring-before($ms-style-width,';')"/></xsl:attribute>
+ <xsl:attribute name="w:sz"><xsl:value-of select="substring-after($ms-style-width,';')"/></xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <!--get border color -->
+ <xsl:choose>
+ <xsl:when test="contains($so-border,'#')">
+ <xsl:attribute name="w:color"><xsl:value-of select="substring-after($so-border, '#')"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="w:color">auto</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/filter/source/xslt/export/wordml/ooo2wordml_custom_draw.xsl b/filter/source/xslt/export/wordml/ooo2wordml_custom_draw.xsl
new file mode 100644
index 000000000000..0548e2525d46
--- /dev/null
+++ b/filter/source/xslt/export/wordml/ooo2wordml_custom_draw.xsl
@@ -0,0 +1,284 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw">
+ <xsl:template name="ooo_custom_draw2ms_word_draw_map">
+ <xsl:param name="ooo_predefined_type"/>
+ <!-- all ooo draw names are get from EnhancedCustomShapeGeometry.idl-->
+ <xsl:choose>
+ <xsl:when test="$ooo_predefined_type = 'isosceles-triangle' ">
+ <xsl:value-of select=" '#_x0000_t5' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'right-triangle' ">
+ <xsl:value-of select=" '#_x0000_t6' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'trapezoid' ">
+ <xsl:value-of select=" '#_x0000_t8' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'diamond' ">
+ <xsl:value-of select=" '#_x0000_t4' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'hexagon' ">
+ <xsl:value-of select=" '#_x0000_t9' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'parallelogram' ">
+ <xsl:value-of select=" '#_x0000_t7' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'pentagon' ">
+ <xsl:value-of select=" '#_x0000_t56' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'octagon' ">
+ <xsl:value-of select=" '#_x0000_t10' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'cross' ">
+ <xsl:value-of select=" '#_x0000_t11' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'ring' ">
+ <xsl:value-of select=" '#_x0000_t23' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'block-arc' ">
+ <xsl:value-of select=" '#_x0000_t95' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'can' ">
+ <xsl:value-of select=" '#_x0000_t22' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'cube' ">
+ <xsl:value-of select=" '#_x0000_t16' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'paper' ">
+ <xsl:value-of select=" '#_x0000_t65' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'smiley' ">
+ <xsl:value-of select=" '#_x0000_t96' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'sun' ">
+ <xsl:value-of select=" '#_x0000_t183' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'moon' ">
+ <xsl:value-of select=" '#_x0000_t184' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'heart' ">
+ <xsl:value-of select=" '#_x0000_t74' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'forbidden' ">
+ <xsl:value-of select=" '#_x0000_t57' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'left-bracket' ">
+ <xsl:value-of select=" '#_x0000_t85' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'right-bracket' ">
+ <xsl:value-of select=" '#_x0000_t86' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'left-brace' ">
+ <xsl:value-of select=" '#_x0000_t87' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'right-brace' ">
+ <xsl:value-of select=" '#_x0000_t88' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'bracket-pair' ">
+ <xsl:value-of select=" '#_x0000_t185' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'brace-pair' ">
+ <xsl:value-of select=" '#_x0000_t186' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'quad-bevel' ">
+ <xsl:value-of select=" '#_x0000_t189' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'left-arrow' ">
+ <xsl:value-of select=" '#_x0000_t66' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'down-arrow' ">
+ <xsl:value-of select=" '#_x0000_t67' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'up-arrow' ">
+ <xsl:value-of select=" '#_x0000_t68' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'right-arrow' ">
+ <xsl:value-of select=" '#_x0000_t13' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'left-right-arrow' ">
+ <xsl:value-of select=" '#_x0000_t69' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'up-down-arrow' ">
+ <xsl:value-of select=" '#_x0000_t70' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'mso-spt89' ">
+ <xsl:value-of select=" '#_x0000_t89' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'quad-arrow' ">
+ <xsl:value-of select=" '#_x0000_t76' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'notched-right-arrow' ">
+ <xsl:value-of select=" '#_x0000_t94' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'pentagon-right' ">
+ <xsl:value-of select=" '#_x0000_t177' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'chevron' ">
+ <xsl:value-of select=" '#_x0000_t55' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'up-arrow-callout' ">
+ <xsl:value-of select=" '#_x0000_t79' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'down-arrow-callout' ">
+ <xsl:value-of select=" '#_x0000_t80' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'up-down-arrow-callout' ">
+ <xsl:value-of select=" '#_x0000_t82' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'circular-arrow' ">
+ <xsl:value-of select=" '#_x0000_t103' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'flowchart-process' ">
+ <xsl:value-of select=" '#_x0000_t109' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'flowchart-alternate-process' ">
+ <xsl:value-of select=" '#_x0000_t116' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'flowchart-decision' ">
+ <xsl:value-of select=" '#_x0000_t110' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'flowchart-data' ">
+ <xsl:value-of select=" '#_x0000_t111' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'flowchart-predefined-process' ">
+ <xsl:value-of select=" '#_x0000_t112' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'flowchart-internal-storage' ">
+ <xsl:value-of select=" '#_x0000_t113' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'flowchart-document' ">
+ <xsl:value-of select=" '#_x0000_t114' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'flowchart-multidocument' ">
+ <xsl:value-of select=" '#_x0000_t115' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'flowchart-terminator' ">
+ <xsl:value-of select=" '#_x0000_t116' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'flowchart-preparation' ">
+ <xsl:value-of select=" '#_x0000_t117' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'flowchart-manual-input' ">
+ <xsl:value-of select=" '#_x0000_t118' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'flowchart-manual-operation' ">
+ <xsl:value-of select=" '#_x0000_t119' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'flowchart-connector' ">
+ <xsl:value-of select=" '#_x0000_t120' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'flowchart-off-page-connector' ">
+ <xsl:value-of select=" '#_x0000_t177' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'flowchart-card' ">
+ <xsl:value-of select=" '#_x0000_t121' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'flowchart-punched-tape' ">
+ <xsl:value-of select=" '#_x0000_t122' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'flowchart-summing-junction' ">
+ <xsl:value-of select=" '#_x0000_t123' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'flowchart-or' ">
+ <xsl:value-of select=" '#_x0000_t124' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'flowchart-collate' ">
+ <xsl:value-of select=" '#_x0000_t125' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'flowchart-sort' ">
+ <xsl:value-of select=" '#_x0000_t126' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'flowchart-extract' ">
+ <xsl:value-of select=" '#_x0000_t127' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'flowchart-merge' ">
+ <xsl:value-of select=" '#_x0000_t128' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'flowchart-stored-data' ">
+ <xsl:value-of select=" '#_x0000_t130' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'flowchart-delay' ">
+ <xsl:value-of select=" '#_x0000_t135' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'flowchart-sequential-access' ">
+ <xsl:value-of select=" '#_x0000_t131' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'flowchart-magnetic-disk' ">
+ <xsl:value-of select=" '#_x0000_t132' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'flowchart-direct-access-storage' ">
+ <xsl:value-of select=" '#_x0000_t133' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'flowchart-display' ">
+ <xsl:value-of select=" '#_x0000_t134' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'rectangular-callout' ">
+ <xsl:value-of select=" '#_x0000_t61' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'round-rectangular-callout' ">
+ <xsl:value-of select=" '#_x0000_t62' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'round-callout' ">
+ <xsl:value-of select=" '#_x0000_t63' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'cloud-callout' ">
+ <xsl:value-of select=" '#_x0000_t106' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'line-callout-1' ">
+ <xsl:value-of select=" '#_x0000_t50' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'line-callout-2' ">
+ <xsl:value-of select=" '#_x0000_t51' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'line-callout-3' ">
+ <xsl:value-of select=" '#_x0000_t47' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'bang' ">
+ <xsl:value-of select=" '#_x0000_t72' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'star4' ">
+ <xsl:value-of select=" '#_x0000_t187' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'star5' ">
+ <xsl:value-of select=" '#_x0000_t12' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'star8' ">
+ <xsl:value-of select=" '#_x0000_t58' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'star24' ">
+ <xsl:value-of select=" '#_x0000_t92' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'vertical-scroll' ">
+ <xsl:value-of select=" '#_x0000_t97' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'horizontal-scroll' ">
+ <xsl:value-of select=" '#_x0000_t98' "/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/filter/source/xslt/export/wordml/ooo2wordml_draw.xsl b/filter/source/xslt/export/wordml/ooo2wordml_draw.xsl
new file mode 100644
index 000000000000..40b146f1481e
--- /dev/null
+++ b/filter/source/xslt/export/wordml/ooo2wordml_draw.xsl
@@ -0,0 +1,1885 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xalan="http://xml.apache.org/xalan" xmlns:oleextracter="MyOleExtracter" xmlns:ole="java:XSLTFilterOLEExtracter" xmlns:java="http://saxon.sf.net/java-type" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw xalan ole oleextracter java" extension-element-prefixes="oleextracter">
+ <xsl:include href="ooo2wordml_custom_draw.xsl"/>
+ <xsl:param name="oleExtractor" as="java:XSLTFilterOLEExtracter" select="ole:new()"/>
+ <xsl:param name="XMultiServiceFactory" as="java:com.sun.star.lang.XMultiServiceFactory" select="ole:init($oleExtractor, 'uno:socket,host=localhost,port=8100;urp;StarOffice.ServiceManager')"/>
+
+ <xsl:key name="stroke-dash-style" match="draw:stroke-dash" use="@draw:name"/>
+ <xsl:key name="fill-image" match="draw:fill-image" use="@draw:name"/>
+ <xsl:key name="draw-gradient" match="draw:gradient " use="@draw:name"/>
+ <xsl:template name="PageLevelGraphic">
+ <xsl:for-each select="//draw:*[@text:anchor-type='page']">
+ <xsl:apply-templates select="."/>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template match="draw:*">
+ <xsl:param name="TargetMeasure" select="'pt'"/>
+ <xsl:param name="x-adjust" select="0"/>
+ <xsl:param name="y-adjust" select="0"/>
+ <xsl:param name="force-draw" select="'false'"/>
+ <xsl:variable name="MeasureMark">
+ <xsl:choose>
+ <xsl:when test="$TargetMeasure = 'twip'"/>
+ <xsl:otherwise>
+ <xsl:value-of select="$TargetMeasure"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <!--
+ deal with captions and frames first. draw:text-box is a powerfull element in OOo, its GUI name is frame. And OOo use it to contain Captions
+ Since there is not a corresponding object in word, so we draw the text-box itself and its children separately. If it look like a Caption only frame
+ we'll adjust the text-box position to make it look pretty
+ -->
+ <!-- skip all not force draw children , must be first case -->
+ <xsl:when test="ancestor::draw:text-box and $force-draw='false' "/>
+ <xsl:when test="name() = 'draw:text-box'">
+ <!-- draw the text-box itself -->
+ <w:r>
+ <w:pict>
+ <xsl:variable name="text-y-adjust">
+ <xsl:choose>
+ <xsl:when test="count(text:p/draw:*) = 1 and (string-length(text:p/draw:*[position()=1]/@svg:x) =0 or number(concat('0',translate(text:p/draw:*[position()=1]/@svg:x,'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ','') ))=0) and (string-length(text:p/draw:*[position()=1]/@svg:y)=0 or number(concat('0',translate(text:p/draw:*[position()=1]/@svg:x,'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ','') ))=0 ) ">
+ <xsl:variable name="pic-height">
+ <xsl:choose>
+ <xsl:when test="name(text:p/draw:*[position()=1]) = 'draw:g' or name(text:p/draw:*[position()=1]) = 'draw:a'">
+ <xsl:variable name="BigestWindow">
+ <xsl:call-template name="GetWindowSize">
+ <xsl:with-param name="nodeSet" select="text:p/draw:*[position()=1]/draw:*"/>
+ <xsl:with-param name="x-adjust" select="$x-adjust"/>
+ <xsl:with-param name="y-adjust" select="$y-adjust"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="number(substring-after($BigestWindow,'y2:')) - number(substring-after(substring-before($BigestWindow,';x2'), 'y1:')) + number(concat('0',translate($y-adjust,'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ','')))"/>
+ </xsl:when>
+ <xsl:when test="text:p/draw:*[position()=1]/@svg:height">
+ <xsl:call-template name="Add-With-Measure">
+ <xsl:with-param name="value1" select="text:p/draw:*[position()=1]/@svg:height"/>
+ <xsl:with-param name="value2" select="$y-adjust"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="text:p/draw:*[position()=1]/@fo:min-height">
+ <xsl:call-template name="Add-With-Measure">
+ <xsl:with-param name="value1" select="text:p/draw:*[position()=1]/@fo:min-height"/>
+ <xsl:with-param name="value2" select="$y-adjust"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="ancestor::draw:frame">
+ <xsl:call-template name="Add-With-Measure">
+ <xsl:with-param name="value1" select="ancestor::draw:frame/@svg:height"/>
+ <xsl:with-param name="value2" select="$y-adjust"/>
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="min-height">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="'in'"/>
+ <xsl:with-param name="value" select="@fo:min-height"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$min-height - $pic-height &lt; 0.001">
+ <!-- If control goes here, it much like that this text-box is used for containt graphic caption only -->
+ <xsl:value-of select="$pic-height - 0.1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$y-adjust"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$y-adjust"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="shape-type">
+ <xsl:choose>
+ <xsl:when test="$text-y-adjust = $y-adjust">
+ <xsl:value-of select="'#_x0000_t202'"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:call-template name="DrawElements">
+ <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/>
+ <xsl:with-param name="x-adjust" select="$x-adjust"/>
+ <xsl:with-param name="y-adjust" select="$text-y-adjust"/>
+ <xsl:with-param name="force-draw" select="'true'"/>
+ <xsl:with-param name="shape-type" select="$shape-type"/>
+ </xsl:call-template>
+ </w:pict>
+ </w:r>
+ <!-- draw the real object first -->
+ <xsl:if test="./text:p/draw:*">
+ <xsl:apply-templates select="./text:p/draw:*">
+ <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/>
+ <xsl:with-param name="x-adjust">
+ <xsl:call-template name="Add-With-Measure">
+ <xsl:with-param name="value1" select="@svg:x"/>
+ <xsl:with-param name="value2" select="$x-adjust"/>
+ </xsl:call-template>
+ </xsl:with-param>
+ <xsl:with-param name="y-adjust">
+ <xsl:call-template name="Add-With-Measure">
+ <xsl:with-param name="value1" select="@svg:y"/>
+ <xsl:with-param name="value2" select="$y-adjust"/>
+ </xsl:call-template>
+ </xsl:with-param>
+ <xsl:with-param name="force-draw" select="'true'"/>
+ </xsl:apply-templates>
+ </xsl:if>
+ </xsl:when>
+ <!-- end deal with captions and frames -->
+ <xsl:when test=" name() = 'draw:frame' ">
+ <xsl:variable name="BigestWindow">
+ <xsl:call-template name="GetWindowSize">
+ <xsl:with-param name="nodeSet" select="."/>
+ <xsl:with-param name="x-adjust" select="$x-adjust"/>
+ <xsl:with-param name="y-adjust" select="$y-adjust"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:apply-templates select="draw:* ">
+ <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/>
+ <xsl:with-param name="x-adjust" select="concat(substring-after(substring-before($BigestWindow,';y1'), 'x1:'), 'in')"/>
+ <xsl:with-param name="y-adjust" select="concat(substring-after(substring-before($BigestWindow,';x2'), 'y1:') , 'in')"/>
+ <xsl:with-param name="force-draw" select="$force-draw"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:when test="name() = 'draw:g'">
+ <w:r>
+ <w:pict>
+ <xsl:element name="v:group">
+ <xsl:variable name="BigestWindow">
+ <xsl:choose>
+ <xsl:when test="name() = 'draw:g'">
+ <xsl:call-template name="GetWindowSize">
+ <xsl:with-param name="nodeSet" select="draw:*"/>
+ <xsl:with-param name="x-adjust" select="$x-adjust"/>
+ <xsl:with-param name="y-adjust" select="$y-adjust"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'draw:frame'">
+ <xsl:call-template name="GetWindowSize">
+ <xsl:with-param name="nodeSet" select="."/>
+ <xsl:with-param name="x-adjust" select="$x-adjust"/>
+ <xsl:with-param name="y-adjust" select="$y-adjust"/>
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="x">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/>
+ <xsl:with-param name="value" select="concat(substring-after(substring-before($BigestWindow,';y1'), 'x1:'), 'in')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="y">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/>
+ <xsl:with-param name="value" select="concat(substring-after(substring-before($BigestWindow,';x2'), 'y1:') , 'in')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="width">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/>
+ <xsl:with-param name="value" select="concat(number(substring-after(substring-before($BigestWindow,';y2'), 'x2:')) - number(substring-after(substring-before($BigestWindow,';y1'), 'x1:')) , 'in')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="height">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/>
+ <xsl:with-param name="value" select="concat(number(substring-after($BigestWindow,'y2:')) - number(substring-after(substring-before($BigestWindow,';x2'), 'y1:')), 'in')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="id">
+ <xsl:value-of select="generate-id()"/>
+ </xsl:attribute>
+ <xsl:variable name="absolute">
+ <xsl:choose>
+ <xsl:when test="ancestor::draw:a"/>
+ <xsl:when test="@text:anchor-type = 'as-char' or @text:anchor-type = 'to-char'"/>
+ <xsl:otherwise>position:absolute</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="$TargetMeasure= 'pt'">
+ <xsl:attribute name="style">
+ <xsl:if test="string-length($absolute) &gt; 0">
+ <xsl:value-of select="concat($absolute, ';')"/>
+ </xsl:if>
+ <xsl:value-of select="concat('margin-left:',$x ,$MeasureMark,';margin-top:', $y,$MeasureMark ,';width:', $width ,$MeasureMark , ';height:', $height,$MeasureMark)"/>
+ </xsl:attribute>
+ <xsl:attribute name="coordorigin">
+ <xsl:choose>
+ <!-- if we are in a text-box then oo will use comparative positions on us-->
+ <xsl:when test="name() = 'draw:frame' ">
+ <xsl:value-of select=" '0 0' "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat(round($x * 20), ',' , round($y * 20))"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:attribute name="coordsize">
+ <xsl:value-of select="concat(round($width * 20),',', round($height * 20) )"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$TargetMeasure= 'twip' ">
+ <xsl:attribute name="style">
+ <xsl:if test="string-length($absolute) &gt; 0">
+ <xsl:value-of select="concat($absolute, ';')"/>
+ </xsl:if>
+ <xsl:value-of select="concat('left:',$x ,$MeasureMark,';top:', $y,$MeasureMark ,';width:', $width ,$MeasureMark , ';height:', $height,$MeasureMark)"/>
+ </xsl:attribute>
+ <xsl:attribute name="coordorigin">
+ <xsl:choose>
+ <!-- if we are in a text-box then oo will use comparative positions on us-->
+ <xsl:when test="name() = 'draw:frame' ">
+ <xsl:value-of select=" '0 0' "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat($x , ',' , $y)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:attribute name="coordsize">
+ <xsl:value-of select="concat($width,',', $height )"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <!-- if we are in a text-box then oo will use comparative positions on us-->
+ <xsl:when test="ancestor::draw:text-box">
+ <xsl:apply-templates select="draw:*">
+ <xsl:with-param name="TargetMeasure" select="'twip'"/>
+ <xsl:with-param name="x-adjust" select="concat(substring-after(substring-before($BigestWindow,';y1'), 'x1:'), 'in')"/>
+ <xsl:with-param name="y-adjust" select="concat(substring-after(substring-before($BigestWindow,';x2'), 'y1:') , 'in')"/>
+ <xsl:with-param name="force-draw" select="$force-draw"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="draw:*">
+ <xsl:with-param name="TargetMeasure" select="'twip'"/>
+ <xsl:with-param name="force-draw" select="$force-draw"/>
+ </xsl:apply-templates>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </w:pict>
+ </w:r>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="name() = 'draw:a'">
+ <xsl:call-template name="export_hyoerlink">
+ <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/>
+ <xsl:with-param name="x-adjust" select="$x-adjust"/>
+ <xsl:with-param name="y-adjust" select="$y-adjust"/>
+ <xsl:with-param name="force-draw" select="$force-draw"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <w:r>
+ <w:pict>
+ <xsl:call-template name="DrawElements">
+ <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/>
+ <xsl:with-param name="x-adjust" select="$x-adjust"/>
+ <xsl:with-param name="y-adjust" select="$y-adjust"/>
+ <xsl:with-param name="force-draw" select="$force-draw"/>
+ </xsl:call-template>
+ </w:pict>
+ </w:r>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="GetWindowSize">
+ <xsl:param name="CurrPos" select="1"/>
+ <xsl:param name="nodeSet"/>
+ <xsl:param name="x-adjust" select="0"/>
+ <xsl:param name="y-adjust" select="0"/>
+ <xsl:variable name="CurrNodeWindow">
+ <xsl:call-template name="GetNodeWindow">
+ <xsl:with-param name="CurrNode" select=" $nodeSet[ $CurrPos ]"/>
+ <xsl:with-param name="x-adjust" select="$x-adjust"/>
+ <xsl:with-param name="y-adjust" select="$y-adjust"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <!-- if we got to the last node, return it directly, or return the max window of current one and follwing ones -->
+ <xsl:when test="$CurrPos = count($nodeSet)">
+ <xsl:value-of select="$CurrNodeWindow"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="CurrentWindow">
+ <xsl:variable name="FollowingWindow">
+ <xsl:call-template name="GetWindowSize">
+ <xsl:with-param name="nodeSet" select="$nodeSet"/>
+ <xsl:with-param name="CurrPos" select="$CurrPos + 1"/>
+ <xsl:with-param name="x-adjust" select="$x-adjust"/>
+ <xsl:with-param name="y-adjust" select="$y-adjust"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="GetBigestWindows">
+ <xsl:with-param name="Window1" select="$CurrNodeWindow"/>
+ <xsl:with-param name="Window2" select="$FollowingWindow"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="$CurrentWindow"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="GetNodeWindow">
+ <xsl:param name="CurrNode"/>
+ <xsl:param name="x-adjust" select="0"/>
+ <xsl:param name="y-adjust" select="0"/>
+ <xsl:choose>
+ <xsl:when test="name($CurrNode)='draw:g'">
+ <xsl:call-template name="GetWindowSize">
+ <xsl:with-param name="nodeSet" select="$CurrNode/draw:*"/>
+ <xsl:with-param name="x-adjust" select="$x-adjust"/>
+ <xsl:with-param name="y-adjust" select="$y-adjust"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="x">
+ <xsl:call-template name="Add-With-Measure">
+ <xsl:with-param name="value1" select="$CurrNode/@svg:x"/>
+ <xsl:with-param name="value2" select="$x-adjust"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="y">
+ <xsl:call-template name="Add-With-Measure">
+ <xsl:with-param name="value1" select="$CurrNode/@svg:y"/>
+ <xsl:with-param name="value2" select="$y-adjust"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="width">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="$CurrNode/@svg:width"/>
+ <xsl:with-param name="TargetMeasure" select="'in'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="height">
+ <xsl:choose>
+ <xsl:when test="$CurrNode/@svg:height">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="$CurrNode/@svg:height"/>
+ <xsl:with-param name="TargetMeasure" select="'in'"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$CurrNode/@fo:min-height">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="$CurrNode/@fo:min-height"/>
+ <xsl:with-param name="TargetMeasure" select="'in'"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:value-of select="concat('x1:' , $x, ';y1:' , $y, ';x2:' , string($x + $width), ';y2:', string($y + $height) ) "/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="GetBigestWindows">
+ <xsl:param name="Window1"/>
+ <xsl:param name="Window2"/>
+ <xsl:variable name="w1x1" select="substring-after( substring-before($Window1,';y1'),'x1:') "/>
+ <xsl:variable name="w2x1" select="substring-after( substring-before($Window2,';y1'),'x1:') "/>
+ <xsl:variable name="w1y1" select="substring-after( substring-before($Window1,';x2'),'y1:') "/>
+ <xsl:variable name="w2y1" select="substring-after( substring-before($Window2,';x2'),'y1:') "/>
+ <xsl:variable name="w1x2" select="substring-after( substring-before($Window1,';y2'),'x2:') "/>
+ <xsl:variable name="w2x2" select="substring-after( substring-before($Window2,';y2'),'x2:') "/>
+ <xsl:variable name="w1y2" select="substring-after( $Window1,';y2:') "/>
+ <xsl:variable name="w2y2" select="substring-after( $Window2,';y2:') "/>
+ <xsl:variable name="x1">
+ <xsl:choose>
+ <xsl:when test="$w1x1 &gt; $w2x1">
+ <xsl:value-of select="$w2x1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$w1x1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="y1">
+ <xsl:choose>
+ <xsl:when test="$w1y1 &gt; $w2y1">
+ <xsl:value-of select="$w2y1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$w1y1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="x2">
+ <xsl:choose>
+ <xsl:when test="$w1x2 &gt; $w2x2">
+ <xsl:value-of select="$w1x2"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$w2x2"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="y2">
+ <xsl:choose>
+ <xsl:when test="$w1y2 &gt; $w2y2">
+ <xsl:value-of select="$w1y2"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$w2y2"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:value-of select="concat('x1:' , $x1 , ';y1:' , $y1 , ';x2:' , $x2, ';y2:' , $y2)"/>
+ </xsl:template>
+ <!-- convert percent value to x% numeric x/100 -->
+ <xsl:template name="ValueOfPercent">
+ <xsl:param name="value"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, '%')">
+ <xsl:value-of select="substring-before($value, '%') div 100"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="points2points">
+ <xsl:param name="input_points"/>
+ <xsl:param name="input_x"/>
+ <xsl:param name="input_y"/>
+ <xsl:param name="input_width"/>
+ <xsl:param name="input_height"/>
+ <xsl:param name="input_boxwidth"/>
+ <xsl:param name="input_boxheight"/>
+ <xsl:variable name="onepoint" select="substring($input_points,1,string-length($input_points) - string-length(substring-after($input_points,' ')) )"/>
+ <xsl:if test="substring-before($input_points,' ')">
+ <xsl:value-of select="round($input_x + (($input_boxwidth - number(substring-before($onepoint,','))) ) * $input_width div $input_boxwidth)"/>
+ <xsl:value-of select="'pt,'"/>
+ <xsl:value-of select="round($input_y + ((number(substring-after($onepoint,',')) ) ) * $input_height div $input_boxheight)"/>
+ <xsl:value-of select="'pt'"/>
+ </xsl:if>
+ <xsl:if test="string-length(substring($input_points,string-length($onepoint) + 1)) &gt; 0">
+ <xsl:value-of select="','"/>
+ <xsl:call-template name="points2points">
+ <xsl:with-param name="input_points" select="substring($input_points,string-length($onepoint) + 1)"/>
+ <xsl:with-param name="input_x" select="$input_x"/>
+ <xsl:with-param name="input_y" select="$input_y"/>
+ <xsl:with-param name="input_width" select="$input_width"/>
+ <xsl:with-param name="input_height" select="$input_height"/>
+ <xsl:with-param name="input_boxwidth" select="$input_boxwidth"/>
+ <xsl:with-param name="input_boxheight" select="$input_boxheight"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="path2path">
+ <xsl:param name="input_points"/>
+ <xsl:param name="x_or_y" select="'x'"/>
+ <xsl:param name="input_x"/>
+ <xsl:param name="input_y"/>
+ <xsl:param name="input_width"/>
+ <xsl:param name="input_height"/>
+ <xsl:param name="input_boxwidth"/>
+ <xsl:param name="input_boxheight"/>
+ <xsl:variable name="space-pos" select="string-length($input_points) - string-length(substring-after($input_points,' '))"/>
+ <xsl:variable name="minus-pos" select="string-length($input_points) - string-length(substring-after($input_points,'-'))"/>
+ <xsl:variable name="m-pos" select="string-length($input_points) - string-length(substring-after($input_points,'m'))"/>
+ <xsl:variable name="c-pos" select="string-length($input_points) - string-length(substring-after($input_points,'c'))"/>
+ <xsl:variable name="e-pos" select="string-length($input_points) - string-length(substring-after($input_points,'e'))"/>
+ <xsl:variable name="min1">
+ <xsl:choose>
+ <xsl:when test="$space-pos &lt; $minus-pos">
+ <xsl:value-of select="$space-pos"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$minus-pos"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="min2">
+ <xsl:choose>
+ <xsl:when test="$m-pos &lt; $min1">
+ <xsl:value-of select="$m-pos"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$min1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="min3">
+ <xsl:choose>
+ <xsl:when test="$c-pos &lt; $min2">
+ <xsl:value-of select="$c-pos"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$min2"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="min4">
+ <xsl:choose>
+ <xsl:when test="$e-pos &lt; $min3">
+ <xsl:value-of select="$e-pos"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$min3"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="min-special-char-pos" select="$min4"/>
+ <xsl:variable name="special-char" select="substring($input_points,$min-special-char-pos,1)"/>
+ <xsl:variable name="one-value" select="substring($input_points,1,$min-special-char-pos - 1)"/>
+ <xsl:variable name="left-points" select="substring($input_points,$min-special-char-pos + 1)"/>
+ <xsl:if test="not($special-char = 'm')">
+ <xsl:if test="$x_or_y = 'x'">
+ <xsl:value-of select="round($input_x + $one-value * $input_width div $input_boxwidth)"/>
+ </xsl:if>
+ <xsl:if test="$x_or_y = 'y'">
+ <xsl:value-of select="round($input_y + $one-value * $input_height div $input_boxheight)"/>
+ </xsl:if>
+ </xsl:if>
+ <!-- output the separator-->
+ <xsl:choose>
+ <xsl:when test="$special-char = '-' or $special-char = ' ' ">
+ <xsl:value-of select="','"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$special-char"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:variable name="next-xy">
+ <xsl:if test="$x_or_y = 'x'">
+ <xsl:value-of select="'y'"/>
+ </xsl:if>
+ <xsl:if test="$x_or_y = 'y'">
+ <xsl:value-of select="'x'"/>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:if test="string-length($left-points) &gt; 0">
+ <xsl:call-template name="path2path">
+ <xsl:with-param name="input_points" select="$left-points"/>
+ <xsl:with-param name="x_or_y" select="$next-xy"/>
+ <xsl:with-param name="input_x" select="$input_x"/>
+ <xsl:with-param name="input_y" select="$input_y"/>
+ <xsl:with-param name="input_width" select="$input_width"/>
+ <xsl:with-param name="input_height" select="$input_height"/>
+ <xsl:with-param name="input_boxwidth" select="$input_boxwidth"/>
+ <xsl:with-param name="input_boxheight" select="$input_boxheight"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="get_dashstyle">
+ <xsl:param name="stroke-width" select="0.1"/>
+ <xsl:param name="style-name" select="@draw:style-name"/>
+ <xsl:variable name="graph-style" select="key('graphics-style', $style-name)/style:graphic-properties"/>
+ <xsl:variable name="dash-style" select="key('stroke-dash-style', $graph-style/@draw:stroke-dash)"/>
+ <xsl:variable name="stroke">
+ <xsl:choose>
+ <xsl:when test="$graph-style/@draw:stroke">
+ <xsl:value-of select="$graph-style/@draw:stroke"/>
+ </xsl:when>
+ <xsl:when test="$dash-style/@draw:stroke">
+ <xsl:value-of select="$dash-style/@draw:stroke"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$stroke = 'solid' ">
+ <xsl:value-of select="$stroke"/>
+ </xsl:when>
+ <xsl:when test="$stroke = 'dash'">
+ <xsl:variable name="dots1">
+ <xsl:choose>
+ <xsl:when test="$graph-style/@draw:dots1">
+ <xsl:value-of select="$graph-style/@draw:dots1"/>
+ </xsl:when>
+ <xsl:when test="$dash-style/@draw:dots1">
+ <xsl:value-of select="$dash-style/@draw:dots1"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="dots2">
+ <xsl:choose>
+ <xsl:when test="$graph-style/@draw:dots1">
+ <xsl:value-of select="$graph-style/@draw:dots2"/>
+ </xsl:when>
+ <xsl:when test="$dash-style/@draw:dots1">
+ <xsl:value-of select="$dash-style/@draw:dots2"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="dots1-length">
+ <xsl:choose>
+ <xsl:when test="$graph-style/@draw:dots1-length">
+ <xsl:value-of select="$graph-style/@draw:dots1-length"/>
+ </xsl:when>
+ <xsl:when test="$dash-style/@draw:dots1-length">
+ <xsl:value-of select="$dash-style/@draw:dots1-length"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="dots2-length">
+ <xsl:choose>
+ <xsl:when test="$graph-style/@draw:dots2-length">
+ <xsl:value-of select="$graph-style/@draw:dots2-length"/>
+ </xsl:when>
+ <xsl:when test="$dash-style/@draw:dots2-length">
+ <xsl:value-of select="$dash-style/@draw:dots2-length"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="distance">
+ <xsl:choose>
+ <xsl:when test="$graph-style/@draw:distance">
+ <xsl:value-of select="$graph-style/@draw:distance"/>
+ </xsl:when>
+ <xsl:when test="$dash-style/@draw:distance">
+ <xsl:value-of select="$dash-style/@draw:distance"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="dot1-step">
+ <xsl:choose>
+ <xsl:when test="contains($dots1-length,'%')">
+ <xsl:variable name="dots-percent">
+ <xsl:call-template name="ValueOfPercent">
+ <xsl:with-param name="value" select="$dots1-length"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="round($dots-percent)"/>
+ </xsl:when>
+ <xsl:when test="contains($dots1-length , 'in' ) and $stroke-width &gt; 0">
+ <xsl:value-of select="round( number(substring-before($dots1-length,'in' )) div $stroke-width )"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="dot2-step">
+ <xsl:choose>
+ <xsl:when test="contains($dots2-length,'%')">
+ <xsl:variable name="dots-percent">
+ <xsl:call-template name="ValueOfPercent">
+ <xsl:with-param name="value" select="$dots2-length"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="round($dots-percent)"/>
+ </xsl:when>
+ <xsl:when test="contains($dots2-length,'in') and $stroke-width &gt; 0">
+ <xsl:value-of select="round(number(substring-before($dots2-length,'in')) div $stroke-width)"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="distance-step">
+ <xsl:choose>
+ <xsl:when test="contains($distance,'%')">
+ <xsl:variable name="dots-percent">
+ <xsl:call-template name="ValueOfPercent">
+ <xsl:with-param name="value" select="$distance"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="round($dots-percent)"/>
+ </xsl:when>
+ <xsl:when test="contains($distance,'in') and $stroke-width &gt; 0">
+ <xsl:value-of select="round(number(substring-before($distance,'in')) div $stroke-width)"/>
+ </xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="dashstyle">
+ <xsl:choose>
+ <xsl:when test="$dots1 = 1 and $dots2 = 1 and $dot1-step = 0 and $dot2-step = 0 and $distance-step = 0">
+ <xsl:value-of select="'ShortDot'"/>
+ </xsl:when>
+ <xsl:when test="$dots2 = 0 and $dot1-step = 0 and $dot2-step = 0 and $distance-step &gt; 0">
+ <xsl:value-of select="concat('0 ', $distance-step)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="create_dashstyle">
+ <xsl:with-param name="dot-count" select="$dots1"/>
+ <xsl:with-param name="dot-step" select="$dot1-step"/>
+ <xsl:with-param name="distance-step" select="$distance-step"/>
+ </xsl:call-template>
+ <xsl:value-of select="' '"/>
+ <xsl:call-template name="create_dashstyle">
+ <xsl:with-param name="dot-count" select="$dots2"/>
+ <xsl:with-param name="dot-step" select="$dot2-step"/>
+ <xsl:with-param name="distance-step" select="$distance-step"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:value-of select="$dashstyle"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="create_dashstyle">
+ <xsl:param name="dot-count"/>
+ <xsl:param name="dot-step"/>
+ <xsl:param name="distance-step"/>
+ <xsl:if test="$dot-count &gt; 0">
+ <xsl:value-of select="concat($dot-step, ' ' , $distance-step )"/>
+ <xsl:if test="$dot-count - 1 &gt; 0">
+ <xsl:value-of select="' '"/>
+ <xsl:call-template name="create_dashstyle">
+ <xsl:with-param name="dot-count" select="$dot-count - 1"/>
+ <xsl:with-param name="dot-step" select="$dot-step"/>
+ <xsl:with-param name="distance-step" select="$distance-step"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="get_borderstyle">
+ <xsl:param name="border"/>
+ <xsl:param name="border-line-width"/>
+ <xsl:choose>
+ <xsl:when test="contains($border,'solid')">
+ <xsl:variable name="strokeweight">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="substring-before($border, ' ')"/>
+ <xsl:with-param name="TargetMeasure" select="'pt'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="concat ( 'strokeweight:', $strokeweight)"/>
+ </xsl:when>
+ <xsl:when test="contains($border,'double')">
+ <xsl:variable name="outside">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="substring-after(substring-after($border-line-width, ' ') , ' ')"/>
+ <xsl:with-param name="TargetMeasure" select="'pt'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="inside">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="substring-before($border-line-width, ' ')"/>
+ <xsl:with-param name="TargetMeasure" select="'pt'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="space">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="substring-before(substring-after($border-line-width, ' ') , ' ')"/>
+ <xsl:with-param name="TargetMeasure" select="'pt'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="linestyle">
+ <xsl:choose>
+ <xsl:when test="$outside = $inside">
+ <xsl:value-of select="'thinThin'"/>
+ </xsl:when>
+ <xsl:when test="$outside &gt; $inside">
+ <xsl:value-of select="'thickThin'"/>
+ </xsl:when>
+ <xsl:when test="$outside &lt; $inside">
+ <xsl:value-of select="'thinThick'"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="strokeweight" select="$inside + $outside + $space"/>
+ <xsl:value-of select="concat( 'linestyle:' , $linestyle , ';' , 'strokeweight:' , $strokeweight )"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="DrawElements">
+ <xsl:param name="TargetMeasure" select="pt"/>
+ <xsl:param name="x-adjust" select="0"/>
+ <xsl:param name="y-adjust" select="0"/>
+ <xsl:param name="force-draw" select="'false'"/>
+ <xsl:param name="shape-type"/>
+ <xsl:variable name="MeasureMark">
+ <xsl:choose>
+ <xsl:when test="$TargetMeasure = 'twip'"/>
+ <xsl:otherwise>
+ <xsl:value-of select="$TargetMeasure"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="drawtextstyle" select="@draw:text-style-name"/>
+ <xsl:variable name="org-z-index">
+ <xsl:choose>
+ <xsl:when test="@draw:z-index">
+ <xsl:value-of select="number(concat('0',@draw:z-index))"/>
+ </xsl:when>
+ <xsl:when test="parent::draw:frame/@draw:z-index">
+ <xsl:value-of select="number(concat('0',parent::draw:frame/@draw:z-index))"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="run-though" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@style:run-through"/>
+ <xsl:variable name="org-wrap" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@style:wrap"/>
+ <xsl:variable name="draw-name">
+ <xsl:choose>
+ <xsl:when test="string-length(@draw:name) = 0">
+ <xsl:value-of select="translate(ancestor::draw:frame[1]/@draw:name, ':/', '__')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="translate(@draw:name, ':/', '__')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="style_name2key">
+ <xsl:choose>
+ <xsl:when test="@draw:style-name">
+ <xsl:value-of select="@draw:style-name"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="ancestor::draw:frame/@draw:style-name">
+ <xsl:value-of select="ancestor::draw:frame/@draw:style-name"/>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="draw-fill-type" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fill"/>
+ <xsl:variable name="draw-gradient-name" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fill-gradient-name"/>
+ <xsl:variable name="horizontal-pos" select="key('graphics-style', $style_name2key)/style:graphic-properties/@style:horizontal-pos"/>
+ <!--horizontal-pos attribute is for the placement of all the drawing elements-->
+ <xsl:variable name="fill-image-name" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fill-image-name"/>
+ <xsl:if test="$draw-fill-type = 'bitmap' ">
+ <xsl:element name="w:binData">
+ <xsl:attribute name="w:name">
+ <xsl:value-of select="concat( 'wordml://', $fill-image-name)"/>
+ </xsl:attribute>
+ <xsl:value-of select="translate(key('fill-image',$fill-image-name)/office:binary-data/text(),'&#9;&#10;&#13;&#32;','' ) "/>
+ <!-- xsl:value-of select="office:binary-data/text()"/ -->
+ </xsl:element>
+ </xsl:if>
+ <xsl:variable name="z-index">
+ <xsl:choose>
+ <xsl:when test="$run-though='foreground'">
+ <!-- make sure z-index >=0 -->
+ <xsl:choose>
+ <xsl:when test="$org-z-index &lt; 0">0</xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$org-z-index"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$run-though='background'">
+ <!-- make sure z-index < 0 -->
+ <xsl:choose>
+ <xsl:when test="$org-z-index &lt; 0">
+ <xsl:value-of select="$org-z-index"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$org-z-index - 10"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="wrap">
+ <xsl:choose>
+ <xsl:when test="@text:anchor-type='as-char' ">none</xsl:when>
+ <xsl:when test="$org-wrap='dynamic'">tight</xsl:when>
+ <xsl:when test="$org-wrap='parallel'">square</xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="ooshapename" select="substring-after(name(),':')"/>
+ <xsl:variable name="element-name">
+ <xsl:choose>
+ <xsl:when test="$ooshapename='rect'">v:rect</xsl:when>
+ <xsl:when test="$ooshapename='ellipse' and not(string-length(@draw:kind) &gt; 0)">v:oval</xsl:when>
+ <xsl:when test="$ooshapename='ellipse' and string-length(@draw:kind) &gt; 0">v:arc</xsl:when>
+ <xsl:when test="$ooshapename='circle' and string-length(@draw:kind) &gt; 0">v:arc</xsl:when>
+ <xsl:when test="$ooshapename='line'">v:line</xsl:when>
+ <xsl:when test="$ooshapename='polyline'">v:polyline</xsl:when>
+ <xsl:when test="$ooshapename='polygon'">v:polyline</xsl:when>
+ <xsl:when test="$ooshapename='text-box'">v:shape</xsl:when>
+ <xsl:when test="$ooshapename='image'">v:shape</xsl:when>
+ <xsl:when test="$ooshapename='frame'">v:shape</xsl:when>
+ <xsl:when test="$ooshapename='path'">v:shape</xsl:when>
+ <!-- This caption is not the "Caption", it's GUI name is Callouts-->
+ <xsl:when test="$ooshapename='caption'">v:shape</xsl:when>
+ <xsl:when test="$ooshapename='custom-shape' and draw:enhanced-geometry[1]/@draw:predefined-type = 'non-primitive' ">v:shape</xsl:when>
+ <xsl:when test="$ooshapename='custom-shape' and draw:enhanced-geometry[1]/@draw:predefined-type = 'round-rectangle' ">v:roundrect</xsl:when>
+ <xsl:when test="$ooshapename='custom-shape' and draw:enhanced-geometry[1]/@draw:predefined-type = 'rectangle' ">v:rect</xsl:when>
+ <xsl:when test="$ooshapename='custom-shape' and draw:enhanced-geometry[1]/@draw:predefined-type = 'ellipse' ">v:oval</xsl:when>
+ <xsl:when test="$ooshapename='custom-shape'">v:shape</xsl:when>
+ <!-- some wild guess -->
+ <xsl:otherwise>v:shape</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="ms-shape-type">
+ <xsl:choose>
+ <xsl:when test="string-length($shape-type) &gt; 0">
+ <xsl:value-of select="$shape-type"/>
+ </xsl:when>
+ <xsl:when test="$ooshapename='custom-shape' ">
+ <xsl:call-template name="ooo_custom_draw2ms_word_draw_map">
+ <xsl:with-param name="ooo_predefined_type" select="draw:enhanced-geometry[1]/@draw:predefined-type"/>
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="real-x-adjust">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/>
+ <xsl:with-param name="value" select="concat($x-adjust,'in')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="real-y-adjust">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/>
+ <xsl:with-param name="value" select="concat($y-adjust,'in')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="org-x">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/>
+ <xsl:with-param name="value" select="@svg:x"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="org-y">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/>
+ <xsl:with-param name="value" select="@svg:y"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="pagemaster" select="key('master-page','Standard')/@style:page-layout-name"/>
+ <xsl:variable name="leftmargin-pt">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/>
+ <xsl:with-param name="value" select="key('page-layout',$pagemaster)/style:page-layout-properties/@fo:margin-left"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="topmargin-pt">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/>
+ <xsl:with-param name="value" select="key('page-layout',$pagemaster)/style:page-layout-properties/@fo:margin-top"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <!-- addjust the x and y values of the page archored objects-->
+ <xsl:variable name="x">
+ <xsl:choose>
+ <xsl:when test="@text:anchor-type='page' or ancestor::draw:*/@text:anchor-type='page'">
+ <xsl:value-of select="$org-x + $real-x-adjust - $leftmargin-pt"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$org-x + $real-x-adjust"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="y">
+ <xsl:choose>
+ <xsl:when test="@text:anchor-type='page' or ancestor::draw:*/@text:anchor-type='page'">
+ <xsl:value-of select="$org-y + $real-y-adjust - $topmargin-pt"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$org-y + $real-y-adjust"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="width">
+ <xsl:variable name="width-tmp">
+ <xsl:choose>
+ <xsl:when test="@svg:width">
+ <xsl:value-of select="@svg:width"/>
+ </xsl:when>
+ <xsl:when test="not(string-length(parent::draw:frame/@svg:width) = 0)">
+ <xsl:value-of select="parent::draw:frame/@svg:width"/>
+ </xsl:when>
+ <xsl:when test="string-length(@svg:width) = 0 and ancestor::draw:frame">
+ <xsl:value-of select="ancestor::draw:frame/@svg:width"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="@svg:width"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/>
+ <xsl:with-param name="value" select="$width-tmp"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="height">
+ <xsl:choose>
+ <xsl:when test="@svg:height">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/>
+ <xsl:with-param name="value" select="@svg:height"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="not(string-length(parent::draw:frame/@svg:height) = 0)">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/>
+ <xsl:with-param name="value" select="parent::draw:frame/@svg:height"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="@fo:min-height and string-length(text:p/text()) = 0 and not(text:p/draw:*)">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/>
+ <xsl:with-param name="value" select="@fo:min-height"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="borderstyle">
+ <xsl:call-template name="get_borderstyle">
+ <xsl:with-param name="border" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@fo:border"/>
+ <xsl:with-param name="border-line-width" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@style:border-line-width"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="stroke-weight-in-inch" select="number(concat('0',translate(key('graphics-style', @draw:style-name)/style:graphic-properties/@svg:stroke-width ,'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ','') ))"/>
+ <xsl:variable name="stroke-weight">
+ <xsl:choose>
+ <xsl:when test="contains($borderstyle , 'strokeweight')">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/>
+ <xsl:with-param name="value" select="concat( substring-after($borderstyle, 'strokeweight:') , 'pt')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/>
+ <xsl:with-param name="value" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@svg:stroke-width"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="linestyle">
+ <xsl:if test="contains($borderstyle , 'strokeweight')">
+ <xsl:value-of select="substring-before( substring-after($borderstyle, 'linestyle:') , ';strokeweight')"/>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:variable name="stroked">
+ <xsl:if test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:stroke = 'none'">
+ <xsl:value-of select="'f'"/>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:variable name="dashstyle">
+ <xsl:call-template name="get_dashstyle">
+ <xsl:with-param name="stroke-width" select="$stroke-weight-in-inch"/>
+ <xsl:with-param name="style-name" select="@draw:style-name"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="start-arrow">
+ <xsl:choose>
+ <xsl:when test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-end">
+ <xsl:call-template name="MapArrowStyle">
+ <xsl:with-param name="arrow-name" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-end"/>
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="end-arrow">
+ <xsl:choose>
+ <xsl:when test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-start">
+ <xsl:call-template name="MapArrowStyle">
+ <xsl:with-param name="arrow-name" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-start"/>
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="start-arrow-length">
+ <xsl:choose>
+ <xsl:when test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-end">
+ <xsl:call-template name="GetArrowLength">
+ <xsl:with-param name="arrow-name" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-end"/>
+ <xsl:with-param name="arrow-width" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-end-width"/>
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="start-arrow-width">
+ <xsl:choose>
+ <xsl:when test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-end">
+ <xsl:call-template name="GetArrowWidth">
+ <xsl:with-param name="arrow-name" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-end"/>
+ <xsl:with-param name="arrow-width" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-end-width"/>
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="end-arrow-length">
+ <xsl:choose>
+ <xsl:when test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-start">
+ <xsl:call-template name="GetArrowLength">
+ <xsl:with-param name="arrow-name" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-start"/>
+ <xsl:with-param name="arrow-width" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-start-width"/>
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="end-arrow-width">
+ <xsl:choose>
+ <xsl:when test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-start">
+ <xsl:call-template name="GetArrowWidth">
+ <xsl:with-param name="arrow-name" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-start"/>
+ <xsl:with-param name="arrow-width" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-start-width"/>
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="stroke-color">
+ <xsl:choose>
+ <xsl:when test="key('graphics-style', @draw:style-name)/style:graphic-properties/@svg:stroke-color">
+ <xsl:value-of select="key('graphics-style', @draw:style-name)/style:graphic-properties/@svg:stroke-color"/>
+ </xsl:when>
+ <xsl:when test="contains(key('graphics-style', @draw:style-name)/style:graphic-properties/@fo:border, '#')">
+ <xsl:value-of select="concat('#', substring-after(key('graphics-style', @draw:style-name)/style:graphic-properties/@fo:border, '#') )"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="stroke-opacity">
+ <xsl:call-template name="ValueOfPercent">
+ <xsl:with-param name="value" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@svg:stroke-opacity"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="fill-color">
+ <xsl:choose>
+ <xsl:when test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fill-color">
+ <xsl:value-of select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fill-color"/>
+ </xsl:when>
+ <xsl:when test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fontwork-style">black</xsl:when>
+ <xsl:when test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fill = 'none'"/>
+ <xsl:when test="$draw-fill-type = 'gradient' ">
+ <xsl:value-of select="key('draw-gradient',$draw-gradient-name)/@draw:end-color "/>
+ </xsl:when>
+ <!-- for these need fill, set the default color we used in oo-->
+ <xsl:when test="name()='draw:polygon' or name()='draw:custom-shape' or name() = 'draw:rect' or (name() = 'draw:ellipse' and not( @draw:kind='arc') )">#00B8FF</xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="position">
+ <xsl:value-of select="concat('left:', $x ,$MeasureMark , ';top:' , $y ,$MeasureMark , ';width:', $width ,$MeasureMark )"/>
+ <xsl:if test="not($height = 0)">
+ <xsl:value-of select="concat(';height:', $height ,$MeasureMark )"/>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:variable name="flip">
+ <xsl:choose>
+ <xsl:when test="@text:anchor-type='as-char' and $ooshapename='line'"/>
+ <xsl:when test="$ooshapename='image'"/>
+ <xsl:when test="$ooshapename='path'"/>
+ <xsl:when test="$ooshapename='caption'"/>
+ <xsl:when test="@draw:kind = 'arc' or @draw:kind = 'cut' or @draw:kind = 'section'"/>
+ <xsl:when test="$ooshapename='custom-shape'"/>
+ <xsl:otherwise>flip:x</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="absolute">
+ <xsl:choose>
+ <xsl:when test="ancestor::draw:a"/>
+ <xsl:when test="@text:anchor-type = 'as-char' or @text:anchor-type = 'to-char'"/>
+ <xsl:when test="parent::draw:frame/@text:anchor-type = 'as-char' or parent::draw:frame/@text:anchor-type = 'to-char'"/>
+ <xsl:otherwise>position:absolute</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="anchorlock">
+ <xsl:choose>
+ <xsl:when test="@text:anchor-type = 'as-char' or @text:anchor-type = 'to-char'">has</xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:variable>
+ <!-- start line special -->
+ <xsl:variable name="org-x1">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/>
+ <xsl:with-param name="value" select="@svg:x1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="org-y1">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/>
+ <xsl:with-param name="value" select="@svg:y1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="org-x2">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/>
+ <xsl:with-param name="value" select="@svg:x2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="org-y2">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/>
+ <xsl:with-param name="value" select="@svg:y2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="x1">
+ <xsl:choose>
+ <xsl:when test="@text:anchor-type='page' or ancestor::draw:*/@text:anchor-type='page'">
+ <xsl:value-of select="$org-x1 + $real-x-adjust - $leftmargin-pt"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$org-x1 + $real-x-adjust"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="y1">
+ <xsl:choose>
+ <xsl:when test="@text:anchor-type='page' or ancestor::draw:*/@text:anchor-type='page'">
+ <xsl:value-of select="$org-y1 + $real-y-adjust - $topmargin-pt"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$org-y1 + $real-y-adjust"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="x2">
+ <xsl:choose>
+ <xsl:when test="@text:anchor-type='page' or ancestor::draw:*/@text:anchor-type='page'">
+ <xsl:value-of select="$org-x2 + $real-x-adjust - $leftmargin-pt"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$org-x2 + $real-x-adjust"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="y2">
+ <xsl:choose>
+ <xsl:when test="@text:anchor-type='page' or ancestor::draw:*/@text:anchor-type='page'">
+ <xsl:value-of select="$org-y2 + $real-y-adjust - $topmargin-pt"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$org-y2 + $real-y-adjust"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <!-- end line special -->
+ <xsl:variable name="relative">
+ <xsl:choose>
+ <xsl:when test="@text:anchor-type = 'as-char' or @text:anchor-type = 'to-char'">mso-position-horizontal-relative:char;mso-position-vertical-relative:line</xsl:when>
+ <xsl:when test="parent::draw:frame/@text:anchor-type = 'as-char' or parent::draw:frame/@text:anchor-type = 'to-char'">mso-position-horizontal-relative:char;mso-position-vertical-relative:line</xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="style">
+ <xsl:choose>
+ <xsl:when test="$wrap='none'"/>
+ <xsl:otherwise>
+ <xsl:if test="string-length($absolute) &gt; 0">
+ <xsl:value-of select="concat($absolute, ';')"/>
+ </xsl:if>
+ <xsl:value-of select="concat('z-index:', $z-index, ';')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="string-length($flip) &gt; 0">
+ <xsl:value-of select="concat($flip,';')"/>
+ </xsl:if>
+ <xsl:if test="not($ooshapename = 'line')">
+ <xsl:value-of select="concat($position,';')"/>
+ </xsl:if>
+ <xsl:if test="ancestor::draw:frame and name()='draw:text-box'">
+ <xsl:if test="string-length($horizontal-pos) &gt; 0">
+ <xsl:value-of select="concat('mso-position-horizontal:',$horizontal-pos,';')"/>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="string-length($relative) &gt; 0">
+ <xsl:value-of select="concat($relative,';')"/>
+ </xsl:if>
+ </xsl:variable>
+ <!-- image special: convert oo base64 binary data (77char/line) to word base64 binary data(73char/line) , a workthrough is removing all line breaks -->
+ <xsl:if test="$ooshapename = 'image'">
+ <xsl:element name="w:binData">
+ <xsl:attribute name="w:name">
+ <xsl:value-of select="concat( 'wordml://', $draw-name )"/>
+ </xsl:attribute>
+ <xsl:value-of select="translate(office:binary-data/text(),'&#9;&#10;&#13;&#32;','' ) "/>
+ <!-- xsl:value-of select="office:binary-data/text()"/ -->
+ </xsl:element>
+ </xsl:if>
+ <!-- all element goes here -->
+ <xsl:variable name="id">
+ <xsl:choose>
+ <xsl:when test="$ooshapename='line'">
+ <xsl:value-of select="concat('_x',$x1 , '_' ,$y1, '_' , $x2, '_' ,$y2 )"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat('_x',$x , '_' ,$y, '_' , $width, '_' ,$height )"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:element name="{$element-name}">
+ <xsl:attribute name="id">
+ <xsl:value-of select="$id"/>
+ </xsl:attribute>
+ <xsl:if test="string-length($ms-shape-type) &gt; 0">
+ <xsl:attribute name="type">
+ <xsl:value-of select="$ms-shape-type"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="style">
+ <xsl:value-of select="$style"/>
+ </xsl:attribute>
+ <xsl:if test="$stroke-weight &gt; 0">
+ <xsl:attribute name="strokeweight">
+ <xsl:value-of select="concat($stroke-weight,$MeasureMark)"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="string-length($stroked) &gt; 0">
+ <xsl:attribute name="stroked">
+ <xsl:value-of select="$stroked"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="string-length($stroke-color) &gt; 0">
+ <xsl:attribute name="strokecolor">
+ <xsl:value-of select="$stroke-color"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="string-length($fill-color) &gt; 0">
+ <xsl:attribute name="fillcolor">
+ <xsl:value-of select="$fill-color"/>
+ </xsl:attribute>
+ <xsl:attribute name="filled">true</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="parent::draw:frame/draw:object-ole[1]">
+ <xsl:attribute name="filled">true</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="string-length($stroke-opacity) &gt; 0">
+ <xsl:attribute name="opacity">
+ <xsl:value-of select="$stroke-opacity"/>
+ </xsl:attribute>
+ </xsl:if>
+ <!-- arc special attribute -->
+ <xsl:if test="@draw:kind = 'arc' or @draw:kind = 'cut' or @draw:kind = 'section'">
+ <xsl:choose>
+ <xsl:when test="@draw:start-angle &gt; @draw:end-angle">
+ <xsl:attribute name="startangle">
+ <xsl:value-of select="round( 450 - (@draw:end-angle + 360) )"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="startangle">
+ <xsl:value-of select="round( 450 - @draw:end-angle )"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="endangle">
+ <xsl:value-of select="round(450 - @draw:start-angle)"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@draw:kind = 'cut'">
+ <xsl:attribute name="fill">
+ <xsl:value-of select="'true'"/>
+ </xsl:attribute>
+ </xsl:if>
+ <!-- end arc special attribute -->
+ <!-- line special attribute-->
+ <xsl:if test="$ooshapename='line'">
+ <xsl:attribute name="from">
+ <xsl:choose>
+ <xsl:when test="@text:anchor-type='as-char'">0,0</xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat($x1,$MeasureMark, ',',$y2,$MeasureMark )"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:attribute name="to">
+ <xsl:choose>
+ <xsl:when test="@text:anchor-type='as-char'">
+ <xsl:value-of select="concat($x2,$MeasureMark ,',',$y2,$MeasureMark )"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat($x2,$MeasureMark ,',' ,$y1,$MeasureMark)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:if>
+ <!-- end line special attribute-->
+ <!-- polyline and polygon special attribute-->
+ <xsl:if test="$ooshapename='polyline' or $ooshapename='polygon' ">
+ <!-- translate ' ' to in ' tranclate ',' to 'in,' -->
+ <xsl:variable name="points">
+ <xsl:call-template name="points2points">
+ <xsl:with-param name="input_x" select="$x"/>
+ <xsl:with-param name="input_y" select="$y"/>
+ <xsl:with-param name="input_width" select="$width"/>
+ <xsl:with-param name="input_height" select="$height"/>
+ <xsl:with-param name="input_boxwidth" select="substring-before(substring-after(@svg:viewBox,'0 0 '),' ')"/>
+ <xsl:with-param name="input_boxheight" select="substring-after(substring-after(@svg:viewBox,'0 0 '),' ')"/>
+ <xsl:with-param name="input_points" select="concat(@draw:points,' ')"/>
+ <!-- add a space to the end of input_points -->
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="points">
+ <xsl:value-of select="$points"/>
+ </xsl:attribute>
+ </xsl:if>
+ <!-- end polyline and polygon special attribute-->
+ <!-- callouts special attribute-->
+ <xsl:if test="$ooshapename='caption'">
+ <xsl:variable name="caption-point-x">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="'twip'"/>
+ <xsl:with-param name="value" select="@draw:caption-point-x"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="caption-point-y">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="'twip'"/>
+ <xsl:with-param name="value" select="@draw:caption-point-y"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="type">
+ <!-- map to word line label 3-->
+ <xsl:value-of select="'#_x0000_t48'"/>
+ </xsl:attribute>
+ <xsl:attribute name="adj">
+ <xsl:value-of select=" concat($caption-point-x * 20 , ',' , $caption-point-y * 20 , ',' , $caption-point-x * 10 , ',,,,' , $caption-point-x * 20, ',' , $caption-point-y * 20) "/>
+ </xsl:attribute>
+ </xsl:if>
+ <!-- end callouts special attribute-->
+ <!-- path special attribute-->
+ <xsl:if test="$ooshapename='path' or string-length(@svg:d) &gt; 0 or ( $ooshapename='custom-shape' and draw:enhanced-geometry[1]/@draw:predefined-type = 'non-primitive') ">
+ <xsl:variable name="path">
+ <xsl:choose>
+ <xsl:when test="$ooshapename='path' or string-length(@svg:d) &gt; 0 ">
+ <xsl:call-template name="svgpath2vmlpath">
+ <xsl:with-param name="svg-path" select="@svg:d"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="svgpath2vmlpath">
+ <xsl:with-param name="svg-path" select="draw:enhanced-geometry[1]/@draw:enhanced-path"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="coordorigin">
+ <xsl:value-of select=" '0 0' "/>
+ </xsl:attribute>
+ <xsl:attribute name="coordsize">
+ <xsl:choose>
+ <xsl:when test="string-length(@svg:viewBox) &gt; 0 ">
+ <xsl:value-of select="substring-after(@svg:viewBox,'0 0 ')"/>
+ </xsl:when>
+ <xsl:when test="string-length(draw:enhanced-geometry[1]/@svg:viewBox) &gt; 0 ">
+ <xsl:value-of select="substring-after(draw:enhanced-geometry[1]/@svg:viewBox,'0 0 ')"/>
+ </xsl:when>
+ <!-- for custom shape use a default viewbox. right? -->
+ <xsl:otherwise>
+ <xsl:value-of select=" '21600 21600' "/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:attribute name="path">
+ <xsl:value-of select="$path"/>
+ </xsl:attribute>
+ </xsl:if>
+ <!-- end path special attribute-->
+ <!-- image special element -->
+ <xsl:if test="$ooshapename='image'">
+ <xsl:element name="v:imagedata">
+ <xsl:attribute name="src">
+ <xsl:value-of select="concat('wordml://', $draw-name)"/>
+ </xsl:attribute>
+ <xsl:attribute name="o:title">
+ <xsl:value-of select="$draw-name"/>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <!-- end image special element -->
+ <!-- start dash style , line style and arrow style-->
+ <xsl:if test="string-length($dashstyle) &gt; 0 or string-length($linestyle) &gt; 0 or string-length($start-arrow) &gt; 0 or string-length($end-arrow) &gt; 0 ">
+ <xsl:element name="v:stroke">
+ <xsl:if test="string-length($dashstyle) &gt; 0">
+ <xsl:attribute name="dashstyle">
+ <xsl:value-of select="$dashstyle"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="string-length($linestyle) &gt; 0">
+ <xsl:attribute name="linestyle">
+ <xsl:value-of select="$linestyle"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="string-length($start-arrow) &gt; 0 ">
+ <xsl:attribute name="startarrow">
+ <xsl:value-of select="$start-arrow"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="string-length($end-arrow) &gt; 0 ">
+ <xsl:attribute name="endarrow">
+ <xsl:value-of select="$end-arrow"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="string-length($start-arrow-length) &gt; 0 ">
+ <xsl:attribute name="startarrowlength">
+ <xsl:value-of select="$start-arrow-length"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="string-length($start-arrow-width) &gt; 0 ">
+ <xsl:attribute name="startarrowwidth">
+ <xsl:value-of select="$start-arrow-width"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="string-length($end-arrow-length) &gt; 0 ">
+ <xsl:attribute name="endarrowlength">
+ <xsl:value-of select="$end-arrow-length"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="string-length($end-arrow-width) &gt; 0 ">
+ <xsl:attribute name="endarrowwidth">
+ <xsl:value-of select="$end-arrow-width"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ <!-- end dash style , line style and arrow style -->
+ <!-- start wrap type -->
+ <xsl:if test="string-length($wrap) &gt; 0">
+ <xsl:element name="w10:wrap">
+ <xsl:attribute name="type">
+ <xsl:value-of select="$wrap"/>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <!-- end wrap type -->
+ <!-- start anchor to char specific element -->
+ <xsl:if test="string-length($anchorlock) &gt; 0">
+ <xsl:element name="w10:anchorlock"/>
+ </xsl:if>
+ <!-- end wrap type -->
+ <!-- start fill image -->
+ <xsl:if test="string-length($draw-fill-type ) &gt; 0">
+ <xsl:element name="v:fill">
+ <xsl:choose>
+ <xsl:when test="$draw-fill-type = 'bitmap'">
+ <xsl:attribute name="src">
+ <xsl:value-of select="concat( 'wordml://', $fill-image-name)"/>
+ </xsl:attribute>
+ <xsl:attribute name="o:titile">
+ <xsl:value-of select="$fill-image-name"/>
+ </xsl:attribute>
+ <xsl:attribute name="recolor">
+ <xsl:value-of select=" 'true' "/>
+ </xsl:attribute>
+ <xsl:attribute name="rotate">
+ <xsl:value-of select=" 'true' "/>
+ </xsl:attribute>
+ <xsl:attribute name="type">
+ <xsl:value-of select=" 'frame' "/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$draw-fill-type = 'gradient'">
+ <xsl:attribute name="type">
+ <xsl:value-of select=" 'gradient' "/>
+ </xsl:attribute>
+ <xsl:attribute name="color2">
+ <xsl:value-of select="key('draw-gradient',$draw-gradient-name)/@draw:start-color "/>
+ </xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:if>
+ <!-- end fill image -->
+ <xsl:if test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fontwork-style">
+ <xsl:call-template name="FontWork"/>
+ </xsl:if>
+ <xsl:if test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:shadow = 'visible'">
+ <xsl:call-template name="Shadow"/>
+ </xsl:if>
+ <!-- only draw:g can have child graphic -->
+ <xsl:choose>
+ <xsl:when test="name() = 'draw:g'">
+ <xsl:apply-templates select="draw:*">
+ <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/>
+ <xsl:with-param name="x-adjust" select="$x-adjust"/>
+ <xsl:with-param name="y-adjust" select="$y-adjust"/>
+ <xsl:with-param name="force-draw" select="$force-draw"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:when test="text:*/* | text:*/text()">
+ <xsl:element name="v:textbox">
+ <xsl:if test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:writing-mode = 'tb-rl'">
+ <xsl:attribute name="style">
+ <xsl:value-of select="'layout-flow:vertical'"/>
+ </xsl:attribute>
+ </xsl:if>
+ <w:txbxContent>
+ <xsl:apply-templates select="text() | text:*"/>
+ </w:txbxContent>
+ </xsl:element>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:apply-templates select="parent::draw:frame/draw:object-ole" mode="output">
+ <xsl:with-param name="ShapeID" select="$id"/>
+ </xsl:apply-templates>
+ </xsl:template>
+ <xsl:template name="Shadow">
+ <xsl:element name="v:shadow">
+ <xsl:variable name="key-node" select="key('graphics-style', @draw:style-name)/style:graphic-properties"/>
+ <xsl:attribute name="on">true</xsl:attribute>
+ <xsl:attribute name="offset">
+ <xsl:value-of select="concat($key-node/@draw:shadow-offset-x,',' , $key-node/@draw:shadow-offset-y)"/>
+ </xsl:attribute>
+ <xsl:attribute name="color">
+ <xsl:value-of select="$key-node/@draw:shadow-color"/>
+ </xsl:attribute>
+ <xsl:attribute name="opacity">
+ <xsl:value-of select="$key-node/@draw:shadow-opacity"/>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="FontWork">
+ <xsl:element name="v:path">
+ <xsl:attribute name="textpathok">true</xsl:attribute>
+ </xsl:element>
+ <xsl:if test="not(key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fontwork-shadow) or not(key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fontwork-shadow = 'normal')">
+ <xsl:element name="v:shadow">
+ <xsl:attribute name="on">true</xsl:attribute>
+ <xsl:attribute name="type">perspective</xsl:attribute>
+ <xsl:attribute name="color">
+ <xsl:value-of select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fontwork-shadow-color"/>
+ </xsl:attribute>
+ <xsl:variable name="offset-x">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="'twip'"/>
+ <xsl:with-param name="value" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fontwork-shadow-offset-x"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="offset-y" select="substring-before(key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fontwork-shadow-offset-y, 'in')"/>
+ <xsl:attribute name="matrix">
+ <xsl:value-of select="concat(',,,' , round($offset-y div 0.000693) div 100, ',,')"/>
+ </xsl:attribute>
+ <xsl:attribute name="origin">-30%, -30%</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="v:textpath">
+ <xsl:attribute name="on">true</xsl:attribute>
+ <xsl:attribute name="fitpath">true</xsl:attribute>
+ <xsl:attribute name="fitshape">true</xsl:attribute>
+ <xsl:attribute name="style">
+ <xsl:choose>
+ <xsl:when test="key('paragraph-style', text:p[1]/@text:style-name )/style:graphic-properties/@svg:font-family">
+ <xsl:value-of select="concat('font-family:&quot;' , key('paragraph-style', text:p[1]/@text:style-name )/style:graphic-properties/@svg:font-family , '&quot;') "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="default-graphics-properties" select="/office:document/office:styles/style:default-style[@style:family = 'graphics']/style:graphic-properties"/>
+ <xsl:value-of select="concat('font-family:&quot;' , $default-graphics-properties/@style:font-name , '&quot;') "/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:attribute name="string">
+ <xsl:value-of select="text:p"/>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="MapArrowStyle">
+ <xsl:param name="arrow-name"/>
+ <xsl:choose>
+ <xsl:when test="$arrow-name = 'Arrow' ">Block</xsl:when>
+ <xsl:when test="$arrow-name = 'Square' ">Diamond</xsl:when>
+ <xsl:when test="$arrow-name = 'Small arrow' ">Block</xsl:when>
+ <xsl:when test="$arrow-name = 'Dimension lines' ">Diamond</xsl:when>
+ <xsl:when test="$arrow-name = 'Double Arrow' ">Block</xsl:when>
+ <xsl:when test="$arrow-name = 'Rounded short arrow' ">Block</xsl:when>
+ <xsl:when test="$arrow-name = 'Symmetric arrow' ">Block</xsl:when>
+ <xsl:when test="$arrow-name = 'Line Arrow' ">Open</xsl:when>
+ <xsl:when test="$arrow-name = 'Rounded large arrow' ">Block</xsl:when>
+ <xsl:when test="$arrow-name = 'Circle' ">Oval</xsl:when>
+ <xsl:when test="$arrow-name = 'Square 45' ">Diamond</xsl:when>
+ <xsl:when test="$arrow-name = 'Arrow concave' ">Classic</xsl:when>
+ <xsl:otherwise>Block</xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="GetArrowLength">
+ <xsl:param name="arrow-name"/>
+ <xsl:param name="arrow-width"/>
+ <xsl:variable name="arrow-size">
+ <xsl:choose>
+ <xsl:when test="$arrow-width">
+ <xsl:value-of select="round(number(substring-before($arrow-width, 'in')) div 0.02) "/>
+ </xsl:when>
+ <xsl:otherwise>3</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$arrow-size &gt; 2">Long</xsl:when>
+ <xsl:when test="$arrow-size &gt; 1">Medium</xsl:when>
+ <xsl:when test="$arrow-size &gt; 0">Short</xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="GetArrowWidth">
+ <xsl:param name="arrow-name"/>
+ <xsl:param name="arrow-width"/>
+ <xsl:variable name="arrow-size">
+ <xsl:choose>
+ <xsl:when test="$arrow-width">
+ <xsl:value-of select="round(number(substring-before($arrow-width, 'in')) div 0.02) "/>
+ </xsl:when>
+ <xsl:otherwise>3</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$arrow-size &gt; 2">Wide</xsl:when>
+ <xsl:when test="$arrow-size &gt; 1">Medium</xsl:when>
+ <xsl:when test="$arrow-size &gt; 0">Narrow</xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="ConvertMeasure">
+ <xsl:param name="TargetMeasure" select="'cm'"/>
+ <xsl:param name="TargetTruncate" select=" 'all' "/>
+ <xsl:param name="value"/>
+ <!-- When TargetTruncate ='all' it returns the number whichsoever the return value is negative or positive
+ When TargetTruncate ='nonNegative' it only returns nonNegative number, all negative number to be returned as 0
+ When TargetTruncate ='positive" it only returns positive number, all nonPositive number to be returned as 1 -->
+ <xsl:variable name="return_value">
+ <xsl:choose>
+ <!-- remove the measure mark, if the value is null, the result should be 0. Must be the first case -->
+ <xsl:when test="string-length(translate(string($value),'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ','')) = 0">0</xsl:when>
+ <xsl:when test="string-length(translate(string($value),'- .0123456789','')) = 0">
+ <xsl:value-of select="$value"/>
+ </xsl:when>
+ <xsl:when test="$TargetMeasure = 'cm'">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="$value"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$TargetMeasure = 'pt'">
+ <xsl:call-template name="convert2pt">
+ <xsl:with-param name="value" select="$value"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$TargetMeasure = 'twip'">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="$value"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$TargetMeasure = 'in'">
+ <xsl:call-template name="convert2in">
+ <xsl:with-param name="value" select="$value"/>
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$TargetTruncate = 'all' ">
+ <xsl:choose>
+ <xsl:when test="string(number($TargetMeasure)) = 'NaN' ">
+ <xsl:value-of select=" '0' "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$return_value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$TargetTruncate = 'nonNegative' ">
+ <xsl:choose>
+ <xsl:when test="string(number($TargetMeasure)) = 'NaN' ">
+ <xsl:value-of select=" '0' "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test=" $return_value &lt; 0 ">
+ <xsl:value-of select=" '0' "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$return_value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$TargetTruncate = 'positive' ">
+ <xsl:choose>
+ <xsl:when test="string(number($TargetMeasure)) = 'NaN' ">
+ <xsl:value-of select=" '1' "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test=" $return_value &lt;= 0 ">
+ <xsl:value-of select=" '1' "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$return_value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="Add-With-Measure">
+ <xsl:param name="value1"/>
+ <xsl:param name="value2"/>
+ <xsl:param name="TargetMeasure" select="'in'"/>
+ <xsl:variable name="number-value1">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="$value1"/>
+ <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="number-value2">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="$value2"/>
+ <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="$number-value1 + $number-value2"/>
+ </xsl:template>
+ <xsl:template name="export-oledata">
+ <xsl:if test="//draw:object-ole[1]">
+ <xsl:choose>
+ <xsl:when test="element-available('oleextracter:init')">
+ <oleextracter:init UNOURL="uno:socket,host=localhost,port=8100;urp;StarOffice.ServiceManager"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="ole:init($XMultiServiceFactory, 'uno:socket,host=localhost,port=8100;urp;StarOffice.ServiceManager')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:apply-templates select="//draw:object-ole" mode="oledata.mso"/>
+ <w:docOleData>
+ <w:binData w:name="oledata.mso">
+ <xsl:if test="function-available('ole:getByName')">
+ <xsl:value-of select="translate(ole:getByName($oleExtractor, 'oledata.mso'),'&#10;&#13;&#32;','')"/>
+ </xsl:if>
+ </w:binData>
+ </w:docOleData>
+ <xsl:if test="function-available('ole:exit')">
+ <xsl:value-of select="ole:exit($oleExtractor)"/>
+ </xsl:if>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="draw:object-ole" mode="oledata.mso">
+ <xsl:variable name="stream-name">
+ <xsl:apply-templates select="." mode="get-number"/>
+ </xsl:variable>
+ <xsl:variable name="tmp" select="ole:insertByName($oleExtractor, $stream-name, translate(office:binary-data/text(),'&#10;&#13;&#32;','' ) )"/>
+ </xsl:template>
+ <xsl:template match="draw:object-ole" mode="output">
+ <xsl:param name="ShapeID"/>
+ <xsl:variable name="stream-name">
+ <xsl:apply-templates select="." mode="get-number"/>
+ </xsl:variable>
+ <o:OLEObject Type="Embed" DrawAspect="Content" ObjectID="{$stream-name}" ShapeID="{$ShapeID}" ProgID=""/>
+ </xsl:template>
+ <xsl:template match="draw:object-ole" mode="get-number">
+ <xsl:number from="/office:document" level="any" count="draw:object-ole" format="1"/>
+ </xsl:template>
+ <xsl:template match="draw:object-ole"/>
+ <xalan:component prefix="oleextracter" elements="init exit" functions="getByName insertByName">
+ <xalan:script lang="javaclass" src="xalan://XSLTFilterOLEExtracter"/>
+ </xalan:component>
+</xsl:stylesheet>
diff --git a/filter/source/xslt/export/wordml/ooo2wordml_field.xsl b/filter/source/xslt/export/wordml/ooo2wordml_field.xsl
new file mode 100644
index 000000000000..48a5e4e7342c
--- /dev/null
+++ b/filter/source/xslt/export/wordml/ooo2wordml_field.xsl
@@ -0,0 +1,733 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw">
+ <!-- the following are common used fields -->
+ <xsl:template match="text:page-number | text:page-count | text:subject | text:initial-creator | text:title | text:date
+ | text:time | text:page-variable-get | text:author-name | text:author-initials | text:file-name | text:sender-company
+ | text:sender-initials | text:sender-phone-work | text:word-count | text:paragraph-count | text:character-count
+ | text:description | text:creation-time | text:creation-date | text:editing-cycles | text:editing-duration
+ | text:keywords | text:print-time | text:print-date | text:creator | text:modification-time | text:modification-date
+ | text:user-defined | text:variable-get | text:user-field-get | text:sequence | text:database-name ">
+ <w:fldSimple>
+ <xsl:variable name="attribute_value1">
+ <xsl:choose>
+ <xsl:when test="name() = 'text:page-number' or name() = 'text:page-variable-get' ">
+ <xsl:text> PAGE </xsl:text>
+ </xsl:when>
+ <xsl:when test="name() = 'text:page-count' ">
+ <xsl:text> NUMPAGES </xsl:text>
+ </xsl:when>
+ <xsl:when test=" name() = 'text:subject' ">
+ <xsl:text> SUBJECT </xsl:text>
+ </xsl:when>
+ <xsl:when test="name() = 'text:initial-creator' ">
+ <xsl:text> AUTHOR </xsl:text>
+ </xsl:when>
+ <xsl:when test=" name() = 'text:title' ">
+ <xsl:text> TITLE </xsl:text>
+ </xsl:when>
+ <xsl:when test="name() = 'text:date' ">
+ <xsl:text> DATE </xsl:text>
+ <!-- ATM, this template just return null date format, it might be developed in the future -->
+ <xsl:call-template name="field_get_date_format">
+ <xsl:with-param name="field_date_stylename" select="@style:data-style-name"/>
+ <xsl:with-param name="field_date_value" select="@text:date-value"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test=" name() = 'text:time' ">
+ <xsl:text> TIME </xsl:text>
+ <!-- ATM, this template just return null time format, it might be developed in the future -->
+ <xsl:call-template name="field_get_time_format">
+ <xsl:with-param name="field_time_stylename" select="@style:data-style-name"/>
+ <xsl:with-param name="field_time_value" select="@text:time-value"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'text:author-name' ">
+ <xsl:text> AUTHOR </xsl:text>
+ </xsl:when>
+ <xsl:when test="name() = 'text:author-initials' ">
+ <xsl:text> USERINITIALS </xsl:text>
+ </xsl:when>
+ <xsl:when test="name() = 'text:file-name' ">
+ <xsl:choose>
+ <xsl:when test="@text:display='name-and-extension' or @text:display='name' ">
+ <xsl:text> FILENAME </xsl:text>
+ </xsl:when>
+ <xsl:when test=" @text:display='full' or @text:display='path' ">
+ <xsl:text>FILENAME \p </xsl:text>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test=" name() = 'text:sender-company' ">
+ <xsl:text> DOCPROPERTY Company </xsl:text>
+ </xsl:when>
+ <xsl:when test="name() = 'text:sender-initials' ">
+ <xsl:text> USERINITIALS </xsl:text>
+ </xsl:when>
+ <xsl:when test="name() = 'text:sender-phone-work' ">
+ <xsl:text> DOCPROPERTY &quot;Telephone number&quot; </xsl:text>
+ </xsl:when>
+ <xsl:when test="name() = 'text:word-count' ">
+ <xsl:text> DOCPROPERTY Words </xsl:text>
+ </xsl:when>
+ <xsl:when test="name() = 'text:paragraph-count' ">
+ <xsl:text> DOCPROPERTY Paragraphs </xsl:text>
+ </xsl:when>
+ <xsl:when test="name() = 'text:character-count' ">
+ <xsl:text> DOCPROPERTY CharactersWithSpaces </xsl:text>
+ </xsl:when>
+ <xsl:when test="name() = 'text:description' ">
+ <xsl:text> COMMENTS </xsl:text>
+ </xsl:when>
+ <xsl:when test="name() = 'text:creation-time' ">
+ <xsl:text> DOCPROPERTY CreateTime </xsl:text>
+ <!-- ATM, this template just return null time format, it might be developed in the future -->
+ <xsl:call-template name="field_get_time_format">
+ <xsl:with-param name="field_time_stylename" select="@style:data-style-name"/>
+ <xsl:with-param name="field_time_value" select="@text:time-value"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test=" name()= 'text:creation-date' ">
+ <xsl:text> CREATEDATE </xsl:text>
+ <!-- ATM, this template just return null date format, it might be developed in the future -->
+ <xsl:call-template name="field_get_date_format">
+ <xsl:with-param name="field_date_stylename" select="@style:data-style-name"/>
+ <xsl:with-param name="field_date_value" select="@text:date-value"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test=" name() = 'text:editing-cycles' ">
+ <xsl:text> REVNUM \* Arabic </xsl:text>
+ </xsl:when>
+ <xsl:when test=" name() = 'text:editing-duration' ">
+ <xsl:text> EDITTIME </xsl:text>
+ </xsl:when>
+ <xsl:when test=" name() = 'text:keywords' ">
+ <xsl:text> KEYWORDS </xsl:text>
+ </xsl:when>
+ <xsl:when test=" name() = 'text:print-time' ">
+ <xsl:text>DOCPROPERTY LastPrinted </xsl:text>
+ <!-- ATM, this template just return null time format, it might be developed in the future -->
+ <xsl:call-template name="field_get_time_format">
+ <xsl:with-param name="field_time_stylename" select="@style:data-style-name"/>
+ <xsl:with-param name="field_time_value" select="@text:time-value"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test=" name() = 'text:print-date' ">
+ <xsl:text>DOCPROPERTY LastPrinted </xsl:text>
+ <!-- ATM, this template just return null date format, it might be developed in the future -->
+ <xsl:call-template name="field_get_date_format">
+ <xsl:with-param name="field_date_stylename" select="@style:data-style-name"/>
+ <xsl:with-param name="field_date_value" select="@text:date-value"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test=" name() = 'text:creator' ">
+ <xsl:text> LASTSAVEDBY </xsl:text>
+ </xsl:when>
+ <xsl:when test=" name() = 'text:modification-time' ">
+ <xsl:text> DOCPROPERTY LastSavedTime </xsl:text>
+ <!-- ATM, this template just return null time format, it might be developed in the future -->
+ <xsl:call-template name="field_get_time_format">
+ <xsl:with-param name="field_time_stylename" select="@style:data-style-name"/>
+ <xsl:with-param name="field_time_value" select="@text:time-value"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test=" name() = 'text:modification-date' ">
+ <xsl:text> SAVEDATE </xsl:text>
+ <!-- ATM, this template just return null date format, it might be developed in the future -->
+ <xsl:call-template name="field_get_date_format">
+ <xsl:with-param name="field_date_stylename" select="@style:data-style-name"/>
+ <xsl:with-param name="field_date_value" select="@text:date-value"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test=" name() = 'text:user-defined' ">
+ <xsl:text> DOCPROPERTY </xsl:text>
+ <xsl:text>&quot;</xsl:text>
+ <xsl:value-of select="translate(string(@text:name), ' ', '')"/>
+ <xsl:text>&quot;</xsl:text>
+ </xsl:when>
+ <xsl:when test="name() = 'text:variable-get' or name() = 'text:user-field-get' ">
+ <xsl:value-of select="concat ('DOCVARIABLE ', @text:name)"/>
+ </xsl:when>
+ <xsl:when test=" name() = 'text:sequence' ">
+ <xsl:value-of select="concat(' SEQ &quot;',@text:name, '&quot;') "/>
+ </xsl:when>
+ <xsl:when test="name() = 'text:database-name' ">
+ <xsl:value-of select="concat (' DATABASE ', @text:database-name, '.' , @text:table-name)"/>
+ </xsl:when>
+ </xsl:choose>
+ <!-- Get number style format for number fields -->
+ <xsl:if test="@style:num-format">
+ <xsl:call-template name="field_get_number_format">
+ <xsl:with-param name="field_number_format_style" select="@style:num-format"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:text> \* MERGEFORMAT </xsl:text>
+ </xsl:variable>
+ <xsl:attribute name="w:instr">
+ <xsl:value-of select="$attribute_value1"/>
+ </xsl:attribute>
+ <w:r>
+ <w:rPr>
+ <xsl:choose>
+ <xsl:when test="@style:num-format = 'ê°€, 나, 다, ...' or @style:num-format ='ì¼, ì´, 삼, ...' or @style:num-format ='ㄱ, ã„´, ã„·, ...' ">
+ <w:rFonts w:fareast="Batang" w:hint="fareast"/>
+ <!--wx:font wx:val="Batang"/ -->
+ <w:lang w:fareast="KO"/>
+ </xsl:when>
+ <xsl:when test="@style:num-format = 'ã‚¢, イ, ウ, ...' or @style:num-format = 'ï½±, ï½², ï½³, ...' or @style:num-format = 'イ, ロ, ãƒ, ...' or @style:num-format = 'ï½², ï¾›, ハ, ...' or @style:num-format ='壱, å¼, å‚, ...' ">
+ <w:rFonts w:fareast="MS Mincho" w:hint="fareast"/>
+ <!--wx:font wx:val="MS Mincho"/ -->
+ <w:lang w:fareast="JA"/>
+ </xsl:when>
+ <xsl:when test=" @style:num-format ='壹, è²³, åƒ, ...' or @style:num-format ='壹, è²³, åƒ, ...' or @style:num-format ='壹, è´°, å, ...'or @style:num-format = '一, 二, 三, ...' ">
+ <w:rFonts w:hint="fareast"/>
+ <!--wx:font wx:val="宋体"/ -->
+ </xsl:when>
+ </xsl:choose>
+ <w:noProof/>
+ </w:rPr>
+ <w:t>
+ <xsl:value-of select="."/>
+ </w:t>
+ </w:r>
+ </w:fldSimple>
+ </xsl:template>
+ <xsl:template name="field_get_number_format">
+ <!-- this template get the various of number formats for number type field-->
+ <xsl:param name="field_number_format_style"/>
+ <xsl:choose>
+ <xsl:when test=" $field_number_format_style = '1, 2, 3, ...' or $field_number_format_style = '1' ">
+ <xsl:text> \* Arabic </xsl:text>
+ </xsl:when>
+ <xsl:when test="$field_number_format_style = 'â‘ , â‘¡, â‘¢, ...' ">
+ <xsl:text> \* CircleNum </xsl:text>
+ </xsl:when>
+ <xsl:when test="$field_number_format_style = 'i' ">
+ <xsl:text> \* roman </xsl:text>
+ </xsl:when>
+ <xsl:when test="$field_number_format_style = 'I' ">
+ <xsl:text> \* ROMAN </xsl:text>
+ </xsl:when>
+ <xsl:when test="$field_number_format_style = '一, 二, 三, ...'">
+ <xsl:text> \* CHINESENUM3 </xsl:text>
+ </xsl:when>
+ <xsl:when test=" $field_number_format_style ='壹, è²³, åƒ, ...' or $field_number_format_style ='壹, è²³, åƒ, ...' or
+$field_number_format_style ='壹, è´°, å, ...' ">
+ <xsl:text> \* CHINESENUM2 </xsl:text>
+ </xsl:when>
+ <xsl:when test="$field_number_format_style = '壱, å¼, å‚, ...' ">
+ <xsl:text> \* DBNUM3 </xsl:text>
+ </xsl:when>
+ <xsl:when test="$field_number_format_style = 'å­, 丑, 寅, ...' ">
+ <xsl:text> \* ZODIAC2 </xsl:text>
+ </xsl:when>
+ <xsl:when test=" $field_number_format_style ='甲, 乙, 丙, ...' ">
+ <xsl:text> \* ZODIAC1 </xsl:text>
+ </xsl:when>
+ <xsl:when test="$field_number_format_style = 'イ, ロ, ãƒ, ...' or $field_number_format_style = 'ï½², ï¾›, ハ, ...' ">
+ <xsl:text> \* Iroha </xsl:text>
+ </xsl:when>
+ <xsl:when test="$field_number_format_style ='ア, イ, ウ, ...' or $field_number_format_style ='ア, イ, ウ, ...' ">
+ <xsl:text> \* Aiueo </xsl:text>
+ </xsl:when>
+ <xsl:when test="$field_number_format_style = 'ì¼, ì´, 삼, ...' ">
+ <xsl:text> \* DBNUM1 </xsl:text>
+ </xsl:when>
+ <xsl:when test="$field_number_format_style ='ㄱ, ㄴ, ㄷ, ...' or $field_number_format_style = '㉠, ㉡, ㉢, ...' ">
+ <xsl:text> \* Chosung </xsl:text>
+ </xsl:when>
+ <xsl:when test="$field_number_format_style = '가, 나, 다, ...' or $field_number_format_style = '㉮, ㉯, ㉰, ...' ">
+ <xsl:text> \* Ganada </xsl:text>
+ </xsl:when>
+ <xsl:when test="$field_number_format_style = 'ア, イ, ウ, ...' or $field_number_format_style = 'ア, イ, ウ, ...' ">
+ <xsl:text> \* Aiueo </xsl:text>
+ </xsl:when>
+ <xsl:when test="$field_number_format_style ='a' ">
+ <xsl:text> \* alphabetic </xsl:text>
+ </xsl:when>
+ <xsl:when test="$field_number_format_style ='A' ">
+ <xsl:text> \* ALPHABETIC </xsl:text>
+ </xsl:when>
+ <xsl:when test="$field_number_format_style = '×, ב, ×’, ...' ">
+ <xsl:text> \* hebrew2 </xsl:text>
+ </xsl:when>
+ <xsl:when test="$field_number_format_style = 'أ, ب, ت, ...' ">
+ <xsl:text> \* ArabicAlpha </xsl:text>
+ </xsl:when>
+ <xsl:when test="$field_number_format_style = 'à¸, ข, ฃ, ...' ">
+ <xsl:text> \* ThaiLetter </xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text> </xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="field_get_date_format">
+ <xsl:param name="field_date_stylename"/>
+ <xsl:param name="field_date_value"/>
+ <!-- this template retun null date format ATM-->
+ <xsl:text/>
+ </xsl:template>
+ <xsl:template name="field_get_time_format">
+ <xsl:param name="field_time_stylename"/>
+ <xsl:param name="field_time_value"/>
+ <!-- this template retun null date format ATM-->
+ <xsl:text/>
+ </xsl:template>
+ <xsl:template match="text:template-name">
+ <xsl:choose>
+ <xsl:when test="@text:display='title' or @text:display= 'area' ">
+ <!-- directly export the content -->
+ <w:r>
+ <w:rPr>
+ <w:noProof/>
+ </w:rPr>
+ <w:t>
+ <xsl:value-of select="."/>
+ </w:t>
+ </w:r>
+ </xsl:when>
+ <xsl:otherwise>
+ <w:fldSimple>
+ <xsl:variable name="template_attribute_value">
+ <xsl:choose>
+ <xsl:when test="@text:display='name-and-extension' or @text:display= 'name' ">
+ <xsl:text> TEMPLATE </xsl:text>
+ </xsl:when>
+ <xsl:when test=" @text:display='full' or @text:display='path' ">
+ <xsl:text>TEMPLATE \p </xsl:text>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:text>\* MERGEFORMAT </xsl:text>
+ </xsl:variable>
+ <xsl:attribute name="w:instr">
+ <xsl:value-of select="$template_attribute_value"/>
+ </xsl:attribute>
+ <w:r>
+ <w:rPr>
+ <w:noProof/>
+ </w:rPr>
+ <w:t>
+ <xsl:value-of select="."/>
+ </w:t>
+ </w:r>
+ </w:fldSimple>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="text:text-input | text:variable-input | text:user-field-input">
+ <w:fldSimple>
+ <xsl:variable name="text-input-attribute">
+ <xsl:text>FILLIN </xsl:text>
+ <xsl:if test="@text:description">
+ <xsl:value-of select="@text:description"/>
+ </xsl:if>
+ <xsl:text> \* MERGEFORMAT</xsl:text>
+ </xsl:variable>
+ <xsl:attribute name="w:instr">
+ <xsl:value-of select="$text-input-attribute"/>
+ </xsl:attribute>
+ <w:r>
+ <w:rPr>
+ <w:noProof/>
+ </w:rPr>
+ <xsl:call-template name="field_convert_linebreak">
+ <xsl:with-param name="field_input_text" select="text()"/>
+ </xsl:call-template>
+ </w:r>
+ </w:fldSimple>
+ </xsl:template>
+ <xsl:template name="field_convert_linebreak">
+ <!-- this template convert the linebreak (&#x0A; and &#x0D;) in continous text to Ms word element<w:br/> -->
+ <xsl:param name="field_input_text"/>
+ <xsl:if test="not (contains($field_input_text,'&#x0A;'))">
+ <w:t>
+ <xsl:value-of select="$field_input_text"/>
+ </w:t>
+ </xsl:if>
+ <xsl:if test="contains($field_input_text,'&#x0A;')">
+ <w:t>
+ <xsl:value-of select="translate(substring-before($field_input_text,'&#x0A;'),'&#x0D;','')"/>
+ </w:t>
+ <w:br/>
+ <xsl:call-template name="field_convert_linebreak">
+ <xsl:with-param name="field_input_text" select="substring-after($field_input_text,'&#x0A;')"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="field_declare">
+ <!-- this template export the field declaration to w:docpr -->
+ <xsl:param name="simple_field_variable_declares"/>
+ <xsl:param name="user_field_variable_declares"/>
+ <xsl:param name="field_sequence_declares"/>
+ <w:docVars>
+ <xsl:if test="$simple_field_variable_declares/text:variable-decl">
+ <xsl:for-each select="$simple_field_variable_declares/text:variable-decl">
+ <w:docVar w:name="{@text:name}" w:val="default value"/>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:if test="$user_field_variable_declares/text:user-field-decl">
+ <xsl:for-each select="$user_field_variable_declares/text:user-field-decl">
+ <w:docVar w:name="{@text:name}" w:val="{@text:string-value}"/>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:if test="$field_sequence_declares/text:sequence-decl">
+ <!-- do nothing for sequence declares when exporting to MS word-->
+ </xsl:if>
+ </w:docVars>
+ </xsl:template>
+ <xsl:template match="text:reference-ref | text:bookmark-ref | text:footnote-ref
+ | text:endnote-ref ">
+ <!-- this template is for reference fields -->
+ <w:r>
+ <w:fldChar w:fldCharType="begin"/>
+ </w:r>
+ <xsl:variable name="complicate_field_instruction">
+ <xsl:choose>
+ <xsl:when test=" name() = 'text:reference-ref' ">
+ <xsl:choose>
+ <xsl:when test=" string(@text:reference-format) = 'page' ">
+ <xsl:value-of select="concat(' PAGEREF ', @text:ref-name, '\h') "/>
+ </xsl:when>
+ <xsl:when test="string(@text:reference-format) = 'chapter' ">
+ <xsl:value-of select="concat(' REF ', @text:ref-name, '\n \h') "/>
+ </xsl:when>
+ <xsl:when test="string(@text:reference-format) = 'text' ">
+ <xsl:value-of select="concat ( ' REF ' , @text:ref-name, ' \h') "/>
+ </xsl:when>
+ <xsl:when test="string(@text:reference-format) = 'direction' ">
+ <xsl:value-of select="concat(' REF ', @text:ref-name, ' \p \h' ) "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat ( ' PAGEREF ', @text:ref-name, '\h')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="name() = 'text:footnote-ref' or name() = 'text:endnote-ref' ">
+ <xsl:choose>
+ <xsl:when test=" string(@text:reference-format) = 'page' ">
+ <xsl:value-of select="concat(' PAGEREF ', @text:ref-name, '\h') "/>
+ </xsl:when>
+ <xsl:when test="string(@text:reference-format) = 'chapter' ">
+ <xsl:value-of select="concat(' REF ', @text:ref-name, '\n \h') "/>
+ </xsl:when>
+ <xsl:when test="string(@text:reference-format) = 'text' ">
+ <xsl:value-of select="concat ( ' NOTEREF ' , @text:ref-name, ' \h') "/>
+ </xsl:when>
+ <xsl:when test="string(@text:reference-format) = 'direction' ">
+ <xsl:value-of select="concat(' PAGEREF ', @text:ref-name, ' \p \h' ) "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat ( ' PAGEREF ', @text:ref-name, '\h')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="name() = 'text:bookmark-ref' ">
+ <xsl:choose>
+ <xsl:when test=" string(@text:reference-format) = 'page' ">
+ <xsl:value-of select="concat(' PAGEREF ', @text:ref-name, '\h') "/>
+ </xsl:when>
+ <xsl:when test="string(@text:reference-format) = 'chapter' ">
+ <xsl:value-of select="concat(' PAGEREF ', @text:ref-name, ' \h') "/>
+ </xsl:when>
+ <xsl:when test="string(@text:reference-format) = 'text' ">
+ <xsl:value-of select="concat ( ' REF ' , @text:ref-name, ' \h') "/>
+ </xsl:when>
+ <xsl:when test="string(@text:reference-format) = 'direction' ">
+ <xsl:value-of select="concat(' REF ', @text:ref-name, ' \p \h' ) "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat ( ' PAGEREF ', @text:ref-name, '\h')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <!--start to combine the complicate field instruction -->
+ <w:r>
+ <w:instrText>
+ <xsl:value-of select="$complicate_field_instruction"/>
+ </w:instrText>
+ </w:r>
+ <w:r>
+ <w:fldChar w:fldCharType="separate"/>
+ </w:r>
+ <w:r>
+ <w:rPr>
+ <w:noProof/>
+ </w:rPr>
+ <w:t>
+ <xsl:value-of select="."/>
+ </w:t>
+ </w:r>
+ <w:r>
+ <w:fldChar w:fldCharType="end"/>
+ </w:r>
+ </xsl:template>
+ <xsl:template match="text:chapter | text:sender-firstname | text:sender-lastname
+ | text:sender-street | text:sender-country | text:sender-postal-code
+ | text:sender-city | text:sender-title | text:sender-position
+ | text:sender-phone-private | text:sender-email | text:sender-fax
+ | text:sender-state-or-province | text:table-count | text:image-count
+ | text:object-count | text:printed-by | text:hidden-paragraph
+ | text:placeholder | text:drop-down | text:conditional-text
+ | text:variable-set | text:table-formula | text:database-display
+ | text:database-next | text:database-select | text:database-row-number
+ | text:sequence-ref | text:expression | text:sheet-name | text:dde-connection">
+ <!-- this template just export content of staroffice fields that do not have the corresponding fields in MS word ATM -->
+ <w:r>
+ <w:rPr>
+ <w:noProof/>
+ </w:rPr>
+ <w:t>
+ <xsl:value-of select="."/>
+ </w:t>
+ </w:r>
+ </xsl:template>
+ <xsl:template match="text:execute-macro | text:variable-decls | text:variable-decl | text:user-field-decls | text:variable-decl | text:sequence-decls | text:sequence-decl | text:page-variable-set | text:bibliography-mark | text:script | text:page-continuation ">
+ <!-- this template is to ignore matched elements when exporting writer to word -->
+ </xsl:template>
+ <xsl:template match="text:a ">
+ <xsl:call-template name="export_hyoerlink"/>
+ </xsl:template>
+ <xsl:template name="export_hyoerlink">
+ <!-- all params are useed by draw -->
+ <xsl:param name="TargetMeasure"/>
+ <xsl:param name="x-adjust"/>
+ <xsl:param name="y-adjust"/>
+ <xsl:param name="force-draw"/>
+ <!-- this template processes the hyperlink in writer -->
+ <xsl:variable name="hyperlink_filename">
+ <xsl:choose>
+ <xsl:when test="contains(@xlink:href, '#')">
+ <xsl:value-of select="substring-before(@xlink:href, '#')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="@xlink:href"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="hyperlink_bookmark">
+ <xsl:if test="contains(@xlink:href, '#')">
+ <xsl:choose>
+ <xsl:when test="contains(@xlink:href, '%7C')">
+ <xsl:call-template name="translate_string">
+ <xsl:with-param name="t_input_string" select="substring-before( substring-after(@xlink:href, '#'), '%7C')"/>
+ <xsl:with-param name="t_pattern_string" select=" '%20' "/>
+ <xsl:with-param name="t_substitute_string" select=" ' ' "/>
+ <xsl:with-param name="t_output_string" select=" '' "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="translate_string">
+ <xsl:with-param name="t_input_string" select="substring-after(@xlink:href, '#')"/>
+ <xsl:with-param name="t_pattern_string" select=" '%20' "/>
+ <xsl:with-param name="t_substitute_string" select=" ' ' "/>
+ <xsl:with-param name="t_output_string" select=" '' "/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:variable>
+ <w:hlink>
+ <xsl:if test="@xlink:href">
+ <xsl:attribute name="w:dest">
+ <xsl:value-of select="$hyperlink_filename"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="contains(@xlink:href, '#')">
+ <xsl:attribute name="w:bookmark">
+ <xsl:value-of select="$hyperlink_bookmark"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@office:target-frame-name">
+ <xsl:attribute name="w:target">
+ <xsl:value-of select="@office:target-frame-name"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@office:name">
+ <xsl:attribute name="w:screenTip">
+ <xsl:value-of select="@office:name"/>
+ </xsl:attribute>
+ </xsl:if>
+ <w:r>
+ <w:rPr>
+ <w:rStyle w:val="Hyperlink"/>
+ </w:rPr>
+ <!--apply inline-text-elements, many many many ... -->
+ <xsl:apply-templates select="text:a | text:span | text() | text:hidden-text
+ | text:line-break | text:tab-stop | text:s | text:page-number | text:page-count | text:subject
+ | text:initial-creator | text:title | text:date | text:time | text:author-name
+ | text:author-initials | text:chapter | text:file-name | text:sender-company
+ | text:sender-firstname | text:sender-lastname | text:sender-initials | text:sender-street
+ | text:sender-country | text:sender-postal-code | text:sender-city | text:sender-title
+ | text:sender-position | text:sender-phone-private | text:sender-phone-work
+ | text:sender-email | text:sender-fax | text:sender-state-or-province | text:word-count
+ | text:paragraph-count | text:character-count | text:table-count | text:image-count
+ | text:object-count | text:template-name | text:description | text:creation-time
+ | text:creation-date | text:editing-cycles | text:editing-duration | text:keywords
+ | text:print-time | text:print-date | text:creator | text:modification-time
+ | text:modification-date | text:user-defined | text:printed-by | text:hidden-paragraph
+ | text:placeholder | text:drop-down | text:conditional-text | text:text-input
+ | text:execute-macro | text:variable-set | text:variable-input
+ | text:user-field-input | text:variable-get | text:user-field-get | text:sequence
+ | text:page-variable-set | text:page-variable-get | text:table-formula
+ | text:database-display | text:database-next| text:database-select
+ | text:database-row-number | text:database-name | text:reference-ref
+ | text:bookmark-ref | text:footnote-ref | text:endnote-ref | text:sequence-ref
+ | text:expression | text:measure | text:dde-connection | text:sheet-name
+ | text:bibliography-mark | text:script | text:page-continuation | office:annotation
+ | draw:*">
+ <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/>
+ <xsl:with-param name="x-adjust" select="$x-adjust"/>
+ <xsl:with-param name="y-adjust" select="$y-adjust"/>
+ <xsl:with-param name="force-draw" select="$force-draw"/>
+ </xsl:apply-templates>
+ </w:r>
+ </w:hlink>
+ </xsl:template>
+ <xsl:template name="translate_string">
+ <!-- this template is to replace the substring matched t_pattern_string in t_t_input_string with t_substitute_string G.Y.-->
+ <xsl:param name="t_input_string"/>
+ <xsl:param name="t_pattern_string"/>
+ <xsl:param name="t_substitute_string"/>
+ <xsl:param name="t_output_string"/>
+ <xsl:variable name="t_temp_output_string">
+ <xsl:if test="contains($t_input_string, $t_pattern_string) ">
+ <xsl:value-of select="concat($t_output_string, substring-before($t_input_string,$t_pattern_string), $t_substitute_string) "/>
+ </xsl:if>
+ <xsl:if test="not (contains($t_input_string, $t_pattern_string)) ">
+ <xsl:value-of select="$t_output_string"/>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:if test="contains($t_input_string, $t_pattern_string) ">
+ <xsl:call-template name="translate_string">
+ <xsl:with-param name="t_input_string" select="substring-after($t_input_string,$t_pattern_string)"/>
+ <xsl:with-param name="t_pattern_string" select="$t_pattern_string"/>
+ <xsl:with-param name="t_substitute_string" select="$t_substitute_string"/>
+ <xsl:with-param name="t_output_string" select="$t_temp_output_string"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="not (contains($t_input_string, $t_pattern_string))">
+ <xsl:value-of select="concat($t_temp_output_string, $t_input_string)"/>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="add_hyperlink_style">
+ <!--this template is to add the hyperlink related style -->
+ <w:style w:type="character" w:styleId="Hyperlink">
+ <w:name w:val="Hyperlink"/>
+ <w:rsid w:val="006A55B0"/>
+ <w:rPr>
+ <w:color w:val="000080"/>
+ <w:u w:val="single"/>
+ </w:rPr>
+ </w:style>
+ <w:style w:type="character" w:styleId="FollowedHyperlink">
+ <w:name w:val="FollowedHyperlink"/>
+ <w:rsid w:val="006A55B0"/>
+ <w:rPr>
+ <w:color w:val="800000"/>
+ <w:u w:val="single"/>
+ </w:rPr>
+ </w:style>
+ </xsl:template>
+ <xsl:template match="office:annotation">
+ <!-- this template export writer note to word comments -->
+ <xsl:variable name="comments_aml_id">
+ <xsl:call-template name="unique_amlid_generator"/>
+ </xsl:variable>
+ <aml:annotation w:type="Word.Comment.Start">
+ <xsl:attribute name="aml:id">
+ <xsl:value-of select="$comments_aml_id"/>
+ </xsl:attribute>
+ </aml:annotation>
+ <aml:annotation w:type="Word.Comment.End">
+ <xsl:attribute name="aml:id">
+ <xsl:value-of select="$comments_aml_id"/>
+ </xsl:attribute>
+ </aml:annotation>
+ <!-- export aml:annotation content-->
+ <w:r>
+ <w:rPr>
+ <w:rStyle w:val="CommentReference"/>
+ </w:rPr>
+ <aml:annotation aml:author="{@office:author}" aml:createdate="{@office:create-date}" w:type="Word.Comment" w:initials="{@office:author}">
+ <xsl:attribute name="aml:id">
+ <xsl:value-of select="$comments_aml_id"/>
+ </xsl:attribute>
+ <aml:content>
+ <xsl:apply-templates select="text:p"/>
+ </aml:content>
+ </aml:annotation>
+ </w:r>
+ <!-- end of export aml:annotation content-->
+ </xsl:template>
+ <xsl:template name="unique_amlid_generator">
+ <!-- this template generate unique id for aml:id, ATM it only counts the office:annotation, some other elements might be added later -->
+ <xsl:number count="office:annotation" from="/office:document/office:body" level="any" format="1"/>
+ </xsl:template>
+ <xsl:template name="add_comments_style">
+ <w:style w:type="character" w:styleId="CommentReference">
+ <w:name w:val="annotation reference"/>
+ <w:basedOn w:val="DefaultParagraphFont"/>
+ <w:semiHidden/>
+ <w:rsid w:val="007770B7"/>
+ <w:rPr>
+ <w:sz w:val="16"/>
+ <w:sz-cs w:val="16"/>
+ </w:rPr>
+ </w:style>
+ <w:style w:type="paragraph" w:styleId="CommentText">
+ <w:name w:val="annotation text"/>
+ <w:basedOn w:val="Normal"/>
+ <w:semiHidden/>
+ <w:rsid w:val="007770B7"/>
+ <w:pPr>
+ <w:pStyle w:val="CommentText"/>
+ </w:pPr>
+ <w:rPr>
+ <w:sz w:val="20"/>
+ <w:sz-cs w:val="20"/>
+ </w:rPr>
+ </w:style>
+ <w:style w:type="paragraph" w:styleId="CommentSubject">
+ <w:name w:val="annotation subject"/>
+ <w:basedOn w:val="CommentText"/>
+ <w:next w:val="CommentText"/>
+ <w:semiHidden/>
+ <w:rsid w:val="007770B7"/>
+ <w:pPr>
+ <w:pStyle w:val="CommentSubject"/>
+ </w:pPr>
+ <w:rPr>
+ <w:b/>
+ <w:b-cs/>
+ </w:rPr>
+ </w:style>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/filter/source/xslt/export/wordml/ooo2wordml_list.xsl b/filter/source/xslt/export/wordml/ooo2wordml_list.xsl
new file mode 100644
index 000000000000..2762e1cd159f
--- /dev/null
+++ b/filter/source/xslt/export/wordml/ooo2wordml_list.xsl
@@ -0,0 +1,340 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw">
+ <xsl:template name="ListStyles">
+ <w:lists>
+ <xsl:if test="descendant::text:list-level-style-image">
+ <xsl:call-template name="PicLists"/>
+ </xsl:if>
+ <xsl:apply-templates select="office:styles/text:outline-style | office:styles/text:list-style | office:automatic-styles/text:list-style" mode="style"/>
+ <xsl:for-each select="office:styles/text:outline-style | office:styles/text:list-style | office:automatic-styles/text:list-style">
+ <w:list w:ilfo="{position()}">
+ <w:ilst w:val="{position()-1}"/>
+ </w:list>
+ </xsl:for-each>
+ </w:lists>
+ </xsl:template>
+ <xsl:template match="text:list-style | text:outline-style" mode="style">
+ <w:listDef w:listDefId="{position()-1}">
+ <xsl:if test="name(..)='office:styles' and name()!='text:outline-style'">
+ <w:styleLink w:val="{@style:name}"/>
+ </xsl:if>
+ <xsl:for-each select="text:list-level-style-number | text:list-level-style-bullet | text:list-level-style-image | text:outline-level-style">
+ <xsl:if test="@text:level &lt; 10">
+ <w:lvl w:ilvl="{ @text:level - 1 }">
+ <xsl:if test="name()='text:outline-level-style'">
+ <xsl:variable name="headinglevel">
+ <xsl:value-of select="@text:level"/>
+ </xsl:variable>
+ <xsl:if test="/office:document/office:body//text:h[@text:level=$headinglevel and @text:style-name]">
+ <xsl:element name="w:pStyle">
+ <xsl:attribute name="w:val"><xsl:value-of select="/office:document/office:body//text:h[@text:level=$headinglevel]/@text:style-name"/></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="@text:start-value">
+ <w:start w:val="{@text:start-value}"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <w:start w:val="1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="@text:bullet-char">
+ <w:nfc w:val="23"/>
+ </xsl:when>
+ <xsl:when test="@style:num-format">
+ <xsl:call-template name="convert_list_number">
+ <xsl:with-param name="number-format" select="@style:num-format"/>
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="name()='text:list-level-style-image'">
+ <w:lvlText w:val="."/>
+ <w:lvlPicBulletId>
+ <xsl:attribute name="w:val"><xsl:value-of select="count(preceding::text:list-level-style-image)"/></xsl:attribute>
+ </w:lvlPicBulletId>
+ </xsl:when>
+ <xsl:when test="@text:bullet-char">
+ <w:lvlText w:val="{@text:bullet-char}"/>
+ </xsl:when>
+ <xsl:when test="@text:display-levels and not(../@text:consecutive-numbering='true')">
+ <xsl:variable name="levelText">
+ <xsl:call-template name="displaylevel">
+ <xsl:with-param name="number" select="@text:display-levels"/>
+ <xsl:with-param name="textlevel" select="@text:level"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <w:lvlText w:val="{concat(@style:num-prefix, substring-after($levelText, '.'), @style:num-suffix)}"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <w:lvlText w:val="{concat(@style:num-prefix, '%', @text:level, @style:num-suffix)}"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="style:list-level-properties/@fo:text-align = 'end'">
+ <w:lvlJc w:val="right"/>
+ </xsl:when>
+ <xsl:when test="style:list-level-properties/@fo:text-align = 'center'">
+ <w:lvlJc w:val="center"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <w:lvlJc w:val="left"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="style:list-level-properties/@text:space-before | style:list-level-properties/@text:min-label-width | style:list-level-properties/@text:min-label-distance">
+ <xsl:call-template name="list_position"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <w:suff w:val="Nothing"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:apply-templates select="key('text-style',@text:style-name)/style:text-properties" mode="character"/>
+ <xsl:apply-templates select="style:text-properties" mode="character"/>
+ </w:lvl>
+ </xsl:if>
+ </xsl:for-each>
+ </w:listDef>
+ </xsl:template>
+ <xsl:template match="text:list-style" mode="count">
+ <xsl:value-of select="count(preceding::text:list-style | preceding::text:outline-style)+1"/>
+ </xsl:template>
+ <xsl:template match="text:unordered-list | text:ordered-list | text:list">
+ <xsl:apply-templates select="text:unordered-list | text:ordered-list | text:list-item | text:list-header | text:list"/>
+ </xsl:template>
+ <xsl:template match="text:list-item | text:list-header">
+ <xsl:apply-templates select="text:unordered-list | text:ordered-list | text:list | text:p | text:h"/>
+ </xsl:template>
+ <xsl:template name="displaylevel">
+ <xsl:param name="number"/>
+ <xsl:param name="textlevel"/>
+ <xsl:if test="$number &gt; 1">
+ <xsl:call-template name="displaylevel">
+ <xsl:with-param name="number" select="$number -1"/>
+ <xsl:with-param name="textlevel" select="number($textlevel)-1"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:value-of select="concat('.','%',$textlevel)"/>
+ </xsl:template>
+ <xsl:template name="list_position">
+ <xsl:variable name="spacebefore">
+ <xsl:choose>
+ <xsl:when test="style:list-level-properties/@text:space-before">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="style:list-level-properties/@text:space-before"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="space2text">
+ <xsl:choose>
+ <xsl:when test="style:list-level-properties/@text:min-label-width">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="style:list-level-properties/@text:min-label-width"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="spacedistance">
+ <xsl:choose>
+ <xsl:when test="style:list-level-properties/@text:min-label-distance">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="style:list-level-properties/@text:min-label-distance"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="$spacedistance='0' and $space2text='0'">
+ <w:suff w:val="Nothing"/>
+ </xsl:if>
+ <w:pPr>
+ <xsl:if test="$spacedistance!='0' or $space2text!='0'">
+ <w:tabs>
+ <w:tab>
+ <xsl:attribute name="w:val">list</xsl:attribute>
+ <xsl:attribute name="w:pos"><xsl:choose><xsl:when test="number($spacedistance) &gt; number($space2text)"><xsl:value-of select="number($spacebefore)+number($spacedistance)+150"/></xsl:when><xsl:otherwise><xsl:value-of select="number($spacebefore)+number($space2text)+150"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <!-- Since SO MinSpaceDistance is width after number or bullet, MS TabSpaceAfter include the number or bullet width. So +150 -->
+ </w:tab>
+ </w:tabs>
+ </xsl:if>
+ <w:ind w:left="{number($space2text)+number($spacebefore)}" w:hanging="{$space2text}"/>
+ <!-- w:pos(MS TabSpaceAfter) = text:space-before + MAX(text:min-label-distance,text:min-label-width) + ( Symbol width ); w:left(MS IndentAt)= text:space-before + text:min-label-width; w:hanging(MS IndentAt - MS AlignedAt)=text:min-label-width -->
+ </w:pPr>
+ </xsl:template>
+ <xsl:template name="PicLists">
+ <xsl:for-each select="descendant::text:list-level-style-image">
+ <w:listPicBullet w:listPicBulletId="{position()-1}">
+ <w:pict>
+ <v:shape>
+ <xsl:variable name="Picwidth">
+ <xsl:call-template name="convert2pt">
+ <xsl:with-param name="value" select="style:list-level-properties/@fo:width"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="Picheight">
+ <xsl:call-template name="convert2pt">
+ <xsl:with-param name="value" select="style:list-level-properties/@fo:height"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="style"><xsl:value-of select="concat('width:', number($Picwidth*1), 'pt;height:', number($Picheight*1), 'pt')"/></xsl:attribute>
+ <xsl:attribute name="o:bullet">t</xsl:attribute>
+ <v:stroke joinstyle="miter"/>
+ <w:binData w:name="{concat('wordml://SOpicbullet', position(), '.gif')}">
+ <xsl:value-of select="office:binary-data"/>
+ </w:binData>
+ <v:imagedata src="{concat('wordml://SOpicbullet', position(), '.gif')}" o:title="{concat('SOpicbullet', position())}"/>
+ </v:shape>
+ </w:pict>
+ </w:listPicBullet>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="convert_list_number">
+ <xsl:param name="number-format"/>
+ <xsl:choose>
+ <xsl:when test="$number-format = 'a'">
+ <!-- nfcLCLetter: Lowercase alpah -->
+ <w:nfc w:val="4"/>
+ </xsl:when>
+ <xsl:when test="$number-format = 'A'">
+ <!-- nfcUCLetter: Uppercase alpha -->
+ <w:nfc w:val="3"/>
+ </xsl:when>
+ <xsl:when test="$number-format = 'i'">
+ <!-- nfcLCRoman: Lowercase roman -->
+ <w:nfc w:val="2"/>
+ </xsl:when>
+ <xsl:when test="$number-format = 'I'">
+ <!-- nfcUCRoman: Uppercase roman -->
+ <w:nfc w:val="1"/>
+ </xsl:when>
+ <xsl:when test="$number-format = '1, 2, 3, ...'">
+ <!-- '1, 2, 3, ...' also seems: decimal-full-width2 -->
+ <w:nfc w:val="14"/>
+ </xsl:when>
+ <xsl:when test="$number-format = 'â‘ , â‘¡, â‘¢, ...'">
+ <w:nfc w:val="18"/>
+ </xsl:when>
+ <xsl:when test="$number-format = '一, 二, 三, ...'">
+ <!-- '一, 二, 三, ...' also seems: ideograph-digital, japanese-counting, japanese-digital-ten-thousand,
+ taiwanese-counting, taiwanese-counting-thousand, taiwanese-digital, chinese-counting, korean-digital2 -->
+ <w:nfc w:val="10"/>
+ </xsl:when>
+ <xsl:when test="$number-format = '壹, è´°, å, ...'">
+ <w:nfc w:val="38"/>
+ </xsl:when>
+ <xsl:when test="$number-format = '壹, è²³, åƒ, ...'">
+ <w:nfc w:val="34"/>
+ </xsl:when>
+ <xsl:when test="$number-format = '甲, 乙, 丙, ...'">
+ <w:nfc w:val="30"/>
+ </xsl:when>
+ <xsl:when test="$number-format = 'å­, 丑, 寅, ...'">
+ <w:nfc w:val="31"/>
+ </xsl:when>
+ <xsl:when test="$number-format = '壱, å¼, å‚, ...'">
+ <w:nfc w:val="16"/>
+ </xsl:when>
+ <xsl:when test="$number-format = 'ア, イ, ウ, ...'">
+ <w:nfc w:val="12"/>
+ </xsl:when>
+ <xsl:when test="$number-format = 'ï½±, ï½², ï½³, ...'">
+ <w:nfc w:val="20"/>
+ </xsl:when>
+ <xsl:when test="$number-format = 'イ, ロ, ãƒ, ...'">
+ <w:nfc w:val="13"/>
+ </xsl:when>
+ <xsl:when test="$number-format = 'イ, ロ, ハ, ...'">
+ <w:nfc w:val="21"/>
+ </xsl:when>
+ <xsl:when test="$number-format = 'ì¼, ì´, 삼, ...'">
+ <!-- 'ì¼, ì´, 삼, ...' also seems: korean-counting -->
+ <w:nfc w:val="41"/>
+ </xsl:when>
+ <xsl:when test="$number-format = 'ㄱ, ㄴ, ㄷ, ...' or $number-format = '㉠, ㉡, ㉢, ...'">
+ <!-- mapping circled to uncirled -->
+ <w:nfc w:val="25"/>
+ </xsl:when>
+ <xsl:when test='$number-format = "가, 나, 다, ..." or $number-format = "㉮, ㉯, ㉰, ..."'>
+ <!-- mapping circled to uncirled -->
+ <w:nfc w:val="24"/>
+ </xsl:when>
+ <xsl:when test="$number-format ='أ, ب, ت, ...'">
+ <!-- 46. hebrew-1-->
+ <w:nfc w:val="46"/>
+ </xsl:when>
+ <xsl:when test="$number-format = 'à¸, ข, ฃ, ...'">
+ <!--53. thai-letters not match well !-->
+ <w:nfc w:val="53"/>
+ </xsl:when>
+ <xsl:when test="$number-format='×, ב, ×’, ...'">
+ <!--45. arabic-alpha-->
+ <w:nfc w:val="45"/>
+ </xsl:when>
+ <xsl:when test="string-length($number-format)=0">
+ <w:nfc w:val="255"/>
+ </xsl:when>
+ <xsl:when test="$number-format = 'Native Numbering'">
+ <xsl:variable name="locale" select="/office:document/office:meta/dc:language"/>
+ <xsl:choose>
+ <xsl:when test="starts-with($locale, 'th-')">
+ <!-- for Thai, mapping thai-numbers, thai-counting to thai-numbers -->
+ <w:nfc w:val="54"/>
+ </xsl:when>
+ <xsl:when test="starts-with($locale, 'hi-')">
+ <!-- for Hindi, mapping hindi-vowels, hindi-consonants, hindi-counting to hindi-numbers -->
+ <w:nfc w:val="51"/>
+ </xsl:when>
+ <xsl:when test="starts-with($locale, 'ar-')">
+ <!-- for Arabic, mapping arabic-abjad to arabic-alpha -->
+ <w:nfc w:val="45"/>
+ </xsl:when>
+ <xsl:when test="starts-with($locale, 'he-')">
+ <!-- for Hebrew, mapping hebrew-2 to -->
+ <w:nfc w:val="46"/>
+ </xsl:when>
+ <xsl:when test="starts-with($locale, 'ru-')">
+ <!-- for Russian, mapping russian-upper to russian-lower -->
+ <w:nfc w:val="58"/>
+ </xsl:when>
+ <xsl:when test="starts-with($locale, 'vi-')">
+ <!-- for Vietnamese -->
+ <w:nfc w:val="56"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <!-- unsupported: ordinal, cardinal-text, ordinal-text, hex, chicago, bullet, ideograph-zodiac-traditional,
+ chinese-not-impl, korean-legal, none -->
+ </xsl:choose>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/filter/source/xslt/export/wordml/ooo2wordml_page.xsl b/filter/source/xslt/export/wordml/ooo2wordml_page.xsl
new file mode 100644
index 000000000000..477ee0b109f0
--- /dev/null
+++ b/filter/source/xslt/export/wordml/ooo2wordml_page.xsl
@@ -0,0 +1,401 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw">
+ <xsl:template name="page-background">
+ <xsl:choose>
+ <xsl:when test="/office:document/office:automatic-styles/style:page-layout/style:page-layout-properties/style:background-image[string-length(office:binary-data/text()) &gt; 0]">
+ <w:bgPict>
+ <xsl:apply-templates select="/office:document/office:automatic-styles/style:page-layout/style:page-layout-properties/style:background-image[string-length(office:binary-data/text()) &gt; 0]" mode="bgPict"/>
+ </w:bgPict>
+ </xsl:when>
+ <xsl:when test="/office:document/office:automatic-styles/style:page-layout/style:page-layout-properties[string-length(@fo:background-color) &gt; 0]">
+ <w:bgPict>
+ <xsl:apply-templates select="/office:document/office:automatic-styles/style:page-layout/style:page-layout-properties[string-length(@fo:background-color) &gt; 0]" mode="bgPict"/>
+ </w:bgPict>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="style:background-image" mode="bgPict">
+ <xsl:variable name="binName" select="concat('wordml://',generate-id(.))"/>
+ <w:binData w:name="{$binName}">
+ <xsl:value-of select="translate(office:binary-data/text(),'&#9;&#10;&#13;&#32;','' ) "/>
+ </w:binData>
+ <w:background w:bgcolor="{parent::style:page-layout-propertie/@fo:background-color}" w:background="{$binName}"/>
+ </xsl:template>
+ <xsl:template match="style:page-layout-properties" mode="bgPict">
+ <w:background w:bgcolor="{@fo:background-color}"/>
+ </xsl:template>
+ <xsl:template match="style:master-page">
+ <xsl:apply-templates select="key( 'page-layout', @style:page-layout-name)"/>
+ <xsl:if test="style:header">
+ <w:hdr w:type="odd">
+ <xsl:apply-templates select="style:header/text:p | style:header/table:table"/>
+ <!-- change style:header//text:p to style:header/text:p and add table:table here, fix for Issue 32035 -->
+ </w:hdr>
+ </xsl:if>
+ <xsl:if test="style:header-left">
+ <w:hdr w:type="even">
+ <xsl:apply-templates select="style:header-left/text:p | style:header-left/table:table"/>
+ <!-- change style:header//text:p to style:header/text:p and add table:table here, fix for Issue 32035 -->
+ </w:hdr>
+ </xsl:if>
+ <xsl:if test="style:footer">
+ <w:ftr w:type="odd">
+ <xsl:apply-templates select="style:footer/text:p | style:footer/table:table"/>
+ <!-- change style:header//text:p to style:header/text:p and add table:table here, fix for Issue 32035 -->
+ </w:ftr>
+ </xsl:if>
+ <xsl:if test="style:footer-left">
+ <w:ftr w:type="even">
+ <xsl:apply-templates select="style:footer-left/text:p | style:footer-left/table:table"/>
+ <!-- change style:header//text:p to style:header/text:p and add table:table here, fix for Issue 32035 -->
+ </w:ftr>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="style:page-layout">
+ <xsl:choose>
+ <xsl:when test="@style:page-usage = 'left'">
+ <w:type w:val="even-page"/>
+ </xsl:when>
+ <xsl:when test="@style:page-usage = 'right'">
+ <w:type w:val="odd-page"/>
+ </xsl:when>
+ <xsl:when test="@style:page-usage = 'all'">
+ <w:type w:val="next-page"/>
+ </xsl:when>
+ <!-- for mirrored, and default -->
+ <xsl:otherwise>
+ <w:type w:val="next-page"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:variable name="page-width">
+ <xsl:if test="style:page-layout-properties/@fo:page-width">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="style:page-layout-properties/@fo:page-width"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:variable name="margin-left">
+ <xsl:if test="style:page-layout-properties/@fo:margin-left">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="style:page-layout-properties/@fo:margin-left"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:variable name="margin-right">
+ <xsl:if test="style:page-layout-properties/@fo:margin-right">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="style:page-layout-properties/@fo:margin-right"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:variable>
+ <w:pgSz>
+ <xsl:if test="style:page-layout-properties/@fo:page-width">
+ <xsl:attribute name="w:w">
+ <xsl:value-of select="$page-width"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:page-layout-properties/@fo:page-height">
+ <xsl:attribute name="w:h">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="style:page-layout-properties/@fo:page-height"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:page-layout-properties/@style:print-orientation">
+ <xsl:attribute name="w:orient">
+ <xsl:value-of select="style:page-layout-properties/@style:print-orientation"/>
+ </xsl:attribute>
+ </xsl:if>
+ </w:pgSz>
+ <w:pgMar>
+ <xsl:if test="style:page-layout-properties/@fo:margin-top">
+ <xsl:variable name="top-margin">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="style:page-layout-properties/@fo:margin-top"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="w:top">
+ <xsl:value-of select="$top-margin"/>
+ </xsl:attribute>
+ <xsl:if test="style:header-style/style:page-layout-properties/@fo:min-height">
+ <xsl:variable name="header-height">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="style:header-style/style:page-layout-properties/@fo:min-height"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="w:header">
+ <xsl:value-of select="$top-margin - $header-height"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="style:page-layout-properties/@fo:margin-bottom">
+ <xsl:variable name="bottom-margin">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="style:page-layout-properties/@fo:margin-bottom"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="w:bottom">
+ <xsl:value-of select="$bottom-margin"/>
+ </xsl:attribute>
+ <xsl:if test="style:footer-style/style:page-layout-properties/@fo:min-height">
+ <xsl:variable name="footer-height">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="style:footer-style/style:page-layout-properties/@fo:min-height"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="w:footer">
+ <xsl:value-of select="$bottom-margin - $footer-height"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="style:page-layout-properties/@fo:margin-left">
+ <xsl:attribute name="w:left">
+ <xsl:value-of select="$margin-left"/>
+ </xsl:attribute>
+ <xsl:attribute name="w:gutter">
+ <xsl:value-of select="'0'"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:page-layout-properties/@fo:margin-right">
+ <xsl:attribute name="w:right">
+ <xsl:value-of select="$margin-right"/>
+ </xsl:attribute>
+ </xsl:if>
+ </w:pgMar>
+ <xsl:variable name="border-top" select="style:page-layout-properties/@fo:border-top | style:page-layout-properties/@fo:border"/>
+ <xsl:variable name="border-bottom" select="style:page-layout-properties/@fo:border-bottom | style:page-layout-properties/@fo:border"/>
+ <xsl:variable name="border-left" select="style:page-layout-properties/@fo:border-left | style:page-layout-properties/@fo:border"/>
+ <xsl:variable name="border-right" select="style:page-layout-properties/@fo:border-right | style:page-layout-properties/@fo:border"/>
+ <xsl:variable name="border-line-width-top" select="style:page-layout-properties/@style:border-line-width-top | style:page-layout-properties/@style:border-line-width "/>
+ <xsl:variable name="border-line-width-bottom" select="style:page-layout-properties/@style:border-line-width-bottom | style:page-layout-properties/@style:border-line-width"/>
+ <xsl:variable name="border-line-width-left" select="style:page-layout-properties/@style:border-line-width-left | style:page-layout-properties/@style:border-line-width"/>
+ <xsl:variable name="border-line-width-right" select="style:page-layout-properties/@style:border-line-width-right | style:page-layout-properties/@style:border-line-width"/>
+ <xsl:variable name="padding-top" select="style:page-layout-properties/@fo:padding-top | style:page-layout-properties/@fo:padding"/>
+ <xsl:variable name="padding-bottom" select="style:page-layout-properties/@fo:padding-bottom | style:page-layout-properties/@fo:padding"/>
+ <xsl:variable name="padding-left" select="style:page-layout-properties/@fo:padding-left | style:page-layout-properties/@fo:padding"/>
+ <xsl:variable name="padding-right" select="style:page-layout-properties/@fo:padding-right | style:page-layout-properties/@fo:padding"/>
+ <w:pgBorders w:offset-from="text">
+ <xsl:if test="$border-top">
+ <xsl:element name="w:top">
+ <xsl:call-template name="get-border">
+ <xsl:with-param name="so-border" select="$border-top"/>
+ <xsl:with-param name="so-border-line-width" select="$border-line-width-top"/>
+ <xsl:with-param name="so-border-position" select=" 'top' "/>
+ </xsl:call-template>
+ <xsl:attribute name="w:space">
+ <xsl:call-template name="convert2pt">
+ <xsl:with-param name="value" select="$padding-top"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:if test="style:page-layout-properties/@style:shadow!='none'">
+ <xsl:attribute name="w:shadow">on</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="$border-bottom">
+ <xsl:element name="w:bottom">
+ <xsl:call-template name="get-border">
+ <xsl:with-param name="so-border" select="$border-bottom"/>
+ <xsl:with-param name="so-border-line-width" select="$border-line-width-bottom"/>
+ <xsl:with-param name="so-border-position" select=" 'bottom' "/>
+ </xsl:call-template>
+ <xsl:attribute name="w:space">
+ <xsl:call-template name="convert2pt">
+ <xsl:with-param name="value" select="$padding-bottom"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:if test="style:page-layout-properties/@style:shadow!='none'">
+ <xsl:attribute name="w:shadow">on</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="$border-left">
+ <xsl:element name="w:left">
+ <xsl:call-template name="get-border">
+ <xsl:with-param name="so-border" select="$border-left"/>
+ <xsl:with-param name="so-border-line-width" select="$border-line-width-left"/>
+ <xsl:with-param name="so-border-position" select=" 'left' "/>
+ </xsl:call-template>
+ <xsl:attribute name="w:space">
+ <xsl:call-template name="convert2pt">
+ <xsl:with-param name="value" select="$padding-left"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:if test="style:page-layout-properties/@style:shadow!='none'">
+ <xsl:attribute name="w:shadow">on</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="$border-right">
+ <xsl:element name="w:right">
+ <xsl:call-template name="get-border">
+ <xsl:with-param name="so-border" select="$border-right"/>
+ <xsl:with-param name="so-border-line-width" select="$border-line-width-right"/>
+ <xsl:with-param name="so-border-position" select=" 'right' "/>
+ </xsl:call-template>
+ <xsl:attribute name="w:space">
+ <xsl:call-template name="convert2pt">
+ <xsl:with-param name="value" select="$padding-right"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:if test="style:page-layout-properties/@style:shadow!='none'">
+ <xsl:attribute name="w:shadow">on</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ </w:pgBorders>
+ <xsl:variable name="valid-width">
+ <xsl:value-of select="$page-width - $margin-left - $margin-right"/>
+ </xsl:variable>
+ <xsl:apply-templates select="style:page-layout-properties/style:columns">
+ <xsl:with-param name="page-width" select="$valid-width"/>
+ </xsl:apply-templates>
+ <xsl:apply-templates select="/office:document/office:styles/text:linenumbering-configuration"/>
+ </xsl:template>
+ <xsl:template match="text:linenumbering-configuration">
+ <xsl:if test="not(@text:number-lines = 'false')">
+ <xsl:element name="w:lnNumType">
+ <xsl:if test="@text:increment">
+ <xsl:attribute name="w:count-by">
+ <xsl:value-of select="@text:increment"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@text:offset">
+ <xsl:attribute name="w:distance">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="@text:offset"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="w:restart">continuous</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="style:style" mode="section">
+ <xsl:param name="master-page"/>
+ <xsl:variable name="page-width">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="$master-page/style:page-layout-properties/@fo:page-width"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="margin-left">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="$master-page/style:page-layout-properties/@fo:margin-left"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="margin-right">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="$master-page/style:page-layout-properties/@fo:margin-right"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="valid-width">
+ <xsl:value-of select="$page-width - $margin-left - $margin-right"/>
+ </xsl:variable>
+ <w:type w:val="continuous"/>
+ <xsl:apply-templates select="style:section-properties/style:columns">
+ <xsl:with-param name="page-width" select="$valid-width"/>
+ </xsl:apply-templates>
+ </xsl:template>
+ <xsl:template match="style:columns">
+ <xsl:param name="page-width"/>
+ <w:cols w:num="{@fo:column-count}">
+ <xsl:if test="@fo:column-gap">
+ <xsl:attribute name="w:space">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="@fo:column-gap"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:column-sep">
+ <xsl:attribute name="w:sep">on</xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="not(style:column)">
+ <xsl:attribute name="w:equalWidth">on</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="w:equalWidth">off</xsl:attribute>
+ <xsl:variable name="column-relative-width">
+ <xsl:call-template name="get-sum-column-width">
+ <xsl:with-param name="current-column" select="style:column[1]"/>
+ <xsl:with-param name="current-width" select="'0'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:for-each select="style:column">
+ <xsl:element name="w:col">
+ <xsl:attribute name="w:w">
+ <xsl:value-of select="floor(substring-before(@style:rel-width,'*') * $page-width div $column-relative-width)"/>
+ </xsl:attribute>
+ <xsl:if test="@fo:margin-right">
+ <xsl:variable name="margin-right">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="@fo:margin-right"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="following-sibling::style:column">
+ <xsl:variable name="margin-left">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="@fo:margin-left"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="w:space">
+ <xsl:value-of select="$margin-right + $margin-left"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="w:space">
+ <xsl:value-of select="$margin-right"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:otherwise>
+ </xsl:choose>
+ </w:cols>
+ </xsl:template>
+ <xsl:template name="get-sum-column-width">
+ <xsl:param name="current-column"/>
+ <xsl:param name="current-width"/>
+ <xsl:variable name="new-width" select="$current-width + substring-before($current-column/@style:rel-width,'*')"/>
+ <xsl:choose>
+ <xsl:when test="$current-column/following-sibling::style:column">
+ <xsl:call-template name="get-sum-column-width">
+ <xsl:with-param name="current-column" select="$current-column/following-sibling::style:column[1]"/>
+ <xsl:with-param name="current-width" select="$new-width"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$new-width"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/filter/source/xslt/export/wordml/ooo2wordml_path.xsl b/filter/source/xslt/export/wordml/ooo2wordml_path.xsl
new file mode 100644
index 000000000000..695bbb0c3ef8
--- /dev/null
+++ b/filter/source/xslt/export/wordml/ooo2wordml_path.xsl
@@ -0,0 +1,858 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw">
+ <xsl:include href="../../common/math.xsl"/>
+ <xsl:template name="test-arc">
+ <xsl:call-template name="svg-arc2vml-arc">
+ <!-- M 125,75 a100,50 0 ?,? 100,50 -->
+ <xsl:with-param name="x0" select="125"/>
+ <xsl:with-param name="y0" select="75"/>
+ <xsl:with-param name="rx" select="100"/>
+ <xsl:with-param name="ry" select="50"/>
+ <xsl:with-param name="x-axis-rotation" select="0"/>
+ <xsl:with-param name="large-arc-flag" select="0"/>
+ <xsl:with-param name="sweep-flag" select="0"/>
+ <xsl:with-param name="x" select="225"/>
+ <xsl:with-param name="y" select="125"/>
+ </xsl:call-template>
+ </xsl:template>
+ <xsl:template name="test">
+ <xsl:call-template name="svgpath2vmlpath">
+ <xsl:with-param name="svg-path" select="'M 36.0 162.0 C 38.0 168.0 39.0-172.0 40.0 176.0 S 42.0 184.0 144.0 188.0'"/>
+ </xsl:call-template>
+ </xsl:template>
+ <xsl:template name="svgpath2vmlpath">
+ <xsl:param name="svg-path"/>
+ <xsl:param name="vml-path" select="''"/>
+ <xsl:param name="position" select="1"/>
+ <xsl:param name="last-command" select="'M'"/>
+ <xsl:param name="current-x" select="'0'"/>
+ <xsl:param name="current-y" select="'0'"/>
+ <xsl:variable name="command-and-newpos">
+ <xsl:call-template name="get-path-command">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="$position"/>
+ <xsl:with-param name="last-command" select="$last-command"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="command" select="substring-before($command-and-newpos , ':')"/>
+ <xsl:variable name="newpos" select="substring-after($command-and-newpos , ':')"/>
+ <xsl:choose>
+ <xsl:when test="$command = 'M' ">
+ <!-- absolute moveto -->
+ <xsl:variable name="new-vml-path" select="concat($vml-path ,' m ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="svgpath2vmlpath">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="vml-path" select=" concat($new-vml-path , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="'L'"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'm' ">
+ <!-- relative moveto -->
+ <xsl:variable name="new-vml-path" select="concat($vml-path ,' t ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="svgpath2vmlpath">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="vml-path" select=" concat($new-vml-path , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="'l'"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') + $current-x"/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') + $current-y "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'L' ">
+ <!-- absolute lineto -->
+ <xsl:variable name="new-vml-path" select="concat($vml-path ,' l ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="svgpath2vmlpath">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="vml-path" select=" concat($new-vml-path , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'l' ">
+ <!-- relative lineto -->
+ <xsl:variable name="new-vml-path" select="concat($vml-path ,' r ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="svgpath2vmlpath">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="vml-path" select=" concat($new-vml-path , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') + $current-x "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') + $current-y "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'H' ">
+ <!-- absolute horizontal lineto -->
+ <xsl:variable name="new-vml-path" select="concat($vml-path ,' l ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="svgpath2vmlpath">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="vml-path" select=" concat($new-vml-path , substring-before( $num-and-pos , ':') , ' ' , $current-y , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( $num-and-pos , ':') "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'h' ">
+ <!-- relative horizontal lineto -->
+ <xsl:variable name="new-vml-path" select="concat($vml-path ,' l ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="svgpath2vmlpath">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="vml-path" select=" concat($new-vml-path , substring-before( $num-and-pos , ':') + $current-x , ' ' , $current-y , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( $num-and-pos , ':') + $current-x"/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'V' ">
+ <!-- absolute vertical lineto -->
+ <xsl:variable name="new-vml-path" select="concat($vml-path ,' l ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="svgpath2vmlpath">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="vml-path" select=" concat($new-vml-path , $current-x , ' ' , substring-before( $num-and-pos , ':') , ' ' ) "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x"/>
+ <xsl:with-param name="current-y" select=" substring-before( $num-and-pos , ':') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'v' ">
+ <!-- relative horizontal lineto -->
+ <xsl:variable name="new-vml-path" select="concat($vml-path ,' l ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="svgpath2vmlpath">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="vml-path" select=" concat($new-vml-path , $current-x , ' ' , substring-before( $num-and-pos , ':') + $current-y , ' ' ) "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x"/>
+ <xsl:with-param name="current-y" select=" substring-before( $num-and-pos , ':') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'C' ">
+ <!-- absolute curveto -->
+ <xsl:variable name="new-vml-path" select="concat($vml-path ,' c ' ) "/>
+ <xsl:variable name="control-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="4"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="substring-after( $control-and-pos , ':') "/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="svgpath2vmlpath">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="vml-path" select=" concat($new-vml-path , substring-before( $control-and-pos , ':') , ' ' , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'c' ">
+ <!-- relative curveto -->
+ <xsl:variable name="new-vml-path" select="concat($vml-path ,' v ' ) "/>
+ <xsl:variable name="control-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="4"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="substring-after( $control-and-pos , ':') "/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="svgpath2vmlpath">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="vml-path" select=" concat($new-vml-path , substring-before( $control-and-pos , ':') , ' ' , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') + $current-x "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') + $current-y "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'S' ">
+ <!-- absolute shorthand/smooth curveto -->
+ <xsl:variable name="new-vml-path" select="concat($vml-path ,' c ' ) "/>
+ <xsl:variable name="control-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="substring-after( $control-and-pos , ':') "/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="control-1">
+ <xsl:choose>
+ <xsl:when test="string-length(translate($last-command, 'CcSs','') )= 0 ">
+ <xsl:variable name="previous-control-2">
+ <xsl:call-template name="get-number-before">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="$position"/>
+ <xsl:with-param name="count" select="2"/>
+ <xsl:with-param name="skipcount" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="substring-before($previous-control-2 , ':') "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-before($control-and-pos, ':') "/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:call-template name="svgpath2vmlpath">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="vml-path" select=" concat($new-vml-path , $control-1 , ' ' , substring-before( $control-and-pos , ':') , ' ' , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 's' ">
+ <!-- absolute shorthand/smooth curveto -->
+ <xsl:variable name="new-vml-path" select="concat($vml-path ,' v ' ) "/>
+ <xsl:variable name="control-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="substring-after( $control-and-pos , ':') "/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="control-1">
+ <xsl:choose>
+ <xsl:when test="string-length(translate($last-command, 'CcSs' , '')) = 0 ">
+ <xsl:variable name="previous-control-2">
+ <xsl:call-template name="get-number-before">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="$position"/>
+ <xsl:with-param name="count" select="2"/>
+ <xsl:with-param name="skipcount" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="substring-before($previous-control-2 , ':') "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-before($control-and-pos, ':') "/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:call-template name="svgpath2vmlpath">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="vml-path" select=" concat($new-vml-path , $control-1 , ' ' , substring-before( $control-and-pos , ':') , ' ' , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') + $current-x "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') + $current-y "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'Q' ">
+ <!-- absolute quadratic bézier curves -->
+ <xsl:variable name="new-vml-path" select="concat($vml-path ,' qb ' ) "/>
+ <xsl:variable name="control-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="substring-after( $control-and-pos , ':') "/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="svgpath2vmlpath">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="vml-path" select=" concat($new-vml-path , substring-before( $control-and-pos , ':') , ' ' , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'q' ">
+ <!-- relative quadratic bézier curves -->
+ <xsl:variable name="control-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="control" select="substring-before( $control-and-pos , ':') "/>
+ <xsl:variable name="new-vml-path" select="concat($vml-path ,' qb ' , substring-before($control,' ') + $current-x , ' ' , substring-after($control , ' ') + $current-y ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="substring-after( $control-and-pos , ':') "/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="number" select="substring-before($num-and-pos, ':')"/>
+ <xsl:variable name="absolute-number" select="concat(substring-before($number, ' ') + $current-x , ' ' , substring-after($number, ' ') + $current-y)"/>
+ <xsl:call-template name="svgpath2vmlpath">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="vml-path" select=" concat($new-vml-path , ' ' , $absolute-number , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( $absolute-number , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( $absolute-number , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'Z' or $command = 'z' ">
+ <!-- closepath -->
+ <xsl:variable name="new-vml-path" select="concat($vml-path ,' x ' ) "/>
+ <xsl:call-template name="svgpath2vmlpath">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="vml-path" select=" concat($new-vml-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$vml-path"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-number-before">
+ <!-- get $count number of number before current position , output format:number1 number2 ... numberN:newpostion
+ skip $skipcount of numbers
+ -->
+ <xsl:param name="svg-path"/>
+ <xsl:param name="position" select="1"/>
+ <xsl:param name="count" select="1"/>
+ <xsl:param name="skipcount" select="0"/>
+ <xsl:param name="number" select="''"/>
+ <xsl:choose>
+ <xsl:when test="$count = 0">
+ <xsl:value-of select=" concat($number , ':' , $position) "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="num-pos">
+ <xsl:call-template name="get-number-position">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="$position"/>
+ <xsl:with-param name="direction" select="-1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="previous-num-and-pos">
+ <xsl:call-template name="get-previous-number">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="$num-pos"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="$skipcount &gt; 0">
+ <xsl:call-template name="get-number-before">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="substring-after($previous-num-and-pos , ':')"/>
+ <xsl:with-param name="count" select="$count"/>
+ <xsl:with-param name="skipcount" select="$skipcount - 1"/>
+ <xsl:with-param name="number" select="$number"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="$skipcount = 0">
+ <xsl:variable name="new-number">
+ <xsl:if test="not($count = 1)">
+ <xsl:value-of select="' '"/>
+ </xsl:if>
+ <xsl:value-of select=" concat( substring-before($previous-num-and-pos , ':') , $number ) "/>
+ </xsl:variable>
+ <xsl:call-template name="get-number-before">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="substring-after($previous-num-and-pos , ':')"/>
+ <xsl:with-param name="count" select="$count - 1"/>
+ <xsl:with-param name="skipcount" select="0"/>
+ <xsl:with-param name="number" select="$new-number"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-number-after">
+ <!-- get $count number of number after current position, output format:number1 number2 ... numberN:newpostion
+ skip $skipcount of numbers
+ -->
+ <xsl:param name="svg-path"/>
+ <xsl:param name="position" select="1"/>
+ <xsl:param name="count" select="1"/>
+ <xsl:param name="skipcount" select="0"/>
+ <xsl:param name="number" select="''"/>
+ <xsl:choose>
+ <xsl:when test="$count = 0">
+ <xsl:value-of select=" concat($number , ':' , $position) "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="num-pos">
+ <xsl:call-template name="get-number-position">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="$position"/>
+ <xsl:with-param name="direction" select="1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="next-num-and-pos">
+ <xsl:call-template name="get-next-number">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="$num-pos"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="$skipcount &gt; 0">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="substring-after($next-num-and-pos , ':')"/>
+ <xsl:with-param name="count" select="$count"/>
+ <xsl:with-param name="skipcount" select="$skipcount - 1"/>
+ <xsl:with-param name="number" select="$number"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="$skipcount = 0">
+ <xsl:variable name="new-number">
+ <xsl:value-of select=" concat( $number , substring-before($next-num-and-pos , ':') ) "/>
+ <xsl:if test="not($count = 1)">
+ <xsl:value-of select="' '"/>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="substring-after($next-num-and-pos , ':')"/>
+ <xsl:with-param name="count" select="$count - 1"/>
+ <xsl:with-param name="skipcount" select="0"/>
+ <xsl:with-param name="number" select="$new-number"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-number-position">
+ <!-- get the next number start position, direction should be 1 or -1-->
+ <xsl:param name="svg-path"/>
+ <xsl:param name="position"/>
+ <xsl:param name="direction" select="1"/>
+ <xsl:choose>
+ <xsl:when test="$direction = 1 and $position &gt; string-length($svg-path) ">0</xsl:when>
+ <xsl:when test="$direction = -1 and not($position &gt; 0)">0</xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="curr-char">
+ <xsl:if test="$direction = 1">
+ <xsl:value-of select="substring($svg-path, $position , 1)"/>
+ </xsl:if>
+ <xsl:if test="$direction = -1">
+ <xsl:value-of select="substring($svg-path, $position -1 , 1)"/>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="string-length(translate($curr-char , '+-.0123456789' ,'')) = 0 ">
+ <!-- number start-->
+ <xsl:value-of select="$position"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="get-number-position">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="$position + $direction"/>
+ <xsl:with-param name="direction" select="$direction"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-next-number">
+ <!-- get the next number from current position-->
+ <xsl:param name="svg-path"/>
+ <xsl:param name="position"/>
+ <xsl:param name="number" select="''"/>
+ <xsl:choose>
+ <xsl:when test="$position &gt; string-length($svg-path) ">
+ <xsl:value-of select=" concat(round($number) , ':' , $position) "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="curr-char" select="substring($svg-path, $position , 1)"/>
+ <xsl:choose>
+ <xsl:when test="string-length(translate($curr-char , '.0123456789' ,'')) = 0 ">
+ <!-- is number -->
+ <xsl:call-template name="get-next-number">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="$position +1"/>
+ <xsl:with-param name="number" select="concat( $number, $curr-char) "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="string-length(translate($curr-char , '+-' ,'') ) = 0 and string-length($number) = 0">
+ <!-- is number -->
+ <xsl:call-template name="get-next-number">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="$position +1"/>
+ <xsl:with-param name="number" select="concat( $number, $curr-char) "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat( round($number) , ':' , $position)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-previous-number">
+ <!-- get the previous number from current position-->
+ <xsl:param name="svg-path"/>
+ <xsl:param name="position"/>
+ <xsl:param name="number" select="''"/>
+ <xsl:choose>
+ <xsl:when test="not($position &gt; 0)">
+ <xsl:value-of select="concat( round($number ), ':0')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="curr-char" select="substring($svg-path, $position -1 , 1)"/>
+ <xsl:choose>
+ <xsl:when test="string-length(translate($curr-char , '.0123456789' ,'')) = 0 ">
+ <!-- is number -->
+ <xsl:call-template name="get-previous-number">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="$position -1"/>
+ <xsl:with-param name="number" select="concat($curr-char , $number) "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="string-length(translate($curr-char , '+-' ,'') ) = 0 and string-length($number) = 0">
+ <!-- skip it -->
+ <xsl:call-template name="get-previous-number">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="$position -1"/>
+ <xsl:with-param name="number" select="$number "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="string-length(translate($curr-char , '+-' ,'') ) = 0 and string-length($number) &gt; 0">
+ <!-- finsh it with +/- -->
+ <xsl:value-of select="concat( round( concat( $curr-char, $number)) , ':' , $position)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat( round($number) , ':' , $position)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-path-command">
+ <xsl:param name="svg-path"/>
+ <xsl:param name="position" select="1"/>
+ <xsl:param name="last-command"/>
+ <xsl:choose>
+ <xsl:when test="$position &gt; string-length($svg-path) "/>
+ <xsl:otherwise>
+ <xsl:variable name="curr-char" select="substring($svg-path, $position , 1)"/>
+ <xsl:choose>
+ <xsl:when test="string-length(translate($curr-char , 'MmZzLlHhVvCcSsQqTtAa' ,'')) = 0 ">
+ <!-- "MmZzLlHhVvCcSsQqTtAa" are all possiable command chars -->
+ <xsl:value-of select="concat( $curr-char , ':' , $position +1)"/>
+ </xsl:when>
+ <xsl:when test="string-length(translate($curr-char , '+-.0123456789' ,'')) = 0 ">
+ <!-- number start, use last command -->
+ <xsl:if test="string-length($last-command) = 0">
+ <xsl:message>ooo2wordml_path.xsl: Find undefined command</xsl:message>
+ </xsl:if>
+ <xsl:value-of select="concat( $last-command , ':' , $position )"/>
+ </xsl:when>
+ <xsl:when test="string-length(translate($curr-char , ',&#9;&#10;&#13;&#32;' ,'')) = 0 ">
+ <!-- space or ',' should be skip -->
+ <xsl:call-template name="get-path-command">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="$position +1"/>
+ <xsl:with-param name="last-command" select="$last-command"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>ooo2wordml_path.xsl: Find undefined command:<xsl:value-of select="$curr-char"/>
+ </xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="svg-arc2vml-arc">
+ <xsl:param name="x0"/>
+ <xsl:param name="y0"/>
+ <xsl:param name="rx"/>
+ <xsl:param name="ry"/>
+ <xsl:param name="x-axis-rotation" select="0"/>
+ <xsl:param name="large-arc-flag" select="0"/>
+ <xsl:param name="sweep-flag" select="0"/>
+ <xsl:param name="x"/>
+ <xsl:param name="y"/>
+ <!-- Compute 1/2 distance between current and final point -->
+ <xsl:variable name="dx2" select="($x0 - $x) div 2"/>
+ <xsl:variable name="dy2" select="($y0 - $y) div 2"/>
+ <!-- Convert from degrees to radians -->
+ <xsl:variable name="rotation-radian" select="$x-axis-rotation * $pi div 180"/>
+ <!-- Compute (x1, y1). What are x1,y1?-->
+ <xsl:variable name="cos-rotation">
+ <xsl:call-template name="cos">
+ <xsl:with-param name="x" select="$rotation-radian"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="sin-rotation">
+ <xsl:call-template name="sin">
+ <xsl:with-param name="x" select="$rotation-radian"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="x1" select="$cos-rotation * $dx2 + $sin-rotation * $dy2"/>
+ <xsl:variable name="y1" select="-1 * $sin-rotation * $dx2 + $cos-rotation * $dy2"/>
+ <!-- Make sure radii are large enough -->
+ <xsl:variable name="rx-abs">
+ <xsl:call-template name="abs">
+ <xsl:with-param name="x" select="$rx"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="ry-abs">
+ <xsl:call-template name="abs">
+ <xsl:with-param name="x" select="$ry"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="rx-sq" select="$rx-abs * $rx-abs"/>
+ <xsl:variable name="ry-sq" select="$ry-abs * $ry-abs"/>
+ <xsl:variable name="x1-sq" select="$x1 * $x1"/>
+ <xsl:variable name="y1-sq" select="$y1 * $y1"/>
+ <xsl:variable name="radius-check" select=" $x1-sq div $rx-sq + $y1-sq div $ry-sq "/>
+ <xsl:variable name="radius-check-sqrt">
+ <xsl:call-template name="sqrt">
+ <xsl:with-param name="x" select="$radius-check"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="new-rx">
+ <xsl:choose>
+ <xsl:when test="$radius-check &gt; 1">
+ <xsl:value-of select="$rx-abs * $radius-check-sqrt"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$rx-abs"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="new-ry">
+ <xsl:choose>
+ <xsl:when test="$radius-check &gt; 1">
+ <xsl:value-of select="$ry-abs * $radius-check-sqrt"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$ry-abs"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="new-ry-sq">
+ <xsl:choose>
+ <xsl:when test="$radius-check &gt; 1">
+ <xsl:value-of select="$new-ry * $new-ry"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$ry-sq"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="new-rx-sq">
+ <xsl:choose>
+ <xsl:when test="$radius-check &gt; 1">
+ <xsl:value-of select="$new-rx * $new-rx"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$rx-sq"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <!-- Step 2: Compute (cx1, cy1) -->
+ <xsl:variable name="sign">
+ <xsl:choose>
+ <xsl:when test="$large-arc-flag = $sweep-flag">-1</xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="unchecked-sq" select=" (($new-rx-sq * $new-ry-sq) - ($new-rx-sq * $y1-sq) - ($new-ry-sq * $x1-sq)) div (($new-rx-sq * $y1-sq) + ($new-ry-sq * $x1-sq)) "/>
+ <xsl:variable name="sq">
+ <xsl:choose>
+ <xsl:when test=" $unchecked-sq &lt; 0">0</xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$unchecked-sq"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="sq-sqrt">
+ <xsl:call-template name="sqrt">
+ <xsl:with-param name="x" select="$sq"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="coef" select="$sign * $sq-sqrt "/>
+ <xsl:variable name="cx1" select="$coef * $new-rx * $y1 div $new-ry"/>
+ <xsl:variable name="cy1" select=" -1 * $coef * $new-ry * $x1 div $new-rx"/>
+ <!-- Step 3: Compute (cx, cy) from (cx1, cy1) -->
+ <xsl:variable name="sx2" select="($x0 +$x) div 2 "/>
+ <xsl:variable name="sy2" select="($y0 +$y) div 2 "/>
+ <xsl:variable name="tmp1" select="$cos-rotation * $cx1 "/>
+ <xsl:variable name="tmp2" select="$cos-rotation * $cx1 "/>
+ <xsl:variable name="cx" select=" $sx2 + ( $cos-rotation * $cx1 - $sin-rotation * $cy1 ) "/>
+ <xsl:variable name="cy" select=" $sy2 + ( $sin-rotation * $cx1 + $cos-rotation * $cy1 ) "/>
+ <!-- Step 4: Compute angle start and angle extent -->
+ <xsl:variable name="ux" select="( $x1 - $cx1) div $new-rx"/>
+ <xsl:variable name="uy" select="( $y1 - $cy1) div $new-ry"/>
+ <xsl:variable name="vx" select="( - 1 * $x1 - $cx1) div $new-rx"/>
+ <xsl:variable name="vy" select="(- 1 * $y1 - $cy1) div $new-ry"/>
+ <xsl:variable name="n">
+ <xsl:call-template name="sqrt">
+ <xsl:with-param name="x" select=" ($ux * $ux) + ($uy * $uy) "/>
+ </xsl:call-template>
+ </xsl:variable>
+ <!-- 1 * ux + 0 * uy -->
+ <xsl:variable name="p" select="$ux"/>
+ <xsl:variable name="uy-sign">
+ <xsl:choose>
+ <xsl:when test=" $uy &lt; 0 ">-1</xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="acos-pn">
+ <xsl:call-template name="acos">
+ <xsl:with-param name="x" select="$p div $n"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="theta" select="( $uy-sign * $acos-pn * 180 div $pi ) mod 360 "/>
+ <xsl:variable name="n-delta">
+ <xsl:call-template name="sqrt">
+ <xsl:with-param name="x" select="($ux * $ux + $uy * $uy) * ($vx * $vx + $vy * $vy)"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="p-delta" select="$ux * $vx + $uy * $vy"/>
+ <xsl:variable name="vy-sign">
+ <xsl:choose>
+ <xsl:when test="($ux * $vy - $uy * $vx) &lt; 0 ">-1</xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="acos-pn-delta">
+ <xsl:call-template name="acos">
+ <xsl:with-param name="x" select="$p-delta div $n-delta"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="unchecked-delta" select="$vy-sign * $acos-pn-delta * 180 div $pi "/>
+ <xsl:variable name="delta">
+ <xsl:choose>
+ <xsl:when test=" $sweep-flag = 0 and $unchecked-delta &gt; 0 ">
+ <xsl:value-of select=" ($unchecked-delta - 360) mod 360 "/>
+ </xsl:when>
+ <xsl:when test=" $sweep-flag = 1 and $unchecked-delta &lt; 0 ">
+ <xsl:value-of select=" ($unchecked-delta + 360) mod 360 "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select=" $unchecked-delta mod 360 "/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:value-of select="concat ($cx, ' ' , $cy, ' ' , $rx, ' ' , $ry, ' ' , $theta, ' ' , $delta, ' ' , $x-axis-rotation) "/>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/filter/source/xslt/export/wordml/ooo2wordml_settings.xsl b/filter/source/xslt/export/wordml/ooo2wordml_settings.xsl
new file mode 100644
index 000000000000..71312d57ed5e
--- /dev/null
+++ b/filter/source/xslt/export/wordml/ooo2wordml_settings.xsl
@@ -0,0 +1,312 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw">
+ <xsl:template match="office:settings">
+ <w:docPr>
+ <w:displayBackgroundShape/>
+ <xsl:variable name="view-settings" select="config:config-item-set[@config:name = 'view-settings']"/>
+ <xsl:choose>
+ <xsl:when test="$view-settings/config:config-item[@config:name = 'InBrowseMode'] = 'true'">
+ <w:view w:val="outline"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <w:view w:val="print"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:variable name="views" select="$view-settings/config:config-item-map-indexed[@config:name = 'Views']"/>
+ <w:zoom w:percent="{$views/config:config-item-map-entry/config:config-item[@config:name = 'ZoomFactor']}">
+ <xsl:variable name="zoom-type" select="$views/config:config-item-map-entry/config:config-item[@config:name = 'ZoomType']"/>
+ <xsl:choose>
+ <xsl:when test="$zoom-type = '3'">
+ <xsl:attribute name="w:val">best-fit</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$zoom-type = '2'">
+ <xsl:attribute name="w:val">full-page</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$zoom-type = '1'">
+ <xsl:attribute name="w:val">text-fit</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </w:zoom>
+ <w:defaultTabStop>
+ <xsl:attribute name="w:val"><xsl:call-template name="convert2twip"><xsl:with-param name="value" select="/office:document/office:styles/style:default-style[@style:family='paragraph']/style:paragraph-properties/@style:tab-stop-distance"/></xsl:call-template></xsl:attribute>
+ </w:defaultTabStop>
+ <xsl:if test="../office:master-styles/style:master-page/style:header-left">
+ <w:evenAndOddHeaders/>
+ </xsl:if>
+ <xsl:apply-templates select="/office:document/office:styles/text:footnotes-configuration"/>
+ <xsl:apply-templates select="/office:document/office:styles/text:endnotes-configuration"/>
+ <!-- add the variables declaration in w:docpr G.Y. Begin-->
+ <xsl:if test="/office:document/office:body/office:text/text:variable-decls | /office:document/office:body/office:text/text:user-field-decls |/office:document/office:body/office:text/text:sequence-decls ">
+ <xsl:call-template name="field_declare">
+ <xsl:with-param name="simple_field_variable_declares" select="/office:document/office:body/office:text/text:variable-decls"/>
+ <xsl:with-param name="user_field_variable_declares" select=" /office:document/office:body/office:text/text:user-field-decls"/>
+ <xsl:with-param name="field_sequence_declares" select="/office:document/office:body/office:text/text:sequence-decls"/>
+ </xsl:call-template>
+ </xsl:if>
+ <!--add the variables declaration in w:docpr G.Y. End-->
+ </w:docPr>
+ </xsl:template>
+ <xsl:template match="text:footnotes-configuration">
+ <xsl:param name="within-section"/>
+ <w:footnotePr>
+ <xsl:choose>
+ <xsl:when test="@text:footnotes-position = 'document'">
+ <w:pos w:val="beneath-text"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <w:pos w:val="page-bottom"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="@text:start-value">
+ <w:numStart w:val="{@text:start-value + 1}"/>
+ </xsl:if>
+ <xsl:if test="@style:num-format">
+ <xsl:call-template name="convert-number-format">
+ <xsl:with-param name="number-format" select="@style:num-format"/>
+ <xsl:with-param name="number-prefix" select="@style:num-prefix"/>
+ <xsl:with-param name="number-suffix" select="@style:num-suffix"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="@text:start-numbering-at">
+ <xsl:choose>
+ <xsl:when test="@text:start-numbering-at = 'document'">
+ <w:numRestart w:val="continuous"/>
+ </xsl:when>
+ <xsl:when test="@text:start-numbering-at = 'page'">
+ <w:numRestart w:val="each-page"/>
+ </xsl:when>
+ <!-- convert "chapter" to "section" -->
+ <xsl:otherwise>
+ <w:numRestart w:val="each-sect"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="$within-section != 'yes'">
+ <!-- because in SO/OOo footnote-sep is defined within every page-layout, but in Word XML footnote separator
+ is defined solely in docPr, so not trouble to find the proper footnote-sep definition. -->
+ <w:footnote w:type="separator">
+ <w:p>
+ <w:r>
+ <w:separator/>
+ </w:r>
+ </w:p>
+ </w:footnote>
+ <w:footnote w:type="continuation-separator">
+ <w:p>
+ <w:r>
+ <w:continuationSeparator/>
+ <xsl:if test="text:footnote-continuation-notice-backward">
+ <w:t>
+ <xsl:value-of select="text:footnote-continuation-notice-backward"/>
+ </w:t>
+ </xsl:if>
+ </w:r>
+ </w:p>
+ </w:footnote>
+ <xsl:if test="text:footnote-continuation-notice-forward">
+ <w:footnote w:type="continuation-notice">
+ <w:p>
+ <w:r>
+ <w:t>
+ <xsl:value-of select="text:footnote-continuation-notice-forward"/>
+ </w:t>
+ </w:r>
+ </w:p>
+ </w:footnote>
+ </xsl:if>
+ </xsl:if>
+ </w:footnotePr>
+ </xsl:template>
+ <xsl:template match="text:endnotes-configuration">
+ <xsl:param name="within-section"/>
+ <w:endnotePr>
+ <w:pos w:val="sect-end"/>
+ <xsl:if test="@text:start-value">
+ <w:numStart w:val="{@text:start-value + 1}"/>
+ </xsl:if>
+ <xsl:if test="@style:num-format">
+ <xsl:call-template name="convert-number-format">
+ <xsl:with-param name="number-format" select="@style:num-format"/>
+ <xsl:with-param name="number-prefix" select="@style:num-prefix"/>
+ <xsl:with-param name="number-suffix" select="@style:num-suffix"/>
+ </xsl:call-template>
+ </xsl:if>
+ <w:numRestart w:val="each-sect"/>
+ <xsl:if test="$within-section != 'yes'">
+ <w:endnote w:type="separator">
+ <w:p>
+ <w:r>
+ <w:separator/>
+ </w:r>
+ </w:p>
+ </w:endnote>
+ <w:endnote w:type="continuation-separator">
+ <w:p>
+ <w:r>
+ <w:continuationSeparator/>
+ </w:r>
+ </w:p>
+ </w:endnote>
+ </xsl:if>
+ </w:endnotePr>
+ </xsl:template>
+ <xsl:template name="convert-number-format">
+ <xsl:param name="number-format"/>
+ <xsl:param name="number-prefix"/>
+ <xsl:param name="number-suffix"/>
+ <xsl:choose>
+ <xsl:when test="$number-format = '1' and normalize-space($number-prefix) = '0'">
+ <w:numFmt w:val="decimal-zero"/>
+ </xsl:when>
+ <xsl:when test="$number-format = '1' and normalize-space($number-suffix) = '.'">
+ <w:numFmt w:val="decimal-enclosed-fullstop"/>
+ </xsl:when>
+ <xsl:when test="$number-format = '1' and normalize-space($number-prefix) = '(' and normalize-space($number-prefix) = ')'">
+ <w:numFmt w:val="decimal-enclosed-paren"/>
+ </xsl:when>
+ <xsl:when test="$number-format = '1' and normalize-space($number-prefix) = '-' and normalize-space($number-prefix) = '-'">
+ <w:numFmt w:val="number-in-dash"/>
+ </xsl:when>
+ <xsl:when test="$number-format = '1'">
+ <!-- '1' also seems: decimal-half-width -->
+ <w:numFmt w:val="decimal"/>
+ </xsl:when>
+ <xsl:when test="$number-format = 'a'">
+ <w:numFmt w:val="lower-letter"/>
+ </xsl:when>
+ <xsl:when test="$number-format = 'A'">
+ <w:numFmt w:val="upper-letter"/>
+ </xsl:when>
+ <xsl:when test="$number-format = 'i'">
+ <w:numFmt w:val="lower-roman"/>
+ </xsl:when>
+ <xsl:when test="$number-format = 'I'">
+ <w:numFmt w:val="upper-roman"/>
+ </xsl:when>
+ <xsl:when test="$number-format = '1, 2, 3, ...'">
+ <!-- '1, 2, 3, ...' also seems: decimal-full-width2 -->
+ <w:numFmt w:val="decimal-full-width"/>
+ </xsl:when>
+ <xsl:when test="$number-format = 'â‘ , â‘¡, â‘¢, ...'">
+ <!-- decimal-enclosed-circle seems same -->
+ <w:numFmt w:val="decimal-enclosed-circle-chinese"/>
+ </xsl:when>
+ <xsl:when test="$number-format = '一, 二, 三, ...' and normalize-space($number-prefix) = '(' and normalize-space($number-suffix) = ')'">
+ <w:numFmt w:val="ideograph-enclosed-circle"/>
+ </xsl:when>
+ <xsl:when test="$number-format = '一, 二, 三, ...'">
+ <!-- '一, 二, 三, ...' also seems: ideograph-digital, japanese-counting, japanese-digital-ten-thousand,
+ taiwanese-counting, taiwanese-counting-thousand, taiwanese-digital, chinese-counting, korean-digital2 -->
+ <w:numFmt w:val="chinese-counting-thousand"/>
+ </xsl:when>
+ <xsl:when test="$number-format = '壹, è´°, å, ...'">
+ <w:numFmt w:val="chinese-legal-simplified"/>
+ </xsl:when>
+ <xsl:when test="$number-format = '壹, è²³, åƒ, ...'">
+ <w:numFmt w:val="ideograph-legal-traditional"/>
+ </xsl:when>
+ <xsl:when test="$number-format = '甲, 乙, 丙, ...'">
+ <w:numFmt w:val="ideograph-traditional"/>
+ </xsl:when>
+ <xsl:when test="$number-format = 'å­, 丑, 寅, ...'">
+ <w:numFmt w:val="ideograph-zodiac"/>
+ </xsl:when>
+ <xsl:when test="$number-format = '壱, å¼, å‚, ...'">
+ <w:numFmt w:val="japanese-legal"/>
+ </xsl:when>
+ <xsl:when test="$number-format = 'ア, イ, ウ, ...'">
+ <w:numFmt w:val="aiueo-full-width"/>
+ </xsl:when>
+ <xsl:when test="$number-format = 'ï½±, ï½², ï½³, ...'">
+ <w:numFmt w:val="aiueo"/>
+ </xsl:when>
+ <xsl:when test="$number-format = 'イ, ロ, ãƒ, ...'">
+ <w:numFmt w:val="iroha-full-width"/>
+ </xsl:when>
+ <xsl:when test="$number-format = 'イ, ロ, ハ, ...'">
+ <w:numFmt w:val="iroha"/>
+ </xsl:when>
+ <xsl:when test="$number-format = 'ì¼, ì´, 삼, ...'">
+ <!-- 'ì¼, ì´, 삼, ...' also seems: korean-counting -->
+ <w:numFmt w:val="korean-digital"/>
+ </xsl:when>
+ <xsl:when test="$number-format = 'ㄱ, ㄴ, ㄷ, ...' or $number-format = '㉠, ㉡, ㉢, ...'">
+ <!-- mapping circled to uncirled -->
+ <w:numFmt w:val="chosung"/>
+ </xsl:when>
+ <xsl:when test="$number-format = '가, 나, 다, ...' or $number-format = '㉮, ㉯, ㉰, ...'">
+ <!-- mapping circled to uncirled -->
+ <w:numFmt w:val="ganada"/>
+ </xsl:when>
+ <xsl:when test="$number-format = 'أ, ب, ت, ...'">
+ <w:numFmt w:val="arabic-alpha"/>
+ </xsl:when>
+ <xsl:when test="$number-format = 'à¸, ข, ฃ, ...'">
+ <w:numFmt w:val="thai-letters"/>
+ </xsl:when>
+ <xsl:when test="$number-format = '×, ב, ×’, ...'">
+ <w:numFmt w:val="hebrew-1"/>
+ </xsl:when>
+ <xsl:when test="$number-format = 'Native Numbering'">
+ <xsl:variable name="locale" select="/office:document/office:meta/dc:language"/>
+ <xsl:choose>
+ <xsl:when test="starts-with($locale, 'th-')">
+ <!-- for Thai, mapping thai-numbers, thai-counting to thai-letters -->
+ <w:numFmt w:val="thai-letters"/>
+ </xsl:when>
+ <xsl:when test="starts-with($locale, 'hi-')">
+ <!-- for Hindi, mapping hindi-vowels, hindi-consonants, hindi-counting to hindi-numbers -->
+ <w:numFmt w:val="hindi-numbers"/>
+ </xsl:when>
+ <xsl:when test="starts-with($locale, 'ar-')">
+ <!-- for Arabic, mapping arabic-abjad to arabic-alpha -->
+ <w:numFmt w:val="arabic-alpha"/>
+ </xsl:when>
+ <xsl:when test="starts-with($locale, 'he-')">
+ <!-- for Hebrew, mapping hebrew-2 to -->
+ <w:numFmt w:val="hebrew-1"/>
+ </xsl:when>
+ <xsl:when test="starts-with($locale, 'ru-')">
+ <!-- for Russian, mapping russian-upper to russian-lower -->
+ <w:numFmt w:val="russian-lower"/>
+ </xsl:when>
+ <xsl:when test="starts-with($locale, 'vi-')">
+ <!-- for Vietnamese -->
+ <w:numFmt w:val="vietnamese-counting"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <!-- unsupported: ordinal, cardinal-text, ordinal-text, hex, chicago, bullet, ideograph-zodiac-traditional,
+ chinese-not-impl, korean-legal -->
+ <xsl:otherwise>
+ <w:numFmt w:val="decimal"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/filter/source/xslt/export/wordml/ooo2wordml_table.xsl b/filter/source/xslt/export/wordml/ooo2wordml_table.xsl
new file mode 100644
index 000000000000..67e4eafe01d7
--- /dev/null
+++ b/filter/source/xslt/export/wordml/ooo2wordml_table.xsl
@@ -0,0 +1,416 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw">
+ <xsl:key name="table-style" match="style:style[@style:family='table']" use="@style:name"/>
+ <xsl:key name="table-column-style" match="style:style[@style:family='table-column']" use="@style:name"/>
+ <xsl:key name="table-row-style" match="style:style[@style:family='table-row']" use="@style:name"/>
+ <xsl:key name="table-cell-style" match="style:style[@style:family='table-cell']" use="@style:name"/>
+ <xsl:template match="style:table-properties" mode="table">
+ <xsl:param name="within-body"/>
+ <xsl:if test="$within-body = 'yes'">
+ <w:tblW>
+ <xsl:choose>
+ <xsl:when test="@style:rel-width">
+ <xsl:attribute name="w:w"><xsl:value-of select="substring-before(@style:rel-width, '%') * 50"/></xsl:attribute>
+ <xsl:attribute name="w:type">pct</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@style:width">
+ <xsl:attribute name="w:w"><xsl:call-template name="convert2twip"><xsl:with-param name="value" select="@style:width"/></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="w:type">dxa</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="w:w">0</xsl:attribute>
+ <xsl:attribute name="w:type">auto</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </w:tblW>
+ </xsl:if>
+ <w:tblInd>
+ <xsl:choose>
+ <xsl:when test="@fo:margin-left">
+ <xsl:attribute name="w:w"><xsl:call-template name="convert2twip"><xsl:with-param name="value" select="@fo:margin-left"/></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="w:type">dxa</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="w:w">0</xsl:attribute>
+ <xsl:attribute name="w:type">auto</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </w:tblInd>
+ <xsl:if test="@table:align">
+ <w:jc>
+ <xsl:choose>
+ <xsl:when test="@table:align = 'left' or @table:align= 'center' or @table:align = 'right'">
+ <xsl:attribute name="w:val"><xsl:value-of select="@table:align"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="w:val">left</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </w:jc>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="table:table">
+ <!--fix for issue i32030 pagebreak before-->
+ <xsl:if test="key('table-style', @table:style-name)/style:table-properties/@fo:break-before">
+ <xsl:variable name="table-break-before" select="key('table-style', @table:style-name)/style:table-properties/@fo:break-before"/>
+ <xsl:choose>
+ <xsl:when test="$table-break-before = 'page' ">
+ <w:p>
+ <w:r>
+ <w:br w:type="page"/>
+ </w:r>
+ </w:p>
+ </xsl:when>
+ <xsl:when test="$table-break-before = 'column' ">
+ <w:p>
+ <w:r>
+ <w:br w:type="column"/>
+ </w:r>
+ </w:p>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ <w:tbl>
+ <w:tblPr>
+ <xsl:if test="not (@table:is-sub-table) or (@table:is-sub-table = 'false' )">
+ <w:tblStyle w:val="{@table:style-name}"/>
+ <xsl:apply-templates select="key('table-style', @table:style-name)/style:table-properties" mode="table">
+ <xsl:with-param name="within-body" select="'yes'"/>
+ </xsl:apply-templates>
+ </xsl:if>
+ <xsl:if test="@table:is-sub-table ='true' ">
+ <w:tblW w:type="dxa">
+ <xsl:variable name="sub-table-width">
+ <xsl:call-template name="caculate-sub-table-width">
+ <xsl:with-param name="sub-table-column-node" select="table:table-column[1]"/>
+ <xsl:with-param name="total-sub-table-width" select="0"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="w:w"><xsl:value-of select="$sub-table-width"/></xsl:attribute>
+ </w:tblW>
+ <!--w:tblLayout w:type="Fixed"/-->
+ </xsl:if>
+ </w:tblPr>
+ <w:tblGrid>
+ <xsl:apply-templates select="table:table-column"/>
+ </w:tblGrid>
+ <xsl:apply-templates select="table:table-header-rows/table:table-row | table:table-row"/>
+ </w:tbl>
+ <!--fix for issue i32030 pagebreak after-->
+ <xsl:if test="key('table-style', @table:style-name)/style:table-properties/@fo:break-after">
+ <xsl:variable name="table-break-after" select=" key('table-style', @table:style-name)/style:table-properties/@fo:break-after"/>
+ <xsl:choose>
+ <xsl:when test="$table-break-after = 'page' ">
+ <w:p>
+ <w:r>
+ <w:br w:type="page"/>
+ </w:r>
+ </w:p>
+ </xsl:when>
+ <xsl:when test="$table-break-after = 'column' ">
+ <w:p>
+ <w:r>
+ <w:br w:type="column"/>
+ </w:r>
+ </w:p>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="name(..)= 'table:table-cell' ">
+ <w:p/>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="caculate-sub-table-width">
+ <xsl:param name="sub-table-column-node"/>
+ <xsl:param name="total-sub-table-width"/>
+ <xsl:variable name="column-width" select="key('table-column-style', $sub-table-column-node/@table:style-name)/style:table-column-properties/@style:column-width"/>
+ <xsl:variable name="column-width-in-twip">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="$column-width"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$sub-table-column-node/following-sibling::table:table-column">
+ <xsl:choose>
+ <xsl:when test="$sub-table-column-node/@table:number-columns-repeated">
+ <xsl:call-template name="caculate-sub-table-width">
+ <xsl:with-param name="sub-table-column-node" select="$sub-table-column-node/following-sibling::table:table-column[ 1]"/>
+ <xsl:with-param name="total-sub-table-width" select="$total-sub-table-width + $column-width-in-twip * $sub-table-column-node/@table:number-columns-repeated"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="caculate-sub-table-width">
+ <xsl:with-param name="sub-table-column-node" select="$sub-table-column-node/following-sibling::table:table-column[1]"/>
+ <xsl:with-param name="total-sub-table-width" select="$total-sub-table-width + $column-width-in-twip "/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="$sub-table-column-node/@table:number-columns-repeated">
+ <xsl:value-of select="$total-sub-table-width + $column-width-in-twip * $sub-table-column-node/@table:number-columns-repeated"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$total-sub-table-width + $column-width-in-twip "/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="table:table-column">
+ <xsl:variable name="column-width" select="key('table-column-style', @table:style-name)/style:table-column-properties/@style:column-width"/>
+ <xsl:variable name="column-width-in-twip">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="$column-width"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <!-- if table:table-column has attribute table:number-columns-repeated, then call the recursion
+ temple repeat-gridcol to produce multiple w:gridCol in MS word. Gary.Yang -->
+ <xsl:when test="@table:number-columns-repeated">
+ <xsl:call-template name="repeat-gridcol">
+ <xsl:with-param name="grid-repeat-count" select="@table:number-columns-repeated"/>
+ <xsl:with-param name="column-width" select="$column-width-in-twip"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <w:gridCol w:w="{$column-width-in-twip}"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!--recursion template for produce multiple w:gridCol Gary.Yang-->
+ <xsl:template name="repeat-gridcol">
+ <xsl:param name="grid-repeat-count"/>
+ <xsl:param name="column-width"/>
+ <xsl:if test="$grid-repeat-count &gt; 0">
+ <w:gridCol w:w="{$column-width}"/>
+ <xsl:call-template name="repeat-gridcol">
+ <xsl:with-param name="grid-repeat-count" select="$grid-repeat-count - 1"/>
+ <xsl:with-param name="column-width" select="$column-width"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="table:table-row">
+ <xsl:element name="w:tr">
+ <xsl:element name="w:trPr">
+ <xsl:if test="parent::table:table-header-rows">
+ <!-- fix for Issue 32034-->
+ <w:tblHeader>on</w:tblHeader>
+ </xsl:if>
+ <xsl:variable name="row-height" select="key('table-row-style', @table:style-name)/style:table-row-properties/@style:row-height"/>
+ <xsl:if test="$row-height">
+ <w:trHeight>
+ <xsl:attribute name="w:val"><xsl:call-template name="convert2twip"><xsl:with-param name="value" select="$row-height"/></xsl:call-template></xsl:attribute>
+ </w:trHeight>
+ </xsl:if>
+ </xsl:element>
+ <!--end of w:trPr-->
+ <xsl:apply-templates select="table:table-cell "/>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="table:table-cell ">
+ <xsl:element name="w:tc">
+ <xsl:element name="w:tcPr">
+ <!-- to caclate the table-cell width Gary.Yang -->
+ <xsl:choose>
+ <!--when the table-cell contains the sub-table -->
+ <xsl:when test="table:table/@table:is-sub-table= 'true' ">
+ <xsl:variable name="table-cell-width">
+ <xsl:call-template name="caculate-sub-table-width">
+ <xsl:with-param name="sub-table-column-node" select="table:table/table:table-column[1]"/>
+ <xsl:with-param name="total-sub-table-width" select="0"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <w:tcW w:type="dxa">
+ <xsl:attribute name="w:w"><xsl:value-of select="$table-cell-width"/></xsl:attribute>
+ </w:tcW>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- when the table-cell doesn't contain the sub-table -->
+ <xsl:variable name="table-cell-width">
+ <xsl:call-template name="caculate-table-cell-width">
+ <xsl:with-param name="table-cell-position" select="position()"/>
+ <xsl:with-param name="table-column" select="ancestor::table:table[1]/table:table-column[1]"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <w:tcW w:type="dxa">
+ <xsl:attribute name="w:w"><xsl:value-of select="$table-cell-width"/></xsl:attribute>
+ </w:tcW>
+ <!-- for performance issue, we can set w:type to auto that makes the cell width auto fit the content. -->
+ <!--w:tcW w:w="0" w:type="auto"/-->
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="@table:number-columns-spanned">
+ <w:gridSpan w:val="{@table:number-columns-spanned}"/>
+ </xsl:if>
+ <xsl:variable name="cell-style-properties" select="key('table-cell-style', @table:style-name)/style:table-cell-properties"/>
+ <xsl:if test="$cell-style-properties/@fo:background-color">
+ <w:shd w:val="solid" w:color="{substring-after($cell-style-properties/@fo:background-color,'#')}"/>
+ </xsl:if>
+ <xsl:if test="$cell-style-properties/@fo:vertical-align">
+ <xsl:choose>
+ <xsl:when test="$cell-style-properties/@fo:vertical-align = 'middle'">
+ <w:vAlign w:val="center"/>
+ </xsl:when>
+ <xsl:when test="$cell-style-properties/@fo:vertical-align = 'Automatic'">
+ <w:vAlign w:val="both"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <w:vAlign w:val="{$cell-style-properties/@fo:vertical-align}"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <w:tcMar>
+ <xsl:if test="$cell-style-properties/@fo:padding-top">
+ <w:top w:type="dxa">
+ <xsl:attribute name="w:w"><xsl:call-template name="convert2twip"><xsl:with-param name="value" select="$cell-style-properties/@fo:padding-top"/></xsl:call-template></xsl:attribute>
+ </w:top>
+ </xsl:if>
+ <xsl:if test="$cell-style-properties/@fo:padding-bottom">
+ <w:bottom w:type="dxa">
+ <xsl:attribute name="w:w"><xsl:call-template name="convert2twip"><xsl:with-param name="value" select="$cell-style-properties/@fo:padding-bottom"/></xsl:call-template></xsl:attribute>
+ </w:bottom>
+ </xsl:if>
+ <xsl:if test="$cell-style-properties/@fo:padding-left">
+ <w:left w:type="dxa">
+ <xsl:attribute name="w:w"><xsl:call-template name="convert2twip"><xsl:with-param name="value" select="$cell-style-properties/@fo:padding-left"/></xsl:call-template></xsl:attribute>
+ </w:left>
+ </xsl:if>
+ <xsl:if test="$cell-style-properties/@fo:padding-right">
+ <w:right w:type="dxa">
+ <xsl:attribute name="w:w"><xsl:call-template name="convert2twip"><xsl:with-param name="value" select="$cell-style-properties/@fo:padding-right"/></xsl:call-template></xsl:attribute>
+ </w:right>
+ </xsl:if>
+ </w:tcMar>
+ <!-- the following code is to get the cell borders if they exsits Gary.Yang-->
+ <xsl:variable name="border-top" select="$cell-style-properties/@fo:border-top | $cell-style-properties/@fo:border"/>
+ <xsl:variable name="border-bottom" select="$cell-style-properties/@fo:border-bottom | $cell-style-properties/@fo:border"/>
+ <xsl:variable name="border-left" select="$cell-style-properties/@fo:border-left | $cell-style-properties/@fo:border"/>
+ <xsl:variable name="border-right" select="$cell-style-properties/@fo:border-right | $cell-style-properties/@fo:border"/>
+ <xsl:variable name="border-line-width-top" select="$cell-style-properties/@style:border-line-width-top | $cell-style-properties/@style:border-line-width "/>
+ <xsl:variable name="border-line-width-bottom" select="$cell-style-properties/@style:border-line-width-bottom | $cell-style-properties/@style:border-line-width"/>
+ <xsl:variable name="border-line-width-left" select="$cell-style-properties/@style:border-line-width-left | $cell-style-properties/@style:border-line-width"/>
+ <xsl:variable name="border-line-width-right" select="$cell-style-properties/@style:border-line-width-right | $cell-style-properties/@style:border-line-width"/>
+ <xsl:element name="w:tcBorders">
+ <xsl:if test="$border-top">
+ <xsl:element name="w:top">
+ <xsl:call-template name="get-border">
+ <xsl:with-param name="so-border" select="$border-top"/>
+ <xsl:with-param name="so-border-line-width" select="$border-line-width-top"/>
+ <xsl:with-param name="so-border-position" select=" 'top' "/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="$border-bottom">
+ <xsl:element name="w:bottom">
+ <xsl:call-template name="get-border">
+ <xsl:with-param name="so-border" select="$border-bottom"/>
+ <xsl:with-param name="so-border-line-width" select="$border-line-width-bottom"/>
+ <xsl:with-param name="so-border-position" select=" 'bottom' "/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="$border-left">
+ <xsl:element name="w:left">
+ <xsl:call-template name="get-border">
+ <xsl:with-param name="so-border" select="$border-left"/>
+ <xsl:with-param name="so-border-line-width" select="$border-line-width-left"/>
+ <xsl:with-param name="so-border-position" select=" 'left' "/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="$border-right">
+ <xsl:element name="w:right">
+ <xsl:call-template name="get-border">
+ <xsl:with-param name="so-border" select="$border-right"/>
+ <xsl:with-param name="so-border-line-width" select="$border-line-width-right"/>
+ <xsl:with-param name="so-border-position" select=" 'right' "/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:if>
+ </xsl:element>
+ </xsl:element>
+ <xsl:if test="not (*) ">
+ <w:p/>
+ </xsl:if>
+ <xsl:apply-templates select=" text:p | table:table | text:h | office:annotation"/>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="caculate-table-cell-width">
+ <xsl:param name="table-cell-position"/>
+ <xsl:param name="table-column"/>
+ <xsl:choose>
+ <xsl:when test="$table-column/@table:number-columns-repeated">
+ <xsl:choose>
+ <xsl:when test="($table-cell-position - $table-column/@table:number-columns-repeated) &lt;= 0">
+ <xsl:variable name="table-cell-width" select="key('table-column-style', $table-column/@table:style-name)/style:table-column-properties/@style:column-width"/>
+ <xsl:variable name="table-cell-width-in-twip">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="$table-cell-width"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="$table-cell-width-in-twip"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="caculate-table-cell-width">
+ <xsl:with-param name="table-cell-position" select="$table-cell-position - $table-column/@table:number-columns-repeated"/>
+ <xsl:with-param name="table-column" select="$table-column/following-sibling::table:table-column[1]"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- if the $table-column doesn't contain the table:number-columns-repeated attribute -->
+ <xsl:choose>
+ <xsl:when test="($table-cell-position - 1) = 0">
+ <xsl:variable name="table-cell-width" select="key('table-column-style', $table-column/@table:style-name)/style:table-column-properties/@style:column-width"/>
+ <xsl:variable name="table-cell-width-in-twip">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="$table-cell-width"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="$table-cell-width-in-twip"/>
+ </xsl:when>
+ <xsl:when test="($table-cell-position - 1) &gt; 0">
+ <xsl:call-template name="caculate-table-cell-width">
+ <xsl:with-param name="table-cell-position" select=" $table-cell-position - 1 "/>
+ <xsl:with-param name="table-column" select="$table-column/following-sibling::table:table-column[1]"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>
+ <xsl:value-of select=" 'caculate table cell width wrong ' "/>
+ </xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/filter/source/xslt/export/wordml/ooo2wordml_text.xsl b/filter/source/xslt/export/wordml/ooo2wordml_text.xsl
new file mode 100644
index 000000000000..5ba97699d4fa
--- /dev/null
+++ b/filter/source/xslt/export/wordml/ooo2wordml_text.xsl
@@ -0,0 +1,1279 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw">
+ <xsl:template match="style:paragraph-properties" mode="paragraph">
+ <w:pPr>
+ <w:adjustRightInd w:val="off"/>
+ <xsl:if test="@fo:break-before = 'page'">
+ <w:pageBreakBefore w:val="on"/>
+ </xsl:if>
+ <xsl:if test="contains(@style:writing-mode, 'rl')">
+ <w:bidi/>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="@fo:text-align-last = 'start'">
+ <xsl:choose>
+ <xsl:when test="contains(@style:writing-mode, 'rl')">
+ <w:jc w:val="right"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <w:jc w:val="left"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="@fo:text-align-last = 'justify'">
+ <w:jc w:val="distribute"/>
+ </xsl:when>
+ <xsl:when test="@fo:text-align-last = 'center'">
+ <w:jc w:val="center"/>
+ </xsl:when>
+ <xsl:when test="@fo:text-align = 'start'">
+ <xsl:choose>
+ <xsl:when test="contains(@style:writing-mode, 'rl')">
+ <w:jc w:val="right"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <w:jc w:val="left"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="@fo:text-align = 'end'">
+ <xsl:choose>
+ <xsl:when test="contains(@style:writing-mode, 'rl')">
+ <w:jc w:val="left"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <w:jc w:val="right"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="@fo:text-align = 'justify'">
+ <w:jc w:val="distribute"/>
+ </xsl:when>
+ <xsl:when test="@fo:text-align = 'center'">
+ <w:jc w:val="center"/>
+ </xsl:when>
+ </xsl:choose>
+ <w:spacing>
+ <xsl:choose>
+ <xsl:when test="@fo:line-height">
+ <xsl:choose>
+ <xsl:when test="contains(@fo:line-height, '%')">
+ <xsl:attribute name="w:line-rule">auto</xsl:attribute>
+ <xsl:attribute name="w:line">
+ <xsl:value-of select="round(substring-before(@fo:line-height, '%') div 100 * 240)"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="w:line-rule">exact</xsl:attribute>
+ <xsl:attribute name="w:line">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="@fo:line-height"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="@style:line-height-at-least">
+ <xsl:attribute name="w:line-rule">at-least</xsl:attribute>
+ <xsl:attribute name="w:line">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="@style:line-height-at-least"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@style:line-spacing">
+ <xsl:attribute name="w:line-rule">auto</xsl:attribute>
+ <xsl:variable name="spacing">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="@style:line-spacing"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="w:line">
+ <xsl:value-of select="round($spacing div 0.567)"/>
+ </xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="@fo:margin-top">
+ <xsl:choose>
+ <xsl:when test="contains(@fo:margin-top, '%')">
+ <xsl:if test="../@style:parent-style-name">
+ <xsl:variable name="parent-size">
+ <xsl:value-of select="key('paragraph-style', ../@style:parent-style-name)/style:paragraph-properties/@fo:margin-top"/>
+ </xsl:variable>
+ <xsl:variable name="w-number">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="$parent-size"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="w:before">
+ <xsl:value-of select="round($w-number div 100 * substring-before(@fo:margin-top, '%'))"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="w:before">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="@fo:margin-top"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="@fo:margin-bottom">
+ <xsl:choose>
+ <xsl:when test="contains(@fo:margin-bottom, '%')">
+ <xsl:if test="../@style:parent-style-name">
+ <xsl:variable name="parent-size">
+ <xsl:value-of select="key('paragraph-style', ../@style:parent-style-name)/style:paragraph-properties/@fo:margin-bottom"/>
+ </xsl:variable>
+ <xsl:variable name="w-number">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="$parent-size"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="w:after">
+ <xsl:value-of select="round($w-number div 100 * substring-before(@fo:margin-bottom, '%'))"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="w:after">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="@fo:margin-bottom"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </w:spacing>
+ <w:ind>
+ <xsl:if test="@fo:margin-left">
+ <xsl:choose>
+ <xsl:when test="contains(@fo:margin-left, '%')">
+ <xsl:if test="../@style:parent-style-name">
+ <xsl:variable name="parent-size">
+ <xsl:value-of select="key('paragraph-style', ../@style:parent-style-name)/style:paragraph-properties/@fo:margin-left"/>
+ </xsl:variable>
+ <xsl:variable name="w-number">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="$parent-size"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="w:left">
+ <xsl:value-of select="round($w-number div 100 * substring-before(@fo:margin-left, '%'))"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="w:left">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="@fo:margin-left"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="@fo:margin-right">
+ <xsl:choose>
+ <xsl:when test="contains(@fo:margin-right, '%')">
+ <xsl:if test="../@style:parent-style-name">
+ <xsl:variable name="parent-size">
+ <xsl:value-of select="key('paragraph-style', ../@style:parent-style-name)/style:paragraph-properties/@fo:margin-right"/>
+ </xsl:variable>
+ <xsl:variable name="w-number">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="$parent-size"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="w:right">
+ <xsl:value-of select="round($w-number div 100 * substring-before(@fo:margin-right, '%'))"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="w:right">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="@fo:margin-right"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="@fo:text-indent">
+ <xsl:choose>
+ <!-- When @style:auto-text-indent='true' @fo:text-indent ignored, use 283 for all font size -->
+ <xsl:when test="@style:auto-text-indent='true'">
+ <xsl:attribute name="w:first-line">283</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="contains(@fo:text-indent, '%')">
+ <xsl:if test="../@style:parent-style-name">
+ <xsl:variable name="parent-size">
+ <xsl:value-of select="key('paragraph-style', ../@style:parent-style-name)/style:paragraph-properties/@fo:text-indent"/>
+ </xsl:variable>
+ <xsl:variable name="w-number">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="$parent-size"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$w-number &lt; 0">
+ <xsl:attribute name="w:hanging">
+ <xsl:value-of select="round($w-number div -100 * substring-before(@fo:text-indent, '%'))"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="w:first-line">
+ <xsl:value-of select="round($w-number div 100 * substring-before(@fo:text-indent, '%'))"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:when>
+ <xsl:when test="starts-with(@fo:text-indent,'-')">
+ <xsl:attribute name="w:hanging">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="substring-after(@fo:text-indent,'-')"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="w:first-line">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="@fo:text-indent"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </w:ind>
+ <xsl:if test="contains(@fo:background-color, '#')">
+ <w:shd w:val="clear" w:color="auto" w:fill="{substring-after(@fo:background-color, '#')}"/>
+ </xsl:if>
+ <xsl:if test="@fo:keep-with-next='true'">
+ <w:keepNext/>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="@fo:widows | @fo:orphans">
+ <w:widowControl w:val="on"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <w:widowControl w:val="off"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="@style:break-inside = 'avoid'">
+ <w:keepLines/>
+ </xsl:if>
+ <xsl:if test="@fo:hyphenate = 'false'">
+ <w:suppressAutoHyphens/>
+ </xsl:if>
+ <xsl:if test="@style:snap-to-layout-grid='false'">
+ <w:snapToGrid w:val="off"/>
+ </xsl:if>
+ <xsl:if test="style:tab-stops">
+ <w:tabs>
+ <xsl:for-each select="style:tab-stops/style:tab-stop">
+ <w:tab>
+ <xsl:choose>
+ <xsl:when test="@style:type='char'">
+ <xsl:attribute name="w:val">decimal</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@style:type">
+ <xsl:attribute name="w:val">
+ <xsl:value-of select="@style:type"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="w:val">left</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="@style:leader-char">
+ <xsl:choose>
+ <xsl:when test="@style:leader-char='-'">
+ <xsl:attribute name="w:leader">hyphen</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@style:leader-char='_'">
+ <xsl:attribute name="w:leader">underscore</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@style:leader-char='.'">
+ <xsl:attribute name="w:leader">dot</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="w:leader">dot</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="@style:position">
+ <xsl:attribute name="w:pos">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="@style:position"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ </w:tab>
+ </xsl:for-each>
+ </w:tabs>
+ </xsl:if>
+ <xsl:if test="@style:line-break='normal'">
+ <w:kinsoku w:val="off"/>
+ </xsl:if>
+ <xsl:if test="@style:punctuation-wrap='simple'">
+ <w:overflowPunct w:val="off"/>
+ </xsl:if>
+ <xsl:if test="@style:text-autospace='none'">
+ <w:autoSpaceDE w:val="off"/>
+ <w:autoSpaceDN w:val="off"/>
+ </xsl:if>
+ <xsl:if test="@style:vertical-align">
+ <xsl:element name="w:textAlignment">
+ <xsl:choose>
+ <xsl:when test="@style:vertical-align='middle'">
+ <xsl:attribute name="w:val">center</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="w:val">
+ <xsl:value-of select="@style:vertical-align"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="@text:number-lines='false'">
+ <w:supressLineNumbers/>
+ </xsl:if>
+ <xsl:variable name="border-top" select="@fo:border-top | @fo:border"/>
+ <xsl:variable name="border-bottom" select="@fo:border-bottom | @fo:border"/>
+ <xsl:variable name="border-left" select="@fo:border-left | @fo:border"/>
+ <xsl:variable name="border-right" select="@fo:border-right | @fo:border"/>
+ <xsl:variable name="border-line-width-top" select="@style:border-line-width-top | @style:border-line-width "/>
+ <xsl:variable name="border-line-width-bottom" select="@style:border-line-width-bottom | @style:border-line-width"/>
+ <xsl:variable name="border-line-width-left" select="@style:border-line-width-left | @style:border-line-width"/>
+ <xsl:variable name="border-line-width-right" select="@style:border-line-width-right | @style:border-line-width"/>
+ <xsl:variable name="padding-top" select="@fo:padding-top | @fo:padding"/>
+ <xsl:variable name="padding-bottom" select="@fo:padding-bottom | @fo:padding"/>
+ <xsl:variable name="padding-left" select="@fo:padding-left | @fo:padding"/>
+ <xsl:variable name="padding-right" select="@fo:padding-right | @fo:padding"/>
+ <w:pBdr>
+ <xsl:if test="$border-top">
+ <xsl:element name="w:top">
+ <xsl:call-template name="get-border">
+ <xsl:with-param name="so-border" select="$border-top"/>
+ <xsl:with-param name="so-border-line-width" select="$border-line-width-top"/>
+ <xsl:with-param name="so-border-position" select=" 'top' "/>
+ </xsl:call-template>
+ <xsl:attribute name="w:space">
+ <xsl:call-template name="convert2pt">
+ <xsl:with-param name="value" select="$padding-top"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:if test="@style:shadow!='none'">
+ <xsl:attribute name="w:shadow">on</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="$border-bottom">
+ <xsl:element name="w:bottom">
+ <xsl:call-template name="get-border">
+ <xsl:with-param name="so-border" select="$border-bottom"/>
+ <xsl:with-param name="so-border-line-width" select="$border-line-width-bottom"/>
+ <xsl:with-param name="so-border-position" select=" 'bottom' "/>
+ </xsl:call-template>
+ <xsl:attribute name="w:space">
+ <xsl:call-template name="convert2pt">
+ <xsl:with-param name="value" select="$padding-bottom"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:if test="@style:shadow!='none'">
+ <xsl:attribute name="w:shadow">on</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="$border-left">
+ <xsl:element name="w:left">
+ <xsl:call-template name="get-border">
+ <xsl:with-param name="so-border" select="$border-left"/>
+ <xsl:with-param name="so-border-line-width" select="$border-line-width-left"/>
+ <xsl:with-param name="so-border-position" select=" 'left' "/>
+ </xsl:call-template>
+ <xsl:attribute name="w:space">
+ <xsl:call-template name="convert2pt">
+ <xsl:with-param name="value" select="$padding-left"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:if test="@style:shadow!='none'">
+ <xsl:attribute name="w:shadow">on</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="$border-right">
+ <xsl:element name="w:right">
+ <xsl:call-template name="get-border">
+ <xsl:with-param name="so-border" select="$border-right"/>
+ <xsl:with-param name="so-border-line-width" select="$border-line-width-right"/>
+ <xsl:with-param name="so-border-position" select=" 'right' "/>
+ </xsl:call-template>
+ <xsl:attribute name="w:space">
+ <xsl:call-template name="convert2pt">
+ <xsl:with-param name="value" select="$padding-right"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:if test="@style:shadow!='none'">
+ <xsl:attribute name="w:shadow">on</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="@style:shadow!='none' and not(@fo:border-top | @fo:border-bottom | @fo:border-left | @fo:border-right | @fo:border)">
+ <xsl:element name="w:right">
+ <xsl:attribute name="w:shadow">on</xsl:attribute>
+ <xsl:attribute name="w:val">single</xsl:attribute>
+ <xsl:variable name="shadow-size">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="substring-after(substring-after(@style:shadow, ' '), ' ')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="w:sz">
+ <xsl:choose>
+ <xsl:when test="$shadow-size &lt;= 0.08">12</xsl:when>
+ <xsl:when test="$shadow-size &lt;= 0.14">18</xsl:when>
+ <xsl:when test="$shadow-size &lt;= 0.20">24</xsl:when>
+ <xsl:when test="$shadow-size &lt;= 0.25">36</xsl:when>
+ <xsl:otherwise>48</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:element>
+ <xsl:element name="w:bottom">
+ <xsl:attribute name="w:shadow">on</xsl:attribute>
+ <xsl:attribute name="w:val">single</xsl:attribute>
+ <xsl:variable name="shadow-size">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="substring-after(substring-after(@style:shadow, ' '), ' ')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="w:sz">
+ <xsl:choose>
+ <xsl:when test="$shadow-size &lt;= 0.08">12</xsl:when>
+ <xsl:when test="$shadow-size &lt;= 0.14">18</xsl:when>
+ <xsl:when test="$shadow-size &lt;= 0.20">24</xsl:when>
+ <xsl:when test="$shadow-size &lt;= 0.25">36</xsl:when>
+ <xsl:otherwise>48</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ </w:pBdr>
+ <w:ind>
+ <xsl:if test="$padding-left!=''">
+ <xsl:attribute name="w:left">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="$padding-left"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$padding-right!='' ">
+ <xsl:attribute name="w:right">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="$padding-right"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ </w:ind>
+ <xsl:variable name="stylename">
+ <xsl:value-of select="../@style:name"/>
+ </xsl:variable>
+ <xsl:if test="/office:document/office:body//text:h[@text:style-name = $stylename]">
+ <xsl:variable name="headinglevel">
+ <xsl:value-of select="/office:document/office:body//text:h[@text:style-name = $stylename]/@text:level"/>
+ </xsl:variable>
+ <xsl:if test="/office:document/office:styles/text:outline-style/text:outline-level-style[@text:level = $headinglevel]">
+ <w:listPr>
+ <w:ilvl w:val="{$headinglevel -1}"/>
+ <w:ilfo w:val="1"/>
+ </w:listPr>
+ </xsl:if>
+ </xsl:if>
+ </w:pPr>
+ </xsl:template>
+ <xsl:template match="style:text-properties" mode="character">
+ <w:rPr>
+ <xsl:if test="@svg:font-family | @style:font-name | @style:font-name-asian | @style:font-name-complex">
+ <w:rFonts>
+ <xsl:variable name="fontname">
+ <xsl:choose>
+ <xsl:when test='starts-with(@svg:font-family,"&apos;")'>
+ <xsl:value-of select='substring-before(substring-after(@svg:font-family,"&apos;"),"&apos;")'/>
+ </xsl:when>
+ <xsl:when test="@svg:font-family">
+ <xsl:value-of select="@svg:font-family"/>
+ </xsl:when>
+ <xsl:when test="@style:font-name">
+ <xsl:value-of select="@style:font-name"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="string-length($fontname)!=0">
+ <xsl:attribute name="w:ascii">
+ <xsl:value-of select="$fontname"/>
+ </xsl:attribute>
+ <xsl:attribute name="w:h-ansi">
+ <xsl:value-of select="$fontname"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@style:font-name-asian">
+ <xsl:attribute name="w:fareast">
+ <xsl:value-of select="@style:font-name-asian"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@style:font-name-complex">
+ <xsl:attribute name="w:cs">
+ <xsl:value-of select="@style:font-name-complex"/>
+ </xsl:attribute>
+ </xsl:if>
+ </w:rFonts>
+ </xsl:if>
+ <!-- relative font sizes not supported yet. -->
+ <xsl:if test="contains(@fo:font-size, 'pt')">
+ <w:sz w:val="{substring-before(@fo:font-size,'pt') * 2}"/>
+ </xsl:if>
+ <xsl:if test="contains(@fo:font-size-complex, 'pt')">
+ <w:sz-cs w:val="{substring-before(@fo:font-size-complex, 'pt') * 2}"/>
+ </xsl:if>
+ <xsl:if test="@fo:font-style = 'italic' or @fo:font-style-asian = 'italic'">
+ <w:i/>
+ </xsl:if>
+ <xsl:if test="@fo:font-style-complex = 'italic'">
+ <w:i-cs/>
+ </xsl:if>
+ <xsl:if test="@fo:font-weight = 'bold' or @fo:font-weight-asian = 'bold'">
+ <w:b/>
+ </xsl:if>
+ <xsl:if test="@fo:font-weight-complex = 'bold'">
+ <w:b-cs/>
+ </xsl:if>
+ <xsl:if test="@style:text-underline-style">
+ <w:u>
+ <xsl:variable name="w-u">
+ <xsl:choose>
+ <xsl:when test="@style:text-underline-style = 'solid'">
+ <xsl:choose>
+ <xsl:when test="@style:text-underline-type = 'double'">double</xsl:when>
+ <xsl:when test="@style:text-underline-width = 'bold'">thick</xsl:when>
+ <xsl:otherwise>single</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="@style:text-underline-style = 'dotted'">
+ <xsl:choose>
+ <xsl:when test="@style:text-underline-type = 'double'">dotted-double</xsl:when>
+ <xsl:when test="@style:text-underline-width = 'bold'">dotted-heavy</xsl:when>
+ <xsl:otherwise>dotted</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="@style:text-underline-style = 'dash'">
+ <xsl:choose>
+ <xsl:when test="@style:text-underline-type = 'double'">dashed-double</xsl:when>
+ <xsl:when test="@style:text-underline-width = 'bold'">dashed-heavy</xsl:when>
+ <xsl:otherwise>dash</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="@style:text-underline-style = 'long-dash'">
+ <xsl:choose>
+ <xsl:when test="@style:text-underline-type = 'double'">dash-long-double</xsl:when>
+ <xsl:when test="@style:text-underline-width = 'bold'">dash-long-heavy</xsl:when>
+ <xsl:otherwise>dash-long</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="@style:text-underline-style = 'dot-dash'">
+ <xsl:choose>
+ <xsl:when test="@style:text-underline-type = 'double'">dot-dash-double</xsl:when>
+ <xsl:when test="@style:text-underline-width = 'bold'">dash-dot-heavy</xsl:when>
+ <xsl:otherwise>dot-dash</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="@style:text-underline-style = 'dot-dot-dash'">
+ <xsl:choose>
+ <xsl:when test="@style:text-underline-type = 'double'">dot-dot-dash-double</xsl:when>
+ <xsl:when test="@style:text-underline-width = 'bold'">dash-dot-dot-heavy</xsl:when>
+ <xsl:otherwise>dot-dot-dash</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="@style:text-underline-style = 'wave'">
+ <xsl:choose>
+ <xsl:when test="@style:text-underline-type = 'double'">wavy-double</xsl:when>
+ <xsl:when test="@style:text-underline-width = 'bold'">wavy-heavy</xsl:when>
+ <xsl:otherwise>wave</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="@style:text-underline-style"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="w:val">
+ <xsl:value-of select="$w-u"/>
+ </xsl:attribute>
+ <xsl:if test="contains(@style:text-underline-color,'#')">
+ <xsl:attribute name="w:color">
+ <xsl:value-of select="substring-after(@style:text-underline-color,'#')"/>
+ </xsl:attribute>
+ </xsl:if>
+ </w:u>
+ </xsl:if>
+ <xsl:if test="@style:text-shadow | @fo:text-shadow">
+ <w:shadow/>
+ </xsl:if>
+ <xsl:if test="string-length(@style:text-line-through-style) &gt; 0">
+ <xsl:choose>
+ <xsl:when test="@style:text-line-through-type = 'double'">
+ <w:dstrike/>
+ </xsl:when>
+ <xsl:when test="@style:text-line-through-style = 'solid'">
+ <w:strike/>
+ </xsl:when>
+ <xsl:otherwise>
+ <w:strike/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="@fo:color">
+ <w:color>
+ <xsl:choose>
+ <xsl:when test="@fo:color != '#000000'">
+ <xsl:attribute name="w:val">
+ <xsl:value-of select="substring-after(@fo:color,'#')"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="w:val">auto</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </w:color>
+ </xsl:if>
+ <xsl:if test="@fo:font-variant = 'small-caps'">
+ <w:smallCaps/>
+ </xsl:if>
+ <xsl:if test="@fo:text-transform = 'uppercase'">
+ <w:caps/>
+ </xsl:if>
+ <xsl:if test="@style:font-relief = 'engraved'">
+ <w:imprint/>
+ </xsl:if>
+ <xsl:if test="@style:font-relief = 'embossed'">
+ <w:emboss/>
+ </xsl:if>
+ <xsl:if test="@style:text-outline = 'true'">
+ <w:outline/>
+ </xsl:if>
+ <xsl:if test="contains(@style:text-scale,'%')">
+ <w:w w:val="{substring-before(@style:text-scale,'%')}"/>
+ </xsl:if>
+ <xsl:if test="@style:text-emphasize">
+ <w:em>
+ <xsl:choose>
+ <xsl:when test="contains(@style:text-emphasize, 'accent')">
+ <xsl:attribute name="w:val">comma</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="contains(@style:text-emphasize, 'disc')">
+ <xsl:attribute name="w:val">under-dot</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="contains(@style:text-emphasize, 'none')">
+ <xsl:attribute name="w:val">none</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="contains(@style:text-emphasize, 'dot below')">
+ <xsl:attribute name="w:val">under-dot</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="contains(@style:text-emphasize, 'dot above')">
+ <xsl:attribute name="w:val">dot</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="contains(@style:text-emphasize, 'circle')">
+ <xsl:attribute name="w:val">dot</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </w:em>
+ </xsl:if>
+ <xsl:if test="@fo:letter-spacing != 'normal'">
+ <w:spacing>
+ <xsl:attribute name="w:val">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="@fo:letter-spacing"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </w:spacing>
+ </xsl:if>
+ <xsl:if test="@style:text-blinking = 'true'">
+ <w:effect w:val="blink-background"/>
+ </xsl:if>
+ <xsl:if test="@fo:language | @fo:language-asian | @fo:language-complex">
+ <w:lang>
+ <xsl:if test="@fo:language and @fo:country">
+ <xsl:attribute name="w:val">
+ <xsl:value-of select="concat(@fo:language, '-', @fo:country)"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@fo:language-asian and @fo:country-asian">
+ <xsl:attribute name="w:fareast">
+ <xsl:value-of select="concat(@fo:language-asian, '-', @fo:country-asian)"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@fo:language-complex and @fo:language-complex">
+ <xsl:attribute name="w:bidi">
+ <xsl:value-of select="concat(@fo:language-complex, '-', @fo:language-complex)"/>
+ </xsl:attribute>
+ </xsl:if>
+ </w:lang>
+ </xsl:if>
+ <xsl:if test="@style:text-position">
+ <xsl:variable name="position">
+ <xsl:choose>
+ <xsl:when test="starts-with(@style:text-position, 'super')">superscript_0</xsl:when>
+ <xsl:when test="starts-with(@style:text-position, 'sub')">subscript_0</xsl:when>
+ <xsl:when test="starts-with(@style:text-position, '-')">
+ <xsl:value-of select="concat('subscript_', substring-before(@style:text-position,'%'))"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat('superscript_', substring-before(@style:text-position,'%'))"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <w:vertAlign>
+ <xsl:attribute name="w:val">
+ <xsl:value-of select="substring-before($position,'_')"/>
+ </xsl:attribute>
+ </w:vertAlign>
+ <!-- Raised/Lowed position is difficult to map to MSWord w:position, Writer use %, but Word use half-point(not relative position). Since it's difficult to get font-size, use 12pt as default font-size -->
+ <w:position>
+ <xsl:attribute name="w:val">
+ <xsl:choose>
+ <xsl:when test="substring-after($position, '_') = 0">0</xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="round(substring-after($position, '_') div 6)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </w:position>
+ </xsl:if>
+ <xsl:if test="@text:display = 'true'">
+ <w:vanish/>
+ </xsl:if>
+ <xsl:if test="contains(@fo:background-color, '#')">
+ <w:shd w:val="clear" w:color="auto" w:fill="{substring-after(@fo:background-color, '#')}"/>
+ </xsl:if>
+ </w:rPr>
+ </xsl:template>
+ <xsl:template match="text:p | text:h">
+ <w:p>
+ <w:pPr>
+ <xsl:if test="@text:style-name">
+ <w:pStyle w:val="{@text:style-name}"/>
+ </xsl:if>
+ <xsl:if test="@text:level">
+ <w:outlineLvl w:val="{@text:level - 1}"/>
+ </xsl:if>
+ <xsl:variable name="following-paragraph-heading-table" select="following::*[(name()= 'text:p' or name()= 'text:h' or name()= 'table:table')]"/>
+ <xsl:variable name="following-section" select="following::text:section[1]"/>
+ <xsl:variable name="ancestor-section" select="ancestor::text:section"/>
+ <!-- if the following neighbour paragraph/heading are slave of one master style, or new section starts,
+ then a new page will start -->
+ <xsl:variable name="next-is-new-page" select="boolean(key( 'slave-style', $following-paragraph-heading-table[1]/@*[name()='text:style-name' or name()='table:style-name']))"/>
+ <xsl:variable name="next-is-new-section">
+ <xsl:if test="$following-section and generate-id($following-section/descendant::*[(name()= 'text:p' or name()= 'text:h' or name()= 'table:table') and position() =1]) = generate-id($following-paragraph-heading-table[1])">
+ <xsl:value-of select="'yes'"/>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:variable name="next-is-section-end">
+ <xsl:if test="$ancestor-section and generate-id($ancestor-section[1]/following::*[(name()= 'text:p' or name()= 'text:h' or name()= 'table:table') and position() =1]) = generate-id($following-paragraph-heading-table[1])">
+ <xsl:value-of select="'yes'"/>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:if test="ancestor::office:body and not(ancestor::text:footnote or ancestor::text:endnote) and ($next-is-new-page or $next-is-new-section = 'yes' or $next-is-section-end = 'yes')">
+ <w:sectPr>
+ <xsl:apply-templates select="/office:document/office:styles/text:footnotes-configuration">
+ <xsl:with-param name="within-section" select="'yes'"/>
+ </xsl:apply-templates>
+ <xsl:apply-templates select="/office:document/office:styles/text:endnotes-configuration">
+ <xsl:with-param name="within-section" select="'yes'"/>
+ </xsl:apply-templates>
+ <xsl:choose>
+ <xsl:when test="key( 'slave-style', @*[name()='text:style-name' or name()='table:style-name'])">
+ <xsl:apply-templates select="key('master-page', key( 'slave-style', @*[name()='text:style-name' or name()='table:style-name'])[1]/@style:master-page-name)"/>
+ <xsl:if test="$ancestor-section">
+ <xsl:apply-templates select="key('section-style',$ancestor-section[1]/@text:style-name)" mode="section">
+ <xsl:with-param name="master-page" select="key( 'page-layout', key('master-page', key( 'slave-style', @*[name()='text:style-name' or name()='table:style-name'])[1]/@style:master-page-name)/@style:page-layout-name)"/>
+ </xsl:apply-templates>
+ </xsl:if>
+ <xsl:if test="key( 'slave-style', @*[name()='text:style-name' or name()='table:style-name'])/style:paragraph-properties/@style:page-number">
+ <!-- in M$ word the header and footer associate with the w:sectPr, but in StarOffice writer the header and footer associate with the style:master-page -->
+ <xsl:variable name="pagenumber_start">
+ <xsl:value-of select=" key( 'slave-style', @*[name()='text:style-name' or name()='table:style-name'])/style:paragraph-properties/@style:page-number"/>
+ </xsl:variable>
+ <xsl:if test=" number($pagenumber_start) &gt; 0 ">
+ <w:pgNumType w:start="{$pagenumber_start}"/>
+ </xsl:if>
+ <!-- comment out the below line to enable the header and footer display normally when style:page-number =0 -->
+ <!--w:pgNumType w:start="{key( 'slave-style', @*[name()='text:style-name' or name()='table:style-name'])/style:paragraph-properties/@style:page-number}"/ -->
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="preceding-style" select="preceding::*[(name()= 'text:p' or name()= 'text:h' or name()= 'table:table') and key( 'slave-style', @*[name()='text:style-name' or name()='table:style-name'])]"/>
+ <xsl:choose>
+ <xsl:when test="$preceding-style">
+ <xsl:apply-templates select="key('master-page', key( 'slave-style', $preceding-style[1]/@*[name()='text:style-name' or name()='table:style-name'])[1]/@style:master-page-name)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="/office:document/office:master-styles/style:master-page[1]"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="$ancestor-section">
+ <xsl:choose>
+ <xsl:when test="$preceding-style">
+ <xsl:apply-templates select="key('section-style',$ancestor-section[1]/@text:style-name)" mode="section">
+ <xsl:with-param name="master-page" select="key( 'page-layout', key('master-page', key( 'slave-style', $preceding-style[1]/@*[name()='text:style-name' or name()='table:style-name'])[1]/@style:master-page-name)/@style:page-layout-name)"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="key('section-style',$ancestor-section[1]/@text:style-name)" mode="section">
+ <xsl:with-param name="master-page" select="/office:document/office:automatic-styles/style:page-layout[1]"/>
+ </xsl:apply-templates>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </w:sectPr>
+ </xsl:if>
+ <!-- add for office:annotation style G.Y. -->
+ <xsl:if test="name(..)= 'office:annotation' ">
+ <w:pStyle w:val="CommentText"/>
+ </xsl:if>
+ <!-- add by wym for listPr -->
+ <xsl:if test="ancestor::text:ordered-list | ancestor::text:unordered-list | ancestor::text:list">
+ <xsl:variable name="listname">
+ <xsl:value-of select="ancestor::text:ordered-list/@text:style-name | ancestor::text:unordered-list/@text:style-name | ancestor::text:list/@text:style-name"/>
+ </xsl:variable>
+ <xsl:variable name="currlevel">
+ <xsl:value-of select="count(ancestor::text:list-item|ancestor::text:list-header)"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="string-length($listname)!=0 and $currlevel &lt; 10">
+ <xsl:variable name="currlist">
+ <xsl:apply-templates select="key('list-style', $listname)" mode="count"/>
+ </xsl:variable>
+ <w:listPr>
+ <w:ilvl w:val="{number($currlevel)-1}"/>
+ <w:ilfo w:val="{$currlist}"/>
+ </w:listPr>
+ </xsl:when>
+ <xsl:when test="string-length($listname)!=0">
+ <xsl:for-each select="key('list-style', $listname)">
+ <xsl:variable name="spacebefore">
+ <xsl:choose>
+ <xsl:when test="*[@text:level=$currlevel]/style:list-level-properties/@text:space-before">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="*[@text:level=$currlevel]/style:list-level-properties/@text:space-before"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="space2text">
+ <xsl:choose>
+ <xsl:when test="*[@text:level=$currlevel]/style:list-level-properties/@text:min-label-width">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="*[@text:level=$currlevel]/style:list-level-properties/@text:min-label-width"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <w:ind w:left="{number($space2text)+number($spacebefore)}" w:hanging="{$space2text}"/>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <w:listPr>
+ <w:ilvl w:val="{number($currlevel)-1}"/>
+ <w:ilfo w:val="1"/>
+ </w:listPr>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <!-- end of listPr -->
+ </w:pPr>
+ <!-- get break column from style -->
+ <xsl:variable name="style" select="key('paragraph-style', @text:style-name)/style:paragraph-properties"/>
+ <xsl:if test="$style/@fo:break-before = 'column'">
+ <w:r>
+ <w:br w:type="column"/>
+ </w:r>
+ </xsl:if>
+ <xsl:if test="parent::office:text and not(preceding-sibling::text:p)">
+ <xsl:call-template name="PageLevelGraphic"/>
+ </xsl:if>
+ <xsl:if test="parent::text:footnote-body and not(preceding-sibling::*)">
+ <w:r>
+ <w:rPr>
+ <w:rStyle w:val="{/office:document/office:styles/text:footnotes-configuration/@text:citation-style-name}"/>
+ </w:rPr>
+ <xsl:choose>
+ <xsl:when test="../../text:footnote-citation/@text:label">
+ <w:t>
+ <xsl:value-of select="../../text:footnote-citation/@text:label"/>
+ </w:t>
+ </xsl:when>
+ <xsl:otherwise>
+ <w:footnoteRef/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </w:r>
+ <w:r>
+ <w:tab/>
+ </w:r>
+ </xsl:if>
+ <xsl:if test="parent::text:endnote-body and not(preceding-sibling::*)">
+ <w:r>
+ <w:rPr>
+ <w:rStyle w:val="{/office:document/office:styles/text:endnotes-configuration/@text:citation-style-name}"/>
+ </w:rPr>
+ <xsl:choose>
+ <xsl:when test="../../text:endnote-citation/@text:label">
+ <w:t>
+ <xsl:value-of select="../../text:endnote-citation/@text:label"/>
+ </w:t>
+ </xsl:when>
+ <xsl:otherwise>
+ <w:endnoteRef/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </w:r>
+ <w:r>
+ <w:tab/>
+ </w:r>
+ </xsl:if>
+ <!-- newly added the endnote , footnote templates -->
+ <xsl:if test="../../@text:note-class='endnote' and not(preceding-sibling::*)">
+ <xsl:message>
+ <xsl:value-of select=" 'enter into ext:note-class= endnote' "/>
+ </xsl:message>
+ <w:r>
+ <w:rPr>
+ <w:rStyle w:val="Endnote_20_Symbol"/>
+ </w:rPr>
+ <xsl:choose>
+ <xsl:when test="../../text:note-citation/@text:label">
+ <w:t>
+ <xsl:value-of select="../../text:note-citation/@text:label"/>
+ </w:t>
+ </xsl:when>
+ <xsl:otherwise>
+ <w:footnoteRef/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </w:r>
+ <w:r>
+ <w:tab/>
+ </w:r>
+ </xsl:if>
+ <xsl:if test="../../@text:note-class='footnote' and not(preceding-sibling::*)">
+ <xsl:message>
+ <xsl:value-of select=" 'enter into ext:note-class= footnote' "/>
+ </xsl:message>
+ <w:r>
+ <w:rPr>
+ <w:rStyle w:val="Footnote_20_Symbol"/>
+ </w:rPr>
+ <xsl:choose>
+ <xsl:when test="../../text:note-citation/@text:label">
+ <w:t>
+ <xsl:value-of select="../../text:note-citation/@text:label"/>
+ </w:t>
+ </xsl:when>
+ <xsl:otherwise>
+ <w:footnoteRef/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </w:r>
+ <w:r>
+ <w:tab/>
+ </w:r>
+ </xsl:if>
+ <!-- apply inline-text-elements, many many many ... :( glu -->
+ <xsl:apply-templates select="text:a | text:span | text() | text:hidden-text | text:line-break | text:tab-stop
+ | text:s | text:note | draw:*
+ | text:page-number | text:page-count | text:subject | text:initial-creator | text:title | text:date | text:time
+ | text:author-name | text:author-initials | text:chapter | text:file-name | text:sender-company
+ | text:sender-firstname | text:sender-lastname | text:sender-initials | text:sender-street
+ | text:sender-country | text:sender-postal-code | text:sender-city | text:sender-title | text:sender-position
+ | text:sender-phone-private | text:sender-phone-work | text:sender-email | text:sender-fax
+ | text:sender-state-or-province | text:word-count | text:paragraph-count | text:character-count
+ | text:table-count | text:image-count | text:object-count | text:template-name | text:description
+ | text:creation-time | text:creation-date | text:editing-cycles | text:editing-duration | text:keywords
+ | text:print-time | text:print-date | text:creator | text:modification-time | text:modification-date
+ | text:user-defined | text:printed-by | text:hidden-paragraph | text:placeholder | text:drop-down
+ | text:conditional-text | text:text-input | text:execute-macro | text:variable-set | text:variable-input
+ | text:user-field-input | text:variable-get | text:user-field-get | text:sequence | text:page-variable-set
+ | text:page-variable-get | text:table-formula | text:database-display | text:database-next
+ | text:database-select | text:database-row-number | text:database-name | text:reference-ref
+ | text:bookmark-ref | text:footnote-ref | text:endnote-ref | text:sequence-ref | text:expression
+ | text:measure | text:dde-connection | text:sheet-name | text:bibliography-mark | text:script
+ | text:page-continuation | office:annotation | text:bookmark-start | text:bookmark-end | text:bookmark
+ "/>
+ <!-- comment out the following line to replace the text:footnote , text:endnote with text:note in OASIS format -->
+ <!--xsl:apply-templates select="text:a | text:span | text() | text:hidden-text | text:line-break | text:tab-stop
+ | text:s | text:footnote | text:endnote | draw:*
+ | text:page-number | text:page-count | text:subject | text:initial-creator | text:title | text:date | text:time
+ | text:author-name | text:author-initials | text:chapter | text:file-name | text:sender-company
+ | text:sender-firstname | text:sender-lastname | text:sender-initials | text:sender-street
+ | text:sender-country | text:sender-postal-code | text:sender-city | text:sender-title | text:sender-position
+ | text:sender-phone-private | text:sender-phone-work | text:sender-email | text:sender-fax
+ | text:sender-state-or-province | text:word-count | text:paragraph-count | text:character-count
+ | text:table-count | text:image-count | text:object-count | text:template-name | text:description
+ | text:creation-time | text:creation-date | text:editing-cycles | text:editing-duration | text:keywords
+ | text:print-time | text:print-date | text:creator | text:modification-time | text:modification-date
+ | text:user-defined | text:printed-by | text:hidden-paragraph | text:placeholder | text:drop-down
+ | text:conditional-text | text:text-input | text:execute-macro | text:variable-set | text:variable-input
+ | text:user-field-input | text:variable-get | text:user-field-get | text:sequence | text:page-variable-set
+ | text:page-variable-get | text:table-formula | text:database-display | text:database-next
+ | text:database-select | text:database-row-number | text:database-name | text:reference-ref
+ | text:bookmark-ref | text:footnote-ref | text:endnote-ref | text:sequence-ref | text:expression
+ | text:measure | text:dde-connection | text:sheet-name | text:bibliography-mark | text:script
+ | text:page-continuation | office:annotation | text:bookmark-start | text:bookmark-end | text:bookmark
+ "/-->
+ <xsl:if test="$style/@fo:break-after">
+ <w:r>
+ <w:br w:type="{$style/@fo:break-after}"/>
+ </w:r>
+ </xsl:if>
+ </w:p>
+ </xsl:template>
+ <xsl:template match="text:span">
+ <!-- apply inline-text-elements, many many many ... :( glu -->
+ <xsl:apply-templates select="text:a | text() | text:hidden-text | text:line-break | text:tab-stop | text:s
+ | text:note
+ | text:page-number | text:page-count | text:subject | text:initial-creator | text:title | text:date | text:time
+ | text:author-name | text:author-initials | text:chapter | text:file-name | text:sender-company
+ | text:sender-firstname | text:sender-lastname | text:sender-initials | text:sender-street
+ | text:sender-country | text:sender-postal-code | text:sender-city | text:sender-title | text:sender-position
+ | text:sender-phone-private | text:sender-phone-work | text:sender-email | text:sender-fax
+ | text:sender-state-or-province | text:word-count | text:paragraph-count | text:character-count
+ | text:table-count | text:image-count | text:object-count | text:template-name | text:description
+ | text:creation-time | text:creation-date | text:editing-cycles | text:editing-duration | text:keywords
+ | text:print-time | text:print-date | text:creator | text:modification-time | text:modification-date
+ | text:user-defined | text:printed-by | text:hidden-paragraph | text:placeholder | text:drop-down
+ | text:conditional-text | text:text-input | text:execute-macro | text:variable-set | text:variable-input
+ | text:user-field-input | text:variable-get | text:user-field-get | text:sequence | text:page-variable-set
+ | text:page-variable-get | text:table-formula | text:database-display | text:database-next
+ | text:database-select | text:database-row-number | text:database-name | text:reference-ref
+ | text:bookmark-ref | text:footnote-ref | text:endnote-ref | text:sequence-ref | text:expression
+ | text:measure | text:dde-connection | text:sheet-name | text:bibliography-mark | text:script
+ | text:page-continuation | office:annotation | text:bookmark-start | text:bookmark-end | text:bookmark
+"/>
+ <!-- comment out the following line to replace the text:footnote , text:endnote with text:note in OASIS format -->
+ <!-- xsl:apply-templates select="text:a | text() | text:hidden-text | text:line-break | text:tab-stop | text:s
+ | text:footnote | text:endnote
+ | text:page-number | text:page-count | text:subject | text:initial-creator | text:title | text:date | text:time
+ | text:author-name | text:author-initials | text:chapter | text:file-name | text:sender-company
+ | text:sender-firstname | text:sender-lastname | text:sender-initials | text:sender-street
+ | text:sender-country | text:sender-postal-code | text:sender-city | text:sender-title | text:sender-position
+ | text:sender-phone-private | text:sender-phone-work | text:sender-email | text:sender-fax
+ | text:sender-state-or-province | text:word-count | text:paragraph-count | text:character-count
+ | text:table-count | text:image-count | text:object-count | text:template-name | text:description
+ | text:creation-time | text:creation-date | text:editing-cycles | text:editing-duration | text:keywords
+ | text:print-time | text:print-date | text:creator | text:modification-time | text:modification-date
+ | text:user-defined | text:printed-by | text:hidden-paragraph | text:placeholder | text:drop-down
+ | text:conditional-text | text:text-input | text:execute-macro | text:variable-set | text:variable-input
+ | text:user-field-input | text:variable-get | text:user-field-get | text:sequence | text:page-variable-set
+ | text:page-variable-get | text:table-formula | text:database-display | text:database-next
+ | text:database-select | text:database-row-number | text:database-name | text:reference-ref
+ | text:bookmark-ref | text:footnote-ref | text:endnote-ref | text:sequence-ref | text:expression
+ | text:measure | text:dde-connection | text:sheet-name | text:bibliography-mark | text:script
+ | text:page-continuation | office:annotation | text:bookmark-start | text:bookmark-end | text:bookmark
+"/-->
+ </xsl:template>
+ <xsl:template match="text()">
+ <xsl:if test="string-length(normalize-space(.)) &gt; 0">
+ <w:r>
+ <xsl:if test="parent::text:span">
+ <w:rPr>
+ <w:rStyle w:val="{parent::text:span/@text:style-name}"/>
+ </w:rPr>
+ </xsl:if>
+ <w:t>
+ <xsl:value-of select="."/>
+ </w:t>
+ </w:r>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="text:hidden-text">
+ <w:r>
+ <w:rPr>
+ <xsl:if test="parent::text:span">
+ <w:rStyle w:val="{parent::text:span/@text:style-name}"/>
+ </xsl:if>
+ <w:vanish/>
+ </w:rPr>
+ <w:t>
+ <xsl:value-of select="@text:string-value"/>
+ </w:t>
+ </w:r>
+ </xsl:template>
+ <xsl:template match="text:line-break">
+ <w:r>
+ <xsl:if test="parent::text:span">
+ <w:rPr>
+ <w:rStyle w:val="{parent::text:span/@text:style-name}"/>
+ </w:rPr>
+ </xsl:if>
+ <w:br w:type="text-wrapping" w:clear="all"/>
+ </w:r>
+ </xsl:template>
+ <xsl:template match="text:tab-stop">
+ <w:r>
+ <xsl:if test="parent::text:span">
+ <w:rPr>
+ <w:rStyle w:val="{parent::text:span/@text:style-name}"/>
+ </w:rPr>
+ </xsl:if>
+ <w:tab/>
+ </w:r>
+ </xsl:template>
+ <xsl:template match="text:s">
+ <w:r>
+ <xsl:if test="parent::text:span">
+ <w:rPr>
+ <w:rStyle w:val="{parent::text:span/@text:style-name}"/>
+ </w:rPr>
+ </xsl:if>
+ <w:t>
+ <xsl:if test="@text:c">
+ <xsl:call-template name="add-space">
+ <xsl:with-param name="number" select="@text:c"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:text> </xsl:text>
+ </w:t>
+ </w:r>
+ </xsl:template>
+ <xsl:template name="add-space">
+ <xsl:param name="number"/>
+ <xsl:if test="$number &gt; 1">
+ <xsl:call-template name="add-space">
+ <xsl:with-param name="number" select="$number - 1"/>
+ </xsl:call-template>
+ <xsl:text> </xsl:text>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="text:footnote">
+ <w:r>
+ <w:rPr>
+ <w:rStyle w:val="{/office:document/office:styles/text:footnotes-configuration/@text:citation-body-style-name}"/>
+ </w:rPr>
+ <xsl:apply-templates select="text:footnote-body"/>
+ </w:r>
+ </xsl:template>
+ <xsl:template match="text:footnote-body">
+ <w:footnote>
+ <xsl:if test="../text:footnote-citation/@text:label">
+ <xsl:attribute name="w:suppressRef">on</xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates select="text:h | text:p | text:ordered-list | text:unordered-list | text:list"/>
+ </w:footnote>
+ </xsl:template>
+ <xsl:template match="text:endnote">
+ <w:r>
+ <w:rPr>
+ <w:rStyle w:val="{/office:document/office:styles/text:endnotes-configuration/@text:citation-body-style-name}"/>
+ </w:rPr>
+ <xsl:apply-templates select="text:endnote-body"/>
+ </w:r>
+ </xsl:template>
+ <xsl:template match="text:endnote-body">
+ <w:endnote>
+ <xsl:if test="../text:endnote-citation/@text:label">
+ <xsl:attribute name="w:suppressRef">on</xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates select="text:h | text:p | text:ordered-list | text:unordered-list | text:list"/>
+ </w:endnote>
+ </xsl:template>
+ <xsl:template match="text:bookmark-start">
+ <xsl:variable name="bookmark-id">
+ <xsl:number from="/office:document/office:body" count="text:bookmark | text:bookmark-start" level="any" format="1"/>
+ </xsl:variable>
+ <aml:annotation aml:id="{$bookmark-id}" w:type="Word.Bookmark.Start" w:name="{@text:name}"/>
+ </xsl:template>
+ <xsl:template match="text:bookmark-end">
+ <xsl:variable name="bookmark-id">
+ <xsl:number from="/office:document/office:body" count="text:bookmark | text:bookmark-start" level="any" format="1"/>
+ </xsl:variable>
+ <aml:annotation aml:id="{$bookmark-id}" w:type="Word.Bookmark.End"/>
+ </xsl:template>
+ <xsl:template match="text:bookmark">
+ <xsl:variable name="bookmark-id">
+ <xsl:number from="/office:document/office:body" count="text:bookmark | text:bookmark-start" level="any" format="1"/>
+ </xsl:variable>
+ <aml:annotation aml:id="{$bookmark-id}" w:type="Word.Bookmark.Start" w:name="{@text:name}"/>
+ <aml:annotation aml:id="{$bookmark-id}" w:type="Word.Bookmark.End"/>
+ </xsl:template>
+ <!-- newly added the endnote , footnote templates -->
+ <xsl:template match="text:note">
+ <xsl:choose>
+ <xsl:when test="@text:note-class = 'endnote' ">
+ <w:r>
+ <w:rPr>
+ <w:rStyle w:val="Endnote"/>
+ </w:rPr>
+ <xsl:apply-templates select="text:note-body"/>
+ </w:r>
+ </xsl:when>
+ <xsl:when test="@text:note-class = 'footnote' ">
+ <w:r>
+ <w:rPr>
+ <w:rStyle w:val="Footnote"/>
+ </w:rPr>
+ <xsl:apply-templates select="text:note-body"/>
+ </w:r>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="text:note-body">
+ <xsl:choose>
+ <xsl:when test="../@text:note-class='endnote' ">
+ <w:endnote>
+ <xsl:if test="../text:note-citation/@text:label">
+ <xsl:attribute name="w:suppressRef">on</xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates select="text:h | text:p | text:ordered-list | text:unordered-list | text:list"/>
+ </w:endnote>
+ </xsl:when>
+ <xsl:when test="../@text:note-class='footnote' ">
+ <w:footnote>
+ <xsl:if test="../text:note-citation/@text:label">
+ <xsl:attribute name="w:suppressRef">on</xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates select="text:h | text:p | text:ordered-list | text:unordered-list | text:list"/>
+ </w:footnote>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/filter/source/xslt/import/common/ms2ooo_docpr.xsl b/filter/source/xslt/import/common/ms2ooo_docpr.xsl
new file mode 100644
index 000000000000..77d21306b7b7
--- /dev/null
+++ b/filter/source/xslt/import/common/ms2ooo_docpr.xsl
@@ -0,0 +1,101 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="w wx aml o dt fo v">
+ <xsl:template match="o:DocumentProperties">
+ <office:meta>
+ <meta:generator>Microsoft Word 2003</meta:generator>
+ <dc:title>
+ <xsl:value-of select="o:Title"/>
+ </dc:title>
+ <dc:description>
+ <xsl:value-of select="o:Description"/>
+ </dc:description>
+ <dc:subject>
+ <xsl:value-of select="o:Subject"/>
+ </dc:subject>
+ <meta:initial-creator>
+ <xsl:value-of select="o:Author"/>
+ </meta:initial-creator>
+ <meta:creation-date>
+ <xsl:value-of select="substring-before( o:Created, 'Z')"/>
+ </meta:creation-date>
+ <dc:creator>
+ <xsl:value-of select="o:LastAuthor"/>
+ </dc:creator>
+ <xsl:if test="string-length(substring-before( o:LastSaved, 'Z')) &gt; 0">
+ <dc:date>
+ <xsl:value-of select="substring-before( o:LastSaved, 'Z')"/>
+ </dc:date>
+ </xsl:if>
+ <!-- comment out the below line now because Oasis format doesn't allow the meta:print-by to be empty element -->
+ <!--meta:printed-by /-->
+ <xsl:if test="string-length(substring-before( o:LastPrinted, 'Z')) &gt; 0">
+ <!--
+ <meta:print-date>
+ <xsl:value-of select="substring-before( o:LastPrinted, 'Z')"/>
+ </meta:print-date>
+ -->
+ </xsl:if>
+ <meta:keyword>
+ <xsl:value-of select="o:Keywords"/>
+ </meta:keyword>
+ <meta:editing-cycles>
+ <xsl:value-of select="o:Revision"/>
+ </meta:editing-cycles>
+ <meta:editing-duration>
+ <xsl:if test="o:TotalTime">
+ <xsl:value-of select="concat('PT', floor(o:TotalTime div 60), 'H', o:TotalTime mod 60, 'M0S')"/>
+ </xsl:if>
+ </meta:editing-duration>
+ <meta:user-defined meta:name="Category" meta:value-type="string">
+ <xsl:value-of select="o:Category"/>
+ </meta:user-defined>
+ <meta:user-defined meta:name="Manager" meta:value-type="string">
+ <xsl:value-of select="o:Manager"/>
+ </meta:user-defined>
+ <meta:user-defined meta:name="Company" meta:value-type="string">
+ <xsl:value-of select="o:Company"/>
+ </meta:user-defined>
+ <meta:user-defined meta:name="Version" meta:value-type="string">
+ <xsl:value-of select="o:Version"/>
+ </meta:user-defined>
+ <meta:user-defined meta:name="HyperlinkBase" meta:value-type="string">
+ <xsl:value-of select="o:HyperlinkBase"/>
+ </meta:user-defined>
+ <xsl:apply-templates select="../o:CustomDocumentProperties"/>
+ <meta:document-statistic meta:page-count="{o:Pages}" meta:paragraph-count="{o:Paragraphs}" meta:word-count="{o:Words}" meta:character-count="{o:Characters}"/>
+ </office:meta>
+ </xsl:template>
+ <xsl:template match="o:CustomDocumentProperties">
+ <xsl:for-each select="node()[@dt:dt]">
+ <meta:user-defined meta:name="{local-name()}" meta:value-type="{@dt:dt}">
+ <xsl:value-of select="."/>
+ </meta:user-defined>
+ </xsl:for-each>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/filter/source/xslt/import/spreadsheetml/spreadsheetml2ooo.xsl b/filter/source/xslt/import/spreadsheetml/spreadsheetml2ooo.xsl
new file mode 100644
index 000000000000..71f1baa492d0
--- /dev/null
+++ b/filter/source/xslt/import/spreadsheetml/spreadsheetml2ooo.xsl
@@ -0,0 +1,9173 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:SL="http://schemas.microsoft.com/schemaLibrary/2003/core" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:smil="urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xlink="http://www.w3.org/1999/xlink" exclude-result-prefixes="aml dt html o ss SL v w10 w wx x">
+ <!--+++++ INCLUDED XSL MODULES +++++-->
+ <!-- helper collection, to convert measures (e.g. inch to pixel using DPI (dots per inch) parameter)-->
+ <xsl:import href="../../common/measure_conversion.xsl"/>
+ <xsl:output indent="no" version="1.0" encoding="UTF-8" method="xml"/>
+ <xsl:template match="/">
+ <office:document office:mimetype="application/vnd.oasis.opendocument.spreadsheet" office:version="1.0">
+ <xsl:apply-templates select="ss:Workbook/o:DocumentProperties"/>
+ <xsl:apply-templates select="ss:Workbook/x:ExcelWorkbook"/>
+ <xsl:call-template name="font-declaration"/>
+ <xsl:apply-templates select="ss:Workbook/ss:Worksheet[1]" mode="styles"/>
+ <xsl:element name="office:body">
+ <xsl:element name="office:spreadsheet">
+ <xsl:call-template name="set-calculation"/>
+ <!-- for DataValidation -->
+ <xsl:if test="ss:Workbook/ss:Worksheet/x:DataValidation">
+ <xsl:element name="table:content-validations">
+ <xsl:apply-templates select="ss:Workbook/ss:Worksheet/x:DataValidation"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:apply-templates select="ss:Workbook/ss:Worksheet"/>
+ <xsl:call-template name="Names"/>
+ <xsl:element name="table:database-ranges">
+ <!-- these descriptions located in every Worksheet in Excel, but at the same path in Calc -->
+ <xsl:for-each select="ss:Workbook/ss:Worksheet">
+ <xsl:apply-templates select="./x:Sorting"/>
+ <xsl:apply-templates select="./x:AutoFilter"/>
+ <!-- for Advanced Filter.the position is same as AutoFilter -->
+ <xsl:if test="./ss:Names/ss:NamedRange and ./ss:Names/ss:NamedRange/@ss:Name='_FilterDatabase'">
+ <xsl:call-template name="transform-advanced-filter">
+ <xsl:with-param name="target-value" select="substring-after(./ss:Names/ss:NamedRange[@ss:Name='_FilterDatabase']/@ss:RefersTo, '=')"/>
+ <xsl:with-param name="condition-pos" select="substring-after(./ss:Names/ss:NamedRange[@ss:Name='Criteria']/@ss:RefersTo, '=')"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:element>
+ </xsl:element>
+ </office:document>
+ </xsl:template>
+ <xsl:template match="o:DocumentProperties">
+ <office:meta>
+ <meta:generator>Microsoft Excel 2003</meta:generator>
+ <xsl:if test="o:Title">
+ <dc:title>
+ <xsl:value-of select="o:Title"/>
+ </dc:title>
+ </xsl:if>
+ <xsl:if test="o:Description">
+ <dc:description>
+ <xsl:value-of select="o:Description"/>
+ </dc:description>
+ </xsl:if>
+ <xsl:if test="o:Subject">
+ <dc:subject>
+ <xsl:value-of select="o:Subject"/>
+ </dc:subject>
+ </xsl:if>
+ <xsl:if test="o:Author">
+ <meta:initial-creator>
+ <xsl:value-of select="o:Author"/>
+ </meta:initial-creator>
+ </xsl:if>
+ <xsl:if test="o:Created">
+ <meta:creation-date>
+ <xsl:value-of select="substring-before( o:Created, 'Z')"/>
+ </meta:creation-date>
+ </xsl:if>
+ <xsl:if test="o:LastAuthor">
+ <dc:creator>
+ <xsl:value-of select="o:LastAuthor"/>
+ </dc:creator>
+ </xsl:if>
+ <xsl:if test="o:LastSaved">
+ <dc:date>
+ <xsl:value-of select="substring-before( o:LastSaved, 'Z')"/>
+ </dc:date>
+ </xsl:if>
+ <!--
+ <meta:printed-by/>
+ <meta:print-date/>
+ <!~~ removed in OASIS Open Office XML
+ <meta:keywords>
+ <meta:keyword>
+ <xsl:value-of select="o:Keywords" />
+ </meta:keyword>
+ </meta:keywords>
+ ~~>
+ <dc:language/>
+ -->
+ <xsl:if test="o:Revision">
+ <meta:editing-cycles>
+ <xsl:value-of select="o:Revision"/>
+ </meta:editing-cycles>
+ </xsl:if>
+ <xsl:if test="o:TotalTime">
+ <meta:editing-duration>
+ <xsl:value-of select="concat('PT', floor(o:TotalTime div 60), 'H', o:TotalTime mod 60, 'M0S')"/>
+ </meta:editing-duration>
+ </xsl:if>
+ <xsl:if test="o:Category">
+ <meta:user-defined meta:name="Category">
+ <xsl:value-of select="o:Category"/>
+ </meta:user-defined>
+ </xsl:if>
+ <xsl:if test="o:Manager">
+ <meta:user-defined meta:name="Manager">
+ <xsl:value-of select="o:Manager"/>
+ </meta:user-defined>
+ </xsl:if>
+ <xsl:if test="o:Company">
+ <meta:user-defined meta:name="Company">
+ <xsl:value-of select="o:Company"/>
+ </meta:user-defined>
+ </xsl:if>
+ <xsl:if test="o:Version">
+ <meta:user-defined meta:name="Version">
+ <xsl:value-of select="o:Version"/>
+ </meta:user-defined>
+ </xsl:if>
+ <xsl:if test="o:HyperlinkBase">
+ <meta:user-defined meta:name="HyperlinkBase">
+ <xsl:value-of select="o:HyperlinkBase"/>
+ </meta:user-defined>
+ </xsl:if>
+ <xsl:apply-templates select="../o:CustomDocumentProperties"/>
+ <!--Note: <meta:document-statistic/>-->
+ </office:meta>
+ </xsl:template>
+ <xsl:template match="o:CustomDocumentProperties">
+ <xsl:for-each select="node()[@dt:dt]">
+ <meta:user-defined meta:name="{name()}">
+ <xsl:value-of select="."/>
+ </meta:user-defined>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template match="x:ExcelWorkbook">
+ <!-- Configuration in 'ooo:view-settings' and 'ooo:configuration-settings'
+ "GridColor"
+ "HasColumnRowHeaders"
+ "HasSheetTabs"
+ "IsOutlineSymbolsSet"
+ "IsRasterAxisSynchronized"
+ "IsSnapToRaster"
+ "RasterIsVisible"
+ "RasterResolutionX"
+ "RasterResolutionY"
+ "RasterSubdivisionX"
+ "RasterSubdivisionY"
+ "ShowGrid"
+ "ShowNotes"
+ "ShowPageBreaks"
+ "ShowZeroValues"
+ -->
+ <xsl:variable name="sharedConfiguration">
+ <xsl:if test="../ss:Worksheet/x:WorksheetOptions/x:GridlineColor">
+ <config:config-item config:name="GridColor" config:type="long">
+ <xsl:variable name="temp-code" select="substring-after(normalize-space(../ss:Worksheet/x:WorksheetOptions/x:GridlineColor), '#')"/>
+ <xsl:variable name="temp-value">
+ <xsl:call-template name="hex2decimal">
+ <xsl:with-param name="hex-number" select="$temp-code"/>
+ <xsl:with-param name="index" select="1"/>
+ <xsl:with-param name="str-length" select="string-length($temp-code)"/>
+ <xsl:with-param name="last-value" select="0"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="$temp-value"/>
+ </config:config-item>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="../ss:Worksheet/x:WorksheetOptions/x:DoNotDisplayHeadings">
+ <config:config-item config:name="HasColumnRowHeaders" config:type="boolean">false</config:config-item>
+ </xsl:when>
+ <xsl:otherwise>
+ <config:config-item config:name="HasColumnRowHeaders" config:type="boolean">true</config:config-item>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="x:HideWorkbookTabs">
+ <config:config-item config:name="HasSheetTabs" config:type="boolean">false</config:config-item>
+ </xsl:when>
+ <xsl:otherwise>
+ <config:config-item config:name="HasSheetTabs" config:type="boolean">true</config:config-item>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="../ss:Worksheet/x:WorksheetOptions/x:DoNotDisplayOutline">
+ <config:config-item config:name="IsOutlineSymbolsSet" config:type="boolean">false</config:config-item>
+ </xsl:when>
+ <xsl:otherwise>
+ <config:config-item config:name="IsOutlineSymbolsSet" config:type="boolean">true</config:config-item>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="../ss:Worksheet/x:WorksheetOptions/x:DoNotDisplayGridlines">
+ <config:config-item config:name="ShowGrid" config:type="boolean">false</config:config-item>
+ </xsl:when>
+ <xsl:otherwise>
+ <config:config-item config:name="ShowGrid" config:type="boolean">true</config:config-item>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="../ss:Worksheet/x:WorksheetOptions/x:DoNotDisplayZeros">
+ <config:config-item config:name="ShowZeroValues" config:type="boolean">false</config:config-item>
+ </xsl:when>
+ <xsl:otherwise>
+ <config:config-item config:name="ShowZeroValues" config:type="boolean">true</config:config-item>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <office:settings>
+ <config:config-item-set config:name="ooo:view-settings">
+ <config:config-item config:type="int" config:name="VisibleAreaTop">
+ <xsl:value-of select="x:WindowTopY"/>
+ </config:config-item>
+ <config:config-item config:name="VisibleAreaLeft" config:type="int">
+ <xsl:value-of select="x:WindowTopX"/>
+ </config:config-item>
+ <config:config-item config:name="VisibleAreaWidth" config:type="int">
+ <xsl:value-of select="x:WindowWidth"/>
+ </config:config-item>
+ <config:config-item config:name="VisibleAreaHeight" config:type="int">
+ <xsl:value-of select="x:WindowHeight"/>
+ </config:config-item>
+ <xsl:variable name="ratio" select="15"/>
+ <config:config-item-map-indexed config:name="Views">
+ <config:config-item-map-entry>
+ <config:config-item config:name="ViewId" config:type="string">View1</config:config-item>
+ <config:config-item-map-named config:name="Tables">
+ <!-- The panes of a table is like 3 | 1 or 3 | 1, or 3 , while 3 is the default one. glu
+ - - - - - - -
+ 2 | 0 2 -->
+ <xsl:for-each select="../ss:Worksheet">
+ <config:config-item-map-entry config:name="{@ss:Name}">
+ <xsl:variable name="active-pane">
+ <xsl:choose>
+ <xsl:when test="x:WorksheetOptions/x:ActivePane">
+ <xsl:value-of select="x:WorksheetOptions/x:ActivePane"/>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="not( $active-pane = '' ) and ( x:WorksheetOptions/x:SplitVertical or x:WorksheetOptions/x:SplitHorizontal )">
+ <config:config-item config:name="ActiveSplitRange" config:type="short">
+ <xsl:choose>
+ <xsl:when test="x:WorksheetOptions/x:SplitVertical and not(x:WorksheetOptions/x:SplitHorizontal)">
+ <xsl:value-of select="'3'"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$active-pane"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </config:config-item>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="not( $active-pane = '')">
+ <config:config-item config:name="CursorPositionX" config:type="int">
+ <xsl:value-of select="x:WorksheetOptions/x:Panes/x:Pane[x:Number = $active-pane ]/x:ActiveCol"/>
+ </config:config-item>
+ <config:config-item config:name="CursorPositionY" config:type="int">
+ <xsl:value-of select="x:WorksheetOptions/x:Panes/x:Pane[x:Number = $active-pane ]/x:ActiveRow"/>
+ </config:config-item>
+ </xsl:when>
+ <xsl:otherwise>
+ <config:config-item config:name="CursorPositionX" config:type="int">
+ <xsl:value-of select="x:WorksheetOptions/x:Panes/x:Pane/x:ActiveCol"/>
+ </config:config-item>
+ <config:config-item config:name="CursorPositionY" config:type="int">
+ <xsl:value-of select="x:WorksheetOptions/x:Panes/x:Pane/x:ActiveRow"/>
+ </config:config-item>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:variable name="position-left">
+ <xsl:choose>
+ <xsl:when test="x:WorksheetOptions/x:LeftColumnVisible">
+ <xsl:value-of select="x:WorksheetOptions/x:LeftColumnVisible"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <config:config-item config:name="PositionLeft" config:type="int">
+ <xsl:value-of select="$position-left"/>
+ </config:config-item>
+ <xsl:variable name="position-top">
+ <xsl:choose>
+ <xsl:when test="x:WorksheetOptions/x:TopRowVisible">
+ <xsl:value-of select="x:WorksheetOptions/x:TopRowVisible"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="x:WorksheetOptions/x:SplitVertical and not(x:WorksheetOptions/x:SplitHorizontal)">
+ <config:config-item config:name="PositionBottom" config:type="int">
+ <xsl:value-of select="$position-top"/>
+ </config:config-item>
+ </xsl:when>
+ <xsl:otherwise>
+ <config:config-item config:name="PositionTop" config:type="int">
+ <xsl:value-of select="$position-top"/>
+ </config:config-item>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="x:WorksheetOptions/x:SplitVertical">
+ <config:config-item config:name="HorizontalSplitMode" config:type="short">
+ <xsl:choose>
+ <xsl:when test="x:WorksheetOptions/x:FreezePanes">2</xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </config:config-item>
+ <config:config-item config:name="HorizontalSplitPosition" config:type="int">
+ <xsl:choose>
+ <xsl:when test="x:WorksheetOptions/x:FreezePanes">
+ <xsl:value-of select="x:WorksheetOptions/x:SplitVertical + $position-left"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="floor( x:WorksheetOptions/x:SplitVertical div $ratio )"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </config:config-item>
+ <config:config-item config:name="PositionRight" config:type="int">
+ <xsl:value-of select="x:WorksheetOptions/x:LeftColumnRightPane"/>
+ </config:config-item>
+ </xsl:when>
+ <xsl:otherwise>
+ <config:config-item config:name="HorizontalSplitMode" config:type="short">0</config:config-item>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="x:WorksheetOptions/x:SplitHorizontal">
+ <config:config-item config:name="VerticalSplitMode" config:type="short">
+ <xsl:choose>
+ <xsl:when test="x:WorksheetOptions/x:FreezePanes">2</xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </config:config-item>
+ <config:config-item config:name="VerticalSplitPosition" config:type="int">
+ <xsl:choose>
+ <xsl:when test="x:WorksheetOptions/x:FreezePanes">
+ <xsl:value-of select="x:WorksheetOptions/x:SplitHorizontal + $position-top"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="floor( x:WorksheetOptions/x:SplitHorizontal div $ratio )"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </config:config-item>
+ <config:config-item config:name="PositionBottom" config:type="int">
+ <xsl:value-of select="x:WorksheetOptions/x:TopRowBottomPane"/>
+ </config:config-item>
+ </xsl:when>
+ <xsl:otherwise>
+ <config:config-item config:name="VerticalSplitMode" config:type="short">0</config:config-item>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:copy-of select="$sharedConfiguration"/>
+ <xsl:if test="x:WorksheetOptions/x:TabColorIndex">
+ <config:config-item config:name="TabColor" config:type="int">
+ <xsl:variable name="temp-value">
+ <xsl:call-template name="colorindex2decimal">
+ <xsl:with-param name="colorindex" select="x:WorksheetOptions/x:TabColorIndex"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="$temp-value"/>
+ </config:config-item>
+ </xsl:if>
+ </config:config-item-map-entry>
+ </xsl:for-each>
+ </config:config-item-map-named>
+ <xsl:if test="x:ActiveSheet">
+ <config:config-item config:name="ActiveTable" config:type="string">
+ <xsl:value-of select="../ss:Worksheet[/ss:Workbook/x:ExcelWorkbook/x:ActiveSheet+1]/@ss:Name"/>
+ </config:config-item>
+ </xsl:if>
+ <config:config-item config:name="HorizontalScrollbarWidth" config:type="int">555</config:config-item>
+ <!-- following are some table setting from Excel, but transformed to global setting, due to limit of Calc -->
+ <xsl:if test="../ss:Worksheet/x:WorksheetOptions/x:ShowPageBreakZoom">
+ <config:config-item config:name="ShowPageBreakPreview" config:type="boolean">true</config:config-item>
+ </xsl:if>
+ <xsl:if test="../ss:Worksheet/x:WorksheetOptions/x:PageBreakZoom">
+ <config:config-item config:name="PageViewZoomValue" config:type="int">
+ <xsl:value-of select="../ss:Worksheet/x:WorksheetOptions/x:PageBreakZoom"/>
+ </config:config-item>
+ </xsl:if>
+ <xsl:if test="../ss:Worksheet/x:WorksheetOptions/x:Zoom">
+ <config:config-item config:name="ZoomValue" config:type="int">
+ <xsl:value-of select="../ss:Worksheet/x:WorksheetOptions/x:Zoom"/>
+ </config:config-item>
+ </xsl:if>
+ <!-- several properties are not saved in Calc XML but setting, whereas vice versa. :( So just to be expanded, glu -->
+ </config:config-item-map-entry>
+ </config:config-item-map-indexed>
+ </config:config-item-set>
+ <config:config-item-set config:name="ooo:configuration-settings">
+ <xsl:copy-of select="$sharedConfiguration"/>
+ </config:config-item-set>
+ <!-- printer setting, not finished yet. glu
+ <config:config-item-set config:name="configuration-settings" />
+ -->
+ </office:settings>
+ </xsl:template>
+ <!-- Key all attributes with the same name and same value -->
+ <xsl:key name="same-named-font" match="/ss:Workbook/ss:Styles/ss:Style/ss:Font" use="concat(@ss:FontName, @x:Family)"/>
+ <xsl:key name="same-named-face" match="/ss:Workbook/ss:Worksheet/ss:Table/ss:Row/ss:Cell//html:Font[@html:Face]" use="concat(@html:Face, @x:Family)"/>
+ <xsl:template name="font-declaration">
+ <office:font-face-decls>
+ <xsl:if test="/ss:Workbook/ss:Styles/ss:Style/ss:Font">
+ <xsl:for-each select="/ss:Workbook/ss:Styles/ss:Style/ss:Font[ generate-id(.) = generate-id(key('same-named-font', concat(@ss:FontName, @x:Family))[1])]">
+ <xsl:sort select="name()"/>
+ <xsl:element name="style:font-face">
+ <xsl:if test="@ss:FontName">
+ <xsl:attribute name="style:name">
+ <xsl:value-of select="@ss:FontName"/>
+ </xsl:attribute>
+ <xsl:attribute name="svg:font-family">
+ <xsl:value-of select="@ss:FontName"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@x:Family">
+ <xsl:attribute name="style:font-family-generic">
+ <xsl:call-template name="translate-font-family-generic">
+ <xsl:with-param name="family" select="@x:Family"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:for-each select="/ss:Workbook/ss:Worksheet/ss:Table/ss:Row/ss:Cell/descendant::html:Font[@html:Face][ generate-id(.) = generate-id(key('same-named-face', concat(@html:Face, @x:Family))[1])]">
+ <xsl:sort select="name()"/>
+ <xsl:element name="style:font-face">
+ <xsl:attribute name="style:name">
+ <xsl:value-of select="@html:Face"/>
+ </xsl:attribute>
+ <xsl:attribute name="svg:font-family">
+ <xsl:value-of select="@html:Face"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:font-family-generic">
+ <xsl:call-template name="translate-font-family-generic">
+ <xsl:with-param name="family" select="@x:Family"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:for-each>
+ </office:font-face-decls>
+ </xsl:template>
+ <xsl:template name="translate-font-family-generic">
+ <xsl:param name="family"/>
+ <xsl:choose>
+ <xsl:when test="$family='Swiss'">swiss</xsl:when>
+ <xsl:when test="$family='Modern'">modern</xsl:when>
+ <xsl:when test="$family='Roman'">roman</xsl:when>
+ <xsl:when test="$family='Script'">script</xsl:when>
+ <xsl:when test="$family='Decorative'">decorative</xsl:when>
+ <!-- change 'System' to 'Automatic' for Excel -->
+ <xsl:when test="$family='Automatic'">system</xsl:when>
+ <xsl:otherwise>system</xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="ss:Workbook/ss:Worksheet" mode="styles">
+ <office:styles>
+ <xsl:apply-templates select="/ss:Workbook/ss:Styles/ss:Style[@ss:Name]"/>
+ <xsl:apply-templates select="/ss:Workbook/ss:Styles/ss:Style/ss:NumberFormat[@ss:Format]"/>
+ <!-- if ConditionalFormatting exists,it should generate some styles for style:style -->
+ <xsl:if test="/ss:Workbook/ss:Worksheet/x:ConditionalFormatting">
+ <xsl:call-template name="CondFormat_office_style"/>
+ </xsl:if>
+ </office:styles>
+ <office:automatic-styles>
+ <xsl:apply-templates select="/ss:Workbook/ss:Worksheet/ss:Table"/>
+ <xsl:apply-templates select="/ss:Workbook/ss:Styles/ss:Style[not(@ss:Name)]"/>
+ <xsl:apply-templates select="/ss:Workbook/ss:Styles/ss:Style/ss:Font[@ss:VerticalAlign]"/>
+ <!-- applying to ss:Data (but *, as also ss:Data nested in ss:Comments -->
+ <xsl:apply-templates select="/ss:Workbook/ss:Worksheet/ss:Table/ss:Row/ss:Cell/*[descendant-or-self::*[namespace-uri()='http://www.w3.org/TR/REC-html40']]"/>
+ <xsl:apply-templates select="/ss:Workbook/ss:Worksheet/x:WorksheetOptions/x:PageSetup//@x:Data"/>
+ <!-- if ConditionalFormatting exists,transforing the styles -->
+ <xsl:if test="/ss:Workbook/ss:Worksheet/x:ConditionalFormatting">
+ <xsl:call-template name="CondFormat_automatic_style"/>
+ </xsl:if>
+ <xsl:call-template name="create-page-master">
+ <xsl:with-param name="worksheetoptions" select="/ss:Workbook/ss:Worksheet/x:WorksheetOptions"/>
+ </xsl:call-template>
+ </office:automatic-styles>
+ <office:master-styles>
+ <xsl:call-template name="create-master-styles">
+ <xsl:with-param name="worksheetoptions" select="/ss:Workbook/ss:Worksheet/x:WorksheetOptions"/>
+ </xsl:call-template>
+ </office:master-styles>
+ </xsl:template>
+ <xsl:template name="CondFormat_office_style">
+ <!-- translate the ConditionalFormatting style,including font,size,color,etc -->
+ <xsl:for-each select="/ss:Workbook/ss:Worksheet/x:ConditionalFormatting">
+ <xsl:variable name="table-pos" select="count(../preceding-sibling::ss:Worksheet)+1"/>
+ <xsl:variable name="conditions" select="count(preceding-sibling::x:ConditionalFormatting)+1"/>
+ <!-- Matching multiple styles, but automatic styles are not allowed to inherit from another automatic style
+ <xsl:for-each select="key('tableStyleIDs', key('tableWithConditional', .))
+ [generate-id(.) =
+ generate-id(key('styleId', .)[1])] ">
+ <xsl:sort select="." />
+
+ <xsl:apply-templates select="/ss:Workbook/ss:Styles/ss:Style[@ss:ID = current()/.]"/>
+ </xsl:for-each>
+ -->
+ <xsl:for-each select="x:Condition">
+ <xsl:variable name="condition-number" select="count(preceding-sibling::x:Condition)+1"/>
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name">
+ <xsl:call-template name="encode-as-nc-name">
+ <xsl:with-param name="string" select="concat('Excel_CondFormat_',$table-pos,'_',$conditions,'_',$condition-number)"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="style:family">table-cell</xsl:attribute>
+ <xsl:apply-templates select="@ss:Name" />
+ <xsl:element name="style:table-cell-properties">
+ <xsl:choose>
+ <xsl:when test="x:Format/@Style">
+ <xsl:variable name="stylevalue" select="./x:Format/@Style"/>
+ <xsl:call-template name="recursion-condformat-style-table-cell">
+ <xsl:with-param name="style-value-t">
+ <xsl:choose>
+ <xsl:when test="substring($stylevalue,string-length($stylevalue),1) != ';'">
+ <xsl:value-of select="concat($stylevalue,';')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$stylevalue"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:element name="style:text-properties">
+ <xsl:choose>
+ <xsl:when test="x:Format/@Style">
+ <xsl:variable name="stylevalue" select="./x:Format/@Style"/>
+ <xsl:call-template name="recursion-condformat-style-text">
+ <xsl:with-param name="style-value-t">
+ <xsl:choose>
+ <xsl:when test="substring($stylevalue,string-length($stylevalue),1) != ';'">
+ <xsl:value-of select="concat($stylevalue,';')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$stylevalue"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:font-style">
+ <xsl:value-of select="'italic'"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:text-underline-type">
+ <xsl:value-of select="'single'"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:text-underline-color">
+ <xsl:value-of select="'font-color'"/>
+ </xsl:attribute>
+ <xsl:attribute name="fo:font-weight">
+ <xsl:value-of select="'bold'"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template match="@ss:Name">
+ <xsl:attribute name="style:display-name">
+ <xsl:value-of select="."/>
+ </xsl:attribute>
+ </xsl:template>
+ <xsl:template name="recursion-condformat-style-table-cell">
+ <!-- generates style:style for ConditionalFormatting -->
+ <xsl:param name="style-value-t"/>
+ <xsl:variable name="style-value" select="normalize-space($style-value-t)"/>
+ <xsl:choose>
+ <xsl:when test="starts-with($style-value,'background')">
+ <xsl:choose>
+ <xsl:when test="contains($style-value,'mso-pattern')">
+ <xsl:variable name="color-value">
+ <xsl:call-template name="translate-color-style">
+ <xsl:with-param name="source-str" select="normalize-space(substring-before(substring-after($style-value,':'),';'))"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="mso-value">
+ <xsl:call-template name="translate-color-style">
+ <xsl:with-param name="source-str" select="normalize-space(substring-after($style-value,'mso-pattern'))"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="mso-color" select="substring-after($mso-value,'#')"/>
+ <xsl:variable name="pattern-color-value" select="substring($mso-color,1,6)"/>
+ <xsl:variable name="pattern" select="concat('0.',normalize-space(substring-before(substring-after($mso-color,'gray-'),';')))"/>
+ <xsl:variable name="pattern-color">
+ <xsl:call-template name="cell-pattern-color">
+ <xsl:with-param name="pattern" select="$pattern"/>
+ <xsl:with-param name="color-value" select="$color-value"/>
+ <xsl:with-param name="pattern-color-value" select="concat('#',$pattern-color-value)"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="fo:background-color">
+ <xsl:value-of select="normalize-space($pattern-color)"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:background-color">
+ <xsl:call-template name="translate-color-style">
+ <xsl:with-param name="source-str" select="normalize-space(substring-before(substring-after($style-value,':'),';'))"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="starts-with($style-value,'border')">
+ <xsl:attribute name="fo:border">
+ <xsl:value-of select="'0.002cm solid #000000'"/>
+ </xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="contains($style-value,':')">
+ <xsl:call-template name="recursion-condformat-style-table-cell">
+ <xsl:with-param name="style-value-t" select="substring-after($style-value,';')"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="recursion-condformat-style-text">
+ <!-- generates style:style for ConditionalFormatting -->
+ <xsl:param name="style-value-t"/>
+ <xsl:variable name="style-value" select="normalize-space($style-value-t)"/>
+ <xsl:choose>
+ <xsl:when test="starts-with($style-value,'color')">
+ <xsl:attribute name="fo:color">
+ <xsl:call-template name="translate-color-style">
+ <xsl:with-param name="source-str" select="normalize-space(substring-before(substring-after($style-value,':'),';'))"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="starts-with($style-value,'font-style')">
+ <xsl:attribute name="fo:font-style">
+ <xsl:value-of select="normalize-space(substring-before(substring-after($style-value,':'),';'))"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="starts-with($style-value,'font-weight')">
+ <xsl:variable name="font-weight" select="normalize-space(substring-before(substring-after($style-value,':'),';'))"/>
+ <xsl:attribute name="fo:font-weight">
+ <xsl:choose>
+ <xsl:when test="($font-weight &gt; 300) and ($font-weight &lt; 500)">
+ <xsl:value-of select="'normal'"/>
+ </xsl:when>
+ <xsl:when test="($font-weight &gt; 500) or ($font-weight = 500)">
+ <xsl:value-of select="'bold'"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="'0'"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="starts-with($style-value,'text-underline-style')">
+ <xsl:attribute name="style:text-underline-type">
+ <xsl:value-of select="normalize-space(substring-before(substring-after($style-value,':'),';'))"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:text-underline-color">
+ <xsl:value-of select="'#000000'"/>
+ </xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="contains($style-value,':')">
+ <xsl:call-template name="recursion-condformat-style-text">
+ <xsl:with-param name="style-value-t" select="substring-after($style-value,';')"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="translate-color-style">
+ <!-- translate the word of color to hex code of color -->
+ <xsl:param name="source-str"/>
+ <xsl:choose>
+ <xsl:when test="starts-with($source-str,'#')">
+ <xsl:value-of select="$source-str"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="starts-with($source-str,'black')">
+ <xsl:value-of select="'#000000'"/>
+ </xsl:when>
+ <xsl:when test="starts-with($source-str,'maroon')">
+ <xsl:value-of select="'#800000'"/>
+ </xsl:when>
+ <xsl:when test="starts-with($source-str,'red')">
+ <xsl:value-of select="'#FF0000'"/>
+ </xsl:when>
+ <xsl:when test="starts-with($source-str,'fuchsia')">
+ <xsl:value-of select="'#FF00FF'"/>
+ </xsl:when>
+ <xsl:when test="starts-with($source-str,'olive')">
+ <xsl:value-of select="'#808000'"/>
+ </xsl:when>
+ <xsl:when test="starts-with($source-str,'yellow')">
+ <xsl:value-of select="'#FFFF00'"/>
+ </xsl:when>
+ <xsl:when test="starts-with($source-str,'green')">
+ <xsl:value-of select="'#008000'"/>
+ </xsl:when>
+ <xsl:when test="starts-with($source-str,'lime')">
+ <xsl:value-of select="'#00FF00'"/>
+ </xsl:when>
+ <xsl:when test="starts-with($source-str,'teal')">
+ <xsl:value-of select="'#008080'"/>
+ </xsl:when>
+ <xsl:when test="starts-with($source-str,'aqua')">
+ <xsl:value-of select="'#00FFFF'"/>
+ </xsl:when>
+ <xsl:when test="starts-with($source-str,'navy')">
+ <xsl:value-of select="'#000080'"/>
+ </xsl:when>
+ <xsl:when test="starts-with($source-str,'blue')">
+ <xsl:value-of select="'#0000FF'"/>
+ </xsl:when>
+ <xsl:when test="starts-with($source-str,'purple')">
+ <xsl:value-of select="'#800080'"/>
+ </xsl:when>
+ <xsl:when test="starts-with($source-str,'gray')">
+ <xsl:value-of select="'#808080'"/>
+ </xsl:when>
+ <xsl:when test="starts-with($source-str,'silver')">
+ <xsl:value-of select="'#C0C0C0'"/>
+ </xsl:when>
+ <xsl:when test="starts-with($source-str,'white')">
+ <xsl:value-of select="'#FFFFFF'"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="'#FFFFFF'"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:key match="/ss:Workbook/ss:Worksheet/ss:Table" name="tableWithConditional" use="following-sibling::x:ConditionalFormatting"/>
+ <xsl:key match="ss:Table/ss:Row/ss:Cell/@ss:StyleID" name="tableStyleIDs" use="ancestor::ss:Table"/>
+ <xsl:key name="styleId" match="@ss:StyleID" use="."/>
+ <xsl:template name="CondFormat_automatic_style">
+ <!-- For each conditionalFormatting We inject a new style, which is a child of the current found style -->
+ <xsl:for-each select="/ss:Workbook/ss:Worksheet/x:ConditionalFormatting">
+ <xsl:variable name="table-pos" select="count(../preceding-sibling::ss:Worksheet)+1"/>
+ <xsl:variable name="conditions" select="count(preceding-sibling::x:ConditionalFormatting)+1"/>
+ <xsl:variable name="conditionalFormatting" select="."/>
+ <!-- for all 'ssStyle/@ss:ID's, which are in tables connected within this conditional formatting -->
+ <xsl:for-each select="key('tableStyleIDs', key('tableWithConditional', .)) [generate-id(.) = generate-id(key('styleId', .)[1])] ">
+ <!-- sort the style ID by their naming -->
+ <xsl:sort select="."/>
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name">
+ <xsl:call-template name="encode-as-nc-name">
+ <xsl:with-param name="string" select="concat(.,'-ce',$table-pos,'-',$conditions)"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="style:family">table-cell</xsl:attribute>
+ <xsl:variable name="style" select="key('Style', .)" />
+ <xsl:choose>
+ <xsl:when test="$style/@ss:Name">
+ <xsl:attribute name="style:parent-style-name">
+ <xsl:call-template name="encode-as-nc-name">
+ <xsl:with-param name="string" select="."/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:when>
+ <!-- as we create an automatic style, the parent is not allowed to be an automatic style as well
+ if the parent would be a automatic (unnamed) style, the style information have to be embedded to this style -->
+ <xsl:otherwise>
+ <xsl:attribute name="style:parent-style-name">
+ <xsl:call-template name="encode-as-nc-name">
+ <xsl:with-param name="string" select="$style/@ss:Parent"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:if test="$style/ss:NumberFormat/@ss:Format">
+ <xsl:attribute name="style:data-style-name">
+ <xsl:value-of select="concat($style/@ss:ID, 'F')"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates select="$style" mode="style-style-content"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:for-each select="$conditionalFormatting/x:Condition">
+ <xsl:variable name="condition-number" select="count(preceding-sibling::x:Condition)+1"/>
+ <xsl:variable name="base-address">
+ <xsl:choose>
+ <xsl:when test="contains(../x:Range,',')">
+ <xsl:choose>
+ <xsl:when test="contains(substring-before(../x:Range,','),':')">
+ <xsl:value-of select="substring-before(substring-after(../x:Range,':'),',')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-before(../x:Range,',')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="../x:Range"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="columnNumber">
+ <xsl:choose>
+ <xsl:when test="contains($base-address, ':')">
+ <xsl:value-of select="substring-after(substring-after($base-address, ':'),'C')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-after($base-address,'C')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="rowNumber">
+ <xsl:choose>
+ <xsl:when test="contains($base-address, ':')">
+ <xsl:value-of select="substring-before(substring-after(substring-after($base-address, ':'),'R'),'C')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-before(substring-after($base-address,'R'),'C')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="base-cell-address">
+ <xsl:call-template name="translate-unit">
+ <xsl:with-param name="column-number" select="$columnNumber"/>
+ <xsl:with-param name="row-number" select="$rowNumber"/>
+ <xsl:with-param name="column-pos-style" select="'relative'"/>
+ <xsl:with-param name="row-pos-style" select="'relative'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="condition-value">
+ <xsl:call-template name="translate-condition">
+ <xsl:with-param name="cell-column-pos" select="$columnNumber"/>
+ <xsl:with-param name="cell-row-pos" select="$rowNumber"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:element name="style:map">
+ <xsl:attribute name="style:condition">
+ <xsl:value-of select="$condition-value"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:apply-style-name">
+ <xsl:value-of select="concat('Excel_CondFormat_',$table-pos,'_',$conditions,'_',$condition-number)"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:base-cell-address">
+ <xsl:value-of select="concat(../../@ss:Name,'.',$base-cell-address)"/>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="translate-condition">
+ <xsl:param name="cell-row-pos"/>
+ <xsl:param name="cell-column-pos"/>
+ <!-- translates the condition to generate formula -->
+ <xsl:variable name="address-value">
+ <xsl:call-template name="translate-expression">
+ <xsl:with-param name="cell-row-pos" select="$cell-row-pos"/>
+ <xsl:with-param name="cell-column-pos" select="$cell-column-pos"/>
+ <xsl:with-param name="expression" select="x:Value1"/>
+ <xsl:with-param name="return-value" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="x:Qualifier">
+ <xsl:variable name="qualifier" select="x:Qualifier"/>
+ <xsl:variable name="first-value" select="x:Value1"/>
+ <xsl:choose>
+ <xsl:when test="$qualifier = 'Equal'">
+ <xsl:choose>
+ <xsl:when test="starts-with($first-value,'&quot;')">
+ <xsl:value-of select="concat('cell-content()=',$address-value)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat('cell-content()=[',$address-value,']')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$qualifier = 'Less'">
+ <xsl:value-of select="concat('cell-content()&lt;[',$address-value,']')"/>
+ </xsl:when>
+ <xsl:when test="$qualifier = 'Greater'">
+ <xsl:value-of select="concat('cell-content()&gt;[',$address-value,']')"/>
+ </xsl:when>
+ <xsl:when test="$qualifier = 'LessOrEqual'">
+ <xsl:value-of select="concat('cell-content()&lt;=[',$address-value,']')"/>
+ </xsl:when>
+ <xsl:when test="$qualifier = 'GreaterOrEqual'">
+ <xsl:value-of select="concat('cell-content()&gt;=[',$address-value,']')"/>
+ </xsl:when>
+ <xsl:when test="$qualifier = 'NotEqual'">
+ <xsl:value-of select="concat('cell-content()!=[',$address-value,']')"/>
+ </xsl:when>
+ <xsl:when test="$qualifier = 'Between'">
+ <xsl:variable name="second-value">
+ <xsl:call-template name="translate-expression">
+ <xsl:with-param name="cell-row-pos" select="0"/>
+ <xsl:with-param name="cell-column-pos" select="0"/>
+ <xsl:with-param name="expression" select="x:Value2"/>
+ <xsl:with-param name="return-value" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="concat('cell-content-is-between([',$address-value,'],[',$second-value,'])')"/>
+ </xsl:when>
+ <xsl:when test="$qualifier = 'NotBetween'">
+ <xsl:variable name="second-value">
+ <xsl:call-template name="translate-expression">
+ <xsl:with-param name="cell-row-pos" select="0"/>
+ <xsl:with-param name="cell-column-pos" select="0"/>
+ <xsl:with-param name="expression" select="x:Value2"/>
+ <xsl:with-param name="return-value" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="concat('cell-content-is-not-between([',$address-value,'],[',$second-value,'])')"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat('is-true-formula(',$address-value,')')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- Used in case of 'style:map', conditional formatting, where a style references to another -->
+ <xsl:key match="/ss:Workbook/ss:Worksheet/ss:Table/ss:Row/ss:Cell" name="cells" use="@ss:StyleID"/>
+ <xsl:template match="ss:NumberFormat">
+ <xsl:variable name="unit-count" select="string-length(@ss:Format) - string-length(translate(@ss:Format,';','')) + 1"/>
+ <xsl:variable name="proto-style-id" select="../@ss:ID"/>
+ <xsl:call-template name="process-number-format-unit">
+ <xsl:with-param name="number-format-unit" select="@ss:Format"/>
+ <xsl:with-param name="style-id" select="concat($proto-style-id,'F')"/>
+ <xsl:with-param name="format-type" select="key('cells', $proto-style-id)/ss:Data/@ss:Type"/>
+ <xsl:with-param name="total-unit" select="$unit-count"/>
+ <xsl:with-param name="current-unit" select="0"/>
+ </xsl:call-template>
+ </xsl:template>
+ <!-- Note: conditions appearing only once at the beginning are mixed with others -->
+ <xsl:template name="process-number-format-unit">
+ <xsl:param name="number-format-unit"/>
+ <xsl:param name="style-id"/>
+ <xsl:param name="format-type"/>
+ <xsl:param name="total-unit"/>
+ <xsl:param name="current-unit"/>
+ <xsl:choose>
+ <!-- if total-unit > 1 and the last unit is just @, delete it -->
+ <xsl:when test="$current-unit = 0 and $total-unit &gt; 1 and substring( $number-format-unit, string-length($number-format-unit) - 1) = ';@'">
+ <xsl:call-template name="process-number-format-unit">
+ <xsl:with-param name="number-format-unit" select="substring( $number-format-unit, 1, string-length($number-format-unit) - 2)"/>
+ <xsl:with-param name="style-id" select="$style-id"/>
+ <xsl:with-param name="format-type" select="$format-type"/>
+ <xsl:with-param name="total-unit" select="$total-unit - 1"/>
+ <xsl:with-param name="current-unit" select="0"/>
+ </xsl:call-template>
+ </xsl:when>
+ <!-- $number-format-unit enum values: General, General Number, General Date, Long Date, Medium Date, Short Date, Long Time,
+ Medium Time, Short Time, Currency, Euro Currency, Fixed, Standard, Percent, Scientific, Yes/No, True/False, On/Off -->
+ <xsl:when test="$number-format-unit = 'Currency'">
+ <number:currency-style style:name="{concat( $style-id, 'P1')}" style:volatile="true">
+ <number:text>$</number:text>
+ <number:number number:decimal-places="2" number:min-integer-digits="1" number:grouping="true"/>
+ </number:currency-style>
+ <number:currency-style style:name="{$style-id}">
+ <style:text-properties fo:color="#ff0000"/>
+ <number:text>$-</number:text>
+ <number:number number:decimal-places="2" number:min-integer-digits="1" number:grouping="true"/>
+ <style:map style:condition="value()&gt;=0" style:apply-style-name="{concat( $style-id, 'P1')}"/>
+ </number:currency-style>
+ </xsl:when>
+ <xsl:when test="$number-format-unit = 'Euro Currency'">
+ <number:currency-style style:name="{concat( $style-id, 'P1')}" style:volatile="true">
+ <number:text>€ </number:text>
+ <number:number number:decimal-places="2" number:min-integer-digits="1" number:grouping="true"/>
+ </number:currency-style>
+ <number:currency-style style:name="{$style-id}">
+ <style:text-properties fo:color="#ff0000"/>
+ <number:text>(€ </number:text>
+ <number:number number:decimal-places="2" number:min-integer-digits="1" number:grouping="true"/>
+ <number:text>)</number:text>
+ <style:map style:condition="value()&gt;=0" style:apply-style-name="{concat( $style-id, 'P1')}"/>
+ </number:currency-style>
+ </xsl:when>
+ <xsl:when test="$number-format-unit = 'Yes/No' or $number-format-unit = 'True/False' or $number-format-unit = 'On/Off'">
+ <xsl:variable name="left-code" select="substring-before( $number-format-unit, '/')"/>
+ <xsl:variable name="right-code" select="substring-after( $number-format-unit, '/')"/>
+ <number:number-style style:name="{concat( $style-id, 'P1')}" style:volatile="true">
+ <number:text>
+ <xsl:value-of select="$left-code"/>
+ </number:text>
+ </number:number-style>
+ <number:number-style style:name="{concat( $style-id, 'P2')}" style:volatile="true">
+ <number:text>
+ <xsl:value-of select="$left-code"/>
+ </number:text>
+ </number:number-style>
+ <number:number-style style:name="{$style-id}">
+ <number:text>
+ <xsl:value-of select="$right-code"/>
+ </number:text>
+ <style:map style:condition="value()&gt;0" style:apply-style-name="{concat( $style-id, 'P1')}"/>
+ <style:map style:condition="value()&lt;0" style:apply-style-name="{concat( $style-id, 'P2')}"/>
+ </number:number-style>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="$total-unit &gt; 1 and $current-unit = 0">
+ <!-- still complete number format string of multiple sub-formats, split them out -->
+ <xsl:call-template name="process-number-format-unit">
+ <xsl:with-param name="number-format-unit" select="substring-before($number-format-unit,';')"/>
+ <xsl:with-param name="style-id" select="concat($style-id,'P1')"/>
+ <xsl:with-param name="format-type" select="$format-type"/>
+ <xsl:with-param name="total-unit" select="$total-unit"/>
+ <xsl:with-param name="current-unit" select="1"/>
+ </xsl:call-template>
+ <xsl:if test="$total-unit &gt; 2">
+ <xsl:call-template name="process-number-format-unit">
+ <xsl:with-param name="number-format-unit" select="substring-before(substring-after($number-format-unit,';'),';')"/>
+ <xsl:with-param name="style-id" select="concat($style-id,'P2')"/>
+ <xsl:with-param name="format-type" select="$format-type"/>
+ <xsl:with-param name="total-unit" select="$total-unit"/>
+ <xsl:with-param name="current-unit" select="2"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="$total-unit &gt; 3">
+ <!-- four sub number format -->
+ <xsl:call-template name="process-number-format-unit">
+ <xsl:with-param name="number-format-unit" select="substring-before(substring-after(substring-after($number-format-unit,';'),';'),';')"/>
+ <xsl:with-param name="style-id" select="concat($style-id,'P3')"/>
+ <xsl:with-param name="format-type" select="$format-type"/>
+ <xsl:with-param name="total-unit" select="$total-unit"/>
+ <xsl:with-param name="current-unit" select="3"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:if>
+ <!-- symbol number format converted, below deal with ordinary number formatting -->
+ <xsl:variable name="current-number-format-unit">
+ <xsl:choose>
+ <xsl:when test="$total-unit = 1 and $current-unit = 0">
+ <xsl:value-of select="$number-format-unit"/>
+ </xsl:when>
+ <xsl:when test="$total-unit = 2 and $current-unit = 0">
+ <xsl:value-of select="substring-after($number-format-unit,';')"/>
+ </xsl:when>
+ <xsl:when test="$total-unit = 3 and $current-unit = 0">
+ <xsl:value-of select="substring-after(substring-after($number-format-unit,';'),';')"/>
+ </xsl:when>
+ <xsl:when test="$current-unit = 0">
+ <!-- the forth sub number format -->
+ <xsl:value-of select="substring-after(substring-after(substring-after($number-format-unit,';'),';'),';')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- not the default sub number format, glu -->
+ <xsl:value-of select="$number-format-unit"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="style-type-name">
+ <xsl:choose>
+ <xsl:when test="($format-type = 'Number' and contains($current-number-format-unit,'[$') and not(contains($current-number-format-unit,'[$-') ) ) or contains($current-number-format-unit,'Currency') ">number:currency-style</xsl:when>
+ <xsl:when test="($format-type = 'Number' and (contains($current-number-format-unit,'%') or contains($current-number-format-unit, 'Percent') ) ) or contains($current-number-format-unit,'Percent') ">number:percentage-style</xsl:when>
+ <xsl:when test="($format-type = 'DateTime' or $format-type = 'String') and (contains($current-number-format-unit,'y') or contains($current-number-format-unit,'g') or contains($current-number-format-unit,'d') or contains($current-number-format-unit, 'Date') )">number:date-style</xsl:when>
+ <xsl:when test="($format-type = 'DateTime' or $format-type = 'String') and ( contains($current-number-format-unit,'h') or contains($current-number-format-unit,'m') or contains($current-number-format-unit,'s') or contains($current-number-format-unit, 'Time') )">number:time-style</xsl:when>
+ <xsl:when test="contains($current-number-format-unit, 'Number') or contains($current-number-format-unit, 'General') or contains($current-number-format-unit, 'Fixed') or contains($current-number-format-unit, 'Standard') or contains($current-number-format-unit, 'Scientific') or ( contains($current-number-format-unit,'#') or contains($current-number-format-unit,'0') or contains($current-number-format-unit,'?') )">number:number-style</xsl:when>
+ <xsl:when test="$format-type = 'Boolean'">number:boolean-style</xsl:when>
+ <xsl:otherwise>number:text-style</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:element name="{$style-type-name}">
+ <xsl:attribute name="style:name">
+ <xsl:value-of select="$style-id"/>
+ </xsl:attribute>
+ <xsl:apply-templates select="@ss:Name" />
+ <!-- removed in OASIS XML
+ <xsl:attribute name="style:family">data-style</xsl:attribute>-->
+ <xsl:if test="$current-unit &gt; 0">
+ <xsl:attribute name="style:volatile">true</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="contains ( $current-number-format-unit, '[h]') or contains ( $current-number-format-unit, '[m]') or contains ( $current-number-format-unit, '[s]')">
+ <xsl:attribute name="number:truncate-on-overflow">false</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="contains($current-number-format-unit,'[$') or contains($current-number-format-unit, '[DBNum')">
+ <xsl:call-template name="create-language-country-attribute">
+ <xsl:with-param name="attribute-code" select="substring-before(substring-after(substring-after($current-number-format-unit,'[$'),'-'),']')"/>
+ <xsl:with-param name="number-code-style" select="substring-before( substring-after($current-number-format-unit,'[DBNum'),']')"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="contains( $current-number-format-unit, '[')">
+ <xsl:element name="style:text-properties">
+ <xsl:choose>
+ <xsl:when test="contains( $current-number-format-unit, '[Red')">
+ <xsl:attribute name="fo:color">#ff0000</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="contains( $current-number-format-unit, '[Black')">
+ <xsl:attribute name="fo:color">#000000</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="contains( $current-number-format-unit, '[Blue')">
+ <xsl:attribute name="fo:color">#0000ff</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="contains( $current-number-format-unit, '[Cyan')">
+ <xsl:attribute name="fo:color">#00ffff</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="contains( $current-number-format-unit, '[Green')">
+ <xsl:attribute name="fo:color">#00ff00</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="contains( $current-number-format-unit, '[Magenta')">
+ <xsl:attribute name="fo:color">#ff00ff</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="contains( $current-number-format-unit, '[White')">
+ <xsl:attribute name="fo:color">#ffffff</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="contains( $current-number-format-unit, '[Yellow')">
+ <xsl:attribute name="fo:color">#ffff00</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:if>
+ <!-- the type of condition-pos:1,the former third part of General; 2, the last General. the methods handling diffirent -->
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$current-number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="1"/>
+ <xsl:with-param name="condition-pos">
+ <xsl:choose>
+ <xsl:when test="$current-unit = 1 or $current-unit = 2 or $current-unit = 3">
+ <xsl:value-of select="1"/>
+ </xsl:when>
+ <xsl:when test="$current-unit = 0 and not(contains($number-format-unit, ';'))">
+ <xsl:value-of select="1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="2"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ </xsl:call-template>
+ <!-- creat style:map for other sub number formats -->
+ <xsl:if test="$current-unit = 0 and $total-unit &gt; 1">
+ <xsl:variable name="style-condition1">
+ <xsl:call-template name="get-number-format-condition">
+ <xsl:with-param name="number-format-unit" select="substring-before($number-format-unit,';')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="string-length($style-condition1) &gt; 0">
+ <style:map style:condition="{concat('value()',$style-condition1)}" style:apply-style-name="{concat($style-id,'P1')}"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="$total-unit = 2">
+ <style:map style:condition="value()&gt;=0" style:apply-style-name="{concat($style-id,'P1')}"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <style:map style:condition="value()&gt;0" style:apply-style-name="{concat($style-id,'P1')}"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="$total-unit &gt; 2">
+ <xsl:variable name="style-condition2">
+ <xsl:call-template name="get-number-format-condition">
+ <xsl:with-param name="number-format-unit" select="substring-before(substring-after($number-format-unit,';'),';')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="string-length($style-condition2) &gt; 0">
+ <style:map style:condition="{concat('value()',$style-condition2)}" style:apply-style-name="{concat($style-id,'P2')}"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <style:map style:condition="value()&lt;0" style:apply-style-name="{concat($style-id,'P2')}"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="$total-unit &gt; 3">
+ <!-- four sub number formats, glu -->
+ <xsl:variable name="style-condition3">
+ <xsl:call-template name="get-number-format-condition">
+ <xsl:with-param name="number-format-unit" select="substring-before(substring-after(substring-after($number-format-unit,';'),';'),';')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="string-length($style-condition3) &gt; 0">
+ <style:map style:condition="{concat('value()',$style-condition3)}" style:apply-style-name="{concat($style-id,'P3')}"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <style:map style:condition="value()=0" style:apply-style-name="{concat($style-id,'P3')}"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:if>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="create-language-country-attribute">
+ <xsl:param name="attribute-code"/>
+ <xsl:param name="number-code-style"/>
+ <!-- convert Microsoft List of Locale ID (LCID) to language and country codes according to ISO-639 and ISO-3166.
+ Reference:
+ http://www.loc.gov/standards/iso639-2/langcodes.html
+ http://etext.lib.virginia.edu/tei/iso639.html
+ http://nl.ijs.si/gnusl/cee/std/ISO_3166.html
+ http://xml.coverpages.org/ripe3166.txt
+ http://www.worldlanguage.com/
+ http://www.ethnologue.com/
+ glu -->
+ <!-- the variables of language-country-code and number-shape-code transformed to decimal format -->
+ <xsl:variable name="language-country-code">
+ <xsl:variable name="temp-code">
+ <xsl:choose>
+ <xsl:when test="string-length($attribute-code) &lt;= 4">
+ <xsl:value-of select="$attribute-code"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring($attribute-code,string-length($attribute-code) - 3)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:call-template name="hex2decimal">
+ <xsl:with-param name="hex-number" select="$temp-code"/>
+ <xsl:with-param name="index" select="1"/>
+ <xsl:with-param name="str-length" select="string-length($temp-code)"/>
+ <xsl:with-param name="last-value" select="0"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="string-length($attribute-code) &gt; 4 or string-length($number-code-style) &gt; 0">
+ <xsl:variable name="number-shape-code">
+ <xsl:variable name="temp-code">
+ <xsl:choose>
+ <xsl:when test="string-length($attribute-code) &gt; 4">
+ <xsl:value-of select="substring($attribute-code, 1, string-length($attribute-code) - 6)"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:call-template name="hex2decimal">
+ <xsl:with-param name="hex-number" select="$temp-code"/>
+ <xsl:with-param name="index" select="1"/>
+ <xsl:with-param name="str-length" select="string-length($temp-code)"/>
+ <xsl:with-param name="last-value" select="0"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="number:transliteration-style">long</xsl:attribute>
+ <xsl:choose>
+ <!-- Western, #01 -->
+ <xsl:when test="$number-shape-code = 1"/>
+ <!-- Arabic Indic, #02 -->
+ <xsl:when test="$number-shape-code = 2"/>
+ <!-- Extended Arabic Indic, #03 -->
+ <xsl:when test="$number-shape-code = 3"/>
+ <!-- Devanagari (Sanskrit - India), #04-->
+ <xsl:when test="$number-shape-code = 4">
+ <xsl:attribute name="number:transliteration-language">sa</xsl:attribute>
+ <xsl:attribute name="number:transliteration-country">IN</xsl:attribute>
+ </xsl:when>
+ <!-- Bengali (India), #05 -->
+ <xsl:when test="$number-shape-code = 5">
+ <xsl:attribute name="number:transliteration-language">bn</xsl:attribute>
+ <xsl:attribute name="number:transliteration-country">IN</xsl:attribute>
+ </xsl:when>
+ <!-- Gurmukhi (Punjabi - India), #06 -->
+ <xsl:when test="$number-shape-code = 6">
+ <xsl:attribute name="number:transliteration-language">pa</xsl:attribute>
+ <xsl:attribute name="number:transliteration-country">IN</xsl:attribute>
+ </xsl:when>
+ <!-- Gujarati (India), #07 -->
+ <xsl:when test="$number-shape-code = 7">
+ <xsl:attribute name="number:transliteration-language">gu</xsl:attribute>
+ <xsl:attribute name="number:transliteration-country">IN</xsl:attribute>
+ </xsl:when>
+ <!-- Oriya (India), #08 -->
+ <xsl:when test="$number-shape-code = 8">
+ <xsl:attribute name="number:transliteration-language">or</xsl:attribute>
+ <xsl:attribute name="number:transliteration-country">IN</xsl:attribute>
+ </xsl:when>
+ <!-- Tamil (India), #09 -->
+ <xsl:when test="$number-shape-code = 9">
+ <xsl:attribute name="number:transliteration-language">ta</xsl:attribute>
+ <xsl:attribute name="number:transliteration-country">IN</xsl:attribute>
+ </xsl:when>
+ <!-- Telugu (India), #0a -->
+ <xsl:when test="$number-shape-code = 10">
+ <xsl:attribute name="number:transliteration-language">te</xsl:attribute>
+ <xsl:attribute name="number:transliteration-country">IN</xsl:attribute>
+ </xsl:when>
+ <!-- Kannada (India), #0b -->
+ <xsl:when test="$number-shape-code = 11">
+ <xsl:attribute name="number:transliteration-language">kn</xsl:attribute>
+ <xsl:attribute name="number:transliteration-country">IN</xsl:attribute>
+ </xsl:when>
+ <!-- Malayalam (India), #0c -->
+ <xsl:when test="$number-shape-code = 12">
+ <xsl:attribute name="number:transliteration-language">ml</xsl:attribute>
+ <xsl:attribute name="number:transliteration-country">IN</xsl:attribute>
+ </xsl:when>
+ <!-- Thai, #0d -->
+ <xsl:when test="$number-shape-code = 13">
+ <xsl:attribute name="number:transliteration-language">th</xsl:attribute>
+ <xsl:attribute name="number:transliteration-country">TH</xsl:attribute>
+ </xsl:when>
+ <!-- Lao, #0e -->
+ <xsl:when test="$number-shape-code = 14">
+ <xsl:attribute name="number:transliteration-language">lo</xsl:attribute>
+ <xsl:attribute name="number:transliteration-country">LA</xsl:attribute>
+ </xsl:when>
+ <!-- Tibetan (China), #0f -->
+ <xsl:when test="$number-shape-code = 15">
+ <xsl:attribute name="number:transliteration-language">bo</xsl:attribute>
+ <xsl:attribute name="number:transliteration-country">CN</xsl:attribute>
+ </xsl:when>
+ <!-- Myanmar (Burma), #10 -->
+ <xsl:when test="$number-shape-code = 16">
+ <xsl:attribute name="number:transliteration-language">my</xsl:attribute>
+ <xsl:attribute name="number:transliteration-country">MM</xsl:attribute>
+ </xsl:when>
+ <!-- Ethiopic (Geez), #11 -->
+ <xsl:when test="$number-shape-code = 17">
+ <xsl:attribute name="number:transliteration-language">gez</xsl:attribute>
+ <xsl:attribute name="number:transliteration-country">ET</xsl:attribute>
+ </xsl:when>
+ <!-- Khmer (Cambodian), #12-->
+ <xsl:when test="$number-shape-code = 18">
+ <xsl:attribute name="number:transliteration-language">km</xsl:attribute>
+ <xsl:attribute name="number:transliteration-country">KH</xsl:attribute>
+ </xsl:when>
+ <!-- Mongolian, #13 -->
+ <xsl:when test="$number-shape-code = 19">
+ <xsl:attribute name="number:transliteration-language">mn</xsl:attribute>
+ <xsl:attribute name="number:transliteration-country">CN</xsl:attribute>
+ </xsl:when>
+ <!-- Japanese 1 ([DBNum1]) , #1b, #0411 -->
+ <xsl:when test="$number-shape-code = 27 or ($number-code-style = '1' and $language-country-code = 1041)">
+ <xsl:attribute name="number:transliteration-format">一</xsl:attribute>
+ <xsl:attribute name="number:transliteration-language">ja</xsl:attribute>
+ <xsl:attribute name="number:transliteration-country">JP</xsl:attribute>
+ </xsl:when>
+ <!-- Japanese 2 ([DBNum2]) ,#1c, #0411 -->
+ <xsl:when test="$number-shape-code = 28 or ($number-code-style = '2' and $language-country-code = 1041 )">
+ <xsl:attribute name="number:transliteration-format">壹</xsl:attribute>
+ <xsl:attribute name="number:transliteration-language">ja</xsl:attribute>
+ <xsl:attribute name="number:transliteration-country">JP</xsl:attribute>
+ </xsl:when>
+ <!-- Japanese 3 ([DBNum3]), #1d, #0411 -->
+ <xsl:when test="$number-shape-code = 29 or ($number-code-style = '3' and $language-country-code = 1041 )">
+ <xsl:attribute name="number:transliteration-format">1</xsl:attribute>
+ <xsl:attribute name="number:transliteration-language">ja</xsl:attribute>
+ <xsl:attribute name="number:transliteration-country">JP</xsl:attribute>
+ </xsl:when>
+ <!-- Simplified Chinese 1 ([DBNum1]), #1e, #0804 -->
+ <xsl:when test="$number-shape-code = 30 or ($number-code-style = '1' and $language-country-code = 2052 )">
+ <xsl:attribute name="number:transliteration-format">一</xsl:attribute>
+ <xsl:attribute name="number:transliteration-language">zh</xsl:attribute>
+ <xsl:attribute name="number:transliteration-country">CN</xsl:attribute>
+ </xsl:when>
+ <!-- Simplified Chinese 2 ([DBNum2]),#1f,#0804 -->
+ <xsl:when test="$number-shape-code = 31 or ($number-code-style = '2' and $language-country-code = 2052 )">
+ <xsl:attribute name="number:transliteration-format">壹</xsl:attribute>
+ <xsl:attribute name="number:transliteration-language">zh</xsl:attribute>
+ <xsl:attribute name="number:transliteration-country">CN</xsl:attribute>
+ </xsl:when>
+ <!-- Simplified Chinese 3 ([DBNum3]), #20,#0804 -->
+ <xsl:when test="$number-shape-code = 32 or ($number-code-style = '3' and $language-country-code = 2052 )">
+ <xsl:attribute name="number:transliteration-format">1</xsl:attribute>
+ <xsl:attribute name="number:transliteration-language">zh</xsl:attribute>
+ <xsl:attribute name="number:transliteration-country">CN</xsl:attribute>
+ </xsl:when>
+ <!-- Traditional Chinese 1 ([DBNum1]), #21, #0404 -->
+ <xsl:when test="$number-shape-code = 33 or ($number-code-style = '1' and $language-country-code = 1028 )">
+ <xsl:attribute name="number:transliteration-format">一</xsl:attribute>
+ <xsl:attribute name="number:transliteration-language">zh</xsl:attribute>
+ <xsl:attribute name="number:transliteration-country">TW</xsl:attribute>
+ </xsl:when>
+ <!-- Traditional Chinese 2 ([DBNum2]), #22, #0404 -->
+ <xsl:when test="$number-shape-code = 34 or ($number-code-style = '2' and $language-country-code = 1028 )">
+ <xsl:attribute name="number:transliteration-format">壹</xsl:attribute>
+ <xsl:attribute name="number:transliteration-language">zh</xsl:attribute>
+ <xsl:attribute name="number:transliteration-country">TW</xsl:attribute>
+ </xsl:when>
+ <!-- Traditional Chinese 3 ([DBNum3]),#23, #0404 -->
+ <xsl:when test="$number-shape-code = 35 or ($number-code-style = '3' and $language-country-code = 1028 )">
+ <xsl:attribute name="number:transliteration-format">1</xsl:attribute>
+ <xsl:attribute name="number:transliteration-language">zh</xsl:attribute>
+ <xsl:attribute name="number:transliteration-country">TW</xsl:attribute>
+ </xsl:when>
+ <!-- Korean 1 ([DBNum1]), #24, #0412 -->
+ <xsl:when test="$number-shape-code = 36 or ($number-code-style = '1' and $language-country-code = 1042 )">
+ <xsl:attribute name="number:transliteration-format">一</xsl:attribute>
+ <xsl:attribute name="number:transliteration-language">ko</xsl:attribute>
+ <xsl:attribute name="number:transliteration-country">KR</xsl:attribute>
+ </xsl:when>
+ <!-- Korean 2 ([DBNum2]), #25, #0412 -->
+ <xsl:when test="$number-shape-code = 37 or ($number-code-style = '2' and $language-country-code = 1042 )">
+ <xsl:attribute name="number:transliteration-format">壹</xsl:attribute>
+ <xsl:attribute name="number:transliteration-language">ko</xsl:attribute>
+ <xsl:attribute name="number:transliteration-country">KR</xsl:attribute>
+ </xsl:when>
+ <!-- Korean 3 ([DBNum3]), #26, #0412 -->
+ <xsl:when test="$number-shape-code = 38 or ($number-code-style = '3' and $language-country-code = 1042 )">
+ <xsl:attribute name="number:transliteration-format">1</xsl:attribute>
+ <xsl:attribute name="number:transliteration-language">ko</xsl:attribute>
+ <xsl:attribute name="number:transliteration-country">KR</xsl:attribute>
+ </xsl:when>
+ <!-- Korean 4 ([DBNum4]), #27, #0412 -->
+ <xsl:when test="$number-shape-code = 39 or ($number-code-style = '4' and $language-country-code = 1042 )">
+ <xsl:attribute name="number:transliteration-format">1</xsl:attribute>
+ <xsl:attribute name="number:transliteration-language">ko</xsl:attribute>
+ <xsl:attribute name="number:transliteration-country">KR</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ <!-- components of a format code: two digits for number shape codes, two for calendar types, four for LCID -->
+ <xsl:choose>
+ <!-- totally 223 language-country LCID codes, manually created, among which MS Office 2003 supports 134, OOo supports 91 -->
+ <xsl:when test="$language-country-code = 1078">
+ <!-- Afrikaans - South Africa, #0436 -->
+ <xsl:attribute name="number:language">af</xsl:attribute>
+ <xsl:attribute name="number:country">ZA</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1052">
+ <!-- Albanian - Albania, #041c -->
+ <xsl:attribute name="number:language">sq</xsl:attribute>
+ <xsl:attribute name="number:country">AL</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1118">
+ <!-- Amharic - Ethiopia, #045e -->
+ <xsl:attribute name="number:language">am</xsl:attribute>
+ <xsl:attribute name="number:country">ET</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1025">
+ <!-- Arabic - Saudi Arabia, #0401 -->
+ <xsl:attribute name="number:language">ar</xsl:attribute>
+ <xsl:attribute name="number:country">SA</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 5121">
+ <!-- Arabic - Algeria, #1401 -->
+ <xsl:attribute name="number:language">ar</xsl:attribute>
+ <xsl:attribute name="number:country">DZ</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 15361">
+ <!-- Arabic - Bahrain, #3c01 -->
+ <xsl:attribute name="number:language">ar</xsl:attribute>
+ <xsl:attribute name="number:country">BH</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 3073">
+ <!-- Arabic - Egypt, #0c01 -->
+ <xsl:attribute name="number:language">ar</xsl:attribute>
+ <xsl:attribute name="number:country">EG</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 2049">
+ <!-- Arabic - Iraq, #0801 -->
+ <xsl:attribute name="number:language">ar</xsl:attribute>
+ <xsl:attribute name="number:country">IQ</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 11265">
+ <!-- Arabic - Jordan, #2c01 -->
+ <xsl:attribute name="number:language">ar</xsl:attribute>
+ <xsl:attribute name="number:country">JO</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 13313">
+ <!-- Arabic - Kuwait, #3401 -->
+ <xsl:attribute name="number:language">ar</xsl:attribute>
+ <xsl:attribute name="number:country">KW</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 12289">
+ <!-- Arabic - Lebanon, #3001 -->
+ <xsl:attribute name="number:language">ar</xsl:attribute>
+ <xsl:attribute name="number:country">LB</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 4097">
+ <!-- Arabic - Libya, #1001 -->
+ <xsl:attribute name="number:language">ar</xsl:attribute>
+ <xsl:attribute name="number:country">LY</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 6145">
+ <!-- Arabic - Morocco, #1801 -->
+ <xsl:attribute name="number:language">ar</xsl:attribute>
+ <xsl:attribute name="number:country">MA</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 8193">
+ <!-- Arabic - Oman, #2001 -->
+ <xsl:attribute name="number:language">ar</xsl:attribute>
+ <xsl:attribute name="number:country">OM</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 16385">
+ <!-- Arabic - Qatar, #4001 -->
+ <xsl:attribute name="number:language">ar</xsl:attribute>
+ <xsl:attribute name="number:country">QA</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 10241">
+ <!-- Arabic - Syria, #2801 -->
+ <xsl:attribute name="number:language">ar</xsl:attribute>
+ <xsl:attribute name="number:country">SY</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 7169">
+ <!-- Arabic - Tunisia, #1c01 -->
+ <xsl:attribute name="number:language">ar</xsl:attribute>
+ <xsl:attribute name="number:country">TN</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 14337">
+ <!-- Arabic - U.A.E., #3801 -->
+ <xsl:attribute name="number:language">ar</xsl:attribute>
+ <xsl:attribute name="number:country">AE</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 9217">
+ <!-- Arabic - Yemen, #2401 -->
+ <xsl:attribute name="number:language">ar</xsl:attribute>
+ <xsl:attribute name="number:country">YE</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1067">
+ <!-- Armenian - Armenia, #042b -->
+ <xsl:attribute name="number:language">hy</xsl:attribute>
+ <xsl:attribute name="number:country">AM</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1101">
+ <!-- Assamese, #044d -->
+ <xsl:attribute name="number:language">as</xsl:attribute>
+ <xsl:attribute name="number:country">IN</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 2092">
+ <!-- Azeri - Cyrillic, #082c -->
+ <xsl:attribute name="number:language">az</xsl:attribute>
+ <xsl:attribute name="number:country">AZ</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1068">
+ <!-- Azeri - Latin, #042c -->
+ <xsl:attribute name="number:language">az</xsl:attribute>
+ <xsl:attribute name="number:country">AZ</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1069">
+ <!-- Basque - France/Spain, #042d -->
+ <xsl:attribute name="number:language">eu</xsl:attribute>
+ <xsl:attribute name="number:country">ES</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1059">
+ <!-- Belarusian - Belarus, #0423 -->
+ <xsl:attribute name="number:language">be</xsl:attribute>
+ <xsl:attribute name="number:country">BY</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1093">
+ <!-- Bengali (India), #0445 -->
+ <xsl:attribute name="number:language">bn</xsl:attribute>
+ <xsl:attribute name="number:country">IN</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 2117">
+ <!-- Bengali (Bangladesh), #0845 -->
+ <xsl:attribute name="number:language">bn</xsl:attribute>
+ <xsl:attribute name="number:country">BD</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 5146">
+ <!-- Bosnian (Bosnia/Herzegovina), #141a -->
+ <xsl:attribute name="number:language">bs</xsl:attribute>
+ <xsl:attribute name="number:country">BA</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1026">
+ <!-- Bulgarian, #0402 -->
+ <xsl:attribute name="number:language">bg</xsl:attribute>
+ <xsl:attribute name="number:country">BG</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1109">
+ <!-- Burmese (Burma/Myanmar), #0455 -->
+ <xsl:attribute name="number:language">my</xsl:attribute>
+ <xsl:attribute name="number:country">MM</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1027">
+ <!-- Catalan - Spain, #0403 -->
+ <xsl:attribute name="number:language">ca</xsl:attribute>
+ <xsl:attribute name="number:country">ES</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1116">
+ <!-- Cherokee - United States, #045c -->
+ <xsl:attribute name="number:language">chr</xsl:attribute>
+ <xsl:attribute name="number:country">US</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 2052">
+ <!-- Chinese - People's Republic of China, #0804 -->
+ <xsl:attribute name="number:language">zh</xsl:attribute>
+ <xsl:attribute name="number:country">CN</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 4100">
+ <!-- Chinese - Singapore, #1004 -->
+ <xsl:attribute name="number:language">zh</xsl:attribute>
+ <xsl:attribute name="number:country">SG</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1028">
+ <!-- Chinese - Taiwan, #0404 -->
+ <xsl:attribute name="number:language">zh</xsl:attribute>
+ <xsl:attribute name="number:country">TW</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 3076">
+ <!-- Chinese - Hong Kong SAR, #0c04 -->
+ <xsl:attribute name="number:language">zh</xsl:attribute>
+ <xsl:attribute name="number:country">HK</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 5124">
+ <!-- Chinese - Macao SAR, #1404 -->
+ <xsl:attribute name="number:language">zh</xsl:attribute>
+ <xsl:attribute name="number:country">MO</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1050">
+ <!-- Croatian (Croatia), #041a -->
+ <xsl:attribute name="number:language">hr</xsl:attribute>
+ <xsl:attribute name="number:country">HR</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 4122">
+ <!-- Croatian (Bosnia/Herzegovina), #101a -->
+ <xsl:attribute name="number:language">hr</xsl:attribute>
+ <xsl:attribute name="number:country">BA</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1029">
+ <!-- Czech, #0405 -->
+ <xsl:attribute name="number:language">cs</xsl:attribute>
+ <xsl:attribute name="number:country">CZ</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1030">
+ <!-- Danish, #0406 -->
+ <xsl:attribute name="number:language">da</xsl:attribute>
+ <xsl:attribute name="number:country">DK</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1125">
+ <!-- Divehi, #0465 -->
+ <xsl:attribute name="number:language">dv</xsl:attribute>
+ <xsl:attribute name="number:country">MV</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1043">
+ <!-- Dutch - Netherlands, #0413 -->
+ <xsl:attribute name="number:language">nl</xsl:attribute>
+ <xsl:attribute name="number:country">NL</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 2067">
+ <!-- Dutch - Belgium, #0813 -->
+ <xsl:attribute name="number:language">nl</xsl:attribute>
+ <xsl:attribute name="number:country">BE</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1126">
+ <!-- Edo (Bini - Nigeria), #0466 -->
+ <xsl:attribute name="number:language">bin</xsl:attribute>
+ <xsl:attribute name="number:country">NG</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1033">
+ <!-- English - United States, #0409 -->
+ <xsl:attribute name="number:language">en</xsl:attribute>
+ <xsl:attribute name="number:country">US</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 2057">
+ <!-- English - United Kingdom, #0809 -->
+ <xsl:attribute name="number:language">en</xsl:attribute>
+ <xsl:attribute name="number:country">GB</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 3081">
+ <!-- English - Australia, #0c09 -->
+ <xsl:attribute name="number:language">en</xsl:attribute>
+ <xsl:attribute name="number:country">AU</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 10249">
+ <!-- English - Belize, #2809 -->
+ <xsl:attribute name="number:language">en</xsl:attribute>
+ <xsl:attribute name="number:country">BZ</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 4105">
+ <!-- English - Canada, #1009 -->
+ <xsl:attribute name="number:language">en</xsl:attribute>
+ <xsl:attribute name="number:country">CA</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 9225">
+ <!-- English - Caribbean (Cuba), #2409 -->
+ <xsl:attribute name="number:language">en</xsl:attribute>
+ <xsl:attribute name="number:country">CU</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 15369">
+ <!-- English - Hong Kong SAR, #3c09 -->
+ <xsl:attribute name="number:language">en</xsl:attribute>
+ <xsl:attribute name="number:country">HK</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 16393">
+ <!-- English - India, #4009 -->
+ <xsl:attribute name="number:language">en</xsl:attribute>
+ <xsl:attribute name="number:country">IN</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 14345">
+ <!-- English - Indonesia, #3809 -->
+ <xsl:attribute name="number:language">en</xsl:attribute>
+ <xsl:attribute name="number:country">ID</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 6153">
+ <!-- English - Ireland, #1809 -->
+ <xsl:attribute name="number:language">en</xsl:attribute>
+ <xsl:attribute name="number:country">IE</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 8201">
+ <!-- English - Jamaica, #2009 -->
+ <xsl:attribute name="number:language">en</xsl:attribute>
+ <xsl:attribute name="number:country">JM</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 17417">
+ <!-- English - Malaysia, #4409 -->
+ <xsl:attribute name="number:language">en</xsl:attribute>
+ <xsl:attribute name="number:country">MY</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 5129">
+ <!-- English - New Zealand, #1409 -->
+ <xsl:attribute name="number:language">en</xsl:attribute>
+ <xsl:attribute name="number:country">NZ</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 13321">
+ <!-- English - Philippines, #3409 -->
+ <xsl:attribute name="number:language">en</xsl:attribute>
+ <xsl:attribute name="number:country">PH</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 18441">
+ <!-- English - Singapore, #4809 -->
+ <xsl:attribute name="number:language">en</xsl:attribute>
+ <xsl:attribute name="number:country">SG</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 7177">
+ <!-- English - South Africa, #1c09 -->
+ <xsl:attribute name="number:language">en</xsl:attribute>
+ <xsl:attribute name="number:country">ZA</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 11273">
+ <!-- English - Trinidad, #2c09 -->
+ <xsl:attribute name="number:language">en</xsl:attribute>
+ <xsl:attribute name="number:country">TT</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 12297">
+ <!-- English - Zimbabwe, #3009 -->
+ <xsl:attribute name="number:language">en</xsl:attribute>
+ <xsl:attribute name="number:country">ZW</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1061">
+ <!-- Estonian (Estonia), #0425 -->
+ <xsl:attribute name="number:language">et</xsl:attribute>
+ <xsl:attribute name="number:country">EE</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1080">
+ <!-- Faroese (Faroe Islands), #0438 -->
+ <xsl:attribute name="number:language">fo</xsl:attribute>
+ <xsl:attribute name="number:country">FO</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1065">
+ <!-- Farsi (Persian/Iran), #0429 -->
+ <xsl:attribute name="number:language">fa</xsl:attribute>
+ <xsl:attribute name="number:country">IR</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1124">
+ <!-- Filipino (Philippine), #0464 -->
+ <xsl:attribute name="number:language">phi</xsl:attribute>
+ <xsl:attribute name="number:country">PH</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1035">
+ <!-- Finnish, #040b -->
+ <xsl:attribute name="number:language">fi</xsl:attribute>
+ <xsl:attribute name="number:country">FI</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1036">
+ <!-- French - France, #040c -->
+ <xsl:attribute name="number:language">fr</xsl:attribute>
+ <xsl:attribute name="number:country">FR</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 2060">
+ <!-- French - Belgium, #080c -->
+ <xsl:attribute name="number:language">fr</xsl:attribute>
+ <xsl:attribute name="number:country">BE</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 11276">
+ <!-- French - Cameroon, #2c0c -->
+ <xsl:attribute name="number:language">fr</xsl:attribute>
+ <xsl:attribute name="number:country">CM</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 3084">
+ <!-- French - Canada, #0c0c -->
+ <xsl:attribute name="number:language">fr</xsl:attribute>
+ <xsl:attribute name="number:country">CA</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 9228">
+ <!-- French - Congo, #240c -->
+ <xsl:attribute name="number:language">fr</xsl:attribute>
+ <xsl:attribute name="number:country">CG</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 12300">
+ <!-- French - Cote d'Ivoire, #300c -->
+ <xsl:attribute name="number:language">fr</xsl:attribute>
+ <xsl:attribute name="number:country">CI</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 15372">
+ <!-- French - Haiti, #3c0c -->
+ <xsl:attribute name="number:language">fr</xsl:attribute>
+ <xsl:attribute name="number:country">HT</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 5132">
+ <!-- French - Luxembourg, #140c -->
+ <xsl:attribute name="number:language">fr</xsl:attribute>
+ <xsl:attribute name="number:country">LU</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 13324">
+ <!-- French - Mali, #340c -->
+ <xsl:attribute name="number:language">fr</xsl:attribute>
+ <xsl:attribute name="number:country">ML</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 6156">
+ <!-- French - Monaco, #180c -->
+ <xsl:attribute name="number:language">fr</xsl:attribute>
+ <xsl:attribute name="number:country">MC</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 14348">
+ <!-- French - Morocco, #380c -->
+ <xsl:attribute name="number:language">fr</xsl:attribute>
+ <xsl:attribute name="number:country">MA</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 58380">
+ <!-- French - North Africa (Algeria), #e40c -->
+ <xsl:attribute name="number:language">fr</xsl:attribute>
+ <xsl:attribute name="number:country">DZ</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 8204">
+ <!-- French - Reunion, #200c -->
+ <xsl:attribute name="number:language">fr</xsl:attribute>
+ <xsl:attribute name="number:country">RE</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 10252">
+ <!-- French - Senegal, #280c -->
+ <xsl:attribute name="number:language">fr</xsl:attribute>
+ <xsl:attribute name="number:country">SN</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 4108">
+ <!-- French - Switzerland, #100c -->
+ <xsl:attribute name="number:language">fr</xsl:attribute>
+ <xsl:attribute name="number:country">CH</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1122">
+ <!-- Frisian - Netherlands, #0462 -->
+ <xsl:attribute name="number:language">fy</xsl:attribute>
+ <xsl:attribute name="number:country">NL</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1127">
+ <!-- Fulfude (Fulah) - Nigeria, #0467 -->
+ <xsl:attribute name="number:language">ff</xsl:attribute>
+ <xsl:attribute name="number:country">NG</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1071">
+ <!-- FYRO Macedonian, #042f -->
+ <xsl:attribute name="number:language">mk</xsl:attribute>
+ <xsl:attribute name="number:country">MK</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 2108">
+ <!-- Gaelic (Ireland), #083c -->
+ <xsl:attribute name="number:language">gd</xsl:attribute>
+ <xsl:attribute name="number:country">IE</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1084">
+ <!-- Gaelic (Scotland), #043c -->
+ <xsl:attribute name="number:language">gd</xsl:attribute>
+ <xsl:attribute name="number:country">GB</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1110">
+ <!-- Galician (Gallegan) - Spain, #0456 -->
+ <xsl:attribute name="number:language">gl</xsl:attribute>
+ <xsl:attribute name="number:country">ES</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1079">
+ <!-- Georgian - Georgia, #0437 -->
+ <xsl:attribute name="number:language">ka</xsl:attribute>
+ <xsl:attribute name="number:country">GE</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1031">
+ <!-- German - Germany, #0407 -->
+ <xsl:attribute name="number:language">de</xsl:attribute>
+ <xsl:attribute name="number:country">DE</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 3079">
+ <!-- German - Austria, #0c07 -->
+ <xsl:attribute name="number:language">de</xsl:attribute>
+ <xsl:attribute name="number:country">AT</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 5127">
+ <!-- German - Liechtenstein, #1407 -->
+ <xsl:attribute name="number:language">de</xsl:attribute>
+ <xsl:attribute name="number:country">LI</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 4103">
+ <!-- German - Luxembourg, #1007 -->
+ <xsl:attribute name="number:language">de</xsl:attribute>
+ <xsl:attribute name="number:country">LU</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 2055">
+ <!-- German - Switzerland, #0807 -->
+ <xsl:attribute name="number:language">de</xsl:attribute>
+ <xsl:attribute name="number:country">CH</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1032">
+ <!-- Greek, #0408 -->
+ <xsl:attribute name="number:language">el</xsl:attribute>
+ <xsl:attribute name="number:country">GR</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1140">
+ <!-- Guarani - Paraguay, #0474 -->
+ <xsl:attribute name="number:language">gn</xsl:attribute>
+ <xsl:attribute name="number:country">PY</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1095">
+ <!-- Gujarati - India, #0447 -->
+ <xsl:attribute name="number:language">gu</xsl:attribute>
+ <xsl:attribute name="number:country">IN</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1128">
+ <!-- Hausa - Nigeria, #0468 -->
+ <xsl:attribute name="number:language">ha</xsl:attribute>
+ <xsl:attribute name="number:country">NG</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1141">
+ <!-- Hawaiian - US, #0475 -->
+ <xsl:attribute name="number:language">haw</xsl:attribute>
+ <xsl:attribute name="number:country">US</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1037">
+ <!-- Hebrew, #040d -->
+ <xsl:attribute name="number:language">he</xsl:attribute>
+ <xsl:attribute name="number:country">IL</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1081">
+ <!-- Hindi (India), #0439 -->
+ <xsl:attribute name="number:language">hi</xsl:attribute>
+ <xsl:attribute name="number:country">IN</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1038">
+ <!-- Hungarian - Hungary, #040e -->
+ <xsl:attribute name="number:language">hu</xsl:attribute>
+ <xsl:attribute name="number:country">HU</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1129">
+ <!-- Ibibio (Niger-Kordofanian) - Nigeria, #0469 -->
+ <xsl:attribute name="number:language">nic</xsl:attribute>
+ <xsl:attribute name="number:country">NG</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1039">
+ <!-- Icelandic, #040f -->
+ <xsl:attribute name="number:language">is</xsl:attribute>
+ <xsl:attribute name="number:country">IS</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1136">
+ <!-- Igbo - Nigeria, #0470 -->
+ <xsl:attribute name="number:language">ig</xsl:attribute>
+ <xsl:attribute name="number:country">NG</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1057">
+ <!-- Indonesian, #0421 -->
+ <xsl:attribute name="number:language">id</xsl:attribute>
+ <xsl:attribute name="number:country">ID</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1117">
+ <!-- Inuktitut - US, #045d -->
+ <xsl:attribute name="number:language">iu</xsl:attribute>
+ <xsl:attribute name="number:country">US</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1040">
+ <!-- Italian - Italy, #0410 -->
+ <xsl:attribute name="number:language">it</xsl:attribute>
+ <xsl:attribute name="number:country">IT</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 2064">
+ <!-- Italian - Switzerland, #0810 -->
+ <xsl:attribute name="number:language">it</xsl:attribute>
+ <xsl:attribute name="number:country">CH</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1041">
+ <!-- Japanese, #0411 -->
+ <xsl:attribute name="number:language">ja</xsl:attribute>
+ <xsl:attribute name="number:country">JP</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1099">
+ <!-- Kannada (India), #044b -->
+ <xsl:attribute name="number:language">kn</xsl:attribute>
+ <xsl:attribute name="number:country">IN</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1137">
+ <!-- Kanuri - Nigeria, #0471 -->
+ <xsl:attribute name="number:language">kr</xsl:attribute>
+ <xsl:attribute name="number:country">NG</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 2144">
+ <!-- Kashmiri (India), #0860 -->
+ <xsl:attribute name="number:language">ks</xsl:attribute>
+ <xsl:attribute name="number:country">IN</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1120">
+ <!-- Kashmiri (Arabic), #0460 -->
+ <xsl:attribute name="number:language">ks</xsl:attribute>
+ <xsl:attribute name="number:country">PK</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1087">
+ <!-- Kazakh, #043f -->
+ <xsl:attribute name="number:language">kk</xsl:attribute>
+ <xsl:attribute name="number:country">KZ</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1107">
+ <!-- Khmer (Cambodian), #0453 -->
+ <xsl:attribute name="number:language">km</xsl:attribute>
+ <xsl:attribute name="number:country">KH</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1111">
+ <!-- Konkani (India), #0457 -->
+ <xsl:attribute name="number:language">kok</xsl:attribute>
+ <xsl:attribute name="number:country">IN</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1042">
+ <!-- Korean, #0412 -->
+ <xsl:attribute name="number:language">ko</xsl:attribute>
+ <xsl:attribute name="number:country">KR</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1088">
+ <!-- Kyrgyz ( Kirgiz / Cyrillic), #0440 -->
+ <xsl:attribute name="number:language">ky</xsl:attribute>
+ <xsl:attribute name="number:country">KG</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1108">
+ <!-- Lao, #0454 -->
+ <xsl:attribute name="number:language">lo</xsl:attribute>
+ <xsl:attribute name="number:country">LA</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1142">
+ <!-- Latin, #0476 -->
+ <xsl:attribute name="number:language">la</xsl:attribute>
+ <xsl:attribute name="number:country">IT</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1062">
+ <!-- Latvian, #0426 -->
+ <xsl:attribute name="number:language">lv</xsl:attribute>
+ <xsl:attribute name="number:country">LV</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1063">
+ <!-- Lithuanian, #0427 -->
+ <xsl:attribute name="number:language">lt</xsl:attribute>
+ <xsl:attribute name="number:country">LT</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1086">
+ <!-- Malay - Malaysia, #043e -->
+ <xsl:attribute name="number:language">ms</xsl:attribute>
+ <xsl:attribute name="number:country">MY</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 2110">
+ <!-- Malay - Brunei Darussalam, #083e -->
+ <xsl:attribute name="number:language">ms</xsl:attribute>
+ <xsl:attribute name="number:country">BN</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1071">
+ <!-- Macedonian (FYROM), #042f -->
+ <xsl:attribute name="number:language">mk</xsl:attribute>
+ <xsl:attribute name="number:country">MK</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1100">
+ <!-- Malayalam (India), #044c -->
+ <xsl:attribute name="number:language">ml</xsl:attribute>
+ <xsl:attribute name="number:country">IN</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1082">
+ <!-- Maltese, #043a -->
+ <xsl:attribute name="number:language">mt</xsl:attribute>
+ <xsl:attribute name="number:country">MT</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1112">
+ <!-- Manipuri (India), #0458 -->
+ <xsl:attribute name="number:language">mni</xsl:attribute>
+ <xsl:attribute name="number:country">IN</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1153">
+ <!-- Maori - New Zealand, #0481 -->
+ <xsl:attribute name="number:language">mi</xsl:attribute>
+ <xsl:attribute name="number:country">NZ</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1102">
+ <!-- Marathi (India), #044e -->
+ <xsl:attribute name="number:language">mr</xsl:attribute>
+ <xsl:attribute name="number:country">IN</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1104">
+ <!-- Mongolian (Cyrillic), #0450 -->
+ <xsl:attribute name="number:language">mn</xsl:attribute>
+ <xsl:attribute name="number:country">MN</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 2128">
+ <!-- Mongolian (Mongolian), #0850 -->
+ <xsl:attribute name="number:language">mn</xsl:attribute>
+ <xsl:attribute name="number:country">CN</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1121">
+ <!-- Nepali, #0461 -->
+ <xsl:attribute name="number:language">ne</xsl:attribute>
+ <xsl:attribute name="number:country">NP</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 2145">
+ <!-- Nepali (India), #0861 -->
+ <xsl:attribute name="number:language">ne</xsl:attribute>
+ <xsl:attribute name="number:country">IN</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1044">
+ <!-- Norwegian (Bokmal), #0414 -->
+ <xsl:attribute name="number:language">nb</xsl:attribute>
+ <xsl:attribute name="number:country">NO</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 2068">
+ <!-- Norwegian (Nynorsk), #0814 -->
+ <xsl:attribute name="number:language">nn</xsl:attribute>
+ <xsl:attribute name="number:country">NO</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1096">
+ <!-- Oriya (India), #0448 -->
+ <xsl:attribute name="number:language">or</xsl:attribute>
+ <xsl:attribute name="number:country">IN</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1138">
+ <!-- Oromo (Ethiopia), #0472 -->
+ <xsl:attribute name="number:language">om</xsl:attribute>
+ <xsl:attribute name="number:country">ET</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1145">
+ <!-- Papiamentu (Netherlands Antilles), #0479 -->
+ <xsl:attribute name="number:language">pap</xsl:attribute>
+ <xsl:attribute name="number:country">AN</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1123">
+ <!-- Pashto (Afghanistan), #0463 -->
+ <xsl:attribute name="number:language">ps</xsl:attribute>
+ <xsl:attribute name="number:country">AF</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1045">
+ <!-- Polish, #0415 -->
+ <xsl:attribute name="number:language">pl</xsl:attribute>
+ <xsl:attribute name="number:country">PL</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1046">
+ <!-- Portuguese - Brazil, #0416 -->
+ <xsl:attribute name="number:language">pt</xsl:attribute>
+ <xsl:attribute name="number:country">BR</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 2070">
+ <!-- Portuguese - Portugal, #0816 -->
+ <xsl:attribute name="number:language">pt</xsl:attribute>
+ <xsl:attribute name="number:country">PT</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1094">
+ <!-- Punjabi, #0446 -->
+ <xsl:attribute name="number:language">pa</xsl:attribute>
+ <xsl:attribute name="number:country">IN</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 2118">
+ <!-- Punjabi (Pakistan), #0846 -->
+ <xsl:attribute name="number:language">pa</xsl:attribute>
+ <xsl:attribute name="number:country">PK</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1131">
+ <!-- Quecha - Blivia, #046b -->
+ <xsl:attribute name="number:language">qu</xsl:attribute>
+ <xsl:attribute name="number:country">BO</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 2155">
+ <!-- Quecha - Ecuador, #086b -->
+ <xsl:attribute name="number:language">qu</xsl:attribute>
+ <xsl:attribute name="number:country">EC</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 3179">
+ <!-- Quecha - peru, #0c6b -->
+ <xsl:attribute name="number:language">qu</xsl:attribute>
+ <xsl:attribute name="number:country">PE</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1047">
+ <!-- Rhaeto-Romanic (Italy), #0417 -->
+ <xsl:attribute name="number:language">rm</xsl:attribute>
+ <xsl:attribute name="number:country">IT</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1048">
+ <!-- Romanian, #0418 -->
+ <xsl:attribute name="number:language">ro</xsl:attribute>
+ <xsl:attribute name="number:country">RO</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 2072">
+ <!-- Romanian - Moldova, #0818 -->
+ <xsl:attribute name="number:language">ro</xsl:attribute>
+ <xsl:attribute name="number:country">MD</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1049">
+ <!-- Russian, #0419 -->
+ <xsl:attribute name="number:language">ru</xsl:attribute>
+ <xsl:attribute name="number:country">RU</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 2073">
+ <!-- Russian - Moldova, #0819 -->
+ <xsl:attribute name="number:language">ru</xsl:attribute>
+ <xsl:attribute name="number:country">MD</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1083">
+ <!-- Sami (Lappish), # (Northern Sami - Sweden), #043b -->
+ <xsl:attribute name="number:language">se</xsl:attribute>
+ <xsl:attribute name="number:country">SE</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1103">
+ <!-- Sanskrit (India), #044f -->
+ <xsl:attribute name="number:language">sa</xsl:attribute>
+ <xsl:attribute name="number:country">IN</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1132">
+ <!-- Sepedi (Northern Sotho - South Africa), #046c -->
+ <xsl:attribute name="number:language">nso</xsl:attribute>
+ <xsl:attribute name="number:country">ZA</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 3098">
+ <!-- Serbian (Cyrillic - Serbia Yugoslavia), #0c1a -->
+ <xsl:attribute name="number:language">sr</xsl:attribute>
+ <xsl:attribute name="number:country">YU</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 2074">
+ <!-- Serbian (Latin - Croatia), #081a -->
+ <xsl:attribute name="number:language">sr</xsl:attribute>
+ <xsl:attribute name="number:country">HR</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1113">
+ <!-- Sindhi - India,#0459 -->
+ <xsl:attribute name="number:language">sd</xsl:attribute>
+ <xsl:attribute name="number:country">IN</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 2137">
+ <!-- Sindhi - Pakistan, #0859 -->
+ <xsl:attribute name="number:language">sd</xsl:attribute>
+ <xsl:attribute name="number:country">PK</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1115">
+ <!-- Sinhalese - Sri Lanka, #045b -->
+ <xsl:attribute name="number:language">si</xsl:attribute>
+ <xsl:attribute name="number:country">LK</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1051">
+ <!-- Slovak, #041b -->
+ <xsl:attribute name="number:language">sk</xsl:attribute>
+ <xsl:attribute name="number:country">SK</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1060">
+ <!-- Slovenian, #0424 -->
+ <xsl:attribute name="number:language">sl</xsl:attribute>
+ <xsl:attribute name="number:country">SI</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1143">
+ <!-- Somali, #0477 -->
+ <xsl:attribute name="number:language">so</xsl:attribute>
+ <xsl:attribute name="number:country">SO</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1070">
+ <!-- Sorbian, #042e -->
+ <xsl:attribute name="number:language">wen</xsl:attribute>
+ <xsl:attribute name="number:country">DE</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 3082">
+ <!-- Spanish - Spain (Modern/International Sort), #0c0a -->
+ <xsl:attribute name="number:language">es</xsl:attribute>
+ <xsl:attribute name="number:country">ES</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1034">
+ <!-- Spanish - Spain (Traditional Sort), #040a -->
+ <xsl:attribute name="number:language">es</xsl:attribute>
+ <xsl:attribute name="number:country">ES</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 11274">
+ <!-- Spanish - Argentina, #2c0a -->
+ <xsl:attribute name="number:language">es</xsl:attribute>
+ <xsl:attribute name="number:country">AR</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 16394">
+ <!-- Spanish - Bolivia, #400a -->
+ <xsl:attribute name="number:language">es</xsl:attribute>
+ <xsl:attribute name="number:country">BO</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 13322">
+ <!-- Spanish - Chile, #340a -->
+ <xsl:attribute name="number:language">es</xsl:attribute>
+ <xsl:attribute name="number:country">CL</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 9226">
+ <!-- Spanish - Colombia, #240a -->
+ <xsl:attribute name="number:language">es</xsl:attribute>
+ <xsl:attribute name="number:country">CO</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 5130">
+ <!-- Spanish - Costa Rica, #140a -->
+ <xsl:attribute name="number:language">es</xsl:attribute>
+ <xsl:attribute name="number:country">CR</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 7178">
+ <!-- Spanish - Dominican Republic, #1c0a -->
+ <xsl:attribute name="number:language">es</xsl:attribute>
+ <xsl:attribute name="number:country">DO</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 12298">
+ <!-- Spanish - Ecuador, #300a -->
+ <xsl:attribute name="number:language">es</xsl:attribute>
+ <xsl:attribute name="number:country">EC</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 17418">
+ <!-- Spanish - EL Salvador, #440a -->
+ <xsl:attribute name="number:language">es</xsl:attribute>
+ <xsl:attribute name="number:country">SV</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 4106">
+ <!-- Spanish - Guatemala, #100a -->
+ <xsl:attribute name="number:language">es</xsl:attribute>
+ <xsl:attribute name="number:country">GT</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 18442">
+ <!-- Spanish - Honduras, #480a -->
+ <xsl:attribute name="number:language">es</xsl:attribute>
+ <xsl:attribute name="number:country">HN</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 58378">
+ <!-- Spanish - Latin America (Argentina), #e40a -->
+ <xsl:attribute name="number:language">es</xsl:attribute>
+ <xsl:attribute name="number:country">AR</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 2058">
+ <!-- Spanish - Mexico, #080a -->
+ <xsl:attribute name="number:language">es</xsl:attribute>
+ <xsl:attribute name="number:country">MX</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 19466">
+ <!-- Spanish - Nicaragua, #4c0a -->
+ <xsl:attribute name="number:language">es</xsl:attribute>
+ <xsl:attribute name="number:country">NI</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 6154">
+ <!-- Spanish - Panama, #180a -->
+ <xsl:attribute name="number:language">es</xsl:attribute>
+ <xsl:attribute name="number:country">PA</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 15370">
+ <!-- Spanish - Paraguay, #3c0a -->
+ <xsl:attribute name="number:language">es</xsl:attribute>
+ <xsl:attribute name="number:country">PY</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 10250">
+ <!-- Spanish - Peru, #280a -->
+ <xsl:attribute name="number:language">es</xsl:attribute>
+ <xsl:attribute name="number:country">PE</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 20490">
+ <!-- Spanish - Puerto Rico, #500a -->
+ <xsl:attribute name="number:language">es</xsl:attribute>
+ <xsl:attribute name="number:country">PR</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 21514">
+ <!-- Spanish - US, #540a -->
+ <xsl:attribute name="number:language">es</xsl:attribute>
+ <xsl:attribute name="number:country">US</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 14346">
+ <!-- Spanish - Uruguay, #380a -->
+ <xsl:attribute name="number:language">es</xsl:attribute>
+ <xsl:attribute name="number:country">UY</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 8202">
+ <!-- Spanish - Venezuela, #200a -->
+ <xsl:attribute name="number:language">es</xsl:attribute>
+ <xsl:attribute name="number:country">VE</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1072">
+ <!-- Sutu (Ngoni - Tanzania), #0430 -->
+ <xsl:attribute name="number:language">bnt</xsl:attribute>
+ <xsl:attribute name="number:country">TZ</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1089">
+ <!-- Swahili (Tanzania), #0441 -->
+ <xsl:attribute name="number:language">sw</xsl:attribute>
+ <xsl:attribute name="number:country">TZ</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1053">
+ <!-- Swedish (Sweden), #041d -->
+ <xsl:attribute name="number:language">sv</xsl:attribute>
+ <xsl:attribute name="number:country">SE</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 2077">
+ <!-- Swedish - Finland, #081d -->
+ <xsl:attribute name="number:language">sv</xsl:attribute>
+ <xsl:attribute name="number:country">FI</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1114">
+ <!-- Syriac (Syria), #045a -->
+ <xsl:attribute name="number:language">syr</xsl:attribute>
+ <xsl:attribute name="number:country">SY</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1064">
+ <!-- Tajik, #0428 -->
+ <xsl:attribute name="number:language">tg</xsl:attribute>
+ <xsl:attribute name="number:country">TJ</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1119">
+ <!-- Tamazight (Arabic), #045f -->
+ <xsl:attribute name="number:language">ber</xsl:attribute>
+ <xsl:attribute name="number:country">ML</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 2143">
+ <!-- Tamazight (Latin), #085f -->
+ <xsl:attribute name="number:language">ber</xsl:attribute>
+ <xsl:attribute name="number:country">MA</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1097">
+ <!-- Tamil (India), #0449 -->
+ <xsl:attribute name="number:language">ta</xsl:attribute>
+ <xsl:attribute name="number:country">IN</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1092">
+ <!-- Tatar (Russia), #0444 -->
+ <xsl:attribute name="number:language">tt</xsl:attribute>
+ <xsl:attribute name="number:country">RU</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1098">
+ <!-- Telugu (India), #044a -->
+ <xsl:attribute name="number:language">te</xsl:attribute>
+ <xsl:attribute name="number:country">IN</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1054">
+ <!-- Thai, #041e -->
+ <xsl:attribute name="number:language">th</xsl:attribute>
+ <xsl:attribute name="number:country">TH</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 2129">
+ <!-- Tibetan - Bhutan, #0851 -->
+ <xsl:attribute name="number:language">bo</xsl:attribute>
+ <xsl:attribute name="number:country">BT</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1105">
+ <!-- Tibetan - Peoples' Republic of China, #0451 -->
+ <xsl:attribute name="number:language">bo</xsl:attribute>
+ <xsl:attribute name="number:country">CN</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 2163">
+ <!-- Tigrigna (Tigrinya) - Eritrea, #0873 -->
+ <xsl:attribute name="number:language">ti</xsl:attribute>
+ <xsl:attribute name="number:country">ER</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1139">
+ <!-- Tigrigna (Tigrinya) - Ethiopia, #0473 -->
+ <xsl:attribute name="number:language">ti</xsl:attribute>
+ <xsl:attribute name="number:country">ET</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1073">
+ <!-- Tsonga (South Africa), #0431 -->
+ <xsl:attribute name="number:language">ts</xsl:attribute>
+ <xsl:attribute name="number:country">ZA</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1074">
+ <!-- Tswana (South Africa), #0432 -->
+ <xsl:attribute name="number:language">tn</xsl:attribute>
+ <xsl:attribute name="number:country">ZA</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1055">
+ <!-- Turkish, #041f -->
+ <xsl:attribute name="number:language">tr</xsl:attribute>
+ <xsl:attribute name="number:country">TR</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1090">
+ <!-- Turkmen, #0442 -->
+ <xsl:attribute name="number:language">tk</xsl:attribute>
+ <xsl:attribute name="number:country">TM</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1152">
+ <!-- Uighur - China, #0480 -->
+ <xsl:attribute name="number:language">ug</xsl:attribute>
+ <xsl:attribute name="number:country">CN</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1058">
+ <!-- Ukrainian, #0422 -->
+ <xsl:attribute name="number:language">uk</xsl:attribute>
+ <xsl:attribute name="number:country">UA</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1056">
+ <!-- Urdu (Pakistan), #0420 -->
+ <xsl:attribute name="number:language">ur</xsl:attribute>
+ <xsl:attribute name="number:country">PK</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 2080">
+ <!-- Urdu - India, #0820 -->
+ <xsl:attribute name="number:language">ur</xsl:attribute>
+ <xsl:attribute name="number:country">IN</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 2115">
+ <!-- Uzbek (Cyrillic), #0843 -->
+ <xsl:attribute name="number:language">uz</xsl:attribute>
+ <xsl:attribute name="number:country">UZ</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1091">
+ <!-- Uzbek (Latin), #0443 -->
+ <xsl:attribute name="number:language">uz</xsl:attribute>
+ <xsl:attribute name="number:country">UZ</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1075">
+ <!-- Venda (South Africa), #0433 -->
+ <xsl:attribute name="number:language">ve</xsl:attribute>
+ <xsl:attribute name="number:country">ZA</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1066">
+ <!-- Vietnamese, #042a -->
+ <xsl:attribute name="number:language">vi</xsl:attribute>
+ <xsl:attribute name="number:country">VN</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1106">
+ <!-- Welsh (UK), #0452 -->
+ <xsl:attribute name="number:language">cy</xsl:attribute>
+ <xsl:attribute name="number:country">UK</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1076">
+ <!-- Xhosa (South Africa), #0434 -->
+ <xsl:attribute name="number:language">xh</xsl:attribute>
+ <xsl:attribute name="number:country">ZA</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1144">
+ <!-- Yi (Sino-Tibetan - China), #0478 -->
+ <xsl:attribute name="number:language">sit</xsl:attribute>
+ <xsl:attribute name="number:country">CN</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1085">
+ <!-- Yiddish (Jews - Israel), #043d -->
+ <xsl:attribute name="number:language">yi</xsl:attribute>
+ <xsl:attribute name="number:country">IL</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1130">
+ <!-- Yoruba (Nigeria), #046a -->
+ <xsl:attribute name="number:language">yo</xsl:attribute>
+ <xsl:attribute name="number:country">NG</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1077">
+ <!-- Zulu (South Africa), #0435 -->
+ <xsl:attribute name="number:language">zu</xsl:attribute>
+ <xsl:attribute name="number:country">ZA</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-number-format-condition">
+ <xsl:param name="number-format-unit"/>
+ <xsl:choose>
+ <xsl:when test="contains($number-format-unit, '[&gt;')">
+ <xsl:value-of select="concat('&gt;', substring-before( substring-after($number-format-unit,'[&gt;'), ']'))"/>
+ </xsl:when>
+ <xsl:when test="contains($number-format-unit, '[&lt;')">
+ <xsl:value-of select="concat('&lt;', substring-before( substring-after($number-format-unit,'[&lt;'), ']'))"/>
+ </xsl:when>
+ <xsl:when test="contains($number-format-unit, '[=')">
+ <xsl:value-of select="concat('=', substring-before( substring-after($number-format-unit,'[='), ']'))"/>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="add-number-text-value">
+ <xsl:param name="style-type-name"/>
+ <xsl:param name="number-format-unit"/>
+ <xsl:param name="unit-pos"/>
+ <xsl:param name="condition-pos"/>
+ <xsl:param name="isNumberTextElementOpened" select="false()"/>
+ <xsl:param name="numberTextValue"/>
+ <xsl:param name="posed-number-format-unit"/>
+ <xsl:param name="finished" select="false()"/>
+ <xsl:choose>
+ <xsl:when test="not($finished)">
+ <xsl:choose>
+<!-- <xsl:when test="$style-type-name='number:text-style' or $style-type-name='number:date-style'"> -->
+ <xsl:when test="$style-type-name='number:text-style'">
+ <xsl:choose>
+ <xsl:when test="$isNumberTextElementOpened">
+ <number:text-content/>
+ <number:text>
+ <xsl:copy-of select="$numberTextValue"/>
+ </number:text>
+ <xsl:call-template name="get-number-text-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ <xsl:with-param name="isNumberTextElementOpened" select="true()"/>
+ <xsl:with-param name="posed-number-format-unit" select="$posed-number-format-unit"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <number:text>
+ <xsl:copy-of select="$numberTextValue"/>
+ </number:text>
+ <xsl:call-template name="get-number-text-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ <xsl:with-param name="isNumberTextElementOpened" select="true()"/>
+ <xsl:with-param name="posed-number-format-unit" select="$posed-number-format-unit"/>
+ </xsl:call-template>
+ <xsl:call-template name="get-number-text-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ <xsl:with-param name="posed-number-format-unit" select="$posed-number-format-unit"/>
+ <xsl:with-param name="finished" select="true()"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$style-type-name='number:number-style'">
+ <xsl:choose>
+ <xsl:when test="$isNumberTextElementOpened">
+ <xsl:copy-of select="$numberTextValue"/>
+ <xsl:call-template name="get-number-text-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ <xsl:with-param name="isNumberTextElementOpened" select="true()"/>
+ <xsl:with-param name="posed-number-format-unit" select="$posed-number-format-unit"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <number:text>
+ <xsl:copy-of select="$numberTextValue"/>
+ <xsl:call-template name="get-number-text-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ <xsl:with-param name="isNumberTextElementOpened" select="true()"/>
+ <xsl:with-param name="posed-number-format-unit" select="$posed-number-format-unit"/>
+ </xsl:call-template>
+ </number:text>
+ <xsl:call-template name="get-number-text-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ <xsl:with-param name="posed-number-format-unit" select="$posed-number-format-unit"/>
+ <xsl:with-param name="finished" select="true()"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <number:text>
+ <xsl:copy-of select="$numberTextValue"/>
+ </number:text>
+ <xsl:choose>
+ <xsl:when test="starts-with($posed-number-format-unit, '\')">
+ <xsl:call-template name="get-number-text-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ <xsl:with-param name="posed-number-format-unit" select="$posed-number-format-unit"/>
+ <xsl:with-param name="finished" select="false()" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="get-number-text-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ <xsl:with-param name="posed-number-format-unit" select="$posed-number-format-unit"/>
+ <xsl:with-param name="finished" select="true()" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="get-number-text-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ <xsl:with-param name="posed-number-format-unit" select="$posed-number-format-unit"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-number-text-content">
+ <xsl:param name="style-type-name"/>
+ <xsl:param name="number-format-unit"/>
+ <xsl:param name="unit-pos"/>
+ <xsl:param name="condition-pos"/>
+ <xsl:param name="isNumberTextElementOpened" select="false()"/>
+ <xsl:param name="finished" select="false()"/>
+ <xsl:param name="posed-number-format-unit"/>
+ <!-- process number-format-unit by character string parser -->
+ <xsl:choose>
+ <xsl:when test="starts-with( $posed-number-format-unit, '\') or starts-with( $posed-number-format-unit, '*')">
+ <xsl:choose>
+ <xsl:when test="not($finished)">
+ <xsl:call-template name="add-number-text-value">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 2"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ <xsl:with-param name="isNumberTextElementOpened" select="$isNumberTextElementOpened"/>
+ <xsl:with-param name="posed-number-format-unit" select="substring($number-format-unit,$unit-pos + 2)"/>
+ <!-- place '*' temparily here, because now StarCalc doesn't support variable filling character definition -->
+ <xsl:with-param name="numberTextValue" select="substring($posed-number-format-unit,2,1)"/>
+ <xsl:with-param name="finished" select="$finished"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="get-number-text-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 2"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ <xsl:with-param name="posed-number-format-unit" select="substring($number-format-unit,$unit-pos +2)"/>
+ <xsl:with-param name="finished" select="true()"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, '_')">
+ <xsl:choose>
+ <xsl:when test="not($finished)">
+ <xsl:call-template name="add-number-text-value">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 2"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ <xsl:with-param name="isNumberTextElementOpened" select="$isNumberTextElementOpened"/>
+ <xsl:with-param name="posed-number-format-unit" select="substring($number-format-unit,$unit-pos + 2)"/>
+ <!-- adding an empty string -->
+ <xsl:with-param name="numberTextValue" select="' '"/>
+ <xsl:with-param name="finished" select="$finished"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="get-number-text-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 2"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ <xsl:with-param name="posed-number-format-unit" select="substring($number-format-unit,$unit-pos + 2)"/>
+ <xsl:with-param name="finished" select="true()"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, '&quot;')">
+ <xsl:choose>
+ <xsl:when test="not($finished)">
+ <!-- creating a pre-character string -->
+ <xsl:variable name="pre-character-string" select="substring-before(substring($posed-number-format-unit,2), '&quot;')"/>
+ <xsl:call-template name="add-number-text-value">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + string-length($pre-character-string) + 2"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ <xsl:with-param name="posed-number-format-unit" select="substring($number-format-unit,$unit-pos + string-length($pre-character-string) + 2)"/>
+ <xsl:with-param name="isNumberTextElementOpened" select="$isNumberTextElementOpened"/>
+ <xsl:with-param name="numberTextValue" select="$pre-character-string"/>
+ <xsl:with-param name="finished" select="$finished"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- creating a pre-character string -->
+ <xsl:variable name="pre-character-string" select="substring-before(substring($posed-number-format-unit,2), '&quot;')"/>
+ <xsl:call-template name="get-number-text-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + string-length($pre-character-string) + 2"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ <xsl:with-param name="posed-number-format-unit" select="substring($number-format-unit,$unit-pos + string-length($pre-character-string) + 2)"/>
+ <xsl:with-param name="finished" select="true()"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="$finished">
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="create-number-format-content">
+ <xsl:param name="style-type-name"/>
+ <xsl:param name="number-format-unit"/>
+ <xsl:param name="unit-pos"/>
+ <xsl:param name="condition-pos"/>
+ <xsl:param name="isNumberTextElementOpened" select="false()"/>
+ <xsl:variable name="posed-number-format-unit" select="substring($number-format-unit,$unit-pos)"/>
+ <xsl:variable name="calendar-type-name">
+ <xsl:if test="contains( $number-format-unit, '[$')">
+ <xsl:variable name="format-code" select="substring-before( substring-after( substring-after( $number-format-unit, '[$'), '-'), ']')"/>
+ <xsl:if test="string-length( $format-code) &gt; 4">
+ <xsl:call-template name="get-calendar-type-name">
+ <xsl:with-param name="calendar-type" select="substring( $format-code, string-length($format-code) -5, 2)"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:if>
+ </xsl:variable>
+ <!-- process number-format-unit by character string parser -->
+ <xsl:choose>
+ <xsl:when test="starts-with( $posed-number-format-unit, '[$') and (not(starts-with($posed-number-format-unit, '[$-') ) )">
+ <xsl:element name="number:currency-symbol">
+ <xsl:call-template name="create-language-country-attribute">
+ <xsl:with-param name="attribute-code" select="substring-before(substring-after(substring-after($posed-number-format-unit,'[$'),'-'),']')"/>
+ </xsl:call-template>
+ <xsl:value-of select="substring-before( substring-after( $posed-number-format-unit, '[$'), '-')"/>
+ </xsl:element>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + string-length( substring-before( $posed-number-format-unit, ']') ) + 1"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, '\') or starts-with( $posed-number-format-unit, '*') or starts-with( $posed-number-format-unit, '_') or starts-with( $posed-number-format-unit, '&quot;')">
+ <xsl:call-template name="get-number-text-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ <xsl:with-param name="posed-number-format-unit" select="$posed-number-format-unit"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="(starts-with( $posed-number-format-unit, '0') or starts-with( $posed-number-format-unit, '#') or starts-with( $posed-number-format-unit, '?') ) and (not ( contains( $posed-number-format-unit, 's.00') ) )">
+ <xsl:variable name="valid-number-format-string">
+ <xsl:call-template name="get-valid-number-format-string">
+ <xsl:with-param name="number-format-unit" select="$posed-number-format-unit"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="contains( $valid-number-format-string, '/')">
+ <xsl:element name="number:fraction">
+ <xsl:attribute name="number:min-integer-digits">
+ <xsl:value-of select="string-length( substring-before($valid-number-format-string, '/') ) - string-length(translate( substring-before($valid-number-format-string, '/'), '0', '') )"/>
+ </xsl:attribute>
+ <xsl:if test="contains( $valid-number-format-string, ',')">
+ <xsl:attribute name="number:grouping">true</xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="number:min-numerator-digits">
+ <xsl:value-of select="string-length( substring-before($valid-number-format-string, '/') ) - string-length(translate( substring-before($valid-number-format-string,'/'), '?', '') )"/>
+ </xsl:attribute>
+ <xsl:attribute name="number:min-denominator-digits">
+ <xsl:value-of select="string-length(substring-after($valid-number-format-string, '/') )"/>
+ </xsl:attribute>
+ <!-- deal with number:embedded-text (removed, as SCHEMA demands element to be empty)
+ <xsl:call-template name="create-number-format-embedded-text">
+ <xsl:with-param name="adapted-number-format-unit" select="$posed-number-format-unit"/>
+ <xsl:with-param name="valid-number-format-string" select="$valid-number-format-string"/>
+ </xsl:call-template>
+ -->
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="contains( $valid-number-format-string, '%')">
+ <xsl:element name="number:number">
+ <xsl:choose>
+ <xsl:when test="contains( $valid-number-format-string, '.')">
+ <xsl:attribute name="number:decimal-places">
+ <xsl:value-of select="string-length( substring-before( substring-after( $valid-number-format-string, '.'), '%') ) - string-length( translate( substring-before( substring-after( $valid-number-format-string, '.'), '%'), '0', '') )"/>
+ </xsl:attribute>
+ <xsl:attribute name="number:min-integer-digits">
+ <xsl:value-of select="string-length( substring-before($valid-number-format-string, '.') ) - string-length(translate( substring-before($valid-number-format-string, '.'), '0', '') )"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="number:decimal-places">0</xsl:attribute>
+ <xsl:attribute name="number:min-integer-digits">
+ <xsl:value-of select="string-length( substring-before($valid-number-format-string, '%') ) - string-length(translate( substring-before($valid-number-format-string, '%'), '0', '') )"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="contains( $valid-number-format-string, ',') and (substring( $valid-number-format-string,string-length($valid-number-format-string)) = ',')">
+ <xsl:variable name="display-factor">
+ <xsl:call-template name="get-display-factor">
+ <xsl:with-param name="start-number" select="1"/>
+ <xsl:with-param name="thousand-count" select="string-length($valid-number-format-string) - string-length( translate($valid-number-format-string, ',', '') )"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="number:display-factor">
+ <xsl:value-of select="$display-factor"/>
+ </xsl:attribute>
+ <xsl:attribute name="number:grouping">true</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="contains( $valid-number-format-string, ',')">
+ <xsl:attribute name="number:grouping">true</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <!-- deal with number:embedded-text -->
+ <xsl:call-template name="create-number-format-embedded-text">
+ <xsl:with-param name="adapted-number-format-unit" select="$posed-number-format-unit"/>
+ <xsl:with-param name="valid-number-format-string" select="$valid-number-format-string"/>
+ </xsl:call-template>
+ </xsl:element>
+ <number:text>%</number:text>
+ </xsl:when>
+ <xsl:when test="contains( $valid-number-format-string, 'E') or contains ($valid-number-format-string, 'e')">
+ <xsl:element name="number:scientific-number">
+ <xsl:choose>
+ <xsl:when test="contains( $valid-number-format-string, '.')">
+ <xsl:attribute name="number:decimal-places">
+ <xsl:value-of select="string-length( substring-before( substring-after( $valid-number-format-string, '.'), 'E') ) - string-length( translate( substring-before( substring-after( $valid-number-format-string, '.'), 'E'), '0', '') )"/>
+ </xsl:attribute>
+ <xsl:attribute name="number:min-integer-digits">
+ <xsl:value-of select="string-length( substring-before($valid-number-format-string, '.') ) - string-length(translate( substring-before($valid-number-format-string, '.'), '0', '') )"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="number:decimal-places">0</xsl:attribute>
+ <xsl:attribute name="number:min-integer-digits">
+ <xsl:value-of select="string-length( substring-before($valid-number-format-string, 'E') ) - string-length(translate( substring-before($valid-number-format-string, 'E'), '0', '') )"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="number:min-exponent-digits">
+ <xsl:value-of select="string-length( substring-after( $valid-number-format-string, 'E') ) - string-length( translate( substring-after( $valid-number-format-string, 'E'), '0', '') )"/>
+ </xsl:attribute>
+ <!-- deal with number:embedded-text -->
+ <xsl:call-template name="create-number-format-embedded-text">
+ <xsl:with-param name="adapted-number-format-unit" select="$posed-number-format-unit"/>
+ <xsl:with-param name="valid-number-format-string" select="$valid-number-format-string"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- -normal number format, currency, and accounting, e.g -->
+ <xsl:element name="number:number">
+ <xsl:choose>
+ <xsl:when test="contains( $valid-number-format-string, '.')">
+ <xsl:attribute name="number:decimal-places">
+ <xsl:value-of select="string-length( substring-after( $valid-number-format-string, '.') ) - string-length( translate( substring-after( $valid-number-format-string, '.'), '0', '') )"/>
+ </xsl:attribute>
+ <xsl:attribute name="number:min-integer-digits">
+ <xsl:value-of select="string-length( substring-before($valid-number-format-string, '.') ) - string-length(translate( substring-before($valid-number-format-string, '.'), '0', '') )"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="number:decimal-places">0</xsl:attribute>
+ <xsl:attribute name="number:min-integer-digits">
+ <xsl:value-of select="string-length( $valid-number-format-string ) - string-length(translate( $valid-number-format-string, '0', '') )"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="contains( $valid-number-format-string, ',') and (substring( $valid-number-format-string,string-length($valid-number-format-string)) = ',')">
+ <xsl:variable name="display-factor">
+ <xsl:call-template name="get-display-factor">
+ <xsl:with-param name="start-number" select="1"/>
+ <xsl:with-param name="thousand-count">
+ <xsl:call-template name="thousand-count-temp">
+ <xsl:with-param name="format-unit" select="$valid-number-format-string"/>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="number:display-factor">
+ <xsl:value-of select="$display-factor"/>
+ </xsl:attribute>
+ <xsl:attribute name="number:grouping">true</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="contains( $valid-number-format-string, ',')">
+ <xsl:attribute name="number:grouping">true</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <!-- deal with number:embedded-text -->
+ <xsl:call-template name="create-number-format-embedded-text">
+ <xsl:with-param name="adapted-number-format-unit" select="$posed-number-format-unit"/>
+ <xsl:with-param name="valid-number-format-string" select="$valid-number-format-string"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!-- deal with post number:text -->
+ <xsl:variable name="post-number-format-text">
+ <xsl:call-template name="get-post-number-format-text">
+ <xsl:with-param name="adapted-number-format-unit" select="$posed-number-format-unit"/>
+ <xsl:with-param name="valid-number-format-string" select="$valid-number-format-string"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$post-number-format-text"/>
+ <xsl:with-param name="unit-pos" select="1"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, 'ggg')">
+ <xsl:element name="number:era">
+ <xsl:attribute name="number:style">long</xsl:attribute>
+ <xsl:if test="string-length($calendar-type-name) &gt; 0">
+ <xsl:attribute name="number:calendar">
+ <xsl:value-of select="$calendar-type-name"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 3"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, 'gg')">
+ <xsl:element name="number:era">
+ <xsl:attribute name="number:style">long</xsl:attribute>
+ <xsl:if test="string-length($calendar-type-name) &gt; 0">
+ <xsl:attribute name="number:calendar">
+ <xsl:value-of select="$calendar-type-name"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 2"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, 'g')">
+ <xsl:element name="number:era">
+ <xsl:attribute name="number:style">short</xsl:attribute>
+ <xsl:if test="string-length($calendar-type-name) &gt; 0">
+ <xsl:attribute name="number:calendar">
+ <xsl:value-of select="$calendar-type-name"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 1"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, 'ee')">
+ <xsl:element name="number:year">
+ <xsl:attribute name="number:style">long</xsl:attribute>
+ <xsl:if test="string-length($calendar-type-name) &gt; 0">
+ <xsl:attribute name="number:calendar">
+ <xsl:value-of select="$calendar-type-name"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 2"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, 'r')">
+ <xsl:element name="number:year">
+ <xsl:attribute name="number:style">long</xsl:attribute>
+ <xsl:if test="string-length($calendar-type-name) &gt; 0">
+ <xsl:attribute name="number:calendar">
+ <xsl:value-of select="$calendar-type-name"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 1"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, 'yyyy')">
+ <xsl:element name="number:year">
+ <xsl:attribute name="number:style">long</xsl:attribute>
+ <xsl:if test="string-length($calendar-type-name) &gt; 0">
+ <xsl:attribute name="number:calendar">
+ <xsl:value-of select="$calendar-type-name"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 4"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, 'yy')">
+ <xsl:element name="number:year">
+ <xsl:attribute name="number:style">short</xsl:attribute>
+ <xsl:if test="string-length($calendar-type-name) &gt; 0">
+ <xsl:attribute name="number:calendar">
+ <xsl:value-of select="$calendar-type-name"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 2"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, 'e') or starts-with( $posed-number-format-unit, 'y')">
+ <xsl:element name="number:year">
+ <xsl:attribute name="number:style">short</xsl:attribute>
+ <xsl:if test="string-length($calendar-type-name) &gt; 0">
+ <xsl:attribute name="number:calendar">
+ <xsl:value-of select="$calendar-type-name"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 1"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, 'mmmmm')">
+ <xsl:element name="number:month">
+ <xsl:attribute name="number:style">short</xsl:attribute>
+ <xsl:attribute name="number:textual">true</xsl:attribute>
+ <xsl:if test="string-length($calendar-type-name) &gt; 0">
+ <xsl:attribute name="number:calendar">
+ <xsl:value-of select="$calendar-type-name"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 5"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, 'mmmm')">
+ <xsl:element name="number:month">
+ <xsl:attribute name="number:style">long</xsl:attribute>
+ <xsl:attribute name="number:textual">true</xsl:attribute>
+ <xsl:if test="string-length($calendar-type-name) &gt; 0">
+ <xsl:attribute name="number:calendar">
+ <xsl:value-of select="$calendar-type-name"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 4"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, 'mmm')">
+ <xsl:element name="number:month">
+ <xsl:attribute name="number:style">short</xsl:attribute>
+ <xsl:attribute name="number:textual">true</xsl:attribute>
+ <xsl:if test="string-length($calendar-type-name) &gt; 0">
+ <xsl:attribute name="number:calendar">
+ <xsl:value-of select="$calendar-type-name"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 3"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, '[mm]')">
+ <xsl:element name="number:minutes">
+ <xsl:attribute name="number:style">long</xsl:attribute>
+ </xsl:element>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 4"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, '[m]')">
+ <xsl:element name="number:minutes">
+ <xsl:attribute name="number:style">short</xsl:attribute>
+ </xsl:element>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 3"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, 'mm') and ( contains( $number-format-unit, 'h') or contains( $posed-number-format-unit, 's') )">
+ <xsl:element name="number:minutes">
+ <xsl:attribute name="number:style">long</xsl:attribute>
+ </xsl:element>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 2"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, 'mm')">
+ <xsl:element name="number:month">
+ <xsl:attribute name="number:style">long</xsl:attribute>
+ <xsl:if test="string-length($calendar-type-name) &gt; 0">
+ <xsl:attribute name="number:calendar">
+ <xsl:value-of select="$calendar-type-name"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 2"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, 'm') and ( contains( $number-format-unit, 'h') or contains( $posed-number-format-unit, 's') )">
+ <xsl:element name="number:minutes">
+ <xsl:attribute name="number:style">short</xsl:attribute>
+ </xsl:element>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 1"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, 'm')">
+ <xsl:element name="number:month">
+ <xsl:attribute name="number:style">short</xsl:attribute>
+ <xsl:if test="string-length($calendar-type-name) &gt; 0">
+ <xsl:attribute name="number:calendar">
+ <xsl:value-of select="$calendar-type-name"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 1"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, 'dddd') or starts-with( $posed-number-format-unit, 'aaaa')">
+ <xsl:element name="number:day-of-week">
+ <xsl:attribute name="number:style">long</xsl:attribute>
+ <xsl:if test="string-length($calendar-type-name) &gt; 0">
+ <xsl:attribute name="number:calendar">
+ <xsl:value-of select="$calendar-type-name"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 4"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, 'ddd') or starts-with( $posed-number-format-unit, 'aaa')">
+ <xsl:element name="number:day-of-week">
+ <xsl:attribute name="number:style">short</xsl:attribute>
+ <xsl:if test="string-length($calendar-type-name) &gt; 0">
+ <xsl:attribute name="number:calendar">
+ <xsl:value-of select="$calendar-type-name"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 3"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, 'dd')">
+ <xsl:element name="number:day">
+ <xsl:attribute name="number:style">long</xsl:attribute>
+ <xsl:if test="string-length($calendar-type-name) &gt; 0">
+ <xsl:attribute name="number:calendar">
+ <xsl:value-of select="$calendar-type-name"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 2"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, 'd')">
+ <xsl:element name="number:day">
+ <xsl:attribute name="number:style">short</xsl:attribute>
+ <xsl:if test="string-length($calendar-type-name) &gt; 0">
+ <xsl:attribute name="number:calendar">
+ <xsl:value-of select="$calendar-type-name"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 1"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, 'hh')">
+ <xsl:element name="number:hours">
+ <xsl:attribute name="number:style">long</xsl:attribute>
+ </xsl:element>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 2"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, '[hh]')">
+ <xsl:element name="number:hours">
+ <xsl:attribute name="number:style">long</xsl:attribute>
+ </xsl:element>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 4"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, 'h')">
+ <xsl:element name="number:hours">
+ <xsl:attribute name="number:style">short</xsl:attribute>
+ </xsl:element>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 1"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, '[h]')">
+ <xsl:element name="number:hours">
+ <xsl:attribute name="number:style">short</xsl:attribute>
+ </xsl:element>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 3"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, 'AM/PM') or starts-with( $posed-number-format-unit, 'am/pm')">
+ <number:am-pm/>
+ <!-- long: am-pm doesn't support long style yet -->
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 5"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, 'a/p'or starts-with( $posed-number-format-unit, 'A/P'))">
+ <number:am-pm/>
+ <!-- short: am-pm doesn't support short style yet -->
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 3"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, 'ss')">
+ <xsl:variable name="decimal-places">
+ <xsl:choose>
+ <xsl:when test="starts-with( $posed-number-format-unit, 'ss.0')">
+ <xsl:value-of select="string-length( $posed-number-format-unit) - string-length( translate( $posed-number-format-unit, '0', '') )"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:element name="number:seconds">
+ <xsl:attribute name="number:style">long</xsl:attribute>
+ <xsl:if test="$decimal-places &gt; 0">
+ <xsl:attribute name="number:decimal-places">
+ <xsl:value-of select="$decimal-places"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:variable name="second-length">
+ <xsl:choose>
+ <xsl:when test="$decimal-places &gt; 0">
+ <xsl:value-of select="$decimal-places + 3"/>
+ </xsl:when>
+ <xsl:otherwise>2</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + $second-length"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, '[ss]')">
+ <xsl:element name="number:seconds">
+ <xsl:attribute name="number:style">long</xsl:attribute>
+ </xsl:element>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 4"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, 's')">
+ <xsl:variable name="decimal-places">
+ <xsl:choose>
+ <xsl:when test="starts-with( $posed-number-format-unit, 's.0')">
+ <xsl:value-of select="string-length( $posed-number-format-unit) - string-length( translate( $posed-number-format-unit, '0', '') )"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:element name="number:seconds">
+ <xsl:attribute name="number:style">short</xsl:attribute>
+ <xsl:if test="$decimal-places &gt; 0">
+ <xsl:attribute name="number:decimal-places">
+ <xsl:value-of select="$decimal-places"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:variable name="second-length">
+ <xsl:choose>
+ <xsl:when test="$decimal-places &gt; 0">
+ <xsl:value-of select="$decimal-places + 2"/>
+ </xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + $second-length"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, '[s]')">
+ <xsl:element name="number:seconds">
+ <xsl:attribute name="number:style">short</xsl:attribute>
+ </xsl:element>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 3"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, '@')">
+ <number:text-content/>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 1"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$posed-number-format-unit = 'General Number'">
+ <number:number number:decimal-places="0" number:min-integer-digits="1"/>
+ </xsl:when>
+ <xsl:when test="$posed-number-format-unit = 'General Date'">
+ <number:year number:style="long"/>
+ <number:text>-</number:text>
+ <number:month number:style="short"/>
+ <number:text>-</number:text>
+ <number:day number:style="short"/>
+ <number:text>
+ <xsl:text> </xsl:text>
+ </number:text>
+ <number:hours number:style="short"/>
+ <number:text>:</number:text>
+ <number:minutes number:style="long"/>
+ </xsl:when>
+ <!-- special for General number:text-content output -->
+ <xsl:when test="starts-with($posed-number-format-unit , 'General')">
+ <xsl:choose>
+ <xsl:when test="$posed-number-format-unit = 'General' and $condition-pos = 1">
+ <number:number number:decimal-places="0" number:min-integer-digits="1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$posed-number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="8"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$posed-number-format-unit = 'Fixed'">
+ <number:number number:decimal-places="2" number:min-integer-digits="1"/>
+ <number:text/>
+ </xsl:when>
+ <xsl:when test="$posed-number-format-unit = 'Standard'">
+ <number:number number:decimal-places="2" number:min-integer-digits="1" number:grouping="true"/>
+ </xsl:when>
+ <xsl:when test="$posed-number-format-unit = 'Long Date'">
+ <number:year number:style="long"/>
+ <number:text>-</number:text>
+ <number:month number:style="long"/>
+ <number:text>-</number:text>
+ <number:day number:style="long"/>
+ </xsl:when>
+ <xsl:when test="$posed-number-format-unit = 'Medium Date'">
+ <number:day number:style="short"/>
+ <number:text>-</number:text>
+ <number:month number:textual="true"/>
+ <number:text>-</number:text>
+ <number:year number:style="short"/>
+ </xsl:when>
+ <xsl:when test="$posed-number-format-unit = 'Short Date'">
+ <number:day number:style="short"/>
+ <number:text>-</number:text>
+ <number:month number:style="short"/>
+ <number:text>-</number:text>
+ <number:year number:style="short"/>
+ </xsl:when>
+ <xsl:when test="$posed-number-format-unit = 'Long Time'">
+ <number:hours number:style="long"/>
+ <number:text>:</number:text>
+ <number:minutes number:style="long"/>
+ <number:text>:</number:text>
+ <number:seconds number:style="long"/>
+ <number:text>
+ <xsl:text> </xsl:text>
+ </number:text>
+ <number:am-pm/>
+ </xsl:when>
+ <xsl:when test="$posed-number-format-unit = 'Medium Time'">
+ <number:hours number:style="short"/>
+ <number:text>:</number:text>
+ <number:minutes number:style="long"/>
+ <number:text>
+ <xsl:text> </xsl:text>
+ </number:text>
+ <number:am-pm/>
+ </xsl:when>
+ <xsl:when test="$posed-number-format-unit = 'Short Time'">
+ <number:hours number:style="short"/>
+ <number:text>:</number:text>
+ <number:minutes number:style="long"/>
+ <number:text>
+ <xsl:text> </xsl:text>
+ </number:text>
+ </xsl:when>
+ <xsl:when test="$posed-number-format-unit = 'Percent'">
+ <number:number number:decimal-places="2" number:min-integer-digits="1"/>
+ <number:text>%</number:text>
+ </xsl:when>
+ <xsl:when test="$posed-number-format-unit = 'Scientific'">
+ <number:scientific-number number:decimal-places="2" number:min-integer-digits="1" number:min-exponent-digits="2"/>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, '[')">
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + string-length( substring-before( $posed-number-format-unit, ']') ) + 1"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ <xsl:with-param name="isNumberTextElementOpened" select="$isNumberTextElementOpened"/>
+ <xsl:with-param name="posed-number-format-unit" select="$posed-number-format-unit"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, '/')">
+ <number:text>/</number:text>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 1"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, ':')">
+ <number:text>:</number:text>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 1"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="string-length( $posed-number-format-unit ) &gt; 0">
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 1"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ <xsl:with-param name="isNumberTextElementOpened" select="$isNumberTextElementOpened"/>
+ <xsl:with-param name="posed-number-format-unit" select="$posed-number-format-unit"/>
+ <xsl:with-param name="numberTextValue" select="substring( $posed-number-format-unit, 1, 1)"/>
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="thousand-count-temp">
+ <!-- thousand count for char ',' at the latter of format-unit by recursion -->
+ <xsl:param name="format-unit"/>
+ <xsl:choose>
+ <xsl:when test="contains($format-unit, ',#')">
+ <xsl:call-template name="thousand-count-temp">
+ <xsl:with-param name="format-unit" select="substring-after($format-unit, ',#')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="contains($format-unit, ',0')">
+ <xsl:call-template name="thousand-count-temp">
+ <xsl:with-param name="format-unit" select="substring-after($format-unit, ',0')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="string-length($format-unit) - string-length( translate($format-unit, ',', ''))"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-calendar-type-name">
+ <xsl:param name="calendar-type"/>
+ <xsl:variable name="temp-type">
+ <xsl:call-template name="hex2decimal">
+ <xsl:with-param name="hex-number" select="$calendar-type"/>
+ <xsl:with-param name="index" select="1"/>
+ <xsl:with-param name="str-length" select="string-length($calendar-type)"/>
+ <xsl:with-param name="last-value" select="0"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <!-- Japanese (Emperor era), #03 -->
+ <xsl:when test="$temp-type = 3">gengou</xsl:when>
+ <!-- Taiwanese, #04 -->
+ <xsl:when test="$temp-type = 4">ROC</xsl:when>
+ <!-- Korean (Tangun era) hanja_yoil is ok too. #05 -->
+ <xsl:when test="$temp-type = 5">hanja</xsl:when>
+ <!-- Hijri (Arabic lunar), #06 -->
+ <xsl:when test="$temp-type = 6">hijri</xsl:when>
+ <!-- Thai, #07 -->
+ <xsl:when test="$temp-type = 7">buddhist</xsl:when>
+ <!-- 01: Gregorian (Localized), 02: Gregorian (United States), 09: Gregorian (Middle East French), 0A: Gregorian (Arabic), 0B: Gregorian (Transliterated English) -->
+ <xsl:otherwise>gregorian</xsl:otherwise>
+ <!-- not found jewish yet -->
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-valid-number-format-string">
+ <xsl:param name="number-format-unit"/>
+ <xsl:choose>
+ <xsl:when test="contains( $number-format-unit, '\')">
+ <xsl:call-template name="get-valid-number-format-string">
+ <xsl:with-param name="number-format-unit" select="concat( substring-before( $number-format-unit, '\'), substring( substring-after( $number-format-unit, '\'), 2) )"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="contains( $number-format-unit, '*')">
+ <xsl:call-template name="get-valid-number-format-string">
+ <xsl:with-param name="number-format-unit" select="concat( substring-before( $number-format-unit, '*'), substring( substring-after( $number-format-unit, '*'), 2) )"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="contains( $number-format-unit, '_')">
+ <xsl:call-template name="get-valid-number-format-string">
+ <xsl:with-param name="number-format-unit" select="concat( substring-before( $number-format-unit, '_'), substring( substring-after( $number-format-unit, '_'), 2) )"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="contains( $number-format-unit, '&quot;')">
+ <xsl:call-template name="get-valid-number-format-string">
+ <xsl:with-param name="number-format-unit" select="concat( substring-before( $number-format-unit, '&quot;'), substring-after( substring-after( $number-format-unit, '&quot;'), '&quot;') )"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$number-format-unit"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-display-factor">
+ <xsl:param name="start-number"/>
+ <xsl:param name="thousand-count"/>
+ <xsl:choose>
+ <xsl:when test="$thousand-count = 0">
+ <xsl:value-of select="$start-number"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="get-display-factor">
+ <xsl:with-param name="start-number" select="$start-number * 1000"/>
+ <xsl:with-param name="thousand-count" select="$thousand-count -1"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-post-number-format-text">
+ <xsl:param name="adapted-number-format-unit"/>
+ <xsl:param name="valid-number-format-string"/>
+ <xsl:variable name="first-embedded-character-pos">
+ <xsl:choose>
+ <xsl:when test="contains( $adapted-number-format-unit, '\')">
+ <xsl:value-of select="string-length( substring-before($adapted-number-format-unit, '\') ) + 1"/>
+ </xsl:when>
+ <xsl:when test="contains( $adapted-number-format-unit, '_')">
+ <xsl:value-of select="string-length( substring-before($adapted-number-format-unit, '_') ) + 1"/>
+ </xsl:when>
+ <xsl:when test="contains( $adapted-number-format-unit, '*')">
+ <xsl:value-of select="string-length( substring-before($adapted-number-format-unit, '*') ) + 1"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="first-embedded-string-pos">
+ <xsl:choose>
+ <xsl:when test="contains( $adapted-number-format-unit, '&quot;')">
+ <xsl:value-of select="string-length( substring-before($adapted-number-format-unit, '&quot;') ) + 1"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="first-embedded-text-pos">
+ <xsl:choose>
+ <xsl:when test="$first-embedded-character-pos &lt; $first-embedded-string-pos and $first-embedded-character-pos &gt; 0">
+ <xsl:value-of select="$first-embedded-character-pos"/>
+ </xsl:when>
+ <xsl:when test="$first-embedded-character-pos &lt; $first-embedded-string-pos and $first-embedded-character-pos = 0">
+ <xsl:value-of select="$first-embedded-string-pos"/>
+ </xsl:when>
+ <xsl:when test="$first-embedded-character-pos &gt; $first-embedded-string-pos and $first-embedded-string-pos &gt; 0">
+ <xsl:value-of select="$first-embedded-string-pos"/>
+ </xsl:when>
+ <xsl:when test="$first-embedded-character-pos &gt; $first-embedded-string-pos and $first-embedded-string-pos = 0">
+ <xsl:value-of select="$first-embedded-character-pos"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$first-embedded-text-pos &gt; string-length( $valid-number-format-string )">
+ <xsl:value-of select="substring( $adapted-number-format-unit, $first-embedded-text-pos)"/>
+ </xsl:when>
+ <xsl:when test="$first-embedded-text-pos &gt; 0 and $first-embedded-text-pos &lt; string-length( $valid-number-format-string )">
+ <xsl:choose>
+ <xsl:when test="starts-with( substring( $adapted-number-format-unit, $first-embedded-text-pos, 1), '\')">
+ <xsl:call-template name="get-post-number-format-text">
+ <xsl:with-param name="adapted-number-format-unit" select="concat( substring-before( $adapted-number-format-unit, '\'), substring( $adapted-number-format-unit, $first-embedded-text-pos + 2) )"/>
+ <xsl:with-param name="valid-number-format-string" select="$valid-number-format-string"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( substring( $adapted-number-format-unit, $first-embedded-text-pos, 1), '_')">
+ <xsl:call-template name="get-post-number-format-text">
+ <xsl:with-param name="adapted-number-format-unit" select="concat( substring-before( $adapted-number-format-unit, '_'), substring( $adapted-number-format-unit, $first-embedded-text-pos + 2) )"/>
+ <xsl:with-param name="valid-number-format-string" select="$valid-number-format-string"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( substring( $adapted-number-format-unit, $first-embedded-text-pos, 1), '*')">
+ <xsl:call-template name="get-post-number-format-text">
+ <xsl:with-param name="adapted-number-format-unit" select="concat( substring-before( $adapted-number-format-unit, '*'), substring( $adapted-number-format-unit, $first-embedded-text-pos + 2) )"/>
+ <xsl:with-param name="valid-number-format-string" select="$valid-number-format-string"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( substring( $adapted-number-format-unit, $first-embedded-text-pos, 1), '&quot;')">
+ <xsl:call-template name="get-post-number-format-text">
+ <xsl:with-param name="adapted-number-format-unit" select="concat( substring-before( $adapted-number-format-unit, '&quot;'), substring-after( substring-after( $adapted-number-format-unit, '&quot;'), '&quot;') )"/>
+ <xsl:with-param name="valid-number-format-string" select="$valid-number-format-string"/>
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="create-number-format-embedded-text">
+ <xsl:param name="adapted-number-format-unit"/>
+ <xsl:param name="valid-number-format-string"/>
+ <xsl:variable name="first-embedded-character-pos">
+ <xsl:choose>
+ <xsl:when test="contains( $adapted-number-format-unit, '\')">
+ <xsl:value-of select="string-length( substring-before($adapted-number-format-unit, '\') ) + 1"/>
+ </xsl:when>
+ <xsl:when test="contains( $adapted-number-format-unit, '_')">
+ <xsl:value-of select="string-length( substring-before($adapted-number-format-unit, '_') ) + 1"/>
+ </xsl:when>
+ <xsl:when test="contains( $adapted-number-format-unit, '*')">
+ <xsl:value-of select="string-length( substring-before($adapted-number-format-unit, '*') ) + 1"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="first-embedded-string-pos">
+ <xsl:choose>
+ <xsl:when test="contains( $adapted-number-format-unit, '&quot;')">
+ <xsl:value-of select="string-length( substring-before($adapted-number-format-unit, '&quot;') ) + 1"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="first-embedded-text-pos">
+ <xsl:choose>
+ <xsl:when test="$first-embedded-character-pos &lt; $first-embedded-string-pos and $first-embedded-character-pos &gt; 0">
+ <xsl:value-of select="$first-embedded-character-pos"/>
+ </xsl:when>
+ <xsl:when test="$first-embedded-character-pos &lt; $first-embedded-string-pos and $first-embedded-character-pos = 0">
+ <xsl:value-of select="$first-embedded-string-pos"/>
+ </xsl:when>
+ <xsl:when test="$first-embedded-character-pos &gt; $first-embedded-string-pos and $first-embedded-string-pos &gt; 0">
+ <xsl:value-of select="$first-embedded-string-pos"/>
+ </xsl:when>
+ <xsl:when test="$first-embedded-character-pos &gt; $first-embedded-string-pos and $first-embedded-string-pos = 0">
+ <xsl:value-of select="$first-embedded-character-pos"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="$first-embedded-text-pos &gt; 0 and $first-embedded-text-pos &lt; string-length( $valid-number-format-string )">
+ <xsl:variable name="text-pos">
+ <xsl:choose>
+ <xsl:when test="contains( $valid-number-format-string, '.')">
+ <xsl:variable name="right-text-pos" select="substring( substring-before( $valid-number-format-string, '.'), $first-embedded-text-pos)"/>
+ <xsl:value-of select="string-length($right-text-pos) - string-length( translate( $right-text-pos, '0#?', '') )"/>
+ </xsl:when>
+ <xsl:when test="contains( $valid-number-format-string, '/')">
+ <xsl:variable name="right-text-pos" select="substring( substring-before( $valid-number-format-string, '/'), $first-embedded-text-pos)"/>
+ <xsl:value-of select="string-length($right-text-pos) - string-length( translate( $right-text-pos, '0#?', '') )"/>
+ </xsl:when>
+ <xsl:when test="contains( $valid-number-format-string, '%')">
+ <xsl:variable name="right-text-pos" select="substring( substring-before( $valid-number-format-string, '%'), $first-embedded-text-pos)"/>
+ <xsl:value-of select="string-length($right-text-pos) - string-length( translate( $right-text-pos, '0#?', '') )"/>
+ </xsl:when>
+ <xsl:when test="contains( $valid-number-format-string, 'E')">
+ <xsl:variable name="right-text-pos" select="substring( substring-before( $valid-number-format-string, 'E'), $first-embedded-text-pos)"/>
+ <xsl:value-of select="string-length($right-text-pos) - string-length( translate( $right-text-pos, '0#?', '') )"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="right-text-pos" select="substring( $valid-number-format-string, $first-embedded-text-pos)"/>
+ <xsl:value-of select="string-length($right-text-pos) - string-length( translate( $right-text-pos, '0#?', '') )"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="starts-with( substring( $adapted-number-format-unit, $first-embedded-text-pos, 1), '\')">
+ <number:embedded-text number:position="{$text-pos}">
+ <xsl:value-of select="substring( $adapted-number-format-unit, $first-embedded-text-pos + 1, 1)"/>
+ </number:embedded-text>
+ <xsl:call-template name="create-number-format-embedded-text">
+ <xsl:with-param name="adapted-number-format-unit" select="concat( substring-before( $adapted-number-format-unit, '\'), substring( $adapted-number-format-unit, $first-embedded-text-pos + 2) )"/>
+ <xsl:with-param name="valid-number-format-string" select="$valid-number-format-string"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( substring( $adapted-number-format-unit, $first-embedded-text-pos, 1), '_')">
+ <number:embedded-text number:position="{$text-pos}">
+ <xsl:value-of select="substring( $adapted-number-format-unit, $first-embedded-text-pos + 1, 1)"/>
+ </number:embedded-text>
+ <xsl:call-template name="create-number-format-embedded-text">
+ <xsl:with-param name="adapted-number-format-unit" select="concat( substring-before( $adapted-number-format-unit, '_'), substring( $adapted-number-format-unit, $first-embedded-text-pos + 2) )"/>
+ <xsl:with-param name="valid-number-format-string" select="$valid-number-format-string"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( substring( $adapted-number-format-unit, $first-embedded-text-pos, 1), '*')">
+ <number:embedded-text number:position="{$text-pos}">
+ <xsl:value-of select="substring( $adapted-number-format-unit, $first-embedded-text-pos + 1, 1)"/>
+ </number:embedded-text>
+ <xsl:call-template name="create-number-format-embedded-text">
+ <xsl:with-param name="adapted-number-format-unit" select="concat( substring-before( $adapted-number-format-unit, '*'), substring( $adapted-number-format-unit, $first-embedded-text-pos + 2) )"/>
+ <xsl:with-param name="valid-number-format-string" select="$valid-number-format-string"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( substring( $adapted-number-format-unit, $first-embedded-text-pos, 1), '&quot;')">
+ <number:embedded-text number:position="{$text-pos}">
+ <xsl:value-of select="substring-before( substring( $adapted-number-format-unit, $first-embedded-text-pos + 1), '&quot;')"/>
+ </number:embedded-text>
+ <xsl:call-template name="create-number-format-embedded-text">
+ <xsl:with-param name="adapted-number-format-unit" select="concat( substring-before( $adapted-number-format-unit, '&quot;'), substring-after( substring-after( $adapted-number-format-unit, '&quot;'), '&quot;') )"/>
+ <xsl:with-param name="valid-number-format-string" select="$valid-number-format-string"/>
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="create-master-styles">
+ <xsl:param name="worksheetoptions"/>
+ <xsl:for-each select="$worksheetoptions">
+ <xsl:element name="style:master-page">
+ <xsl:attribute name="style:name">
+ <xsl:call-template name="encode-as-nc-name">
+ <xsl:with-param name="string" select="concat( 'TAB_', ../@ss:Name)"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="style:display-name">
+ <xsl:value-of select="concat( 'PageStyle_', ../@ss:Name)"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:page-layout-name">
+ <xsl:call-template name="encode-as-nc-name">
+ <xsl:with-param name="string" select="concat( 'pm_', ../@ss:Name)"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="x:PageSetup/x:Header/@x:Data">
+ <style:header>
+ <xsl:call-template name="translate-header-footer">
+ <xsl:with-param name="content" select="x:PageSetup/x:Header/@x:Data"/>
+ <xsl:with-param name="style-name-header" select="concat(../@ss:Name, substring(name(x:PageSetup/x:Header),1,1))"/>
+ </xsl:call-template>
+ </style:header>
+ </xsl:when>
+ <xsl:otherwise>
+ <style:header style:display="false"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="x:PageSetup/x:Footer/@x:Data">
+ <style:footer>
+ <xsl:call-template name="translate-header-footer">
+ <xsl:with-param name="content" select="x:PageSetup/x:Footer/@x:Data"/>
+ <xsl:with-param name="style-name-header" select="concat(../@ss:Name, substring(name(x:PageSetup/x:Footer),1,1))"/>
+ </xsl:call-template>
+ </style:footer>
+ </xsl:when>
+ <xsl:otherwise>
+ <style:footer style:display="false"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="translate-header-footer">
+ <xsl:param name="content"/>
+ <xsl:param name="style-name-header"/>
+ <style:region-left>
+ <text:p>
+ <xsl:variable name="left-content">
+ <xsl:call-template name="get-pos-content">
+ <xsl:with-param name="content" select="$content"/>
+ <xsl:with-param name="pos" select="'left'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="locate-header-footer-data">
+ <xsl:with-param name="header-footer-data" select="$left-content"/>
+ <xsl:with-param name="style-name-header" select="concat($style-name-header,'L')"/>
+ <xsl:with-param name="index" select="0"/>
+ <xsl:with-param name="current-pos" select="1"/>
+ </xsl:call-template>
+ </text:p>
+ </style:region-left>
+ <style:region-center>
+ <text:p>
+ <xsl:variable name="center-content">
+ <xsl:call-template name="get-pos-content">
+ <xsl:with-param name="content" select="$content"/>
+ <xsl:with-param name="pos" select="'center'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="locate-header-footer-data">
+ <xsl:with-param name="header-footer-data" select="$center-content"/>
+ <xsl:with-param name="style-name-header" select="concat($style-name-header,'C')"/>
+ <xsl:with-param name="index" select="0"/>
+ <xsl:with-param name="current-pos" select="1"/>
+ </xsl:call-template>
+ </text:p>
+ </style:region-center>
+ <style:region-right>
+ <text:p>
+ <xsl:variable name="right-content">
+ <xsl:call-template name="get-pos-content">
+ <xsl:with-param name="content" select="$content"/>
+ <xsl:with-param name="pos" select="'right'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="locate-header-footer-data">
+ <xsl:with-param name="header-footer-data" select="$right-content"/>
+ <xsl:with-param name="style-name-header" select="concat($style-name-header,'R')"/>
+ <xsl:with-param name="index" select="0"/>
+ <xsl:with-param name="current-pos" select="1"/>
+ </xsl:call-template>
+ </text:p>
+ </style:region-right>
+ </xsl:template>
+ <xsl:template name="locate-header-footer-data">
+ <xsl:param name="header-footer-data"/>
+ <xsl:param name="style-name-header"/>
+ <xsl:param name="index"/>
+ <xsl:param name="current-pos"/>
+ <xsl:variable name="current-style-data">
+ <xsl:value-of select="substring($header-footer-data,$current-pos)"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="starts-with($current-style-data,'&amp;X') or starts-with($current-style-data,'&amp;Y') or starts-with($current-style-data,'&amp;S') or starts-with($current-style-data,'&amp;U') or starts-with($current-style-data,'&amp;E') or starts-with($current-style-data,'&amp;B')">
+ <xsl:call-template name="locate-header-footer-data">
+ <xsl:with-param name="header-footer-data" select="$header-footer-data"/>
+ <xsl:with-param name="style-name-header" select="$style-name-header"/>
+ <xsl:with-param name="index" select="$index"/>
+ <xsl:with-param name="current-pos" select="$current-pos+2"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with($current-style-data,'&amp;0') or starts-with($current-style-data,'&amp;1') or starts-with($current-style-data,'&amp;2') or starts-with($current-style-data,'&amp;3') or starts-with($current-style-data,'&amp;4') or starts-with($current-style-data,'&amp;5') or starts-with($current-style-data,'&amp;6') or starts-with($current-style-data,'&amp;7') or starts-with($current-style-data,'&amp;8') or starts-with($current-style-data,'&amp;9')">
+ <xsl:variable name="font-size-length">
+ <xsl:call-template name="get-digit-length">
+ <xsl:with-param name="complexive-string" select="substring-after($current-style-data,'&amp;')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="locate-header-footer-data">
+ <xsl:with-param name="header-footer-data" select="$header-footer-data"/>
+ <xsl:with-param name="style-name-header" select="$style-name-header"/>
+ <xsl:with-param name="index" select="$index"/>
+ <xsl:with-param name="current-pos" select="$current-pos+1+$font-size-length"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with($current-style-data,'&amp;&quot;')">
+ <xsl:call-template name="locate-header-footer-data">
+ <xsl:with-param name="header-footer-data" select="$header-footer-data"/>
+ <xsl:with-param name="style-name-header" select="$style-name-header"/>
+ <xsl:with-param name="index" select="$index"/>
+ <xsl:with-param name="current-pos" select="string-length(substring-before(substring($header-footer-data,$current-pos+2),'&quot;'))+$current-pos+3"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="current-content-last-pos">
+ <xsl:call-template name="get-current-content-last-pos">
+ <xsl:with-param name="style-data" select="$header-footer-data"/>
+ <xsl:with-param name="current-pos" select="$current-pos"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$current-pos &gt; 1">
+ <text:span text:style-name="{concat($style-name-header,$index)}">
+ <xsl:call-template name="translate-header-footer-data">
+ <xsl:with-param name="header-footer-data" select="substring($header-footer-data,$current-pos,$current-content-last-pos+1-$current-pos)"/>
+ </xsl:call-template>
+ </text:span>
+ <xsl:if test="$current-content-last-pos &lt; string-length($header-footer-data)">
+ <xsl:call-template name="locate-header-footer-data">
+ <xsl:with-param name="header-footer-data" select="$header-footer-data"/>
+ <xsl:with-param name="style-name-header" select="$style-name-header"/>
+ <xsl:with-param name="index" select="$index+1"/>
+ <xsl:with-param name="current-pos" select="$current-content-last-pos+1"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="translate-header-footer-data">
+ <xsl:with-param name="header-footer-data" select="substring($header-footer-data,$current-pos,$current-content-last-pos+1-$current-pos)"/>
+ </xsl:call-template>
+ <xsl:if test="$current-content-last-pos &lt; string-length($header-footer-data)">
+ <xsl:call-template name="locate-header-footer-data">
+ <xsl:with-param name="header-footer-data" select="$header-footer-data"/>
+ <xsl:with-param name="style-name-header" select="$style-name-header"/>
+ <xsl:with-param name="index" select="$index"/>
+ <xsl:with-param name="current-pos" select="$current-content-last-pos+1"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-current-content-last-pos">
+ <xsl:param name="style-data"/>
+ <xsl:param name="current-pos"/>
+ <xsl:variable name="current-style-data">
+ <xsl:value-of select="substring($style-data,$current-pos)"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="starts-with($current-style-data,'&amp;&quot;') or starts-with($current-style-data,'&amp;X') or starts-with($current-style-data,'&amp;Y') or starts-with($current-style-data,'&amp;S') or starts-with($current-style-data,'&amp;U') or starts-with($current-style-data,'&amp;E') or starts-with($current-style-data,'&amp;B')or starts-with($current-style-data,'&amp;0') or starts-with($current-style-data,'&amp;1') or starts-with($current-style-data,'&amp;2') or starts-with($current-style-data,'&amp;3') or starts-with($current-style-data,'&amp;4') or starts-with($current-style-data,'&amp;5') or starts-with($current-style-data,'&amp;6') or starts-with($current-style-data,'&amp;7') or starts-with($current-style-data,'&amp;8') or starts-with($current-style-data,'&amp;9')">
+ <xsl:value-of select="$current-pos - 1"/>
+ </xsl:when>
+ <xsl:when test="contains($current-style-data,'&amp;&quot;') or contains($current-style-data,'&amp;X') or contains($current-style-data,'&amp;Y') or contains($current-style-data,'&amp;S') or contains($current-style-data,'&amp;U') or contains($current-style-data,'&amp;E') or contains($current-style-data,'&amp;B')or contains($current-style-data,'&amp;0') or contains($current-style-data,'&amp;1') or contains($current-style-data,'&amp;2') or contains($current-style-data,'&amp;3') or contains($current-style-data,'&amp;4') or contains($current-style-data,'&amp;5') or contains($current-style-data,'&amp;6') or contains($current-style-data,'&amp;7') or contains($current-style-data,'&amp;8') or contains($current-style-data,'&amp;9')">
+ <xsl:variable name="temp" select="substring-before(substring($current-style-data,2),'&amp;')"/>
+ <xsl:variable name="next-amp-pos">
+ <xsl:value-of select="$current-pos+string-length($temp)+1"/>
+ </xsl:variable>
+ <xsl:call-template name="get-current-content-last-pos">
+ <xsl:with-param name="style-data" select="$style-data"/>
+ <xsl:with-param name="current-pos" select="$next-amp-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="string-length($style-data)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="translate-header-footer-data">
+ <xsl:param name="header-footer-data"/>
+ <xsl:choose>
+ <xsl:when test="contains( $header-footer-data, '&amp;D')">
+ <xsl:call-template name="translate-header-footer-data">
+ <xsl:with-param name="header-footer-data" select="substring-before( $header-footer-data, '&amp;D')"/>
+ </xsl:call-template>
+ <text:date/>
+ <xsl:call-template name="translate-header-footer-data">
+ <xsl:with-param name="header-footer-data" select="substring-after( $header-footer-data, '&amp;D')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="contains( $header-footer-data, '&amp;T')">
+ <xsl:call-template name="translate-header-footer-data">
+ <xsl:with-param name="header-footer-data" select="substring-before( $header-footer-data, '&amp;T')"/>
+ </xsl:call-template>
+ <text:time/>
+ <xsl:call-template name="translate-header-footer-data">
+ <xsl:with-param name="header-footer-data" select="substring-after( $header-footer-data, '&amp;T')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="contains( $header-footer-data, '&amp;P')">
+ <xsl:call-template name="translate-header-footer-data">
+ <xsl:with-param name="header-footer-data" select="substring-before( $header-footer-data, '&amp;P')"/>
+ </xsl:call-template>
+ <text:page-number/>
+ <xsl:call-template name="translate-header-footer-data">
+ <xsl:with-param name="header-footer-data" select="substring-after( $header-footer-data, '&amp;P')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="contains( $header-footer-data, '&amp;N')">
+ <xsl:call-template name="translate-header-footer-data">
+ <xsl:with-param name="header-footer-data" select="substring-before( $header-footer-data, '&amp;N')"/>
+ </xsl:call-template>
+ <text:page-count/>
+ <xsl:call-template name="translate-header-footer-data">
+ <xsl:with-param name="header-footer-data" select="substring-after( $header-footer-data, '&amp;N')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="contains( $header-footer-data, '&amp;A')">
+ <xsl:call-template name="translate-header-footer-data">
+ <xsl:with-param name="header-footer-data" select="substring-before( $header-footer-data, '&amp;A')"/>
+ </xsl:call-template>
+ <text:sheet-name/>
+ <xsl:call-template name="translate-header-footer-data">
+ <xsl:with-param name="header-footer-data" select="substring-after( $header-footer-data, '&amp;A')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="contains( $header-footer-data, '&amp;Z&amp;F')">
+ <xsl:call-template name="translate-header-footer-data">
+ <xsl:with-param name="header-footer-data" select="substring-before( $header-footer-data, '&amp;Z&amp;F')"/>
+ </xsl:call-template>
+ <text:file-name text:display="full"/>
+ <xsl:call-template name="translate-header-footer-data">
+ <xsl:with-param name="header-footer-data" select="substring-after( $header-footer-data, '&amp;Z&amp;F')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="contains( $header-footer-data, '&amp;Z')">
+ <xsl:call-template name="translate-header-footer-data">
+ <xsl:with-param name="header-footer-data" select="substring-before( $header-footer-data, '&amp;Z')"/>
+ </xsl:call-template>
+ <text:file-name text:display="path"/>
+ <xsl:call-template name="translate-header-footer-data">
+ <xsl:with-param name="header-footer-data" select="substring-after( $header-footer-data, '&amp;Z')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="contains( $header-footer-data, '&amp;F')">
+ <xsl:call-template name="translate-header-footer-data">
+ <xsl:with-param name="header-footer-data" select="substring-before( $header-footer-data, '&amp;F')"/>
+ </xsl:call-template>
+ <text:file-name text:display="name"/>
+ <xsl:call-template name="translate-header-footer-data">
+ <xsl:with-param name="header-footer-data" select="substring-after( $header-footer-data, '&amp;F')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$header-footer-data"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="create-page-master">
+ <xsl:param name="worksheetoptions"/>
+ <xsl:for-each select="$worksheetoptions">
+ <xsl:element name="style:page-layout">
+ <xsl:attribute name="style:name">
+ <xsl:call-template name="encode-as-nc-name">
+ <xsl:with-param name="string" select="concat( 'pm_', ../@ss:Name)"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:element name="style:page-layout-properties">
+ <xsl:choose>
+ <xsl:when test="x:PageSetup/x:Layout/@x:Orientation = 'Landscape'">
+ <xsl:attribute name="style:print-orientation">landscape</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:print-orientation">portrait</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="x:PageSetup/x:Layout/@x:StartPageNumber">
+ <xsl:attribute name="style:first-page-number">
+ <xsl:value-of select="x:PageSetup/x:Layout/@x:StartPageNumber"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:first-page-number">continue</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="x:PageSetup/x:PageMargins">
+ <xsl:attribute name="fo:margin-top">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="concat(x:PageSetup/x:PageMargins/@x:Top,'pt')"/>
+ </xsl:call-template>
+ <xsl:text>cm</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute name="fo:margin-bottom">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="concat(x:PageSetup/x:PageMargins/@x:Bottom,'pt')"/>
+ </xsl:call-template>
+ <xsl:text>cm</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute name="fo:margin-left">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="concat(x:PageSetup/x:PageMargins/@x:Left,'pt')"/>
+ </xsl:call-template>
+ <xsl:text>cm</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute name="fo:margin-right">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="concat(x:PageSetup/x:PageMargins/@x:Right,'pt')"/>
+ </xsl:call-template>
+ <xsl:text>cm</xsl:text>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:if test="x:PageSetup/x:Header">
+ <style:header-style>
+ <xsl:element name="style:header-footer-properties">
+ <xsl:attribute name="fo:min-height">0.75cm</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="x:PageSetup/x:Header/@x:Margin">
+ <xsl:attribute name="fo:margin-bottom">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="concat(x:PageSetup/x:Header/@x:Margin,'pt')"/>
+ </xsl:call-template>
+ <xsl:text>cm</xsl:text>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:margin-bottom">0.25cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </style:header-style>
+ </xsl:if>
+ <xsl:if test="x:PageSetup/x:Footer">
+ <style:footer-style>
+ <xsl:element name="style:header-footer-properties">
+ <xsl:attribute name="fo:min-height">0.75cm</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="x:PageSetup/x:Footer/@x:Margin">
+ <xsl:attribute name="fo:margin-top">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="concat(x:PageSetup/x:Footer/@x:Margin,'pt')"/>
+ </xsl:call-template>
+ <xsl:text>cm</xsl:text>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:margin-top">0.25cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </style:footer-style>
+ </xsl:if>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template match="ss:Style" name="style-style-content" mode="style-style-content">
+ <xsl:element name="style:table-cell-properties">
+ <xsl:if test="ss:Alignment">
+ <xsl:if test="ss:Alignment/@ss:Vertical">
+ <xsl:variable name="vertical-align">
+ <xsl:choose>
+ <xsl:when test="ss:Alignment/@ss:Vertical = 'Top'">top</xsl:when>
+ <xsl:when test="ss:Alignment/@ss:Vertical = 'Center'">middle</xsl:when>
+ <xsl:when test="ss:Alignment/@ss:Vertical = 'Bottom'">bottom</xsl:when>
+ <xsl:when test="ss:Alignment/@ss:Vertical = 'Automatic'">middle</xsl:when>
+ <!-- actually for vertical writen characters, not supported by StarOffice/OpenOffice now yet -->
+ <xsl:otherwise>middle</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="style:vertical-align">
+ <xsl:value-of select="$vertical-align"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="ss:Alignment/@ss:WrapText = '1'">
+ <xsl:attribute name="fo:wrap-option">wrap</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="ss:Alignment/@ss:Indent">
+ <xsl:attribute name="fo:padding-left"><!-- Indent is ten times of a point -->
+ <xsl:variable name="indent" select="ss:Alignment/@ss:Indent * 10"/>
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="concat($indent,'pt')"/>
+ </xsl:call-template>
+ <xsl:text>cm</xsl:text>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="ss:Alignment/@ss:Rotate">
+ <xsl:attribute name="style:rotation-angle">
+ <xsl:choose>
+ <xsl:when test="ss:Alignment/@ss:Rotate &lt; 0">
+ <xsl:value-of select="360 + ss:Alignment/@ss:Rotate"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="ss:Alignment/@ss:Rotate"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:attribute name="style:rotation-align">none</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="ss:Alignment/@ss:VerticalText = '1'">
+ <xsl:attribute name="style:direction">ttb</xsl:attribute>
+ <!-- The horizontal align default for vertical text in Excel is 'center' -->
+ <xsl:if test="not(ss:Alignment/@ss:Horizontal)">
+ <!-- OASIS XML removal
+ <xsl:attribute name="fo:text-align">center</xsl:attribute>-->
+ <xsl:attribute name="style:text-align-source">fix</xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="ss:Borders">
+ <xsl:if test="ss:Borders/ss:Border">
+ <xsl:apply-templates select="ss:Borders/ss:Border"/>
+ </xsl:if>
+ </xsl:if>
+ <xsl:apply-templates select="ss:Interior" mode="style-style-content"/>
+ <xsl:if test="ss:Protection">
+ <xsl:choose>
+ <xsl:when test="ss:Protection/@ss:Protected = '0'">
+ <xsl:choose>
+ <xsl:when test="ss:Protection/@ss:HideFormula = '1'">
+ <xsl:attribute name="style:cell-protect">hidden-and-protected</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:cell-protect">none</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="ss:Protection/@x:HideFormula = '1'">
+ <xsl:attribute name="style:cell-protect">protected formula-hidden</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:cell-protect">none</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <!-- fix means the horizontal alignment is dependent on ss:Horizontal,
+ but set on paragaraph properties not cell paragraphs -->
+ <xsl:if test="ss:Alignment/@ss:Horizontal">
+ <xsl:attribute name="style:text-align-source">fix</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:choose>
+ <xsl:when test="ss:Alignment/@ss:Horizontal">
+ <xsl:element name="style:paragraph-properties">
+ <xsl:variable name="text-align">
+ <xsl:choose>
+ <xsl:when test="ss:Alignment/@ss:Horizontal = 'Left'">start</xsl:when>
+ <xsl:when test="ss:Alignment/@ss:Horizontal = 'Center'">center</xsl:when>
+ <xsl:when test="ss:Alignment/@ss:Horizontal = 'Right'">end</xsl:when>
+ <xsl:when test="ss:Alignment/@ss:Horizontal = 'Justify'">justify</xsl:when>
+ <!-- many other text-align not supported yet -->
+ <xsl:otherwise>start</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="fo:text-align">
+ <xsl:value-of select="$text-align"/>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- The horizontal align default for vertical text in Excel is 'center' -->
+ <xsl:element name="style:paragraph-properties">
+ <xsl:if test="ss:Alignment/@ss:VerticalText = '1'">
+ <xsl:attribute name="fo:text-align">center</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="ss:Font">
+ <xsl:element name="style:text-properties">
+ <xsl:choose>
+ <xsl:when test="ss:Font/@ss:FontName">
+ <xsl:attribute name="style:font-name">
+ <xsl:value-of select="ss:Font/@ss:FontName"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:font-name-asian">
+ <xsl:value-of select="ss:Font/@ss:FontName"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:font-name-complex">
+ <xsl:value-of select="ss:Font/@ss:FontName"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:font-name">Arial</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!-- "ss:Font/@x:Family" is useless here, so can't map to "svg:font-family" attribute -->
+ <xsl:if test="ss:Font/@ss:Bold = '1'">
+ <xsl:attribute name="fo:font-weight">bold</xsl:attribute>
+ <xsl:attribute name="style:font-weight-asian">bold</xsl:attribute>
+ <xsl:attribute name="style:font-weight-complex">bold</xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="ss:Font/@ss:Color">
+ <xsl:attribute name="fo:color">
+ <xsl:value-of select="ss:Font/@ss:Color"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:use-window-font-color">true</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="ss:Font/@ss:Italic = '1'">
+ <!-- omit font-style oblique -->
+ <xsl:attribute name="fo:font-style">italic</xsl:attribute>
+ <xsl:attribute name="style:font-style-asian">italic</xsl:attribute>
+ <xsl:attribute name="style:font-style-complex">italic</xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="ss:Font/@ss:Size">
+ <xsl:attribute name="fo:font-size">
+ <xsl:value-of select="concat( ss:Font/@ss:Size, 'pt')"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:font-size-asian">
+ <xsl:value-of select="concat( ss:Font/@ss:Size, 'pt')"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:font-size-complex">
+ <xsl:value-of select="concat( ss:Font/@ss:Size, 'pt')"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:font-size">10pt</xsl:attribute>
+ <xsl:attribute name="style:font-size-asian">10pt</xsl:attribute>
+ <xsl:attribute name="style:font-size-complex">10pt</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="ss:Font/@ss:Outline = '1'">
+ <xsl:attribute name="style:text-outline">true</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="ss:Font/@ss:Shadow = '1'">
+ <!-- Not in DTD nor in docu <xsl:attribute name="style:text-shadow">shadow</xsl:attribute> -->
+ <xsl:attribute name="fo:text-shadow">1pt 1pt</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="ss:Font/@ss:StrikeThrough = '1'">
+ <xsl:attribute name="style:text-line-through-style">solid</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="ss:Font/@ss:Underline">
+ <xsl:choose>
+ <xsl:when test="ss:Font/@ss:Underline = 'None'">
+ <xsl:attribute name="style:text-underline-type">none</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="ss:Font/@ss:Underline = 'Single'">
+ <xsl:attribute name="style:text-underline-type">single</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="ss:Font/@ss:Underline = 'Double'">
+ <xsl:attribute name="style:text-underline-type">double</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="ss:Font/@ss:Underline = 'SingleAccounting'">
+ <xsl:attribute name="style:text-underline-type">single</xsl:attribute>"</xsl:when>
+ <xsl:when test="ss:Font/@ss:Underline = 'DoubleAccounting'">
+ <xsl:attribute name="style:text-underline-type">double</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:text-underline-type">none</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="ss:Font/@x:Charset">
+ <!-- quite unclear till now, -->
+ <xsl:attribute name="style:font-charset">x-symbol</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template match="ss:Interior" mode="style-style-content">
+ <xsl:choose>
+ <xsl:when test="@ss:Pattern = 'Solid'">
+ <xsl:if test="@ss:Color">
+ <xsl:attribute name="fo:background-color">
+ <xsl:value-of select="@ss:Color"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="@ss:PatternColor">
+ <xsl:variable name="pattern-value">
+ <xsl:call-template name="cell-pattern-color">
+ <xsl:with-param name="pattern" select="concat('0.',substring-after(@ss:Pattern,'y'))"/>
+ <xsl:with-param name="color-value" select="@ss:Color"/>
+ <xsl:with-param name="pattern-color-value" select="@ss:PatternColor"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="fo:background-color">
+ <xsl:value-of select="$pattern-value"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <xsl:template match="ss:Style">
+ <!-- style:default-style is meant for application defaults
+ <xsl:when test="@ss:ID = 'Default'">
+ <xsl:element name="style:default-style">
+ <xsl:call-template name="style-style-content" />
+ </xsl:element>
+ </xsl:when> -->
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name">
+ <xsl:value-of select="@ss:ID"/>
+ </xsl:attribute>
+ <xsl:apply-templates select="@ss:Name" />
+ <xsl:choose>
+ <xsl:when test="@ss:Parent">
+ <xsl:attribute name="style:parent-style-name">
+ <xsl:value-of select="@ss:Parent"/>
+ </xsl:attribute>
+ </xsl:when>
+ <!-- no parent, but automatic style are automatically inheriting from a style called 'Default'
+ not necessary named style -->
+ <xsl:when test="not(key('Style', @ss:ID)/@ss:Name)">
+ <xsl:attribute name="style:parent-style-name">
+ <xsl:text>Default</xsl:text>
+ </xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="ss:NumberFormat/@ss:Format">
+ <xsl:attribute name="style:data-style-name">
+ <xsl:value-of select="concat( @ss:ID, 'F')"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="style:family">table-cell</xsl:attribute>
+ <xsl:call-template name="style-style-content"/>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="cell-pattern-color">
+ <!-- generates a new color from cell-pattern-color -->
+ <xsl:param name="pattern"/>
+ <xsl:param name="color-value"/>
+ <xsl:param name="pattern-color-value"/>
+ <xsl:variable name="rev-pattern" select="1 - $pattern"/>
+ <xsl:variable name="color-R-value">
+ <xsl:call-template name="hex2decimal">
+ <xsl:with-param name="hex-number" select="substring($color-value,2,2)"/>
+ <xsl:with-param name="index" select="1"/>
+ <xsl:with-param name="str-length" select="2"/>
+ <xsl:with-param name="last-value" select="0"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="color-G-value">
+ <xsl:call-template name="hex2decimal">
+ <xsl:with-param name="hex-number" select="substring($color-value,4,2)"/>
+ <xsl:with-param name="index" select="1"/>
+ <xsl:with-param name="str-length" select="2"/>
+ <xsl:with-param name="last-value" select="0"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="color-B-value">
+ <xsl:call-template name="hex2decimal">
+ <xsl:with-param name="hex-number" select="substring($color-value,6,2)"/>
+ <xsl:with-param name="index" select="1"/>
+ <xsl:with-param name="str-length" select="2"/>
+ <xsl:with-param name="last-value" select="0"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="pattern-R-value">
+ <xsl:call-template name="hex2decimal">
+ <xsl:with-param name="hex-number" select="substring($pattern-color-value,2,2)"/>
+ <xsl:with-param name="index" select="1"/>
+ <xsl:with-param name="str-length" select="2"/>
+ <xsl:with-param name="last-value" select="0"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="pattern-G-value">
+ <xsl:call-template name="hex2decimal">
+ <xsl:with-param name="hex-number" select="substring($pattern-color-value,4,2)"/>
+ <xsl:with-param name="index" select="1"/>
+ <xsl:with-param name="str-length" select="2"/>
+ <xsl:with-param name="last-value" select="0"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="pattern-B-value">
+ <xsl:call-template name="hex2decimal">
+ <xsl:with-param name="hex-number" select="substring($pattern-color-value,6,2)"/>
+ <xsl:with-param name="index" select="1"/>
+ <xsl:with-param name="str-length" select="2"/>
+ <xsl:with-param name="last-value" select="0"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="R-value">
+ <xsl:variable name="combined-R-value">
+ <xsl:call-template name="decimal2hex">
+ <xsl:with-param name="dec-number" select="floor($color-R-value * $rev-pattern + $pattern-R-value * $pattern)"/>
+ <xsl:with-param name="last-value" select="'H'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="string-length($combined-R-value) = 1">
+ <xsl:value-of select="concat('0',$combined-R-value)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$combined-R-value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="G-value">
+ <xsl:variable name="combined-G-value">
+ <xsl:call-template name="decimal2hex">
+ <xsl:with-param name="dec-number" select="floor($color-G-value * $rev-pattern + $pattern-G-value * $pattern)"/>
+ <xsl:with-param name="last-value" select="'H'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="string-length($combined-G-value) = 1">
+ <xsl:value-of select="concat('0',$combined-G-value)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$combined-G-value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="B-value">
+ <xsl:variable name="combined-B-value">
+ <xsl:call-template name="decimal2hex">
+ <xsl:with-param name="dec-number" select="floor($color-B-value * $rev-pattern + $pattern-B-value * $pattern)"/>
+ <xsl:with-param name="last-value" select="'H'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="string-length($combined-B-value) = 1">
+ <xsl:value-of select="concat('0',$combined-B-value)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$combined-B-value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:value-of select="concat('#',$R-value,$G-value,$B-value)"/>
+ </xsl:template>
+ <xsl:template name="colorindex2decimal">
+ <xsl:param name="colorindex"/>
+ <xsl:variable name="colorIndexLookup">
+ <xsl:value-of select="$colorindex - 8"/>
+ </xsl:variable>
+ <xsl:variable name="tempColorValue">
+ <xsl:choose>
+ <!-- Grab the color from the custom color index if it exists... -->
+ <xsl:when test="/ss:Workbook/o:OfficeDocumentSettings/o:Colors/o:Color/o:Index=$colorIndexLookup">
+ <xsl:value-of select="substring-after(normalize-space(/ss:Workbook/o:OfficeDocumentSettings/o:Colors/o:Color/o:RGB[/ss:Workbook/o:OfficeDocumentSettings/o:Colors/o:Color/o:Index=$colorIndexLookup]), '#')"/>
+ </xsl:when >
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="$colorindex=8">
+ <xsl:value-of select="'000000'"/>
+ </xsl:when>
+ <xsl:when test="$colorindex=9">
+ <xsl:value-of select="'FFFFFF'"/>
+ </xsl:when>
+ <xsl:when test="$colorindex=10">
+ <xsl:value-of select="'FF0000'"/>
+ </xsl:when>
+ <xsl:when test="$colorindex=11">
+ <xsl:value-of select="'00FF00'"/>
+ </xsl:when>
+ <xsl:when test="$colorindex=12">
+ <xsl:value-of select="'0000FF'"/>
+ </xsl:when>
+ <xsl:when test="$colorindex=13">
+ <xsl:value-of select="'FFFF00'"/>
+ </xsl:when>
+ <xsl:when test="$colorindex=14">
+ <xsl:value-of select="'FF00FF'"/>
+ </xsl:when>
+ <xsl:when test="$colorindex=15">
+ <xsl:value-of select="'00FFFF'"/>
+ </xsl:when>
+ <xsl:when test="$colorindex=16">
+ <xsl:value-of select="'800000'"/>
+ </xsl:when>
+ <xsl:when test="$colorindex=17">
+ <xsl:value-of select="'008000'"/>
+ </xsl:when>
+ <xsl:when test="$colorindex=18">
+ <xsl:value-of select="'000080'"/>
+ </xsl:when>
+ <xsl:when test="$colorindex=19">
+ <xsl:value-of select="'808000'"/>
+ </xsl:when>
+ <xsl:when test="$colorindex=20">
+ <xsl:value-of select="'800080'"/>
+ </xsl:when>
+ <xsl:when test="$colorindex=21">
+ <xsl:value-of select="'008080'"/>
+ </xsl:when>
+ <xsl:when test="$colorindex=22">
+ <xsl:value-of select="'C0C0C0'"/>
+ </xsl:when>
+ <xsl:when test="$colorindex=23">
+ <xsl:value-of select="'808080'"/>
+ </xsl:when>
+ <xsl:when test="$colorindex=24">
+ <xsl:value-of select="'9999FF'"/>
+ </xsl:when>
+ <xsl:when test="$colorindex=25">
+ <xsl:value-of select="'993366'"/>
+ </xsl:when>
+ <xsl:when test="$colorindex=26">
+ <xsl:value-of select="'FFFFCC'"/>
+ </xsl:when>
+ <xsl:when test="$colorindex=27">
+ <xsl:value-of select="'CCFFFF'"/>
+ </xsl:when>
+ <xsl:when test="$colorindex=28">
+ <xsl:value-of select="'660066'"/>
+ </xsl:when>
+ <xsl:when test="$colorindex=29">
+ <xsl:value-of select="'FF8080'"/>
+ </xsl:when>
+ <xsl:when test="$colorindex=30">
+ <xsl:value-of select="'0066CC'"/>
+ </xsl:when>
+ <xsl:when test="$colorindex=31">
+ <xsl:value-of select="'CCCCFF'"/>
+ </xsl:when>
+ <xsl:when test="$colorindex=32">
+ <xsl:value-of select="'000080'"/>
+ </xsl:when>
+ <xsl:when test="$colorindex=33">
+ <xsl:value-of select="'FF00FF'"/>
+ </xsl:when>
+ <xsl:when test="$colorindex=34">
+ <xsl:value-of select="'FFFF00'"/>
+ </xsl:when>
+ <xsl:when test="$colorindex=35">
+ <xsl:value-of select="'00FFFF'"/>
+ </xsl:when>
+ <xsl:when test="$colorindex=36">
+ <xsl:value-of select="'800080'"/>
+ </xsl:when>
+ <xsl:when test="$colorindex=37">
+ <xsl:value-of select="'800000'"/>
+ </xsl:when>
+ <xsl:when test="$colorindex=38">
+ <xsl:value-of select="'008080'"/>
+ </xsl:when>
+ <xsl:when test="$colorindex=39">
+ <xsl:value-of select="'0000FF'"/>
+ </xsl:when>
+ <xsl:when test="$colorindex=40">
+ <xsl:value-of select="'00CCFF'"/>
+ </xsl:when>
+ <xsl:when test="$colorindex=41">
+ <xsl:value-of select="'CCFFFF'"/>
+ </xsl:when>
+ <xsl:when test="$colorindex=42">
+ <xsl:value-of select="'CCFFCC'"/>
+ </xsl:when>
+ <xsl:when test="$colorindex=43">
+ <xsl:value-of select="'FFFF99'"/>
+ </xsl:when>
+ <xsl:when test="$colorindex=44">
+ <xsl:value-of select="'99CCFF'"/>
+ </xsl:when>
+ <xsl:when test="$colorindex=45">
+ <xsl:value-of select="'FF99CC'"/>
+ </xsl:when>
+ <xsl:when test="$colorindex=46">
+ <xsl:value-of select="'CC99FF'"/>
+ </xsl:when>
+ <xsl:when test="$colorindex=47">
+ <xsl:value-of select="'FFCC99'"/>
+ </xsl:when>
+ <xsl:when test="$colorindex=48">
+ <xsl:value-of select="'3366FF'"/>
+ </xsl:when>
+ <xsl:when test="$colorindex=49">
+ <xsl:value-of select="'33CCCC'"/>
+ </xsl:when>
+ <xsl:when test="$colorindex=50">
+ <xsl:value-of select="'99CC00'"/>
+ </xsl:when>
+ <xsl:when test="$colorindex=51">
+ <xsl:value-of select="'FFCC00'"/>
+ </xsl:when>
+ <xsl:when test="$colorindex=52">
+ <xsl:value-of select="'FF9900'"/>
+ </xsl:when>
+ <xsl:when test="$colorindex=53">
+ <xsl:value-of select="'FF6600'"/>
+ </xsl:when>
+ <xsl:when test="$colorindex=54">
+ <xsl:value-of select="'666699'"/>
+ </xsl:when>
+ <xsl:when test="$colorindex=55">
+ <xsl:value-of select="'969696'"/>
+ </xsl:when>
+ <xsl:when test="$colorindex=56">
+ <xsl:value-of select="'003366'"/>
+ </xsl:when>
+ <xsl:when test="$colorindex=57">
+ <xsl:value-of select="'339966'"/>
+ </xsl:when>
+ <xsl:when test="$colorindex=58">
+ <xsl:value-of select="'003300'"/>
+ </xsl:when>
+ <xsl:when test="$colorindex=59">
+ <xsl:value-of select="'333300'"/>
+ </xsl:when>
+ <xsl:when test="$colorindex=60">
+ <xsl:value-of select="'993300'"/>
+ </xsl:when>
+ <xsl:when test="$colorindex=61">
+ <xsl:value-of select="'993366'"/>
+ </xsl:when>
+ <xsl:when test="$colorindex=62">
+ <xsl:value-of select="'333399'"/>
+ </xsl:when>
+ <xsl:when test="$colorindex=63">
+ <xsl:value-of select="'333333'"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="'NOTFOUND'"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="tempColorDecimal">
+ <xsl:choose>
+ <xsl:when test="not($tempColorValue = 'NOTFOUND')">
+ <xsl:call-template name="hex2decimal">
+ <xsl:with-param name="hex-number" select="$tempColorValue"/>
+ <xsl:with-param name="index" select="1"/>
+ <xsl:with-param name="str-length" select="6"/>
+ <xsl:with-param name="last-value" select="0"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="4294967295"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:value-of select="$tempColorDecimal"/>
+ </xsl:template>
+ <xsl:template name="hex2decimal">
+ <!-- transforms a hex number to a decimal number.parses the string from left to right -->
+ <xsl:param name="hex-number"/>
+ <xsl:param name="index"/>
+ <xsl:param name="str-length"/>
+ <xsl:param name="last-value"/>
+ <xsl:variable name="dec-char">
+ <xsl:call-template name="hexNumber2dec">
+ <xsl:with-param name="hex-value" select="substring($hex-number, $index ,1)"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="current-value" select="$last-value * 16 + $dec-char"/>
+ <xsl:if test="$index &lt; $str-length">
+ <xsl:call-template name="hex2decimal">
+ <xsl:with-param name="hex-number" select="$hex-number"/>
+ <xsl:with-param name="index" select="$index + 1"/>
+ <xsl:with-param name="str-length" select="$str-length"/>
+ <xsl:with-param name="last-value" select="$current-value"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="$index = $str-length">
+ <xsl:value-of select="$current-value"/>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="hexNumber2dec">
+ <!-- return a decimal number for a hex character -->
+ <xsl:param name="hex-value"/>
+ <xsl:choose>
+ <xsl:when test="$hex-value = 'A' or ($hex-value = 'a')">
+ <xsl:value-of select="10"/>
+ </xsl:when>
+ <xsl:when test="$hex-value = 'B' or ($hex-value = 'b')">
+ <xsl:value-of select="11"/>
+ </xsl:when>
+ <xsl:when test="$hex-value = 'C' or ($hex-value = 'c')">
+ <xsl:value-of select="12"/>
+ </xsl:when>
+ <xsl:when test="$hex-value = 'D' or ($hex-value = 'd')">
+ <xsl:value-of select="13"/>
+ </xsl:when>
+ <xsl:when test="$hex-value = 'E' or ($hex-value = 'e')">
+ <xsl:value-of select="14"/>
+ </xsl:when>
+ <xsl:when test="$hex-value = 'F' or ($hex-value = 'f')">
+ <xsl:value-of select="15"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$hex-value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="decimal2hex">
+ <!-- transforms a decimal number to a hex number,only for two-bit hex(less than 256 in decimal) currently -->
+ <xsl:param name="dec-number"/>
+ <xsl:param name="last-value"/>
+ <xsl:variable name="current-value">
+ <xsl:call-template name="decNumber2hex">
+ <xsl:with-param name="dec-value">
+ <xsl:if test="$dec-number &gt; 15">
+ <xsl:value-of select="floor($dec-number div 16)"/>
+ </xsl:if>
+ <xsl:if test="$dec-number &lt; 16">
+ <xsl:value-of select="$dec-number"/>
+ </xsl:if>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="$dec-number &gt; 15">
+ <xsl:call-template name="decimal2hex">
+ <xsl:with-param name="dec-number" select="$dec-number mod 16"/>
+ <xsl:with-param name="last-value" select="concat($last-value,$current-value)"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="$dec-number &lt; 16">
+ <xsl:value-of select="substring-after(concat($last-value,$current-value),'H')"/>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="decNumber2hex">
+ <!-- return a hex number for a decimal character -->
+ <xsl:param name="dec-value"/>
+ <xsl:choose>
+ <xsl:when test="$dec-value = 10">
+ <xsl:value-of select="'A'"/>
+ </xsl:when>
+ <xsl:when test="$dec-value = 11">
+ <xsl:value-of select="'B'"/>
+ </xsl:when>
+ <xsl:when test="$dec-value = 12">
+ <xsl:value-of select="'C'"/>
+ </xsl:when>
+ <xsl:when test="$dec-value = 13">
+ <xsl:value-of select="'D'"/>
+ </xsl:when>
+ <xsl:when test="$dec-value = 14">
+ <xsl:value-of select="'E'"/>
+ </xsl:when>
+ <xsl:when test="$dec-value = 15">
+ <xsl:value-of select="'F'"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$dec-value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="ss:Border">
+ <xsl:variable name="position">
+ <xsl:choose>
+ <xsl:when test="@ss:Position = 'Top'">fo:border-top</xsl:when>
+ <xsl:when test="@ss:Position = 'Bottom'">fo:border-bottom</xsl:when>
+ <xsl:when test="@ss:Position = 'Left'">fo:border-left</xsl:when>
+ <xsl:when test="@ss:Position = 'Right'">fo:border-right</xsl:when>
+ <!-- DiagonalLeft & DiagonalRight are not supported yet, -->
+ <xsl:otherwise>fo:border-left</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="width">
+ <xsl:choose>
+ <!-- 0: Hairline -->
+ <xsl:when test="@ss:Weight = '0'">0.002cm</xsl:when>
+ <!-- 1: Thin -->
+ <xsl:when test="@ss:Weight = '1'">0.035cm</xsl:when>
+ <!-- 2: Medium -->
+ <xsl:when test="@ss:Weight = '2'">0.088cm</xsl:when>
+ <!-- 3: Thick -->
+ <xsl:when test="@ss:Weight = '3'">
+ <xsl:choose>
+ <xsl:when test="@ss:LineStyle = 'Double'">0.105cm</xsl:when>
+ <xsl:otherwise>0.141cm</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <!-- invalid value, or parameter not exist at all -->
+ <xsl:otherwise>0.002cm</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="linestyle">
+ <xsl:choose>
+ <xsl:when test="@ss:LineStyle = 'None'">none</xsl:when>
+ <xsl:when test="@ss:LineStyle = 'Continuous'">solid</xsl:when>
+ <xsl:when test="@ss:LineStyle = 'Double'">double</xsl:when>
+ <!-- Dash, Dot, DashDot, DashDotDot, SlantDashDot are not supported yet -->
+ <xsl:otherwise>solid</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="color">
+ <xsl:choose>
+ <xsl:when test="@ss:Color">
+ <xsl:value-of select="@ss:Color"/>
+ </xsl:when>
+ <!-- default border color is black -->
+ <xsl:otherwise>#000000</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="{$position}">
+ <xsl:value-of select="concat( $width, ' ', $linestyle, ' ', $color)"/>
+ </xsl:attribute>
+ <xsl:if test="@ss:LineStyle = 'Double'">
+ <xsl:variable name="widthposition">
+ <xsl:choose>
+ <xsl:when test="@ss:Position = 'Top'">style:border-line-width-top</xsl:when>
+ <xsl:when test="@ss:Position = 'Bottom'">style:border-line-width-bottom</xsl:when>
+ <xsl:when test="@ss:Position = 'Left'">style:border-line-width-left</xsl:when>
+ <xsl:when test="@ss:Position = 'Right'">style:border-line-width-right</xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="{$widthposition}">0.035cm 0.035cm 0.035cm</xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="ss:Font">
+ <xsl:choose>
+ <xsl:when test="@ss:VerticalAlign = 'Superscript'">
+ <style:style style:name="{concat(../@ss:ID,'T0')}" style:family="text">
+ <style:text-properties style:text-position="33% 58%"/>
+ </style:style>
+ </xsl:when>
+ <xsl:when test="@ss:VerticalAlign = 'Subscript'">
+ <style:style style:name="{concat(../@ss:ID,'T0')}" style:family="text">
+ <style:text-properties style:text-position="-33% 58%"/>
+ </style:style>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="ss:Table">
+ <xsl:variable name="default-column-width">
+ <xsl:choose>
+ <xsl:when test="@ss:DefaultColumnWidth">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="concat(@ss:DefaultColumnWidth,'pt')"/>
+ </xsl:call-template>
+ <xsl:text>cm</xsl:text>
+ </xsl:when>
+ <!-- Note: Specify where this value come from.. -->
+ <xsl:otherwise>2.096cm</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="table-pos">
+ <xsl:value-of select="count(../preceding-sibling::ss:Worksheet)+1"/>
+ </xsl:variable>
+ <!-- naming convention the default column style is name co<NumberOfSheet> e.g. co1 for the first sheet -->
+ <style:style style:family="table-column" style:name="{concat('co', $table-pos)}">
+ <style:table-column-properties fo:break-before="auto" style:column-width="{$default-column-width}"/>
+ </style:style>
+ <xsl:choose>
+ <xsl:when test="ss:Column">
+ <xsl:call-template name="get-column-style-name">
+ <xsl:with-param name="finishedColumns" select="0"/>
+ <xsl:with-param name="columnCount" select="count(./ss:Column)"/>
+ <xsl:with-param name="currentCount" select="1"/>
+ <xsl:with-param name="table-pos" select="$table-pos"/>
+ <xsl:with-param name="default-column-width" select="$default-column-width"/>
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="../x:PageBreaks/x:ColBreaks">
+ <style:style style:name="{concat('cob',$table-pos)}" style:family="table-column">
+ <xsl:element name="style:table-column-properties">
+ <xsl:attribute name="style:column-width">
+ <xsl:value-of select="$default-column-width"/>
+ </xsl:attribute>
+ <xsl:attribute name="fo:break-before">page</xsl:attribute>
+ </xsl:element>
+ </style:style>
+ </xsl:if>
+ <xsl:variable name="default-row-height">
+ <xsl:choose>
+ <xsl:when test="@ss:DefaultRowHeight">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="concat(@ss:DefaultRowHeight,'pt')"/>
+ </xsl:call-template>
+ <xsl:text>cm</xsl:text>
+ </xsl:when>
+ <!-- Note: This is the default row hight value in spec it is written 255 point, this seems wrong -->
+ <!-- <xsl:otherwise>0.503cm</xsl:otherwise> -->
+ <xsl:otherwise>0.45cm</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <style:style style:family="table-row" style:name="{concat('ro', $table-pos)}">
+ <style:table-row-properties style:row-height="{$default-row-height}" style:use-optimal-row-height="false"/>
+ </style:style>
+ <xsl:if test="ss:Row">
+ <xsl:call-template name="get-row-style-name">
+ <xsl:with-param name="earlierRowNo" select="0"/>
+ <xsl:with-param name="rowNodeCount" select="count(./ss:Row)"/>
+ <xsl:with-param name="rowNodeIndex" select="1"/>
+ <xsl:with-param name="table-pos" select="$table-pos"/>
+ <xsl:with-param name="default-row-height" select="$default-row-height"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="../x:PageBreaks/x:RowBreaks">
+ <style:style style:name="{concat('rob',$table-pos)}" style:family="table-row">
+ <xsl:element name="style:table-row-properties">
+ <xsl:attribute name="style:row-height">
+ <xsl:value-of select="$default-row-height"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:use-optimal-row-height">false</xsl:attribute>
+ <xsl:attribute name="fo:break-before">page</xsl:attribute>
+ </xsl:element>
+ </style:style>
+ </xsl:if>
+ <!-- create table-style -->
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name">
+ <xsl:value-of select="concat( 'ta', $table-pos)"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:family">table</xsl:attribute>
+ <!-- ss:Name have to be from type 'NCNameChar' ::= Letter | Digit | '.' | '-' | '_' | CombiningChar | Extender -->
+ <xsl:attribute name="style:master-page-name">
+ <xsl:call-template name="encode-as-nc-name">
+ <xsl:with-param name="string" select="../@ss:Name"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:element name="style:table-properties">
+ <xsl:choose>
+ <xsl:when test="../x:WorksheetOptions/x:Visible = 'SheetHidden'">
+ <xsl:attribute name="table:display">false</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="table:display">true</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="get-column-style-name">
+ <!-- generate stylename of colbreak after matching the column number and the colbreak number -->
+ <xsl:param name="finishedColumns"/>
+ <xsl:param name="columnCount"/>
+ <xsl:param name="currentCount"/>
+ <xsl:param name="table-pos"/>
+ <xsl:param name="default-column-width"/>
+ <xsl:if test="$currentCount &lt; ($columnCount + 1)">
+ <xsl:variable name="span-value">
+ <xsl:choose>
+ <xsl:when test="./ss:Column[position() = $currentCount]/@ss:Span">
+ <xsl:value-of select="./ss:Column[position() = $currentCount]/@ss:Span + 1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="0"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="current-index">
+ <xsl:choose>
+ <xsl:when test="./ss:Column[position() = $currentCount]/@ss:Index">
+ <xsl:value-of select="./ss:Column[position() = $currentCount]/@ss:Index - 1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$finishedColumns"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="column-break">
+ <xsl:choose>
+ <xsl:when test="$span-value = 0">
+ <xsl:if test="../x:PageBreaks/x:ColBreaks/x:ColBreak/x:Column = $current-index">
+ <xsl:value-of select="1"/>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="../x:PageBreaks/x:ColBreaks[(x:ColBreak/x:Column &gt; $finishedColumns) and (x:ColBreak/x:Column &lt; ($finishedColumns + $span-value))]">
+ <xsl:value-of select="1"/>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="$column-break = 1">
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name">
+ <xsl:call-template name="encode-as-nc-name">
+ <xsl:with-param name="string" select="concat('cob', $table-pos, '-',$currentCount)"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="style:family">table-column</xsl:attribute>
+ <xsl:element name="style:table-column-properties">
+ <xsl:choose>
+ <xsl:when test="./ss:Column[position() = $currentCount]/@ss:Width">
+ <xsl:attribute name="style:column-width">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="concat(./ss:Column[position() = $currentCount]/@ss:Width,'pt')"/>
+ </xsl:call-template>
+ <xsl:text>cm</xsl:text>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:column-width">
+ <xsl:value-of select="$default-column-width"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="./ss:Column[position() = $currentCount]/@ss:AutoFitWidth = '0'">
+ <xsl:attribute name="style:use-optimal-column-width">false</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="./ss:Column[position() = $currentCount]/@ss:Width &gt; 0">
+ <xsl:attribute name="style:use-optimal-column-width">false</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:use-optimal-column-width">true</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="fo:break-before">page</xsl:attribute>
+ </xsl:element>
+ </xsl:element>
+ </xsl:if>
+ <style:style style:name="{concat('co', $table-pos, '-',$currentCount)}" style:family="table-column">
+ <xsl:element name="style:table-column-properties">
+ <xsl:choose>
+ <xsl:when test="./ss:Column[position() = $currentCount]/@ss:Width">
+ <xsl:attribute name="style:column-width">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="concat(./ss:Column[position() = $currentCount]/@ss:Width,'pt')"/>
+ </xsl:call-template>
+ <xsl:text>cm</xsl:text>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:column-width">
+ <xsl:value-of select="$default-column-width"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="fo:break-before">auto</xsl:attribute>
+ </xsl:element>
+ </style:style>
+ <xsl:if test="$currentCount &lt; $columnCount">
+ <xsl:call-template name="get-column-style-name">
+ <xsl:with-param name="finishedColumns">
+ <xsl:choose>
+ <xsl:when test="./ss:Column[position() = $currentCount]/@ss:Index">
+ <xsl:choose>
+ <xsl:when test="./ss:Column[position() = $currentCount]/@ss:Span">
+ <xsl:value-of select="./ss:Column[position() = $currentCount]/@ss:Index + ./ss:Column[position() = $currentCount]/@ss:Span"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="./ss:Column[position() = $currentCount]/@ss:Index"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="./ss:Column[position() = $currentCount]/@ss:Span">
+ <xsl:value-of select="$finishedColumns + ./ss:Column[position() = $currentCount]/@ss:Span + 1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$finishedColumns + 1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="columnCount" select="$columnCount"/>
+ <xsl:with-param name="currentCount" select="$currentCount + 1"/>
+ <xsl:with-param name="table-pos" select="$table-pos"/>
+ <xsl:with-param name="default-column-width" select="$default-column-width"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="get-row-style-name">
+ <!-- generate stylename of rowbreak after matching the row number and the rowbreak number -->
+ <xsl:param name="earlierRowNo"/>
+ <xsl:param name="rowNodeCount"/>
+ <xsl:param name="rowNodeIndex"/>
+ <xsl:param name="table-pos"/>
+ <xsl:param name="default-row-height"/>
+ <xsl:if test="$rowNodeIndex &lt; ($rowNodeCount + 1)">
+ <xsl:variable name="span-value">
+ <xsl:choose>
+ <xsl:when test="./ss:Row[position() = $rowNodeIndex]/@ss:Index">
+ <xsl:choose>
+ <xsl:when test="./ss:Row[position() = $rowNodeIndex]/@ss:Span">
+ <xsl:value-of select="./ss:Row[position() = $rowNodeIndex]/@ss:Index - $earlierRowNo+ ./ss:Row[position() = $rowNodeIndex]/@ss:Span"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="0"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="./ss:Row[position() = $rowNodeIndex]/@ss:Span">
+ <xsl:value-of select="./ss:Row[position() = $rowNodeIndex]/@ss:Span + 1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="0"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="current-index">
+ <xsl:choose>
+ <xsl:when test="./ss:Row[position() = $rowNodeIndex]/@ss:Index">
+ <xsl:value-of select="./ss:Row[position() = $rowNodeIndex]/@ss:Index - 1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$earlierRowNo"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="row-break">
+ <xsl:choose>
+ <xsl:when test="$span-value = 0">
+ <xsl:if test="../x:PageBreaks/x:RowBreaks/x:RowBreak/x:Row = $current-index">
+ <xsl:value-of select="1"/>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="../x:PageBreaks/x:RowBreaks[(x:RowBreak/x:Row &gt; $earlierRowNo) and (x:RowBreak/x:Row &lt; ($earlierRowNo + $span-value))]">
+ <xsl:value-of select="1"/>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="$row-break = 1">
+ <xsl:element name="style:style">
+ <xsl:choose>
+ <xsl:when test="./ss:Row[position() = $rowNodeIndex]/@ss:StyleID">
+ <xsl:attribute name="style:name"><xsl:value-of select="concat('ro', $table-pos, '-',$rowNodeIndex,'-',ss:Row[position() = $rowNodeIndex]/@ss:StyleID)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:name"><xsl:value-of select="concat('ro', $table-pos, '-',$rowNodeIndex)"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="style:family">table-row</xsl:attribute>
+
+
+ <xsl:element name="style:table-row-properties">
+ <xsl:choose>
+ <xsl:when test="./ss:Row[position() = $rowNodeIndex]/@ss:Height">
+ <xsl:attribute name="style:row-height">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="concat(./ss:Row[position() = $rowNodeIndex]/@ss:Height,'pt')"/>
+ </xsl:call-template>
+ <xsl:text>cm</xsl:text>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:row-height">
+ <xsl:value-of select="$default-row-height"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="./ss:Row[position() = $rowNodeIndex]/@ss:AutoFitHeight = '0'">
+ <xsl:attribute name="style:use-optimal-row-height">false</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="./ss:Row[position() = $rowNodeIndex]/@ss:Height &gt; 0">
+ <xsl:attribute name="style:use-optimal-row-height">false</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:use-optimal-row-height">true</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="fo:break-before">page</xsl:attribute>
+ <xsl:apply-templates select="key('Style', ss:Row[position() = $rowNodeIndex]/@ss:StyleID)/ss:Interior" mode="style-style-content"/>
+ </xsl:element>
+ <!--
+ <xsl:apply-templates select="key('Style', ss:Row[position() = $rowNodeIndex]/@ss:StyleID)" mode="style-style-content" />
+ -->
+ </xsl:element>
+ </xsl:if>
+ <!--
+ <style:style style:name="{concat('ro', $table-pos, '-',$rowNodeIndex)}" style:family="table-row">
+ -->
+ <xsl:element name="style:style">
+ <xsl:choose>
+ <xsl:when test="./ss:Row[position() = $rowNodeIndex]/@ss:StyleID">
+ <xsl:attribute name="style:name"><xsl:value-of select="concat('ro', $table-pos, '-',$rowNodeIndex,'-',ss:Row[position() = $rowNodeIndex]/@ss:StyleID)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:name"><xsl:value-of select="concat('ro', $table-pos, '-',$rowNodeIndex)"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="style:family">table-row</xsl:attribute>
+
+
+ <xsl:element name="style:table-row-properties">
+ <xsl:choose>
+ <xsl:when test="./ss:Row[position() = $rowNodeIndex]/@ss:Height">
+ <xsl:attribute name="style:row-height">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="concat(./ss:Row[position() = $rowNodeIndex]/@ss:Height,'pt')"/>
+ </xsl:call-template>
+ <xsl:text>cm</xsl:text>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:row-height">
+ <xsl:value-of select="$default-row-height"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="./ss:Row[position() = $rowNodeIndex]/@ss:AutoFitHeight">
+ <xsl:choose>
+ <xsl:when test="./ss:Row[position() = $rowNodeIndex]/@ss:AutoFitHeight = '0'">
+ <xsl:attribute name="style:use-optimal-row-height">false</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:use-optimal-row-height">true</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="./ss:Row[position() = $rowNodeIndex]/@ss:Height &gt; 0">
+ <xsl:attribute name="style:use-optimal-row-height">false</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:use-optimal-row-height">true</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="fo:break-before">auto</xsl:attribute>
+ <!-- apply to background -->
+ <xsl:apply-templates select="key('Style', ss:Row[position() = $rowNodeIndex]/@ss:StyleID)/ss:Interior" mode="style-style-content"/>
+ </xsl:element>
+ <!--
+ <xsl:apply-templates select="key('Style', ss:Row[position() = $rowNodeIndex]/@ss:StyleID)" mode="style-style-content" />
+ -->
+ </xsl:element>
+ <xsl:if test="$rowNodeIndex &lt; $rowNodeCount">
+ <xsl:call-template name="get-row-style-name">
+ <xsl:with-param name="earlierRowNo">
+ <xsl:choose>
+ <xsl:when test="./ss:Row[position() = $rowNodeIndex]/@ss:Index">
+ <xsl:choose>
+ <xsl:when test="./ss:Row[position() = $rowNodeIndex]/@ss:Span">
+ <xsl:value-of select="./ss:Row[position() = $rowNodeIndex]/@ss:Index + ./ss:Row[position() = $rowNodeIndex]/@ss:Span"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="./ss:Row[position() = $rowNodeIndex]/@ss:Index"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="./ss:Row[position() = $rowNodeIndex]/@ss:Span">
+ <xsl:value-of select="$earlierRowNo + ./ss:Row[position() = $rowNodeIndex]/@ss:Span + 1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$earlierRowNo + 1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="rowNodeCount" select="$rowNodeCount"/>
+ <xsl:with-param name="rowNodeIndex" select="$rowNodeIndex + 1"/>
+ <xsl:with-param name="table-pos" select="$table-pos"/>
+ <xsl:with-param name="default-row-height" select="$default-row-height"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="count-spanned-columns">
+ <xsl:param name="expandedColumnCount" select="0"/>
+ <xsl:param name="columns"/>
+ <xsl:param name="columnsCount" select="count($columns)"/>
+ <xsl:param name="columnIndex" select="1"/>
+ <xsl:choose>
+ <xsl:when test="$columnIndex &lt;= $columnsCount">
+ <xsl:call-template name="count-spanned-columns">
+ <xsl:with-param name="columns" select="$columns"/>
+ <xsl:with-param name="columnsCount" select="$columnsCount"/>
+ <xsl:with-param name="columnIndex" select="$columnIndex + 1"/>
+ <xsl:with-param name="expandedColumnCount" select="$expandedColumnCount + $columns[$columnIndex]/@ss:Span"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$expandedColumnCount"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="ss:Worksheet">
+ <xsl:element name="table:table">
+ <xsl:attribute name="table:name">
+ <xsl:value-of select="@ss:Name"/>
+ </xsl:attribute>
+ <!-- other attributes aren't suitable to apply yet -->
+ <xsl:if test="ss:Table">
+ <xsl:attribute name="table:style-name">
+ <xsl:value-of select="concat( 'ta', count(preceding-sibling::ss:Worksheet)+1)"/>
+ </xsl:attribute>
+ <xsl:if test="@ss:Protected = '1'">
+ <xsl:attribute name="table:protected">true</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="descendant::ss:NamedRange[@ss:Name = 'Print_Area' and contains( @ss:RefersTo, '!R')]">
+ <xsl:variable name="referto">
+ <xsl:call-template name="translate-expression">
+ <xsl:with-param name="cell-row-pos" select="0"/>
+ <xsl:with-param name="cell-column-pos" select="0"/>
+ <xsl:with-param name="expression" select="descendant::ss:NamedRange/@ss:RefersTo"/>
+ <xsl:with-param name="return-value" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="table:print-ranges">
+ <xsl:value-of select="translate( $referto, '=', '$')"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:variable name="table-pos">
+ <xsl:value-of select="count(../preceding-sibling::ss:Worksheet)+1"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="ss:Table/@ss:ExpandedColumnCount">
+ <xsl:choose>
+ <xsl:when test="not(ss:Table/ss:Column)">
+ <!-- no columns exist -->
+ <xsl:call-template name="create-columns-without-input">
+ <xsl:with-param name="table-pos" select="$table-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="create-columns">
+ <xsl:with-param name="columnCount" select="ss:Table/@ss:ExpandedColumnCount"/>
+ <xsl:with-param name="currentColumnNode" select="ss:Table/ss:Column[1]"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="ss:Table/ss:Column/@ss:Span">
+ <!-- No absolute column number (ss:ExpandedColumnCount) is add the nodes and spanned columns -->
+ <xsl:variable name="spannedColumns">
+ <xsl:call-template name="count-spanned-columns">
+ <xsl:with-param name="columns" select="ss:Table/ss:Column[@ss:Span]"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="create-columns">
+ <xsl:with-param name="columnCount" select="count(ss:Table/ss:Column) + number($spannedColumns)"/>
+ <xsl:with-param name="currentColumnNode" select="ss:Table/ss:Column[1]"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- No absolute column number (ss:ExpandedColumnCount) is add the nodes -->
+ <xsl:call-template name="create-columns">
+ <xsl:with-param name="columnCount" select="count(ss:Table/ss:Column)"/>
+ <xsl:with-param name="currentColumnNode" select="ss:Table/ss:Column[1]"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!-- generates the string of row\column position if ConditionalFormatting exists -->
+ <xsl:variable name="condition-pos-str1">
+ <xsl:if test="./x:ConditionalFormatting">
+ <xsl:call-template name="condition-row-column-string">
+ <xsl:with-param name="last" select="''"/>
+ <xsl:with-param name="total" select="count(./x:ConditionalFormatting)"/>
+ <xsl:with-param name="index" select="1"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:variable name="condition-pos-str2">
+ <xsl:if test="./x:DataValidation">
+ <xsl:call-template name="validation-row-column-string">
+ <xsl:with-param name="last" select="''"/>
+ <xsl:with-param name="total" select="count(./x:DataValidation)"/>
+ <xsl:with-param name="index" select="1"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:variable name="condition-pos-str" select="concat($condition-pos-str1, $condition-pos-str2)"/>
+ <xsl:choose>
+ <xsl:when test="./ss:Table/ss:Row">
+ <xsl:call-template name="create-rows">
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="./x:PageBreaks/x:RowBreaks">
+ <xsl:for-each select="./x:PageBreaks/x:RowBreaks/x:RowBreak">
+ <xsl:variable name="number-repeated">
+ <xsl:choose>
+ <xsl:when test="position() = 1">
+ <xsl:value-of select="./x:Row"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select=". - preceding::x:RowBreak[position()=count(.)]/x:Row - 1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="$number-repeated &gt; 0">
+ <xsl:element name="table:table-row">
+ <xsl:if test="@ss:Hidden = '1'">
+ <xsl:attribute name="table:visibility">collapse</xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="table:style-name">
+ <xsl:value-of select="concat('ro',$table-pos)"/>
+ </xsl:attribute>
+ <xsl:attribute name="table:number-rows-repeated">
+ <xsl:value-of select="$number-repeated"/>
+ </xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="ss:Table/@ss:ExpandedColumnCount">
+ <table:table-cell table:number-columns-repeated="{ss:Table/@ss:ExpandedColumnCount}"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- OASIS XML row can not be empty -->
+ <table:table-cell table:number-columns-repeated="256"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="table:table-row">
+ <xsl:if test="@ss:Hidden = '1'">
+ <xsl:attribute name="table:visibility">collapse</xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="table:style-name">
+ <xsl:value-of select="concat('rob',$table-pos)"/>
+ </xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="ss:Table/@ss:ExpandedColumnCount">
+ <table:table-cell table:number-columns-repeated="{ss:Table/@ss:ExpandedColumnCount}"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- OASIS XML row can not be empty -->
+ <table:table-cell table:number-columns-repeated="256"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- in case no table row exists (empty spreadsheet) -->
+ <xsl:element name="table:table-row">
+ <xsl:choose>
+ <xsl:when test="ss:Table/@ss:StyleID">
+ <xsl:attribute name="table:style-name">
+ <xsl:value-of select="ss:Table/@ss:StyleID"/>
+ </xsl:attribute>
+ <xsl:element name="table:table-cell">
+ <xsl:attribute name="table:style-name">
+ <xsl:value-of select="ss:Table/@ss:StyleID"/>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="table:style-name">
+ <xsl:value-of select="concat('ro',$table-pos)"/>
+ </xsl:attribute>
+ <xsl:element name="table:table-cell"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="./x:ConditionalFormatting">
+ <xsl:variable name="condition-row-max">
+ <xsl:call-template name="condition-row-col-pos-max">
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="last-value" select="0"/>
+ <xsl:with-param name="div-value" select="'R'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="condition-col-max">
+ <xsl:call-template name="condition-row-col-pos-max">
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="last-value" select="0"/>
+ <xsl:with-param name="div-value" select="'C'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="break-row-max">
+ <xsl:call-template name="break-row-beyond-max">
+ <xsl:with-param name="pos" select="1"/>
+ <xsl:with-param name="last-value" select="0"/>
+ <xsl:with-param name="count-value" select="count(./x:PageBreaks/x:RowBreaks/x:RowBreak)"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="end-value">
+ <xsl:choose>
+ <xsl:when test="$condition-row-max &lt; $break-row-max">
+ <xsl:value-of select="$break-row-max"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$condition-row-max"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:call-template name="get-row-beyond-last">
+ <xsl:with-param name="index-value" select="1"/>
+ <xsl:with-param name="worksheetNo" select="count(preceding-sibling::ss:Worksheet)+1"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="end-pos" select="$end-value"/>
+ <xsl:with-param name="total-col" select="$condition-col-max"/>
+ </xsl:call-template>
+ </xsl:if>
+ <!-- if exists attribute of StyleID in tag of ss:Table but no Row/Column -->
+ <xsl:if test="./ss:Table/@ss:StyleID">
+ <table:table-row table:style-name="{concat('ro',$table-pos)}" table:number-rows-repeated="65564">
+ <table:table-cell table:number-columns-repeated="256"/>
+ </table:table-row>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:element>
+ </xsl:template>
+ <!-- Note: Need to be refactored -->
+ <xsl:template name="create-columns-without-input">
+ <xsl:param name="table-pos"/>
+ <xsl:choose>
+ <xsl:when test="./x:PageBreaks/x:ColBreaks">
+ <xsl:for-each select="./x:PageBreaks/x:ColBreaks/x:ColBreak">
+ <xsl:variable name="number-repeated">
+ <xsl:choose>
+ <xsl:when test="position() = 1">
+ <xsl:value-of select="./x:Column"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select=". - preceding::x:ColBreak[position()=count(.)]/x:Column - 1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="$number-repeated &gt; 0">
+ <xsl:element name="table:table-column">
+ <xsl:if test="ancestor::ss:Worksheet/ss:Table/@ss:StyleID">
+ <xsl:attribute name="table:default-cell-style-name">
+ <xsl:value-of select="ancestor::ss:Worksheet/ss:Table/@ss:StyleID"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@ss:Hidden = '1'">
+ <xsl:attribute name="table:visibility">collapse</xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="table:style-name">
+ <xsl:value-of select="concat('co',$table-pos)"/>
+ </xsl:attribute>
+ <xsl:attribute name="table:number-columns-repeated">
+ <xsl:value-of select="$number-repeated"/>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="table:table-column">
+ <!-- column style be made out beforehead -->
+ <xsl:if test="ancestor::ss:Worksheet/ss:Table/@ss:StyleID">
+ <xsl:attribute name="table:default-cell-style-name">
+ <xsl:value-of select="ancestor::ss:Worksheet/ss:Table/@ss:StyleID"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@ss:Hidden = '1'">
+ <xsl:attribute name="table:visibility">collapse</xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="table:style-name">
+ <xsl:value-of select="concat('cob',$table-pos)"/>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="table:table-column">
+ <xsl:choose>
+ <xsl:when test="ss:Table/@ss:StyleID">
+ <xsl:attribute name="table:style-name">
+ <xsl:value-of select="ss:Table/@ss:StyleID"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="table:style-name">
+ <xsl:text>co1</xsl:text>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="ss:Table/@ss:ExpandedColumnCount and ss:Table/@ss:ExpandedColumnCount > 0">
+ <xsl:attribute name="table:number-columns-repeated">
+ <xsl:value-of select="ss:Table/@ss:ExpandedColumnCount"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="table:default-cell-style-name">
+ <xsl:text>Default</xsl:text>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!--
+ Example:
+ <ss:Table>
+ <ss:Column ss:Index="4" ss:Width="500" ss:Span="3" />
+ <ss:Column ss:Width="200" />
+ </ss:Table>
+
+ Prior column (ss:Index - 1) is written
+ The given fourth cell (ss:Index="4") is handled as repeated three times (ss:Span="3").
+ The eight column got a width of "200"
+
+ ContextNode: ss:Worksheet
+ -->
+ <xsl:key match="/ss:Workbook/ss:Worksheet/x:PageBreaks/x:ColBreaks/x:ColBreak" name="ColBreak" use="Column"/>
+ <xsl:template name="create-columns">
+ <xsl:param name="columnCount"/>
+ <xsl:param name="currentColumn" select="1"/>
+ <xsl:param name="finishedColumns" select="0"/>
+ <xsl:param name="worksheetNo" select="count(preceding-sibling::ss:Worksheet)+1"/>
+ <xsl:param name="currentColumnNode"/>
+ <xsl:choose>
+ <xsl:when test="$finishedColumns &lt; $columnCount">
+ <xsl:choose>
+ <xsl:when test="$currentColumnNode">
+ <xsl:choose>
+ <xsl:when test="$currentColumnNode/@ss:Index - $finishedColumns &gt; 1">
+ <!-- found column with index.
+ filling up table with empty columns until Index is reached -->
+ <xsl:call-template name="create-default-column">
+ <xsl:with-param name="currentColumn" select="$currentColumn"/>
+ <xsl:with-param name="currentColumnNode" select="$currentColumnNode"/>
+ <xsl:with-param name="worksheetNo" select="$worksheetNo"/>
+ </xsl:call-template>
+ <xsl:call-template name="create-columns">
+ <xsl:with-param name="columnCount" select="$columnCount"/>
+ <xsl:with-param name="currentColumn" select="$currentColumn"/>
+ <xsl:with-param name="currentColumnNode" select="$currentColumnNode"/>
+ <xsl:with-param name="finishedColumns" select="$finishedColumns + 1"/>
+ <xsl:with-param name="worksheetNo" select="$worksheetNo"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="table:table-column">
+ <xsl:if test="$currentColumnNode/@ss:Hidden = '1'">
+ <xsl:attribute name="table:visibility">collapse</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$currentColumnNode/@ss:Span">
+ <xsl:attribute name="table:number-columns-repeated">
+ <xsl:value-of select="$currentColumnNode/@ss:Span + 1"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="key('ColBreak', $currentColumn)">
+ <xsl:attribute name="table:style-name">
+ <xsl:value-of select="concat('cob', $worksheetNo, '-', $currentColumn)"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="table:style-name">
+ <xsl:value-of select="concat('co', $worksheetNo, '-', $currentColumn)"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="$currentColumnNode/@ss:StyleID">
+ <xsl:attribute name="table:default-cell-style-name">
+ <xsl:value-of select="$currentColumnNode/@ss:StyleID"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="table:default-cell-style-name">
+ <xsl:text>Default</xsl:text>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:call-template name="create-columns">
+ <xsl:with-param name="columnCount" select="$columnCount"/>
+ <xsl:with-param name="currentColumn" select="$currentColumn + 1"/>
+ <xsl:with-param name="finishedColumns">
+ <xsl:choose>
+ <xsl:when test="$currentColumnNode/@ss:Span">
+ <xsl:value-of select="$finishedColumns + $currentColumnNode/@ss:Span + 1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$finishedColumns + 1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="currentColumnNode" select="ss:Table/ss:Column[$currentColumn + 1]"/>
+ <xsl:with-param name="worksheetNo" select="$worksheetNo"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- <xsl:if test="not($finishedColumns + 1 = $columnCount)"> -->
+ <xsl:call-template name="create-default-column">
+ <xsl:with-param name="currentColumn" select="$currentColumn"/>
+ <xsl:with-param name="currentColumnNode" select="$currentColumnNode"/>
+ <xsl:with-param name="worksheetNo" select="$worksheetNo"/>
+ </xsl:call-template>
+ <xsl:call-template name="create-columns">
+ <xsl:with-param name="columnCount" select="$columnCount"/>
+ <xsl:with-param name="currentColumn" select="$currentColumn"/>
+ <xsl:with-param name="finishedColumns" select="$finishedColumns + 1"/>
+ <xsl:with-param name="worksheetNo" select="$worksheetNo"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="$currentColumn = $columnCount">
+ <!-- Note: name test document for this case and refactor the template -->
+ <xsl:if test="x:PageBreaks/x:ColBreaks/x:ColBreak/x:Column &gt; $finishedColumns">
+ <xsl:call-template name="get-column-beyond-last">
+ <xsl:with-param name="index-value" select="$finishedColumns"/>
+ <xsl:with-param name="worksheetNo" select="$worksheetNo"/>
+ </xsl:call-template>
+ </xsl:if>
+ <!--Note: Test Scenario for this case: generates some special tags for whole row style
+ <xsl:if test="(./ss:Table[@ss:StyleID] or ./ss:Table/ss:Row[@ss:StyleID]) and (256 - $finishedColumns &gt; 0)">
+ <xsl:element name="table:table-column">
+ <xsl:attribute name="table:default-cell-style-name"><xsl:choose><xsl:when test="./ss:Table[@ss:StyleID]"><xsl:value-of select="./ss:Table/@ss:StyleID" /></xsl:when><xsl:otherwise><xsl:value-of select="'Default'" /></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="table:style-name"><xsl:value-of select="'co1'" /></xsl:attribute>
+ <xsl:attribute name="table:number-columns-repeated"><xsl:value-of select="256 - $finishedColumns" /></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ -->
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="create-default-column">
+ <xsl:param name="currentColumn"/>
+ <xsl:param name="currentColumnNode"/>
+ <xsl:param name="worksheetNo"/>
+ <xsl:param name="nextColumnNo"/>
+ <xsl:element name="table:table-column">
+ <xsl:attribute name="table:default-cell-style-name">
+ <xsl:call-template name="get-default-cell-style">
+ <xsl:with-param name="currentColumnNode" select="$currentColumnNode"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <!-- <xsl:attribute name="table:default-cell-style-name"><xsl:value-of select="$nextColumnNo - $currentColumn"/></xsl:attribute> -->
+ <xsl:choose>
+ <xsl:when test="key('ColBreak', $currentColumn)">
+ <xsl:attribute name="table:style-name">
+ <xsl:value-of select="concat('cob',$worksheetNo)"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="table:style-name">
+ <xsl:value-of select="concat('co',$worksheetNo)"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="create-rows">
+ <xsl:param name="condition-pos-str"/>
+ <xsl:apply-templates select="ss:Table/ss:Row[1]" mode="create-rows">
+ <xsl:with-param name="worksheetNo" select="count(preceding-sibling::ss:Worksheet)+1"/>
+ <xsl:with-param name="rowNodeCount" select="count(ss:Table/ss:Row)"/>
+ <xsl:with-param name="rowNodeIndex" select="1"/>
+ <xsl:with-param name="expandedRowCount">
+ <xsl:call-template name="get-expanded-row-count"/>
+ </xsl:with-param>
+ <xsl:with-param name="expandedRowCountIndex" select="1"/>
+ <xsl:with-param name="expandedColumnCount">
+ <xsl:call-template name="get-expanded-column-count"/>
+ </xsl:with-param>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ </xsl:apply-templates>
+ </xsl:template>
+ <xsl:template match="ss:Row" mode="create-rows">
+ <xsl:param name="worksheetNo"/>
+ <xsl:param name="rowNodeCount"/>
+ <xsl:param name="rowNodeIndex" select="1"/>
+ <xsl:param name="expandedRowCount"/>
+ <xsl:param name="expandedRowCountIndex" select="1"/>
+ <xsl:param name="expandedColumnCount"/>
+ <xsl:param name="condition-pos-str"/>
+ <xsl:variable name="currentRowNo">
+ <xsl:choose>
+ <xsl:when test="@ss:Index">
+ <xsl:value-of select="@ss:Index"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$expandedRowCountIndex"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="@ss:Index - $expandedRowCountIndex &gt; 0">
+ <!-- create the precding missing rows -->
+ <xsl:element name="table:table-row">
+ <!-- fill the preceding gap with rows without a cell -->
+ <xsl:attribute name="table:number-rows-repeated">
+ <xsl:value-of select="@ss:Index - $expandedRowCountIndex"/>
+ </xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="$expandedColumnCount != 0">
+ <table:table-cell table:number-columns-repeated="{$expandedColumnCount}"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- OASIS XML row can not be empty -->
+ <table:table-cell table:number-columns-repeated="256"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="table:table-row">
+ <xsl:attribute name="table:style-name">
+ <xsl:choose>
+ <xsl:when test="@ss:StyleID">
+ <xsl:value-of select="concat('ro',$worksheetNo, '-',$rowNodeIndex,'-', @ss:StyleID)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat('ro',$worksheetNo,'-',$rowNodeIndex)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:if test="@ss:Hidden = '1'">
+ <xsl:attribute name="table:visibility">collapse</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@ss:Span">
+ <xsl:attribute name="table:number-rows-repeated">
+ <xsl:value-of select="@ss:Span + 1"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <!-- Excel row without content -->
+ <xsl:when test="not(*)">
+ <!-- OASIS OpenDocument Format does not allow rows without a cell -->
+ <xsl:choose>
+ <xsl:when test="$expandedColumnCount != 0">
+ <table:table-cell table:number-columns-repeated="{$expandedColumnCount}"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- OASIS XML row can not be empty -->
+ <table:table-cell table:number-columns-repeated="256"/>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="create-cells">
+ <xsl:with-param name="row-pos" select="$currentRowNo"/>
+ <xsl:with-param name="expandedColumnCount" select="$expandedColumnCount"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <!-- columns are painting over the expanded RowCount -->
+ <xsl:choose>
+ <xsl:when test="count(following-sibling::ss:Row) != 0">
+ <xsl:apply-templates select="following-sibling::ss:Row[1]" mode="create-rows">
+ <xsl:with-param name="worksheetNo" select="$worksheetNo"/>
+ <xsl:with-param name="rowNodeCount" select="$rowNodeCount"/>
+ <xsl:with-param name="rowNodeIndex" select="$rowNodeIndex + 1"/>
+ <xsl:with-param name="expandedRowCount" select="$expandedRowCount"/>
+ <xsl:with-param name="expandedRowCountIndex">
+ <xsl:choose>
+ <xsl:when test="@ss:Index and @ss:Span">
+ <xsl:value-of select="@ss:Index + @ss:Span + 1"/>
+ </xsl:when>
+ <xsl:when test="@ss:Index">
+ <xsl:value-of select="@ss:Index + 1"/>
+ </xsl:when>
+ <xsl:when test="@ss:Span">
+ <xsl:value-of select="$expandedRowCountIndex + @ss:Span + 1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$expandedRowCountIndex + 1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="expandedColumnCount" select="$expandedColumnCount"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:when test="$currentRowNo &lt; 65536">
+ <xsl:element name="table:table-row">
+ <!-- fill the preceding gap with rows without a cell -->
+ <xsl:attribute name="table:number-rows-repeated">
+ <xsl:value-of select="65536 - $currentRowNo"/>
+ </xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="$expandedColumnCount != 0">
+ <table:table-cell table:number-columns-repeated="{$expandedColumnCount}"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- OASIS XML row can not be empty -->
+ <table:table-cell table:number-columns-repeated="256"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-expanded-column-count">
+ <xsl:choose>
+ <xsl:when test="ss:Table/@ss:ExpandedColumnCount">
+ <xsl:value-of select="ss:Table/@ss:ExpandedColumnCount"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="ss:Table/ss:Column/@ss:Span">
+ <!-- No absolute column number (ss:ExpandedColumnCount) is add the nodes and spanned columns -->
+ <xsl:variable name="spannedColumns">
+ <xsl:call-template name="count-spanned-columns">
+ <xsl:with-param name="columns" select="ss:Table/ss:Column[@ss:Span]"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="count(ss:Table/ss:Column) + number($spannedColumns)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- No absolute column number (ss:ExpandedColumnCount) is add the nodes -->
+ <xsl:value-of select="count(ss:Table/ss:Column)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-expanded-row-count">
+ <xsl:choose>
+ <xsl:when test="ss:Table/@ss:ExpandedRowCount">
+ <xsl:value-of select="ss:Table/@ss:ExpandedRowCount"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="ss:Table/ss:Row/@ss:Index and not(ss:Table/ss:Row/@ss:Span)">
+ <xsl:variable name="lastIndexedRow" select="ss:Table/ss:Row[@ss:Index][last()]"/>
+ <xsl:value-of select="number($lastIndexedRow/@ss:Index) + count($lastIndexedRow/following-sibling::ss:Row)"/>
+ </xsl:when>
+ <xsl:when test="ss:Table/ss:Row/@ss:Index and ss:Table/ss:Row/@ss:Span">
+ <xsl:variable name="lastIndexedRow" select="ss:Table/ss:Row[@ss:Index][last()]"/>
+ <xsl:variable name="spannedRows">
+ <xsl:call-template name="count-spanned-rows">
+ <xsl:with-param name="rows" select="$lastIndexedRow/following-sibling::ss:Row[@ss:Span]"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="number($lastIndexedRow/@ss:Index) + count($lastIndexedRow/following-sibling::ss:Row) + number($spannedRows)"/>
+ </xsl:when>
+ <xsl:when test="not(ss:Table/ss:Row/@ss:Index) and ss:Table/ss:Row/@ss:Span">
+ <xsl:variable name="spannedRows">
+ <xsl:call-template name="count-spanned-rows">
+ <xsl:with-param name="rows" select="ss:Table/ss:Rows[@ss:Span]"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="count(ss:Table/ss:Row + number($spannedRows))"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="count(ss:Table/ss:Row)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="count-spanned-rows">
+ <xsl:param name="expandedRowCount" select="0"/>
+ <xsl:param name="rows"/>
+ <xsl:param name="rowsCount" select="count($rows)"/>
+ <xsl:param name="rowIndex" select="1"/>
+ <xsl:choose>
+ <xsl:when test="$rowIndex &lt;= $rowsCount">
+ <xsl:call-template name="count-spanned-rows">
+ <xsl:with-param name="rows" select="$rows"/>
+ <xsl:with-param name="rowsCount" select="$rowsCount"/>
+ <xsl:with-param name="rowIndex" select="$rowIndex + 1"/>
+ <xsl:with-param name="expandedRowCount" select="$expandedRowCount + $rows[$rowIndex]/@ss:Span"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$expandedRowCount"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-default-cell-style">
+ <xsl:param name="currentColumnNode"/>
+ <xsl:choose>
+ <xsl:when test="$currentColumnNode">
+ <xsl:choose>
+ <xsl:when test="$currentColumnNode/@ss:StyleID">
+ <xsl:value-of select="$currentColumnNode/@ss:StyleID"/>
+ </xsl:when>
+ <xsl:otherwise>Default</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="./ss:Table[@ss:StyleID]">
+ <xsl:value-of select="./ss:Table/@ss:StyleID"/>
+ </xsl:when>
+ <xsl:otherwise>Default</xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-row-beyond-last">
+ <!-- dealing the RowBreak after last row by recursion -->
+ <xsl:param name="index-value"/>
+ <xsl:param name="worksheetNo"/>
+ <xsl:param name="condition-pos-str"/>
+ <xsl:param name="end-pos"/>
+ <xsl:param name="total-col"/>
+ <xsl:variable name="current" select="concat('R',$index-value)"/>
+ <xsl:element name="table:table-row">
+ <xsl:choose>
+ <xsl:when test="./x:PageBreaks/x:RowBreaks/x:RowBreak/x:Row = ($index-value - 1)">
+ <xsl:attribute name="table:style-name">
+ <xsl:value-of select="concat('rob',$worksheetNo)"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="table:style-name">
+ <xsl:value-of select="concat('ro',$worksheetNo)"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <!-- Note: 2 be refactored
+ <xsl:when test="./ss:Table/ss:Column[@ss:StyleID] or ./ss:Table[@ss:StyleID]">
+ <xsl:if test="256 - count(ss:Table/ss:Column) &gt; 0">
+ <table:table-cell table:number-columns-repeated="{256 - count(ss:Table/ss:Column)}" />
+ </xsl:if>
+ </xsl:when>-->
+ <xsl:when test="contains($condition-pos-str,$current)">
+ <xsl:call-template name="create-spanning-cells">
+ <xsl:with-param name="row-pos" select="$index-value"/>
+ <xsl:with-param name="c-start" select="1"/>
+ <xsl:with-param name="c-end" select="$total-col"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- OASIS XML does not allow rows without a cell -->
+ <table:table-cell/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:if test="$index-value &lt; ($end-pos + 1)">
+ <xsl:call-template name="get-row-beyond-last">
+ <xsl:with-param name="index-value" select="$index-value + 1"/>
+ <xsl:with-param name="worksheetNo" select="$worksheetNo"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="end-pos" select="$end-pos"/>
+ <xsl:with-param name="total-col" select="$total-col"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="break-row-beyond-max">
+ <!-- returns the max position of the row from condition-pos-str -->
+ <xsl:param name="pos"/>
+ <xsl:param name="last-value"/>
+ <xsl:param name="count-value"/>
+ <xsl:variable name="pre-value" select="./x:PageBreaks/x:RowBreaks/x:RowBreak[position() = $pos]/x:Row"/>
+ <xsl:variable name="end-value">
+ <xsl:choose>
+ <xsl:when test="$last-value &lt; $pre-value">
+ <xsl:value-of select="$pre-value"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$last-value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$pos &lt; $count-value">
+ <xsl:call-template name="break-row-beyond-max">
+ <xsl:with-param name="pos" select="$pos + 1"/>
+ <xsl:with-param name="last-value" select="$end-value"/>
+ <xsl:with-param name="count-value" select="$count-value"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$end-value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-column-beyond-last">
+ <!-- dealing the ColBreak after last column by recursion -->
+ <xsl:param name="index-value"/>
+ <xsl:param name="worksheetNo"/>
+ <xsl:for-each select="./x:PageBreaks/x:ColBreaks/x:ColBreak">
+ <xsl:variable name="each-column-value" select="./x:Column"/>
+ <xsl:choose>
+ <xsl:when test="$each-column-value + 1 &gt; $index-value">
+ <xsl:variable name="number-repeated">
+ <xsl:choose>
+ <xsl:when test="preceding-sibling::x:ColBreak[position()=count(.)]/x:Column + 1 = $index-value">
+ <xsl:value-of select="$each-column-value - preceding-sibling::x:ColBreak[position()=count(.)]/x:Column - 1"/>
+ </xsl:when>
+ <xsl:when test="preceding-sibling::x:ColBreak[position()=count(.)]/x:Column + 1 &gt; $index-value">
+ <xsl:value-of select="$each-column-value - preceding-sibling::x:ColBreak[position()=count(.)]/x:Column - 1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$each-column-value - $index-value + 1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="$number-repeated &gt; 0">
+ <xsl:element name="table:table-column">
+ <xsl:attribute name="table:style-name">
+ <xsl:value-of select="'co1'"/>
+ </xsl:attribute>
+ <xsl:attribute name="table:number-columns-repeated">
+ <xsl:value-of select="$number-repeated"/>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="table:table-column">
+ <xsl:if test="./../../../ss:Table[@ss:StyleID]">
+ <xsl:attribute name="table:default-cell-style-name">
+ <xsl:value-of select="./ss:Table/@ss:StyleID"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="table:style-name">
+ <xsl:value-of select="concat('cob',$worksheetNo)"/>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="$each-column-value + 1 = $index-value">
+ <xsl:element name="table:table-column">
+ <xsl:if test="./../../../ss:Table[@ss:StyleID]">
+ <xsl:attribute name="table:default-cell-style-name">
+ <xsl:value-of select="./../../../ss:Table/@ss:StyleID"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="table:style-name">
+ <xsl:value-of select="concat('cob',$worksheetNo)"/>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="create-spanning-cells">
+ <!-- judge the position of the Cell in the condition-pos-str -->
+ <xsl:param name="row-pos"/>
+ <xsl:param name="c-start"/>
+ <xsl:param name="c-end"/>
+ <xsl:param name="condition-pos-str"/>
+
+ <xsl:variable name="current" select="concat('R',$row-pos,'C',$c-start,',')"/>
+ <xsl:variable name="style-name">
+ <xsl:choose>
+ <xsl:when test="contains($condition-pos-str,$current)">
+ <xsl:variable name="temp-str">
+ <xsl:call-template name="condition-str">
+ <xsl:with-param name="param-str" select="substring-before($condition-pos-str,$current)"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="starts-with($temp-str, 'c')">
+ <xsl:value-of select="concat('ce', substring-after($temp-str, 'c'))"/>
+ </xsl:when>
+ <xsl:when test="starts-with($temp-str, 'v')">
+ <xsl:value-of select="concat('val', substring-after($temp-str, 'v'))"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- as for the spanned cells no style is taken.. -->
+ <xsl:choose>
+ <!-- inherit style from parent row style-->
+ <xsl:when test="../@ss:StyleID">
+ <xsl:value-of select="../@ss:StyleID"/>
+ </xsl:when>
+ <!-- if no correspondent column style exisit.. -->
+ <!-- inherit style from parent table style -->
+ <xsl:when test="../../@ss:StyleID">
+ <!-- function to give in col-pos and get back column style -->
+ <xsl:variable name="relatedColumnStyle">
+ <xsl:call-template name="get-related-column-style">
+ <!-- the given position of the cell in the table, a column style is searched -->
+ <xsl:with-param name="calculatedCellPosition" select="$c-start" />
+ <!-- all columns in XML -->
+ <xsl:with-param name="columnXMLNodes" select="../../ss:Column"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="$relatedColumnStyle = ''">
+ <xsl:value-of select="../../@ss:StyleID"/>
+ </xsl:if>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:element name="table:table-cell">
+ <xsl:if test="not($style-name = '')">
+ <xsl:choose>
+ <xsl:when test="starts-with($style-name, 'val')">
+ <xsl:attribute name="table:content-validation-name">
+ <xsl:value-of select="$style-name"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="starts-with($style-name, 'ce')">
+ <xsl:attribute name="table:style-name">
+ <xsl:value-of select="$style-name"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="table:style-name">
+ <xsl:value-of select="$style-name"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="$c-start &lt; $c-end">
+ <xsl:attribute name="table:number-columns-repeated">
+ <xsl:value-of select="$c-end - $c-start + 1"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="condition-row-col-pos-max">
+ <!-- returns the max position of the column or row from condition-pos-str -->
+ <xsl:param name="condition-pos-str"/>
+ <xsl:param name="last-value"/>
+ <xsl:param name="div-value"/>
+ <xsl:variable name="pre-value">
+ <xsl:choose>
+ <xsl:when test="$div-value = 'R'">
+ <xsl:value-of select="substring-before(substring-after($condition-pos-str,$div-value),'C')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-before(substring-after($condition-pos-str,$div-value),',')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="end-value">
+ <xsl:choose>
+ <xsl:when test="$last-value &lt; $pre-value">
+ <xsl:value-of select="$pre-value"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$last-value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="contains($condition-pos-str,$div-value)">
+ <xsl:call-template name="condition-row-col-pos-max">
+ <xsl:with-param name="condition-pos-str" select="substring-after($condition-pos-str,$div-value)"/>
+ <xsl:with-param name="last-value" select="$end-value"/>
+ <xsl:with-param name="div-value" select="$div-value"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$end-value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="condition-str">
+ <!-- returns the string of style name of condition-pos-str -->
+ <xsl:param name="param-str"/>
+ <xsl:choose>
+ <xsl:when test="contains($param-str,'(')">
+ <xsl:call-template name="condition-str">
+ <xsl:with-param name="param-str" select="substring-after($param-str,'(')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-before($param-str,':')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:key name="Style" match="/ss:Workbook/ss:Styles/ss:Style" use="@ss:ID"/>
+ <xsl:template name="create-cells">
+ <xsl:param name="row-pos"/>
+ <xsl:param name="expandedColumnCount"/>
+ <xsl:param name="condition-pos-str"/>
+ <xsl:choose>
+ <xsl:when test="ss:Cell">
+ <xsl:apply-templates select="ss:Cell[1]" mode="selected">
+ <xsl:with-param name="row-pos" select="$row-pos"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="col-pos-max" select="$expandedColumnCount"/>
+ <!--
+ <xsl:call-template name="condition-row-col-pos-max">
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str" />
+ <xsl:with-param name="last-value" select="0" />
+ <xsl:with-param name="div-value" select="'C'" />
+ </xsl:call-template>
+ </xsl:with-param> -->
+ <xsl:with-param name="col-pos-written" select="0"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="current" select="concat('R',$row-pos,'C')"/>
+ <xsl:choose>
+ <xsl:when test="contains($condition-pos-str,$current)">
+ <xsl:call-template name="create-spanning-cells">
+ <xsl:with-param name="row-pos" select="$row-pos"/>
+ <xsl:with-param name="c-start" select="1"/>
+ <xsl:with-param name="c-end">
+ <xsl:call-template name="condition-row-col-pos-max">
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="last-value" select="0"/>
+ <xsl:with-param name="div-value" select="'C'"/>
+ </xsl:call-template>
+ </xsl:with-param>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="col-pos" select="1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- OASIS XML does not allow an empty row -->
+ <xsl:choose>
+ <xsl:when test="$expandedColumnCount != 0">
+ <table:table-cell table:number-columns-repeated="{$expandedColumnCount}"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- OASIS XML row can not be empty -->
+ <table:table-cell table:number-columns-repeated="256"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="ss:Cell" name="ss:Cell" mode="selected">
+ <!-- Contains the max position of the column or row from the concatenation from
+ x:ConditionalFormatting
+ and
+ x:DataValidation -->
+ <xsl:param name="condition-pos-str"/>
+ <xsl:param name="col-pos-max"/>
+ <xsl:param name="col-pos-written" select="0"/>
+ <xsl:param name="col-pos-current" select="0"/>
+ <xsl:param name="row-pos"/>
+ <xsl:param name="col-repeated" select="1"/>
+
+ <!-- The column position of the cell (might jumped by ss:Index) -->
+ <xsl:variable name="col-pos">
+ <xsl:choose>
+ <xsl:when test="@ss:Index">
+ <xsl:choose>
+ <xsl:when test="@ss:MergeAcross">
+ <xsl:value-of select="@ss:MergeAcross + @ss:Index"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="@ss:Index"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="@ss:MergeAcross">
+ <xsl:value-of select="1 + @ss:MergeAcross + $col-pos-current"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="1 + $col-pos-current"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="nextCell" select="following-sibling::ss:Cell[1]"/>
+ <!-- Multiple empty cells with the same or no style will be moved to one cell with a 'table:number-columns-repeated' attribute -->
+ <xsl:variable name="cell-is-repeatable" select="
+ not(current()/*)
+ and
+ not(current()/text())
+ and
+ (
+ not($nextCell)
+ and $col-pos &gt; $col-pos-written + 1
+ or
+ (
+ $nextCell
+ and
+ not($nextCell/*)
+ and
+ not($nextCell/text())
+ and
+ (
+ (current()/@ss:StyleID = $nextCell/@ss:StyleID)
+ or
+ (not(current()/@ss:StyleID) and not($nextCell/@ss:StyleID))
+ )
+ and
+ (
+ not($nextCell/@ss:Index)
+ or
+ ($nextCell/@ss:Index = $col-pos + 1)
+ )
+ )
+ ) "/>
+ <xsl:choose>
+ <!-- Scenario: The missing cells scipped by using the ss:Index attribute will be added -->
+ <xsl:when test="@ss:Index and @ss:Index &gt; $col-pos-written + 1">
+ <!-- In Open Document nothing comparable to Index exists,
+ the missing cells might have to be created, if they had content as only style will be repeated-->
+ <xsl:call-template name="create-spanning-cells">
+ <xsl:with-param name="row-pos" select="$row-pos"/>
+ <xsl:with-param name="c-start" select="$col-pos-current + 1"/>
+ <xsl:with-param name="c-end" select="@ss:Index - 1"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ </xsl:call-template>
+ <xsl:call-template name="ss:Cell">
+ <xsl:with-param name="row-pos" select="$row-pos"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="col-pos-max" select="$col-pos-max"/>
+ <xsl:with-param name="col-pos-written" select="@ss:Index - 1"/>
+ <xsl:with-param name="col-pos-current" select="$col-pos"/>
+ <xsl:with-param name="col-repeated" select="$col-repeated"/>
+ </xsl:call-template>
+ </xsl:when>
+ <!-- Scenario: A sequence of cells can be put together as one cell -->
+ <xsl:when test="$cell-is-repeatable">
+ <xsl:apply-templates select="$nextCell" mode="selected">
+ <xsl:with-param name="row-pos" select="$row-pos"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="col-pos-max" select="$col-pos-max"/>
+ <xsl:with-param name="col-pos-written" select="$col-pos-written"/>
+ <xsl:with-param name="col-pos-current" select="$col-pos"/>
+ <xsl:with-param name="col-repeated" select="$col-repeated"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- if the cell wasn't repeated yet, created first -->
+ <xsl:if test="$col-repeated = 1">
+ <xsl:element name="table:table-cell">
+ <!-- in case the cell has an Index and is repeatable (s.above) and therefore has not been repeated earlier -->
+ <xsl:choose>
+ <xsl:when test="@ss:MergeAcross">
+ <xsl:if test="$col-pos - @ss:MergeAcross &gt; $col-pos-written + 1">
+ <xsl:attribute name="table:number-columns-repeated">
+ <xsl:value-of select="$col-pos - $col-pos-written"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="$col-pos &gt; $col-pos-written + 1">
+ <xsl:attribute name="table:number-columns-repeated">
+ <xsl:value-of select="$col-pos - $col-pos-written"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:call-template name="create-table-cell-attributes">
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="col-pos-max" select="$col-pos-max"/>
+ <xsl:with-param name="col-pos" select="$col-pos"/>
+ <xsl:with-param name="row-pos" select="$row-pos"/>
+ </xsl:call-template>
+ <xsl:call-template name="create-table-cell-content">
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="col-pos-max" select="$col-pos-max"/>
+ <xsl:with-param name="col-pos" select="$col-pos"/>
+ <xsl:with-param name="row-pos" select="$row-pos"/>
+ </xsl:call-template>
+ </xsl:element>
+ <!-- ss:MergeAcross (column spanned) indicates a covered table-cell in Open Document XML-->
+ <xsl:if test="@ss:MergeAcross">
+ <xsl:element name="table:covered-table-cell">
+ <xsl:if test="@ss:MergeAcross &gt; 1">
+ <xsl:attribute name="table:number-columns-repeated">
+ <xsl:value-of select="@ss:MergeAcross"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ </xsl:if>
+ <xsl:choose>
+ <!-- the following block is not used, if the cell had been repeated earlier -->
+ <xsl:when test="$nextCell and not($cell-is-repeatable and $col-repeated = 1)">
+ <xsl:choose>
+ <!-- After cells can not longer be repeated write out the attribute -->
+ <xsl:when test="not($cell-is-repeatable) and $col-repeated > 1">
+ <xsl:attribute name="table:number-columns-repeated">
+ <xsl:value-of select="$col-repeated"/>
+ </xsl:attribute>
+ </xsl:when>
+ <!-- At the end of the row -->
+ <xsl:when test="not($nextCell)">
+ <xsl:if test="../../../x:ConditionalFormatting">
+ <!-- at the last position of the Cell tag,inspecting the following cell before condition-row-col-pos-max -->
+ <xsl:call-template name="create-spanning-cells">
+ <xsl:with-param name="row-pos" select="$row-pos"/>
+ <xsl:with-param name="c-start" select="$col-pos"/>
+ <xsl:with-param name="c-end" select="$col-pos-max"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:when>
+ <!-- If the cells can not be repeated (default) -->
+ <xsl:when test="not($cell-is-repeatable)">
+ <!-- Traverse the following Cell -->
+ <xsl:apply-templates select="$nextCell" mode="selected">
+ <xsl:with-param name="row-pos" select="$row-pos"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="col-pos-max" select="$col-pos-max"/>
+ <xsl:with-param name="col-pos-written" select="$col-pos"/>
+ <xsl:with-param name="col-pos-current" select="$col-pos"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <!-- Go on with started repetition -->
+ <xsl:otherwise>
+ <xsl:apply-templates select="$nextCell" mode="selected">
+ <xsl:with-param name="row-pos" select="$row-pos"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="col-pos-max" select="$col-pos-max"/>
+ <xsl:with-param name="col-pos-written" select="$col-pos"/>
+ <xsl:with-param name="col-pos-current" select="$col-pos"/>
+ <xsl:with-param name="col-repeated" select="$col-repeated + 1"/>
+ </xsl:apply-templates>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="not($nextCell)">
+ <xsl:choose>
+ <xsl:when test="$col-repeated = 1 and ($col-pos &lt; $col-pos-max)">
+ <table:table-cell table:number-columns-repeated="{$col-pos-max - $col-pos}"/>
+ </xsl:when>
+ <xsl:when test="$col-repeated &gt; 1">
+ <xsl:attribute name="table:number-columns-repeated">
+ <xsl:value-of select="$col-repeated"/>
+ </xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="$nextCell" mode="skip">
+ <xsl:with-param name="row-pos" select="$row-pos"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="col-pos-max" select="$col-pos-max"/>
+ <xsl:with-param name="col-pos-written" select="$col-pos"/>
+ </xsl:apply-templates>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="ss:Cell" mode="skip">
+ <xsl:param name="condition-pos-str"/>
+ <xsl:param name="col-pos-max"/>
+ <xsl:param name="col-pos-written"/>
+ <xsl:param name="row-pos"/>
+
+ <xsl:variable name="nextCell" select="following-sibling::ss:Cell[1]"/>
+ <!-- Multiple empty cells with the same style will be moved to one cell with a 'table:number-columns-repeated' attribute -->
+ <xsl:variable name="cell-is-repeatable" select="not($nextCell/*) and not($nextCell/text()) and ((current()/@ss:StyleID = $nextCell/@ss:StyleID) or (not(current()/@ss:StyleID) and not($nextCell/@ss:StyleID))) and not($nextCell/@ss:Index)"/>
+ <xsl:choose>
+ <xsl:when test="$cell-is-repeatable">
+ <xsl:apply-templates select="$nextCell" mode="skip">
+ <xsl:with-param name="row-pos" select="$row-pos"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="col-pos-max" select="$col-pos-max"/>
+ <xsl:with-param name="col-pos-written" select="$col-pos-written + 1"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="$nextCell" mode="selected">
+ <xsl:with-param name="row-pos" select="$row-pos"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="col-pos-max" select="$col-pos-max"/>
+ <xsl:with-param name="col-pos-written" select="$col-pos-written + 1"/>
+ <xsl:with-param name="col-pos-current" select="$col-pos-written + 1"/>
+ </xsl:apply-templates>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="create-table-cell-attributes">
+ <xsl:param name="condition-pos-str"/>
+ <xsl:param name="col-pos-max"/>
+ <xsl:param name="col-pos"/>
+ <xsl:param name="row-pos"/>
+
+ <xsl:choose>
+ <xsl:when test="$condition-pos-str">
+ <xsl:call-template name="get-condition-dependent-cell-attributes">
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="current-pos-str" select="concat('R',$row-pos,'C',$col-pos,',')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="@ss:StyleID">
+ <xsl:attribute name="table:style-name">
+ <xsl:value-of select="@ss:StyleID"/>
+ </xsl:attribute>
+ </xsl:when>
+ <!-- inherit style from parent row style-->
+ <xsl:when test="../@ss:StyleID">
+ <xsl:attribute name="table:style-name">
+ <xsl:value-of select="../@ss:StyleID"/>
+ </xsl:attribute>
+ </xsl:when>
+ <!-- if no correspondent column style exisit.. -->
+ <!-- inherit style from parent table style -->
+ <xsl:when test="../../@ss:StyleID">
+ <!-- function to give in col-pos and get back column style -->
+ <xsl:variable name="relatedColumnStyle">
+ <xsl:call-template name="get-related-column-style">
+ <!-- the given position of the cell in the table, a column style is searched -->
+ <xsl:with-param name="calculatedCellPosition" select="$col-pos" />
+ <!-- all columns in XML -->
+ <xsl:with-param name="columnXMLNodes" select="../../ss:Column"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="$relatedColumnStyle = ''">
+ <xsl:attribute name="table:style-name">
+ <xsl:value-of select="../../@ss:StyleID"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="@ss:MergeAcross or @ss:MergeDown">
+ <xsl:choose>
+ <xsl:when test="@ss:MergeAcross">
+ <xsl:attribute name="table:number-columns-spanned">
+ <xsl:value-of select="@ss:MergeAcross + 1"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="table:number-columns-spanned">1</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="@ss:MergeDown">
+ <xsl:attribute name="table:number-rows-spanned">
+ <xsl:value-of select="@ss:MergeDown+1"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="table:number-rows-spanned">1</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="@ss:Formula">
+ <!-- formula translation from Excel to Calc -->
+ <xsl:variable name="calc-formula">
+ <xsl:call-template name="translate-expression">
+ <xsl:with-param name="cell-row-pos" select="$row-pos"/>
+ <xsl:with-param name="cell-column-pos" select="$col-pos"/>
+ <xsl:with-param name="expression" select="@ss:Formula"/>
+ <xsl:with-param name="return-value" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="table:formula">
+ <xsl:value-of select="$calc-formula"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="ss:Data">
+ <xsl:variable name="data-format">
+ <xsl:value-of select="key('Style', @ss:StyleID)/ss:NumberFormat/@ss:Format"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="ss:Data/@ss:Type = 'Number'">
+ <xsl:choose>
+ <xsl:when test="$data-format = 'Percent' or contains( $data-format, '%')">
+ <xsl:attribute name="office:value-type">percentage</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="contains(key('Style', @ss:StyleID)/ss:NumberFormat/@ss:Format, 'Currency')">
+ <xsl:attribute name="office:value-type">currency</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="office:value-type">float</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="office:value">
+ <xsl:value-of select="ss:Data"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="ss:Data/@ss:Type = 'DateTime'">
+ <xsl:choose>
+ <xsl:when test="(contains( $data-format, 'Date') or contains($data-format,'y') or contains($data-format,'g') or contains($data-format,'d') or contains($data-format,'e') or starts-with( substring( ss:Data, 11), 'T00:00:00.000' ) ) and (not (contains( $data-format, 'Time') ) )">
+ <xsl:attribute name="office:value-type">date</xsl:attribute>
+ <xsl:attribute name="office:date-value">
+ <xsl:value-of select="substring-before(ss:Data, 'T')"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="office:value-type">time</xsl:attribute>
+ <xsl:attribute name="office:time-value">
+ <xsl:value-of select="concat('P',substring(ss:Data, 11, 3), 'H', substring(ss:Data, 15, 2), 'M', substring(ss:Data, 18,2), 'S')"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="ss:Data/@ss:Type = 'Boolean'">
+ <xsl:attribute name="office:value-type">boolean</xsl:attribute>
+ <xsl:attribute name="office:boolean-value">
+ <xsl:choose>
+ <xsl:when test="ss:Data = '1'">true</xsl:when>
+ <xsl:otherwise>false</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="ss:Data/@ss:Type = 'String'">
+ <xsl:attribute name="office:value-type">string</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="get-related-column-style">
+ <!-- the given position of the cell in the table, a column style is searched -->
+ <xsl:param name="calculatedCellPosition" />
+ <!-- the current position of the column as XML node -->
+ <xsl:param name="columnXMLPosition" select="1" />
+ <!-- all columns in XML -->
+ <xsl:param name="columnXMLNodes" />
+ <!-- the ending column position of the earlier column style in the table -->
+ <xsl:param name="earlierCalculatedColumnEnd" select="0" />
+
+ <!-- the current column as XML node -->
+ <xsl:variable name="columnXMLNode" select="$columnXMLNodes[1]" />
+ <xsl:if test="$columnXMLNodes and count($columnXMLNodes) > 0">
+ <!-- the starting column position of the style in the table -->
+ <xsl:variable name="calculatedColumnStart">
+ <!-- if ss:Index exists, this is the start of the column -->
+ <xsl:choose>
+ <xsl:when test="$columnXMLNode/@ss:Index">
+ <xsl:value-of select="$columnXMLNode/@ss:Index" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$earlierCalculatedColumnEnd + 1" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <!-- the ending column position of the style in the table -->
+ <xsl:variable name="calculatedColumnEnd">
+ <xsl:choose>
+ <xsl:when test="$columnXMLNode/@ss:Span">
+ <xsl:value-of select="$calculatedColumnStart + $columnXMLNode/@ss:Span" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$calculatedColumnStart" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$calculatedColumnStart &gt;= $calculatedCellPosition and $calculatedCellPosition &lt;= $calculatedColumnEnd">
+ <xsl:value-of select="$columnXMLNode/@ss:StyleID"/>
+ </xsl:when>
+ <xsl:when test="$calculatedColumnEnd &lt;= $calculatedCellPosition">
+ <xsl:call-template name="get-related-column-style">
+ <!-- the given position of the cell in the table, a column style is searched -->
+ <xsl:with-param name="calculatedCellPosition" select="$calculatedCellPosition" />
+ <!-- all columns in XML -->
+ <xsl:with-param name="columnXMLNodes" select="$columnXMLNodes[position() != 1]"/>
+ <!-- the ending column position of the style in the table -->
+ <xsl:with-param name="earlierCalculatedColumnEnd" select="$calculatedColumnEnd" />
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template name="create-table-cell-content">
+ <xsl:param name="condition-pos-str"/>
+ <xsl:param name="col-pos-max"/>
+ <xsl:param name="col-pos"/>
+ <xsl:param name="row-pos"/>
+ <xsl:apply-templates select="ss:Comment" mode="body"/>
+ <xsl:if test="ss:Data">
+ <text:p>
+ <xsl:call-template name="create-data-content">
+ <xsl:with-param name="style-id" select="@ss:StyleID"/>
+ </xsl:call-template>
+ </text:p>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="create-data-content">
+ <xsl:param name="style-id" select="@ss:StyleID"/>
+ <!-- collect every HTML 3.2 children, which are not empty -->
+ <xsl:variable name="html-children" select="ss:Data/descendant-or-self::*[namespace-uri()='http://www.w3.org/TR/REC-html40'][string-length(text()) != 0]"/>
+ <xsl:choose>
+ <xsl:when test="$html-children and $html-children != ''">
+ <xsl:for-each select="$html-children">
+ <text:span text:style-name="{concat($style-id, 'T', count(preceding::ss:Data[child::html:*]), '_', position())}">
+ <xsl:copy-of select="text()"/>
+ </text:span>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:when test="contains(key('Style', $style-id)/ss:Font/@ss:VerticalAlign, 'script')">
+ <text:span text:style-name="{concat($style-id, 'T0')}">
+ <xsl:choose>
+ <xsl:when test="@ss:HRef">
+ <text:a xlink:href="{@ss:HRef}">
+ <xsl:value-of select="ss:Data"/>
+ </text:a>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="ss:Data"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </text:span>
+ </xsl:when>
+ <xsl:when test="@ss:HRef">
+ <text:a xlink:href="{@ss:HRef}">
+ <xsl:value-of select="ss:Data"/>
+ </text:a>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="ss:Data"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-condition-dependent-cell-attributes">
+ <xsl:param name="condition-pos-str"/>
+ <xsl:param name="current-pos-str"/>
+ <xsl:variable name="temp-str">
+ <xsl:call-template name="condition-str">
+ <xsl:with-param name="param-str" select="substring-before($condition-pos-str,$current-pos-str)"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="style-name">
+ <xsl:choose>
+ <xsl:when test="contains($condition-pos-str, $current-pos-str) and starts-with($temp-str, 'c')">
+ <xsl:value-of select="concat(@ss:StyleID, '-ce', substring-after($temp-str, 'c'))"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="@ss:StyleID">
+ <xsl:value-of select="@ss:StyleID"/>
+ </xsl:when>
+ <xsl:when test="../@ss:StyleID">
+ <xsl:value-of select="../@ss:StyleID"/>
+ </xsl:when>
+ <xsl:when test="../../@ss:StyleID">
+ <xsl:value-of select="../../@ss:StyleID"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="starts-with($style-name, 'val')">
+ <xsl:attribute name="table:content-validation-name">
+ <xsl:value-of select="$style-name"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="not($style-name = '')">
+ <xsl:attribute name="table:style-name">
+ <xsl:value-of select="$style-name"/>
+ </xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <!-- maybe multi functions occur at same time in the same Cell, such as ConditionalFormatting and DataValidation -->
+ <xsl:if test="contains($condition-pos-str, $current-pos-str)">
+ <xsl:choose>
+ <xsl:when test="starts-with($temp-str, 'v')">
+ <xsl:attribute name="table:content-validation-name">
+ <xsl:value-of select="concat('val', substring-after($temp-str, 'v'))"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="after-str" select="substring-after($condition-pos-str, $current-pos-str)"/>
+ <xsl:if test="contains( $after-str, $current-pos-str)">
+ <xsl:variable name="temp-str-2">
+ <xsl:call-template name="condition-str">
+ <xsl:with-param name="param-str" select="substring-before( $after-str,$current-pos-str)"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="starts-with( $temp-str-2, 'v')">
+ <xsl:attribute name="table:content-validation-name">
+ <xsl:value-of select="concat('val', substring-after($temp-str-2, 'v'))"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="validation-row-column-string">
+ <!-- returns a string with structer,including row\column position by extraction from x:DataValidation -->
+ <xsl:param name="last"/>
+ <xsl:param name="total"/>
+ <xsl:param name="index"/>
+ <xsl:variable name="table-pos" select="count(preceding-sibling::ss:Worksheet)+1"/>
+ <xsl:variable name="current">
+ <xsl:call-template name="parse-range">
+ <xsl:with-param name="range-value" select="./x:DataValidation[position() = $index]/x:Range"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="current-value" select="concat('(v',$index,':', $current,');')"/>
+ <xsl:if test="$index &lt; $total">
+ <xsl:call-template name="validation-row-column-string">
+ <xsl:with-param name="last" select="concat($last, $current-value)"/>
+ <xsl:with-param name="total" select="$total"/>
+ <xsl:with-param name="index" select="$index + 1"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="$index = $total">
+ <xsl:value-of select="concat($last, $current-value)"/>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="condition-row-column-string">
+ <!-- returns a string with structer,including row\column position by extraction from x:ConditionalFormatting -->
+ <xsl:param name="last"/>
+ <xsl:param name="total"/>
+ <xsl:param name="index"/>
+ <xsl:variable name="table-pos" select="count(preceding-sibling::ss:Worksheet)+1"/>
+ <xsl:variable name="current">
+ <xsl:call-template name="parse-range">
+ <xsl:with-param name="range-value" select="./x:ConditionalFormatting[position() = $index]/x:Range"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="current-value" select="concat('(c',$table-pos,'-',$index,':', $current,');')"/>
+ <xsl:if test="$index &lt; $total">
+ <xsl:call-template name="condition-row-column-string">
+ <xsl:with-param name="last" select="concat($last, $current-value)"/>
+ <xsl:with-param name="total" select="$total"/>
+ <xsl:with-param name="index" select="$index + 1"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="$index = $total">
+ <xsl:value-of select="concat($last, $current-value)"/>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="parse-range">
+ <!-- returns a string,input param:the value of x:Range -->
+ <xsl:param name="range-value"/>
+ <xsl:param name="last"/>
+ <xsl:variable name="first-pit">
+ <xsl:choose>
+ <xsl:when test="contains($range-value,',')">
+ <xsl:value-of select="substring-before($range-value,',')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$range-value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="current">
+ <xsl:choose>
+ <xsl:when test="contains($first-pit,':')">
+ <xsl:variable name="R-start" select="substring-before(substring-after($first-pit,'R'),'C')"/>
+ <xsl:variable name="C-start" select="substring-before(substring-after($first-pit,'C'),':')"/>
+ <xsl:variable name="second-pit" select="substring-after($first-pit,':')"/>
+ <xsl:variable name="R-end" select="substring-before(substring-after($second-pit,'R'),'C')"/>
+ <xsl:variable name="C-end" select="substring-after($second-pit,'C')"/>
+ <xsl:variable name="the-str">
+ <xsl:call-template name="condition-rc-str">
+ <xsl:with-param name="r-start" select="$R-start"/>
+ <xsl:with-param name="r-end" select="$R-end"/>
+ <xsl:with-param name="c-start" select="$C-start"/>
+ <xsl:with-param name="c-end" select="$C-end"/>
+ <xsl:with-param name="last" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="$the-str"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat($first-pit,',')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="contains($range-value,',')">
+ <xsl:call-template name="parse-range">
+ <xsl:with-param name="range-value" select="substring-after($range-value,',')"/>
+ <xsl:with-param name="last" select="concat($last,$current)"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat($last,$current)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="condition-rc-str">
+ <!-- dealing the range of row\column -->
+ <xsl:param name="r-start"/>
+ <xsl:param name="r-end"/>
+ <xsl:param name="c-start"/>
+ <xsl:param name="c-end"/>
+ <xsl:param name="last"/>
+ <xsl:variable name="current">
+ <xsl:call-template name="condition-c-str">
+ <xsl:with-param name="rc-str" select="concat('R',$r-start)"/>
+ <xsl:with-param name="start" select="$c-start"/>
+ <xsl:with-param name="end" select="$c-end"/>
+ <xsl:with-param name="last" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="$r-start &lt; $r-end">
+ <xsl:call-template name="condition-rc-str">
+ <xsl:with-param name="r-start" select="$r-start + 1"/>
+ <xsl:with-param name="r-end" select="$r-end"/>
+ <xsl:with-param name="c-start" select="$c-start"/>
+ <xsl:with-param name="c-end" select="$c-end"/>
+ <xsl:with-param name="last" select="concat($last,$current)"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="$r-start = $r-end">
+ <xsl:value-of select="concat($last,$current)"/>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="condition-c-str">
+ <!-- return value for the template condition-rc-str -->
+ <xsl:param name="rc-str"/>
+ <xsl:param name="start"/>
+ <xsl:param name="end"/>
+ <xsl:param name="last"/>
+ <xsl:variable name="current" select="concat($rc-str,'C',$start,',')"/>
+ <xsl:if test="$start &lt; $end">
+ <xsl:call-template name="condition-c-str">
+ <xsl:with-param name="rc-str" select="$rc-str"/>
+ <xsl:with-param name="start" select="$start + 1"/>
+ <xsl:with-param name="end" select="$end"/>
+ <xsl:with-param name="last" select="concat($last,$current)"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="$start = $end">
+ <xsl:value-of select="concat($last,$current)"/>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="ss:Data">
+ <xsl:for-each select="descendant-or-self::*[namespace-uri()='http://www.w3.org/TR/REC-html40'][string-length(text()) != 0]">
+ <style:style style:name="{concat(ancestor::ss:Cell/@ss:StyleID,'T',count(preceding::ss:Data[child::html:*]), '_', position())}" style:family="text">
+ <xsl:element name="style:text-properties">
+ <xsl:if test="ancestor-or-self::html:Font/@html:Face">
+ <xsl:attribute name="style:font-name">
+ <xsl:value-of select="ancestor-or-self::html:Font/@html:Face"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="ancestor-or-self::html:Font/@html:Size">
+ <xsl:attribute name="fo:font-size">
+ <xsl:value-of select="concat(ancestor-or-self::html:Font/@html:Size,'pt')"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:font-size-asian">
+ <xsl:value-of select="concat(ancestor-or-self::html:Font/@html:Size,'pt')"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:font-size-complex">
+ <xsl:value-of select="concat(ancestor-or-self::html:Font/@html:Size,'pt')"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="ancestor-or-self::html:Font/@html:Color">
+ <xsl:attribute name="fo:color">
+ <xsl:value-of select="ancestor-or-self::html:Font/@html:Color"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="ancestor-or-self::html:B">
+ <xsl:attribute name="fo:font-weight">bold</xsl:attribute>
+ <xsl:attribute name="style:font-weight-asian">bold</xsl:attribute>
+ <xsl:attribute name="style:font-weight-complex">bold</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="ancestor-or-self::html:I">
+ <xsl:attribute name="fo:font-style">italic</xsl:attribute>
+ <xsl:attribute name="style:font-style-asian">italic</xsl:attribute>
+ <xsl:attribute name="style:font-style-complex">italic</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="ancestor-or-self::html:U">
+ <xsl:attribute name="style:text-underline-type">single</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="ancestor-or-self::html:S">
+ <xsl:attribute name="style:text-line-through-style">solid</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="ancestor-or-self::html:Sup">
+ <xsl:attribute name="style:text-position">33% 58%</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="ancestor-or-self::html:Sub">
+ <xsl:attribute name="style:text-position">-33% 58%</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </style:style>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="get-pos-content">
+ <xsl:param name="content"/>
+ <xsl:param name="pos"/>
+ <xsl:choose>
+ <xsl:when test="$pos = 'left'">
+ <xsl:choose>
+ <xsl:when test="contains($content,'&amp;C')">
+ <xsl:value-of select="substring-before( substring-after( $content, '&amp;L'), '&amp;C')"/>
+ </xsl:when>
+ <xsl:when test="contains($content,'&amp;R')">
+ <xsl:value-of select="substring-before( substring-after( $content, '&amp;L'), '&amp;R')"/>
+ </xsl:when>
+ <xsl:when test="contains($content,'&amp;L')">
+ <xsl:value-of select="substring-after( $content, '&amp;L')"/>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$pos = 'center'">
+ <xsl:choose>
+ <xsl:when test="contains($content,'&amp;R')">
+ <xsl:value-of select="substring-before( substring-after( $content, '&amp;C'), '&amp;R')"/>
+ </xsl:when>
+ <xsl:when test="contains($content,'&amp;C')">
+ <xsl:value-of select="substring-after( $content, '&amp;C')"/>
+ </xsl:when>
+ <xsl:when test="contains($content,'&amp;L')"/>
+ <xsl:otherwise>
+ <xsl:value-of select="$content"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$pos = 'right'">
+ <xsl:value-of select="substring-after( $content, '&amp;R')"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="@x:Data">
+ <xsl:variable name="style-name-header">
+ <xsl:value-of select="concat(ancestor::ss:Worksheet/@ss:Name, substring(name(..),1,1))"/>
+ </xsl:variable>
+ <xsl:variable name="left-style-data">
+ <xsl:call-template name="get-pos-content">
+ <xsl:with-param name="content" select="."/>
+ <xsl:with-param name="pos" select="'left'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="string-length($left-style-data)&gt;0 and contains($left-style-data,'&amp;')">
+ <xsl:call-template name="create-header-footer-style">
+ <xsl:with-param name="style-name-header" select="concat($style-name-header,'L')"/>
+ <xsl:with-param name="style-data" select="$left-style-data"/>
+ <xsl:with-param name="index" select="0"/>
+ <xsl:with-param name="current-pos" select="1"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:variable name="center-style-data">
+ <xsl:call-template name="get-pos-content">
+ <xsl:with-param name="content" select="."/>
+ <xsl:with-param name="pos" select="'center'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="string-length($center-style-data)&gt;0 and contains($center-style-data,'&amp;')">
+ <xsl:call-template name="create-header-footer-style">
+ <xsl:with-param name="style-name-header" select="concat($style-name-header,'C')"/>
+ <xsl:with-param name="style-data" select="$center-style-data"/>
+ <xsl:with-param name="index" select="0"/>
+ <xsl:with-param name="current-pos" select="1"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:variable name="right-style-data">
+ <xsl:call-template name="get-pos-content">
+ <xsl:with-param name="content" select="."/>
+ <xsl:with-param name="pos" select="'right'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="string-length($right-style-data)&gt;0 and contains($right-style-data,'&amp;')">
+ <xsl:call-template name="create-header-footer-style">
+ <xsl:with-param name="style-name-header" select="concat($style-name-header,'R')"/>
+ <xsl:with-param name="style-data" select="$right-style-data"/>
+ <xsl:with-param name="index" select="0"/>
+ <xsl:with-param name="current-pos" select="1"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="create-header-footer-style">
+ <xsl:param name="style-name-header"/>
+ <xsl:param name="style-data"/>
+ <xsl:param name="index"/>
+ <xsl:param name="current-pos"/>
+ <xsl:variable name="current-style-data">
+ <xsl:value-of select="substring($style-data,$current-pos)"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="starts-with($current-style-data,'&amp;D') or starts-with($current-style-data,'&amp;T') or starts-with($current-style-data,'&amp;P') or starts-with($current-style-data,'&amp;N') or starts-with($current-style-data,'&amp;A') or starts-with($current-style-data,'&amp;F') or starts-with($current-style-data,'&amp;Z')">
+ <xsl:call-template name="create-header-footer-style">
+ <xsl:with-param name="style-name-header" select="$style-name-header"/>
+ <xsl:with-param name="style-data" select="$style-data"/>
+ <xsl:with-param name="index" select="$index"/>
+ <xsl:with-param name="current-pos" select="$current-pos +2"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with($current-style-data,'&amp;')">
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name">
+ <xsl:value-of select="concat($style-name-header,$index)"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:family">text</xsl:attribute>
+ <xsl:element name="style:text-properties">
+ <xsl:call-template name="process-header-footer-style-properties">
+ <xsl:with-param name="style-data" select="$style-data"/>
+ <xsl:with-param name="current-pos" select="$current-pos"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:element>
+ <xsl:variable name="next-style-header-pos">
+ <xsl:call-template name="get-current-content-pos">
+ <xsl:with-param name="style-data" select="$style-data"/>
+ <xsl:with-param name="current-pos" select="$current-pos"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="create-header-footer-style">
+ <xsl:with-param name="style-name-header" select="$style-name-header"/>
+ <xsl:with-param name="style-data" select="$style-data"/>
+ <xsl:with-param name="index" select="$index+1"/>
+ <xsl:with-param name="current-pos" select="$next-style-header-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="contains($current-style-data,'&amp;')">
+ <xsl:variable name="temp" select="substring-before($current-style-data,'&amp;')"/>
+ <xsl:call-template name="create-header-footer-style">
+ <xsl:with-param name="style-name-header" select="$style-name-header"/>
+ <xsl:with-param name="style-data" select="$style-data"/>
+ <xsl:with-param name="index" select="$index"/>
+ <xsl:with-param name="current-pos" select="string-length($temp)+$current-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="process-header-footer-style-properties">
+ <xsl:param name="style-data"/>
+ <xsl:param name="current-pos"/>
+ <xsl:variable name="current-style-data">
+ <xsl:value-of select="substring($style-data,$current-pos)"/>
+ </xsl:variable>
+ <xsl:choose>
+ <!-- stack operations necessary -->
+ <xsl:when test="starts-with($current-style-data,'&amp;&quot;')">
+ <xsl:attribute name="style:font-name">
+ <xsl:value-of select="substring-before(substring-after($current-style-data,'&amp;&quot;'),',')"/>
+ </xsl:attribute>
+ <xsl:if test="contains(substring-before(substring-after($current-style-data,','),'&quot;'),'Bold')">
+ <xsl:attribute name="fo:font-weight">bold</xsl:attribute>
+ <xsl:attribute name="style:font-weight-asian">bold</xsl:attribute>
+ <xsl:attribute name="style:font-weight-complex">bold</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="contains(substring-before(substring-after($current-style-data,','),'&quot;'),'Italic')">
+ <xsl:attribute name="fo:font-style">italic</xsl:attribute>
+ <xsl:attribute name="style:font-style-asian">italic</xsl:attribute>
+ <xsl:attribute name="style:font-style-complex">italic</xsl:attribute>
+ </xsl:if>
+ <xsl:variable name="temp" select="substring-before(substring($style-data,$current-pos+2),'&quot;')"/>
+ <xsl:call-template name="process-header-footer-style-properties">
+ <xsl:with-param name="style-data" select="$style-data"/>
+ <xsl:with-param name="current-pos" select="string-length($temp)+$current-pos+3"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with($current-style-data,'&amp;0') or starts-with($current-style-data,'&amp;1') or starts-with($current-style-data,'&amp;2') or starts-with($current-style-data,'&amp;3') or starts-with($current-style-data,'&amp;4') or starts-with($current-style-data,'&amp;5') or starts-with($current-style-data,'&amp;6') or starts-with($current-style-data,'&amp;7') or starts-with($current-style-data,'&amp;8') or starts-with($current-style-data,'&amp;9')">
+ <xsl:variable name="font-size-length">
+ <xsl:call-template name="get-digit-length">
+ <xsl:with-param name="complexive-string" select="substring-after($current-style-data,'&amp;')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="fo:font-size">
+ <xsl:value-of select="concat(substring($current-style-data,2,$font-size-length),'pt')"/>
+ </xsl:attribute>
+ <xsl:call-template name="process-header-footer-style-properties">
+ <xsl:with-param name="style-data" select="$style-data"/>
+ <xsl:with-param name="current-pos" select="$current-pos + 1 + $font-size-length"/>
+ </xsl:call-template>
+ </xsl:when>
+ <!-- dont' consider tangled or adjoined '&X' and '&Y', '&U' & '&E', processing-check is necessary, too complex. :( -->
+ <xsl:when test="starts-with($current-style-data,'&amp;X')">
+ <xsl:variable name="superscript-count-before">
+ <xsl:call-template name="get-substyle-count-in-data">
+ <xsl:with-param name="style-data" select="substring($style-data,1,$current-pos)"/>
+ <xsl:with-param name="substyle" select="'&amp;X'"/>
+ <xsl:with-param name="count" select="0"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="$superscript-count-before mod 2 = 0">
+ <xsl:attribute name="style:text-position">33% 58%</xsl:attribute>
+ </xsl:if>
+ <xsl:call-template name="process-header-footer-style-properties">
+ <xsl:with-param name="style-data" select="$style-data"/>
+ <xsl:with-param name="current-pos" select="$current-pos + 2"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with($current-style-data,'&amp;B')">
+ <xsl:variable name="subscript-count-before">
+ <xsl:call-template name="get-substyle-count-in-data">
+ <xsl:with-param name="style-data" select="substring($style-data,1,$current-pos)"/>
+ <xsl:with-param name="substyle" select="'&amp;B'"/>
+ <xsl:with-param name="count" select="0"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="$subscript-count-before mod 2 = 0">
+ <xsl:attribute name="fo:font-weight">bold</xsl:attribute>
+ <xsl:attribute name="style:font-weight-asian">bold</xsl:attribute>
+ <xsl:attribute name="style:font-weight-complex">bold</xsl:attribute>
+ </xsl:if>
+ <xsl:call-template name="process-header-footer-style-properties">
+ <xsl:with-param name="style-data" select="$style-data"/>
+ <xsl:with-param name="current-pos" select="$current-pos + 2"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with($current-style-data,'&amp;Y')">
+ <xsl:variable name="subscript-count-before">
+ <xsl:call-template name="get-substyle-count-in-data">
+ <xsl:with-param name="style-data" select="substring($style-data,1,$current-pos)"/>
+ <xsl:with-param name="substyle" select="'&amp;Y'"/>
+ <xsl:with-param name="count" select="0"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="$subscript-count-before mod 2 = 0">
+ <xsl:attribute name="style:text-position">-33% 58%</xsl:attribute>
+ </xsl:if>
+ <xsl:call-template name="process-header-footer-style-properties">
+ <xsl:with-param name="style-data" select="$style-data"/>
+ <xsl:with-param name="current-pos" select="$current-pos + 2"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with($current-style-data,'&amp;S')">
+ <xsl:variable name="strikethrough-count-before">
+ <xsl:call-template name="get-substyle-count-in-data">
+ <xsl:with-param name="style-data" select="substring($style-data,1,$current-pos)"/>
+ <xsl:with-param name="substyle" select="'&amp;S'"/>
+ <xsl:with-param name="count" select="0"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="$strikethrough-count-before mod 2 = 0">
+ <xsl:attribute name="style:text-line-through-style">solid</xsl:attribute>
+ </xsl:if>
+ <xsl:call-template name="process-header-footer-style-properties">
+ <xsl:with-param name="style-data" select="$style-data"/>
+ <xsl:with-param name="current-pos" select="$current-pos + 2"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with($current-style-data,'&amp;U')">
+ <xsl:variable name="single-underline-count-before">
+ <xsl:call-template name="get-substyle-count-in-data">
+ <xsl:with-param name="style-data" select="substring($style-data,1,$current-pos)"/>
+ <xsl:with-param name="substyle" select="'&amp;U'"/>
+ <xsl:with-param name="count" select="0"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="$single-underline-count-before mod 2 = 0">
+ <xsl:attribute name="style:text-underline-type">single</xsl:attribute>
+ </xsl:if>
+ <xsl:call-template name="process-header-footer-style-properties">
+ <xsl:with-param name="style-data" select="$style-data"/>
+ <xsl:with-param name="current-pos" select="$current-pos + 2"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with($current-style-data,'&amp;E')">
+ <xsl:variable name="double-underline-count-before">
+ <xsl:call-template name="get-substyle-count-in-data">
+ <xsl:with-param name="style-data" select="substring($style-data,1,$current-pos)"/>
+ <xsl:with-param name="substyle" select="'&amp;E'"/>
+ <xsl:with-param name="count" select="0"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="$double-underline-count-before mod 2 = 0">
+ <xsl:attribute name="style:text-underline-type">double</xsl:attribute>
+ </xsl:if>
+ <xsl:call-template name="process-header-footer-style-properties">
+ <xsl:with-param name="style-data" select="$style-data"/>
+ <xsl:with-param name="current-pos" select="$current-pos + 2"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-substyle-count-in-data">
+ <xsl:param name="style-data"/>
+ <xsl:param name="substyle"/>
+ <xsl:param name="count"/>
+ <xsl:choose>
+ <xsl:when test="contains($style-data,$substyle)">
+ <xsl:call-template name="get-substyle-count-in-data">
+ <xsl:with-param name="style-data" select="substring-after($style-data,$substyle)"/>
+ <xsl:with-param name="substyle" select="$substyle"/>
+ <xsl:with-param name="count" select="$count+1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$count"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-current-content-pos">
+ <xsl:param name="style-data"/>
+ <xsl:param name="current-pos"/>
+ <xsl:variable name="current-style-data">
+ <xsl:value-of select="substring($style-data,$current-pos)"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="starts-with($current-style-data,'&amp;X') or starts-with($current-style-data,'&amp;Y') or starts-with($current-style-data,'&amp;S') or starts-with($current-style-data,'&amp;U') or starts-with($current-style-data,'&amp;E') or starts-with($current-style-data,'&amp;B')">
+ <xsl:call-template name="get-current-content-pos">
+ <xsl:with-param name="style-data" select="$style-data"/>
+ <xsl:with-param name="current-pos" select="$current-pos+2"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with($current-style-data,'&amp;0') or starts-with($current-style-data,'&amp;1') or starts-with($current-style-data,'&amp;2') or starts-with($current-style-data,'&amp;3') or starts-with($current-style-data,'&amp;4') or starts-with($current-style-data,'&amp;5') or starts-with($current-style-data,'&amp;6') or starts-with($current-style-data,'&amp;7') or starts-with($current-style-data,'&amp;8') or starts-with($current-style-data,'&amp;9')">
+ <xsl:variable name="font-size-length">
+ <xsl:call-template name="get-digit-length">
+ <xsl:with-param name="complexive-string" select="substring-after($current-style-data,'&amp;')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="get-current-content-pos">
+ <xsl:with-param name="style-data" select="$style-data"/>
+ <xsl:with-param name="current-pos" select="$current-pos+1+$font-size-length"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with($current-style-data,'&amp;&quot;')">
+ <xsl:variable name="temp" select="substring-before(substring($style-data,$current-pos+2),'&quot;')"/>
+ <xsl:call-template name="get-current-content-pos">
+ <xsl:with-param name="style-data" select="$style-data"/>
+ <xsl:with-param name="current-pos" select="string-length($temp)+$current-pos+3"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$current-pos"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- OASIS OpenDocument Format change:
+ Excel "=RC4*6"
+ OOoXML "=$D22*6"
+ OASIS XML "oooc:=[.$D22]*6" -->
+ <xsl:template name="translate-expression">
+ <!-- return position or range for formula or other -->
+ <xsl:param name="cell-row-pos"/>
+ <!-- the position in row (vertical) of cell -->
+ <xsl:param name="cell-column-pos"/>
+ <!-- the position in column (horizontal of cell -->
+ <xsl:param name="expression"/>
+ <!-- recomposed expression containing cell positions after every conversion -->
+ <xsl:param name="is-range-mode" select="false()"/>
+ <!-- as mode changes a '[.' resp. ']' is written out -->
+ <xsl:param name="return-value"/>
+ <!-- expression of table:cell-range-address is different than formula (e.g. no prefix) -->
+ <xsl:param name="isRangeAddress"/>
+ <!-- determines if the currently processed expression is relative -->
+ <xsl:param name="isRelative" select="false()" />
+
+ <!-- value to be given out later -->
+ <!-- to judge whether this input expression contains any cell position to convert -->
+ <xsl:variable name="temp-range">
+ <xsl:choose>
+ <xsl:when test="$expression != ''">
+ <xsl:call-template name="parse-range-name">
+ <xsl:with-param name="expression" select="$expression"/>
+ <xsl:with-param name="return-value" select="''"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="''"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <!-- if $range-type = 1, then range is representing a sheet, function's name or separated symbol, but not cell position,
+ or if $range-type = 2, range should be handled because it contains certain cell position.
+ The first character marks the type of that expression. -->
+ <xsl:variable name="range-type">
+ <xsl:choose>
+ <xsl:when test="substring($temp-range, 1, 1) = '1'">
+ <xsl:value-of select="1"/>
+ </xsl:when>
+ <xsl:when test="substring($temp-range, 1, 1) = '2'">
+ <xsl:value-of select="2"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="2"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <!-- remove that added range type token -->
+ <xsl:variable name="current-range">
+ <xsl:value-of select="substring($temp-range, 2)"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$range-type = 1">
+ <!-- Nothing to convert, so just join the front and behind strings. -->
+ <xsl:call-template name="translate-expression">
+ <xsl:with-param name="cell-row-pos" select="$cell-row-pos"/>
+ <xsl:with-param name="cell-column-pos" select="$cell-column-pos"/>
+ <xsl:with-param name="expression">
+ <!-- get current converting position from $temp-token or $current-range, then join the expression. -->
+ <xsl:choose>
+ <xsl:when test="contains($current-range, '#$')">
+ <!-- because of recomposing of string, the $current-range may not be the pit
+ of $expression, so the char #$ should not be used for nominal -->
+ <xsl:variable name="temp-token">
+ <xsl:choose>
+ <xsl:when test="contains($current-range, '\')">
+ <xsl:value-of select="concat(']', substring-after($current-range, '#$'), &quot;&apos;&quot;)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-after($current-range, '#$')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:value-of select="substring-after($expression, $temp-token)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-after($expression, $current-range)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="return-value">
+ <!-- react on range mode change (when to insert closing ']' or in case of '!' change the mode to RANGE and create open '[' -->
+ <xsl:choose>
+ <xsl:when test="$current-range = '=' and $return-value = '' and not($isRangeAddress)">
+ <xsl:text>oooc:=</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($current-range, '!') and not($isRangeAddress)">
+ <xsl:value-of select="concat($return-value, '[', $current-range)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="$is-range-mode = 'true' and $current-range != ':' and not($isRangeAddress)">
+ <xsl:value-of select="concat($return-value, ']', substring-before($expression, $current-range), $current-range)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat($return-value, substring-before($expression, $current-range), $current-range)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="is-range-mode">
+ <xsl:choose>
+ <!-- ! is the separator of worksheet and range
+ : is the separator for a cell range -->
+ <xsl:when test="contains($current-range, '!') or $current-range = ':'">
+ <xsl:value-of select="true()"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="false()"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="isRangeAddress" select="$isRangeAddress"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- types of range to handle in $current-range, i.e. the cell position expression to convert
+ 1: special cell including row and column; e.g. R4C5
+ 2: whole row; e.g. R3
+ 3: whole column; e.g. C5
+ 4: other name not for cell or row/column; e.g. RANDOM() or something unknown
+ -->
+ <xsl:variable name="handle-type">
+ <xsl:choose>
+ <xsl:when test="starts-with($current-range, 'R')">
+ <!-- It's type 1 or type 2 or 4/unknown cell position. -->
+ <xsl:choose>
+ <xsl:when test="contains($current-range, 'C')">
+ <!-- It's type 1, specifying the cell position or 4/unknown -->
+ <xsl:variable name="part-type-r">
+ <xsl:call-template name="handle-type-number">
+ <xsl:with-param name="t-part" select="substring-before( substring-after($current-range, 'R'), 'C')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="part-type-c">
+ <xsl:call-template name="handle-type-number">
+ <xsl:with-param name="t-part" select="substring-after($current-range, 'C')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="($part-type-r = 1) and ($part-type-c = 1)">
+ <xsl:value-of select="1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="4"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- It's type 2 specifying the cell position, or 4/unknown. -->
+ <xsl:variable name="part-type">
+ <xsl:call-template name="handle-type-number">
+ <xsl:with-param name="t-part" select="substring-after($current-range, 'R')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$part-type = 1">
+ <xsl:value-of select="2"/>
+ </xsl:when>
+ <xsl:when test="$part-type = 2">
+ <xsl:value-of select="4"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="4"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="starts-with($current-range, 'C')">
+ <!-- It's type 3 of cell position, or 4/unknown -->
+ <xsl:variable name="part-type">
+ <xsl:call-template name="handle-type-number">
+ <xsl:with-param name="t-part" select="substring-after($current-range, 'C')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$part-type = 1">
+ <xsl:value-of select="3"/>
+ </xsl:when>
+ <xsl:when test="$part-type = 2">
+ <xsl:value-of select="4"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="4"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- It's type 4, not cell position -->
+ <xsl:value-of select="4"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <!-- Start to convert that cell position expression, that cell position unit -->
+ <xsl:choose>
+ <xsl:when test="$handle-type = 1">
+ <!-- It's type 1, e.g. R1C2 -->
+ <!-- process the row part -->
+ <xsl:variable name="after-R">
+ <xsl:value-of select="substring(substring-after($current-range,'R'),1,1)"/>
+ </xsl:variable>
+ <xsl:choose>
+ <!-- found one cell unit -->
+ <xsl:when test="$after-R='C' or $after-R='[' or $after-R='0' or $after-R='1' or $after-R='2' or $after-R='3' or $after-R='4' or $after-R='5' or $after-R='6' or $after-R='7' or $after-R='8' or $after-R='9'">
+ <xsl:variable name="row-pos">
+ <xsl:choose>
+ <xsl:when test="$after-R='['">
+ <xsl:value-of select="$cell-row-pos+substring-before( substring-after($current-range,'R['),']')"/>
+ </xsl:when>
+ <xsl:when test="$after-R='C'">
+ <xsl:value-of select="$cell-row-pos"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-before(substring-after($current-range,'R'),'C')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="row-pos-style">
+ <xsl:choose>
+ <xsl:when test="$after-R='[' or $after-R='C'">relative</xsl:when>
+ <xsl:otherwise>absolute</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <!-- process the column part -->
+ <xsl:variable name="after-C">
+ <xsl:value-of select="substring(substring-after(substring-after($current-range,'R'),'C'),1,1)"/>
+ </xsl:variable>
+ <xsl:variable name="column-digit-length">
+ <xsl:choose>
+ <xsl:when test="$after-C='0' or $after-C='1' or $after-C='2' or $after-C='3' or $after-C='4' or $after-C='5' or $after-C='6' or $after-C='7' or $after-C='8' or $after-C='9'">
+ <xsl:call-template name="get-digit-length">
+ <xsl:with-param name="complexive-string" select="substring-after(substring-after($current-range,'R'),'C')"/>
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="column-pos">
+ <xsl:choose>
+ <xsl:when test="$after-C='['">
+ <xsl:value-of select="$cell-column-pos + substring-before(substring-after(substring-after($current-range,'R'),'C['),']')"/>
+ </xsl:when>
+ <xsl:when test="$after-C='0' or $after-C='1' or $after-C='2' or $after-C='3' or $after-C='4' or $after-C='5' or $after-C='6' or $after-C='7' or $after-C='8' or $after-C='9'">
+ <xsl:value-of select="substring(substring-after(substring-after($current-range,'R'),'C'),1,$column-digit-length)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$cell-column-pos"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="column-pos-style">
+ <xsl:choose>
+ <xsl:when test="$after-C='0' or $after-C='1' or $after-C='2' or $after-C='3' or $after-C='4' or $after-C='5' or $after-C='6' or $after-C='7' or $after-C='8' or $after-C='9'">absolute</xsl:when>
+ <xsl:otherwise>relative</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="trans-unit">
+ <xsl:call-template name="translate-unit">
+ <xsl:with-param name="column-number" select="$column-pos"/>
+ <xsl:with-param name="row-number" select="$row-pos"/>
+ <xsl:with-param name="column-pos-style" select="$column-pos-style"/>
+ <xsl:with-param name="row-pos-style" select="$row-pos-style"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="name-unit" select="concat(substring-before($expression, $current-range), $trans-unit)"/>
+ <xsl:call-template name="translate-expression">
+ <xsl:with-param name="cell-row-pos" select="$cell-row-pos"/>
+ <xsl:with-param name="cell-column-pos" select="$cell-column-pos"/>
+ <xsl:with-param name="expression" select="substring-after($expression, $current-range)"/>
+ <xsl:with-param name="return-value">
+ <xsl:choose>
+ <xsl:when test="$is-range-mode = 'true'">
+ <xsl:value-of select="concat($return-value, $name-unit)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat($return-value, '[.', $name-unit)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="is-range-mode" select="true()"/>
+ <xsl:with-param name="isRangeAddress" select="$isRangeAddress"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="name-unit" select="concat(substring-before($expression, $current-range), translate( substring-before(substring-after($expression, '('),'R'),',!', ';.'))"/>
+ <xsl:call-template name="translate-expression">
+ <xsl:with-param name="cell-row-pos" select="$cell-row-pos"/>
+ <xsl:with-param name="cell-column-pos" select="$cell-column-pos"/>
+ <xsl:with-param name="expression" select="substring-after($current-range,'R')"/>
+ <xsl:with-param name="return-value">
+ <xsl:choose>
+ <xsl:when test="$is-range-mode = 'true'">
+ <xsl:value-of select="concat($return-value, $name-unit)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat($return-value, '[.', $name-unit)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="is-range-mode" select="true()"/>
+ <xsl:with-param name="isRangeAddress" select="$isRangeAddress"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$handle-type = 2">
+ <!-- It's type 2, e.g. R3 -->
+ <!-- process the range only including a whole row -->
+ <xsl:variable name="after-R">
+ <xsl:value-of select="substring(substring-after($current-range,'R'),1,1)"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$after-R='[' or $after-R='0' or $after-R='1' or $after-R='2' or $after-R='3' or $after-R='4' or $after-R='5' or $after-R='6' or $after-R='7' or $after-R='8' or $after-R='9'">
+ <xsl:variable name="row-number">
+ <xsl:choose>
+ <xsl:when test="$after-R = '['">
+ <xsl:value-of select="substring-before(substring-after($current-range, 'R['), ']')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-after($current-range, 'R')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="row-pos">
+ <xsl:choose>
+ <xsl:when test="$after-R='['">
+ <xsl:value-of select="$cell-row-pos + $row-number"/>
+ </xsl:when>
+ <xsl:when test="$after-R='0' or $after-R='1' or $after-R='2' or $after-R='3' or $after-R='4' or $after-R='5' or $after-R='6' or $after-R='7' or $after-R='8' or $after-R='9'">
+ <xsl:value-of select="$row-number"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$cell-row-pos"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="trans-unit1">
+ <xsl:call-template name="translate-unit">
+ <xsl:with-param name="column-number" select="1"/>
+ <xsl:with-param name="row-number" select="$row-pos"/>
+ <xsl:with-param name="column-pos-style" select="'relative'"/>
+ <xsl:with-param name="row-pos-style" select="'relative'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="trans-unit2">
+ <xsl:call-template name="translate-unit">
+ <xsl:with-param name="column-number" select="256"/>
+ <xsl:with-param name="row-number" select="$row-pos"/>
+ <xsl:with-param name="column-pos-style" select="'relative'"/>
+ <xsl:with-param name="row-pos-style" select="'relative'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="name-unit" select="concat(substring-before($expression, $current-range), $trans-unit1, ':', $trans-unit2)"/>
+ <xsl:call-template name="translate-expression">
+ <xsl:with-param name="cell-row-pos" select="$cell-row-pos"/>
+ <xsl:with-param name="cell-column-pos" select="$cell-column-pos"/>
+ <xsl:with-param name="expression" select="substring-after($expression, $current-range)"/>
+ <xsl:with-param name="return-value">
+ <xsl:choose>
+ <xsl:when test="$is-range-mode = 'true'">
+ <xsl:value-of select="concat($return-value, $name-unit)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat($return-value, '[.', $name-unit)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="is-range-mode" select="true()"/>
+ <xsl:with-param name="isRangeAddress" select="$isRangeAddress"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="name-unit" select="concat(substring-before($expression, $current-range), translate( substring-before($current-range,'R'),',!', ';.'),'R')"/>
+ <xsl:call-template name="translate-expression">
+ <xsl:with-param name="cell-row-pos" select="$cell-row-pos"/>
+ <xsl:with-param name="cell-column-pos" select="$cell-column-pos"/>
+ <xsl:with-param name="expression" select="substring-after($current-range,'R')"/>
+ <xsl:with-param name="return-value">
+ <xsl:choose>
+ <xsl:when test="$is-range-mode = 'true'">
+ <xsl:value-of select="concat($return-value, $name-unit)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat($return-value, '[.', $name-unit)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="is-range-mode" select="true()"/>
+ <xsl:with-param name="isRangeAddress" select="$isRangeAddress"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$handle-type = 3">
+ <!-- It's type 3, e.g. C4 -->
+ <!-- process the range only including a whole column -->
+ <xsl:variable name="after-C">
+ <xsl:value-of select="substring(substring-after($current-range,'C'),1,1)"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$after-C='[' or $after-C='0' or $after-C='1' or $after-C='2' or $after-C='3' or $after-C='4' or $after-C='5' or $after-C='6' or $after-C='7' or $after-C='8' or $after-C='9'">
+ <xsl:variable name="column-number">
+ <xsl:choose>
+ <xsl:when test="$after-C = '['">
+ <xsl:value-of select="substring-before(substring-after($current-range, 'C['), ']')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-after($current-range, 'C')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="column-pos">
+ <xsl:choose>
+ <xsl:when test="$after-C='['">
+ <xsl:value-of select="$cell-column-pos + $column-number"/>
+ </xsl:when>
+ <xsl:when test="$after-C='0' or $after-C='1' or $after-C='2' or $after-C='3' or $after-C='4' or $after-C='5' or $after-C='6' or $after-C='7' or $after-C='8' or $after-C='9'">
+ <xsl:value-of select="$column-number"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$cell-column-pos"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="trans-unit1">
+ <xsl:call-template name="translate-unit">
+ <xsl:with-param name="column-number" select="$column-pos"/>
+ <xsl:with-param name="row-number" select="1"/>
+ <xsl:with-param name="column-pos-style" select="'relative'"/>
+ <xsl:with-param name="row-pos-style" select="'relative'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="trans-unit2">
+ <xsl:call-template name="translate-unit">
+ <xsl:with-param name="column-number" select="$column-pos"/>
+ <xsl:with-param name="row-number" select="65565"/>
+ <xsl:with-param name="column-pos-style" select="'relative'"/>
+ <xsl:with-param name="row-pos-style" select="'relative'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="name-unit" select="concat(substring-before($expression, $current-range), $trans-unit1, ':', $trans-unit2)"/>
+ <xsl:call-template name="translate-expression">
+ <xsl:with-param name="cell-row-pos" select="$cell-row-pos"/>
+ <xsl:with-param name="cell-column-pos" select="$cell-column-pos"/>
+ <xsl:with-param name="expression" select="substring-after($expression, $current-range)"/>
+ <xsl:with-param name="return-value">
+ <xsl:choose>
+ <xsl:when test="$is-range-mode = 'true'">
+ <xsl:value-of select="concat($return-value, $name-unit)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat($return-value, '[.', $name-unit)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="is-range-mode" select="true()"/>
+ <xsl:with-param name="isRangeAddress" select="$isRangeAddress"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="name-unit" select="concat(substring-before($expression, $current-range), translate( substring-before($current-range,'C'),',!', ';.'),'C')"/>
+ <xsl:call-template name="translate-expression">
+ <xsl:with-param name="cell-row-pos" select="$cell-row-pos"/>
+ <xsl:with-param name="cell-column-pos" select="$cell-column-pos"/>
+ <xsl:with-param name="expression" select="substring-after($current-range,'C')"/>
+ <xsl:with-param name="return-value">
+ <xsl:choose>
+ <xsl:when test="$is-range-mode = 'true'">
+ <xsl:value-of select="concat($return-value, $name-unit)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat($return-value, '[.', $name-unit)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="is-range-mode" select="true()"/>
+ <xsl:with-param name="isRangeAddress" select="$isRangeAddress"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- It's unknown, so just jump over it -->
+ <xsl:variable name="next-pit" select="substring-after($expression, $current-range)"/>
+ <xsl:choose>
+ <xsl:when test="contains($next-pit, '+') or contains($next-pit, '-') or contains($next-pit, '*') or contains($next-pit, '/') or contains($next-pit, ')') or contains($next-pit, '^') or contains($next-pit, ':') or contains($next-pit, '&quot;') or contains($next-pit, ';') or contains($next-pit, ',') or contains($next-pit, '[')">
+ <xsl:call-template name="translate-expression">
+ <xsl:with-param name="cell-row-pos" select="$cell-row-pos"/>
+ <xsl:with-param name="cell-column-pos" select="$cell-column-pos"/>
+ <xsl:with-param name="expression" select="substring-after($expression, $current-range)"/>
+ <xsl:with-param name="return-value" select="concat($return-value, substring-before($expression, $current-range), $current-range)"/>
+ <xsl:with-param name="is-range-mode" select="false()"/>
+ <xsl:with-param name="isRangeAddress" select="$isRangeAddress"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- return the final range or formula -->
+ <xsl:choose>
+ <!-- in case the closing bracket of the range wasn't set, do it now -->
+ <xsl:when test="$is-range-mode = 'true' and $current-range = ''">
+ <xsl:value-of select="translate( concat($return-value, ']'),',!', ';.')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="translate( concat($return-value, substring-before($expression, $current-range), $current-range),',!', ';.')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="parse-range-name">
+ <!-- return the string or name for next handle. the type 1 is names of function, sheet, special separated symbol, not to parse as range; type 2 is the range including R/C to be parsed -->
+ <xsl:param name="expression"/>
+ <xsl:param name="return-value"/>
+ <xsl:variable name="first-one" select="substring($expression,1,1)"/>
+ <xsl:choose>
+ <xsl:when test="$first-one = '='">
+ <xsl:choose>
+ <xsl:when test="string-length(normalize-space($return-value)) &gt; 0">
+ <xsl:value-of select="concat('2', $return-value)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>1=</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$first-one='(' or $first-one='!' or $first-one='&amp;'">
+ <xsl:value-of select="concat('1', $return-value, $first-one)"/>
+ </xsl:when>
+ <xsl:when test="$first-one='['">
+ <xsl:choose>
+ <xsl:when test="starts-with(substring-after($expression, ']'), 'C')">
+ <xsl:call-template name="parse-range-name">
+ <xsl:with-param name="expression" select="substring-after($expression, ']')"/>
+ <xsl:with-param name="return-value" select="concat($return-value, substring-before($expression, ']'), ']')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="contains(substring-before($expression, ']'), '.') and contains(substring-after($expression, ']'), '!')">
+ <xsl:value-of select="concat('1', &quot;&apos;&quot;, substring-before(substring-after($expression, '['), ']'), &quot;&apos;&quot;, '#$', substring-before(substring-after($expression, ']'), '!'))"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat('2', $return-value, substring-before($expression, ']'), ']')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$first-one='&quot;'">
+ <xsl:value-of select="concat('1', $first-one, substring-before(substring-after($expression, '&quot;'), '&quot;'), '&quot;')"/>
+ </xsl:when>
+ <xsl:when test="$first-one=&quot;&apos;&quot;">
+ <!-- here the string &quot;&apos;&quot; represents a char &apos; -->
+ <xsl:variable name="str-in" select="substring-before(substring-after($expression, &quot;&apos;&quot;), &quot;&apos;&quot;)"/>
+ <xsl:choose>
+ <!-- for file path transformation -->
+ <xsl:when test="contains($str-in, '\') and contains($str-in, '[') and contains($str-in, ']')">
+ <xsl:variable name="first-pos" select="substring-before($str-in, '[')"/>
+ <xsl:variable name="second-pos" select="substring-before(substring-after($str-in, '['), ']')"/>
+ <xsl:variable name="third-pos" select="substring-after($str-in, ']')"/>
+ <xsl:value-of select="concat('1', &quot;&apos;&quot;, $first-pos, $second-pos, &quot;&apos;&quot;, '#$', $third-pos)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat('1', &quot;&apos;&quot;, $str-in, &quot;&apos;&quot;)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$first-one='+' or $first-one='-' or $first-one='*' or $first-one='/' or $first-one=')' or $first-one='^' or $first-one=':' or $first-one='&quot;' or $first-one=';' or $first-one=',' or $first-one='&gt;' or $first-one='&lt;'">
+ <xsl:choose>
+ <xsl:when test="$return-value = ''">
+ <xsl:value-of select="concat('1', $first-one)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat('2', $return-value)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="$expression = ''">
+ <xsl:value-of select="concat('2', $return-value)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="parse-range-name">
+ <xsl:with-param name="expression" select="substring($expression, 2, string-length($expression)-1)"/>
+ <xsl:with-param name="return-value" select="concat($return-value, substring($expression, 1, 1))"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="handle-type-number">
+ <!-- to handle the part between R and C, or after C in range string in translate-expression. return type: 1: number or cell range; 2: other, not for next step -->
+ <xsl:param name="t-part"/>
+ <xsl:choose>
+ <xsl:when test="starts-with($t-part, '[')">
+ <xsl:variable name="tt-str" select="substring-before( substring-after( $t-part, '['), ']')"/>
+ <xsl:choose>
+ <xsl:when test="($tt-str &lt; 0) or ($tt-str &gt; 0) or ($tt-str = 0)">
+ <xsl:value-of select="1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="2"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="($t-part &lt; 0) or ($t-part &gt; 0) or ($t-part = 0)">
+ <xsl:value-of select="1"/>
+ </xsl:when>
+ <xsl:when test="$t-part = ''">
+ <xsl:value-of select="1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="2"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="translate-unit">
+ <!-- convert cell position expression unit, R1C1, R3, C4 -->
+ <xsl:param name="column-number"/>
+ <xsl:param name="row-number"/>
+ <xsl:param name="column-pos-style"/>
+ <xsl:param name="row-pos-style"/>
+ <xsl:variable name="column-number1">
+ <xsl:value-of select="floor( $column-number div 26 )"/>
+ </xsl:variable>
+ <xsl:variable name="column-number2">
+ <xsl:value-of select="$column-number mod 26"/>
+ </xsl:variable>
+ <xsl:variable name="column-character1">
+ <xsl:call-template name="number-to-character">
+ <xsl:with-param name="number" select="$column-number1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="column-character2">
+ <xsl:call-template name="number-to-character">
+ <xsl:with-param name="number" select="$column-number2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <!-- position styles are 'absolute' or 'relative', -->
+ <xsl:choose>
+ <xsl:when test="$column-pos-style = 'absolute'">
+ <xsl:value-of select="concat( '$', $column-character1, $column-character2)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat( $column-character1, $column-character2)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="$row-pos-style ='absolute'">
+ <xsl:value-of select="concat( '$', $row-number)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$row-number"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="number-to-character">
+ <xsl:param name="number"/>
+ <xsl:choose>
+ <xsl:when test="$number = 0"/>
+ <xsl:when test="$number = 1">A</xsl:when>
+ <xsl:when test="$number = 2">B</xsl:when>
+ <xsl:when test="$number = 3">C</xsl:when>
+ <xsl:when test="$number = 4">D</xsl:when>
+ <xsl:when test="$number = 5">E</xsl:when>
+ <xsl:when test="$number = 6">F</xsl:when>
+ <xsl:when test="$number = 7">G</xsl:when>
+ <xsl:when test="$number = 8">H</xsl:when>
+ <xsl:when test="$number = 9">I</xsl:when>
+ <xsl:when test="$number = 10">J</xsl:when>
+ <xsl:when test="$number = 11">K</xsl:when>
+ <xsl:when test="$number = 12">L</xsl:when>
+ <xsl:when test="$number = 13">M</xsl:when>
+ <xsl:when test="$number = 14">N</xsl:when>
+ <xsl:when test="$number = 15">O</xsl:when>
+ <xsl:when test="$number = 16">P</xsl:when>
+ <xsl:when test="$number = 17">Q</xsl:when>
+ <xsl:when test="$number = 18">R</xsl:when>
+ <xsl:when test="$number = 19">S</xsl:when>
+ <xsl:when test="$number = 20">T</xsl:when>
+ <xsl:when test="$number = 21">U</xsl:when>
+ <xsl:when test="$number = 22">V</xsl:when>
+ <xsl:when test="$number = 23">W</xsl:when>
+ <xsl:when test="$number = 24">X</xsl:when>
+ <xsl:when test="$number = 25">Y</xsl:when>
+ <xsl:when test="$number = 26">Z</xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-digit-length">
+ <xsl:param name="complexive-string"/>
+ <xsl:variable name="first-char">
+ <xsl:value-of select="substring( $complexive-string, 1, 1)"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$first-char = '1' or $first-char = '2' or $first-char = '3' or $first-char = '4' or $first-char = '5' or $first-char = '6' or $first-char = '7' or $first-char = '8' or $first-char = '9' or $first-char = '0' ">
+ <xsl:variable name="temp">
+ <xsl:call-template name="get-digit-length">
+ <xsl:with-param name="complexive-string" select="substring( $complexive-string, 2)"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="$temp+1"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="ss:Comment" mode="body">
+ <xsl:element name="office:annotation">
+ <xsl:if test="@ss:ShowAlways = '1'">
+ <xsl:attribute name="office:display">true</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@ss:Author">
+ <xsl:element name="dc:creator">
+ <xsl:value-of select="@ss:Author"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="ss:Data">
+ <text:p>
+ <xsl:call-template name="create-data-content">
+ <xsl:with-param name="style-id" select="@ss:StyleID"/>
+ </xsl:call-template>
+ </text:p>
+ </xsl:if>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="Names">
+ <xsl:variable name="namedRanges" select="/ss:Workbook/ss:Worksheet/ss:Names/ss:NamedRange |
+ /ss:Workbook/ss:Names/ss:NamedRange" />
+ <xsl:if test="$namedRanges">
+ <table:named-expressions>
+ <xsl:for-each select="$namedRanges">
+ <xsl:choose>
+ <xsl:when test="contains( @ss:RefersTo, '!R')">
+ <xsl:variable name="referto">
+ <xsl:call-template name="translate-expression">
+ <xsl:with-param name="isRangeAddress" select="true()"/>
+ <xsl:with-param name="cell-row-pos" select="0"/>
+ <xsl:with-param name="cell-column-pos" select="0"/>
+ <xsl:with-param name="expression" select="@ss:RefersTo"/>
+ <xsl:with-param name="return-value" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:element name="table:named-range">
+ <xsl:attribute name="table:name">
+ <xsl:value-of select="@ss:Name"/>
+ </xsl:attribute>
+ <xsl:attribute name="table:base-cell-address">
+ <xsl:variable name="worksheetName" select="translate(substring-before(@ss:RefersTo, '!'), '=', '$')" />
+ <xsl:call-template name="encode-as-cell-address">
+ <xsl:with-param name="string" select="concat($worksheetName,'.$A$1')"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="table:cell-range-address">
+ <xsl:call-template name="encode-as-cell-range-address">
+ <xsl:with-param name="string" select="translate( $referto, '=', '$')"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:if test="@ss:Name = 'Print_Area'">
+ <xsl:attribute name="table:range-usable-as">print-range</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="expression-name">
+ <xsl:value-of select="@ss:Name"/>
+ </xsl:variable>
+ <xsl:element name="table:named-expression">
+ <xsl:attribute name="table:name">
+ <xsl:value-of select="@ss:Name"/>
+ </xsl:attribute>
+ <!-- just set '$Sheet1.$A$1' as named-expressions virtual base-cell-address -->
+ <xsl:attribute name="table:base-cell-address">
+ <xsl:variable name="worksheetName" select="following-sibling::ss:Worksheet/@ss:Name" />
+ <xsl:call-template name="encode-as-cell-address">
+ <xsl:with-param name="string" select="concat('$', $worksheetName,'.$A$1')"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="table:expression">
+ <xsl:value-of select="substring( @ss:RefersTo, 2)"/>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </table:named-expressions>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="transform-advanced-filter">
+ <!-- transform the params of Advanced Filter.it's different from AutoFilter -->
+ <xsl:param name="target-value"/>
+ <xsl:param name="condition-pos"/>
+ <xsl:element name="table:database-range">
+ <xsl:variable name="target-range">
+ <xsl:call-template name="translate-expression">
+ <xsl:with-param name="cell-row-pos" select="0"/>
+ <xsl:with-param name="cell-column-pos" select="0"/>
+ <xsl:with-param name="expression" select="$target-value"/>
+ <xsl:with-param name="return-value" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="condition-range">
+ <xsl:call-template name="translate-expression">
+ <xsl:with-param name="cell-row-pos" select="0"/>
+ <xsl:with-param name="cell-column-pos" select="0"/>
+ <xsl:with-param name="expression" select="$condition-pos"/>
+ <xsl:with-param name="return-value" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="table:target-range-address">
+ <xsl:value-of select="$target-range"/>
+ </xsl:attribute>
+ <xsl:attribute name="table:name">
+ <xsl:value-of select="concat($target-range, '.filter')"/>
+ </xsl:attribute>
+ <xsl:element name="table:filter">
+ <xsl:attribute name="table:condition-source-range-address">
+ <xsl:value-of select="$condition-range"/>
+ </xsl:attribute>
+ <xsl:element name="table:filter-condition">
+ <xsl:attribute name="table:field-number">0</xsl:attribute>
+ <!-- The two attributes are recommended by OASIS -->
+ <xsl:attribute name="table:value"/>
+ <xsl:attribute name="table:operator"/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="x:AutoFilter">
+ <!-- for AutoFilter -->
+ <xsl:element name="table:database-range">
+ <xsl:attribute name="table:name">
+ <xsl:value-of select="concat(../@ss:Name,'_',@x:Range)"/>
+ </xsl:attribute>
+ <xsl:variable name="range">
+ <xsl:call-template name="translate-expression">
+ <xsl:with-param name="cell-row-pos" select="0"/>
+ <xsl:with-param name="cell-column-pos" select="0"/>
+ <xsl:with-param name="expression" select="@x:Range"/>
+ <xsl:with-param name="return-value" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="table:target-range-address">
+ <xsl:value-of select="concat('$',../@ss:Name,'.',$range)"/>
+ </xsl:attribute>
+ <xsl:attribute name="table:display-filter-buttons">true</xsl:attribute>
+ <xsl:element name="table:filter">
+ <xsl:call-template name="auto-filter-condition">
+ <xsl:with-param name="item-pos" select="1"/>
+ <xsl:with-param name="index" select="1"/>
+ <xsl:with-param name="total" select="count(./x:AutoFilterColumn)"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="auto-filter-condition">
+ <!--?? generate element of filter-condition for AutoCondition to get position of index -->
+ <xsl:param name="item-pos"/>
+ <xsl:param name="index"/>
+ <xsl:param name="total"/>
+ <xsl:if test="($index - 1 &lt; $total) or ($index - 1 = $total)">
+ <xsl:element name="table:filter-condition">
+ <xsl:attribute name="table:data-type">number</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="./x:AutoFilterColumn[position() = $item-pos]/@x:Type = 'TopPercent'">
+ <xsl:attribute name="table:operator">
+ <xsl:value-of select="'top value'"/>
+ </xsl:attribute>
+ <xsl:attribute name="table:value">
+ <xsl:value-of select="./x:AutoFilterColumn[position() = $item-pos]/@x:Value"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="./x:AutoFilterColumn[position() = $item-pos]/@x:Type = 'Top'">
+ <xsl:attribute name="table:operator">
+ <xsl:value-of select="'top values'"/>
+ </xsl:attribute>
+ <xsl:attribute name="table:value">
+ <xsl:value-of select="./x:AutoFilterColumn[position() = $item-pos]/@x:Value"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="./x:AutoFilterColumn[position() = $item-pos]/@x:Type = 'TopPercent'">
+ <xsl:attribute name="table:operator">
+ <xsl:value-of select="'top percent'"/>
+ </xsl:attribute>
+ <xsl:attribute name="table:value">
+ <xsl:value-of select="./x:AutoFilterColumn[position() = $item-pos]/@x:Value"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="./x:AutoFilterColumn[position() = $item-pos]/@x:Type = 'Bottom'">
+ <xsl:attribute name="table:operator">
+ <xsl:value-of select="'bottom values'"/>
+ </xsl:attribute>
+ <xsl:attribute name="table:value">
+ <xsl:value-of select="./x:AutoFilterColumn[position() = $item-pos]/@x:Value"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="./x:AutoFilterColumn[position() = $item-pos]/@x:Type = 'BottomPercent'">
+ <xsl:attribute name="table:operator">
+ <xsl:value-of select="'bottom percent'"/>
+ </xsl:attribute>
+ <xsl:attribute name="table:value">
+ <xsl:value-of select="./x:AutoFilterColumn[position() = $item-pos]/@x:Value"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="./x:AutoFilterColumn[position() = $item-pos]/@x:Type = 'Custom'">
+ <xsl:choose>
+ <xsl:when test="./x:AutoFilterColumn[position() = $item-pos]/x:AutoFilterOr or ./x:AutoFilterColumn[position() = $item-pos]/x:AutoFilterAnd">
+ <xsl:attribute name="table:operator">
+ <xsl:choose>
+ <xsl:when test="./x:AutoFilterColumn[position() = $item-pos]//@x:Operator = 'Equals'">
+ <xsl:value-of select="'='"/>
+ </xsl:when>
+ <xsl:when test="./x:AutoFilterColumn[position() = $item-pos]//@x:Operator = 'DoesNotEquals'">
+ <xsl:value-of select="'!='"/>
+ </xsl:when>
+ <xsl:when test="./x:AutoFilterColumn[position() = $item-pos]//@x:Operator = 'GreaterThan'">
+ <xsl:value-of select="'&gt;'"/>
+ </xsl:when>
+ <xsl:when test="./x:AutoFilterColumn[position() = $item-pos]//@x:Operator = 'GreaterThanOrEqual'">
+ <xsl:value-of select="'&gt;='"/>
+ </xsl:when>
+ <xsl:when test="./x:AutoFilterColumn[position() = $item-pos]//@x:Operator = 'LessThan'">
+ <xsl:value-of select="'&lt;'"/>
+ </xsl:when>
+ <xsl:when test="./x:AutoFilterColumn[position() = $item-pos]//@x:Operator = 'LessThanOrEqual'">
+ <xsl:value-of select="'&lt;='"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="'='"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:attribute name="table:value">
+ <xsl:value-of select="./x:AutoFilterColumn[position() = $item-pos]//@x:Value"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="table:operator">
+ <xsl:value-of select="'bottom percent'"/>
+ </xsl:attribute>
+ <xsl:attribute name="table:value">
+ <xsl:value-of select="./x:AutoFilterColumn[position() = $item-pos]//@x:Value"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:attribute name="table:field-number">
+ <xsl:choose>
+ <xsl:when test="./x:AutoFilterColumn[position() = $item-pos]/@x:Index">
+ <xsl:value-of select="./x:AutoFilterColumn[position() = $item-pos]/@x:Index - 1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$index - 1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:element>
+ <xsl:call-template name="auto-filter-condition">
+ <xsl:with-param name="item-pos" select="$item-pos + 1"/>
+ <xsl:with-param name="index">
+ <xsl:choose>
+ <xsl:when test="./x:AutoFilterColumn[position() = $item-pos]/@x:Index">
+ <xsl:value-of select="./x:AutoFilterColumn[position() = $item-pos]/@x:Index + 1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$index + 1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="total" select="count(./x:AutoFilterColumn)"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="x:Sorting">
+ <!-- for Sorting don't contains header row -->
+ <xsl:if test="contains(./x:Sort, 'Column')">
+ <xsl:element name="table:database-range">
+ <xsl:variable name="first-sort-letter" select="normalize-space(substring-after(./x:Sort[position() = 1], 'Column'))"/>
+ <xsl:variable name="second-sort-letter" select="normalize-space(substring-after(./x:Sort[position() = 2], 'Column'))"/>
+ <xsl:variable name="third-sort-letter" select="normalize-space(substring-after(./x:Sort[position() = 3], 'Column'))"/>
+ <xsl:variable name="first-sort-num">
+ <xsl:call-template name="letter-to-number">
+ <xsl:with-param name="source-letter" select="$first-sort-letter"/>
+ <xsl:with-param name="return-value" select="0"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="second-sort-num">
+ <xsl:call-template name="letter-to-number">
+ <xsl:with-param name="source-letter" select="$second-sort-letter"/>
+ <xsl:with-param name="return-value" select="0"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="third-sort-num">
+ <xsl:call-template name="letter-to-number">
+ <xsl:with-param name="source-letter" select="$third-sort-letter"/>
+ <xsl:with-param name="return-value" select="0"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="min-left-num">
+ <xsl:call-template name="min-of-three">
+ <xsl:with-param name="first-num" select="$first-sort-num"/>
+ <xsl:with-param name="second-num" select="$second-sort-num"/>
+ <xsl:with-param name="third-num" select="$third-sort-num"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="max-right-num">
+ <xsl:call-template name="max-of-three">
+ <xsl:with-param name="first-num" select="$first-sort-num"/>
+ <xsl:with-param name="second-num" select="$second-sort-num"/>
+ <xsl:with-param name="third-num" select="$third-sort-num"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="left-column">
+ <xsl:call-template name="number-to-letter">
+ <xsl:with-param name="source-number" select="$min-left-num"/>
+ <xsl:with-param name="return-value" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="right-column">
+ <xsl:call-template name="number-to-letter">
+ <xsl:with-param name="source-number" select="$max-right-num"/>
+ <xsl:with-param name="return-value" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="table:target-range-address">
+ <xsl:value-of select="concat(../@ss:Name, '.', $left-column, '1:', ../@ss:Name, '.', $right-column, '32000')"/>
+ </xsl:attribute>
+ <xsl:attribute name="table:name">
+ <xsl:value-of select="concat(../@ss:Name, '.sort')"/>
+ </xsl:attribute>
+ <xsl:attribute name="table:contains-header">
+ <xsl:value-of select="'false'"/>
+ </xsl:attribute>
+ <xsl:element name="table:sort">
+ <xsl:for-each select="./x:Sort">
+ <xsl:element name="table:sort-by">
+ <xsl:attribute name="table:field-number">
+ <xsl:value-of select="0"/>
+ </xsl:attribute>
+ <xsl:attribute name="table:data-type">
+ <xsl:value-of select="'automatic'"/>
+ </xsl:attribute>
+ <xsl:variable name="after-sort" select="following-sibling::*"/>
+ <xsl:if test="name($after-sort[position() = 1]) = 'Descending'">
+ <xsl:attribute name="table:order">
+ <xsl:value-of select="'descending'"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="position() = 1">
+ <xsl:attribute name="table:field-number">
+ <xsl:value-of select="$first-sort-num - $min-left-num"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="position() = 2">
+ <xsl:attribute name="table:field-number">
+ <xsl:value-of select="$second-sort-num - $min-left-num"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="position() = 3">
+ <xsl:attribute name="table:field-number">
+ <xsl:value-of select="$third-sort-num - $min-left-num"/>
+ </xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="letter-to-number">
+ <!-- convert letter to number for sorting. the string source-letter should be normalize-space and the first return-value should be zero -->
+ <xsl:param name="source-letter"/>
+ <xsl:param name="return-value"/>
+ <xsl:choose>
+ <xsl:when test="string-length($source-letter) &gt; 0">
+ <xsl:variable name="first-pit" select="substring($source-letter, 1, 1)"/>
+ <xsl:variable name="pit-number">
+ <xsl:choose>
+ <xsl:when test="($first-pit = 'A') or ($first-pit = 'a')">
+ <xsl:value-of select="1"/>
+ </xsl:when>
+ <xsl:when test="($first-pit = 'B') or ($first-pit = 'b')">
+ <xsl:value-of select="2"/>
+ </xsl:when>
+ <xsl:when test="($first-pit = 'C') or ($first-pit = 'c')">
+ <xsl:value-of select="3"/>
+ </xsl:when>
+ <xsl:when test="($first-pit = 'D') or ($first-pit = 'd')">
+ <xsl:value-of select="4"/>
+ </xsl:when>
+ <xsl:when test="($first-pit = 'E') or ($first-pit = 'e')">
+ <xsl:value-of select="5"/>
+ </xsl:when>
+ <xsl:when test="($first-pit = 'F') or ($first-pit = 'f')">
+ <xsl:value-of select="6"/>
+ </xsl:when>
+ <xsl:when test="($first-pit = 'G') or ($first-pit = 'g')">
+ <xsl:value-of select="7"/>
+ </xsl:when>
+ <xsl:when test="($first-pit = 'H') or ($first-pit = 'h')">
+ <xsl:value-of select="8"/>
+ </xsl:when>
+ <xsl:when test="($first-pit = 'I') or ($first-pit = 'i')">
+ <xsl:value-of select="9"/>
+ </xsl:when>
+ <xsl:when test="($first-pit = 'J') or ($first-pit = 'j')">
+ <xsl:value-of select="10"/>
+ </xsl:when>
+ <xsl:when test="($first-pit = 'K') or ($first-pit = 'k')">
+ <xsl:value-of select="11"/>
+ </xsl:when>
+ <xsl:when test="($first-pit = 'L') or ($first-pit = 'l')">
+ <xsl:value-of select="12"/>
+ </xsl:when>
+ <xsl:when test="($first-pit = 'M') or ($first-pit = 'm')">
+ <xsl:value-of select="13"/>
+ </xsl:when>
+ <xsl:when test="($first-pit = 'N') or ($first-pit = 'n')">
+ <xsl:value-of select="14"/>
+ </xsl:when>
+ <xsl:when test="($first-pit = 'O') or ($first-pit = 'o')">
+ <xsl:value-of select="15"/>
+ </xsl:when>
+ <xsl:when test="($first-pit = 'P') or ($first-pit = 'p')">
+ <xsl:value-of select="16"/>
+ </xsl:when>
+ <xsl:when test="($first-pit = 'Q') or ($first-pit = 'q')">
+ <xsl:value-of select="17"/>
+ </xsl:when>
+ <xsl:when test="($first-pit = 'R') or ($first-pit = 'r')">
+ <xsl:value-of select="18"/>
+ </xsl:when>
+ <xsl:when test="($first-pit = 'S') or ($first-pit = 's')">
+ <xsl:value-of select="19"/>
+ </xsl:when>
+ <xsl:when test="($first-pit = 'T') or ($first-pit = 't')">
+ <xsl:value-of select="20"/>
+ </xsl:when>
+ <xsl:when test="($first-pit = 'U') or ($first-pit = 'u')">
+ <xsl:value-of select="21"/>
+ </xsl:when>
+ <xsl:when test="($first-pit = 'V') or ($first-pit = 'v')">
+ <xsl:value-of select="22"/>
+ </xsl:when>
+ <xsl:when test="($first-pit = 'W') or ($first-pit = 'w')">
+ <xsl:value-of select="23"/>
+ </xsl:when>
+ <xsl:when test="($first-pit = 'X') or ($first-pit = 'x')">
+ <xsl:value-of select="24"/>
+ </xsl:when>
+ <xsl:when test="($first-pit = 'Y') or ($first-pit = 'y')">
+ <xsl:value-of select="25"/>
+ </xsl:when>
+ <xsl:when test="($first-pit = 'Z') or ($first-pit = 'z')">
+ <xsl:value-of select="26"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:call-template name="letter-to-number">
+ <xsl:with-param name="source-letter" select="substring($source-letter, 2)"/>
+ <xsl:with-param name="return-value">
+ <xsl:choose>
+ <xsl:when test="string-length($source-letter) &gt;= 2">
+ <xsl:value-of select="$pit-number * 26 + $return-value"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$pit-number + $return-value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$return-value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="number-to-letter">
+ <!--?? convert number to letter for sorting -->
+ <xsl:param name="source-number"/>
+ <xsl:param name="return-value"/>
+ <xsl:variable name="current-value">
+ <xsl:call-template name="num-conv-letter">
+ <xsl:with-param name="first-pit">
+ <xsl:choose>
+ <xsl:when test="$source-number &gt; 26">
+ <xsl:value-of select="floor($source-number div 26)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$source-number"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="$source-number &gt; 26">
+ <xsl:call-template name="number-to-letter">
+ <xsl:with-param name="source-number" select="$source-number mod 26"/>
+ <xsl:with-param name="return-value" select="concat($return-value,$current-value)"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="$source-number &lt; 27">
+ <xsl:value-of select="concat($return-value,$current-value)"/>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="num-conv-letter">
+ <!-- convert number to number by pit of 26 -->
+ <xsl:param name="first-pit"/>
+ <xsl:choose>
+ <xsl:when test="$first-pit = 1">
+ <xsl:value-of select="'A'"/>
+ </xsl:when>
+ <xsl:when test="$first-pit = 2">
+ <xsl:value-of select="'B'"/>
+ </xsl:when>
+ <xsl:when test="$first-pit = 3">
+ <xsl:value-of select="'C'"/>
+ </xsl:when>
+ <xsl:when test="$first-pit = 4">
+ <xsl:value-of select="'D'"/>
+ </xsl:when>
+ <xsl:when test="$first-pit = 5">
+ <xsl:value-of select="'E'"/>
+ </xsl:when>
+ <xsl:when test="$first-pit = 6">
+ <xsl:value-of select="'F'"/>
+ </xsl:when>
+ <xsl:when test="$first-pit = 7">
+ <xsl:value-of select="'G'"/>
+ </xsl:when>
+ <xsl:when test="$first-pit = 8">
+ <xsl:value-of select="'H'"/>
+ </xsl:when>
+ <xsl:when test="$first-pit = 9">
+ <xsl:value-of select="'I'"/>
+ </xsl:when>
+ <xsl:when test="$first-pit = 10">
+ <xsl:value-of select="'J'"/>
+ </xsl:when>
+ <xsl:when test="$first-pit = 11">
+ <xsl:value-of select="'K'"/>
+ </xsl:when>
+ <xsl:when test="$first-pit = 12">
+ <xsl:value-of select="'L'"/>
+ </xsl:when>
+ <xsl:when test="$first-pit = 13">
+ <xsl:value-of select="'M'"/>
+ </xsl:when>
+ <xsl:when test="$first-pit = 14">
+ <xsl:value-of select="'N'"/>
+ </xsl:when>
+ <xsl:when test="$first-pit = 15">
+ <xsl:value-of select="'O'"/>
+ </xsl:when>
+ <xsl:when test="$first-pit = 16">
+ <xsl:value-of select="'P'"/>
+ </xsl:when>
+ <xsl:when test="$first-pit = 17">
+ <xsl:value-of select="'Q'"/>
+ </xsl:when>
+ <xsl:when test="$first-pit = 18">
+ <xsl:value-of select="'R'"/>
+ </xsl:when>
+ <xsl:when test="$first-pit = 19">
+ <xsl:value-of select="'S'"/>
+ </xsl:when>
+ <xsl:when test="$first-pit = 20">
+ <xsl:value-of select="'T'"/>
+ </xsl:when>
+ <xsl:when test="$first-pit = 21">
+ <xsl:value-of select="'U'"/>
+ </xsl:when>
+ <xsl:when test="$first-pit = 22">
+ <xsl:value-of select="'V'"/>
+ </xsl:when>
+ <xsl:when test="$first-pit = 23">
+ <xsl:value-of select="'W'"/>
+ </xsl:when>
+ <xsl:when test="$first-pit = 24">
+ <xsl:value-of select="'X'"/>
+ </xsl:when>
+ <xsl:when test="$first-pit = 25">
+ <xsl:value-of select="'Y'"/>
+ </xsl:when>
+ <xsl:when test="$first-pit = 26">
+ <xsl:value-of select="'Z'"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="'A'"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="min-of-three">
+ <!-- return minest of three for sorting -->
+ <xsl:param name="first-num"/>
+ <xsl:param name="second-num"/>
+ <xsl:param name="third-num"/>
+ <xsl:variable name="first-comp">
+ <xsl:choose>
+ <xsl:when test="$first-num = 0">
+ <xsl:value-of select="$second-num"/>
+ </xsl:when>
+ <xsl:when test="($first-num &lt; $second-num) or ($second-num = 0)">
+ <xsl:value-of select="$first-num"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$second-num"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="second-comp">
+ <xsl:choose>
+ <xsl:when test="($first-comp &lt; $third-num) or ($third-num = 0)">
+ <xsl:value-of select="$first-comp"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$third-num"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:value-of select="$second-comp"/>
+ </xsl:template>
+ <xsl:template name="max-of-three">
+ <!-- return maxest of three for sorting -->
+ <xsl:param name="first-num"/>
+ <xsl:param name="second-num"/>
+ <xsl:param name="third-num"/>
+ <xsl:variable name="first-comp">
+ <xsl:choose>
+ <xsl:when test="$first-num &gt; $second-num">
+ <xsl:value-of select="$first-num"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$second-num"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="second-comp">
+ <xsl:choose>
+ <xsl:when test="$first-comp &gt; $third-num">
+ <xsl:value-of select="$first-comp"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$third-num"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:value-of select="$second-comp"/>
+ </xsl:template>
+ <xsl:template name="set-calculation">
+ <xsl:element name="table:calculation-settings">
+ <xsl:if test="/ss:Workbook/x:ExcelWorkbook/x:PrecisionAsDisplayed">
+ <xsl:attribute name="table:precision-as-shown">true</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="/ss:Workbook/x:ExcelWorkbook/x:Date1904">
+ <table:null-date office:date-value="1904-01-01"/>
+ </xsl:if>
+ <xsl:element name="table:iteration">
+ <xsl:if test="/ss:Workbook/x:ExcelWorkbook/x:Iteration">
+ <xsl:attribute name="table:status">enable</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="/ss:Workbook/x:ExcelWorkbook/x:MaxIterations">
+ <xsl:attribute name="table:steps">
+ <xsl:value-of select="/ss:Workbook/x:ExcelWorkbook/x:MaxIterations"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="/ss:Workbook/x:ExcelWorkbook/x:MaxChange">
+ <xsl:attribute name="table:maximum-difference">
+ <xsl:value-of select="/ss:Workbook/x:ExcelWorkbook/x:MaxChange"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="x:DataValidation">
+ <!-- for DataValidation. don't support the attribute IMEMode currently. -->
+ <xsl:element name="table:content-validation">
+ <xsl:attribute name="table:name">
+ <xsl:value-of select="concat('val', position())"/>
+ </xsl:attribute>
+ <xsl:attribute name="table:condition"><!-- don't support two type of qualifier: List, Custom -->
+ <xsl:variable name="qualifier-content">
+ <xsl:choose>
+ <xsl:when test="./x:Qualifier = 'NotBetween'">
+ <xsl:value-of select="concat('cell-content-is-not-between(', ./x:Min, ',', ./x:Max, ')')"/>
+ </xsl:when>
+ <xsl:when test="./x:Qualifier = 'NotEqual'">
+ <xsl:value-of select="concat('!=', ./x:Value)"/>
+ </xsl:when>
+ <xsl:when test="./x:Qualifier = 'Equal'">
+ <xsl:value-of select="concat('=', ./x:Value)"/>
+ </xsl:when>
+ <xsl:when test="./x:Qualifier = 'Less'">
+ <xsl:value-of select="concat('&lt;', ./x:Value)"/>
+ </xsl:when>
+ <xsl:when test="./x:Qualifier = 'Greater'">
+ <xsl:value-of select="concat('&gt;', ./x:Value)"/>
+ </xsl:when>
+ <xsl:when test="./x:Qualifier = 'GreaterOrEqual'">
+ <xsl:value-of select="concat('&gt;=', ./x:Value)"/>
+ </xsl:when>
+ <xsl:when test="./x:Qualifier = 'LessOrEqual'">
+ <xsl:value-of select="concat('&lt;=', ./x:Value)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat('cell-content-is-between(', ./x:Min, ',', ./x:Max)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="qualifier-value">
+ <xsl:choose>
+ <xsl:when test="./x:Type = 'Whole'">
+ <xsl:choose>
+ <xsl:when test="(./x:Qualifier = 'NotBetween') or ./x:Max">
+ <xsl:value-of select="concat('cell-content-is-whole-number() and ', $qualifier-content, ')')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat('cell-content-is-whole-number() and ', 'cell-content()', $qualifier-content)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="./x:Type = 'Decimal'">
+ <xsl:choose>
+ <xsl:when test="(./x:Qualifier = 'NotBetween') or ./x:Max">
+ <xsl:value-of select="concat('cell-content-is-decimal-number() and ', $qualifier-content, ')')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat('cell-content-is-decimal-number() and ', 'cell-content()', $qualifier-content)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="./x:Type = 'Date'">
+ <xsl:choose>
+ <xsl:when test="(./x:Qualifier = 'NotBetween') or ./x:Max">
+ <xsl:value-of select="concat('cell-content-is-date() and ', $qualifier-content, ')')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat('cell-content-is-date() and ', 'cell-content()', $qualifier-content)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="./x:Type = 'Time'">
+ <xsl:choose>
+ <xsl:when test="(./x:Qualifier = 'NotBetween') or ./x:Max">
+ <xsl:value-of select="concat('cell-content-is-time() and ', $qualifier-content, ')')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat('cell-content-is-time() and ', 'cell-content()', $qualifier-content)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="./x:Type = 'TextLength'">
+ <xsl:choose>
+ <xsl:when test="./x:Qualifier = 'NotBetween'">
+ <xsl:value-of select="concat('cell-content-text-length-is-not-between(', ./x:Min, ',', ./x:Max, ')')"/>
+ </xsl:when>
+ <xsl:when test="./x:Max and ./x:Min">
+ <xsl:value-of select="concat('cell-content-text-length-is-between(', ./x:Min, ',', ./x:Max, ')')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat('cell-content-text-length()', $qualifier-content)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="./x:Type"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:value-of select="$qualifier-value"/>
+ </xsl:attribute>
+ <xsl:attribute name="table:base-cell-address">
+ <xsl:variable name="first-range">
+ <xsl:choose>
+ <xsl:when test="contains(./x:Range, ',')">
+ <xsl:value-of select="substring-before(./x:Range, ',')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="./x:Range"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="range">
+ <xsl:call-template name="translate-expression">
+ <xsl:with-param name="cell-row-pos" select="0"/>
+ <xsl:with-param name="cell-column-pos" select="0"/>
+ <xsl:with-param name="expression" select="$first-range"/>
+ <xsl:with-param name="return-value" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="encode-as-cell-address">
+ <xsl:with-param name="string" select="concat(../../ss:Worksheet/@ss:Name, '.', $range)"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:element name="table:help-message">
+ <xsl:attribute name="table:title">
+ <xsl:value-of select="./x:InputTitle"/>
+ </xsl:attribute>
+ <xsl:attribute name="table:display">
+ <xsl:choose>
+ <xsl:when test="./x:InputHide">
+ <xsl:value-of select="'false'"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="'true'"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:element name="text:p">
+ <xsl:value-of select="./x:InputMessage"/>
+ </xsl:element>
+ </xsl:element>
+ <xsl:element name="table:error-message">
+ <xsl:attribute name="table:message-type">
+ <xsl:choose>
+ <xsl:when test="./x:ErrorStyle= 'Info'">
+ <xsl:value-of select="'information'"/>
+ </xsl:when>
+ <xsl:when test="./x:ErrorStyle= 'Warn'">
+ <xsl:value-of select="'warning'"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="'stop'"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:attribute name="table:title">
+ <xsl:value-of select="./x:ErrorTitle"/>
+ </xsl:attribute>
+ <xsl:attribute name="table:display">
+ <xsl:choose>
+ <xsl:when test="./x:ErrorHide">
+ <xsl:value-of select="'false'"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="'true'"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:element name="text:p">
+ <xsl:value-of select="./x:ErrorMessage"/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <!-- Note: Move template to common section -->
+ <xsl:template name="encode-as-cell-range-address">
+ <xsl:param name="string"/>
+ <xsl:value-of select="$string"/>
+ </xsl:template>
+ <xsl:template name="encode-as-cell-address">
+ <xsl:param name="string"/>
+ <xsl:value-of select="$string"/>
+ </xsl:template>
+ <xsl:template name="encode-as-nc-name">
+ <xsl:param name="string"/>
+ <xsl:value-of select="translate($string, '.%()/\+[]', '')"/>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/filter/source/xslt/import/uof/uof2odf_presentation.xsl b/filter/source/xslt/import/uof/uof2odf_presentation.xsl
new file mode 100644
index 000000000000..8e03235c63bc
--- /dev/null
+++ b/filter/source/xslt/import/uof/uof2odf_presentation.xsl
@@ -0,0 +1,3478 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:uof="http://schemas.uof.org/cn/2003/uof" xmlns:表="http://schemas.uof.org/cn/2003/uof-spreadsheet" xmlns:演="http://schemas.uof.org/cn/2003/uof-slideshow" xmlns:字="http://schemas.uof.org/cn/2003/uof-wordproc" xmlns:图="http://schemas.uof.org/cn/2003/graph" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:smil="urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0" xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" office:version="1.0">
+ <xsl:output method="xml" indent="no" encoding="UTF-8" version="1.0"/>
+ <xsl:template match="uof:UOF">
+ <office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:smil="urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0" xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" office:version="1.0">
+ <xsl:apply-templates select="uof:元数æ®"/>
+ <office:settings>
+ <xsl:variable name="PageNumberFormat" select="/uof:UOF/uof:演示文稿/æ¼”:公用处ç†è§„则/æ¼”:页é¢è®¾ç½®é›†/æ¼”:页é¢è®¾ç½®/æ¼”:页ç æ ¼å¼[1]"/>
+ <xsl:variable name="proportion">
+ <xsl:value-of select="substring-before(/uof:UOF/uof:演示文稿/æ¼”:公用处ç†è§„则/æ¼”:显示比例,'%')"/>
+ </xsl:variable>
+ <config:config-item-set config:name="ooo:view-settings">
+ <config:config-item config:name="VisibleAreaTop" config:type="int">0</config:config-item>
+ <config:config-item config:name="VisibleAreaLeft" config:type="int">0</config:config-item>
+ <config:config-item config:name="VisibleAreaWidth" config:type="int">14098</config:config-item>
+ <config:config-item config:name="VisibleAreaHeight" config:type="int">9998</config:config-item>
+ <config:config-item-map-indexed config:name="Views">
+ <config:config-item-map-entry>
+ <config:config-item config:name="ViewId" config:type="string">view1</config:config-item>
+ <config:config-item config:name="GridIsVisible" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="GridIsFront" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="IsSnapToGrid" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="IsSnapToPageMargins" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="IsSnapToSnapLines" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="IsSnapToObjectFrame" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="IsSnapToObjectPoints" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="IsPlusHandlesAlwaysVisible" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="IsFrameDragSingles" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="EliminatePolyPointLimitAngle" config:type="int">1500</config:config-item>
+ <config:config-item config:name="IsEliminatePolyPoints" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="VisibleLayers" config:type="base64Binary">//////////////////////////////////////////8=</config:config-item>
+ <config:config-item config:name="PrintableLayers" config:type="base64Binary">//////////////////////////////////////////8=</config:config-item>
+ <config:config-item config:name="LockedLayers" config:type="base64Binary"/>
+ <config:config-item config:name="NoAttribs" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="NoColors" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="RulerIsVisible" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="PageKind" config:type="short">0</config:config-item>
+ <config:config-item config:name="SelectedPage" config:type="short">0</config:config-item>
+ <config:config-item config:name="IsLayerMode" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="IsBigHandles" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="IsDoubleClickTextEdit" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="IsClickChangeRotation" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="SlidesPerRow" config:type="short">4</config:config-item>
+ <config:config-item config:name="EditModeStandard" config:type="int">0</config:config-item>
+ <config:config-item config:name="EditModeNotes" config:type="int">0</config:config-item>
+ <config:config-item config:name="EditModeHandout" config:type="int">1</config:config-item>
+ <config:config-item config:name="VisibleAreaTop" config:type="int">-5402</config:config-item>
+ <config:config-item config:name="VisibleAreaLeft" config:type="int">-441</config:config-item>
+ <config:config-item config:name="VisibleAreaWidth" config:type="int">
+ <xsl:value-of select="(100*13997) div $proportion"/>
+ </config:config-item>
+ <config:config-item config:name="VisibleAreaHeight" config:type="int">
+ <xsl:value-of select="(100*15426) div $proportion"/>
+ </config:config-item>
+ <config:config-item config:name="GridCoarseWidth" config:type="int">1000</config:config-item>
+ <config:config-item config:name="GridCoarseHeight" config:type="int">1000</config:config-item>
+ <config:config-item config:name="GridFineWidth" config:type="int">500</config:config-item>
+ <config:config-item config:name="GridFineHeight" config:type="int">500</config:config-item>
+ <config:config-item config:name="GridSnapWidth" config:type="int">1000</config:config-item>
+ <config:config-item config:name="GridSnapHeight" config:type="int">1000</config:config-item>
+ <config:config-item config:name="GridSnapWidthXNumerator" config:type="int">500</config:config-item>
+ <config:config-item config:name="GridSnapWidthXDenominator" config:type="int">1</config:config-item>
+ <config:config-item config:name="GridSnapWidthYNumerator" config:type="int">500</config:config-item>
+ <config:config-item config:name="GridSnapWidthYDenominator" config:type="int">1</config:config-item>
+ <config:config-item config:name="IsAngleSnapEnabled" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="SnapAngle" config:type="int">1500</config:config-item>
+ <config:config-item config:name="ZoomOnPage" config:type="boolean">true</config:config-item>
+ </config:config-item-map-entry>
+ </config:config-item-map-indexed>
+ </config:config-item-set>
+ <config:config-item-set config:name="ooo:configuration-settings">
+ <config:config-item config:name="PageNumberFormat" config:type="int">
+ <xsl:choose>
+ <xsl:when test="/uof:UOF/uof:演示文稿/æ¼”:公用处ç†è§„则/æ¼”:页é¢è®¾ç½®é›†/æ¼”:页é¢è®¾ç½®/æ¼”:页ç æ ¼å¼">
+ <xsl:choose>
+ <xsl:when test="$PageNumberFormat='upper-letter'">0</xsl:when>
+ <xsl:when test="$PageNumberFormat='lower-letter'">1</xsl:when>
+ <xsl:when test="$PageNumberFormat='upper-roman'">2</xsl:when>
+ <xsl:when test="$PageNumberFormat='lower-letter'">3</xsl:when>
+ <xsl:when test="$PageNumberFormat='decimal'">4</xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>5</xsl:otherwise>
+ </xsl:choose>
+ </config:config-item>
+ </config:config-item-set>
+ </office:settings>
+ <office:scripts/>
+ <xsl:element name="office:font-face-decls">
+ <style:font-face style:name="宋体" svg:font-family="宋体" style:font-family-generic="swiss" style:font-pitch="variable"/>
+ <xsl:apply-templates select="uof:å¼æ ·é›†/uof:字体集"/>
+ </xsl:element>
+ <office:styles>
+ <xsl:apply-templates select="uof:演示文稿/æ¼”:公用处ç†è§„则/æ¼”:页é¢ç‰ˆå¼é›†/æ¼”:页é¢ç‰ˆå¼"/>
+ <xsl:call-template name="ç¼–å·å­—体"/>
+ <xsl:for-each select="uof:å¼æ ·é›†/uof:段è½å¼æ ·">
+ <xsl:variable name="outline" select="@字:标识符"/>
+ <xsl:choose>
+ <xsl:when test="/uof:UOF/uof:å¼æ ·é›†/uof:自动编å·é›†/å­—:自动编å·[@å­—:标识符=$outline]">
+ <xsl:call-template name="段è½å¼æ ·"/>
+ </xsl:when>
+ <xsl:when test="contains($outline,'outline')">
+ <xsl:call-template name="段è½å¼æ ·"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+ </office:styles>
+ <office:automatic-styles>
+ <xsl:apply-templates select="uof:演示文稿/æ¼”:公用处ç†è§„则/æ¼”:é…色方案集/æ¼”:é…色方案"/>
+ <xsl:apply-templates select="uof:å¼æ ·é›†/uof:å¥å¼æ ·"/>
+ <xsl:for-each select="uof:å¼æ ·é›†/uof:段è½å¼æ ·">
+ <xsl:variable name="outline" select="@字:标识符"/>
+ <xsl:if test="not(/uof:UOF/uof:å¼æ ·é›†/uof:自动编å·é›†/å­—:自动编å·[@å­—:标识符=$outline]) and not(contains($outline,'outline'))">
+ <xsl:call-template name="段è½å¼æ ·"/>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:apply-templates select="uof:对象集"/>
+ <xsl:call-template name="create-page-master">
+ <xsl:with-param name="impressoptions" select="uof:演示文稿/æ¼”:公用处ç†è§„则/æ¼”:页é¢è®¾ç½®é›†/æ¼”:页é¢è®¾ç½®"/>
+ </xsl:call-template>
+ <xsl:for-each select="/uof:UOF/uof:对象集/图:图形/图:文本内容/å­—:段è½/å­—:段è½å±žæ€§/å­—:自动编å·ä¿¡æ¯">
+ <xsl:variable name="currlistid" select="@å­—:ç¼–å·å¼•ç”¨"/>
+ <xsl:variable name="currlist" select="."/>
+ <xsl:variable name="rootlist" select="/uof:UOF/uof:å¼æ ·é›†/uof:自动编å·é›†/å­—:自动编å·[@å­—:标识符 =$currlistid]"/>
+ <xsl:if test="not(ancestor::å­—:段è½/preceding-sibling::å­—:段è½[1]/å­—:段è½å±žæ€§/å­—:自动编å·ä¿¡æ¯/@å­—:ç¼–å·å¼•ç”¨= $currlistid)">
+ <xsl:element name="text:list-style">
+ <xsl:attribute name="style:name">List<xsl:value-of select="count(preceding::å­—:自动编å·ä¿¡æ¯)"/></xsl:attribute>
+ <xsl:for-each select="$rootlist">
+ <xsl:call-template name="自动编å·"/>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:if>
+ </xsl:for-each>
+ </office:automatic-styles>
+ <office:master-styles>
+ <xsl:apply-templates select="uof:演示文稿/æ¼”:主体/æ¼”:æ¯ç‰ˆé›†"/>
+ </office:master-styles>
+ <office:body>
+ <office:presentation>
+ <xsl:apply-templates select="uof:演示文稿/æ¼”:主体/æ¼”:å¹»ç¯ç‰‡é›†"/>
+ <xsl:apply-templates select="uof:演示文稿/æ¼”:公用处ç†è§„则/æ¼”:放映设置"/>
+ </office:presentation>
+ </office:body>
+ </office:document>
+ </xsl:template>
+ <xsl:template match="演:放映设置">
+ <presentation:settings>
+ <xsl:variable name="start-page">
+ <xsl:choose>
+ <xsl:when test="contains(æ¼”:å¹»ç¯ç‰‡åºåˆ—,' ')">
+ <xsl:value-of select="substring-before(æ¼”:å¹»ç¯ç‰‡åºåˆ—,' ')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="æ¼”:å¹»ç¯ç‰‡åºåˆ—"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="first-page">
+ <xsl:value-of select="/uof:UOF/uof:演示文稿/æ¼”:主体/æ¼”:å¹»ç¯ç‰‡é›†/æ¼”:å¹»ç¯ç‰‡[1]/@æ¼”:å称"/>
+ </xsl:variable>
+ <xsl:if test="not($start-page = $first-page)">
+ <xsl:attribute name="presentation:start-page"><xsl:value-of select="$start-page"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="æ¼”:å…¨å±æ”¾æ˜ ='false'">
+ <xsl:attribute name="presentation:full-screen">false</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="演:循环放映='true'">
+ <xsl:attribute name="presentation:endless">true</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="演:放映间隔">
+ <xsl:attribute name="presentation:pause"><xsl:variable name="OOtime"><xsl:value-of select="substring-after(演:放映间隔,'P0Y0M0DT')"/></xsl:variable><xsl:value-of select="concat('PT',$OOtime)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="æ¼”:手动方å¼='true'">
+ <xsl:attribute name="presentation:force-manual">true</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="演:导航帮助='true'">
+ <xsl:attribute name="presentation:start-with-navigator">true</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="演:放映动画='false'">
+ <xsl:attribute name="presentation:animations">disabled</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="æ¼”:å‰ç«¯æ˜¾ç¤º='true'">
+ <xsl:attribute name="presentation:stay-on-top">true</xsl:attribute>
+ </xsl:if>
+ </presentation:settings>
+ </xsl:template>
+ <xsl:template name="自动编å·">
+ <xsl:for-each select="字:级别">
+ <xsl:choose>
+ <xsl:when test="å­—:项目符å·">
+ <xsl:call-template name="xiangmufuhao">
+ <xsl:with-param name="biaoshifu" select="../@字:标识符"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="å­—:图片符å·å¼•ç”¨">
+ <xsl:call-template name="imagefuhao">
+ <xsl:with-param name="biaoshifu" select="../@字:标识符"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="jibianhao">
+ <xsl:with-param name="biaoshifu" select="../@字:标识符"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="ç¼–å·å­—体">
+ <xsl:for-each select="/uof:UOF/uof:å¼æ ·é›†/uof:自动编å·é›†/å­—:自动编å·">
+ <xsl:if test="å­—:级别/å­—:符å·å­—体">
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name"><xsl:value-of select="concat( @字:标识符,字:级别/@字:级别值)"/></xsl:attribute>
+ <xsl:attribute name="style:family">text</xsl:attribute>
+ <xsl:element name="style:text-properties">
+ <xsl:attribute name="fo:color"><xsl:value-of select="å­—:级别/å­—:符å·å­—体/å­—:字体/@å­—:颜色"/></xsl:attribute>
+ <xsl:if test="å­—:级别/å­—:符å·å­—体/å­—:粗体 and å­—:级别/å­—:符å·å­—体/å­—:粗体/@å­—:值='true'">
+ <xsl:attribute name="fo:font-weight">bold</xsl:attribute>
+ <xsl:attribute name="style:font-style-asian">bold</xsl:attribute>
+ </xsl:if>
+ <xsl:variable name="ziti">
+ <xsl:value-of select="å­—:级别/å­—:符å·å­—体/å­—:字体/@å­—:中文字体引用"/>
+ </xsl:variable>
+ <xsl:for-each select="/uof:UOF/uof:å¼æ ·é›†/uof:字体集/uof:字体声明">
+ <xsl:if test="@uof:标识符=$ziti">
+ <xsl:attribute name="style:font-name"><xsl:value-of select="@uof:å称"/></xsl:attribute>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:attribute name="fo:font-style">normal</xsl:attribute>
+ <xsl:attribute name="style:font-weight-asian">normal</xsl:attribute>
+ </xsl:element>
+ </xsl:element>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template match="uof:对象集">
+ <xsl:apply-templates select="图:图形"/>
+ <xsl:apply-templates select="图:图形/图:文本内容/å­—:段è½/å­—:å¥/å­—:å¥å±žæ€§" mode="style"/>
+ </xsl:template>
+ <xsl:variable name="uofUnit">
+ <xsl:variable name="uu">
+ <xsl:value-of select="/uof:UOF/uof:演示文稿/æ¼”:公用处ç†è§„则/æ¼”:度é‡å•ä½"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$uu='cm'">cm</xsl:when>
+ <xsl:when test="$uu='mm'">mm</xsl:when>
+ <xsl:when test="$uu='pt'">pt</xsl:when>
+ <xsl:when test="$uu='inch'">inch</xsl:when>
+ <xsl:otherwise>pt</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="other-to-cm-conversion-factor">
+ <xsl:choose>
+ <xsl:when test="$uofUnit='cm'">1</xsl:when>
+ <xsl:when test="$uofUnit='mm'">0.1</xsl:when>
+ <xsl:when test="$uofUnit='pt'">0.03527</xsl:when>
+ <xsl:when test="$uofUnit='inch'">2.54</xsl:when>
+ <xsl:when test="$uofUnit='pica'">0.4233</xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:key match="/uof:UOF/uof:演示文稿/æ¼”:主体/æ¼”:æ¯ç‰ˆé›†/æ¼”:æ¯ç‰ˆ/uof:锚点 | /uof:UOF/uof:演示文稿/æ¼”:主体/æ¼”:å¹»ç¯ç‰‡é›†/æ¼”:å¹»ç¯ç‰‡/uof:锚点 | /uof:UOF/uof:演示文稿/æ¼”:主体/æ¼”:å¹»ç¯ç‰‡é›†/æ¼”:å¹»ç¯ç‰‡/æ¼”:å¹»ç¯ç‰‡å¤‡æ³¨/uof:锚点" name="rel_graphic_name" use="@uof:图形引用"/>
+ <xsl:template match="图:图形">
+ <xsl:variable name="random-name">
+ <xsl:value-of select="generate-id()"/>
+ </xsl:variable>
+ <xsl:variable name="draw-name">
+ <xsl:value-of select="substring($random-name,string-length($random-name)-1)"/>
+ </xsl:variable>
+ <xsl:call-template name="graphic-fill">
+ <xsl:with-param name="draw-name" select="$draw-name"/>
+ <xsl:with-param name="gradient-name" select="图:预定义图形/图:属性/图:å¡«å……/图:æ¸å˜"/>
+ </xsl:call-template>
+ <xsl:variable name="biaozhifu" select="@图:标识符"/>
+ <xsl:choose>
+ <xsl:when test="图:预定义图形/图:属性/图:å¡«å……/图:æ¸å˜">
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name"><xsl:value-of select="@图:标识符"/></xsl:attribute>
+ <xsl:attribute name="style:family"><xsl:choose><xsl:when test="图:预定义图形/图:类别='3' or 图:预定义图形/图:类别='67'">presentation</xsl:when><xsl:otherwise>graphic</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="/uof:UOF/uof:演示文稿/æ¼”:主体/æ¼”:æ¯ç‰ˆé›†/æ¼”:æ¯ç‰ˆ/uof:锚点[@uof:图形引用=$biaozhifu]">
+ <xsl:variable name="duan" select="图:文本内容/å­—:段è½/å­—:段è½å±žæ€§/@å­—:å¼æ ·å¼•ç”¨"/>
+ <xsl:attribute name="style:parent-style-name"><xsl:value-of select="/uof:UOF/uof:å¼æ ·é›†/uof:段è½å¼æ ·[@å­—:标识符=$duan]/@å­—:基å¼æ ·å¼•ç”¨"/></xsl:attribute>
+ </xsl:if>
+ <xsl:element name="style:graphic-properties">
+ <xsl:call-template name="process-graphics">
+ <xsl:with-param name="draw-name" select="$draw-name"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name"><xsl:value-of select="@图:标识符"/></xsl:attribute>
+ <xsl:attribute name="style:family"><xsl:choose><xsl:when test="图:预定义图形/图:类别='3' or 图:预定义图形/图:类别='67'">presentation</xsl:when><xsl:otherwise>graphic</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="/uof:UOF/uof:演示文稿/æ¼”:主体/æ¼”:æ¯ç‰ˆé›†/æ¼”:æ¯ç‰ˆ/uof:锚点[@uof:图形引用=$biaozhifu]">
+ <xsl:variable name="duan" select="图:文本内容/å­—:段è½/å­—:段è½å±žæ€§/@å­—:å¼æ ·å¼•ç”¨"/>
+ <xsl:attribute name="style:parent-style-name"><xsl:value-of select="/uof:UOF/uof:å¼æ ·é›†/uof:段è½å¼æ ·[@å­—:标识符=$duan]/@å­—:基å¼æ ·å¼•ç”¨"/></xsl:attribute>
+ </xsl:if>
+ <xsl:element name="style:graphic-properties">
+ <xsl:if test="@图:其他对象">
+ <xsl:attribute name="fo:clip">rect(0cm 0cm 0cm 0cm)</xsl:attribute>
+ <xsl:attribute name="draw:color-mode">standard</xsl:attribute>
+ <xsl:attribute name="draw:luminance">0%</xsl:attribute>
+ <xsl:attribute name="draw:contrast">0%</xsl:attribute>
+ <xsl:attribute name="draw:gamma">100%</xsl:attribute>
+ <xsl:attribute name="draw:red">0%</xsl:attribute>
+ <xsl:attribute name="draw:green">0%</xsl:attribute>
+ <xsl:attribute name="draw:blue">0%</xsl:attribute>
+ <xsl:attribute name="draw:image-opacity">100%</xsl:attribute>
+ <xsl:attribute name="style:mirror">none</xsl:attribute>
+ </xsl:if>
+ <xsl:call-template name="process-graphics"/>
+ </xsl:element>
+ <xsl:if test="图:文本内容/@图:文字排列方å‘='vert-r2l' or 图:文本内容/@图:文字排列方å‘='vert-l2r'">
+ <xsl:element name="style:paragraph-properties">
+ <xsl:attribute name="style:writing-mode">tb-rl</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="process-graphics">
+ <xsl:param name="draw-name"/>
+ <xsl:if test="not(key('rel_graphic_name',@图:标识符)/@uof:éšåŠ¨æ–¹å¼='movesize')">
+ <xsl:attribute name="style:protect"><xsl:choose><xsl:when test="key('rel_graphic_name',@图:标识符)/@uof:éšåŠ¨æ–¹å¼='move'">size</xsl:when><xsl:otherwise>position size</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="not(图:预定义图形/图:属性/图:填充)">
+ <xsl:attribute name="draw:fill">none</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:填充/图:图片">
+ <xsl:attribute name="draw:fill">bitmap</xsl:attribute>
+ <xsl:attribute name="draw:fill-image-name"><xsl:value-of select="图:预定义图形/图:属性/图:å¡«å……/图:图片/@图:å称"/></xsl:attribute>
+ <xsl:if test="not(图:预定义图形/图:属性/图:å¡«å……/图:图片/@图:ä½ç½®='title')">
+ <xsl:attribute name="style:repeat"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:å¡«å……/图:图片/@图:ä½ç½®='center'">no-repeat</xsl:when><xsl:when test="图:预定义图形/图:属性/图:å¡«å……/图:图片/@图:ä½ç½®='stretch'">stretch</xsl:when></xsl:choose></xsl:attribute>
+ </xsl:if>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:填充/图:图案">
+ <xsl:attribute name="draw:fill">bitmap</xsl:attribute>
+ <xsl:attribute name="draw:fill-color"><xsl:value-of select="图:预定义图形/图:属性/图:å¡«å……/图:图案/@图:å‰æ™¯è‰²"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:填充/图:颜色">
+ <xsl:attribute name="draw:fill">solid</xsl:attribute>
+ <xsl:attribute name="draw:fill-color"><xsl:value-of select="图:预定义图形/图:属性/图:填充/图:颜色"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:å¡«å……/图:æ¸å˜">
+ <xsl:attribute name="draw:fill">gradient</xsl:attribute>
+ <xsl:attribute name="draw:fill-color"><xsl:value-of select="图:预定义图形/图:属性/图:å¡«å……/图:æ¸å˜/@图:起始色"/></xsl:attribute>
+ <xsl:attribute name="draw:fill-gradient-name"><xsl:value-of select="concat('Gradient ',$draw-name)"/></xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="图:预定义图形/图:属性/图:线颜色">
+ <xsl:attribute name="svg:stroke-color"><xsl:value-of select="图:预定义图形/图:属性/图:线颜色"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="图:预定义图形/图:属性/图:线型 and not(图:预定义图形/图:属性/图:线型 = 'single') and not(图:预定义图形/图:属性/图:线型 = 'thick')">
+ <xsl:variable name="linetype" select="图:预定义图形/图:属性/图:线型"/>
+ <xsl:attribute name="draw:stroke"><xsl:choose><xsl:when test="$linetype='none'">none</xsl:when><xsl:otherwise>dash</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="draw:stroke-dash"><xsl:choose><xsl:when test="$linetype='dot-dot-dash' or $linetype='dash-dot-dot-heavy'">_32__20_Dots_20_1_20_Dash</xsl:when><xsl:when test="$linetype='dash' or $linetype='dashed-heavy'">Ultrafine_20_Dashed</xsl:when><xsl:when test="$linetype='dotted' or $linetype='dotted-heavy'">Ultrafine_20_Dotted_20__28_var_29_</xsl:when><xsl:when test="$linetype='double'">Line_20_with_20_Fine_20_Dots</xsl:when><xsl:when test="$linetype='dot-dash' or $linetype='dash-dot-heavy'">_33__20_Dashes_20_3_20_Dots_20__28_var_29_</xsl:when><xsl:when test="$linetype='wave' or $linetype='wavy-heavy'">Ultrafine_20_2_20_Dots_20_3_20_Dashes</xsl:when><xsl:when test="$linetype='wavy-double'">Fine_20_Dashed_20__28_var_29_</xsl:when><xsl:otherwise>Fine Dashed</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="图:预定义图形/图:属性/图:线粗细">
+ <xsl:attribute name="svg:stroke-width"><xsl:value-of select="concat(图:预定义图形/图:属性/图:线粗细,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´">
+ <xsl:attribute name="draw:marker-start"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¼æ ·='normal'">Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¼æ ·='open'">Line_20_Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¼æ ·='stealth'">Arrow_20_concave</xsl:when><xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¼æ ·='oval'">Circle</xsl:when><xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¼æ ·='diamond'">Square_20_45</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:if test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:大å°">
+ <xsl:attribute name="draw:marker-start-width"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¤§å° = '1'"><xsl:value-of select="concat('0.05',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¤§å° = '2'"><xsl:value-of select="concat('0.10',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¤§å° = '3'"><xsl:value-of select="concat('0.15',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¤§å° = '4'"><xsl:value-of select="concat('0.20',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¤§å° = '5'"><xsl:value-of select="concat('0.25',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¤§å° = '6'"><xsl:value-of select="concat('0.30',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¤§å° = '7'"><xsl:value-of select="concat('0.35',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¤§å° = '8'"><xsl:value-of select="concat('0.40',$uofUnit)"/></xsl:when><xsl:otherwise><xsl:value-of select="concat('0.45',$uofUnit)"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´">
+ <xsl:attribute name="draw:marker-end"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¼æ ·='normal'">Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¼æ ·='open'">Line_20_Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¼æ ·='stealth'">Arrow_20_concave</xsl:when><xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¼æ ·='oval'">Circle</xsl:when><xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¼æ ·='diamond'">Square_20_45</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:if test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:大å°">
+ <xsl:attribute name="draw:marker-end-width"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¤§å° = '1'"><xsl:value-of select="concat('0.05',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¤§å° = '2'"><xsl:value-of select="concat('0.10',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¤§å° = '3'"><xsl:value-of select="concat('0.15',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¤§å° = '4'"><xsl:value-of select="concat('0.20',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¤§å° = '5'"><xsl:value-of select="concat('0.25',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¤§å° = '6'"><xsl:value-of select="concat('0.30',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¤§å° = '7'"><xsl:value-of select="concat('0.35',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¤§å° = '8'"><xsl:value-of select="concat('0.40',$uofUnit)"/></xsl:when><xsl:otherwise><xsl:value-of select="concat('0.45',$uofUnit)"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="图:预定义图形/图:属性/图:é€æ˜Žåº¦">
+ <xsl:attribute name="draw:opacity"><xsl:variable name="opacity"><xsl:value-of select="./图:预定义图形/图:属性/图:é€æ˜Žåº¦"/></xsl:variable><xsl:value-of select="concat((1 - $opacity)*100,'%')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="图:文本内容">
+ <xsl:for-each select="图:文本内容">
+ <xsl:if test="@图:上边è·">
+ <xsl:attribute name="fo:padding-top"><xsl:value-of select="concat(@图:上边è·,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:padding-bottom"><xsl:value-of select="concat(@图:下边è·,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:padding-left"><xsl:value-of select="concat(@图:左边è·,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:padding-right"><xsl:value-of select="concat(@图:å³è¾¹è·,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="not(@图:文字排列方å‘='middle')">
+ <xsl:variable name="hori-or-vert" select="@图:文字排列方å‘"/>
+ <xsl:choose>
+ <xsl:when test="$hori-or-vert='vert-l2r'">
+ <xsl:attribute name="draw:textarea-vertical-align">bottom</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$hori-or-vert='hori-l2r'">
+ <xsl:attribute name="draw:textarea-horizontal-align">left</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$hori-or-vert='hori-r2l'">
+ <xsl:attribute name="draw:textarea-horizontal-align">right</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$hori-or-vert"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="@图:自动æ¢è¡Œ">
+ <xsl:attribute name="fo:wrap-option">no-wrap</xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="draw:auto-grow-width"><xsl:choose><xsl:when test="@图:大å°é€‚应文字">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:for-each>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="bina_graphic">
+ <xsl:param name="refGraphic"/>
+ <xsl:element name="office:binary-data">
+ <xsl:for-each select="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符 = $refGraphic]">
+ <xsl:value-of select="uof:æ•°æ®"/>
+ </xsl:for-each>
+ </xsl:element>
+ <text:p/>
+ </xsl:template>
+ <xsl:template name="graphic-fill">
+ <xsl:param name="draw-name"/>
+ <xsl:param name="gradient-name"/>
+ <xsl:if test="图:预定义图形/图:属性/图:å¡«å……/图:æ¸å˜">
+ <xsl:element name="draw:gradient">
+ <xsl:attribute name="draw:name"><xsl:value-of select="concat('Gradient ',$draw-name)"/></xsl:attribute>
+ <xsl:attribute name="draw:style"><xsl:choose><xsl:when test="$gradient-name/@图:ç§å­ç±»åž‹='linear'"><xsl:value-of select="'linear'"/></xsl:when><xsl:when test="$gradient-name/@图:ç§å­ç±»åž‹='radar'"><xsl:value-of select="'radial'"/></xsl:when><xsl:when test="$gradient-name/@图:ç§å­ç±»åž‹='oval'"><xsl:value-of select="'ellipsoid'"/></xsl:when><xsl:when test="$gradient-name/@图:ç§å­ç±»åž‹='square'"><xsl:value-of select="'square'"/></xsl:when><xsl:when test="$gradient-name/@图:ç§å­ç±»åž‹='rectangle'"><xsl:value-of select="'rectangular'"/></xsl:when></xsl:choose></xsl:attribute>
+ <xsl:attribute name="draw:start-color"><xsl:value-of select="$gradient-name/@图:起始色"/></xsl:attribute>
+ <xsl:attribute name="draw:end-color"><xsl:value-of select="$gradient-name/@图:终止色"/></xsl:attribute>
+ <xsl:attribute name="draw:start-intensity"><xsl:value-of select="concat($gradient-name/@图:起始浓度,'%')"/></xsl:attribute>
+ <xsl:attribute name="draw:end-intensity"><xsl:value-of select="concat($gradient-name/@图:终止浓度,'%')"/></xsl:attribute>
+ <xsl:attribute name="draw:angle"><xsl:value-of select="$gradient-name/@图:æ¸å˜æ–¹å‘ * 10"/></xsl:attribute>
+ <xsl:attribute name="draw:border"><xsl:value-of select="concat($gradient-name/@图:边界,'%')"/></xsl:attribute>
+ <xsl:if test="$gradient-name/@图:ç§å­Xä½ç½®">
+ <xsl:attribute name="draw:cx"><xsl:value-of select="concat($gradient-name/@图:ç§å­Xä½ç½®,'%')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$gradient-name/@图:ç§å­Yä½ç½®">
+ <xsl:attribute name="draw:cy"><xsl:value-of select="concat($gradient-name/@图:ç§å­Yä½ç½®,'%')"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´">
+ <xsl:element name="draw:marker">
+ <xsl:attribute name="draw:name"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¼æ ·='normal'">Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¼æ ·='open'">Line_20_Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¼æ ·='stealth'">Arrow_20_concave</xsl:when><xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¼æ ·='oval'">Circle</xsl:when><xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¼æ ·='diamond'">Square_20_45</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¼æ ·='normal'">
+ <xsl:attribute name="svg:viewBox">0 0 20 30</xsl:attribute>
+ <xsl:attribute name="svg:d">m10 0-10 30h20z</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¼æ ·='open'">
+ <xsl:attribute name="svg:viewBox">0 0 1122 2243</xsl:attribute>
+ <xsl:attribute name="svg:d">m0 2108v17 17l12 42 30 34 38 21 43 4 29-8 30-21 25-26 13-34 343-1532 339 1520 13 42 29 34 39 21 42 4 42-12 34-30 21-42v-39-12l-4 4-440-1998-9-42-25-39-38-25-43-8-42 8-38 25-26 39-8 42z</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¼æ ·='stealth'">
+ <xsl:attribute name="svg:viewBox">0 0 1131 1580</xsl:attribute>
+ <xsl:attribute name="svg:d">m1013 1491 118 89-567-1580-564 1580 114-85 136-68 148-46 161-17 161 13 153 46z</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¼æ ·='oval'">
+ <xsl:attribute name="svg:viewBox">0 0 1131 1131</xsl:attribute>
+ <xsl:attribute name="svg:d">m462 1118-102-29-102-51-93-72-72-93-51-102-29-102-13-105 13-102 29-106 51-102 72-89 93-72 102-50 102-34 106-9 101 9 106 34 98 50 93 72 72 89 51 102 29 106 13 102-13 105-29 102-51 102-72 93-93 72-98 51-106 29-101 13z</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¼æ ·='diamond'">
+ <xsl:attribute name="svg:viewBox">0 0 1131 1131</xsl:attribute>
+ <xsl:attribute name="svg:d">m0 564 564 567 567-567-567-564z</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´">
+ <xsl:element name="draw:marker">
+ <xsl:attribute name="draw:name"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¼æ ·='normal'">Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¼æ ·='open'">Line_20_Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¼æ ·='stealth'">Arrow_20_concave</xsl:when><xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¼æ ·='oval'">Circle</xsl:when><xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¼æ ·='diamond'">Square_20_45</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¼æ ·='normal'">
+ <xsl:attribute name="svg:viewBox">0 0 20 30</xsl:attribute>
+ <xsl:attribute name="svg:d">m10 0-10 30h20z</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¼æ ·='open'">
+ <xsl:attribute name="svg:viewBox">0 0 1122 2243</xsl:attribute>
+ <xsl:attribute name="svg:d">m0 2108v17 17l12 42 30 34 38 21 43 4 29-8 30-21 25-26 13-34 343-1532 339 1520 13 42 29 34 39 21 42 4 42-12 34-30 21-42v-39-12l-4 4-440-1998-9-42-25-39-38-25-43-8-42 8-38 25-26 39-8 42z</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¼æ ·='stealth'">
+ <xsl:attribute name="svg:viewBox">0 0 1131 1580</xsl:attribute>
+ <xsl:attribute name="svg:d">m1013 1491 118 89-567-1580-564 1580 114-85 136-68 148-46 161-17 161 13 153 46z</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¼æ ·='oval'">
+ <xsl:attribute name="svg:viewBox">0 0 1131 1131</xsl:attribute>
+ <xsl:attribute name="svg:d">m462 1118-102-29-102-51-93-72-72-93-51-102-29-102-13-105 13-102 29-106 51-102 72-89 93-72 102-50 102-34 106-9 101 9 106 34 98 50 93 72 72 89 51 102 29 106 13 102-13 105-29 102-51 102-72 93-93 72-98 51-106 29-101 13z</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¼æ ·='diamond'">
+ <xsl:attribute name="svg:viewBox">0 0 1131 1131</xsl:attribute>
+ <xsl:attribute name="svg:d">m0 564 564 567 567-567-567-564z</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="图:预定义图形/图:属性/图:填充/图:图片/@图:图形引用 or 图:预定义图形/图:属性/图:填充/图:图案/@图:图形引用">
+ <xsl:element name="draw:fill-image">
+ <xsl:attribute name="draw:name"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:å¡«å……/图:图案/@图:图形引用"><xsl:value-of select="图:预定义图形/图:属性/图:å¡«å……/图:图案/@图:类型"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:å¡«å……/图:图片/@图:图形引用"><xsl:value-of select="图:预定义图形/图:属性/图:å¡«å……/图:图片/@图:å称"/></xsl:when></xsl:choose></xsl:attribute>
+ <xsl:call-template name="bina_graphic">
+ <xsl:with-param name="refGraphic">
+ <xsl:choose>
+ <xsl:when test="图:预定义图形/图:属性/图:填充/图:图案/@图:图形引用">
+ <xsl:value-of select="图:预定义图形/图:属性/图:填充/图:图案/@图:图形引用"/>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:填充/图:图片/@图:图形引用">
+ <xsl:value-of select="图:预定义图形/图:属性/图:填充/图:图片/@图:图形引用"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="not(图:预定义图形/图:属性/图:线型='single') and not(图:预定义图形/图:属性/图:线型='thick') and 图:预定义图形/图:属性/图:线型">
+ <xsl:variable name="line" select="图:预定义图形/图:属性/图:线型"/>
+ <xsl:element name="draw:stroke-dash">
+ <xsl:choose>
+ <xsl:when test="$line='dash-long' or $line='dash-long-heavy'">
+ <xsl:attribute name="draw:name">Fine_20_Dashed</xsl:attribute>
+ <xsl:attribute name="draw:display-name">Fine dashed</xsl:attribute>
+ <xsl:attribute name="draw:style">rect</xsl:attribute>
+ <xsl:attribute name="draw:dots1">1</xsl:attribute>
+ <xsl:attribute name="draw:dots1-length">0.508cm</xsl:attribute>
+ <xsl:attribute name="draw:dots2">1</xsl:attribute>
+ <xsl:attribute name="draw:dots2-length">0.508cm</xsl:attribute>
+ <xsl:attribute name="draw:distance">0.508cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$line='dot-dot-dash' or $line='dash-dot-dot-heavy'">
+ <xsl:attribute name="draw:name">_32__20_Dots_20_1_20_Dash</xsl:attribute>
+ <xsl:attribute name="draw:display-name">2 Dots 1 Dash</xsl:attribute>
+ <xsl:attribute name="draw:style">rect</xsl:attribute>
+ <xsl:attribute name="draw:dots1">2</xsl:attribute>
+ <xsl:attribute name="draw:dots2">1</xsl:attribute>
+ <xsl:attribute name="draw:dots2-length">0.203cm</xsl:attribute>
+ <xsl:attribute name="draw:distance">0.203cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$line='dash' or $line='dashed-heavy'">
+ <xsl:attribute name="draw:name">Ultrafine_20_Dashed</xsl:attribute>
+ <xsl:attribute name="draw:display-name">Ultrafine Dashed</xsl:attribute>
+ <xsl:attribute name="draw:style">rect</xsl:attribute>
+ <xsl:attribute name="draw:dots1">1</xsl:attribute>
+ <xsl:attribute name="draw:dots1-length">0.051cm</xsl:attribute>
+ <xsl:attribute name="draw:dots2">1</xsl:attribute>
+ <xsl:attribute name="draw:dots2-length">0.051cm</xsl:attribute>
+ <xsl:attribute name="draw:distance">0.051cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$line='dotted' or $line='dotted-heavy'">
+ <xsl:attribute name="draw:name">Ultrafine_20_Dotted_20__28_var_29_</xsl:attribute>
+ <xsl:attribute name="draw:display-name">Ultrafine Dotted (var)</xsl:attribute>
+ <xsl:attribute name="draw:style">rect</xsl:attribute>
+ <xsl:attribute name="draw:dots1">1</xsl:attribute>
+ <xsl:attribute name="draw:distance">50%</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$line='wave' or $line='wavy-heavy'">
+ <xsl:attribute name="draw:name">Ultrafine_20_2_20_Dots_20_3_20_Dashes</xsl:attribute>
+ <xsl:attribute name="draw:display-name">Ultrafine 2 Dots 3 Dashes</xsl:attribute>
+ <xsl:attribute name="draw:style">rect</xsl:attribute>
+ <xsl:attribute name="draw:dots1">2</xsl:attribute>
+ <xsl:attribute name="draw:dots1-length">0.051cm</xsl:attribute>
+ <xsl:attribute name="draw:dots2">3</xsl:attribute>
+ <xsl:attribute name="draw:dots2-length">0.254cm</xsl:attribute>
+ <xsl:attribute name="draw:distance">0.127cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$line='dot-dash' or $line='dash-dot-heavy'">
+ <xsl:attribute name="draw:name">_33__20_Dashes_20_3_20_Dots_20__28_var_29_</xsl:attribute>
+ <xsl:attribute name="draw:display-name">3 Dashes 3 Dots (var)</xsl:attribute>
+ <xsl:attribute name="draw:style">rect</xsl:attribute>
+ <xsl:attribute name="draw:dots1">3</xsl:attribute>
+ <xsl:attribute name="draw:dots1-length">197%</xsl:attribute>
+ <xsl:attribute name="draw:dots2">3</xsl:attribute>
+ <xsl:attribute name="draw:distance">100%</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$line='double'">
+ <xsl:attribute name="draw:name">Line_20_with_20_Fine_20_Dots</xsl:attribute>
+ <xsl:attribute name="draw:display-name">Line with Fine Dots</xsl:attribute>
+ <xsl:attribute name="draw:style">rect</xsl:attribute>
+ <xsl:attribute name="draw:dots1">1</xsl:attribute>
+ <xsl:attribute name="draw:dots1-length">2.007cm</xsl:attribute>
+ <xsl:attribute name="draw:dots2">10</xsl:attribute>
+ <xsl:attribute name="draw:distance">0.152cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$line='wavy-double'">
+ <xsl:attribute name="draw:name">Fine_20_Dashed_20__28_var_29_</xsl:attribute>
+ <xsl:attribute name="draw:display-name">Fine Dashed (var)</xsl:attribute>
+ <xsl:attribute name="draw:style">rect</xsl:attribute>
+ <xsl:attribute name="draw:dots1">1</xsl:attribute>
+ <xsl:attribute name="draw:dots1-length">197%</xsl:attribute>
+ <xsl:attribute name="draw:distance">197%</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="draw:name">Fine Dashed</xsl:attribute>
+ <xsl:attribute name="draw:style">rect</xsl:attribute>
+ <xsl:attribute name="draw:dots1">1</xsl:attribute>
+ <xsl:attribute name="draw:dots1-length">0.508cm</xsl:attribute>
+ <xsl:attribute name="draw:dots2">1</xsl:attribute>
+ <xsl:attribute name="draw:dots2-length">0.508cm</xsl:attribute>
+ <xsl:attribute name="draw:distance">0.508cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="create-page-master">
+ <xsl:param name="impressoptions"/>
+ <xsl:for-each select="$impressoptions">
+ <xsl:element name="style:page-layout">
+ <xsl:attribute name="style:name"><xsl:call-template name="encode-as-nc-name"><xsl:with-param name="string" select="@演:标识符"/></xsl:call-template></xsl:attribute>
+ <xsl:element name="style:page-layout-properties">
+ <xsl:if test="演:纸张/@uof:宽度">
+ <xsl:attribute name="fo:page-width"><xsl:value-of select="concat(演:纸张/@uof:宽度,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="演:纸张/@uof:高度">
+ <xsl:attribute name="fo:page-height"><xsl:value-of select="concat((演:纸张/@uof:高度),$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="æ¼”:页边è·">
+ <xsl:attribute name="fo:margin-top"><xsl:value-of select="concat(æ¼”:页边è·/@uof:上,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:margin-bottom"><xsl:value-of select="concat(æ¼”:页边è·/@uof:下,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:margin-left"><xsl:value-of select="concat(æ¼”:页边è·/@uof:å·¦,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:margin-right"><xsl:value-of select="concat(æ¼”:页边è·/@uof:å³,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="æ¼”:çº¸å¼ æ–¹å‘ = 'landscape'">
+ <xsl:attribute name="style:print-orientation">landscape</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:print-orientation">portrait</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="encode-as-nc-name">
+ <xsl:param name="string"/>
+ <xsl:value-of select="translate($string, '. %()/\+', '')"/>
+ </xsl:template>
+ <xsl:key name="tianchongmu" match="/uof:UOF/uof:演示文稿/æ¼”:主体/æ¼”:æ¯ç‰ˆé›†/æ¼”:æ¯ç‰ˆ" use="@æ¼”:é…色方案引用"/>
+ <xsl:key name="tianchonghuan" match="/uof:UOF/uof:演示文稿/æ¼”:主体/æ¼”:å¹»ç¯ç‰‡é›†/æ¼”:å¹»ç¯ç‰‡" use="@æ¼”:标识符"/>
+ <xsl:template match="æ¼”:é…色方案">
+ <xsl:if test="key('tianchongmu',@演:标识符)/演:背景">
+ <xsl:for-each select="key('tianchongmu',@演:标识符)/演:背景">
+ <xsl:call-template name="officestyle"/>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:if test="key('tianchonghuan',@演:标识符)/演:背景">
+ <xsl:for-each select="key('tianchonghuan',@演:标识符)/演:背景">
+ <xsl:call-template name="officestyle"/>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:family">drawing-page</xsl:attribute>
+ <xsl:attribute name="style:name"><xsl:value-of select="@演:标识符"/></xsl:attribute>
+ <xsl:element name="style:drawing-page-properties">
+ <xsl:if test="æ¼”:å¡«å……">
+ <xsl:attribute name="draw:fill">solid</xsl:attribute>
+ <xsl:attribute name="draw:fill-color"><xsl:value-of select="演:背景色"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="演:背景色">
+ <xsl:attribute name="draw:background-size">border</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="演:阴影">
+ <xsl:attribute name="draw:shadow">visible</xsl:attribute>
+ <xsl:attribute name="draw:shadow-color"><xsl:value-of select="演:阴影"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="æ¼”:文本和线æ¡">
+ <xsl:attribute name="svg:stroke-color"><xsl:value-of select="æ¼”:文本和线æ¡"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="key('tianchongmu',@演:标识符)/演:背景">
+ <xsl:for-each select="key('tianchongmu',@演:标识符)/演:背景">
+ <xsl:call-template name="background"/>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:if test="key('tianchonghuan',@演:标识符)/演:背景">
+ <xsl:for-each select="key('tianchonghuan',@演:标识符)/演:背景">
+ <xsl:call-template name="background"/>
+ </xsl:for-each>
+ </xsl:if>
+ </xsl:element>
+ <xsl:variable name="style-name">
+ <xsl:value-of select="@演:标识符"/>
+ </xsl:variable>
+ <xsl:for-each select="/uof:UOF/uof:演示文稿/æ¼”:主体/æ¼”:å¹»ç¯ç‰‡é›†/æ¼”:å¹»ç¯ç‰‡[@æ¼”:标识符=$style-name]/æ¼”:切æ¢">
+ <style:drawing-page-properties>
+ <xsl:if test="@演:速度='slow'">
+ <xsl:attribute name="presentation:transition-speed">slow</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="not(@演:效果 = 'none')">
+ <xsl:variable name="effect">
+ <xsl:value-of select="@演:效果"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$effect='box in'">
+ <xsl:attribute name="smil:type">irisWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">rectangle</xsl:attribute>
+ <xsl:attribute name="smil:direction">reverse</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='box out'">
+ <xsl:attribute name="smil:type">irisWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">rectangle</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='checkerboard across'">
+ <xsl:attribute name="smil:type">checkerBoardWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">across</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='checkerboard down'">
+ <xsl:attribute name="smil:type">checkerBoardWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">down</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='comb horizontal'">
+ <xsl:attribute name="smil:type">pushWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">combHorizontal</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='comb vertical'">
+ <xsl:attribute name="smil:type">pushWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">combVertical</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='uncover down'">
+ <xsl:attribute name="smil:type">slideWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">fromTop</xsl:attribute>
+ <xsl:attribute name="smil:direction">reverse</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='uncover left'">
+ <xsl:attribute name="smil:type">slideWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">fromRight</xsl:attribute>
+ <xsl:attribute name="smil:direction">reverse</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='uncover right'">
+ <xsl:attribute name="smil:type">slideWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">fromLeft</xsl:attribute>
+ <xsl:attribute name="smil:direction">reverse</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='uncover up'">
+ <xsl:attribute name="smil:type">slideWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">fromBottom</xsl:attribute>
+ <xsl:attribute name="smil:direction">reverse</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='uncover left-down'">
+ <xsl:attribute name="smil:type">slideWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">fromTopRight</xsl:attribute>
+ <xsl:attribute name="smil:direction">reverse</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='uncover left-up'">
+ <xsl:attribute name="smil:type">slideWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">fromBottomRight</xsl:attribute>
+ <xsl:attribute name="smil:direction">reverse</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='uncover right-down'">
+ <xsl:attribute name="smil:type">slideWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">fromTopLeft</xsl:attribute>
+ <xsl:attribute name="smil:direction">reverse</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='uncover right-up'">
+ <xsl:attribute name="smil:type">slideWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">fromBottomLeft</xsl:attribute>
+ <xsl:attribute name="smil:direction">reverse</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='cover down'">
+ <xsl:attribute name="smil:type">slideWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">fromTop</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='cover left'">
+ <xsl:attribute name="smil:type">slideWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">fromRight</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='cover right'">
+ <xsl:attribute name="smil:type">slideWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">fromLeft</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='cover up'">
+ <xsl:attribute name="smil:type">slideWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">fromBottom</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='cover left-down'">
+ <xsl:attribute name="smil:type">slideWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">fromTopRight</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='cover left-up'">
+ <xsl:attribute name="smil:type">slideWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">fromBottomRight</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='cover right-down'">
+ <xsl:attribute name="smil:type">slideWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">fromTopLeft</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='cover right-up'">
+ <xsl:attribute name="smil:type">slideWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">fromBottomLeft</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='fade through black'">
+ <xsl:attribute name="smil:type">fade</xsl:attribute>
+ <xsl:attribute name="smil:subtype">fadeOverColor</xsl:attribute>
+ <xsl:attribute name="smil:fadeColor">#000000</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='push down'">
+ <xsl:attribute name="smil:type">pushWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">fromTop</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='push left'">
+ <xsl:attribute name="smil:type">pushWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">fromRight</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='push right'">
+ <xsl:attribute name="smil:type">pushWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">fromLeft</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='push up'">
+ <xsl:attribute name="smil:type">pushWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">fromBottom</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='random bars horizontal'">
+ <xsl:attribute name="smil:type">randomBarWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">horizontal</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='random bars vertical'">
+ <xsl:attribute name="smil:type">randomBarWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">vertical</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='shape circle'">
+ <xsl:attribute name="smil:type">ellipseWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">circle</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='shape diamond'">
+ <xsl:attribute name="smil:type">irisWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">diamond</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='shape plus'">
+ <xsl:attribute name="smil:type">fourBoxWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">cornersOut</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='split horizontal in'">
+ <xsl:attribute name="smil:type">barnDoorWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">horizontal</xsl:attribute>
+ <xsl:attribute name="smil:direction">reverse</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='split horizontal out'">
+ <xsl:attribute name="smil:type">barnDoorWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">horizontal</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='split vertical in'">
+ <xsl:attribute name="smil:type">barnDoorWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">vertical</xsl:attribute>
+ <xsl:attribute name="smil:direction">reverse</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='split vertical out'">
+ <xsl:attribute name="smil:type">barnDoorWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">vertical</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='wedge'">
+ <xsl:attribute name="smil:type">fanWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">centerTop</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='wheel clockwise – 1 spoke'">
+ <xsl:attribute name="smil:type">pinWheelWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">oneBlade</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='wheel clockwise – 2 spoke'">
+ <xsl:attribute name="smil:type">pinWheelWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">twoBladeVertical</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='wheel clockwise – 3 spoke'">
+ <xsl:attribute name="smil:type">pinWheelWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">threeBlade</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='wheel clockwise – 4 spoke'">
+ <xsl:attribute name="smil:type">pinWheelWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">fourBlade</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='wheel clockwise – 8 spoke'">
+ <xsl:attribute name="smil:type">pinWheelWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">eightBlade</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='wipe left'">
+ <xsl:attribute name="smil:type">barWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">leftToRight</xsl:attribute>
+ <xsl:attribute name="smil:direction">reverse</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='wipe right'">
+ <xsl:attribute name="smil:type">barWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">leftToRight</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='wipe up'">
+ <xsl:attribute name="smil:type">barWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">topToBottom</xsl:attribute>
+ <xsl:attribute name="smil:direction">reverse</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='wipe down'">
+ <xsl:attribute name="smil:type">barWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">topToBottom</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='blinds vertical'">
+ <xsl:attribute name="smil:type">blindsWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">vertical</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='blinds horizontal'">
+ <xsl:attribute name="smil:type">blindsWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">horizontal</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='dissolve'">
+ <xsl:attribute name="smil:type">dissolve</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='random transition'">
+ <xsl:attribute name="smil:type">random</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="æ¼”:æ–¹å¼/æ¼”:å•å‡»é¼ æ ‡='false'">
+ <xsl:attribute name="presentation:transition-type">automatic</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="æ¼”:æ–¹å¼/æ¼”:时间间隔">
+ <xsl:attribute name="presentation:duration"><xsl:value-of select="concat('PT00H00M',æ¼”:æ–¹å¼/æ¼”:时间间隔,'S')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="(演:声音/@演:预定义声音 and not(演:声音/@演:预定义声音='none')) or 演:声音/@演:自定义声音">
+ <xsl:choose>
+ <xsl:when test="演:声音/@演:预定义声音">
+ <xsl:variable name="voice">
+ <xsl:value-of select="演:声音/@演:预定义声音"/>
+ </xsl:variable>
+ <presentation:sound xlink:type="simple" xlink:show="new" xlink:actuate="onRequest">
+ <xsl:attribute name="xlink:href"><xsl:choose><xsl:when test="$voice='applause'">../../../../../../../softwware/Redoffcie%203.0/share/gallery/sounds/applause.wav</xsl:when><xsl:when test="$voice='explosion'">../../../../../../../softwware/Redoffcie%203.0/share/gallery/sounds/explos.wav</xsl:when><xsl:when test="$voice='laser'">../../../../../../../softwware/Redoffcie%203.0/share/gallery/sounds/laser.wav</xsl:when><xsl:otherwise><xsl:value-of select="演:声音/@演:预定义声音"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </presentation:sound>
+ </xsl:when>
+ <xsl:otherwise>
+ <presentation:sound xlink:type="simple" xlink:show="new" xlink:actuate="onRequest">
+ <xsl:attribute name="xlink:href"><xsl:value-of select="演:声音/@演:自定义声音"/></xsl:attribute>
+ </presentation:sound>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </style:drawing-page-properties>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="officestyle">
+ <xsl:variable name="random-name">
+ <xsl:value-of select="generate-id()"/>
+ </xsl:variable>
+ <xsl:variable name="draw-name">
+ <xsl:value-of select="substring($random-name,string-length($random-name)-1)"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="图:æ¸å˜">
+ <xsl:element name="draw:gradient">
+ <xsl:attribute name="draw:name"><xsl:value-of select="concat('Gradient ',$draw-name)"/></xsl:attribute>
+ <xsl:attribute name="draw:style"><xsl:choose><xsl:when test="图:æ¸å˜/@图:ç§å­ç±»åž‹='linear'"><xsl:value-of select="'linear'"/></xsl:when><xsl:when test="图:æ¸å˜/@图:ç§å­ç±»åž‹='radar'"><xsl:value-of select="'radial'"/></xsl:when><xsl:when test="图:æ¸å˜/@图:ç§å­ç±»åž‹='oval'"><xsl:value-of select="'ellipsoid'"/></xsl:when><xsl:when test="图:æ¸å˜/@图:ç§å­ç±»åž‹='square'"><xsl:value-of select="'square'"/></xsl:when><xsl:when test="图:æ¸å˜/@图:ç§å­ç±»åž‹='rectangle'"><xsl:value-of select="'rectangular'"/></xsl:when></xsl:choose></xsl:attribute>
+ <xsl:attribute name="draw:start-color"><xsl:value-of select="图:æ¸å˜/@图:起始色"/></xsl:attribute>
+ <xsl:attribute name="draw:end-color"><xsl:value-of select="图:æ¸å˜/@图:终止色"/></xsl:attribute>
+ <xsl:attribute name="draw:start-intensity"><xsl:value-of select="concat(图:æ¸å˜/@图:起始浓度,'%')"/></xsl:attribute>
+ <xsl:attribute name="draw:end-intensity"><xsl:value-of select="concat(图:æ¸å˜/@图:终止浓度,'%')"/></xsl:attribute>
+ <xsl:attribute name="draw:angle"><xsl:value-of select="图:æ¸å˜/@图:æ¸å˜æ–¹å‘ * 10"/></xsl:attribute>
+ <xsl:attribute name="draw:border"><xsl:value-of select="concat(图:æ¸å˜/@图:边界,'%')"/></xsl:attribute>
+ <xsl:if test="图:æ¸å˜/@图:ç§å­Xä½ç½®">
+ <xsl:attribute name="draw:cx"><xsl:value-of select="concat(图:æ¸å˜/@图:ç§å­Xä½ç½®,'%')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="图:æ¸å˜/@图:ç§å­Yä½ç½®">
+ <xsl:attribute name="draw:cy"><xsl:value-of select="concat(图:æ¸å˜/@图:ç§å­Yä½ç½®,'%')"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="图:图片/@图:图形引用 or 图:图案/@图:图形引用">
+ <xsl:element name="draw:fill-image">
+ <xsl:attribute name="draw:name"><xsl:choose><xsl:when test="图:图案/@图:图形引用"><xsl:value-of select="图:图案/@图:类型"/></xsl:when><xsl:when test="图:图片/@图:图形引用"><xsl:value-of select="图:图片/@图:å称"/></xsl:when></xsl:choose></xsl:attribute>
+ <xsl:call-template name="bina_graphic">
+ <xsl:with-param name="refGraphic">
+ <xsl:choose>
+ <xsl:when test="图:图案/@图:图形引用">
+ <xsl:value-of select="图:图案/@图:图形引用"/>
+ </xsl:when>
+ <xsl:when test="图:图片/@图:图形引用">
+ <xsl:value-of select="图:图片/@图:图形引用"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="background">
+ <xsl:variable name="random-name">
+ <xsl:value-of select="generate-id()"/>
+ </xsl:variable>
+ <xsl:variable name="draw-name">
+ <xsl:value-of select="substring($random-name,string-length($random-name)-1)"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="图:图片">
+ <xsl:attribute name="draw:fill">bitmap</xsl:attribute>
+ <xsl:attribute name="draw:fill-image-name"><xsl:value-of select="图:图片/@图:å称"/></xsl:attribute>
+ <xsl:if test="not(图:图片/@图:ä½ç½®='title')">
+ <xsl:attribute name="style:repeat"><xsl:choose><xsl:when test="图:图片/@图:ä½ç½®='center'">no-repeat</xsl:when><xsl:when test="图:图片/@图:ä½ç½®='stretch'">stretch</xsl:when></xsl:choose></xsl:attribute>
+ </xsl:if>
+ </xsl:when>
+ <xsl:when test="图:图案">
+ <xsl:attribute name="draw:fill">bitmap</xsl:attribute>
+ <xsl:attribute name="draw:fill-color"><xsl:value-of select="图:图案/@图:å‰æ™¯è‰²"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:颜色">
+ <xsl:attribute name="draw:fill-color"><xsl:value-of select="图:颜色"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:æ¸å˜">
+ <xsl:attribute name="draw:fill">gradient</xsl:attribute>
+ <xsl:attribute name="draw:fill-color"><xsl:value-of select="图:æ¸å˜/@图:起始色"/></xsl:attribute>
+ <xsl:attribute name="draw:fill-gradient-name"><xsl:value-of select="concat('Gradient ',$draw-name)"/></xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="æ¼”:æ¯ç‰ˆé›†">
+ <draw:layer-set>
+ <draw:layer draw:name="layout"/>
+ <draw:layer draw:name="background"/>
+ <draw:layer draw:name="backgroundobjects"/>
+ <draw:layer draw:name="controls"/>
+ <draw:layer draw:name="measurelines"/>
+ </draw:layer-set>
+ <xsl:apply-templates select="æ¼”:æ¯ç‰ˆ"/>
+ </xsl:template>
+ <xsl:template match="æ¼”:æ¯ç‰ˆ">
+ <xsl:choose>
+ <xsl:when test="@演:类型 = 'handout' ">
+ <xsl:element name="style:handout-master">
+ <xsl:attribute name="style:name"><xsl:value-of select="@演:标识符"/></xsl:attribute>
+ <xsl:attribute name="style:page-layout-name"><xsl:value-of select="@æ¼”:页é¢è®¾ç½®å¼•ç”¨"/></xsl:attribute>
+ <xsl:attribute name="draw:style-name"><xsl:value-of select="@æ¼”:é…色方案引用"/></xsl:attribute>
+ <xsl:for-each select="uof:锚点[@uof:缩略图='true']">
+ <draw:page-thumbnail draw:layer="backgroundobjects">
+ <xsl:attribute name="svg:width"><xsl:value-of select="concat(@uof:宽度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:height"><xsl:value-of select="concat(@uof:高度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:x"><xsl:value-of select="concat(@uof:xåæ ‡,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:y"><xsl:value-of select="concat(@uof:yåæ ‡,$uofUnit)"/></xsl:attribute>
+ </draw:page-thumbnail>
+ </xsl:for-each>
+ <xsl:apply-templates select="uof:锚点[not(@uof:缩略图='true')]"/>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="@演:类型 = 'slide'">
+ <xsl:element name="style:master-page">
+ <xsl:attribute name="style:name"><xsl:value-of select="@演:标识符"/></xsl:attribute>
+ <xsl:attribute name="style:page-layout-name"><xsl:value-of select="@æ¼”:页é¢è®¾ç½®å¼•ç”¨"/></xsl:attribute>
+ <xsl:attribute name="draw:style-name"><xsl:value-of select="@æ¼”:é…色方案引用"/></xsl:attribute>
+ <xsl:apply-templates select="uof:锚点 "/>
+ <xsl:for-each select="/uof:UOF/uof:演示文稿/æ¼”:主体/æ¼”:æ¯ç‰ˆé›†/æ¼”:æ¯ç‰ˆ">
+ <xsl:if test="@演:类型 = 'notes'">
+ <xsl:element name="presentation:notes">
+ <xsl:attribute name="style:page-layout-name"><xsl:value-of select="@æ¼”:页é¢è®¾ç½®å¼•ç”¨"/></xsl:attribute>
+ <xsl:attribute name="draw:style-name"><xsl:value-of select="@æ¼”:é…色方案引用"/></xsl:attribute>
+ <xsl:apply-templates select="uof:锚点 "/>
+ </xsl:element>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="uof:å¥å¼æ ·">
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name"><xsl:value-of select="@字:标识符"/></xsl:attribute>
+ <xsl:if test="@å­—:基å¼æ ·å¼•ç”¨">
+ <xsl:attribute name="style:parent-style-name"><xsl:value-of select="@å­—:基å¼æ ·å¼•ç”¨"/></xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="ancestor::å­—:段è½å¼æ ·">
+ <xsl:attribute name="style:family">paragraph</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:family">text</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:element name="style:text-properties">
+ <xsl:apply-templates select="*"/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="段è½å¼æ ·">
+ <xsl:element name="style:style">
+ <xsl:variable name="outline" select="@字:标识符"/>
+ <xsl:attribute name="style:family"><xsl:choose><xsl:when test="/uof:UOF/uof:å¼æ ·é›†/uof:自动编å·é›†/å­—:自动编å·[@å­—:标识符=$outline]">presentation</xsl:when><xsl:otherwise>paragraph</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="style:name"><xsl:value-of select="@字:标识符"/></xsl:attribute>
+ <xsl:if test="@å­—:基å¼æ ·å¼•ç”¨">
+ <xsl:attribute name="style:parent-style-name"><xsl:value-of select="@å­—:基å¼æ ·å¼•ç”¨"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="/uof:UOF/uof:å¼æ ·é›†/uof:自动编å·é›†/å­—:自动编å·[@å­—:标识符=$outline]">
+ <xsl:for-each select="/uof:UOF/uof:å¼æ ·é›†/uof:自动编å·é›†/å­—:自动编å·[@å­—:标识符=$outline]">
+ <style:graphic-properties draw:stroke="none" draw:fill="none">
+ <xsl:element name="text:list-style">
+ <xsl:call-template name="自动编å·"/>
+ </xsl:element>
+ </style:graphic-properties>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:element name="style:paragraph-properties">
+ <xsl:if test="å­—:自动编å·ä¿¡æ¯">
+ <xsl:attribute name="text:enable-numbering">true</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="contains($outline,'title')">
+ <xsl:attribute name="fo:text-align">center</xsl:attribute>
+ </xsl:if>
+ <xsl:call-template name="paragraph-properties"/>
+ </xsl:element>
+ <xsl:element name="style:text-properties">
+ <xsl:apply-templates select="*"/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="paragraph-properties">
+ <xsl:choose>
+ <xsl:when test="descendant::å­—:页边è·[@uof:å·¦]">
+ <xsl:attribute name="fo:margin-left"><xsl:value-of select="number(((descendant::å­—:页边è·/@uof:å·¦)div 10) *1)"/>cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:margin-left">0cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="descendant::å­—:页边è·[@uof:å³]">
+ <xsl:attribute name="fo:margin-right"><xsl:value-of select="number(((descendant::å­—:页边è·/@uof:å³)div 10) *1)"/>cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:margin-right">0cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="fo:text-indent">0cm</xsl:attribute>
+ <xsl:call-template name="bidi"/>
+ </xsl:template>
+ <xsl:template name="bidi">
+ </xsl:template>
+ <xsl:template name="jibianhao">
+ <xsl:param name="biaoshifu"/>
+ <xsl:element name="text:list-level-style-number">
+ <xsl:variable name="currlevel" select="number(@字:级别值)"/>
+ <xsl:attribute name="text:level"><xsl:value-of select="$currlevel"/></xsl:attribute>
+ <xsl:attribute name="text:style-name">Numbering Symbols</xsl:attribute>
+ <xsl:if test="å­—:起始编å·">
+ <xsl:attribute name="text:start-value"><xsl:value-of select="å­—:起始编å·"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="å­—:正规格å¼">
+ <xsl:attribute name="text:num-regular-exp"><xsl:value-of select="å­—:正规格å¼/@值"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="text:display-levels"><xsl:value-of select="string-length(å­—:ç¼–å·æ ¼å¼è¡¨ç¤º) - string-length(translate(å­—:ç¼–å·æ ¼å¼è¡¨ç¤º,'%','') )"/></xsl:attribute>
+ <xsl:if test="å­—:ç¼–å·æ ¼å¼">
+ <xsl:call-template name="ç¼–å·æ ¼å¼"/>
+ </xsl:if>
+ <xsl:if test="å­—:ç¼–å·æ ¼å¼è¡¨ç¤º">
+ <xsl:attribute name="style:num-prefix"><xsl:choose><xsl:when test="number($currlevel) =1"><xsl:value-of select="substring-before(å­—:ç¼–å·æ ¼å¼è¡¨ç¤º,concat('%',$currlevel))"/></xsl:when><xsl:otherwise><xsl:value-of select="substring-after(substring-after( substring-before(å­—:ç¼–å·æ ¼å¼è¡¨ç¤º,concat('%',$currlevel)),concat('%',string(number($currlevel) -1))),'.')"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="style:num-suffix"><xsl:value-of select="substring-after(å­—:ç¼–å·æ ¼å¼è¡¨ç¤º,concat('%',$currlevel))"/></xsl:attribute>
+ </xsl:if>
+ <xsl:element name="style:list-level-properties">
+ <xsl:if test="@å­—:ç¼–å·å¯¹é½æ–¹å¼">
+ <xsl:attribute name="fo:text-align"><xsl:value-of select="@å­—:ç¼–å·å¯¹é½æ–¹å¼"/></xsl:attribute>
+ </xsl:if>
+ <xsl:call-template name="suojinleixing"/>
+ </xsl:element>
+ <xsl:element name="style:text-properties">
+ <xsl:if test="å­—:符å·å­—体">
+ <xsl:variable name="Font-ID">
+ <xsl:value-of select="å­—:符å·å­—体/@å­—:å¼æ ·å¼•ç”¨"/>
+ </xsl:variable>
+ <xsl:for-each select="/uof:UOF/uof:å¼æ ·é›†/uof:å¥å¼æ ·">
+ <xsl:if test="@字:标识符=$Font-ID">
+ <xsl:if test="字:字体/@字:中文字体引用">
+ <xsl:attribute name="fo:font-family"><xsl:value-of select="字:字体/@字:中文字体引用"/></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:for-each select="å­—:符å·å­—体">
+ <xsl:apply-templates select="*"/>
+ </xsl:for-each>
+ </xsl:if>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="xiangmufuhao">
+ <xsl:param name="biaoshifu"/>
+ <xsl:variable name="currlevel" select="number(@字:级别值)"/>
+ <xsl:element name="text:list-level-style-bullet">
+ <xsl:attribute name="text:level"><xsl:value-of select="$currlevel"/></xsl:attribute>
+ <xsl:attribute name="text:style-name"><xsl:value-of select="concat( $biaoshifu,$currlevel)"/></xsl:attribute>
+ <xsl:attribute name="style:num-suffix"><xsl:value-of select="substring-after(å­—:ç¼–å·æ ¼å¼è¡¨ç¤º,'%1')"/></xsl:attribute>
+ <xsl:attribute name="text:bullet-char"><xsl:value-of select="å­—:项目符å·"/></xsl:attribute>
+ <xsl:element name="style:list-level-properties">
+ <xsl:if test="@å­—:ç¼–å·å¯¹é½æ–¹å¼">
+ <xsl:attribute name="fo:text-align"><xsl:value-of select="@å­—:ç¼–å·å¯¹é½æ–¹å¼"/></xsl:attribute>
+ </xsl:if>
+ <xsl:call-template name="suojinleixing"/>
+ </xsl:element>
+ <xsl:element name="style:text-properties">
+ <xsl:if test="å­—:符å·å­—体">
+ <xsl:variable name="Font-ID">
+ <xsl:value-of select="å­—:符å·å­—体/@å­—:å¼æ ·å¼•ç”¨"/>
+ </xsl:variable>
+ <xsl:for-each select="/uof:UOF/uof:å¼æ ·é›†/uof:å¥å¼æ ·[@å­—:标识符=$Font-ID]">
+ <xsl:if test="字:字体/@字:中文字体引用">
+ <xsl:attribute name="fo:font-family"><xsl:value-of select="字:字体/@字:中文字体引用"/></xsl:attribute>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:for-each select="å­—:符å·å­—体">
+ <xsl:apply-templates select="*"/>
+ </xsl:for-each>
+ </xsl:if>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="suojinleixing">
+ <xsl:if test="å­—:缩进/å­—:å·¦/å­—:ç»å¯¹/@å­—:值">
+ <xsl:attribute name="text:space-before"><xsl:value-of select="concat(number(å­—:缩进/å­—:å·¦/å­—:ç»å¯¹/@å­—:值),$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="å­—:缩进/å­—:å³/å­—:ç»å¯¹/@å­—:值">
+ <xsl:attribute name="text:min-label-width"><xsl:value-of select="concat(number(å­—:缩进/å­—:å³/å­—:ç»å¯¹/@å­—:值),$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="å­—:缩进/å­—:首行/å­—:ç»å¯¹/@å­—:值">
+ <xsl:attribute name="text:min-label-distance"><xsl:value-of select="concat(number(å­—:缩进/å­—:首行/å­—:ç»å¯¹/@å­—:值),$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="imagefuhao">
+ <xsl:param name="biaoshifu"/>
+ <xsl:variable name="currlevel" select="number(@字:级别值)"/>
+ <xsl:element name="text:list-level-style-image" style:vertical-pos="middle" style:vertical-rel="line" fo:width="0.265cm" fo:height="0.265cm">
+ <xsl:attribute name="text:level"><xsl:value-of select="$currlevel"/></xsl:attribute>
+ <xsl:attribute name="text:style-name"><xsl:value-of select="concat( $biaoshifu,$currlevel)"/></xsl:attribute>
+ <xsl:attribute name="style:num-suffix"><xsl:value-of select="substring-after(å­—:ç¼–å·æ ¼å¼è¡¨ç¤º,'%1')"/></xsl:attribute>
+ <xsl:if test="å­—:图片符å·å¼•ç”¨">
+ <xsl:variable name="gid">
+ <xsl:value-of select="å­—:图片符å·å¼•ç”¨"/>
+ </xsl:variable>
+ <xsl:element name="office:binary-data">
+ <xsl:value-of select="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$gid]/uof:æ•°æ®"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="style:list-level-properties">
+ <xsl:attribute name="style:vertical-pos">middle</xsl:attribute>
+ <xsl:attribute name="style:vertical-rel">line</xsl:attribute>
+ <xsl:attribute name="fo:width"><xsl:value-of select="concat(å­—:图片符å·å¼•ç”¨/@å­—:宽度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:height"><xsl:value-of select="concat(å­—:图片符å·å¼•ç”¨/@å­—:高度,$uofUnit)"/></xsl:attribute>
+ <xsl:if test="å­—:符å·å­—体">
+ <xsl:variable name="Font-ID">
+ <xsl:value-of select="å­—:符å·å­—体/@å­—:å¼æ ·å¼•ç”¨"/>
+ </xsl:variable>
+ <xsl:for-each select="/uof:UOF/uof:å¼æ ·é›†/uof:å¥å¼æ ·">
+ <xsl:if test="@字:标识符=$Font-ID">
+ <xsl:if test="字:字体/@字:中文字体引用">
+ <xsl:attribute name="fo:font-family"><xsl:value-of select="字:字体/@字:中文字体引用"/></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:call-template name="suojinleixing"/>
+ <xsl:if test="@å­—:ç¼–å·å¯¹é½æ–¹å¼">
+ <xsl:attribute name="fo:text-align"><xsl:value-of select="@å­—:ç¼–å·å¯¹é½æ–¹å¼"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:element name="style:text-properties">
+ <xsl:for-each select="å­—:符å·å­—体">
+ <xsl:apply-templates select="*"/>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="ç¼–å·æ ¼å¼">
+ <xsl:attribute name="style:num-format"><xsl:choose><xsl:when test="string(å­—:ç¼–å·æ ¼å¼)='lower-letter'">a</xsl:when><xsl:when test="string(å­—:ç¼–å·æ ¼å¼)='upper-letter'">A</xsl:when><xsl:when test="string(å­—:ç¼–å·æ ¼å¼)='lower-roman'">i</xsl:when><xsl:when test="string(å­—:ç¼–å·æ ¼å¼)='upper-roman'">I</xsl:when><xsl:when test="string(å­—:ç¼–å·æ ¼å¼)='decimal-enclosed-circle'">â‘ , â‘¡, â‘¢, ...</xsl:when><xsl:when test="string(å­—:ç¼–å·æ ¼å¼)='ideograph-traditional'">甲, ä¹™, 丙, ...</xsl:when><xsl:when test="string(å­—:ç¼–å·æ ¼å¼)='ideograph-zodiac'">å­, 丑, 寅, ...</xsl:when><xsl:when test="string(å­—:ç¼–å·æ ¼å¼)='chinese-counting'">一, 二, 三, ...</xsl:when><xsl:when test="string(å­—:ç¼–å·æ ¼å¼)='chinese-legal-simplified'">壹, è´°, å, ...</xsl:when><xsl:otherwise>1</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:template>
+ <xsl:template match="æ¼”:å¹»ç¯ç‰‡é›†">
+ <xsl:for-each select="æ¼”:å¹»ç¯ç‰‡">
+ <xsl:element name="draw:page">
+ <xsl:attribute name="draw:name"><xsl:value-of select="@æ¼”:å称"/></xsl:attribute>
+ <xsl:attribute name="draw:style-name"><xsl:value-of select="@演:标识符"/></xsl:attribute>
+ <xsl:attribute name="draw:master-page-name"><xsl:value-of select="@æ¼”:æ¯ç‰ˆå¼•ç”¨"/></xsl:attribute>
+ <xsl:if test="@æ¼”:页é¢ç‰ˆå¼å¼•ç”¨">
+ <xsl:attribute name="presentation:presentation-page-layout-name"><xsl:value-of select="@æ¼”:页é¢ç‰ˆå¼å¼•ç”¨"/></xsl:attribute>
+ </xsl:if>
+ <office:forms form:automatic-focus="false" form:apply-design-mode="false"/>
+ <xsl:apply-templates select="uof:锚点"/>
+ <xsl:apply-templates select="演:动画"/>
+ <xsl:element name="presentation:notes">
+ <xsl:attribute name="draw:style-name">dp2</xsl:attribute>
+ <xsl:apply-templates select="./æ¼”:å¹»ç¯ç‰‡å¤‡æ³¨/uof:锚点"/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template match="演:动画">
+ <xsl:element name="anim:par">
+ <xsl:attribute name="presentation:node-type">timing-root</xsl:attribute>
+ <anim:seq presentation:node-type="main-sequence">
+ <xsl:for-each select="æ¼”:åºåˆ—">
+ <anim:par begin="next">
+ <anim:par smil:begin="0s">
+ <xsl:variable name="animnodename">anim:par</xsl:variable>
+ <xsl:choose>
+ <xsl:when test="演:效果//演:其他">
+ <xsl:copy-of select="演:效果//演:其他/*"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="{$animnodename}">
+ <xsl:attribute name="smil:fill"><xsl:choose><xsl:when test="æ¼”:定时/@æ¼”:回å·='true'">remove</xsl:when><xsl:otherwise>hold</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="æ¼”:增强/æ¼”:动画播放åŽ/@æ¼”:播放åŽéšè—='true'">
+ <xsl:attribute name="presentation:preset-property">Direction;Accelerate;Decelerate</xsl:attribute>
+ </xsl:when>
+ <xsl:when test=".//æ¼”:è½®å­">
+ <xsl:attribute name="presentation:preset-property">Spokes</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="演:效果/演:强调/演:更改填充颜色">
+ <xsl:attribute name="presentation:preset-property">FillColor;ColorStyle;Accelerate;Decelerate;AutoReverse</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="演:效果/演:强调/演:更改字体颜色">
+ <xsl:attribute name="presentation:preset-property">CharColor;ColorStyle;Accelerate;Decelerate;AutoReverse</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="æ¼”:效果/æ¼”:强调/æ¼”:更改字å·">
+ <xsl:attribute name="presentation:preset-property">CharHeight</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="演:效果/演:强调/演:更改字形">
+ <xsl:attribute name="presentation:preset-property">CharDecoration</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="演:效果/演:强调/演:陀螺旋">
+ <xsl:attribute name="presentation:preset-property">Rotate;Accelerate;Decelerate;AutoReverse</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="æ¼”:效果/æ¼”:强调/æ¼”:é€æ˜Ž">
+ <xsl:attribute name="presentation:preset-property">Transparency</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="æ¼”:效果/æ¼”:强调/æ¼”:更改线æ¡é¢œè‰²">
+ <xsl:attribute name="presentation:preset-property">LineColor;ColorStyle;Accelerate;Decelerate;AutoReverse</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:attribute name="presentation:node-type"><xsl:choose><xsl:when test="演:定时/@演:事件='on click'">on-click</xsl:when><xsl:otherwise><xsl:value-of select="演:定时/@演:事件"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="smil:begin"><xsl:value-of select="演:定时/@演:延时"/></xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="æ¼”:定时/@æ¼”:é‡å¤='until next click' ">
+ <xsl:attribute name="smil:repeatCount">indefinite</xsl:attribute>
+ <xsl:attribute name="smil:end">next</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="æ¼”:定时/@æ¼”:é‡å¤='until next slide' ">
+ <xsl:attribute name="smil:repeatCount ">indefinite</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="æ¼”:定时/@æ¼”:é‡å¤ !='none'">
+ <xsl:attribute name="smil:repeatCount"><xsl:value-of select="æ¼”:定时/@æ¼”:é‡å¤"/></xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="æ¼”:增强/æ¼”:动画文本/@æ¼”:å‘é€">
+ <xsl:attribute name="anim:iterate-type"><xsl:choose><xsl:when test="æ¼”:增强/æ¼”:动画文本/@æ¼”:å‘é€='by word'">by-word</xsl:when><xsl:when test="æ¼”:增强/æ¼”:动画文本/@æ¼”:å‘é€='by letter'">by-letter</xsl:when><xsl:otherwise>all at once</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="演:增强/演:动画文本/@演:间隔">
+ <xsl:attribute name="anim:iterate-interval"><xsl:value-of select="演:增强/演:动画文本/@演:间隔"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$animnodename='anim:iterate' ">
+ <xsl:attribute name="anim:id"><xsl:value-of select="@演:动画对象"/></xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates select="演:效果"/>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </anim:par>
+ </anim:par>
+ </xsl:for-each>
+ </anim:seq>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="演:效果">
+ <xsl:apply-templates select="演:进入 "/>
+ <xsl:apply-templates select="演:强调"/>
+ <xsl:apply-templates select="演:退出"/>
+ </xsl:template>
+ <xsl:template match="演:进入">
+ <xsl:attribute name="presentation:preset-class">entrance</xsl:attribute>
+ <xsl:apply-templates select="." mode="entrance"/>
+ </xsl:template>
+ <xsl:template match="演:强调">
+ <xsl:attribute name="presentation:preset-class">emphasis</xsl:attribute>
+ <xsl:apply-templates select="." mode="emphasis"/>
+ </xsl:template>
+ <xsl:template match="演:退出">
+ <xsl:attribute name="presentation:preset-class">exit</xsl:attribute>
+ <xsl:apply-templates select="." mode="exit"/>
+ </xsl:template>
+ <xsl:template name="演速度">
+ <xsl:choose>
+ <xsl:when test="./@演:速度='very fast' ">0.5s</xsl:when>
+ <xsl:when test="./@演:速度='fast'">1s</xsl:when>
+ <xsl:when test="./@演:速度='medium'">2s</xsl:when>
+ <xsl:when test="./@演:速度='slow'">3s</xsl:when>
+ <xsl:when test="./@演:速度='very slow'">5s</xsl:when>
+ <xsl:otherwise>1s</xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="演:出现" mode="entrance">
+ <xsl:attribute name="presentation:preset-id">ooo-entrance-appear</xsl:attribute>
+ <anim:set smil:begin="0s" smil:dur="0.001s" smil:fill="hold" anim:sub-item="text" smil:attributeName="visibility" smil:to="visible">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ </anim:set>
+ </xsl:template>
+ <xsl:template match="演:盒状" mode="entrance">
+ <xsl:attribute name="presentation:preset-id">ooo-entrance-box</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type"><xsl:value-of select="@æ¼”:æ–¹å‘"/></xsl:attribute>
+ <anim:set smil:begin="0s" smil:dur="0.004s" smil:fill="hold" smil:attributeName="visibility" smil:to="visible">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ </anim:set>
+ <anim:transitionFilter smil:type="irisWipe" smil:subtype="rectangle" smil:direction="reverse">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ </anim:transitionFilter>
+ </xsl:template>
+ <xsl:template match="演:棋盘" mode="entrance">
+ <xsl:attribute name="presentation:preset-id">ooo-entrance-checkerboard</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type"><xsl:choose><xsl:when test="@æ¼”:æ–¹å‘='down'">downward</xsl:when><xsl:when test="@æ¼”:æ–¹å‘='across'">across</xsl:when></xsl:choose></xsl:attribute>
+ <anim:set smil:begin="0s" smil:dur="0.004s" smil:fill="hold" smil:attributeName="visibility" smil:to="visible">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ </anim:set>
+ <anim:transitionFilter smil:dur="2s" anim:sub-item="text" smil:type="checkerBoardWipe" smil:subtype="down">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ </anim:transitionFilter>
+ </xsl:template>
+ <xsl:template match="演:圆形扩展" mode="entrance">
+ <xsl:attribute name="presentation:preset-id">ooo-entrance-circle</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type"><xsl:value-of select="@æ¼”:æ–¹å‘"/></xsl:attribute>
+ <anim:set smil:begin="0s" smil:dur="0.0005s" smil:fill="hold" smil:attributeName="visibility" smil:to="visible">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ </anim:set>
+ <anim:transitionFilter smil:type="ellipseWipe" smil:subtype="horizontal" smil:direction="reverse">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ </anim:transitionFilter>
+ </xsl:template>
+ <xsl:template match="演:阶梯状" mode="entrance">
+ <xsl:attribute name="presentation:preset-id">ooo-entrance-diagonal-squares</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type"><xsl:choose><xsl:when test="@æ¼”:æ–¹å‘='left down'">left-to-bottom</xsl:when><xsl:when test="@æ¼”:æ–¹å‘='left up'">left-to-top</xsl:when><xsl:when test="@æ¼”:æ–¹å‘='right down'">right-to-bottom</xsl:when><xsl:when test="@æ¼”:æ–¹å‘='right up'">right-to-top</xsl:when></xsl:choose></xsl:attribute>
+ <anim:set smil:begin="0s" smil:dur="0.0005s" smil:fill="hold" smil:attributeName="visibility" smil:to="visible">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ </anim:set>
+ <anim:transitionFilter smil:type="waterfallWipe" smil:direction="reverse">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:subtype"><xsl:choose><xsl:when test="@æ¼”:æ–¹å‘='left down'">horizontalLeft</xsl:when><xsl:when test="@æ¼”:æ–¹å‘='left up'">horizontalLeft</xsl:when><xsl:when test="@æ¼”:æ–¹å‘='right down'">horizontalRight</xsl:when><xsl:when test="@æ¼”:æ–¹å‘='right up'">horizontalRight</xsl:when></xsl:choose></xsl:attribute>
+ </anim:transitionFilter>
+ </xsl:template>
+ <xsl:template match="æ¼”:è±å½¢" mode="entrance">
+ <xsl:attribute name="presentation:preset-id">ooo-entrance-diamond</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type"><xsl:value-of select="@æ¼”:æ–¹å‘"/></xsl:attribute>
+ <anim:set smil:begin="0s" smil:dur="0.0005s" smil:fill="hold" smil:attributeName="visibility" smil:to="visible">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ </anim:set>
+ <anim:transitionFilter smil:type="irisWipe" smil:subtype="diamond" smil:direction="reverse">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ </anim:transitionFilter>
+ </xsl:template>
+ <xsl:template match="æ¼”:内å‘溶解" mode="entrance">
+ <xsl:attribute name="presentation:preset-id">ooo-entrance-dissolve-in</xsl:attribute>
+ <anim:set smil:begin="0s" smil:dur="0.0005s" smil:fill="hold" smil:attributeName="visibility" smil:to="visible">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ </anim:set>
+ <anim:transitionFilter smil:type="dissolve" smil:direction="reverse">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ </anim:transitionFilter>
+ </xsl:template>
+ <xsl:template match="æ¼”:é—ªçƒä¸€æ¬¡" mode="entrance">
+ <xsl:attribute name="presentation:preset-id">ooo-entrance-flash-once</xsl:attribute>
+ <anim:set smil:begin="0s" smil:attributeName="visibility" smil:to="visible">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ </anim:set>
+ </xsl:template>
+ <xsl:template match="演:飞入" mode="entrance">
+ <xsl:attribute name="presentation:preset-id">ooo-entrance-fly-in</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type"><xsl:choose><xsl:when test="@æ¼”:æ–¹å‘= 'from bottom'">from-bottom</xsl:when><xsl:when test="@æ¼”:æ–¹å‘ = 'from top-right'">from-top-right</xsl:when><xsl:when test="@æ¼”:æ–¹å‘ = 'from top-left'">from-top-left</xsl:when><xsl:when test="@æ¼”:æ–¹å‘ = 'from bottom-left'">from-bottom-left</xsl:when><xsl:when test="@æ¼”:æ–¹å‘ = 'from bottom-right'">from-bottom-right</xsl:when><xsl:when test="@æ¼”:æ–¹å‘ = 'from right'">from-right</xsl:when><xsl:when test="@æ¼”:æ–¹å‘ = 'from left'">from-left</xsl:when><xsl:when test="@æ¼”:æ–¹å‘ = 'from top'">from-top</xsl:when></xsl:choose></xsl:attribute>
+ <anim:set smil:begin="0s" smil:dur="0.0005s" smil:fill="hold" smil:attributeName="visibility" smil:to="visible">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ </anim:set>
+ <xsl:variable name="smilvalueX">
+ <xsl:choose>
+ <xsl:when test="contains(@æ¼”:æ–¹å‘,'right')">1+width/2;x</xsl:when>
+ <xsl:when test="contains(@æ¼”:æ–¹å‘,'left')">0-width/2;x</xsl:when>
+ <xsl:otherwise>x;x</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="smilvalueY">
+ <xsl:choose>
+ <xsl:when test="contains(@æ¼”:æ–¹å‘,'bottom')">1+height/2;y</xsl:when>
+ <xsl:when test="contains(@æ¼”:æ–¹å‘,'top')">0-height/2;y</xsl:when>
+ <xsl:otherwise>y;y</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <anim:animate smil:fill="hold" smil:attributeName="x" smil:keyTimes="0;1" presentation:additive="base">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:values"><xsl:value-of select="$smilvalueX"/></xsl:attribute>
+ </anim:animate>
+ <anim:animate smil:fill="hold" smil:attributeName="y" smil:keyTimes="0;1" presentation:additive="base">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:values"><xsl:value-of select="$smilvalueY"/></xsl:attribute>
+ </anim:animate>
+ </xsl:template>
+ <xsl:template match="演:缓慢飞入" mode="entrance">
+ <xsl:attribute name="presentation:preset-id">ooo-entrance-fly-in-slow</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type"><xsl:choose><xsl:when test="@æ¼”:æ–¹å‘= 'from bottom'">from-bottom</xsl:when><xsl:when test="@æ¼”:æ–¹å‘ = 'from right'">from-right</xsl:when><xsl:when test="@æ¼”:æ–¹å‘ = 'from left'">from-left</xsl:when><xsl:when test="@æ¼”:æ–¹å‘ = 'from top'">from-top</xsl:when></xsl:choose></xsl:attribute>
+ <anim:set smil:begin="0s" smil:dur="0.0005s" smil:fill="hold" smil:attributeName="visibility" smil:to="visible">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ </anim:set>
+ <xsl:variable name="smilvalueX">
+ <xsl:choose>
+ <xsl:when test="contains(@æ¼”:æ–¹å‘,'right')">1+width/2;x</xsl:when>
+ <xsl:when test="contains(@æ¼”:æ–¹å‘,'left')">0-width/2;x</xsl:when>
+ <xsl:otherwise>x;x</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="smilvalueY">
+ <xsl:choose>
+ <xsl:when test="contains(@æ¼”:æ–¹å‘,'bottom')">1+height/2;y</xsl:when>
+ <xsl:when test="contains(@æ¼”:æ–¹å‘,'top')">0-height/2;y</xsl:when>
+ <xsl:otherwise>y;y</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <anim:animate smil:fill="hold" smil:attributeName="x" smil:keyTimes="0;1" presentation:additive="base">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:values"><xsl:value-of select="$smilvalueX"/></xsl:attribute>
+ </anim:animate>
+ <anim:animate smil:fill="hold" smil:attributeName="y" smil:keyTimes="0;1" presentation:additive="base">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:values"><xsl:value-of select="$smilvalueY"/></xsl:attribute>
+ </anim:animate>
+ </xsl:template>
+ <xsl:template match="演:切入" mode="entrance">
+ <xsl:attribute name="presentation:preset-id">ooo-entrance-peek-in</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type"><xsl:choose><xsl:when test="@æ¼”:æ–¹å‘= 'from bottom'">from-bottom</xsl:when><xsl:when test="@æ¼”:æ–¹å‘ = 'from right'">from-right</xsl:when><xsl:when test="@æ¼”:æ–¹å‘ = 'from left'">from-left</xsl:when><xsl:when test="@æ¼”:æ–¹å‘ = 'from top'">from-top</xsl:when></xsl:choose></xsl:attribute>
+ <anim:set smil:begin="0s" smil:dur="0.0005s" smil:fill="hold" smil:attributeName="visibility" smil:to="visible">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ </anim:set>
+ <anim:transitionFilter smil:type="slideWipe" smil:direction="reverse">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:subtype"><xsl:choose><xsl:when test="@æ¼”:æ–¹å‘= 'from bottom'">fromBottom</xsl:when><xsl:when test="@æ¼”:æ–¹å‘ = 'from right'">fromRight</xsl:when><xsl:when test="@æ¼”:æ–¹å‘ = 'from left'">fromLeft</xsl:when><xsl:when test="@æ¼”:æ–¹å‘ = 'from top'">fromTop</xsl:when></xsl:choose></xsl:attribute>
+ </anim:transitionFilter>
+ </xsl:template>
+ <xsl:template match="æ¼”:å字形扩展" mode="entrance">
+ <xsl:attribute name="presentation:preset-id">ooo-entrance-plus</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type"><xsl:value-of select="@æ¼”:æ–¹å‘"/></xsl:attribute>
+ <anim:set smil:begin="0s" smil:dur="0.00025s" smil:fill="hold" smil:attributeName="visibility" smil:to="visible">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ </anim:set>
+ <anim:transitionFilter smil:type="fourBoxWipe" smil:direction="reverse">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:subtype"><xsl:choose><xsl:when test="@æ¼”:æ–¹å‘= 'in'">cornersIn</xsl:when><xsl:when test="@æ¼”:æ–¹å‘ = 'out'">cornersOut</xsl:when></xsl:choose></xsl:attribute>
+ </anim:transitionFilter>
+ </xsl:template>
+ <xsl:template match="æ¼”:éšæœºçº¿æ¡" mode="entrance">
+ <xsl:attribute name="presentation:preset-id">ooo-entrance-bars</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type"><xsl:value-of select="@æ¼”:æ–¹å‘"/></xsl:attribute>
+ <anim:set smil:begin="0s" smil:dur="0.001s" smil:fill="hold" smil:attributeName="visibility" smil:to="visible">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ </anim:set>
+ <anim:transitionFilter smil:type="randomBarWipe" smil:direction="reverse">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:subtype"><xsl:choose><xsl:when test="@æ¼”:æ–¹å‘= 'horizontal'">vertical</xsl:when><xsl:when test="@æ¼”:æ–¹å‘ = 'vertical'">horizontal</xsl:when></xsl:choose></xsl:attribute>
+ </anim:transitionFilter>
+ </xsl:template>
+ <xsl:template match="演:劈裂" mode="entrance">
+ <xsl:attribute name="presentation:preset-id">ooo-entrance-split</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type"><xsl:choose><xsl:when test="@æ¼”:æ–¹å‘ = 'horizontal out'">horizontal-out</xsl:when><xsl:when test="@æ¼”:æ–¹å‘= 'horizontal in'">horizontal-in</xsl:when><xsl:when test="@æ¼”:æ–¹å‘= 'vertical in'">vertical-in</xsl:when><xsl:when test="@æ¼”:æ–¹å‘= 'vertical out'">vertical-out</xsl:when></xsl:choose></xsl:attribute>
+ <anim:set smil:begin="0s" smil:dur="0.001s" smil:fill="hold" smil:attributeName="visibility" smil:to="visible">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ </anim:set>
+ <anim:transitionFilter smil:dur="0.5s" smil:type="barnDoorWipe">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:subtype"><xsl:choose><xsl:when test="@æ¼”:æ–¹å‘ = 'horizontal out'">horizontal</xsl:when><xsl:when test="@æ¼”:æ–¹å‘= 'horizontal in'">horizontal</xsl:when><xsl:when test="@æ¼”:æ–¹å‘= 'vertical in'">vertical</xsl:when><xsl:when test="@æ¼”:æ–¹å‘= 'vertical out'">vertical</xsl:when></xsl:choose></xsl:attribute>
+ </anim:transitionFilter>
+ </xsl:template>
+ <xsl:template match="æ¼”:百å¶çª—" mode="entrance">
+ <xsl:attribute name="presentation:preset-id">ooo-entrance-venetian-blinds</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type"><xsl:value-of select="@æ¼”:æ–¹å‘"/></xsl:attribute>
+ <anim:set smil:begin="0s" smil:dur="0.001s" smil:fill="hold" smil:attributeName="visibility" smil:to="visible">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ </anim:set>
+ <anim:transitionFilter smil:type="blindsWipe" smil:direction="reverse">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:subtype"><xsl:choose><xsl:when test="@æ¼”:æ–¹å‘= 'horizontal'">vertical</xsl:when><xsl:when test="@æ¼”:æ–¹å‘ = 'vertical'">horizontal</xsl:when></xsl:choose></xsl:attribute>
+ </anim:transitionFilter>
+ </xsl:template>
+ <xsl:template match="演:扇形展开" mode="entrance">
+ <xsl:attribute name="presentation:preset-id">ooo-entrance-wedge</xsl:attribute>
+ <anim:set smil:begin="0s" smil:dur="0.0015s" smil:fill="hold" smil:attributeName="visibility" smil:to="visible">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ </anim:set>
+ <anim:transitionFilter smil:type="fanWipe" smil:subtype="centerTop">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ </anim:transitionFilter>
+ </xsl:template>
+ <xsl:template match="æ¼”:è½®å­" mode="entrance">
+ <xsl:attribute name="presentation:preset-id">ooo-entrance-wheel</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type"><xsl:value-of select="@æ¼”:è¾å°„状"/></xsl:attribute>
+ <anim:set smil:begin="0s" smil:dur="0.00025s" smil:fill="hold" smil:attributeName="visibility" smil:to="visible">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ </anim:set>
+ <anim:transitionFilter smil:dur="0.5s" smil:type="pinWheelWipe">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:subtype"><xsl:choose><xsl:when test="@æ¼”:è¾å°„状='1'">oneBlade</xsl:when><xsl:when test="@æ¼”:è¾å°„状='2'">twoBlade</xsl:when><xsl:when test="@æ¼”:è¾å°„状='3'">threeBlade</xsl:when><xsl:when test="@æ¼”:è¾å°„状='4'">fourBlade</xsl:when><xsl:when test="@æ¼”:è¾å°„状='8'">eightBlade</xsl:when></xsl:choose></xsl:attribute>
+ </anim:transitionFilter>
+ </xsl:template>
+ <xsl:template match="演:擦除" mode="entrance">
+ <xsl:attribute name="presentation:preset-id">ooo-entrance-wipe</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type"><xsl:choose><xsl:when test="@演:速度 = 'from right'">from-right</xsl:when><xsl:when test="@演:速度 = 'from left'">from-left</xsl:when><xsl:when test="@演:速度 = 'from top'">from-top</xsl:when><xsl:when test="@演:速度 = 'from bottom'">from-bottom</xsl:when><xsl:otherwise>from-left</xsl:otherwise></xsl:choose></xsl:attribute>
+ <anim:set smil:begin="0s" smil:dur="0.006s" smil:fill="hold" smil:attributeName="visibility" smil:to="visible">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ </anim:set>
+ <anim:transitionFilter smil:type="barWipe" smil:subtype="leftToRight" smil:direction="reverse">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:subtype"><xsl:choose><xsl:when test="(@演:速度 = 'from right') or (@演:速度 = 'from left')">leftToRight</xsl:when><xsl:when test="(@演:速度 = 'from top') or (@演:速度 = 'from bottom')">topToBottom</xsl:when><xsl:otherwise>leftToRight</xsl:otherwise></xsl:choose></xsl:attribute>
+ </anim:transitionFilter>
+ </xsl:template>
+ <xsl:template match="æ¼”:éšæœºæ•ˆæžœ" mode="entrance">
+ <xsl:attribute name="presentation:preset-id">ooo-entrance-random</xsl:attribute>
+ <anim:set smil:begin="0s" smil:dur="0.001s" smil:fill="hold" smil:attributeName="visibility" smil:to="visible">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ </anim:set>
+ <anim:animate smil:dur="1s" smil:fill="hold" smil:attributeName="width" smil:values="0;width" smil:keyTimes="0;1" presentation:additive="base">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ </anim:animate>
+ <anim:animate smil:fill="hold" smil:attributeName="height" smil:values="0;height" smil:keyTimes="0;1" presentation:additive="base">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ </anim:animate>
+ <anim:animate smil:fill="hold" smil:attributeName="rotate" smil:values="90;0" smil:keyTimes="0;1" presentation:additive="base">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ </anim:animate>
+ <anim:transitionFilter smil:type="fade" smil:subtype="crossfade">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ </anim:transitionFilter>
+ </xsl:template>
+ <xsl:template match="更改填充颜色" mode="emphasis">
+ <xsl:attribute name="presentation:preset-id">ooo-emphasis-fill-color</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type">2</xsl:attribute>
+ <anim:animateColor smil:fill="hold" smil:attributeName="fill-color" presentation:additive="base" anim:color-interpolation="rgb" anim:color-interpolation-direction="clockwise">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:to"><xsl:value-of select="@演:颜色"/></xsl:attribute>
+ </anim:animateColor>
+ <anim:set smil:dur="0.5s" smil:fill="hold" smil:attributeName="fill" smil:to="solid">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ </anim:set>
+ </xsl:template>
+ <xsl:template match="更改字体颜色" mode="emphasis">
+ <xsl:attribute name="presentation:preset-id">ooo-emphasis-font-color</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type">2</xsl:attribute>
+ <anim:animateColor smil:fill="hold" smil:attributeName="fill-color" presentation:additive="base" anim:color-interpolation="rgb" anim:color-interpolation-direction="clockwise">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:to"><xsl:value-of select="@演:颜色"/></xsl:attribute>
+ </anim:animateColor>
+ </xsl:template>
+ <xsl:template match="æ¼”:更改字å·" mode="emphasis">
+ <xsl:attribute name="presentation:preset-id">ooo-emphasis-font-size</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type">2</xsl:attribute>
+ <anim:animate smil:fill="hold" smil:attributeName="font-size" presentation:additive="base">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:to"><xsl:choose><xsl:when test="@演:预定义尺寸='tiny' ">0.25,1</xsl:when><xsl:when test="@演:预定义尺寸='smaller' ">0.5,1</xsl:when><xsl:when test="@演:预定义尺寸='larger' ">1.5,1</xsl:when><xsl:when test="@演:预定义尺寸='huge' ">4,1</xsl:when><xsl:when test="@演:自定义尺寸"><xsl:value-of select="@演:自定义尺寸"/></xsl:when><xsl:otherwise>1</xsl:otherwise></xsl:choose></xsl:attribute>
+ </anim:animate>
+ </xsl:template>
+ <xsl:template name="emp_font_style">
+ <xsl:param name="fontstyle"/>
+ <xsl:choose>
+ <xsl:when test="contains($fontstyle,' ')">
+ <anim:set smil:dur="indefinite" smil:attributeName="font-style">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:to"><xsl:value-of select="substring-before($fontstyle,' ')"/></xsl:attribute>
+ </anim:set>
+ <xsl:variable name="fontstyle1">
+ <xsl:choose>
+ <xsl:when test="contains($fontstyle,' ')">
+ <xsl:value-of select="substring-after($fontstyle,' ')"/>
+ </xsl:when>
+ <xsl:when test="not($fontstyle=' ')">
+ <xsl:value-of select="$fontstyle"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:call-template name="emp_font_style">
+ <xsl:with-param name="fontstyle">
+ <xsl:value-of select="$fontstyle1"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="演:更改字形" mode="emphasis">
+ <xsl:attribute name="presentation:preset-id">ooo-emphasis-font-style</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type">1</xsl:attribute>
+ <xsl:call-template name="emp_font_style">
+ <xsl:with-param name="fontstyle">
+ <xsl:value-of select="@æ¼”:å­—å½¢"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:template>
+ <xsl:template match="æ¼”:更改线æ¡é¢œè‰²" mode="emphasis">
+ <xsl:attribute name="presentation:preset-id">ooo-emphasis-line-color</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type">2</xsl:attribute>
+ <anim:animateColor smil:dur="0s" smil:fill="hold" smil:attributeName="stroke-color" presentation:additive="base" anim:color-interpolation="rgb" anim:color-interpolation-direction="clockwise">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:to"><xsl:value-of select="@演:颜色"/></xsl:attribute>
+ </anim:animateColor>
+ <anim:set smil:dur="0s" smil:fill="hold" anim:sub-item="text" smil:attributeName="stroke" smil:to="solid">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ </anim:set>
+ </xsl:template>
+ <xsl:template match="演:陀螺旋" mode="emphasis">
+ <xsl:attribute name="presentation:preset-id">ooo-emphasis-spin</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type">2</xsl:attribute>
+ <anim:animateTransform smil:fill="hold" smil:by="180" presentation:additive="base" svg:type="rotate">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:by"><xsl:choose><xsl:when test="@演:预定义角度='quarter spin'">90</xsl:when><xsl:when test="@演:预定义角度='half spin'">180</xsl:when><xsl:when test="@演:预定义角度='full spin'">360</xsl:when><xsl:when test="@演:预定义角度='two spins'">720 </xsl:when><xsl:when test="@演:自定义角度"><xsl:value-of select="@演:自定义角度"/></xsl:when></xsl:choose></xsl:attribute>
+ </anim:animateTransform>
+ </xsl:template>
+ <xsl:template match="æ¼”:é€æ˜Ž" mode="emphasis">
+ <xsl:attribute name="presentation:preset-id">ooo-emphasis-transparency</xsl:attribute>
+ <xsl:attribute name="smil:repeatCount"><xsl:choose><xsl:when test="(@演:期间 = 'until next click') or (@演:期间 ='until next slide') ">indefinite</xsl:when><xsl:when test="@演:期间='2' or @演:期间 ='3' or @演:期间 ='4' or @演:期间 ='5' or @演:期间 ='10'"><xsl:value-of select="@演:期间"/></xsl:when><xsl:otherwise>2</xsl:otherwise></xsl:choose></xsl:attribute>
+ <anim:set smil:dur="indefinite" anim:sub-item="text" smil:attributeName="opacity">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:to"><xsl:choose><xsl:when test="@æ¼”:预定义é€æ˜Žåº¦='25' ">0.25</xsl:when><xsl:when test="@æ¼”:预定义é€æ˜Žåº¦='50' ">0.5</xsl:when><xsl:when test="@æ¼”:预定义é€æ˜Žåº¦='75' ">0.75</xsl:when><xsl:when test="@æ¼”:预定义é€æ˜Žåº¦='100' ">1</xsl:when><xsl:when test="@æ¼”:自定义é€æ˜Žåº¦"><xsl:value-of select="@æ¼”:自定义é€æ˜Žåº¦"/></xsl:when><xsl:otherwise>1</xsl:otherwise></xsl:choose></xsl:attribute>
+ </anim:set>
+ </xsl:template>
+ <xsl:template match="演:缩放" mode="emphasis">
+ <xsl:attribute name="presentation:preset-id">ooo-emphasis-grow-and-shrink</xsl:attribute>
+ <anim:animateTransform smil:fill="hold" anim:sub-item="text" presentation:additive="base" svg:type="scale">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:to"><xsl:choose><xsl:when test="@演:预定义尺寸='tiny' ">0.25,1</xsl:when><xsl:when test="@演:预定义尺寸='smaller' ">0.5,1</xsl:when><xsl:when test="@演:预定义尺寸='larger' ">1.5,1</xsl:when><xsl:when test="@演:预定义尺寸='huge' ">4,1</xsl:when><xsl:when test="@演:自定义尺寸"><xsl:value-of select="@演:自定义尺寸"/></xsl:when><xsl:otherwise>0.5,1</xsl:otherwise></xsl:choose></xsl:attribute>
+ </anim:animateTransform>
+ </xsl:template>
+ <xsl:template match="演:盒状" mode="exit">
+ <xsl:attribute name="presentation:preset-id">ooo-exit-box</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type"><xsl:value-of select="@æ¼”:æ–¹å‘"/></xsl:attribute>
+ <anim:transitionFilter smil:type="irisWipe" smil:subtype="rectangle" smil:direction="reverse" smil:mode="out">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ </anim:transitionFilter>
+ <anim:set smil:dur="0.004s" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden">
+ <xsl:attribute name="smil:begin"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ </anim:set>
+ </xsl:template>
+ <xsl:template match="演:棋盘" mode="exit">
+ <xsl:attribute name="presentation:preset-id">ooo-exit-checkerboard</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type"><xsl:choose><xsl:when test="@æ¼”:æ–¹å‘='down'">downward</xsl:when><xsl:when test="@æ¼”:æ–¹å‘='across'">across</xsl:when></xsl:choose></xsl:attribute>
+ <anim:transitionFilter smil:dur="2s" anim:sub-item="text" smil:type="checkerBoardWipe" smil:subtype="down" smil:mode="out">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ </anim:transitionFilter>
+ <anim:set smil:dur="0.004s" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden">
+ <xsl:attribute name="smil:begin"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ </anim:set>
+ </xsl:template>
+ <xsl:template match="演:圆形扩展" mode="exit">
+ <xsl:attribute name="presentation:preset-id">ooo-exit-circle</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type"><xsl:value-of select="@æ¼”:æ–¹å‘"/></xsl:attribute>
+ <anim:transitionFilter smil:type="ellipseWipe" smil:subtype="horizontal" smil:direction="reverse" smil:mode="out">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ </anim:transitionFilter>
+ <anim:set smil:dur="0.0005s" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden">
+ <xsl:attribute name="smil:begin"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ </anim:set>
+ </xsl:template>
+ <xsl:template match="演:阶梯状" mode="exit">
+ <xsl:attribute name="presentation:preset-id">ooo-exit-diagonal-squares</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type"><xsl:choose><xsl:when test="@æ¼”:æ–¹å‘='left down'">left-to-bottom</xsl:when><xsl:when test="@æ¼”:æ–¹å‘='left up'">left-to-top</xsl:when><xsl:when test="@æ¼”:æ–¹å‘='right down'">right-to-bottom</xsl:when><xsl:when test="@æ¼”:æ–¹å‘='right up'">right-to-top</xsl:when></xsl:choose></xsl:attribute>
+ <anim:transitionFilter smil:type="waterfallWipe" smil:direction="reverse" smil:mode="out">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:subtype"><xsl:choose><xsl:when test="@æ¼”:æ–¹å‘='left down'">horizontalLeft</xsl:when><xsl:when test="@æ¼”:æ–¹å‘='left up'">horizontalLeft</xsl:when><xsl:when test="@æ¼”:æ–¹å‘='right down'">horizontalRight</xsl:when><xsl:when test="@æ¼”:æ–¹å‘='right up'">horizontalRight</xsl:when></xsl:choose></xsl:attribute>
+ </anim:transitionFilter>
+ <anim:set smil:dur="0.0005s" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden">
+ <xsl:attribute name="smil:begin"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ </anim:set>
+ </xsl:template>
+ <xsl:template match="æ¼”:è±å½¢" mode="exit">
+ <xsl:attribute name="presentation:preset-id">ooo-exit-diamond</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type"><xsl:value-of select="@æ¼”:æ–¹å‘"/></xsl:attribute>
+ <anim:transitionFilter smil:type="irisWipe" smil:subtype="diamond" smil:direction="reverse" smil:mode="out">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ </anim:transitionFilter>
+ <anim:set smil:dur="0.0005s" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden">
+ <xsl:attribute name="smil:begin"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ </anim:set>
+ </xsl:template>
+ <xsl:template match="演:消失" mode="exit">
+ <xsl:attribute name="presentation:preset-id">ooo-exit-disappear</xsl:attribute>
+ <anim:set smil:begin="0s" smil:dur="0.001s" smil:fill="hold" anim:sub-item="text" smil:attributeName="visibility" smil:to="visible">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ </anim:set>
+ </xsl:template>
+ <xsl:template match="æ¼”:å‘外溶解" mode="exit">
+ <xsl:attribute name="presentation:preset-id">ooo-exit-dissolve</xsl:attribute>
+ <anim:transitionFilter smil:type="dissolve" smil:direction="reverse" smil:mode="out">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ </anim:transitionFilter>
+ <anim:set smil:dur="0.0005s" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden">
+ <xsl:attribute name="smil:begin"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ </anim:set>
+ </xsl:template>
+ <xsl:template match="æ¼”:é—ªçƒä¸€æ¬¡" mode="exit">
+ <xsl:attribute name="presentation:preset-id">ooo-exit-flash-once</xsl:attribute>
+ <anim:animate smil:attributeName="visibility" smil:values="hidden;visible" smil:keyTimes="0;0.5" smil:calcMode="discrete" presentation:additive="base">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ </anim:animate>
+ <anim:set smil:dur="0s" smil:attributeName="visibility" smil:to="hidden">
+ <xsl:attribute name="smil:begin"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ </anim:set>
+ </xsl:template>
+ <xsl:template match="演:飞出" mode="exit">
+ <xsl:attribute name="presentation:preset-id">ooo-exit-fly-out</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type"><xsl:choose><xsl:when test="@æ¼”:æ–¹å‘= 'to bottom'">from-bottom</xsl:when><xsl:when test="@æ¼”:æ–¹å‘ = 'to top-right'">from-top-right</xsl:when><xsl:when test="@æ¼”:æ–¹å‘ = 'to top-left'">from-top-left</xsl:when><xsl:when test="@æ¼”:æ–¹å‘ = 'to bottom-left'">from-bottom-left</xsl:when><xsl:when test="@æ¼”:æ–¹å‘ = 'to bottom-right'">from-bottom-right</xsl:when><xsl:when test="@æ¼”:æ–¹å‘ = 'to right'">from-right</xsl:when><xsl:when test="@æ¼”:æ–¹å‘ = 'to left'">from-left</xsl:when><xsl:when test="@æ¼”:æ–¹å‘ = 'to top'">from-top</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:variable name="smilvalueX">
+ <xsl:choose>
+ <xsl:when test="contains(@æ¼”:æ–¹å‘,'right')">x;1+width/2</xsl:when>
+ <xsl:when test="contains(@æ¼”:æ–¹å‘,'left')">x;0-width/2</xsl:when>
+ <xsl:otherwise>x;x</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="smilvalueY">
+ <xsl:choose>
+ <xsl:when test="contains(@æ¼”:æ–¹å‘,'bottom')">y;1+height/2</xsl:when>
+ <xsl:when test="contains(@æ¼”:æ–¹å‘,'top')">y;0-height/2</xsl:when>
+ <xsl:otherwise>y;y</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <anim:animate smil:fill="hold" smil:attributeName="x" smil:keyTimes="0;1" presentation:additive="base">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:values"><xsl:value-of select="$smilvalueX"/></xsl:attribute>
+ </anim:animate>
+ <anim:animate smil:fill="hold" smil:attributeName="y" smil:keyTimes="0;1" presentation:additive="base">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:values"><xsl:value-of select="$smilvalueY"/></xsl:attribute>
+ </anim:animate>
+ <anim:set smil:dur="0.0005s" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden">
+ <xsl:attribute name="smil:begin"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ </anim:set>
+ </xsl:template>
+ <xsl:template match="演:缓慢移出" mode="exit">
+ <xsl:attribute name="presentation:preset-id">ooo-exit-crawl-out</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type"><xsl:choose><xsl:when test="@æ¼”:æ–¹å‘= 'to bottom'">from-bottom</xsl:when><xsl:when test="@æ¼”:æ–¹å‘ = 'to right'">from-right</xsl:when><xsl:when test="@æ¼”:æ–¹å‘ = 'to left'">from-left</xsl:when><xsl:when test="@æ¼”:æ–¹å‘ = 'to top'">from-top</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:variable name="smilvalueX">
+ <xsl:choose>
+ <xsl:when test="contains(@æ¼”:æ–¹å‘,'right')">x;1+width/2</xsl:when>
+ <xsl:when test="contains(@æ¼”:æ–¹å‘,'left')">x;0-width/2</xsl:when>
+ <xsl:otherwise>x;x</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="smilvalueY">
+ <xsl:choose>
+ <xsl:when test="contains(@æ¼”:æ–¹å‘,'bottom')">y;1+height/2</xsl:when>
+ <xsl:when test="contains(@æ¼”:æ–¹å‘,'top')">y;0-height/2</xsl:when>
+ <xsl:otherwise>y;y</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <anim:animate smil:fill="hold" smil:attributeName="x" smil:keyTimes="0;1" presentation:additive="base">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:values"><xsl:value-of select="$smilvalueX"/></xsl:attribute>
+ </anim:animate>
+ <anim:animate smil:fill="hold" smil:attributeName="y" smil:keyTimes="0;1" presentation:additive="base">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:values"><xsl:value-of select="$smilvalueY"/></xsl:attribute>
+ </anim:animate>
+ <anim:set smil:dur="0.0005s" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden">
+ <xsl:attribute name="smil:begin"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ </anim:set>
+ </xsl:template>
+ <xsl:template match="演:切出" mode="exit">
+ <xsl:attribute name="presentation:preset-id">ooo-exit-peek-out</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type"><xsl:choose><xsl:when test="@æ¼”:æ–¹å‘= 'from bottom'">from-bottom</xsl:when><xsl:when test="@æ¼”:æ–¹å‘ = 'from right'">from-right</xsl:when><xsl:when test="@æ¼”:æ–¹å‘ = 'from left'">from-left</xsl:when><xsl:when test="@æ¼”:æ–¹å‘ = 'from top'">from-top</xsl:when></xsl:choose></xsl:attribute>
+ <anim:transitionFilter smil:type="slideWipe" smil:direction="reverse" smil:mode="out">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:subtype"><xsl:choose><xsl:when test="@æ¼”:æ–¹å‘= 'from bottom'">fromBottom</xsl:when><xsl:when test="@æ¼”:æ–¹å‘ = 'from right'">fromRight</xsl:when><xsl:when test="@æ¼”:æ–¹å‘ = 'from left'">fromLeft</xsl:when><xsl:when test="@æ¼”:æ–¹å‘ = 'from top'">fromTop</xsl:when></xsl:choose></xsl:attribute>
+ </anim:transitionFilter>
+ <anim:set smil:dur="0.0005s" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden">
+ <xsl:attribute name="smil:begin"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ </anim:set>
+ </xsl:template>
+ <xsl:template match="æ¼”:å字形扩展" mode="exit">
+ <xsl:attribute name="presentation:preset-id">ooo-exit-plus</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type"><xsl:value-of select="@æ¼”:æ–¹å‘"/></xsl:attribute>
+ <anim:transitionFilter smil:type="fourBoxWipe" smil:direction="reverse" smil:mode="out">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:subtype"><xsl:choose><xsl:when test="@æ¼”:æ–¹å‘= 'in'">cornersIn</xsl:when><xsl:when test="@æ¼”:æ–¹å‘ = 'out'">cornersOut</xsl:when></xsl:choose></xsl:attribute>
+ </anim:transitionFilter>
+ <anim:set smil:dur="0.00025s" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden">
+ <xsl:attribute name="smil:begin"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ </anim:set>
+ </xsl:template>
+ <xsl:template match="æ¼”:éšæœºçº¿æ¡" mode="exit">
+ <xsl:attribute name="presentation:preset-id">ooo-exit-random-bars</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type"><xsl:value-of select="@æ¼”:æ–¹å‘"/></xsl:attribute>
+ <anim:transitionFilter smil:type="randomBarWipe" smil:direction="reverse" smil:mode="out">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:subtype"><xsl:choose><xsl:when test="@æ¼”:æ–¹å‘= 'horizontal'">vertical</xsl:when><xsl:when test="@æ¼”:æ–¹å‘ = 'vertical'">horizontal</xsl:when></xsl:choose></xsl:attribute>
+ </anim:transitionFilter>
+ <anim:set smil:dur="0.001s" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden">
+ <xsl:attribute name="smil:begin"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ </anim:set>
+ </xsl:template>
+ <xsl:template match="演:劈裂" mode="exit">
+ <xsl:attribute name="presentation:preset-id">ooo-exit-split</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type"><xsl:choose><xsl:when test="@æ¼”:æ–¹å‘ = 'horizontal out'">horizontal-out</xsl:when><xsl:when test="@æ¼”:æ–¹å‘= 'horizontal in'">horizontal-in</xsl:when><xsl:when test="@æ¼”:æ–¹å‘= 'vertical in'">vertical-in</xsl:when><xsl:when test="@æ¼”:æ–¹å‘= 'vertical out'">vertical-out</xsl:when></xsl:choose></xsl:attribute>
+ <anim:transitionFilter smil:dur="0.5s" smil:type="barnDoorWipe" smil:mode="out">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:subtype"><xsl:choose><xsl:when test="@æ¼”:æ–¹å‘ = 'horizontal out'">horizontal</xsl:when><xsl:when test="@æ¼”:æ–¹å‘= 'horizontal in'">horizontal</xsl:when><xsl:when test="@æ¼”:æ–¹å‘= 'vertical in'">vertical</xsl:when><xsl:when test="@æ¼”:æ–¹å‘= 'vertical out'">vertical</xsl:when></xsl:choose></xsl:attribute>
+ </anim:transitionFilter>
+ <anim:set smil:dur="0.001s" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden">
+ <xsl:attribute name="smil:begin"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ </anim:set>
+ </xsl:template>
+ <xsl:template match="æ¼”:百å¶çª—" mode="exit">
+ <xsl:attribute name="presentation:preset-id">ooo-exit-venetian-blinds</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type"><xsl:value-of select="@æ¼”:æ–¹å‘"/></xsl:attribute>
+ <anim:transitionFilter smil:type="blindsWipe" smil:direction="reverse" smil:mode="out">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:subtype"><xsl:choose><xsl:when test="@æ¼”:æ–¹å‘= 'horizontal'">vertical</xsl:when><xsl:when test="@æ¼”:æ–¹å‘ = 'vertical'">horizontal</xsl:when></xsl:choose></xsl:attribute>
+ </anim:transitionFilter>
+ <anim:set smil:dur="0.001s" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden">
+ <xsl:attribute name="smil:begin"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ </anim:set>
+ </xsl:template>
+ <xsl:template match="演:扇形展开" mode="exit">
+ <xsl:attribute name="presentation:preset-id">ooo-exit-wedge</xsl:attribute>
+ <anim:transitionFilter smil:type="fanWipe" smil:subtype="centerTop" smil:mode="out">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ </anim:transitionFilter>
+ <anim:set smil:dur="0.0015s" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden">
+ <xsl:attribute name="smil:begin"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ </anim:set>
+ </xsl:template>
+ <xsl:template match="æ¼”:è½®å­" mode="exit">
+ <xsl:attribute name="presentation:preset-id">ooo-exit-wheel</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type"><xsl:value-of select="@æ¼”:è¾å°„状"/></xsl:attribute>
+ <anim:transitionFilter smil:dur="0.5s" smil:type="pinWheelWipe" smil:mode="out">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:subtype"><xsl:choose><xsl:when test="@æ¼”:è¾å°„状='1'">oneBlade</xsl:when><xsl:when test="@æ¼”:è¾å°„状='2'">twoBlade</xsl:when><xsl:when test="@æ¼”:è¾å°„状='3'">threeBlade</xsl:when><xsl:when test="@æ¼”:è¾å°„状='4'">fourBlade</xsl:when><xsl:when test="@æ¼”:è¾å°„状='8'">eightBlade</xsl:when></xsl:choose></xsl:attribute>
+ </anim:transitionFilter>
+ <anim:set smil:dur="0.00025s" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden">
+ <xsl:attribute name="smil:begin"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ </anim:set>
+ </xsl:template>
+ <xsl:template match="演:擦除" mode="exit">
+ <xsl:attribute name="presentation:preset-id">ooo-exit-wipe</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type"><xsl:choose><xsl:when test="@演:速度 = 'from right'">from-right</xsl:when><xsl:when test="@演:速度 = 'from left'">from-left</xsl:when><xsl:when test="@演:速度 = 'from top'">from-top</xsl:when><xsl:when test="@演:速度 = 'from bottom'">from-bottom</xsl:when><xsl:otherwise>from-left</xsl:otherwise></xsl:choose></xsl:attribute>
+ <anim:transitionFilter smil:type="barWipe" smil:subtype="leftToRight" smil:direction="reverse" smil:mode="out">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:subtype"><xsl:choose><xsl:when test="(@演:速度 = 'from right') or (@演:速度 = 'from left')">leftToRight</xsl:when><xsl:when test="(@演:速度 = 'from top') or (@演:速度 = 'from bottom')">topToBottom</xsl:when><xsl:otherwise>leftToRight</xsl:otherwise></xsl:choose></xsl:attribute>
+ </anim:transitionFilter>
+ <anim:set smil:dur="0.006s" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden">
+ <xsl:attribute name="smil:begin"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ </anim:set>
+ </xsl:template>
+ <xsl:template match="æ¼”:éšæœºæ•ˆæžœ" mode="exit">
+ <xsl:attribute name="presentation:preset-id">ooo-exit-random</xsl:attribute>
+ <anim:transitionFilter smil:type="fade" smil:subtype="crossfade" smil:mode="out">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ </anim:transitionFilter>
+ <anim:animate smil:attributeName="x" smil:values="x;x" smil:keyTimes="0;1" presentation:additive="base">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ </anim:animate>
+ <anim:animate smil:dur="0.1s" smil:decelerate="1" smil:attributeName="y" smil:values="y;y-.03" smil:keyTimes="0;1" presentation:additive="base">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ </anim:animate>
+ <anim:animate smil:begin="0.1s" smil:dur="0.9s" smil:accelerate="1" smil:attributeName="y" smil:values="y;y+1" smil:keyTimes="0;1" presentation:additive="base">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ </anim:animate>
+ <anim:set smil:dur="0.001s" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden">
+ <xsl:attribute name="smil:begin"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::æ¼”:åºåˆ—/@æ¼”:动画对象"/></xsl:attribute>
+ </anim:set>
+ </xsl:template>
+ <xsl:template match="uof:锚点" name="图形解æž">
+ <xsl:variable name="tuxing1" select="@uof:图形引用"/>
+ <xsl:choose>
+ <xsl:when test="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]">
+ <xsl:if test="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/@uof:公共类型='png' or /uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/@uof:公共类型='jpg' or /uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/@uof:公共类型='bmp' or /uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/@uof:公共类型='gif'">
+ <xsl:element name="draw:frame">
+ <xsl:attribute name="draw:name"><xsl:variable name="pos"><xsl:value-of select="count(preceding::uof:锚点)"/></xsl:variable><xsl:value-of select="concat('图形',$pos)"/></xsl:attribute>
+ <xsl:attribute name="presentation:class">graphic</xsl:attribute>
+ <xsl:attribute name="presentation:user-transformed">true</xsl:attribute>
+ <xsl:attribute name="svg:x"><xsl:value-of select="concat(@uof:xåæ ‡,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:y"><xsl:value-of select="concat(@uof:yåæ ‡,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:width"><xsl:value-of select="concat(@uof:宽度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:height"><xsl:value-of select="concat(@uof:高度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="draw:layer">layout</xsl:attribute>
+ <xsl:if test="../æ¼”:动画/æ¼”:åºåˆ—/@æ¼”:动画对象=$tuxing1">
+ <xsl:attribute name="draw:id"><xsl:value-of select="$tuxing1"/></xsl:attribute>
+ </xsl:if>
+ <draw:image>
+ <xsl:if test="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/uof:路径">
+ <xsl:attribute name="xlink:href"><xsl:value-of select="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/uof:路径"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/uof:路径">
+ <xsl:attribute name="xlink:href"><xsl:value-of select="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/uof:路径"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/uof:æ•°æ®">
+ <office:binary-data>
+ <xsl:value-of select="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/uof:æ•°æ®"/>
+ </office:binary-data>
+ </xsl:if>
+ </draw:image>
+ </xsl:element>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="graph">
+ <xsl:with-param name="id" select="/uof:UOF/uof:对象集/图:图形[@图:标识符=$tuxing1]"/>
+ <xsl:with-param name="groupx" select="0"/>
+ <xsl:with-param name="groupy" select="0"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="graph">
+ <xsl:param name="id"/>
+ <xsl:param name="groupx"/>
+ <xsl:param name="groupy"/>
+ <xsl:for-each select="$id">
+ <xsl:variable name="tuxing1">
+ <xsl:value-of select="图:预定义图形/图:类别"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$tuxing1='11'">
+ <xsl:call-template name="Rectangle">
+ <xsl:with-param name="groupx1" select="$groupx"/>
+ <xsl:with-param name="groupy1" select="$groupy"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$tuxing1='19'">
+ <xsl:call-template name="Oval">
+ <xsl:with-param name="groupx1" select="$groupx"/>
+ <xsl:with-param name="groupy1" select="$groupy"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$tuxing1='61'">
+ <xsl:call-template name="Line">
+ <xsl:with-param name="groupx1" select="$groupx"/>
+ <xsl:with-param name="groupy1" select="$groupy"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$tuxing1='64'">
+ <xsl:call-template name="Curve">
+ <xsl:with-param name="groupx1" select="$groupx"/>
+ <xsl:with-param name="groupy1" select="$groupy"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$tuxing1='65'">
+ <xsl:call-template name="Freeform">
+ <xsl:with-param name="groupx1" select="$groupx"/>
+ <xsl:with-param name="groupy1" select="$groupy"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$tuxing1='66'">
+ <xsl:call-template name="Scribble">
+ <xsl:with-param name="groupx1" select="$groupx"/>
+ <xsl:with-param name="groupy1" select="$groupy"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$tuxing1='3'">
+ <xsl:call-template name="演文本框"/>
+ </xsl:when>
+ <xsl:when test="$tuxing1='67'">
+ <xsl:call-template name="演缩略图"/>
+ </xsl:when>
+ <xsl:when test="$tuxing1='4'">
+ <xsl:element name="draw:g">
+ <xsl:variable name="tu">
+ <xsl:value-of select="@图:标识符"/>
+ </xsl:variable>
+ <xsl:attribute name="draw:style-name"><xsl:value-of select="$tu"/></xsl:attribute>
+ <xsl:attribute name="draw:z-index"><xsl:value-of select="@图:层次"/></xsl:attribute>
+ <xsl:variable name="this-group-x">
+ <xsl:value-of select="key('rel_graphic_name',@图:标识符)/@uof:xåæ ‡"/>
+ </xsl:variable>
+ <xsl:variable name="this-group-y">
+ <xsl:value-of select="key('rel_graphic_name',@图:标识符)/uof:yåæ ‡"/>
+ </xsl:variable>
+ <xsl:variable name="group-x">
+ <xsl:value-of select="number($groupx + $this-group-x)"/>
+ </xsl:variable>
+ <xsl:variable name="group-y">
+ <xsl:value-of select="number($groupy + $this-group-y)"/>
+ </xsl:variable>
+ <xsl:call-template name="组åˆå›¾å½¢">
+ <xsl:with-param name="zuheliebiao" select="@图:组åˆåˆ—表"/>
+ <xsl:with-param name="groupx1" select="$group-x"/>
+ <xsl:with-param name="groupy1" select="$group-y"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="common">
+ <xsl:param name="groupx"/>
+ <xsl:param name="groupy"/>
+ <xsl:variable name="tuxing">
+ <xsl:value-of select="@图:标识符"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="key('rel_graphic_name',@图:标识符)">
+ <xsl:for-each select="key('rel_graphic_name',@图:标识符)">
+ <xsl:attribute name="svg:x"><xsl:value-of select="concat(@uof:xåæ ‡,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:y"><xsl:value-of select="concat(@uof:yåæ ‡,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:width"><xsl:value-of select="concat(@uof:宽度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:height"><xsl:value-of select="concat(@uof:高度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="draw:layer"><xsl:choose><xsl:when test="parent::æ¼”:æ¯ç‰ˆ">backgroundobjects</xsl:when><xsl:otherwise>layout</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="../æ¼”:动画/æ¼”:åºåˆ—/@æ¼”:动画对象=$tuxing">
+ <xsl:attribute name="draw:id"><xsl:value-of select="$tuxing"/></xsl:attribute>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="zuheweizhi-x">
+ <xsl:value-of select="图:组åˆä½ç½®/@图:xåæ ‡"/>
+ </xsl:variable>
+ <xsl:variable name="zuheweizhi-y">
+ <xsl:value-of select="图:组åˆä½ç½®/@图:yåæ ‡"/>
+ </xsl:variable>
+ <xsl:attribute name="text:anchor-type">paragraph</xsl:attribute>
+ <xsl:attribute name="svg:x"><xsl:value-of select="concat(($groupx + $zuheweizhi-x),$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:y"><xsl:value-of select="concat(($groupy + $zuheweizhi-y),$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:width"><xsl:value-of select="concat(图:预定义图形 /图:属性/图:宽度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:height"><xsl:value-of select="concat(图:预定义图形/图:属性 /图:高度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="draw:layer">layout</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="draw:style-name"><xsl:value-of select="@图:标识符"/></xsl:attribute>
+ <xsl:attribute name="draw:z-index"><xsl:value-of select="@图:层次"/></xsl:attribute>
+ <xsl:if test="图:预定义图形/图:属性/图:旋转角度 and not(图:预定义图形/图:属性/图:旋转角度='0.0')">
+ <xsl:variable name="rotate-angle">
+ <xsl:value-of select="(图:预定义图形/图:属性/图:旋转角度 * 2 * 3.14159265 ) div 360"/>
+ </xsl:variable>
+ <xsl:attribute name="draw:transform"><xsl:value-of select="concat('rotate (',$rotate-angle,') translate (-0.0194027777777778cm 3.317875cm)')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="图:文本内容">
+ <xsl:apply-templates select="图:文本内容/å­—:段è½"/>
+ <xsl:apply-templates select="图:文本内容/字:文字表"/>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="组åˆå›¾å½¢">
+ <xsl:param name="zuheliebiao"/>
+ <xsl:param name="groupx1"/>
+ <xsl:param name="groupy1"/>
+ <xsl:variable name="x">
+ <xsl:value-of select="$groupx1"/>
+ </xsl:variable>
+ <xsl:variable name="y">
+ <xsl:value-of select="$groupy1"/>
+ </xsl:variable>
+ <xsl:variable name="first-pictures">
+ <xsl:value-of select="substring-before($zuheliebiao,',')"/>
+ </xsl:variable>
+ <xsl:variable name="other-pictures">
+ <xsl:value-of select="substring-after($zuheliebiao,',')"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="contains($other-pictures,',')">
+ <xsl:call-template name="graph">
+ <xsl:with-param name="id" select="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $first-pictures]"/>
+ <xsl:with-param name="groupx" select="$groupx1"/>
+ <xsl:with-param name="groupy" select="$groupy1"/>
+ </xsl:call-template>
+ <xsl:call-template name="组åˆå›¾å½¢">
+ <xsl:with-param name="zuheliebiao" select="$other-pictures"/>
+ <xsl:with-param name="groupx1" select="$x"/>
+ <xsl:with-param name="groupy1" select="$y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="graph">
+ <xsl:with-param name="id" select="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $first-pictures]"/>
+ <xsl:with-param name="groupx" select="$groupx1"/>
+ <xsl:with-param name="groupy" select="$groupy1"/>
+ </xsl:call-template>
+ <xsl:call-template name="graph">
+ <xsl:with-param name="id" select="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $other-pictures]"/>
+ <xsl:with-param name="groupx" select="$groupx1"/>
+ <xsl:with-param name="groupy" select="$groupy1"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="Curve">
+ <xsl:param name="groupx1"/>
+ <xsl:param name="groupy1"/>
+ <xsl:element name="draw:path">
+ <xsl:variable name="width" select="number(图:预定义图形/图:属性/图:宽度)*1000"/>
+ <xsl:variable name="height" select="number(图:预定义图形/图:属性/图:高度)*1000"/>
+ <xsl:attribute name="svg:viewBox"><xsl:value-of select="concat('0 0 ',$width, ' ',$height)"/></xsl:attribute>
+ <xsl:attribute name="svg:d"><xsl:value-of select="图:预定义图形/图:关键点åæ ‡/@图:路径"/></xsl:attribute>
+ <xsl:call-template name="common">
+ <xsl:with-param name="groupx" select="$groupx1"/>
+ <xsl:with-param name="groupy" select="$groupy1"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="Freeform">
+ <xsl:param name="groupx1"/>
+ <xsl:param name="groupy1"/>
+ <xsl:element name="draw:polygon">
+ <xsl:variable name="width" select="number(图:预定义图形/图:属性/图:宽度)*1000"/>
+ <xsl:variable name="height" select="number(图:预定义图形/图:属性/图:高度)*1000"/>
+ <xsl:attribute name="svg:viewBox"><xsl:value-of select="concat('0 0 ',$width, ' ',$height)"/></xsl:attribute>
+ <xsl:attribute name="draw:points"><xsl:call-template name="drawpoints"><xsl:with-param name="points" select="图:预定义图形/图:关键点åæ ‡/@图:路径"/><xsl:with-param name="value"/></xsl:call-template></xsl:attribute>
+ <xsl:call-template name="common">
+ <xsl:with-param name="groupx" select="$groupx1"/>
+ <xsl:with-param name="groupy" select="$groupy1"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="Scribble">
+ <xsl:param name="groupx1"/>
+ <xsl:param name="groupy1"/>
+ <xsl:element name="draw:polyline">
+ <xsl:variable name="width" select="number(图:预定义图形/图:属性/图:宽度)*1000"/>
+ <xsl:variable name="height" select="number(图:预定义图形/图:属性/图:高度)*1000"/>
+ <xsl:attribute name="svg:viewBox"><xsl:value-of select="concat('0 0 ',$width, ' ',$height)"/></xsl:attribute>
+ <xsl:attribute name="draw:points"><xsl:call-template name="drawpoints"><xsl:with-param name="points" select="图:预定义图形/图:关键点åæ ‡/@图:路径"/><xsl:with-param name="value"/></xsl:call-template></xsl:attribute>
+ <xsl:call-template name="common">
+ <xsl:with-param name="groupx" select="$groupx1"/>
+ <xsl:with-param name="groupy" select="$groupy1"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="drawpoints">
+ <xsl:param name="points"/>
+ <xsl:param name="value"/>
+ <xsl:variable name="frist-piont">
+ <xsl:value-of select="substring-before($points,'lineto')"/>
+ </xsl:variable>
+ <xsl:variable name="other-points">
+ <xsl:value-of select="substring-after($points,'lineto')"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="contains($other-points,'lineto')">
+ <xsl:variable name="x-coor">
+ <xsl:value-of select="substring-before($frist-piont,' ') * 1000"/>
+ </xsl:variable>
+ <xsl:variable name="y-coor">
+ <xsl:value-of select="substring-after($frist-piont,' ') * 1000"/>
+ </xsl:variable>
+ <xsl:variable name="all-points">
+ <xsl:value-of select="concat($value,$x-coor,',',$y-coor,' ')"/>
+ </xsl:variable>
+ <xsl:call-template name="drawpoints">
+ <xsl:with-param name="points" select="$other-points"/>
+ <xsl:with-param name="value" select="$all-points"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="q-x-coor">
+ <xsl:value-of select="substring-before($frist-piont,' ') * 1000"/>
+ </xsl:variable>
+ <xsl:variable name="q-y-coor">
+ <xsl:value-of select="substring-after($frist-piont,' ') * 1000"/>
+ </xsl:variable>
+ <xsl:variable name="e-x-coor">
+ <xsl:value-of select="substring-before($other-points,' ') * 1000"/>
+ </xsl:variable>
+ <xsl:variable name="e-y-coor">
+ <xsl:value-of select="substring-after($other-points,' ') * 1000"/>
+ </xsl:variable>
+ <xsl:value-of select="concat($value,$q-x-coor,',',$q-y-coor,' ',$e-x-coor,',',$e-y-coor)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="Oval">
+ <xsl:param name="groupx1"/>
+ <xsl:param name="groupy1"/>
+ <xsl:element name="draw:ellipse">
+ <xsl:call-template name="common">
+ <xsl:with-param name="groupx" select="$groupx1"/>
+ <xsl:with-param name="groupy" select="$groupy1"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="Rectangle">
+ <xsl:param name="groupx1"/>
+ <xsl:param name="groupy1"/>
+ <xsl:element name="draw:rect">
+ <xsl:call-template name="common">
+ <xsl:with-param name="groupx" select="$groupx1"/>
+ <xsl:with-param name="groupy" select="$groupy1"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="Line">
+ <xsl:param name="groupx1"/>
+ <xsl:param name="groupy1"/>
+ <xsl:element name="draw:line">
+ <xsl:variable name="tuxing1" select="@图:标识符"/>
+ <xsl:choose>
+ <xsl:when test="key('rel_graphic_name',@图:标识符)">
+ <xsl:for-each select="key('rel_graphic_name',@图:标识符)">
+ <xsl:attribute name="svg:x1"><xsl:value-of select="concat(@uof:xåæ ‡,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:y1"><xsl:value-of select="concat(@uof:yåæ ‡,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:x2"><xsl:value-of select="concat((@uof:xåæ ‡ + @uof:宽度),$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:y2"><xsl:value-of select="concat((@uof:yåæ ‡ + @uof:高度),$uofUnit)"/></xsl:attribute>
+ <xsl:if test="../æ¼”:动画/æ¼”:åºåˆ—/@æ¼”:动画对象=$tuxing1">
+ <xsl:attribute name="draw:id"><xsl:value-of select="$tuxing1"/></xsl:attribute>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="zuheweizhi-x">
+ <xsl:value-of select="图:组åˆä½ç½®/@图:xåæ ‡"/>
+ </xsl:variable>
+ <xsl:variable name="zuheweizhi-y">
+ <xsl:value-of select="图:组åˆä½ç½®/@图:yåæ ‡"/>
+ </xsl:variable>
+ <xsl:variable name="hex">
+ <xsl:value-of select="concat(number($groupx1 + $zuheweizhi-x),$uofUnit)"/>
+ </xsl:variable>
+ <xsl:variable name="hey">
+ <xsl:value-of select="concat(number($groupy1 + $zuheweizhi-y),$uofUnit)"/>
+ </xsl:variable>
+ <xsl:attribute name="svg:x1"><xsl:value-of select="$hex"/></xsl:attribute>
+ <xsl:attribute name="svg:y1"><xsl:value-of select="$hey"/></xsl:attribute>
+ <xsl:attribute name="svg:x2"><xsl:value-of select="concat(($hex + 图:预定义图形/图:属性/图:宽度),$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:y2"><xsl:value-of select="concat(($hey + 图:预定义图形/图:属性/图:高度),$uofUnit)"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="text:anchor-type">paragraph</xsl:attribute>
+ <xsl:attribute name="draw:style-name"><xsl:value-of select="$tuxing1"/></xsl:attribute>
+ <xsl:attribute name="draw:z-index"><xsl:value-of select="@图:层次"/></xsl:attribute>
+ <xsl:if test="图:预定义图形/图:属性/图:旋转角度 and not(图:预定义图形/图:属性/图:旋转角度='0.0')">
+ <xsl:variable name="rotate-angle">
+ <xsl:value-of select="(图:预定义图形/图:属性/图:旋转角度 * 2 * 3.14159265 ) div 360"/>
+ </xsl:variable>
+ <xsl:attribute name="draw:transform"><xsl:value-of select="concat('rotate (',$rotate-angle,') translate (-0.0194027777777778cm 3.317875cm)')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="图:文本内容">
+ <xsl:apply-templates select="图:文本内容/å­—:段è½"/>
+ <xsl:apply-templates select="图:文本内容/字:文字表"/>
+ </xsl:if>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="演文本框">
+ <xsl:for-each select="key('rel_graphic_name',@图:标识符)">
+ <xsl:variable name="tuxing1" select="@uof:图形引用"/>
+ <xsl:element name="draw:frame">
+ <xsl:attribute name="svg:x"><xsl:value-of select="concat(@uof:xåæ ‡,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:y"><xsl:value-of select="concat(@uof:yåæ ‡,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:width"><xsl:value-of select="concat(@uof:宽度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:height"><xsl:value-of select="concat(@uof:高度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="draw:layer"><xsl:choose><xsl:when test="parent::æ¼”:æ¯ç‰ˆ">backgroundobjects</xsl:when><xsl:otherwise>layout</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $tuxing1]/图:预定义图形/图:类别 = '3' and (parent::æ¼”:å¹»ç¯ç‰‡/@æ¼”:é…色方案引用) and not(@uof:å ä½ç¬¦ = 'graphic')">
+ <xsl:attribute name="presentation:style-name"><xsl:value-of select="parent::æ¼”:å¹»ç¯ç‰‡/@æ¼”:é…色方案引用"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="../æ¼”:动画/æ¼”:åºåˆ—/@æ¼”:动画对象=$tuxing1">
+ <xsl:attribute name="draw:id"><xsl:value-of select="$tuxing1"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="not(@uof:å ä½ç¬¦ = 'graphic')">
+ <xsl:attribute name="presentation:style-name"><xsl:value-of select="@uof:图形引用"/></xsl:attribute>
+ </xsl:if>
+ <xsl:variable name="placeholdType">
+ <xsl:value-of select="@uof:å ä½ç¬¦"/>
+ </xsl:variable>
+ <xsl:if test="@uof:å ä½ç¬¦">
+ <xsl:attribute name="presentation:class"><xsl:choose><xsl:when test="@uof:å ä½ç¬¦ = 'clipart'">graphic</xsl:when><xsl:when test="@uof:å ä½ç¬¦ = 'media_clip'">graphic</xsl:when><xsl:when test="@uof:å ä½ç¬¦ = 'graphics'">graphic</xsl:when><xsl:when test="@uof:å ä½ç¬¦ = 'number'">page_number</xsl:when><xsl:when test="@uof:å ä½ç¬¦ = 'centertitle'">title</xsl:when><xsl:when test="@uof:å ä½ç¬¦ = 'date'">date-time</xsl:when><xsl:when test="@uof:å ä½ç¬¦ = 'vertical_text'">vertical_outline</xsl:when><xsl:when test="@uof:å ä½ç¬¦ = 'vertical_subtitle'">vertical_outline</xsl:when><xsl:otherwise><xsl:value-of select="@uof:å ä½ç¬¦"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:for-each select="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $tuxing1]">
+ <xsl:variable name="leibie">
+ <xsl:value-of select="图:预定义图形/图:类别"/>
+ </xsl:variable>
+ <xsl:if test="图:预定义图形/图:属性/图:旋转角度 and not(图:预定义图形/图:属性/图:旋转角度='0.0')">
+ <xsl:variable name="rotate-angle">
+ <xsl:value-of select="(图:预定义图形/图:属性/图:旋转角度 * 2 * 3.14159265 ) div 360"/>
+ </xsl:variable>
+ <xsl:attribute name="draw:transform"><xsl:value-of select="concat('rotate (',$rotate-angle,') translate (-0.0194027777777778cm 3.317875cm)')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="图:文本内容 or @图:其他对象">
+ <xsl:attribute name="presentation:user-transformed">true</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="presentation:placeholder">true</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="$placeholdType = 'graphic' or $placeholdType = 'clipart' or $placeholdType ='media_clip'">
+ <draw:image/>
+ </xsl:when>
+ <xsl:when test="$placeholdType = 'table' or $placeholdType = 'chart' or $placeholdType ='object'">
+ <draw:object/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="draw:text-box">
+ <xsl:apply-templates select="图:文本内容/å­—:段è½"/>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="演缩略图">
+ <draw:page-thumbnail>
+ <xsl:call-template name="common"/>
+ <xsl:attribute name="draw:layer">layout</xsl:attribute>
+ <xsl:attribute name="draw:page-number"><xsl:for-each select="../.."><xsl:value-of select="count(preceding-sibling::æ¼”:å¹»ç¯ç‰‡) + 1"/></xsl:for-each></xsl:attribute>
+ <xsl:attribute name="presentation:class">page</xsl:attribute>
+ </draw:page-thumbnail>
+ </xsl:template>
+ <xsl:template match="æ¼”:页é¢ç‰ˆå¼">
+ <xsl:element name="style:presentation-page-layout">
+ <xsl:attribute name="style:name"><xsl:value-of select="@演:标识符"/></xsl:attribute>
+ <xsl:apply-templates select="æ¼”:å ä½ç¬¦" mode="layout"/>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="æ¼”:å ä½ç¬¦" mode="layout">
+ <presentation:placeholder>
+ <xsl:attribute name="presentation:object"><xsl:choose><xsl:when test="@演:类型='vertical_text'">vertical_outline</xsl:when><xsl:when test="@演:类型='date'">date-time</xsl:when><xsl:when test="@演:类型='number'">page_number</xsl:when><xsl:otherwise><xsl:value-of select="@演:类型"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="svg:x"><xsl:value-of select="concat(uof:锚点/@uof:xåæ ‡,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:y"><xsl:value-of select="concat(uof:锚点/@uof:yåæ ‡,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:width"><xsl:value-of select="concat(uof:锚点/@uof:宽度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:height"><xsl:value-of select="concat(uof:锚点/@uof:高度,$uofUnit)"/></xsl:attribute>
+ </presentation:placeholder>
+ </xsl:template>
+ <xsl:template match="å­—:段è½">
+ <xsl:choose>
+ <xsl:when test="å­—:段è½å±žæ€§/å­—:自动编å·ä¿¡æ¯">
+ <xsl:call-template name="ç¼–å·è§£æž"/>
+ </xsl:when>
+ <xsl:when test="å­—:å¥/å­—:分页符">
+ <xsl:call-template name="processPageBreaks"/>
+ </xsl:when>
+ <xsl:when test="string(parent::node()/@uof:locID)='t0107'">
+ <xsl:call-template name="jiaozhu"/>
+ </xsl:when>
+ <xsl:when test="string(parent::node()/@uof:locID)='t0108'">
+ <xsl:call-template name="weizhu"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="commonParagraph"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="jiaozhu">
+ <xsl:element name="text:footnote">
+ <xsl:element name="text:footnote-body">
+ <xsl:call-template name="commonParagraph"/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="weizhu">
+ <xsl:element name="text:endnote">
+ <xsl:element name="text:endnote-body">
+ <xsl:call-template name="commonParagraph"/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="processPageBreaks">
+ <xsl:variable name="pageBreak" select="å­—:å¥/å­—:分页符"/>
+ <xsl:call-template name="createSubParagraph">
+ <xsl:with-param name="list" select="$pageBreak[1]/preceding-sibling::å­—:å¥"/>
+ <xsl:with-param name="pageBreak"/>
+ <xsl:with-param name="needsPageBreak">false</xsl:with-param>
+ </xsl:call-template>
+ <xsl:for-each select="$pageBreak">
+ <xsl:call-template name="createSubParagraph">
+ <xsl:with-param name="list" select="./following-sibling::å­—:å¥[preceding::å­—:å¥/å­—:分页符 = '.']"/>
+ <xsl:with-param name="pageBreak" select="."/>
+ <xsl:with-param name="needsPageBreak">true</xsl:with-param>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="createSubParagraph">
+ <xsl:param name="list"/>
+ <xsl:param name="pageBreak"/>
+ <xsl:param name="needsPageBreak"/>
+ <xsl:if test="(count($list) &gt; 0) or ($needsPageBreak ='true') ">
+ <xsl:element name="text:p">
+ <xsl:choose>
+ <xsl:when test="$needsPageBreak = 'true'">
+ <xsl:choose>
+ <xsl:when test="ancestor::å­—:段è½/å­—:段è½å±žæ€§">
+ <xsl:attribute name="text:style-name">P<xsl:number from="/uof:UOF/uof:演示文稿/æ¼”:主体" level="any" count="å­—:段è½å±žæ€§"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="text:style-name">PageBreak</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="$pageBreak">
+ <xsl:apply-templates select="$pageBreak"/>
+ </xsl:if>
+ <xsl:apply-templates select="$list"/>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="字:区域开始[@字:类型='bookmark']">
+ <text:bookmark-start text:name="{@字:标识符}"/>
+ </xsl:template>
+ <xsl:template match="å­—:区域结æŸ[preceding::å­—:区域开始[1]/@å­—:类型='bookmark']">
+ <text:bookmark-end text:name="{@字:标识符引用}"/>
+ </xsl:template>
+ <xsl:template match="å­—:段è½/å­—:域开始">
+ <xsl:choose>
+ <xsl:when test="@字:类型='CREATEDATE'">
+ <xsl:variable name="datestr" select="../å­—:å¥/å­—:文本串"/>
+ <xsl:element name="text:date">
+ <xsl:attribute name="style:data-style-name">Time<xsl:number from="/uof:UOF/uof:演示文稿/æ¼”:主体" level="any" count="å­—:段è½/å­—:域开始[@å­—:类型 = 'CREATEDATE']"/></xsl:attribute>
+ <xsl:attribute name="text:date-value"><xsl:value-of select="concat(substring-before($datestr,' '),'T',substring-after($datestr,' '))"/></xsl:attribute>
+ <xsl:value-of select="$datestr"/>
+ </xsl:element>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="commonParagraph">
+ <xsl:element name="text:p">
+ <xsl:if test="@字:动画标识">
+ <xsl:attribute name="text:id"><xsl:value-of select="@字:动画标识"/></xsl:attribute>
+ </xsl:if>
+ <xsl:call-template name="commonParagraphAttributes"/>
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="commonParagraphAttributes">
+ <xsl:choose>
+ <xsl:when test="å­—:段è½å±žæ€§">
+ <xsl:attribute name="text:style-name"><xsl:value-of select="å­—:段è½å±žæ€§/@å­—:å¼æ ·å¼•ç”¨"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="generate-id(ancestor::å­—:主体/descendant::å­—:段è½[1]) = generate-id(.)">
+ <xsl:variable name="paragraph-number">
+ <xsl:number from="/uof:UOF/uof:文字处ç†/å­—:主体" level="any" count="å­—:段è½[å­—:段è½å±žæ€§]"/>
+ </xsl:variable>
+ <xsl:attribute name="text:style-name">P<xsl:value-of select="number($paragraph-number)"/>_1</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="not(å­—:段è½å±žæ€§) and (descendant::å­—:分æ ç¬¦ or ancestor::å­—:分节/descendant::å­—:节属性[å­—:分æ /@å­—:æ æ•° &gt; 1])">
+ <xsl:attribute name="text:style-name">ColumnBreakPara</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="å­—:å¥">
+ <xsl:apply-templates select="字:文本串"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="å­—:段è½å±žæ€§"/>
+ <xsl:template match="å­—:å¥/å­—:å¥å±žæ€§"/>
+ <xsl:template match="å­—:å¥å±žæ€§" mode="style">
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name">T<xsl:number from="/uof:UOF/uof:对象集" level="any" count="å­—:å¥å±žæ€§" format="1"/></xsl:attribute>
+ <xsl:attribute name="style:family">text</xsl:attribute>
+ <xsl:if test="@å­—:å¼æ ·å¼•ç”¨">
+ <xsl:attribute name="style:parent-style-name"><xsl:value-of select="@å­—:å¼æ ·å¼•ç”¨"/></xsl:attribute>
+ </xsl:if>
+ <xsl:element name="style:text-properties">
+ <xsl:apply-templates select="./*"/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="å­—:å¥/å­—:文本串">
+ <xsl:choose>
+ <xsl:when test="string(.) = ' ' ">
+ <xsl:element name="text:s"/>
+ </xsl:when>
+ <xsl:when test="contains(.,' ')">
+ <xsl:call-template name="replace-spaces">
+ <xsl:with-param name="curr-string" select="."/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="replace-spaces">
+ <xsl:param name="curr-string"/>
+ <xsl:if test="contains($curr-string,' ')">
+ <xsl:value-of select="substring-before($curr-string,' ')"/>
+ <text:s text:c="2"/>
+ <xsl:variable name="next-string" select="substring-after($curr-string,' ')"/>
+ <xsl:choose>
+ <xsl:when test="contains($next-string, ' ')">
+ <xsl:call-template name="replace-spaces">
+ <xsl:with-param name="curr-string" select="$next-string"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$next-string"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="å­—:å¥">
+ <xsl:if test="name(following-sibling::*[1])!='å­—:域结æŸ'">
+ <xsl:if test="å­—:æ¢è¡Œç¬¦">
+ <xsl:element name="text:line-break"/>
+ </xsl:if>
+ <xsl:variable name="currently-node" select="./字:锚点"/>
+ <xsl:choose>
+ <xsl:when test="å­—:å¥å±žæ€§//å­—:éšè—文字/@å­—:值='true'">
+ <text:hidden-text text:is-hidden="true" text:string-value="{.}"/>
+ </xsl:when>
+ <xsl:when test="字:区域开始[@字:类型='hyperlink']">
+ <xsl:element name="text:a">
+ <xsl:attribute name="xlink:type">simple</xsl:attribute>
+ <xsl:variable name="hyperDest" select="字:区域开始/@字:标识符"/>
+ <xsl:attribute name="xlink:href"><xsl:for-each select="/uof:UOF/uof:链接集/uof:超级链接"><xsl:if test="@uof:链æº=$hyperDest"><xsl:if test="@uof:目标"><xsl:value-of select="@uof:目标"/></xsl:if><xsl:if test="@uof:书签"><xsl:variable name="bookmarkDest" select="@uof:书签"/><xsl:for-each select="/uof:UOF/uof:书签集/uof:书签"><xsl:if test="@uof:å称=$bookmarkDest"><xsl:value-of select="concat('#',uof:文本ä½ç½®/@å­—:区域引用)"/></xsl:if></xsl:for-each></xsl:if></xsl:if></xsl:for-each></xsl:attribute>
+ <xsl:apply-templates select="字:文本串"/>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="(preceding-sibling::å­—:å¥) or (å­—:å¥å±žæ€§)or(å­—:区域开始)">
+ <xsl:element name="text:span">
+ <xsl:choose>
+ <xsl:when test="字:区域开始[@字:类型='annotation']">
+ <xsl:variable name="ref_comment">
+ <xsl:value-of select="字:区域开始/@字:标识符"/>
+ </xsl:variable>
+ <xsl:apply-templates/>
+ <xsl:apply-templates select="/uof:UOF/uof:文字处ç†/å­—:公用处ç†è§„则/å­—:批注集/å­—:批注[@å­—:区域引用 = $ref_comment]"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="stylenum">
+ <xsl:number from="/uof:UOF/uof:文字处ç†/å­—:主体" level="any" count="å­—:å¥" format="1"/>
+ </xsl:variable>
+ <xsl:attribute name="text:style-name"><xsl:value-of select="å­—:å¥å±žæ€§/@å­—:å¼æ ·å¼•ç”¨"/></xsl:attribute>
+ <xsl:apply-templates/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="node()[name() = 'å­—:ä½ç½®']">
+ <xsl:variable name="height">100% </xsl:variable>
+ <xsl:variable name="position">
+ <xsl:choose>
+ <xsl:when test="parent::å­—:å¥å±žæ€§//å­—:ä½ç½®">
+ <xsl:value-of select="concat( parent::å­—:å¥å±žæ€§//å­—:ä½ç½®, '%')"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="style:text-position"><xsl:value-of select="concat(concat( $position, ' '), $height)"/></xsl:attribute>
+ </xsl:template>
+ <xsl:template match="字:字体">
+ <xsl:if test="@å­—:å­—å·">
+ <xsl:attribute name="fo:font-size"><xsl:value-of select="@å­—:å­—å·"/>pt</xsl:attribute>
+ <xsl:attribute name="style:font-size-asian"><xsl:value-of select="@å­—:å­—å·"/>pt</xsl:attribute>
+ <xsl:attribute name="style:font-size-complex"><xsl:value-of select="@å­—:å­—å·"/>pt</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@å­—:ç›¸å¯¹å­—å· and self::node( )[not(parent::å­—:å¥å±žæ€§)]">
+ <xsl:variable name="stylename" select="parent::node()/@å­—:基å¼æ ·å¼•ç”¨"/>
+ <xsl:variable name="zihao">
+ <xsl:for-each select="/uof:UOF/uof:å¼æ ·é›†//uof:段è½å¼æ ·[@å­—:标识符=$stylename]">
+ <xsl:value-of select="å­—:字体/@å­—:å­—å·"/>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:variable name="font-size" select="@å­—:相对字å·"/>
+ <xsl:attribute name="fo:font-size"><xsl:value-of select="($zihao * $font-size div 100)"/>pt</xsl:attribute>
+ <xsl:attribute name="style:font-size-asian"><xsl:value-of select="($zihao * $font-size div 100)"/>pt</xsl:attribute>
+ <xsl:attribute name="style:font-size-complex"><xsl:value-of select="($zihao * $font-size div 100)"/>pt</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@字:颜色">
+ <xsl:attribute name="fo:color"><xsl:value-of select="string(@字:颜色)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@字:中文字体引用">
+ <xsl:attribute name="style:font-name-asian"><xsl:value-of select="@字:中文字体引用"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@字:西文字体引用">
+ <xsl:attribute name="style:font-name"><xsl:value-of select="@字:西文字体引用"/></xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="字:斜体">
+ <xsl:if test="@字:值='true'">
+ <xsl:attribute name="fo:font-style">italic</xsl:attribute>
+ <xsl:attribute name="fo:font-style-asian">italic</xsl:attribute>
+ <xsl:attribute name="style:font-style-asian">italic</xsl:attribute>
+ <xsl:attribute name="style:font-style-complex">italic</xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="字:粗体">
+ <xsl:if test="@字:值='true'">
+ <xsl:attribute name="fo:font-weight">bold</xsl:attribute>
+ <xsl:attribute name="fo:font-weight-asian">bold</xsl:attribute>
+ <xsl:attribute name="style:font-weight-asian">bold</xsl:attribute>
+ <xsl:attribute name="style:font-weight-complex">bold</xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="字:下划线">
+ <xsl:choose>
+ <xsl:when test="@字:字下划线 = 'true'">
+ <xsl:attribute name="style:text-underline">single</xsl:attribute>
+ <xsl:attribute name=" style:text-underline-color">font-color</xsl:attribute>
+ <xsl:attribute name="fo:score-spaces">false</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'thick'">
+ <xsl:attribute name="style:text-underline">bold</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'dotted-heavy'">
+ <xsl:attribute name="style:text-underline">bold-dotted</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'dashed-heavy'">
+ <xsl:attribute name="style:text-underline">bold-dash</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'dash-long'">
+ <xsl:attribute name="style:text-underline">long-dash</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'dash-long-heavy'">
+ <xsl:attribute name="style:text-underline">bold-long-dash</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'dash-dot-heavy'">
+ <xsl:attribute name="style:text-underline">bold-dot-dash</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'dash-dot-dot-heavy'">
+ <xsl:attribute name="style:text-underline">bold-dot-dot-dash</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'wavy-heavy'">
+ <xsl:attribute name="style:text-underline">bold-wave</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'wavy-double'">
+ <xsl:attribute name="style:text-underline">double-wave</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:text-underline"><xsl:value-of select="@字:类型"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="@字:颜色 and not(@字:颜色 = 'auto')">
+ <xsl:attribute name="style:text-underline-color"><xsl:value-of select="concat( '#', @字:颜色)"/></xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="字:阴影">
+ <xsl:attribute name="style:text-shadow">1pt 1pt</xsl:attribute>
+ <xsl:attribute name="fo:text-shadow">1pt 1pt</xsl:attribute>
+ </xsl:template>
+ <xsl:template match="字:删除线">
+ <xsl:choose>
+ <xsl:when test="@字:类型 = 'single' ">
+ <xsl:attribute name="style:text-crossing-out">single-line</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字类型 = 'double'">
+ <xsl:attribute name="style:text-crossing-out">double-line</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="å­—:çªå‡ºæ˜¾ç¤º">
+ <xsl:attribute name="fo:text-transform">uppercase</xsl:attribute>
+ <xsl:attribute name="fo:text-background-color"><xsl:value-of select="string(@字:颜色)"/></xsl:attribute>
+ </xsl:template>
+ <xsl:template match="@字:颜色[not(.='auto')]">
+ <xsl:attribute name="fo:color">#<xsl:value-of select="."/></xsl:attribute>
+ </xsl:template>
+ <xsl:template match="字:浮雕">
+ <xsl:attribute name="style:font-relief">embossed</xsl:attribute>
+ </xsl:template>
+ <xsl:template match="字:外框">
+ <xsl:attribute name="style:text-outline">true</xsl:attribute>
+ </xsl:template>
+ <xsl:template match="字:缩放">
+ <xsl:attribute name="style:text-scale"><xsl:value-of select="@å­—:å­—å·"/></xsl:attribute>
+ </xsl:template>
+ <xsl:template match="å­—:字符间è·[parent::å­—:å¥å±žæ€§]">
+ <xsl:attribute name="fo:letter-spacing"><xsl:value-of select="concat( floor(number(å­—:å­—ç¬¦é—´è· div 1440) * 2540) div 1000, 'cm')"/></xsl:attribute>
+ </xsl:template>
+ <xsl:template match="uof:字体集">
+ <xsl:if test="not(uof:字体声明[@uof:å称='StarSymbol'])">
+ <style:font-face style:name="StarSymbol" svg:font-family="StarSymbol" style:font-charset="x-symbol"/>
+ </xsl:if>
+ <xsl:for-each select="uof:字体声明">
+ <xsl:element name="style:font-face">
+ <xsl:attribute name="style:name"><xsl:value-of select="@uof:å称"/></xsl:attribute>
+ <xsl:attribute name="svg:font-family"><xsl:value-of select="@uof:字体æ—"/></xsl:attribute>
+ <xsl:if test="@uof:字符集 = '02'">
+ <xsl:attribute name="style:font-charset">x-symbol</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@uof:字体æ—">
+ <xsl:choose>
+ <xsl:when test="@uof:å­—ä½“æ— = 'Swiss'">
+ <xsl:attribute name="style:font-family-generic">swiss</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@uof:å­—ä½“æ— ='Modern'">
+ <xsl:attribute name="style:font-family-generic">modern</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@uof:字体æ—='Roman'">
+ <xsl:attribute name="style:font-family-generic">roman</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@uof:å­—ä½“æ— ='Script'">
+ <xsl:attribute name="style:font-family-generic">script</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@uof:å­—ä½“æ— ='Decorative'">
+ <xsl:attribute name="style:font-family-generic">decorative</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@uof:å­—ä½“æ— ='System'">
+ <xsl:attribute name="style:font-family-generic">system</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:font-family-generic">system</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:attribute name="style:font-pitch">12</xsl:attribute>
+ </xsl:element>
+ </xsl:for-each>
+ <xsl:apply-templates select="uof:字体声明"/>
+ </xsl:template>
+ <xsl:template match="uof:元数æ®">
+ <office:meta>
+ <meta:generator>UOFText 2004</meta:generator>
+ <dc:title>
+ <xsl:value-of select="uof:标题"/>
+ </dc:title>
+ <dc:description>
+ <xsl:value-of select="uof:摘è¦"/>
+ </dc:description>
+ <dc:subject>
+ <xsl:value-of select="uof:主题"/>
+ </dc:subject>
+ <meta:initial-creator>
+ <xsl:value-of select="uof:作者"/>
+ </meta:initial-creator>
+ <meta:creation-date>
+ <xsl:value-of select="substring-before( uof:创建日期, 'Z')"/>
+ </meta:creation-date>
+ <dc:creator>
+ <xsl:value-of select="uof:最åŽä½œè€…"/>
+ </dc:creator>
+ <dc:date>
+ <xsl:value-of select="substring-before( uof:编辑时间, 'Z')"/>
+ </dc:date>
+ <meta:printed-by/>
+ <meta:print-date/>
+ <meta:keywords>
+ <meta:keyword>
+ <xsl:value-of select="uof:关键字集/uof:关键字"/>
+ </meta:keyword>
+ </meta:keywords>
+ <dc:language/>
+ <meta:editing-cycles>
+ <xsl:value-of select="uof:编辑次数"/>
+ </meta:editing-cycles>
+ <meta:editing-duration>
+ <xsl:if test="uof:编辑时间">
+ <xsl:value-of select="concat('PT', floor(uof:编辑时间 div 60), 'H', uof:编辑时间 mod 60, 'M0S')"/>
+ </xsl:if>
+ </meta:editing-duration>
+ <meta:user-defined meta:name="Category">
+ <xsl:value-of select="uof:分类"/>
+ </meta:user-defined>
+ <meta:user-defined meta:name="Manager">
+ <xsl:value-of select="uof:ç»ç†å称"/>
+ </meta:user-defined>
+ <meta:user-defined meta:name="Company">
+ <xsl:value-of select="uof:å…¬å¸å称"/>
+ </meta:user-defined>
+ <meta:user-defined meta:name="Version">
+ <xsl:value-of select="uof:创建应用程åº"/>
+ </meta:user-defined>
+ <xsl:if test="uof:文档模æ¿|child::*[@uof:locID='u0013']">
+ <meta:template xlink:type="simple" xlink:actuate="onRequest" xlink:href="{child::*[@uof:locID='u0013']}"/>
+ </xsl:if>
+ <xsl:if test="uof:用户自定义元数æ®é›†/uof:用户自定义元数æ®|child::*[@uof:locID='u0016']/*[@uof:locID='u0017']">
+ <xsl:for-each select="uof:用户自定义元数æ®é›†/uof:用户自定义元数æ®|child::*[@uof:locID='u0016']/*[@uof:locID='u0017']">
+ <xsl:element name="meta:user-defined">
+ <xsl:attribute name="meta:name"><xsl:value-of select="@uof:å称"/></xsl:attribute>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:if>
+ <meta:document-statistic meta:page-count="{child::*[@uof:locID='u0020']}" meta:paragraph-count="{child::*[@uof:locID='u0025']}" meta:word-count="{child::*[@uof:locID='u0023']}" meta:object-count="{child::*[@uof:locID='u0026']}" meta:character-count="{child::*[@uof:locID='u0021']}"/>
+ <meta:document-statistic/>
+ </office:meta>
+ </xsl:template>
+ <xsl:template match="uof:用户自定义元数æ®é›†">
+ <xsl:for-each select="node()[@å称]">
+ <meta:user-defined meta:name="{name()}">
+ <xsl:value-of select="."/>
+ </meta:user-defined>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="parse-range">
+ <xsl:param name="range-value"/>
+ <xsl:param name="last"/>
+ <xsl:variable name="first-pit">
+ <xsl:choose>
+ <xsl:when test="contains($range-value,',')">
+ <xsl:value-of select="substring-before($range-value,',')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$range-value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="current">
+ <xsl:choose>
+ <xsl:when test="contains($first-pit,':')">
+ <xsl:variable name="R-start" select="substring-before(substring-after($first-pit,'R'),'C')"/>
+ <xsl:variable name="C-start" select="substring-before(substring-after($first-pit,'C'),':')"/>
+ <xsl:variable name="second-pit" select="substring-after($first-pit,':')"/>
+ <xsl:variable name="R-end" select="substring-before(substring-after($second-pit,'R'),'C')"/>
+ <xsl:variable name="C-end" select="substring-after($second-pit,'C')"/>
+ <xsl:variable name="the-str">
+ <xsl:call-template name="condition-rc-str">
+ <xsl:with-param name="r-start" select="$R-start"/>
+ <xsl:with-param name="r-end" select="$R-end"/>
+ <xsl:with-param name="c-start" select="$C-start"/>
+ <xsl:with-param name="c-end" select="$C-end"/>
+ <xsl:with-param name="last" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="$the-str"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat($first-pit,',')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="contains($range-value,',')">
+ <xsl:call-template name="parse-range">
+ <xsl:with-param name="range-value" select="substring-after($range-value,',')"/>
+ <xsl:with-param name="last" select="concat($last,$current)"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat($last,$current)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="condition-rc-str">
+ <xsl:param name="r-start"/>
+ <xsl:param name="r-end"/>
+ <xsl:param name="c-start"/>
+ <xsl:param name="c-end"/>
+ <xsl:param name="last"/>
+ <xsl:variable name="current">
+ <xsl:call-template name="condition-c-str">
+ <xsl:with-param name="rc-str" select="concat('R',$r-start)"/>
+ <xsl:with-param name="start" select="$c-start"/>
+ <xsl:with-param name="end" select="$c-end"/>
+ <xsl:with-param name="last" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="$r-start &lt; $r-end">
+ <xsl:call-template name="condition-rc-str">
+ <xsl:with-param name="r-start" select="$r-start + 1"/>
+ <xsl:with-param name="r-end" select="$r-end"/>
+ <xsl:with-param name="c-start" select="$c-start"/>
+ <xsl:with-param name="c-end" select="$c-end"/>
+ <xsl:with-param name="last" select="concat($last,$current)"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="$r-start = $r-end">
+ <xsl:value-of select="concat($last,$current)"/>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="condition-c-str">
+ <xsl:param name="rc-str"/>
+ <xsl:param name="start"/>
+ <xsl:param name="end"/>
+ <xsl:param name="last"/>
+ <xsl:variable name="current" select="concat($rc-str,'C',$start,',')"/>
+ <xsl:if test="$start &lt; $end">
+ <xsl:call-template name="condition-c-str">
+ <xsl:with-param name="rc-str" select="$rc-str"/>
+ <xsl:with-param name="start" select="$start + 1"/>
+ <xsl:with-param name="end" select="$end"/>
+ <xsl:with-param name="last" select="concat($last,$current)"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="$start = $end">
+ <xsl:value-of select="concat($last,$current)"/>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="condition-str">
+ <xsl:param name="param-str"/>
+ <xsl:choose>
+ <xsl:when test="contains($param-str,'(')">
+ <xsl:call-template name="condition-str">
+ <xsl:with-param name="param-str" select="substring-after($param-str,'(')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-before($param-str,':')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="encode-as-cell-range-address">
+ <xsl:param name="string"/>
+ <xsl:value-of select="$string"/>
+ </xsl:template>
+ <xsl:template name="encode-as-cell-address">
+ <xsl:param name="string"/>
+ <xsl:value-of select="$string"/>
+ </xsl:template>
+ <xsl:param name="dpi" select="111"/>
+ <xsl:param name="centimeter-in-mm" select="10"/>
+ <xsl:param name="inch-in-mm" select="25.4"/>
+ <xsl:param name="didot-point-in-mm" select="0.376065"/>
+ <xsl:param name="pica-in-mm" select="4.2333333"/>
+ <xsl:param name="point-in-mm" select="0.3527778"/>
+ <xsl:param name="twip-in-mm" select="0.017636684"/>
+ <xsl:param name="pixel-in-mm" select="$inch-in-mm div $dpi"/>
+ <!-- ***** MEASUREMENT CONVERSIONS *****
+ PARAM 'value'
+ The measure to be converted.
+ The current measure is judged by a substring (e.g. 'mm', 'cm', 'in', 'pica'...)
+ directly added to the number.
+
+ PARAM 'rounding-factor'
+ Is used for the rounding of decimal places.
+ The parameter number is the product of 1 and some '10', where
+ every zero represents a decimal place.
+
+ For example, providing as parameter:
+ <xsl:param name="rounding-factor" select="10000" />
+ Gives by default four decimal places.
+
+ To round two decimal places, basically the following is done:
+ <xsl:value-of select="round(100 * value) div 100"/>
+
+ RETURN The converted number, by default rounded to four decimal places.
+ In case the input measure could not be matched the same value is
+ returned and a warning message is written out.
+
+
+
+ MEASURE LIST:
+ * 1 milimeter (mm), the basic measure
+
+ * 1 centimeter (cm) = 10 mm
+
+ * 1 inch (in) = 25.4 mm
+ While the English have already seen the light (read: the metric system), the US
+ remains loyal to this medieval system.
+
+ * 1 point (pt) = 0.35277777.. mm
+ Sometimes called PostScript point (ppt), as when Adobe created PostScript, they added their own system of points.
+ There are exactly 72 PostScript points in 1 inch.
+
+ * 1 twip = twentieth of a (PostScript) point
+ A twip (twentieth of a point) is a 1/20th of a PostScript point, a traditional measure in printing.
+
+ * 1 didot point (dpt) = 0.376065 mm
+ Didot point after the French typographer Firmin Didot (1764-1836).
+
+ More details under
+ http://www.unc.edu/~rowlett/units/dictP.html:
+ "A unit of length used by typographers and printers. When printing was done
+ from hand-set metal type, one point represented the smallest element of type
+ that could be handled, roughly 1/64 inch. Eventually, the point was standardized
+ in Britain and America as exactly 1/72.27 = 0.013 837 inch, which is
+ about 0.35 mm (351.46 micrometers). In continental Europe, typographers
+ traditionally used a slightly larger point of 0.014 83 inch (about
+ 1/72 pouce, 0.377 mm, or roughly 1/67 English inch), called a Didot point
+ after the French typographer Firmin Didot (1764-1836). In the U.S.,
+ Adobe software defines the point to be exactly 1/72 inch (0.013 888 9 inch
+ or 0.352 777 8 millimeters) and TeX software uses a slightly smaller point
+ of 0.351 459 8035 mm. The German standards agency DIN has proposed that
+ all these units be replaced by multiples of 0.25 millimeters (1/101.6 inch).
+
+ * 1 pica = 4.233333 mm
+ 1/6 inch or 12 points
+
+ * 1 pixel (px) = 0.26458333.. mm (relative to 'DPI', here: 96 dpi)
+ Most pictures have the 96 dpi resolution, but the dpi variable may vary by stylesheet parameter
+
+
+ -->
+ <!-- changing measure to mm -->
+ <xsl:template name="convert2mm">
+ <xsl:param name="value"/>
+ <xsl:param name="rounding-factor" select="10000"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="substring-before($value, 'mm')"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'cm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm' ) * $centimeter-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in' ) * $inch-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') * $point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') * $twip-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') * $didot-point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') * $pica-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') * $pixel-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'mm'!</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- changing measure to cm -->
+ <xsl:template name="convert2cm">
+ <xsl:param name="value"/>
+ <xsl:param name="rounding-factor" select="10000"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $centimeter-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'cm')">
+ <xsl:value-of select="substring-before($value, 'cm')"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $centimeter-in-mm * $inch-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $centimeter-in-mm * $point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $centimeter-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $centimeter-in-mm * $pica-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $centimeter-in-mm * $twip-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $centimeter-in-mm * $pixel-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'cm'!</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- changing measure to inch (cp. section comment) -->
+ <xsl:template name="convert2in">
+ <xsl:param name="value"/>
+ <xsl:param name="rounding-factor" select="10000"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $inch-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'cm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $inch-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="substring-before($value, 'in')"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $inch-in-mm * $point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $inch-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $inch-in-mm * $pica-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $inch-in-mm * $twip-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $inch-in-mm * $pixel-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'in'!</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- changing measure to dpt (cp. section comment) -->
+ <xsl:template name="convert2dpt">
+ <xsl:param name="value"/>
+ <xsl:param name="rounding-factor" select="10000"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $didot-point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'cm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $didot-point-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $didot-point-in-mm * $inch-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $didot-point-in-mm * $point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="substring-before($value, 'dpt')"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $didot-point-in-mm * $pica-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $didot-point-in-mm * $twip-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $didot-point-in-mm * $pixel-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'dpt'!</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- changing measure to pica (cp. section comment) -->
+ <xsl:template name="convert2pica">
+ <xsl:param name="value"/>
+ <xsl:param name="rounding-factor" select="10000"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $pica-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'cm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $pica-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $pica-in-mm * $inch-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $pica-in-mm * $point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $pica-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="substring-before($value, 'pica')"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $pica-in-mm * $twip-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $pica-in-mm * $pixel-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'pica'!</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- changing measure to pt (cp. section comment) -->
+ <xsl:template name="convert2pt">
+ <xsl:param name="value"/>
+ <xsl:param name="rounding-factor" select="10000"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'cm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $point-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $point-in-mm * $inch-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="substring-before($value, 'pt')"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $point-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $point-in-mm * $pica-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $point-in-mm * $twip-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $point-in-mm * $pixel-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'pt'!</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="ç¼–å·è§£æž">
+ <xsl:variable name="bianhao">
+ <xsl:value-of select="å­—:段è½å±žæ€§/å­—:自动编å·ä¿¡æ¯/@å­—:ç¼–å·å¼•ç”¨"/>
+ </xsl:variable>
+ <xsl:variable name="bianhaojibie">
+ <xsl:value-of select="å­—:段è½å±žæ€§/å­—:自动编å·ä¿¡æ¯/@å­—:ç¼–å·çº§åˆ«"/>
+ </xsl:variable>
+ <xsl:variable name="isxiangmuorisimage">
+ <xsl:for-each select="/uof:UOF/uof:å¼æ ·é›†/uof:自动编å·é›†/å­—:自动编å·">
+ <xsl:choose>
+ <xsl:when test="$bianhao=@字:标识符">
+ <xsl:choose>
+ <xsl:when test="å­—:级别[@å­—:级别值= (number($bianhaojibie))]/å­—:项目符å·">true</xsl:when>
+ <xsl:when test="å­—:级别[@å­—:级别值= (number($bianhaojibie))]/å­—:图片符å·å¼•ç”¨">true</xsl:when>
+ <xsl:otherwise>false</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>false</xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$isxiangmuorisimage='true'">
+ <xsl:call-template name="æ— åº"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="有åº"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="有åº">
+ <xsl:variable name="currlistid" select="å­—:段è½å±žæ€§/å­—:自动编å·ä¿¡æ¯/@å­—:ç¼–å·å¼•ç”¨"/>
+ <xsl:variable name="currlistlvl" select="å­—:段è½å±žæ€§/å­—:自动编å·ä¿¡æ¯/@å­—:ç¼–å·çº§åˆ«"/>
+ <xsl:variable name="firstoccur" select="/descendant::å­—:段è½å±žæ€§[å­—:自动编å·ä¿¡æ¯/@å­—:ç¼–å·å¼•ç”¨ = $currlistid][1]"/>
+ <xsl:element name="text:list">
+ <xsl:attribute name="text:style-name">List<xsl:value-of select="count($firstoccur/preceding::å­—:自动编å·ä¿¡æ¯)"/></xsl:attribute>
+ <xsl:if test="å­—:段è½å±žæ€§/å­—:自动编å·ä¿¡æ¯/@å­—:é‡æ–°ç¼–å·">
+ <xsl:attribute name="text:continue-numbering"><xsl:choose><xsl:when test="å­—:段è½å±žæ€§/å­—:自动编å·ä¿¡æ¯/@å­—:é‡æ–°ç¼–å·='true'">false</xsl:when><xsl:otherwise>true</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:element name="text:list-item">
+ <xsl:call-template name="ordered-levels">
+ <xsl:with-param name="level" select="$currlistlvl -1"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="ordered-levels">
+ <xsl:param name="level"/>
+ <xsl:choose>
+ <xsl:when test="$level = '0'">
+ <xsl:call-template name="commonParagraph"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="text:list">
+ <xsl:element name="text:list-item">
+ <xsl:call-template name="ordered-levels">
+ <xsl:with-param name="level" select="$level -1"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="æ— åº">
+ <xsl:variable name="currlistid" select="å­—:段è½å±žæ€§/å­—:自动编å·ä¿¡æ¯/@å­—:ç¼–å·å¼•ç”¨"/>
+ <xsl:variable name="currlistlvl" select="å­—:段è½å±žæ€§/å­—:自动编å·ä¿¡æ¯/@å­—:ç¼–å·çº§åˆ«"/>
+ <xsl:variable name="firstoccur" select="/descendant::å­—:段è½å±žæ€§[å­—:自动编å·ä¿¡æ¯/@å­—:ç¼–å·å¼•ç”¨ = $currlistid][1]"/>
+ <xsl:element name="text:list">
+ <xsl:attribute name="text:style-name">List<xsl:value-of select="count($firstoccur/preceding::å­—:自动编å·ä¿¡æ¯)"/></xsl:attribute>
+ <xsl:element name="text:list-item">
+ <xsl:call-template name="unordered-levels">
+ <xsl:with-param name="level" select="$currlistlvl -1"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="unordered-levels">
+ <xsl:param name="level"/>
+ <xsl:choose>
+ <xsl:when test="$level = '0'">
+ <xsl:call-template name="commonParagraph"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="text:list">
+ <xsl:element name="text:list-item">
+ <xsl:call-template name="unordered-levels">
+ <xsl:with-param name="level" select="$level -1"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- changing measure to pt (cp. section comment) -->
+ <xsl:template name="convert2twip">
+ <xsl:param name="value"/>
+ <xsl:param name="rounding-factor" select="10000"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $twip-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'cm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $twip-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $twip-in-mm * $inch-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $twip-in-mm * $point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $twip-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $twip-in-mm * $pica-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="substring-before($value, 'twip')"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $twip-in-mm * $pixel-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'twip'!</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- changing measure to pixel by via parameter provided dpi (dots per inch) standard factor (cp. section comment) -->
+ <xsl:template name="convert2px">
+ <xsl:param name="value"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="round(number(substring-before($value, 'mm')) div $pixel-in-mm)"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'cm')">
+ <xsl:value-of select="round(number(substring-before($value, 'cm')) div $pixel-in-mm * $centimeter-in-mm)"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="round(number(substring-before($value, 'in')) div $pixel-in-mm * $inch-in-mm)"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="round(number(substring-before($value, 'pt')) div $pixel-in-mm * $point-in-mm)"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="round(number(substring-before($value, 'dpt')) div $pixel-in-mm * $didot-point-in-mm)"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="round(number(substring-before($value, 'pica')) div $pixel-in-mm * $pica-in-mm)"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="round(number(substring-before($value, 'twip')) div $pixel-in-mm * $twip-in-mm)"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="$value"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'px'!</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/filter/source/xslt/import/uof/uof2odf_spreadsheet.xsl b/filter/source/xslt/import/uof/uof2odf_spreadsheet.xsl
new file mode 100644
index 000000000000..532561920791
--- /dev/null
+++ b/filter/source/xslt/import/uof/uof2odf_spreadsheet.xsl
@@ -0,0 +1,9054 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:uof="http://schemas.uof.org/cn/2003/uof" xmlns:表="http://schemas.uof.org/cn/2003/uof-spreadsheet" xmlns:演="http://schemas.uof.org/cn/2003/uof-slideshow" xmlns:字="http://schemas.uof.org/cn/2003/uof-wordproc" xmlns:图="http://schemas.uof.org/cn/2003/graph" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:smil="urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0" xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" office:version="1.0">
+ <xsl:output method="xml" indent="no" encoding="UTF-8" version="1.0"/>
+ <xsl:template match="uof:UOF">
+ <!--chengxz0804 OK-->
+ <!--office:document xmlns:office="http://openoffice.org/2000/office" xmlns:style="http://openoffice.org/2000/style" xmlns:text="http://openoffice.org/2000/text" xmlns:table="http://openoffice.org/2000/table" xmlns:draw="http://openoffice.org/2000/drawing" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="http://openoffice.org/2000/meta" xmlns:number="http://openoffice.org/2000/datastyle" xmlns:svg="http://www.w3.org/2000/svg" xmlns:chart="http://openoffice.org/2000/chart" xmlns:dr3d="http://openoffice.org/2000/dr3d" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="http://openoffice.org/2000/form" xmlns:script="http://openoffice.org/2000/script" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" office:version="1.0" office:class="spreadsheet"-->
+ <office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:smil="urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0" xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" office:version="1.0">
+ <xsl:apply-templates select="uof:元数æ®"/>
+ <office:settings>
+ <xsl:call-template name="工作表属性"/>
+ </office:settings>
+ <xsl:apply-templates select="uof:å¼æ ·é›†"/>
+ <!--xsl:apply-templates select="表:公用处ç†è§„则"/-->
+ <xsl:apply-templates select="uof:电å­è¡¨æ ¼"/>
+ </office:document>
+ </xsl:template>
+ <!--Redoffice comment lil from chenjh SC0013 06.02.15-->
+ <!--增加内容-->
+ <xsl:variable name="uofUnit">
+ <xsl:variable name="uu">
+ <xsl:value-of select="/uof:UOF/uof:电å­è¡¨æ ¼/表:公用处ç†è§„则/表:度é‡å•ä½"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$uu='cm'">cm</xsl:when>
+ <xsl:when test="$uu='mm'">mm</xsl:when>
+ <xsl:when test="$uu='pt'">pt</xsl:when>
+ <xsl:when test="$uu='inch'">inch</xsl:when>
+ <xsl:otherwise>cm</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="other-to-cm-conversion-factor">
+ <xsl:choose>
+ <xsl:when test="$uofUnit='cm'">1</xsl:when>
+ <xsl:when test="$uofUnit='mm'">0.1</xsl:when>
+ <xsl:when test="$uofUnit='pt'">0.03527</xsl:when>
+ <xsl:when test="$uofUnit='inch'">2.54</xsl:when>
+ <xsl:when test="$uofUnit='pica'">0.4233</xsl:when>
+ <xsl:otherwise>0.03527</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <!--Redoffice comment liliang end 06.02.15-->
+ <xsl:template name="set-calculation">
+ <xsl:element name="table:calculation-settings">
+ <xsl:if test="表:公用处ç†è§„则/表:度é‡å•ä½">
+ <xsl:variable name="uofUnit">
+ <xsl:variable name="uu">
+ <xsl:value-of select="表:公用处ç†è§„则/表:度é‡å•ä½"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$uu='cm'">cm</xsl:when>
+ <xsl:when test="$uu='mm'">mm</xsl:when>
+ <xsl:when test="$uu='pt'">pt</xsl:when>
+ <xsl:when test="$uu='inch'">inch</xsl:when>
+ <xsl:otherwise>cm</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="other-to-cm-conversion-factor">
+ <xsl:choose>
+ <xsl:when test="$uofUnit='cm'">1</xsl:when>
+ <xsl:when test="$uofUnit='mm'">0.1</xsl:when>
+ <xsl:when test="$uofUnit='pt'">0.03527</xsl:when>
+ <xsl:when test="$uofUnit='inch'">2.54</xsl:when>
+ <xsl:when test="$uofUnit='pica'">0.4233</xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ </xsl:if>
+ <xsl:if test="表:公用处ç†è§„则/表:精确度以显示值为准">
+ <xsl:attribute name="table:precision-as-shown">true</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="表:公用处ç†è§„则/表:日期系统-1904/@表:值='true'">
+ <table:null-date table:date-value="1904-01-01"/>
+ </xsl:if>
+ <xsl:if test="表:公用处ç†è§„则/表:计算设置">
+ <xsl:element name="table:iteration">
+ <xsl:attribute name="table:status">enable</xsl:attribute>
+ <xsl:attribute name="table:steps"><xsl:value-of select="表:公用处ç†è§„则/表:计算设置/@表:迭代次数"/></xsl:attribute>
+ <xsl:attribute name="table:maximum-difference"><xsl:value-of select="表:公用处ç†è§„则/表:计算设置/@表:å差值"/></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="uof:字体集">
+ <xsl:if test="not(uof:字体声明[@uof:å称='StarSymbol'])">
+ <style:font-face style:name="StarSymbol" fo:font-family="StarSymbol" style:font-charset="x-symbol"/>
+ </xsl:if>
+ <xsl:for-each select="uof:字体声明">
+ <xsl:element name="style:font-face">
+ <xsl:attribute name="style:name"><xsl:value-of select="@uof:å称"/></xsl:attribute>
+ <xsl:attribute name="svg:font-family"><xsl:value-of select="@uof:字体æ—"/></xsl:attribute>
+ <xsl:if test="@uof:字符集 = '02'">
+ <xsl:attribute name="style:font-charset">x-symbol</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@uof:字体æ—">
+ <xsl:choose>
+ <xsl:when test="@uof:å­—ä½“æ— = 'Swiss'">
+ <xsl:attribute name="style:font-family-generic">swiss</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@uof:å­—ä½“æ— ='Modern'">
+ <xsl:attribute name="style:font-family-generic">modern</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@uof:字体æ—='Roman'">
+ <xsl:attribute name="style:font-family-generic">roman</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@uof:å­—ä½“æ— ='Script'">
+ <xsl:attribute name="style:font-family-generic">script</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@uof:å­—ä½“æ— ='Decorative'">
+ <xsl:attribute name="style:font-family-generic">decorative</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@uof:å­—ä½“æ— ='System'">
+ <xsl:attribute name="style:font-family-generic">system</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:font-family-generic">system</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:attribute name="style:font-pitch">12</xsl:attribute>
+ </xsl:element>
+ </xsl:for-each>
+ <xsl:apply-templates select="uof:字体声明"/>
+ </xsl:template>
+ <xsl:template match="uof:电å­è¡¨æ ¼">
+ <office:body>
+ <office:spreadsheet>
+ <xsl:call-template name="trackchange"/>
+ <xsl:call-template name="set-calculation"/>
+ <xsl:if test="表:公用处ç†è§„则/表:æ•°æ®æœ‰æ•ˆæ€§é›†">
+ <xsl:element name="table:content-validations">
+ <xsl:call-template name="create-content-validations">
+ <xsl:with-param name="validation-set" select="表:公用处ç†è§„则/表:æ•°æ®æœ‰æ•ˆæ€§é›†/表:æ•°æ®æœ‰æ•ˆæ€§"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:if>
+ <xsl:apply-templates select="表:主体/表:工作表"/>
+ <!--MSexcel 中的names暂时没有对应的-->
+ <xsl:element name="table:database-ranges">
+ <xsl:for-each select="表:主体/表:工作表">
+ <xsl:if test="./表:筛选">
+ <xsl:variable name="filter" select="./表:筛选"/>
+ <xsl:variable name="column-and-row" select="substring-before(substring-after($filter/表:范围/text(),'.'),':')"/>
+ <xsl:variable name="dd" select="number(substring($column-and-row,2,1))"/>
+ <xsl:variable name="zone-left-column-string">
+ <xsl:choose>
+ <xsl:when test="contains($dd,'NaN') ">
+ <xsl:value-of select="substring($column-and-row,1,2)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring($column-and-row,1,1)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="zone-left-column-num">
+ <xsl:call-template name="translate-column-char-to-number">
+ <xsl:with-param name="string" select="$zone-left-column-string"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:element name="table:database-range">
+ <xsl:attribute name="table:name"><xsl:value-of select="uof:电å­è¡¨æ ¼/表:主体/表:工作表/@表:å称"/></xsl:attribute>
+ <xsl:attribute name="table:target-range-address"><xsl:call-template name="translate-expression2"><xsl:with-param name="expression2" select="translate($filter/表:范围/text(),'$','')"/></xsl:call-template></xsl:attribute>
+ <xsl:if test="$filter/@表:类型='auto'">
+ <xsl:attribute name="table:display-filter-buttons">true</xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="$filter/表:æ¡ä»¶åŒºåŸŸ">
+ <xsl:element name="table:filter">
+ <xsl:attribute name="table:condition-source-range-address"><xsl:call-template name="translate-expression2"><xsl:with-param name="expression2" select="translate($filter/表:æ¡ä»¶åŒºåŸŸ/text(),'$','')"/></xsl:call-template></xsl:attribute>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="table:filter">
+ <xsl:element name="table:filter-and">
+ <xsl:call-template name="auto-filter-condition">
+ <xsl:with-param name="conditon-set" select="$filter/表:æ¡ä»¶"/>
+ <xsl:with-param name="zone-left-column-num" select="$zone-left-column-num"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:element>
+ </office:spreadsheet>
+ </office:body>
+ </xsl:template>
+ <xsl:template name="trackchange">
+ <xsl:for-each select="表:主体/表:工作表/表:工作表内容//字:修订开始">
+ <xsl:variable name="num">
+ <xsl:number level="any" from="表:主体/表:工作表/表:工作表内容//*" count="字:修订开始"/>
+ </xsl:variable>
+ <table:tracked-changes>
+ <table:cell-content-change>
+ <xsl:attribute name="table:id"><xsl:value-of select="concat('ct',$num)"/></xsl:attribute>
+ <table:cell-address>
+ <xsl:attribute name="table:column"><xsl:value-of select="substring-after(@字:标识符,'-')"/></xsl:attribute>
+ <xsl:attribute name="table:row"><xsl:value-of select="substring-before(@字:标识符,'-')"/></xsl:attribute>
+ <xsl:attribute name="table:table">0</xsl:attribute>
+ </table:cell-address>
+ <office:change-info>
+ <dc:creator>
+ <xsl:choose>
+ <xsl:when test="starts-with(@å­—:修订信æ¯å¼•ç”¨,'+')"/>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-before(@å­—:修订信æ¯å¼•ç”¨,'+')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </dc:creator>
+ <!--xsl:value-of select="/uof:UOF/uof:元数æ®/uof:作者"/-->
+ <!--xsl:value-of select="/uof:UOF/uof:元数æ®/uof:创建日期"/-->
+ <dc:date>
+ <xsl:value-of select="substring-before(substring-after(@å­—:修订信æ¯å¼•ç”¨,'+'),'%')"/>
+ </dc:date>
+ </office:change-info>
+ <table:previous>
+ <table:change-track-table-cell>
+ <text:p>
+ <xsl:value-of select="substring-after(@å­—:修订信æ¯å¼•ç”¨,'%')"/>
+ </text:p>
+ </table:change-track-table-cell>
+ </table:previous>
+ </table:cell-content-change>
+ </table:tracked-changes>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template match="uof:å¼æ ·é›†">
+ <xsl:element name="office:font-face-decls">
+ <style:font-face style:name="宋体" svg:font-family="宋体" style:font-family-generic="swiss"/>
+ <xsl:apply-templates select="uof:字体集"/>
+ </xsl:element>
+ <xsl:call-template name="å•å…ƒæ ¼å¼æ ·"/>
+ </xsl:template>
+ <xsl:key match="/uof:UOF/uof:电å­è¡¨æ ¼/表:主体/表:工作表/表:工作表内容/uof:锚点 | /uof:UOF/uof:电å­è¡¨æ ¼/表:主体/表:工作表/表:工作表内容/表:è¡Œ/表:å•å…ƒæ ¼/uof:锚点" name="rel_graphic_name" use="@uof:图形引用"/>
+ <xsl:template match="图:图形">
+ <xsl:variable name="random-name">
+ <xsl:value-of select="generate-id()"/>
+ </xsl:variable>
+ <xsl:variable name="draw-name">
+ <xsl:value-of select="substring($random-name,string-length($random-name)-1)"/>
+ </xsl:variable>
+ <xsl:call-template name="graphic-fill">
+ <xsl:with-param name="draw-name" select="$draw-name"/>
+ <xsl:with-param name="gradient-name" select="图:预定义图形/图:属性/图:å¡«å……/图:æ¸å˜"/>
+ </xsl:call-template>
+ <xsl:choose>
+ <xsl:when test="图:预定义图形/图:属性/图:å¡«å……/图:æ¸å˜">
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name"><xsl:value-of select="@图:标识符"/></xsl:attribute>
+ <xsl:attribute name="style:family">graphic</xsl:attribute>
+ <xsl:element name="style:graphic-properties">
+ <xsl:call-template name="process-graphics">
+ <xsl:with-param name="draw-name" select="$draw-name"/>
+ </xsl:call-template>
+ </xsl:element>
+ <xsl:element name="style:paragraph-properties">
+ <xsl:if test="图:文本内容/@图:文字排列方å‘">
+ <xsl:choose>
+ <xsl:when test="图:文本内容/@图:文字排列方å‘='vert-l2r'">
+ <xsl:attribute name="style:writing-mode">tb-lr</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:文本内容/@图:文字排列方å‘='vert-r2l'">
+ <xsl:attribute name="style:writing-mode">tb-rl</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:element>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name"><xsl:value-of select="@图:标识符"/></xsl:attribute>
+ <xsl:attribute name="style:family">graphic</xsl:attribute>
+ <xsl:element name="style:graphic-properties">
+ <xsl:if test="@图:其他对象">
+ <xsl:attribute name="fo:clip">rect(0cm 0cm 0cm 0cm)</xsl:attribute>
+ <xsl:attribute name="draw:color-mode">standard</xsl:attribute>
+ <xsl:attribute name="draw:luminance">0%</xsl:attribute>
+ <xsl:attribute name="draw:contrast">0%</xsl:attribute>
+ <xsl:attribute name="draw:gamma">100%</xsl:attribute>
+ <xsl:attribute name="draw:red">0%</xsl:attribute>
+ <xsl:attribute name="draw:green">0%</xsl:attribute>
+ <xsl:attribute name="draw:blue">0%</xsl:attribute>
+ <xsl:attribute name="draw:image-opacity">100%</xsl:attribute>
+ <xsl:attribute name="style:mirror">none</xsl:attribute>
+ </xsl:if>
+ <xsl:call-template name="process-graphics"/>
+ </xsl:element>
+ <xsl:element name="style:paragraph-properties">
+ <xsl:if test="图:文本内容/@图:文字排列方å‘">
+ <xsl:choose>
+ <xsl:when test="图:文本内容/@图:文字排列方å‘='vert-l2r'">
+ <xsl:attribute name="style:writing-mode">tb-lr</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:文本内容/@图:文字排列方å‘='vert-r2l'">
+ <xsl:attribute name="style:writing-mode">tb-rl</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:element>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="process-graphics">
+ <xsl:param name="draw-name"/>
+ <xsl:if test="not(key('rel_graphic_name',@图:标识符)/@uof:éšåŠ¨æ–¹å¼='movesize')">
+ <xsl:attribute name="style:protect"><xsl:choose><xsl:when test="key('rel_graphic_name',@图:标识符)/@uof:éšåŠ¨æ–¹å¼='move'">size</xsl:when><xsl:otherwise>position size</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="not(图:预定义图形/图:属性/图:填充)">
+ <xsl:attribute name="draw:fill">none</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:填充/图:图片">
+ <xsl:attribute name="draw:fill">bitmap</xsl:attribute>
+ <xsl:attribute name="draw:fill-image-name"><xsl:value-of select="图:预定义图形/图:属性/图:å¡«å……/图:图片/@图:å称"/></xsl:attribute>
+ <xsl:if test="not(图:预定义图形/图:属性/图:å¡«å……/图:图片/@图:ä½ç½®='tile')">
+ <xsl:attribute name="style:repeat"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:å¡«å……/图:图片/@图:ä½ç½®='center'">no-repeat</xsl:when><xsl:when test="图:预定义图形/图:属性/图:å¡«å……/图:图片/@图:ä½ç½®='stretch'">stretch</xsl:when></xsl:choose></xsl:attribute>
+ </xsl:if>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:填充/图:图案">
+ <xsl:attribute name="draw:fill">bitmap</xsl:attribute>
+ <xsl:attribute name="draw:fill-color"><xsl:value-of select="图:预定义图形/图:属性/图:å¡«å……/图:图案/@图:å‰æ™¯è‰²"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:填充/图:颜色">
+ <xsl:attribute name="draw:fill">solid</xsl:attribute>
+ <xsl:attribute name="draw:fill-color"><xsl:value-of select="图:预定义图形/图:属性/图:填充/图:颜色"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:å¡«å……/图:æ¸å˜">
+ <xsl:attribute name="draw:fill">gradient</xsl:attribute>
+ <xsl:attribute name="draw:fill-color"><xsl:value-of select="图:预定义图形/图:属性/图:å¡«å……/图:æ¸å˜/@图:起始色"/></xsl:attribute>
+ <xsl:attribute name="draw:fill-gradient-name"><xsl:value-of select="concat('Gradient ',$draw-name)"/></xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="图:预定义图形/图:属性/图:线颜色">
+ <xsl:attribute name="svg:stroke-color"><xsl:value-of select="图:预定义图形/图:属性/图:线颜色"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="图:预定义图形/图:属性/图:线型 and not(图:预定义图形/图:属性/图:线型 = 'single') and not(图:预定义图形/图:属性/图:线型 = 'thick')">
+ <xsl:variable name="type" select="图:预定义图形/图:属性/图:线型"/>
+ <xsl:attribute name="draw:stroke"><xsl:choose><xsl:when test="$type='none'">none</xsl:when><xsl:when test="$type='single'">solid</xsl:when><xsl:otherwise>dash</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="draw:stroke-dash"><xsl:choose><xsl:when test="$type='dash'">Ultrafine_20_Dashed</xsl:when><xsl:when test="$type='dot-dash'">Ultrafine_20_2_20_Dots_20_3_20_Dashes</xsl:when><xsl:when test="$type='dashed-heavy'">Fine_20_Dashed</xsl:when><xsl:when test="$type='dotted' ">Fine_20_Dotted</xsl:when><xsl:when test="$type='dash-long-heavy'">Line_20_with_20_Fine_20_Dots</xsl:when><xsl:when test="$type='dash-long'">Fine_20_Dashed_20__28_var_29_</xsl:when><xsl:when test="$type='dash-dot-dot'">_33__20_Dashes_20_3_20_Dots_20__28_var_29_</xsl:when><xsl:when test="$type='dotted-heavy'">Ultrafine_20_Dotted_20__28_var_29_</xsl:when><xsl:when test="$type='thick'">Line_20_Style_20_9</xsl:when><xsl:when test="$type='dot-dot-dash'">_32__20_Dots_20_1_20_Dash</xsl:when><xsl:when test="$type='dash-dot-dot-heavy'">Dashed_20__28_var_29_</xsl:when><xsl:when test="$type='dash-dot-heavy'">Dash_20_10</xsl:when></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="图:预定义图形/图:属性/图:线粗细">
+ <xsl:attribute name="svg:stroke-width"><xsl:value-of select="concat(图:预定义图形/图:属性/图:线粗细,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´">
+ <xsl:attribute name="draw:marker-start"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¼æ ·='normal'">Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¼æ ·='open'">Line Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¼æ ·='stealth'">Arrow concave</xsl:when><xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¼æ ·='oval'">Circle</xsl:when><xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¼æ ·='diamond'">Square 45</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:if test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:大å°">
+ <xsl:attribute name="draw:marker-start-width"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¤§å° = '1'"><xsl:value-of select="concat('0.05',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¤§å° = '2'"><xsl:value-of select="concat('0.10',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¤§å° = '3'"><xsl:value-of select="concat('0.15',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¤§å° = '4'"><xsl:value-of select="concat('0.20',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¤§å° = '5'"><xsl:value-of select="concat('0.25',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¤§å° = '6'"><xsl:value-of select="concat('0.30',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¤§å° = '7'"><xsl:value-of select="concat('0.35',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¤§å° = '8'"><xsl:value-of select="concat('0.40',$uofUnit)"/></xsl:when><xsl:otherwise><xsl:value-of select="concat('0.45',$uofUnit)"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´">
+ <xsl:attribute name="draw:marker-end"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¼æ ·='normal'">Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¼æ ·='open'">Line Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¼æ ·='stealth'">Arrow concave</xsl:when><xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¼æ ·='oval'">Circle</xsl:when><xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¼æ ·='diamond'">Square 45</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:if test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:大å°">
+ <xsl:attribute name="draw:marker-end-width"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¤§å° = '1'"><xsl:value-of select="concat('0.05',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¤§å° = '2'"><xsl:value-of select="concat('0.10',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¤§å° = '3'"><xsl:value-of select="concat('0.15',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¤§å° = '4'"><xsl:value-of select="concat('0.20',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¤§å° = '5'"><xsl:value-of select="concat('0.25',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¤§å° = '6'"><xsl:value-of select="concat('0.30',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¤§å° = '7'"><xsl:value-of select="concat('0.35',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¤§å° = '8'"><xsl:value-of select="concat('0.40',$uofUnit)"/></xsl:when><xsl:otherwise><xsl:value-of select="concat('0.45',$uofUnit)"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="图:预定义图形/图:属性/图:é€æ˜Žåº¦">
+ <xsl:attribute name="draw:opacity"><xsl:value-of select="concat(图:预定义图形/图:属性/图:é€æ˜Žåº¦,'%')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="图:文本内容">
+ <xsl:if test="图:文本内容/@图:上边è·">
+ <xsl:attribute name="fo:padding-top"><xsl:value-of select="concat(图:文本内容/@图:上边è·,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:padding-bottom"><xsl:value-of select="concat(图:文本内容/@图:下边è·,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:padding-left"><xsl:value-of select="concat(图:文本内容/@图:左边è·,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:padding-right"><xsl:value-of select="concat(图:文本内容/@图:å³è¾¹è·,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="图:文本内容/@图:文字排列方å‘">
+ <xsl:choose>
+ <xsl:when test="图:文本内容/@图:文字排列方å‘='vert-l2r'">
+ <xsl:attribute name="style:writing-mode">tb-lr</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:文本内容/@图:文字排列方å‘='vert-r2l'">
+ <xsl:attribute name="style:writing-mode">tb-rl</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:文本内容/@图:文字排列方å‘='hori-r2l'">
+ <xsl:attribute name="draw:textarea-horizontal-align">right</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:文本内容/@图:文字排列方å‘='hori-12r'">
+ <xsl:attribute name="draw:textarea-horizontal-align">left</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="图:文本内容/@图:水平对é½">
+ <xsl:attribute name="draw:textarea-horizontal-align"><xsl:value-of select="图:文本内容/@图:水平对é½"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="图:文本内容/@图:垂直对é½">
+ <xsl:attribute name="draw:textarea-vertical-align"><xsl:value-of select="图:文本内容/@图:垂直对é½"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="图:文本内容/@图:自动æ¢è¡Œ">
+ <xsl:attribute name="fo:wrap-option">no-wrap</xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="draw:auto-grow-width"><xsl:choose><xsl:when test="图:文本内容/@图:大å°é€‚应文字">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="draw:auto-grow-height"><xsl:choose><xsl:when test="图:文本内容/@图:大å°é€‚应文字">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="bina_graphic">
+ <xsl:param name="refGraphic"/>
+ <xsl:element name="office:binary-data">
+ <xsl:for-each select="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符 = $refGraphic]">
+ <xsl:value-of select="uof:æ•°æ®"/>
+ </xsl:for-each>
+ </xsl:element>
+ <text:p/>
+ </xsl:template>
+ <xsl:template name="graphic-fill">
+ <xsl:param name="draw-name"/>
+ <xsl:param name="gradient-name"/>
+ <xsl:if test="图:预定义图形/图:属性/图:å¡«å……/图:æ¸å˜">
+ <xsl:element name="draw:gradient">
+ <xsl:attribute name="draw:name"><xsl:value-of select="concat('Gradient ',$draw-name)"/></xsl:attribute>
+ <xsl:attribute name="draw:style"><xsl:choose><xsl:when test="$gradient-name/@图:ç§å­ç±»åž‹='linear'"><xsl:value-of select="'linear'"/></xsl:when><xsl:when test="$gradient-name/@图:ç§å­ç±»åž‹='radar'"><xsl:value-of select="'radial'"/></xsl:when><xsl:when test="$gradient-name/@图:ç§å­ç±»åž‹='oval'"><xsl:value-of select="'ellipsoid'"/></xsl:when><xsl:when test="$gradient-name/@图:ç§å­ç±»åž‹='square'"><xsl:value-of select="'square'"/></xsl:when><xsl:when test="$gradient-name/@图:ç§å­ç±»åž‹='rectangle'"><xsl:value-of select="'rectangular'"/></xsl:when></xsl:choose></xsl:attribute>
+ <xsl:attribute name="draw:start-color"><xsl:value-of select="$gradient-name/@图:起始色"/></xsl:attribute>
+ <xsl:attribute name="draw:end-color"><xsl:value-of select="$gradient-name/@图:终止色"/></xsl:attribute>
+ <xsl:attribute name="draw:start-intensity"><xsl:value-of select="concat($gradient-name/@图:起始浓度,'%')"/></xsl:attribute>
+ <xsl:attribute name="draw:end-intensity"><xsl:value-of select="concat($gradient-name/@图:终止浓度,'%')"/></xsl:attribute>
+ <xsl:attribute name="draw:angle"><xsl:value-of select="$gradient-name/@图:æ¸å˜æ–¹å‘ * 10"/></xsl:attribute>
+ <xsl:attribute name="draw:border"><xsl:value-of select="concat($gradient-name/@图:边界,'%')"/></xsl:attribute>
+ <xsl:if test="$gradient-name/@图:ç§å­Xä½ç½®">
+ <xsl:attribute name="draw:cx"><xsl:value-of select="concat($gradient-name/@图:ç§å­Xä½ç½®,'%')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$gradient-name/@图:ç§å­Yä½ç½®">
+ <xsl:attribute name="draw:cy"><xsl:value-of select="concat($gradient-name/@图:ç§å­Yä½ç½®,'%')"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´">
+ <xsl:element name="draw:marker">
+ <xsl:attribute name="draw:name"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¼æ ·='normal'">Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¼æ ·='open'">Line Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¼æ ·='stealth'">Arrow concave</xsl:when><xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¼æ ·='oval'">Circle</xsl:when><xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¼æ ·='diamond'">Square 45</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¼æ ·='normal'">
+ <xsl:attribute name="svg:viewBox">0 0 20 30</xsl:attribute>
+ <xsl:attribute name="svg:d">m10 0-10 30h20z</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¼æ ·='open'">
+ <xsl:attribute name="svg:viewBox">0 0 1122 2243</xsl:attribute>
+ <xsl:attribute name="svg:d">m0 2108v17 17l12 42 30 34 38 21 43 4 29-8 30-21 25-26 13-34 343-1532 339 1520 13 42 29 34 39 21 42 4 42-12 34-30 21-42v-39-12l-4 4-440-1998-9-42-25-39-38-25-43-8-42 8-38 25-26 39-8 42z</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¼æ ·='stealth'">
+ <xsl:attribute name="svg:viewBox">0 0 1131 1580</xsl:attribute>
+ <xsl:attribute name="svg:d">m1013 1491 118 89-567-1580-564 1580 114-85 136-68 148-46 161-17 161 13 153 46z</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¼æ ·='oval'">
+ <xsl:attribute name="svg:viewBox">0 0 1131 1131</xsl:attribute>
+ <xsl:attribute name="svg:d">m462 1118-102-29-102-51-93-72-72-93-51-102-29-102-13-105 13-102 29-106 51-102 72-89 93-72 102-50 102-34 106-9 101 9 106 34 98 50 93 72 72 89 51 102 29 106 13 102-13 105-29 102-51 102-72 93-93 72-98 51-106 29-101 13z</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¼æ ·='diamond'">
+ <xsl:attribute name="svg:viewBox">0 0 1131 1131</xsl:attribute>
+ <xsl:attribute name="svg:d">m0 564 564 567 567-567-567-564z</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´">
+ <xsl:element name="draw:marker">
+ <xsl:attribute name="draw:name"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¼æ ·='normal'">Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¼æ ·='open'">Line Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¼æ ·='stealth'">Arrow concave</xsl:when><xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¼æ ·='oval'">Circle</xsl:when><xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¼æ ·='diamond'">Square 45</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¼æ ·='normal'">
+ <xsl:attribute name="svg:viewBox">0 0 20 30</xsl:attribute>
+ <xsl:attribute name="svg:d">m10 0-10 30h20z</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¼æ ·='open'">
+ <xsl:attribute name="svg:viewBox">0 0 1122 2243</xsl:attribute>
+ <xsl:attribute name="svg:d">m0 2108v17 17l12 42 30 34 38 21 43 4 29-8 30-21 25-26 13-34 343-1532 339 1520 13 42 29 34 39 21 42 4 42-12 34-30 21-42v-39-12l-4 4-440-1998-9-42-25-39-38-25-43-8-42 8-38 25-26 39-8 42z</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¼æ ·='stealth'">
+ <xsl:attribute name="svg:viewBox">0 0 1131 1580</xsl:attribute>
+ <xsl:attribute name="svg:d">m1013 1491 118 89-567-1580-564 1580 114-85 136-68 148-46 161-17 161 13 153 46z</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¼æ ·='oval'">
+ <xsl:attribute name="svg:viewBox">0 0 1131 1131</xsl:attribute>
+ <xsl:attribute name="svg:d">m462 1118-102-29-102-51-93-72-72-93-51-102-29-102-13-105 13-102 29-106 51-102 72-89 93-72 102-50 102-34 106-9 101 9 106 34 98 50 93 72 72 89 51 102 29 106 13 102-13 105-29 102-51 102-72 93-93 72-98 51-106 29-101 13z</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¼æ ·='diamond'">
+ <xsl:attribute name="svg:viewBox">0 0 1131 1131</xsl:attribute>
+ <xsl:attribute name="svg:d">m0 564 564 567 567-567-567-564z</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="图:预定义图形/图:属性/图:填充/图:图片/@图:图形引用 or 图:预定义图形/图:属性/图:填充/图:图案/@图:图形引用">
+ <xsl:element name="draw:fill-image">
+ <xsl:attribute name="draw:name"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:å¡«å……/图:图案/@图:图形引用"><xsl:value-of select="图:预定义图形/图:属性/图:å¡«å……/图:图案/@图:类型"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:å¡«å……/图:图片/@图:图形引用"><xsl:value-of select="图:预定义图形/图:属性/图:å¡«å……/图:图片/@图:å称"/></xsl:when></xsl:choose></xsl:attribute>
+ <xsl:call-template name="bina_graphic">
+ <xsl:with-param name="refGraphic">
+ <xsl:choose>
+ <xsl:when test="图:预定义图形/图:属性/图:填充/图:图案/@图:图形引用">
+ <xsl:value-of select="图:预定义图形/图:属性/图:填充/图:图案/@图:图形引用"/>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:填充/图:图片/@图:图形引用">
+ <xsl:value-of select="图:预定义图形/图:属性/图:填充/图:图片/@图:图形引用"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="not(图:预定义图形/图:属性/图:线型='single') and not(图:预定义图形/图:属性/图:线型='thick') and 图:预定义图形/图:属性/图:线型">
+ <draw:stroke-dash draw:name="Ultrafine_20_Dashed" draw:display-name="Ultrafine Dashed" draw:style="rect" draw:dots1="1" draw:dots1-length="0.051cm" draw:dots2="1" draw:dots2-length="0.051cm" draw:distance="0.051cm"/>
+ <draw:stroke-dash draw:name="Fine_20_Dashed" draw:display-name="Fine Dashed" draw:style="rect" draw:dots1="1" draw:dots1-length="0.508cm" draw:dots2="1" draw:dots2-length="0.508cm" draw:distance="0.508cm"/>
+ <draw:stroke-dash draw:name="Ultrafine_20_2_20_Dots_20_3_20_Dashes" draw:display-name="Ultrafine 2 Dots 3 Dashes" draw:style="rect" draw:dots1="2" draw:dots1-length="0.051cm" draw:dots2="3" draw:dots2-length="0.254cm" draw:distance="0.127cm"/>
+ <draw:stroke-dash draw:name="Fine_20_Dashed_20__28_var_29_" draw:display-name="Fine Dashed (var)" draw:style="rect" draw:dots1="1" draw:dots1-length="197%" draw:distance="197%"/>
+ <draw:stroke-dash draw:name="Fine_20_Dotted" draw:display-name="Fine Dotted" draw:style="rect" draw:dots1="1" draw:distance="0.457cm"/>
+ <draw:stroke-dash draw:name="Fine_20_Dashed_20__28_var_29_" draw:display-name="Fine Dashed (var)" draw:style="rect" draw:dots1="1" draw:dots1-length="197%" draw:distance="197%"/>
+ <draw:stroke-dash draw:name="Fine_20_Dotted" draw:display-name="Fine Dotted" draw:style="rect" draw:dots1="1" draw:distance="0.457cm"/>
+ <draw:stroke-dash draw:name="Line_20_with_20_Fine_20_Dots" draw:display-name="Line with Fine Dots" draw:style="rect" draw:dots1="1" draw:dots1-length="2.007cm" draw:dots2="10" draw:distance="0.152cm"/>
+ <draw:stroke-dash draw:name="Line_20_Style_20_9" draw:display-name="Line Style 9" draw:style="rect" draw:dots1="1" draw:dots1-length="197%" draw:distance="120%"/>
+ <draw:stroke-dash draw:name="_33__20_Dashes_20_3_20_Dots_20__28_var_29_" draw:display-name="3 Dashes 3 Dots (var)" draw:style="rect" draw:dots1="3" draw:dots1-length="197%" draw:dots2="3" draw:distance="100%"/>
+ <draw:stroke-dash draw:name="_32__20_Dots_20_1_20_Dash" draw:display-name="2 Dots 1 Dash" draw:style="rect" draw:dots1="2" draw:dots2="1" draw:dots2-length="0.203cm" draw:distance="0.203cm"/>
+ <draw:stroke-dash draw:name="Ultrafine_20_Dotted_20__28_var_29_" draw:display-name="Ultrafine Dotted (var)" draw:style="rect" draw:dots1="1" draw:distance="50%"/>
+ <draw:stroke-dash draw:name="Dash_20_10" draw:display-name="Dash 10" draw:style="rect" draw:dots1="1" draw:dots1-length="0.02cm" draw:dots2="1" draw:dots2-length="0.02cm" draw:distance="0.02cm"/>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="å•å…ƒæ ¼å¼æ ·">
+ <xsl:variable name="uofSheet" select="/uof:UOF/uof:电å­è¡¨æ ¼"/>
+ <xsl:variable name="uofSheet1" select="/uof:UOF/uof:电å­è¡¨æ ¼/表:主体/表:工作表"/>
+ <xsl:variable name="uofSheetCom" select="$uofSheet/表:公用处ç†è§„则"/>
+ <xsl:variable name="first-style" select="/uof:UOF/uof:å¼æ ·é›†/uof:å•å…ƒæ ¼å¼æ ·"/>
+ <xsl:variable name="quyu" select="/uof:UOF/uof:电å­è¡¨æ ¼/表:公用处ç†è§„则/表:æ¡ä»¶æ ¼å¼åŒ–集/表:æ¡ä»¶æ ¼å¼åŒ–/表:区域"/>
+ <xsl:variable name="condition-format-set" select="/uof:UOF/uof:电å­è¡¨æ ¼/表:公用处ç†è§„则/表:æ¡ä»¶æ ¼å¼åŒ–集/表:æ¡ä»¶æ ¼å¼åŒ–"/>
+ <xsl:variable name="aa">
+ <xsl:for-each select="$first-style">
+ <xsl:if test="@表:标识符!=@表:å称 and @表:å称!='Normal'">
+ <xsl:value-of select="@表:å称"/>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:variable name="bb">
+ <xsl:for-each select="$first-style">
+ <xsl:if test="@表:标识符!=@表:å称 and @表:å称!='Normal'">
+ <xsl:value-of select="@表:标识符"/>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:variable>
+ <office:styles>
+ <!-- if ConditionalFormatting exists,it should generate some styles for style:style -->
+ <!--xsl:if test="$uofSheetCom/表:æ¡ä»¶æ ¼å¼åŒ–集">
+ <xsl:call-template name="CondFormat_office_style"/>
+ </xsl:if-->
+ <!--ro000179 chenjh-->
+ <xsl:for-each select="$first-style[@表:类型='custom' or @表:类型='default']">
+ <xsl:call-template name="å•å…ƒæ ¼å…·ä½“å¼æ ·"/>
+ <xsl:apply-templates select="表:æ•°å­—æ ¼å¼[@表:æ ¼å¼ç ]"/>
+ <xsl:apply-templates select="表:字体格å¼[å­—:上下标]"/>
+ </xsl:for-each>
+ </office:styles>
+ <office:automatic-styles>
+ <xsl:for-each select="$first-style[@表:类型='auto']">
+ <xsl:variable name="apply-style-name" select="@表:å称"/>
+ <xsl:variable name="style-name" select="@表:标识符"/>
+ <xsl:choose>
+ <xsl:when test="$style-name!=$apply-style-name and $apply-style-name!='Normal'">
+ <xsl:for-each select="$condition-format-set/表:æ¡ä»¶">
+ <style:style>
+ <xsl:attribute name="style:name"><xsl:value-of select="//uof:å•å…ƒæ ¼å¼æ ·[@表:å称=current()/表:æ ¼å¼/@表:å¼æ ·å¼•ç”¨ and @表:类型='auto']/@表:标识符"/></xsl:attribute>
+ <xsl:attribute name="style:family">table-cell</xsl:attribute>
+ <xsl:attribute name="style:parent-style-name">Default</xsl:attribute>
+ <xsl:for-each select="parent::表:æ¡ä»¶æ ¼å¼åŒ–/表:æ¡ä»¶">
+ <xsl:variable name="condition-text">
+ <xsl:choose>
+ <xsl:when test="@表:类型='cell value'">
+ <xsl:choose>
+ <xsl:when test="表:æ“作ç /text()='between' ">
+ <xsl:value-of select="concat('cell-content-is-between','(',表:第一æ“作数/text(),',',表:第二æ“作数/text(),')')"/>
+ </xsl:when>
+ <xsl:when test=" 表:æ“作ç /text()='not between'">
+ <xsl:value-of select="concat('cell-content-is-not-between','(',表:第一æ“作数/text(),',',表:第二æ“作数/text(),')')"/>
+ </xsl:when>
+ <xsl:when test="表:æ“作ç /text()='equal to'">
+ <xsl:value-of select="concat('cell-content()=',表:第一æ“作数/text())"/>
+ </xsl:when>
+ <xsl:when test="表:æ“作ç /text()='not equal to'">
+ <xsl:value-of select="concat('cell-content()!=',表:第一æ“作数/text())"/>
+ </xsl:when>
+ <xsl:when test="表:æ“作ç /text()='greater than'">
+ <xsl:value-of select="concat('cell-content()&gt;',表:第一æ“作数/text())"/>
+ </xsl:when>
+ <xsl:when test="表:æ“作ç /text()='less than'">
+ <xsl:value-of select="concat('cell-content()&lt;',表:第一æ“作数/text())"/>
+ </xsl:when>
+ <xsl:when test="表:æ“作ç /text()='greater than or equal to'">
+ <xsl:value-of select="concat('cell-content()&gt;=',表:第一æ“作数/text())"/>
+ </xsl:when>
+ <xsl:when test="表:æ“作ç /text()='less than or equal to'">
+ <xsl:value-of select="concat('cell-content()&lt;=',表:第一æ“作数/text())"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="@表:类型='formula'">
+ <xsl:value-of select="concat('is-true-formula','(',表:第一æ“作数/text(),')')"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:element name="style:map">
+ <xsl:variable name="address">
+ <xsl:value-of select="preceding-sibling::表:区域"/>
+ </xsl:variable>
+ <xsl:attribute name="style:condition"><xsl:value-of select="$condition-text"/></xsl:attribute>
+ <xsl:attribute name="style:apply-style-name"><xsl:value-of select="表:æ ¼å¼/@表:å¼æ ·å¼•ç”¨"/></xsl:attribute>
+ <xsl:attribute name="style:base-cell-address"><xsl:value-of select="substring-after($address,':')"/></xsl:attribute>
+ </xsl:element>
+ </xsl:for-each>
+ </style:style>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:for-each select="uof:å•å…ƒæ ¼å¼æ · ">
+ <xsl:if test="@表:类型='auto' and (@表:标识符=@表:å称 or @表:å称='Normal')">
+ <xsl:call-template name="å•å…ƒæ ¼å…·ä½“å¼æ ·"/>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ <!--Redoffie comment liliang SC0008 06.02.14-->
+ <!--1新增内容-->
+ <xsl:if test="uof:å•å…ƒæ ¼å¼æ ·">
+ <xsl:for-each select="uof:å•å…ƒæ ¼å¼æ ·">
+ <xsl:if test="@表:类型='auto' and (@表:标识符=@表:å称 or @表:å称='Normal')">
+ <xsl:call-template name="å•å…ƒæ ¼å…·ä½“å¼æ ·"/>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:if test="/uof:UOF/uof:对象集/uof:其他对象/@uof:公有类型='png' or /uof:UOF/uof:对象集/uof:其他对象/@uof:公有类型='ipg' or /uof:UOF/uof:对象集/uof:其他对象/@uof:公有类型='bmp' or /uof:UOF/uof:对象集/uof:其他对象/@uof:公有类型='gif'">
+ <style:style style:name="Graphics" style:family="graphics">
+ <style:properties text:anchor-type="paragraph" svg:x="0cm" svg:y="0cm" style:wrap="none" style:vertical-pos="top" style:vertical-rel="paragraph" style:horizontal-pos="center" style:horizontal-rel="paragraph"/>
+ </style:style>
+ </xsl:if>
+ <xsl:apply-templates select="/uof:UOF/uof:对象集/图:图形"/>
+ <xsl:apply-templates select="/uof:UOF/uof:对象集/图:图形/图:文本内容/å­—:段è½/å­—:å¥/å­—:å¥å±žæ€§" mode="style"/>
+ <!--Redoffice comment end 06.02.14-->
+ <xsl:apply-templates select="$uofSheet1/表:工作表内容"/>
+ <xsl:if test="uof:å•å…ƒæ ¼å¼æ ·">
+ <xsl:for-each select="uof:å•å…ƒæ ¼å¼æ ·[@表:类型='auto' and (@表:标识符=@表:å称 or @表:å称='Normal')]">
+ <xsl:call-template name="å•å…ƒæ ¼å…·ä½“å¼æ ·"/>
+ <xsl:apply-templates select="表:æ•°å­—æ ¼å¼[@表:æ ¼å¼ç ]"/>
+ <xsl:apply-templates select="表:字体格å¼[å­—:上下标]"/>
+ </xsl:for-each>
+ </xsl:if>
+ <!-- if ConditionalFormatting exists,transforing the styles -->
+ <!--xsl:if test="$uofSheetCom/表:æ¡ä»¶æ ¼å¼åŒ–集">
+ <xsl:call-template name="CondFormat_automatic_style"/>
+ </xsl:if-->
+ <xsl:if test="$uofSheetCom/表:æ¡ä»¶æ ¼å¼åŒ–集/表:æ¡ä»¶æ ¼å¼åŒ–">
+ <xsl:variable name="style-name" select="$first-style/@表:标识符"/>
+ <xsl:variable name="left-top">
+ <xsl:call-template name="search-left-top-in-tables">
+ <xsl:with-param name="cellstylename" select="$style-name"/>
+ <xsl:with-param name="tableslist" select="$uofSheet1/表:工作表内容"/>
+ <xsl:with-param name="return" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="after-translated-left-top">
+ <xsl:call-template name="translate-left-top">
+ <xsl:with-param name="left-top" select="$left-top"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="$after-translated-left-top!=''">
+ <xsl:call-template name="create-the-condition-format-map">
+ <xsl:with-param name="condition-format-set" select="$uofSheetCom/表:æ¡ä»¶æ ¼å¼åŒ–集//表:æ¡ä»¶æ ¼å¼åŒ–"/>
+ <xsl:with-param name="current-left-top" select="$after-translated-left-top"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:if>
+ <xsl:apply-templates select="/uof:UOF/uof:电å­è¡¨æ ¼/表:主体/表:工作表/表:工作表内容/表:列/表:å•å…ƒæ ¼/*[descendant-or-self::*[namespace-uri()='http://www.w3.org/TR/REC-html40']]"/>
+ <!--xsl:apply-templates select="$uofSheet1/表:工作表属性/表:页é¢è®¾ç½®/表:页眉页脚/å­—:段è½" /-->
+ <xsl:call-template name="create-page-master">
+ <xsl:with-param name="worksheetoptions" select="$uofSheet1/表:工作表属性"/>
+ </xsl:call-template>
+ <xsl:for-each select="uof:å¥å¼æ ·">
+ <style:style>
+ <xsl:attribute name="style:name"><xsl:value-of select="@字:标识符"/></xsl:attribute>
+ <xsl:attribute name="style:family">text</xsl:attribute>
+ <style:text-properties>
+ <xsl:apply-templates select="./*"/>
+ </style:text-properties>
+ </style:style>
+ </xsl:for-each>
+ </office:automatic-styles>
+ <office:master-styles>
+ <xsl:call-template name="create-master-styles">
+ <xsl:with-param name="worksheetoptions" select="$uofSheet1/表:工作表属性"/>
+ </xsl:call-template>
+ </office:master-styles>
+ </xsl:template>
+ <xsl:template match="表:æ•°æ®æœ‰æ•ˆæ€§">
+ <xsl:variable name="range-name-temp">
+ <xsl:value-of select="substring-before(表:区域,'!')"/>
+ </xsl:variable>
+ <xsl:variable name="range-name">
+ <xsl:value-of select="substring($range-name-temp,2,string-length($range-name-temp)-2)"/>
+ </xsl:variable>
+ <xsl:variable name="first-range">
+ <xsl:choose>
+ <xsl:when test="contains(表:区域, ',')">
+ <xsl:value-of select="translate(substring-after(substring-before(表:区域, ','),'!'),'$','')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="translate(substring-after(表:区域,'!'),'$','')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="value-first">
+ <xsl:value-of select="translate(表:第一æ“作数,'=','')"/>
+ </xsl:variable>
+ <xsl:variable name="value-second">
+ <xsl:value-of select="translate(表:第二æ“作数,'=','')"/>
+ </xsl:variable>
+ <xsl:element name="table:content-validation">
+ <xsl:attribute name="table:name"><xsl:value-of select="concat('val', position())"/></xsl:attribute>
+ <!--æ•°æ®æœ‰æ•ˆæ€§:第一æ“作数ã€ç¬¬äºŒæ“作数-->
+ <!-- don't support two type of qualifier: List, Custom -->
+ <xsl:attribute name="table:condition"><xsl:variable name="qualifier-content"><xsl:choose><xsl:when test="表:æ“ä½œç  = 'between'"><xsl:choose><xsl:when test="(number($value-second))"><xsl:value-of select="concat('cell-content-is-between([',$range-name,'.',$value-first,'],',$value-second)"/></xsl:when><xsl:otherwise><xsl:value-of select="concat('cell-content-is-between([',$range-name,'.',$value-first,'],[',$range-name,'.',$value-second,']')"/></xsl:otherwise></xsl:choose></xsl:when><xsl:when test="表:æ“ä½œç  = 'not between'"><xsl:choose><xsl:when test="number($value-second)"><xsl:value-of select="concat('cell-content-is-not-between([',$range-name,'.',$value-first,'],',$value-second)"/></xsl:when><xsl:otherwise><xsl:value-of select="concat('cell-content-is-not-between([',$range-name,'.',$value-first,'],[',$range-name,'.',$value-second,']')"/></xsl:otherwise></xsl:choose></xsl:when><xsl:when test="表:æ“ä½œç  = 'not equal to'"><xsl:value-of select="concat('!=', $value-first)"/></xsl:when><xsl:when test="表:æ“ä½œç  = 'equal to'"><xsl:variable name="range1"><xsl:value-of select="substring-after(substring-before($value-first,':'),'(')"/></xsl:variable><xsl:variable name="range2"><xsl:value-of select="substring-before(substring-after($value-first,':'),')')"/></xsl:variable><xsl:value-of select="concat('=SUM([',$range-name,'.',$range1,':',$range-name,'.',$range2,']')"/></xsl:when><xsl:when test="表:æ“ä½œç  = 'less than'"><xsl:value-of select="concat('&lt;', $value-first)"/></xsl:when><xsl:when test="表:æ“ä½œç  = 'greater than'"><xsl:value-of select="concat('&gt;', $value-first)"/></xsl:when><xsl:when test="表:æ“ä½œç  = 'greater than or equal to'"><xsl:value-of select="concat('&gt;=[',$range-name, '.',$value-first,']')"/></xsl:when><xsl:when test="表:æ“ä½œç  = 'less than or equal to'"><xsl:value-of select="concat('&lt;=[',$range-name,'.', $value-first,']')"/></xsl:when><xsl:otherwise><xsl:value-of select="concat('([',$range-name,'.',substring-before($value-first,':'),':',$range-name,'.',substring-after($value-first,':'),'])')"/></xsl:otherwise></xsl:choose></xsl:variable><!--æ“作ç ã€æ ¡éªŒç±»åž‹--><xsl:variable name="qualifier-value"><xsl:choose><xsl:when test="表:校验类型 = 'whole number'"><xsl:choose><xsl:when test="(表:æ“ä½œç  = 'not between') or (表:æ“ä½œç  = 'between')"><xsl:value-of select="concat('oooc:cell-content-is-whole-number() and ', $qualifier-content, ')')"/></xsl:when><xsl:otherwise><xsl:value-of select="concat('oooc:cell-content-is-whole-number() and ', 'cell-content()', $qualifier-content)"/></xsl:otherwise></xsl:choose></xsl:when><xsl:when test="表:校验类型 = 'decimal'"><xsl:choose><xsl:when test="(表:æ“ä½œç  = 'not between') or (表:æ“ä½œç  = 'between')"><xsl:value-of select="concat('oooc:cell-content-is-decimal-number() and ', $qualifier-content, ')')"/></xsl:when><xsl:otherwise><xsl:value-of select="concat('oooc:cell-content-is-decimal-number() and ', 'cell-content()', $qualifier-content)"/></xsl:otherwise></xsl:choose></xsl:when><xsl:when test="表:校验类型 = 'list'"><xsl:choose><xsl:when test="(表:æ“ä½œç  = 'not between') or (表:æ“ä½œç  = 'between')"><xsl:value-of select="concat('oooc:cell-content-is-in-list() and ', $qualifier-content, ')')"/></xsl:when><xsl:otherwise><xsl:value-of select="concat('oooc:cell-content-is-in-list',$qualifier-content)"/></xsl:otherwise></xsl:choose></xsl:when><xsl:when test="表:校验类型 = 'date'"><xsl:choose><xsl:when test="(表:æ“ä½œç  = 'not between') or (表:æ“ä½œç  = 'between')"><xsl:value-of select="concat('oooc:cell-content-is-date() and ', $qualifier-content, ')')"/></xsl:when><xsl:otherwise><xsl:value-of select="concat('oooc:cell-content-is-date() and ', 'cell-content()', $qualifier-content)"/></xsl:otherwise></xsl:choose></xsl:when><xsl:when test="表:校验类型 = 'time'"><xsl:choose><xsl:when test="(表:æ“ä½œç  = 'not between') or (表:æ“ä½œç  = 'between')"><xsl:value-of select="concat('oooc:cell-content-is-time() and ', $qualifier-content, ')')"/></xsl:when><xsl:otherwise><xsl:value-of select="concat('oooc:cell-content-is-time() and ', 'cell-content()', $qualifier-content)"/></xsl:otherwise></xsl:choose></xsl:when><xsl:when test="表:校验类型 = 'text length'"><xsl:choose><xsl:when test="表:æ“ä½œç  = 'not between'"><xsl:choose><xsl:when test="number($value-second)"><xsl:value-of select="concat('oooc:cell-content-text-length-is-not-between([', $range-name,'.',$value-first, '],', $value-second, ')')"/></xsl:when><xsl:otherwise><xsl:value-of select="concat('oooc:cell-content-text-length-is-not-between([',$range-name,'.', $value-first, '],[',$range-name,'.', $value-second, '])')"/></xsl:otherwise></xsl:choose></xsl:when><xsl:when test="$value-second and $value-first"><xsl:choose><xsl:when test="number($value-second)"><xsl:value-of select="concat('oooc:cell-content-text-length-is-between([',$range-name,'.',$value-first,'],',$value-second,')')"/></xsl:when><xsl:otherwise><xsl:value-of select="concat('oooc:cell-content-text-length-is-between([',$range-name,'.',$value-first,'],[',$range-name,'.',$value-second,'])')"/></xsl:otherwise></xsl:choose></xsl:when><xsl:otherwise><xsl:value-of select="concat('oooc:cell-content-text-length()', $qualifier-content)"/></xsl:otherwise></xsl:choose></xsl:when><xsl:when test="表:校验类型 = 'custom'"><xsl:choose><xsl:when test="表:æ“ä½œç  = 'between'"><xsl:value-of select="concat('and cell-content-is-between(',substring-before($value-first,'('),'([',$range-name,'.',substring-after(substring-before($value-first,':'),'('),':',$range-name,'.',substring-before(substring-after($value-first,':'),')'),']),0')"/></xsl:when><xsl:when test="表:æ“ä½œç  = 'not between'"><xsl:value-of select="concat('oooc:and cell-content-is-not-between(',substring-before($value-first,'('),'([',$range-name,'.',substring-after(substring-before($value-first,':'),'('),':',$range-name,'.',substring-before(substring-after($value-first,':'),')'),']),0')"/></xsl:when><xsl:otherwise><xsl:value-of select="concat('oooc:cell-content-is-custom() and ', 'cell-content()', $qualifier-content)"/></xsl:otherwise></xsl:choose></xsl:when><xsl:otherwise><xsl:value-of select="表:校验类型"/></xsl:otherwise></xsl:choose></xsl:variable><xsl:value-of select="$qualifier-value"/></xsl:attribute>
+ <!--忽略空格-->
+ <xsl:attribute name="table:allow-empty-cell"><xsl:choose><xsl:when test="表:忽略空格"><xsl:value-of select="'false'"/></xsl:when><xsl:otherwise><xsl:value-of select="'true'"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="table:base-cell-address"><xsl:variable name="range"><xsl:value-of select="$first-range"/><!--xsl:call-template name="translate-expression">
+ <xsl:with-param name="cell-row-pos" select="0" />
+ <xsl:with-param name="cell-column-pos" select="0" />
+ <xsl:with-param name="expression" select="$first-range" />
+ <xsl:with-param name="return-value" select="''" />
+ </xsl:call-template--></xsl:variable><xsl:call-template name="encode-as-cell-address"><xsl:with-param name="string" select="concat($range-name, '.', $range)"/></xsl:call-template></xsl:attribute>
+ <!--输入æ示-->
+ <xsl:element name="table:help-message">
+ <xsl:attribute name="table:title"><xsl:value-of select="表:输入æ示/@表:标题"/></xsl:attribute>
+ <xsl:attribute name="table:display"><xsl:choose><xsl:when test="表:输入æ示/@表:显示"><xsl:value-of select="表:输入æ示/@表:显示"/></xsl:when><xsl:otherwise><xsl:value-of select="'false'"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:element name="text:p">
+ <xsl:value-of select="表:输入æ示/@表:内容"/>
+ </xsl:element>
+ </xsl:element>
+ <!--错误æ示-->
+ <xsl:element name="table:error-message">
+ <xsl:attribute name="table:message-type"><xsl:choose><xsl:when test="表:错误æ示/@表:类型= 'information'"><xsl:value-of select="'information'"/></xsl:when><xsl:when test="表:错误æ示/@表:类型= 'warning'"><xsl:value-of select="'warning'"/></xsl:when><xsl:otherwise><xsl:value-of select="'stop'"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="table:title"><xsl:value-of select="表:错误æ示/@表:标题"/></xsl:attribute>
+ <xsl:attribute name="table:display"><xsl:choose><xsl:when test="表:错误æ示/@表:显示"><xsl:value-of select="表:错误æ示/@表:显示"/></xsl:when><xsl:otherwise><xsl:value-of select="'false'"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:element name="text:p">
+ <xsl:value-of select="表:错误æ示/@表:内容"/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="CondFormat_office_style">
+ <xsl:for-each select="../../uof:电å­è¡¨æ ¼/表:公用处ç†è§„则/表:æ¡ä»¶æ ¼å¼åŒ–集/表:æ¡ä»¶æ ¼å¼åŒ–">
+ <xsl:variable name="table-pos" select="count(../../../preceding-sibling::表:公用处ç†è§„则)+1"/>
+ <xsl:variable name="conditions" select="count(../preceding-sibling::表:æ¡ä»¶æ ¼å¼åŒ–集)+1"/>
+ <xsl:for-each select="表:æ¡ä»¶">
+ <xsl:variable name="condition-number" select="count(preceding-sibling::表:æ¡ä»¶)+1"/>
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name"><xsl:call-template name="encode-as-nc-name"><xsl:with-param name="string" select="concat('Excel_CondFormat_',$table-pos,'_',$conditions,'_',$condition-number)"/></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="style:family">table-cell</xsl:attribute>
+ <xsl:element name="style:properties">
+ <xsl:choose>
+ <xsl:when test="表:æ ¼å¼/@表:å¼æ ·å¼•ç”¨">
+ <xsl:variable name="stylevalue" select="表:æ ¼å¼/@表:å¼æ ·å¼•ç”¨"/>
+ <xsl:call-template name="recursion-condformat-style-table-cell">
+ <xsl:with-param name="style-value-t">
+ <xsl:choose>
+ <xsl:when test="substring($stylevalue,string-length($stylevalue),1) != ';'">
+ <xsl:value-of select="concat($stylevalue,';')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$stylevalue"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ <!--xsl:element name="style:text-properties"-->
+ <!--chengxz0618-->
+ <xsl:element name="style:properties">
+ <xsl:choose>
+ <xsl:when test="表:æ ¼å¼/@表:å¼æ ·å¼•ç”¨">
+ <xsl:variable name="stylevalue" select="表:æ ¼å¼/@表:å¼æ ·å¼•ç”¨"/>
+ <xsl:call-template name="recursion-condformat-style-text">
+ <xsl:with-param name="style-value-t">
+ <xsl:choose>
+ <xsl:when test="substring($stylevalue,string-length($stylevalue),1) != ';'">
+ <xsl:value-of select="concat($stylevalue,';')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$stylevalue"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:font-style"><xsl:value-of select="'italic'"/></xsl:attribute>
+ <xsl:attribute name="style:text-underline-type"><xsl:value-of select="'single'"/></xsl:attribute>
+ <xsl:attribute name="style:text-underline-color"><xsl:value-of select="'font-color'"/></xsl:attribute>
+ <xsl:attribute name="fo:font-weight"><xsl:value-of select="'bold'"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="cell-pattern-color">
+ <xsl:param name="pattern"/>
+ <xsl:param name="color-value"/>
+ <xsl:param name="pattern-color-value"/>
+ <xsl:variable name="rev-pattern" select="1 - $pattern"/>
+ <xsl:variable name="color-R-value">
+ <xsl:call-template name="hex2decimal">
+ <xsl:with-param name="hex-number" select="substring($color-value,2,2)"/>
+ <xsl:with-param name="index" select="1"/>
+ <xsl:with-param name="str-length" select="2"/>
+ <xsl:with-param name="last-value" select="0"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="color-G-value">
+ <xsl:call-template name="hex2decimal">
+ <xsl:with-param name="hex-number" select="substring($color-value,4,2)"/>
+ <xsl:with-param name="index" select="1"/>
+ <xsl:with-param name="str-length" select="2"/>
+ <xsl:with-param name="last-value" select="0"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="color-B-value">
+ <xsl:call-template name="hex2decimal">
+ <xsl:with-param name="hex-number" select="substring($color-value,6,2)"/>
+ <xsl:with-param name="index" select="1"/>
+ <xsl:with-param name="str-length" select="2"/>
+ <xsl:with-param name="last-value" select="0"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="pattern-R-value">
+ <xsl:call-template name="hex2decimal">
+ <xsl:with-param name="hex-number" select="substring($pattern-color-value,2,2)"/>
+ <xsl:with-param name="index" select="1"/>
+ <xsl:with-param name="str-length" select="2"/>
+ <xsl:with-param name="last-value" select="0"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="pattern-G-value">
+ <xsl:call-template name="hex2decimal">
+ <xsl:with-param name="hex-number" select="substring($pattern-color-value,4,2)"/>
+ <xsl:with-param name="index" select="1"/>
+ <xsl:with-param name="str-length" select="2"/>
+ <xsl:with-param name="last-value" select="0"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="pattern-B-value">
+ <xsl:call-template name="hex2decimal">
+ <xsl:with-param name="hex-number" select="substring($pattern-color-value,6,2)"/>
+ <xsl:with-param name="index" select="1"/>
+ <xsl:with-param name="str-length" select="2"/>
+ <xsl:with-param name="last-value" select="0"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="R-value">
+ <xsl:variable name="combined-R-value">
+ <xsl:call-template name="decimal2hex">
+ <xsl:with-param name="dec-number" select="floor($color-R-value * $rev-pattern + $pattern-R-value * $pattern)"/>
+ <xsl:with-param name="last-value" select="'H'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="string-length($combined-R-value) = 1">
+ <xsl:value-of select="concat('0',$combined-R-value)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$combined-R-value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="G-value">
+ <xsl:variable name="combined-G-value">
+ <xsl:call-template name="decimal2hex">
+ <xsl:with-param name="dec-number" select="floor($color-G-value * $rev-pattern + $pattern-G-value * $pattern)"/>
+ <xsl:with-param name="last-value" select="'H'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="string-length($combined-G-value) = 1">
+ <xsl:value-of select="concat('0',$combined-G-value)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$combined-G-value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="B-value">
+ <xsl:variable name="combined-B-value">
+ <xsl:call-template name="decimal2hex">
+ <xsl:with-param name="dec-number" select="floor($color-B-value * $rev-pattern + $pattern-B-value * $pattern)"/>
+ <xsl:with-param name="last-value" select="'H'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="string-length($combined-B-value) = 1">
+ <xsl:value-of select="concat('0',$combined-B-value)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$combined-B-value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:value-of select="concat('#',$R-value,$G-value,$B-value)"/>
+ </xsl:template>
+ <xsl:template name="hex2decimal">
+ <xsl:param name="hex-number"/>
+ <xsl:param name="index"/>
+ <xsl:param name="str-length"/>
+ <xsl:param name="last-value"/>
+ <xsl:variable name="dec-char">
+ <xsl:call-template name="hexNumber2dec">
+ <xsl:with-param name="hex-value" select="substring($hex-number, $index ,1)"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="current-value" select="$last-value * 16 + $dec-char"/>
+ <xsl:if test="$index &lt; $str-length">
+ <xsl:call-template name="hex2decimal">
+ <xsl:with-param name="hex-number" select="$hex-number"/>
+ <xsl:with-param name="index" select="$index + 1"/>
+ <xsl:with-param name="str-length" select="$str-length"/>
+ <xsl:with-param name="last-value" select="$current-value"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="$index = $str-length">
+ <xsl:value-of select="$current-value"/>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="hexNumber2dec">
+ <xsl:param name="hex-value"/>
+ <xsl:choose>
+ <xsl:when test="$hex-value = 'A' or ($hex-value = 'a')">
+ <xsl:value-of select="10"/>
+ </xsl:when>
+ <xsl:when test="$hex-value = 'B' or ($hex-value = 'b')">
+ <xsl:value-of select="11"/>
+ </xsl:when>
+ <xsl:when test="$hex-value = 'C' or ($hex-value = 'c')">
+ <xsl:value-of select="12"/>
+ </xsl:when>
+ <xsl:when test="$hex-value = 'D' or ($hex-value = 'd')">
+ <xsl:value-of select="13"/>
+ </xsl:when>
+ <xsl:when test="$hex-value = 'E' or ($hex-value = 'e')">
+ <xsl:value-of select="14"/>
+ </xsl:when>
+ <xsl:when test="$hex-value = 'F' or ($hex-value = 'f')">
+ <xsl:value-of select="15"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$hex-value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="decimal2hex">
+ <xsl:param name="dec-number"/>
+ <xsl:param name="last-value"/>
+ <xsl:variable name="current-value">
+ <xsl:call-template name="decNumber2hex">
+ <xsl:with-param name="dec-value">
+ <xsl:if test="$dec-number &gt; 15">
+ <xsl:value-of select="floor($dec-number div 16)"/>
+ </xsl:if>
+ <xsl:if test="$dec-number &lt; 16">
+ <xsl:value-of select="$dec-number"/>
+ </xsl:if>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="$dec-number &gt; 15">
+ <xsl:call-template name="decimal2hex">
+ <xsl:with-param name="dec-number" select="$dec-number mod 16"/>
+ <xsl:with-param name="last-value" select="concat($last-value,$current-value)"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="$dec-number &lt; 16">
+ <xsl:value-of select="substring-after(concat($last-value,$current-value),'H')"/>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="decNumber2hex">
+ <xsl:param name="dec-value"/>
+ <xsl:choose>
+ <xsl:when test="$dec-value = 10">
+ <xsl:value-of select="'A'"/>
+ </xsl:when>
+ <xsl:when test="$dec-value = 11">
+ <xsl:value-of select="'B'"/>
+ </xsl:when>
+ <xsl:when test="$dec-value = 12">
+ <xsl:value-of select="'C'"/>
+ </xsl:when>
+ <xsl:when test="$dec-value = 13">
+ <xsl:value-of select="'D'"/>
+ </xsl:when>
+ <xsl:when test="$dec-value = 14">
+ <xsl:value-of select="'E'"/>
+ </xsl:when>
+ <xsl:when test="$dec-value = 15">
+ <xsl:value-of select="'F'"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$dec-value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="recursion-condformat-style-table-cell">
+ <xsl:param name="style-value-t"/>
+ <xsl:variable name="style-value" select="$style-value-t"/>
+ <xsl:choose>
+ <xsl:when test="starts-with($style-value,'background')">
+ <xsl:choose>
+ <xsl:when test="contains($style-value,'mso-pattern')">
+ <xsl:variable name="color-value">
+ <xsl:call-template name="translate-color-style">
+ <xsl:with-param name="source-str" select="normalize-space(substring-before(substring-after($style-value,':'),';'))"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="mso-value">
+ <xsl:call-template name="translate-color-style">
+ <xsl:with-param name="source-str" select="normalize-space(substring-after($style-value,'mso-pattern'))"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="mso-color" select="substring-after($mso-value,'#')"/>
+ <xsl:variable name="pattern-color-value" select="substring($mso-color,1,6)"/>
+ <xsl:variable name="pattern" select="concat('0.',normalize-space(substring-before(substring-after($mso-color,'gray-'),';')))"/>
+ <xsl:variable name="pattern-color">
+ <xsl:call-template name="cell-pattern-color">
+ <xsl:with-param name="pattern" select="$pattern"/>
+ <xsl:with-param name="color-value" select="$color-value"/>
+ <xsl:with-param name="pattern-color-value" select="concat('#',$pattern-color-value)"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="fo:background-color"><xsl:value-of select="normalize-space($pattern-color)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:background-color"><xsl:call-template name="translate-color-style"><xsl:with-param name="source-str" select="normalize-space(substring-before(substring-after($style-value,':'),';'))"/></xsl:call-template></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="starts-with($style-value,'border')">
+ <xsl:attribute name="fo:border"><xsl:value-of select="'0.002cm solid #000000'"/></xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="contains($style-value,':')">
+ <xsl:call-template name="recursion-condformat-style-table-cell">
+ <xsl:with-param name="style-value-t" select="substring-after($style-value,';')"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="recursion-condformat-style-text">
+ <xsl:param name="style-value-t"/>
+ <xsl:variable name="style-value" select="normalize-space($style-value-t)"/>
+ <xsl:choose>
+ <xsl:when test="starts-with($style-value,'color')">
+ <xsl:attribute name="fo:color"><xsl:call-template name="translate-color-style"><xsl:with-param name="source-str" select="normalize-space(substring-before(substring-after($style-value,':'),';'))"/></xsl:call-template></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="starts-with($style-value,'font-style')">
+ <xsl:attribute name="fo:font-style"><xsl:value-of select="normalize-space(substring-before(substring-after($style-value,':'),';'))"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="starts-with($style-value,'font-weight')">
+ <xsl:variable name="font-weight" select="normalize-space(substring-before(substring-after($style-value,':'),';'))"/>
+ <xsl:attribute name="fo:font-weight"><xsl:choose><xsl:when test="($font-weight &gt; 300) and ($font-weight &lt; 500)"><xsl:value-of select="'normal'"/></xsl:when><xsl:when test="($font-weight &gt; 500) or ($font-weight = 500)"><xsl:value-of select="'bold'"/></xsl:when><xsl:otherwise><xsl:value-of select="'0'"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="starts-with($style-value,'text-underline-style')">
+ <xsl:attribute name="style:text-underline-type"><xsl:value-of select="normalize-space(substring-before(substring-after($style-value,':'),';'))"/></xsl:attribute>
+ <xsl:attribute name="style:text-underline-color"><xsl:value-of select="'#000000'"/></xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="contains($style-value,':')">
+ <xsl:call-template name="recursion-condformat-style-text">
+ <xsl:with-param name="style-value-t" select="substring-after($style-value,';')"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="translate-color-style">
+ <xsl:param name="source-str"/>
+ <xsl:choose>
+ <xsl:when test="starts-with($source-str,'#')">
+ <xsl:value-of select="$source-str"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="starts-with($source-str,'black')">
+ <xsl:value-of select="'#000000'"/>
+ </xsl:when>
+ <xsl:when test="starts-with($source-str,'maroon')">
+ <xsl:value-of select="'#800000'"/>
+ </xsl:when>
+ <xsl:when test="starts-with($source-str,'red')">
+ <xsl:value-of select="'#FF0000'"/>
+ </xsl:when>
+ <xsl:when test="starts-with($source-str,'fuchsia')">
+ <xsl:value-of select="'#FF00FF'"/>
+ </xsl:when>
+ <xsl:when test="starts-with($source-str,'olive')">
+ <xsl:value-of select="'#808000'"/>
+ </xsl:when>
+ <xsl:when test="starts-with($source-str,'yellow')">
+ <xsl:value-of select="'#FFFF00'"/>
+ </xsl:when>
+ <xsl:when test="starts-with($source-str,'green')">
+ <xsl:value-of select="'#008000'"/>
+ </xsl:when>
+ <xsl:when test="starts-with($source-str,'lime')">
+ <xsl:value-of select="'#00FF00'"/>
+ </xsl:when>
+ <xsl:when test="starts-with($source-str,'teal')">
+ <xsl:value-of select="'#008080'"/>
+ </xsl:when>
+ <xsl:when test="starts-with($source-str,'aqua')">
+ <xsl:value-of select="'#00FFFF'"/>
+ </xsl:when>
+ <xsl:when test="starts-with($source-str,'navy')">
+ <xsl:value-of select="'#000080'"/>
+ </xsl:when>
+ <xsl:when test="starts-with($source-str,'blue')">
+ <xsl:value-of select="'#0000FF'"/>
+ </xsl:when>
+ <xsl:when test="starts-with($source-str,'purple')">
+ <xsl:value-of select="'#800080'"/>
+ </xsl:when>
+ <xsl:when test="starts-with($source-str,'gray')">
+ <xsl:value-of select="'#808080'"/>
+ </xsl:when>
+ <xsl:when test="starts-with($source-str,'silver')">
+ <xsl:value-of select="'#C0C0C0'"/>
+ </xsl:when>
+ <xsl:when test="starts-with($source-str,'white')">
+ <xsl:value-of select="'#FFFFFF'"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="'#FFFFFF'"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="CondFormat_automatic_style">
+ <xsl:for-each select="../uof:电å­è¡¨æ ¼/表:公用处ç†è§„则/表:æ¡ä»¶æ ¼å¼åŒ–集/表:æ¡ä»¶æ ¼å¼åŒ–">
+ <xsl:variable name="table-pos" select="count(../../../preceding-sibling::表:公用处ç†è§„则)+1"/>
+ <xsl:variable name="conditions" select="count(../preceding-sibling::表:æ¡ä»¶æ ¼å¼åŒ–集)+1"/>
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name"><xsl:call-template name="encode-as-nc-name"><xsl:with-param name="string" select="concat('ce',$table-pos,'-',$conditions)"/></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="style:family">table-cell</xsl:attribute>
+ <xsl:for-each select="uof:å•å…ƒæ ¼å¼æ ·/表:æ¡ä»¶">
+ <xsl:variable name="condition-number" select="count(preceding-sibling::表:æ¡ä»¶)+1"/>
+ <xsl:variable name="base-address">
+ <xsl:choose>
+ <xsl:when test="contains(../表:区域,',')">
+ <xsl:choose>
+ <xsl:when test="contains(substring-before(../表:区域,','),':')">
+ <xsl:value-of select="substring-before(substring-after(../表:区域,':'),',')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-before(../表:区域,',')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="../表:区域"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="base-cell-address">
+ <xsl:call-template name="translate-unit">
+ <xsl:with-param name="column-number" select="substring-before(substring-after($base-address,'R'),'C')"/>
+ <xsl:with-param name="row-number" select="substring-after($base-address,'C')"/>
+ <xsl:with-param name="column-pos-style" select="absolute"/>
+ <xsl:with-param name="row-pos-style" select="absolute"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="condition-value">
+ <xsl:call-template name="translate-condition">
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:element name="style:map">
+ <xsl:attribute name="style:condition"><xsl:value-of select="$condition-value"/></xsl:attribute>
+ <xsl:attribute name="style:apply-style-name"><xsl:value-of select="concat('Excel_CondFormat_',$table-pos,'_',$conditions,'_',$condition-number)"/></xsl:attribute>
+ <xsl:attribute name="style:base-cell-address"><xsl:value-of select="concat(../../@Name,'.',$base-cell-address)"/></xsl:attribute>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="translate-condition">
+ <xsl:variable name="address-value">
+ <xsl:call-template name="translate-expression">
+ <xsl:with-param name="cell-row-pos" select="0"/>
+ <xsl:with-param name="cell-column-pos" select="0"/>
+ <xsl:with-param name="expression" select="表:第一æ“作数"/>
+ <xsl:with-param name="return-value" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="表:æ“作ç ">
+ <xsl:variable name="qualifier" select="表:æ“作ç "/>
+ <xsl:variable name="first-value" select="表:第一æ“作数"/>
+ <xsl:choose>
+ <xsl:when test="$qualifier = 'Equal'">
+ <xsl:choose>
+ <xsl:when test="starts-with($first-value,'&quot;')">
+ <xsl:value-of select="concat('cell-content()=',$address-value)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat('cell-content()=[',$address-value,']')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$qualifier = 'Less'">
+ <xsl:value-of select="concat('cell-content()&lt;[',$address-value,']')"/>
+ </xsl:when>
+ <xsl:when test="$qualifier = 'Greater'">
+ <xsl:value-of select="concat('cell-content()&gt;[',$address-value,']')"/>
+ </xsl:when>
+ <xsl:when test="$qualifier = 'LessOrEqual'">
+ <xsl:value-of select="concat('cell-content()&lt;=[',$address-value,']')"/>
+ </xsl:when>
+ <xsl:when test="$qualifier = 'GreaterOrEqual'">
+ <xsl:value-of select="concat('cell-content()&gt;=[',$address-value,']')"/>
+ </xsl:when>
+ <xsl:when test="$qualifier = 'NotEqual'">
+ <xsl:value-of select="concat('cell-content()!=[',$address-value,']')"/>
+ </xsl:when>
+ <xsl:when test="$qualifier = 'Between'">
+ <xsl:variable name="second-value">
+ <xsl:call-template name="translate-expression">
+ <xsl:with-param name="cell-row-pos" select="0"/>
+ <xsl:with-param name="cell-column-pos" select="0"/>
+ <xsl:with-param name="expression" select="表:第二æ“作数"/>
+ <xsl:with-param name="return-value" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="concat('cell-content-is-between([',$address-value,'],[',$second-value,'])')"/>
+ </xsl:when>
+ <xsl:when test="$qualifier = 'NotBetween'">
+ <xsl:variable name="second-value">
+ <xsl:call-template name="translate-expression">
+ <xsl:with-param name="cell-row-pos" select="0"/>
+ <xsl:with-param name="cell-column-pos" select="0"/>
+ <xsl:with-param name="expression" select="表:第二æ“作数"/>
+ <xsl:with-param name="return-value" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="concat('cell-content-is-not-between([',$address-value,'],[',$second-value,'])')"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat('is-true-formula(',$address-value,')')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="translate-expression">
+ <xsl:param name="cell-row-pos"/>
+ <xsl:param name="cell-column-pos"/>
+ <xsl:param name="expression"/>
+ <xsl:param name="return-value"/>
+ <xsl:variable name="temp-range">
+ <xsl:choose>
+ <xsl:when test="$expression != ''">
+ <xsl:call-template name="parse-range-name">
+ <xsl:with-param name="expression" select="$expression"/>
+ <xsl:with-param name="return-value" select="''"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="''"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="range-type">
+ <xsl:choose>
+ <xsl:when test="substring($temp-range, 1, 1) = '1'">
+ <xsl:value-of select="1"/>
+ </xsl:when>
+ <xsl:when test="substring($temp-range, 1, 1) = '2'">
+ <xsl:value-of select="2"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="2"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="current-range">
+ <xsl:value-of select="substring($temp-range, 2)"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$range-type = 1">
+ <xsl:call-template name="translate-expression">
+ <xsl:with-param name="cell-row-pos" select="$cell-row-pos"/>
+ <xsl:with-param name="cell-column-pos" select="$cell-column-pos"/>
+ <xsl:with-param name="expression">
+ <xsl:choose>
+ <xsl:when test="contains($current-range, '#$')">
+ <xsl:variable name="temp-token">
+ <xsl:choose>
+ <xsl:when test="contains($current-range, '\')">
+ <xsl:value-of select="concat(']', substring-after($current-range, '#$'), &quot;&apos;&quot;)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-after($current-range, '#$')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:value-of select="substring-after($expression, $temp-token)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-after($expression, $current-range)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="return-value">
+ <xsl:choose>
+ <xsl:when test="$current-range = '='">
+ <xsl:text>oooc:=</xsl:text>
+ </xsl:when>
+ <xsl:when test="substring($current-range, string-length($current-range)) = '('">
+ <xsl:value-of select="concat($return-value, substring-before($expression, $current-range), $current-range, '[.')"/>
+ </xsl:when>
+ <xsl:when test="$current-range = ','">
+ <xsl:value-of select="concat($return-value, substring-before($expression, $current-range), '];[.')"/>
+ </xsl:when>
+ <xsl:when test="$current-range = ')'">
+ <xsl:value-of select="concat($return-value, substring-before($expression, $current-range), '])')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat($return-value, substring-before($expression, $current-range), $current-range)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="handle-type">
+ <xsl:choose>
+ <xsl:when test="starts-with($current-range, 'R')">
+ <xsl:choose>
+ <xsl:when test="contains($current-range, 'C')">
+ <xsl:variable name="part-type-r">
+ <xsl:call-template name="handle-type-number">
+ <xsl:with-param name="t-part" select="substring-before( substring-after($current-range, 'R'), 'C')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="part-type-c">
+ <xsl:call-template name="handle-type-number">
+ <xsl:with-param name="t-part" select="substring-after($current-range, 'C')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="($part-type-r = 1) and ($part-type-c = 1)">
+ <xsl:value-of select="1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="4"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="part-type">
+ <xsl:call-template name="handle-type-number">
+ <xsl:with-param name="t-part" select="substring-after($current-range, 'R')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$part-type = 1">
+ <xsl:value-of select="2"/>
+ </xsl:when>
+ <xsl:when test="$part-type = 2">
+ <xsl:value-of select="4"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="4"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="starts-with($current-range, 'C')">
+ <xsl:variable name="part-type">
+ <xsl:call-template name="handle-type-number">
+ <xsl:with-param name="t-part" select="substring-after($current-range, 'C')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$part-type = 1">
+ <xsl:value-of select="3"/>
+ </xsl:when>
+ <xsl:when test="$part-type = 2">
+ <xsl:value-of select="4"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="4"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="4"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$handle-type = 1">
+ <xsl:variable name="after-R">
+ <xsl:value-of select="substring(substring-after($current-range,'R'),1,1)"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$after-R='C' or $after-R='[' or $after-R='0' or $after-R='1' or $after-R='2' or $after-R='3' or $after-R='4' or $after-R='5' or $after-R='6' or $after-R='7' or $after-R='8' or $after-R='9'">
+ <xsl:variable name="row-pos">
+ <xsl:choose>
+ <xsl:when test="$after-R='['">
+ <xsl:value-of select="$cell-row-pos+substring-before( substring-after($current-range,'R['),']')"/>
+ </xsl:when>
+ <xsl:when test="$after-R='C'">
+ <xsl:value-of select="$cell-row-pos"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-before(substring-after($current-range,'R'),'C')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="row-pos-style">
+ <xsl:choose>
+ <xsl:when test="$after-R='[' or $after-R='C'">relative</xsl:when>
+ <xsl:otherwise>absolute</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="after-C">
+ <xsl:value-of select="substring(substring-after(substring-after($current-range,'R'),'C'),1,1)"/>
+ </xsl:variable>
+ <xsl:variable name="column-digit-length">
+ <xsl:choose>
+ <xsl:when test="$after-C='0' or $after-C='1' or $after-C='2' or $after-C='3' or $after-C='4' or $after-C='5' or $after-C='6' or $after-C='7' or $after-C='8' or $after-C='9'">
+ <xsl:call-template name="get-digit-length">
+ <xsl:with-param name="complexive-string" select="substring-after(substring-after($current-range,'R'),'C')"/>
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="column-pos">
+ <xsl:choose>
+ <xsl:when test="$after-C='['">
+ <xsl:value-of select="$cell-column-pos + substring-before(substring-after(substring-after($current-range,'R'),'C['),']')"/>
+ </xsl:when>
+ <xsl:when test="$after-C='0' or $after-C='1' or $after-C='2' or $after-C='3' or $after-C='4' or $after-C='5' or $after-C='6' or $after-C='7' or $after-C='8' or $after-C='9'">
+ <xsl:value-of select="substring(substring-after(substring-after($current-range,'R'),'C'),1,$column-digit-length)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$cell-column-pos"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="column-pos-style">
+ <xsl:choose>
+ <xsl:when test="$after-C='0' or $after-C='1' or $after-C='2' or $after-C='3' or $after-C='4' or $after-C='5' or $after-C='6' or $after-C='7' or $after-C='8' or $after-C='9'">absolute</xsl:when>
+ <xsl:otherwise>relative</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="trans-unit">
+ <xsl:call-template name="translate-unit">
+ <xsl:with-param name="column-number" select="$column-pos"/>
+ <xsl:with-param name="row-number" select="$row-pos"/>
+ <xsl:with-param name="column-pos-style" select="$column-pos-style"/>
+ <xsl:with-param name="row-pos-style" select="$row-pos-style"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="name-unit" select="concat(substring-before($expression, $current-range), $trans-unit)"/>
+ <xsl:call-template name="translate-expression">
+ <xsl:with-param name="cell-row-pos" select="$cell-row-pos"/>
+ <xsl:with-param name="cell-column-pos" select="$cell-column-pos"/>
+ <xsl:with-param name="expression" select="substring-after($expression, $current-range)"/>
+ <xsl:with-param name="return-value" select="concat($return-value, $name-unit)"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="name-unit" select="concat(substring-before($expression, $current-range), translate( substring-before(substring-after($expression, '('),'R'),',!', ';.'))"/>
+ <xsl:call-template name="translate-expression">
+ <xsl:with-param name="cell-row-pos" select="$cell-row-pos"/>
+ <xsl:with-param name="cell-column-pos" select="$cell-column-pos"/>
+ <xsl:with-param name="expression" select="substring-after($current-range,'R')"/>
+ <xsl:with-param name="return-value" select="concat($return-value, $name-unit)"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$handle-type = 2">
+ <xsl:variable name="after-R">
+ <xsl:value-of select="substring(substring-after($current-range,'R'),1,1)"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$after-R='[' or $after-R='0' or $after-R='1' or $after-R='2' or $after-R='3' or $after-R='4' or $after-R='5' or $after-R='6' or $after-R='7' or $after-R='8' or $after-R='9'">
+ <xsl:variable name="row-number">
+ <xsl:choose>
+ <xsl:when test="$after-R = '['">
+ <xsl:value-of select="substring-before(substring-after($current-range, 'R['), ']')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-after($current-range, 'R')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="row-pos">
+ <xsl:choose>
+ <xsl:when test="$after-R='['">
+ <xsl:value-of select="$cell-row-pos + $row-number"/>
+ </xsl:when>
+ <xsl:when test="$after-R='0' or $after-R='1' or $after-R='2' or $after-R='3' or $after-R='4' or $after-R='5' or $after-R='6' or $after-R='7' or $after-R='8' or $after-R='9'">
+ <xsl:value-of select="$row-number"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$cell-row-pos"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="trans-unit1">
+ <xsl:call-template name="translate-unit">
+ <xsl:with-param name="column-number" select="1"/>
+ <xsl:with-param name="row-number" select="$row-pos"/>
+ <xsl:with-param name="column-pos-style" select="'relative'"/>
+ <xsl:with-param name="row-pos-style" select="'relative'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="trans-unit2">
+ <xsl:call-template name="translate-unit">
+ <xsl:with-param name="column-number" select="256"/>
+ <xsl:with-param name="row-number" select="$row-pos"/>
+ <xsl:with-param name="column-pos-style" select="'relative'"/>
+ <xsl:with-param name="row-pos-style" select="'relative'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="name-unit" select="concat(substring-before($expression, $current-range), $trans-unit1, ':', $trans-unit2)"/>
+ <xsl:call-template name="translate-expression">
+ <xsl:with-param name="cell-row-pos" select="$cell-row-pos"/>
+ <xsl:with-param name="cell-column-pos" select="$cell-column-pos"/>
+ <xsl:with-param name="expression" select="substring-after($expression, $current-range)"/>
+ <xsl:with-param name="return-value" select="concat($return-value, $name-unit)"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="name-unit" select="concat(substring-before($expression, $current-range), translate( substring-before($current-range,'R'),',!', ';.'),'R')"/>
+ <xsl:call-template name="translate-expression">
+ <xsl:with-param name="cell-row-pos" select="$cell-row-pos"/>
+ <xsl:with-param name="cell-column-pos" select="$cell-column-pos"/>
+ <xsl:with-param name="expression" select="substring-after($current-range,'R')"/>
+ <xsl:with-param name="return-value" select="concat($return-value, $name-unit)"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$handle-type = 3">
+ <xsl:variable name="after-C">
+ <xsl:value-of select="substring(substring-after($current-range,'C'),1,1)"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$after-C='[' or $after-C='0' or $after-C='1' or $after-C='2' or $after-C='3' or $after-C='4' or $after-C='5' or $after-C='6' or $after-C='7' or $after-C='8' or $after-C='9'">
+ <xsl:variable name="column-number">
+ <xsl:choose>
+ <xsl:when test="$after-C = '['">
+ <xsl:value-of select="substring-before(substring-after($current-range, 'C['), ']')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-after($current-range, 'C')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="column-pos">
+ <xsl:choose>
+ <xsl:when test="$after-C='['">
+ <xsl:value-of select="$cell-column-pos + $column-number"/>
+ </xsl:when>
+ <xsl:when test="$after-C='0' or $after-C='1' or $after-C='2' or $after-C='3' or $after-C='4' or $after-C='5' or $after-C='6' or $after-C='7' or $after-C='8' or $after-C='9'">
+ <xsl:value-of select="$column-number"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$cell-column-pos"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="trans-unit1">
+ <xsl:call-template name="translate-unit">
+ <xsl:with-param name="column-number" select="$column-pos"/>
+ <xsl:with-param name="row-number" select="1"/>
+ <xsl:with-param name="column-pos-style" select="'relative'"/>
+ <xsl:with-param name="row-pos-style" select="'relative'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="trans-unit2">
+ <xsl:call-template name="translate-unit">
+ <xsl:with-param name="column-number" select="$column-pos"/>
+ <xsl:with-param name="row-number" select="32000"/>
+ <xsl:with-param name="column-pos-style" select="'relative'"/>
+ <xsl:with-param name="row-pos-style" select="'relative'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="name-unit" select="concat(substring-before($expression, $current-range), $trans-unit1, ':', $trans-unit2)"/>
+ <xsl:call-template name="translate-expression">
+ <xsl:with-param name="cell-row-pos" select="$cell-row-pos"/>
+ <xsl:with-param name="cell-column-pos" select="$cell-column-pos"/>
+ <xsl:with-param name="expression" select="substring-after($expression, $current-range)"/>
+ <xsl:with-param name="return-value" select="concat($return-value, $name-unit)"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="name-unit" select="concat(substring-before($expression, $current-range), translate( substring-before($current-range,'C'),',!', ';.'),'C')"/>
+ <xsl:call-template name="translate-expression">
+ <xsl:with-param name="cell-row-pos" select="$cell-row-pos"/>
+ <xsl:with-param name="cell-column-pos" select="$cell-column-pos"/>
+ <xsl:with-param name="expression" select="substring-after($current-range,'C')"/>
+ <xsl:with-param name="return-value" select="concat($return-value, $name-unit)"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="next-pit" select="substring-after($expression, $current-range)"/>
+ <xsl:choose>
+ <xsl:when test="contains($next-pit, '+') or contains($next-pit, '-') or contains($next-pit, '*') or contains($next-pit, '/') or contains($next-pit, ')') or contains($next-pit, '^') or contains($next-pit, ':') or contains($next-pit, '&quot;') or contains($next-pit, ';') or contains($next-pit, ',') or contains($next-pit, '[')">
+ <xsl:call-template name="translate-expression">
+ <xsl:with-param name="cell-row-pos" select="$cell-row-pos"/>
+ <xsl:with-param name="cell-column-pos" select="$cell-column-pos"/>
+ <xsl:with-param name="expression" select="substring-after($expression, $current-range)"/>
+ <xsl:with-param name="return-value" select="concat($return-value, substring-before($expression, $current-range), $current-range)"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="translate( concat($return-value, substring-before($expression, $current-range), $current-range),',!', ';.')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="parse-range-name">
+ <xsl:param name="expression"/>
+ <xsl:param name="return-value"/>
+ <xsl:variable name="first-one" select="substring($expression,1,1)"/>
+ <xsl:choose>
+ <xsl:when test="$first-one = '='">
+ <xsl:choose>
+ <xsl:when test="string-length(normalize-space($return-value)) &gt; 0">
+ <xsl:value-of select="concat('2', $return-value)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>1=</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$first-one='(' or $first-one='!' or $first-one='&amp;'">
+ <xsl:value-of select="concat('1', $return-value, $first-one)"/>
+ </xsl:when>
+ <xsl:when test="$first-one='['">
+ <xsl:choose>
+ <xsl:when test="starts-with(substring-after($expression, ']'), 'C')">
+ <xsl:call-template name="parse-range-name">
+ <xsl:with-param name="expression" select="substring-after($expression, ']')"/>
+ <xsl:with-param name="return-value" select="concat($return-value, substring-before($expression, ']'), ']')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="contains(substring-before($expression, ']'), '.') and contains(substring-after($expression, ']'), '!')">
+ <xsl:value-of select="concat('1', &quot;&apos;&quot;, substring-before(substring-after($expression, '['), ']'), &quot;&apos;&quot;, '#$', substring-before(substring-after($expression, ']'), '!'))"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat('2', $return-value, substring-before($expression, ']'), ']')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$first-one='&quot;'">
+ <xsl:value-of select="concat('1', $first-one, substring-before(substring-after($expression, '&quot;'), '&quot;'), '&quot;')"/>
+ </xsl:when>
+ <xsl:when test="$first-one=&quot;&apos;&quot;">
+ <xsl:variable name="str-in" select="substring-before(substring-after($expression, &quot;&apos;&quot;), &quot;&apos;&quot;)"/>
+ <xsl:choose>
+ <xsl:when test="contains($str-in, '\') and contains($str-in, '[') and contains($str-in, ']')">
+ <xsl:variable name="first-pos" select="substring-before($str-in, '[')"/>
+ <xsl:variable name="second-pos" select="substring-before(substring-after($str-in, '['), ']')"/>
+ <xsl:variable name="third-pos" select="substring-after($str-in, ']')"/>
+ <xsl:value-of select="concat('1', &quot;&apos;&quot;, $first-pos, $second-pos, &quot;&apos;&quot;, '#$', $third-pos)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat('1', &quot;&apos;&quot;, $str-in, &quot;&apos;&quot;)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$first-one='+' or $first-one='-' or $first-one='*' or $first-one='/' or $first-one=')' or $first-one='^' or $first-one=':' or $first-one='&quot;' or $first-one=';' or $first-one=',' or $first-one='&gt;' or $first-one='&lt;'">
+ <xsl:choose>
+ <xsl:when test="$return-value = ''">
+ <xsl:value-of select="concat('1', $first-one)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat('2', $return-value)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="$expression = ''">
+ <xsl:value-of select="concat('2', $return-value)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="parse-range-name">
+ <xsl:with-param name="expression" select="substring($expression, 2, string-length($expression)-1)"/>
+ <xsl:with-param name="return-value" select="concat($return-value, substring($expression, 1, 1))"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="handle-type-number">
+ <xsl:param name="t-part"/>
+ <xsl:choose>
+ <xsl:when test="starts-with($t-part, '[')">
+ <xsl:variable name="tt-str" select="substring-before( substring-after( $t-part, '['), ']')"/>
+ <xsl:choose>
+ <xsl:when test="($tt-str &lt; 0) or ($tt-str &gt; 0) or ($tt-str = 0)">
+ <xsl:value-of select="1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="2"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="($t-part &lt; 0) or ($t-part &gt; 0) or ($t-part = 0)">
+ <xsl:value-of select="1"/>
+ </xsl:when>
+ <xsl:when test="$t-part = ''">
+ <xsl:value-of select="1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="2"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="translate-unit">
+ <xsl:param name="column-number"/>
+ <xsl:param name="row-number"/>
+ <xsl:param name="column-pos-style"/>
+ <xsl:param name="row-pos-style"/>
+ <xsl:variable name="column-number1">
+ <xsl:value-of select="floor( $column-number div 26 )"/>
+ </xsl:variable>
+ <xsl:variable name="column-number2">
+ <xsl:value-of select="$column-number mod 26"/>
+ </xsl:variable>
+ <xsl:variable name="column-character1">
+ <xsl:call-template name="number-to-character">
+ <xsl:with-param name="number" select="$column-number1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="column-character2">
+ <xsl:call-template name="number-to-character">
+ <xsl:with-param name="number" select="$column-number2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$column-pos-style = 'absolute'">
+ <xsl:value-of select="concat( '$', $column-character1, $column-character2)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat( $column-character1, $column-character2)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="$row-pos-style ='absolute'">
+ <xsl:value-of select="concat( '$', $row-number)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$row-number"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="number-to-character">
+ <xsl:param name="number"/>
+ <xsl:choose>
+ <xsl:when test="$number = 0"/>
+ <xsl:when test="$number = 1">A</xsl:when>
+ <xsl:when test="$number = 2">B</xsl:when>
+ <xsl:when test="$number = 3">C</xsl:when>
+ <xsl:when test="$number = 4">D</xsl:when>
+ <xsl:when test="$number = 5">E</xsl:when>
+ <xsl:when test="$number = 6">F</xsl:when>
+ <xsl:when test="$number = 7">G</xsl:when>
+ <xsl:when test="$number = 8">H</xsl:when>
+ <xsl:when test="$number = 9">I</xsl:when>
+ <xsl:when test="$number = 10">J</xsl:when>
+ <xsl:when test="$number = 11">K</xsl:when>
+ <xsl:when test="$number = 12">L</xsl:when>
+ <xsl:when test="$number = 13">M</xsl:when>
+ <xsl:when test="$number = 14">N</xsl:when>
+ <xsl:when test="$number = 15">O</xsl:when>
+ <xsl:when test="$number = 16">P</xsl:when>
+ <xsl:when test="$number = 17">Q</xsl:when>
+ <xsl:when test="$number = 18">R</xsl:when>
+ <xsl:when test="$number = 19">S</xsl:when>
+ <xsl:when test="$number = 20">T</xsl:when>
+ <xsl:when test="$number = 21">U</xsl:when>
+ <xsl:when test="$number = 22">V</xsl:when>
+ <xsl:when test="$number = 23">W</xsl:when>
+ <xsl:when test="$number = 24">X</xsl:when>
+ <xsl:when test="$number = 25">Y</xsl:when>
+ <xsl:when test="$number = 26">Z</xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-digit-length">
+ <xsl:param name="complexive-string"/>
+ <xsl:variable name="first-char">
+ <xsl:value-of select="substring( $complexive-string, 1, 1)"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$first-char = '1' or $first-char = '2' or $first-char = '3' or $first-char = '4' or $first-char = '5' or $first-char = '6' or $first-char = '7' or $first-char = '8' or $first-char = '9' or $first-char = '0' ">
+ <xsl:variable name="temp">
+ <xsl:call-template name="get-digit-length">
+ <xsl:with-param name="complexive-string" select="substring( $complexive-string, 2)"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="$temp+1"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="å­—:å¥å±žæ€§" mode="style">
+ <!--chengxz 0725-->
+ <xsl:if test="not(@å­—:å¼æ ·å¼•ç”¨)">
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name">T<xsl:number from="/uof:UOF/uof:文字处ç†/å­—:主体" level="any" count="å­—:å¥å±žæ€§" format="1"/></xsl:attribute>
+ <xsl:attribute name="style:family">text</xsl:attribute>
+ <xsl:if test="@å­—:å¼æ ·å¼•ç”¨">
+ <xsl:attribute name="style:parent-style-name"><xsl:value-of select="@å­—:å¼æ ·å¼•ç”¨"/></xsl:attribute>
+ </xsl:if>
+ <xsl:element name="style:text-properties">
+ <xsl:apply-templates select="./*"/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="style-style-content">
+ <xsl:variable name="style-name" select="@表:标识符"/>
+ <xsl:variable name="apply-style-name" select="@表:å称"/>
+ <xsl:attribute name="style:family"><xsl:choose><xsl:when test="/uof:UOF/uof:电å­è¡¨æ ¼/表:主体/表:工作表/表:工作表内容/表:列[@表:å¼æ ·å¼•ç”¨=$style-name]">table-column</xsl:when><xsl:otherwise>table-cell</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="/uof:UOF/uof:电å­è¡¨æ ¼/表:主体/表:工作表/表:工作表内容/表:列[@表:å¼æ ·å¼•ç”¨=$style-name]/@表:列宽">
+ <xsl:element name="style:table-column-properties">
+ <xsl:attribute name="style:column-width"><xsl:value-of select="concat(/uof:UOF/uof:电å­è¡¨æ ¼/表:主体/表:工作表/表:工作表内容/表:列[@表:å¼æ ·å¼•ç”¨=$style-name]/@表:列宽,$uofUnit)"/></xsl:attribute>
+ <xsl:if test="/uof:UOF/uof:电å­è¡¨æ ¼/表:主体/表:工作表/表:工作表内容/表:列[@表:å¼æ ·å¼•ç”¨=$style-name]/@表:跨度">
+ <xsl:attribute name="fo:break-before">auto</xsl:attribute>
+ </xsl:if>
+ <xsl:for-each select="/uof:UOF/uof:电å­è¡¨æ ¼/表:主体/表:工作表/表:工作表内容/表:列[@表:å¼æ ·å¼•ç”¨=$style-name]">
+ <xsl:if test="preceding-sibling::表:列[1]/@表:跨度 and ancestor::表:工作表/表:分页符集/表:分页符/@表:列å·">
+ <xsl:variable name="kuadu">
+ <xsl:value-of select="preceding-sibling::表:列[1]/@表:跨度"/>
+ </xsl:variable>
+ <xsl:if test="not($kuadu='1')">
+ <xsl:attribute name="fo:break-before">page</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$kuadu='1' and not(preceding::表:列[2])">
+ <xsl:attribute name="fo:break-before">page</xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="style:table-cell-properties">
+ <xsl:if test="表:对é½æ ¼å¼">
+ <xsl:if test="表:对é½æ ¼å¼/表:垂直对é½æ–¹å¼">
+ <xsl:variable name="vertical-align">
+ <xsl:choose>
+ <xsl:when test="表:对é½æ ¼å¼/表:垂直对é½æ–¹å¼ = 'top'">top</xsl:when>
+ <xsl:when test="表:对é½æ ¼å¼/表:垂直对é½æ–¹å¼ = 'center'">center</xsl:when>
+ <xsl:when test="表:对é½æ ¼å¼/表:垂直对é½æ–¹å¼ = 'bottom'">bottom</xsl:when>
+ <xsl:otherwise>middle</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="style:vertical-align"><xsl:value-of select="$vertical-align"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="表:对é½æ ¼å¼/表:自动æ¢è¡Œ/@表:值 = 'true'">
+ <xsl:attribute name="fo:wrap-option">wrap</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="表:对é½æ ¼å¼/表:缩进">
+ <xsl:attribute name="fo:padding-left"><xsl:variable name="indent" select="表:对é½æ ¼å¼/表:缩进 * 10"/><xsl:call-template name="convert2cm"><xsl:with-param name="value" select="concat($indent,'pt')"/></xsl:call-template><xsl:text>cm</xsl:text></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="表:对é½æ ¼å¼/表:文字旋转角度">
+ <xsl:attribute name="style:rotation-angle"><xsl:choose><xsl:when test="表:对é½æ ¼å¼/表:文字旋转角度 &lt; 0"><xsl:value-of select="360 - 表:对é½æ ¼å¼/表:文字旋转角度"/></xsl:when><xsl:otherwise><xsl:value-of select="表:对é½æ ¼å¼/表:文字旋转角度"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="style:rotation-align">none</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="表:对é½æ ¼å¼/表:æ–‡å­—æ–¹å‘ = 'vertical'">
+ <xsl:attribute name="style:direction">ttb</xsl:attribute>
+ <xsl:if test="not(表:对é½æ ¼å¼/å­—:水平对é½æ–¹å¼)">
+ <xsl:attribute name="style:text-align-source">fix</xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ </xsl:if>
+ <!--xsl:if test="表:边框">
+ <xsl:apply-templates select="表:边框" />
+ </xsl:if-->
+ <!--chenjh add 边框 again-->
+ <xsl:if test="表:边框/uof:上/@uof:宽度 !=''">
+ <xsl:variable name="top-line-width" select="concat(表:边框/uof:上/@uof:宽度,$uofUnit)"/>
+ <xsl:variable name="top-line-tyle">
+ <xsl:choose>
+ <xsl:when test="表:边框/uof:上/@uof:类型='single'">solid</xsl:when>
+ <xsl:when test="表:边框/uof:上/@uof:类型='double'">double</xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="top-line-color" select="表:边框/uof:上/@uof:颜色"/>
+ <xsl:variable name="border-top" select="concat($top-line-width,' ',$top-line-tyle,' ',$top-line-color)"/>
+ <xsl:attribute name="fo:border-top"><xsl:value-of select="$border-top"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="表:边框/uof:下/@uof:宽度 !=''">
+ <xsl:variable name="bottom-line-width" select="concat(表:边框/uof:下/@uof:宽度,$uofUnit)"/>
+ <xsl:variable name="bottom-line-tyle">
+ <xsl:choose>
+ <xsl:when test="表:边框/uof:下/@uof:类型='single'">solid</xsl:when>
+ <xsl:when test="表:边框/uof:下/@uof:类型='double'">double</xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="bottom-line-color" select="表:边框/uof:下/@uof:颜色"/>
+ <xsl:variable name="border-bottom" select="concat($bottom-line-width,' ',$bottom-line-tyle,' ',$bottom-line-color)"/>
+ <xsl:attribute name="fo:border-bottom"><xsl:value-of select="$border-bottom"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="表:边框/uof:左/@uof:宽度 !=''">
+ <xsl:variable name="left-line-width" select="concat(表:边框/uof:左/@uof:宽度,$uofUnit)"/>
+ <xsl:variable name="left-line-tyle">
+ <xsl:choose>
+ <xsl:when test="表:边框/uof:左/@uof:类型='single'">solid</xsl:when>
+ <xsl:when test="表:边框/uof:左/@uof:类型='double'">double</xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="left-line-color" select="表:边框/uof:左/@uof:颜色"/>
+ <xsl:variable name="border-left" select="concat($left-line-width,' ',$left-line-tyle,' ',$left-line-color)"/>
+ <xsl:attribute name="fo:border-left"><xsl:value-of select="$border-left"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="表:边框/uof:å³/@uof:宽度 !=''">
+ <xsl:variable name="right-line-width" select="concat(表:边框/uof:å³/@uof:宽度,$uofUnit)"/>
+ <xsl:variable name="right-line-tyle">
+ <xsl:choose>
+ <xsl:when test="@uof:类型 = 'none'">none</xsl:when>
+ <xsl:when test="@uof:类型 = 'continuous'">solid</xsl:when>
+ <xsl:when test="@uof:类型 = 'double'">double</xsl:when>
+ <xsl:otherwise>solid</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="right-line-color" select="表:边框/uof:å³/@uof:颜色"/>
+ <xsl:variable name="border-right" select="concat($right-line-width,' ',$right-line-tyle,' ',$right-line-color)"/>
+ <xsl:attribute name="fo:border-right"><xsl:value-of select="$border-right"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="表:边框/uof:对角线1/@uof:宽度 !=''">
+ <xsl:variable name="diagonal-lr-width" select="concat(表:边框/uof:对角线1/@uof:宽度,$uofUnit)"/>
+ <xsl:variable name="diagonal-lr-tyle">
+ <xsl:choose>
+ <xsl:when test="表:边框/uof:对角线1/@uof:类型 = 'none'">none</xsl:when>
+ <xsl:when test="表:边框/uof:对角线1/@uof:类型 = 'continuous'">solid</xsl:when>
+ <xsl:when test="表:边框/uof:对角线1/@uof:类型 = 'double'">double</xsl:when>
+ <xsl:otherwise>solid</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="diagonal-lr-color" select="表:边框/uof:对角线1/@uof:颜色"/>
+ <xsl:variable name="border-diagonal" select="concat($diagonal-lr-width,' ',$diagonal-lr-tyle,' ',$diagonal-lr-color)"/>
+ <xsl:attribute name="style:diagonal-bl-tr"><xsl:value-of select="$border-diagonal"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="表:边框/uof:对角线2/@uof:宽度 !=''">
+ <xsl:variable name="diagonal-rl-width" select="concat(表:边框/uof:对角线2/@uof:宽度,$uofUnit)"/>
+ <xsl:variable name="diagonal-rl-tyle">
+ <xsl:choose>
+ <xsl:when test="表:边框/uof:对角线1/@uof:类型 = 'none'">none</xsl:when>
+ <xsl:when test="表:边框/uof:对角线1/@uof:类型 = 'continuous'">solid</xsl:when>
+ <xsl:when test="表:边框/uof:对角线1/@uof:类型 = 'double'">double</xsl:when>
+ <xsl:otherwise>solid</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="diagonal-rl-color" select="表:边框/uof:对角线2/@uof:颜色"/>
+ <xsl:variable name="border-diagonal" select="concat($diagonal-rl-width,' ',$diagonal-rl-tyle,' ',$diagonal-rl-color)"/>
+ <xsl:attribute name="style:diagonal-tl-br"><xsl:value-of select="$border-diagonal"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="表:边框/*/@uof:阴影">
+ <xsl:choose>
+ <xsl:when test="表:边框/uof:下/@uof:阴影 and 表:边框/uof:å³/@uof:阴影">
+ <xsl:attribute name="style:shadow">#808080 0.18cm 0.18cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="表:边框/uof:下/@uof:阴影 and 表:边框/uof:左/@uof:阴影">
+ <xsl:attribute name="style:shadow">#808080 -0.18cm 0.18cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="表:边框/uof:上/@uof:阴影 and 表:边框/uof:å³/@uof:阴影">
+ <xsl:attribute name="style:shadow">#808080 0.18cm -0.18cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="表:边框/uof:上/@uof:阴影 and 表:边框/uof:左/@uof:阴影">
+ <xsl:attribute name="style:shadow">#808080 -0.18cm -0.18cm</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ <!--边框 end -->
+ <xsl:if test="表:填充">
+ <xsl:choose>
+ <xsl:when test="表:填充/图:颜色">
+ <xsl:attribute name="fo:background-color"><xsl:value-of select="表:填充/图:颜色"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="表:å¡«å……/图:图案/@图:å‰æ™¯è‰²">
+ <xsl:variable name="pattern-value">
+ <xsl:call-template name="cell-pattern-color">
+ <xsl:with-param name="pattern" select="concat('0.',substring-after(表:填充/图:图案/图:背景色,'y'))"/>
+ <xsl:with-param name="color-value" select="表:填充/图:颜色"/>
+ <xsl:with-param name="pattern-color-value" select="表:填充/图:图案/图:背景色"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="fo:background-color"><xsl:value-of select="$pattern-value"/></xsl:attribute>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="表:字体格å¼/å­—:éšè—文字">
+ <xsl:choose>
+ <xsl:when test="表:字体格å¼/å­—:éšè—文字 = 'true'">
+ <xsl:attribute name="style:cell-protect">protected formula-hidden</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:cell-protect">none</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:attribute name="style:cell-protect">none</xsl:attribute>
+ <xsl:attribute name="style:text-align-source">fix</xsl:attribute>
+ </xsl:element>
+ <xsl:element name="style:paragraph-properties">
+ <xsl:if test="表:对é½æ ¼å¼/表:水平对é½æ–¹å¼">
+ <xsl:variable name="text-align">
+ <xsl:choose>
+ <xsl:when test="表:对é½æ ¼å¼/表:水平对é½æ–¹å¼ = 'left'">start</xsl:when>
+ <xsl:when test="表:对é½æ ¼å¼/表:水平对é½æ–¹å¼ = 'center'">center</xsl:when>
+ <xsl:when test="表:对é½æ ¼å¼/表:水平对é½æ–¹å¼ = 'right'">end</xsl:when>
+ <xsl:when test="表:对é½æ ¼å¼/表:水平对é½æ–¹å¼ = 'justify'">justify</xsl:when>
+ <xsl:otherwise>start</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="fo:text-align"><xsl:value-of select="$text-align"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:element name="style:text-properties">
+ <xsl:if test="表:字体格å¼/å­—:字体">
+ <xsl:choose>
+ <xsl:when test="(表:字体格å¼/å­—:字体/@å­—:中文字体引用)or (表:字体格å¼/å­—:字体/@å­—:西文字体引用)">
+ <xsl:variable name="fontnameZ" select="表:字体格å¼/å­—:字体/@å­—:中文字体引用"/>
+ <xsl:variable name="fontnameX" select="表:字体格å¼/å­—:字体/@å­—:西文字体引用"/>
+ <xsl:for-each select="/uof:UOF/uof:å¼æ ·é›†/uof:字体集/uof:字体声明">
+ <xsl:if test="(./@uof:标识符 = $fontnameZ)or(./@uof:标识符 = $fontnameX)">
+ <xsl:attribute name="style:font-name"><xsl:value-of select="./@uof:å称"/></xsl:attribute>
+ <xsl:attribute name="style:font-name-asian"><xsl:value-of select="./@uof:å称"/></xsl:attribute>
+ <xsl:attribute name="style:font-name-complex"><xsl:value-of select="./@uof:å称"/></xsl:attribute>
+ <xsl:attribute name="style:font-charset"><xsl:value-of select="./@uof:字体æ—"/></xsl:attribute>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:font-name">Arial</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="表:字体格å¼/å­—:粗体/@å­—:值">
+ <xsl:attribute name="fo:font-weight"><xsl:choose><xsl:when test="表:字体格å¼/å­—:粗体/@å­—:值=1 or 表:字体格å¼/å­—:粗体/@å­—:值='true'">bold</xsl:when><xsl:when test="表:字体格å¼/å­—:粗体/@å­—:值=0 or 表:字体格å¼/å­—:粗体/@å­—:值='false'">normal</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:attribute name="style:font-weight-asian"><xsl:choose><xsl:when test="表:字体格å¼/å­—:粗体/@å­—:值=1 or 表:字体格å¼/å­—:粗体/@å­—:值='true'">bold</xsl:when><xsl:when test="表:字体格å¼/å­—:粗体/@å­—:值=0 or 表:字体格å¼/å­—:粗体/@å­—:值='false'">normal</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:attribute name="style:font-weight-complex"><xsl:choose><xsl:when test="表:字体格å¼/å­—:粗体/@å­—:值=1 or 表:字体格å¼/å­—:粗体/@å­—:值='true'">bold</xsl:when><xsl:when test="表:字体格å¼/å­—:粗体/@å­—:值=0 or 表:字体格å¼/å­—:粗体/@å­—:值='false'">normal</xsl:when></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="表:字体格å¼/å­—:斜体/@å­—:值">
+ <xsl:attribute name="fo:font-style"><xsl:choose><xsl:when test="表:字体格å¼/å­—:斜体/@å­—:值=1 or 表:字体格å¼/å­—:斜体/@å­—:值='true'">italic</xsl:when><xsl:when test="表:字体格å¼/å­—:斜体/@å­—:值=0 or 表:字体格å¼/å­—:斜体/@å­—:值='false'">normal</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:attribute name="style:font-style-asian"><xsl:choose><xsl:when test="表:字体格å¼/å­—:斜体/@å­—:值=1 or 表:字体格å¼/å­—:斜体/@å­—:值='true'">italic</xsl:when><xsl:when test="表:字体格å¼/å­—:斜体/@å­—:值=0 or 表:字体格å¼/å­—:斜体/@å­—:值='false'">normal</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:attribute name="style:font-style-complex"><xsl:choose><xsl:when test="表:字体格å¼/å­—:斜体/@å­—:值=1 or 表:字体格å¼/å­—:斜体/@å­—:值='true'">italic</xsl:when><xsl:when test="表:字体格å¼/å­—:斜体/@å­—:值=0 or 表:字体格å¼/å­—:斜体/@å­—:值='false'">normal</xsl:when></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="表:字体格å¼/å­—:字体/@å­—:颜色">
+ <xsl:attribute name="fo:color"><xsl:value-of select="表:字体格å¼/å­—:字体/@å­—:颜色"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:use-window-font-color">true</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="表:字体格å¼/å­—:字体/@å­—:å­—å·">
+ <xsl:attribute name="fo:font-size"><xsl:value-of select="concat( 表:字体格å¼/å­—:字体/@å­—:å­—å·, 'pt')"/></xsl:attribute>
+ <xsl:attribute name="style:font-size-asian"><xsl:value-of select="concat( 表:字体格å¼/å­—:字体/@å­—:å­—å·, 'pt')"/></xsl:attribute>
+ <xsl:attribute name="style:font-size-complex"><xsl:value-of select="concat( 表:字体格å¼/å­—:字体/@å­—:å­—å·, 'pt')"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:font-size">12pt</xsl:attribute>
+ <xsl:attribute name="style:font-size-asian">12pt</xsl:attribute>
+ <xsl:attribute name="style:font-size-complex">12pt</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="表:字体格å¼/å­—:浮雕">
+ <xsl:variable name="aa">
+ <xsl:value-of select="表:字体格å¼/å­—:浮雕/@å­—:类型"/>
+ </xsl:variable>
+ <xsl:attribute name="style:font-relief"><xsl:choose><xsl:when test="$aa='emboss'">embossed</xsl:when><xsl:when test="$aa='engrave'">engraved</xsl:when></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="表:字体格å¼/å­—:阴影/@å­—:值 = '1' or 表:字体格å¼/å­—:阴影/@å­—:值 = 'true'">
+ <xsl:attribute name="fo:text-shadow">1pt 1pt</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="表:字体格å¼/å­—:删除线">
+ <xsl:attribute name="style:text-line-through-style">solid</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="表:字体格å¼/å­—:删除线/@å­—:类型='double'">
+ <xsl:attribute name="style:text-line-through-type">double</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="表:字体格å¼/å­—:删除线/@å­—:类型='single'">
+ <xsl:attribute name="style:text-underline-mode">continuous</xsl:attribute>
+ <xsl:attribute name="style:text-line-through-mode">continuous</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="表:字体格å¼/å­—:删除线/@å­—:类型='bold'">
+ <xsl:attribute name="style:text-line-through-width">bold</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="表:字体格å¼/å­—:删除线/@å­—:类型='带/'">
+ <xsl:attribute name="style:text-line-through-text">/</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="表:字体格å¼/å­—:删除线/@å­—:类型='带X'">
+ <xsl:attribute name="style:text-line-through-text">X</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="表:字体格å¼/å­—:下划线">
+ <xsl:apply-templates select="表:字体格å¼/å­—:下划线"/>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="表:字体格å¼/å­—:ç€é‡å·">
+ <xsl:apply-templates select="表:字体格å¼/å­—:ç€é‡å·"/>
+ </xsl:if>
+ <xsl:if test="表:字体格å¼/å­—:空心/@å­—:值='true'">
+ <xsl:attribute name="style:text-outline">true</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="å•å…ƒæ ¼å…·ä½“å¼æ ·">
+ <xsl:choose>
+ <xsl:when test="@表:类型 = 'Default'">
+ <xsl:element name="style:default-style">
+ <xsl:call-template name="style-style-content"/>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name"><xsl:value-of select="@表:标识符"/></xsl:attribute>
+ <xsl:if test="表:æ•°å­—æ ¼å¼/@表:æ ¼å¼ç  = 'general'">
+ <xsl:attribute name="style:parent-style-name">Default</xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="style:parent-style-name">Default</xsl:attribute>
+ <xsl:attribute name="style:data-style-name"><xsl:value-of select="concat( @表:标识符, 'F')"/></xsl:attribute>
+ <!--chengxz这里è¦æ”¹ -->
+ <!--xsl:attribute name="style:data-style-name"><xsl:value-of select="'N2'"/></xsl:attribute-->
+ <xsl:call-template name="style-style-content"/>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="表:边框">
+ <!--chengxz 0622-->
+ <xsl:if test="not(uof:下)">
+ <xsl:attribute name="fo:border-bottom">none</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="not(uof:上)">
+ <xsl:attribute name="fo:border-top">none</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="not(uof:å·¦)">
+ <xsl:attribute name="fo:border-left">none</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="not(uof:å³)">
+ <xsl:attribute name="fo:border-right">none</xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates select="uof:对角线1"/>
+ <xsl:apply-templates select="uof:对角线2"/>
+ <xsl:apply-templates select="uof:上"/>
+ <xsl:apply-templates select="uof:下"/>
+ <xsl:apply-templates select="uof:å·¦"/>
+ <xsl:apply-templates select="uof:å³"/>
+ </xsl:template>
+ <xsl:template match="uof:上">
+ <xsl:variable name="bordtype">
+ <xsl:choose>
+ <xsl:when test="@uof:类型 = 'none'">none</xsl:when>
+ <xsl:when test="@uof:类型 = 'continuous'">solid</xsl:when>
+ <xsl:when test="@uof:类型 = 'double'">double</xsl:when>
+ <!-- Dash, Dot, DashDot, DashDotDot, SlantDashDot are not supported yet -->
+ <xsl:otherwise>solid</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="fo:border-top"><xsl:value-of select="concat(@uof:宽度 div 30,$uofUnit, ' ',$bordtype, ' ', @uof:颜色)"/></xsl:attribute>
+ <xsl:if test="@uof:类型 = 'double'">
+ <xsl:attribute name="style:border-line-width-top">0.035cm 0.035cm 0.035cm</xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="uof:下">
+ <xsl:variable name="bordtype">
+ <xsl:choose>
+ <xsl:when test="@uof:类型 = 'none'">none</xsl:when>
+ <xsl:when test="@uof:类型 = 'continuous'">solid</xsl:when>
+ <xsl:when test="@uof:类型 = 'double'">double</xsl:when>
+ <!-- Dash, Dot, DashDot, DashDotDot, SlantDashDot are not supported yet -->
+ <xsl:otherwise>solid</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="fo:border-bottom"><xsl:value-of select="concat(@uof:宽度 div 30, $uofUnit,' ',$bordtype, ' ',@uof:颜色)"/></xsl:attribute>
+ <xsl:if test="@uof:类型 = 'double'">
+ <xsl:attribute name="style:border-line-width-bottom">0.035cm 0.035cm 0.035cm</xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="uof:å·¦">
+ <xsl:variable name="bordtype">
+ <xsl:choose>
+ <xsl:when test="@uof:类型 = 'none'">none</xsl:when>
+ <xsl:when test="@uof:类型 = 'continuous'">solid</xsl:when>
+ <xsl:when test="@uof:类型 = 'double'">double</xsl:when>
+ <!-- Dash, Dot, DashDot, DashDotDot, SlantDashDot are not supported yet -->
+ <xsl:otherwise>solid</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="fo:border-left"><xsl:value-of select="concat(@uof:宽度 div 30,$uofUnit, ' ',$bordtype, ' ', @uof:颜色)"/></xsl:attribute>
+ <xsl:if test="@uof:类型 = 'double'">
+ <xsl:attribute name="style:border-line-width-left">0.035cm 0.035cm 0.035cm</xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="uof:å³">
+ <xsl:variable name="bordtype">
+ <xsl:choose>
+ <xsl:when test="@uof:类型 = 'none'">none</xsl:when>
+ <xsl:when test="@uof:类型 = 'continuous'">solid</xsl:when>
+ <xsl:when test="@uof:类型 = 'double'">double</xsl:when>
+ <!-- Dash, Dot, DashDot, DashDotDot, SlantDashDot are not supported yet -->
+ <xsl:otherwise>solid</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="fo:border-right"><xsl:value-of select="concat( @uof:宽度 div 30, $uofUnit,' ',$bordtype, ' ', @uof:颜色)"/></xsl:attribute>
+ <xsl:if test="@uof:类型 = 'double'">
+ <xsl:attribute name="style:border-line-width-right">0.035cm 0.035cm 0.035cm</xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="uof:对角线1">
+ <xsl:variable name="bordtype">
+ <xsl:choose>
+ <xsl:when test="@uof:类型 = 'none'">none</xsl:when>
+ <xsl:when test="@uof:类型 = 'continuous'">solid</xsl:when>
+ <xsl:when test="@uof:类型 = 'double'">double</xsl:when>
+ <!-- Dash, Dot, DashDot, DashDotDot, SlantDashDot are not supported yet -->
+ <xsl:otherwise>solid</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="style:diagonal-bl-tr"><xsl:value-of select="concat( @uof:宽度 div 30, $uofUnit,' ',$bordtype, ' ', @uof:颜色)"/></xsl:attribute>
+ <xsl:if test="@uof:类型 = 'double'">
+ <xsl:attribute name="style:diagonal-bl-tr-width">0.035cm 0.035cm 0.035cm</xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="uof:对角线2">
+ <xsl:variable name="bordtype">
+ <xsl:choose>
+ <xsl:when test="@uof:类型 = 'none'">none</xsl:when>
+ <xsl:when test="@uof:类型 = 'continuous'">solid</xsl:when>
+ <xsl:when test="@uof:类型 = 'double'">double</xsl:when>
+ <!-- Dash, Dot, DashDot, DashDotDot, SlantDashDot are not supported yet -->
+ <xsl:otherwise>solid</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="style:diagonal-tl-br"><xsl:value-of select="concat( @uof:宽度 div 30, $uofUnit,' ',$bordtype, ' ', @uof:颜色)"/></xsl:attribute>
+ <xsl:if test="@uof:类型 = 'double'">
+ <xsl:attribute name="style:diagonal-tl-br-width">0.035cm 0.035cm 0.035cm</xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="表:字体格å¼">
+ <xsl:choose>
+ <xsl:when test="字:上下标/@字:上下标 = 'sup'">
+ <style:style style:name="{concat(../@表:标识符,'T0')}" style:family="text">
+ <style:text-properties style:text-position="33% 58%"/>
+ </style:style>
+ </xsl:when>
+ <xsl:when test="字:上下标/@字:上下标 = 'sub'">
+ <style:style style:name="{concat(../@表:标识符,'T0')}" style:family="text">
+ <style:text-properties style:text-position="-33% 58%"/>
+ </style:style>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="tablecolumngroup">
+ <xsl:param name="start"/>
+ <xsl:param name="end"/>
+ <xsl:param name="prestart"/>
+ <xsl:param name="preend"/>
+ <xsl:param name="nextstart"/>
+ <xsl:param name="nextend"/>
+ <table:table-column-group>
+ <table:table-column>
+ <xsl:attribute name="table:style-name">co1</xsl:attribute>
+ <xsl:attribute name="table:table-column-repeated"><xsl:value-of select="@表:终止 - @表:起始 + 1"/></xsl:attribute>
+ </table:table-column>
+ <xsl:if test="$nextstart &gt;= $start and $nextend &lt;= $end">
+ <xsl:for-each select="following-sibling::表:列[1]">
+ <xsl:call-template name="tablecolumngroup"/>
+ </xsl:for-each>
+ </xsl:if>
+ </table:table-column-group>
+ </xsl:template>
+ <xsl:template match="表:工作表">
+ <xsl:variable name="rowpath" select="表:工作表内容/表:行"/>
+ <xsl:variable name="colpath" select="表:工作表内容/表:列"/>
+ <xsl:element name="table:table">
+ <xsl:attribute name="table:name"><xsl:value-of select="@表:å称"/></xsl:attribute>
+ <xsl:if test="表:工作表内容">
+ <xsl:attribute name="table:style-name"><xsl:value-of select="concat( 'ta', count(preceding-sibling::表:工作表)+1)"/></xsl:attribute>
+ <xsl:if test="(@表:éšè— = '1')or(@表:éšè— = 'true')">
+ <xsl:attribute name="table:protected">true</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="表:工作表内容/uof:锚点 or 表:工作表内容/表:图表">
+ <table:shapes>
+ <xsl:apply-templates select="表:工作表内容/uof:锚点"/>
+ <xsl:apply-templates select="表:工作表内容/表:图表">
+ <xsl:with-param name="table-name" select="@表:å称"/>
+ </xsl:apply-templates>
+ </table:shapes>
+ </xsl:if>
+ <xsl:variable name="table-pos">
+ <xsl:value-of select="count(../preceding-sibling::表:工作表)+1"/>
+ </xsl:variable>
+ <xsl:if test="表:工作表内容/表:分组集/表:列">
+ <xsl:for-each select="表:工作表内容/表:分组集/表:列">
+ <xsl:variable name="start" select="@表:起始"/>
+ <xsl:variable name="end" select="@表:终止"/>
+ <xsl:variable name="prestart" select="preceding-sibling::表:列/@表:起始"/>
+ <xsl:variable name="preend" select="preceding-sibling::表:列/@表:终止"/>
+ <xsl:variable name="nextstart" select="following-sibling::表:列/@表:起始"/>
+ <xsl:variable name="nextend" select="following-sibling::表:列/@表:终止"/>
+ <xsl:call-template name="tablecolumngroup">
+ <xsl:with-param name="start" select="$start"/>
+ <xsl:with-param name="end" select="$end"/>
+ <xsl:with-param name="prestart" select="$prestart"/>
+ <xsl:with-param name="preend" select="$preend"/>
+ <xsl:with-param name="nextstart" select="$nextstart"/>
+ <xsl:with-param name="nextend" select="$nextend"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:for-each select="表:工作表内容/表:列">
+ <table:table-column>
+ <xsl:attribute name="table:style-name"><xsl:value-of select="@表:å¼æ ·å¼•ç”¨"/></xsl:attribute>
+ <xsl:if test="@表:跨度 and not(@表:跨度='1')">
+ <xsl:attribute name="table:number-columns-repeated"><xsl:value-of select="@表:跨度"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@表:éšè—">
+ <xsl:attribute name="table:visibility">collapse</xsl:attribute>
+ </xsl:if>
+ </table:table-column>
+ </xsl:for-each>
+ <xsl:variable name="condition-pos-str1">
+ <xsl:if test="../../表:公用处ç†è§„则/表:æ¡ä»¶æ ¼å¼åŒ–集/表:æ¡ä»¶æ ¼å¼åŒ–">
+ <xsl:call-template name="condition-row-column-string">
+ <xsl:with-param name="last" select="''"/>
+ <xsl:with-param name="total" select="count(../../表:公用处ç†è§„则/表:æ¡ä»¶æ ¼å¼åŒ–集/表:æ¡ä»¶æ ¼å¼åŒ–)"/>
+ <xsl:with-param name="index" select="1"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:variable name="condition-pos-str2">
+ <xsl:if test="../../表:公用处ç†è§„则/表:æ•°æ®æœ‰æ•ˆæ€§é›†/表:æ•°æ®æœ‰æ•ˆæ€§">
+ <xsl:call-template name="validation-row-column-string">
+ <xsl:with-param name="last" select="''"/>
+ <xsl:with-param name="total" select="count(../../表:公用处ç†è§„则/表:æ•°æ®æœ‰æ•ˆæ€§é›†/表:æ•°æ®æœ‰æ•ˆæ€§)"/>
+ <xsl:with-param name="index" select="1"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:variable name="condition-pos-str" select="concat($condition-pos-str1, $condition-pos-str2)"/>
+ <xsl:choose>
+ <xsl:when test="./表:工作表内容/表:行">
+ <xsl:call-template name="create-rows">
+ <xsl:with-param name="lastrowpos" select="0"/>
+ <xsl:with-param name="row-count" select="count(表:工作表内容/表:行)"/>
+ <xsl:with-param name="currentRow" select="1"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="tableHasStyle">
+ <xsl:choose>
+ <xsl:when test="./表:工作表内容[@表:å¼æ ·å¼•ç”¨]">
+ <xsl:value-of select="1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="0"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="./表:分页符集/表:分页符[@表:è¡Œå·]">
+ <xsl:for-each select="./表:分页符集/表:分页符[@表:è¡Œå·]">
+ <xsl:variable name="number-repeated">
+ <xsl:choose>
+ <xsl:when test="position() = 1">
+ <xsl:value-of select="./@表:è¡Œå·"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="./@表:è¡Œå· - preceding::表:分页符[@表:è¡Œå· and (position()=count(.))]/@表:è¡Œå· - 1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="$number-repeated &gt; 0">
+ <xsl:element name="table:table-row">
+ <xsl:if test="($rowpath/@表:éšè— = '1') or ($rowpath/@表:éšè— = 'true')">
+ <xsl:attribute name="table:visibility">collapse</xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="table:style-name"><xsl:value-of select="concat('ro',$table-pos)"/></xsl:attribute>
+ <xsl:attribute name="table:number-rows-repeated"><xsl:value-of select="$number-repeated"/></xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="$tableHasStyle = 1">
+ <table:table-cell table:number-columns-repeated="256"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <table:table-cell/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="table:table-row">
+ <xsl:if test="($colpath/@表:éšè— = '1') or ($colpath/@表:éšè— = 'true')">
+ <xsl:attribute name="table:visibility">collapse</xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="table:style-name"><xsl:value-of select="concat('rob',$table-pos)"/></xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="$tableHasStyle = 1">
+ <table:table-cell table:number-columns-repeated="256"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <table:table-cell/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="table:table-row">
+ <xsl:choose>
+ <xsl:when test="表:工作表内容/@表:å¼æ ·å¼•ç”¨">
+ <xsl:attribute name="table:style-name"><xsl:value-of select="表:工作表内容/@表:å¼æ ·å¼•ç”¨"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="table:style-name"><xsl:text>ro1</xsl:text></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:element name="table:table-cell"/>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="../../表:公用处ç†è§„则/表:æ¡ä»¶æ ¼å¼åŒ–集/表:æ¡ä»¶æ ¼å¼åŒ–">
+ <xsl:variable name="condition-row-max">
+ <xsl:call-template name="condition-row-col-pos-max">
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="last-value" select="0"/>
+ <xsl:with-param name="div-value" select="'R'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="condition-col-max">
+ <xsl:call-template name="condition-row-col-pos-max">
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="last-value" select="0"/>
+ <xsl:with-param name="div-value" select="'C'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="break-row-max">
+ <xsl:call-template name="break-row-beyond-max">
+ <xsl:with-param name="pos" select="1"/>
+ <xsl:with-param name="last-value" select="0"/>
+ <xsl:with-param name="count-value" select="count(./表:分页符集/表:分页符[@表:è¡Œå·])"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="end-value">
+ <xsl:choose>
+ <xsl:when test="$condition-row-max &lt; $break-row-max">
+ <xsl:value-of select="$break-row-max"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$condition-row-max"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:call-template name="get-row-beyond-last">
+ <xsl:with-param name="index-value" select="1"/>
+ <xsl:with-param name="worksheetNo" select="count(preceding-sibling::表:工作表)+1"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="end-pos" select="$end-value"/>
+ <xsl:with-param name="total-col" select="$condition-col-max"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="./表:工作表内容/@表:å¼æ ·å¼•ç”¨">
+ <table:table-row table:style-name="ro1" table:number-rows-repeated="32000">
+ <table:table-cell table:number-columns-repeated="256"/>
+ </table:table-row>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:element>
+ <xsl:if test="表:图表">
+ <table:shapes>
+ <xsl:apply-templates select="表:图表">
+ <xsl:with-param name="table-name" select="@表:å称"/>
+ </xsl:apply-templates>
+ </table:shapes>
+ </xsl:if>
+ </xsl:template>
+ <!--xsl:template name="create-columns-without-input"></xsl:template>
+ <xsl:template name="create-columns"></xsl:template>
+ <xsl:template name="condition-row-column-string"></xsl:template>
+<xsl:template name="validation-row-column-string"></xsl:template>
+<xsl:template name="create-rows"></xsl:template>
+<xsl:template name="condition-row-col-pos-max"></xsl:template>
+<xsl:template name="get-row-beyond-last"></xsl:template-->
+ <!--xsl:template name="break-row-beyond-max"></xsl:template-->
+ <!-- chengxz有问题-->
+ <xsl:template name="create-columns-without-input">
+ <xsl:param name="table-pos"/>
+ <xsl:variable name="rowpath" select="表:工作表内容/表:行"/>
+ <xsl:variable name="colpath" select="表:工作表内容/表:列"/>
+ <xsl:choose>
+ <xsl:when test="./表:分页符集/表:分页符[@表:列å·]">
+ <xsl:for-each select="./表:分页符集/表:分页符[@表:列å·]">
+ <xsl:variable name="number-repeated">
+ <xsl:choose>
+ <xsl:when test="position() = 1">
+ <xsl:value-of select="./@表:列å·"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="./@表:åˆ—å· - preceding::表:分页符[@表:åˆ—å· and (position()=count(.))]/@表:åˆ—å· - 1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="$number-repeated &gt; 0">
+ <xsl:element name="table:table-column">
+ <xsl:if test="ancestor::表:工作表/表:工作表内容/@表:å¼æ ·å¼•ç”¨">
+ <xsl:attribute name="table:default-cell-style-name"><xsl:value-of select="ancestor::表:工作表/表:工作表内容/@表:å¼æ ·å¼•ç”¨"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="($colpath/@表:éšè— = '1') or ($colpath/@表:éšè— = 'true')">
+ <xsl:attribute name="table:visibility">collapse</xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="table:style-name"><xsl:value-of select="concat('co',$table-pos)"/></xsl:attribute>
+ <xsl:attribute name="table:number-columns-repeated"><xsl:value-of select="$number-repeated"/></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="table:table-column">
+ <xsl:if test="ancestor::表:工作表/表:工作表内容/@表:å¼æ ·å¼•ç”¨">
+ <xsl:attribute name="table:default-cell-style-name"><xsl:value-of select="ancestor::表:工作表/表:工作表内容/@表:å¼æ ·å¼•ç”¨"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="($colpath/@表:éšè— = '1') or ($colpath/@表:éšè— = 'true')">
+ <xsl:attribute name="table:visibility">collapse</xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="table:style-name"><xsl:value-of select="concat('cob',$table-pos)"/></xsl:attribute>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="table:table-column">
+ <xsl:choose>
+ <xsl:when test="表:工作表内容/@表:å¼æ ·å¼•ç”¨">
+ <xsl:attribute name="table:style-name"><xsl:value-of select="表:工作表内容/@表:å¼æ ·å¼•ç”¨"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="table:style-name"><xsl:text>co1</xsl:text></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="表:工作表内容/@表:最大列 and 表:工作表内容/@表:最大列 > 0">
+ <xsl:attribute name="table:number-columns-repeated"><xsl:value-of select="表:工作表内容/@表:最大列"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="table:default-cell-style-name"><xsl:text>Default</xsl:text></xsl:attribute>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="create-columns">
+ <xsl:param name="columnCount"/>
+ <xsl:param name="currentColumn" select="1"/>
+ <xsl:param name="finishedColumns" select="0"/>
+ <xsl:param name="worksheetNo" select="count(preceding-sibling::表:工作表)+1"/>
+ <xsl:param name="currentColumnNode"/>
+ <xsl:choose>
+ <xsl:when test="$finishedColumns &lt; $columnCount">
+ <xsl:choose>
+ <xsl:when test="$currentColumnNode">
+ <xsl:choose>
+ <xsl:when test="$currentColumnNode/@表:åˆ—å· - $finishedColumns &gt; 1">
+ <xsl:call-template name="create-default-column">
+ <xsl:with-param name="currentColumn" select="$currentColumn"/>
+ <xsl:with-param name="currentColumnNode" select="$currentColumnNode"/>
+ <xsl:with-param name="worksheetNo" select="$worksheetNo"/>
+ </xsl:call-template>
+ <xsl:call-template name="create-columns">
+ <xsl:with-param name="columnCount" select="$columnCount"/>
+ <xsl:with-param name="currentColumn" select="$currentColumn"/>
+ <xsl:with-param name="currentColumnNode" select="$currentColumnNode"/>
+ <xsl:with-param name="finishedColumns" select="$finishedColumns + 1"/>
+ <xsl:with-param name="worksheetNo" select="$worksheetNo"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="table:table-column">
+ <xsl:if test="($currentColumnNode/@表:éšè— = '1') or ($currentColumnNode/@表:éšè— = 'true')">
+ <xsl:attribute name="table:visibility">collapse</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$currentColumnNode/@表:跨度">
+ <xsl:attribute name="table:number-columns-repeated"><xsl:value-of select="$currentColumnNode/@表:跨度 + 1"/></xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="key('ColBreak', $currentColumn)">
+ <xsl:attribute name="table:style-name"><xsl:value-of select="concat('cob', $worksheetNo, '-', $currentColumn)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="table:style-name"><xsl:value-of select="concat('co', $worksheetNo, '-', $currentColumn)"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:call-template name="create-columns">
+ <xsl:with-param name="columnCount" select="$columnCount"/>
+ <xsl:with-param name="currentColumn" select="$currentColumn + 1"/>
+ <xsl:with-param name="finishedColumns" select="$finishedColumns + 1"/>
+ <xsl:with-param name="currentColumnNode" select="表:工作表属性/表:列[$currentColumn + 1]"/>
+ <xsl:with-param name="worksheetNo" select="$worksheetNo"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="create-default-column">
+ <xsl:with-param name="currentColumn" select="$currentColumn"/>
+ <xsl:with-param name="currentColumnNode" select="$currentColumnNode"/>
+ <xsl:with-param name="worksheetNo" select="$worksheetNo"/>
+ </xsl:call-template>
+ <xsl:call-template name="create-columns">
+ <xsl:with-param name="columnCount" select="$columnCount"/>
+ <xsl:with-param name="currentColumn" select="$currentColumn"/>
+ <xsl:with-param name="finishedColumns" select="$finishedColumns + 1"/>
+ <xsl:with-param name="worksheetNo" select="$worksheetNo"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="$currentColumn = $columnCount">
+ <xsl:if test="表:分页符集/表:分页符/@表:åˆ—å· &gt; $finishedColumns">
+ <xsl:call-template name="get-column-beyond-last">
+ <xsl:with-param name="index-value" select="$finishedColumns"/>
+ <xsl:with-param name="worksheetNo" select="$worksheetNo"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-column-beyond-last">
+ <xsl:param name="index-value"/>
+ <xsl:param name="worksheetNo"/>
+ <xsl:for-each select="表:分页符集/表:分页符[@表:列å·]">
+ <xsl:variable name="each-column-value" select="@表:列å·"/>
+ <xsl:choose>
+ <xsl:when test="$each-column-value + 1 &gt; $index-value">
+ <xsl:variable name="number-repeated">
+ <xsl:choose>
+ <xsl:when test="preceding-sibling::表:分页符[@表:列å·][position()=count(.)]/@表:åˆ—å· + 1 = $index-value">
+ <xsl:value-of select="$each-column-value - preceding-sibling::表:分页符[@表:åˆ—å· and (position()=count(.))]/@表:åˆ—å· - 1"/>
+ </xsl:when>
+ <xsl:when test="preceding-sibling::表:分页符[@表:åˆ—å· and (position()=count(.))]/@表:åˆ—å· + 1 &gt; $index-value">
+ <xsl:value-of select="$each-column-value - preceding-sibling::表:分页符[@表:列å·][position()=count(.)]/@表:åˆ—å· - 1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$each-column-value - $index-value + 1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="$number-repeated &gt; 0">
+ <xsl:element name="table:table-column">
+ <xsl:attribute name="table:style-name"><xsl:value-of select="'co1'"/></xsl:attribute>
+ <xsl:attribute name="table:number-columns-repeated"><xsl:value-of select="$number-repeated"/></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="table:table-column">
+ <xsl:if test="../../表:工作表内容[@表:å¼æ ·å¼•ç”¨]">
+ <xsl:attribute name="table:default-cell-style-name"><xsl:value-of select="./表:工作表内容/@表:å¼æ ·å¼•ç”¨"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="table:style-name"><xsl:value-of select="concat('cob',$worksheetNo)"/></xsl:attribute>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="$each-column-value + 1 = $index-value">
+ <xsl:element name="table:table-column">
+ <xsl:if test="/../../表:工作表内容[@表:å¼æ ·å¼•ç”¨]">
+ <xsl:attribute name="table:default-cell-style-name"><xsl:value-of select="./../../表:工作表内容/@表:å¼æ ·å¼•ç”¨"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="table:style-name"><xsl:value-of select="concat('cob',$worksheetNo)"/></xsl:attribute>
+ </xsl:element>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="condition-row-column-string">
+ <xsl:param name="last"/>
+ <xsl:param name="total"/>
+ <xsl:param name="index"/>
+ <xsl:variable name="table-pos" select="count(preceding-sibling::表:工作表)+1"/>
+ <xsl:variable name="current">
+ <xsl:call-template name="parse-range">
+ <xsl:with-param name="range-value" select="../../表:公用处ç†è§„则/表:æ¡ä»¶æ ¼å¼åŒ–集/表:æ¡ä»¶æ ¼å¼åŒ–[position() = $index]/表:范围"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="current-value" select="concat('(c',$table-pos,'-',$index,':', $current,');')"/>
+ <xsl:if test="$index &lt; $total">
+ <xsl:call-template name="condition-row-column-string">
+ <xsl:with-param name="last" select="concat($last, $current-value)"/>
+ <xsl:with-param name="total" select="$total"/>
+ <xsl:with-param name="index" select="$index + 1"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="$index = $total">
+ <xsl:value-of select="concat($last, $current-value)"/>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="validation-row-column-string">
+ <xsl:param name="last"/>
+ <xsl:param name="total"/>
+ <xsl:param name="index"/>
+ <xsl:variable name="table-pos" select="count(preceding-sibling::表:工作表)+1"/>
+ <xsl:variable name="current">
+ <xsl:call-template name="parse-range">
+ <xsl:with-param name="range-value" select="../../表:公用处ç†è§„则/表:æ•°æ®æœ‰æ•ˆæ€§é›†/表:æ•°æ®æœ‰æ•ˆæ€§[position() = $index]/表:范围"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="current-value" select="concat('(v',$index,':', $current,');')"/>
+ <xsl:if test="$index &lt; $total">
+ <xsl:call-template name="validation-row-column-string">
+ <xsl:with-param name="last" select="concat($last, $current-value)"/>
+ <xsl:with-param name="total" select="$total"/>
+ <xsl:with-param name="index" select="$index + 1"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="$index = $total">
+ <xsl:value-of select="concat($last, $current-value)"/>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="create-rows">
+ <xsl:param name="lastrowpos"/>
+ <xsl:param name="row-count"/>
+ <xsl:param name="currentRow"/>
+ <xsl:param name="condition-pos-str"/>
+ <xsl:choose>
+ <xsl:when test="$currentRow &lt; ($row-count + 1)">
+ <xsl:variable name="span-value">
+ <xsl:choose>
+ <xsl:when test="./表:工作表内容/表:è¡Œ[position() = $currentRow]/@表:è¡Œå·">
+ <xsl:choose>
+ <xsl:when test="./表:工作表内容/表:行[position() = $currentRow]/@表:跨度">
+ <xsl:value-of select="./表:工作表内容/表:è¡Œ[position() = $currentRow]/@表:è¡Œå· - $lastrowpos + ./表:工作表内容/表:è¡Œ[position() = $currentRow]/@表:跨度"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="./表:工作表内容/表:è¡Œ[position() = $currentRow]/@表:è¡Œå· - $lastrowpos"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="./表:工作表内容/表:行[position() = $currentRow]/@表:跨度">
+ <xsl:value-of select="./表:工作表内容/表:行[position() = $currentRow]/@表:跨度 + 1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="current-index">
+ <xsl:choose>
+ <xsl:when test="./表:工作表内容/表:è¡Œ[position() = $currentRow]/@表:è¡Œå·">
+ <xsl:value-of select="./表:工作表内容/表:è¡Œ[position() = $currentRow]/@表:è¡Œå·"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$lastrowpos + 1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="./表:工作表内容/表:分组集/表:行">
+ <xsl:for-each select="./表:工作表内容/表:分组集/表:行[1]">
+ <xsl:call-template name="table:table-row-group"/>
+ </xsl:for-each>
+ <xsl:for-each select="./表:工作表内容/表:è¡Œ[not(@表:è¡Œå·)]">
+ <xsl:call-template name="create-row">
+ <xsl:with-param name="index-value" select="$lastrowpos"/>
+ <xsl:with-param name="span-value" select="$span-value"/>
+ <xsl:with-param name="worksheetNo" select="count(preceding-sibling::表:工作表)+1"/>
+ <xsl:with-param name="row-value" select="$currentRow"/>
+ <xsl:with-param name="times" select="1"/>
+ <xsl:with-param name="current-index" select="$current-index"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:when test="./表:工作表内容/表:分组集 and ( ./表:工作表内容/表:分组集/表:行/@表:起始 &gt;= ($currentRow - 1) and ($currentRow - 1) &lt;= ./表:工作表内容/表:分组集/表:行/@表:终止 )">
+ <xsl:element name="table:table-row-group">
+ <xsl:variable name="TempStart">
+ <xsl:value-of select="./表:工作表内容/表:分组集/表:行/@表:起始"/>
+ </xsl:variable>
+ <xsl:variable name="TempEnd">
+ <xsl:value-of select="./表:工作表内容/表:分组集/表:行/@表:终止"/>
+ </xsl:variable>
+ <xsl:for-each select="./表:工作表内容/表:行">
+ <xsl:if test="$TempStart &gt;= ($currentRow - 1) and ($currentRow - 1) &lt;= $TempEnd">
+ <xsl:call-template name="create-row">
+ <xsl:with-param name="index-value" select="$lastrowpos"/>
+ <xsl:with-param name="span-value" select="$span-value"/>
+ <xsl:with-param name="worksheetNo" select="count(preceding-sibling::表:工作表)+1"/>
+ <xsl:with-param name="row-value" select="$currentRow"/>
+ <xsl:with-param name="times" select="1"/>
+ <xsl:with-param name="current-index" select="$current-index"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="create-row">
+ <xsl:with-param name="index-value" select="$lastrowpos"/>
+ <xsl:with-param name="span-value" select="$span-value"/>
+ <xsl:with-param name="worksheetNo" select="count(preceding-sibling::表:工作表)+1"/>
+ <xsl:with-param name="row-value" select="$currentRow"/>
+ <xsl:with-param name="times" select="1"/>
+ <xsl:with-param name="current-index" select="$current-index"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ </xsl:call-template>
+ <xsl:if test="$currentRow &lt; $row-count">
+ <xsl:call-template name="create-rows">
+ <xsl:with-param name="lastrowpos">
+ <xsl:choose>
+ <xsl:when test="./表:工作表内容/表:è¡Œ[position() = $currentRow]/@表:è¡Œå·">
+ <xsl:choose>
+ <xsl:when test="./表:工作表内容/表:行[position() = $currentRow]/@表:跨度">
+ <xsl:value-of select="./表:工作表内容/表:è¡Œ[position() = $currentRow]/@表:è¡Œå· + ./表:工作表内容/表:è¡Œ[position() = $currentRow]/@表:跨度"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="./表:工作表内容/表:è¡Œ[position() = $currentRow]/@表:è¡Œå·"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="./表:工作表内容/表:行[position() = $currentRow]/@表:跨度">
+ <xsl:value-of select="$lastrowpos + ./表:工作表内容/表:行[position() = $currentRow]/@表:跨度 + 1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$lastrowpos + 1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="row-count" select="$row-count"/>
+ <xsl:with-param name="currentRow" select="$currentRow + 1"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$currentRow = $row-count">
+ <xsl:variable name="last-pos">
+ <xsl:choose>
+ <xsl:when test="./表:工作表内容/表:è¡Œ[position() = $currentRow]/@表:è¡Œå·">
+ <xsl:choose>
+ <xsl:when test="./表:工作表内容/表:行[position() = $currentRow]/@表:跨度">
+ <xsl:value-of select="./表:工作表内容/表:è¡Œ[position() = $currentRow]/@表:è¡Œå· + ./表:工作表内容/表:è¡Œ[position() = $currentRow]/@表:跨度"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="./表:工作表内容/表:è¡Œ[position() = $currentRow]/@表:è¡Œå·"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="./表:工作表内容/表:行[position() = $currentRow]/@表:跨度">
+ <xsl:value-of select="$lastrowpos + ./表:工作表内容/表:行[position() = $currentRow]/@表:跨度 + 1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$lastrowpos + 1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="./表:分页符集/表:分页符/@表:è¡Œå· &gt; ($last-pos - 1) or ../../表:公用处ç†è§„则/表:æ¡ä»¶æ ¼å¼åŒ–集/表:æ¡ä»¶æ ¼å¼åŒ–">
+ <xsl:variable name="condition-row-max">
+ <xsl:call-template name="condition-row-col-pos-max">
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="last-value" select="0"/>
+ <xsl:with-param name="div-value" select="'R'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="condition-col-max">
+ <xsl:call-template name="condition-row-col-pos-max">
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="last-value" select="0"/>
+ <xsl:with-param name="div-value" select="'C'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="break-row-max">
+ <xsl:call-template name="break-row-beyond-max">
+ <xsl:with-param name="pos" select="1"/>
+ <xsl:with-param name="last-value" select="0"/>
+ <xsl:with-param name="count-value" select="count(./表:分页符集/表:分页符[@表:è¡Œå·])"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="end-value">
+ <xsl:choose>
+ <xsl:when test="$condition-row-max &lt; $break-row-max">
+ <xsl:value-of select="$break-row-max"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$condition-row-max"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:call-template name="get-row-beyond-last">
+ <xsl:with-param name="index-value" select="$last-pos + 1"/>
+ <xsl:with-param name="worksheetNo" select="count(preceding-sibling::表:工作表)+1"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="end-pos" select="$end-value"/>
+ <xsl:with-param name="total-col" select="$condition-col-max"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="./表:工作表内容/表:列[@表:å¼æ ·å¼•ç”¨] or ./表:工作表内容[@表:å¼æ ·å¼•ç”¨]">
+ <table:table-row table:style-name="ro1" table:number-rows-repeated="31990">
+ <table:table-cell table:number-columns-repeated="256"/>
+ </table:table-row>
+ <table:table-row table:style-name="ro1">
+ <table:table-cell table:number-columns-repeated="256"/>
+ </table:table-row>
+ </xsl:if>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <!-- add row-group 2.6-->
+ <xsl:template name="table:table-row-group">
+ <xsl:param name="start"/>
+ <xsl:param name="end"/>
+ <xsl:variable name="start1" select="@表:起始"/>
+ <xsl:variable name="end1" select="@表:终止"/>
+ <xsl:variable name="nextstart" select="following-sibling::表:行/@表:起始"/>
+ <xsl:variable name="nextend" select="following-sibling::表:行/@表:终止"/>
+ <xsl:variable name="prestart" select="preceding-sibling::表:行/@表:起始"/>
+ <xsl:variable name="preend" select="preceding-sibling::表:行/@表:终止"/>
+ <xsl:variable name="numrow" select="$end1 - $start1"/>
+ <xsl:variable name="position" select="position()"/>
+ <xsl:choose>
+ <xsl:when test="$nextstart &gt;= $start1 and $nextend &lt;= $end1">
+ <table:table-row-group>
+ <xsl:call-template name="creategroup"/>
+ </table:table-row-group>
+ </xsl:when>
+ <xsl:when test="$nextstart &gt;= $end1">
+ <xsl:choose>
+ <xsl:when test="$nextend &lt;=$preend">
+ <xsl:call-template name="row">
+ <xsl:with-param name="start1" select="$start1"/>
+ <xsl:with-param name="end1" select="$end1"/>
+ <xsl:with-param name="nextstart" select="$nextstart"/>
+ <xsl:with-param name="nextend" select="$nextend"/>
+ <xsl:with-param name="prestart" select="$prestart"/>
+ <xsl:with-param name="preend" select="$preend"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="levelgroup"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="row">
+ <xsl:with-param name="start1" select="$start1"/>
+ <xsl:with-param name="end1" select="$end1"/>
+ <xsl:with-param name="nextstart" select="$nextstart"/>
+ <xsl:with-param name="nextend" select="$nextend"/>
+ <xsl:with-param name="prestart" select="$prestart"/>
+ <xsl:with-param name="preend" select="$preend"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="levelrowgroup">
+ <xsl:param name="start"/>
+ <xsl:param name="end"/>
+ <xsl:variable name="start1" select="@表:起始"/>
+ <xsl:variable name="end1" select="@表:终止"/>
+ <xsl:variable name="nextstart" select="following-sibling::表:行/@表:起始"/>
+ <xsl:variable name="nextend" select="following-sibling::表:行/@表:终止"/>
+ <xsl:variable name="prestart" select="preceding-sibling::表:行/@表:起始"/>
+ <xsl:variable name="preend" select="preceding-sibling::表:行/@表:终止"/>
+ <xsl:variable name="numrow" select="$end1 - $start1"/>
+ <xsl:variable name="position" select="position()"/>
+ <xsl:call-template name="row">
+ <xsl:with-param name="start1" select="$start1"/>
+ <xsl:with-param name="end1" select="$end1"/>
+ <xsl:with-param name="nextstart" select="$nextstart"/>
+ <xsl:with-param name="nextend" select="$nextend"/>
+ <xsl:with-param name="prestart" select="$prestart"/>
+ <xsl:with-param name="preend" select="$preend"/>
+ </xsl:call-template>
+ </xsl:template>
+ <xsl:template name="creategroup">
+ <xsl:for-each select="following-sibling::表:行">
+ <xsl:variable name="start1" select="@表:起始"/>
+ <xsl:variable name="end1" select="@表:终止"/>
+ <xsl:variable name="nextstart" select="following-sibling::表:行/@表:起始"/>
+ <xsl:variable name="nextend" select="following-sibling::表:行/@表:终止"/>
+ <xsl:variable name="prestart" select="preceding-sibling::表:行/@表:起始"/>
+ <xsl:variable name="preend" select="preceding-sibling::表:行/@表:终止"/>
+ <xsl:if test="$start1 &gt;= $prestart and $end1 &lt;= $preend">
+ <xsl:call-template name="table:table-row-group"/>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="levelgroup">
+ <xsl:for-each select="parent::表:分组集/表:行">
+ <xsl:call-template name="levelrowgroup"/>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="row">
+ <xsl:param name="start1"/>
+ <xsl:param name="end1"/>
+ <xsl:param name="nextstart"/>
+ <xsl:param name="nextend"/>
+ <xsl:param name="prestart"/>
+ <xsl:param name="preend"/>
+ <xsl:for-each select="ancestor::表:工作表内容/表:è¡Œ[@表:è¡Œå·]">
+ <xsl:variable name="rownum" select="@表:è¡Œå·"/>
+ <xsl:variable name="aa" select="$start1 - $prestart"/>
+ <xsl:if test="$rownum &gt;= $prestart and $rownum &lt;= ($prestart + $aa - 1) and $start1 &lt;= $preend">
+ <table:table-row>
+ <xsl:attribute name="table:style-name"><xsl:value-of select="@表:å¼æ ·å¼•ç”¨"/></xsl:attribute>
+ <xsl:call-template name="celldata"/>
+ </table:table-row>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:for-each select="ancestor::表:工作表内容/表:è¡Œ[@表:è¡Œå·]">
+ <xsl:variable name="rownum" select="@表:è¡Œå·"/>
+ <xsl:variable name="ss" select="$start1 - $preend"/>
+ <xsl:if test="$rownum &gt;= ($preend +1) and $rownum &lt;= ($preend + $ss - 1) and $start1 &gt;= $preend">
+ <table:table-row>
+ <xsl:attribute name="table:style-name"><xsl:value-of select="@表:å¼æ ·å¼•ç”¨"/></xsl:attribute>
+ <xsl:call-template name="celldata"/>
+ </table:table-row>
+ </xsl:if>
+ </xsl:for-each>
+ <table:table-row-group>
+ <xsl:for-each select="ancestor::表:工作表内容/表:è¡Œ[@表:è¡Œå·]">
+ <xsl:variable name="rownum" select="@表:è¡Œå·"/>
+ <xsl:if test="$rownum &lt;= $end1">
+ <xsl:if test="$rownum &gt;= $start1">
+ <table:table-row>
+ <xsl:attribute name="table:style-name"><xsl:value-of select="@表:å¼æ ·å¼•ç”¨"/></xsl:attribute>
+ <xsl:call-template name="celldata"/>
+ </table:table-row>
+ </xsl:if>
+ </xsl:if>
+ </xsl:for-each>
+ </table:table-row-group>
+ <xsl:for-each select="ancestor::表:工作表内容/表:è¡Œ[@表:è¡Œå·]">
+ <xsl:variable name="rownum" select="@表:è¡Œå·"/>
+ <xsl:variable name="bb" select="$preend - $end1"/>
+ <xsl:if test="$rownum &gt;= ($end1 + 1) and $rownum &lt;= ($end1 + $bb) and $start1 &lt; $preend">
+ <table:table-row>
+ <xsl:attribute name="table:style-name"><xsl:value-of select="@表:å¼æ ·å¼•ç”¨"/></xsl:attribute>
+ <xsl:call-template name="celldata"/>
+ </table:table-row>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="celldata">
+ <xsl:for-each select="./表:å•å…ƒæ ¼">
+ <table:table-cell>
+ <xsl:choose>
+ <xsl:when test="表:æ•°æ®/@表:æ•°æ®ç±»åž‹ = 'number'">
+ <xsl:attribute name="office:value-type">float</xsl:attribute>
+ <xsl:attribute name="office:value"><xsl:choose><xsl:when test="表:æ•°æ®/@表:æ•°æ®æ•°å€¼"><xsl:value-of select="表:æ•°æ®/@表:æ•°æ®æ•°å€¼"/></xsl:when><xsl:otherwise><xsl:value-of select="表:æ•°æ®/å­—:å¥/å­—:文本串"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="表:æ•°æ®/@表:æ•°æ®ç±»åž‹ = 'date'">
+ <xsl:attribute name="office:value-type">date</xsl:attribute>
+ <xsl:attribute name="table:date-value"><xsl:value-of select="表:æ•°æ®/@表:æ•°æ®æ•°å€¼"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="表:æ•°æ®/@表:æ•°æ®ç±»åž‹ = 'time'">
+ <xsl:attribute name="office:value-type">time</xsl:attribute>
+ <xsl:attribute name="table:time-value"><xsl:value-of select="表:æ•°æ®/@表:æ•°æ®æ•°å€¼"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="表:æ•°æ®/@表:æ•°æ®ç±»åž‹ = 'boolean'">
+ <xsl:attribute name="office:value-type">boolean</xsl:attribute>
+ <xsl:attribute name="table:boolean-value"><xsl:choose><xsl:when test="表:æ•°æ®/å­—:å¥/å­—:文本串 = '1'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="表:æ•°æ®/@表:æ•°æ®ç±»åž‹ = 'text'">
+ <xsl:attribute name="office:value-type">string</xsl:attribute>
+ <xsl:attribute name="table:string-value"><xsl:value-of select="表:æ•°æ®/@表:æ•°æ®æ•°å€¼"/></xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="表:æ•°æ®/å­—:å¥/å­—:文本串">
+ <text:p>
+ <xsl:value-of select="表:æ•°æ®/å­—:å¥/å­—:文本串"/>
+ </text:p>
+ </xsl:if>
+ </table:table-cell>
+ </xsl:for-each>
+ </xsl:template>
+ <!-- add row-group 2.8 -->
+ <xsl:template name="create-row">
+ <xsl:param name="index-value"/>
+ <xsl:param name="span-value"/>
+ <xsl:param name="worksheetNo"/>
+ <xsl:param name="row-value"/>
+ <xsl:param name="times"/>
+ <xsl:param name="current-index"/>
+ <xsl:param name="condition-pos-str"/>
+ <xsl:element name="table:table-row">
+ <xsl:choose>
+ <xsl:when test="./表:分页符集/表:分页符/@表:è¡Œå· = ($index-value + $times - 1)">
+ <xsl:choose>
+ <xsl:when test="($index-value + $times &lt; $current-index) and ($current-index != 0)">
+ <xsl:attribute name="table:style-name"><xsl:value-of select="concat('rob',$worksheetNo)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="table:style-name"><xsl:value-of select="concat('rob', $worksheetNo, '-', $row-value)"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="($index-value + $times &lt; $current-index) and ($current-index != 0)">
+ <xsl:attribute name="table:style-name"><xsl:value-of select="concat('ro',$worksheetNo)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="table:style-name"><xsl:value-of select="concat('ro', $worksheetNo, '-', $row-value)"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!--chengxiuzhi0617-->
+ <xsl:if test="./表:工作表内容/表:è¡Œ[position() = $row-value]/@表:éšè— = 'true'">
+ <xsl:choose>
+ <xsl:when test="./表:工作表内容/表:行[position() = $row-value]/@表:跨度">
+ <xsl:if test="$index-value + $times &gt; ($current-index - 1)">
+ <xsl:attribute name="table:visibility">collapse</xsl:attribute>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="$index-value + $times = $current-index">
+ <xsl:attribute name="table:visibility">collapse</xsl:attribute>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="not(./表:工作表内容/表:行[position() = $row-value]/*)">
+ <table:table-cell>
+ <xsl:for-each select="./表:å•å…ƒæ ¼/表:æ•°æ®">
+ <xsl:choose>
+ <xsl:when test="@表:æ•°æ®ç±»åž‹ = 'number'">
+ <xsl:attribute name="office:value-type">float</xsl:attribute>
+ <xsl:attribute name="office:value"><xsl:choose><xsl:when test="@表:æ•°æ®æ•°å€¼"><xsl:value-of select="@表:æ•°æ®æ•°å€¼"/></xsl:when><xsl:otherwise><xsl:value-of select="å­—:å¥/å­—:文本串"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@表:æ•°æ®ç±»åž‹ = 'date'">
+ <xsl:attribute name="office:value-type">date</xsl:attribute>
+ <xsl:attribute name="table:date-value"><xsl:value-of select="@表:æ•°æ®æ•°å€¼"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@表:æ•°æ®ç±»åž‹ = 'time'">
+ <xsl:attribute name="office:value-type">time</xsl:attribute>
+ <xsl:attribute name="table:time-value"><xsl:value-of select="@表:æ•°æ®æ•°å€¼"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@表:æ•°æ®ç±»åž‹ = 'boolean'">
+ <xsl:attribute name="office:value-type">boolean</xsl:attribute>
+ <xsl:attribute name="table:boolean-value"><xsl:choose><xsl:when test="å­—:å¥/å­—:文本串 = '1'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@表:æ•°æ®ç±»åž‹ = 'text'">
+ <xsl:attribute name="office:value-type">string</xsl:attribute>
+ <xsl:attribute name="table:string-value"><xsl:value-of select="@表:æ•°æ®æ•°å€¼"/></xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="å­—:å¥/å­—:文本串">
+ <text:p>
+ <xsl:value-of select="å­—:å¥/å­—:文本串"/>
+ </text:p>
+ </xsl:if>
+ </xsl:for-each>
+ </table:table-cell>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="$index-value + $times &lt; $current-index">
+ <xsl:variable name="current" select="concat('R',($index-value + $times),'C')"/>
+ <xsl:variable name="col-pos-max">
+ <xsl:call-template name="condition-row-col-pos-max">
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="last-value" select="0"/>
+ <xsl:with-param name="div-value" select="'C'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="contains($condition-pos-str,$current)">
+ <xsl:call-template name="get-cell-span-in">
+ <xsl:with-param name="row-pos" select="$index-value + $times"/>
+ <xsl:with-param name="c-start" select="1"/>
+ <xsl:with-param name="c-end" select="$col-pos-max"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <table:table-cell/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$index-value + $times = $current-index">
+ <xsl:apply-templates select="表:工作表内容/表:行[position() = $row-value]" mode="selected">
+ <xsl:with-param name="row-pos" select="$index-value + $times"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
+ <table:table-cell/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:if test="$times &lt; $span-value">
+ <xsl:call-template name="create-row">
+ <xsl:with-param name="index-value" select="$index-value"/>
+ <xsl:with-param name="span-value" select="$span-value"/>
+ <xsl:with-param name="worksheetNo" select="$worksheetNo"/>
+ <xsl:with-param name="row-value" select="$row-value"/>
+ <xsl:with-param name="times" select="$times + 1"/>
+ <xsl:with-param name="current-index" select="$current-index"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="condition-row-col-pos-max">
+ <xsl:param name="condition-pos-str"/>
+ <xsl:param name="last-value"/>
+ <xsl:param name="div-value"/>
+ <xsl:variable name="pre-value">
+ <xsl:choose>
+ <xsl:when test="$div-value = 'R'">
+ <xsl:value-of select="substring-before(substring-after($condition-pos-str,$div-value),'C')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-before(substring-after($condition-pos-str,$div-value),',')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="end-value">
+ <xsl:choose>
+ <xsl:when test="$last-value &lt; $pre-value">
+ <xsl:value-of select="$pre-value"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$last-value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="contains($condition-pos-str,$div-value)">
+ <xsl:call-template name="condition-row-col-pos-max">
+ <xsl:with-param name="condition-pos-str" select="substring-after($condition-pos-str,$div-value)"/>
+ <xsl:with-param name="last-value" select="$end-value"/>
+ <xsl:with-param name="div-value" select="$div-value"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$end-value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="break-row-beyond-max">
+ <xsl:param name="pos"/>
+ <xsl:param name="last-value"/>
+ <xsl:param name="count-value"/>
+ <xsl:variable name="pre-value" select="./表:分页符集/表:分页符[@表:åˆ—å· and (position() = $pos)]/@表:列å·"/>
+ <xsl:variable name="end-value">
+ <xsl:choose>
+ <xsl:when test="$last-value &lt; $pre-value">
+ <xsl:value-of select="$pre-value"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$last-value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$pos &lt; $count-value">
+ <xsl:call-template name="break-row-beyond-max">
+ <xsl:with-param name="pos" select="$pos + 1"/>
+ <xsl:with-param name="last-value" select="$end-value"/>
+ <xsl:with-param name="count-value" select="$count-value"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$end-value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-row-beyond-last">
+ <xsl:param name="index-value"/>
+ <xsl:param name="worksheetNo"/>
+ <xsl:param name="condition-pos-str"/>
+ <xsl:param name="end-pos"/>
+ <xsl:param name="total-col"/>
+ <xsl:variable name="current" select="concat('R',$index-value)"/>
+ <xsl:element name="table:table-row">
+ <xsl:choose>
+ <xsl:when test="./表:分页符集/表:分页符/@è¡Œå· = ($index-value - 1)">
+ <xsl:attribute name="table:style-name"><xsl:value-of select="concat('rob',$worksheetNo)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="table:style-name"><xsl:value-of select="concat('ro',$worksheetNo)"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="contains($condition-pos-str,$current)">
+ <xsl:call-template name="get-cell-span-in">
+ <xsl:with-param name="row-pos" select="$index-value"/>
+ <xsl:with-param name="c-start" select="1"/>
+ <xsl:with-param name="c-end" select="$total-col"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <table:table-cell/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:if test="$index-value &lt; ($end-pos + 1)">
+ <xsl:call-template name="get-row-beyond-last">
+ <xsl:with-param name="index-value" select="$index-value + 1"/>
+ <xsl:with-param name="worksheetNo" select="$worksheetNo"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="end-pos" select="$end-pos"/>
+ <xsl:with-param name="total-col" select="$total-col"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="get-cell-span-in">
+ <xsl:param name="row-pos"/>
+ <xsl:param name="c-start"/>
+ <xsl:param name="c-end"/>
+ <xsl:param name="condition-pos-str"/>
+ <xsl:variable name="current" select="concat('R',$row-pos,'C',$c-start,',')"/>
+ <xsl:variable name="style-name">
+ <xsl:choose>
+ <xsl:when test="contains($condition-pos-str,$current)">
+ <xsl:variable name="temp-str">
+ <xsl:call-template name="condition-str">
+ <xsl:with-param name="param-str" select="substring-before($condition-pos-str,$current)"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="starts-with($temp-str, 'c')">
+ <xsl:value-of select="concat('ce', substring-after($temp-str, 'c'))"/>
+ </xsl:when>
+ <xsl:when test="starts-with($temp-str, 'v')">
+ <xsl:value-of select="concat('val', substring-after($temp-str, 'v'))"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="../表:å•å…ƒæ ¼[position() = position() - 1]/@表:å¼æ ·å¼•ç”¨">
+ <xsl:value-of select="../表:å•å…ƒæ ¼[position() = position() - 1]/@表:å¼æ ·å¼•ç”¨ "/>
+ </xsl:when>
+ <xsl:when test="../@表:å¼æ ·å¼•ç”¨">
+ <xsl:value-of select="../@表:å¼æ ·å¼•ç”¨"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="'Default'"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$c-start &lt; $c-end">
+ <xsl:call-template name="get-cell-condition-in">
+ <xsl:with-param name="style-name" select="$style-name"/>
+ </xsl:call-template>
+ <xsl:call-template name="get-cell-span-in">
+ <xsl:with-param name="row-pos" select="$row-pos"/>
+ <xsl:with-param name="c-start" select="$c-start + 1"/>
+ <xsl:with-param name="c-end" select="$c-end"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$c-start = $c-end">
+ <xsl:call-template name="get-cell-condition-in">
+ <xsl:with-param name="style-name" select="$style-name"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <table:table-cell/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-cell-condition-in">
+ <xsl:param name="style-name"/>
+ <xsl:element name="table:table-cell">
+ <xsl:if test="not( contains($style-name, 'Default'))">
+ <xsl:choose>
+ <xsl:when test="starts-with($style-name, 'val')">
+ <xsl:attribute name="table:content-validation-name"><xsl:value-of select="$style-name"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="starts-with($style-name, 'ce')">
+ <xsl:attribute name="table:style-name"><xsl:value-of select="$style-name"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="table:style-name"><xsl:value-of select="$style-name"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <!--chengxiuzhi0617 å•å…ƒæ ¼-->
+ </xsl:element>
+ </xsl:template>
+ <xsl:key match="/uof:UOF/uof:电å­è¡¨æ ¼/表:主体/表:工作表/表:分页符集/表:分页符[@表:列å·]" name="ColBreak" use="Column"/>
+ <xsl:template name="create-default-column">
+ <xsl:param name="currentColumn"/>
+ <xsl:param name="currentColumnNode"/>
+ <xsl:param name="worksheetNo"/>
+ <xsl:element name="table:table-column">
+ <xsl:attribute name="table:default-cell-style-name"><xsl:call-template name="get-default-cell-style"><xsl:with-param name="currentColumnNode" select="$currentColumnNode"/></xsl:call-template></xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="key('ColBreak', $currentColumn)">
+ <xsl:attribute name="table:style-name"><xsl:value-of select="concat('cob',$worksheetNo)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="table:style-name"><xsl:value-of select="concat('co',$worksheetNo)"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!--chengxiuzhi0617用key就错-->
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="get-default-cell-style">
+ <xsl:param name="currentColumnNode"/>
+ <xsl:choose>
+ <xsl:when test="$currentColumnNode">
+ <xsl:choose>
+ <xsl:when test="$currentColumnNode/@表:å¼æ ·å¼•ç”¨">
+ <xsl:value-of select="$currentColumnNode/@表:å¼æ ·å¼•ç”¨"/>
+ </xsl:when>
+ <xsl:otherwise>Default</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="./表:工作表内容[@表:å¼æ ·å¼•ç”¨]">
+ <xsl:value-of select="./表:工作表内容/@表:å¼æ ·å¼•ç”¨"/>
+ </xsl:when>
+ <xsl:otherwise>Default</xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="表:行" mode="selected">
+ <xsl:param name="row-pos"/>
+ <xsl:param name="condition-pos-str"/>
+ <xsl:choose>
+ <xsl:when test="表:å•å…ƒæ ¼">
+ <xsl:apply-templates select="表:å•å…ƒæ ¼[1]" mode="selected">
+ <xsl:with-param name="row-pos" select="$row-pos"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="col-pos-max">
+ <xsl:call-template name="condition-row-col-pos-max">
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="last-value" select="0"/>
+ <xsl:with-param name="div-value" select="'C'"/>
+ </xsl:call-template>
+ </xsl:with-param>
+ <xsl:with-param name="col-pos-before" select="0"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="current" select="concat('R',$row-pos,'C')"/>
+ <xsl:choose>
+ <xsl:when test="contains($condition-pos-str,$current)">
+ <xsl:call-template name="get-cell-span-in">
+ <xsl:with-param name="row-pos" select="$row-pos"/>
+ <xsl:with-param name="c-start" select="1"/>
+ <xsl:with-param name="c-end">
+ <xsl:call-template name="condition-row-col-pos-max">
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="last-value" select="0"/>
+ <xsl:with-param name="div-value" select="'C'"/>
+ </xsl:call-template>
+ </xsl:with-param>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="col-pos" select="1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <table:table-cell/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="表:å•å…ƒæ ¼" mode="selected">
+ <xsl:param name="condition-pos-str"/>
+ <xsl:param name="col-pos-max"/>
+ <xsl:param name="col-pos-before"/>
+ <xsl:param name="row-pos"/>
+ <xsl:param name="col-repeated" select="1"/>
+ <xsl:variable name="col-pos">
+ <xsl:choose>
+ <xsl:when test="@表:列å·">
+ <xsl:choose>
+ <xsl:when test="@表:åˆå¹¶åˆ—æ•°">
+ <xsl:value-of select="@表:åˆå¹¶åˆ—æ•° + @表:列å·"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="@表:列å·"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="@表:åˆå¹¶åˆ—æ•°">
+ <xsl:value-of select="1 + @表:åˆå¹¶åˆ—æ•° + $col-pos-before"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="1 + $col-pos-before"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="next-cell" select="following-sibling::表:å•å…ƒæ ¼[1]"/>
+ <xsl:variable name="maodian" select="boolean($next-cell/uof:锚点)"/>
+ <xsl:variable name="cell-is-repeatable" select="not(current()/*) and not($next-cell/*) and not($next-cell/text()) and (@表:å¼æ ·å¼•ç”¨ = $next-cell/@表:å¼æ ·å¼•ç”¨) and not($next-cell/@表:列å·)"/>
+ <xsl:if test="$col-repeated = 1">
+ <xsl:if test="@表:åˆ—å· != ($col-pos-before + 1)">
+ <xsl:call-template name="get-cell-span-in">
+ <xsl:with-param name="row-pos" select="$row-pos"/>
+ <xsl:with-param name="c-start" select="$col-pos-before + 1"/>
+ <xsl:with-param name="c-end" select="@表:åˆ—å· - 1"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:element name="table:table-cell">
+ <xsl:call-template name="create-table-cell-attributes">
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="col-pos-max" select="$col-pos-max"/>
+ <xsl:with-param name="col-pos" select="$col-pos"/>
+ <xsl:with-param name="row-pos" select="$row-pos"/>
+ </xsl:call-template>
+ <xsl:if test="$cell-is-repeatable">
+ <xsl:apply-templates select="$next-cell" mode="selected">
+ <xsl:with-param name="row-pos" select="$row-pos"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="col-pos-max" select="$col-pos-max"/>
+ <xsl:with-param name="col-pos-before" select="$col-pos + 1"/>
+ <xsl:with-param name="col-repeated" select="$col-repeated + 1"/>
+ </xsl:apply-templates>
+ </xsl:if>
+ <xsl:call-template name="create-table-cell-content">
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="col-pos-max" select="$col-pos-max"/>
+ <xsl:with-param name="col-pos" select="$col-pos"/>
+ <xsl:with-param name="row-pos" select="$row-pos"/>
+ </xsl:call-template>
+ </xsl:element>
+ <xsl:if test="@表:åˆå¹¶åˆ—æ•°">
+ <xsl:element name="table:covered-table-cell">
+ <xsl:if test="@表:åˆå¹¶åˆ—æ•° &gt; 1">
+ <xsl:attribute name="table:number-columns-repeated"><xsl:value-of select="@表:åˆå¹¶åˆ—æ•°"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="not($cell-is-repeatable and $col-repeated = 1)">
+ <xsl:choose>
+ <xsl:when test="not($cell-is-repeatable) and $col-repeated &gt; 1">
+ <xsl:attribute name="table:number-columns-repeated"><xsl:value-of select="$col-repeated"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="not($next-cell)">
+ <xsl:if test="../../../../../表:公用处ç†è§„则/表:æ¡ä»¶æ ¼å¼åŒ–集/表:æ¡ä»¶æ ¼å¼åŒ–">
+ <xsl:call-template name="get-cell-span-in">
+ <xsl:with-param name="row-pos" select="$row-pos"/>
+ <xsl:with-param name="c-start" select="$col-pos"/>
+ <xsl:with-param name="c-end" select="$col-pos-max"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:when>
+ <xsl:when test="not($cell-is-repeatable)">
+ <xsl:apply-templates select="$next-cell" mode="selected">
+ <xsl:with-param name="row-pos" select="$row-pos"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="col-pos-max" select="$col-pos-max"/>
+ <xsl:with-param name="col-pos-before" select="$col-pos"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="$next-cell" mode="selected">
+ <xsl:with-param name="row-pos" select="$row-pos"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="col-pos-max" select="$col-pos-max"/>
+ <xsl:with-param name="col-pos-before" select="$col-pos"/>
+ <xsl:with-param name="col-repeated" select="$col-repeated + 1"/>
+ </xsl:apply-templates>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="$next-cell">
+ <xsl:apply-templates select="$next-cell" mode="skip">
+ <xsl:with-param name="row-pos" select="$row-pos"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="col-pos-max" select="$col-pos-max"/>
+ <xsl:with-param name="col-pos-before" select="$col-pos"/>
+ </xsl:apply-templates>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!--Redoffice comment liliang sc0012 06.02.15-->
+ <!--新增内容-->
+ <xsl:template match="uof:锚点">
+ <xsl:variable name="tuxing1" select="@uof:图形引用"/>
+ <xsl:choose>
+ <xsl:when test="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]">
+ <xsl:if test="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/@uof:公共类型='png' or /uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/@uof:公共类型='ipg' or /uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/@uof:公共类型='bmp' or /uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/@uof:公共类型='gif'">
+ <xsl:element name="draw:frame">
+ <xsl:attribute name="draw:name"><xsl:variable name="pos"><xsl:value-of select="count(preceding::uof:锚点)"/></xsl:variable><xsl:value-of select="concat('图形',$pos)"/></xsl:attribute>
+ <xsl:attribute name="svg:x"><xsl:value-of select="concat(@uof:xåæ ‡,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:y"><xsl:value-of select="concat(@uof:yåæ ‡,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:width"><xsl:value-of select="concat(@uof:宽度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:height"><xsl:value-of select="concat(@uof:高度,$uofUnit)"/></xsl:attribute>
+ <xsl:for-each select="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $tuxing1]">
+ <xsl:attribute name="draw:style-name"><xsl:value-of select="@图:标识符"/></xsl:attribute>
+ <xsl:attribute name="draw:z-index"><xsl:value-of select="@图:层次"/></xsl:attribute>
+ <xsl:if test="图:预定义图形/图:属性/图:旋转角度 and not(图:预定义图形/图:属性/图:旋转角度='0.0')">
+ <xsl:variable name="rotate-angle">
+ <xsl:value-of select="(图:预定义图形/图:属性/图:旋转角度 * 2 * 3.14159265 ) div 360"/>
+ </xsl:variable>
+ <xsl:attribute name="draw:transform"><xsl:value-of select="concat('rotate (',$rotate-angle,') translate (-0.0194027777777778cm 3.317875cm)')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="图:文本内容">
+ <xsl:apply-templates select="图:文本内容/å­—:段è½"/>
+ <xsl:apply-templates select="图:文本内容/字:文字表"/>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:element name="draw:image">
+ <xsl:if test="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/uof:路径">
+ <xsl:attribute name="xlink:href"><xsl:value-of select="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符= $tuxing1]/uof:路径"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/uof:æ•°æ®">
+ <office:binary-data>
+ <xsl:value-of select="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/uof:æ•°æ®"/>
+ </office:binary-data>
+ </xsl:if>
+ </xsl:element>
+ </xsl:element>
+ </xsl:if>
+ </xsl:when>
+ <xsl:when test="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $tuxing1]/图:文本内容[@图:文本框='true']">
+ <draw:text-box text:anchor-type="paragraph">
+ <xsl:attribute name="draw:style-name"><xsl:value-of select="$tuxing1"/></xsl:attribute>
+ <xsl:attribute name="svg:width"><xsl:value-of select="concat(@uof:宽度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:height"><xsl:value-of select="concat(@uof:高度,$uofUnit)"/></xsl:attribute>
+ <xsl:if test="@uof:xåæ ‡">
+ <xsl:attribute name="svg:x"><xsl:value-of select="concat(@uof:xåæ ‡,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@uof:yåæ ‡">
+ <xsl:attribute name="svg:y"><xsl:value-of select="concat(@uof:yåæ ‡,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="draw:z-index"><xsl:value-of select="/uof:UOF/uof:对象集/图:图形/@图:层次"/></xsl:attribute>
+ <xsl:apply-templates select="/uof:UOF/uof:对象集/图:图形[@图:标识符=$tuxing1]/图:文本内容/å­—:段è½"/>
+ <xsl:apply-templates select="/uof:UOF/uof:对象集/图:图形[@图:标识符=$tuxing1]/图:文本内容/字:文字表"/>
+ </draw:text-box>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="graph">
+ <xsl:with-param name="id" select="/uof:UOF/uof:对象集/图:图形[@图:标识符=$tuxing1]"/>
+ <xsl:with-param name="groupx" select="0"/>
+ <xsl:with-param name="groupy" select="0"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="graph">
+ <xsl:param name="id"/>
+ <xsl:param name="groupx"/>
+ <xsl:param name="groupy"/>
+ <xsl:for-each select="$id">
+ <xsl:variable name="tuxing1">
+ <xsl:value-of select="图:预定义图形/图:类别"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$tuxing1='11'">
+ <xsl:call-template name="Rectangle">
+ <xsl:with-param name="groupx1" select="$groupx"/>
+ <xsl:with-param name="groupy1" select="$groupy"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$tuxing1='19'">
+ <xsl:call-template name="Oval">
+ <xsl:with-param name="groupx1" select="$groupx"/>
+ <xsl:with-param name="groupy1" select="$groupy"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$tuxing1='61'">
+ <xsl:call-template name="Line">
+ <xsl:with-param name="groupx1" select="$groupx"/>
+ <xsl:with-param name="groupy1" select="$groupy"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$tuxing1='64'">
+ <xsl:call-template name="Curve">
+ <xsl:with-param name="groupx1" select="$groupx"/>
+ <xsl:with-param name="groupy1" select="$groupy"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$tuxing1='65'">
+ <xsl:call-template name="Freeform">
+ <xsl:with-param name="groupx1" select="$groupx"/>
+ <xsl:with-param name="groupy1" select="$groupy"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$tuxing1='66'">
+ <xsl:call-template name="Scribble">
+ <xsl:with-param name="groupx1" select="$groupx"/>
+ <xsl:with-param name="groupy1" select="$groupy"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$tuxing1='4'">
+ <xsl:element name="draw:g">
+ <xsl:variable name="tu">
+ <xsl:value-of select="@图:标识符"/>
+ </xsl:variable>
+ <xsl:attribute name="draw:style-name"><xsl:value-of select="$tu"/></xsl:attribute>
+ <xsl:attribute name="draw:z-index"><xsl:value-of select="@图:层次"/></xsl:attribute>
+ <xsl:variable name="this-group-x">
+ <xsl:choose>
+ <xsl:when test="key('rel_graphic_name',@图:标识符)/@uof:xåæ ‡">
+ <xsl:value-of select="key('rel_graphic_name',@图:标识符)/@uof:xåæ ‡"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="number(0)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="this-group-y">
+ <xsl:choose>
+ <xsl:when test="key('rel_graphic_name',@图:标识符)/@uof:yåæ ‡">
+ <xsl:value-of select="key('rel_graphic_name',@图:标识符)/@uof:yåæ ‡"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="number(0)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="group-x">
+ <xsl:value-of select="number($groupx + $this-group-x)"/>
+ </xsl:variable>
+ <xsl:variable name="group-y">
+ <xsl:value-of select="number($groupy + $this-group-y)"/>
+ </xsl:variable>
+ <xsl:call-template name="组åˆå›¾å½¢">
+ <xsl:with-param name="zuheliebiao" select="@图:组åˆåˆ—表"/>
+ <xsl:with-param name="groupx1" select="$group-x"/>
+ <xsl:with-param name="groupy1" select="$group-y"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="common">
+ <xsl:param name="groupx"/>
+ <xsl:param name="groupy"/>
+ <xsl:variable name="tuxing">
+ <xsl:value-of select="@图:标识符"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="key('rel_graphic_name',@图:标识符)/@uof:xåæ ‡">
+ <xsl:for-each select="key('rel_graphic_name',@图:标识符)">
+ <xsl:if test="@uof:xåæ ‡">
+ <xsl:attribute name="svg:x"><xsl:value-of select="concat(@uof:xåæ ‡,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@uof:yåæ ‡">
+ <xsl:attribute name="svg:y"><xsl:value-of select="concat(@uof:yåæ ‡,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:variable name="tuxing1" select="@uof:图形引用"/>
+ <xsl:attribute name="svg:width"><xsl:value-of select="concat(@uof:宽度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:height"><xsl:value-of select="concat(@uof:高度,$uofUnit)"/></xsl:attribute>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="zuheweizhi-x">
+ <xsl:value-of select="图:组åˆä½ç½®/@图:xåæ ‡"/>
+ </xsl:variable>
+ <xsl:variable name="zuheweizhi-y">
+ <xsl:value-of select="图:组åˆä½ç½®/@图:yåæ ‡"/>
+ </xsl:variable>
+ <xsl:attribute name="text:anchor-type">paragraph</xsl:attribute>
+ <xsl:attribute name="svg:x"><xsl:value-of select="concat(($groupx + $zuheweizhi-x),$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:y"><xsl:value-of select="concat(($groupy + $zuheweizhi-y),$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:width"><xsl:value-of select="concat(图:预定义图形/图:属性/图:宽度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:height"><xsl:value-of select="concat(图:预定义图形/图:属性 /图:高度,$uofUnit)"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="draw:style-name"><xsl:value-of select="@图:标识符"/></xsl:attribute>
+ <xsl:attribute name="draw:z-index"><xsl:value-of select="@图:层次"/></xsl:attribute>
+ <xsl:if test="图:预定义图形/图:属性/图:旋转角度 and not(图:预定义图形/图:属性/图:旋转角度='0.0')">
+ <xsl:variable name="rotate-angle">
+ <xsl:value-of select="(图:预定义图形/图:属性/图:旋转角度 * 2 * 3.14159265 ) div 360"/>
+ </xsl:variable>
+ <xsl:attribute name="draw:transform"><xsl:value-of select="concat('rotate (',$rotate-angle,') translate (-0.0194027777777778cm 3.317875cm)')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="图:文本内容">
+ <xsl:apply-templates select="图:文本内容/å­—:段è½"/>
+ <xsl:apply-templates select="图:文本内容/字:文字表"/>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="组åˆå›¾å½¢">
+ <xsl:param name="zuheliebiao"/>
+ <xsl:param name="groupx1"/>
+ <xsl:param name="groupy1"/>
+ <xsl:variable name="x">
+ <xsl:value-of select="$groupx1"/>
+ </xsl:variable>
+ <xsl:variable name="y">
+ <xsl:value-of select="$groupy1"/>
+ </xsl:variable>
+ <xsl:variable name="first-pictures">
+ <xsl:value-of select="substring-before($zuheliebiao,',')"/>
+ </xsl:variable>
+ <xsl:variable name="other-pictures">
+ <xsl:value-of select="substring-after($zuheliebiao,',')"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="contains($other-pictures,',')">
+ <xsl:call-template name="graph">
+ <xsl:with-param name="id" select="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $first-pictures]"/>
+ <xsl:with-param name="groupx" select="$groupx1"/>
+ <xsl:with-param name="groupy" select="$groupy1"/>
+ </xsl:call-template>
+ <xsl:call-template name="组åˆå›¾å½¢">
+ <xsl:with-param name="zuheliebiao" select="$other-pictures"/>
+ <xsl:with-param name="groupx1" select="$x"/>
+ <xsl:with-param name="groupy1" select="$y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="graph">
+ <xsl:with-param name="id" select="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $first-pictures]"/>
+ <xsl:with-param name="groupx" select="$groupx1"/>
+ <xsl:with-param name="groupy" select="$groupy1"/>
+ </xsl:call-template>
+ <xsl:call-template name="graph">
+ <xsl:with-param name="id" select="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $other-pictures]"/>
+ <xsl:with-param name="groupx" select="$groupx1"/>
+ <xsl:with-param name="groupy" select="$groupy1"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="Curve">
+ <xsl:param name="groupx1"/>
+ <xsl:param name="groupy1"/>
+ <xsl:element name="draw:path">
+ <xsl:variable name="width" select="number(图:预定义图形/图:属性/图:宽度)*1000"/>
+ <xsl:variable name="height" select="number(图:预定义图形/图:属性/图:高度)*1000"/>
+ <xsl:attribute name="svg:viewBox"><xsl:value-of select="concat('0 0 ',$width, ' ',$height)"/></xsl:attribute>
+ <xsl:attribute name="svg:d"><xsl:value-of select="图:预定义图形/图:关键点åæ ‡/@图:路径"/></xsl:attribute>
+ <xsl:call-template name="common">
+ <xsl:with-param name="groupx" select="$groupx1"/>
+ <xsl:with-param name="groupy" select="$groupy1"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="Freeform">
+ <xsl:param name="groupx1"/>
+ <xsl:param name="groupy1"/>
+ <xsl:element name="draw:polygon">
+ <xsl:variable name="width" select="number(图:预定义图形/图:属性/图:宽度)*1000"/>
+ <xsl:variable name="height" select="number(图:预定义图形/图:属性/图:高度)*1000"/>
+ <xsl:attribute name="svg:viewBox"><xsl:value-of select="concat('0 0 ',$width, ' ',$height)"/></xsl:attribute>
+ <xsl:attribute name="draw:points"><xsl:call-template name="drawpoints"><xsl:with-param name="points" select="图:预定义图形/图:关键点åæ ‡/@图:路径"/><xsl:with-param name="value"/></xsl:call-template></xsl:attribute>
+ <xsl:call-template name="common">
+ <xsl:with-param name="groupx" select="$groupx1"/>
+ <xsl:with-param name="groupy" select="$groupy1"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="Scribble">
+ <xsl:param name="groupx1"/>
+ <xsl:param name="groupy1"/>
+ <xsl:element name="draw:polyline">
+ <xsl:variable name="width" select="number(图:预定义图形/图:属性/图:宽度)*1000"/>
+ <xsl:variable name="height" select="number(图:预定义图形/图:属性/图:高度)*1000"/>
+ <xsl:attribute name="svg:viewBox"><xsl:value-of select="concat('0 0 ',$width, ' ',$height)"/></xsl:attribute>
+ <xsl:attribute name="draw:points"><xsl:call-template name="drawpoints"><xsl:with-param name="points" select="图:预定义图形/图:关键点åæ ‡/@图:路径"/><xsl:with-param name="value"/></xsl:call-template></xsl:attribute>
+ <xsl:call-template name="common">
+ <xsl:with-param name="groupx" select="$groupx1"/>
+ <xsl:with-param name="groupy" select="$groupy1"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="drawpoints">
+ <xsl:param name="points"/>
+ <xsl:param name="value"/>
+ <xsl:variable name="frist-piont">
+ <xsl:value-of select="substring-before($points,'lineto')"/>
+ </xsl:variable>
+ <xsl:variable name="other-points">
+ <xsl:value-of select="substring-after($points,'lineto')"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="contains($other-points,'lineto')">
+ <xsl:variable name="x-coor">
+ <xsl:value-of select="substring-before($frist-piont,' ') * 1000"/>
+ </xsl:variable>
+ <xsl:variable name="y-coor">
+ <xsl:value-of select="substring-after($frist-piont,' ') * 1000"/>
+ </xsl:variable>
+ <xsl:variable name="all-points">
+ <xsl:value-of select="concat($value,$x-coor,',',$y-coor,' ')"/>
+ </xsl:variable>
+ <xsl:call-template name="drawpoints">
+ <xsl:with-param name="points" select="$other-points"/>
+ <xsl:with-param name="value" select="$all-points"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="q-x-coor">
+ <xsl:value-of select="substring-before($frist-piont,' ') * 1000"/>
+ </xsl:variable>
+ <xsl:variable name="q-y-coor">
+ <xsl:value-of select="substring-after($frist-piont,' ') * 1000"/>
+ </xsl:variable>
+ <xsl:variable name="e-x-coor">
+ <xsl:value-of select="substring-before($other-points,' ') * 1000"/>
+ </xsl:variable>
+ <xsl:variable name="e-y-coor">
+ <xsl:value-of select="substring-after($other-points,' ') * 1000"/>
+ </xsl:variable>
+ <xsl:value-of select="concat($value,$q-x-coor,',',$q-y-coor,' ',$e-x-coor,',',$e-y-coor)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="Oval">
+ <xsl:param name="groupx1"/>
+ <xsl:param name="groupy1"/>
+ <xsl:element name="draw:ellipse">
+ <xsl:call-template name="common">
+ <xsl:with-param name="groupx" select="$groupx1"/>
+ <xsl:with-param name="groupy" select="$groupy1"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="Rectangle">
+ <xsl:param name="groupx1"/>
+ <xsl:param name="groupy1"/>
+ <xsl:element name="draw:rect">
+ <xsl:call-template name="common">
+ <xsl:with-param name="groupx" select="$groupx1"/>
+ <xsl:with-param name="groupy" select="$groupy1"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="Line">
+ <xsl:param name="groupx1"/>
+ <xsl:param name="groupy1"/>
+ <xsl:element name="draw:line">
+ <xsl:variable name="tuxing1" select="@图:标识符"/>
+ <xsl:choose>
+ <xsl:when test="key('rel_graphic_name',@图:标识符)">
+ <xsl:for-each select="key('rel_graphic_name',@图:标识符)">
+ <xsl:attribute name="svg:x1"><xsl:value-of select="concat(@uof:xåæ ‡,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:y1"><xsl:value-of select="concat(@uof:yåæ ‡,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:x2"><xsl:value-of select="concat((number(@uof:xåæ ‡) + number(@uof:宽度)),$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:y2"><xsl:value-of select="concat((number(@uof:yåæ ‡) + number(@uof:高度)),$uofUnit)"/></xsl:attribute>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="zuheweizhi-x">
+ <xsl:value-of select="图:组åˆä½ç½®/@图:xåæ ‡"/>
+ </xsl:variable>
+ <xsl:variable name="zuheweizhi-y">
+ <xsl:value-of select="图:组åˆä½ç½®/@图:yåæ ‡"/>
+ </xsl:variable>
+ <xsl:variable name="hex">
+ <xsl:value-of select="concat(number($groupx1 + $zuheweizhi-x),$uofUnit)"/>
+ </xsl:variable>
+ <xsl:variable name="hey">
+ <xsl:value-of select="concat(number($groupy1 + $zuheweizhi-y),$uofUnit)"/>
+ </xsl:variable>
+ <xsl:attribute name="svg:x1"><xsl:value-of select="$hex"/></xsl:attribute>
+ <xsl:attribute name="svg:y1"><xsl:value-of select="$hey"/></xsl:attribute>
+ <xsl:attribute name="svg:x2"><xsl:value-of select="concat(($hex + 图:预定义图形/图:属性/图:宽度),$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:y2"><xsl:value-of select="concat(($hey + 图:预定义图形/图:属性/图:高度),$uofUnit)"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="text:anchor-type">paragraph</xsl:attribute>
+ <xsl:attribute name="draw:style-name"><xsl:value-of select="$tuxing1"/></xsl:attribute>
+ <xsl:attribute name="draw:z-index"><xsl:value-of select="@图:层次"/></xsl:attribute>
+ <xsl:if test="图:预定义图形/图:属性/图:旋转角度 and not(图:预定义图形/图:属性/图:旋转角度='0.0')">
+ <xsl:variable name="rotate-angle">
+ <xsl:value-of select="(图:预定义图形/图:属性/图:旋转角度 * 2 * 3.14159265 ) div 360"/>
+ </xsl:variable>
+ <xsl:attribute name="draw:transform"><xsl:value-of select="concat('rotate (',$rotate-angle,') translate (-0.0194027777777778cm 3.317875cm)')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="图:文本内容">
+ <xsl:apply-templates select="图:文本内容/å­—:段è½"/>
+ <xsl:apply-templates select="图:文本内容/字:文字表"/>
+ </xsl:if>
+ </xsl:element>
+ </xsl:template>
+ <!--Redoffice comment liliang end 06.02.15-->
+ <xsl:template match="表:å•å…ƒæ ¼" mode="skip">
+ <xsl:param name="condition-pos-str"/>
+ <xsl:param name="col-pos-max"/>
+ <xsl:param name="col-pos-before"/>
+ <xsl:param name="row-pos"/>
+ <xsl:variable name="next-cell" select="following-sibling::表:å•å…ƒæ ¼[1]"/>
+ <xsl:variable name="cell-is-repeatable" select="not($next-cell/*) and not($next-cell/text()) and (@表:å¼æ ·å¼•ç”¨ = $next-cell/@表:å¼æ ·å¼•ç”¨) and not($next-cell/@表:列å·)"/>
+ <xsl:choose>
+ <xsl:when test="$cell-is-repeatable">
+ <xsl:apply-templates select="$next-cell" mode="skip">
+ <xsl:with-param name="row-pos" select="$row-pos"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="col-pos-max" select="$col-pos-max"/>
+ <xsl:with-param name="col-pos-before" select="$col-pos-before + 1"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="$next-cell">
+ <xsl:apply-templates select="$next-cell" mode="selected">
+ <xsl:with-param name="row-pos" select="$row-pos"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="col-pos-max" select="$col-pos-max"/>
+ <xsl:with-param name="col-pos-before" select="$col-pos-before +1"/>
+ </xsl:apply-templates>
+ <!--chengxz0925 no otherwise ,some content cells missed -->
+ </xsl:if>
+ <!--chengxz 060418 add if sentence-->
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!--xsl:template name="create-table-cell-attributes"></xsl:template>
+<xsl:template name="create-table-cell-content"></xsl:template>
+<xsl:template name="create-data-content"></xsl:template>
+<xsl:template name="get-condition-dependent-cell-attributes"></xsl:template-->
+ <xsl:template name="create-table-cell-attributes">
+ <xsl:param name="condition-pos-str"/>
+ <xsl:param name="col-pos-max"/>
+ <xsl:param name="col-pos"/>
+ <xsl:param name="row-pos"/>
+ <xsl:choose>
+ <xsl:when test="$condition-pos-str">
+ <xsl:call-template name="get-condition-dependent-cell-attributes">
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="current-pos-str" select="concat('R',$row-pos,'C',$col-pos,',')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="table:style-name"><xsl:choose><xsl:when test="@表:å¼æ ·å¼•ç”¨"><xsl:value-of select="@表:å¼æ ·å¼•ç”¨"/></xsl:when><xsl:when test="../@表:å¼æ ·å¼•ç”¨ and ../@表:å¼æ ·å¼•ç”¨ != ''"><xsl:value-of select="../@表:å¼æ ·å¼•ç”¨"/></xsl:when><xsl:otherwise><xsl:value-of select="'Default'"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <!--chengxiuzhi-->
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="@表:åˆå¹¶åˆ—æ•° or @表:åˆå¹¶è¡Œæ•°">
+ <xsl:choose>
+ <xsl:when test="@表:åˆå¹¶åˆ—æ•°">
+ <xsl:attribute name="table:number-columns-spanned"><xsl:value-of select="@表:åˆå¹¶åˆ—æ•° + 1"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="table:number-columns-spanned">1</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="@表:åˆå¹¶è¡Œæ•°">
+ <xsl:attribute name="table:number-rows-spanned"><xsl:value-of select="@表:åˆå¹¶è¡Œæ•°+1"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="table:number-rows-spanned">1</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="表:æ•°æ®">
+ <xsl:if test="表:æ•°æ®/表:å…¬å¼">
+ <xsl:variable name="calc-formula">
+ <xsl:call-template name="translate-expression">
+ <xsl:with-param name="cell-row-pos" select="$row-pos"/>
+ <xsl:with-param name="cell-column-pos" select="$col-pos"/>
+ <xsl:with-param name="expression" select="表:æ•°æ®/表:å…¬å¼"/>
+ <xsl:with-param name="return-value" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="table:formula"><xsl:value-of select="$calc-formula"/></xsl:attribute>
+ </xsl:if>
+ <!--RedOffice Comment from Zengjh:UOF0020 2006-04-17 Based on Original-->
+ <xsl:variable name="table-stylename" select="@表:å¼æ ·å¼•ç”¨"/>
+ <xsl:variable name="data-format">
+ <xsl:for-each select="/uof:UOF/uof:å¼æ ·é›†/uof:å•å…ƒæ ¼å¼æ ·">
+ <xsl:if test="$table-stylename = ./@ 表:标识符">
+ <xsl:value-of select="表:æ•°å­—æ ¼å¼/@表:分类å称"/>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:variable name="data-formatcode">
+ <xsl:for-each select="/uof:UOF/uof:å¼æ ·é›†/uof:å•å…ƒæ ¼å¼æ ·">
+ <xsl:if test="$table-stylename= ./@表:标识符">
+ <xsl:value-of select="表:æ•°å­—æ ¼å¼/@表:æ ¼å¼ç "/>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="表:æ•°æ®/@表:æ•°æ®ç±»åž‹ = 'number'">
+ <xsl:choose>
+ <xsl:when test="$data-format = 'percentage' or contains( $data-formatcode, '%')">
+ <xsl:attribute name="office:value-type">percentage</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="contains($data-format, 'currency')">
+ <xsl:attribute name="office:value-type">currency</xsl:attribute>
+ <xsl:attribute name="office:currency">CNY</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="office:value-type">float</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="office:value"><xsl:choose><xsl:when test="表:æ•°æ®/@表:æ•°æ®æ•°å€¼"><xsl:value-of select="表:æ•°æ®/@表:æ•°æ®æ•°å€¼"/></xsl:when><xsl:otherwise><xsl:value-of select="表:æ•°æ®/å­—:å¥/å­—:文本串"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="表:æ•°æ®/@表:æ•°æ®ç±»åž‹ = 'date'">
+ <xsl:attribute name="office:value-type">date</xsl:attribute>
+ <xsl:attribute name="office:date-value"><xsl:value-of select="表:æ•°æ®/@表:æ•°æ®æ•°å€¼"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="表:æ•°æ®/@表:æ•°æ®ç±»åž‹ = 'time'">
+ <xsl:attribute name="office:value-type">time</xsl:attribute>
+ <xsl:attribute name="office:time-value"><xsl:value-of select="表:æ•°æ®/@表:æ•°æ®æ•°å€¼"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="表:æ•°æ®/@表:æ•°æ®ç±»åž‹ = 'boolean'">
+ <xsl:attribute name="office:value-type">boolean</xsl:attribute>
+ <xsl:attribute name="office:boolean-value"><xsl:choose><xsl:when test="表:æ•°æ®/å­—:å¥/å­—:文本串 = '1'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="表:æ•°æ®/@表:æ•°æ®ç±»åž‹ = 'text'">
+ <xsl:attribute name="office:value-type">string</xsl:attribute>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="表:æ•°æ®/@表:æ•°æ®æ•°å€¼"/></xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ <!-- zhangying ok and /uof:UOF/uof:电å­è¡¨æ ¼/表:公共处ç†è§„则/表:æ•°æ®æœ‰æ•ˆæ€§é›†-->
+ <xsl:if test="表:æ•°æ®">
+ <xsl:variable name="validation-name">
+ <xsl:call-template name="zyvalidationtest">
+ <xsl:with-param name="column-num" select="$col-pos"/>
+ <xsl:with-param name="row-num" select="$row-pos"/>
+ <xsl:with-param name="table-name" select="ancestor::表:工作表/@表:å称"/>
+ <xsl:with-param name="validation-set" select="/uof:UOF/uof:电å­è¡¨æ ¼/表:公用处ç†è§„则/表:æ•°æ®æœ‰æ•ˆæ€§é›†/表:æ•°æ®æœ‰æ•ˆæ€§"/>
+ <xsl:with-param name="validation-num" select="'1'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="$validation-name!=''">
+ <xsl:attribute name="table:content-validation-name"><xsl:value-of select="$validation-name"/></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <!-- zhangying mod end -->
+ </xsl:template>
+ <!-- zhangying o -->
+ <xsl:template name="zyvalidationtest">
+ <xsl:param name="row-num"/>
+ <xsl:param name="column-num"/>
+ <xsl:param name="table-name"/>
+ <xsl:param name="validation-set"/>
+ <xsl:param name="validation-num"/>
+ <xsl:if test="$validation-set">
+ <xsl:variable name="zone" select="$validation-set/表:区域/text()"/>
+ <xsl:variable name="success">
+ <xsl:choose>
+ <xsl:when test="$table-name=substring-after(substring-before($zone,'.'),'$')">
+ <xsl:variable name="validation-row-left-top" select="substring-before(substring-after(substring-after(substring-after($zone,'$'),'$'),'$'),':')"/>
+ <xsl:variable name="validation-row-right-bottom" select="substring-after(substring-after(substring-after($zone,':$'),'$'),'$')"/>
+ <xsl:choose>
+ <xsl:when test="($row-num &gt;= $validation-row-left-top and $row-num &lt;= $validation-row-right-bottom) or $validation-row-left-top=$validation-row-right-bottom">
+ <xsl:variable name="validation-column-left-top">
+ <xsl:call-template name="translate-column-char-to-number">
+ <xsl:with-param name="string" select="substring-before(substring-after(substring-after($zone,'$'),'$'),'$')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="validation-column-right-bottom">
+ <xsl:call-template name="translate-column-char-to-number">
+ <xsl:with-param name="string" select="substring-before(substring-after(substring-after($zone,':$'),'$'),'$')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="($column-num &gt;= $validation-column-left-top) and ($column-num &lt;= $validation-column-right-bottom)">yes</xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$success='yes'">
+ <xsl:value-of select="concat('val',$validation-num)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="zyvalidationtest">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="row-num" select="$row-num"/>
+ <xsl:with-param name="column-num" select="$column-num"/>
+ <xsl:with-param name="validation-set" select="$validation-set[position()!=1]"/>
+ <xsl:with-param name="validation-num" select="$validation-num + 1"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:template>
+ <!--zhangying mod end -->
+ <xsl:template name="create-table-cell-content">
+ <xsl:param name="condition-pos-str"/>
+ <xsl:param name="col-pos-max"/>
+ <xsl:param name="col-pos"/>
+ <xsl:param name="row-pos"/>
+ <!--Redoffice comment liliang SC0011 06.02.15 -->
+ <!--新增内容-->
+ <xsl:apply-templates select="uof:锚点"/>
+ <!--Redoffice comment liliang end 06.02.15 -->
+ <xsl:apply-templates select="表:批注" mode="body"/>
+ <!--RedOffice Comment from Zengjh:UOF0020 2006-04-26 charts-->
+ <xsl:apply-templates select="表:图表"/>
+ <xsl:if test="表:æ•°æ®/å­—:å¥">
+ <text:p>
+ <xsl:call-template name="create-data-content">
+ <xsl:with-param name="style-id" select="../../@表:å¼æ ·å¼•ç”¨"/>
+ </xsl:call-template>
+ </text:p>
+ </xsl:if>
+ <!--chengxz0701多个å¥ä¸èƒ½è¯»å…¥-->
+ </xsl:template>
+ <xsl:template name="create-data-content">
+ <xsl:param name="style-id" select="@表:å¼æ ·å¼•ç”¨"/>
+ <xsl:variable name="html-children" select="表:å¼æ ·å¼•ç”¨/descendant-or-self::*[namespace-uri()='http://www.w3.org/TR/REC-html40'][string-length(text()) != 0]"/>
+ <xsl:choose>
+ <xsl:when test="$html-children and $html-children != ''">
+ <xsl:for-each select="$html-children">
+ <text:span text:style-name="{concat($style-id, 'T', count(preceding::表:æ•°æ®/å­—:å¥/å­—:文本串[child::html:*]), '_', position())}">
+ <xsl:copy-of select="text()"/>
+ </text:span>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:when test="@表:超链接引用">
+ <text:a xlink:href="{@表:超链接引用}">
+ <xsl:value-of select="表:æ•°æ®/å­—:å¥/å­—:文本串"/>
+ </text:a>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:for-each select="表:æ•°æ®/å­—:å¥">
+ <xsl:choose>
+ <xsl:when test="name(descendant::*[1])='å­—:å¥å±žæ€§'">
+ <text:span>
+ <xsl:attribute name="text:style-name"><xsl:value-of select="descendant::*[1]/@å­—:å¼æ ·å¼•ç”¨"/></xsl:attribute>
+ <xsl:value-of select="./字:文本串"/>
+ </text:span>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="./字:文本串"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="create-comment-data-content">
+ <xsl:param name="style-id" select="@表:å¼æ ·å¼•ç”¨"/>
+ <xsl:variable name="html-children" select="表:å¼æ ·å¼•ç”¨/descendant-or-self::*[namespace-uri()='http://www.w3.org/TR/REC-html40'][string-length(text()) != 0]"/>
+ <xsl:choose>
+ <xsl:when test="$html-children and $html-children != ''">
+ <xsl:for-each select="$html-children">
+ <text:span text:style-name="{concat($style-id, 'T', count(preceding::图:文本内容/å­—:段è½/å­—:å¥/å­—:文本串[child::html:*]), '_', position())}">
+ <xsl:copy-of select="text()"/>
+ </text:span>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:when test="@表:超链接引用">
+ <text:a xlink:href="{@表:超链接引用}">
+ <xsl:value-of select="图:文本内容/å­—:段è½/å­—:å¥/å­—:文本串"/>
+ </text:a>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="图:文本内容/å­—:段è½/å­—:å¥/å­—:文本串"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-condition-dependent-cell-attributes">
+ <xsl:param name="condition-pos-str"/>
+ <xsl:param name="current-pos-str"/>
+ <xsl:variable name="temp-str">
+ <xsl:call-template name="condition-str">
+ <xsl:with-param name="param-str" select="substring-before($condition-pos-str,$current-pos-str)"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="style-name">
+ <xsl:choose>
+ <xsl:when test="contains($condition-pos-str, $current-pos-str) and starts-with($temp-str, 'c')">
+ <xsl:value-of select="concat('ce', substring-after($temp-str, 'c'))"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="@表:å¼æ ·å¼•ç”¨">
+ <xsl:value-of select="@表:å¼æ ·å¼•ç”¨"/>
+ </xsl:when>
+ <xsl:when test="../@表:å¼æ ·å¼•ç”¨">
+ <xsl:value-of select="../@表:å¼æ ·å¼•ç”¨"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="'Default'"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="not( contains($style-name, 'Default'))">
+ <xsl:choose>
+ <xsl:when test="starts-with($style-name, 'val')">
+ <xsl:attribute name="table:content-validation-name"><xsl:value-of select="$style-name"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="table:style-name"><xsl:value-of select="$style-name"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="contains($style-name, 'Default')">
+ <xsl:variable name="style-nametemp">
+ <xsl:choose>
+ <xsl:when test="@表:å¼æ ·å¼•ç”¨">
+ <xsl:value-of select="@表:å¼æ ·å¼•ç”¨"/>
+ </xsl:when>
+ <xsl:when test="../@表:å¼æ ·å¼•ç”¨">
+ <xsl:value-of select="../@表:å¼æ ·å¼•ç”¨"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="'Default'"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="table:style-name"><xsl:value-of select="$style-nametemp"/></xsl:attribute>
+ <!--xsl:attribute name="style:data-style-name"><xsl:value-of select="N104" /></xsl:attribute-->
+ </xsl:if>
+ <!--chengxz-->
+ <xsl:if test="contains($condition-pos-str, $current-pos-str)">
+ <xsl:choose>
+ <xsl:when test="starts-with($temp-str, 'v')">
+ <xsl:attribute name="table:content-validation-name"><xsl:value-of select="concat('val', substring-after($temp-str, 'v'))"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="after-str" select="substring-after($condition-pos-str, $current-pos-str)"/>
+ <xsl:if test="contains( $after-str, $current-pos-str)">
+ <xsl:variable name="temp-str-2">
+ <xsl:call-template name="condition-str">
+ <xsl:with-param name="param-str" select="substring-before( $after-str,$current-pos-str)"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="starts-with( $temp-str-2, 'v')">
+ <xsl:attribute name="table:content-validation-name"><xsl:value-of select="concat('val', substring-after($temp-str-2, 'v'))"/></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="表:工作表内容">
+ <xsl:variable name="default-column-width">
+ <xsl:choose>
+ <xsl:when test="@表:缺çœåˆ—宽">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="concat(@表:缺çœåˆ—宽,'pt')"/>
+ </xsl:call-template>
+ <xsl:text>cm</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>2.096cm</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="table-pos">
+ <xsl:value-of select="count(../preceding-sibling::表:工作表)+1"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="表:列">
+ <xsl:call-template name="get-column-style-name">
+ <xsl:with-param name="finishedColumns" select="0"/>
+ <xsl:with-param name="columnCount" select="count(./表:列)"/>
+ <xsl:with-param name="currentCount" select="1"/>
+ <xsl:with-param name="table-pos" select="$table-pos"/>
+ <xsl:with-param name="default-column-width" select="$default-column-width"/>
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="../表:分页符集/表:分页符[@表:列å·]">
+ <style:style style:name="{concat('cob',$table-pos)}" style:family="table-column">
+ <xsl:element name="style:table-column-properties">
+ <xsl:attribute name="style:column-width"><xsl:value-of select="$default-column-width"/></xsl:attribute>
+ <xsl:attribute name="fo:break-before">page</xsl:attribute>
+ </xsl:element>
+ </style:style>
+ </xsl:if>
+ <xsl:variable name="default-row-height">
+ <xsl:choose>
+ <xsl:when test="@表:缺çœè¡Œé«˜">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="concat(@表:缺çœè¡Œé«˜,'pt')"/>
+ </xsl:call-template>
+ <xsl:text>cm</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>0.503cm</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <style:style style:family="table-row" style:name="{concat('ro', $table-pos)}">
+ <style:table-row-properties style:row-height="{$default-row-height}" style:use-optimal-row-height="false"/>
+ </style:style>
+ <xsl:if test="表:行">
+ <xsl:call-template name="get-row-style-name">
+ <xsl:with-param name="lastrowpos" select="0"/>
+ <xsl:with-param name="row-count" select="count(./表:行)"/>
+ <xsl:with-param name="currentRow" select="1"/>
+ <xsl:with-param name="table-pos" select="$table-pos"/>
+ <xsl:with-param name="default-row-height" select="$default-row-height"/>
+ </xsl:call-template>
+ </xsl:if>
+ <!--RedOffice Comment from Zengjh:UOF0020 2006-06-11 charts-->
+ <xsl:for-each select="//表:图表">
+ <xsl:variable name="chart-current">
+ <xsl:number level="any" count="表:图表" format="1"/>
+ </xsl:variable>
+ <style:style style:family="graphics" style:name="{concat('chart', $chart-current)}">
+ <style:graphic-properties>
+ <xsl:choose>
+ <xsl:when test="@表:éšåŠ¨æ–¹å¼='none'">
+ <xsl:attribute name="draw:move-protect">true</xsl:attribute>
+ <xsl:attribute name="draw:size-protect">true</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@表:éšåŠ¨æ–¹å¼='move'">
+ <xsl:attribute name="draw:size-protect">true</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </style:graphic-properties>
+ </style:style>
+ </xsl:for-each>
+ <!--RedOffice comment (Zengjh) end charts-->
+ <xsl:if test="../表:分页符集/表:分页符[@è¡Œå·]">
+ <style:style style:name="{concat('rob',$table-pos)}" style:family="table-row">
+ <xsl:element name="style:table-row-properties">
+ <xsl:attribute name="style:row-height"><xsl:value-of select="$default-row-height"/></xsl:attribute>
+ <xsl:attribute name="style:use-optimal-row-height">false</xsl:attribute>
+ <xsl:attribute name="fo:break-before">page</xsl:attribute>
+ </xsl:element>
+ </style:style>
+ </xsl:if>
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name"><xsl:value-of select="concat( 'ta', $table-pos)"/></xsl:attribute>
+ <xsl:attribute name="style:family">table</xsl:attribute>
+ <xsl:attribute name="style:master-page-name"><xsl:call-template name="encode-as-nc-name"><xsl:with-param name="string" select="concat( 'TAB_',../@表:å称)"/></xsl:call-template></xsl:attribute>
+ <xsl:element name="style:properties">
+ <xsl:choose>
+ <xsl:when test="../@表:éšè— = 'true'">
+ <xsl:attribute name="table:display">false</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="table:display">true</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="get-column-style-name">
+ <xsl:param name="finishedColumns"/>
+ <xsl:param name="columnCount"/>
+ <xsl:param name="currentCount"/>
+ <xsl:param name="table-pos"/>
+ <xsl:param name="default-column-width"/>
+ <xsl:if test="$currentCount &lt; ($columnCount + 1)">
+ <xsl:variable name="span-value">
+ <xsl:choose>
+ <xsl:when test="./表:列[position() = $currentCount]/@表:跨度">
+ <xsl:value-of select="./表:跨度[position() = $currentCount]/@表:跨度 + 1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="0"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="current-index">
+ <xsl:choose>
+ <xsl:when test="./表:列[position() = $currentCount]/@表:列å·">
+ <xsl:value-of select="./表:列[position() = $currentCount]/@表:åˆ—å· - 1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$finishedColumns"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="column-break">
+ <xsl:choose>
+ <xsl:when test="$span-value = 0">
+ <xsl:if test="../表:分页符集/表:分页符/表:列 = $current-index">
+ <xsl:value-of select="1"/>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="../表:分页符集/表:分页符[(@表:åˆ—å· &gt; $finishedColumns) and (@表:åˆ—å· &lt; ($finishedColumns + $span-value))]">
+ <xsl:value-of select="1"/>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="$column-break = 1">
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name"><xsl:call-template name="encode-as-nc-name"><xsl:with-param name="string" select="concat('cob', $table-pos, '-',$currentCount)"/></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="style:family">table-column</xsl:attribute>
+ <xsl:element name="style:table-column-properties">
+ <xsl:choose>
+ <xsl:when test="./表:列[position() = $currentCount]/@表:列宽">
+ <xsl:attribute name="style:column-width"><xsl:call-template name="convert2cm"><xsl:with-param name="value" select="concat(./表:列[position() = $currentCount]/@表:列宽,'pt')"/></xsl:call-template><xsl:text>cm</xsl:text></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:column-width"><xsl:value-of select="$default-column-width"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="./表:列[position() = $currentCount]/@表:列宽 &gt; 0">
+ <xsl:attribute name="style:use-optimal-column-width">false</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:use-optimal-column-width">true</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="fo:break-before">page</xsl:attribute>
+ </xsl:element>
+ </xsl:element>
+ </xsl:if>
+ <style:style style:name="{concat('co', $table-pos, '-',$currentCount)}" style:family="table-column">
+ <xsl:element name="style:table-column-properties">
+ <xsl:choose>
+ <xsl:when test="./表:列[position() = $currentCount]/@表:列宽">
+ <xsl:attribute name="style:column-width"><xsl:call-template name="convert2cm"><xsl:with-param name="value" select="concat(./表:列[position() = $currentCount]/@表:列宽,'pt')"/></xsl:call-template><xsl:text>cm</xsl:text></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:column-width"><xsl:value-of select="$default-column-width"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="fo:break-before">auto</xsl:attribute>
+ </xsl:element>
+ </style:style>
+ <xsl:if test="$currentCount &lt; $columnCount">
+ <xsl:call-template name="get-column-style-name">
+ <xsl:with-param name="finishedColumns">
+ <xsl:choose>
+ <xsl:when test="./表:列[position() = $currentCount]/@表:列å·">
+ <xsl:choose>
+ <xsl:when test="./表:列[position() = $currentCount]/@表:跨度">
+ <xsl:value-of select="./表:列[position() = $currentCount]/@表:列宽 + ./表:列[position() = $currentCount]/@表:跨度"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="./表:列[position() = $currentCount]/@表:列å·"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="./表:列[position() = $currentCount]/@表:跨度">
+ <xsl:value-of select="$finishedColumns + ./表:列[position() = $currentCount]/@表:跨度 + 1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$finishedColumns + 1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="columnCount" select="$columnCount"/>
+ <xsl:with-param name="currentCount" select="$currentCount + 1"/>
+ <xsl:with-param name="table-pos" select="$table-pos"/>
+ <xsl:with-param name="default-column-width" select="$default-column-width"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="get-row-style-name">
+ <xsl:param name="lastrowpos"/>
+ <xsl:param name="row-count"/>
+ <xsl:param name="currentRow"/>
+ <xsl:param name="table-pos"/>
+ <xsl:param name="default-row-height"/>
+ <xsl:if test="$currentRow &lt; ($row-count + 1)">
+ <xsl:variable name="span-value">
+ <xsl:choose>
+ <xsl:when test="./表:è¡Œ[position() = $currentRow]/@表:è¡Œå·">
+ <xsl:choose>
+ <xsl:when test="./表:行[position() = $currentRow]/@表:跨度">
+ <xsl:value-of select="./表:è¡Œ[position() = $currentRow]/@表:è¡Œå· - $lastrowpos+ ./表:è¡Œ[position() = $currentRow]/@表:跨度"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="0"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="./表:行[position() = $currentRow]/@表:跨度">
+ <xsl:value-of select="./表:行[position() = $currentRow]/@表:跨度 + 1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="0"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="current-index">
+ <xsl:choose>
+ <xsl:when test="./表:è¡Œ[position() = $currentRow]/@表:è¡Œå·">
+ <xsl:value-of select="./表:è¡Œ[position() = $currentRow]/@表:è¡Œå· - 1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$lastrowpos"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="row-break">
+ <xsl:choose>
+ <xsl:when test="$span-value = 0">
+ <xsl:if test="../表:分页符集/表:分页符/@表:è¡Œå· = $current-index">
+ <xsl:value-of select="1"/>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="../表:分页符集/表:分页符[(@表:è¡Œå· &gt; $lastrowpos) and (@表:è¡Œå· &lt; ($lastrowpos + $span-value))]">
+ <xsl:value-of select="1"/>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="$row-break = 1">
+ <style:style style:name="{concat('rob', $table-pos, '-',$currentRow)}" style:family="table-row">
+ <xsl:element name="style:table-row-properties">
+ <xsl:choose>
+ <xsl:when test="./表:行[position() = $currentRow]/@表:行高">
+ <xsl:attribute name="style:row-height"><xsl:call-template name="convert2cm"><xsl:with-param name="value" select="concat(./表:行[position() = $currentRow]/@表:行高,'pt')"/></xsl:call-template><xsl:text>cm</xsl:text></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:row-height"><xsl:value-of select="$default-row-height"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="./表:行[position() = $currentRow]/@表:行高 &gt; 0">
+ <xsl:attribute name="style:use-optimal-row-height">false</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:use-optimal-row-height">true</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="fo:break-before">page</xsl:attribute>
+ </xsl:element>
+ </style:style>
+ </xsl:if>
+ <style:style style:name="{concat('ro', $table-pos, '-',$currentRow)}" style:family="table-row">
+ <xsl:element name="style:table-row-properties">
+ <xsl:choose>
+ <xsl:when test="./表:行[position() = $currentRow]/@表:行高">
+ <xsl:attribute name="style:row-height"><xsl:call-template name="convert2cm"><xsl:with-param name="value" select="concat(./表:行[position() = $currentRow]/@表:行高,'pt')"/></xsl:call-template><xsl:text>cm</xsl:text></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:row-height"><xsl:value-of select="$default-row-height"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="style:use-optimal-row-height">true</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="./表:行[position() = $currentRow]/@表:行高 &gt; 0">
+ <xsl:attribute name="style:use-optimal-row-height">false</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:use-optimal-row-height">true</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="fo:break-before">auto</xsl:attribute>
+ </xsl:element>
+ </style:style>
+ <xsl:if test="$currentRow &lt; $row-count">
+ <xsl:call-template name="get-row-style-name">
+ <xsl:with-param name="lastrowpos">
+ <xsl:choose>
+ <xsl:when test="./表:è¡Œ[position() = $currentRow]/@表:è¡Œå·">
+ <xsl:choose>
+ <xsl:when test="./表:行[position() = $currentRow]/@表:跨度">
+ <xsl:value-of select="./表:è¡Œ[position() = $currentRow]/@表:è¡Œå· + ./表:è¡Œ[position() = $currentRow]/@表:跨度"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="./表:è¡Œ[position() = $currentRow]/@表:è¡Œå·"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="./表:行[position() = $currentRow]/@表:跨度">
+ <xsl:value-of select="$lastrowpos + ./表:行[position() = $currentRow]/@表:跨度 + 1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$lastrowpos + 1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="row-count" select="$row-count"/>
+ <xsl:with-param name="currentRow" select="$currentRow + 1"/>
+ <xsl:with-param name="table-pos" select="$table-pos"/>
+ <xsl:with-param name="default-row-height" select="$default-row-height"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="encode-as-nc-name">
+ <xsl:param name="string"/>
+ <xsl:value-of select="translate($string, '. %()/\+', '')"/>
+ </xsl:template>
+ <xsl:key match="/uof:UOF/uof:电å­è¡¨æ ¼/表:主体/表:工作表/表:工作表内容/表:è¡Œ/表:å•å…ƒæ ¼" name="cells" use="@表:å¼æ ·å¼•ç”¨"/>
+ <xsl:template match="表:æ•°å­—æ ¼å¼">
+ <xsl:variable name="unit-count" select="string-length(@表:æ ¼å¼ç ) - string-length(translate(@表:æ ¼å¼ç ,';','')) + 1"/>
+ <xsl:variable name="style-id" select="../@表:标识符"/>
+ <xsl:variable name="number-format-name">
+ <xsl:choose>
+ <xsl:when test="@表:分类å称='fraction' or @表:分类å称='scientific'">number</xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="@表:分类å称"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:call-template name="process-number-format">
+ <xsl:with-param name="number-format-name" select="$number-format-name"/>
+ <xsl:with-param name="number-format-unit" select="@表:æ ¼å¼ç "/>
+ <xsl:with-param name="style-id" select="concat($style-id,'F')"/>
+ <xsl:with-param name="format-type" select="key('cells', $style-id)/表:æ•°æ®/@表:æ•°æ®ç±»åž‹"/>
+ <xsl:with-param name="total-unit" select="$unit-count"/>
+ <xsl:with-param name="current-unit" select="0"/>
+ </xsl:call-template>
+ </xsl:template>
+ <xsl:template name="process-number-format">
+ <xsl:param name="number-format-name"/>
+ <xsl:param name="number-format-unit"/>
+ <xsl:param name="style-id"/>
+ <xsl:param name="format-type"/>
+ <xsl:param name="total-unit"/>
+ <xsl:param name="current-unit"/>
+ <xsl:choose>
+ <xsl:when test="$current-unit &lt; ($total-unit -1)">
+ <xsl:variable name="style-name">
+ <xsl:choose>
+ <xsl:when test="contains(substring-before($number-format-unit,';'),'[$')">currency</xsl:when>
+ <xsl:when test="contains(substring-before($number-format-unit,';'),'%')">percentage</xsl:when>
+ <xsl:otherwise>number</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:element name="{concat('number:',$style-name,'-style')}">
+ <xsl:attribute name="style:name"><xsl:value-of select="concat( $style-id, 'P',$current-unit)"/></xsl:attribute>
+ <xsl:attribute name="style:volatile">true</xsl:attribute>
+ <xsl:call-template name="general-number">
+ <xsl:with-param name="number-format-unit" select="substring-before($number-format-unit,';')"/>
+ </xsl:call-template>
+ </xsl:element>
+ <xsl:call-template name="process-number-format">
+ <xsl:with-param name="number-format-name" select="$number-format-name"/>
+ <xsl:with-param name="number-format-unit" select="substring-after($number-format-unit,';')"/>
+ <xsl:with-param name="style-id" select="$style-id"/>
+ <xsl:with-param name="format-type" select="$format-type"/>
+ <xsl:with-param name="total-unit" select="$total-unit"/>
+ <xsl:with-param name="current-unit" select="$current-unit +1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="{concat('number:',$number-format-name,'-style')}">
+ <xsl:attribute name="style:name"><xsl:value-of select="$style-id"/></xsl:attribute>
+ <xsl:call-template name="element-attribute">
+ <xsl:with-param name="number-format-unit" select="string($number-format-unit)"/>
+ </xsl:call-template>
+ <xsl:call-template name="general-number">
+ <xsl:with-param name="number-format-unit" select="string($number-format-unit)"/>
+ </xsl:call-template>
+ <xsl:call-template name="style-map">
+ <xsl:with-param name="number-format-name" select="@表:分类å称"/>
+ <xsl:with-param name="number-format-unit" select="@表:æ ¼å¼ç "/>
+ <xsl:with-param name="style-id" select="$style-id"/>
+ <xsl:with-param name="format-type" select="$format-type"/>
+ <xsl:with-param name="total-unit" select="$total-unit"/>
+ <xsl:with-param name="current-unit" select="0"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="style-map">
+ <xsl:param name="number-format-name"/>
+ <xsl:param name="number-format-unit"/>
+ <xsl:param name="style-id"/>
+ <xsl:param name="format-type"/>
+ <xsl:param name="total-unit"/>
+ <xsl:param name="current-unit"/>
+ <xsl:if test="$current-unit &lt; ($total-unit -1)">
+ <xsl:variable name="stylecondition" select="substring-after(substring-before($number-format-unit,']'),'[')"/>
+ <style:map style:condition="{$stylecondition}" style:apply-style-name="{concat( $style-id, 'P',$current-unit)}"/>
+ <xsl:call-template name="style-map">
+ <xsl:with-param name="number-format-name" select="$number-format-name"/>
+ <xsl:with-param name="number-format-unit" select="substring-after($number-format-unit,';')"/>
+ <xsl:with-param name="style-id" select="$style-id"/>
+ <xsl:with-param name="format-type" select="$format-type"/>
+ <xsl:with-param name="total-unit" select="$total-unit"/>
+ <xsl:with-param name="current-unit" select="$current-unit +1"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="general-number">
+ <xsl:param name="number-format-unit"/>
+ <xsl:call-template name="number-format-color">
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ </xsl:call-template>
+ <xsl:call-template name="number-format-currency">
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ </xsl:call-template>
+ <xsl:choose>
+ <xsl:when test="starts-with($number-format-unit,'&quot;')">
+ <number:text>
+ <xsl:value-of select="substring-before(substring-after($number-format-unit,'&quot;'),'&quot;')"/>
+ </number:text>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'@')">
+ <number:text-content/>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'-') or starts-with($number-format-unit,'$') or starts-with($number-format-unit,'ï¿¥')">
+ <number:text>
+ <xsl:value-of select="substring($number-format-unit,1,1)"/>
+ </number:text>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'YYYY')">
+ <number:year number:style="long"/>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'YY')">
+ <number:year number:style="rolong"/>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'MMMM')">
+ <number:month number:style="long" number:textual="true"/>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'MMM')">
+ <number:month number:style="rolong" number:textual="true"/>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'DD')">
+ <number:day number:style="long"/>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'D')">
+ <number:day number:style="rolong"/>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'[HH]')">
+ <number:hours number:style="long"/>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'HH')">
+ <number:hours number:style="long"/>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'H')">
+ <number:hours/>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'SS.00')">
+ <number:seconds number:style="long" number:decimal-places="2"/>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'SS')">
+ <number:seconds number:style="long"/>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'S')">
+ <number:seconds/>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'AM/PM')">
+ <number:am-pm/>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'NNNN')">
+ <number:day-of-week number:style="long"/>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'NNN')">
+ <number:day-of-week/>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'QQ')">
+ <number:quarter number:style="long"/>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'Q')">
+ <number:quarter/>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'WW')">
+ <number:week-of-year/>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'MM')">
+ <xsl:choose>
+ <xsl:when test="starts-with(substring($number-format-unit,3),'S') or (starts-with(substring($number-format-unit,3),'&quot;') and starts-with(substring-after(substring-after($number-format-unit,'&quot;'),'&quot;'),'S'))">
+ <number:minutes number:style="long"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <number:month number:style="long"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'M')">
+ <xsl:choose>
+ <xsl:when test="starts-with(substring($number-format-unit,2),'S') or (starts-with(substring($number-format-unit,2),'&quot;') and starts-with(substring-after(substring-after($number-format-unit,'&quot;'),'&quot;'),'S'))">
+ <number:minutes/>
+ </xsl:when>
+ <xsl:otherwise>
+ <number:month/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'#') or starts-with($number-format-unit,'0')">
+ <xsl:variable name="digits-part">
+ <xsl:choose>
+ <xsl:when test="contains($number-format-unit,'&quot;')">
+ <xsl:value-of select="substring-before($number-format-unit,'&quot;')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$number-format-unit"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:call-template name="decimal-integer-exponent-fraction">
+ <xsl:with-param name="digits-part" select="$digits-part"/>
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:variable name="unit-length">
+ <xsl:choose>
+ <xsl:when test="starts-with($number-format-unit,'[value()')">
+ <xsl:value-of select="string-length(substring-before($number-format-unit,']')) +2"/>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'[NatNum')">
+ <xsl:value-of select="string-length(substring-before($number-format-unit,']')) +2"/>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'[$-804]')">8</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'&quot;')">
+ <xsl:value-of select="string-length(substring-before(substring-after($number-format-unit,'&quot;'),'&quot;')) +3"/>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'@')">2</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'-') or starts-with($number-format-unit,'$') or starts-with($number-format-unit,'ï¿¥')">2</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'YYYY')">5</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'YY')">3</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'MMMM')">5</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'MMM')">4</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'MM')">3</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'M')">2</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'DD')">3</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'D')">2</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'[HH]')">5</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'HH')">3</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'H')">2</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'SS.00')">6</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'SS')">3</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'S')">2</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'AM/PM')">6</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'NNNN')">5</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'NNN')">4</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'QQ')">3</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'Q')">2</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'WW')">3</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'#') or starts-with($number-format-unit,'0')">
+ <xsl:choose>
+ <xsl:when test="contains($number-format-unit,'&quot;')">
+ <xsl:value-of select="string-length(substring-before($number-format-unit,'&quot;')) +1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="string-length($number-format-unit) +1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="$unit-length &gt;1 and $unit-length &lt;=string-length($number-format-unit)">
+ <xsl:call-template name="general-number">
+ <xsl:with-param name="number-format-unit" select="substring($number-format-unit,$unit-length)"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="decimal-integer-exponent-fraction">
+ <xsl:param name="digits-part"/>
+ <xsl:variable name="decimal-digits">
+ <xsl:choose>
+ <xsl:when test="contains($digits-part,'.')">
+ <xsl:choose>
+ <xsl:when test="contains($digits-part,' ')">
+ <xsl:value-of select="string-length(substring-before(substring-after($digits-part,'.'),' '))"/>
+ </xsl:when>
+ <xsl:when test="contains(substring-after($digits-part,'.'),',')">
+ <xsl:value-of select="string-length(substring-before(substring-after($digits-part,'.'),','))"/>
+ </xsl:when>
+ <xsl:when test="contains($digits-part,'E')">
+ <xsl:value-of select="string-length(substring-before(substring-after($digits-part,'.'),'E'))"/>
+ </xsl:when>
+ <xsl:when test="contains($digits-part,'e')">
+ <xsl:value-of select="string-length(substring-before(substring-after($digits-part,'.'),'e'))"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="string-length(substring-after($digits-part,'.'))"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="decimal-replacement">
+ <xsl:choose>
+ <xsl:when test="contains($digits-part,'.')">
+ <xsl:choose>
+ <xsl:when test="contains($digits-part,' ') and contains(substring-before(substring-after($digits-part,'.'),' '),'#')">true</xsl:when>
+ <xsl:when test="contains($digits-part,'E') and contains(substring-before(substring-after($digits-part,'.'),'E'),'#')">true</xsl:when>
+ <xsl:when test="contains($digits-part,'e') and contains(substring-before(substring-after($digits-part,'.'),'e'),'#')">true</xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="contains(substring-after($digits-part,'.'),'#')">true</xsl:when>
+ <xsl:otherwise>false</xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>false</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="integer-digits">
+ <xsl:choose>
+ <xsl:when test="contains($digits-part,'.')">
+ <xsl:value-of select="string-length(substring-before($digits-part,'.')) - string-length(translate(substring-before($digits-part,'.'),'0',''))"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="string-length($digits-part) - string-length(translate($digits-part,'0',''))"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="factor-digits">
+ <xsl:call-template name="display-factor-digits">
+ <xsl:with-param name="digits-part" select="$digits-part"/>
+ <xsl:with-param name="count" select="0"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="grouping">
+ <xsl:choose>
+ <xsl:when test="(string-length($digits-part) - string-length(translate($digits-part,',',''))) &gt;$factor-digits">true</xsl:when>
+ <xsl:otherwise>false</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="exponent-digits">
+ <xsl:choose>
+ <xsl:when test="contains($digits-part,'E')">
+ <xsl:value-of select="string-length(substring-after($digits-part,'E')) -1"/>
+ </xsl:when>
+ <xsl:when test="contains($digits-part,'e')">
+ <xsl:value-of select="string-length(substring-after($digits-part,'e')) -1"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="numerator-digits">
+ <xsl:choose>
+ <xsl:when test="contains($digits-part,' ')">
+ <xsl:value-of select="string-length(substring-before(substring-after($digits-part,' '),'/'))"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="denominator-digits">
+ <xsl:choose>
+ <xsl:when test="contains($digits-part,' ')">
+ <xsl:value-of select="string-length(substring-after(substring-after($digits-part,' '),'/'))"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="number-type">
+ <xsl:choose>
+ <xsl:when test="$exponent-digits &gt;0">number:scientific-number</xsl:when>
+ <xsl:when test="($numerator-digits &gt;0) or ($denominator-digits &gt;0)">number:fraction</xsl:when>
+ <xsl:otherwise>number:number</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:element name="{$number-type}">
+ <xsl:if test="$decimal-digits &gt;=0">
+ <xsl:attribute name="number:decimal-places"><xsl:value-of select="$decimal-digits"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$decimal-replacement='true'">
+ <xsl:attribute name="number:decimal-replacement"/>
+ </xsl:if>
+ <xsl:if test="$integer-digits &gt;=0">
+ <xsl:attribute name="number:min-integer-digits"><xsl:value-of select="$integer-digits"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$grouping='true'">
+ <xsl:attribute name="number:grouping"><xsl:value-of select="$grouping"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$factor-digits &gt;0">
+ <xsl:attribute name="number:display-factor"><xsl:choose><xsl:when test="$factor-digits=1">1000</xsl:when><xsl:when test="$factor-digits=2">1000000</xsl:when><xsl:when test="$factor-digits=3">1000000000</xsl:when><xsl:when test="$factor-digits=4">1000000000000</xsl:when><xsl:when test="$factor-digits=5">1000000000000000</xsl:when><xsl:when test="$factor-digits=6">1000000000000000000</xsl:when><xsl:otherwise>0</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$exponent-digits &gt;0">
+ <xsl:attribute name="number:min-exponent-digits"><xsl:value-of select="$exponent-digits"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$numerator-digits &gt;0">
+ <xsl:attribute name="number:min-numerator-digits"><xsl:value-of select="$numerator-digits"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$denominator-digits &gt;0">
+ <xsl:attribute name="number:min-denominator-digits"><xsl:value-of select="$denominator-digits"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="number-format-color">
+ <xsl:param name="number-format-unit"/>
+ <xsl:choose>
+ <xsl:when test="starts-with($number-format-unit,'[Black]')">
+ <style:text-properties fo:color="#000000"/>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'[Blue]')">
+ <style:text-properties fo:color="#0000ff"/>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'[Cyan]')">
+ <style:text-properties fo:color="#00ffff"/>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'[Green]')">
+ <style:text-properties fo:color="#00ff00"/>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'[Magenta]')">
+ <style:text-properties fo:color="#ff00ff"/>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'[Red]')">
+ <style:text-properties fo:color="#ff0000"/>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'[White]')">
+ <style:text-properties fo:color="#ffffff"/>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'[Yellow]')">
+ <style:text-properties fo:color="#ffff00"/>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:variable name="unit-length">
+ <xsl:choose>
+ <xsl:when test="starts-with($number-format-unit,'[Black]')">8</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'[Blue]')">7</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'[Cyan]')">7</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'[Green]')">8</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'[Magenta]')">10</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'[Red]')">6</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'[White]')">8</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'[Yellow]')">9</xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="$unit-length &gt;1 and $unit-length &lt;=string-length($number-format-unit)">
+ <xsl:call-template name="general-number">
+ <xsl:with-param name="number-format-unit" select="substring($number-format-unit,$unit-length)"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="number-format-currency">
+ <xsl:param name="number-format-unit"/>
+ <xsl:choose>
+ <xsl:when test="starts-with($number-format-unit,'[$ï¿¥-804]')">
+ <number:currency-symbol number:language="zh" number:country="CN">ï¿¥</number:currency-symbol>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'[$$-409]')">
+ <number:currency-symbol number:language="en" number:country="US">$</number:currency-symbol>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'[$$-2C0A]')">
+ <number:currency-symbol number:language="es" number:country="AR">$</number:currency-symbol>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'[$$-C0C]')">
+ <number:currency-symbol number:language="fr" number:country="CA">$</number:currency-symbol>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'[$CNY]')">
+ <number:currency-symbol>CNY</number:currency-symbol>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'[$AFA]')">
+ <number:currency-symbol>AFA</number:currency-symbol>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'CNY')">
+ <number:currency-symbol>CNY</number:currency-symbol>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'CCC')">
+ <number:currency-symbol>CCC</number:currency-symbol>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:variable name="unit-length">
+ <xsl:choose>
+ <xsl:when test="starts-with($number-format-unit,'[$ï¿¥-804]')">9</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'[$$-409]')">9</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'[$$-2C0A]')">10</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'[$$-C0C]')">9</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'[$CNY]')">7</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'[$AFA]')">7</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'CNY')">4</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'CCC')">4</xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="$unit-length &gt;1 and $unit-length &lt;=string-length($number-format-unit)">
+ <xsl:call-template name="general-number">
+ <xsl:with-param name="number-format-unit" select="substring($number-format-unit,$unit-length)"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="display-factor-digits">
+ <xsl:param name="digits-part"/>
+ <xsl:param name="count"/>
+ <xsl:choose>
+ <xsl:when test="not(substring($digits-part,string-length($digits-part),1) =',')">
+ <xsl:value-of select="$count"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="display-factor-digits">
+ <xsl:with-param name="digits-part" select="substring($digits-part,1,string-length($digits-part) -1)"/>
+ <xsl:with-param name="count" select="$count +1"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="element-attribute">
+ <xsl:param name="number-format-unit"/>
+ <xsl:if test="contains($number-format-unit,'[HH]')">
+ <xsl:attribute name="number:truncate-on-overflow">false</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="starts-with($number-format-unit,'[NatNum1]')">
+ <xsl:attribute name="number:transliteration-format">一</xsl:attribute>
+ <xsl:attribute name="number:transliteration-style">short</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="starts-with($number-format-unit,'[NatNum2]')">
+ <xsl:attribute name="number:transliteration-format">壹</xsl:attribute>
+ <xsl:attribute name="number:transliteration-style">short</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="starts-with($number-format-unit,'[NatNum3]')">
+ <xsl:attribute name="number:transliteration-format">1</xsl:attribute>
+ <xsl:attribute name="number:transliteration-style">short</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="starts-with($number-format-unit,'[NatNum4]')">
+ <xsl:attribute name="number:transliteration-format">一</xsl:attribute>
+ <xsl:attribute name="number:transliteration-style">long</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="starts-with($number-format-unit,'[NatNum5]')">
+ <xsl:attribute name="number:transliteration-format">壹</xsl:attribute>
+ <xsl:attribute name="number:transliteration-style">long</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="starts-with($number-format-unit,'[NatNum6]')">
+ <xsl:attribute name="number:transliteration-format">1</xsl:attribute>
+ <xsl:attribute name="number:transliteration-style">long</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="starts-with($number-format-unit,'[NatNum7]')">
+ <xsl:attribute name="number:transliteration-format">一</xsl:attribute>
+ <xsl:attribute name="number:transliteration-style">medium</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="starts-with($number-format-unit,'[NatNum8]')">
+ <xsl:attribute name="number:transliteration-format">壹</xsl:attribute>
+ <xsl:attribute name="number:transliteration-style">medium</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="starts-with($number-format-unit,'[NatNum0]')">
+ <xsl:attribute name="number:transliteration-format">1</xsl:attribute>
+ <xsl:attribute name="number:transliteration-style">short</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="contains($number-format-unit,'[$-804]')">
+ <xsl:attribute name="number:transliteration-language">zh</xsl:attribute>
+ <xsl:attribute name="number:transliteration-country">CN</xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:key name="pz" match="/uof:UOF/uof:对象集/图:图形" use="@图:标识符"/>
+ <xsl:template match="表:批注" mode="body">
+ <xsl:element name="office:annotation">
+ <xsl:if test="@表:是å¦æ˜¾ç¤º = 'true'">
+ <xsl:attribute name="office:display">true</xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="draw:style-name"><xsl:value-of select="uof:锚点/@uof:图形引用"/></xsl:attribute>
+ <xsl:attribute name="svg:height"><xsl:value-of select="concat(uof:锚点/@uof:高度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:x"><xsl:value-of select="concat(uof:锚点/@uof:xåæ ‡,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:y"><xsl:value-of select="concat(uof:锚点/@uof:yåæ ‡,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:width"><xsl:value-of select="concat(uof:锚点/@uof:宽度,$uofUnit)"/></xsl:attribute>
+ <xsl:variable name="w">
+ <xsl:value-of select="./uof:锚点/@uof:图形引用"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="key('pz',$w)/图:文本内容/å­—:å¥/å­—:文本串">
+ <text:p>
+ <xsl:for-each select="key('pz',$w)/图:文本内容/å­—:å¥">
+ <text:span>
+ <xsl:if test="å­—:å¥å±žæ€§/@å­—:å¼æ ·å¼•ç”¨">
+ <xsl:attribute name="text:style-name"><xsl:value-of select="å­—:å¥å±žæ€§/@å­—:å¼æ ·å¼•ç”¨"/></xsl:attribute>
+ </xsl:if>
+ <xsl:value-of select="字:文本串"/>
+ </text:span>
+ </xsl:for-each>
+ </text:p>
+ </xsl:when>
+ </xsl:choose>
+ <!--xsl:if test="图:文本内容/å­—:段è½/å­—:å¥/å­—:文本串">
+ <text:p>
+ <xsl:call-template name="create-comment-data-content">
+ <xsl:with-param name="style-id" select="../@表:å¼æ ·å¼•ç”¨"/>
+ </xsl:call-template>
+ </text:p>
+ </xsl:if-->
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="auto-filter-condition">
+ <xsl:param name="conditon-set"/>
+ <xsl:param name="zone-left-column-num"/>
+ <xsl:if test="$conditon-set">
+ <xsl:variable name="first-condition" select="$conditon-set[1]"/>
+ <xsl:element name="table:filter-condition">
+ <xsl:attribute name="table:field-number"><xsl:value-of select="$first-condition/@表:åˆ—å· - $zone-left-column-num"/></xsl:attribute>
+ <xsl:attribute name="office:value"><xsl:choose><xsl:when test="$first-condition/表:普通"><xsl:value-of select="$first-condition/表:普通/@表:值"/></xsl:when><xsl:when test="$first-condition/表:自定义"><xsl:value-of select="$first-condition/表:自定义/表:æ“作æ¡ä»¶/表:值"/></xsl:when></xsl:choose></xsl:attribute>
+ <xsl:variable name="operator">
+ <xsl:choose>
+ <xsl:when test="$first-condition/表:普通">
+ <xsl:variable name="general" select="$first-condition/表:普通/@表:类型"/>
+ <xsl:choose>
+ <xsl:when test="$general ='topitem'">top values</xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$first-condition/表:自定义">
+ <xsl:variable name="operator-text" select="$first-condition/表:自定义/表:æ“作æ¡ä»¶/表:æ“作ç /text()"/>
+ <xsl:choose>
+ <xsl:when test="$operator-text ='less than'">&lt;</xsl:when>
+ <xsl:when test="$operator-text ='greater than'">&gt;</xsl:when>
+ <xsl:when test="$operator-text ='equal to'">
+ <xsl:value-of select="'='"/>
+ </xsl:when>
+ <xsl:when test="$operator-text ='greater than or equal to'">
+ <xsl:value-of select="'&gt;='"/>
+ </xsl:when>
+ <xsl:when test="$operator-text ='less than or equal to'">
+ <xsl:value-of select="'&lt;='"/>
+ </xsl:when>
+ <xsl:when test="$operator-text ='not equal to'">
+ <xsl:value-of select="'!='"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="table:operator"><xsl:value-of select="$operator"/></xsl:attribute>
+ </xsl:element>
+ <xsl:call-template name="auto-filter-condition">
+ <xsl:with-param name="conditon-set" select="$conditon-set[position()!=1]"/>
+ <xsl:with-param name="zone-left-column-num" select="$zone-left-column-num"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="translate-column-char-to-number">
+ <xsl:param name="string"/>
+ <xsl:choose>
+ <xsl:when test="string-length($string)=1">
+ <xsl:call-template name="char-to-number">
+ <xsl:with-param name="char" select="$string"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="tens-place">
+ <xsl:call-template name="char-to-number">
+ <xsl:with-param name="char" select="substring($string,1,1)"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="units-place">
+ <xsl:call-template name="char-to-number">
+ <xsl:with-param name="char" select="substring($string,2,1)"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="$tens-place * 26 + $units-place"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="char-to-number">
+ <xsl:param name="char"/>
+ <xsl:choose>
+ <xsl:when test="$char='A'">1</xsl:when>
+ <xsl:when test="$char='B'">2</xsl:when>
+ <xsl:when test="$char='C'">3</xsl:when>
+ <xsl:when test="$char='D'">4</xsl:when>
+ <xsl:when test="$char='E'">5</xsl:when>
+ <xsl:when test="$char='F'">6</xsl:when>
+ <xsl:when test="$char='G'">7</xsl:when>
+ <xsl:when test="$char='H'">8</xsl:when>
+ <xsl:when test="$char='I'">9</xsl:when>
+ <xsl:when test="$char='J'">10</xsl:when>
+ <xsl:when test="$char='K'">11</xsl:when>
+ <xsl:when test="$char='L'">12</xsl:when>
+ <xsl:when test="$char='M'">13</xsl:when>
+ <xsl:when test="$char='N'">14</xsl:when>
+ <xsl:when test="$char='O'">15</xsl:when>
+ <xsl:when test="$char='P'">16</xsl:when>
+ <xsl:when test="$char='Q'">17</xsl:when>
+ <xsl:when test="$char='R'">18</xsl:when>
+ <xsl:when test="$char='S'">19</xsl:when>
+ <xsl:when test="$char='T'">20</xsl:when>
+ <xsl:when test="$char='U'">21</xsl:when>
+ <xsl:when test="$char='V'">22</xsl:when>
+ <xsl:when test="$char='W'">23</xsl:when>
+ <xsl:when test="$char='X'">24</xsl:when>
+ <xsl:when test="$char='Y'">25</xsl:when>
+ <xsl:when test="$char='Z'">26</xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="translate-expression2">
+ <xsl:param name="expression2"/>
+ <xsl:choose>
+ <xsl:when test="contains($expression2,':')">
+ <xsl:variable name="column-one">
+ <xsl:value-of select="substring(substring-before($expression2,':'),1,1)"/>
+ </xsl:variable>
+ <xsl:variable name="row-one">
+ <xsl:value-of select="substring(substring-before($expression2,':'),2)"/>
+ </xsl:variable>
+ <xsl:variable name="column-two">
+ <xsl:value-of select="substring(substring-after($expression2,':'),1,1)"/>
+ </xsl:variable>
+ <xsl:variable name="row-two">
+ <xsl:value-of select="substring(substring-after($expression2,':'),2)"/>
+ </xsl:variable>
+ <xsl:variable name="column-value1">
+ <xsl:call-template name="character-to-column">
+ <xsl:with-param name="column-value" select="$column-one"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="column-value2">
+ <xsl:call-template name="character-to-column">
+ <xsl:with-param name="column-value" select="$column-two"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="concat('R',$row-one,'C',$column-value1,':','R',$row-two,'C',$column-value2)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="column-one">
+ <xsl:value-of select="substring($expression2,1,1)"/>
+ </xsl:variable>
+ <xsl:variable name="row-one">
+ <xsl:value-of select="substring($expression2,2)"/>
+ </xsl:variable>
+ <xsl:variable name="column-value1">
+ <xsl:call-template name="character-to-column">
+ <xsl:with-param name="column-value" select="$column-one"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="concat('R',$row-one,'C',$column-value1)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="character-to-column">
+ <xsl:param name="column-value"/>
+ <xsl:choose>
+ <xsl:when test="$column-value= 'A'">1</xsl:when>
+ <xsl:when test="$column-value= 'B'">2</xsl:when>
+ <xsl:when test="$column-value= 'C'">3</xsl:when>
+ <xsl:when test="$column-value= 'D'">4</xsl:when>
+ <xsl:when test="$column-value= 'E'">5</xsl:when>
+ <xsl:when test="$column-value= 'F'">6</xsl:when>
+ <xsl:when test="$column-value= 'G'">7</xsl:when>
+ <xsl:when test="$column-value= 'H'">8</xsl:when>
+ <xsl:when test="$column-value= 'I'">9</xsl:when>
+ <xsl:when test="$column-value= 'J'">10</xsl:when>
+ <xsl:when test="$column-value= 'K'">11</xsl:when>
+ <xsl:when test="$column-value= 'L'">12</xsl:when>
+ <xsl:when test="$column-value= 'M'">13</xsl:when>
+ <xsl:when test="$column-value= 'N'">14</xsl:when>
+ <xsl:when test="$column-value= 'O'">15</xsl:when>
+ <xsl:when test="$column-value= 'P'">16</xsl:when>
+ <xsl:when test="$column-value= 'Q'">17</xsl:when>
+ <xsl:when test="$column-value= 'R'">18</xsl:when>
+ <xsl:when test="$column-value= 'S'">19</xsl:when>
+ <xsl:when test="$column-value= 'T'">20</xsl:when>
+ <xsl:when test="$column-value= 'U'">21</xsl:when>
+ <xsl:when test="$column-value= 'V'">22</xsl:when>
+ <xsl:when test="$column-value= 'W'">23</xsl:when>
+ <xsl:when test="$column-value= 'X'">24</xsl:when>
+ <xsl:when test="$column-value= 'Y'">25</xsl:when>
+ <xsl:when test="$column-value= 'Z'">26</xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:template>
+ <!--chenjh end 20050611-->
+ <xsl:template name="工作表属性">
+ <!--office:settings-->
+ <xsl:variable name="sheetprop" select="/uof:UOF/uof:电å­è¡¨æ ¼/表:主体/表:工作表"/>
+ <config:config-item-set config:name="ooo:view-settings">
+ <xsl:variable name="ratio" select="15"/>
+ <xsl:if test="/uof:UOF/uof:电å­è¡¨æ ¼/表:主体/表:工作表/表:工作表内容/表:è¡Œ/表:å•å…ƒæ ¼/表:æ•°æ®/å­—:å¥/å­—:修订开始">
+ <config:config-item-set config:name="TrackedChangesViewSettings">
+ <config:config-item config:name="ShowChanges" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="ShowAcceptedChanges" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="ShowRejectedChanges" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="ShowChangesByDatetime" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="ShowChangesByDatetimeMode" config:type="short">0</config:config-item>
+ <config:config-item config:name="ShowChangesByDatetimeFirstDatetime" config:type="datetime">2007-01-17T10:56:46.21</config:config-item>
+ <config:config-item config:name="ShowChangesByDatetimeSecondDatetime" config:type="datetime">2007-01-17T10:56:46.21</config:config-item>
+ <config:config-item config:name="ShowChangesByAuthor" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="ShowChangesByAuthorName" config:type="string"/>
+ <config:config-item config:name="ShowChangesByComment" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="ShowChangesByCommentText" config:type="string"/>
+ <config:config-item config:name="ShowChangesByRanges" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="ShowChangesByRangesList" config:type="string"/>
+ </config:config-item-set>
+ </xsl:if>
+ <config:config-item-map-indexed config:name="Views">
+ <config:config-item-map-entry>
+ <config:config-item config:name="ViewId" config:type="string">View1</config:config-item>
+ <config:config-item-map-named config:name="Tables">
+ <xsl:for-each select="$sheetprop/表:工作表属性/表:视图">
+ <xsl:element name="config:config-item-map-entry">
+ <xsl:attribute name="config:name"><xsl:value-of select="ancestor::表:工作表/@表:å称"/></xsl:attribute>
+ <xsl:element name="config:config-item">
+ <xsl:attribute name="config:name">HorizontalSplitMode</xsl:attribute>
+ <xsl:attribute name="config:type">short</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="表:冻结 and 表:冻结/@表:列å·!=0">2</xsl:when>
+ <xsl:when test="表:冻结 and 表:冻结/@表:列å·=0">0</xsl:when>
+ <xsl:when test="表:拆分 and 表:拆分/@表:宽度!=0">1</xsl:when>
+ <xsl:when test="表:拆分 and 表:拆分/@表:宽度=0">0</xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:element name="config:config-item">
+ <xsl:attribute name="config:name">VerticalSplitMode</xsl:attribute>
+ <xsl:attribute name="config:type">short</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="表:冻结 and 表:冻结/@表:è¡Œå·!=0">2</xsl:when>
+ <xsl:when test="表:冻结 and 表:冻结/@表:è¡Œå·=0">0</xsl:when>
+ <xsl:when test="表:拆分 and 表:拆分/@表:高度!=0">1</xsl:when>
+ <xsl:when test="表:拆分 and 表:拆分/@表:高度=0">0</xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:element name="config:config-item">
+ <xsl:attribute name="config:name">HorizontalSplitPosition</xsl:attribute>
+ <xsl:attribute name="config:type">int</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="表:冻结 and 表:冻结/@表:列å·=0">0</xsl:when>
+ <xsl:when test="表:冻结 and 表:冻结/@表:列å·!=0">
+ <xsl:value-of select="表:冻结/@表:列å·"/>
+ </xsl:when>
+ <xsl:when test="表:拆分 and 表:拆分/@表:宽度=0">0</xsl:when>
+ <xsl:when test="表:拆分 and 表:拆分/@表:宽度!=0">
+ <xsl:value-of select="表:拆分/@表:宽度"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:element name="config:config-item">
+ <xsl:attribute name="config:name">VerticalSplitPosition</xsl:attribute>
+ <xsl:attribute name="config:type">int</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="表:冻结 and 表:冻结/@表:è¡Œå·=0">0</xsl:when>
+ <xsl:when test="表:冻结 and 表:冻结/@表:è¡Œå·!=0">
+ <xsl:value-of select="表:冻结/@表:è¡Œå·"/>
+ </xsl:when>
+ <xsl:when test="表:拆分 and 表:拆分/@表:高度=0">0</xsl:when>
+ <xsl:when test="表:拆分 and 表:拆分/@表:高度!=0">
+ <xsl:value-of select="表:拆分/@表:高度"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:variable name="position-top">
+ <xsl:choose>
+ <xsl:when test="$sheetprop/表:工作表属性/表:视图/表:最上行">
+ <xsl:value-of select="//表:工作表属性/表:视图/表:最上行"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="position-left">
+ <xsl:choose>
+ <xsl:when test="$sheetprop/表:工作表属性/表:视图/表:最左列">
+ <xsl:value-of select="$sheetprop/表:工作表属性/表:视图/表:最左列"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <config:config-item config:name="PositionRight" config:type="int">
+ <xsl:value-of select="$position-left"/>
+ </config:config-item>
+ <config:config-item config:name="PositionBottom" config:type="int">
+ <xsl:value-of select="$position-top"/>
+ </config:config-item>
+ </xsl:element>
+ </xsl:for-each>
+ </config:config-item-map-named>
+ <xsl:if test="$sheetprop/表:工作表属性/表:视图/表:当å‰è§†å›¾">
+ <xsl:element name="config:config-item">
+ <xsl:attribute name="config:name">ShowPageBreakPreview</xsl:attribute>
+ <xsl:attribute name="config:type">boolean</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="$sheetprop/表:工作表属性/表:视图/表:当å‰è§†å›¾/@表:类型='normal'">false</xsl:when>
+ <xsl:otherwise>true</xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="$sheetprop/表:工作表属性/表:视图/表:网格">
+ <xsl:element name="config:config-item">
+ <xsl:attribute name="config:name">ShowGrid</xsl:attribute>
+ <xsl:attribute name="config:type">boolean</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="$sheetprop/表:工作表属性/表:视图/表:网格/@表:值=1 or $sheetprop/表:工作表属性/表:视图/表:网格/@表:值='true'">true</xsl:when>
+ <xsl:otherwise>false</xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="$sheetprop/表:工作表属性/表:视图/表:网格颜色">
+ <xsl:element name="config:config-item">
+ <xsl:attribute name="config:name">GridColor</xsl:attribute>
+ <xsl:attribute name="config:type">long</xsl:attribute>
+ <xsl:call-template name="transform-hex-to-decimal">
+ <xsl:with-param name="number" select="//表:视图/表:网格颜色/text()"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="$sheetprop/表:工作表属性/表:视图/表:选中">
+ <xsl:element name="config:config-item">
+ <xsl:attribute name="config:name">ActiveTable</xsl:attribute>
+ <xsl:attribute name="config:type">string</xsl:attribute>
+ <xsl:value-of select="$sheetprop/表:工作表属性/表:视图[表:选中]/ancestor::表:工作表/@表:å称"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="$sheetprop/表:工作表属性/表:视图/表:缩放">
+ <config:config-item config:name="ZoomValue" config:type="int">
+ <xsl:value-of select="$sheetprop/表:工作表属性/表:视图/表:缩放/text()"/>
+ </config:config-item>
+ </xsl:if>
+ <xsl:if test="$sheetprop/表:工作表属性/表:视图/表:分页缩放">
+ <config:config-item config:name="PageViewZoomValue" config:type="int">
+ <xsl:value-of select="$sheetprop/表:工作表属性/表:视图/表:分页缩放/text()"/>
+ </config:config-item>
+ </xsl:if>
+ </config:config-item-map-entry>
+ </config:config-item-map-indexed>
+ </config:config-item-set>
+ </xsl:template>
+ <xsl:template name="create-page-master">
+ <xsl:param name="worksheetoptions"/>
+ <xsl:for-each select="$worksheetoptions">
+ <xsl:element name="style:page-layout">
+ <xsl:attribute name="style:name"><xsl:call-template name="encode-as-nc-name"><xsl:with-param name="string" select="concat( 'pm_', ../@表:å称)"/></xsl:call-template></xsl:attribute>
+ <xsl:element name="style:page-layout-properties">
+ <xsl:if test="表:页é¢è®¾ç½®/表:纸张/@uof:宽度">
+ <xsl:attribute name="fo:page-width"><xsl:value-of select="concat(表:页é¢è®¾ç½®/表:纸张/@uof:宽度,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="表:页é¢è®¾ç½®/表:纸张/@uof:高度">
+ <xsl:attribute name="fo:page-height"><xsl:value-of select="concat(表:页é¢è®¾ç½®/表:纸张/@uof:高度,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="表:页é¢è®¾ç½®/表:纸张方å‘">
+ <xsl:attribute name="style:print-orientation"><xsl:value-of select="表:页é¢è®¾ç½®/表:纸张方å‘"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="表:页é¢è®¾ç½®/表:缩放">
+ <xsl:attribute name="style:scale-to"><xsl:value-of select="concat(表:页é¢è®¾ç½®/表:缩放,'%')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="/uof:UOF/uof:电å­è¡¨æ ¼/表:主体/表:工作表/@表:背景">
+ <xsl:attribute name="fo:background-color"><xsl:value-of select="/uof:UOF/uof:电å­è¡¨æ ¼/表:主体/表:工作表/@表:背景"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="style:first-page-number">continue</xsl:attribute>
+ <xsl:if test="表:页é¢è®¾ç½®/表:页边è·">
+ <xsl:attribute name="fo:margin-top"><xsl:value-of select="concat(表:页é¢è®¾ç½®/表:页边è·/@uof:上,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:margin-bottom"><xsl:value-of select="concat(表:页é¢è®¾ç½®/表:页边è·/@uof:下,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:margin-left"><xsl:value-of select="concat(表:页é¢è®¾ç½®/表:页边è·/@uof:å·¦,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:margin-right"><xsl:value-of select="concat(表:页é¢è®¾ç½®/表:页边è·/@uof:å³,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="表:页é¢è®¾ç½®/表:打å°/@表:先列åŽè¡Œ='true'">
+ <xsl:attribute name="style:print-page-order">ltr</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="表:页é¢è®¾ç½®/表:垂直对é½/@表:对é½æ–¹å¼">
+ <xsl:attribute name="style:table-centering">vertical</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="表:页é¢è®¾ç½®/表:水平对é½/@表:对é½æ–¹å¼">
+ <xsl:attribute name="style:table-centering">horizontal</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:element name="style:header-style">
+ <xsl:element name="style:header-footer-properties">
+ <xsl:attribute name="fo:min-height">0.75cm</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="表:页é¢è®¾ç½®/表:页眉页脚/@uof:è¾¹è·">
+ <xsl:attribute name="fo:margin-bottom"><xsl:call-template name="convert2cm"><xsl:with-param name="value" select="concat(表:页é¢è®¾ç½®/表:页眉页脚/@uof:è¾¹è·,'pt')"/></xsl:call-template><xsl:text>cm</xsl:text></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:margin-bottom">0.25cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:element>
+ <xsl:element name="style:footer-style">
+ <xsl:element name="style:header-footer-properties">
+ <xsl:attribute name="fo:min-height">0.75cm</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="表:页é¢è®¾ç½®/表:页眉页脚/@uof:è¾¹è·">
+ <xsl:attribute name="fo:margin-top"><xsl:call-template name="convert2cm"><xsl:with-param name="value" select="concat(表:页é¢è®¾ç½®/表:页眉页脚/@uof:è¾¹è·,'pt')"/></xsl:call-template><xsl:text>cm</xsl:text></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:margin-top">0.25cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:element>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template match="字:文本串">
+ <xsl:value-of select="text()"/>
+ </xsl:template>
+ <xsl:template match="å­—:æ¢è¡Œç¬¦">
+ <xsl:element name="text:line-break"/>
+ </xsl:template>
+ <xsl:template match="字:制表符">
+ <xsl:element name="text:tab-stop"/>
+ </xsl:template>
+ <xsl:template match="字:区域开始">
+ <xsl:if test="@字:类型='hyperlink'">
+ <xsl:variable name="superlink" select="//uof:超级链接[@uof:标识符=current()/@字:标识符]"/>
+ <xsl:element name="text:a">
+ <xsl:attribute name="xlink:href"><xsl:value-of select="$superlink/@uof:目标"/></xsl:attribute>
+ <xsl:value-of select="$superlink/@uof:æ示"/>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="字:空格符">
+ <xsl:element name="text:s">
+ <xsl:if test="@字:个数">
+ <xsl:attribute name="text:c"><xsl:value-of select="@字:个数"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="create-page-header-footer-text-p">
+ <xsl:param name="paragragh-set"/>
+ <xsl:choose>
+ <xsl:when test="$paragragh-set">
+ <xsl:element name="text:p">
+ <xsl:for-each select="$paragragh-set[1]/å­—:å¥">
+ <xsl:choose>
+ <xsl:when test="not(å­—:å¥å±žæ€§)">
+ <xsl:apply-templates select="å­—:文本串 | å­—:空格符 | å­—:æ¢è¡Œç¬¦"/>
+ </xsl:when>
+ <xsl:when test="å­—:å¥å±žæ€§">
+ <xsl:element name="text:span">
+ <xsl:attribute name="text:style-name"><xsl:value-of select="//uof:å¥å¼æ ·[@å­—:标识符=current()/å­—:å¥å±žæ€§/@å­—:å¼æ ·å¼•ç”¨]/@å­—:å称"/></xsl:attribute>
+ <xsl:apply-templates select="å­—:空格符 | å­—:文本串 | å­—:æ¢è¡Œç¬¦ | å­—:制表符"/>
+ </xsl:element>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:element>
+ <xsl:call-template name="create-page-header-footer-text-p">
+ <xsl:with-param name="paragragh-set" select="$paragragh-set[position()!=1]"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:template>
+ <!--Redoffice comment lilliang SC0016 06.02.16 -->
+ <!--新增内容-->
+ <xsl:template match="å­—:段è½">
+ <xsl:element name="text:p">
+ <xsl:choose>
+ <xsl:when test="å­—:段è½å±žæ€§">
+ <xsl:attribute name="text:style-name">P<xsl:number from="/uof:UOF/uof:文字处ç†/å­—:主体" level="any" count="å­—:段è½[å­—:段è½å±žæ€§]"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="generate-id(ancestor::å­—:主体/descendant::å­—:段è½[1]) = generate-id(.)">
+ <!-- create the leading paragraph style name in one section for master page style application, glu -->
+ <xsl:variable name="paragraph-number">
+ <xsl:number from="/uof:UOF/uof:文字处ç†/å­—:主体" level="any" count="å­—:段è½[å­—:段è½å±žæ€§]"/>
+ </xsl:variable>
+ <xsl:attribute name="text:style-name">P<xsl:value-of select="number($paragraph-number)"/>_1</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="not(å­—:段è½å±žæ€§) and (descendant::å­—:分æ ç¬¦ or ancestor::å­—:分节/descendant::å­—:节属性[å­—:分æ /@å­—:æ æ•° &gt; 1])">
+ <xsl:attribute name="text:style-name">ColumnBreakPara</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="å­—:å¥">
+ <xsl:apply-templates select="å­—:å¥/å­—:文本串"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:template>
+ <!--Redoffice comment liliang end 06.02.16-->
+ <xsl:template name="create-master-styles">
+ <xsl:param name="worksheetoptions"/>
+ <xsl:for-each select="$worksheetoptions">
+ <xsl:element name="style:master-page">
+ <xsl:attribute name="style:name"><xsl:call-template name="encode-as-nc-name"><xsl:with-param name="string" select="concat( 'TAB_', ../@表:å称)"/></xsl:call-template></xsl:attribute>
+ <!--xsl:attribute name="style:page-layout-name"-->
+ <xsl:attribute name="style:page-layout-name"><xsl:call-template name="encode-as-nc-name"><xsl:with-param name="string" select="concat( 'pm_', ../@表:å称)"/></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="style:display-name"><xsl:value-of select="concat( 'PageStyle_', ../@表:å称)"/></xsl:attribute>
+ <style:header>
+ <xsl:for-each select="表:页é¢è®¾ç½®/表:页眉页脚">
+ <xsl:variable name="temp" select="@表:ä½ç½®"/>
+ <xsl:choose>
+ <xsl:when test="contains($temp,'header')">
+ <xsl:if test="å­—:段è½">
+ <xsl:choose>
+ <xsl:when test="@表:ä½ç½®='headerleft'">
+ <xsl:element name="style:region-left">
+ <xsl:call-template name="create-page-header-footer-text-p">
+ <xsl:with-param name="paragragh-set" select="å­—:段è½"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="@表:ä½ç½®='headercenter'">
+ <xsl:element name="style:region-center">
+ <xsl:call-template name="create-page-header-footer-text-p">
+ <xsl:with-param name="paragragh-set" select="å­—:段è½"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="@表:ä½ç½®='headerright'">
+ <xsl:element name="style:region-right">
+ <xsl:call-template name="create-page-header-footer-text-p">
+ <xsl:with-param name="paragragh-set" select="å­—:段è½"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:for-each>
+ </style:header>
+ <style:footer>
+ <xsl:for-each select="表:页é¢è®¾ç½®/表:页眉页脚">
+ <xsl:variable name="temp" select="@表:ä½ç½®"/>
+ <xsl:choose>
+ <xsl:when test="contains($temp,'footer')">
+ <xsl:if test="å­—:段è½">
+ <xsl:choose>
+ <xsl:when test="@表:ä½ç½®='footerleft'">
+ <xsl:element name="style:region-left">
+ <xsl:call-template name="create-page-header-footer-text-p">
+ <xsl:with-param name="paragragh-set" select="å­—:段è½"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="@表:ä½ç½®='footercenter'">
+ <xsl:element name="style:region-center">
+ <xsl:call-template name="create-page-header-footer-text-p">
+ <xsl:with-param name="paragragh-set" select="å­—:段è½"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="@表:ä½ç½®='footerright'">
+ <xsl:element name="style:region-right">
+ <xsl:call-template name="create-page-header-footer-text-p">
+ <xsl:with-param name="paragragh-set" select="å­—:段è½"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:for-each>
+ </style:footer>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:template>
+ <!--xsl:template name="create-page-master">
+ </xsl:template>
+ <xsl:template match="表:页é¢è®¾ç½®">
+ </xsl:template>
+
+ <xsl:template name="create-master-styles">
+ </xsl:template>
+ <xsl:template name="表:工作表属性">
+ </xsl:template-->
+ <!--00000000000-->
+ <xsl:template match="uof:元数æ®">
+ <office:meta>
+ <xsl:if test="uof:创建应用程åº">
+ <meta:generator>
+ <xsl:value-of select="uof:创建应用程åº"/>
+ </meta:generator>
+ </xsl:if>
+ <xsl:if test="uof:标题">
+ <dc:title>
+ <xsl:value-of select="uof:标题"/>
+ </dc:title>
+ </xsl:if>
+ <xsl:if test="uof:摘è¦">
+ <dc:description>
+ <xsl:value-of select="uof:摘è¦"/>
+ </dc:description>
+ </xsl:if>
+ <xsl:if test="uof:主题">
+ <dc:subject>
+ <xsl:value-of select="uof:主题"/>
+ </dc:subject>
+ </xsl:if>
+ <xsl:if test="uof:作者">
+ <meta:initial-creator>
+ <xsl:value-of select="uof:作者"/>
+ </meta:initial-creator>
+ </xsl:if>
+ <xsl:if test="uof:创建日期">
+ <meta:creation-date>
+ <xsl:value-of select="uof:创建日期"/>
+ </meta:creation-date>
+ </xsl:if>
+ <xsl:if test="uof:最åŽä½œè€…">
+ <dc:creator>
+ <xsl:value-of select="uof:最åŽä½œè€…"/>
+ </dc:creator>
+ </xsl:if>
+ <xsl:if test="uof:编辑时间">
+ <meta:editing-duration>
+ <xsl:value-of select="uof:编辑时间"/>
+ </meta:editing-duration>
+ </xsl:if>
+ <dc:language/>
+ <meta:keyword>
+ <xsl:value-of select="uof:关键字集/uof:关键字"/>
+ </meta:keyword>
+ <xsl:if test="uof:编辑次数">
+ <meta:editing-cycles>
+ <xsl:value-of select="uof:编辑次数"/>
+ </meta:editing-cycles>
+ </xsl:if>
+ <xsl:if test="uof:分类">
+ <meta:user-defined meta:name="Category">
+ <xsl:value-of select="uof:分类"/>
+ </meta:user-defined>
+ </xsl:if>
+ <xsl:if test="uof:ç»ç†å称">
+ <meta:user-defined meta:name="Manager">
+ <xsl:value-of select="uof:ç»ç†å称"/>
+ </meta:user-defined>
+ </xsl:if>
+ <xsl:if test="uof:å…¬å¸å称">
+ <meta:user-defined meta:name="Company">
+ <xsl:value-of select="uof:å…¬å¸å称"/>
+ </meta:user-defined>
+ </xsl:if>
+ <xsl:apply-templates select="uof:用户自定义元数æ®é›†"/>
+ </office:meta>
+ </xsl:template>
+ <xsl:template match="uof:用户自定义元数æ®é›†">
+ <xsl:for-each select="uof:用户自定义元数æ®">
+ <meta:user-defined meta:name="{@uof:å称}">
+ <xsl:value-of select="."/>
+ </meta:user-defined>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="parse-range">
+ <xsl:param name="range-value"/>
+ <xsl:param name="last"/>
+ <xsl:variable name="first-pit">
+ <xsl:choose>
+ <xsl:when test="contains($range-value,',')">
+ <xsl:value-of select="substring-before($range-value,',')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$range-value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="current">
+ <xsl:choose>
+ <xsl:when test="contains($first-pit,':')">
+ <xsl:variable name="R-start" select="substring-before(substring-after($first-pit,'R'),'C')"/>
+ <xsl:variable name="C-start" select="substring-before(substring-after($first-pit,'C'),':')"/>
+ <xsl:variable name="second-pit" select="substring-after($first-pit,':')"/>
+ <xsl:variable name="R-end" select="substring-before(substring-after($second-pit,'R'),'C')"/>
+ <xsl:variable name="C-end" select="substring-after($second-pit,'C')"/>
+ <xsl:variable name="the-str">
+ <xsl:call-template name="condition-rc-str">
+ <xsl:with-param name="r-start" select="$R-start"/>
+ <xsl:with-param name="r-end" select="$R-end"/>
+ <xsl:with-param name="c-start" select="$C-start"/>
+ <xsl:with-param name="c-end" select="$C-end"/>
+ <xsl:with-param name="last" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="$the-str"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat($first-pit,',')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="contains($range-value,',')">
+ <xsl:call-template name="parse-range">
+ <xsl:with-param name="range-value" select="substring-after($range-value,',')"/>
+ <xsl:with-param name="last" select="concat($last,$current)"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat($last,$current)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="condition-rc-str">
+ <!-- dealing the range of row\column -->
+ <xsl:param name="r-start"/>
+ <xsl:param name="r-end"/>
+ <xsl:param name="c-start"/>
+ <xsl:param name="c-end"/>
+ <xsl:param name="last"/>
+ <xsl:variable name="current">
+ <xsl:call-template name="condition-c-str">
+ <xsl:with-param name="rc-str" select="concat('R',$r-start)"/>
+ <xsl:with-param name="start" select="$c-start"/>
+ <xsl:with-param name="end" select="$c-end"/>
+ <xsl:with-param name="last" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="$r-start &lt; $r-end">
+ <xsl:call-template name="condition-rc-str">
+ <xsl:with-param name="r-start" select="$r-start + 1"/>
+ <xsl:with-param name="r-end" select="$r-end"/>
+ <xsl:with-param name="c-start" select="$c-start"/>
+ <xsl:with-param name="c-end" select="$c-end"/>
+ <xsl:with-param name="last" select="concat($last,$current)"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="$r-start = $r-end">
+ <xsl:value-of select="concat($last,$current)"/>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="condition-c-str">
+ <!-- return value for the template condition-rc-str -->
+ <xsl:param name="rc-str"/>
+ <xsl:param name="start"/>
+ <xsl:param name="end"/>
+ <xsl:param name="last"/>
+ <xsl:variable name="current" select="concat($rc-str,'C',$start,',')"/>
+ <xsl:if test="$start &lt; $end">
+ <xsl:call-template name="condition-c-str">
+ <xsl:with-param name="rc-str" select="$rc-str"/>
+ <xsl:with-param name="start" select="$start + 1"/>
+ <xsl:with-param name="end" select="$end"/>
+ <xsl:with-param name="last" select="concat($last,$current)"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="$start = $end">
+ <xsl:value-of select="concat($last,$current)"/>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="condition-str">
+ <xsl:param name="param-str"/>
+ <xsl:choose>
+ <xsl:when test="contains($param-str,'(')">
+ <xsl:call-template name="condition-str">
+ <xsl:with-param name="param-str" select="substring-after($param-str,'(')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-before($param-str,':')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="encode-as-cell-range-address">
+ <xsl:param name="string"/>
+ <xsl:value-of select="$string"/>
+ </xsl:template>
+ <xsl:template name="encode-as-cell-address">
+ <xsl:param name="string"/>
+ <xsl:value-of select="$string"/>
+ </xsl:template>
+ <!--chengxiuzhi 111111111111111111111111111111111111111111111111111111111111111-->
+ <!-- measure_conversion.xsl Begin-->
+ <xsl:param name="dpi" select="111"/>
+ <xsl:param name="centimeter-in-mm" select="10"/>
+ <xsl:param name="inch-in-mm" select="25.4"/>
+ <xsl:param name="didot-point-in-mm" select="0.376065"/>
+ <xsl:param name="pica-in-mm" select="4.2333333"/>
+ <xsl:param name="point-in-mm" select="0.3527778"/>
+ <xsl:param name="twip-in-mm" select="0.017636684"/>
+ <xsl:param name="pixel-in-mm" select="$inch-in-mm div $dpi"/>
+ <!-- ***** MEASUREMENT CONVERSIONS *****
+ PARAM 'value'
+ The measure to be converted.
+ The current measure is judged by a substring (e.g. 'mm', 'cm', 'in', 'pica'...)
+ directly added to the number.
+
+ PARAM 'rounding-factor'
+ Is used for the rounding of decimal places.
+ The parameter number is the product of 1 and some '10', where
+ every zero represents a decimal place.
+
+ For example, providing as parameter:
+ <xsl:param name="rounding-factor" select="10000" />
+ Gives by default four decimal places.
+
+ To round two decimal places, basically the following is done:
+ <xsl:value-of select="round(100 * value) div 100"/>
+
+ RETURN The converted number, by default rounded to four decimal places.
+ In case the input measure could not be matched the same value is
+ returned and a warning message is written out.
+
+
+
+ MEASURE LIST:
+ * 1 milimeter (mm), the basic measure
+
+ * 1 centimeter (cm) = 10 mm
+
+ * 1 inch (in) = 25.4 mm
+ While the English have already seen the light (read: the metric system), the US
+ remains loyal to this medieval system.
+
+ * 1 point (pt) = 0.35277777.. mm
+ Sometimes called PostScript point (ppt), as when Adobe created PostScript, they added their own system of points.
+ There are exactly 72 PostScript points in 1 inch.
+
+ * 1 twip = twentieth of a (PostScript) point
+ A twip (twentieth of a point) is a 1/20th of a PostScript point, a traditional measure in printing.
+
+ * 1 didot point (dpt) = 0.376065 mm
+ Didot point after the French typographer Firmin Didot (1764-1836).
+
+ More details under
+ http://www.unc.edu/~rowlett/units/dictP.html:
+ "A unit of length used by typographers and printers. When printing was done
+ from hand-set metal type, one point represented the smallest element of type
+ that could be handled, roughly 1/64 inch. Eventually, the point was standardized
+ in Britain and America as exactly 1/72.27 = 0.013 837 inch, which is
+ about 0.35 mm (351.46 micrometers). In continental Europe, typographers
+ traditionally used a slightly larger point of 0.014 83 inch (about
+ 1/72 pouce, 0.377 mm, or roughly 1/67 English inch), called a Didot point
+ after the French typographer Firmin Didot (1764-1836). In the U.S.,
+ Adobe software defines the point to be exactly 1/72 inch (0.013 888 9 inch
+ or 0.352 777 8 millimeters) and TeX software uses a slightly smaller point
+ of 0.351 459 8035 mm. The German standards agency DIN has proposed that
+ all these units be replaced by multiples of 0.25 millimeters (1/101.6 inch).
+
+ * 1 pica = 4.233333 mm
+ 1/6 inch or 12 points
+
+ * 1 pixel (px) = 0.26458333.. mm (relative to 'DPI', here: 96 dpi)
+ Most pictures have the 96 dpi resolution, but the dpi variable may vary by stylesheet parameter
+
+
+ -->
+ <!-- changing measure to mm -->
+ <xsl:template name="convert2mm">
+ <xsl:param name="value"/>
+ <xsl:param name="rounding-factor" select="10000"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="substring-before($value, 'mm')"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'cm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm' ) * $centimeter-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in' ) * $inch-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') * $point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') * $twip-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') * $didot-point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') * $pica-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') * $pixel-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'mm'!</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- changing measure to cm -->
+ <xsl:template name="convert2cm">
+ <xsl:param name="value"/>
+ <xsl:param name="rounding-factor" select="10000"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $centimeter-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'cm')">
+ <xsl:value-of select="substring-before($value, 'cm')"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $centimeter-in-mm * $inch-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $centimeter-in-mm * $point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $centimeter-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $centimeter-in-mm * $pica-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $centimeter-in-mm * $twip-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $centimeter-in-mm * $pixel-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'cm'!</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- changing measure to inch (cp. section comment) -->
+ <xsl:template name="convert2in">
+ <xsl:param name="value"/>
+ <xsl:param name="rounding-factor" select="10000"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $inch-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'cm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $inch-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="substring-before($value, 'in')"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $inch-in-mm * $point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $inch-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $inch-in-mm * $pica-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $inch-in-mm * $twip-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $inch-in-mm * $pixel-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'in'!</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- changing measure to dpt (cp. section comment) -->
+ <xsl:template name="convert2dpt">
+ <xsl:param name="value"/>
+ <xsl:param name="rounding-factor" select="10000"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $didot-point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'cm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $didot-point-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $didot-point-in-mm * $inch-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $didot-point-in-mm * $point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="substring-before($value, 'dpt')"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $didot-point-in-mm * $pica-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $didot-point-in-mm * $twip-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $didot-point-in-mm * $pixel-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'dpt'!</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- changing measure to pica (cp. section comment) -->
+ <xsl:template name="convert2pica">
+ <xsl:param name="value"/>
+ <xsl:param name="rounding-factor" select="10000"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $pica-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'cm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $pica-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $pica-in-mm * $inch-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $pica-in-mm * $point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $pica-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="substring-before($value, 'pica')"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $pica-in-mm * $twip-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $pica-in-mm * $pixel-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'pica'!</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- changing measure to pt (cp. section comment) -->
+ <xsl:template name="convert2pt">
+ <xsl:param name="value"/>
+ <xsl:param name="rounding-factor" select="10000"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'cm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $point-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $point-in-mm * $inch-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="substring-before($value, 'pt')"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $point-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $point-in-mm * $pica-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $point-in-mm * $twip-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $point-in-mm * $pixel-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'pt'!</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- changing measure to pt (cp. section comment) -->
+ <xsl:template name="convert2twip">
+ <xsl:param name="value"/>
+ <xsl:param name="rounding-factor" select="10000"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $twip-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'cm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $twip-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $twip-in-mm * $inch-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $twip-in-mm * $point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $twip-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $twip-in-mm * $pica-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="substring-before($value, 'twip')"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $twip-in-mm * $pixel-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'twip'!</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- changing measure to pixel by via parameter provided dpi (dots per inch) standard factor (cp. section comment) -->
+ <xsl:template name="convert2px">
+ <xsl:param name="value"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="round(number(substring-before($value, 'mm')) div $pixel-in-mm)"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'cm')">
+ <xsl:value-of select="round(number(substring-before($value, 'cm')) div $pixel-in-mm * $centimeter-in-mm)"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="round(number(substring-before($value, 'in')) div $pixel-in-mm * $inch-in-mm)"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="round(number(substring-before($value, 'pt')) div $pixel-in-mm * $point-in-mm)"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="round(number(substring-before($value, 'dpt')) div $pixel-in-mm * $didot-point-in-mm)"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="round(number(substring-before($value, 'pica')) div $pixel-in-mm * $pica-in-mm)"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="round(number(substring-before($value, 'twip')) div $pixel-in-mm * $twip-in-mm)"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="$value"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'px'!</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- chenjh zhangying-->
+ <xsl:template name="create-content-validations">
+ <xsl:param name="validation-set"/>
+ <xsl:if test="$validation-set">
+ <xsl:variable name="first-validation" select="$validation-set[1]"/>
+ <xsl:variable name="condition-text">
+ <xsl:choose>
+ <xsl:when test="$first-validation/表:校验类型/text()='whole number'">
+ <xsl:choose>
+ <xsl:when test="$first-validation/表:æ“作ç /text()='between' ">
+ <xsl:value-of select="concat('oooc:cell-content-is-whole-number() and cell-content-is-between','(',$first-validation/表:第一æ“作数/text(),',',$first-validation/表:第二æ“作数/text(),')')"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:æ“作ç /text()='not between'">
+ <xsl:value-of select="concat('oooc:cell-content-is-whole-number() and cell-content-is-not-between','(',$first-validation/表:第一æ“作数/text(),',',$first-validation/表:第二æ“作数/text(),')')"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:æ“作ç /text()='equal to'">
+ <xsl:value-of select="concat('oooc:cell-content-is-whole-number() and cell-content()=',$first-validation/表:第一æ“作数/text())"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:æ“作ç /text()='not equal to'">
+ <xsl:value-of select="concat('oooc:cell-content-is-whole-number() and cell-content()!=',$first-validation/表:第一æ“作数/text())"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:æ“作ç /text()='greater than'">
+ <xsl:value-of select="concat('oooc:cell-content-is-whole-number() and cell-content()&gt;',$first-validation/表:第一æ“作数/text())"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:æ“作ç /text()='less than'">
+ <xsl:value-of select="concat('oooc:cell-content-is-whole-number() and cell-content()&lt;',$first-validation/表:第一æ“作数/text())"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:æ“作ç /text()='greater than or equal to'">
+ <xsl:value-of select="concat('oooc:cell-content-is-whole-number() and cell-content()&gt;=',$first-validation/表:第一æ“作数/text())"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:æ“作ç /text()='less than or equal to'">
+ <xsl:value-of select="concat('oooc:cell-content-is-whole-number() and cell-content()&lt;=',$first-validation/表:第一æ“作数/text())"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:校验类型/text()='decimal'">
+ <xsl:choose>
+ <xsl:when test="$first-validation/表:æ“作ç /text()='between' ">
+ <xsl:value-of select="concat('oooc:cell-content-is-decimal-number() and cell-content-is-between','(',$first-validation/表:第一æ“作数/text(),',',$first-validation/表:第二æ“作数/text(),')')"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:æ“作ç /text()='not between'">
+ <xsl:value-of select="concat('oooc:cell-content-is-decimal-number() and cell-content-is-not-between','(',$first-validation/表:第一æ“作数/text(),',',$first-validation/表:第二æ“作数/text(),')')"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:æ“作ç /text()='equal to'">
+ <xsl:value-of select="concat('oooc:cell-content-is-decimal-number() and cell-content()=',$first-validation/表:第一æ“作数/text())"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:æ“作ç /text()='not equal to'">
+ <xsl:value-of select="concat('oooc:cell-content-is-decimal-number() and cell-content()!=',$first-validation/表:第一æ“作数/text())"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:æ“作ç /text()='greater than'">
+ <xsl:value-of select="concat('oooc:cell-content-is-decimal-number() and cell-content()&gt;',$first-validation/表:第一æ“作数/text())"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:æ“作ç /text()='less than'">
+ <xsl:value-of select="concat('oooc:cell-content-is-decimal-number() and cell-content()&lt;',$first-validation/表:第一æ“作数/text())"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:æ“作ç /text()='greater than or equal to'">
+ <xsl:value-of select="concat('oooc:cell-content-is-decimal-number() and cell-content()&gt;=',$first-validation/表:第一æ“作数/text())"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:æ“作ç /text()='less than or equal to'">
+ <xsl:value-of select="concat('oooc:cell-content-is-decimal-number() and cell-content()&lt;=',$first-validation/表:第一æ“作数/text())"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:校验类型/text()='date'">
+ <xsl:choose>
+ <xsl:when test="$first-validation/表:æ“作ç /text()='between' ">
+ <xsl:value-of select="concat('oooc:cell-content-is-date() and cell-content-is-between','(',$first-validation/表:第一æ“作数/text(),',',$first-validation/表:第二æ“作数/text(),')')"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:æ“作ç /text()='not between'">
+ <xsl:value-of select="concat('oooc:cell-content-is-date() and cell-content-is-not-between','(',$first-validation/表:第一æ“作数/text(),',',$first-validation/表:第二æ“作数/text(),')')"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:æ“作ç /text()='equal to'">
+ <xsl:value-of select="concat('oooc:cell-content-is-date() and cell-content()=',$first-validation/表:第一æ“作数/text())"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:æ“作ç /text()='not equal to'">
+ <xsl:value-of select="concat('oooc:cell-content-is-date() and cell-content()!=',$first-validation/表:第一æ“作数/text())"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:æ“作ç /text()='greater than'">
+ <xsl:value-of select="concat('oooc:cell-content-is-date() and cell-content()&gt;',$first-validation/表:第一æ“作数/text())"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:æ“作ç /text()='less than'">
+ <xsl:value-of select="concat('oooc:cell-content-is-date() and cell-content()&lt;',$first-validation/表:第一æ“作数/text())"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:æ“作ç /text()='greater than or equal to'">
+ <xsl:value-of select="concat('oooc:cell-content-is-date() and cell-content()&gt;=',$first-validation/表:第一æ“作数/text())"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:æ“作ç /text()='less than or equal to'">
+ <xsl:value-of select="concat('oooc:cell-content-is-date() and cell-content()&lt;=',$first-validation/表:第一æ“作数/text())"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:校验类型/text()='time'">
+ <xsl:choose>
+ <xsl:when test="$first-validation/表:æ“作ç /text()='between' ">
+ <xsl:value-of select="concat('oooc:cell-content-is-time() and cell-content-is-between','(',$first-validation/表:第一æ“作数/text(),',',$first-validation/表:第二æ“作数/text(),')')"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:æ“作ç /text()='not between'">
+ <xsl:value-of select="concat('oooc:cell-content-is-time() and cell-content-is-not-between','(',$first-validation/表:第一æ“作数/text(),',',$first-validation/表:第二æ“作数/text(),')')"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:æ“作ç /text()='equal to'">
+ <xsl:value-of select="concat('oooc:cell-content-is-time() and cell-content()=',$first-validation/表:第一æ“作数/text())"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:æ“作ç /text()='not equal to'">
+ <xsl:value-of select="concat('oooc:cell-content-is-time() and cell-content()!=',$first-validation/表:第一æ“作数/text())"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:æ“作ç /text()='greater than'">
+ <xsl:value-of select="concat('oooc:cell-content-is-time() and cell-content()&gt;',$first-validation/表:第一æ“作数/text())"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:æ“作ç /text()='less than'">
+ <xsl:value-of select="concat('oooc:cell-content-is-time() and cell-content()&lt;',$first-validation/表:第一æ“作数/text())"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:æ“作ç /text()='greater than or equal to'">
+ <xsl:value-of select="concat('oooc:cell-content-is-time() and cell-content()&gt;=',$first-validation/表:第一æ“作数/text())"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:æ“作ç /text()='less than or equal to'">
+ <xsl:value-of select="concat('oooc:cell-content-is-time() and cell-content()&lt;=',$first-validation/表:第一æ“作数/text())"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <!-- add 20060317 -->
+ <xsl:when test="$first-validation/表:校验类型/text()='cell range'">
+ <xsl:value-of select="concat('oooc:cell-content-is-in-list',$first-validation/表:第一æ“作数/text())"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:校验类型/text()='list'">
+ <xsl:value-of select="concat('oooc:cell-content-is-in-list',$first-validation/表:第一æ“作数/text())"/>
+ </xsl:when>
+ <!-- add 20060317 end -->
+ <xsl:when test="$first-validation/表:校验类型/text()='text length'">
+ <xsl:choose>
+ <xsl:when test="$first-validation/表:æ“作ç /text()='between' ">
+ <xsl:value-of select="concat('oooc:cell-content-text-length-is-between','(',$first-validation/表:第一æ“作数/text(),',',$first-validation/表:第二æ“作数/text(),')')"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:æ“作ç /text()='not between'">
+ <xsl:value-of select="concat('oooc:cell-content-text-length-is-not-between','(',$first-validation/表:第一æ“作数/text(),',',$first-validation/表:第二æ“作数/text(),')')"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:æ“作ç /text()='equal to'">
+ <xsl:value-of select="concat('oooc:cell-content-text-length()=',$first-validation/表:第一æ“作数/text())"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:æ“作ç /text()='not equal to'">
+ <xsl:value-of select="concat('oooc:cell-content-text-length()!=',$first-validation/表:第一æ“作数/text())"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:æ“作ç /text()='greater than'">
+ <xsl:value-of select="concat('oooc:cell-content-text-length()&gt;',$first-validation/表:第一æ“作数/text())"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:æ“作ç /text()='less than'">
+ <xsl:value-of select="concat('oooc:cell-content-text-length()&lt;',$first-validation/表:第一æ“作数/text())"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:æ“作ç /text()='greater than or equal to'">
+ <xsl:value-of select="concat('oooc:cell-content-text-length()&gt;=',$first-validation/表:第一æ“作数/text())"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:æ“作ç /text()='less than or equal to'">
+ <xsl:value-of select="concat('oooc:cell-content-text-length()&lt;=',$first-validation/表:第一æ“作数/text())"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:element name="table:content-validation">
+ <xsl:attribute name="table:name"><xsl:value-of select="concat('val',count($first-validation/preceding-sibling::表:æ•°æ®æœ‰æ•ˆæ€§)+1)"/></xsl:attribute>
+ <xsl:attribute name="table:condition"><xsl:value-of select="$condition-text"/></xsl:attribute>
+ <xsl:attribute name="table:allow-empty-cell"><xsl:value-of select="$first-validation/表:忽略空格/@表:值"/></xsl:attribute>
+ <xsl:attribute name="table:base-cell-address"><xsl:value-of select="translate(substring-after($first-validation/表:区域/text(),':'),'$','')"/></xsl:attribute>
+ <xsl:if test="$first-validation/表:输入æ示">
+ <xsl:element name="table:help-message">
+ <xsl:attribute name="table:title"><xsl:value-of select="$first-validation/表:输入æ示/@表:标题"/></xsl:attribute>
+ <xsl:attribute name="table:display"><xsl:value-of select="$first-validation/表:输入æ示/@表:显示"/></xsl:attribute>
+ <xsl:element name="text:p">
+ <xsl:value-of select="$first-validation/表:输入æ示/@表:内容"/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="$first-validation/表:错误æ示">
+ <xsl:element name="table:error-message">
+ <xsl:attribute name="table:title"><xsl:value-of select="$first-validation/表:错误æ示/@表:标题"/></xsl:attribute>
+ <xsl:attribute name="table:display"><xsl:value-of select="$first-validation/表:错误æ示/@表:显示"/></xsl:attribute>
+ <xsl:attribute name="table:message-type"><xsl:value-of select="$first-validation/表:错误æ示/@表:类型"/></xsl:attribute>
+ <xsl:element name="text:p">
+ <xsl:value-of select="$first-validation/表:错误æ示/@表:内容"/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:if>
+ </xsl:element>
+ <xsl:call-template name="create-content-validations">
+ <xsl:with-param name="validation-set" select="$validation-set[position()!=1]"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <!--RedOffice Comment from Zengjh:UOF0020 2006-04-26 charts-->
+ <xsl:template match="表:图表">
+ <xsl:param name="table-name"/>
+ <xsl:element name="draw:frame">
+ <xsl:attribute name="draw:z-index"><xsl:value-of select="'0'"/></xsl:attribute>
+ <xsl:attribute name="svg:width"><xsl:value-of select="concat(@表:宽度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:height"><xsl:value-of select="concat(@表:高度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:x"><xsl:value-of select="concat(@表:xåæ ‡,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:y"><xsl:value-of select="concat(@表:yåæ ‡,$uofUnit)"/></xsl:attribute>
+ <xsl:variable name="chart-current">
+ <xsl:number level="any" count="表:图表" format="1"/>
+ </xsl:variable>
+ <xsl:attribute name="draw:style-name"><xsl:value-of select="concat('chart', $chart-current)"/></xsl:attribute>
+ <xsl:variable name="series-value-start">
+ <xsl:for-each select="表:æ•°æ®æº/表:系列[position()='1']">
+ <xsl:value-of select="@表:系列值"/>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:variable name="series-value-end">
+ <xsl:for-each select="表:æ•°æ®æº/表:系列[position()=last()]">
+ <xsl:value-of select="@表:系列值"/>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:variable name="series-generate-type">
+ <xsl:choose>
+ <xsl:when test="表:æ•°æ®æº/@表åºå·äº§ç”Ÿ">
+ <xsl:value-of select="表:æ•°æ®æº/@表åºå·äº§ç”Ÿ"/>
+ </xsl:when>
+ <xsl:when test="substring(substring-after($series-value-start,'!'),2,1)=substring(substring-after($series-value-start,':'),2,1)">row</xsl:when>
+ <xsl:otherwise>col</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:element name="draw:object">
+ <xsl:attribute name="draw:notify-on-update-of-ranges"><xsl:value-of select="表:æ•°æ®æº/@表:æ•°æ®åŒºåŸŸ"/></xsl:attribute>
+ <office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" office:version="1.0" office:mimetype="application/vnd.oasis.opendocument.chart">
+ <xsl:call-template name="表:元数æ®">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="@表:类型"/>
+ <xsl:with-param name="table-subtype" select="@表:å­ç±»åž‹"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ </xsl:call-template>
+ <xsl:call-template name="表:å¼æ ·é›†">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="@表:类型"/>
+ <xsl:with-param name="table-subtype" select="@表:å­ç±»åž‹"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ </xsl:call-template>
+ <xsl:call-template name="表:主体">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="@表:类型"/>
+ <xsl:with-param name="table-subtype" select="@表:å­ç±»åž‹"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ </xsl:call-template>
+ </office:document>
+ </xsl:element>
+ <xsl:element name="draw:image">
+ <office:binary-data>
+ <xsl:value-of select="/uof:UOF/uof:对象集/uof:其他对象/uof:æ•°æ®"/>
+ </office:binary-data>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="表:元数æ®">
+ <xsl:param name="table-name"/>
+ <xsl:param name="table-type"/>
+ <xsl:param name="table-subtype"/>
+ <xsl:param name="series-value-start"/>
+ <xsl:param name="series-value-end"/>
+ <xsl:param name="series-generate-type"/>
+ <xsl:for-each select="/uof:UOF/uof:元数æ®">
+ <office:meta>
+ <meta:generator>OpenOffice.org 1.1.3 (Win32)</meta:generator>
+ <xsl:if test="uof:标题">
+ <dc:title>
+ <xsl:value-of select="uof:标题"/>
+ </dc:title>
+ </xsl:if>
+ <xsl:if test="uof:摘è¦">
+ <dc:description>
+ <xsl:value-of select="uof:摘è¦"/>
+ </dc:description>
+ </xsl:if>
+ <xsl:if test="uof:主题">
+ <dc:subject>
+ <xsl:value-of select="uof:主题"/>
+ </dc:subject>
+ </xsl:if>
+ <xsl:if test="uof:作者">
+ <meta:initial-creator>
+ <xsl:value-of select="uof:作者"/>
+ </meta:initial-creator>
+ </xsl:if>
+ <xsl:if test="uof:创建日期">
+ <meta:creation-date>
+ <xsl:value-of select="uof:创建日期"/>
+ </meta:creation-date>
+ </xsl:if>
+ <xsl:if test="uof:最åŽä½œè€…">
+ <dc:creator>
+ <xsl:value-of select="uof:最åŽä½œè€…"/>
+ </dc:creator>
+ </xsl:if>
+ <xsl:if test="uof:编辑时间">
+ <meta:editing-duration>
+ <xsl:value-of select="uof:编辑时间"/>
+ </meta:editing-duration>
+ </xsl:if>
+ <dc:language/>
+ <meta:keywords>
+ <meta:keyword>
+ <xsl:value-of select="uof:关键字集/uof:关键字"/>
+ </meta:keyword>
+ </meta:keywords>
+ <xsl:if test="uof:编辑次数">
+ <meta:editing-cycles>
+ <xsl:value-of select="uof:编辑次数"/>
+ </meta:editing-cycles>
+ </xsl:if>
+ <xsl:if test="uof:分类">
+ <meta:user-defined meta:name="Category">
+ <xsl:value-of select="uof:分类"/>
+ </meta:user-defined>
+ </xsl:if>
+ <xsl:if test="uof:ç»ç†å称">
+ <meta:user-defined meta:name="Manager">
+ <xsl:value-of select="uof:ç»ç†å称"/>
+ </meta:user-defined>
+ </xsl:if>
+ <xsl:if test="uof:å…¬å¸å称">
+ <meta:user-defined meta:name="Company">
+ <xsl:value-of select="uof:å…¬å¸å称"/>
+ </meta:user-defined>
+ </xsl:if>
+ <xsl:if test="uof:创建应用程åº">
+ <meta:user-defined meta:name="Version">
+ <xsl:value-of select="uof:创建应用程åº"/>
+ </meta:user-defined>
+ </xsl:if>
+ </office:meta>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="表:å¼æ ·é›†">
+ <xsl:param name="table-name"/>
+ <xsl:param name="table-type"/>
+ <xsl:param name="table-subtype"/>
+ <xsl:param name="series-value-start"/>
+ <xsl:param name="series-value-end"/>
+ <xsl:param name="series-generate-type"/>
+ <office:styles>
+ <draw:stroke-dash draw:name="Ultrafine_20_Dashed" draw:display-name="Ultrafine Dashed" draw:style="rect" draw:dots1="1" draw:dots1-length="0.051cm" draw:dots2="1" draw:dots2-length="0.051cm" draw:distance="0.051cm"/>
+ <draw:stroke-dash draw:name="Fine_20_Dashed" draw:display-name="Fine Dashed" draw:style="rect" draw:dots1="1" draw:dots1-length="0.508cm" draw:dots2="1" draw:dots2-length="0.508cm" draw:distance="0.508cm"/>
+ <draw:stroke-dash draw:name="Ultrafine_20_2_20_Dots_20_3_20_Dashes" draw:display-name="Ultrafine 2 Dots 3 Dashes" draw:style="rect" draw:dots1="2" draw:dots1-length="0.051cm" draw:dots2="3" draw:dots2-length="0.254cm" draw:distance="0.127cm"/>
+ <draw:stroke-dash draw:name="Fine_20_Dashed_20__28_var_29_" draw:display-name="Fine Dashed (var)" draw:style="rect" draw:dots1="1" draw:dots1-length="197%" draw:distance="197%"/>
+ <draw:stroke-dash draw:name="Fine_20_Dotted" draw:display-name="Fine Dotted" draw:style="rect" draw:dots1="1" draw:distance="0.457cm"/>
+ <draw:stroke-dash draw:name="Fine_20_Dashed_20__28_var_29_" draw:display-name="Fine Dashed (var)" draw:style="rect" draw:dots1="1" draw:dots1-length="197%" draw:distance="197%"/>
+ <draw:stroke-dash draw:name="Fine_20_Dotted" draw:display-name="Fine Dotted" draw:style="rect" draw:dots1="1" draw:distance="0.457cm"/>
+ <draw:stroke-dash draw:name="Line_20_with_20_Fine_20_Dots" draw:display-name="Line with Fine Dots" draw:style="rect" draw:dots1="1" draw:dots1-length="2.007cm" draw:dots2="10" draw:distance="0.152cm"/>
+ <draw:stroke-dash draw:name="Line_20_Style_20_9" draw:display-name="Line Style 9" draw:style="rect" draw:dots1="1" draw:dots1-length="197%" draw:distance="120%"/>
+ <draw:stroke-dash draw:name="_33__20_Dashes_20_3_20_Dots_20__28_var_29_" draw:display-name="3 Dashes 3 Dots (var)" draw:style="rect" draw:dots1="3" draw:dots1-length="197%" draw:dots2="3" draw:distance="100%"/>
+ <draw:stroke-dash draw:name="_32__20_Dots_20_1_20_Dash" draw:display-name="2 Dots 1 Dash" draw:style="rect" draw:dots1="2" draw:dots2="1" draw:dots2-length="0.203cm" draw:distance="0.203cm"/>
+ <draw:stroke-dash draw:name="Ultrafine_20_Dotted_20__28_var_29_" draw:display-name="Ultrafine Dotted (var)" draw:style="rect" draw:dots1="1" draw:distance="50%"/>
+ <draw:stroke-dash draw:name="Dash_20_10" draw:display-name="Dash 10" draw:style="rect" draw:dots1="1" draw:dots1-length="0.02cm" draw:dots2="1" draw:dots2-length="0.02cm" draw:distance="0.02cm"/>
+ <xsl:for-each select="//图:图片">
+ <xsl:variable name="chart-image-name" select="@图:å称"/>
+ <draw:fill-image>
+ <xsl:attribute name="draw:name"><xsl:value-of select="@图:å称"/></xsl:attribute>
+ <office:binary-data>
+ <xsl:for-each select="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$chart-image-name]">
+ <xsl:value-of select="uof:æ•°æ®"/>
+ </xsl:for-each>
+ </office:binary-data>
+ </draw:fill-image>
+ </xsl:for-each>
+ <xsl:for-each select="//图:图案">
+ <xsl:variable name="chart-hatch-name" select="@图:图形引用"/>
+ <draw:hatch>
+ <xsl:if test="@图:图形引用">
+ <xsl:attribute name="draw:name"><xsl:value-of select="$chart-hatch-name"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@图:类型">
+ <xsl:attribute name="draw:style"><xsl:value-of select="@图:类型"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@图:å‰æ™¯è‰²">
+ <xsl:attribute name="draw:color"><xsl:value-of select="@图:å‰æ™¯è‰²"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@图:è·ç¦»">
+ <xsl:attribute name="draw:distance"><xsl:value-of select="@图:è·ç¦»"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@图:旋转度">
+ <xsl:attribute name="draw:rotation"><xsl:value-of select="@图:旋转度"/></xsl:attribute>
+ </xsl:if>
+ </draw:hatch>
+ </xsl:for-each>
+ <xsl:for-each select="//图:æ¸å˜">
+ <draw:gradient>
+ <xsl:if test="@图:图形引用">
+ <xsl:attribute name="draw:name"><xsl:value-of select="@图:图形引用"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@图:起始色">
+ <xsl:attribute name="draw:start-color"><xsl:value-of select="@图:起始色"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@图:终止色">
+ <xsl:attribute name="draw:end-color"><xsl:value-of select="@图:终止色"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@图:ç§å­ç±»åž‹">
+ <xsl:attribute name="draw:style"><xsl:value-of select="@图:ç§å­ç±»åž‹"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@图:起始浓度">
+ <xsl:attribute name="draw:start-intensity"><xsl:value-of select="@图:起始浓度"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@图:终止浓度">
+ <xsl:attribute name="draw:end-intensity"><xsl:value-of select="@图:终止浓度"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@图:æ¸å˜æ–¹å‘">
+ <xsl:attribute name="draw:angle"><xsl:value-of select="@图:æ¸å˜æ–¹å‘"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@图:边界">
+ <xsl:attribute name="draw:border"><xsl:value-of select="@图:边界"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@图:ç§å­Xä½ç½®">
+ <xsl:attribute name="draw:cx"><xsl:value-of select="@图:ç§å­Xä½ç½®"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@图:ç§å­Yä½ç½®">
+ <xsl:attribute name="draw:cy"><xsl:value-of select="@图:ç§å­Yä½ç½®"/></xsl:attribute>
+ </xsl:if>
+ </draw:gradient>
+ </xsl:for-each>
+ </office:styles>
+ <office:automatic-styles>
+ <xsl:for-each select="node( )">
+ <xsl:choose>
+ <xsl:when test="name(.)='表:图表区'">
+ <xsl:call-template name="表:图表区å¼æ ·">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name(.)='表:绘图区'">
+ <xsl:call-template name="表:绘图区å¼æ ·">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ </xsl:call-template>
+ <xsl:call-template name="表:图表背景墙å¼æ ·">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name(.)='表:分类轴'">
+ <xsl:call-template name="表:分类轴å¼æ ·">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name(.)='表:数值轴'">
+ <xsl:call-template name="表:数值轴å¼æ ·">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name(.)='表:图例'">
+ <xsl:call-template name="表:图例å¼æ ·">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name(.)='表:æ•°æ®è¡¨'">
+ <xsl:call-template name="表:æ•°æ®è¡¨å¼æ ·">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name(.)='表:æ•°æ®ç³»åˆ—集'">
+ <xsl:call-template name="表:æ•°æ®ç³»åˆ—集å¼æ ·">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name(.)='表:æ•°æ®ç‚¹é›†'">
+ <xsl:call-template name="表:æ•°æ®ç‚¹é›†å¼æ ·">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name(.)='表:网格线集'">
+ <xsl:call-template name="表:网格线集å¼æ ·">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name(.)='表:æ•°æ®æº'">
+ <xsl:call-template name="表:æ•°æ®æºå¼æ ·">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name(.)='表:标题集'">
+ <xsl:call-template name="表:标题集å¼æ ·">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:for-each>
+ </office:automatic-styles>
+ </xsl:template>
+ <xsl:template name="表:主体">
+ <xsl:param name="table-name"/>
+ <xsl:param name="table-type"/>
+ <xsl:param name="table-subtype"/>
+ <xsl:param name="series-value-start"/>
+ <xsl:param name="series-value-end"/>
+ <xsl:param name="series-generate-type"/>
+ <office:body>
+ <office:chart>
+ <chart:chart>
+ <xsl:attribute name="svg:width"><xsl:value-of select="concat(@表:宽度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:height"><xsl:value-of select="concat(@表:高度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="chart:class"><xsl:choose><xsl:when test="$table-type='column'">chart:bar</xsl:when><xsl:when test="$table-type='line'">chart:line</xsl:when><xsl:when test="$table-type='pie'"><xsl:choose><xsl:when test="$table-subtype='pie_ring'">chart:ring</xsl:when><xsl:otherwise>chart:circle</xsl:otherwise></xsl:choose></xsl:when><xsl:otherwise><xsl:value-of select="$table-type"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="chart:style-name">chart-area</xsl:attribute>
+ <xsl:for-each select="表:标题集/表:标题[@表:ä½ç½®='chart']">
+ <chart:title chart:style-name="chart-title">
+ <text:p>
+ <xsl:value-of select="@表:å称"/>
+ </text:p>
+ </chart:title>
+ </xsl:for-each>
+ <xsl:call-template name="表:图例区域">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ </xsl:call-template>
+ <xsl:call-template name="表:绘图区域">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ </xsl:call-template>
+ <xsl:call-template name="表:本地表">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ </xsl:call-template>
+ </chart:chart>
+ </office:chart>
+ </office:body>
+ </xsl:template>
+ <xsl:template name="表:图例区域">
+ <xsl:param name="table-name"/>
+ <xsl:param name="table-type"/>
+ <xsl:param name="table-subtype"/>
+ <xsl:param name="series-value-start"/>
+ <xsl:param name="series-value-end"/>
+ <xsl:param name="series-generate-type"/>
+ <chart:legend>
+ <xsl:attribute name="chart:legend-position"><xsl:choose><xsl:when test="表:图例/@表:ä½ç½®"><xsl:value-of select="表:图例/@表:ä½ç½®"/></xsl:when><xsl:otherwise>right</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="svg:x"><xsl:value-of select="concat(表:图例/@表:xåæ ‡,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:y"><xsl:value-of select="concat(表:图例/@表:yåæ ‡,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="chart:style-name">legend</xsl:attribute>
+ </chart:legend>
+ </xsl:template>
+ <xsl:template name="表:绘图区域">
+ <xsl:param name="table-name"/>
+ <xsl:param name="table-type"/>
+ <xsl:param name="table-subtype"/>
+ <xsl:param name="series-value-start"/>
+ <xsl:param name="series-value-end"/>
+ <xsl:param name="series-generate-type"/>
+ <chart:plot-area>
+ <xsl:variable name="start-range">
+ <xsl:value-of select="concat('.$',substring(substring-after($series-value-start,'!'),1,1),'$',substring-before(substring(substring-after($series-value-start,'!'),2),':'))"/>
+ </xsl:variable>
+ <xsl:variable name="end-range">
+ <xsl:value-of select="concat(':.$',substring(substring-after($series-value-end,':'),1,1),'$',substring(substring-after($series-value-end,':'),2))"/>
+ </xsl:variable>
+ <xsl:attribute name="chart:style-name">plot-area</xsl:attribute>
+ <xsl:attribute name="table:cell-range-address"><xsl:value-of select="concat($table-name,$start-range,$end-range)"/></xsl:attribute>
+ <!--xsl:value-of select="表:æ•°æ®æº/@表:æ•°æ®åŒºåŸŸ"/-->
+ <xsl:attribute name="chart:table-number-list">0</xsl:attribute>
+ <xsl:attribute name="svg:width"><xsl:value-of select="concat(表:绘图区/@表:宽度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:height"><xsl:value-of select="concat(表:绘图区/@表:高度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:x"><xsl:value-of select="concat(表:绘图区/@表:xåæ ‡,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:y"><xsl:value-of select="concat(表:绘图区/@表:yåæ ‡,$uofUnit)"/></xsl:attribute>
+ <xsl:if test="表:分类轴">
+ <chart:axis chart:dimension="x" chart:name="primary-x" chart:style-name="category-axis">
+ <xsl:for-each select="表:标题集/表:标题[@表:ä½ç½®='category axis']">
+ <chart:title chart:style-name="category-axis-title">
+ <text:p>
+ <xsl:value-of select="@表:å称"/>
+ </text:p>
+ </chart:title>
+ </xsl:for-each>
+ <chart:categories/>
+ <xsl:if test="表:网格线集/表:网格线[@表:ä½ç½®='category axis']">
+ <chart:grid chart:style-name="category-axis-grid" chart:class="major"/>
+ </xsl:if>
+ </chart:axis>
+ </xsl:if>
+ <xsl:if test="表:数值轴">
+ <chart:axis chart:dimension="y" chart:name="primary-y" chart:style-name="value-axis">
+ <xsl:for-each select="表:标题集/表:标题[@表:ä½ç½®='value axis']">
+ <chart:title chart:style-name="value-axis-title">
+ <text:p>
+ <xsl:value-of select="@表:å称"/>
+ </text:p>
+ </chart:title>
+ </xsl:for-each>
+ <chart:grid chart:style-name="value-axis-grid" chart:class="major"/>
+ </chart:axis>
+ </xsl:if>
+ <xsl:call-template name="表:æ•°æ®ç»„">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ </xsl:call-template>
+ <chart:wall>
+ <xsl:attribute name="chart:style-name">chart-wall</xsl:attribute>
+ </chart:wall>
+ <chart:floor>
+ <xsl:attribute name="chart:style-name">chart-floor</xsl:attribute>
+ </chart:floor>
+ </chart:plot-area>
+ </xsl:template>
+ <xsl:template name="表:本地表">
+ <xsl:param name="table-name"/>
+ <xsl:param name="table-type"/>
+ <xsl:param name="table-subtype"/>
+ <xsl:param name="series-value-start"/>
+ <xsl:param name="series-value-end"/>
+ <xsl:param name="series-generate-type"/>
+ <table:table table:name="local-table">
+ <table:table-header-columns>
+ <xsl:call-template name="表:本地表_表头列">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ <xsl:with-param name="sum" select="1"/>
+ </xsl:call-template>
+ </table:table-header-columns>
+ <table:table-columns>
+ <xsl:variable name="column-sum">
+ <xsl:value-of select="count(表:æ•°æ®æº/表:系列)"/>
+ </xsl:variable>
+ <xsl:call-template name="表:本地表_列">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ <xsl:with-param name="column-sum" select="$column-sum"/>
+ </xsl:call-template>
+ </table:table-columns>
+ <table:table-header-rows>
+ <xsl:call-template name="表:本地表_表头行">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ <xsl:with-param name="row-current" select="1"/>
+ <xsl:with-param name="fixed-row-sum" select="'1'"/>
+ </xsl:call-template>
+ </table:table-header-rows>
+ <table:table-rows>
+ <xsl:variable name="row-start">
+ <xsl:value-of select="substring-before(substring(substring-after($series-value-start,'!'),2),':')"/>
+ </xsl:variable>
+ <xsl:variable name="row-end">
+ <xsl:value-of select="substring(substring-after($series-value-end,':'),2)"/>
+ </xsl:variable>
+ <xsl:variable name="fixed-row-sum">
+ <xsl:value-of select="$row-end -$row-start +1"/>
+ </xsl:variable>
+ <xsl:call-template name="表:本地表_行">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ <xsl:with-param name="row-current" select="'1'"/>
+ <xsl:with-param name="fixed-row-sum" select="$fixed-row-sum"/>
+ </xsl:call-template>
+ </table:table-rows>
+ </table:table>
+ </xsl:template>
+ <xsl:template name="表:本地表_表头列">
+ <xsl:param name="table-name"/>
+ <xsl:param name="table-type"/>
+ <xsl:param name="table-subtype"/>
+ <xsl:param name="series-value-start"/>
+ <xsl:param name="series-value-end"/>
+ <xsl:param name="series-generate-type"/>
+ <xsl:param name="sum"/>
+ <xsl:choose>
+ <xsl:when test="$sum=0"/>
+ <xsl:otherwise>
+ <table:table-column/>
+ <xsl:call-template name="表:本地表_表头列">
+ <xsl:with-param name="sum" select="$sum -1"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="表:本地表_列">
+ <xsl:param name="table-name"/>
+ <xsl:param name="table-type"/>
+ <xsl:param name="table-subtype"/>
+ <xsl:param name="series-value-start"/>
+ <xsl:param name="series-value-end"/>
+ <xsl:param name="series-generate-type"/>
+ <xsl:param name="column-sum"/>
+ <xsl:choose>
+ <xsl:when test="$column-sum=0"/>
+ <xsl:otherwise>
+ <table:table-column/>
+ <xsl:call-template name="表:本地表_列">
+ <xsl:with-param name="column-sum" select="$column-sum -1"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="表:本地表_表头行">
+ <xsl:param name="table-name"/>
+ <xsl:param name="table-type"/>
+ <xsl:param name="table-subtype"/>
+ <xsl:param name="series-value-start"/>
+ <xsl:param name="series-value-end"/>
+ <xsl:param name="series-generate-type"/>
+ <xsl:param name="row-current"/>
+ <xsl:param name="fixed-row-sum"/>
+ <xsl:choose>
+ <xsl:when test="$row-current >$fixed-row-sum"/>
+ <xsl:otherwise>
+ <table:table-row>
+ <xsl:variable name="series-value-current">
+ <xsl:for-each select="表:æ•°æ®æº/表:系列[position()=$row-current]">
+ <xsl:value-of select="@表:系列值"/>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:variable name="cell-start">
+ <xsl:call-template name="General-Char-Transition">
+ <xsl:with-param name="input-char" select="substring(substring-after($series-value-start,'!'),1,1)"/>
+ <xsl:with-param name="output-type" select="'ARABIC'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="cell-end">
+ <xsl:choose>
+ <xsl:when test="$series-generate-type='row'">
+ <xsl:call-template name="General-Char-Transition">
+ <xsl:with-param name="input-char" select="substring(substring-after($series-value-start,':'),1,1)"/>
+ <xsl:with-param name="output-type" select="'ARABIC'"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="General-Char-Transition">
+ <xsl:with-param name="input-char" select="substring(substring-after($series-value-end,'!'),1,1)"/>
+ <xsl:with-param name="output-type" select="'ARABIC'"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="cell-sum">
+ <xsl:value-of select="$cell-end -$cell-start +2"/>
+ </xsl:variable>
+ <xsl:variable name="fixed-cell-sum" select="$cell-sum"/>
+ <xsl:call-template name="表:本地表_表头行_å•å…ƒæ ¼">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ <xsl:with-param name="series-value-current" select="$series-value-current"/>
+ <xsl:with-param name="row-current" select="$row-current"/>
+ <xsl:with-param name="cell-sum" select="$cell-sum"/>
+ <xsl:with-param name="fixed-cell-sum" select="$fixed-cell-sum"/>
+ </xsl:call-template>
+ </table:table-row>
+ <xsl:call-template name="表:本地表_表头行">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ <xsl:with-param name="row-current" select="$row-current +1"/>
+ <xsl:with-param name="fixed-row-sum" select="$fixed-row-sum"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="表:本地表_表头行_å•å…ƒæ ¼">
+ <xsl:param name="table-name"/>
+ <xsl:param name="table-type"/>
+ <xsl:param name="table-subtype"/>
+ <xsl:param name="series-value-start"/>
+ <xsl:param name="series-value-end"/>
+ <xsl:param name="series-generate-type"/>
+ <xsl:param name="series-value-current"/>
+ <xsl:param name="row-current"/>
+ <xsl:param name="cell-sum"/>
+ <xsl:param name="fixed-cell-sum"/>
+ <xsl:choose>
+ <xsl:when test="$cell-sum=0"/>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="$fixed-cell-sum=$cell-sum">
+ <table:table-cell>
+ <text:p/>
+ </table:table-cell>
+ </xsl:when>
+ <xsl:otherwise>
+ <table:table-cell office:value-type="string">
+ <xsl:variable name="cell-no">
+ <xsl:value-of select="$fixed-cell-sum -$cell-sum +1"/>
+ </xsl:variable>
+ <xsl:variable name="cell-start">
+ <xsl:call-template name="General-Char-Transition">
+ <xsl:with-param name="input-char" select="substring(substring-after($series-value-start,'!'),1,1)"/>
+ <xsl:with-param name="output-type" select="'ARABIC'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="char">
+ <xsl:call-template name="General-Char-Transition">
+ <xsl:with-param name="input-char" select="$cell-start +$cell-no -2"/>
+ <xsl:with-param name="output-type" select="'CHARS_UPPER_LETTER'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <text:p>
+ <xsl:value-of select="concat('列 ',$char)"/>
+ </text:p>
+ </table:table-cell>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:call-template name="表:本地表_表头行_å•å…ƒæ ¼">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ <xsl:with-param name="series-value-current" select="$series-value-current"/>
+ <xsl:with-param name="row-current" select="$row-current"/>
+ <xsl:with-param name="cell-sum" select="$cell-sum -1"/>
+ <xsl:with-param name="fixed-cell-sum" select="$fixed-cell-sum"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="表:本地表_行">
+ <xsl:param name="table-name"/>
+ <xsl:param name="table-type"/>
+ <xsl:param name="table-subtype"/>
+ <xsl:param name="series-value-start"/>
+ <xsl:param name="series-value-end"/>
+ <xsl:param name="series-generate-type"/>
+ <xsl:param name="row-current"/>
+ <xsl:param name="fixed-row-sum"/>
+ <xsl:choose>
+ <xsl:when test="$row-current >$fixed-row-sum"/>
+ <xsl:otherwise>
+ <xsl:variable name="series-value-current">
+ <xsl:for-each select="表:æ•°æ®æº/表:系列[position()=$row-current]">
+ <xsl:value-of select="@表:系列值"/>
+ </xsl:for-each>
+ </xsl:variable>
+ <table:table-row>
+ <xsl:variable name="cell-start">
+ <xsl:call-template name="General-Char-Transition">
+ <xsl:with-param name="input-char" select="substring(substring-after($series-value-start,'!'),1,1)"/>
+ <xsl:with-param name="output-type" select="'ARABIC'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="cell-end">
+ <xsl:choose>
+ <xsl:when test="$series-generate-type='row'">
+ <xsl:call-template name="General-Char-Transition">
+ <xsl:with-param name="input-char" select="substring(substring-after($series-value-start,':'),1,1)"/>
+ <xsl:with-param name="output-type" select="'ARABIC'"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="General-Char-Transition">
+ <xsl:with-param name="input-char" select="substring(substring-after($series-value-end,'!'),1,1)"/>
+ <xsl:with-param name="output-type" select="'ARABIC'"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="cell-sum">
+ <xsl:value-of select="$cell-end -$cell-start +2"/>
+ </xsl:variable>
+ <xsl:variable name="fixed-cell-sum" select="$cell-sum"/>
+ <xsl:call-template name="表:本地表_è¡Œ_å•å…ƒæ ¼">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ <xsl:with-param name="series-value-current" select="$series-value-current"/>
+ <xsl:with-param name="row-current" select="$row-current"/>
+ <xsl:with-param name="cell-sum" select="$cell-sum"/>
+ <xsl:with-param name="fixed-cell-sum" select="$fixed-cell-sum"/>
+ </xsl:call-template>
+ </table:table-row>
+ <xsl:call-template name="表:本地表_行">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ <xsl:with-param name="row-current" select="$row-current +1"/>
+ <xsl:with-param name="fixed-row-sum" select="$fixed-row-sum"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="表:本地表_è¡Œ_å•å…ƒæ ¼">
+ <xsl:param name="table-name"/>
+ <xsl:param name="table-type"/>
+ <xsl:param name="table-subtype"/>
+ <xsl:param name="series-value-start"/>
+ <xsl:param name="series-value-end"/>
+ <xsl:param name="series-generate-type"/>
+ <xsl:param name="series-value-current"/>
+ <xsl:param name="row-current"/>
+ <xsl:param name="cell-sum"/>
+ <xsl:param name="fixed-cell-sum"/>
+ <xsl:choose>
+ <xsl:when test="$cell-sum=0"/>
+ <xsl:otherwise>
+ <xsl:variable name="cell-start">
+ <xsl:call-template name="General-Char-Transition">
+ <xsl:with-param name="input-char" select="substring(substring-after($series-value-start,'!'),1,1)"/>
+ <xsl:with-param name="output-type" select="'ARABIC'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="cell-no">
+ <xsl:value-of select="$cell-start +$fixed-cell-sum -$cell-sum -1"/>
+ </xsl:variable>
+ <xsl:variable name="row-start">
+ <xsl:value-of select="substring(substring-after($series-value-start,'!'),2,1)"/>
+ </xsl:variable>
+ <xsl:variable name="row-no">
+ <xsl:value-of select="$row-start +$row-current -1"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$fixed-cell-sum=$cell-sum">
+ <table:table-cell office:value-type="string">
+ <text:p>
+ <xsl:value-of select="concat('行 ',$row-no)"/>
+ </text:p>
+ </table:table-cell>
+ </xsl:when>
+ <xsl:otherwise>
+ <table:table-cell office:value-type="float">
+ <xsl:variable name="cell-content">
+ <xsl:choose>
+ <xsl:when test="/uof:UOF/uof:电å­è¡¨æ ¼/表:主体/表:工作表/表:工作表内容/表:è¡Œ/@表:è¡Œå·">
+ <xsl:for-each select="/uof:UOF/uof:电å­è¡¨æ ¼/表:主体/表:工作表/表:工作表内容/表:è¡Œ[@表:è¡Œå·=$row-no]">
+ <xsl:for-each select="表:å•å…ƒæ ¼[@表:列å·=$cell-no]">
+ <xsl:value-of select="表:æ•°æ®/å­—:å¥/å­—:文本串"/>
+ </xsl:for-each>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:for-each select="/uof:UOF/uof:电å­è¡¨æ ¼/表:主体/表:工作表/表:工作表内容/表:è¡Œ[position()=$row-no]">
+ <xsl:for-each select="表:å•å…ƒæ ¼[position()=$cell-no]">
+ <xsl:value-of select="表:æ•°æ®/å­—:å¥/å­—:文本串"/>
+ </xsl:for-each>
+ </xsl:for-each>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:value"><xsl:value-of select="$cell-content"/></xsl:attribute>
+ <text:p>
+ <xsl:value-of select="$cell-content"/>
+ </text:p>
+ </table:table-cell>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:call-template name="表:本地表_è¡Œ_å•å…ƒæ ¼">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ <xsl:with-param name="series-value-current" select="$series-value-current"/>
+ <xsl:with-param name="row-current" select="$row-current"/>
+ <xsl:with-param name="cell-sum" select="$cell-sum -1"/>
+ <xsl:with-param name="fixed-cell-sum" select="$fixed-cell-sum"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="表:æ•°æ®ç»„">
+ <xsl:param name="table-name"/>
+ <xsl:param name="table-type"/>
+ <xsl:param name="table-subtype"/>
+ <xsl:param name="series-value-start"/>
+ <xsl:param name="series-value-end"/>
+ <xsl:param name="series-generate-type"/>
+ <xsl:variable name="input-char-start">
+ <xsl:choose>
+ <xsl:when test="$series-generate-type='row'">
+ <xsl:value-of select="substring(substring-after($series-value-start,'!'),1,1)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-before(substring(substring-after($series-value-start,'!'),2),':')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="input-char-end">
+ <xsl:choose>
+ <xsl:when test="$series-generate-type='row'">
+ <xsl:value-of select="substring(substring-after($series-value-start,':'),1,1)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring(substring-after($series-value-start,':'),2)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="cell-start">
+ <xsl:call-template name="General-Char-Transition">
+ <xsl:with-param name="input-char" select="$input-char-start"/>
+ <xsl:with-param name="output-type" select="'ARABIC'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="cell-end">
+ <xsl:call-template name="General-Char-Transition">
+ <xsl:with-param name="input-char" select="$input-char-end"/>
+ <xsl:with-param name="output-type" select="'ARABIC'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="fixed-cell-sum">
+ <xsl:value-of select="$cell-end -$cell-start +1"/>
+ </xsl:variable>
+ <xsl:for-each select="表:æ•°æ®ç³»åˆ—集/表:æ•°æ®ç³»åˆ—">
+ <chart:series>
+ <xsl:attribute name="chart:style-name"><xsl:value-of select="concat('data-series',position())"/></xsl:attribute>
+ <xsl:call-template name="表:æ•°æ®ç‚¹">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ <xsl:with-param name="data-series-current" select="position()"/>
+ <xsl:with-param name="cell-current" select="'1'"/>
+ <xsl:with-param name="fixed-cell-sum" select="$fixed-cell-sum"/>
+ </xsl:call-template>
+ </chart:series>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="表:æ•°æ®ç‚¹">
+ <xsl:param name="table-name"/>
+ <xsl:param name="table-type"/>
+ <xsl:param name="table-subtype"/>
+ <xsl:param name="series-value-start"/>
+ <xsl:param name="series-value-end"/>
+ <xsl:param name="series-generate-type"/>
+ <xsl:param name="data-series-current"/>
+ <xsl:param name="cell-current"/>
+ <xsl:param name="fixed-cell-sum"/>
+ <xsl:choose>
+ <xsl:when test="$cell-current>$fixed-cell-sum"/>
+ <xsl:otherwise>
+ <chart:data-point>
+ <xsl:attribute name="chart:style-name"><xsl:value-of select="concat('data-point',$data-series-current,$cell-current)"/></xsl:attribute>
+ </chart:data-point>
+ <xsl:call-template name="表:æ•°æ®ç‚¹">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ <xsl:with-param name="data-series-current" select="$data-series-current"/>
+ <xsl:with-param name="cell-current" select="$cell-current +1"/>
+ <xsl:with-param name="fixed-cell-sum" select="$fixed-cell-sum"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="表:图表区å¼æ ·">
+ <xsl:param name="table-name"/>
+ <xsl:param name="table-type"/>
+ <xsl:param name="table-subtype"/>
+ <xsl:param name="series-value-start"/>
+ <xsl:param name="series-value-end"/>
+ <xsl:param name="series-generate-type"/>
+ <style:style style:name="chart-area" style:family="chart">
+ <xsl:for-each select="node()">
+ <xsl:choose>
+ <xsl:when test="name(.)='表:边框'">
+ <style:graphic-properties>
+ <xsl:call-template name="uof:边框"/>
+ </style:graphic-properties>
+ </xsl:when>
+ <xsl:when test="name(.)='表:填充'">
+ <style:graphic-properties>
+ <xsl:call-template name="图:填充类型"/>
+ </style:graphic-properties>
+ </xsl:when>
+ <xsl:when test="name(.)='表:字体'">
+ <style:text-properties>
+ <xsl:call-template name="å­—:å¥å±žæ€§ç±»åž‹"/>
+ </style:text-properties>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+ </style:style>
+ </xsl:template>
+ <xsl:template name="表:绘图区å¼æ ·">
+ <xsl:param name="table-name"/>
+ <xsl:param name="table-type"/>
+ <xsl:param name="table-subtype"/>
+ <xsl:param name="series-value-start"/>
+ <xsl:param name="series-value-end"/>
+ <xsl:param name="series-generate-type"/>
+ <style:style style:name="plot-area" style:family="chart">
+ <style:chart-properties>
+ <xsl:choose>
+ <xsl:when test="$table-subtype='bar_stacked' or $table-subtype='column_stacked' or $table-subtype='line_stacked'">
+ <xsl:attribute name="chart:stacked">true</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$table-subtype='bar_percent' or $table-subtype='column_percent' or $table-subtype='line_percent'">
+ <xsl:attribute name="chart:percentage">true</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:attribute name="chart:vertical"><xsl:choose><xsl:when test="$table-type='bar'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="chart:series-source"><xsl:choose><xsl:when test="$series-generate-type='row'">rows</xsl:when><xsl:otherwise>columns</xsl:otherwise></xsl:choose></xsl:attribute>
+ </style:chart-properties>
+ </style:style>
+ </xsl:template>
+ <xsl:template name="表:图表背景墙å¼æ ·">
+ <xsl:param name="table-name"/>
+ <xsl:param name="table-type"/>
+ <xsl:param name="table-subtype"/>
+ <xsl:param name="series-value-start"/>
+ <xsl:param name="series-value-end"/>
+ <xsl:param name="series-generate-type"/>
+ <style:style style:name="chart-wall" style:family="chart">
+ <style:graphic-properties>
+ <xsl:for-each select="node()">
+ <xsl:choose>
+ <xsl:when test="name(.)='表:边框'">
+ <xsl:call-template name="uof:边框"/>
+ </xsl:when>
+ <xsl:when test="name(.)='表:填充'">
+ <xsl:call-template name="图:填充类型"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+ </style:graphic-properties>
+ </style:style>
+ </xsl:template>
+ <xsl:template name="表:分类轴å¼æ ·">
+ <xsl:param name="table-name"/>
+ <xsl:param name="table-type"/>
+ <xsl:param name="table-subtype"/>
+ <xsl:param name="series-value-start"/>
+ <xsl:param name="series-value-end"/>
+ <xsl:param name="series-generate-type"/>
+ <style:style style:name="category-axis" style:family="chart">
+ <xsl:call-template name="表:å标轴类型">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ <xsl:with-param name="axis-type" select="'category axis'"/>
+ </xsl:call-template>
+ </style:style>
+ </xsl:template>
+ <xsl:template name="表:数值轴å¼æ ·">
+ <xsl:param name="table-name"/>
+ <xsl:param name="table-type"/>
+ <xsl:param name="table-subtype"/>
+ <xsl:param name="series-value-start"/>
+ <xsl:param name="series-value-end"/>
+ <xsl:param name="series-generate-type"/>
+ <style:style style:name="value-axis" style:family="chart">
+ <xsl:call-template name="表:å标轴类型">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ <xsl:with-param name="axis-type" select="'value axis'"/>
+ </xsl:call-template>
+ </style:style>
+ </xsl:template>
+ <xsl:template name="表:图例å¼æ ·">
+ <xsl:param name="table-name"/>
+ <xsl:param name="table-type"/>
+ <xsl:param name="table-subtype"/>
+ <xsl:param name="series-value-start"/>
+ <xsl:param name="series-value-end"/>
+ <xsl:param name="series-generate-type"/>
+ <style:style style:name="legend" style:family="chart">
+ <xsl:for-each select="node()">
+ <xsl:choose>
+ <xsl:when test="name(.)='表:边框'">
+ <style:graphic-properties>
+ <xsl:call-template name="uof:边框"/>
+ </style:graphic-properties>
+ </xsl:when>
+ <xsl:when test="name(.)='表:填充'">
+ <style:graphic-properties>
+ <xsl:call-template name="图:填充类型"/>
+ </style:graphic-properties>
+ </xsl:when>
+ <xsl:when test="name(.)='表:字体'">
+ <style:text-properties>
+ <xsl:call-template name="å­—:å¥å±žæ€§ç±»åž‹"/>
+ </style:text-properties>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+ </style:style>
+ </xsl:template>
+ <xsl:template name="表:æ•°æ®è¡¨å¼æ ·">
+ <xsl:param name="table-name"/>
+ <xsl:param name="table-type"/>
+ <xsl:param name="table-subtype"/>
+ <xsl:param name="series-value-start"/>
+ <xsl:param name="series-value-end"/>
+ <xsl:param name="series-generate-type"/>
+ <style:style style:name="data-table" style:family="chart">
+ <xsl:for-each select="node()">
+ <xsl:choose>
+ <xsl:when test="name(.)='表:边框'">
+ <style:graphic-properties>
+ <xsl:call-template name="uof:边框"/>
+ </style:graphic-properties>
+ </xsl:when>
+ <xsl:when test="name(.)='表:填充'">
+ <style:graphic-properties>
+ <xsl:call-template name="图:填充类型"/>
+ </style:graphic-properties>
+ </xsl:when>
+ <xsl:when test="name(.)='表:字体'">
+ <style:text-properties>
+ <xsl:call-template name="å­—:å¥å±žæ€§ç±»åž‹"/>
+ </style:text-properties>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+ </style:style>
+ </xsl:template>
+ <xsl:template name="表:æ•°æ®ç³»åˆ—集å¼æ ·">
+ <xsl:param name="table-name"/>
+ <xsl:param name="table-type"/>
+ <xsl:param name="table-subtype"/>
+ <xsl:param name="series-value-start"/>
+ <xsl:param name="series-value-end"/>
+ <xsl:param name="series-generate-type"/>
+ <xsl:for-each select="表:æ•°æ®ç³»åˆ—">
+ <style:style style:family="chart">
+ <xsl:variable name="current-positon" select="position()"/>
+ <xsl:attribute name="style:name"><xsl:value-of select="concat('data-series',$current-positon)"/></xsl:attribute>
+ <xsl:call-template name="表:æ•°æ®ç‚¹ç±»åž‹">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ <xsl:with-param name="recall-type" select="'data-series'"/>
+ </xsl:call-template>
+ </style:style>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="表:æ•°æ®ç‚¹é›†å¼æ ·">
+ <xsl:param name="table-name"/>
+ <xsl:param name="table-type"/>
+ <xsl:param name="table-subtype"/>
+ <xsl:param name="series-value-start"/>
+ <xsl:param name="series-value-end"/>
+ <xsl:param name="series-generate-type"/>
+ <xsl:for-each select="表:æ•°æ®ç‚¹">
+ <style:style style:family="chart">
+ <xsl:attribute name="style:name"><xsl:value-of select="concat('data-point',@表:系列,@表:点)"/></xsl:attribute>
+ <xsl:call-template name="表:æ•°æ®ç‚¹ç±»åž‹">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ <xsl:with-param name="recall-type" select="'data-point'"/>
+ </xsl:call-template>
+ </style:style>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="表:网格线集å¼æ ·">
+ <xsl:param name="table-name"/>
+ <xsl:param name="table-type"/>
+ <xsl:param name="table-subtype"/>
+ <xsl:param name="series-value-start"/>
+ <xsl:param name="series-value-end"/>
+ <xsl:param name="series-generate-type"/>
+ <xsl:for-each select="表:网格线">
+ <xsl:choose>
+ <xsl:when test="@表:ä½ç½®='category axis'">
+ <style:style style:name="category-axis-grid" style:family="chart">
+ <style:graphic-properties>
+ <xsl:call-template name="uof:边框"/>
+ </style:graphic-properties>
+ </style:style>
+ </xsl:when>
+ <xsl:when test="@表:ä½ç½®='value axis'">
+ <style:style style:name="value-axis-grid" style:family="chart">
+ <style:graphic-properties>
+ <xsl:call-template name="uof:边框"/>
+ </style:graphic-properties>
+ </style:style>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="表:æ•°æ®æºå¼æ ·">
+ <xsl:param name="table-name"/>
+ <xsl:param name="table-type"/>
+ <xsl:param name="table-subtype"/>
+ <xsl:param name="series-value-start"/>
+ <xsl:param name="series-value-end"/>
+ <xsl:param name="series-generate-type"/>
+ <xsl:for-each select="表:系列">
+ <style:style style:family="chart">
+ <xsl:variable name="current-positon" select="position()"/>
+ <xsl:attribute name="style:name"><xsl:value-of select="concat('data-source',$current-positon)"/></xsl:attribute>
+ </style:style>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="表:标题集å¼æ ·">
+ <xsl:param name="table-name"/>
+ <xsl:param name="table-type"/>
+ <xsl:param name="table-subtype"/>
+ <xsl:param name="series-value-start"/>
+ <xsl:param name="series-value-end"/>
+ <xsl:param name="series-generate-type"/>
+ <xsl:for-each select="表:标题">
+ <xsl:choose>
+ <xsl:when test="@表:ä½ç½®='chart'">
+ <style:style style:name="chart-title" style:family="chart">
+ <xsl:call-template name="表:标题类型">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ </xsl:call-template>
+ </style:style>
+ </xsl:when>
+ <xsl:when test="@表:ä½ç½®='category axis'">
+ <style:style style:name="category-axis-title" style:family="chart">
+ <xsl:call-template name="表:标题类型">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ </xsl:call-template>
+ </style:style>
+ </xsl:when>
+ <xsl:when test="@表:ä½ç½®='value axis'">
+ <style:style style:name="value-axis-title" style:family="chart">
+ <xsl:call-template name="表:标题类型">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ </xsl:call-template>
+ </style:style>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="表:å标轴类型">
+ <xsl:param name="table-name"/>
+ <xsl:param name="table-type"/>
+ <xsl:param name="table-subtype"/>
+ <xsl:param name="series-value-start"/>
+ <xsl:param name="series-value-end"/>
+ <xsl:param name="series-generate-type"/>
+ <xsl:param name="axis-type"/>
+ <style:chart-properties>
+ <xsl:choose>
+ <xsl:when test="@表:主刻度类型='cross'">
+ <xsl:attribute name="chart:tick-marks-major-inner">true</xsl:attribute>
+ <xsl:attribute name="chart:tick-marks-major-outer">true</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@表:主刻度类型='inside'">
+ <xsl:attribute name="chart:tick-marks-major-inner">true</xsl:attribute>
+ <xsl:attribute name="chart:tick-marks-major-outer">false</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@表:主刻度类型='outside'">
+ <xsl:attribute name="chart:tick-marks-major-inner">false</xsl:attribute>
+ <xsl:attribute name="chart:tick-marks-major-outer">true</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="@表:次刻度类型='cross'">
+ <xsl:attribute name="chart:tick-marks-minor-inner">true</xsl:attribute>
+ <xsl:attribute name="chart:tick-marks-minor-outer">true</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@表:次刻度类型='inside'">
+ <xsl:attribute name="chart:tick-marks-minor-inner">true</xsl:attribute>
+ <xsl:attribute name="chart:tick-marks-minor-outer">false</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@表:次刻度类型='outside'">
+ <xsl:attribute name="chart:tick-marks-minor-inner">false</xsl:attribute>
+ <xsl:attribute name="chart:tick-marks-minor-outer">true</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ <xsl:if test="@表:刻度线标志='next to axis'">
+ <xsl:attribute name="chart:display-label">true</xsl:attribute>
+ </xsl:if>
+ <xsl:for-each select="node()">
+ <xsl:choose>
+ <xsl:when test="name(.)='表:线型'">
+ <xsl:call-template name="uof:线型"/>
+ </xsl:when>
+ <xsl:when test="name(.)='表:数值'">
+ <xsl:attribute name="chart:link-data-style-to-source"><xsl:value-of select="@表:链接到æº"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="name(.)='表:刻度'">
+ <xsl:call-template name="表:刻度类型"/>
+ </xsl:when>
+ <xsl:when test="name(.)='表:对é½'">
+ <xsl:if test="表:文字方å‘">
+ <xsl:attribute name="fo:direction"><xsl:value-of select="表:文字方å‘"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="表:旋转角度">
+ <xsl:attribute name="text:rotation-angle"><xsl:value-of select="表:旋转角度"/></xsl:attribute>
+ </xsl:if>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+ </style:chart-properties>
+ <xsl:if test="表:字体">
+ <xsl:for-each select="表:字体">
+ <xsl:element name="style:text-properties">
+ <xsl:call-template name="å­—:å¥å±žæ€§ç±»åž‹"/>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="表:æ•°æ®ç‚¹ç±»åž‹">
+ <xsl:param name="table-name"/>
+ <xsl:param name="table-type"/>
+ <xsl:param name="table-subtype"/>
+ <xsl:param name="series-value-start"/>
+ <xsl:param name="series-value-end"/>
+ <xsl:param name="series-generate-type"/>
+ <xsl:param name="recall-type"/>
+ <xsl:if test="name(.)='表:æ•°æ®ç‚¹'">
+ <style:chart-properties>
+ <xsl:if test="$table-type='pie' and $table-subtype='pie_offset1' and @表:点='1'">
+ <xsl:attribute name="chart:pie-offset">10</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$table-type='pie' and $table-subtype='pie_offset2'">
+ <xsl:attribute name="chart:pie-offset">10</xsl:attribute>
+ </xsl:if>
+ </style:chart-properties>
+ </xsl:if>
+ <xsl:for-each select="node()">
+ <xsl:choose>
+ <xsl:when test="name(.)='表:边框'">
+ <style:graphic-properties>
+ <xsl:call-template name="uof:边框"/>
+ </style:graphic-properties>
+ </xsl:when>
+ <xsl:when test="name(.)='表:填充'">
+ <style:graphic-properties>
+ <xsl:call-template name="图:填充类型"/>
+ </style:graphic-properties>
+ </xsl:when>
+ <xsl:when test="name(.)='表:字体'">
+ <style:text-properties>
+ <xsl:call-template name="å­—:å¥å±žæ€§ç±»åž‹"/>
+ </style:text-properties>
+ </xsl:when>
+ <xsl:when test="name(.)='表:显示标志'">
+ <style:chart-properties>
+ <xsl:if test="@表:类别å">
+ <xsl:attribute name="chart:data-label-text"><xsl:value-of select="@表:类别å"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@表:数值">
+ <xsl:attribute name="chart:data-label-number">value</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@表:百分数">
+ <xsl:attribute name="chart:data-label-number">percentage</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@表:图例标志">
+ <xsl:attribute name="chart:data-label-symbol"><xsl:value-of select="@表:图例标志"/></xsl:attribute>
+ </xsl:if>
+ </style:chart-properties>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="表:标题类型">
+ <xsl:param name="table-name"/>
+ <xsl:param name="table-type"/>
+ <xsl:param name="table-subtype"/>
+ <xsl:param name="series-value-start"/>
+ <xsl:param name="series-value-end"/>
+ <xsl:param name="series-generate-type"/>
+ <xsl:for-each select="node()">
+ <xsl:choose>
+ <xsl:when test="name(.)='表:边框'">
+ <style:graphic-properties>
+ <xsl:call-template name="uof:边框"/>
+ </style:graphic-properties>
+ </xsl:when>
+ <xsl:when test="name(.)='表:填充'">
+ <style:graphic-properties>
+ <xsl:call-template name="图:填充类型"/>
+ </style:graphic-properties>
+ </xsl:when>
+ <xsl:when test="name(.)='表:对é½'">
+ <style:chart-properties>
+ <xsl:call-template name="表:对é½æ ¼å¼ç±»åž‹"/>
+ </style:chart-properties>
+ </xsl:when>
+ <xsl:when test="name(.)='表:字体'">
+ <style:text-properties>
+ <xsl:call-template name="å­—:å¥å±žæ€§ç±»åž‹"/>
+ </style:text-properties>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="uof:边框">
+ <xsl:if test="@uof:类型">
+ <xsl:variable name="type" select="@uof:类型"/>
+ <xsl:attribute name="draw:stroke"><xsl:choose><xsl:when test="@uof:类型='single'">solid</xsl:when><xsl:when test="@uof:类型='none'">none</xsl:when><xsl:otherwise>dash</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="draw:stroke-dash"><xsl:choose><xsl:when test="$type='dash'">Ultrafine_20_Dashed</xsl:when><xsl:when test="$type='dot-dash'">Ultrafine_20_2_20_Dots_20_3_20_Dashes</xsl:when><xsl:when test="$type='dashed-heavy'">Fine_20_Dashed</xsl:when><xsl:when test="$type='dotted' ">Fine_20_Dotted</xsl:when><xsl:when test="$type='dash-long-heavy'">Line_20_with_20_Fine_20_Dots</xsl:when><xsl:when test="$type='dash-long'">Fine_20_Dashed_20__28_var_29_</xsl:when><xsl:when test="$type='dash-dot-dot'">_33__20_Dashes_20_3_20_Dots_20__28_var_29_</xsl:when><xsl:when test="$type='dotted-heavy'">Ultrafine_20_Dotted_20__28_var_29_</xsl:when><xsl:when test="$type='thick'">Line_20_Style_20_9</xsl:when><xsl:when test="$type='dot-dot-dash'">_32__20_Dots_20_1_20_Dash</xsl:when><xsl:when test="$type='dash-dot-dot-heavy'">Dashed_20__28_var_29_</xsl:when><xsl:when test="$type='dash-dot-heavy'">Dash_20_10</xsl:when></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@uof:宽度">
+ <xsl:attribute name="svg:stroke-width"><xsl:value-of select="concat(@uof:宽度,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@uof:颜色">
+ <xsl:attribute name="svg:stroke-color"><xsl:value-of select="@uof:颜色"/></xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="图:填充类型">
+ <xsl:if test="图:颜色">
+ <xsl:attribute name="draw:fill">solid</xsl:attribute>
+ <xsl:attribute name="draw:fill-color"><xsl:value-of select="图:颜色"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="图:图片">
+ <xsl:attribute name="draw:fill">bitmap</xsl:attribute>
+ <xsl:attribute name="draw:fill-image-name"><xsl:value-of select="图:图片/@图:å称"/></xsl:attribute>
+ <xsl:if test="not(图:图片/@图:ä½ç½®='tile')">
+ <xsl:attribute name="style:repeat"><xsl:choose><xsl:when test="图:图片/@图:ä½ç½®='center'">no-repeat</xsl:when><xsl:when test="图:图片/@图:ä½ç½®='stretch'">stretch</xsl:when></xsl:choose></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="图:图案">
+ <xsl:attribute name="draw:fill">bitmap</xsl:attribute>
+ <xsl:attribute name="draw:fill-hatch-name"><xsl:value-of select="图:图案/@图:图形引用"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="图:æ¸å˜">
+ <xsl:attribute name="draw:fill">gradient</xsl:attribute>
+ <xsl:attribute name="draw:fill-gradient-name"><xsl:value-of select="图:æ¸å˜/@图:图形引用"/></xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="uof:线型">
+ <xsl:call-template name="uof:边框"/>
+ </xsl:template>
+ <xsl:template name="å­—:å¥å±žæ€§ç±»åž‹">
+ <xsl:apply-templates select="./*"/>
+ </xsl:template>
+ <xsl:template name="表:刻度类型">
+ <xsl:if test="表:最å°å€¼">
+ <xsl:attribute name="chart:minimum"><xsl:value-of select="表:最å°å€¼"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="表:最大值">
+ <xsl:attribute name="chart:maximum"><xsl:value-of select="表:最大值"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="表:主å•ä½">
+ <xsl:attribute name="chart:interval-major"><xsl:value-of select="表:主å•ä½"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="表:次å•ä½">
+ <xsl:attribute name="chart:interval-minor"><xsl:value-of select="表:次å•ä½"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="表:分类交å‰ç‚¹">
+ <xsl:attribute name="chart:origin"><xsl:value-of select="表:分类交å‰ç‚¹"/></xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="表:对é½æ ¼å¼ç±»åž‹">
+ <xsl:if test="表:文字方å‘">
+ <xsl:attribute name="style:direction"><xsl:value-of select="表:文字方å‘"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="表:文字旋转角度">
+ <xsl:attribute name="style:rotation-angle"><xsl:value-of select="表:文字旋转角度"/></xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="字:字体">
+ <xsl:if test="@å­—:å­—å·">
+ <xsl:attribute name="fo:font-size"><xsl:value-of select="@å­—:å­—å·"/>pt</xsl:attribute>
+ <xsl:attribute name="style:font-size-asian"><xsl:value-of select="@å­—:å­—å·"/>pt</xsl:attribute>
+ <xsl:attribute name="style:font-size-complex"><xsl:value-of select="@å­—:å­—å·"/>pt</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@å­—:ç›¸å¯¹å­—å· and self::node( )[not(parent::å­—:å¥å±žæ€§)]">
+ <xsl:variable name="stylename" select="parent::node()/@å­—:基å¼æ ·å¼•ç”¨"/>
+ <xsl:variable name="zihao">
+ <xsl:for-each select="/uof:UOF/uof:å¼æ ·é›†//uof:段è½å¼æ ·[@å­—:标识符=$stylename]">
+ <xsl:value-of select="å­—:字体/@å­—:å­—å·"/>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:variable name="font-size" select="@å­—:相对字å·"/>
+ <xsl:attribute name="fo:font-size"><xsl:value-of select="($zihao * $font-size div 100)"/>pt</xsl:attribute>
+ <xsl:attribute name="style:font-size-asian"><xsl:value-of select="($zihao * $font-size div 100)"/>pt</xsl:attribute>
+ <xsl:attribute name="style:font-size-complex"><xsl:value-of select="($zihao * $font-size div 100)"/>pt</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@字:颜色">
+ <xsl:attribute name="fo:color"><xsl:value-of select="string(@字:颜色)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@字:中文字体引用">
+ <xsl:attribute name="style:font-family-asian"><xsl:value-of select="@字:中文字体引用"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@字:西文字体引用">
+ <xsl:attribute name="fo:font-family"><xsl:value-of select="@字:西文字体引用"/></xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="字:斜体">
+ <xsl:if test="@字:值='true'">
+ <xsl:attribute name="fo:font-style">italic</xsl:attribute>
+ <xsl:attribute name="fo:font-style-asian">italic</xsl:attribute>
+ <xsl:attribute name="style:font-style-asian">italic</xsl:attribute>
+ <xsl:attribute name="style:font-style-complex">italic</xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="字:粗体">
+ <xsl:if test="@字:值='true'">
+ <xsl:attribute name="fo:font-weight">bold</xsl:attribute>
+ <xsl:attribute name="style:font-weight-asian">bold</xsl:attribute>
+ <xsl:attribute name="style:font-weight-complex">bold</xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="字:下划线">
+ <xsl:choose>
+ <xsl:when test="@字:类型 = 'single'">
+ <xsl:attribute name="style:text-underline-style">solid</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">auto</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'double'">
+ <xsl:attribute name="style:text-underline-style">solid</xsl:attribute>
+ <xsl:attribute name="style:text-underline-type">double</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">auto</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'thick'">
+ <xsl:attribute name="style:text-underline-style">solid</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">bold</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'dotted'">
+ <xsl:attribute name="style:text-underline-style">dotted</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">auto</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'dotted-heavy'">
+ <xsl:attribute name="style:text-underline-style">dotted</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">bold</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'dash'">
+ <xsl:attribute name="style:text-underline-style">dash</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">auto</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'dashed-heavy'">
+ <xsl:attribute name="style:text-underline-style">dash</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">bold</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'dash-long'">
+ <xsl:attribute name="style:text-underline-style">long-dash</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">auto</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'dash-long-heavy'">
+ <xsl:attribute name="style:text-underline-style">long-dash</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">bold</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'dot-dash'">
+ <xsl:attribute name="style:text-underline-style">dot-dash</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">auto</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'dash-dot-heavy'">
+ <xsl:attribute name="style:text-underline-style">dot-dash</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">bold</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'dot-dot-dash'">
+ <xsl:attribute name="style:text-underline-style">dot-dot-dash</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">auto</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'dash-dot-dot-heavy'">
+ <xsl:attribute name="style:text-underline-style">dot-dot-dash</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">bold</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'wave'">
+ <xsl:attribute name="style:text-underline-style">wave</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">auto</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'wavy-heavy'">
+ <xsl:attribute name="style:text-underline-style">wave</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">bold</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'wavy-double'">
+ <xsl:attribute name="style:text-underline-style">wave</xsl:attribute>
+ <xsl:attribute name="style:text-underline-type">double</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">auto</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="@字:颜色">
+ <xsl:attribute name="style:text-underline-color"><xsl:choose><xsl:when test="@字:颜色='auto'">font-color</xsl:when><xsl:otherwise><xsl:value-of select="@字:颜色"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:text-underline-color">font-color</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="å­—:ç€é‡å·">
+ <xsl:if test="not(@字:类型='none')">
+ <xsl:choose>
+ <xsl:when test="@字:类型='accent above' ">
+ <xsl:attribute name="style:text-emphasize">accent above</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型='dot above' ">
+ <xsl:attribute name="style:text-emphasize">dot above</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型='disc above' ">
+ <xsl:attribute name="style:text-emphasize">disc above</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型='circle above' ">
+ <xsl:attribute name="style:text-emphasize">circle above</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型='accent below' ">
+ <xsl:attribute name="style:text-emphasize">accent below</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型='dot below' ">
+ <xsl:attribute name="style:text-emphasize">dot below</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型='disc below' ">
+ <xsl:attribute name="style:text-emphasize">disc below</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型='circle below' ">
+ <xsl:attribute name="style:text-emphasize">circle below</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="字:颜色">
+ <xsl:attribute name="fo:color"><xsl:value-of select="@字:颜色"/></xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="å­—:éšè—文字">
+ <xsl:attribute name="text:display"><xsl:value-of select="@字:值"/></xsl:attribute>
+ </xsl:template>
+ <xsl:template match="字:空心">
+ <xsl:attribute name="style:text-outline"><xsl:value-of select="@字:值"/></xsl:attribute>
+ </xsl:template>
+ <xsl:template match="字:阴影">
+ <xsl:if test="not(@字:值='false')">
+ <xsl:attribute name="fo:text-shadow">1pt 1pt</xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="字:删除线">
+ <xsl:attribute name="style:text-line-through-style">solid</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="@字:类型='double'">
+ <xsl:attribute name="style:text-line-through-type">double</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型='single'">
+ <xsl:attribute name="style:text-underline-mode">continuous</xsl:attribute>
+ <xsl:attribute name="style:text-line-through-mode">continuous</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型='bold'">
+ <xsl:attribute name="style:text-line-through-width">bold</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型='带/'">
+ <xsl:attribute name="style:text-line-through-text">/</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型='带X'">
+ <xsl:attribute name="style:text-line-through-text">X</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="@字:颜色[not(.='auto')]">
+ <xsl:attribute name="fo:color">#<xsl:value-of select="."/></xsl:attribute>
+ </xsl:template>
+ <xsl:template match="字:浮雕">
+ <xsl:attribute name="style:font-relief"><xsl:choose><xsl:when test="@字:类型='engrave'">engraved</xsl:when><xsl:when test="@字:类型='emboss'">embossed</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:template>
+ <xsl:template match="字:醒目字体">
+ <xsl:choose>
+ <xsl:when test="@字:类型='small-caps'">
+ <xsl:attribute name="fo:font-variant">small-caps</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型='none'">
+ <xsl:attribute name="fo:font-variant">normal</xsl:attribute>
+ <xsl:attribute name="fo:text-transform">none</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:text-transform"><xsl:choose><xsl:when test="@字:类型='uppercase'">uppercase</xsl:when><xsl:when test="@字:类型='lowercase'">lowercase</xsl:when><xsl:when test="@字:类型='capital'">capitalize</xsl:when></xsl:choose></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="å­—:ä½ç½®">
+ <xsl:attribute name="style:text-position"><xsl:value-of select="."/></xsl:attribute>
+ </xsl:template>
+ <xsl:template match="字:缩放">
+ <xsl:attribute name="style:text-scale"><xsl:value-of select="."/></xsl:attribute>
+ </xsl:template>
+ <xsl:template match="å­—:字符间è·">
+ <xsl:attribute name="fo:letter-spacing"><xsl:value-of select="."/></xsl:attribute>
+ </xsl:template>
+ <xsl:template match="å­—:调整字间è·">
+ <xsl:attribute name="style:letter-kerning"><xsl:value-of select="."/></xsl:attribute>
+ </xsl:template>
+ <xsl:template match="字:外框">
+ <xsl:attribute name="style:text-outline">true</xsl:attribute>
+ </xsl:template>
+ <xsl:template match="字:缩放">
+ <xsl:attribute name="style:text-scale"><xsl:value-of select="."/></xsl:attribute>
+ </xsl:template>
+ <xsl:template match="å­—:字符间è·[parent::å­—:å¥å±žæ€§]">
+ <xsl:attribute name="fo:letter-spacing"><xsl:value-of select="concat( number(.)* $other-to-cm-conversion-factor, $uofUnit)"/></xsl:attribute>
+ </xsl:template>
+ <xsl:template name="General-Char-Transition">
+ <xsl:param name="input-char"/>
+ <xsl:param name="output-type"/>
+ <xsl:choose>
+ <xsl:when test="$input-char='A' or $input-char='a' or $input-char='1' or $input-char='Roman_I' or $input-char='Roman_i' or $input-char='一' or $input-char='壹' or $input-char='甲' or $input-char='å­'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">1</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">a</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">A</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">I</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">i</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">1</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">一</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">1</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">壹</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">1</xsl:when>
+ <xsl:when test="$output-type='TIAN_GAN_ZH'">甲</xsl:when>
+ <xsl:when test="$output-type='DI_ZI_ZH'">å­</xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='B' or $input-char='b' or $input-char='2' or $input-char='Roman_II' or $input-char='Roman_ii' or $input-char='二' or $input-char='贰' or $input-char='乙' or $input-char='丑'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">2</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">b</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">B</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">II</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">ii</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">ï¼’</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">二</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">2</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">è´°</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">2</xsl:when>
+ <xsl:when test="$output-type='TIAN_GAN_ZH'">ä¹™</xsl:when>
+ <xsl:when test="$output-type='DI_ZI_ZH'">丑</xsl:when>
+ <xsl:otherwise>2</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='C' or $input-char='c' or $input-char='3' or $input-char='Roman_III' or $input-char='Roman_iii' or $input-char='三' or $input-char='å' or $input-char='丙' or $input-char='寅'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">3</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">c</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">C</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">III</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">iii</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">3</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">三</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">3</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">å</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">3</xsl:when>
+ <xsl:when test="$output-type='TIAN_GAN_ZH'">丙</xsl:when>
+ <xsl:when test="$output-type='DI_ZI_ZH'">寅</xsl:when>
+ <xsl:otherwise>3</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='D' or $input-char='d' or $input-char='4' or $input-char='Roman_IV' or $input-char='Roman_iv' or $input-char='å››' or $input-char='肆' or $input-char='ä¸' or $input-char='å¯'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">4</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">d</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">D</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">IV</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">iv</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">ï¼”</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">å››</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">4</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">肆</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">4</xsl:when>
+ <xsl:when test="$output-type='TIAN_GAN_ZH'">ä¸</xsl:when>
+ <xsl:when test="$output-type='DI_ZI_ZH'">å¯</xsl:when>
+ <xsl:otherwise>4</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='E' or $input-char='e' or $input-char='5' or $input-char='Roman_V' or $input-char='Roman_v' or $input-char='五' or $input-char='ä¼' or $input-char='戊' or $input-char='è¾°'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">5</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">e</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">E</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">V</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">v</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">5</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">五</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">5</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">ä¼</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">5</xsl:when>
+ <xsl:when test="$output-type='TIAN_GAN_ZH'">戊</xsl:when>
+ <xsl:when test="$output-type='DI_ZI_ZH'">è¾°</xsl:when>
+ <xsl:otherwise>5</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='F' or $input-char='f' or $input-char='6' or $input-char='Roman_VI' or $input-char='Roman_vi' or $input-char='六' or $input-char='陆' or $input-char='己' or $input-char='巳'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">6</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">f</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">F</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">VI</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">vi</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">ï¼–</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">å…­</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">ï¼–</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">陆</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">ï¼–</xsl:when>
+ <xsl:when test="$output-type='TIAN_GAN_ZH'">å·±</xsl:when>
+ <xsl:when test="$output-type='DI_ZI_ZH'">å·³</xsl:when>
+ <xsl:otherwise>6</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='G' or $input-char='g' or $input-char='7' or $input-char='ï¼—' or $input-char='Roman_VII' or $input-char='Roman_vii' or $input-char='七' or $input-char='柒' or $input-char='庚' or $input-char='åˆ'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">7</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">g</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">G</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">VII</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">vii</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">ï¼—</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">七</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">7</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">柒</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">7</xsl:when>
+ <xsl:when test="$output-type='TIAN_GAN_ZH'">庚</xsl:when>
+ <xsl:when test="$output-type='DI_ZI_ZH'">åˆ</xsl:when>
+ <xsl:otherwise>7</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='H' or $input-char='h' or $input-char='8' or $input-char='Roman_VIII' or $input-char='Roman_viii' or $input-char='å…«' or $input-char='æŒ' or $input-char='è¾›' or $input-char='未'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">8</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">h</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">H</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">VIII</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">viii</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">8</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">å…«</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">8</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">æŒ</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">8</xsl:when>
+ <xsl:when test="$output-type='TIAN_GAN_ZH'">è¾›</xsl:when>
+ <xsl:when test="$output-type='DI_ZI_ZH'">未</xsl:when>
+ <xsl:otherwise>8</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='I' or $input-char='i' or $input-char='9' or $input-char='Roman_IX' or $input-char='Roman_ix' or $input-char='ä¹' or $input-char='玖' or $input-char='壬' or $input-char='申'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">9</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">i</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">I</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">IX</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">ix</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">ï¼™</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">ä¹</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">ï¼™</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">玖</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">ï¼™</xsl:when>
+ <xsl:when test="$output-type='TIAN_GAN_ZH'">壬</xsl:when>
+ <xsl:when test="$output-type='DI_ZI_ZH'">申</xsl:when>
+ <xsl:otherwise>9</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='J' or $input-char='j' or $input-char='10' or $input-char='Roman_X' or $input-char='Roman_x' or $input-char='å' or $input-char='拾' or $input-char='癸' or $input-char='é…‰'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">10</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">j</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">J</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">X</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">x</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">10</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">å</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">10</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">拾</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">10</xsl:when>
+ <xsl:when test="$output-type='TIAN_GAN_ZH'">癸</xsl:when>
+ <xsl:when test="$output-type='DI_ZI_ZH'">é…‰</xsl:when>
+ <xsl:otherwise>10</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='K' or $input-char='k' or $input-char='11' or $input-char='Roman_XI' or $input-char='Roman_xi' or $input-char='å一' or $input-char='拾壹' or $input-char='戌'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">11</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">k</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">K</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XI</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xi</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">11</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">å一</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">11</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">拾壹</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">11</xsl:when>
+ <xsl:when test="$output-type='DI_ZI_ZH'">戌</xsl:when>
+ <xsl:otherwise>11</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='L' or $input-char='l' or $input-char='12' or $input-char='Roman_XII' or $input-char='Roman_xii' or $input-char='å二' or $input-char='拾贰' or $input-char='亥'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">12</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">l</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">L</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XII</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xii</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">12</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">å二</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">12</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">拾贰</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">12</xsl:when>
+ <xsl:when test="$output-type='DI_ZI_ZH'">亥</xsl:when>
+ <xsl:otherwise>12</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='M' or $input-char='m' or $input-char='13' or $input-char='Roman_XIII' or $input-char='Roman_xiii' or $input-char='å三' or $input-char='拾å'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">13</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">m</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">M</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XIII</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xiii</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">13</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">å三</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">13</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">拾å</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">13</xsl:when>
+ <xsl:otherwise>13</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='N' or $input-char='n' or $input-char='14' or $input-char='Roman_XIV' or $input-char='Roman_xiv' or $input-char='åå››' or $input-char='拾肆'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">14</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">n</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">N</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XIV</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xiv</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">14</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">åå››</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">14</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">拾肆</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">14</xsl:when>
+ <xsl:otherwise>14</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='O' or $input-char='o' or $input-char='15' or $input-char='Roman_XV' or $input-char='Roman_xv' or $input-char='å五' or $input-char='拾ä¼'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">15</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">o</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">O</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XV</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xv</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">15</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">å五</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">15</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">拾ä¼</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">15</xsl:when>
+ <xsl:otherwise>15</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='P' or $input-char='p' or $input-char='16' or $input-char='Roman_XVI' or $input-char='Roman_xvi' or $input-char='åå…­' or $input-char='拾陆'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">16</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">p</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">P</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XVI</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xvi</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">16</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">åå…­</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">16</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">拾陆</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">16</xsl:when>
+ <xsl:otherwise>16</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='Q' or $input-char='q' or $input-char='17' or $input-char='Roman_XVII' or $input-char='Roman_xvii' or $input-char='å七' or $input-char='拾柒'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">17</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">q</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">Q</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XVII</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xvii</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">17</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">å七</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">17</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">拾柒</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">17</xsl:when>
+ <xsl:otherwise>17</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='R' or $input-char='r' or $input-char='18' or $input-char='Roman_XVIII' or $input-char='Roman_xviii' or $input-char='åå…«' or $input-char='拾æŒ'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">18</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">r</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">R</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XVIII</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xviii</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">18</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">åå…«</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">18</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">拾æŒ</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">18</xsl:when>
+ <xsl:otherwise>18</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='S' or $input-char='s' or $input-char='19' or $input-char='Roman_XIX' or $input-char='Roman_xix' or $input-char='åä¹' or $input-char='拾玖'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">19</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">s</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">S</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XIX</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xix</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">19</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">åä¹</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">19</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">拾玖</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">19</xsl:when>
+ <xsl:otherwise>19</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='T' or $input-char='t' or $input-char='20' or $input-char='Roman_XX' or $input-char='Roman_xx' or $input-char='二å' or $input-char='贰拾'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">20</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">t</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">T</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XX</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xx</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">20</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">二å</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">20</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">贰拾</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">20</xsl:when>
+ <xsl:otherwise>20</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='U' or $input-char='u' or $input-char='21' or $input-char='Roman_XXI' or $input-char='Roman_xxi' or $input-char='二å一' or $input-char='贰拾壹'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">21</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">u</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">U</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XXI</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xxi</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">21</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">二å一</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">21</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">贰拾壹</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">21</xsl:when>
+ <xsl:otherwise>21</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='V' or $input-char='v' or $input-char='22' or $input-char='Roman_XXII' or $input-char='Roman_xxii' or $input-char='二å二' or $input-char='贰拾贰'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">22</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">v</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">V</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XXII</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xxii</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">22</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">二å二</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">22</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">贰拾贰</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">22</xsl:when>
+ <xsl:otherwise>22</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='W' or $input-char='w' or $input-char='23' or $input-char='Roman_XXIII' or $input-char='Roman_xxiii' or $input-char='二å三' or $input-char='贰拾å'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">23</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">w</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">W</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XXIII</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xxiii</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">23</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">二å三</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">23</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">贰拾å</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">23</xsl:when>
+ <xsl:otherwise>23</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='X' or $input-char='x' or $input-char='24' or $input-char='Roman_XXIV' or $input-char='Roman_xxiv' or $input-char='二åå››' or $input-char='贰拾肆'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">24</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">x</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">X</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XXIV</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xxiv</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">24</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">二åå››</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">24</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">贰拾肆</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">24</xsl:when>
+ <xsl:otherwise>24</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='Y' or $input-char='y' or $input-char='25' or $input-char='Roman_XXV' or $input-char='Roman_xxv' or $input-char='二å五' or $input-char='贰拾ä¼'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">25</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">y</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">Y</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XXV</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xxv</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">25</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">二å五</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">25</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">贰拾ä¼</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">25</xsl:when>
+ <xsl:otherwise>25</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='Z' or $input-char='z' or $input-char='26' or $input-char='Roman_XXVI' or $input-char='Roman_xxvi' or $input-char='二åå…­' or $input-char='贰拾陆'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">26</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">z</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">Z</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XXVI</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xxvi</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">26</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">二åå…­</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">26</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">贰拾陆</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">26</xsl:when>
+ <xsl:otherwise>26</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">1</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">a</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">A</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">I</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">i</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">1</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">一</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">1</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">壹</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">1</xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!--RedOffice comment (Zengjh) end charts-->
+ <!-- 以下模æ¿çš„作用是将网格线颜色由16进制转æ¢ä¸ºå进制 -->
+ <xsl:template name="transform-hex-to-decimal">
+ <xsl:param name="number"/>
+ <xsl:variable name="R-color-number">
+ <xsl:call-template name="color-hex-to-decimal">
+ <xsl:with-param name="chars" select="substring($number,2,2)"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="G-color-number">
+ <xsl:call-template name="color-hex-to-decimal">
+ <xsl:with-param name="chars" select="substring($number,4,2)"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="B-color-number">
+ <xsl:call-template name="color-hex-to-decimal">
+ <xsl:with-param name="chars" select="substring($number,6,2)"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="$R-color-number * 65536 + $G-color-number * 256 + $B-color-number"/>
+ </xsl:template>
+ <!-- 以下模æ¿çš„作用是为R或G或B颜色转æ¢ä¸ºå进制形å¼-->
+ <xsl:template name="color-hex-to-decimal">
+ <xsl:param name="chars"/>
+ <xsl:variable name="first-num">
+ <xsl:call-template name="hex-to-decimal">
+ <xsl:with-param name="char" select="substring($chars,1,1)"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="second-num">
+ <xsl:call-template name="hex-to-decimal">
+ <xsl:with-param name="char" select="substring($chars,2,1)"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="$first-num *16 + $second-num"/>
+ </xsl:template>
+ <xsl:template name="hex-to-decimal">
+ <xsl:param name="char"/>
+ <xsl:choose>
+ <xsl:when test="$char='0'">0</xsl:when>
+ <xsl:when test="$char='1'">1</xsl:when>
+ <xsl:when test="$char='2'">2</xsl:when>
+ <xsl:when test="$char='3'">3</xsl:when>
+ <xsl:when test="$char='4'">4</xsl:when>
+ <xsl:when test="$char='5'">5</xsl:when>
+ <xsl:when test="$char='6'">6</xsl:when>
+ <xsl:when test="$char='7'">7</xsl:when>
+ <xsl:when test="$char='8'">8</xsl:when>
+ <xsl:when test="$char='9'">9</xsl:when>
+ <xsl:when test="$char='a'">10</xsl:when>
+ <xsl:when test="$char='b'">11</xsl:when>
+ <xsl:when test="$char='c'">12</xsl:when>
+ <xsl:when test="$char='d'">13</xsl:when>
+ <xsl:when test="$char='e'">14</xsl:when>
+ <xsl:when test="$char='f'">15</xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <!-- end -->
+ <!--ro000179 chenjh-->
+ <xsl:template name="search-left-top-in-tables">
+ <xsl:param name="cellstylename"/>
+ <xsl:param name="tableslist"/>
+ <xsl:param name="return"/>
+ <xsl:choose>
+ <xsl:when test="$tableslist and $return=''">
+ <xsl:variable name="firsttablerows" select="$tableslist[1]//表:行"/>
+ <xsl:variable name="first-left-top">
+ <xsl:call-template name="search-left-top-inatable">
+ <xsl:with-param name="row-num" select="'1'"/>
+ <xsl:with-param name="firsttablerows" select="$firsttablerows"/>
+ <xsl:with-param name="cellstylename" select="$cellstylename"/>
+ <xsl:with-param name="return" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="rest-left-top">
+ <xsl:call-template name="search-left-top-in-tables">
+ <xsl:with-param name="cellstylename" select="$cellstylename"/>
+ <xsl:with-param name="tableslist" select="$tableslist[position()!=1]"/>
+ <xsl:with-param name="return" select="$first-left-top"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$first-left-top!=''">
+ <xsl:value-of select="$first-left-top"/>
+ </xsl:when>
+ <xsl:when test="$rest-left-top!=''">
+ <xsl:value-of select="$rest-left-top"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="''"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$return"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- 以下模æ¿çš„作用为在一个table中寻找左上角-->
+ <xsl:template name="search-left-top-inatable">
+ <xsl:param name="row-num"/>
+ <xsl:param name="firsttablerows"/>
+ <xsl:param name="cellstylename"/>
+ <xsl:param name="return"/>
+ <xsl:choose>
+ <xsl:when test="$firsttablerows and $return=''">
+ <xsl:variable name="firstcells" select="$firsttablerows[1]/表:å•å…ƒæ ¼"/>
+ <xsl:variable name="first-left-top">
+ <xsl:call-template name="search-left-top-inarow">
+ <xsl:with-param name="row-num" select="$row-num"/>
+ <xsl:with-param name="firstcells" select="$firstcells"/>
+ <xsl:with-param name="cellstylename" select="$cellstylename"/>
+ <xsl:with-param name="return" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="row-num-p">
+ <xsl:choose>
+ <xsl:when test="$firsttablerows[1]/@表:跨度">
+ <xsl:value-of select="$row-num+ $firsttablerows[1]/@表:跨度"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$row-num+1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="rest-left-top">
+ <xsl:call-template name="search-left-top-inatable">
+ <xsl:with-param name="row-num" select="$row-num-p"/>
+ <xsl:with-param name="firsttablerows" select="$firsttablerows[position()!=1]"/>
+ <xsl:with-param name="cellstylename" select="$cellstylename"/>
+ <xsl:with-param name="return" select="$first-left-top"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$first-left-top!=''">
+ <xsl:value-of select="$first-left-top"/>
+ </xsl:when>
+ <xsl:when test="$rest-left-top !=''">
+ <xsl:value-of select="$rest-left-top "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="''"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$return"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- 以下模æ¿çš„作用为在æŸä¸€è¡Œä¸­å¯»æ‰¾å·¦ä¸Šè§’-->
+ <xsl:template name="search-left-top-inarow">
+ <xsl:param name="row-num"/>
+ <xsl:param name="firstcells"/>
+ <xsl:param name="cellstylename"/>
+ <xsl:param name="return"/>
+ <xsl:choose>
+ <xsl:when test="$firstcells and $return=''">
+ <xsl:variable name="firstcell" select="$firstcells[1]"/>
+ <xsl:variable name="first-left-top">
+ <xsl:call-template name="search-left-top-inacell">
+ <xsl:with-param name="row-num" select="$row-num"/>
+ <xsl:with-param name="cell" select="$firstcell"/>
+ <xsl:with-param name="cellstylename" select="$cellstylename"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="rest-left-top">
+ <xsl:call-template name="search-left-top-inarow">
+ <xsl:with-param name="row-num" select="$row-num"/>
+ <xsl:with-param name="firstcells" select="$firstcells[position()!=1]"/>
+ <xsl:with-param name="cellstylename" select="$cellstylename"/>
+ <xsl:with-param name="return" select="$first-left-top"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$first-left-top!=''">
+ <xsl:value-of select="$first-left-top"/>
+ </xsl:when>
+ <xsl:when test="$rest-left-top !=''">
+ <xsl:value-of select="$rest-left-top "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="''"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$return"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- 以下的模æ¿çš„作用为判断æŸä¸ªcell是å¦ä¸ºå·¦ä¸Šè§’ -->
+ <xsl:template name="search-left-top-inacell">
+ <xsl:param name="row-num"/>
+ <xsl:param name="cell"/>
+ <xsl:param name="cellstylename"/>
+ <xsl:choose>
+ <xsl:when test="$cell/@表:å¼æ ·å¼•ç”¨=$cellstylename">
+ <xsl:value-of select="concat($cell/ancestor::表:工作表/@表:å称,'.',$cell/@表:列å·,' ',$row-num)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="''"/>
+ <!-- <xsl:variable name="style-is-default">
+ <xsl:call-template name="is-default-or-not-condition-format">
+ <xsl:with-param name="column-num" select="$cell/@表:列å·"/>
+ <xsl:with-param name="cell" select="$cell"/>
+ <xsl:with-param name="preceding-cellstylename" select="''"/>
+ <xsl:with-param name="temp-num" select="'0'"/>
+ <xsl:with-param name="cellstylename" select="$cellstylename"/>
+ <xsl:with-param name="table-collumns" select="$cell/ancestor::表:工作表内容//表:列"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$style-is-default='yes' ">
+ <xsl:value-of select="concat($cell/ancestor::表:工作表/@表:å称,'.',$cell/@表:列å·,' ',$row-num)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="''"/>
+ </xsl:otherwise>
+ </xsl:choose> -->
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="translate-left-top">
+ <xsl:param name="left-top"/>
+ <xsl:if test="$left-top!=''">
+ <xsl:variable name="column-number" select="substring-before(substring-after($left-top,'.'),' ')"/>
+ <xsl:variable name="column-number1">
+ <xsl:value-of select="floor( $column-number div 26 )"/>
+ </xsl:variable>
+ <xsl:variable name="column-number2">
+ <xsl:value-of select="$column-number mod 26"/>
+ </xsl:variable>
+ <xsl:variable name="column-character1">
+ <xsl:call-template name="number-to-character">
+ <xsl:with-param name="number" select="$column-number1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="column-character2">
+ <xsl:call-template name="number-to-character">
+ <xsl:with-param name="number" select="$column-number2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="concat(substring-before($left-top,'.'),'.',$column-character1,$column-character2,substring-after($left-top,' '))"/>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="create-the-condition-format-map">
+ <xsl:param name="condition-format-set"/>
+ <xsl:param name="current-left-top"/>
+ <xsl:if test="$condition-format-set">
+ <xsl:choose>
+ <xsl:when test="contains($condition-format-set[1]/表:区域/text(),$current-left-top)">
+ <xsl:for-each select="$condition-format-set[1]/表:æ¡ä»¶">
+ <xsl:variable name="condition-text">
+ <xsl:choose>
+ <xsl:when test="@表:类型='cell value'">
+ <xsl:choose>
+ <xsl:when test="表:æ“作ç /text()='between' ">
+ <xsl:value-of select="concat('cell-content-is-between','(',表:第一æ“作数/text(),',',表:第二æ“作数/text(),')')"/>
+ </xsl:when>
+ <xsl:when test=" 表:æ“作ç /text()='not between'">
+ <xsl:value-of select="concat('cell-content-is-not-between','(',表:第一æ“作数/text(),',',表:第二æ“作数/text(),')')"/>
+ </xsl:when>
+ <xsl:when test="表:æ“作ç /text()='equal to'">
+ <xsl:value-of select="concat('cell-content()=',表:第一æ“作数/text())"/>
+ </xsl:when>
+ <xsl:when test="表:æ“作ç /text()='not equal to'">
+ <xsl:value-of select="concat('cell-content()!=',表:第一æ“作数/text())"/>
+ </xsl:when>
+ <xsl:when test="表:æ“作ç /text()='greater than'">
+ <xsl:value-of select="concat('cell-content()&gt;',表:第一æ“作数/text())"/>
+ </xsl:when>
+ <xsl:when test="表:æ“作ç /text()='less than'">
+ <xsl:value-of select="concat('cell-content()&lt;',表:第一æ“作数/text())"/>
+ </xsl:when>
+ <xsl:when test="表:æ“作ç /text()='greater than or equal to'">
+ <xsl:value-of select="concat('cell-content()&gt;=',表:第一æ“作数/text())"/>
+ </xsl:when>
+ <xsl:when test="表:æ“作ç /text()='less than or equal to'">
+ <xsl:value-of select="concat('cell-content()&lt;=',表:第一æ“作数/text())"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="@表:类型='formula'">
+ <xsl:value-of select="concat('is-true-formula','(',表:第一æ“作数/text(),')')"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:element name="style:map">
+ <xsl:attribute name="style:condition"><xsl:value-of select="$condition-text"/></xsl:attribute>
+ <xsl:attribute name="style:apply-style-name"><xsl:value-of select="//uof:å•å…ƒæ ¼å¼æ ·[@表:标识符=current()/表:æ ¼å¼/@表:å¼æ ·å¼•ç”¨]/@表:å称"/></xsl:attribute>
+ <xsl:attribute name="style:base-cell-address"><xsl:value-of select="substring-after($condition-format-set[1]/表:区域/text(),':')"/></xsl:attribute>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="create-the-condition-format-map">
+ <xsl:with-param name="condition-format-set" select="$condition-format-set[position()!=1]"/>
+ <xsl:with-param name="current-left-top" select="$current-left-top"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:template>
+ <!--ro000179 end-->
+</xsl:stylesheet>
diff --git a/filter/source/xslt/import/uof/uof2odf_text.xsl b/filter/source/xslt/import/uof/uof2odf_text.xsl
new file mode 100644
index 000000000000..abf597853c97
--- /dev/null
+++ b/filter/source/xslt/import/uof/uof2odf_text.xsl
@@ -0,0 +1,4650 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:uof="http://schemas.uof.org/cn/2003/uof" xmlns:表="http://schemas.uof.org/cn/2003/uof-spreadsheet" xmlns:演="http://schemas.uof.org/cn/2003/uof-slideshow" xmlns:字="http://schemas.uof.org/cn/2003/uof-wordproc" xmlns:图="http://schemas.uof.org/cn/2003/graph" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:smil="urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0" xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" office:version="1.0">
+ <xsl:template match="uof:UOF">
+ <office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:smil="urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0" xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" office:version="1.0">
+ <xsl:apply-templates select="uof:元数æ®"/>
+ <xsl:apply-templates select="uof:文字处ç†/å­—:公用处ç†è§„则/å­—:文档设置"/>
+ <xsl:apply-templates select="uof:字体集"/>
+ <xsl:apply-templates select="uof:å¼æ ·é›†"/>
+ <xsl:apply-templates select="uof:文字处ç†"/>
+ </office:document>
+ </xsl:template>
+ <xsl:template match="uof:元数æ®">
+ <xsl:element name="office:meta">
+ <meta:generator>UOFText 2004</meta:generator>
+ <dc:title>
+ <xsl:value-of select="uof:标题"/>
+ </dc:title>
+ <dc:description>
+ <xsl:value-of select="uof:摘è¦"/>
+ </dc:description>
+ <dc:subject>
+ <xsl:value-of select="uof:主题"/>
+ </dc:subject>
+ <meta:initial-creator>
+ <xsl:value-of select="uof:创建者"/>
+ </meta:initial-creator>
+ <meta:creation-date>
+ <xsl:value-of select="substring-before( uof:创建日期, 'Z')"/>
+ </meta:creation-date>
+ <dc:creator>
+ <xsl:value-of select="uof:最åŽä½œè€…"/>
+ </dc:creator>
+ <dc:date>
+ <xsl:value-of select="substring-before( uof:编辑时间, 'Z')"/>
+ </dc:date>
+ <meta:printed-by/>
+ <meta:print-date/>
+ <meta:keywords>
+ <meta:keyword>
+ <xsl:value-of select="uof:关键字集/uof:关键字"/>
+ </meta:keyword>
+ </meta:keywords>
+ <dc:language/>
+ <meta:editing-cycles>
+ <xsl:value-of select="uof:编辑次数"/>
+ </meta:editing-cycles>
+ <meta:editing-duration>
+ <xsl:if test="uof:编辑时间">
+ <xsl:value-of select="concat('PT', floor(uof:编辑时间 div 60), 'H', uof:编辑时间 mod 60, 'M0S')"/>
+ </xsl:if>
+ </meta:editing-duration>
+ <meta:user-defined meta:name="Category">
+ <xsl:value-of select="uof:分类"/>
+ </meta:user-defined>
+ <meta:user-defined meta:name="Manager">
+ <xsl:value-of select="uof:ç»ç†å称"/>
+ </meta:user-defined>
+ <meta:user-defined meta:name="Company">
+ <xsl:value-of select="uof:å…¬å¸å称"/>
+ </meta:user-defined>
+ <meta:user-defined meta:name="Version">
+ <xsl:value-of select="uof:创建应用程åº"/>
+ </meta:user-defined>
+ <xsl:if test="uof:文档模æ¿|child::*[@uof:locID='u0013']">
+ <meta:template xlink:type="simple" xlink:actuate="onRequest" xlink:href="{child::*[@uof:locID='u0013']}"/>
+ </xsl:if>
+ <xsl:if test="uof:用户自定义元数æ®é›†/uof:用户自定义元数æ®|child::*[@uof:locID='u0016']/*[@uof:locID='u0017']">
+ <xsl:for-each select="uof:用户自定义元数æ®é›†/uof:用户自定义元数æ®|child::*[@uof:locID='u0016']/*[@uof:locID='u0017']">
+ <xsl:element name="meta:user-defined">
+ <xsl:attribute name="meta:name"><xsl:value-of select="@uof:å称"/></xsl:attribute>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:if>
+ <meta:document-statistic>
+ <xsl:attribute name="meta:page-count">
+ <xsl:choose>
+ <xsl:when test="child::*[@uof:locID='u0020']"><xsl:value-of select="uof:页数"/></xsl:when>
+ <xsl:otherwise>
+ <xsl:for-each select="/uof:UOF/uof:文字处ç†/å­—:主体/å­—:段è½/å­—:域开始[@å­—:类型='numpages']">
+ <xsl:variable name="date0" select="substring-after(../å­—:域代ç /å­—:段è½/å­—:å¥/å­—:文本串,' \* ')"/>
+ <xsl:variable name="fmt">
+ <xsl:value-of select="substring-before($date0,' \*')"/>
+ </xsl:variable>
+ <xsl:if test="$fmt='Arabic'"><xsl:value-of select="following-sibling::å­—:å¥/å­—:文本串"/></xsl:if>
+ <xsl:if test="not($fmt='Arabic')">
+ <xsl:variable name="content">
+ <xsl:value-of select="following-sibling::å­—:å¥/å­—:文本串"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$content='I' or $content='i' or $content='A' or $content='a'">1</xsl:when>
+ <xsl:when test="$content='II' or $content='ii' or $content='B' or $content='b'">2</xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:attribute name="meta:paragraph-count"><xsl:if test="child::*[@uof:locID='u0025']"><xsl:value-of select="uof:段è½æ•°"/></xsl:if></xsl:attribute>
+ <xsl:attribute name="meta:word-count"><xsl:if test="child::*[@uof:locID='u0023']"><xsl:value-of select="uof:中文字符数"/></xsl:if></xsl:attribute>
+ <xsl:attribute name="meta:object-count"><xsl:if test="child::*[@uof:locID='u0026']"><xsl:value-of select="uof:对象数"/></xsl:if></xsl:attribute>
+ <xsl:attribute name="meta:character-count">
+ <xsl:for-each select="/uof:UOF/uof:文字处ç†/å­—:主体/å­—:段è½/å­—:域开始[@å­—:类型='numchars']">
+ <xsl:value-of select="following-sibling::å­—:å¥/å­—:文本串"/>
+ </xsl:for-each>
+ <xsl:if test="child::*[@uof:locID='u0021']"><xsl:value-of select="uof:å­—æ•°"/></xsl:if>
+ </xsl:attribute>
+ </meta:document-statistic>
+ <meta:document-statistic/>
+ </xsl:element>
+ </xsl:template>
+ <xsl:variable name="uofUnit">
+ <xsl:variable name="uu">
+ <xsl:value-of select="/uof:UOF/uof:文字处ç†/å­—:公用处ç†è§„则/å­—:文档设置/å­—:度é‡å•ä½"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$uu='cm'">cm</xsl:when>
+ <xsl:when test="$uu='mm'">mm</xsl:when>
+ <xsl:when test="$uu='pt'">pt</xsl:when>
+ <xsl:when test="$uu='inch'">in</xsl:when>
+ <xsl:otherwise>cm</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="other-to-cm-conversion-factor">
+ <xsl:choose>
+ <xsl:when test="$uofUnit='cm'">1</xsl:when>
+ <xsl:when test="$uofUnit='mm'">0.1</xsl:when>
+ <xsl:when test="$uofUnit='pt'">0.03527</xsl:when>
+ <xsl:when test="$uofUnit='inch'">2.54</xsl:when>
+ <xsl:when test="$uofUnit='pica'">0.4233</xsl:when>
+ <xsl:otherwise>0.03527</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:template match="uof:å¼æ ·é›†">
+ <xsl:apply-templates select="uof:字体集"/>
+ <xsl:variable name="default_paragraph_style" select="uof:段è½å¼æ ·"/>
+ <xsl:variable name="default_character_style" select="uof:å¥å¼æ ·"/>
+ <xsl:variable name="default_table_style" select="uof:文字表å¼æ ·"/>
+ <office:styles>
+ <xsl:if test="uof:段è½å¼æ ·[@å­—:类型 = 'default']">
+ <style:default-style style:family="paragraph">
+ <xsl:element name="style:paragraph-properties">
+ <xsl:attribute name="style:tab-stop-distance"><xsl:value-of select="concat( number(/uof:UOF/uof:文字处ç†/å­—:公用处ç†è§„则/å­—:文档设置/å­—:默认制表ä½ä½ç½®),$uofUnit)"/></xsl:attribute>
+ </xsl:element>
+ <xsl:element name="style:text-properties">
+ <xsl:choose>
+ <xsl:when test="/uof:UOF/uof:å¼æ ·é›†/uof:字体集/uof:默认字体">
+ <xsl:attribute name="style:font-name"><xsl:value-of select="/uof:UOF//uof:字体集/uof:默认字体/@uof:ascii"/></xsl:attribute>
+ <xsl:attribute name="style:font-name-asian"><xsl:value-of select="/uof:UOF//uof:字体集/uof:默认字体/@uof:fareast"/></xsl:attribute>
+ <xsl:attribute name="style:font-name-complex"><xsl:value-of select="/uof:UOF//uof:字体集/uof:默认字体/@uof:cs"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:font-name">Times New Roman</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:apply-templates select="uof:UOF/uof:å¼æ ·é›†/uof:å¥å¼æ ·/å­—:字体"/>
+ <xsl:if test="not(uof:UOF/uof:å¼æ ·é›†/uof:å¥å¼æ ·/å­—:字体/@å­—:å­—å· or uof:UOF/uof:å¼æ ·é›†/uof:å¥å±žæ€§/å­—:字体/@å­—:å­—å·)">
+ <xsl:attribute name="fo:font-size">10pt</xsl:attribute>
+ <xsl:attribute name="fo:font-size-asian">10pt</xsl:attribute>
+ <xsl:attribute name="fo:font-size-complex">10pt</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </style:default-style>
+ </xsl:if>
+ <xsl:for-each select="uof:段è½å¼æ ·[@å­—:类型='auto']">
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:family">paragraph</xsl:attribute>
+ <xsl:attribute name="style:name"><xsl:value-of select="@字:标识符"/></xsl:attribute>
+ <xsl:if test="@å­—:基å¼æ ·å¼•ç”¨">
+ <xsl:attribute name="style:parent-style-name"><xsl:value-of select="@å­—:基å¼æ ·å¼•ç”¨"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@å­—:别å">
+ <xsl:attribute name="style:display-name"><xsl:value-of select="@å­—:别å"/></xsl:attribute>
+ </xsl:if>
+ <xsl:element name="style:paragraph-properties">
+ <xsl:call-template name="XDParagraphAttr"/>
+ <xsl:apply-templates select="*[not(name()='字:大纲级别')]"/>
+ <xsl:if test="å­—:制表ä½è®¾ç½®">
+ <xsl:call-template name="ootab"/>
+ </xsl:if>
+ </xsl:element>
+ <xsl:element name="style:text-properties">
+ <xsl:apply-templates select="å­—:å¥å±žæ€§/*"/>
+ </xsl:element>
+ <xsl:variable name="biaoshi" select="@字:标识符"/>
+ <xsl:for-each select="../uof:å¥å¼æ ·">
+ <xsl:if test="@字:标识符=$biaoshi">
+ <xsl:element name="style:text-properties">
+ <xsl:apply-templates select="*"/>
+ </xsl:element>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:for-each>
+ <xsl:for-each select="uof:å¥å¼æ ·[@å­—:类型='auto']">
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name"><xsl:value-of select="@字:标识符"/></xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="ancestor::å­—:段è½å¼æ ·">
+ <xsl:attribute name="style:family">paragraph</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:family">text</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:element name="style:text-properties">
+ <xsl:apply-templates select="*"/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:for-each>
+ <style:style style:name="ColumnBreakPara" style:family="paragraph">
+ <style:text-properties fo:break-after="column"/>
+ </style:style>
+ <xsl:if test="uof:å¥å¼æ ·">
+ <style:default-style style:family="text"/>
+ </xsl:if>
+ <style:style style:name="Numbering Symbols" style:family="text"/>
+ <style:style style:name="Bullet Symbols" style:family="text">
+ <style:text-properties style:font-name="StarSymbol" fo:font-size="9pt" style:font-name-asian="StarSymbol" style:font-size-asian="9pt" style:font-name-complex="StarSymbol" style:font-size-complex="9pt"/>
+ </style:style>
+ <xsl:apply-templates select="uof:文字表å¼æ ·" mode="table"/>
+ <xsl:apply-templates select="uof:å¼æ ·"/>
+ <xsl:call-template name="脚注设置"/>
+ <xsl:call-template name="尾注设置"/>
+ <xsl:call-template name="行编å·"/>
+ </office:styles>
+ <xsl:element name="office:automatic-styles">
+ <style:style style:name="PageBreak" style:family="paragraph">
+ <style:text-properties fo:break-before="page"/>
+ </style:style>
+ <xsl:apply-templates select="/uof:UOF/uof:文字处ç†/å­—:主体/å­—:段è½/å­—:å¥/å­—:å¥å±žæ€§" mode="style"/>
+ <xsl:for-each select="/uof:UOF/uof:文字处ç†/å­—:主体//å­—:å¥">
+ <xsl:variable name="stylename1" select="å­—:å¥å±žæ€§/@å­—:å¼æ ·å¼•ç”¨"/>
+ <xsl:element name="style:style">
+ <xsl:variable name="stylenum">
+ <xsl:number from="/uof:UOF/uof:文字处ç†/å­—:主体" level="any" count="å­—:å¥" format="1"/>
+ </xsl:variable>
+ <xsl:attribute name="style:name"><xsl:value-of select="concat('T',$stylenum)"/></xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="ancestor::å­—:段è½å¼æ ·">
+ <xsl:attribute name="style:family">paragraph</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:family">text</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:for-each select="/uof:UOF/uof:å¼æ ·é›†/uof:å¥å¼æ ·">
+ <xsl:if test="$stylename1=@字:标识符">
+ <xsl:choose>
+ <xsl:when test="@å­—:标识符=/uof:UOF/uof:文字处ç†/å­—:主体/å­—:段è½/å­—:å¥/å­—:å¥å±žæ€§/å­—:æ ¼å¼ä¿®è®¢/@å­—:修订信æ¯å¼•ç”¨">
+ <xsl:attribute name="style:parent-style-name"><xsl:value-of select="@字:标识符"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:parent-style-name"><xsl:value-of select="@å­—:基å¼æ ·å¼•ç”¨"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:element name="style:text-properties">
+ <xsl:for-each select="/uof:UOF/uof:å¼æ ·é›†/uof:å¥å¼æ ·">
+ <xsl:if test="$stylename1=@字:标识符">
+ <xsl:apply-templates select="./å­—:ä½ç½®" mode="oo"/>
+ <xsl:apply-templates select="*[not(name()='å­—:ä½ç½®')]"/>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:element>
+ </xsl:for-each>
+ <xsl:for-each select="/uof:UOF/uof:文字处ç†/å­—:主体//å­—:域开始[@å­—:类型 = 'date']">
+ <xsl:element name="number:date-style">
+ <xsl:attribute name="style:name">Date<xsl:number from="/uof:UOF/uof:文字处ç†/å­—:主体" level="any" count="å­—:段è½/å­—:域开始[@å­—:类型 = 'date']"/></xsl:attribute>
+ <xsl:call-template name="日期域"/>
+ </xsl:element>
+ </xsl:for-each>
+ <xsl:for-each select="/uof:UOF/uof:文字处ç†/å­—:主体//å­—:域开始[@å­—:类型 = 'createdate']">
+ <xsl:element name="number:date-style">
+ <xsl:attribute name="style:name">CreateDate<xsl:number from="/uof:UOF/uof:文字处ç†/å­—:主体" level="any" count="å­—:段è½/å­—:域开始[@å­—:类型 = 'createdate']"/></xsl:attribute>
+ <xsl:call-template name="日期域"/>
+ </xsl:element>
+ </xsl:for-each>
+ <xsl:for-each select="/uof:UOF/uof:文字处ç†/å­—:主体//å­—:域开始[@å­—:类型 = 'savedate']">
+ <xsl:element name="number:date-style">
+ <xsl:attribute name="style:name">SaveDate<xsl:number from="/uof:UOF/uof:文字处ç†/å­—:主体" level="any" count="å­—:段è½/å­—:域开始[@å­—:类型 = 'savedate']"/></xsl:attribute>
+ <xsl:call-template name="日期域"/>
+ </xsl:element>
+ </xsl:for-each>
+ <xsl:for-each select="/uof:UOF/uof:文字处ç†/å­—:主体//å­—:域开始[@å­—:类型 = 'time']">
+ <xsl:element name="number:date-style">
+ <xsl:attribute name="style:name">Time<xsl:number from="/uof:UOF/uof:文字处ç†/å­—:主体" level="any" count="å­—:段è½/å­—:域开始[@å­—:类型 = 'time']"/></xsl:attribute>
+ <xsl:call-template name="时间域"/>
+ </xsl:element>
+ </xsl:for-each>
+ <xsl:for-each select="/uof:UOF/uof:文字处ç†/å­—:主体//å­—:域开始[@å­—:类型 = 'edittime']">
+ <xsl:element name="number:time-style">
+ <xsl:attribute name="style:name">EditTime<xsl:number from="/uof:UOF/uof:文字处ç†/å­—:主体" level="any" count="å­—:段è½/å­—:域开始[@å­—:类型 = 'edittime']"/></xsl:attribute>
+ <xsl:call-template name="编辑时间"/>
+ </xsl:element>
+ </xsl:for-each>
+ <xsl:for-each select="/uof:UOF/uof:文字处ç†/å­—:主体//å­—:域开始[@å­—:类型 = 'createtime']">
+ <xsl:element name="number:time-style">
+ <xsl:attribute name="style:name">CREATETIME<xsl:number from="/uof:UOF/uof:文字处ç†/å­—:主体" level="any" count="å­—:段è½/å­—:域开始[@å­—:类型 = 'createtime']"/></xsl:attribute>
+ <xsl:call-template name="创建时间"/>
+ </xsl:element>
+ </xsl:for-each>
+ <xsl:apply-templates select="/uof:UOF/uof:文字处ç†/å­—:主体//å­—:文字表[not(@å­—:类型='sub-table')]" mode="style"/>
+ <xsl:apply-templates select="/uof:UOF/uof:文字处ç†/å­—:主体//å­—:å•å…ƒæ ¼" mode="style"/>
+ <xsl:apply-templates select="/uof:UOF/uof:文字处ç†/å­—:主体//å­—:è¡Œ[not(../../@å­—:类型='sub-table')]" mode="style"/>
+ <xsl:apply-templates select="/uof:UOF/uof:文字处ç†/å­—:主体//å­—:列宽集[not(../../@å­—:类型='sub-table')]" mode="style"/>
+ <xsl:for-each select="/uof:UOF/uof:文字处ç†/å­—:主体//å­—:自动编å·ä¿¡æ¯">
+ <xsl:variable name="currlistid" select="@å­—:ç¼–å·å¼•ç”¨"/>
+ <xsl:variable name="currlist" select="."/>
+ <xsl:variable name="rootlist" select="/uof:UOF/uof:å¼æ ·é›†/uof:自动编å·é›†/å­—:自动编å·[@å­—:标识符 =$currlistid]"/>
+ <xsl:if test="not(ancestor::å­—:段è½/preceding-sibling::å­—:段è½[1]/å­—:段è½å±žæ€§/å­—:自动编å·ä¿¡æ¯/@å­—:ç¼–å·å¼•ç”¨= $currlistid)">
+ <xsl:element name="text:list-style">
+ <xsl:attribute name="style:name">List<xsl:value-of select="count(preceding::å­—:自动编å·ä¿¡æ¯)"/></xsl:attribute>
+ <xsl:for-each select="$rootlist">
+ <xsl:for-each select="字:级别">
+ <xsl:choose>
+ <xsl:when test="å­—:项目符å·">
+ <xsl:call-template name="xiangmufuhao">
+ <xsl:with-param name="biaoshifu" select="../@字:标识符"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="å­—:图片符å·å¼•ç”¨">
+ <xsl:call-template name="imagefuhao">
+ <xsl:with-param name="biaoshifu" select="../@字:标识符"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="jibianhao">
+ <xsl:with-param name="biaoshifu" select="../@字:标识符"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:for-each select="/uof:UOF/uof:文字处ç†/å­—:主体//å­—:节属性">
+ <xsl:element name="style:page-layout">
+ <xsl:attribute name="style:name">pm<xsl:number from="/uof:UOF/uof:文字处ç†/å­—:主体" level="any"/></xsl:attribute>
+ <xsl:if test="å­—:对称页边è·/@å­—:值='true'">
+ <xsl:attribute name="style:page-usage">mirrored</xsl:attribute>
+ </xsl:if>
+ <xsl:element name="style:page-layout-properties">
+ <xsl:if test="å­—:纸张方å‘">
+ <xsl:attribute name="style:print-orientation"><xsl:choose><xsl:when test="å­—:纸张方å‘='portrait'">portrait</xsl:when><xsl:when test="å­—:纸张方å‘='landscape'">landscape</xsl:when></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="fo:page-width"><xsl:value-of select="concat(字:纸张/@uof:宽度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:page-height"><xsl:value-of select="concat(字:纸张/@uof:高度,$uofUnit)"/></xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="å­—:页边è·">
+ <xsl:attribute name="fo:margin-top"><xsl:value-of select="concat(å­—:页边è·/@uof:上 ,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:margin-left"><xsl:value-of select="concat(å­—:页边è·/@uof:å·¦,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:margin-right"><xsl:value-of select="concat(å­—:页边è·/@uof:å³,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:margin-bottom"><xsl:value-of select="concat(å­—:页边è·/@uof:下,$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="å­—:装订线/@å­—:ä½ç½®='top'">
+ <xsl:attribute name="fo:margin-top"><xsl:value-of select="concat(å­—:页边è·/@uof:上 ,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:margin-left"><xsl:value-of select="concat(å­—:页边è·/@uof:å·¦,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:margin-right"><xsl:value-of select="concat(å­—:页边è·/@uof:å³,$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="å­—:装订线/@å­—:ä½ç½®='left' ">
+ <xsl:attribute name="fo:margin-top"><xsl:value-of select="concat(å­—:页边è·/@uof:上,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:margin-left"><xsl:value-of select="concat((å­—:页边è·/@uof:å·¦+ å­—:装订线/@å­—:è·è¾¹ç•Œ),$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:margin-right"><xsl:value-of select="concat(å­—:页边è·/@uof:å³,$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:margin-top"><xsl:value-of select="concat(å­—:页边è·/@uof:上,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:margin-left"><xsl:value-of select="concat(å­—:页边è·/@uof:å·¦,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:margin-right"><xsl:value-of select="concat(å­—:页边è·/@uof:å³,$uofUnit)"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="fo:margin-bottom"><xsl:value-of select="concat(å­—:页边è·/@uof:下,$uofUnit)"/></xsl:attribute>
+ <xsl:if test="字:拼页/@字:值='1' or 字:拼页/@字:值='true'">
+ <xsl:attribute name="style:page-usage">mirrored</xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="string(å­—:文字排列方å‘)='vert-r2l'">
+ <xsl:attribute name="style:writing-mode">tb-rl</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="string(å­—:文字排列方å‘)='vert-l2r'">
+ <xsl:attribute name="style:writing-mode">tb-rl</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="string(å­—:文字排列方å‘)='hori-l2r'">
+ <xsl:attribute name="style:writing-mode">lr-tb</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="string(å­—:文字排列方å‘)='hori-r2l'">
+ <xsl:attribute name="style:writing-mode">lr-tb</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:writing-mode">page</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="字:网格设置/@字:网格类型">
+ <xsl:attribute name="style:layout-grid-mode"><xsl:choose><xsl:when test="字:网格设置/@字:网格类型='line-char'">both-nosnap</xsl:when><xsl:when test="字:网格设置/@字:网格类型='char'">both</xsl:when><xsl:when test="字:网格设置/@字:网格类型='line'">line</xsl:when><xsl:when test="字:网格设置/@字:网格类型='none'">none</xsl:when></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:网格设置/@字:宽度">
+ <xsl:attribute name="style:layout-grid-base-width"><xsl:value-of select="concat(字:网格设置/@字:宽度,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:网格设置/@字:高度">
+ <xsl:attribute name="style:layout-grid-base-height"><xsl:value-of select="concat(字:网格设置/@字:高度,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:网格设置/@字:显示网格">
+ <xsl:attribute name="style:layout-grid-display"><xsl:value-of select="字:网格设置/@字:显示网格"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="å­—:网格设置/@å­—:打å°ç½‘æ ¼">
+ <xsl:attribute name="style:layout-grid-print"><xsl:value-of select="å­—:网格设置/@å­—:打å°ç½‘æ ¼"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:稿纸设置/@字:类型">
+ <xsl:attribute name="style:layout-grid-mode"><xsl:choose><xsl:when test="字:稿纸设置/@字:类型='draft-paper' ">both</xsl:when><xsl:when test="字:稿纸设置/@字:类型='letter-paper' ">line</xsl:when><xsl:otherwise>both</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="å­—:稿纸设置/@å­—:æ ¼å¼">
+ <xsl:choose>
+ <xsl:when test="å­—:稿纸设置/@å­—:æ ¼å¼='fourth-gear'">
+ <xsl:attribute name="style:layout-grid-base-width">0.728cm</xsl:attribute>
+ <xsl:attribute name="style:layout-grid-base-height">0.728cm</xsl:attribute>
+ <xsl:attribute name="style:layout-grid-ruby-height">0.496cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="å­—:稿纸设置/@å­—:æ ¼å¼='third-gear'">
+ <xsl:attribute name="style:layout-grid-base-width">0.584cm</xsl:attribute>
+ <xsl:attribute name="style:layout-grid-base-height">0.584cm</xsl:attribute>
+ <xsl:attribute name="style:layout-grid-ruby-height">0.64cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="å­—:稿纸设置/@å­—:æ ¼å¼='second-gear'">
+ <xsl:attribute name="style:layout-grid-base-width">0.728cm</xsl:attribute>
+ <xsl:attribute name="style:layout-grid-base-height">0.728cm</xsl:attribute>
+ <xsl:attribute name="style:layout-grid-ruby-height">0.905cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="å­—:稿纸设置/@å­—:æ ¼å¼='first-gear'">
+ <xsl:attribute name="style:layout-grid-base-width">0.728cm</xsl:attribute>
+ <xsl:attribute name="style:layout-grid-base-height">0.728cm</xsl:attribute>
+ <xsl:attribute name="style:layout-grid-ruby-height">1.633cm</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:attribute name="style:layout-grid-display">true</xsl:attribute>
+ <xsl:attribute name="style:layout-grid-print">true</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:稿纸设置/@字:颜色">
+ <xsl:attribute name="style:layout-grid-color"><xsl:value-of select="字:稿纸设置/@字:颜色"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:边框">
+ <xsl:for-each select="字:边框">
+ <xsl:call-template name="uof:边框"/>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:if test="å­—:å¡«å……">
+ <xsl:for-each select="å­—:å¡«å……">
+ <xsl:call-template name="uof:å¡«å……"/>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:apply-templates select="å­—:å¡«å……"/>
+ <xsl:attribute name="style:num-format"><xsl:variable name="format"><xsl:value-of select="å­—:页ç è®¾ç½®/@å­—:æ ¼å¼"/></xsl:variable><xsl:call-template name="ooæ•°å­—æ ¼å¼"><xsl:with-param name="oo_format" select="$format"/></xsl:call-template></xsl:attribute>
+ <xsl:if test="å­—:纸张æ¥æº/@å­—:其他页">
+ <xsl:attribute name="style:paper-tray-name"><xsl:value-of select="å­—:纸张æ¥æº/@å­—:其他页"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="å­—:分æ /@å­—:æ æ•°">
+ <xsl:apply-templates select="å­—:分æ "/>
+ </xsl:if>
+ </xsl:element>
+ <xsl:if test="å­—:页眉ä½ç½®">
+ <style:header-style>
+ <xsl:element name="style:header-footer-properties">
+ <xsl:attribute name="fo:margin-bottom"><xsl:value-of select="concat(å­—:页眉ä½ç½®/@å­—:è·è¾¹ç•Œ,$uofUnit)"/></xsl:attribute>
+ <xsl:variable name="long1" select="å­—:页眉ä½ç½®/@å­—:è·è¾¹ç•Œ"/>
+ <xsl:variable name="long2" select="å­—:页眉ä½ç½®/@å­—:è·ç‰ˆèŠ¯"/>
+ <xsl:variable name="long" select="$long1 + $long2"/>
+ <xsl:attribute name="svg:height"><xsl:value-of select="concat($long,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="style:dynamic-spacing">false</xsl:attribute>
+ </xsl:element>
+ </style:header-style>
+ </xsl:if>
+ <xsl:if test="å­—:页脚ä½ç½®">
+ <style:footer-style>
+ <xsl:element name="style:header-footer-properties">
+ <xsl:attribute name="fo:margin-top"><xsl:value-of select="concat(å­—:页脚ä½ç½®/@å­—:è·è¾¹ç•Œ,$uofUnit)"/></xsl:attribute>
+ <xsl:variable name="long1" select="å­—:页脚ä½ç½®/@å­—:è·è¾¹ç•Œ"/>
+ <xsl:variable name="long2" select="å­—:页脚ä½ç½®/@å­—:è·ç‰ˆèŠ¯"/>
+ <xsl:variable name="long" select="$long1 + $long2"/>
+ <xsl:attribute name="svg:height"><xsl:value-of select="concat($long,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="style:dynamic-spacing">false</xsl:attribute>
+ </xsl:element>
+ </style:footer-style>
+ </xsl:if>
+ </xsl:element>
+ <xsl:if test="å­—:分æ /@å­—:æ æ•°">
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name">sect<xsl:value-of select="count(preceding::å­—:节属性[å­—:分æ /@å­—:æ æ•°])"/></xsl:attribute>
+ <xsl:attribute name="style:family">section</xsl:attribute>
+ <xsl:element name="style:page-layout-properties">
+ <xsl:element name="style:columns">
+ <xsl:attribute name="fo:column-count"><xsl:value-of select="number(å­—:分æ /@å­—:æ æ•°)"/></xsl:attribute>
+ <xsl:attribute name="fo:column-gap"><xsl:value-of select="concat(number(å­—:分æ /@å­—:分割线宽度),$uofUnit)"/></xsl:attribute>
+ </xsl:element>
+ </xsl:element>
+ </xsl:element>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:if test="/uof:UOF/uof:对象集/uof:其他对象/@uof:公有类型='png' or /uof:UOF/uof:对象集/uof:其他对象/@uof:公有类型='jpg' or /uof:UOF/uof:对象集/uof:其他对象/@uof:公有类型='bmp' or /uof:UOF/uof:对象集/uof:其他对象/@uof:公有类型='gif' or /uof:UOF/uof:对象集/uof:其他对象/@uof:ç§æœ‰ç±»åž‹='图片'">
+ <style:style style:name="Graphics" style:family="graphic">
+ <style:graphic-properties text:anchor-type="paragraph" svg:x="0cm" svg:y="0cm" style:wrap="none" style:vertical-pos="top" style:vertical-rel="paragraph" style:horizontal-pos="center" style:horizontal-rel="paragraph"/>
+ </style:style>
+ </xsl:if>
+ <xsl:apply-templates select="/uof:UOF/uof:对象集/图:图形"/>
+ <xsl:apply-templates select="/uof:UOF/uof:对象集/图:图形/图:文本内容/å­—:段è½/å­—:å¥/å­—:å¥å±žæ€§" mode="style"/>
+ <xsl:call-template name="duanluoshuxing"/>
+ </xsl:element>
+ <office:master-styles>
+ <xsl:for-each select="/uof:UOF/uof:文字处ç†/å­—:主体//å­—:节属性">
+ <xsl:element name="style:master-page">
+ <xsl:variable name="master-page-name">
+ <xsl:number count="å­—:节属性" from="/uof:UOF/uof:文字处ç†/å­—:主体" level="any"/>
+ </xsl:variable>
+ <xsl:attribute name="style:name"><xsl:choose>
+ <xsl:when test="../@å­—:å称"><xsl:value-of select="../@å­—:å称"/></xsl:when>
+ <xsl:otherwise>Standard</xsl:otherwise>
+ </xsl:choose></xsl:attribute>
+ <xsl:attribute name="style:page-layout-name"><xsl:value-of select="concat('pm', $master-page-name)"/></xsl:attribute>
+ <xsl:if test="following::字:节属性">
+ <xsl:attribute name="style:next-style-name">Standard<xsl:value-of select="$master-page-name +1"/></xsl:attribute>
+ </xsl:if>
+ <xsl:for-each select="字:页眉">
+ <xsl:if test="字:首页页眉 or 字:奇数页页眉">
+ <xsl:element name="style:header">
+ <xsl:apply-templates select="å­—:奇数页页眉/å­—:æ®µè½ | å­—:首页页眉/å­—:æ®µè½ | å­—:奇数页页眉/å­—:文字表 | å­—:首页页眉/å­—:文字表"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="å­—:å¶æ•°é¡µé¡µçœ‰">
+ <xsl:element name="style:header-left">
+ <xsl:apply-templates select="å­—:å¶æ•°é¡µé¡µçœ‰/å­—:æ®µè½ | å­—:å¶æ•°é¡µé¡µçœ‰/å­—:文字表"/>
+ </xsl:element>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:for-each select="字:页脚">
+ <xsl:if test="字:奇数页页脚 or 字:首页页脚">
+ <xsl:element name="style:footer">
+ <xsl:apply-templates select="å­—:奇数页页脚/å­—:æ®µè½ | å­—:首页页脚/å­—:æ®µè½ | å­—:奇数页页脚/å­—:文字表 | å­—:首页页脚/å­—:文字表"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="å­—:å¶æ•°é¡µé¡µè„š">
+ <xsl:element name="style:footer-left">
+ <xsl:apply-templates select="å­—:å¶æ•°é¡µé¡µè„š/å­—:æ®µè½ | å­—:å¶æ•°é¡µé¡µè„š/å­—:文字表"/>
+ </xsl:element>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:if test="å­—:奇å¶é¡µé¡µçœ‰é¡µè„šä¸åŒ">
+ <xsl:element name="style:header-left">
+ </xsl:element>
+ </xsl:if>
+ </xsl:element>
+ </xsl:for-each>
+ </office:master-styles>
+ </xsl:template>
+ <xsl:template match="å­—:å¡«å……">
+ <xsl:choose>
+ <xsl:when test="图:颜色">
+ <xsl:attribute name="fo:background-color"><xsl:value-of select="图:颜色"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:图案/@图:背景色">
+ <xsl:attribute name="style:text-background-color"><xsl:choose><xsl:when test="contains(图:图案/@图:背景色,'#')"><xsl:value-of select="图:图案/@图:背景色"/></xsl:when><xsl:otherwise>auto</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:图案/@图:å‰æ™¯è‰²">
+ <xsl:attribute name="fo:text-background-color"><xsl:choose><xsl:when test="contains(图:图案/@图:å‰æ™¯è‰²,'#')"><xsl:value-of select="图:图案/@图:å‰æ™¯è‰²"/></xsl:when><xsl:otherwise>auto</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="å­—:分æ ">
+ <xsl:element name="style:columns">
+ <xsl:attribute name="fo:column-count"><xsl:value-of select="//å­—:分æ /@å­—:æ æ•°"/></xsl:attribute>
+ <xsl:variable name="aa">
+ <xsl:value-of select="//å­—:分æ /å­—:æ [position()=1]/@å­—:é—´è·"/>
+ </xsl:variable>
+ <xsl:if test="//å­—:分æ /@å­—:等宽='true' ">
+ <xsl:attribute name="fo:column-gap"><xsl:value-of select="concat($aa * 2,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="//å­—:分æ /@å­—:分隔线宽度">
+ <xsl:element name="style:column-sep">
+ <xsl:attribute name="style:width"><xsl:value-of select="concat(@字:分隔线宽度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="style:color"><xsl:value-of select="@字:分隔线颜色"/></xsl:attribute>
+ <xsl:attribute name="style:height">100%</xsl:attribute>
+ <xsl:attribute name="style:vertical-align">top</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:for-each select="//å­—:分æ /å­—:æ ">
+ <xsl:element name="style:column">
+ <xsl:attribute name="style:rel-width"><xsl:value-of select="@字:宽度"/>*</xsl:attribute>
+ <xsl:if test="parent::å­—:分æ /@å­—:宽度='true'">
+ <xsl:choose>
+ <xsl:when test="self::node()[not(preceding-sibling::å­—:æ )]">
+ <xsl:attribute name="fo:start-indent">0cm</xsl:attribute>
+ <xsl:attribute name="fo:end-indent"><xsl:value-of select="concat(@å­—:é—´è·,$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="self::node()[not(following-sibling::å­—:æ )]">
+ <xsl:attribute name="fo:start-indent"><xsl:value-of select="concat(@å­—:é—´è·,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:end-indent">0cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:start-indent"><xsl:value-of select="concat(@å­—:é—´è·,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:end-indent"><xsl:value-of select="concat(@å­—:é—´è·,$uofUnit)"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="parent::å­—:分æ /@å­—:等宽='false'">
+ <xsl:variable name="last" select="preceding-sibling::å­—:æ [1]/@å­—:é—´è·"/>
+ <xsl:choose>
+ <xsl:when test="self::node()[not(preceding-sibling::å­—:æ )]">
+ <xsl:attribute name="fo:start-indent">0cm</xsl:attribute>
+ <xsl:attribute name="fo:end-indent"><xsl:value-of select="concat(@å­—:é—´è·,$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="self::node()[not(following-sibling::å­—:æ )]">
+ <xsl:attribute name="fo:start-indent"><xsl:value-of select="concat($last,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:end-indent">0cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:start-indent"><xsl:value-of select="concat($last,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:end-indent"><xsl:value-of select="concat(@å­—:é—´è·,$uofUnit)"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="uof:文字表å¼æ ·" mode="table">
+ <style:style style:family="table">
+ <xsl:attribute name="style:name"><xsl:value-of select="@字:标识符"/></xsl:attribute>
+ <xsl:if test="@å­—:基å¼æ ·å¼•ç”¨">
+ <xsl:attribute name="style:parent-style-name"><xsl:value-of select="@å­—:基å¼æ ·å¼•ç”¨"/></xsl:attribute>
+ </xsl:if>
+ <style:table-properties>
+ <xsl:choose>
+ <xsl:when test="å­—:对é½">
+ <xsl:attribute name="table:align"><xsl:value-of select="å­—:对é½"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="table:align">margins</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="字:宽度/@字:相对宽度">
+ <xsl:variable name="reltblw">
+ <xsl:value-of select="concat(number(字:宽度/@字:相对宽度),'%')"/>
+ </xsl:variable>
+ <xsl:variable name="pagew">
+ <xsl:value-of select="/uof:UOF/uof:文字处ç†/å­—:主体/å­—:分节/å­—:节属性/å­—:纸张/@uof:宽度"/>
+ </xsl:variable>
+ <xsl:variable name="leftm">
+ <xsl:value-of select="/uof:UOF/uof:文字处ç†/å­—:主体/å­—:分节/å­—:节属性/å­—:页边è·/@uof:å·¦"/>
+ </xsl:variable>
+ <xsl:variable name="rightm">
+ <xsl:value-of select="/uof:UOF/uof:文字处ç†/å­—:主体/å­—:分节/å­—:节属性/å­—:页边è·/@uof:å³"/>
+ </xsl:variable>
+ <xsl:attribute name="style:rel-width"><xsl:value-of select="concat(number(字:宽度/@字:相对宽度) * 100,'%')"/></xsl:attribute>
+ <xsl:attribute name="style:width"><xsl:value-of select="concat((number($pagew)-number($leftm)-number($rightm)) * number($reltblw),$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="å­—:宽度/@å­—:ç»å¯¹å®½åº¦">
+ <xsl:attribute name="style:width"><xsl:value-of select="concat(number(å­—:宽度/@å­—:ç»å¯¹å®½åº¦),$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </style:table-properties>
+ </style:style>
+ </xsl:template>
+ <xsl:template match="字:文字表" mode="style">
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name">Table<xsl:number count="å­—:文字表[not (@å­—:类型='sub-table')]" from="/uof:UOF/uof:文字处ç†/å­—:主体" level="any" format="1"/></xsl:attribute>
+ <xsl:attribute name="style:family">table</xsl:attribute>
+ <xsl:if test="@å­—:å¼æ ·å¼•ç”¨">
+ <xsl:attribute name="style:parent-style-name"><xsl:value-of select="@å­—:å¼æ ·å¼•ç”¨"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="name(preceding-sibling::*[1])='字:分节'">
+ <xsl:attribute name="style:master-page-name"><xsl:value-of select="preceding-sibling::*[1]/@å­—:å称"/></xsl:attribute>
+ </xsl:if>
+ <xsl:element name="style:table-properties">
+ <xsl:for-each select="字:文字表属性">
+ <xsl:variable name="biaoshi" select="@å­—:å¼æ ·å¼•ç”¨"/>
+ <xsl:choose>
+ <xsl:when test="å­—:å¯¹é½ = 'left' or å­—:å¯¹é½ = 'center' or å­—:å¯¹é½ = 'right'">
+ <xsl:attribute name="table:align"><xsl:value-of select="å­—:对é½"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="/uof:UOF/uof:å¼æ ·é›†/uof:文字表å¼æ ·[@å­—:标识符=$biaoshi]/å­—:对é½">
+ <xsl:attribute name="table:align"><xsl:value-of select="/uof:UOF/uof:å¼æ ·é›†/uof:文字表å¼æ ·[@å­—:标识符=$biaoshi]/å­—:对é½"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="table:align">margins</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="字:左缩进">
+ <xsl:attribute name="fo:margin-left"><xsl:value-of select="concat(number(字:左缩进),$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:绕排/@字:值='around'">
+ <xsl:if test="å­—:绕排边è·/@å­—:上">
+ <xsl:attribute name="fo:margin-top"><xsl:value-of select="concat(å­—:绕排边è·/@å­—:上,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="å­—:绕排边è·/@å­—:å·¦">
+ <xsl:attribute name="fo:margin-left"><xsl:value-of select="concat(å­—:绕排边è·/@å­—:å·¦,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="å­—:绕排边è·/@å­—:å³">
+ <xsl:attribute name="fo:margin-right"><xsl:value-of select="concat(å­—:绕排边è·/@å­—:å³,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="å­—:绕排边è·/@å­—:下">
+ <xsl:attribute name="fo:margin-bottom"><xsl:value-of select="concat(å­—:绕排边è·/@å­—:下,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="@å­—:å¼æ ·å¼•ç”¨">
+ <xsl:variable name="rootStyle" select="@å­—:å¼æ ·å¼•ç”¨"/>
+ <xsl:variable name="rootStyleNode" select="/uof:UOF/uof:å¼æ ·é›†/å­—:文字表å¼æ ·[@å­—:基å¼æ ·å¼•ç”¨ = $rootStyle]"/>
+ <xsl:variable name="paddingleft">
+ <xsl:value-of select="$rootStyleNode/å­—:文字表属性/å­—:è¾¹è·/@uof:å·¦"/>
+ </xsl:variable>
+ <xsl:variable name="paddingright">
+ <xsl:value-of select="$rootStyleNode/å­—:文字表属性/å­—:è¾¹è·/@uof:å³"/>
+ </xsl:variable>
+ <xsl:variable name="paddingtop">
+ <xsl:value-of select="$rootStyleNode/å­—:文字表属性/å­—:è¾¹è·/@uof:上"/>
+ </xsl:variable>
+ <xsl:variable name="paddingbottom">
+ <xsl:value-of select="$rootStyleNode/å­—:文字表属性/å­—:è¾¹è·/@uof:下"/>
+ </xsl:variable>
+ <xsl:if test="$rootStyleNode/å­—:文字表属性/å­—:è¾¹è·/@uof:å·¦">
+ <xsl:attribute name="fo:margin-left">-<xsl:value-of select="(number($paddingleft))* $other-to-cm-conversion-factor"/>cm</xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="字:宽度/@字:相对宽度">
+ <xsl:variable name="reltblw">
+ <xsl:value-of select="字:宽度/@字:相对宽度"/>
+ </xsl:variable>
+ <xsl:variable name="pagew">
+ <xsl:value-of select="/uof:UOF/uof:文字处ç†/å­—:主体/å­—:分节/å­—:节属性/å­—:纸张/@uof:宽度"/>
+ </xsl:variable>
+ <xsl:variable name="leftm">
+ <xsl:value-of select="/uof:UOF/uof:文字处ç†/å­—:主体/å­—:分节/å­—:节属性/å­—:页边è·/@uof:å·¦"/>
+ </xsl:variable>
+ <xsl:variable name="rightm">
+ <xsl:value-of select="/uof:UOF/uof:文字处ç†/å­—:主体/å­—:分节/å­—:节属性/å­—:页边è·/@uof:å³"/>
+ </xsl:variable>
+ <xsl:attribute name="style:rel-width"><xsl:value-of select="concat(number(字:宽度/@字:相对宽度) * 100,'%')"/></xsl:attribute>
+ <xsl:attribute name="style:width"><xsl:value-of select="concat((number($pagew)-number($leftm)-number($rightm)) * number($reltblw),$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="å­—:宽度/@å­—:ç»å¯¹å®½åº¦">
+ <xsl:attribute name="style:width"><xsl:value-of select="concat(number(å­—:宽度/@å­—:ç»å¯¹å®½åº¦),$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="/uof:UOF/uof:å¼æ ·é›†/uof:文字表å¼æ ·[@å­—:标识符=$biaoshi]/å­—:宽度/@å­—:相对宽度 or /uof:UOF/uof:å¼æ ·é›†/uof:文字表å¼æ ·[@å­—:标识符=$biaoshi]/å­—:宽度/@å­—:ç»å¯¹å®½åº¦">
+ <xsl:attribute name="style:rel-width"><xsl:value-of select="concat(/uof:UOF/uof:å¼æ ·é›†/uof:文字表å¼æ ·[@å­—:标识符=$biaoshi]/å­—:宽度/@å­—:相对宽度 * 100,'%')"/></xsl:attribute>
+ <xsl:attribute name="style:width"><xsl:value-of select="/uof:UOF/uof:å¼æ ·é›†/uof:文字表å¼æ ·[@å­—:标识符=$biaoshi]/å­—:宽度/@å­—:ç»å¯¹å®½åº¦"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="pagew">
+ <xsl:value-of select="/uof:UOF/uof:文字处ç†/å­—:主体/å­—:分节/å­—:节属性/å­—:纸张/@uof:宽度"/>
+ </xsl:variable>
+ <xsl:variable name="leftm">
+ <xsl:value-of select="/uof:UOF/uof:文字处ç†/å­—:主体/å­—:分节/å­—:节属性/å­—:页边è·/@uof:å·¦"/>
+ </xsl:variable>
+ <xsl:variable name="rightm">
+ <xsl:value-of select="/uof:UOF/uof:文字处ç†/å­—:主体/å­—:分节/å­—:节属性/å­—:页边è·/@uof:å³"/>
+ </xsl:variable>
+ <xsl:attribute name="style:width"><xsl:value-of select="concat((number($pagew)-number($leftm)-number($rightm)),$uofUnit)"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:variable name="tblsize" select="sum(字:列宽集/字:列宽)"/>
+ <xsl:if test="(not($tblsize='0')) and not(字:宽度) ">
+ <xsl:choose>
+ <xsl:when test="字:左缩进">
+ <xsl:attribute name="style:width"><xsl:value-of select="concat( number($tblsize - 字:左缩进), $uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:width"><xsl:value-of select="concat( number(sum(字:列宽集/字:列宽) ), $uofUnit)"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="字:边框">
+ <xsl:for-each select="字:边框">
+ <xsl:call-template name="uof:边框"/>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:for-each select="å­—:å¡«å……">
+ <xsl:call-template name="uof:å¡«å……"/>
+ </xsl:for-each>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="字:列宽集" mode="style">
+ <xsl:choose>
+ <xsl:when test="not(./字:列宽)">
+ <xsl:for-each select="../..">
+ <xsl:for-each select="å­—:è¡Œ[1]/å­—:å•å…ƒæ ¼">
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:family">table-column</xsl:attribute>
+ <xsl:attribute name="style:name">Table<xsl:number count="å­—:文字表" from="/uof:UOF/uof:文字处ç†/å­—:主体" level="any" format="1"/>.C<xsl:number value="count(preceding::å­—:å•å…ƒæ ¼)+1"/></xsl:attribute>
+ <xsl:element name="style:table-column-properties">
+ <xsl:choose>
+ <xsl:when test="å­—:å•å…ƒæ ¼å±žæ€§/å­—:宽度/@å­—:相对值">
+ <xsl:variable name="tblw1">
+ <xsl:choose>
+ <xsl:when test="../../å­—:文字表属性/å­—:宽度/@å­—:ç»å¯¹å®½åº¦">
+ <xsl:value-of select="../../å­—:文字表属性/å­—:宽度/@å­—:ç»å¯¹å®½åº¦"/>
+ </xsl:when>
+ <xsl:when test="../../字:文字表属性/字:宽度/@字:相对宽度">
+ <xsl:variable name="pagew">
+ <xsl:value-of select="/uof:UOF/uof:文字处ç†/å­—:主体/å­—:分节/å­—:节属性/å­—:纸张/@uof:宽度"/>
+ </xsl:variable>
+ <xsl:variable name="leftm">
+ <xsl:value-of select="/uof:UOF/uof:文字处ç†/å­—:主体/å­—:分节/å­—:节属性/å­—:页边è·/@uof:å·¦"/>
+ </xsl:variable>
+ <xsl:variable name="rightm">
+ <xsl:value-of select="/uof:UOF/uof:文字处ç†/å­—:主体/å­—:分节/å­—:节属性/å­—:页边è·/@uof:å³"/>
+ </xsl:variable>
+ <xsl:variable name="relw">
+ <xsl:value-of select="../../字:文字表属性/字:宽度/@字:相对宽度"/>
+ </xsl:variable>
+ <xsl:value-of select=" ( number($pagew)-number($leftm)-number($rightm))* number($relw) div 100"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="pagew">
+ <xsl:value-of select="/uof:UOF/uof:文字处ç†/å­—:主体/å­—:分节/å­—:节属性/å­—:纸张/@uof:宽度"/>
+ </xsl:variable>
+ <xsl:variable name="leftm">
+ <xsl:value-of select="/uof:UOF/uof:文字处ç†/å­—:主体/å­—:分节/å­—:节属性/å­—:页边è·/@uof:å·¦"/>
+ </xsl:variable>
+ <xsl:variable name="rightm">
+ <xsl:value-of select="/uof:UOF/uof:文字处ç†/å­—:主体/å­—:分节/å­—:节属性/å­—:页边è·/@uof:å³"/>
+ </xsl:variable>
+ <xsl:value-of select="(number($pagew)-number($leftm)-number($rightm))"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="style:column-width"><xsl:value-of select="concat(number(number($tblw1)*number(å­—:å•å…ƒæ ¼å±žæ€§/å­—:宽度/@å­—:相对值) div 100),$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="å­—:å•å…ƒæ ¼å±žæ€§/å­—:宽度/@å­—:ç»å¯¹å€¼">
+ <xsl:attribute name="style:column-width"><xsl:value-of select="concat(number(å­—:å•å…ƒæ ¼å±žæ€§/å­—:宽度/@å­—:ç»å¯¹å€¼),$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:column-width"><xsl:value-of select="'1cm'"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:for-each select="字:列宽">
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:family">table-column</xsl:attribute>
+ <xsl:attribute name="style:name">Table<xsl:number count="å­—:文字表[not (@å­—:类型='sub-table')]" from="/uof:UOF/uof:文字处ç†/å­—:主体" level="any" format="1"/>.C<xsl:number count="å­—:列宽" from="/uof:UOF/uof:文字处ç†/å­—:主体" level="single" format="1"/></xsl:attribute>
+ <xsl:variable name="tableRoot" select="ancestor::字:文字表"/>
+ <xsl:element name="style:table-column-properties">
+ <xsl:choose>
+ <xsl:when test="string(.)">
+ <xsl:attribute name="style:column-width"><xsl:value-of select="concat(.,$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:column-width"><xsl:value-of select="'1cm'"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="字:行" mode="style">
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:family">table-row</xsl:attribute>
+ <xsl:attribute name="style:name">Table<xsl:number count="å­—:文字表[not (@å­—:类型='sub-table')]" from="/uof:UOF/uof:文字处ç†/å­—:主体" level="any" format="1"/>.R<xsl:number count="å­—:è¡Œ" from="/uof:UOF/uof:文字处ç†/å­—:主体/å­—:文字表[not (@å­—:类型='sub-table')]" level="any" format="1"/></xsl:attribute>
+ <xsl:element name="style:table-row-properties">
+ <xsl:for-each select="字:表行属性">
+ <xsl:choose>
+ <xsl:when test="字:高度/@字:固定值">
+ <xsl:attribute name="style:row-height"><xsl:value-of select="concat(number(字:高度/@字:固定值),$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="å­—:高度/@å­—:最å°å€¼">
+ <xsl:attribute name="style:min-row-height"><xsl:value-of select="concat(number(å­—:高度/@å­—:最å°å€¼), $uofUnit )"/></xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:attribute name="fo:keep-together"><xsl:value-of select="字:跨页/@字:值"/></xsl:attribute>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="å­—:å•å…ƒæ ¼" mode="style">
+ <style:style>
+ <xsl:attribute name="style:name">Table<xsl:number count="å­—:文字表[not (@å­—:类型='sub-table')]" from="/uof:UOF/uof:文字处ç†/å­—:主体" level="any" format="1"/>.R<xsl:number count="å­—:è¡Œ" from="/uof:UOF/uof:文字处ç†/å­—:主体/å­—:文字表[not (@å­—:类型='sub-table')]" level="any" format="1"/>C<xsl:number count="å­—:å•å…ƒæ ¼" from="/uof:UOF/uof:文字处ç†/å­—:主体/å­—:文字表[not (@å­—:类型='sub-table')]/å­—:è¡Œ" level="any" format="1"/></xsl:attribute>
+ <xsl:attribute name="style:family">table-cell</xsl:attribute>
+ <xsl:element name="style:table-cell-properties">
+ <xsl:for-each select="å­—:å•å…ƒæ ¼å±žæ€§">
+ <xsl:choose>
+ <xsl:when test="å­—:å•å…ƒæ ¼è¾¹è·/@å­—:å·¦">
+ <xsl:attribute name="fo:padding-left"><xsl:value-of select="concat(number(å­—:å•å…ƒæ ¼è¾¹è·/@å­—:å·¦),$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:padding-left"><xsl:value-of select="../../../../å­—:文字表属性/å­—:默认å•å…ƒæ ¼è¾¹è·/@å­—:å·¦"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="å­—:å•å…ƒæ ¼è¾¹è·/@å­—:å³">
+ <xsl:attribute name="fo:padding-right"><xsl:value-of select="concat(number(å­—:å•å…ƒæ ¼è¾¹è·/@å­—:å³),$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:padding-right"><xsl:value-of select="../../../../å­—:文字表属性/å­—:默认å•å…ƒæ ¼è¾¹è·/@å­—:å³"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="å­—:å•å…ƒæ ¼è¾¹è·/@å­—:上">
+ <xsl:attribute name="fo:padding-top"><xsl:value-of select="concat(number(å­—:å•å…ƒæ ¼è¾¹è·/@å­—:上),$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:padding-top"><xsl:value-of select="../../../../å­—:文字表属性/å­—:默认å•å…ƒæ ¼è¾¹è·/@å­—:上"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="å­—:å•å…ƒæ ¼è¾¹è·/@å­—:下">
+ <xsl:attribute name="fo:padding-bottom"><xsl:value-of select="concat(number(å­—:å•å…ƒæ ¼è¾¹è·/@å­—:下),$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:padding-bottom"><xsl:value-of select="../../../../å­—:文字表属性/å­—:默认å•å…ƒæ ¼è¾¹è·/@å­—:下"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:variable name="cellbefore">
+ <xsl:value-of select="count(ancestor::å­—:å•å…ƒæ ¼/preceding-sibling::å­—:å•å…ƒæ ¼)"/>
+ </xsl:variable>
+ <xsl:variable name="cellafter">
+ <xsl:value-of select="count(ancestor::å­—:å•å…ƒæ ¼/following-sibling::å­—:å•å…ƒæ ¼)"/>
+ </xsl:variable>
+ <xsl:variable name="rowbefore">
+ <xsl:value-of select="count(ancestor::字:行/preceding-sibling::字:行)"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="字:边框">
+ <xsl:for-each select="字:边框">
+ <xsl:call-template name="uof:边框"/>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="number($cellafter) &gt; 0">
+ <xsl:attribute name="fo:border-right">none</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:border-right">0.002cm solid #000000</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="fo:border-left">0.002cm solid #000000</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="number($rowbefore) &gt; 0">
+ <xsl:attribute name="fo:border-top">none</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:border-top">0.002cm solid #000000</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="fo:border-bottom">0.002cm solid #000000</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="style:vertical-align"><xsl:choose><xsl:when test="å­—:垂直对é½æ–¹å¼='center' ">middle</xsl:when><xsl:when test="å­—:垂直对é½æ–¹å¼='bottom' ">bottom</xsl:when><xsl:otherwise>top</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:for-each select="å­—:å¡«å……">
+ <xsl:call-template name="uof:å¡«å……"/>
+ </xsl:for-each>
+ </xsl:for-each>
+ </xsl:element>
+ </style:style>
+ </xsl:template>
+ <xsl:template match="uof:字体集">
+ <xsl:element name="office:font-face-decls">
+ <style:font-face style:name="Arial" svg:font-family="Arial" style:font-family-generic="roman" style:font-pitch="variable"/>
+ <style:font-face style:name="Times New Roman" svg:font-family="'Times New Roman'" style:font-family-generic="roman" style:font-pitch="variable"/>
+ <style:font-face style:name="Symbol" svg:font-family="Symbol" style:font-family-generic="roman" style:font-pitch="variable" style:font-charset="x-symbol"/>
+ <style:font-face style:name="Courier New" svg:font-family="'Courier New'" style:font-family-generic="modern" style:font-pitch="fixed"/>
+ <xsl:if test="not(uof:字体声明[@uof:å称='StarSymbol'])">
+ <style:font-face style:name="StarSymbol" svg:font-family="StarSymbol" style:font-charset="x-symbol"/>
+ </xsl:if>
+ <xsl:for-each select="uof:字体声明">
+ <xsl:element name="style:font-face">
+ <xsl:attribute name="style:name"><xsl:value-of select="@uof:标识符"/></xsl:attribute>
+ <xsl:attribute name="svg:font-family"><xsl:value-of select="@uof:å称"/></xsl:attribute>
+ <xsl:if test="@uof:字符集 = '02'">
+ <xsl:attribute name="style:font-charset">x-symbol</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@uof:字体æ—">
+ <xsl:choose>
+ <xsl:when test="@uof:å­—ä½“æ— = 'Swiss'">
+ <xsl:attribute name="style:font-family-generic">swiss</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@uof:å­—ä½“æ— ='Modern'">
+ <xsl:attribute name="style:font-family-generic">modern</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@uof:字体æ—='Roman'">
+ <xsl:attribute name="style:font-family-generic">roman</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@uof:å­—ä½“æ— ='Script'">
+ <xsl:attribute name="style:font-family-generic">script</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@uof:å­—ä½“æ— ='Decorative'">
+ <xsl:attribute name="style:font-family-generic">decorative</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@uof:å­—ä½“æ— ='System'">
+ <xsl:attribute name="style:font-family-generic">system</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:font-family-generic">system</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:attribute name="style:font-pitch">12</xsl:attribute>
+ </xsl:element>
+ </xsl:for-each>
+ <xsl:apply-templates select="uof:字体声明"/>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="uof:å¼æ ·">
+ <xsl:element name="style:text-properties">
+ <xsl:apply-templates select="uof:å¥å¼æ ·/*"/>
+ <xsl:apply-templates select="uof:段è½å¼æ ·/*"/>
+ <xsl:call-template name="paragraph-properties"/>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="uof:段è½å¼æ ·"/>
+ <xsl:template match="uof:å¥å¼æ ·"/>
+ <xsl:template match="å­—:公用处ç†è§„则">
+ <xsl:apply-templates select="uof:文字处ç†/å­—:公用处ç†è§„则/å­—:文档设置"/>
+ </xsl:template>
+ <xsl:template match="uof:文字处ç†/å­—:公用处ç†è§„则/å­—:文档设置">
+ <office:settings>
+ <config:config-item-set config:name="ooo:view-settings">
+ <config:config-item config:name="InBrowseMode" config:type="boolean">
+ <xsl:choose>
+ <xsl:when test="å­—:当å‰è§†å›¾='web'">true</xsl:when>
+ <xsl:otherwise>false</xsl:otherwise>
+ </xsl:choose>
+ </config:config-item>
+ <config:config-item-map-indexed config:name="Views">
+ <config:config-item-map-entry>
+ <xsl:if test="字:缩放">
+ <config:config-item config:name="VisibleRight" config:type="int">1</config:config-item>
+ <config:config-item config:name="VisibleBottom" config:type="int">1</config:config-item>
+ <xsl:choose>
+ <xsl:when test="字:缩放 = 'best-fit'">
+ <config:config-item config:name="ZoomType" config:type="short">3</config:config-item>
+ </xsl:when>
+ <xsl:when test="字:缩放 = 'full-page'">
+ <config:config-item config:name="ZoomType" config:type="short">2</config:config-item>
+ </xsl:when>
+ <xsl:when test="字:缩放 = 'text-fit'">
+ <config:config-item config:name="ZoomType" config:type="short">1</config:config-item>
+ </xsl:when>
+ <xsl:otherwise>
+ <config:config-item config:name="ZoomType" config:type="short">0</config:config-item>
+ </xsl:otherwise>
+ </xsl:choose>
+ <config:config-item config:name="ZoomFactor" config:type="short">
+ <xsl:value-of select="字:缩放"/>
+ </config:config-item>
+ </xsl:if>
+ </config:config-item-map-entry>
+ </config:config-item-map-indexed>
+ </config:config-item-set>
+ <config:config-item-set config:name="configuration-settings">
+ <config:config-item-map-indexed config:name="ForbiddenCharacters">
+ <config:config-item-map-entry>
+ <config:config-item config:name="Language" config:type="string">zh</config:config-item>
+ <config:config-item config:name="Country" config:type="string">CN</config:config-item>
+ <config:config-item config:name="Variant" config:type="string"/>
+ <config:config-item config:name="BeginLine" config:type="string">
+ <xsl:choose>
+ <xsl:when test="å­—:标点ç¦åˆ™/å­—:行首字符 or *[@uof:locID='t0007']/*[@uof:locID='t0008']">
+ <xsl:value-of select="*[@uof:locID='t0007']/*[@uof:locID='t0008']"/>
+ </xsl:when>
+ <xsl:otherwise>:!),.:;?]}_'"ã€ã€‚〉》ã€ã€ã€‘〕〗〞︰︱︳ï¹_﹒﹔﹕﹖﹗﹚﹜﹞ï¼ï¼‰ï¼Œï¼Žï¼šï¼›ï¼Ÿï½œï½ï¸´ï¸¶ï¸¸ï¸ºï¸¼ï¸¾ï¹€ï¹‚﹄ï¹_~¢々‖_·ˇˉ―--′</xsl:otherwise>
+ </xsl:choose>
+ </config:config-item>
+ <config:config-item config:name="EndLine" config:type="string">
+ <xsl:choose>
+ <xsl:when test="å­—:标点ç¦åˆ™/å­—:行尾字符 or *[@uof:locID='t0007']/*[@uof:locID='t0009']">
+ <xsl:value-of select="*[@uof:locID='t0007']/*[@uof:locID='t0009']"/>
+ </xsl:when>
+ <xsl:otherwise>([{__'"‵〈《「『ã€ã€”〖([{£¥ã€ï¸µï¸·ï¸¹ï¸»ï¸½ï¸¿ï¹ï¹ƒï¹™ï¹›ï¹ï¼ˆï½›</xsl:otherwise>
+ </xsl:choose>
+ </config:config-item>
+ </config:config-item-map-entry>
+ </config:config-item-map-indexed>
+ </config:config-item-set>
+ </office:settings>
+ </xsl:template>
+ <xsl:template match="uof:文字处ç†">
+ <xsl:element name="office:body">
+ <xsl:element name="office:text">
+ <xsl:call-template name="GenerateTrackChanges"/>
+ <text:sequence-decls>
+ <xsl:call-template name="default_seqence_declaration"/>
+ </text:sequence-decls>
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="default_seqence_declaration">
+ <text:sequence-decl text:display-outline-level="0" text:name="Illustration">
+ </text:sequence-decl>
+ <text:sequence-decl text:display-outline-level="0" text:name="Table">
+ </text:sequence-decl>
+ <text:sequence-decl text:display-outline-level="0" text:name="Text">
+ </text:sequence-decl>
+ <text:sequence-decl text:display-outline-level="0" text:name="Drawing">
+ </text:sequence-decl>
+ <text:sequence-decl text:display-outline-level="0" text:name="AutoNr">
+ </text:sequence-decl>
+ </xsl:template>
+ <xsl:template name="段è½" match="å­—:段è½[not((preceding-sibling::å­—:段è½/å­—:域开始) and (not(preceding-sibling::å­—:段è½/å­—:域结æŸ)))][not(å­—:段è½å±žæ€§[å­—:自动编å·ä¿¡æ¯])]">
+ <xsl:if test="字:域开始/@字:类型='caption'">
+ <xsl:apply-templates select="å­—:域代ç "/>
+ </xsl:if>
+ <xsl:if test="字:域开始/@字:类型='REF'">
+ <xsl:call-template name="目录域"/>
+ </xsl:if>
+ <xsl:if test="字:域开始/@字:类型='INDEX'">
+ <xsl:call-template name="索引域"/>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="string(parent::node()/@uof:locID)='t0107'">
+ <xsl:apply-templates select="字:脚注"/>
+ </xsl:when>
+ <xsl:when test="string(parent::node()/@uof:locID)='t0108'">
+ <xsl:apply-templates select="字:尾注"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="commonParagraph"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="字:脚注">
+ <xsl:element name="text:note">
+ <xsl:attribute name="text:note-class">footnote</xsl:attribute>
+ <xsl:element name="text:note-citation">
+ <xsl:attribute name="text:label"><xsl:value-of select="@字:引文体"/></xsl:attribute>
+ <xsl:value-of select="@字:引文体"/>
+ </xsl:element>
+ <xsl:element name="text:note-body">
+ <xsl:for-each select="å­—:段è½">
+ <xsl:call-template name="commonParagraph"/>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="字:尾注">
+ <xsl:element name="text:note">
+ <xsl:attribute name="text:note-class">endnote</xsl:attribute>
+ <xsl:element name="text:note-citation">
+ <xsl:attribute name="text:label"><xsl:value-of select="@字:引文体"/></xsl:attribute>
+ <xsl:value-of select="@字:引文体"/>
+ </xsl:element>
+ <xsl:element name="text:note-body">
+ <xsl:for-each select="å­—:段è½">
+ <xsl:call-template name="commonParagraph"/>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="字:锚点">
+ <xsl:call-template name="图形解æž"/>
+ </xsl:template>
+ <xsl:key match="/uof:UOF/uof:文字处ç†/å­—:主体/å­—:段è½/å­—:å¥/å­—:锚点 | /uof:UOF/uof:文字处ç†/å­—:主体/å­—:分节/å­—:节属性/å­—:页眉//å­—:锚点 | /uof:UOF/uof:文字处ç†/å­—:主体/å­—:分节/å­—:节属性/å­—:页脚//å­—:锚点" name="rel_graphic_name" use="å­—:图形/@å­—:图形引用"/>
+ <xsl:template match="图:图形">
+ <xsl:variable name="random-name">
+ <xsl:value-of select="generate-id()"/>
+ </xsl:variable>
+ <xsl:variable name="draw-name">
+ <xsl:value-of select="substring($random-name,string-length($random-name)-1)"/>
+ </xsl:variable>
+ <xsl:call-template name="graphic-fill">
+ <xsl:with-param name="draw-name" select="$draw-name"/>
+ <xsl:with-param name="gradient-name" select="图:预定义图形/图:属性/图:å¡«å……/图:æ¸å˜"/>
+ </xsl:call-template>
+ <xsl:choose>
+ <xsl:when test="图:预定义图形/图:属性/图:å¡«å……/图:æ¸å˜ | 图:预定义图形/图:属性/图:å¡«å……/图:颜色 | 图:预定义图形/图:属性/图:å¡«å……/图:图片 | 图:预定义图形/图:属性/图:å¡«å……/图:ä½å›¾">
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name"><xsl:value-of select="@图:标识符"/></xsl:attribute>
+ <xsl:attribute name="style:family">graphic</xsl:attribute>
+ <xsl:if test="图:文本内容/@图:自动æ¢è¡Œ='true' or 图:文本内容/@图:自动æ¢è¡Œ='1'">
+ <xsl:attribute name="draw:fit-to-contour">true</xsl:attribute>
+ </xsl:if>
+ <xsl:element name="style:graphic-properties">
+ <xsl:call-template name="process-graphics">
+ <xsl:with-param name="draw-name" select="$draw-name"/>
+ </xsl:call-template>
+ </xsl:element>
+ <xsl:if test="图:文本内容/@图:文字排列方å‘">
+ <xsl:choose>
+ <xsl:when test="图:文本内容/@图:文字排列方å‘='vert-l2r'">
+ <style:paragraph-properties style:writing-mode="tb-rl"/>
+ </xsl:when>
+ <xsl:when test="图:文本内容/@图:文字排列方å‘='vert-r2l'">
+ <style:paragraph-properties style:writing-mode="tb-rl"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name"><xsl:value-of select="@图:标识符"/></xsl:attribute>
+ <xsl:attribute name="style:family">graphic</xsl:attribute>
+ <xsl:element name="style:graphic-properties">
+ <xsl:if test="@图:其他对象 or key('rel_graphic_name',@图:标识符)/å­—:锚点属性/å­—:锚点属性/å­—:ä½ç½®/å­—:åž‚ç›´/å­—:相对/@å­—:相对于">
+ <xsl:attribute name="fo:clip">rect(0cm 0cm 0cm 0cm)</xsl:attribute>
+ <xsl:attribute name="draw:color-mode">standard</xsl:attribute>
+ <xsl:attribute name="draw:luminance">0%</xsl:attribute>
+ <xsl:attribute name="draw:contrast">0%</xsl:attribute>
+ <xsl:attribute name="draw:gamma">100%</xsl:attribute>
+ <xsl:attribute name="draw:red">0%</xsl:attribute>
+ <xsl:attribute name="draw:green">0%</xsl:attribute>
+ <xsl:attribute name="draw:blue">0%</xsl:attribute>
+ <xsl:attribute name="draw:image-opacity">100%</xsl:attribute>
+ <xsl:attribute name="style:mirror">none</xsl:attribute>
+ </xsl:if>
+ <xsl:call-template name="process-graphics"/>
+ </xsl:element>
+ <xsl:if test="图:文本内容/@图:文字排列方å‘">
+ <xsl:choose>
+ <xsl:when test="图:文本内容/@图:文字排列方å‘='vert-l2r'">
+ <style:paragraph-properties style:writing-mode="tb-rl"/>
+ </xsl:when>
+ <xsl:when test="图:文本内容/@图:文字排列方å‘='vert-r2l'">
+ <style:paragraph-properties style:writing-mode="tb-rl"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="bina_graphic">
+ <xsl:param name="refGraphic"/>
+ <xsl:element name="office:binary-data">
+ <xsl:for-each select="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符 = $refGraphic]">
+ <xsl:value-of select="uof:æ•°æ®"/>
+ </xsl:for-each>
+ </xsl:element>
+ <text:p/>
+ </xsl:template>
+ <xsl:template name="graphic-fill">
+ <xsl:param name="draw-name"/>
+ <xsl:param name="gradient-name"/>
+ <xsl:if test="图:预定义图形/图:属性/图:å¡«å……/图:æ¸å˜">
+ <xsl:element name="draw:gradient">
+ <xsl:attribute name="draw:name"><xsl:value-of select="concat('Gradient ',$draw-name)"/></xsl:attribute>
+ <xsl:attribute name="draw:style"><xsl:choose><xsl:when test="$gradient-name/@图:ç§å­ç±»åž‹='linear'"><xsl:value-of select="'linear'"/></xsl:when><xsl:when test="$gradient-name/@图:ç§å­ç±»åž‹='radar'"><xsl:value-of select="'radial'"/></xsl:when><xsl:when test="$gradient-name/@图:ç§å­ç±»åž‹='oval'"><xsl:value-of select="'ellipsoid'"/></xsl:when><xsl:when test="$gradient-name/@图:ç§å­ç±»åž‹='square'"><xsl:value-of select="'square'"/></xsl:when><xsl:when test="$gradient-name/@图:ç§å­ç±»åž‹='rectangle'"><xsl:value-of select="'rectangular'"/></xsl:when></xsl:choose></xsl:attribute>
+ <xsl:attribute name="draw:start-color"><xsl:value-of select="$gradient-name/@图:起始色"/></xsl:attribute>
+ <xsl:attribute name="draw:end-color"><xsl:value-of select="$gradient-name/@图:终止色"/></xsl:attribute>
+ <xsl:attribute name="draw:start-intensity"><xsl:value-of select="concat($gradient-name/@图:起始浓度,'%')"/></xsl:attribute>
+ <xsl:attribute name="draw:end-intensity"><xsl:value-of select="concat($gradient-name/@图:终止浓度,'%')"/></xsl:attribute>
+ <xsl:attribute name="draw:angle"><xsl:value-of select="$gradient-name/@图:æ¸å˜æ–¹å‘ * 10"/></xsl:attribute>
+ <xsl:attribute name="draw:border"><xsl:value-of select="concat($gradient-name/@图:边界,'%')"/></xsl:attribute>
+ <xsl:if test="$gradient-name/@图:ç§å­Xä½ç½®">
+ <xsl:attribute name="draw:cx"><xsl:value-of select="concat($gradient-name/@图:ç§å­Xä½ç½®,'%')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$gradient-name/@图:ç§å­Yä½ç½®">
+ <xsl:attribute name="draw:cy"><xsl:value-of select="concat($gradient-name/@图:ç§å­Yä½ç½®,'%')"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´">
+ <xsl:element name="draw:marker">
+ <xsl:attribute name="draw:name"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¼æ ·='normal'">Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¼æ ·='open'">Line Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¼æ ·='stealth'">Arrow concave</xsl:when><xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¼æ ·='oval'">Circle</xsl:when><xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¼æ ·='diamond'">Square 45</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¼æ ·='normal'">
+ <xsl:attribute name="svg:viewBox">0 0 20 30</xsl:attribute>
+ <xsl:attribute name="svg:d">m10 0-10 30h20z</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¼æ ·='open'">
+ <xsl:attribute name="svg:viewBox">0 0 1122 2243</xsl:attribute>
+ <xsl:attribute name="svg:d">m0 2108v17 17l12 42 30 34 38 21 43 4 29-8 30-21 25-26 13-34 343-1532 339 1520 13 42 29 34 39 21 42 4 42-12 34-30 21-42v-39-12l-4 4-440-1998-9-42-25-39-38-25-43-8-42 8-38 25-26 39-8 42z</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¼æ ·='stealth'">
+ <xsl:attribute name="svg:viewBox">0 0 1131 1580</xsl:attribute>
+ <xsl:attribute name="svg:d">m1013 1491 118 89-567-1580-564 1580 114-85 136-68 148-46 161-17 161 13 153 46z</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¼æ ·='oval'">
+ <xsl:attribute name="svg:viewBox">0 0 1131 1131</xsl:attribute>
+ <xsl:attribute name="svg:d">m462 1118-102-29-102-51-93-72-72-93-51-102-29-102-13-105 13-102 29-106 51-102 72-89 93-72 102-50 102-34 106-9 101 9 106 34 98 50 93 72 72 89 51 102 29 106 13 102-13 105-29 102-51 102-72 93-93 72-98 51-106 29-101 13z</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¼æ ·='diamond'">
+ <xsl:attribute name="svg:viewBox">0 0 1131 1131</xsl:attribute>
+ <xsl:attribute name="svg:d">m0 564 564 567 567-567-567-564z</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´">
+ <xsl:element name="draw:marker">
+ <xsl:attribute name="draw:name"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¼æ ·='normal'">Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¼æ ·='open'">Line Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¼æ ·='stealth'">Arrow concave</xsl:when><xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¼æ ·='oval'">Circle</xsl:when><xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¼æ ·='diamond'">Square 45</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¼æ ·='normal'">
+ <xsl:attribute name="svg:viewBox">0 0 20 30</xsl:attribute>
+ <xsl:attribute name="svg:d">m10 0-10 30h20z</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¼æ ·='open'">
+ <xsl:attribute name="svg:viewBox">0 0 1122 2243</xsl:attribute>
+ <xsl:attribute name="svg:d">m0 2108v17 17l12 42 30 34 38 21 43 4 29-8 30-21 25-26 13-34 343-1532 339 1520 13 42 29 34 39 21 42 4 42-12 34-30 21-42v-39-12l-4 4-440-1998-9-42-25-39-38-25-43-8-42 8-38 25-26 39-8 42z</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¼æ ·='stealth'">
+ <xsl:attribute name="svg:viewBox">0 0 1131 1580</xsl:attribute>
+ <xsl:attribute name="svg:d">m1013 1491 118 89-567-1580-564 1580 114-85 136-68 148-46 161-17 161 13 153 46z</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¼æ ·='oval'">
+ <xsl:attribute name="svg:viewBox">0 0 1131 1131</xsl:attribute>
+ <xsl:attribute name="svg:d">m462 1118-102-29-102-51-93-72-72-93-51-102-29-102-13-105 13-102 29-106 51-102 72-89 93-72 102-50 102-34 106-9 101 9 106 34 98 50 93 72 72 89 51 102 29 106 13 102-13 105-29 102-51 102-72 93-93 72-98 51-106 29-101 13z</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¼æ ·='diamond'">
+ <xsl:attribute name="svg:viewBox">0 0 1131 1131</xsl:attribute>
+ <xsl:attribute name="svg:d">m0 564 564 567 567-567-567-564z</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="图:预定义图形/图:属性/图:填充/图:图片/@图:图形引用 or 图:预定义图形/图:属性/图:填充/图:图案/@图:图形引用">
+ <xsl:element name="draw:fill-image">
+ <xsl:attribute name="draw:name"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:å¡«å……/图:图案/@图:图形引用"><xsl:value-of select="图:预定义图形/图:属性/图:å¡«å……/图:图案/@图:类型"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:å¡«å……/图:图片/@图:图形引用"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:å¡«å……/图:图片/@图:å称"><xsl:value-of select="图:预定义图形/图:属性/图:å¡«å……/图:图片/@图:å称"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:å¡«å……/图:图片/@图:图形引用"><xsl:value-of select="图:预定义图形/图:属性/图:å¡«å……/图:图片/@图:图形引用"/></xsl:when></xsl:choose></xsl:when></xsl:choose></xsl:attribute>
+ <xsl:call-template name="bina_graphic">
+ <xsl:with-param name="refGraphic">
+ <xsl:choose>
+ <xsl:when test="图:预定义图形/图:属性/图:填充/图:图案/@图:图形引用">
+ <xsl:value-of select="图:预定义图形/图:属性/图:填充/图:图案/@图:图形引用"/>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:å¡«å……/图:图片/@图:å称">
+ <xsl:value-of select="图:预定义图形/图:属性/图:å¡«å……/图:图片/@图:å称"/>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:填充/图:图片/@图:图形引用">
+ <xsl:value-of select="图:预定义图形/图:属性/图:填充/图:图片/@图:图形引用"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="not(图:预定义图形/图:属性/图:线型='single') and not(图:预定义图形/图:属性/图:线型='thick') and 图:预定义图形/图:属性/图:线型">
+ <xsl:variable name="line" select="图:预定义图形/图:属性/图:线型"/>
+ <xsl:element name="draw:stroke-dash">
+ <xsl:choose>
+ <xsl:when test="$line='dash-long' or $line='dash-long-heavy'">
+ <xsl:attribute name="draw:name">Fine_20_Dashed</xsl:attribute>
+ <xsl:attribute name="draw:style">rect</xsl:attribute>
+ <xsl:attribute name="draw:dots1">1</xsl:attribute>
+ <xsl:attribute name="draw:dots1-length">0.508cm</xsl:attribute>
+ <xsl:attribute name="draw:dots2">1</xsl:attribute>
+ <xsl:attribute name="draw:dots2-length">0.508cm</xsl:attribute>
+ <xsl:attribute name="draw:distance">0.508cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$line='dot-dot-dash' or $line='dash-dot-dot-heavy'">
+ <xsl:attribute name="draw:name">2 Dots 1 Dash</xsl:attribute>
+ <xsl:attribute name="draw:style">rect</xsl:attribute>
+ <xsl:attribute name="draw:dots1">2</xsl:attribute>
+ <xsl:attribute name="draw:dots2">1</xsl:attribute>
+ <xsl:attribute name="draw:dots2-length">0.203cm</xsl:attribute>
+ <xsl:attribute name="draw:distance">0.203cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$line='dash' or $line='dashed-heavy'">
+ <xsl:attribute name="draw:name">Ultrafine Dashed</xsl:attribute>
+ <xsl:attribute name="draw:style">rect</xsl:attribute>
+ <xsl:attribute name="draw:dots1">1</xsl:attribute>
+ <xsl:attribute name="draw:dots1-length">0.051cm</xsl:attribute>
+ <xsl:attribute name="draw:dots2">1</xsl:attribute>
+ <xsl:attribute name="draw:dots2-length">0.051cm</xsl:attribute>
+ <xsl:attribute name="draw:distance">0.051cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$line='dotted' or $line='dotted-heavy'">
+ <xsl:attribute name="draw:name">Ultrafine Dotted (var)</xsl:attribute>
+ <xsl:attribute name="draw:style">rect</xsl:attribute>
+ <xsl:attribute name="draw:dots1">1</xsl:attribute>
+ <xsl:attribute name="draw:distance">50%</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$line='wave' or $line='wavy-heavy'">
+ <xsl:attribute name="draw:name">Ultrafine 2 Dots 3 Dashes</xsl:attribute>
+ <xsl:attribute name="draw:style">rect</xsl:attribute>
+ <xsl:attribute name="draw:dots1">2</xsl:attribute>
+ <xsl:attribute name="draw:dots1-length">0.051cm</xsl:attribute>
+ <xsl:attribute name="draw:dots2">3</xsl:attribute>
+ <xsl:attribute name="draw:dots2-length">0.254cm</xsl:attribute>
+ <xsl:attribute name="draw:distance">0.127cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$line='dot-dash' or $line='dash-dot-heavy'">
+ <xsl:attribute name="draw:name">3 Dashes 3 Dots (var)</xsl:attribute>
+ <xsl:attribute name="draw:style">rect</xsl:attribute>
+ <xsl:attribute name="draw:dots1">3</xsl:attribute>
+ <xsl:attribute name="draw:dots1-length">197%</xsl:attribute>
+ <xsl:attribute name="draw:dots2">3</xsl:attribute>
+ <xsl:attribute name="draw:distance">100%</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$line='double'">
+ <xsl:attribute name="draw:name">Line with Fine Dots</xsl:attribute>
+ <xsl:attribute name="draw:style">rect</xsl:attribute>
+ <xsl:attribute name="draw:dots1">1</xsl:attribute>
+ <xsl:attribute name="draw:dots1-length">2.007cm</xsl:attribute>
+ <xsl:attribute name="draw:dots2">10</xsl:attribute>
+ <xsl:attribute name="draw:distance">0.152cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$line='wavy-double'">
+ <xsl:attribute name="draw:name">Fine Dashed (var)</xsl:attribute>
+ <xsl:attribute name="draw:style">rect</xsl:attribute>
+ <xsl:attribute name="draw:dots1">1</xsl:attribute>
+ <xsl:attribute name="draw:dots1-length">197%</xsl:attribute>
+ <xsl:attribute name="draw:distance">197%</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="draw:name">Fine Dashed</xsl:attribute>
+ <xsl:attribute name="draw:style">rect</xsl:attribute>
+ <xsl:attribute name="draw:dots1">1</xsl:attribute>
+ <xsl:attribute name="draw:dots1-length">0.508cm</xsl:attribute>
+ <xsl:attribute name="draw:dots2">1</xsl:attribute>
+ <xsl:attribute name="draw:dots2-length">0.508cm</xsl:attribute>
+ <xsl:attribute name="draw:distance">0.508cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="process-graphics">
+ <xsl:param name="draw-name"/>
+ <xsl:if test="图:预定义图形/图:类别">
+ </xsl:if>
+ <xsl:for-each select="key('rel_graphic_name',@图:标识符)/å­—:锚点属性/å­—:ä½ç½®/å­—:åž‚ç›´">
+ <xsl:attribute name="style:vertical-pos"><xsl:choose><xsl:when test="å­—:ç»å¯¹">from-top</xsl:when><xsl:when test="å­—:相对/@å­—:值='bottom'">bottom</xsl:when><xsl:when test="å­—:相对/@å­—:值='center'">middle</xsl:when><xsl:when test="å­—:相对/@å­—:值='inside'">below</xsl:when><xsl:otherwise>top</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="style:vertical-rel"><xsl:choose><xsl:when test="@字:相对于='margin'">paragraph-content</xsl:when><xsl:otherwise><xsl:value-of select="@字:相对于"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:for-each>
+ <xsl:for-each select="key('rel_graphic_name',@图:标识符)/å­—:锚点属性/å­—:ä½ç½®/å­—:æ°´å¹³">
+ <xsl:attribute name="style:horizontal-pos"><xsl:choose><xsl:when test="å­—:ç»å¯¹">from-left</xsl:when><xsl:otherwise><xsl:value-of select="å­—:相对/@å­—:值"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="style:horizontal-rel"><xsl:choose><xsl:when test="@字:相对于='margin'">paragraph</xsl:when><xsl:when test="@字:相对于='page'">page</xsl:when><xsl:when test="@字:相对于='column'">paragraph</xsl:when><xsl:when test="@字:相对于='char'">char</xsl:when></xsl:choose></xsl:attribute>
+ </xsl:for-each>
+ <xsl:variable name="wrap_type">
+ <xsl:value-of select="key('rel_graphic_name',@图:标识符)/å­—:锚点属性/å­—:绕排/@å­—:绕排方å¼"/>
+ </xsl:variable>
+ <xsl:variable name="aa">
+ <xsl:value-of select="key('rel_graphic_name',@图:标识符)/字:锚点属性/字:绕排/@字:绕排顶点"/>
+ </xsl:variable>
+ <xsl:for-each select="key('rel_graphic_name',@图:标识符)/å­—:锚点属性/å­—:绕排/@å­—:绕排方å¼">
+ <xsl:attribute name="style:wrap"><xsl:choose><xsl:when test="$wrap_type = 'through'">run-through</xsl:when><xsl:when test="$wrap_type = 'tight'">right</xsl:when><xsl:when test="$wrap_type = 'square'">parallel</xsl:when><xsl:when test="$wrap_type = 'top-bottom'">dynamic</xsl:when><xsl:when test="$wrap_type = 'infrontoftext'">run-through</xsl:when><xsl:when test="$wrap_type = 'behindtext'">run-through</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="style:run-through"><xsl:choose><xsl:when test="$wrap_type = 'behindtext'">background</xsl:when><xsl:otherwise>foreground</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:for-each>
+ <xsl:if test="key('rel_graphic_name',@图:标识符)/å­—:锚点属性/å­—:è¾¹è·">
+ <xsl:for-each select="key('rel_graphic_name',@图:标识符)/å­—:锚点属性/å­—:è¾¹è·">
+ <xsl:attribute name="fo:margin-top"><xsl:value-of select="concat(@字:上,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:margin-bottom"><xsl:value-of select="concat(@字:下,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:margin-right"><xsl:value-of select="concat(@å­—:å³,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:margin-left"><xsl:value-of select="concat(@å­—:å·¦,$uofUnit)"/></xsl:attribute>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:if test="key('rel_graphic_name',@图:标识符)/å­—:锚点属性/å­—:ä¿æŠ¤/@å­—:值='true'">
+ <xsl:choose>
+ <xsl:when test="图:预定义图形/图:å称">
+ <xsl:attribute name="style:protect">position size</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:protect">content size position</xsl:attribute>
+ <xsl:attribute name="draw:size-protect">true</xsl:attribute>
+ <xsl:attribute name="draw:move-protect">true</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="图:预定义图形/图:å称">
+ <xsl:choose>
+ <xsl:when test="图:预定义图形/图:å称='椭圆'">
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="not(图:预定义图形/图:属性/图:填充)">
+ <xsl:attribute name="draw:fill">none</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:填充/图:图片">
+ <xsl:choose>
+ <xsl:when test="图:预定义图形/图:属性/图:å¡«å……/图:图片/@图:å称='background-image'">
+ <xsl:element name="style:background-image">
+ <xsl:element name="office:binary-data">
+ <xsl:variable name="biaoshi">
+ <xsl:value-of select="图:预定义图形/图:属性/图:填充/图:图片/@图:图形引用"/>
+ </xsl:variable>
+ <xsl:value-of select="ancestor::uof:对象集/uof:其他对象[@uof:标识符=$biaoshi]/uof:æ•°æ®"/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="draw:fill">bitmap</xsl:attribute>
+ <xsl:attribute name="draw:fill-image-name"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:å¡«å……/图:图片/@图:å称"><xsl:value-of select="图:预定义图形/图:属性/图:å¡«å……/图:图片/@图:å称"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:å¡«å……/图:图片/@图:图形引用"><xsl:value-of select="图:预定义图形/图:属性/图:å¡«å……/图:图片/@图:图形引用"/></xsl:when></xsl:choose></xsl:attribute>
+ <xsl:if test="not(图:预定义图形/图:属性/图:å¡«å……/图:图片/@图:ä½ç½®='tile')">
+ <xsl:attribute name="style:repeat"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:å¡«å……/图:图片/@图:ä½ç½®='center'">no-repeat</xsl:when><xsl:when test="图:预定义图形/图:属性/图:å¡«å……/图:图片/@图:ä½ç½®='stretch'">stretch</xsl:when></xsl:choose></xsl:attribute>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:填充/图:图案">
+ <xsl:attribute name="draw:fill">bitmap</xsl:attribute>
+ <xsl:attribute name="draw:fill-color"><xsl:value-of select="图:预定义图形/图:属性/图:å¡«å……/图:图案/@图:å‰æ™¯è‰²"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:填充/图:颜色">
+ <xsl:attribute name="draw:fill">solid</xsl:attribute>
+ <xsl:attribute name="draw:fill-color"><xsl:value-of select="图:预定义图形/图:属性/图:填充/图:颜色"/></xsl:attribute>
+ <xsl:attribute name="fo:background-color"><xsl:value-of select="图:预定义图形/图:属性/图:填充/图:颜色"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:å¡«å……/图:æ¸å˜">
+ <xsl:attribute name="draw:fill">gradient</xsl:attribute>
+ <xsl:attribute name="draw:fill-color"><xsl:value-of select="图:预定义图形/图:属性/图:å¡«å……/图:æ¸å˜/@图:起始色"/></xsl:attribute>
+ <xsl:attribute name="draw:fill-gradient-name"><xsl:value-of select="concat('Gradient ',$draw-name)"/></xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="图:预定义图形/图:属性/图:线颜色">
+ <xsl:attribute name="svg:stroke-color"><xsl:value-of select="图:预定义图形/图:属性/图:线颜色"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="图:预定义图形/图:属性/图:线型 and not(图:预定义图形/图:属性/图:线型 = 'single') and not(图:预定义图形/图:属性/图:线型 = 'thick')">
+ <xsl:variable name="linetype" select="图:预定义图形/图:属性/图:线型"/>
+ <xsl:attribute name="draw:stroke"><xsl:choose><xsl:when test="$linetype='none'">none</xsl:when><xsl:otherwise>dash</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="$linetype='none'">
+ <xsl:attribute name="fo:border">none</xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="draw:stroke-dash"><xsl:choose><xsl:when test="$linetype='dot-dot-dash' or $linetype='dash-dot-dot-heavy'">2 Dots 1 Dash</xsl:when><xsl:when test="$linetype='dash' or $linetype='dashed-heavy'">Ultrafine_20_Dashed</xsl:when><xsl:when test="$linetype='dotted' or $linetype='dotted-heavy'">Ultrafine Dotted (var)</xsl:when><xsl:when test="$linetype='double'">Line with Fine Dots</xsl:when><xsl:when test="$linetype='dot-dash' or $linetype='dash-dot-heavy'">3 Dashes 3 Dots (var)</xsl:when><xsl:when test="$linetype='wave' or $linetype='wavy-heavy'">Ultrafine 2 Dots 3 Dashes</xsl:when><xsl:when test="$linetype='wavy-double'">Fine Dashed (var)</xsl:when><xsl:otherwise>Fine Dashed</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="图:预定义图形/图:属性/图:线粗细">
+ <xsl:attribute name="svg:stroke-width"><xsl:value-of select="concat(图:预定义图形/图:属性/图:线粗细,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´">
+ <xsl:attribute name="draw:marker-start"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¼æ ·='normal'">Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¼æ ·='open'">Line Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¼æ ·='stealth'">Arrow concave</xsl:when><xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¼æ ·='oval'">Circle</xsl:when><xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¼æ ·='diamond'">Square 45</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:if test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:大å°">
+ <xsl:attribute name="draw:marker-start-width"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¤§å° = '1'"><xsl:value-of select="concat('0.05',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¤§å° = '2'"><xsl:value-of select="concat('0.10',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¤§å° = '3'"><xsl:value-of select="concat('0.15',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¤§å° = '4'"><xsl:value-of select="concat('0.20',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¤§å° = '5'"><xsl:value-of select="concat('0.25',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¤§å° = '6'"><xsl:value-of select="concat('0.30',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¤§å° = '7'"><xsl:value-of select="concat('0.35',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¤§å° = '8'"><xsl:value-of select="concat('0.40',$uofUnit)"/></xsl:when><xsl:otherwise><xsl:value-of select="concat('0.45',$uofUnit)"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´">
+ <xsl:attribute name="draw:marker-end"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¼æ ·='normal'">Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¼æ ·='open'">Line Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¼æ ·='stealth'">Arrow concave</xsl:when><xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¼æ ·='oval'">Circle</xsl:when><xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¼æ ·='diamond'">Square 45</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:if test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:大å°">
+ <xsl:attribute name="draw:marker-end-width"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¤§å° = '1'"><xsl:value-of select="concat('0.05',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¤§å° = '2'"><xsl:value-of select="concat('0.10',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¤§å° = '3'"><xsl:value-of select="concat('0.15',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¤§å° = '4'"><xsl:value-of select="concat('0.20',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¤§å° = '5'"><xsl:value-of select="concat('0.25',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¤§å° = '6'"><xsl:value-of select="concat('0.30',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¤§å° = '7'"><xsl:value-of select="concat('0.35',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¤§å° = '8'"><xsl:value-of select="concat('0.40',$uofUnit)"/></xsl:when><xsl:otherwise><xsl:value-of select="concat('0.45',$uofUnit)"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="图:预定义图形/图:属性/图:宽度">
+ </xsl:if>
+ <xsl:if test="图:预定义图形/图:属性/图:高度">
+ </xsl:if>
+ <xsl:if test="图:预定义图形/图:属性/图:旋转角度">
+ </xsl:if>
+ <xsl:if test="图:预定义图形/图:属性/图:é”定纵横比">
+ </xsl:if>
+ <xsl:if test="图:预定义图形/图:属性/图:打å°å¯¹è±¡">
+ </xsl:if>
+ <xsl:if test="图:预定义图形/图:属性/图:é€æ˜Žåº¦">
+ <xsl:attribute name="draw:opacity"><xsl:value-of select="concat((100 - 图:预定义图形/图:属性/图:é€æ˜Žåº¦),'%')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="图:文本内容">
+ <xsl:if test="图:文本内容/@图:上边è·">
+ <xsl:attribute name="fo:padding-top"><xsl:value-of select="concat(图:文本内容/@图:上边è·,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:padding-bottom"><xsl:value-of select="concat(图:文本内容/@图:下边è·,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:padding-left"><xsl:value-of select="concat(图:文本内容/@图:左边è·,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:padding-right"><xsl:value-of select="concat(图:文本内容/@图:å³è¾¹è·,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="图:文本内容/@图:文字排列方å‘">
+ <xsl:choose>
+ <xsl:when test="图:文本内容/@图:文字排列方å‘='vert-l2r'">
+ <xsl:attribute name="style:writing-mode">tb-rl</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:文本内容/@图:文字排列方å‘='vert-r2l'">
+ <xsl:attribute name="style:writing-mode">tb-rl</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="图:文本内容/@图:水平对é½">
+ <xsl:attribute name="draw:textarea-horizontal-align"><xsl:value-of select="图:文本内容/@图:水平对é½"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="图:文本内容/@图:垂直对é½">
+ <xsl:attribute name="draw:textarea-vertical-align"><xsl:value-of select="图:文本内容/@图:垂直对é½"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="图:文本内容/@图:自动æ¢è¡Œ">
+ <xsl:attribute name="fo:wrap-option"><xsl:choose><xsl:when test="图:文本内容/@图:自动æ¢è¡Œ='1' or 图:文本内容/@图:自动æ¢è¡Œ='true'">wrap</xsl:when><xsl:otherwise>no-wrap</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="图:文本内容/@图:大å°é€‚应文字='true'">
+ <xsl:attribute name="draw:auto-grow-width">true</xsl:attribute>
+ <xsl:attribute name="draw:auto-grow-height">true</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="draw:auto-grow-width">false</xsl:attribute>
+ <xsl:attribute name="draw:auto-grow-height">false</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="图:控制点">
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="图形解æž">
+ <xsl:variable name="tuxing1" select="字:图形/@字:图形引用"/>
+ <xsl:variable name="paiban">
+ <xsl:value-of select="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $tuxing1]/图:预定义图形/图:å称"/>
+ </xsl:variable>
+ <xsl:variable name="otherobject">
+ <xsl:value-of select="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $tuxing1]/@图:其他对象"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]">
+ <xsl:if test="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/@uof:公共类型='png' or /uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/@uof:公共类型='jpg' or /uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/@uof:公共类型='bmp' or /uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/@uof:公共类型='gif' or /uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/@uof:ç§æœ‰ç±»åž‹='图片'">
+ <xsl:element name="draw:frame">
+ <xsl:attribute name="draw:name"><xsl:variable name="pos"><xsl:value-of select="count(preceding::字:锚点)"/></xsl:variable><xsl:value-of select="concat('图形',$pos)"/></xsl:attribute>
+ <xsl:if test="å­—:锚点属性/å­—:ä½ç½®/å­—:æ°´å¹³/å­—:ç»å¯¹">
+ <xsl:attribute name="svg:x"><xsl:value-of select="concat(å­—:锚点属性/å­—:ä½ç½®/å­—:æ°´å¹³/å­—:ç»å¯¹/@å­—:值,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="å­—:锚点属性/å­—:ä½ç½®/å­—:åž‚ç›´/å­—:ç»å¯¹">
+ <xsl:attribute name="svg:y"><xsl:value-of select="concat(å­—:锚点属性/å­—:ä½ç½®/å­—:åž‚ç›´/å­—:ç»å¯¹/@å­—:值,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="svg:width"><xsl:value-of select="concat(字:锚点属性/字:宽度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:height"><xsl:value-of select="concat(字:锚点属性/字:高度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="text:anchor-type"><xsl:choose><xsl:when test="@字:类型='inline'">as-char</xsl:when><xsl:otherwise>paragraph</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:for-each select="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $tuxing1]">
+ <xsl:attribute name="draw:style-name"><xsl:value-of select="@图:标识符"/></xsl:attribute>
+ <xsl:attribute name="draw:z-index"><xsl:value-of select="@图:层次"/></xsl:attribute>
+ <xsl:if test="图:预定义图形/图:属性/图:旋转角度 and not(图:预定义图形/图:属性/图:旋转角度='0.0')">
+ <xsl:variable name="jiaodu">
+ <xsl:value-of select="图:预定义图形/图:属性/图:旋转角度"/>
+ </xsl:variable>
+ <xsl:variable name="shibie">
+ <xsl:value-of select="图:预定义图形/图:生æˆè½¯ä»¶"/>
+ </xsl:variable>
+ <xsl:variable name="rotate-angle">
+ <xsl:choose>
+ <xsl:when test="图:预定义图形/图:生æˆè½¯ä»¶ and not($shibie='PNG')">
+ <xsl:value-of select="((360 - $jiaodu) * 2 * 3.14159265 ) div 360"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="(图:预定义图形/图:属性/图:旋转角度 * 2 * 3.14159265 ) div 360"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="draw:transform"><xsl:value-of select="concat('rotate (',$rotate-angle,') translate (-0.0194027777777778cm 3.317875cm)')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="图:文本内容">
+ <xsl:apply-templates select="图:文本内容/å­—:段è½"/>
+ <xsl:apply-templates select="图:文本内容/字:文字表"/>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:if test="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/uof:æ•°æ®">
+ <draw:image>
+ <office:binary-data>
+ <xsl:value-of select="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/uof:æ•°æ®"/>
+ </office:binary-data>
+ </draw:image>
+ </xsl:if>
+ <xsl:if test="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/uof:路径">
+ <xsl:attribute name="xlink:href"><xsl:value-of select="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/uof:路径"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ </xsl:when>
+ <xsl:when test="/uof:UOF/uof:对象集/图:图形[@图:标识符=$tuxing1]/@图:其他对象 and /uof:UOF/uof:对象集/uof:其他对象/@uof:公共类型='jpg'">
+ <xsl:variable name="bshi">
+ <xsl:value-of select="/uof:UOF/uof:对象集/图:图形/@图:其他对象"/>
+ </xsl:variable>
+ <xsl:if test="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$bshi]/@uof:公共类型='jpg'">
+ <xsl:element name="draw:frame">
+ <xsl:attribute name="draw:name"><xsl:variable name="pos"><xsl:value-of select="count(preceding::字:锚点)"/></xsl:variable><xsl:value-of select="concat('图形',$pos)"/></xsl:attribute>
+ <xsl:if test="å­—:锚点属性/å­—:ä½ç½®/å­—:æ°´å¹³/å­—:ç»å¯¹">
+ <xsl:attribute name="svg:x"><xsl:value-of select="concat(å­—:锚点属性/å­—:ä½ç½®/å­—:æ°´å¹³/å­—:ç»å¯¹/@å­—:值,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="å­—:锚点属性/å­—:ä½ç½®/å­—:åž‚ç›´/å­—:ç»å¯¹">
+ <xsl:attribute name="svg:y"><xsl:value-of select="concat(å­—:锚点属性/å­—:ä½ç½®/å­—:åž‚ç›´/å­—:ç»å¯¹/@å­—:值,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="svg:width"><xsl:value-of select="concat(字:锚点属性/字:宽度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:height"><xsl:value-of select="concat(字:锚点属性/字:高度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="text:anchor-type"><xsl:choose><xsl:when test="@字:类型='inline'">as-char</xsl:when><xsl:otherwise>paragraph</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:for-each select="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $tuxing1]">
+ <xsl:attribute name="draw:style-name"><xsl:value-of select="@图:标识符"/></xsl:attribute>
+ <xsl:attribute name="draw:z-index"><xsl:value-of select="@图:层次"/></xsl:attribute>
+ <xsl:if test="图:预定义图形/图:属性/图:旋转角度 and not(图:预定义图形/图:属性/图:旋转角度='0.0')">
+ <xsl:variable name="jiaodu">
+ <xsl:value-of select="图:预定义图形/图:属性/图:旋转角度"/>
+ </xsl:variable>
+ <xsl:variable name="shibie">
+ <xsl:value-of select="图:预定义图形/图:生æˆè½¯ä»¶"/>
+ </xsl:variable>
+ <xsl:variable name="rotate-angle">
+ <xsl:choose>
+ <xsl:when test="图:预定义图形/图:生æˆè½¯ä»¶ and not($shibie='PNG')">
+ <xsl:value-of select="((360 - $jiaodu) * 2 * 3.14159265 ) div 360"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="(图:预定义图形/图:属性/图:旋转角度 * 2 * 3.14159265 ) div 360"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="draw:transform"><xsl:value-of select="concat('rotate (',$rotate-angle,') translate (-0.0194027777777778cm 3.317875cm)')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="图:文本内容">
+ <xsl:apply-templates select="图:文本内容/å­—:段è½"/>
+ <xsl:apply-templates select="图:文本内容/字:文字表"/>
+ </xsl:if>
+ <xsl:variable name="qita">
+ <xsl:value-of select="self::node()/@图:其他对象"/>
+ </xsl:variable>
+ <xsl:for-each select="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$qita]/uof:æ•°æ®">
+ <draw:image>
+ <office:binary-data>
+ <xsl:value-of select="."/>
+ </office:binary-data>
+ </draw:image>
+ </xsl:for-each>
+ </xsl:for-each>
+ <xsl:if test="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/uof:路径">
+ <xsl:attribute name="xlink:href"><xsl:value-of select="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/uof:路径"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ </xsl:when>
+ <xsl:when test="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $tuxing1]/图:文本内容[@图:文本框='true'] and not($paiban='排版框')">
+ <draw:frame text:anchor-type="paragraph">
+ <xsl:attribute name="draw:style-name"><xsl:value-of select="$tuxing1"/></xsl:attribute>
+ <xsl:attribute name="svg:width"><xsl:value-of select="concat(字:锚点属性/字:宽度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:height"><xsl:value-of select="concat(字:锚点属性/字:高度,$uofUnit)"/></xsl:attribute>
+ <xsl:if test="å­—:锚点属性/å­—:ä½ç½®/å­—:æ°´å¹³/å­—:ç»å¯¹">
+ <xsl:attribute name="svg:x"><xsl:value-of select="concat(å­—:锚点属性/å­—:ä½ç½®/å­—:æ°´å¹³/å­—:ç»å¯¹/@å­—:值,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="å­—:锚点属性/å­—:ä½ç½®/å­—:åž‚ç›´/å­—:ç»å¯¹">
+ <xsl:attribute name="svg:y"><xsl:value-of select="concat(å­—:锚点属性/å­—:ä½ç½®/å­—:åž‚ç›´/å­—:ç»å¯¹/@å­—:值,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="draw:z-index">
+ <xsl:for-each select="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $tuxing1]"><xsl:value-of select="@图:层次"/></xsl:for-each>
+ </xsl:attribute>
+ <draw:text-box>
+ <xsl:apply-templates select="/uof:UOF/uof:对象集/图:图形[@图:标识符=$tuxing1]/图:文本内容/å­—:段è½"/>
+ <xsl:apply-templates select="/uof:UOF/uof:对象集/图:图形[@图:标识符=$tuxing1]/图:文本内容/字:文字表"/>
+ </draw:text-box>
+ </draw:frame>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="leibie">
+ <xsl:for-each select="/uof:UOF/uof:对象集/图:图形[@图:标识符=$tuxing1]">
+ <xsl:value-of select="图:预定义图形/图:类别"/>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:variable name="leibie2">
+ <xsl:for-each select="/uof:UOF/uof:对象集/图:图形[@图:标识符=$tuxing1]">
+ <xsl:value-of select="图:预定义图形/图:å称"/>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$leibie='22'">
+ <xsl:call-template name="排版框">
+ <xsl:with-param name="biaoshi" select="$tuxing1"/>
+ <xsl:with-param name="name" select="$leibie2"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$leibie='23'">
+ <xsl:call-template name="文本框">
+ <xsl:with-param name="biaoshi" select="$tuxing1"/>
+ <xsl:with-param name="name" select="$leibie2"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$leibie='11'">
+ <xsl:call-template name="Rectangle"/>
+ </xsl:when>
+ <xsl:when test="$leibie='19'">
+ <xsl:call-template name="Oval"/>
+ </xsl:when>
+ <xsl:when test="$leibie='61'">
+ <xsl:call-template name="Line"/>
+ </xsl:when>
+ <xsl:when test="$leibie='62'">
+ <xsl:call-template name="Line"/>
+ </xsl:when>
+ <xsl:when test="$leibie='63'">
+ <xsl:call-template name="Line"/>
+ </xsl:when>
+ <xsl:when test="$leibie='64'">
+ <xsl:call-template name="Curve"/>
+ </xsl:when>
+ <xsl:when test="$leibie='65'">
+ <xsl:call-template name="Freeform"/>
+ </xsl:when>
+ <xsl:when test="$leibie='66'">
+ <xsl:call-template name="Scribble"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="文本框">
+ <xsl:param name="biaoshi"/>
+ <xsl:param name="name"/>
+ <draw:frame text:anchor-type="paragraph">
+ <xsl:attribute name="draw:style-name"><xsl:value-of select="$biaoshi"/></xsl:attribute>
+ <xsl:attribute name="draw:name"><xsl:value-of select="$name"/></xsl:attribute>
+ <xsl:attribute name="svg:width"><xsl:value-of select="concat(字:锚点属性/字:宽度,$uofUnit)"/></xsl:attribute>
+ <xsl:if test="å­—:锚点属性/å­—:ä½ç½®/å­—:æ°´å¹³/å­—:ç»å¯¹">
+ <xsl:attribute name="svg:x"><xsl:value-of select="concat(å­—:锚点属性/å­—:ä½ç½®/å­—:æ°´å¹³/å­—:ç»å¯¹/@å­—:值,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="å­—:锚点属性/å­—:ä½ç½®/å­—:åž‚ç›´/å­—:ç»å¯¹">
+ <xsl:attribute name="svg:y"><xsl:value-of select="concat(å­—:锚点属性/å­—:ä½ç½®/å­—:åž‚ç›´/å­—:ç»å¯¹/@å­—:值,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="draw:z-index">
+ <xsl:for-each select="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $biaoshi]">
+ <xsl:value-of select="@图:层次"/>
+ </xsl:for-each>
+ </xsl:attribute>
+ <draw:text-box>
+ <xsl:apply-templates select="/uof:UOF/uof:对象集/图:图形[@图:标识符=$biaoshi]/图:文本内容/å­—:段è½"/>
+ <xsl:apply-templates select="/uof:UOF/uof:对象集/图:图形[@图:标识符=$biaoshi]/图:文本内容/字:文字表"/>
+ </draw:text-box>
+ </draw:frame>
+ </xsl:template>
+ <xsl:template name="Curve">
+ <xsl:element name="draw:path">
+ <xsl:variable name="tuxing1" select="字:图形/@字:图形引用"/>
+ <xsl:for-each select="/uof:UOF/uof:对象集/图:图形[@图:标识符=$tuxing1]">
+ <xsl:variable name="width" select="number(图:预定义图形/图:属性/图:宽度)*1000"/>
+ <xsl:variable name="height" select="number(图:预定义图形/图:属性/图:高度)*1000"/>
+ <xsl:attribute name="svg:viewBox"><xsl:value-of select="concat('0 0 ',$width, ' ',$height)"/></xsl:attribute>
+ <xsl:attribute name="svg:d"><xsl:value-of select="图:预定义图形/图:关键点åæ ‡/@图:路径"/></xsl:attribute>
+ </xsl:for-each>
+ <xsl:call-template name="common"/>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="common">
+ <xsl:if test="å­—:锚点属性/å­—:ä½ç½®/å­—:æ°´å¹³/å­—:ç»å¯¹">
+ <xsl:attribute name="svg:x"><xsl:value-of select="concat(å­—:锚点属性/å­—:ä½ç½®/å­—:æ°´å¹³/å­—:ç»å¯¹/@å­—:值,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="å­—:锚点属性/å­—:ä½ç½®/å­—:åž‚ç›´/å­—:ç»å¯¹">
+ <xsl:attribute name="svg:y"><xsl:value-of select="concat(å­—:锚点属性/å­—:ä½ç½®/å­—:åž‚ç›´/å­—:ç»å¯¹/@å­—:值,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:variable name="tuxing1" select="字:图形/@字:图形引用"/>
+ <xsl:attribute name="svg:width"><xsl:value-of select="concat(字:锚点属性/字:宽度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:height"><xsl:value-of select="concat(字:锚点属性/字:高度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="text:anchor-type"><xsl:choose><xsl:when test="@字:类型='inline'">as-char</xsl:when><xsl:otherwise>paragraph</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:for-each select="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $tuxing1]">
+ <xsl:attribute name="draw:style-name"><xsl:value-of select="@图:标识符"/></xsl:attribute>
+ <xsl:attribute name="draw:z-index"><xsl:value-of select="@图:层次"/></xsl:attribute>
+ <xsl:if test="图:预定义图形/图:属性/图:旋转角度 and not(图:预定义图形/图:属性/图:旋转角度='0.0')">
+ <xsl:variable name="jiaodu">
+ <xsl:value-of select="图:预定义图形/图:属性/图:旋转角度"/>
+ </xsl:variable>
+ <xsl:variable name="shibie">
+ <xsl:value-of select="图:预定义图形/图:生æˆè½¯ä»¶"/>
+ </xsl:variable>
+ <xsl:variable name="rotate-angle">
+ <xsl:choose>
+ <xsl:when test="图:预定义图形/图:生æˆè½¯ä»¶ and not($shibie='PNG')">
+ <xsl:value-of select="((360 - $jiaodu) * 2 * 3.14159265 ) div 360"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="(图:预定义图形/图:属性/图:旋转角度 * 2 * 3.14159265 ) div 360"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="draw:transform"><xsl:value-of select="concat('rotate (',$rotate-angle,') translate (-0.0194027777777778cm 3.317875cm)')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="图:文本内容">
+ <xsl:apply-templates select="图:文本内容/å­—:段è½"/>
+ <xsl:apply-templates select="图:文本内容/字:文字表"/>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="common1">
+ <xsl:if test="å­—:锚点属性/å­—:ä½ç½®/å­—:æ°´å¹³/å­—:ç»å¯¹">
+ <xsl:attribute name="svg:x"><xsl:value-of select="concat(å­—:锚点属性/å­—:ä½ç½®/å­—:æ°´å¹³/å­—:ç»å¯¹/@å­—:值,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="å­—:锚点属性/å­—:ä½ç½®/å­—:åž‚ç›´/å­—:ç»å¯¹">
+ <xsl:attribute name="svg:y"><xsl:value-of select="concat(å­—:锚点属性/å­—:ä½ç½®/å­—:åž‚ç›´/å­—:ç»å¯¹/@å­—:值,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:variable name="tuxing1" select="字:图形/@字:图形引用"/>
+ <xsl:attribute name="svg:width"><xsl:value-of select="concat(/uof:UOF/uof:对象集/图:图形[@图:标识符=$tuxing1]/图:预定义图形/图:属性/图:宽度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:height"><xsl:value-of select="concat(/uof:UOF/uof:对象集/图:图形[@图:标识符=$tuxing1]/图:预定义图形/图:属性/图:高度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="text:anchor-type"><xsl:choose><xsl:when test="@字:类型='inline'">as-char</xsl:when><xsl:otherwise>paragraph</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:for-each select="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $tuxing1]">
+ <xsl:attribute name="draw:style-name"><xsl:value-of select="@图:标识符"/></xsl:attribute>
+ <xsl:attribute name="draw:z-index"><xsl:value-of select="@图:层次"/></xsl:attribute>
+ <xsl:if test="图:预定义图形/图:属性/图:旋转角度 and not(图:预定义图形/图:属性/图:旋转角度='0.0')">
+ <xsl:variable name="jiaodu">
+ <xsl:value-of select="图:预定义图形/图:属性/图:旋转角度"/>
+ </xsl:variable>
+ <xsl:variable name="shibie">
+ <xsl:value-of select="图:预定义图形/图:生æˆè½¯ä»¶"/>
+ </xsl:variable>
+ <xsl:variable name="rotate-angle">
+ <xsl:choose>
+ <xsl:when test="图:预定义图形/图:生æˆè½¯ä»¶ and not($shibie='PNG')">
+ <xsl:value-of select="((360 - $jiaodu) * 2 * 3.14159265 ) div 360"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="(图:预定义图形/图:属性/图:旋转角度 * 2 * 3.14159265 ) div 360"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="draw:transform"><xsl:value-of select="concat('rotate (',$rotate-angle,') translate (-0.0194027777777778cm 3.317875cm)')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="图:文本内容">
+ <xsl:apply-templates select="图:文本内容/å­—:段è½"/>
+ <xsl:apply-templates select="图:文本内容/字:文字表"/>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="Freeform">
+ <xsl:element name="draw:polygon">
+ <xsl:variable name="tuxing1" select="字:图形/@字:图形引用"/>
+ <xsl:variable name="width" select="number(/uof:UOF/uof:对象集/图:图形[@图:标识符 = $tuxing1]/图:预定义图形/图:属性/图:宽度)*1000"/>
+ <xsl:variable name="height" select="number(/uof:UOF/uof:对象集/图:图形[@图:标识符 = $tuxing1]/图:预定义图形/图:属性/图:高度)*1000"/>
+ <xsl:attribute name="svg:viewBox"><xsl:value-of select="concat('0 0 ',$width, ' ',$height)"/></xsl:attribute>
+ <xsl:attribute name="draw:points"><xsl:for-each select="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $tuxing1]/图:预定义图形/图:关键点åæ ‡"><xsl:call-template name="drawpoints"><xsl:with-param name="points" select="concat(number(图:åæ ‡[1]/@xåæ ‡)*1000,',',number(图:åæ ‡[1]/@yåæ ‡)*1000)"/><xsl:with-param name="point-pos" select="2"/></xsl:call-template></xsl:for-each></xsl:attribute>
+ <xsl:call-template name="common"/>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="drawpoints">
+ <xsl:param name="points"/>
+ <xsl:param name="point-pos"/>
+ <xsl:choose>
+ <xsl:when test="图:åæ ‡[$point-pos]">
+ <xsl:variable name="points1" select="concat($points,' ',number(图:åæ ‡[$point-pos]/@xåæ ‡)*1000,',',number(图:åæ ‡[$point-pos]/@yåæ ‡)*1000)"/>
+ <xsl:call-template name="drawpoints">
+ <xsl:with-param name="points" select="$points1"/>
+ <xsl:with-param name="point-pos" select="$point-pos+1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$points"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="Scribble">
+ <xsl:element name="draw:polyline">
+ <xsl:variable name="tuxing1" select="字:图形/@字:图形引用"/>
+ <xsl:variable name="width" select="number(/uof:UOF/uof:对象集/图:图形[@图:标识符 = $tuxing1]/图:预定义图形/图:属性/图:宽度)*1000"/>
+ <xsl:variable name="height" select="number(/uof:UOF/uof:对象集/图:图形[@图:标识符 = $tuxing1]/图:预定义图形/图:属性/图:高度)*1000"/>
+ <xsl:attribute name="svg:viewBox"><xsl:value-of select="concat('0 0 ',$width, ' ',$height)"/></xsl:attribute>
+ <xsl:attribute name="draw:points"><xsl:for-each select="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $tuxing1]/图:预定义图形/图:关键点åæ ‡"><xsl:call-template name="drawpoints"><xsl:with-param name="points" select="concat(number(图:åæ ‡[1]/@xåæ ‡)*1000,',',number(图:åæ ‡[1]/@yåæ ‡)*1000)"/><xsl:with-param name="point-pos" select="2"/></xsl:call-template></xsl:for-each></xsl:attribute>
+ <xsl:call-template name="common"/>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="Oval">
+ <xsl:element name="draw:ellipse">
+ <xsl:call-template name="common1"/>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="排版框">
+ <xsl:param name="biaoshi"/>
+ <xsl:param name="name"/>
+ <draw:frame text:anchor-type="paragraph">
+ <xsl:attribute name="draw:style-name"><xsl:value-of select="$biaoshi"/></xsl:attribute>
+ <xsl:attribute name="draw:name"><xsl:value-of select="$name"/></xsl:attribute>
+ <xsl:attribute name="svg:width"><xsl:value-of select="concat(字:锚点属性/字:宽度,$uofUnit)"/></xsl:attribute>
+ <xsl:if test="å­—:锚点属性/å­—:ä½ç½®/å­—:æ°´å¹³/å­—:ç»å¯¹">
+ <xsl:attribute name="svg:x"><xsl:value-of select="concat(å­—:锚点属性/å­—:ä½ç½®/å­—:æ°´å¹³/å­—:ç»å¯¹/@å­—:值,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="å­—:锚点属性/å­—:ä½ç½®/å­—:åž‚ç›´/å­—:ç»å¯¹">
+ <xsl:attribute name="svg:y"><xsl:value-of select="concat(å­—:锚点属性/å­—:ä½ç½®/å­—:åž‚ç›´/å­—:ç»å¯¹/@å­—:值,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="draw:z-index">
+ <xsl:for-each select="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $biaoshi]">
+ <xsl:value-of select="@图:层次"/>
+ </xsl:for-each>
+ </xsl:attribute>
+ <draw:text-box>
+ <xsl:attribute name="fo:min-height"><xsl:value-of select="concat(字:锚点属性/字:高度,$uofUnit)"/></xsl:attribute>
+ <xsl:apply-templates select="/uof:UOF/uof:对象集/图:图形[@图:标识符=$biaoshi]/图:文本内容/å­—:段è½"/>
+ <xsl:apply-templates select="/uof:UOF/uof:对象集/图:图形[@图:标识符=$biaoshi]/图:文本内容/字:文字表"/>
+ </draw:text-box>
+ </draw:frame>
+ </xsl:template>
+ <xsl:template name="Rectangle">
+ <xsl:element name="draw:rect">
+ <xsl:call-template name="common1"/>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="Line">
+ <xsl:element name="draw:line">
+ <xsl:variable name="tuxing1" select="字:图形/@字:图形引用"/>
+ <xsl:attribute name="svg:x1"><xsl:value-of select="concat(å­—:锚点属性/å­—:ä½ç½®/å­—:æ°´å¹³/å­—:ç»å¯¹/@å­—:值,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:y1"><xsl:value-of select="concat(å­—:锚点属性/å­—:ä½ç½®/å­—:åž‚ç›´/å­—:ç»å¯¹/@å­—:值,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:x2"><xsl:value-of select="concat((å­—:锚点属性/å­—:ä½ç½®/å­—:æ°´å¹³/å­—:ç»å¯¹/@å­—:值 + å­—:锚点属性/å­—:宽度),$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:y2"><xsl:value-of select="concat((å­—:锚点属性/å­—:ä½ç½®/å­—:åž‚ç›´/å­—:ç»å¯¹/@å­—:值 + å­—:锚点属性/å­—:高度),$uofUnit)"/></xsl:attribute>
+ <xsl:for-each select="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $tuxing1]">
+ <xsl:attribute name="text:anchor-type">paragraph</xsl:attribute>
+ <xsl:attribute name="draw:style-name"><xsl:value-of select="@图:标识符"/></xsl:attribute>
+ <xsl:attribute name="draw:z-index"><xsl:value-of select="@图:层次"/></xsl:attribute>
+ <xsl:if test="图:预定义图形/图:属性/图:旋转角度 and not(图:预定义图形/图:属性/图:旋转角度='0.0')">
+ <xsl:variable name="jiaodu">
+ <xsl:value-of select="图:预定义图形/图:属性/图:旋转角度"/>
+ </xsl:variable>
+ <xsl:variable name="shibie">
+ <xsl:value-of select="图:预定义图形/图:生æˆè½¯ä»¶"/>
+ </xsl:variable>
+ <xsl:variable name="rotate-angle">
+ <xsl:choose>
+ <xsl:when test="图:预定义图形/图:生æˆè½¯ä»¶ and not($shibie='PNG')">
+ <xsl:value-of select="((360 - $jiaodu) * 2 * 3.14159265 ) div 360"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="(图:预定义图形/图:属性/图:旋转角度 * 2 * 3.14159265 ) div 360"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="draw:transform"><xsl:value-of select="concat('rotate (',$rotate-angle,') translate (-0.0194027777777778cm 3.317875cm)')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="图:文本内容">
+ <xsl:apply-templates select="图:文本内容/å­—:段è½"/>
+ <xsl:apply-templates select="图:文本内容/字:文字表"/>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="processPageBreaks">
+ <xsl:variable name="pageBreak" select="å­—:å¥/å­—:分页符"/>
+ <xsl:call-template name="createSubParagraph">
+ <xsl:with-param name="list" select="$pageBreak[1]/preceding-sibling::å­—:å¥"/>
+ <xsl:with-param name="pageBreak"/>
+ <xsl:with-param name="needsPageBreak">false</xsl:with-param>
+ </xsl:call-template>
+ <xsl:for-each select="$pageBreak">
+ <xsl:call-template name="createSubParagraph">
+ <xsl:with-param name="list" select="./following-sibling::å­—:å¥[preceding::å­—:å¥/å­—:分页符 = '.']"/>
+ <xsl:with-param name="pageBreak" select="."/>
+ <xsl:with-param name="needsPageBreak">true</xsl:with-param>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="createSubParagraph">
+ <xsl:param name="list"/>
+ <xsl:param name="pageBreak"/>
+ <xsl:param name="needsPageBreak"/>
+ <xsl:if test="(count($list) &gt; 0) or ($needsPageBreak ='true') ">
+ <xsl:element name="text:p">
+ <xsl:choose>
+ <xsl:when test="$needsPageBreak = 'true'">
+ <xsl:choose>
+ <xsl:when test="ancestor::å­—:段è½/å­—:段è½å±žæ€§">
+ <xsl:attribute name="text:style-name">P<xsl:number from="/uof:UOF/uof:文字处ç†/å­—:主体" level="any" count="å­—:段è½å±žæ€§"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="text:style-name">PageBreak</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="$pageBreak">
+ <xsl:apply-templates select="$pageBreak"/>
+ </xsl:if>
+ <xsl:apply-templates select="$list"/>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="å­—:å¥/å­—:区域开始[@å­—:类型='bookmark']">
+ <xsl:variable name="biaoshi">
+ <xsl:value-of select="@字:标识符"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="not(@å­—:å称)">
+ <text:bookmark-start text:name="{/uof:UOF/uof:书签集/uof:书签[uof:文本ä½ç½®/@å­—:区域引用=$biaoshi]/@uof:å称}"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <text:bookmark-start text:name="{@å­—:å称}"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="å­—:å¥/å­—:区域结æŸ[preceding::å­—:区域开始[1]/@å­—:类型='bookmark']">
+ <xsl:variable name="biaoshi">
+ <xsl:value-of select="@字:标识符引用"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="not(@å­—:å称)">
+ <text:bookmark-end text:name="{/uof:UOF/uof:书签集/uof:书签[uof:文本ä½ç½®/@å­—:区域引用=$biaoshi]/@uof:å称}"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <text:bookmark-end text:name="{@å­—:å称}"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="字:区域开始[@字:类型='annotation']">
+ <text:bookmark-start text:name="{@字:标识符}"/>
+ </xsl:template>
+ <xsl:template match="å­—:区域结æŸ[preceding::å­—:区域开始[1]/@å­—:类型='annotation']">
+ <text:bookmark-end text:name="{@字:标识符引用}"/>
+ </xsl:template>
+ <xsl:template match="字:区域开始[@字:类型='user-data']">
+ <text:alphabetical-index-mark-start text:id="{@å­—:标识符}" text:string-value-phonetic="{@å­—:å称}"/>
+ </xsl:template>
+ <xsl:template match="å­—:区域结æŸ[preceding::å­—:区域开始[1]/@å­—:类型='user-data']">
+ <text:alphabetical-index-mark-end text:id="{@字:标识符引用}"/>
+ </xsl:template>
+ <xsl:template match="å­—:段è½/å­—:域开始">
+ <xsl:choose>
+ <xsl:when test="@字:类型='createdate'">
+ <xsl:variable name="datestr" select="../å­—:å¥[preceding-sibling::å­—:域代ç ]/å­—:文本串"/>
+ <xsl:element name="text:creation-date">
+ <xsl:attribute name="style:data-style-name">CreateDate<xsl:number from="/uof:UOF/uof:文字处ç†/å­—:主体" level="any" count="å­—:段è½/å­—:域开始[@å­—:类型 = 'createdate']"/></xsl:attribute>
+ <xsl:attribute name="text:date-value"><xsl:value-of select="$datestr"/></xsl:attribute>
+ <xsl:value-of select="$datestr"/>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="@字:类型='savedate'">
+ <xsl:variable name="datestr" select="../å­—:å¥[preceding-sibling::å­—:域代ç ]/å­—:文本串"/>
+ <xsl:element name="text:date">
+ <xsl:attribute name="style:data-style-name">SaveDate<xsl:number from="/uof:UOF/uof:文字处ç†/å­—:主体" level="any" count="å­—:段è½/å­—:域开始[@å­—:类型 = 'savedate']"/></xsl:attribute>
+ <xsl:attribute name="text:date-value"><xsl:value-of select="$datestr"/></xsl:attribute>
+ <xsl:attribute name="text:fixed">true</xsl:attribute>
+ <xsl:value-of select="$datestr"/>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="@字:类型='date'">
+ <xsl:variable name="datestr" select="../å­—:å¥[preceding-sibling::å­—:域代ç ]/å­—:文本串"/>
+ <xsl:element name="text:date">
+ <xsl:attribute name="style:data-style-name">Date<xsl:number from="/uof:UOF/uof:文字处ç†/å­—:主体" level="any" count="å­—:段è½/å­—:域开始[@å­—:类型 = 'date']"/></xsl:attribute>
+ <xsl:attribute name="text:date-value"><xsl:value-of select="$datestr"/></xsl:attribute>
+ <xsl:value-of select="$datestr"/>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="@字:类型='time'">
+ <xsl:variable name="datestr" select="../å­—:å¥[preceding-sibling::å­—:域代ç ]/å­—:文本串"/>
+ <xsl:element name="text:time">
+ <xsl:attribute name="style:data-style-name">Time<xsl:number from="/uof:UOF/uof:文字处ç†/å­—:主体" level="any" count="å­—:段è½/å­—:域开始[@å­—:类型 = 'time']"/></xsl:attribute>
+ <xsl:attribute name="text:time-value"><xsl:value-of select="$datestr"/></xsl:attribute>
+ <xsl:value-of select="$datestr"/>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="@字:类型='edittime'">
+ <xsl:variable name="datestr" select="../å­—:å¥[preceding-sibling::å­—:域代ç ]/å­—:文本串"/>
+ <xsl:element name="text:editing-duration">
+ <xsl:attribute name="style:data-style-name">EditTime<xsl:number from="/uof:UOF/uof:文字处ç†/å­—:主体" level="any" count="å­—:段è½/å­—:域开始[@å­—:类型 = 'edittime']"/></xsl:attribute>
+ <xsl:value-of select="$datestr"/>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="@字:类型='createtime'">
+ <xsl:variable name="datestr" select="../å­—:å¥[preceding-sibling::å­—:域代ç ]/å­—:文本串"/>
+ <xsl:element name="text:creation-time">
+ <xsl:attribute name="style:data-style-name">CREATETIME<xsl:number from="/uof:UOF/uof:文字处ç†/å­—:主体" level="any" count="å­—:段è½/å­—:域开始[@å­—:类型 = 'createtime']"/></xsl:attribute>
+ <xsl:value-of select="$datestr"/>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="@字:类型='page'">
+ <xsl:call-template name="页ç åŸŸ"/>
+ </xsl:when>
+ <xsl:when test="@字:类型='numpages'">
+ <xsl:call-template name="页数域"/>
+ </xsl:when>
+ <xsl:when test="@字:类型='author'">
+ <xsl:call-template name="作者域"/>
+ </xsl:when>
+ <xsl:when test="@字:类型='username'">
+ <xsl:call-template name="用户域"/>
+ </xsl:when>
+ <xsl:when test="@字:类型='userinitials'">
+ <xsl:call-template name="缩写域"/>
+ </xsl:when>
+ <xsl:when test="@字:类型='title'">
+ <xsl:call-template name="标题域"/>
+ </xsl:when>
+ <xsl:when test="@字:类型='subject'">
+ <xsl:call-template name="主题域"/>
+ </xsl:when>
+ <xsl:when test="@字:类型='numchars'">
+ <xsl:call-template name="字符数"/>
+ </xsl:when>
+ <xsl:when test="@字:类型='filename'">
+ <xsl:call-template name="文件å"/>
+ </xsl:when>
+ <xsl:when test="@字:类型='edittime'">
+ <xsl:call-template name="编辑时间"/>
+ </xsl:when>
+ <xsl:when test="@字:类型='creation-time'">
+ <xsl:call-template name="创建时间"/>
+ </xsl:when>
+ <xsl:when test="@字:类型='seq'">
+ <xsl:call-template name="题注"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="commonParagraph">
+ <xsl:choose>
+ <xsl:when test="å­—:段è½å±žæ€§/å­—:大纲级别">
+ <xsl:element name="text:h">
+ <xsl:call-template name="commonParagraphAttributes"/>
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="not (字:域开始/@字:类型='ref') and not(字:域开始/@字:类型='index')">
+ <xsl:element name="text:p">
+ <xsl:call-template name="commonParagraphAttributes"/>
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="commonParagraphAttributes">
+ <xsl:choose>
+ <xsl:when test="å­—:段è½å±žæ€§">
+ <xsl:variable name="pp">
+ <xsl:number from="/uof:UOF/uof:文字处ç†/å­—:主体" level="any" count="å­—:段è½[å­—:段è½å±žæ€§]"/>
+ </xsl:variable>
+ <xsl:variable name="aa">
+ <xsl:number from="/uof:UOF/uof:文字处ç†/å­—:主体" level="any" count="å­—:段è½[å­—:域结æŸ]"/>
+ </xsl:variable>
+ <xsl:variable name="stylename" select="å­—:段è½å±žæ€§/@å­—:å¼æ ·å¼•ç”¨"/>
+ <xsl:choose>
+ <xsl:when test="preceding-sibling::å­—:段è½/å­—:域结æŸ">
+ <xsl:attribute name="text:style-name"><xsl:value-of select="concat('P',$pp+$aa)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="contains($stylename,'Heading')">
+ <xsl:attribute name="text:style-name"><xsl:value-of select="$stylename"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="text:style-name"><xsl:value-of select="concat('P',$pp)"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="å­—:段è½å±žæ€§/å­—:大纲级别">
+ <xsl:attribute name="text:outline-level"><xsl:value-of select="å­—:段è½å±žæ€§/å­—:大纲级别"/></xsl:attribute>
+ </xsl:if>
+ </xsl:when>
+ <xsl:when test="generate-id(ancestor::å­—:主体/descendant::å­—:段è½[1]) = generate-id(.)">
+ <xsl:variable name="paragraph-number">
+ <xsl:number from="/uof:UOF/uof:文字处ç†/å­—:主体" level="any" count="å­—:段è½[å­—:段è½å±žæ€§]"/>
+ </xsl:variable>
+ <xsl:attribute name="text:style-name">P<xsl:value-of select="number($paragraph-number)"/>_1</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="not(å­—:段è½å±žæ€§) and (descendant::å­—:分æ ç¬¦ or ancestor::å­—:分节/descendant::å­—:节属性[å­—:分æ /@å­—:æ æ•° &gt; 1])">
+ <xsl:attribute name="text:style-name">ColumnBreakPara</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="å­—:å¥">
+ <xsl:apply-templates select="字:文本串"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="å­—:段è½å±žæ€§"/>
+ <xsl:template match="å­—:å¥/å­—:å¥å±žæ€§"/>
+ <xsl:template match="å­—:å¥å±žæ€§" mode="style">
+ <xsl:if test="not(@å­—:å¼æ ·å¼•ç”¨)">
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name">T<xsl:number from="/uof:UOF/uof:文字处ç†/å­—:主体" level="any" count="å­—:å¥å±žæ€§" format="1"/></xsl:attribute>
+ <xsl:attribute name="style:family">text</xsl:attribute>
+ <xsl:if test="@å­—:å¼æ ·å¼•ç”¨">
+ <xsl:attribute name="style:parent-style-name"><xsl:value-of select="@å­—:å¼æ ·å¼•ç”¨"/></xsl:attribute>
+ </xsl:if>
+ <xsl:element name="style:text-properties">
+ <xsl:apply-templates select="./*"/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="å­—:å¥/å­—:文本串">
+ <xsl:choose>
+ <xsl:when test="string(.) = ' ' ">
+ <xsl:element name="text:s"/>
+ </xsl:when>
+ <xsl:when test="contains(.,' ')">
+ <xsl:call-template name="replace-spaces">
+ <xsl:with-param name="curr-string" select="."/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="replace-spaces">
+ <xsl:param name="curr-string"/>
+ <xsl:if test="contains($curr-string,' ')">
+ <xsl:value-of select="substring-before($curr-string,' ')"/>
+ <text:s text:c="2"/>
+ <xsl:variable name="next-string" select="substring-after($curr-string,' ')"/>
+ <xsl:choose>
+ <xsl:when test="contains($next-string, ' ')">
+ <xsl:call-template name="replace-spaces">
+ <xsl:with-param name="curr-string" select="$next-string"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$next-string"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="å­—:空格符[parent::å­—:å¥]">
+ <xsl:element name="text:s">
+ <xsl:attribute name="text:c"><xsl:value-of select="@字:个数"/></xsl:attribute>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="å­—:制表符[parent::å­—:å¥]">
+ <xsl:element name="text:tab"/>
+ </xsl:template>
+ <xsl:template match="å­—:å¥">
+ <xsl:if test="name(following-sibling::*[1])!='å­—:域结æŸ'">
+ <xsl:if test="å­—:æ¢è¡Œç¬¦">
+ <xsl:element name="text:line-break"/>
+ </xsl:if>
+ <xsl:variable name="currently-node" select="./字:锚点"/>
+ <xsl:choose>
+ <xsl:when test="å­—:å¥å±žæ€§//å­—:éšè—文字/@å­—:值='true'">
+ <text:hidden-text text:is-hidden="true" text:string-value="{.}"/>
+ </xsl:when>
+ <xsl:when test="字:区域开始[@字:类型='hyperlink']">
+ <xsl:element name="text:a">
+ <xsl:attribute name="xlink:type">simple</xsl:attribute>
+ <xsl:variable name="hyperDest" select="字:区域开始/@字:标识符"/>
+ <xsl:attribute name="xlink:href"><xsl:for-each select="/uof:UOF/uof:链接集/uof:超级链接"><xsl:if test="@uof:链æº=$hyperDest"><xsl:if test="@uof:æ示"><xsl:attribute name="office:name"><xsl:value-of select="@uof:æ示"/></xsl:attribute></xsl:if><xsl:if test="@uof:目标"><xsl:variable name="bsh" select="@uof:目标"/><xsl:choose><xsl:when test="contains($bsh,'\')"><xsl:value-of select="concat('/',translate($bsh,'\','/'))"/></xsl:when><xsl:otherwise><xsl:value-of select="$bsh"/></xsl:otherwise></xsl:choose></xsl:if><xsl:if test="@uof:书签"><xsl:variable name="bookmarkDest" select="@uof:书签"/><xsl:choose><xsl:when test="/uof:UOF/uof:书签集/uof:书签"><xsl:for-each select="/uof:UOF/uof:书签集/uof:书签"><xsl:if test="@uof:å称=$bookmarkDest"><xsl:value-of select="concat('#',@uof:å称)"/></xsl:if></xsl:for-each></xsl:when><xsl:otherwise><xsl:value-of select="concat('#',$bookmarkDest)"/></xsl:otherwise></xsl:choose></xsl:if></xsl:if></xsl:for-each></xsl:attribute>
+ <xsl:for-each select="/uof:UOF/uof:链接集/uof:超级链接">
+ <xsl:if test="@uof:链æº=$hyperDest">
+ <xsl:if test="@uof:æ示">
+ <xsl:attribute name="office:name"><xsl:value-of select="@uof:æ示"/></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:choose>
+ <xsl:when test="./字:文本串">
+ <xsl:apply-templates select="字:文本串"/>
+ </xsl:when>
+ <xsl:when test="following-sibling::å­—:å¥/å­—:文本串">
+ <xsl:value-of select="following-sibling::å­—:å¥/å­—:文本串"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="å­—:åŒºåŸŸç»“æŸ and preceding::å­—:区域开始[1]/@å­—:类型='bookmark' and not(self::node()/å­—:区域开始)">
+ <xsl:variable name="aa">
+ <xsl:value-of select="å­—:区域结æŸ/@å­—:标识符引用"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="preceding::å­—:区域开始[1]/@å­—:类型='bookmark' and not(preceding::å­—:区域开始[1]/@å­—:å称)">
+ <text:bookmark-end text:name="{/uof:UOF/uof:书签集/uof:书签[uof:文本ä½ç½®/@å­—:区域引用=$aa]/@uof:å称}"/>
+ </xsl:when>
+ <xsl:when test="preceding::字:区域开始[1]/@字:类型='bookmark'">
+ <text:bookmark-end text:name="{preceding::å­—:区域开始[1]/@å­—:å称}"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="preceding-sibling::å­—:å¥[position()=1]/å­—:区域开始[@å­—:类型='hyperlink'] and not(preceding-sibling::å­—:å¥[position()=1]/å­—:区域结æŸ)"/>
+ <xsl:when test="(preceding-sibling::å­—:å¥) or (å­—:å¥å±žæ€§)or(å­—:区域开始)">
+ <xsl:element name="text:span">
+ <xsl:choose>
+ <xsl:when test="字:区域开始[@字:类型='annotation']">
+ <xsl:variable name="ref_comment">
+ <xsl:value-of select="字:区域开始/@字:标识符"/>
+ </xsl:variable>
+ <xsl:apply-templates/>
+ <xsl:apply-templates select="/uof:UOF/uof:文字处ç†/å­—:公用处ç†è§„则/å­—:批注集/å­—:批注[@å­—:区域引用 = $ref_comment]"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="stylenum">
+ <xsl:number from="/uof:UOF/uof:文字处ç†/å­—:主体" level="any" count="å­—:å¥" format="1"/>
+ </xsl:variable>
+ <xsl:attribute name="text:style-name"><xsl:value-of select="concat('T',$stylenum)"/></xsl:attribute>
+ <xsl:apply-templates select="*[not(name()='å­—:引文符å·')]"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="å­—:文本串|å­—:锚点|å­—:空格符|å­—:æ¢è¡Œç¬¦|å­—:制表符|å­—:区域开始|å­—:区域结æŸ|å­—:脚注|å­—:尾注"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="node()[name() = 'å­—:ä½ç½®']">
+ <xsl:attribute name="style:text-position"><xsl:variable name="val"><xsl:value-of select="."/></xsl:variable><xsl:choose><xsl:when test="$val='sub' or $val='super'"><xsl:value-of select="concat($val,' 58%')"/></xsl:when><xsl:when test="contains($val,'sub ') or contains($val,'super ')"><xsl:value-of select="concat($val,'%')"/></xsl:when><xsl:when test="not(contains($val,' '))"><xsl:value-of select="concat($val,'% 100%')"/></xsl:when><xsl:otherwise><xsl:value-of select="concat(substring-before($val,' '),'% ',substring-after($val,' '),'%' )"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:template>
+ <xsl:template match="字:批注">
+ <office:annotation office:display="true">
+ <xsl:variable name="name" select="@字:作者"/>
+ <dc:creator>
+ <xsl:value-of select="/uof:UOF/uof:文字处ç†/å­—:公用处ç†è§„则/å­—:用户集/å­—:用户[@å­—:标识符=$name]/@å­—:姓å"/>
+ </dc:creator>
+ <dc:date>
+ <xsl:value-of select="@字:日期"/>
+ </dc:date>
+ <xsl:apply-templates select="å­—:段è½"/>
+ </office:annotation>
+ </xsl:template>
+ <xsl:template match="字:字体">
+ <xsl:if test="@å­—:å­—å·">
+ <xsl:attribute name="fo:font-size"><xsl:value-of select="@å­—:å­—å·"/>pt</xsl:attribute>
+ <xsl:attribute name="style:font-size-asian"><xsl:value-of select="@å­—:å­—å·"/>pt</xsl:attribute>
+ <xsl:attribute name="style:font-size-complex"><xsl:value-of select="@å­—:å­—å·"/>pt</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@å­—:ç›¸å¯¹å­—å· and self::node( )[not(parent::å­—:å¥å±žæ€§)]">
+ <xsl:variable name="stylename" select="parent::node()/@å­—:基å¼æ ·å¼•ç”¨"/>
+ <xsl:variable name="zihao">
+ <xsl:for-each select="/uof:UOF/uof:å¼æ ·é›†//uof:段è½å¼æ ·[@å­—:标识符=$stylename]">
+ <xsl:value-of select="å­—:字体/@å­—:å­—å·"/>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:variable name="font-size" select="@å­—:相对字å·"/>
+ <xsl:attribute name="fo:font-size"><xsl:value-of select="($zihao * $font-size div 100)"/>pt</xsl:attribute>
+ <xsl:attribute name="style:font-size-asian"><xsl:value-of select="($zihao * $font-size div 100)"/>pt</xsl:attribute>
+ <xsl:attribute name="style:font-size-complex"><xsl:value-of select="($zihao * $font-size div 100)"/>pt</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@字:颜色">
+ <xsl:attribute name="fo:color"><xsl:value-of select="@字:颜色"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@字:中文字体引用">
+ <xsl:attribute name="style:font-name-asian"><xsl:value-of select="@字:中文字体引用"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@字:西文字体引用">
+ <xsl:variable name="xiwen" select="@字:西文字体引用"/>
+ <xsl:attribute name="style:font-name"><xsl:value-of select="translate($xiwen,'_',' ')"/></xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="字:斜体">
+ <xsl:if test="@字:值='true'">
+ <xsl:attribute name="fo:font-style">italic</xsl:attribute>
+ <xsl:attribute name="fo:font-style-asian">italic</xsl:attribute>
+ <xsl:attribute name="style:font-style-asian">italic</xsl:attribute>
+ <xsl:attribute name="style:font-style-complex">italic</xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="字:粗体">
+ <xsl:if test="@字:值='true'or @字:值='1'">
+ <xsl:attribute name="fo:font-weight">bold</xsl:attribute>
+ <xsl:attribute name="style:font-weight-asian">bold</xsl:attribute>
+ <xsl:attribute name="style:font-weight-complex">bold</xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="字:下划线">
+ <xsl:choose>
+ <xsl:when test="@字:类型 = 'single'">
+ <xsl:attribute name="style:text-underline-style">solid</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">auto</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'double'">
+ <xsl:attribute name="style:text-underline-style">solid</xsl:attribute>
+ <xsl:attribute name="style:text-underline-type">double</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">auto</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'thick'">
+ <xsl:attribute name="style:text-underline-style">solid</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">bold</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'dotted'">
+ <xsl:attribute name="style:text-underline-style">dotted</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">auto</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'dotted-heavy'">
+ <xsl:attribute name="style:text-underline-style">dotted</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">bold</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'dash'">
+ <xsl:attribute name="style:text-underline-style">dash</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">auto</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'dashed-heavy'">
+ <xsl:attribute name="style:text-underline-style">dash</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">bold</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'dash-long'">
+ <xsl:attribute name="style:text-underline-style">long-dash</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">auto</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'dash-long-heavy'">
+ <xsl:attribute name="style:text-underline-style">long-dash</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">bold</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'dot-dash'">
+ <xsl:attribute name="style:text-underline-style">dot-dash</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">auto</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'dash-dot-heavy'">
+ <xsl:attribute name="style:text-underline-style">dot-dash</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">bold</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'dot-dot-dash'">
+ <xsl:attribute name="style:text-underline-style">dot-dot-dash</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">auto</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'dash-dot-dot-heavy'">
+ <xsl:attribute name="style:text-underline-style">dot-dot-dash</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">bold</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'wave'">
+ <xsl:attribute name="style:text-underline-style">wave</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">auto</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'wavy-heavy'">
+ <xsl:attribute name="style:text-underline-style">wave</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">bold</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'wavy-double'">
+ <xsl:attribute name="style:text-underline-style">wave</xsl:attribute>
+ <xsl:attribute name="style:text-underline-type">double</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">auto</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="@字:颜色">
+ <xsl:attribute name="style:text-underline-color"><xsl:choose><xsl:when test="@字:颜色='auto'">font-color</xsl:when><xsl:otherwise><xsl:value-of select="@字:颜色"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:text-underline-color">font-color</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="å­—:ç€é‡å·">
+ <xsl:if test="not(@字:类型='none')">
+ <xsl:choose>
+ <xsl:when test="@字:类型='dot'">
+ <xsl:attribute name="style:text-emphasize">dot below</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型='accent above' ">
+ <xsl:attribute name="style:text-emphasize">accent above</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型='dot above' ">
+ <xsl:attribute name="style:text-emphasize">dot above</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型='disc above' ">
+ <xsl:attribute name="style:text-emphasize">disc above</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型='circle above' ">
+ <xsl:attribute name="style:text-emphasize">circle above</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型='accent below' ">
+ <xsl:attribute name="style:text-emphasize">accent below</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型='dot below' ">
+ <xsl:attribute name="style:text-emphasize">dot below</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型='disc below' ">
+ <xsl:attribute name="style:text-emphasize">disc below</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型='circle below' ">
+ <xsl:attribute name="style:text-emphasize">circle below</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>none</xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="字:颜色">
+ <xsl:attribute name="fo:color"><xsl:value-of select="@字:颜色"/></xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="å­—:éšè—文字">
+ <xsl:attribute name="text:display"><xsl:value-of select="@字:值"/></xsl:attribute>
+ </xsl:template>
+ <xsl:template match="字:空心">
+ <xsl:attribute name="style:text-outline"><xsl:value-of select="@字:值"/></xsl:attribute>
+ </xsl:template>
+ <xsl:template match="字:阴影">
+ <xsl:if test="not(@字:值='false')">
+ <xsl:attribute name="fo:text-shadow">1pt 1pt</xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="字:闪动的">
+ <xsl:attribute name="style:text-blinking"><xsl:value-of select="@字:闪动的"/></xsl:attribute>
+ </xsl:template>
+ <xsl:template match="字:删除线">
+ <xsl:choose>
+ <xsl:when test="@字:类型 = 'single' ">
+ <xsl:attribute name="style:text-line-through-style">solid</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'double' ">
+ <xsl:attribute name="style:text-line-through-type">double</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'bold' ">
+ <xsl:attribute name="style:text-line-through-width">bold</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'xl' ">
+ <xsl:attribute name="style:text-line-through-text">X</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = '/l' ">
+ <xsl:attribute name="style:text-line-through-text">/</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:text-crossing-out">none</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="å­—:çªå‡ºæ˜¾ç¤º">
+ <xsl:attribute name="fo:background-color">
+ <xsl:choose>
+ <xsl:when test="@字:颜色='auto'">transparent</xsl:when>
+ <xsl:otherwise><xsl:value-of select="@字:颜色"/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:template>
+ <xsl:template match="@字:颜色[not(.='auto')]">
+ <xsl:attribute name="fo:color">#<xsl:value-of select="."/></xsl:attribute>
+ </xsl:template>
+ <xsl:template match="字:浮雕">
+ <xsl:attribute name="style:font-relief"><xsl:choose><xsl:when test="@字:类型='engrave'">engraved</xsl:when><xsl:when test="@字:类型='emboss'">embossed</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:template>
+ <xsl:template match="字:醒目字体">
+ <xsl:choose>
+ <xsl:when test="@字:类型='small-caps'">
+ <xsl:attribute name="fo:font-variant">small-caps</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型='none'">
+ <xsl:attribute name="fo:font-variant">normal</xsl:attribute>
+ <xsl:attribute name="fo:text-transform">none</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:text-transform"><xsl:choose><xsl:when test="@字:类型='uppercase'">uppercase</xsl:when><xsl:when test="@字:类型='lowercase'">lowercase</xsl:when><xsl:when test="@字:类型='capital'">capitalize</xsl:when></xsl:choose></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="å­—:ä½ç½®" mode="oo">
+ <xsl:attribute name="style:text-position"><xsl:variable name="val"><xsl:value-of select="."/></xsl:variable><xsl:choose><xsl:when test="$val='sub' or $val='super'"><xsl:value-of select="concat($val,' 58%')"/></xsl:when><xsl:when test="contains($val,'sub ') or contains($val,'super ')"><xsl:value-of select="concat($val,'%')"/></xsl:when><xsl:when test="not(contains($val,' '))"><xsl:value-of select="concat($val,'% 100%')"/></xsl:when><xsl:otherwise><xsl:value-of select="concat(substring-before($val,' '),'% ',substring-after($val,' '),'%' )"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:template>
+ <xsl:template match="字:缩放">
+ <xsl:attribute name="style:text-scale"><xsl:value-of select="."/>%</xsl:attribute>
+ </xsl:template>
+ <xsl:template match="å­—:字符间è·">
+ <xsl:attribute name="fo:letter-spacing"><xsl:value-of select="."/>cm</xsl:attribute>
+ </xsl:template>
+ <xsl:template match="å­—:调整字间è·">
+ <xsl:variable name="tt" select="å­—:调整字间è·"/>
+ <xsl:attribute name="style:letter-kerning"><xsl:choose><xsl:when test="$tt='1'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:template>
+ <xsl:template match="字:外框">
+ <xsl:attribute name="style:text-outline">true</xsl:attribute>
+ </xsl:template>
+ <xsl:template match="å­—:字符间è·[parent::å­—:å¥å±žæ€§]">
+ <xsl:variable name="aa">
+ <xsl:value-of select="."/>
+ </xsl:variable>
+ <xsl:attribute name="fo:letter-spacing"><xsl:value-of select="concat( $aa, $uofUnit)"/></xsl:attribute>
+ </xsl:template>
+ <xsl:template match="字:分节">
+ <xsl:if test="字:节属性/字:脚注设置">
+ <xsl:call-template name="脚注设置"/>
+ </xsl:if>
+ <xsl:if test="字:节属性/字:尾注设置">
+ <xsl:call-template name="尾注设置"/>
+ </xsl:if>
+ <xsl:if test="å­—:节属性/å­—:è¡Œå·è®¾ç½®">
+ <xsl:call-template name="行编å·"/>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="行编å·">
+ <xsl:element name="text:linenumbering-configuration">
+ <xsl:for-each select="/uof:UOF/uof:文字处ç†/å­—:主体/å­—:分节/å­—:节属性/å­—:è¡Œå·è®¾ç½®">
+ <xsl:choose>
+ <xsl:when test="@å­—:使用行å·='false'">
+ <xsl:attribute name="text:number-lines">false</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="text:style-name">Line numbering</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="@å­—:ç¼–å·æ–¹å¼">
+ <xsl:choose>
+ <xsl:when test="@å­—:ç¼–å·æ–¹å¼='section'">
+ <xsl:attribute name="text:count-in-floating-frames">true</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@å­—:ç¼–å·æ–¹å¼='page'">
+ <xsl:attribute name="text:restart-on-page">true</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="å­—:ç¼–å·æ–¹å¼='continuous'">
+ <xsl:attribute name="text:count-empty-lines">true</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="@å­—:起始编å·">
+ <xsl:attribute name="style:num-format"><xsl:value-of select="@å­—:起始编å·"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@å­—:è·è¾¹ç•Œ">
+ <xsl:attribute name="text:offset"><xsl:value-of select="concat(@å­—:è·è¾¹ç•Œ,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@å­—:è¡Œå·é—´éš”">
+ <xsl:attribute name="text:increment"><xsl:value-of select="@å­—:è¡Œå·é—´éš”"/></xsl:attribute>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="脚注设置">
+ <xsl:element name="text:notes-configuration">
+ <xsl:for-each select="/uof:UOF/uof:文字处ç†/å­—:主体/å­—:分节/å­—:节属性/å­—:脚注设置">
+ <xsl:attribute name="text:note-class">footnote</xsl:attribute>
+ <xsl:attribute name="text:master-page-name">Footnote</xsl:attribute>
+ <xsl:attribute name="text:footnotes-position"><xsl:choose><xsl:when test="@å­—:ä½ç½®='page-bottom'">page</xsl:when><xsl:when test="@å­—:ä½ç½®='below-text'">document</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:attribute name="text:start-numbering-at"><xsl:choose><xsl:when test="@å­—:ç¼–å·æ–¹å¼='continuous'">document</xsl:when><xsl:when test="@å­—:ç¼–å·æ–¹å¼='section'">chapter</xsl:when><xsl:when test="@å­—:ç¼–å·æ–¹å¼='page'">page</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:attribute name="text:start-value"><xsl:value-of select="@å­—:èµ·å§‹ç¼–å· - 1"/></xsl:attribute>
+ <xsl:attribute name="style:num-format"><xsl:call-template name="ooæ•°å­—æ ¼å¼"><xsl:with-param name="oo_format" select="@å­—:æ ¼å¼"/></xsl:call-template></xsl:attribute>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="尾注设置">
+ <xsl:element name="text:notes-configuration">
+ <xsl:for-each select="/uof:UOF/uof:文字处ç†/å­—:主体/å­—:分节/å­—:节属性/å­—:尾注设置">
+ <xsl:attribute name="text:note-class">endnote</xsl:attribute>
+ <xsl:attribute name="text:master-page-name">Endnote</xsl:attribute>
+ <xsl:attribute name="style:num-format"><xsl:call-template name="ooæ•°å­—æ ¼å¼"><xsl:with-param name="oo_format" select="@å­—:æ ¼å¼"/></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="text:start-value"><xsl:value-of select="@å­—:èµ·å§‹ç¼–å· - 1"/></xsl:attribute>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="paragraph-properties">
+ <xsl:choose>
+ <xsl:when test="descendant::å­—:页边è·[@uof:å·¦]">
+ <xsl:attribute name="fo:margin-left"><xsl:value-of select="number((descendant::å­—:页边è·/@uof:å·¦)) * $other-to-cm-conversion-factor"/>cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:margin-left">0cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="descendant::å­—:页边è·[@uof:å³]">
+ <xsl:attribute name="fo:margin-right"><xsl:value-of select="number((descendant::å­—:页边è·/@uof:å³)) * $other-to-cm-conversion-factor"/>cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:margin-right">0cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="fo:text-indent">0cm</xsl:attribute>
+ <xsl:call-template name="bidi"/>
+ </xsl:template>
+ <xsl:template name="bidi">
+ </xsl:template>
+ <xsl:template match="字:文字表">
+ <xsl:choose>
+ <xsl:when test="@字:类型 = 'sub-table'">
+ <xsl:element name="table:table">
+ <xsl:attribute name="table:is-sub-table">true</xsl:attribute>
+ <xsl:apply-templates select="字:文字表属性">
+ <xsl:with-param name="sub-table" select="@字:类型"/>
+ </xsl:apply-templates>
+ <xsl:if test="字:行[position()=1]/字:表行属性/字:表头行/@字:值='true'">
+ <xsl:element name="table:table-header-rows">
+ <xsl:for-each select="字:行">
+ <xsl:if test="字:表行属性/字:表头行/@字:值='true'">
+ <xsl:apply-templates select="."/>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:if>
+ <xsl:for-each select="字:行[not(字:表行属性/字:表头行) or (字:表行属性/字:表头行/@字:值='false')]">
+ <xsl:apply-templates select="."/>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="table:table">
+ <xsl:if test="字:文字表属性">
+ <xsl:attribute name="table:style-name">Table<xsl:number count="å­—:文字表[not (@å­—:类型='sub-table')]" from="/uof:UOF/uof:文字处ç†/å­—:主体" level="any" format="1"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="not(字:文字表属性/字:列宽集/字:列宽)">
+ <xsl:for-each select="å­—:è¡Œ[1]/å­—:å•å…ƒæ ¼">
+ <xsl:element name="table:table-column">
+ <xsl:attribute name="table:style-name">Table<xsl:number count="å­—:文字表" from="/uof:UOF/uof:文字处ç†/å­—:主体" level="any" format="1"/>.C<xsl:number value="count(preceding::å­—:å•å…ƒæ ¼)+1"/></xsl:attribute>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:apply-templates select="字:文字表属性"/>
+ <xsl:if test="字:行[position()=1]/字:表行属性/字:表头行/@字:值='true'">
+ <xsl:element name="table:table-header-rows">
+ <xsl:for-each select="字:行">
+ <xsl:if test="字:表行属性/字:表头行/@字:值='true'">
+ <xsl:apply-templates select="."/>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:if>
+ <xsl:for-each select="字:行[not(字:表行属性/字:表头行) or (字:表行属性/字:表头行/@字:值='false')]">
+ <xsl:apply-templates select="."/>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="字:文字表属性">
+ <xsl:param name="sub-table"/>
+ <xsl:apply-templates select="字:列宽集">
+ <xsl:with-param name="sub-table" select="$sub-table"/>
+ </xsl:apply-templates>
+ </xsl:template>
+ <xsl:template match="字:列宽集">
+ <xsl:param name="sub-table"/>
+ <xsl:apply-templates select="字:列宽">
+ <xsl:with-param name="sub-table" select="$sub-table"/>
+ </xsl:apply-templates>
+ </xsl:template>
+ <xsl:template match="字:列宽">
+ <xsl:param name="sub-table"/>
+ <xsl:element name="table:table-column">
+ <xsl:choose>
+ <xsl:when test="$sub-table='sub-table'">
+ <xsl:variable name="subtable-leikuan" select="."/>
+ <xsl:variable name="weizi">
+ <xsl:for-each select="ancestor::*[name()='字:文字表' and not(@字:类型='sub-table')]/字:文字表属性/字:列宽集/字:列宽">
+ <xsl:variable name="yyyyy" select="."/>
+ <xsl:if test="substring(string($yyyyy),1,string-length(string($yyyyy))-1)=substring(string($subtable-leikuan),1,string-length(string($subtable-leikuan))-1)">
+ <xsl:value-of select="concat(position(),';')"/>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:variable name="xxxxx">
+ <xsl:number count="å­—:文字表[not (@å­—:类型='sub-table')]" from="/uof:UOF/uof:文字处ç†/å­—:主体" level="any" format="1"/>
+ </xsl:variable>
+ <xsl:attribute name="table:style-name"><xsl:value-of select="concat('Table',$xxxxx,'.C',substring-before($weizi,';'))"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="table:style-name">Table<xsl:number count="å­—:文字表[not (@å­—:类型='sub-table')]" from="/uof:UOF/uof:文字处ç†/å­—:主体" level="any" format="1"/>.C<xsl:number count="å­—:列宽" from="/uof:UOF/uof:文字处ç†/å­—:主体" level="single" format="1"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="字:行">
+ <xsl:element name="table:table-row">
+ <xsl:attribute name="table:style-name">Table<xsl:number count="å­—:文字表[not (@å­—:类型='sub-table')]" from="/uof:UOF/uof:文字处ç†/å­—:主体" level="any" format="1"/>.R<xsl:number count="å­—:è¡Œ" from="/uof:UOF/uof:文字处ç†/å­—:主体/å­—:文字表[not (@å­—:类型='sub-table')]" level="any" format="1"/></xsl:attribute>
+ <xsl:for-each select="node()">
+ <xsl:choose>
+ <xsl:when test="name()='å­—:å•å…ƒæ ¼'">
+ <xsl:call-template name="å­—:å•å…ƒæ ¼"/>
+ </xsl:when>
+ <xsl:when test="name()='å­—:å•å…ƒæ ¼è¦†ç›–'">
+
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="å­—:å•å…ƒæ ¼">
+ <xsl:element name="table:table-cell">
+ <xsl:attribute name="table:style-name">Table<xsl:number count="å­—:文字表[not (@å­—:类型='sub-table')]" from="/uof:UOF/uof:文字处ç†/å­—:主体" level="any" format="1"/>.R<xsl:number count="å­—:è¡Œ" from="/uof:UOF/uof:文字处ç†/å­—:主体/å­—:文字表[not (@å­—:类型='sub-table')]" level="any" format="1"/>C<xsl:number count="å­—:å•å…ƒæ ¼" from="/uof:UOF/uof:文字处ç†/å­—:主体/å­—:文字表[not (@å­—:类型='sub-table')]/å­—:è¡Œ" level="any" format="1"/></xsl:attribute>
+ <xsl:if test="å­—:å•å…ƒæ ¼å±žæ€§">
+ <xsl:apply-templates select="å­—:å•å…ƒæ ¼å±žæ€§"/>
+ </xsl:if>
+ <xsl:for-each select="node( )">
+ <xsl:choose>
+ <xsl:when test="name( )='å­—:段è½'">
+ <xsl:apply-templates select="."/>
+ </xsl:when>
+ <xsl:when test="name( )='字:文字表'">
+ <xsl:apply-templates select="."/>
+ </xsl:when>
+ <xsl:otherwise>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="å­—:å•å…ƒæ ¼å±žæ€§/å­—:边框">
+ <xsl:apply-templates/>
+ </xsl:template>
+ <xsl:template match="å­—:对é½[parent::å­—:文字表属性]">
+
+ </xsl:template>
+ <xsl:template match="uof:上">
+ <xsl:choose>
+ <xsl:when test="@uof:宽度='nil' ">
+ <xsl:attribute name="fo:border-top">none</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@uof:宽度 and @uof:颜色">
+ <xsl:attribute name="fo:border-top"><xsl:value-of select="concat(number(@uof:宽度),$uofUnit)"/><xsl:text> </xsl:text><xsl:choose><xsl:when test="@uof:颜色 ='auto'"><xsl:text>solid #000000</xsl:text></xsl:when><xsl:otherwise><xsl:text>solid </xsl:text><xsl:value-of select="@uof:颜色"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@uof:宽度">
+ <xsl:attribute name="fo:border-top"><xsl:value-of select="concat(number(@uof:宽度),$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="uof:下">
+ <xsl:choose>
+ <xsl:when test="@uof:宽度='nil' ">
+ <xsl:attribute name="fo:border-bottom">none</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@uof:宽度 and @uof:颜色">
+ <xsl:attribute name="fo:border-bottom"><xsl:value-of select="concat(number(@uof:宽度),$uofUnit)"/><xsl:text> </xsl:text><xsl:choose><xsl:when test="@uof:颜色 ='auto'"><xsl:text>solid #000000</xsl:text></xsl:when><xsl:otherwise><xsl:text>solid </xsl:text><xsl:value-of select="@uof:颜色"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@uof:宽度">
+ <xsl:attribute name="fo:border-bottom"><xsl:value-of select="concat(number(@uof:宽度),$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="uof:å·¦">
+ <xsl:choose>
+ <xsl:when test="@uof:宽度='nil'">
+ <xsl:attribute name="fo:border-left">none</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@uof:宽度 and @uof:颜色">
+ <xsl:attribute name="fo:border-left"><xsl:value-of select="concat(number(@uof:宽度),$uofUnit)"/><xsl:text> </xsl:text><xsl:choose><xsl:when test="@uof:颜色 ='auto'"><xsl:text>solid #000000</xsl:text></xsl:when><xsl:otherwise><xsl:text>solid </xsl:text><xsl:value-of select="@uof:颜色"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@uof:宽度">
+ <xsl:attribute name="fo:border-left"><xsl:value-of select="concat(number(@uof:宽度),$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="uof:å³">
+ <xsl:choose>
+ <xsl:when test="@uof:宽度='nil' ">
+ <xsl:attribute name="fo:border-right">none</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@uof:宽度 and @uof:颜色">
+ <xsl:attribute name="fo:border-right"><xsl:value-of select="concat(number(@uof:宽度),$uofUnit)"/><xsl:text> </xsl:text><xsl:choose><xsl:when test="@uof:颜色 ='auto'"><xsl:text>solid #000000</xsl:text></xsl:when><xsl:otherwise><xsl:text>solid </xsl:text><xsl:value-of select="@uof:颜色"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@uof:宽度">
+ <xsl:attribute name="fo:border-right"><xsl:value-of select="concat(number(@uof:宽度),$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="字:文字表属性/字:边框">
+ <xsl:apply-templates/>
+ </xsl:template>
+ <xsl:template match="å­—:å•å…ƒæ ¼å±žæ€§/å­—:边框">
+ <xsl:call-template name="uof:边框"/>
+ </xsl:template>
+ <xsl:template match="字:左缩进">
+ </xsl:template>
+ <xsl:template match="å­—:å•å…ƒæ ¼å±žæ€§">
+ <xsl:if test="字:跨列/@字:值">
+ <xsl:attribute name="table:number-columns-spanned"><xsl:value-of select="字:跨列/@字:值"/></xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="ç¼–å·é£Žæ ¼">
+ <xsl:for-each select="/uof:UOF/uof:å¼æ ·é›†/uof:自动编å·é›†/å­—:自动编å·">
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name"><xsl:value-of select="concat('P',@字:标识符)"/></xsl:attribute>
+ <xsl:attribute name="style:family">paragraph</xsl:attribute>
+ <xsl:attribute name="style:parent-style-name">Standard</xsl:attribute>
+ <xsl:attribute name="style:list-style-name"><xsl:value-of select="@字:标识符"/></xsl:attribute>
+ <xsl:element name="style:text-properties">
+ <xsl:attribute name="fo:margin-left">0cm</xsl:attribute>
+ <xsl:attribute name="fo:margin-right">0cm</xsl:attribute>
+ <xsl:attribute name="fo:color"><xsl:value-of select="å­—:级别/å­—:符å·å­—体/å­—:字体/å­—:颜色"/></xsl:attribute>
+ <xsl:attribute name="fo:text-indent"/>
+ <xsl:attribute name="style:auto-text-indent">false</xsl:attribute>
+ </xsl:element>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="ç¼–å·æ ¼å¼">
+ <xsl:attribute name="style:num-format"><xsl:choose><xsl:when test="string(å­—:ç¼–å·æ ¼å¼)='lower-letter'">a</xsl:when><xsl:when test="string(å­—:ç¼–å·æ ¼å¼)='upper-letter'">A</xsl:when><xsl:when test="string(å­—:ç¼–å·æ ¼å¼)='lower-roman'">i</xsl:when><xsl:when test="string(å­—:ç¼–å·æ ¼å¼)='upper-roman'">I</xsl:when><xsl:when test="string(å­—:ç¼–å·æ ¼å¼)='decimal-enclosed-circle'">â‘ , â‘¡, â‘¢, ...</xsl:when><xsl:when test="string(å­—:ç¼–å·æ ¼å¼)='ideograph-traditional'">甲, ä¹™, 丙, ...</xsl:when><xsl:when test="string(å­—:ç¼–å·æ ¼å¼)='ideograph-zodiac'">å­, 丑, 寅, ...</xsl:when><xsl:when test="string(å­—:ç¼–å·æ ¼å¼)='chinese-counting'">一, 二, 三, ...</xsl:when><xsl:when test="string(å­—:ç¼–å·æ ¼å¼)='chinese-legal-simplified'">壹, è´°, å, ...</xsl:when><xsl:otherwise>1</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:template>
+ <xsl:template name="图形style">
+ <xsl:for-each select="/uof:UOF/uof:对象集/图:图形">
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name"><xsl:value-of select="@图:标识符"/></xsl:attribute>
+ <xsl:attribute name="style:family">graphic</xsl:attribute>
+ <xsl:attribute name="style:parent-style-name">Graphics</xsl:attribute>
+ <xsl:element name="style:text-properties">
+ <xsl:attribute name="svg:stroke-width"><xsl:value-of select="图:预定义图形/图:属性/图:线粗细"/></xsl:attribute>
+ <xsl:attribute name="svg:stroke-color"><xsl:value-of select="图:预定义图形/图:属性/图:线颜色"/></xsl:attribute>
+ <xsl:attribute name="draw:stroke-dash"><xsl:value-of select="图:预定义图形/图:属性/图:线型"/></xsl:attribute>
+ <xsl:attribute name="draw:marker-start"><xsl:value-of select="图:预定义图形/图:属性/图:å‰ç«¯ç®­å¤´/图:å¼æ ·"/></xsl:attribute>
+ <xsl:attribute name="draw:marker-end"><xsl:value-of select="图:预定义图形/图:属性/图:åŽç«¯ç®­å¤´/图:å¼æ ·"/></xsl:attribute>
+ </xsl:element>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="duanluoshuxing">
+ <xsl:for-each select="/uof:UOF/uof:文字处ç†//å­—:段è½">
+ <xsl:choose>
+ <xsl:when test="count(å­—:å¥)&lt;=1">
+ <xsl:call-template name="å•ä¸ªæˆ–者没有å¥"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="多个å¥"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="å•ä¸ªæˆ–者没有å¥">
+ <xsl:variable name="stylename" select="å­—:段è½å±žæ€§/@å­—:å¼æ ·å¼•ç”¨"/>
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name">P<xsl:number from="/uof:UOF/uof:文字处ç†/å­—:主体" level="any" count="å­—:段è½"/></xsl:attribute>
+ <xsl:attribute name="style:family">paragraph</xsl:attribute>
+ <xsl:if test="name(preceding-sibling::*[1])='字:分节'">
+ <xsl:attribute name="style:master-page-name"><xsl:value-of select="preceding-sibling::å­—:分节[1]/@å­—:å称"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="å­—:段è½å±žæ€§/@å­—:å¼æ ·å¼•ç”¨">
+ <xsl:variable name="duanluoyinyong">
+ <xsl:value-of select="å­—:段è½å±žæ€§/@å­—:å¼æ ·å¼•ç”¨"/>
+ </xsl:variable>
+ <xsl:for-each select="/uof:UOF//uof:段è½å¼æ ·">
+ <xsl:if test="$duanluoyinyong=@字:标识符">
+ <xsl:if test="@å­—:基å¼æ ·å¼•ç”¨">
+ <xsl:choose>
+ <xsl:when test="@å­—:标识符=/uof:UOF/uof:文字处ç†/å­—:主体/å­—:段è½/å­—:段è½å±žæ€§/å­—:æ ¼å¼ä¿®è®¢/@å­—:修订信æ¯å¼•ç”¨">
+ <xsl:attribute name="style:parent-style-name"><xsl:value-of select="@字:标识符"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:parent-style-name"><xsl:value-of select="@å­—:基å¼æ ·å¼•ç”¨"/></xsl:attribute>
+ <xsl:variable name="aa">
+ <xsl:value-of select="@å­—:基å¼æ ·å¼•ç”¨"/>
+ </xsl:variable>
+ <xsl:for-each select="/uof:UOF//uof:段è½å¼æ ·">
+ <xsl:if test="$aa=@字:标识符">
+ <xsl:attribute name="style:display-name"><xsl:choose><xsl:when test="@å­—:别å"><xsl:value-of select="@å­—:别å"/></xsl:when><xsl:otherwise><xsl:value-of select="@å­—:å称"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:element name="style:paragraph-properties">
+ <xsl:if test="å­—:对é½">
+ <xsl:if test="å­—:对é½/@å­—:文字对é½">
+ <xsl:attribute name="style:vertical-align"><xsl:choose><xsl:when test="å­—:对é½/@å­—:文字对é½='base'">baseline</xsl:when><xsl:when test="å­—:对é½/@å­—:文字对é½='center'">middle</xsl:when><xsl:otherwise><xsl:value-of select="å­—:对é½/@å­—:文字对é½"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="å­—:对é½/@å­—:水平对é½">
+ <xsl:attribute name="fo:text-align"><xsl:choose><xsl:when test="å­—:对é½/@å­—:水平对é½='left'">start</xsl:when><xsl:when test="å­—:对é½/@å­—:水平对é½='right'">end</xsl:when><xsl:when test="å­—:对é½/@å­—:水平对é½='center'">center</xsl:when><xsl:otherwise>justify</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="å­—:对é½/@å­—:水平对é½='distributed'">
+ <xsl:attribute name="fo:text-align-last">justify</xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="style:justify-single-word">false</xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:call-template name="ParagraphAttr"/>
+ <xsl:if test="å­—:段è½å±žæ€§/å­—:制表ä½è®¾ç½®">
+ <xsl:call-template name="ootab"/>
+ </xsl:if>
+ </xsl:element>
+ <xsl:if test="å­—:å¥å±žæ€§">
+ <xsl:variable name="bsh">
+ <xsl:value-of select="å­—:å¥å±žæ€§/@å­—:å¼æ ·å¼•ç”¨"/>
+ </xsl:variable>
+ <xsl:element name="style:text-properties">
+ <xsl:for-each select="/uof:UOF//uof:å¥å¼æ ·">
+ <xsl:if test="$bsh=@字:标识符">
+ <xsl:apply-templates select="./*"/>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:if>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="字:边框">
+ <xsl:call-template name="uof:边框"/>
+ </xsl:if>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:element name="style:text-properties">
+ <xsl:if test="å­—:å¥/å­—:å¥å±žæ€§/å­—:字体">
+ <xsl:variable name="ziti">
+ <xsl:value-of select="å­—:å¥/å­—:å¥å±žæ€§/å­—:字体/@å­—:中文字体引用"/>
+ </xsl:variable>
+ <xsl:for-each select="/uof:UOF/uof:å¼æ ·é›†/uof:字体集/uof:字体声明">
+ <xsl:if test="@uof:标识符=$ziti">
+ <xsl:attribute name="style:font-name"><xsl:value-of select="@uof:å称"/></xsl:attribute>
+ <xsl:attribute name="style:font-name-asian"><xsl:value-of select="@uof:å称"/></xsl:attribute>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:if test="å­—:å¥/å­—:å¥å±žæ€§/å­—:字体/@å­—:å­—å·">
+ <xsl:attribute name="fo:font-size"><xsl:value-of select="å­—:å¥/å­—:å¥å±žæ€§/å­—:字体/@å­—:å­—å·"/></xsl:attribute>
+ <xsl:attribute name="style:font-size-asian"><xsl:value-of select="å­—:å¥/å­—:å¥å±žæ€§/å­—:字体/@å­—:å­—å·"/></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="å­—:段è½å±žæ€§/å­—:å¥å±žæ€§">
+ <xsl:for-each select="å­—:段è½å±žæ€§/å­—:å¥å±žæ€§">
+ <xsl:apply-templates select="./*"/>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:apply-templates select="å­—:å¥/å­—:å¥å±žæ€§/å­—:浮雕 | å­—:å¥/å­—:å¥å±žæ€§/å­—:边框 | å­—:å¥/å­—:å¥å±žæ€§/å­—:缩放 | å­—:å¥/å­—:å¥å±žæ€§/å­—:阴影 | å­—:å¥/å­—:å¥å±žæ€§/å­—:删除线 | å­—:å¥/å­—:å¥å±žæ€§/å­—:下划线 | å­—:å¥/å­—:å¡«å……"/>
+ <xsl:call-template name="ParagraphAttr"/>
+ <xsl:if test="å­—:段è½å±žæ€§/å­—:制表ä½è®¾ç½®">
+ <xsl:call-template name="ootab"/>
+ </xsl:if>
+ <xsl:for-each select="/uof:UOF/uof:å¼æ ·é›†/uof:å¥å¼æ ·[@å­—:标识符=$stylename]">
+ <xsl:apply-templates select="./*"/>
+ </xsl:for-each>
+ </xsl:element>
+ <style:paragraph-properties>
+ <xsl:if test="å­—:å¥/å­—:分æ ç¬¦">
+ <xsl:attribute name="fo:break-before">column</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="å­—:å¥/å­—:分页符">
+ <xsl:attribute name="fo:break-before">page</xsl:attribute>
+ </xsl:if>
+ <xsl:call-template name="ParagraphAttr"/>
+ <xsl:if test="å­—:段è½å±žæ€§/å­—:制表ä½è®¾ç½®">
+ <xsl:call-template name="ootab"/>
+ </xsl:if>
+ </style:paragraph-properties>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="ParagraphAttr">
+ <xsl:apply-templates select="å­—:段è½å±žæ€§/å­—:å¡«å……"/>
+ <xsl:if test="å­—:段è½å±žæ€§/å­—:对é½">
+ <xsl:if test="å­—:段è½å±žæ€§/å­—:对é½/@å­—:文字对é½">
+ <xsl:attribute name="style:vertical-align"><xsl:choose><xsl:when test="å­—:段è½å±žæ€§/å­—:对é½/@å­—:文字对é½='base'">baseline</xsl:when><xsl:when test="å­—:段è½å±žæ€§/å­—:对é½/@å­—:文字对é½='center'">middle</xsl:when><xsl:otherwise><xsl:value-of select="å­—:段è½å±žæ€§/å­—:对é½/@å­—:文字对é½"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="å­—:段è½å±žæ€§/å­—:对é½/@å­—:水平对é½">
+ <xsl:attribute name="fo:text-align"><xsl:choose><xsl:when test="å­—:段è½å±žæ€§/å­—:对é½/@å­—:水平对é½='left'">start</xsl:when><xsl:when test="å­—:段è½å±žæ€§/å­—:对é½/@å­—:水平对é½='right'">end</xsl:when><xsl:when test="å­—:段è½å±žæ€§/å­—:对é½/@å­—:水平对é½='center'">center</xsl:when><xsl:otherwise>justify</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="å­—:段è½å±žæ€§/å­—:对é½/@å­—:水平对é½='distributed'">
+ <xsl:attribute name="fo:text-align-last">justify</xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="style:justify-single-word">false</xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="å­—:段è½å±žæ€§/å­—:缩进">
+ <xsl:variable name="a1">
+ <xsl:value-of select="å­—:段è½å±žæ€§/å­—:缩进/å­—:å·¦/å­—:相对/@å­—:值"/>
+ </xsl:variable>
+ <xsl:variable name="a2">
+ <xsl:value-of select="å­—:段è½å±žæ€§/å­—:缩进/å­—:å³/å­—:相对/@å­—:值"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="å­—:段è½å±žæ€§/å­—:缩进/å­—:å·¦/å­—:相对 or å­—:段è½å±žæ€§/å­—:缩进/å­—:å³/å­—:相对">
+ <xsl:attribute name="fo:margin-left"><xsl:value-of select="concat($a1 * 0.37,'cm')"/></xsl:attribute>
+ <xsl:attribute name="fo:margin-right"><xsl:value-of select="concat($a2 * 0.37,'cm')"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:margin-left"><xsl:value-of select="concat(å­—:段è½å±žæ€§/å­—:缩进/å­—:å·¦/å­—:ç»å¯¹/@å­—:值,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:margin-right"><xsl:value-of select="concat(å­—:段è½å±žæ€§/å­—:缩进/å­—:å³/å­—:ç»å¯¹/@å­—:值,$uofUnit)"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="fo:text-indent"><xsl:value-of select="concat(å­—:段è½å±žæ€§/å­—:缩进/å­—:首行/å­—:ç»å¯¹/@å­—:值,$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="ancestor::uof:UOF/uof:å¼æ ·é›†/uof:自动编å·é›†/å­—:自动编å·/å­—:级别[following-sibling::å­—:级别[position()=1]/@å­—:级别值='1']/å­—:缩进">
+ <xsl:attribute name="fo:margin-left"><xsl:value-of select="concat(ancestor::uof:UOF/uof:å¼æ ·é›†/uof:自动编å·é›†/å­—:自动编å·/å­—:级别[following-sibling::å­—:级别[position()=1]/@å­—:级别值='1']/å­—:缩进/å­—:å·¦/å­—:ç»å¯¹/@å­—:值,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:margin-right"><xsl:value-of select="concat(ancestor::uof:UOF/uof:å¼æ ·é›†/uof:自动编å·é›†/å­—:自动编å·/å­—:级别[following-sibling::å­—:级别[position()=1]/@å­—:级别值='1']/å­—:缩进/å­—:å³/å­—:ç»å¯¹/@å­—:值,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:text-indent"><xsl:value-of select="concat(ancestor::uof:UOF/uof:å¼æ ·é›†/uof:自动编å·é›†/å­—:自动编å·/å­—:级别[following-sibling::å­—:级别[position()=1]/@å­—:级别值='1']/å­—:缩进/å­—:首行/å­—:ç»å¯¹/@å­—:值,$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="å­—:段è½å±žæ€§/å­—:è¡Œè·">
+ <xsl:variable name="type">
+ <xsl:value-of select="å­—:段è½å±žæ€§/å­—:è¡Œè·/@å­—:类型"/>
+ </xsl:variable>
+ <xsl:variable name="val">
+ <xsl:value-of select="å­—:段è½å±žæ€§/å­—:è¡Œè·/@å­—:值"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$type='fixed'">
+ <xsl:attribute name="fo:line-height"><xsl:value-of select="concat($val,$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$type='multi-lines'">
+ <xsl:attribute name="fo:line-height"><xsl:value-of select="concat($val * 100,'%')"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$type='at-least'">
+ <xsl:attribute name="style:line-height-at-least"><xsl:value-of select="concat($val,$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$type='line-space'">
+ <xsl:attribute name="style:line-spacing"><xsl:value-of select="concat($val,$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="å­—:段è½å±žæ€§/å­—:段间è·">
+ <xsl:if test="å­—:段è½å±žæ€§/å­—:段间è·/å­—:段å‰è·/å­—:ç»å¯¹å€¼/@å­—:值">
+ <xsl:attribute name="fo:margin-top"><xsl:value-of select="concat(å­—:段è½å±žæ€§/å­—:段间è·/å­—:段å‰è·/å­—:ç»å¯¹å€¼/@å­—:值,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="å­—:段è½å±žæ€§/å­—:段间è·/å­—:段åŽè·/å­—:ç»å¯¹å€¼/@å­—:值">
+ <xsl:attribute name="fo:margin-bottom"><xsl:value-of select="concat(å­—:段è½å±žæ€§/å­—:段间è·/å­—:段åŽè·/å­—:ç»å¯¹å€¼/@å­—:值,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:variable name="aa">
+ <xsl:value-of select="å­—:段è½å±žæ€§/å­—:段间è·/å­—:段å‰è·/å­—:相对值/@å­—:值"/>
+ </xsl:variable>
+ <xsl:variable name="bb">
+ <xsl:value-of select="å­—:段è½å±žæ€§/å­—:段间è·/å­—:段åŽè·/å­—:相对值/@å­—:值"/>
+ </xsl:variable>
+ <xsl:if test="å­—:段è½å±žæ€§/å­—:段间è·/å­—:段å‰è·/å­—:相对值/@å­—:值">
+ <xsl:attribute name="fo:margin-top"><xsl:value-of select="concat($aa * 15.6,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="å­—:段è½å±žæ€§/å­—:段间è·/å­—:段åŽè·/å­—:相对值/@å­—:值">
+ <xsl:attribute name="fo:margin-bottom"><xsl:value-of select="concat($bb * 15.6,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="å­—:段è½å±žæ€§/å­—:孤行控制">
+ <xsl:attribute name="fo:widows"><xsl:value-of select="å­—:段è½å±žæ€§/å­—:孤行控制"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="å­—:段è½å±žæ€§/å­—:寡行控制">
+ <xsl:attribute name="fo:orphans"><xsl:value-of select="å­—:段è½å±žæ€§/å­—:寡行控制"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="å­—:段è½å±žæ€§/å­—:段中ä¸åˆ†é¡µ">
+ <xsl:attribute name="fo:keep-together"><xsl:choose><xsl:when test="å­—:段è½å±žæ€§/å­—:段中ä¸åˆ†é¡µ/@å­—:值='1' or å­—:段è½å±žæ€§/å­—:段中ä¸åˆ†é¡µ/@å­—:值='true'">always</xsl:when><xsl:otherwise>auto</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="å­—:段è½å±žæ€§/å­—:与下段åŒé¡µ">
+ <xsl:attribute name="fo:keep-with-next"><xsl:choose><xsl:when test="å­—:段è½å±žæ€§/å­—:与下段åŒé¡µ/@å­—:值='1' or å­—:段è½å±žæ€§/å­—:与下段åŒé¡µ/@å­—:值='true'">always</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:for-each select="å­—:段è½å±žæ€§/å­—:边框">
+ <xsl:call-template name="uof:边框"/>
+ </xsl:for-each>
+ <xsl:for-each select="å­—:段è½å±žæ€§/å­—:å¡«å……">
+ <xsl:call-template name="uof:å¡«å……"/>
+ </xsl:for-each>
+ <xsl:if test="å­—:段è½å±žæ€§/å­—:对é½ç½‘æ ¼">
+ <xsl:attribute name="style:snap-to-layout-grid"><xsl:choose><xsl:when test="å­—:段è½å±žæ€§/å­—:对é½ç½‘æ ¼/@å­—:值='1' or å­—:段è½å±žæ€§/å­—:对é½ç½‘æ ¼/@å­—:值='true'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="å­—:段è½å±žæ€§/å­—:å–消断字">
+ <xsl:attribute name="fo:hyphenation-ladder-count">no-limit</xsl:attribute>
+ <xsl:attribute name="fo:hyphenation-remain-char-count">2</xsl:attribute>
+ <xsl:attribute name="fo:hyphenation-push-char-count">2</xsl:attribute>
+ <xsl:attribute name="fo:hyphenate"><xsl:choose><xsl:when test="å­—:段è½å±žæ€§/å­—:å–消断字/@å­—:值='1' or å­—:段è½å±žæ€§/å­—:å–消断字/@å­—:值='true'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="å­—:段è½å±žæ€§/å­—:å–消行å·">
+ <xsl:attribute name="text:number-lines"><xsl:choose><xsl:when test="å­—:段è½å±žæ€§/å­—:å–消行å·/@å­—:值='1' or å­—:段è½å±žæ€§/å­—:å–消行å·/@å­—:值='true'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="å­—:段è½å±žæ€§/å­—:行首尾标点控制">
+ <xsl:attribute name="style:punctuation-wrap"><xsl:choose><xsl:when test="å­—:段è½å±žæ€§/å­—:行首尾标点控制/@å­—:值='1' or å­—:段è½å±žæ€§/å­—:行首尾标点控制/@å­—:值='true'">hanging</xsl:when><xsl:otherwise>simple</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="å­—:段è½å±žæ€§/å­—:是å¦è¡Œé¦–标点压缩/@å­—:值='true'">
+ <xsl:attribute name="style:punctuation-compress">false</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="å­—:段è½å±žæ€§/å­—:中文习惯首尾字符">
+ <xsl:attribute name="style:line-break"><xsl:choose><xsl:when test="å­—:段è½å±žæ€§/å­—:中文习惯首尾字符/@å­—:值='1' or å­—:段è½å±žæ€§/å­—:中文习惯首尾字符/@å­—:值='true'">strict</xsl:when><xsl:otherwise>normal</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="å­—:段è½å±žæ€§/å­—:è‡ªåŠ¨è°ƒæ•´ä¸­è‹±æ–‡å­—ç¬¦é—´è· or å­—:段è½å±žæ€§/å­—:自动调整中文与数字间è·">
+ <xsl:attribute name="style:text-autospace"><xsl:choose><xsl:when test="å­—:段è½å±žæ€§/å­—:自动调整中英文字符间è·/@å­—:值='1' or å­—:段è½å±žæ€§/å­—:自动调整中文与数字间è·/@å­—:值='1'or å­—:段è½å±žæ€§/å­—:自动调整中英文字符间è·/@å­—:值='true' or å­—:段è½å±žæ€§/å­—:自动调整中文与数字间è·/@å­—:值='true'">ideograph-alpha</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="å­—:段è½å±žæ€§/å­—:首字下沉">
+ <xsl:element name="style:drop-cap">
+ <xsl:if test="å­—:段è½å±žæ€§/å­—:首字下沉/@å­—:行数">
+ <xsl:attribute name="style:lines"><xsl:value-of select="å­—:段è½å±žæ€§/å­—:首字下沉/@å­—:行数"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="å­—:段è½å±žæ€§/å­—:首字下沉/@å­—:é—´è·">
+ <xsl:attribute name="style:distance"><xsl:value-of select="concat(å­—:段è½å±žæ€§/å­—:首字下沉/@å­—:é—´è·,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="å­—:段è½å±žæ€§/å­—:首字下沉/@å­—:字体引用">
+ <xsl:attribute name="style:style-name"><xsl:value-of select="translate(å­—:段è½å±žæ€§/å­—:首字下沉/@å­—:字体引用,'_',' ')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="å­—:段è½å±žæ€§/å­—:首字下沉/@å­—:字符数">
+ <xsl:attribute name="style:length"><xsl:choose><xsl:when test="å­—:段è½å±žæ€§/å­—:首字下沉/@å­—:字符数='1'">word</xsl:when><xsl:otherwise><xsl:value-of select="å­—:段è½å±žæ€§/å­—:首字下沉/@å­—:字符数"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="XDParagraphAttr">
+ <xsl:apply-templates select="å­—:å¡«å……"/>
+ <xsl:if test="å­—:对é½">
+ <xsl:if test="å­—:对é½/@å­—:文字对é½">
+ <xsl:attribute name="style:vertical-align"><xsl:choose><xsl:when test="å­—:对é½/@å­—:文字对é½='base'">baseline</xsl:when><xsl:when test="å­—:对é½/@å­—:文字对é½='center'">middle</xsl:when><xsl:otherwise><xsl:value-of select="å­—:对é½/@å­—:文字对é½"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="å­—:对é½/@å­—:水平对é½">
+ <xsl:attribute name="fo:text-align"><xsl:choose><xsl:when test="å­—:对é½/@å­—:水平对é½='left'">start</xsl:when><xsl:when test="å­—:对é½/@å­—:水平对é½='right'">end</xsl:when><xsl:when test="å­—:对é½/@å­—:水平对é½='center'">center</xsl:when><xsl:otherwise>justify</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="å­—:对é½/@å­—:水平对é½='distributed'">
+ <xsl:attribute name="fo:text-align-last">justify</xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="style:justify-single-word">false</xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="字:缩进">
+ <xsl:if test="å­—:缩进/å­—:å·¦/å­—:ç»å¯¹/@å­—:值">
+ <xsl:attribute name="fo:margin-left"><xsl:value-of select="concat(å­—:缩进/å­—:å·¦/å­—:ç»å¯¹/@å­—:值,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="å­—:缩进/å­—:å³/å­—:ç»å¯¹/@å­—:值">
+ <xsl:attribute name="fo:margin-right"><xsl:value-of select="concat(å­—:缩进/å­—:å³/å­—:ç»å¯¹/@å­—:值,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="å­—:缩进/å­—:首行/å­—:ç»å¯¹/@å­—:值">
+ <xsl:attribute name="fo:text-indent"><xsl:value-of select="concat(å­—:缩进/å­—:首行/å­—:ç»å¯¹/@å­—:值,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="å­—:è¡Œè·">
+ <xsl:variable name="type">
+ <xsl:value-of select="å­—:è¡Œè·/@å­—:类型"/>
+ </xsl:variable>
+ <xsl:variable name="val">
+ <xsl:value-of select="å­—:è¡Œè·/@å­—:值"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$type='fixed'">
+ <xsl:attribute name="fo:line-height"><xsl:value-of select="concat($val,$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$type='multi-lines'">
+ <xsl:attribute name="fo:line-height"><xsl:value-of select="concat($val * 100,'%')"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$type='at-least'">
+ <xsl:attribute name="style:line-height-at-least"><xsl:value-of select="concat($val,$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$type='line-space'">
+ <xsl:attribute name="style:line-spacing"><xsl:value-of select="concat($val,$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="å­—:段间è·">
+ <xsl:if test="å­—:段间è·/å­—:段å‰è·/å­—:ç»å¯¹å€¼/@å­—:值">
+ <xsl:attribute name="fo:margin-top"><xsl:value-of select="concat(å­—:段间è·/å­—:段å‰è·/å­—:ç»å¯¹å€¼/@å­—:值,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="å­—:段间è·/å­—:段åŽè·/å­—:ç»å¯¹å€¼/@å­—:值">
+ <xsl:attribute name="fo:margin-bottom"><xsl:value-of select="concat(å­—:段间è·/å­—:段åŽè·/å­—:ç»å¯¹å€¼/@å­—:值,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="字:孤行控制">
+ <xsl:attribute name="fo:orphans"><xsl:value-of select="字:孤行控制"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:寡行控制">
+ <xsl:attribute name="fo:widows"><xsl:value-of select="字:寡行控制"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="å­—:段中ä¸åˆ†é¡µ">
+ <xsl:attribute name="fo:keep-together"><xsl:choose><xsl:when test="å­—:段中ä¸åˆ†é¡µ/@å­—:值='1' or å­—:段中ä¸åˆ†é¡µ/@å­—:值='true'">always</xsl:when><xsl:otherwise>auto</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="å­—:与下段åŒé¡µ">
+ <xsl:attribute name="fo:keep-with-next"><xsl:choose><xsl:when test="å­—:与下段åŒé¡µ/@å­—:值='1' or å­—:与下段åŒé¡µ/@å­—:值='true'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:for-each select="字:边框">
+ <xsl:call-template name="uof:边框"/>
+ </xsl:for-each>
+ <xsl:for-each select="å­—:å¡«å……">
+ <xsl:call-template name="uof:å¡«å……"/>
+ </xsl:for-each>
+ <xsl:if test="å­—:对é½ç½‘æ ¼">
+ <xsl:attribute name="style:snap-to-layout-grid"><xsl:choose><xsl:when test="å­—:对é½ç½‘æ ¼/@å­—:值='1' or å­—:对é½ç½‘æ ¼/@å­—:值='true'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="å­—:å–消断字">
+ <xsl:attribute name="fo:hyphenation-ladder-count">no-limit</xsl:attribute>
+ <xsl:attribute name="fo:hyphenation-remain-char-count">2</xsl:attribute>
+ <xsl:attribute name="fo:hyphenation-push-char-count">2</xsl:attribute>
+ <xsl:attribute name="fo:hyphenate"><xsl:choose><xsl:when test="å­—:å–消断字/@å­—:值='1' or å­—:å–消断字/@å­—:值='true'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="å­—:å–消行å·">
+ <xsl:attribute name="text:number-lines"><xsl:choose><xsl:when test="å­—:å–消行å·/@å­—:值='1' or å­—:å–消行å·/@å­—:值='true'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:行首尾标点控制">
+ <xsl:attribute name="style:punctuation-wrap"><xsl:choose><xsl:when test="字:行首尾标点控制/@字:值='1' or 字:行首尾标点控制/@字:值='true'">hanging</xsl:when><xsl:otherwise>simple</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="å­—:是å¦è¡Œé¦–标点压缩/@å­—:值='true'">
+ <xsl:attribute name="style:punctuation-compress">false</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:中文习惯首尾字符">
+ <xsl:attribute name="style:line-break"><xsl:choose><xsl:when test="字:中文习惯首尾字符/@字:值='1' or 字:中文习惯首尾字符/@字:值='true'">strict</xsl:when><xsl:otherwise>normal</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="å­—:è‡ªåŠ¨è°ƒæ•´ä¸­è‹±æ–‡å­—ç¬¦é—´è· or å­—:自动调整中文与数字间è·">
+ <xsl:attribute name="style:text-autospace"><xsl:choose><xsl:when test="å­—:自动调整中英文字符间è·/@å­—:值='1' or å­—:自动调整中文与数字间è·/@å­—:值='1'or å­—:自动调整中英文字符间è·/@å­—:值='true' or å­—:自动调整中文与数字间è·/@å­—:值='true'">ideograph-alpha</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:首字下沉">
+ <xsl:element name="style:drop-cap">
+ <xsl:if test="字:首字下沉/@字:行数">
+ <xsl:attribute name="style:lines"><xsl:value-of select="字:首字下沉/@字:行数"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="å­—:首字下沉/@å­—:é—´è·">
+ <xsl:attribute name="style:distance"><xsl:value-of select="concat(å­—:首字下沉/@å­—:é—´è·,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:首字下沉/@字:字体引用">
+ <xsl:attribute name="style:style-name"><xsl:value-of select="字:首字下沉/@字:字体引用"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:首字下沉/@字:字符数">
+ <xsl:attribute name="style:length"><xsl:choose><xsl:when test="字:首字下沉/@字:字符数='1'">word</xsl:when><xsl:otherwise><xsl:value-of select="字:首字下沉/@字:字符数"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="多个å¥">
+ <xsl:call-template name="å•ä¸ªæˆ–者没有å¥"/>
+ </xsl:template>
+ <xsl:template name="jibianhao">
+ <xsl:param name="biaoshifu"/>
+ <xsl:element name="text:list-level-style-number">
+ <xsl:variable name="currlevel" select="number(@字:级别值) + 1"/>
+ <xsl:attribute name="text:level"><xsl:value-of select="$currlevel"/></xsl:attribute>
+ <xsl:attribute name="text:style-name">Numbering Symbols</xsl:attribute>
+ <xsl:if test="@å­—:å°¾éšå­—符">
+ <xsl:attribute name="style:num-suffix"><xsl:choose><xsl:when test="@å­—:å°¾éšå­—符='space'"><xsl:value-of select="' ' "/></xsl:when><xsl:when test="@å­—:å°¾éšå­—符='tab'"><xsl:value-of select="' '"/></xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="å­—:符å·å­—体">
+ <xsl:variable name="Font-ID">
+ <xsl:value-of select="å­—:符å·å­—体/@å­—:å¼æ ·å¼•ç”¨"/>
+ </xsl:variable>
+ <xsl:attribute name="text:style-name"><xsl:value-of select="$Font-ID"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="å­—:起始编å·">
+ <xsl:attribute name="text:start-value"><xsl:value-of select="å­—:起始编å·"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="å­—:正规格å¼">
+ <xsl:attribute name="text:num-regular-exp"><xsl:value-of select="å­—:正规格å¼/@值"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="text:display-levels"><xsl:value-of select="string-length(å­—:ç¼–å·æ ¼å¼è¡¨ç¤º) - string-length(translate(å­—:ç¼–å·æ ¼å¼è¡¨ç¤º,'%','') )"/></xsl:attribute>
+ <xsl:if test="å­—:ç¼–å·æ ¼å¼">
+ <xsl:call-template name="ç¼–å·æ ¼å¼"/>
+ </xsl:if>
+ <xsl:if test="å­—:ç¼–å·æ ¼å¼è¡¨ç¤º">
+ <xsl:variable name="last" select="substring-after(å­—:ç¼–å·æ ¼å¼è¡¨ç¤º,concat('%',$currlevel))"/>
+ <xsl:variable name="first">
+ <xsl:variable name="aa" select="substring-before(å­—:ç¼–å·æ ¼å¼è¡¨ç¤º,concat('%',$currlevel))"/>
+ <xsl:choose>
+ <xsl:when test="not(substring-after($aa,'%'))">
+ <xsl:value-of select="$aa"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="$first!=''">
+ <xsl:attribute name="style:num-prefix"><xsl:value-of select="$first"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$last!=''">
+ <xsl:attribute name="style:num-suffix"><xsl:value-of select="$last"/></xsl:attribute>
+ </xsl:if>
+ <xsl:call-template name="bianhaogeshi">
+ <xsl:with-param name="biaoshi">
+ <xsl:value-of select="å­—:ç¼–å·æ ¼å¼è¡¨ç¤º"/>
+ </xsl:with-param>
+ <xsl:with-param name="jibie">
+ <xsl:value-of select="1"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:element name="style:text-properties">
+ <xsl:call-template name="suojinleixing"/>
+ <xsl:if test="@å­—:ç¼–å·å¯¹é½æ–¹å¼">
+ <xsl:attribute name="fo:text-align"><xsl:variable name="aa"><xsl:value-of select="@å­—:ç¼–å·å¯¹é½æ–¹å¼"/></xsl:variable><xsl:choose><xsl:when test="$aa='center' ">center</xsl:when><xsl:when test="$aa='right' ">end</xsl:when><xsl:otherwise>left</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="å­—:符å·å­—体">
+ <xsl:if test="å­—:符å·å­—体/@å­—:å¼æ ·å¼•ç”¨">
+ <xsl:variable name="Font-ID">
+ <xsl:value-of select="å­—:符å·å­—体/@å­—:å¼æ ·å¼•ç”¨"/>
+ </xsl:variable>
+ <xsl:for-each select="/uof:UOF/uof:å¼æ ·é›†/uof:å¥å¼æ ·">
+ <xsl:if test="@字:标识符=$Font-ID">
+ <xsl:if test="字:字体/@字:中文字体引用">
+ <xsl:attribute name="fo:font-family"><xsl:value-of select="字:字体/@字:中文字体引用"/></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:if>
+ </xsl:if>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="bianhaogeshi">
+ <xsl:param name="biaoshi"/>
+ <xsl:param name="jibie"/>
+ <xsl:variable name="bb">
+ <xsl:value-of select="substring-after($biaoshi,'%')"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="substring-after($bb,'%')">
+ <xsl:call-template name="bianhaogeshi">
+ <xsl:with-param name="biaoshi" select="$bb"/>
+ <xsl:with-param name="jibie" select="$jibie +1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="not($jibie=1)">
+ <xsl:attribute name="text:display-levels"><xsl:value-of select="$jibie"/></xsl:attribute>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="xiangmufuhao">
+ <xsl:param name="biaoshifu"/>
+ <xsl:variable name="currlevel" select="number(@字:级别值) + 1"/>
+ <xsl:element name="text:list-level-style-bullet">
+ <xsl:attribute name="text:level"><xsl:value-of select="$currlevel"/></xsl:attribute>
+ <xsl:attribute name="text:style-name"><xsl:value-of select="../@å­—:å称"/></xsl:attribute>
+ <xsl:attribute name="style:num-suffix"><xsl:value-of select="substring-after(å­—:ç¼–å·æ ¼å¼è¡¨ç¤º,'%1')"/></xsl:attribute>
+ <xsl:attribute name="text:bullet-char"><xsl:value-of select="å­—:项目符å·"/></xsl:attribute>
+ <xsl:element name="style:text-properties">
+ <xsl:if test="å­—:符å·å­—体">
+ <xsl:variable name="Font-ID">
+ <xsl:value-of select="å­—:符å·å­—体/@å­—:å¼æ ·å¼•ç”¨"/>
+ </xsl:variable>
+ <xsl:for-each select="/uof:UOF/uof:å¼æ ·é›†/uof:å¥å¼æ ·">
+ <xsl:if test="@字:标识符=$Font-ID">
+ <xsl:if test="字:字体/@字:中文字体引用">
+ <xsl:attribute name="svg:font-family"><xsl:value-of select="字:字体/@字:中文字体引用"/></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:if test="å­—:项目符å·">
+ <xsl:attribute name="fo:font-family"><xsl:value-of select="'WingDings'"/></xsl:attribute>
+ </xsl:if>
+ <xsl:call-template name="suojinleixing"/>
+ <xsl:if test="@å­—:ç¼–å·å¯¹é½æ–¹å¼">
+ <xsl:attribute name="fo:text-align"><xsl:variable name="aa"><xsl:value-of select="@å­—:ç¼–å·å¯¹é½æ–¹å¼"/></xsl:variable><xsl:choose><xsl:when test="$aa='center' ">center</xsl:when><xsl:when test="$aa='right' ">end</xsl:when><xsl:otherwise>left</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="imagefuhao">
+ <xsl:param name="biaoshifu"/>
+ <xsl:variable name="currlevel" select="number(@字:级别值) + 1"/>
+ <xsl:element name="text:list-level-style-image" style:vertical-pos="middle" style:vertical-rel="line" fo:width="0.265cm" fo:height="0.265cm">
+ <xsl:attribute name="text:level"><xsl:value-of select="$currlevel"/></xsl:attribute>
+ <xsl:attribute name="text:style-name"><xsl:value-of select="concat( $biaoshifu,$currlevel)"/></xsl:attribute>
+ <xsl:attribute name="style:num-suffix"><xsl:value-of select="substring-after(å­—:ç¼–å·æ ¼å¼è¡¨ç¤º,'%1')"/></xsl:attribute>
+ <xsl:if test="å­—:图片符å·å¼•ç”¨">
+ <xsl:variable name="gid">
+ <xsl:value-of select="å­—:图片符å·å¼•ç”¨"/>
+ </xsl:variable>
+ <xsl:element name="office:binary-data">
+ <xsl:value-of select="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$gid]/uof:æ•°æ®"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="style:list-level-properties">
+ <xsl:attribute name="style:vertical-pos">middle</xsl:attribute>
+ <xsl:attribute name="style:vertical-rel">line</xsl:attribute>
+ <xsl:attribute name="fo:width"><xsl:value-of select="concat(å­—:图片符å·å¼•ç”¨/@å­—:宽度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:height"><xsl:value-of select="concat(å­—:图片符å·å¼•ç”¨/@å­—:高度,$uofUnit)"/></xsl:attribute>
+ <xsl:if test="å­—:符å·å­—体">
+ <xsl:variable name="Font-ID">
+ <xsl:value-of select="å­—:符å·å­—体/@å­—:å¼æ ·å¼•ç”¨"/>
+ </xsl:variable>
+ <xsl:for-each select="/uof:UOF/uof:å¼æ ·é›†/uof:å¥å¼æ ·">
+ <xsl:if test="@字:标识符=$Font-ID">
+ <xsl:if test="字:字体/@字:中文字体引用">
+ <xsl:attribute name="svg:font-family"><xsl:value-of select="字:字体/@字:中文字体引用"/></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:call-template name="suojinleixing"/>
+ <xsl:if test="@å­—:ç¼–å·å¯¹é½æ–¹å¼">
+ <xsl:attribute name="fo:text-align"><xsl:variable name="aa"><xsl:value-of select="@å­—:ç¼–å·å¯¹é½æ–¹å¼"/></xsl:variable><xsl:choose><xsl:when test="$aa='center' ">center</xsl:when><xsl:when test="$aa='right' ">end</xsl:when><xsl:otherwise>left</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="ootab">
+ <xsl:element name="style:tab-stops">
+ <xsl:for-each select="å­—:段è½å±žæ€§/å­—:制表ä½è®¾ç½®/å­—:åˆ¶è¡¨ä½ | å­—:制表ä½è®¾ç½®/å­—:制表ä½">
+ <xsl:element name="style:tab-stop">
+ <xsl:attribute name="style:position"><xsl:value-of select="concat(@å­—:ä½ç½®,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="style:type"><xsl:choose><xsl:when test="@字:类型='decimal'">char</xsl:when><xsl:when test="@字:类型='left' or @字:类型='right' or @字:类型='center'"><xsl:value-of select="@字:类型"/></xsl:when><xsl:otherwise/></xsl:choose></xsl:attribute>
+ <xsl:if test="@å­—:制表ä½å­—符">
+ <xsl:attribute name="style:leader-text"><xsl:value-of select="@å­—:制表ä½å­—符"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="style:leader-style"><xsl:value-of select="@å­—:å‰å¯¼ç¬¦"/></xsl:attribute>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="å­—:段è½[å­—:段è½å±žæ€§[å­—:自动编å·ä¿¡æ¯]]">
+ <xsl:call-template name="ç¼–å·è§£æž">
+ </xsl:call-template>
+ </xsl:template>
+ <xsl:template name="ç¼–å·è§£æž">
+ <xsl:variable name="bianhao">
+ <xsl:value-of select="å­—:段è½å±žæ€§/å­—:自动编å·ä¿¡æ¯/@å­—:ç¼–å·å¼•ç”¨"/>
+ </xsl:variable>
+ <xsl:variable name="bianhaojibie">
+ <xsl:value-of select="å­—:段è½å±žæ€§/å­—:自动编å·ä¿¡æ¯/@å­—:ç¼–å·çº§åˆ«"/>
+ </xsl:variable>
+ <xsl:variable name="isxiangmuorisimage">
+ <xsl:for-each select="/uof:UOF/uof:å¼æ ·é›†/uof:自动编å·é›†/å­—:自动编å·">
+ <xsl:choose>
+ <xsl:when test="$bianhao=@字:标识符">
+ <xsl:choose>
+ <xsl:when test="å­—:级别[@å­—:级别值= (number($bianhaojibie))]/å­—:项目符å·">true</xsl:when>
+ <xsl:when test="å­—:级别[@å­—:级别值= (number($bianhaojibie))]/å­—:图片符å·å¼•ç”¨">true</xsl:when>
+ <xsl:otherwise>false</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>false</xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$isxiangmuorisimage='true'">
+ <xsl:call-template name="æ— åº"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="有åº"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="有åº">
+ <xsl:variable name="currlistid" select="å­—:段è½å±žæ€§/å­—:自动编å·ä¿¡æ¯/@å­—:ç¼–å·å¼•ç”¨"/>
+ <xsl:variable name="currlistlvl" select="å­—:段è½å±žæ€§/å­—:自动编å·ä¿¡æ¯/@å­—:ç¼–å·çº§åˆ« + 1"/>
+ <xsl:variable name="firstoccur" select="/descendant::å­—:段è½å±žæ€§[å­—:自动编å·ä¿¡æ¯/@å­—:ç¼–å·å¼•ç”¨ = $currlistid][1]"/>
+ <xsl:element name="text:list">
+ <xsl:attribute name="text:style-name">List<xsl:value-of select="count($firstoccur/preceding::å­—:自动编å·ä¿¡æ¯)"/></xsl:attribute>
+ <xsl:attribute name="text:continue-numbering"><xsl:choose><xsl:when test="å­—:段è½å±žæ€§/å­—:自动编å·ä¿¡æ¯/@å­—:é‡æ–°ç¼–å·='false'">false</xsl:when><xsl:otherwise>true</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="å­—:段è½å±žæ€§/å­—:自动编å·ä¿¡æ¯/@å­—:é‡æ–°ç¼–å·">
+ <xsl:attribute name="text:continue-numbering"><xsl:choose><xsl:when test="å­—:段è½å±žæ€§/å­—:自动编å·ä¿¡æ¯/@å­—:é‡æ–°ç¼–å·='1'">false</xsl:when><xsl:otherwise>true</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:element name="text:list-item">
+ <xsl:call-template name="ordered-levels">
+ <xsl:with-param name="level" select="$currlistlvl - 1"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="ordered-levels">
+ <xsl:param name="level"/>
+ <xsl:choose>
+ <xsl:when test="$level = '0'">
+ <xsl:call-template name="commonParagraph"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="text:list">
+ <xsl:element name="text:list-item">
+ <xsl:call-template name="ordered-levels">
+ <xsl:with-param name="level" select="$level - 1"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="æ— åº">
+ <xsl:variable name="currlistid" select="å­—:段è½å±žæ€§/å­—:自动编å·ä¿¡æ¯/@å­—:ç¼–å·å¼•ç”¨"/>
+ <xsl:variable name="currlistlvl" select="å­—:段è½å±žæ€§/å­—:自动编å·ä¿¡æ¯/@å­—:ç¼–å·çº§åˆ« + 1"/>
+ <xsl:variable name="firstoccur" select="/descendant::å­—:段è½å±žæ€§[å­—:自动编å·ä¿¡æ¯/@å­—:ç¼–å·å¼•ç”¨ = $currlistid][1]"/>
+ <xsl:element name="text:list">
+ <xsl:attribute name="text:style-name">List<xsl:value-of select="count($firstoccur/preceding::å­—:自动编å·ä¿¡æ¯)"/></xsl:attribute>
+ <xsl:element name="text:list-item">
+ <xsl:call-template name="unordered-levels">
+ <xsl:with-param name="level" select="$currlistlvl - 1"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="unordered-levels">
+ <xsl:param name="level"/>
+ <xsl:choose>
+ <xsl:when test="$level = '0'">
+ <xsl:call-template name="commonParagraph"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="text:list">
+ <xsl:element name="text:list-item">
+ <xsl:call-template name="unordered-levels">
+ <xsl:with-param name="level" select="$level - 1"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- measure_conversion.xsl Begin-->
+ <xsl:param name="dpi" select="111"/>
+ <xsl:param name="centimeter-in-mm" select="10"/>
+ <xsl:param name="inch-in-mm" select="25.4"/>
+ <xsl:param name="didot-point-in-mm" select="0.376065"/>
+ <xsl:param name="pica-in-mm" select="4.2333333"/>
+ <xsl:param name="point-in-mm" select="0.3527778"/>
+ <xsl:param name="twip-in-mm" select="0.017636684"/>
+ <xsl:param name="pixel-in-mm" select="$inch-in-mm div $dpi"/>
+ <!-- ***** MEASUREMENT CONVERSIONS *****
+ PARAM 'value'
+ The measure to be converted.
+ The current measure is judged by a substring (e.g. 'mm', 'cm', 'in', 'pica'...)
+ directly added to the number.
+
+ PARAM 'rounding-factor'
+ Is used for the rounding of decimal places.
+ The parameter number is the product of 1 and some '10', where
+ every zero represents a decimal place.
+
+ For example, providing as parameter:
+ <xsl:param name="rounding-factor" select="10000" />
+ Gives by default four decimal places.
+
+ To round two decimal places, basically the following is done:
+ <xsl:value-of select="round(100 * value) div 100"/>
+
+ RETURN The converted number, by default rounded to four decimal places.
+ In case the input measure could not be matched the same value is
+ returned and a warning message is written out.
+
+
+
+ MEASURE LIST:
+ * 1 milimeter (mm), the basic measure
+
+ * 1 centimeter (cm) = 10 mm
+
+ * 1 inch (in) = 25.4 mm
+ While the English have already seen the light (read: the metric system), the US
+ remains loyal to this medieval system.
+
+ * 1 point (pt) = 0.35277777.. mm
+ Sometimes called PostScript point (ppt), as when Adobe created PostScript, they added their own system of points.
+ There are exactly 72 PostScript points in 1 inch.
+
+ * 1 twip = twentieth of a (PostScript) point
+ A twip (twentieth of a point) is a 1/20th of a PostScript point, a traditional measure in printing.
+
+ * 1 didot point (dpt) = 0.376065 mm
+ Didot point after the French typographer Firmin Didot (1764-1836).
+
+ More details under
+ http://www.unc.edu/~rowlett/units/dictP.html:
+ "A unit of length used by typographers and printers. When printing was done
+ from hand-set metal type, one point represented the smallest element of type
+ that could be handled, roughly 1/64 inch. Eventually, the point was standardized
+ in Britain and America as exactly 1/72.27 = 0.013 837 inch, which is
+ about 0.35 mm (351.46 micrometers). In continental Europe, typographers
+ traditionally used a slightly larger point of 0.014 83 inch (about
+ 1/72 pouce, 0.377 mm, or roughly 1/67 English inch), called a Didot point
+ after the French typographer Firmin Didot (1764-1836). In the U.S.,
+ Adobe software defines the point to be exactly 1/72 inch (0.013 888 9 inch
+ or 0.352 777 8 millimeters) and TeX software uses a slightly smaller point
+ of 0.351 459 8035 mm. The German standards agency DIN has proposed that
+ all these units be replaced by multiples of 0.25 millimeters (1/101.6 inch).
+
+ * 1 pica = 4.233333 mm
+ 1/6 inch or 12 points
+
+ * 1 pixel (px) = 0.26458333.. mm (relative to 'DPI', here: 96 dpi)
+ Most pictures have the 96 dpi resolution, but the dpi variable may vary by stylesheet parameter
+
+
+ -->
+ <!-- changing measure to mm -->
+ <xsl:template name="convert2cm">
+ <xsl:param name="value"/>
+ <xsl:param name="rounding-factor" select="10000"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $centimeter-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, $uofUnit)">
+ <xsl:value-of select="substring-before($value, $uofUnit)"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $centimeter-in-mm * $inch-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $centimeter-in-mm * $point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $centimeter-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $centimeter-in-mm * $pica-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $centimeter-in-mm * $twip-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $centimeter-in-mm * $pixel-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'cm'!</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="uof:通用边框">
+ <xsl:param name="lineType"/>
+ <xsl:param name="width"/>
+ <xsl:param name="color"/>
+ <xsl:choose>
+ <xsl:when test="$lineType='none'">none</xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$width"/>
+ <xsl:choose>
+ <xsl:when test="$lineType='single'">solid </xsl:when>
+ <xsl:when test="$lineType='double'">double </xsl:when>
+ <xsl:otherwise>solid </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="$color='auto' or $color='none' or $color=''">#808080</xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$color"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="uof:边框">
+ <xsl:if test="uof:上">
+ <xsl:variable name="type" select="uof:上/@uof:类型"/>
+ <xsl:variable name="size" select="concat(uof:上/@uof:宽度,$uofUnit,' ')"/>
+ <xsl:variable name="clr" select="uof:上/@uof:颜色"/>
+ <xsl:attribute name="fo:border-top"><xsl:call-template name="uof:通用边框"><xsl:with-param name="lineType" select="$type"/><xsl:with-param name="width" select="$size"/><xsl:with-param name="color" select="$clr"/></xsl:call-template></xsl:attribute>
+ <xsl:if test="uof:上/@uof:线宽度">
+ <xsl:attribute name="style:border-line-width-top"><xsl:value-of select="uof:上/@uof:线宽度"/></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="uof:下">
+ <xsl:variable name="type" select="uof:下/@uof:类型"/>
+ <xsl:variable name="size" select="concat(uof:下/@uof:宽度,$uofUnit,' ')"/>
+ <xsl:variable name="clr" select="uof:下/@uof:颜色"/>
+ <xsl:attribute name="fo:border-bottom"><xsl:call-template name="uof:通用边框"><xsl:with-param name="lineType" select="$type"/><xsl:with-param name="width" select="$size"/><xsl:with-param name="color" select="$clr"/></xsl:call-template></xsl:attribute>
+ <xsl:if test="uof:下/@uof:线宽度">
+ <xsl:attribute name="style:border-line-width-bottom"><xsl:value-of select="uof:下/@uof:线宽度"/></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="uof:å·¦">
+ <xsl:variable name="type" select="uof:左/@uof:类型"/>
+ <xsl:variable name="size" select="concat(uof:左/@uof:宽度,$uofUnit,' ')"/>
+ <xsl:variable name="clr" select="uof:左/@uof:颜色"/>
+ <xsl:attribute name="fo:border-left"><xsl:call-template name="uof:通用边框"><xsl:with-param name="lineType" select="$type"/><xsl:with-param name="width" select="$size"/><xsl:with-param name="color" select="$clr"/></xsl:call-template></xsl:attribute>
+ <xsl:if test="uof:左/@uof:线宽度">
+ <xsl:attribute name="style:border-line-width-left"><xsl:value-of select="uof:左/@uof:线宽度"/></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="uof:å³">
+ <xsl:variable name="type" select="uof:å³/@uof:类型"/>
+ <xsl:variable name="size" select="concat(uof:å³/@uof:宽度,$uofUnit,' ')"/>
+ <xsl:variable name="clr" select="uof:å³/@uof:颜色"/>
+ <xsl:attribute name="fo:border-right"><xsl:call-template name="uof:通用边框"><xsl:with-param name="lineType" select="$type"/><xsl:with-param name="width" select="$size"/><xsl:with-param name="color" select="$clr"/></xsl:call-template></xsl:attribute>
+ <xsl:if test="uof:å³/@uof:线宽度">
+ <xsl:attribute name="style:border-line-width-right"><xsl:value-of select="uof:å³/@uof:线宽度"/></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="uof:上/@uof:阴影='true'or uof:上/@uof:阴影='1'">
+ <xsl:if test="uof:左/@uof:阴影='true'or uof:左/@uof:阴影='1'">
+ <xsl:attribute name="style:shadow">#808080 -0.18cm -0.18cm</xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="uof:上/@uof:阴影='true'or uof:上/@uof:阴影='1'">
+ <xsl:if test="uof:å³/@uof:阴影='true'or uof:å³/@uof:阴影='1'">
+ <xsl:attribute name="style:shadow">#808080 0.18cm -0.18cm</xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="uof:下/@uof:阴影='true'or uof:下/@uof:阴影='1'">
+ <xsl:if test="uof:左/@uof:阴影='true'or uof:左/@uof:阴影='1'">
+ <xsl:attribute name="style:shadow">#808080 -0.18cm 0.18cm</xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="uof:下/@uof:阴影='true'or uof:下/@uof:阴影='1'">
+ <xsl:if test="uof:å³/@uof:阴影='true'or uof:å³/@uof:阴影='1'">
+ <xsl:attribute name="style:shadow">#808080 0.18cm 0.18cm</xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="uof:上/@uof:è¾¹è·">
+ <xsl:attribute name="fo:padding-top"><xsl:value-of select="concat(uof:上/@uof:è¾¹è·,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="uof:下/@uof:è¾¹è·">
+ <xsl:attribute name="fo:padding-bottom"><xsl:value-of select="concat(uof:下/@uof:è¾¹è·,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="uof:å·¦/@uof:è¾¹è·">
+ <xsl:attribute name="fo:padding-left"><xsl:value-of select="concat(uof:å·¦/@uof:è¾¹è·,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="uof:å³/@uof:è¾¹è·">
+ <xsl:attribute name="fo:padding-right"><xsl:value-of select="concat(uof:å³/@uof:è¾¹è·,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="uof:å¡«å……">
+ <xsl:choose>
+ <xsl:when test="图:颜色">
+ <xsl:attribute name="fo:background-color"><xsl:choose><xsl:when test="图:颜色"><xsl:value-of select="图:颜色"/></xsl:when><xsl:otherwise>transparent</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="contains(图:图案/@图:å‰æ™¯è‰²,'#')">
+ <xsl:attribute name="fo:text-background-color"><xsl:value-of select="图:图案/@图:å‰æ™¯è‰²"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:图案/@图:背景色">
+ <xsl:attribute name="fo:background-color"><xsl:value-of select="图:图案/@图:背景色"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ <xsl:if test="图:图片">
+ <xsl:element name="style:background-image">
+ <xsl:variable name="gid">
+ <xsl:value-of select="图:图片/@图:图形引用"/>
+ </xsl:variable>
+ <xsl:if test="图:图片/@图:ä½ç½® and not(图:图片/@图:ä½ç½®='tile')">
+ <xsl:attribute name="style:repeat"><xsl:choose><xsl:when test="图:图片/@图:ä½ç½®='stretch'">stretch</xsl:when><xsl:when test="图:图片/@图:ä½ç½®='center'">no-repeat</xsl:when></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$gid]/uof:æ•°æ®">
+ <xsl:element name="office:binary-data">
+ <xsl:value-of select="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$gid]/uof:æ•°æ®"/>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="xlink:href"><xsl:value-of select="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$gid]/uof:路径"/></xsl:attribute>
+ <xsl:attribute name="xlink:type">simple</xsl:attribute>
+ <xsl:attribute name="xlink:actuate">onLoad</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="日期域">
+ <xsl:if test="following-sibling::å­—:域代ç /å­—:段è½/å­—:å¥/å­—:文本串">
+ <xsl:variable name="date0" select="substring-after(following-sibling::å­—:域代ç /å­—:段è½/å­—:å¥/å­—:文本串,'\@ ')"/>
+ <xsl:variable name="datestr">
+ <xsl:choose>
+ <xsl:when test="contains($date0,'\*')">
+ <xsl:value-of select="string(substring-before($date0,'\*'))"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$date0"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:call-template name="zydate">
+ <xsl:with-param name="str1" select="substring($datestr,2,string-length($datestr)-2)"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="zydate">
+ <xsl:param name="str1"/>
+ <xsl:choose>
+ <xsl:when test="substring($str1,1,5)='am/pm'">
+ <xsl:variable name="str1-before" select="substring($str1,1,5)"/>
+ <xsl:variable name="str1-after" select="substring($str1,6)"/>
+ <number:am-pm/>
+ <xsl:if test="not($str1-after)=''">
+ <number:text>
+ <xsl:value-of select="substring($str1-after,1,1)"/>
+ </number:text>
+ </xsl:if>
+ <xsl:if test="string-length($str1-after)&gt;1">
+ <xsl:call-template name="zytime">
+ <xsl:with-param name="str1" select="substring($str1-after,2)"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+
+ <xsl:choose>
+ <xsl:when test="substring($str1,1,4)='yyyy'">
+ <xsl:variable name="str1-before" select="substring($str1,1,4)"/>
+ <xsl:variable name="str1-after" select="substring($str1,5)"/>
+ <number:year number:style="long"/>
+ <number:text>
+ <xsl:value-of select="substring($str1-after,1,1)"/>
+ </number:text>
+ <xsl:if test="string-length($str1-after)&gt;1">
+ <xsl:call-template name="zydate">
+ <xsl:with-param name="str1" select="substring($str1-after,2)"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="substring($str1,1,1)=substring($str1,2,1) and substring($str1,2,1) !=substring($str1,3,1) ">
+ <xsl:variable name="str1-before" select="substring($str1,1,2)"/>
+ <xsl:variable name="str1-after" select="substring($str1,3)"/>
+ <xsl:if test="substring($str1,1,1)='y'">
+ <number:year/>
+ </xsl:if>
+ <xsl:if test="substring($str1,1,1)='M'">
+ <number:month number:style="long"/>
+ </xsl:if>
+ <xsl:if test="substring($str1,1,1)='d'">
+ <number:day number:style="long"/>
+ </xsl:if>
+ <xsl:if test="substring($str1,1,1)='h'">
+ <number:hours number:style="long"/>
+ </xsl:if>
+ <xsl:if test="substring($str1,1,1)='m'">
+ <number:minutes number:style="long"/>
+ </xsl:if>
+ <xsl:if test="substring($str1,1,1)='s'">
+ <number:seconds number:style="long"/>
+ </xsl:if>
+ <xsl:if test="substring($str1,1,1)='W'">
+ <number:week-of-year number:style="long"/>
+ </xsl:if>
+ <number:text>
+ <xsl:value-of select="substring($str1-after,1,1)"/>
+ </number:text>
+ <xsl:if test="string-length($str1-after)&gt;1">
+ <xsl:call-template name="zydate">
+ <xsl:with-param name="str1" select="substring($str1-after,2)"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="substring($str1,1,1)='M'or substring($str1,1,1)='d'or substring($str1,1,1)='h'or substring($str1,1,1)='m'or substring($str1,1,1)='s'">
+ <xsl:variable name="str1-after" select="substring($str1,2)"/>
+ <xsl:variable name="str1-before" select="substring($str1,1,1)"/>
+ <xsl:if test="substring($str1,1,1)='M'">
+ <number:month/>
+ <number:text>
+ <xsl:value-of select="substring($str1-after,1,1)"/>
+ </number:text>
+ </xsl:if>
+ <xsl:if test="substring($str1,1,1)='d'">
+ <number:day/>
+ <number:text>
+ <xsl:value-of select="substring($str1-after,1,1)"/>
+ </number:text>
+ </xsl:if>
+ <xsl:if test="substring($str1,1,1)='h'">
+ <number:hours/>
+ <number:text>
+ <xsl:value-of select="substring($str1-after,1,1)"/>
+ </number:text>
+ </xsl:if>
+ <xsl:if test="substring($str1,1,1)='m'">
+ <number:minutes/>
+ <number:text>
+ <xsl:value-of select="substring($str1-after,1,1)"/>
+ </number:text>
+ </xsl:if>
+ <xsl:if test="substring($str1,1,1)='s'">
+ <number:seconds/>
+ <number:text>
+ <xsl:value-of select="substring($str1-after,1,1)"/>
+ </number:text>
+ </xsl:if>
+ <xsl:if test="string-length($str1-after)&gt;1">
+ <xsl:call-template name="zydate">
+ <xsl:with-param name="str1" select="substring($str1-after,2)"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="contains(substring($str1,1,3),'Q' )">
+ <xsl:choose>
+ <xsl:when test="substring($str1,1,1)='Q'">
+ <xsl:variable name="str1-before" select="substring($str1,1,2)"/>
+ <xsl:variable name="str1-after" select="substring($str1,3)"/>
+ <number:quarter/>
+ <number:text>
+ <xsl:value-of select="substring($str1-after,1,1)"/>
+ </number:text>
+ <xsl:if test="string-length($str1-after)&gt;1">
+ <xsl:call-template name="zydate">
+ <xsl:with-param name="str1" select="substring($str1-after,2)"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="str1-before" select="substring($str1,1,5)"/>
+ <xsl:variable name="str1-after" select="substring($str1,6)"/>
+ <number:quarter number:style="long"/>
+ <number:text>
+ <xsl:value-of select="substring($str1-after,1,1)"/>
+ </number:text>
+ <xsl:if test="string-length($str1-after)&gt;1">
+ <xsl:call-template name="zydate">
+ <xsl:with-param name="str1" select="substring($str1-after,2)"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="contains(substring(normalize-space($str1),1,3),'W' )">
+ <xsl:variable name="str1-before" select="substring(normalize-space($str1),1,3)"/>
+ <xsl:variable name="str1-after" select="substring(normalize-space($str1),4)"/>
+ <number:day-of-week number:style="long"/>
+ <number:text>
+ <xsl:value-of select="substring($str1-after,1,1)"/>
+ </number:text>
+ <xsl:if test="string-length($str1-after)&gt;1">
+ <xsl:call-template name="zydate">
+ <xsl:with-param name="str1" select="substring($str1-after,2)"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="contains(substring($str1,1,3),'NN' ) and substring($str1,1,1)!='NN' ">
+ <xsl:variable name="str1-before" select="substring($str1,1,3)"/>
+ <xsl:variable name="str1-after" select="substring($str1,4)"/>
+ <number:text>第</number:text>
+ <number:week-of-year/>
+ <number:text>周</number:text>
+ <xsl:if test="string-length($str1-after)&gt;1">
+ <xsl:call-template name="zydate">
+ <xsl:with-param name="str1" select="substring($str1-after,2)"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="时间域">
+ <xsl:if test="following-sibling::å­—:域代ç /å­—:段è½/å­—:å¥/å­—:文本串">
+ <xsl:variable name="date0" select="substring-after(following-sibling::å­—:域代ç /å­—:段è½/å­—:å¥/å­—:文本串,'\@ ')"/>
+ <xsl:variable name="datestr" select="$date0"/>
+ <xsl:call-template name="zytime">
+ <xsl:with-param name="str1" select="substring($datestr,2,string-length($datestr)-2)"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="zytime">
+ <xsl:param name="str1"/>
+ <xsl:choose>
+ <xsl:when test="substring($str1,1,5)='am/pm'">
+ <xsl:variable name="str1-before" select="substring($str1,1,5)"/>
+ <xsl:variable name="str1-after" select="substring($str1,6)"/>
+ <number:am-pm/>
+ <xsl:if test="not($str1-after)=''">
+ <number:text>
+ <xsl:value-of select="substring($str1-after,1,1)"/>
+ </number:text>
+ </xsl:if>
+ <xsl:if test="string-length($str1-after)&gt;1">
+ <xsl:call-template name="zytime">
+ <xsl:with-param name="str1" select="substring($str1-after,2)"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="substring($str1,1,1)=substring($str1,2,1) and substring($str1,2,1) !=substring($str1,3,1) ">
+ <xsl:variable name="str1-before" select="substring($str1,1,2)"/>
+ <xsl:variable name="str1-after" select="substring($str1,3)"/>
+ <xsl:if test="substring($str1,1,1)='H' or substring($str1,1,1)='h'">
+ <number:hours number:style="long"/>
+ </xsl:if>
+ <xsl:if test="substring($str1,1,1)='M' or substring($str1,1,1)='m'">
+ <number:minutes number:style="long"/>
+ </xsl:if>
+ <xsl:if test="substring($str1,1,1)='S' or substring($str1,1,1)='s'">
+ <number:seconds number:style="long"/>
+ </xsl:if>
+ <number:text>
+ <xsl:value-of select="substring($str1-after,1,1)"/>
+ </number:text>
+ <xsl:if test="string-length($str1-after)&gt;1">
+ <xsl:call-template name="zytime">
+ <xsl:with-param name="str1" select="substring($str1-after,2)"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="substring($str1,1,1)='H'or substring($str1,1,1)='M'or substring($str1,1,1)='S'or substring($str1,1,1)='h' or substring($str1,1,1)='m' or substring($str1,1,1)='s'">
+ <xsl:variable name="str1-after" select="substring($str1,2)"/>
+ <xsl:variable name="str1-before" select="substring($str1,1,1)"/>
+ <xsl:if test="substring($str1,1,1)='H' or substring($str1,1,1)='h'">
+ <number:hours/>
+ <number:text>
+ <xsl:value-of select="substring($str1-after,1,1)"/>
+ </number:text>
+ </xsl:if>
+ <xsl:if test="substring($str1,1,1)='M' or substring($str1,1,1)='m'">
+ <number:minutes/>
+ <number:text>
+ <xsl:value-of select="substring($str1-after,1,1)"/>
+ </number:text>
+ </xsl:if>
+ <xsl:if test="substring($str1,1,1)='S' or substring($str1,1,1)='s'">
+ <number:seconds/>
+ <number:text>
+ <xsl:value-of select="substring($str1-after,1,1)"/>
+ </number:text>
+ </xsl:if>
+ <xsl:if test="string-length($str1-after)&gt;1">
+ <xsl:call-template name="zytime">
+ <xsl:with-param name="str1" select="substring($str1-after,2)"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="ooæ•°å­—æ ¼å¼åŸŸå¼€å…³">
+ <xsl:param name="oo_format"/>
+ <xsl:choose>
+ <xsl:when test="$oo_format='Arabic'">1</xsl:when>
+ <xsl:when test="$oo_format='ROMAN'">I</xsl:when>
+ <xsl:when test="$oo_format='roman'">i</xsl:when>
+ <xsl:when test="$oo_format='ALPHABETIC'">A</xsl:when>
+ <xsl:when test="$oo_format='alphabetic'">a</xsl:when>
+ <xsl:when test="$oo_format='GB1'">1, 2, 3, ...</xsl:when>
+ <xsl:when test="$oo_format='GB3'">â‘ , â‘¡, â‘¢, ...</xsl:when>
+ <xsl:when test="$oo_format='CHINESENUM3'">一, 二, 三, ...</xsl:when>
+ <xsl:when test="$oo_format='CHINESENUM2'">壹, è´°, å, ...</xsl:when>
+ <xsl:when test="$oo_format='ZODIAC1'">甲, 乙, 丙, ...</xsl:when>
+ <xsl:when test="$oo_format='ZODIAC2'">å­, 丑, 寅, ...</xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="题注">
+ <xsl:if test="../å­—:域代ç /å­—:段è½/å­—:å¥/å­—:文本串 or å­—:域代ç /å­—:段è½/å­—:å¥/å­—:文本串">
+ <xsl:variable name="aa" select="substring-after(../å­—:域代ç /å­—:段è½/å­—:å¥/å­—:文本串,'\f ')"/>
+ <xsl:variable name="ooow" select="substring-after($aa,'ooow:') "/>
+ <xsl:variable name="as" select="substring-before(../å­—:域代ç /å­—:段è½/å­—:å¥/å­—:文本串,' \* ')"/>
+ <xsl:variable name="ad">
+ <xsl:value-of select="substring-after($as,'SEQ ') "/>
+ </xsl:variable>
+ <xsl:variable name="num">
+ <xsl:value-of select="substring-after(substring-before(../å­—:域代ç /å­—:段è½/å­—:å¥/å­—:文本串,' \f'),'\* ')"/>
+ </xsl:variable>
+ <xsl:variable name="fmt">
+ <xsl:call-template name="ooæ•°å­—æ ¼å¼åŸŸå¼€å…³">
+ <xsl:with-param name="oo_format" select="$num"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:element name="text:sequence">
+ <xsl:attribute name="text:name"><xsl:choose><xsl:when test="$ad='表格'">Table</xsl:when><xsl:when test="$ad='图表'">Drawing</xsl:when><xsl:otherwise><xsl:value-of select="$ad"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="text:formula"><xsl:choose><xsl:when test="contains($aa,'ooow:')"><xsl:value-of select="$ooow"/></xsl:when><xsl:when test="contains($as,'表格')"><xsl:value-of select="concat('Table','+',$fmt)"/></xsl:when><xsl:when test="contains($as,'图表')"><xsl:value-of select="concat('Drawing','+',$fmt)"/></xsl:when><xsl:otherwise><xsl:value-of select="$aa"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="style:num-format"><xsl:value-of select="$fmt"/></xsl:attribute>
+ <xsl:value-of select="following-sibling::å­—:å¥/å­—:文本串"/>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="页ç åŸŸ">
+ <xsl:if test="../å­—:域代ç /å­—:段è½/å­—:å¥/å­—:文本串 or å­—:域代ç /å­—:段è½/å­—:å¥/å­—:文本串">
+ <xsl:variable name="date0" select="substring-after(../å­—:域代ç /å­—:段è½/å­—:å¥/å­—:文本串,' \* ')"/>
+ <xsl:variable name="datestr" select="substring-before(../å­—:域代ç /å­—:段è½/å­—:å¥/å­—:文本串,'\* ')"/>
+ <xsl:variable name="fmt">
+ <xsl:call-template name="ooæ•°å­—æ ¼å¼åŸŸå¼€å…³">
+ <xsl:with-param name="oo_format" select="$date0"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:element name="text:page-number">
+ <xsl:attribute name="style:num-format"><xsl:value-of select="$fmt"/></xsl:attribute>
+ <xsl:attribute name="text:select-page">current</xsl:attribute>
+ <xsl:value-of select="following-sibling::å­—:å¥/å­—:文本串"/>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="页数域">
+ <xsl:if test="../å­—:域代ç /å­—:段è½/å­—:å¥/å­—:文本串">
+ <xsl:variable name="date0" select="substring-after(../å­—:域代ç /å­—:段è½/å­—:å¥/å­—:文本串,' \* ')"/>
+ <xsl:variable name="datestr" select="substring-before(../å­—:域代ç /å­—:段è½/å­—:å¥/å­—:文本串,'\* ')"/>
+ <xsl:variable name="fmt">
+ <xsl:call-template name="ooæ•°å­—æ ¼å¼åŸŸå¼€å…³">
+ <xsl:with-param name="oo_format" select="substring-before($date0,' \*')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:element name="text:page-count">
+ <xsl:attribute name="style:num-format"><xsl:value-of select="$fmt"/></xsl:attribute>
+ <xsl:value-of select="following-sibling::å­—:å¥/å­—:文本串"/>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="作者域">
+ <xsl:if test="../å­—:域代ç /å­—:段è½/å­—:å¥/å­—:文本串">
+ <xsl:variable name="date0" select="substring-after(../å­—:域代ç /å­—:段è½/å­—:å¥/å­—:文本串,' \* ')"/>
+ <xsl:variable name="datestr" select="substring-before(../å­—:域代ç /å­—:段è½/å­—:å¥/å­—:文本串,'\* ')"/>
+ <xsl:element name="text:initial-creator">
+ <xsl:value-of select="following-sibling::å­—:å¥/å­—:文本串"/>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="用户域">
+ <xsl:if test="../å­—:域代ç /å­—:段è½/å­—:å¥/å­—:文本串">
+ <xsl:variable name="date0" select="substring-after(../å­—:域代ç /å­—:段è½/å­—:å¥/å­—:文本串,' \* ')"/>
+ <xsl:variable name="datestr" select="substring-before(../å­—:域代ç /å­—:段è½/å­—:å¥/å­—:文本串,'\* ')"/>
+ <xsl:element name="text:author-name">
+ <xsl:value-of select="following-sibling::å­—:å¥/å­—:文本串"/>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="缩写域">
+ <xsl:if test="../å­—:域代ç /å­—:段è½/å­—:å¥/å­—:文本串">
+ <xsl:variable name="date0" select="substring-after(../å­—:域代ç /å­—:段è½/å­—:å¥/å­—:文本串,' \* ')"/>
+ <xsl:variable name="datestr" select="substring-before(../å­—:域代ç /å­—:段è½/å­—:å¥/å­—:文本串,'\* ')"/>
+ <xsl:element name="text:author-initials">
+ <xsl:value-of select="following-sibling::å­—:å¥/å­—:文本串"/>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="标题域">
+ <xsl:if test="../å­—:域代ç /å­—:段è½/å­—:å¥/å­—:文本串">
+ <xsl:variable name="date0" select="substring-after(../å­—:域代ç /å­—:段è½/å­—:å¥/å­—:文本串,' \* ')"/>
+ <xsl:variable name="datestr" select="substring-before(../å­—:域代ç /å­—:段è½/å­—:å¥/å­—:文本串,'\* ')"/>
+ <xsl:element name="text:title">
+ <xsl:value-of select="following-sibling::å­—:å¥/å­—:文本串"/>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="主题域">
+ <xsl:if test="../å­—:域代ç /å­—:段è½/å­—:å¥/å­—:文本串">
+ <xsl:variable name="date0" select="substring-after(../å­—:域代ç /å­—:段è½/å­—:å¥/å­—:文本串,' \* ')"/>
+ <xsl:variable name="datestr" select="substring-before(../å­—:域代ç /å­—:段è½/å­—:å¥/å­—:文本串,'\* ')"/>
+ <xsl:element name="text:subject">
+ <xsl:value-of select="following-sibling::å­—:å¥/å­—:文本串"/>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="文件å">
+ <xsl:if test="../å­—:域代ç /å­—:段è½/å­—:å¥/å­—:文本串">
+ <xsl:element name="text:file-name">
+ <xsl:variable name="string">
+ <xsl:value-of select="../å­—:域代ç /å­—:段è½/å­—:å¥/å­—:文本串"/>
+ </xsl:variable>
+ <xsl:attribute name="text:display"><xsl:choose><xsl:when test="contains($string,' \p')">full</xsl:when><xsl:otherwise>name-and-extension</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:value-of select="following-sibling::å­—:å¥/å­—:文本串"/>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="编辑时间">
+ <xsl:if test="../å­—:域代ç /å­—:段è½/å­—:å¥/å­—:文本串">
+ <xsl:variable name="date0" select="substring-after(following-sibling::å­—:域代ç /å­—:段è½/å­—:å¥/å­—:文本串,'\@ ')"/>
+ <xsl:variable name="datestr" select="$date0"/>
+ <xsl:call-template name="zytime">
+ <xsl:with-param name="str1" select="substring($datestr,2,string-length($datestr)-2)"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="创建时间">
+ <xsl:if test="../å­—:域代ç /å­—:段è½/å­—:å¥/å­—:文本串">
+ <xsl:variable name="date0" select="substring-after(following-sibling::å­—:域代ç /å­—:段è½/å­—:å¥/å­—:文本串,'\@ ')"/>
+ <xsl:variable name="datestr" select="$date0"/>
+ <xsl:call-template name="zytime">
+ <xsl:with-param name="str1" select="substring($datestr,2,string-length($datestr)-2)"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="字符数">
+ <xsl:if test="../å­—:域代ç /å­—:段è½/å­—:å¥/å­—:文本串">
+ <xsl:variable name="date0" select="substring-after(../å­—:域代ç /å­—:段è½/å­—:å¥/å­—:文本串,' \* ')"/>
+ <xsl:variable name="datestr" select="substring-before(../å­—:域代ç /å­—:段è½/å­—:å¥/å­—:文本串,'\* ')"/>
+ <xsl:variable name="fmt">
+ <xsl:call-template name="ooæ•°å­—æ ¼å¼åŸŸå¼€å…³">
+ <xsl:with-param name="oo_format" select="substring-before($date0,' \#')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:element name="text:character-count">
+ <xsl:attribute name="style:num-format"><xsl:value-of select="$fmt"/></xsl:attribute>
+ <xsl:value-of select="following-sibling::å­—:å¥/å­—:文本串"/>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:key name="mulu" match="/uof:UOF/uof:å¼æ ·é›†/uof:段è½å¼æ ·" use="@å­—:标识符"/>
+ <xsl:template name="索引域">
+ <xsl:element name="text:alphabetical-index">
+ <xsl:variable name="stylenum">
+ <xsl:number from="/uof:UOF/uof:文字处ç†/å­—:主体" level="any" count="å­—:å¥" format="1"/>
+ </xsl:variable>
+ <xsl:attribute name="text:style-name"><xsl:value-of select="concat('Sect',$stylenum)"/></xsl:attribute>
+ <xsl:variable name="aanum">
+ <xsl:number value="0" format="1"/>
+ </xsl:variable>
+ <xsl:attribute name="text:name"><xsl:value-of select="concat('索引目录',$aanum + 1)"/></xsl:attribute>
+ <text:alphabetical-index-source text:main-entry-style-name="Main_index_entry" text:sort-algorithm="pinyin" fo:language="zh" fo:country="CN">
+ <text:index-title-template text:style-name="Index_20_Heading">索引目录</text:index-title-template>
+ <text:alphabetical-index-entry-template text:outline-level="separator" text:style-name="Index_Separator">
+ <text:index-entry-text/>
+ </text:alphabetical-index-entry-template>
+ <text:alphabetical-index-entry-template text:outline-level="1" text:style-name="Index_20_1">
+ <text:index-entry-text/>
+ <text:index-entry-tab-stop style:type="right" style:leader-char="."/>
+ <text:index-entry-page-number/>
+ </text:alphabetical-index-entry-template>
+ <text:alphabetical-index-entry-template text:outline-level="2" text:style-name="Index_20_2">
+ <text:index-entry-text/>
+ <text:index-entry-tab-stop style:type="right" style:leader-char="."/>
+ <text:index-entry-page-number/>
+ </text:alphabetical-index-entry-template>
+ <text:alphabetical-index-entry-template text:outline-level="3" text:style-name="Index_20_3">
+ <text:index-entry-text/>
+ <text:index-entry-tab-stop style:type="right" style:leader-char="."/>
+ <text:index-entry-page-number/>
+ </text:alphabetical-index-entry-template>
+ </text:alphabetical-index-source>
+ <text:index-body>
+ <text:index-title>
+ <xsl:attribute name="text:style-name"><xsl:value-of select="concat('Sect',$stylenum)"/></xsl:attribute>
+ <xsl:attribute name="text:name"><xsl:value-of select="concat('索引目录',$aanum + 1,'_Head')"/></xsl:attribute>
+ <xsl:for-each select="å­—:域代ç /å­—:段è½[position()=2]">
+ <text:p text:style-name="Index_20_Heading">
+ <xsl:apply-templates select=".//字:文本串"/>
+ </text:p>
+ </xsl:for-each>
+ </text:index-title>
+ <xsl:if test="字:域开始/@字:类型='INDEX'">
+ <xsl:for-each select="å­—:域代ç /å­—:段è½[position()>2]">
+ <xsl:element name="text:p">
+ <xsl:variable name="aa">
+ <xsl:number from="/uof:UOF/uof:文字处ç†/å­—:主体" level="any" count="å­—:段è½[å­—:段è½å±žæ€§]"/>
+ </xsl:variable>
+ <xsl:attribute name="text:style-name"><xsl:value-of select="concat('P',$aa + 1)"/></xsl:attribute>
+ <xsl:for-each select="å­—:å¥">
+ <xsl:apply-templates select="self::node()/*"/>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:if>
+ </text:index-body>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="目录域">
+ <xsl:element name="text:table-of-content">
+ <xsl:variable name="stylenum">
+ <xsl:number from="/uof:UOF/uof:文字处ç†/å­—:主体" level="any" count="å­—:å¥" format="1"/>
+ </xsl:variable>
+ <xsl:attribute name="text:style-name"><xsl:value-of select="concat('Sect',$stylenum)"/></xsl:attribute>
+ <xsl:variable name="aanum">
+ <xsl:number value="0" format="1"/>
+ </xsl:variable>
+ <xsl:attribute name="text:name"><xsl:value-of select="concat('内容目录',$aanum + 1)"/></xsl:attribute>
+ <text:table-of-content-source text:outline-level="10">
+ <text:index-title-template text:style-name="Contents_20_Heading">内容目录</text:index-title-template>
+ <text:table-of-content-entry-template text:outline-level="1" text:style-name="Contents 1">
+ <text:index-entry-link-start text:style-name="Index_20_Link"/>
+ <text:index-entry-chapter/>
+ <text:index-entry-text/>
+ <text:index-entry-tab-stop style:type="right" style:leader-char="."/>
+ <text:index-entry-page-number/>
+ <text:index-entry-link-end/>
+ </text:table-of-content-entry-template>
+ <text:table-of-content-entry-template text:outline-level="2" text:style-name="Contents 2">
+ <text:index-entry-link-start text:style-name="Index_20_Link"/>
+ <text:index-entry-chapter/>
+ <text:index-entry-text/>
+ <text:index-entry-tab-stop style:type="right" style:leader-char="."/>
+ <text:index-entry-page-number/>
+ <text:index-entry-link-end/>
+ </text:table-of-content-entry-template>
+ <text:table-of-content-entry-template text:outline-level="3" text:style-name="Contents 3">
+ <text:index-entry-link-start text:style-name="Index_20_Link"/>
+ <text:index-entry-chapter/>
+ <text:index-entry-text/>
+ <text:index-entry-tab-stop style:type="right" style:leader-char="."/>
+ <text:index-entry-page-number/>
+ <text:index-entry-link-end/>
+ </text:table-of-content-entry-template>
+ <text:table-of-content-entry-template text:outline-level="4" text:style-name="Contents 4">
+ <text:index-entry-link-start text:style-name="Index_20_Link"/>
+ <text:index-entry-chapter/>
+ <text:index-entry-text/>
+ <text:index-entry-tab-stop style:type="right" style:leader-char="."/>
+ <text:index-entry-page-number/>
+ <text:index-entry-link-end/>
+ </text:table-of-content-entry-template>
+ <text:table-of-content-entry-template text:outline-level="5" text:style-name="Contents 5">
+ <text:index-entry-link-start text:style-name="Index_20_Link"/>
+ <text:index-entry-chapter/>
+ <text:index-entry-text/>
+ <text:index-entry-tab-stop style:type="right" style:leader-char="."/>
+ <text:index-entry-page-number/>
+ <text:index-entry-link-end/>
+ </text:table-of-content-entry-template>
+ <text:table-of-content-entry-template text:outline-level="6" text:style-name="Contents 6">
+ <text:index-entry-link-start text:style-name="Index_20_Link"/>
+ <text:index-entry-chapter/>
+ <text:index-entry-text/>
+ <text:index-entry-tab-stop style:type="right" style:leader-char="."/>
+ <text:index-entry-page-number/>
+ <text:index-entry-link-end/>
+ </text:table-of-content-entry-template>
+ <text:table-of-content-entry-template text:outline-level="7" text:style-name="Contents 7">
+ <text:index-entry-link-start text:style-name="Index_20_Link"/>
+ <text:index-entry-chapter/>
+ <text:index-entry-text/>
+ <text:index-entry-tab-stop style:type="right" style:leader-char="."/>
+ <text:index-entry-page-number/>
+ <text:index-entry-link-end/>
+ </text:table-of-content-entry-template>
+ <text:table-of-content-entry-template text:outline-level="8" text:style-name="Contents 8">
+ <text:index-entry-link-start text:style-name="Index_20_Link"/>
+ <text:index-entry-chapter/>
+ <text:index-entry-text/>
+ <text:index-entry-tab-stop style:type="right" style:leader-char="."/>
+ <text:index-entry-page-number/>
+ <text:index-entry-link-end/>
+ </text:table-of-content-entry-template>
+ <text:table-of-content-entry-template text:outline-level="9" text:style-name="Contents 9">
+ <text:index-entry-link-start text:style-name="Index_20_Link"/>
+ <text:index-entry-chapter/>
+ <text:index-entry-text/>
+ <text:index-entry-tab-stop style:type="right" style:leader-char="."/>
+ <text:index-entry-page-number/>
+ <text:index-entry-link-end/>
+ </text:table-of-content-entry-template>
+ <text:table-of-content-entry-template text:outline-level="10" text:style-name="Contents 10">
+ <text:index-entry-link-start text:style-name="Index_20_Link"/>
+ <text:index-entry-chapter/>
+ <text:index-entry-text/>
+ <text:index-entry-tab-stop style:type="right" style:leader-char="."/>
+ <text:index-entry-page-number/>
+ <text:index-entry-link-end/>
+ </text:table-of-content-entry-template>
+ </text:table-of-content-source>
+ <text:index-body>
+ <text:index-title>
+ <xsl:attribute name="text:style-name"><xsl:value-of select="concat('Sect',$stylenum)"/></xsl:attribute>
+ <xsl:attribute name="text:name"><xsl:value-of select="concat('内容目录',$aanum + 1,'_Head')"/></xsl:attribute>
+ <xsl:for-each select="å­—:域代ç /å­—:段è½[position()=2]">
+ <text:p text:style-name="Contents_20_Heading">
+ <xsl:apply-templates select=".//字:文本串"/>
+ </text:p>
+ </xsl:for-each>
+ </text:index-title>
+ <xsl:if test="字:域开始/@字:类型='REF'">
+ <xsl:for-each select="å­—:域代ç /å­—:段è½[position()>2]">
+ <xsl:element name="text:p">
+ <xsl:variable name="aa">
+ <xsl:number from="/uof:UOF/uof:文字处ç†/å­—:主体" level="any" count="å­—:段è½[å­—:段è½å±žæ€§]"/>
+ </xsl:variable>
+ <xsl:attribute name="text:style-name"><xsl:value-of select="concat('P',$aa + 1)"/></xsl:attribute>
+ <xsl:element name="text:a">
+ <xsl:attribute name="xlink:type">simple</xsl:attribute>
+ <xsl:attribute name="text:style-name">Index Link</xsl:attribute>
+ <xsl:attribute name="text:visited-style-name">Index Link</xsl:attribute>
+ <xsl:variable name="hyperDest" select="./å­—:å¥/å­—:区域开始/@å­—:标识符"/>
+ <xsl:attribute name="xlink:href"><xsl:for-each select="/uof:UOF/uof:链接集/uof:超级链接"><xsl:if test="@uof:链æº=$hyperDest"><xsl:value-of select="concat('#',@uof:书签)"/></xsl:if></xsl:for-each></xsl:attribute>
+ <xsl:apply-templates select="å­—:å¥/*"/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:if>
+ </text:index-body>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="suojinleixing">
+ <xsl:if test="å­—:缩进/å­—:首行/å­—:ç»å¯¹/@å­—:值 and å­—:缩进/å­—:å·¦/å­—:ç»å¯¹/@å­—:值">
+ <xsl:attribute name="text:min-label-width"><xsl:value-of select="concat(0 - å­—:缩进/å­—:首行/å­—:ç»å¯¹/@å­—:值,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="text:space-before"><xsl:value-of select="concat(å­—:缩进/å­—:å·¦/å­—:ç»å¯¹/@å­—:值 + å­—:缩进/å­—:首行/å­—:ç»å¯¹/@å­—:值,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="字:修订开始[@字:类型='insert']">
+ <xsl:choose>
+ <xsl:when test="./@字:标识符">
+ <text:change-start text:change-id="{@字:标识符}"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <text:change-start text:change-id="{@å­—:修订信æ¯å¼•ç”¨}"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="å­—:修订结æŸ[preceding::å­—:修订开始[1]/@å­—:类型='insert']">
+ <text:change-end>
+ <xsl:attribute name="text:change-id"><xsl:value-of select="@字:开始标识引用"/></xsl:attribute>
+ </text:change-end>
+ </xsl:template>
+ <xsl:template match="字:修订开始[@字:类型='delete']">
+ <xsl:choose>
+ <xsl:when test="./@字:标识符">
+ <text:change-start text:change-id="{@字:标识符}"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <text:change-start text:change-id="{@å­—:修订信æ¯å¼•ç”¨}"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="å­—:修订结æŸ[preceding::å­—:修订开始[1]/@å­—:类型='delete']">
+ <text:change-end>
+ <xsl:attribute name="text:change-id"><xsl:value-of select="@字:开始标识引用"/></xsl:attribute>
+ </text:change-end>
+ </xsl:template>
+ <xsl:template match="字:修订开始[@字:类型='format']">
+ <xsl:choose>
+ <xsl:when test="./@字:标识符">
+ <text:change-start text:change-id="{@字:标识符}"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <text:change-start text:change-id="{@å­—:修订信æ¯å¼•ç”¨}"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="å­—:修订结æŸ[preceding::å­—:修订开始[1]/@å­—:类型='format']">
+ <text:change-end>
+ <xsl:attribute name="text:change-id"><xsl:value-of select="@字:开始标识引用"/></xsl:attribute>
+ </text:change-end>
+ </xsl:template>
+ <xsl:template name="GenerateTrackChanges">
+ <text:tracked-changes>
+ <xsl:if test="/uof:UOF/uof:文字处ç†/å­—:公用处ç†è§„则/å­—:文档设置/å­—:修订">
+ <xsl:attribute name="text:track-changes"><xsl:value-of select="/uof:UOF/uof:文字处ç†/å­—:公用处ç†è§„则/å­—:文档设置/å­—:修订/@å­—:值"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="//å­—:段è½/å­—:修订开始[@å­—:类型='insert']">
+ <xsl:for-each select="//å­—:段è½/å­—:修订开始[@å­—:类型='insert']">
+ <xsl:variable name="id" select="@字:标识符"/>
+ <xsl:variable name="aid" select="/uof:UOF/uof:文字处ç†/å­—:公用处ç†è§„则/å­—:修订信æ¯é›†/å­—:修订信æ¯[@å­—:标识符=$id]/@å­—:作者"/>
+ <xsl:variable name="sid" select="/uof:UOF/uof:文字处ç†/å­—:公用处ç†è§„则/å­—:用户集/å­—:用户[@å­—:标识符=$aid]/@å­—:姓å"/>
+ <xsl:variable name="bid" select="/uof:UOF/uof:文字处ç†/å­—:公用处ç†è§„则/å­—:修订信æ¯é›†/å­—:修订信æ¯[@å­—:标识符=$id]/@å­—:日期"/>
+ <text:changed-region text:id="{$id}">
+ <xsl:choose>
+ <xsl:when test="name()='字:修订开始'">
+ <xsl:choose>
+ <xsl:when test="not(name(following-sibling::node()[1])='å­—:修订结æŸ')">
+ <text:insertion>
+ <office:change-info>
+ <dc:creator>
+ <xsl:value-of select="$sid"/>
+ </dc:creator>
+ <dc:date>
+ <xsl:value-of select="$bid"/>
+ </dc:date>
+ </office:change-info>
+ </text:insertion>
+ </xsl:when>
+ <xsl:otherwise>
+ <text:format-change>
+ <office:change-info>
+ <dc:creator>
+ <xsl:value-of select="$sid"/>
+ </dc:creator>
+ <dc:date>
+ <xsl:value-of select="$bid"/>
+ </dc:date>
+ </office:change-info>
+ </text:format-change>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ </xsl:choose>
+ </text:changed-region>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:if test="//å­—:段è½/å­—:修订开始[@å­—:类型='insert']">
+ <xsl:for-each select="//å­—:段è½/å­—:修订开始[@å­—:类型='delete']">
+ <xsl:variable name="id" select="@字:标识符"/>
+ <xsl:variable name="aid" select="/uof:UOF/uof:文字处ç†/å­—:公用处ç†è§„则/å­—:修订信æ¯é›†/å­—:修订信æ¯[@å­—:标识符=$id]/@å­—:作者"/>
+ <xsl:variable name="sid" select="/uof:UOF/uof:文字处ç†/å­—:公用处ç†è§„则/å­—:用户集/å­—:用户[@å­—:标识符=$aid]/@å­—:姓å"/>
+ <xsl:variable name="bid" select="/uof:UOF/uof:文字处ç†/å­—:公用处ç†è§„则/å­—:修订信æ¯é›†/å­—:修订信æ¯[@å­—:标识符=$id]/@å­—:日期"/>
+ <text:changed-region text:id="{$id}">
+ <xsl:choose>
+ <xsl:when test="name()='字:修订开始'">
+ <xsl:choose>
+ <xsl:when test="not(name(following-sibling::node()[1])='å­—:修订结æŸ')">
+ <text:deletion>
+ <office:change-info>
+ <dc:creator>
+ <xsl:value-of select="$sid"/>
+ </dc:creator>
+ <dc:date>
+ <xsl:value-of select="$bid"/>
+ </dc:date>
+ </office:change-info>
+ </text:deletion>
+ </xsl:when>
+ <xsl:otherwise>
+ <text:format-change>
+ <office:change-info>
+ <dc:creator>
+ <xsl:value-of select="$sid"/>
+ </dc:creator>
+ <dc:date>
+ <xsl:value-of select="$bid"/>
+ </dc:date>
+ </office:change-info>
+ </text:format-change>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ </xsl:choose>
+ </text:changed-region>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:if test="//å­—:段è½/å­—:修订开始[@å­—:类型='format']">
+ <xsl:for-each select="//å­—:段è½/å­—:修订开始[@å­—:类型='format']">
+ <xsl:variable name="id" select="@字:标识符"/>
+ <xsl:variable name="aid" select="/uof:UOF/uof:文字处ç†/å­—:公用处ç†è§„则/å­—:修订信æ¯é›†/å­—:修订信æ¯[@å­—:标识符=$id]/@å­—:作者"/>
+ <xsl:variable name="sid" select="/uof:UOF/uof:文字处ç†/å­—:公用处ç†è§„则/å­—:用户集/å­—:用户[@å­—:标识符=$aid]/@å­—:姓å"/>
+ <xsl:variable name="bid" select="/uof:UOF/uof:文字处ç†/å­—:公用处ç†è§„则/å­—:修订信æ¯é›†/å­—:修订信æ¯[@å­—:标识符=$id]/@å­—:日期"/>
+ <text:changed-region text:id="{$id}">
+ <xsl:choose>
+ <xsl:when test="name()='字:修订开始'">
+ <xsl:choose>
+ <xsl:when test="not(name(following-sibling::node()[1])='å­—:修订结æŸ')">
+ <text:format-change>
+ <office:change-info>
+ <dc:creator>
+ <xsl:value-of select="$sid"/>
+ </dc:creator>
+ <dc:date>
+ <xsl:value-of select="$bid"/>
+ </dc:date>
+ </office:change-info>
+ </text:format-change>
+ </xsl:when>
+ <xsl:otherwise>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ </xsl:choose>
+ </text:changed-region>
+ </xsl:for-each>
+ </xsl:if>
+
+ </text:tracked-changes>
+
+ </xsl:template>
+ <xsl:template name="ooæ•°å­—æ ¼å¼">
+ <xsl:param name="oo_format"/>
+ <xsl:choose>
+ <xsl:when test="$oo_format='decimal'">1</xsl:when>
+ <xsl:when test="$oo_format='upper-roman'">I</xsl:when>
+ <xsl:when test="$oo_format='lower-roman'">i</xsl:when>
+ <xsl:when test="$oo_format='upper-letter'">A</xsl:when>
+ <xsl:when test="$oo_format='lower-letter'">a</xsl:when>
+ <xsl:when test="$oo_format='decimal-full-width'">1, 2, 3, ...</xsl:when>
+ <xsl:when test="$oo_format='decimal-enclosed-circle'">â‘ , â‘¡, â‘¢, ...</xsl:when>
+ <xsl:when test="$oo_format='chinese-counting'">一, 二, 三, ...</xsl:when>
+ <xsl:when test="$oo_format='chinese-legal-simplified'">壹, è´°, å, ...</xsl:when>
+ <xsl:when test="$oo_format='ideograph-traditional'">甲, 乙, 丙, ...</xsl:when>
+ <xsl:when test="$oo_format='ideograph-zodiac'">å­, 丑, 寅, ...</xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="章节域">
+ <xsl:if test="../å­—:域代ç /å­—:段è½/å­—:å¥/å­—:文本串">
+ <xsl:variable name="date0" select="substring-after(../å­—:域代ç /å­—:段è½/å­—:å¥/å­—:文本串,' \* ')"/>
+ <xsl:variable name="datestr" select="substring-before(../å­—:域代ç /å­—:段è½/å­—:å¥/å­—:文本串,'\* ')"/>
+ <xsl:variable name="fmt">
+ <xsl:choose>
+ <xsl:when test="substring-before($date0,' \*')='Arabic'">
+ <xsl:call-template name="ooæ•°å­—æ ¼å¼åŸŸå¼€å…³">
+ <xsl:with-param name="oo_format" select="substring-before($date0,' \*')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:element name="text:chapter">
+ <xsl:attribute name="text:display">name</xsl:attribute>
+ <xsl:attribute name="text:outline-level"><xsl:value-of select="$fmt"/></xsl:attribute>
+ <xsl:value-of select="following-sibling::å­—:å¥/å­—:文本串"/>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/filter/source/xslt/import/wordml/wordml2ooo.xsl b/filter/source/xslt/import/wordml/wordml2ooo.xsl
new file mode 100644
index 000000000000..1f36f195f3cd
--- /dev/null
+++ b/filter/source/xslt/import/wordml/wordml2ooo.xsl
@@ -0,0 +1,348 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="w wx aml o dt v" xmlns:fla="urn:experimental:fla">
+ <xsl:output method="xml" indent="no" encoding="UTF-8" version="1.0"/>
+ <xsl:include href="../../common/measure_conversion.xsl"/>
+ <xsl:include href="../common/ms2ooo_docpr.xsl"/>
+ <xsl:include href="wordml2ooo_text.xsl"/>
+ <xsl:include href="wordml2ooo_settings.xsl"/>
+ <xsl:include href="wordml2ooo_table.xsl"/>
+ <xsl:include href="wordml2ooo_page.xsl"/>
+ <xsl:include href="wordml2ooo_list.xsl"/>
+ <xsl:include href="wordml2ooo_draw.xsl"/>
+ <xsl:include href="wordml2ooo_field.xsl"/>
+ <xsl:include href="wordml2ooo_props.xsl"/>
+ <xsl:key name="paragraph-style" match="w:style[@w:type = 'paragraph']" use="@w:styleId"/>
+ <xsl:key name="heading-style" match="w:style[@w:type = 'paragraph' and w:pPr/w:outlineLvl]" use="@w:styleId"/>
+ <xsl:variable name="preserve-alien-markup">no</xsl:variable>
+ <xsl:variable name="native-namespace-prefixes">,w,o,v,wx,aml,w10,dt,</xsl:variable>
+ <xsl:variable name="to-dispatch-elements">,wx:sect,wx:sub-section,w:p,w:tbl,w:sectPr,w:r,w:fldSimple,w:hlink,w:t,w:pict,w:br,w:instrText,w:fldChar,w:tab,w:footnote,w:endnote,aml:annotation,w:hlink,w:footnote,w:endnote,w:tblGrid,w:tr,w:tc,wx:pBdrGroup,</xsl:variable>
+ <xsl:template match="/">
+ <xsl:apply-templates select="w:wordDocument"/>
+ </xsl:template>
+ <xsl:template match="*" mode="dispatch">
+ <xsl:choose>
+ <xsl:when test="not(contains($native-namespace-prefixes, concat(',', substring-before(name(), ':'), ',')))">
+ <!-- if alien namespace dispatch -->
+ <xsl:choose>
+ <xsl:when test="$preserve-alien-markup = 'yes'">
+ <xsl:copy>
+ <xsl:copy-of select="@*"/>
+ <xsl:apply-templates mode="dispatch"/>
+ </xsl:copy>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates mode="dispatch"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="contains($to-dispatch-elements, concat(',',name(),','))">
+ <xsl:apply-templates select="current()"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="w:wordDocument">
+ <office:document office:mimetype="application/vnd.oasis.opendocument.text" office:version="1.0">
+ <fla:fla.activate/>
+ <xsl:apply-templates select="o:DocumentProperties"/>
+ <xsl:apply-templates select="w:docOleData" mode="init"/>
+ <xsl:apply-templates select="w:docPr"/>
+ <xsl:apply-templates select="w:fonts"/>
+ <xsl:apply-templates select="w:styles"/>
+ <xsl:apply-templates select="w:body"/>
+ <xsl:apply-templates select="w:docOleData" mode="exit"/>
+ </office:document>
+ </xsl:template>
+ <xsl:template match="w:fonts">
+ <xsl:element name="office:font-face-decls">
+ <!-- MS Word's default font declaration, added for Writer automatically. glu -->
+ <style:font-face style:name="Arial" svg:font-family="Arial" style:font-family-generic="roman" style:font-pitch="variable"/>
+ <style:font-face style:name="Times New Roman" svg:font-family="'Times New Roman'" style:font-family-generic="roman" style:font-pitch="variable"/>
+ <style:font-face style:name="Symbol" svg:font-family="Symbol" style:font-family-generic="roman" style:font-pitch="variable" style:font-charset="x-symbol"/>
+ <style:font-face style:name="Courier New" svg:font-family="'Courier New'" style:font-family-generic="modern" style:font-pitch="fixed"/>
+ <xsl:if test="not(w:font[@w:name='StarSymbol'])">
+ <style:font-face style:name="StarSymbol" svg:font-family="StarSymbol" style:font-charset="x-symbol"/>
+ </xsl:if>
+ <xsl:for-each select="w:font">
+ <xsl:element name="style:font-face">
+ <xsl:attribute name="style:name">
+ <xsl:value-of select="@w:name"/>
+ </xsl:attribute>
+ <xsl:attribute name="svg:font-family">
+ <xsl:value-of select="@w:name"/>
+ </xsl:attribute>
+ <!-- added by glu, for process special fonts e.g. Marlett, -->
+ <xsl:if test="w:charset/@w:val = '02'">
+ <xsl:attribute name="style:font-charset">x-symbol</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:family">
+ <xsl:choose>
+ <xsl:when test="w:family/@w:val = 'Swiss'">
+ <xsl:attribute name="style:font-family-generic">swiss</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:family/@w:val='Modern'">
+ <xsl:attribute name="style:font-family-generic">modern</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:family/@w:val='Roman'">
+ <xsl:attribute name="style:font-family-generic">roman</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:family/@w:val='Script'">
+ <xsl:attribute name="style:font-family-generic">script</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:family/@w:val='Decorative'">
+ <xsl:attribute name="style:font-family-generic">decorative</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:family/@w:val='System'">
+ <xsl:attribute name="style:font-family-generic">system</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:font-family-generic">system</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="w:pitch and string-length(w:pitch/@w:val) &gt; 0">
+ <xsl:attribute name="style:font-pitch">
+ <xsl:choose>
+ <xsl:when test="w:pitch/@w:val = 'default'">variable</xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="w:pitch/@w:val"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="w:styles">
+ <office:styles>
+ <!--The next statement Added by wguo,collect the pict's dash and mark-style.The template is implemented in file wordml2ooo_draw.xsl-->
+ <xsl:apply-templates select="/w:wordDocument/w:body//w:pict" mode="style4dash_mark"/>
+ <xsl:apply-templates select="//v:fill" mode="office-style"/>
+ <xsl:call-template name="create-default-paragraph-styles"/>
+ <xsl:call-template name="create-default-text-styles"/>
+ <xsl:call-template name="create-default-frame-style"/>
+ <!-- StarWriter has no default style family 'list'. glu -->
+ <xsl:if test="w:style[@w:type = 'paragraph' and w:pPr/w:outlineLvl and w:pPr/w:listPr]">
+ <xsl:call-template name="create-outline-style"/>
+ </xsl:if>
+ <xsl:apply-templates select="w:style[@w:type='table']" mode="table"/>
+ <xsl:apply-templates select="w:style[@w:type='list']" mode="list"/>
+ <xsl:apply-templates select="w:style[@w:type!='list']"/>
+ <xsl:apply-templates select="/w:wordDocument/w:docPr/w:footnotePr" mode="config"/>
+ <xsl:apply-templates select="/w:wordDocument/w:docPr/w:endnotePr" mode="config"/>
+ </office:styles>
+ <office:automatic-styles>
+ <xsl:apply-templates select="/w:wordDocument/w:body//w:p" mode="style"/>
+ <xsl:apply-templates select="/w:wordDocument/w:body//w:rPr[not(parent::w:pPr)]" mode="style"/>
+ <!--The next statement Added by wguo for the pict's draw-style.The template is implemented in file wordml2ooo_draw.xsl-->
+ <xsl:apply-templates select="/w:wordDocument/w:body//w:pict" mode="style"/>
+ <xsl:apply-templates select="/w:wordDocument/w:body//w:tblPr" mode="style"/>
+ <xsl:apply-templates select="/w:wordDocument/w:body//w:gridCol" mode="style"/>
+ <xsl:apply-templates select="/w:wordDocument/w:body//w:trPr" mode="style"/>
+ <xsl:apply-templates select="/w:wordDocument/w:body//w:tcPr" mode="style"/>
+ <xsl:apply-templates select="/w:wordDocument/w:body//w:listPr" mode="style"/>
+ <xsl:apply-templates select="/w:wordDocument/w:body//w:sectPr" mode="page-layout"/>
+ <xsl:call-template name="default_date_style"/>
+ <!--add for generate the date , time style for date , time field G.Y.-->
+ <xsl:apply-templates select="/w:wordDocument/w:body//w:instrText | /w:wordDocument/w:body//w:fldSimple " mode="style"/>
+ </office:automatic-styles>
+ <office:master-styles>
+ <xsl:apply-templates select="/w:wordDocument/w:body//w:sectPr" mode="master-page"/>
+ </office:master-styles>
+ </xsl:template>
+ <xsl:template match="w:style">
+ <style:style>
+ <xsl:attribute name="style:name">
+ <xsl:value-of select="concat('w',translate(@w:styleId,' ~`!@#$%^*(&#x26;)+/,;?&lt;&gt;{}[]:','_'))"/>
+ </xsl:attribute>
+ <xsl:if test="w:basedOn">
+ <xsl:attribute name="style:parent-style-name">
+ <xsl:value-of select="concat('w',translate(w:basedOn/@w:val,' ~`!@#$%^*(&#x26;)+/,;?&lt;&gt;{}[]:','_'))"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:next">
+ <xsl:attribute name="style:next-style-name">
+ <xsl:value-of select="concat('w',translate(w:basedOn/@w:val,' ~`!@#$%^*(&#x26;)+/,;?&lt;&gt;{}[]:','_'))"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="@w:type = 'character'">
+ <xsl:attribute name="style:family">text</xsl:attribute>
+ </xsl:when>
+ <!-- table, paragraph are the same as in Writer . glu -->
+ <xsl:when test="@w:type">
+ <xsl:attribute name="style:family">
+ <xsl:value-of select="@w:type"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:family">text</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="@w:type = 'table'">
+ <xsl:element name="style:table-properties">
+ <!-- xsl:apply-templates select="w:tblPr" mode="style"/ -->
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="@w:type = 'character' ">
+ <xsl:element name="style:text-properties">
+<!--
+ <xsl:apply-templates select="w:pPr/w:rPr"/>
+ <xsl:apply-templates select="w:rPr"/>
+-->
+ <xsl:for-each select="w:rPr">
+ <xsl:call-template name="text-properties"/>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="style:paragraph-properties">
+ <xsl:apply-templates select="w:pPr"/>
+ </xsl:element>
+ <xsl:element name="style:text-properties">
+ <xsl:apply-templates select="w:rPr"/>
+ <xsl:apply-templates select="w:pPr/w:rPr"/>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </style:style>
+ </xsl:template>
+ <xsl:template match="w:body">
+ <xsl:element name="office:body">
+ <xsl:element name="office:text">
+ <!-- to add the sequece variable declaration at the begining of the office:body G.Y.-->
+ <text:sequence-decls>
+ <xsl:call-template name="default_seqence_declaration"/>
+ <xsl:apply-templates select="/w:wordDocument/w:body//w:instrText[substring(normalize-space(text()),1,3) = 'SEQ' ] | /w:wordDocument/w:body//w:fldSimple[substring(normalize-space(@w:instr),1,3) = 'SEQ' ] " mode="sequence_declare"/>
+ </text:sequence-decls>
+ <!-- add the user field variables declare for Docpropety fields importing G.Y.-->
+ <text:user-field-decls>
+ <xsl:call-template name="user_fields_declare_docproperty"/>
+ </text:user-field-decls>
+ <xsl:apply-templates mode="dispatch"/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="wx:sect">
+ <xsl:apply-templates mode="dispatch"/>
+ </xsl:template>
+ <xsl:template match="wx:sub-section">
+ <xsl:apply-templates mode="dispatch"/>
+ </xsl:template>
+ <xsl:template name="create-default-frame-style">
+ <!--add for default frame style -->
+ <style:style style:name="Frame" style:family="graphic">
+ <style:graphic-properties text:anchor-type="paragraph" svg:x="0in" svg:y="0in" style:wrap="parallel" style:number-wrapped-paragraphs="no-limit" style:wrap-contour="false" style:vertical-pos="top" style:vertical-rel="paragraph-content" style:horizontal-pos="center" style:horizontal-rel="paragraph-content"/>
+ </style:style>
+ </xsl:template>
+ <xsl:template name="ConvertMeasure">
+ <xsl:param name="TargetMeasure" select="'cm'"/>
+ <xsl:param name="TargetTruncate" select=" 'all' "/>
+ <xsl:param name="value"/>
+ <!-- When TargetTruncate ='all' it returns the number whichsoever the return value is negative or positive
+ When TargetTruncate ='nonNegative' it only returns nonNegative number, all negative number to be returned as 0
+ When TargetTruncate ='positive" it only returns positive number, all nonPositive number to be returned as 1 -->
+ <xsl:variable name="return_value">
+ <xsl:choose>
+ <!-- remove the measure mark, if the value is null, the result should be 0. Must be the first case -->
+ <xsl:when test="string-length(translate($value,'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ','')) = 0">0</xsl:when>
+ <xsl:when test="string-length(translate($value,'-.0123456789 ','')) = 0">
+ <xsl:value-of select="$value"/>
+ </xsl:when>
+ <xsl:when test="$TargetMeasure = 'cm'">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="$value"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$TargetMeasure = 'pt'">
+ <xsl:call-template name="convert2pt">
+ <xsl:with-param name="value" select="$value"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$TargetMeasure = 'twip'">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="$value"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$TargetMeasure = 'in'">
+ <xsl:call-template name="convert2in">
+ <xsl:with-param name="value" select="$value"/>
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$TargetTruncate = 'all' ">
+ <xsl:choose>
+ <xsl:when test="number($TargetMeasure) = 'NaN' ">
+ <xsl:value-of select=" '0' "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$return_value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$TargetTruncate = 'nonNegative' ">
+ <xsl:choose>
+ <xsl:when test="number($TargetMeasure) = 'NaN' ">
+ <xsl:value-of select=" '0' "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test=" $return_value &lt; 0 ">
+ <xsl:value-of select=" '0' "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$return_value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$TargetTruncate = 'positive' ">
+ <xsl:choose>
+ <xsl:when test="number($TargetMeasure) = 'NaN' ">
+ <xsl:value-of select=" '1' "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test=" $return_value &lt;= 0 ">
+ <xsl:value-of select=" '1' "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$return_value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/filter/source/xslt/import/wordml/wordml2ooo_custom_draw.xsl b/filter/source/xslt/import/wordml/wordml2ooo_custom_draw.xsl
new file mode 100644
index 000000000000..118c63301774
--- /dev/null
+++ b/filter/source/xslt/import/wordml/wordml2ooo_custom_draw.xsl
@@ -0,0 +1,284 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="w wx aml o dt fo v">
+ <xsl:template name="ms_word_draw_map2ooo_custom_draw">
+ <xsl:param name="ms_word_draw_type"/>
+ <!-- all ooo draw names are get from EnhancedCustomShapeGeometry.idl-->
+ <xsl:choose>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t5' ">
+ <xsl:value-of select=" 'isosceles-triangle'"/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type ='#_x0000_t6' ">
+ <xsl:value-of select=" 'right-triangle' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t8' ">
+ <xsl:value-of select=" 'trapezoid' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t4' ">
+ <xsl:value-of select=" 'diamond' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t9' ">
+ <xsl:value-of select=" 'hexagon' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t7' ">
+ <xsl:value-of select="'parallelogram' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t56' ">
+ <xsl:value-of select=" 'pentagon' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t10' ">
+ <xsl:value-of select=" 'octagon' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t11' ">
+ <xsl:value-of select=" 'cross' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t23' ">
+ <xsl:value-of select=" 'ring' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t95' ">
+ <xsl:value-of select=" 'block-arc' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t22' ">
+ <xsl:value-of select=" 'can' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t16' ">
+ <xsl:value-of select=" 'cube' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t65' ">
+ <xsl:value-of select=" 'paper' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t96' ">
+ <xsl:value-of select=" 'smiley' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t183' ">
+ <xsl:value-of select=" 'sun' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t184' ">
+ <xsl:value-of select=" 'moon' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t74' ">
+ <xsl:value-of select=" 'heart' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t57' ">
+ <xsl:value-of select=" 'forbidden' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type ='#_x0000_t85' ">
+ <xsl:value-of select=" 'left-bracket' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t86' ">
+ <xsl:value-of select=" 'right-bracket' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t87' ">
+ <xsl:value-of select=" 'left-brace' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t88' ">
+ <xsl:value-of select=" 'right-brace' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t185' ">
+ <xsl:value-of select=" 'bracket-pair' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t186' ">
+ <xsl:value-of select=" 'brace-pair' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t189' ">
+ <xsl:value-of select=" 'quad-bevel' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t66' ">
+ <xsl:value-of select=" 'left-arrow' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t67' ">
+ <xsl:value-of select=" 'down-arrow' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t68' ">
+ <xsl:value-of select=" 'up-arrow' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t13' ">
+ <xsl:value-of select=" 'right-arrow' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t69' ">
+ <xsl:value-of select=" 'left-right-arrow' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t70' ">
+ <xsl:value-of select=" 'up-down-arrow' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t89' ">
+ <xsl:value-of select=" 'mso-spt89' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t76' ">
+ <xsl:value-of select=" 'quad-arrow' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t94' ">
+ <xsl:value-of select=" 'notched-right-arrow' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t177' ">
+ <xsl:value-of select=" 'pentagon-right' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t55' ">
+ <xsl:value-of select=" 'chevron' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t79' ">
+ <xsl:value-of select=" 'up-arrow-callout' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t80' ">
+ <xsl:value-of select=" 'down-arrow-callout' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t82' ">
+ <xsl:value-of select=" 'up-down-arrow-callout' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t103' ">
+ <xsl:value-of select=" 'circular-arrow' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t109' ">
+ <xsl:value-of select=" 'flowchart-process' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t116' ">
+ <xsl:value-of select=" 'flowchart-alternate-process' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t110' ">
+ <xsl:value-of select=" 'flowchart-decision' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t111' ">
+ <xsl:value-of select=" 'flowchart-data' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t112' ">
+ <xsl:value-of select=" 'flowchart-predefined-process' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t113' ">
+ <xsl:value-of select=" 'flowchart-internal-storage' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t114' ">
+ <xsl:value-of select=" 'flowchart-document' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t115' ">
+ <xsl:value-of select=" 'flowchart-multidocument' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t116' ">
+ <xsl:value-of select=" 'flowchart-terminator' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t117' ">
+ <xsl:value-of select=" 'flowchart-preparation' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t118' ">
+ <xsl:value-of select=" 'flowchart-manual-input' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t119' ">
+ <xsl:value-of select=" 'flowchart-manual-operation' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t120' ">
+ <xsl:value-of select=" 'flowchart-connector' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t177' ">
+ <xsl:value-of select=" 'flowchart-off-page-connector' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t121' ">
+ <xsl:value-of select=" 'flowchart-card' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t122' ">
+ <xsl:value-of select=" 'flowchart-punched-tape' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t123' ">
+ <xsl:value-of select=" 'flowchart-summing-junction' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t124' ">
+ <xsl:value-of select=" 'flowchart-or' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t125' ">
+ <xsl:value-of select=" 'flowchart-collate' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t126' ">
+ <xsl:value-of select=" 'flowchart-sort' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t127' ">
+ <xsl:value-of select=" 'flowchart-extract' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t128' ">
+ <xsl:value-of select=" 'flowchart-merge' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t130' ">
+ <xsl:value-of select=" 'flowchart-stored-data' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t135' ">
+ <xsl:value-of select=" 'flowchart-delay' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t131' ">
+ <xsl:value-of select=" 'flowchart-sequential-access' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t132' ">
+ <xsl:value-of select=" 'flowchart-magnetic-disk' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t133' ">
+ <xsl:value-of select=" 'flowchart-direct-access-storage' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t134' ">
+ <xsl:value-of select=" 'flowchart-display' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t61' ">
+ <xsl:value-of select=" 'rectangular-callout' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t62' ">
+ <xsl:value-of select=" 'round-rectangular-callout' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t63' ">
+ <xsl:value-of select=" 'round-callout' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t106' ">
+ <xsl:value-of select=" 'cloud-callout' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t50' ">
+ <xsl:value-of select=" 'line-callout-1' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t51' ">
+ <xsl:value-of select=" 'line-callout-2' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t47' ">
+ <xsl:value-of select=" 'line-callout-3' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t72' ">
+ <xsl:value-of select=" 'bang' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t187' ">
+ <xsl:value-of select=" 'star4' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t12' ">
+ <xsl:value-of select=" 'star5' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t58' ">
+ <xsl:value-of select=" 'star8' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t92' ">
+ <xsl:value-of select=" 'star24' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t97' ">
+ <xsl:value-of select=" 'vertical-scroll' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t98' ">
+ <xsl:value-of select=" 'horizontal-scroll' "/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/filter/source/xslt/import/wordml/wordml2ooo_draw.xsl b/filter/source/xslt/import/wordml/wordml2ooo_draw.xsl
new file mode 100644
index 000000000000..e0737d1374fa
--- /dev/null
+++ b/filter/source/xslt/import/wordml/wordml2ooo_draw.xsl
@@ -0,0 +1,2213 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xalan="http://xml.apache.org/xalan" xmlns:oleextracter="MyOleExtracter" xmlns:ole="java:XSLTFilterOLEExtracter" xmlns:java="http://saxon.sf.net/java-type" exclude-result-prefixes="w wx aml o dt v xalan ole oleextracter java" extension-element-prefixes="oleextracter">
+ <xsl:include href="wordml2ooo_custom_draw.xsl"/>
+ <xsl:include href="wordml2ooo_path.xsl"/>
+ <xsl:param name="oleExtractor" as="java:XSLTFilterOLEExtracter" select="ole:new()"/>
+ <xsl:param name="XMultiServiceFactory" as="java:com.sun.star.lang.XMultiServiceFactory" select="ole:init($oleExtractor, 'uno:socket,host=localhost,port=8100;urp;StarOffice.ServiceManager')"/>
+
+
+ <xsl:key name="imagedata" match="w:binData" use="@w:name"/>
+ <xsl:key name="shapetype" match="v:shapetype" use="concat('#', @id)"/>
+ <xsl:template match="v:fill" mode="get-xsl-number">
+ <xsl:number from="/w:wordDocument/w:body" level="any" count="v:fill" format="1"/>
+ </xsl:template>
+ <xsl:template match="v:textpath" mode="get-xsl-number">
+ <xsl:number from="/w:wordDocument/w:body" level="any" count="v:textpath" format="1"/>
+ </xsl:template>
+ <xsl:template match="v:fill" mode="office-style">
+ <xsl:choose>
+ <xsl:when test="@type='pattern' or @type='tile' or @type='frame'">
+ <xsl:variable name="fill-src" select="key('imagedata',@src)"/>
+ <xsl:if test="$fill-src">
+ <draw:fill-image>
+ <xsl:if test="string-length(@o:title) &gt; 0">
+ <xsl:attribute name="draw:name">
+ <xsl:value-of select="@o:title"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="draw:name">
+ <xsl:value-of select="translate(@src,'&#9;&#10;&#13;&#32;:/.','' ) "/>
+ </xsl:attribute>
+ <xsl:element name="office:binary-data">
+ <xsl:value-of select="translate($fill-src/text(),'&#9;&#10;&#13;&#32;','' ) "/>
+ </xsl:element>
+ </draw:fill-image>
+ </xsl:if>
+ </xsl:when>
+ <xsl:when test="contains(@type,'gradient')">
+ <draw:gradient>
+ <xsl:attribute name="draw:name">
+ <xsl:value-of select=" 'gradient' "/>
+ <xsl:number from="/w:wordDocument/w:body" level="any" count="v:fill" format="1"/>
+ </xsl:attribute>
+ <xsl:attribute name="draw:style">linear</xsl:attribute>
+ <xsl:if test="string-length(parent::v:*/@fillcolor) &gt; 0">
+ <xsl:attribute name="draw:start-color">
+ <xsl:call-template name="MapConstColor">
+ <xsl:with-param name="color" select="parent::v:*/@fillcolor"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="string-length(@color2) &gt; 0">
+ <xsl:attribute name="draw:end-color">
+ <xsl:call-template name="MapConstColor">
+ <xsl:with-param name="color" select="@color2"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ </draw:gradient>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="w:pict" mode="style4dash_mark">
+ <xsl:if test="descendant::v:line or descendant::v:rect or descendant::v:oval or descendant::v:arc or descendant::v:shape">
+ <!--Changed-->
+ <xsl:variable name="vchild" select="./v:*"/>
+ <xsl:variable name="def" select="$vchild/v:stroke"/>
+ <xsl:if test="$def">
+ <!--<draw:marker draw:name="Stupid33" svg:viewBox="0 0 20 30" svg:d="m10 0-10 30h20z"/> -->
+ <xsl:variable name="wdashstyle" select="$vchild/v:stroke/@dashstyle"/>
+ <xsl:variable name="stroke-num">
+ <xsl:number from="/w:wordDocument/w:body" level="any" count="v:stroke" format="1"/>
+ </xsl:variable>
+ <xsl:variable name="ptweight">
+ <xsl:choose>
+ <xsl:when test="$vchild/@strokeweight">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="'pt'"/>
+ <xsl:with-param name="value" select="$vchild/@strokeweight"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="'pt'"/>
+ <xsl:with-param name="value" select="'1pt'"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="$wdashstyle and not ($wdashstyle = 'solid')">
+ <xsl:variable name="strdashdot">
+ <xsl:call-template name="getstrdashdot">
+ <xsl:with-param name="dashstyle" select="$wdashstyle"/>
+ <!--<xsl:with-param name="weight" select="$vchild/@strokeweight"/>-->
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="draw-style">
+ <xsl:variable name="end-cap" select="$vchild/v:stroke/@endcap"/>
+ <xsl:choose>
+ <xsl:when test="$end-cap = 'round'">round</xsl:when>
+ <xsl:otherwise>rect</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="dot1-length">
+ <xsl:call-template name="get-middle-substring">
+ <xsl:with-param name="string" select="$strdashdot"/>
+ <xsl:with-param name="prefix" select="'dol:'"/>
+ <xsl:with-param name="suffix" select="';don'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="dot1n">
+ <xsl:call-template name="get-middle-substring">
+ <xsl:with-param name="string" select="$strdashdot"/>
+ <xsl:with-param name="prefix" select="'don:'"/>
+ <xsl:with-param name="suffix" select="';dist'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="dist-length">
+ <xsl:call-template name="get-middle-substring">
+ <xsl:with-param name="string" select="$strdashdot"/>
+ <xsl:with-param name="prefix" select="'dist:'"/>
+ <xsl:with-param name="suffix" select="';dtl'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="dot2-length">
+ <xsl:call-template name="get-middle-substring">
+ <xsl:with-param name="string" select="$strdashdot"/>
+ <xsl:with-param name="prefix" select="'dtl:'"/>
+ <xsl:with-param name="suffix" select="';dtn'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="dot2n">
+ <xsl:call-template name="get-middle-substring">
+ <xsl:with-param name="string" select="$strdashdot"/>
+ <xsl:with-param name="prefix" select="'dtn:'"/>
+ <xsl:with-param name="suffix" select="';eddtn'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:element name="draw:stroke-dash">
+ <!--dol:8;don:1;dist:2;dtl:1;dtn:2;eddtn" />-->
+ <xsl:attribute name="draw:name">
+ <xsl:value-of select="concat('Tdash',$stroke-num)"/>
+ </xsl:attribute>
+ <xsl:attribute name="draw:style">
+ <xsl:value-of select="$draw-style"/>
+ </xsl:attribute>
+ <xsl:if test="(string-length($dot1n) &gt; 0 ) and not ($dot1n ='-1')">
+ <xsl:attribute name="draw:dots1">
+ <xsl:value-of select="$dot1n"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="(string-length($dot2n) &gt; 0 ) and not ($dot2n ='-1')">
+ <xsl:attribute name="draw:dots2">
+ <xsl:value-of select="$dot2n"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="(string-length($dot1-length) &gt; 0 ) and not ($dot1-length ='-1')">
+ <xsl:attribute name="draw:dots1-length">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="'in'"/>
+ <xsl:with-param name="value" select="concat($dot1-length,'pt')"/>
+ </xsl:call-template>in</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="(string-length($dot2-length) &gt; 0 ) and not ($dot2-length ='-1')">
+ <xsl:attribute name="draw:dots2-length">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="'in'"/>
+ <xsl:with-param name="value" select="concat($dot2-length,'pt')"/>
+ </xsl:call-template>in</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="(string-length($dist-length) &gt; 0 ) and not ($dist-length ='-1')">
+ <xsl:variable name="valdistance-length">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="'in'"/>
+ <xsl:with-param name="value" select="concat($dist-length,'pt')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="draw:distance">
+ <xsl:value-of select="$valdistance-length*$ptweight"/>in</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="$vchild/v:stroke/@startarrow">
+ <xsl:call-template name="CreateArrowStyle">
+ <xsl:with-param name="arrow-name" select="$vchild/v:stroke/@startarrow"/>
+ <xsl:with-param name="namenumber" select="concat('markerstart',$stroke-num)"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="$vchild/v:stroke/@endarrow">
+ <xsl:call-template name="CreateArrowStyle">
+ <xsl:with-param name="arrow-name" select="$vchild/v:stroke/@endarrow"/>
+ <xsl:with-param name="namenumber" select="concat('markerend',$stroke-num)"/>
+ </xsl:call-template>
+ </xsl:if>
+ <!--<v:stroke dashstyle="1 1" startarrow="diamond" startarrowwidth="wide" startarrowlength="long" endarrow="block"
+ endarrowwidth="wide" endarrowlength="long" endcap="round"/>
+ <draw:stroke-dash draw:name="2 2dots 1 dash" draw:style="rect" draw:dots1="2" draw:dots2="1" draw:dots2-length="0.0795in"
+ draw:distance="0.102in"/>
+ Hehe,It need to be revised-->
+ </xsl:if>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="CreateArrowStyle">
+ <!--<draw:marker draw:name="Stupid33" svg:viewBox="0 0 20 30" svg:d="m10 0-10 30h20z"/> -->
+ <xsl:param name="arrow-name"/>
+ <xsl:param name="namenumber"/>
+ <xsl:param name="arrow-weight"/>
+ <xsl:variable name="svg-box">
+ <xsl:choose>
+ <xsl:when test="$arrow-name = 'block' ">0 0 1131 902</xsl:when>
+ <xsl:when test="$arrow-name = 'diamond' ">0 0 10 10</xsl:when>
+ <xsl:when test="$arrow-name = 'open' ">0 0 1122 2243</xsl:when>
+ <xsl:when test="$arrow-name = 'oval' ">0 0 1131 1131</xsl:when>
+ <xsl:when test="$arrow-name = 'diamond' ">0 0 1131 1131</xsl:when>
+ <xsl:when test="$arrow-name = 'classic' ">0 0 1131 1580</xsl:when>
+ <xsl:otherwise>0 0 1122 2243</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="svg-d">
+ <xsl:choose>
+ <xsl:when test="$arrow-name = 'block' ">m564 0-564 902h1131z</xsl:when>
+ <!--Symmetric Arrow-->
+ <xsl:when test="$arrow-name = 'diamond' ">m0 0h10v10h-10z</xsl:when>
+ <xsl:when test="$arrow-name = 'open' ">m0 2108v17 17l12 42 30 34 38 21 43 4 29-8 30-21 25-26 13-34 343-1532 339 1520 13 42 29 34 39 21 42 4 42-12 34-30 21-42v-39-12l-4 4-440-1998-9-42-25-39-38-25-43-8-42 8-38 25-26 39-8 42z</xsl:when>
+ <xsl:when test="$arrow-name = 'oval' ">m462 1118-102-29-102-51-93-72-72-93-51-102-29-102-13-105 13-102 29-106 51-102 72-89 93-72 102-50 102-34 106-9 101 9 106 34 98 50 93 72 72 89 51 102 29 106 13 102-13 105-29 102-51 102-72 93-93 72-98 51-106 29-101 13z</xsl:when>
+ <xsl:when test="$arrow-name = 'diamond' ">m0 564 564 567 567-567-567-564z</xsl:when>
+ <xsl:when test="$arrow-name = 'classic' ">m1013 1491 118 89-567-1580-564 1580 114-85 136-68 148-46 161-17 161 13 153 46z</xsl:when>
+ <xsl:otherwise>m0 2108v17 17l12 42 30 34 38 21 43 4 29-8 30-21 25-26 13-34 343-1532 339 1520 13 42 29 34 39 21 42 4 42-12 34-30 21-42v-39-12l-4 4-440-1998-9-42-25-39-38-25-43-8-42 8-38 25-26 39-8 42z</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:element name="draw:marker">
+ <xsl:attribute name="draw:name">
+ <xsl:value-of select="$namenumber"/>
+ </xsl:attribute>
+ <xsl:attribute name="draw:display-name">
+ <xsl:value-of select="$namenumber"/>
+ </xsl:attribute>
+ <xsl:attribute name="svg:viewBox">
+ <xsl:value-of select="$svg-box"/>
+ </xsl:attribute>
+ <xsl:attribute name="svg:d">
+ <xsl:value-of select="$svg-d"/>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:template>
+ <!-- The template MapDashConst Map the const dashstyle to a number manner
+ It calls the template kickblanks to delete the extra blanks in the dash style here is the map
+• Solid (default) • ShortDash "2 2"
+• ShortDot "0 2" • ShortDashDot "2 2 0 2"
+• ShortDashDotDot "2 2 0 2 0 2" • Dot "1 2"
+• Dash "4 2" • LongDash "8 2"
+• DashDot "4 2 1 2"• LongDashDot "8 2 1 2"
+• LongDashDotDot "8 2 1 2 1 2"
+-->
+ <xsl:template name="MapDashConst">
+ <xsl:param name="dashstyle"/>
+ <xsl:choose>
+ <xsl:when test="$dashstyle='shortDash'"> 2 2 </xsl:when>
+ <xsl:when test="$dashstyle='shortDot'"> 0 2 </xsl:when>
+ <xsl:when test="$dashstyle='shortDashDot'"> 2 2 0 2 </xsl:when>
+ <xsl:when test="$dashstyle='shortDashDotDot'"> 2 2 0 2 0 2 </xsl:when>
+ <xsl:when test="$dashstyle='dot'"> 1 2 </xsl:when>
+ <xsl:when test="$dashstyle='dash'"> 4 2 </xsl:when>
+ <xsl:when test="$dashstyle='longDash'"> 8 2 </xsl:when>
+ <xsl:when test="$dashstyle='dashDot'"> 4 2 1 2 </xsl:when>
+ <xsl:when test="$dashstyle='longDashDot'"> 8 2 1 2 </xsl:when>
+ <xsl:when test="$dashstyle='longDashDotDot'"> 8 2 1 2 1 2 </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="str-style" select="concat(' ',$dashstyle ,' ')"/>
+ <xsl:variable name="cleanstyle">
+ <xsl:call-template name="kickblanks">
+ <xsl:with-param name="str" select="translate($str-style,' ','-')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="translate($cleanstyle,'-',' ')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!--The template is used to delete the extra blanks from a string.-->
+ <xsl:template name="kickblanks">
+ <xsl:param name="str"/>
+ <xsl:variable name="tmpstr">
+ <xsl:choose>
+ <xsl:when test="contains($str,'--')">
+ <xsl:variable name="str-before">
+ <xsl:value-of select="substring-before($str,'--')"/>
+ </xsl:variable>
+ <xsl:variable name="str-after">
+ <xsl:value-of select="substring-after($str,'--')"/>
+ </xsl:variable>
+ <xsl:value-of select="concat($str-before,'-',$str-after)"/>
+ </xsl:when>
+ <xsl:when test="contains($str,' ')">
+ <xsl:variable name="str-before">
+ <xsl:value-of select="substring-before($str,' ')"/>
+ </xsl:variable>
+ <xsl:variable name="str-after">
+ <xsl:value-of select="substring-after($str,' ')"/>
+ </xsl:variable>
+ <xsl:value-of select="concat($str-before,' ',$str-after)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$str"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="not ( string-length($str) = string-length($tmpstr) )">
+ <xsl:variable name="restr">
+ <xsl:call-template name="kickblanks">
+ <xsl:with-param name="str" select="$tmpstr"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="$restr"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$str"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="substrcount">
+ <xsl:param name="str"/>
+ <xsl:param name="substr"/>
+ <xsl:choose>
+ <xsl:when test="$substr and string-length($str) and contains($str,$substr) and string-length(substring-before($str,$substr)) = 0">
+ <xsl:variable name="restr" select="substring-after($str,$substr)"/>
+ <xsl:variable name="num">
+ <xsl:call-template name="substrcount">
+ <xsl:with-param name="str" select="$restr"/>
+ <xsl:with-param name="substr" select="$substr"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="$num+1"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="lastest-substr-after">
+ <xsl:param name="str"/>
+ <xsl:param name="substr"/>
+ <xsl:choose>
+ <xsl:when test="contains($str,$substr) and string-length(substring-before($str,$substr)) = 0">
+ <xsl:variable name="restr" select="substring-after($str,$substr)"/>
+ <xsl:call-template name="lastest-substr-after">
+ <xsl:with-param name="str" select="$restr"/>
+ <xsl:with-param name="substr" select="$substr"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$str"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!--Template get_revised_adj is used to get real adj when adj show two time in the file. -->
+ <xsl:template name="get_remained_adj">
+ <xsl:param name="adj_typeid"/>
+ <xsl:param name="num"/>
+ <xsl:param name="mark"/>
+ <xsl:choose>
+ <xsl:when test="$num &gt; 0 ">
+ <xsl:variable name="new_remained_adj">
+ <xsl:choose>
+ <xsl:when test="string-length($adj_typeid) &gt; 0">
+ <xsl:call-template name="get_remained_adj">
+ <xsl:with-param name="adj_typeid" select="substring-after($adj_typeid,$mark)"/>
+ <xsl:with-param name="num" select="$num -1"/>
+ <xsl:with-param name="mark" select="$mark"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:value-of select="$new_remained_adj"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$adj_typeid"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!--Template get_non_omit_adj is used to get the non-omit adj.(e.g. Adj="10,,11" means modifiers="10 0 11").-->
+ <xsl:template name="get_non_omit_adj">
+ <xsl:param name="adj_typeid"/>
+ <xsl:param name="num"/>
+ <xsl:param name="mark"/>
+ <xsl:choose>
+ <xsl:when test="$num &gt; 0 ">
+ <xsl:variable name="before" select="substring-before($adj_typeid,',')"/>
+ <xsl:variable name="after" select="substring-after($adj_typeid,',')"/>
+ <xsl:variable name="zero_or_itself">
+ <xsl:choose>
+ <xsl:when test="string-length(translate($before, ' ','' ) ) &gt; 0">
+ <xsl:value-of select="$before"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="'0'"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="new_non_omit_adj">
+ <xsl:call-template name="get_non_omit_adj">
+ <xsl:with-param name="adj_typeid" select="$after"/>
+ <xsl:with-param name="num" select="$num -1"/>
+ <xsl:with-param name="mark" select="$mark"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="concat($zero_or_itself, ' ',$new_non_omit_adj)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="zero_or_itself">
+ <xsl:choose>
+ <xsl:when test="string-length(translate($adj_typeid, ' ','' ) ) &gt; 0">
+ <xsl:value-of select="$adj_typeid"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="'0'"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:value-of select="$zero_or_itself"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="getstrdashdot">
+ <!--Remember the robust!if dashstyle is '2'?What to do!-->
+ <xsl:param name="dashstyle"/>
+ <xsl:variable name="dstyle">
+ <xsl:variable name="tmpstyle">
+ <xsl:call-template name="MapDashConst">
+ <xsl:with-param name="dashstyle" select="$dashstyle"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="substring-after($tmpstyle,' ')"/>
+ </xsl:variable>
+ <xsl:variable name="dot1" select="substring-before($dstyle,' ')"/>
+ <xsl:variable name="dot1after" select="substring-after($dstyle,' ')"/>
+ <xsl:variable name="dot1distance" select="substring-before($dot1after,' ')"/>
+ <xsl:variable name="modesubstr1" select="concat($dot1,' ',$dot1distance,' ')"/>
+ <xsl:variable name="dot1n">
+ <xsl:call-template name="substrcount">
+ <xsl:with-param name="str" select="$dstyle"/>
+ <xsl:with-param name="substr" select="$modesubstr1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="dot2substr">
+ <xsl:call-template name="lastest-substr-after">
+ <xsl:with-param name="str" select="$dstyle"/>
+ <xsl:with-param name="substr" select="$modesubstr1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="dot2">
+ <xsl:choose>
+ <xsl:when test="string-length($dot2substr) &gt; 3">
+ <xsl:value-of select="substring-before($dot2substr,' ')"/>
+ </xsl:when>
+ <xsl:otherwise>-1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="dot2distance">
+ <xsl:choose>
+ <xsl:when test="string-length($dot2substr) &gt; 3">
+ <xsl:variable name="tmpstr" select="substring-after($dot2substr,' ')"/>
+ <xsl:value-of select="substring-before($tmpstr,' ')"/>
+ </xsl:when>
+ <xsl:otherwise>-1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="modesubstr2" select="concat($dot2,' ',$dot2distance,' ') "/>
+ <xsl:variable name="dot2n">
+ <xsl:choose>
+ <xsl:when test="string-length($dot2substr) &gt; 3">
+ <xsl:call-template name="substrcount">
+ <xsl:with-param name="str" select="$dot2substr"/>
+ <xsl:with-param name="substr" select="$modesubstr2"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>-1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="valDistance">
+ <!--Over all distance is the larger one!-->
+ <xsl:choose>
+ <xsl:when test="$dot2distance &gt; $dot1distance">
+ <xsl:value-of select="$dot2distance"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$dot1distance"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:value-of select="concat('dol:',$dot1,';don:',$dot1n,';dist:',$valDistance,';dtl:',$dot2,';dtn:',$dot2n,';eddtn')"/>
+ <!--<xsl:choose>
+ <xsl:when test="$dashstyle='1 1' or $dashstyle='Dots'">
+ <xsl:variable name="do"><xsl:value-of select="'1'"/></xsl:variable>
+ <xsl:variable name="dol"><xsl:value-of select="$do * $cmweight"/></xsl:variable>
+ <xsl:variable name="ds"><xsl:value-of select="'1'"/></xsl:variable>
+ <xsl:variable name="dsl"><xsl:value-of select="$ds * $cmweight"/></xsl:variable>
+ <xsl:variable name="dt"><xsl:value-of select="'-1'"/></xsl:variable>
+ <xsl:variable name="dtl"><xsl:value-of select="'-1'"/></xsl:variable>
+ <xsl:value-of select="concat('dsl:',$dsl,'edsl','do:',$do, 'edo;','do')"/>
+ </xsl:when>
+ </xsl:choose>-->
+ </xsl:template>
+ <xsl:template match="w:pict" mode="style">
+ <xsl:apply-templates mode="style" select="v:*"/>
+ </xsl:template>
+ <xsl:template match="v:*" mode="style">
+ <xsl:variable name="vchild" select="."/>
+ <xsl:variable name="style" select="concat($vchild/@style, ';')"/>
+ <xsl:variable name="z-index" select="substring-before(substring-after($style,'z-index:'),';')"/>
+ <xsl:variable name="right-name" select="not(name($vchild) = 'v:formulas') and not(name($vchild) = 'v:f') and not(name($vchild) = 'v:shapetype')"/>
+ <xsl:variable name="def" select="string-length($style) &gt; 0 or $vchild/@stroke or $vchild/@stroked or $vchild/@strokecolor or $vchild/v:stroke or $vchild/@strokeweight or $vchild/@wrapcoords or $vchild/@fillcolor"/>
+ <xsl:choose>
+ <xsl:when test="$right-name and ($def or (number($z-index) &lt; 0))">
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name">Tgr<xsl:number from="/w:wordDocument/w:body" level="any" count="v:*" format="1"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:family">graphic</xsl:attribute>
+ <xsl:variable name="stroke-num">
+ <xsl:if test="$vchild/v:stroke">
+ <xsl:number from="/w:wordDocument/w:body" level="any" count="v:stroke" format="1"/>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:variable name="draw-stroke">
+ <xsl:variable name="dashstyle" select="$vchild/v:stroke/@dashstyle"/>
+ <xsl:choose>
+ <xsl:when test="$vchild/@stroked and $vchild/@stroked='f'">none</xsl:when>
+ <xsl:when test="$dashstyle and not ($dashstyle = 'solid')">
+ <xsl:value-of select="concat('Tdash',$stroke-num)"/>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:element name="style:graphic-properties">
+ <xsl:variable name="style-str" select="concat(@style,';')"/>
+ <xsl:choose>
+ <xsl:when test="number($z-index) &lt; 0 or (name($vchild) = 'v:group' and $vchild/@editas ='canvas' )">
+ <xsl:attribute name="style:wrap">run-through</xsl:attribute>
+ <xsl:attribute name="style:run-through">background</xsl:attribute>
+ <xsl:attribute name="style:flow-with-text">false</xsl:attribute>
+ <xsl:attribute name="fo:border">none</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:wrap">run-through</xsl:attribute>
+ <xsl:attribute name="style:run-through">foreground</xsl:attribute>
+ <xsl:attribute name="style:flow-with-text">false</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="contains($style-str,'mso-position-horizontal:')">
+ <xsl:attribute name="style:horizontal-pos">
+ <xsl:value-of select="substring-before( substring-after( $style-str , 'mso-position-horizontal:') , ';')"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="v:imagedata or v:textbox">
+ <xsl:attribute name="style:horizontal-pos">from-left</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="parent::w:pict/o:OLEObject">
+ <xsl:variable name="style" select="concat(@style, ';')"/>
+ <xsl:variable name="width" select="substring-before( substring-after($style,'width:') ,';')"/>
+ <xsl:variable name="height" select="substring-before(substring-after($style,'height:'),';')"/>
+ <xsl:attribute name="draw:visible-area-left">0cm</xsl:attribute>
+ <xsl:attribute name="draw:visible-area-top">0cm</xsl:attribute>
+ <xsl:attribute name="draw:visible-area-width">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$width"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="draw:visible-area-height">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$height"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="draw:ole-draw-aspect">
+ <!-- DVASPECT_CONTENT = 1,
+ DVASPECT_THUMBNAIL = 2,
+ DVASPECT_ICON = 4,
+ DVASPECT_DOCPRINT = 8 -->
+ <xsl:variable name="ms-aspect" select="parent::w:pict/o:OLEObject/@DrawAspect"/>
+ <xsl:choose>
+ <xsl:when test="$ms-aspect = 'Content'">1</xsl:when>
+ <xsl:when test="$ms-aspect = 'Thumbnail'">2</xsl:when>
+ <xsl:when test="$ms-aspect = 'Icon'">4</xsl:when>
+ <xsl:when test="$ms-aspect = 'Docprint'">8</xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="parent::w:pict/o:OLEObject">
+ <xsl:attribute name="style:vertical-pos">middle</xsl:attribute>
+ <xsl:attribute name="style:vertical-rel">baseline</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="contains($style-str,'mso-position-vertical:')">
+ <xsl:attribute name="style:vertical-pos">
+ <xsl:value-of select="substring-before( substring-after( $style-str , 'mso-position-vertical:') , ';')"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="v:imagedata or v:textbox">
+ <xsl:attribute name="style:vertical-pos">from-top</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="string-length($draw-stroke) &gt; 0">
+ <!--draw:stroke="dash" draw:stroke-dash="Ohon!Ultrafine dashed" -->
+ <xsl:choose>
+ <xsl:when test="not ($draw-stroke = 'none')">
+ <xsl:attribute name="draw:stroke">
+ <xsl:value-of select="'dash'"/>
+ </xsl:attribute>
+ <xsl:attribute name="draw:stroke-dash">
+ <xsl:value-of select="$draw-stroke"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="draw:stroke">
+ <xsl:value-of select="'none'"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="$vchild/v:stroke/@startarrow">
+ <!--<v:stroke startarrow="block" startarrowwidth="wide" startarrowlength="long"/-->
+ <xsl:attribute name="draw:marker-start">
+ <xsl:value-of select="concat('markerstart',$stroke-num)"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$vchild/v:stroke/@endarrow">
+ <!--<v:stroke startarrow="block" startarrowwidth="wide" startarrowlength="long"/-->
+ <xsl:attribute name="draw:marker-end">
+ <xsl:value-of select="concat('markerend',$stroke-num)"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$vchild/@strokeweight">
+ <xsl:attribute name="svg:stroke-width">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$vchild/@strokeweight"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$vchild/@strokecolor">
+ <xsl:attribute name="svg:stroke-color">
+ <xsl:call-template name="MapConstColor">
+ <xsl:with-param name="color" select="$vchild/@strokecolor"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$vchild/@fillcolor">
+ <xsl:attribute name="draw:fill-color">
+ <xsl:call-template name="MapConstColor">
+ <xsl:with-param name="color" select="$vchild/@fillcolor"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="not($vchild/@fillcolor)">
+ <xsl:choose>
+ <xsl:when test="ancestor::v:group | v:shadow">
+ <xsl:attribute name="draw:fill-color">#ffffff</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="not($vchild/v:fill) and not(v:shadow)">
+ <xsl:attribute name="draw:fill">none</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="$vchild/v:fill/@opacity">
+ <xsl:attribute name="draw:opacity">
+ <xsl:call-template name="convert2percent">
+ <xsl:with-param name="value" select="$vchild/v:fill/@opacity"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$vchild/v:fill/@type = 'pattern' or $vchild/v:fill/@type = 'tile' or $vchild/v:fill/@type = 'frame'">
+ <xsl:attribute name="draw:fill">bitmap</xsl:attribute>
+ <xsl:attribute name="draw:fill-image-name">
+ <xsl:value-of select="translate($vchild/v:fill/@src,'&#9;&#10;&#13;&#32;:/.','' ) "/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$vchild/v:fill/@type = 'gradient'">
+ <xsl:attribute name="draw:fill">gradient</xsl:attribute>
+ <xsl:attribute name="draw:fill-gradient-name">
+ <xsl:value-of select=" 'gradient' "/>
+ <xsl:apply-templates mode="get-xsl-number" select="$vchild/v:fill"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates mode="style" select="v:shadow"/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <!--Default style which will surely be removed during imported from a .flat file to SO-->
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name">Tgr<xsl:number from="/w:wordDocument/w:body" level="any" count="v:*" format="1"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:family">graphic</xsl:attribute>
+ <style:graphic-properties draw:textarea-horizontal-align="center" draw:textarea-vertical-align="middle" style:wrap="none" draw:fill="none"/>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="name() = 'v:group'">
+ <xsl:apply-templates mode="style" select="v:*"/>
+ </xsl:if>
+ <xsl:apply-templates mode="style" select="v:textpath"/>
+ </xsl:template>
+ <xsl:template match="v:shadow" mode="style">
+ <!-- v:shadow on="t" color="aqua" opacity=".5" offset="13pt,11pt" offset2="14pt,10pt" -->
+ <xsl:attribute name="draw:shadow">
+ <xsl:choose>
+ <xsl:when test="contains(@on,'f')">hidden</xsl:when>
+ <xsl:otherwise>visible</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:attribute name="draw:shadow-color">
+ <xsl:call-template name="MapConstColor">
+ <xsl:with-param name="color" select="@color"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:if test="string-length(@opacity) &gt;0">
+ <xsl:attribute name="draw:shadow-opacity">
+ <xsl:call-template name="convert2percent">
+ <xsl:with-param name="value" select="@opacity"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="contains(@offset,',')">
+ <xsl:attribute name="draw:shadow-offset-x">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="substring-before(@offset,',')"/>
+ <xsl:with-param name="TargetMeasure" select=" 'cm' "/>
+ </xsl:call-template>
+ <xsl:value-of select="'cm'"/>
+ </xsl:attribute>
+ <xsl:attribute name="draw:shadow-offset-y">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="substring-after(@offset,',')"/>
+ <xsl:with-param name="TargetMeasure" select=" 'cm' "/>
+ </xsl:call-template>
+ <xsl:value-of select="'cm'"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="draw:shadow-offset-x">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="@offset"/>
+ <xsl:with-param name="TargetMeasure" select=" 'cm' "/>
+ </xsl:call-template>
+ <xsl:value-of select="'cm'"/>
+ </xsl:attribute>
+ <xsl:attribute name="draw:shadow-offset-y">0.062cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="@type='perspective' and @offset='0,0'">
+ <xsl:message>This kind of shadow does not support yet.</xsl:message>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="convert2percent">
+ <xsl:param name="value"/>
+ <xsl:choose>
+ <xsl:when test="contains($value,'%')">
+ <xsl:value-of select="$value"/>
+ </xsl:when>
+ <xsl:when test="contains($value,'f')">
+ <xsl:variable name="num-value" select="round(substring-before($value,'f') div 6.5536) div 100"/>
+ <xsl:value-of select="concat(100 - $num-value ,'%')"/>
+ </xsl:when>
+ <xsl:when test="string-length($value) = 0">
+ <xsl:value-of select="'1%'"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat($value * 100 ,'%')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="w:pict">
+ <xsl:param name="x-scale" select="1"/>
+ <xsl:param name="y-scale" select="1"/>
+ <xsl:param name="group-left" select="0"/>
+ <xsl:param name="group-top" select="0"/>
+ <xsl:param name="coord-left" select="0"/>
+ <xsl:param name="coord-top" select="0"/>
+ <xsl:param name="MeasureMark"/>
+ <xsl:apply-templates>
+ <xsl:with-param name="x-scale" select="$x-scale"/>
+ <xsl:with-param name="y-scale" select="$x-scale"/>
+ <xsl:with-param name="MeasureMark" select="$MeasureMark"/>
+ <xsl:with-param name="group-left" select="$group-left"/>
+ <xsl:with-param name="group-top" select="$group-top"/>
+ <xsl:with-param name="coord-left" select="$coord-left"/>
+ <xsl:with-param name="coord-top" select="$coord-top"/>
+ </xsl:apply-templates>
+ </xsl:template>
+ <xsl:template name="get-middle-substring">
+ <xsl:param name="string"/>
+ <xsl:param name="prefix"/>
+ <xsl:param name="suffix"/>
+ <xsl:if test="contains($string, $prefix)">
+ <xsl:choose>
+ <xsl:when test="contains(substring-after( $string, $prefix), $suffix)">
+ <xsl:value-of select="substring-before(substring-after( $string, $prefix), $suffix)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-after( $string, $prefix)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="w:binData">
+ </xsl:template>
+ <xsl:template match="v:group">
+ <xsl:param name="x-scale" select="1"/>
+ <xsl:param name="y-scale" select="1"/>
+ <xsl:param name="MeasureMark"/>
+ <xsl:param name="group-left" select="0"/>
+ <xsl:param name="group-top" select="0"/>
+ <xsl:param name="coord-left" select="0"/>
+ <xsl:param name="coord-top" select="0"/>
+ <xsl:variable name="style" select="concat(@style, ';')"/>
+ <xsl:variable name="left">
+ <xsl:variable name="direct-left" select="substring-before(substring-after($style,';left:'),';')"/>
+ <xsl:variable name="margin-left" select="substring-before( substring-after($style,'margin-left:') ,';')"/>
+ <xsl:call-template name="Add-with-Measure">
+ <xsl:with-param name="value1" select="$margin-left"/>
+ <xsl:with-param name="value2" select="$direct-left"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="top">
+ <xsl:variable name="direct-top" select="substring-before(substring-after($style,';top:'),';')"/>
+ <xsl:variable name="margin-top" select="substring-before( substring-after($style,'margin-top:') ,';')"/>
+ <xsl:call-template name="Add-with-Measure">
+ <xsl:with-param name="value1" select="$margin-top"/>
+ <xsl:with-param name="value2" select="$direct-top"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="width" select="substring-before( substring-after($style,'width:') ,';')"/>
+ <xsl:variable name="height" select="substring-before(substring-after($style,'height:'),';')"/>
+ <xsl:variable name="Current-coord-left">
+ <xsl:call-template name="get-number">
+ <xsl:with-param name="value" select="substring-before(@coordorigin, ',' )"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="Current-coord-top">
+ <xsl:call-template name="get-number">
+ <xsl:with-param name="value" select="substring-after(@coordorigin, ',' )"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="Current-coord-width">
+ <xsl:call-template name="get-number">
+ <xsl:with-param name="value" select="substring-before(@coordsize, ',' )"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="Current-coord-height">
+ <xsl:call-template name="get-number">
+ <xsl:with-param name="value" select="substring-after(@coordsize, ',' )"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="Current-MeasureMark">
+ <xsl:choose>
+ <xsl:when test="string-length($MeasureMark) &gt; 0">
+ <xsl:value-of select="$MeasureMark"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select=" 'cm' "/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="left-value">
+ <xsl:variable name="adjusted-left">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$left"/>
+ <xsl:with-param name="scale" select="$x-scale"/>
+ <xsl:with-param name="MeasureMark" select="$Current-MeasureMark"/>
+ <xsl:with-param name="Target-Measure" select="$Current-MeasureMark"/>
+ <xsl:with-param name="group-value" select="$group-left"/>
+ <xsl:with-param name="coord-value" select="$coord-left"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="get-number">
+ <xsl:with-param name="value" select="$adjusted-left"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="top-value">
+ <xsl:variable name="adjusted-top">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$top"/>
+ <xsl:with-param name="scale" select="$x-scale"/>
+ <xsl:with-param name="MeasureMark" select="$Current-MeasureMark"/>
+ <xsl:with-param name="Target-Measure" select="$Current-MeasureMark"/>
+ <xsl:with-param name="group-value" select="$group-left"/>
+ <xsl:with-param name="coord-value" select="$coord-left"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="get-number">
+ <xsl:with-param name="value" select="$adjusted-top"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="width-value">
+ <xsl:variable name="adjusted-width">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$width"/>
+ <xsl:with-param name="scale" select="$x-scale"/>
+ <xsl:with-param name="MeasureMark" select="$Current-MeasureMark"/>
+ <xsl:with-param name="Target-Measure" select="$Current-MeasureMark"/>
+ <xsl:with-param name="group-value" select="$group-left"/>
+ <xsl:with-param name="coord-value" select="$coord-left"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="get-number">
+ <xsl:with-param name="value" select="$adjusted-width"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="height-value">
+ <xsl:variable name="adjusted-height">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$height"/>
+ <xsl:with-param name="scale" select="$y-scale"/>
+ <xsl:with-param name="MeasureMark" select="$Current-MeasureMark"/>
+ <xsl:with-param name="Target-Measure" select="$Current-MeasureMark"/>
+ <xsl:with-param name="group-value" select="$group-left"/>
+ <xsl:with-param name="coord-value" select="$coord-left"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="get-number">
+ <xsl:with-param name="value" select="$adjusted-height"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="Current-x-scale" select="( $Current-coord-width div $width-value ) * $x-scale"/>
+ <xsl:variable name="Current-y-scale" select="( $Current-coord-height div $height-value ) * $y-scale"/>
+ <xsl:choose>
+ <xsl:when test="@editas='canvas' ">
+ <!-- frame -->
+ <xsl:variable name="style-name">Tgr<xsl:number from="/w:wordDocument/w:body" level="any" count="v:*" format="1"/>
+ </xsl:variable>
+ <xsl:variable name="frame-name">frame<xsl:number from="/w:wordDocument/w:body" level="any" count="v:group" format="1"/>
+ </xsl:variable>
+ <draw:frame draw:style-name="{$style-name}" draw:name="{$frame-name}" text:anchor-type="as-char" svg:x="{$left-value}{$Current-MeasureMark}" svg:y="{$top-value}{$Current-MeasureMark}" svg:width="{$width-value}{$Current-MeasureMark}" svg:height="{$height-value}{$Current-MeasureMark}" draw:z-index="0">
+ <draw:text-box>
+ <text:p text:style-name="Drawing">
+ <xsl:apply-templates select="w:r/w:pict | v:*">
+ <xsl:with-param name="x-scale" select="$Current-x-scale"/>
+ <xsl:with-param name="y-scale" select="$Current-y-scale"/>
+ <xsl:with-param name="MeasureMark" select="$Current-MeasureMark"/>
+ <xsl:with-param name="group-left" select="$left-value"/>
+ <xsl:with-param name="group-top" select="$top-value"/>
+ <xsl:with-param name="coord-left" select="$Current-coord-left"/>
+ <xsl:with-param name="coord-top" select="$Current-coord-top"/>
+ </xsl:apply-templates>
+ </text:p>
+ </draw:text-box>
+ </draw:frame>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="draw:g">
+ <xsl:apply-templates select="w:r/w:pict | v:*">
+ <xsl:with-param name="x-scale" select="$Current-x-scale"/>
+ <xsl:with-param name="y-scale" select="$Current-y-scale"/>
+ <xsl:with-param name="MeasureMark" select="$Current-MeasureMark"/>
+ <xsl:with-param name="group-left" select="$left-value"/>
+ <xsl:with-param name="group-top" select="$top-value"/>
+ <xsl:with-param name="coord-left" select="$Current-coord-left"/>
+ <xsl:with-param name="coord-top" select="$Current-coord-top"/>
+ </xsl:apply-templates>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="v:*">
+ <xsl:param name="x-scale" select="1"/>
+ <xsl:param name="y-scale" select="1"/>
+ <xsl:param name="MeasureMark"/>
+ <xsl:param name="group-left" select="0"/>
+ <xsl:param name="group-top" select="0"/>
+ <xsl:param name="coord-left" select="0"/>
+ <xsl:param name="coord-top" select="0"/>
+ <xsl:if test="not (name() = 'v:shapetype' )">
+ <xsl:call-template name="DrawElements">
+ <xsl:with-param name="x-scale" select="$x-scale"/>
+ <xsl:with-param name="y-scale" select="$y-scale"/>
+ <xsl:with-param name="MeasureMark" select="$MeasureMark"/>
+ <xsl:with-param name="group-left" select="$group-left"/>
+ <xsl:with-param name="group-top" select="$group-top"/>
+ <xsl:with-param name="coord-left" select="$coord-left"/>
+ <xsl:with-param name="coord-top" select="$coord-top"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="DrawElements">
+ <xsl:param name="x-scale" select="1"/>
+ <xsl:param name="y-scale" select="1"/>
+ <xsl:param name="MeasureMark"/>
+ <xsl:param name="group-left" select="0"/>
+ <xsl:param name="group-top" select="0"/>
+ <xsl:param name="coord-left" select="0"/>
+ <xsl:param name="coord-top" select="0"/>
+ <xsl:param name="force-draw" select="'false'"/>
+ <xsl:param name="shape-type"/>
+ <xsl:variable name="wordshapename" select="substring-after(name(),':')"/>
+ <xsl:variable name="custom_shapename">
+ <xsl:if test="$wordshapename='roundrect' ">round-rectangle</xsl:if>
+ <xsl:if test="$wordshapename='shape' and not (v:imagedata) and not (v:textbox) and @type">
+ <xsl:call-template name="ms_word_draw_map2ooo_custom_draw">
+ <xsl:with-param name="ms_word_draw_type" select="@type"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:variable name="is-image" select="$wordshapename='shape' and v:imagedata"/>
+ <xsl:variable name="element-name">
+ <xsl:choose>
+ <xsl:when test="$wordshapename='line'">draw:line</xsl:when>
+ <xsl:when test="$wordshapename='rect'">draw:rect</xsl:when>
+ <xsl:when test="$wordshapename='oval'">draw:ellipse</xsl:when>
+ <xsl:when test="$wordshapename='arc'">draw:ellipse</xsl:when>
+ <xsl:when test="$wordshapename='polyline'">draw:polyline</xsl:when>
+ <xsl:when test="$wordshapename='roundrect' ">draw:custom-shape</xsl:when>
+ <xsl:when test="$wordshapename='shape' and v:imagedata">draw:frame</xsl:when>
+ <xsl:when test="$wordshapename='shape' and not (v:imagedata) and @type">
+ <xsl:choose>
+ <xsl:when test="string-length($custom_shapename) &gt; 0">draw:custom-shape</xsl:when>
+ <xsl:when test=" string-length(@type) &gt; 0 and key('shapetype',@type)">draw:custom-shape</xsl:when>
+ <xsl:otherwise>draw:rect</xsl:otherwise>
+ <!--if nothing match it, we prefer rect-->
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$wordshapename='shape' and v:textbox">draw:frame</xsl:when>
+ <!--changed here!-->
+ <xsl:otherwise>draw:path</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="wfill" select="@fill"/>
+ <xsl:variable name="draw-kind">
+ <xsl:if test="$wordshapename='arc' and string-length($wfill) &gt; 0">arc</xsl:if>
+ <!--Means this is a Segment of Circle-->
+ </xsl:variable>
+ <!--Get the position,left,top,width,height,z-index,flip from Style-->
+ <xsl:variable name="style" select="concat(@style, ';')"/>
+ <xsl:variable name="position" select="substring-before(substring-after($style,'position:'),';')"/>
+ <xsl:variable name="direct-left" select="substring-before(substring-after($style,';left:'),';')"/>
+ <xsl:variable name="left">
+ <xsl:variable name="margin-left" select="substring-before( substring-after($style,'margin-left:') ,';')"/>
+ <xsl:call-template name="Add-with-Measure">
+ <xsl:with-param name="value1" select="$margin-left"/>
+ <xsl:with-param name="value2" select="$direct-left"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="direct-top" select="substring-before(substring-after($style,';top:'),';')"/>
+ <xsl:variable name="top">
+ <xsl:variable name="margin-top" select="substring-before( substring-after($style,'margin-top:') ,';')"/>
+ <xsl:call-template name="Add-with-Measure">
+ <xsl:with-param name="value1" select="$margin-top"/>
+ <xsl:with-param name="value2" select="$direct-top"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="width" select="substring-before( substring-after($style,'width:') ,';')"/>
+ <xsl:variable name="height" select="substring-before(substring-after($style,'height:'),';')"/>
+ <xsl:variable name="flip" select="substring-before(substring-after($style,'flip:'),';')"/>
+ <xsl:variable name="z-index" select="substring-before(substring-after($style,'z-index:'),';')"/>
+ <!--these are used for wrap margins get from style-->
+ <xsl:variable name="mso-wrap-distance-lefttmp" select="substring-after($style,'mso-wrap-distance-left:')"/>
+ <xsl:variable name="mso-wrap-distance-left" select="substring-before($mso-wrap-distance-lefttmp,';')"/>
+ <xsl:variable name="mso-wrap-distance-toptmp" select="substring-after($style,'mso-wrap-distance-top:')"/>
+ <xsl:variable name="mso-wrap-distance-top" select="substring-before($mso-wrap-distance-toptmp,';')"/>
+ <xsl:variable name="mso-wrap-distance-righttmp" select="substring-after($style,'mso-wrap-distance-right:')"/>
+ <xsl:variable name="mso-wrap-distance-right" select="substring-before($mso-wrap-distance-righttmp,';')"/>
+ <xsl:variable name="mso-wrap-distance-bottomtmp" select="substring-after($style,'mso-wrap-distance-bottom:')"/>
+ <xsl:variable name="mso-wrap-distance-bottom" select="substring-before($mso-wrap-distance-bottomtmp,';')"/>
+ <xsl:variable name="mso-position-horizontal-relativetmp" select="substring-after($style,'mso-position-horizontal-relative:')"/>
+ <xsl:variable name="mso-position-horizontal-relative" select="substring-before($mso-position-horizontal-relativetmp,';')"/>
+ <xsl:variable name="mso-position-vertical-relativetmp" select="substring-after($style,'mso-position-vertical-relative:')"/>
+ <xsl:variable name="mso-position-vertical-relative" select="substring-before($mso-position-vertical-relativetmp,';')"/>
+ <xsl:variable name="anchor-type">
+ <xsl:choose>
+ <xsl:when test="$mso-position-vertical-relative='page' or $mso-position-horizontal-relative = 'page'">page</xsl:when>
+ <xsl:when test="$position='absolute'">paragraph</xsl:when>
+ <xsl:otherwise>as-char</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="text-style-name">
+ <xsl:choose>
+ <xsl:when test="descendant::v:textbox">P1</xsl:when>
+ <xsl:when test="v:textpath">textpath<xsl:apply-templates mode="get-xsl-number" select="v:textpath"/>
+ </xsl:when>
+ <!--Should get the real style late-->
+ <xsl:otherwise>P1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:element name="{$element-name}">
+ <xsl:if test="$element-name = 'draw:frame'">
+ <xsl:attribute name="draw:name">
+ <xsl:value-of select="'frame'"/>
+ <xsl:number from="/w:wordDocument/w:body" level="any" count="v:*" format="1"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$element-name ='draw:path'">
+ <xsl:choose>
+ <xsl:when test="string-length(@path) = 0">
+ <xsl:attribute name="svg:d">M 0,0 L 0,0</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="svg:d">
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="@path"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="$element-name ='draw:path' or $wordshapename='polyline'">
+ <xsl:attribute name="svg:viewBox">
+ <xsl:value-of select="'0 0'"/>
+ <xsl:value-of select="' '"/>
+ <xsl:if test="string-length(@coordsize) = 0">
+ <xsl:value-of select="'1000 1000'"/>
+ </xsl:if>
+ <xsl:if test="not(string-length(@coordsize) = 0)">
+ <xsl:value-of select="translate(@coordsize,',',' ')"/>
+ </xsl:if>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="contains($style,'rotation:')">
+ <xsl:attribute name="draw:transform">
+ <xsl:variable name="rotate">
+ <xsl:call-template name="convert2redian">
+ <xsl:with-param name="x" select="substring-before(substring-after($style,'rotation:') , ';')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="concat( 'rotate(' , $rotate * -1 , ')' )"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="text:anchor-type">
+ <xsl:value-of select="$anchor-type"/>
+ <!--This need to be checkout and built!-->
+ </xsl:attribute>
+ <xsl:if test="string-length($z-index) &gt; 0">
+ <xsl:if test="number($z-index) &lt; 0">
+ <xsl:attribute name="draw:z-index">
+ <xsl:value-of select="'0'"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="not(number($z-index) &lt; 0)">
+ <xsl:attribute name="draw:z-index">
+ <xsl:value-of select="$z-index"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:attribute name="draw:style-name">Tgr<xsl:number from="/w:wordDocument/w:body" level="any" count="v:*" format="1"/>
+ </xsl:attribute>
+ <xsl:attribute name="draw:text-style-name">
+ <xsl:value-of select="$text-style-name"/>
+ <!--This is difficult!!-->
+ </xsl:attribute>
+ <xsl:if test="$wordshapename='line'">
+ <xsl:variable name="fromx" select="substring-before(@from,',')"/>
+ <xsl:variable name="fromy" select="substring-after(@from,',')"/>
+ <xsl:variable name="tox" select="substring-before(@to,',')"/>
+ <xsl:variable name="toy" select="substring-after(@to,',')"/>
+ <xsl:variable name="valfromx"> </xsl:variable>
+ <xsl:if test="$anchor-type='as-char'">
+ <xsl:attribute name="svg:x1">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$fromx"/>
+ <xsl:with-param name="scale" select="$x-scale"/>
+ <xsl:with-param name="MeasureMark" select="$MeasureMark"/>
+ <xsl:with-param name="group-value" select="$group-left"/>
+ <xsl:with-param name="coord-value" select="$coord-left"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="svg:y1">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$fromy"/>
+ <xsl:with-param name="scale" select="$y-scale"/>
+ <xsl:with-param name="MeasureMark" select="$MeasureMark"/>
+ <xsl:with-param name="group-value" select="$group-top"/>
+ <xsl:with-param name="coord-value" select="$coord-top"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="svg:x2">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$tox"/>
+ <xsl:with-param name="scale" select="$x-scale"/>
+ <xsl:with-param name="MeasureMark" select="$MeasureMark"/>
+ <xsl:with-param name="group-value" select="$group-left"/>
+ <xsl:with-param name="coord-value" select="$coord-left"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="svg:y2">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$toy"/>
+ <xsl:with-param name="scale" select="$y-scale"/>
+ <xsl:with-param name="MeasureMark" select="$MeasureMark"/>
+ <xsl:with-param name="group-value" select="$group-top"/>
+ <xsl:with-param name="coord-value" select="$coord-top"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="not ($anchor-type='as-char')">
+ <xsl:attribute name="svg:x1">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$fromx"/>
+ <xsl:with-param name="scale" select="$x-scale"/>
+ <xsl:with-param name="MeasureMark" select="$MeasureMark"/>
+ <xsl:with-param name="group-value" select="$group-left"/>
+ <xsl:with-param name="coord-value" select="$coord-left"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="svg:y1">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$toy"/>
+ <xsl:with-param name="scale" select="$y-scale"/>
+ <xsl:with-param name="MeasureMark" select="$MeasureMark"/>
+ <xsl:with-param name="group-value" select="$group-top"/>
+ <xsl:with-param name="coord-value" select="$coord-top"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="svg:x2">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$tox"/>
+ <xsl:with-param name="scale" select="$x-scale"/>
+ <xsl:with-param name="MeasureMark" select="$MeasureMark"/>
+ <xsl:with-param name="group-value" select="$group-left"/>
+ <xsl:with-param name="coord-value" select="$coord-left"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="svg:y2">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$fromy"/>
+ <xsl:with-param name="scale" select="$y-scale"/>
+ <xsl:with-param name="MeasureMark" select="$MeasureMark"/>
+ <xsl:with-param name="group-value" select="$group-top"/>
+ <xsl:with-param name="coord-value" select="$coord-top"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="$wordshapename='rect' or $wordshapename='oval' or $wordshapename='arc' or $wordshapename='shape' or $wordshapename='polyline' or ($wordshapename='shape' and v:textbox) or ($wordshapename='roundrect' and v:textbox) ">
+ <xsl:if test="$anchor-type='as-char'">
+ <xsl:attribute name="svg:width">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$width"/>
+ <xsl:with-param name="scale" select="$x-scale"/>
+ <xsl:with-param name="MeasureMark" select="$MeasureMark"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="svg:height">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$height"/>
+ <xsl:with-param name="scale" select="$y-scale"/>
+ <xsl:with-param name="MeasureMark" select="$MeasureMark"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="svg:x">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$left"/>
+ <xsl:with-param name="scale" select="$x-scale"/>
+ <xsl:with-param name="MeasureMark" select="$MeasureMark"/>
+ <xsl:with-param name="group-value" select="$group-left"/>
+ <xsl:with-param name="coord-value" select="$coord-left"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="svg:y">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$top"/>
+ <xsl:with-param name="scale" select="$y-scale"/>
+ <xsl:with-param name="MeasureMark" select="$MeasureMark"/>
+ <xsl:with-param name="group-value" select="$group-top"/>
+ <xsl:with-param name="coord-value" select="$coord-top"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="not ($anchor-type='as-char')">
+ <!--Something has to be down because We have Margin-top options-->
+ <xsl:attribute name="svg:width">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$width"/>
+ <xsl:with-param name="scale" select="$x-scale"/>
+ <xsl:with-param name="MeasureMark" select="$MeasureMark"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="svg:height">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$height"/>
+ <xsl:with-param name="scale" select="$y-scale"/>
+ <xsl:with-param name="MeasureMark" select="$MeasureMark"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="svg:x">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$left"/>
+ <xsl:with-param name="scale" select="$x-scale"/>
+ <xsl:with-param name="MeasureMark" select="$MeasureMark"/>
+ <xsl:with-param name="group-value" select="$group-left"/>
+ <xsl:with-param name="coord-value" select="$coord-left"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="svg:y">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$top"/>
+ <xsl:with-param name="scale" select="$y-scale"/>
+ <xsl:with-param name="MeasureMark" select="$MeasureMark"/>
+ <xsl:with-param name="group-value" select="$group-top"/>
+ <xsl:with-param name="coord-value" select="$coord-top"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="$element-name='draw:ellipse' and string-length($draw-kind) &gt; 0">
+ <xsl:attribute name="draw:kind">
+ <xsl:value-of select="$draw-kind"/>
+ </xsl:attribute>
+ </xsl:if>
+ <!--<draw:area-polygon … svg:x="0" svg:y="0" svg:width="2.0cm" svg:height="2.0cm" svg:viewBox="0 0 2000 2000" svg:points="400,1500 1600,1500 1000,400"/>
+ The element shown in the following example defines a triangle that is located in the middle of a 2cm by 2cm image. The bounding box covers an area of 2cm by 1.5cm. One view box unit corresponds to 0.01mm.-->
+ <xsl:if test="$wordshapename='polyline'">
+ <xsl:variable name="MeasureMark_Here" select="'cm'"/>
+ <!--MeasureMarkHere is cm because One view box unit corresponds to 0.01mm-->
+ <xsl:variable name="width_cm">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$width"/>
+ <xsl:with-param name="scale" select="$x-scale"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="height_cm">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$height"/>
+ <xsl:with-param name="scale" select="$x-scale"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="widthval">
+ <xsl:if test="contains($width_cm,'cm')">
+ <xsl:value-of select="round(substring-before($width_cm,'cm')*1000)"/>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:variable name="heightval">
+ <xsl:if test="contains($height_cm,'cm')">
+ <xsl:value-of select="round(substring-before($height_cm,'cm')*1000)"/>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:variable name="viewBoxstr" select="concat('0 0 ',$widthval,' ',$heightval)"/>
+ <xsl:attribute name="svg:viewBox">
+ <xsl:value-of select="$viewBoxstr"/>
+ </xsl:attribute>
+ <xsl:variable name="inputx_cm">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$left"/>
+ <xsl:with-param name="scale" select="$x-scale"/>
+ <xsl:with-param name="group-value" select="$group-left"/>
+ <xsl:with-param name="coord-value" select="$coord-left"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="inputy_cm">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$top"/>
+ <xsl:with-param name="scale" select="$y-scale"/>
+ <xsl:with-param name="group-value" select="$group-top"/>
+ <xsl:with-param name="coord-value" select="$coord-top"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="inputx_val">
+ <xsl:choose>
+ <xsl:when test="contains($inputx_cm,'cm')">
+ <xsl:value-of select="substring-before($inputx_cm,'cm')"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="inputy_val">
+ <xsl:choose>
+ <xsl:when test="contains($inputy_cm,'cm')">
+ <xsl:value-of select="substring-before($inputy_cm,'cm')"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="inputboxwidth" select="$widthval"/>
+ <xsl:variable name="oopoints">
+ <xsl:call-template name="wordpoints2oopoints">
+ <xsl:with-param name="input_x" select="$inputx_val"/>
+ <xsl:with-param name="input_y" select="$inputy_val"/>
+ <xsl:with-param name="input_width" select="$width"/>
+ <xsl:with-param name="input_height" select="$height"/>
+ <xsl:with-param name="input_boxwidth" select="$widthval"/>
+ <xsl:with-param name="input_boxheight" select="$heightval"/>
+ <xsl:with-param name="input_points" select="concat(@points,',')"/>
+ <!-- add a space to the end of input_points -->
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="string-length($oopoints) &gt; 0">
+ <xsl:attribute name="draw:points">
+ <xsl:value-of select="$oopoints"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="$is-image">
+ <xsl:variable name="the-image" select="key('imagedata',v:imagedata/@src)"/>
+ <xsl:choose>
+ <xsl:when test="string-length(v:imagedata/@o:title) &gt; 0">
+ <xsl:attribute name="draw:name">
+ <xsl:value-of select="v:imagedata/@o:title"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="string-length(parent::w:pict/o:OLEObject/@ObjectID) &gt; 0">
+ <xsl:attribute name="draw:name">
+ <xsl:value-of select="parent::w:pict/o:OLEObject/@ObjectID"/>
+ </xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:apply-templates select="parent::w:pict/o:OLEObject" mode="output"/>
+ <draw:image>
+ <xsl:element name="office:binary-data">
+ <xsl:value-of select="translate($the-image/text(),'&#9;&#10;&#13;&#32;','' ) "/>
+ </xsl:element>
+ </draw:image>
+ </xsl:if>
+ <xsl:if test="$element-name = 'draw:custom-shape'">
+ <xsl:apply-templates select="v:textpath" mode="text-p">
+ <xsl:with-param name="type-textpath" select="key('shapetype',@type)/v:textpath[1]"/>
+ </xsl:apply-templates>
+ <xsl:element name="draw:enhanced-geometry">
+ <xsl:variable name="enhanced_path">
+ <!--enhanced_path call a template to get the enhanced-path-->
+ <xsl:choose>
+ <xsl:when test="string-length($custom_shapename) = 0">
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="@path"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:variable>
+ <!--####notice that:there is some drawing elements that don't have the shapetype so that can not have a viewbox
+ It is a ****problem**** now-so be sure to check it out.-->
+ <xsl:if test="$wordshapename='roundrect' ">
+ <xsl:variable name="tmp_MeasueMark">
+ <xsl:value-of select="'cm'"/>
+ </xsl:variable>
+ <xsl:variable name="svg_viewwidth">
+ <xsl:if test="$anchor-type='as-char'">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$width"/>
+ <xsl:with-param name="scale" select="$x-scale"/>
+ <xsl:with-param name="MeasureMark" select="$tmp_MeasueMark"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="not ($anchor-type='as-char')">
+ <!--Something has to be down because We have Margin-top options-->
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$width"/>
+ <xsl:with-param name="scale" select="$x-scale"/>
+ <xsl:with-param name="MeasureMark" select="$tmp_MeasueMark"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:variable name="svg_viewheight">
+ <xsl:if test="$anchor-type='as-char'">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$height"/>
+ <xsl:with-param name="scale" select="$y-scale"/>
+ <xsl:with-param name="MeasureMark" select="$tmp_MeasueMark"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="not ($anchor-type='as-char')">
+ <!--Something has to be down because We have Margin-top options-->
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$height"/>
+ <xsl:with-param name="scale" select="$y-scale"/>
+ <xsl:with-param name="MeasureMark" select="$tmp_MeasueMark"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:variable name="svg_viewBox">
+ <xsl:value-of select="concat( '0 0 ',substring-before($svg_viewwidth,$tmp_MeasueMark)*10000,' ',substring-before($svg_viewheight,$tmp_MeasueMark)*10000)"/>
+ </xsl:variable>
+ <xsl:attribute name="svg:viewBox">
+ <xsl:value-of select="$svg_viewBox"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="string-length($custom_shapename) &gt; 0">
+ <xsl:attribute name="draw:type">
+ <xsl:value-of select="$custom_shapename"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="string-length($enhanced_path) &gt; 0">
+ <xsl:attribute name="draw:enhanced-path">
+ <xsl:value-of select="$enhanced_path"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:variable name="typeid_adj">
+ <!--for fix the bug of version 1.63: the following discription: adj="-11796480,,5400" in OOo should be: modifier =" -11796480 0 5400"-->
+ <xsl:variable name="tmp_adj">
+ <xsl:value-of select="key('shapetype',@type)/@adj"/>
+ </xsl:variable>
+ <xsl:if test="contains($tmp_adj, ',') ">
+ <xsl:variable name="number">
+ <xsl:value-of select="string-length(translate($tmp_adj,'+-0123456789 ','' ) )"/>
+ </xsl:variable>
+ <xsl:call-template name="get_non_omit_adj">
+ <xsl:with-param name="adj_typeid" select="$tmp_adj"/>
+ <xsl:with-param name="num" select="$number"/>
+ <xsl:with-param name="mark" select="',' "/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="not (contains($tmp_adj, ',') )">
+ <xsl:value-of select="$tmp_adj"/>
+ </xsl:if>
+ </xsl:variable>
+ <!--the following choose statement code will process the revised modifier
+ It happens that if a drawing elements has more than 2 modifier, the modifier (or say adj
+ in wordml) can be adjusted and only the modified adj is recorded.
+ what makes it more compicated is that adj support both comma and blanks.
+ so you have to use kickblanks template to kick the blanks and change it to comma version.
+ <key('shapetype',@type)/v:textpath[1]-->
+ <xsl:choose>
+ <xsl:when test="string-length($typeid_adj) = 0">
+ <xsl:if test="contains(@adj,',')">
+ <!--Please Note that the modifier can be more than 2 , so use a translate can be more efficient.
+ -####Note that comma cann't be recognized by OOo's modifiers
+ <xsl:variable name="adjust-x" select="substring-before(@adj,',')"/>
+ <xsl:variable name="adjust-y" select="substring-after(@adj,',')"/>
+ <xsl:variable name="adjuststr">
+ <xsl:if test="$adjust-x and $adjust-y">
+ -####Note that comma cann't be recognized by OOo's modifiers->
+ <xsl:value-of select="concat( $adjust-x , ' ' ,$adjust-y )"/>
+ </xsl:if>
+ </xsl:variable>-->
+ <xsl:attribute name="draw:modifiers">
+ <xsl:value-of select="translate(@adj ,',' ,' ')"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@adj and not(contains(@adj,','))">
+ <!--####Note that comma cann't be recognized by OOo's modifiers.-->
+ <xsl:attribute name="draw:modifiers">
+ <xsl:value-of select="@adj"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <!--Means that you have to care about 2 adj parameters which is defferent-->
+ <xsl:variable name="mark_used_by_typeid">
+ <xsl:if test="contains($typeid_adj, ',' )">
+ <xsl:value-of select="',' "/>
+ </xsl:if>
+ <xsl:if test="not (contains( $typeid_adj, ',' ) ) ">
+ <xsl:value-of select="' ' "/>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="@adj">
+ <xsl:variable name="remained_adj">
+ <xsl:if test="contains(@adj,',' ) ">
+ <xsl:variable name="number">
+ <xsl:value-of select="string-length(translate(@adj,'+-0123456789 ','' ) )"/>
+ </xsl:variable>
+ <xsl:call-template name="get_remained_adj">
+ <xsl:with-param name="adj_typeid" select="$typeid_adj"/>
+ <xsl:with-param name="num" select="$number+1"/>
+ <xsl:with-param name="mark" select="$mark_used_by_typeid"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="not (contains(@adj,',' ) ) ">
+ <xsl:variable name="tmp_str_adj">
+ <xsl:call-template name="kickblanks">
+ <xsl:with-param name="str" select="concat(' ' ,@adj,' ')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="number">
+ <xsl:value-of select="string-length(translate($tmp_str_adj,'+-0123456789','' ) )"/>
+ </xsl:variable>
+ <xsl:call-template name="get_remained_adj">
+ <xsl:with-param name="adj_typeid" select="$typeid_adj"/>
+ <xsl:with-param name="num" select="$number - 1"/>
+ <xsl:with-param name="mark" select="$mark_used_by_typeid "/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:attribute name="draw:modifiers">
+ <xsl:value-of select="translate(concat(@adj ,',' ,$remained_adj), ',' ,' ' )"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="contains($typeid_adj,',')">
+ <xsl:attribute name="draw:modifiers">
+ <xsl:value-of select="translate($typeid_adj ,',' ,' ')"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="not(contains($typeid_adj,','))">
+ <xsl:attribute name="draw:modifiers">
+ <xsl:value-of select="$typeid_adj"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="@type">
+ <xsl:apply-templates select="v:textpath" mode="output">
+ <xsl:with-param name="type-textpath" select="key('shapetype',@type)/v:textpath[1]"/>
+ </xsl:apply-templates>
+ <xsl:apply-templates select="key('shapetype',@type)" mode="output">
+ <xsl:with-param name="instance" select="."/>
+ </xsl:apply-templates>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="$wordshapename='shape' and v:textbox and $element-name='draw:frame' ">
+ <xsl:element name="draw:text-box">
+ <xsl:apply-templates select="v:textbox/w:txbxContent/w:p"/>
+ </xsl:element>
+ </xsl:when>
+ <!--It is a case statement for all shapes,so we add v:roundrect here.-->
+ <xsl:when test="$wordshapename='roundrect' and v:textbox and $element-name='draw:frame' ">
+ <xsl:element name="draw:text-box">
+ <xsl:apply-templates select="v:textbox/w:txbxContent/w:p"/>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="v:textbox">
+ <xsl:apply-templates select="v:textbox/w:txbxContent/w:p"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="w:docOleData" mode="init">
+ <xsl:choose>
+ <xsl:when test="element-available('oleextracter:init')">
+ <oleextracter:init UNOURL="uno:socket,host=localhost,port=8100;urp;StarOffice.ServiceManager"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="ole:init($oleExtractor, 'uno:socket,host=localhost,port=8100;urp;StarOffice.ServiceManager')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:apply-templates select="w:binData[@w:name='oledata.mso']" mode="oledata.mso"/>
+ </xsl:template>
+ <xsl:template match="w:docOleData" mode="exit">
+ <oleextracter:exit/>
+ </xsl:template>
+ <xsl:template match="w:binData" mode="oledata.mso">
+ <!-- <xsl:choose>
+ <xsl:when test="element-available('oleextracter:getByName')">
+ <xsl:variable name="tmp" select="oleextracter:insertByName('oledata.mso', translate(text(),'&#10;&#13;&#32;','' ) )"/>
+ </xsl:when>
+ <xsl:otherwise>-->
+ <xsl:variable name="tmp" select="ole:insertByName($oleExtractor,'oledata.mso', translate(text(),'&#10;&#13;&#32;','' ) )"/>
+ <!-- </xsl:otherwise>
+ </xsl:choose> -->
+ </xsl:template>
+ <xsl:template match="o:OLEObject " mode="output">
+ <!-- depends on i43230,we can uncomment this code or find another way after i43230 got fixed -->
+ <draw:object-ole>
+ <xsl:element name="office:binary-data">
+ <!--
+ <xsl:choose>
+ <xsl:when test="element-available('oleextracter:getByName')">
+ <xsl:value-of select="translate(oleextracter:getByName(@ObjectID),'&#13;','')"/>
+ </xsl:when>
+ <xsl:otherwise> -->
+ <xsl:value-of select="translate(ole:getByName($oleExtractor,@ObjectID),'&#13;','')"/>
+ <!--
+ </xsl:otherwise>
+ </xsl:choose> -->
+ </xsl:element>
+ </draw:object-ole>
+ </xsl:template>
+ <xsl:template name="get-vml-value">
+ <xsl:param name="node1" select="''"/>
+ <xsl:param name="property-name"/>
+ <xsl:variable name="pn" select="concat(';',$property-name, ':')"/>
+ <xsl:choose>
+ <xsl:when test="string-length(@*[name() = $property-name]) &gt; 0">
+ <xsl:value-of select="@*[name() = $property-name]"/>
+ </xsl:when>
+ <xsl:when test="string-length(@style) &gt; 0 and contains(concat(';',translate(@style,' ','')),$pn)">
+ <xsl:value-of select=" substring-before( concat(substring-after(concat(';',translate($node1/@style,' ','')) , $pn),';') , ';') "/>
+ </xsl:when>
+ <xsl:when test="$node1 and string-length($node1/@*[name() = $property-name]) &gt; 0">
+ <xsl:value-of select="$node1/@*[name() = $property-name]"/>
+ </xsl:when>
+ <xsl:when test="$node1 and string-length($node1/@style) &gt; 0 and contains(concat(';',translate($node1/@style,' ','')),$pn)">
+ <xsl:value-of select=" substring-before( concat(substring-after(concat(';',translate($node1/@style,' ','')) , $pn),';') , ';') "/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="v:textpath" mode="text-p">
+ <xsl:param name="type-textpath" select="''"/>
+ <xsl:variable name="the-string">
+ <xsl:call-template name="get-vml-value">
+ <xsl:with-param name="node1" select="$type-textpath"/>
+ <xsl:with-param name="property-name" select="'string'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="style-name">
+ <xsl:value-of select="'textpath'"/>
+ <xsl:number from="/w:wordDocument/w:body" level="any" count="v:textpath" format="1"/>
+ </xsl:variable>
+ <text:p text:style-name="{$style-name}">
+ <xsl:value-of select="$the-string"/>
+ </text:p>
+ </xsl:template>
+ <xsl:template match="v:textpath" mode="style">
+ <xsl:if test="contains(@style,'font-family:')">
+ <xsl:variable name="style-name">
+ <xsl:value-of select="'textpath'"/>
+ <xsl:number from="/w:wordDocument/w:body" level="any" count="v:textpath" format="1"/>
+ </xsl:variable>
+ <xsl:variable name="font-family">
+ <!-- we need remove the addtional &quot; from font-family -->
+ <xsl:value-of select="translate(substring-before(substring-after(@style,'font-family:'),';'), '&quot;' ,'')"/>
+ </xsl:variable>
+ <xsl:variable name="font-size">
+ <xsl:choose>
+ <xsl:when test="contains(@style,'font-size:')">
+ <xsl:value-of select="substring-before(substring-after(@style,'font-size:'),';')"/>
+ </xsl:when>
+ <xsl:otherwise>36pt</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <style:style style:name="{$style-name}" style:family="paragraph">
+ <style:paragraph-properties text:enable-numbering="false" style:writing-mode="lr-tb"/>
+ <style:text-properties fo:font-family="{$font-family}" fo:font-size="{$font-size}" style:font-family-generic="roman" style:text-scale="80%"/>
+ </style:style>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="v:textpath" mode="output">
+ <xsl:param name="type-textpath" select="''"/>
+ <xsl:variable name="on">
+ <xsl:call-template name="get-vml-value">
+ <xsl:with-param name="node1" select="$type-textpath"/>
+ <xsl:with-param name="property-name" select="'on'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="starts-with($on,'t')">
+ <xsl:attribute name="draw:text-path">true</xsl:attribute>
+ </xsl:if>
+ <xsl:variable name="fitshape">
+ <xsl:call-template name="get-vml-value">
+ <xsl:with-param name="node1" select="$type-textpath"/>
+ <xsl:with-param name="property-name" select="'fitshape'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="fitpath">
+ <xsl:call-template name="get-vml-value">
+ <xsl:with-param name="node1" select="$type-textpath"/>
+ <xsl:with-param name="property-name" select="'fitpath'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="draw:type">fontwork-plain-text</xsl:attribute>
+ <xsl:attribute name="draw:text-path-mode">
+ <xsl:choose>
+ <xsl:when test="starts-with($fitpath,'t') ">path</xsl:when>
+ <xsl:when test="starts-with($fitshape,'t') ">shape</xsl:when>
+ <xsl:otherwise>normal</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:attribute name="draw:text-path-scale">path</xsl:attribute>
+ <!-- xsl:attribute name="draw:text-path-same-letter-heights">false</xsl:attribute -->
+ <!-- xsl:attribute name="draw:text-path-scale-x">false</xsl:attribute -->
+ </xsl:template>
+ <xsl:template match="v:shapetype" mode="output">
+ <xsl:param name="instance" select="''"/>
+ <!--#Dummy after version 1.63 The following test is for the adj attribute of the file. It is Dummy now.
+ <xsl:if test="not($instance/@adj)">
+ <xsl:if test="contains(@adj,',')">-->
+ <!--Please Note that the modifier can be more than 2 , so use a translate can be more efficient.
+ -####Note that comma cann't be recognized by OOo's modifiers
+ <xsl:variable name="adjust-x" select="substring-before(@adj,',')"/>
+ <xsl:variable name="adjust-y" select="substring-after(@adj,',')"/>
+ <xsl:variable name="adjuststr">
+ <xsl:if test="$adjust-x and $adjust-y">
+ < -####Note that comma cann't be recognized by OOo's modifiers.->
+ <xsl:value-of select="concat( $adjust-x , ' ' ,$adjust-y )"/>
+ </xsl:if>
+ </xsl:variable>-->
+ <!--Dummy after version 1.63 <xsl:attribute name="draw:modifiers">
+ <xsl:value-of select="translate(@adj, ',' , ' ' )"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@adj and not(contains(@adj,','))">-->
+ <!--####Note that comma cann't be recognized by OOo's modifiers.-->
+ <!--Dummy after version 1.63 <xsl:attribute name="draw:modifiers">
+ <xsl:value-of select="@adj"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:if>-->
+ <xsl:variable name="viewbox">
+ <xsl:value-of select="'0 0'"/>
+ <xsl:value-of select="' '"/>
+ <xsl:if test="string-length(@coordsize) = 0">
+ <xsl:value-of select="'1000 1000'"/>
+ </xsl:if>
+ <xsl:if test="not(string-length(@coordsize) = 0)">
+ <xsl:value-of select="translate(@coordsize,',',' ')"/>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:attribute name="svg:viewBox">
+ <xsl:value-of select="$viewbox"/>
+ </xsl:attribute>
+ <xsl:attribute name="draw:text-areas">
+ <xsl:value-of select="$viewbox"/>
+ </xsl:attribute>
+ <!-- This path need be output is instance does not have a path-->
+ <xsl:if test="not($instance/@path) and string-length(@path) &gt;0">
+ <xsl:attribute name="draw:enhanced-path">
+ <!--<xsl:call-template name="vmlpath2svgpath">rrrrrrevised-->
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="@path"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates select="v:formulas | v:handles" mode="output"/>
+ </xsl:template>
+ <xsl:template match="v:formulas" mode="output">
+ <xsl:apply-templates select="v:f" mode="output"/>
+ </xsl:template>
+ <xsl:template match="v:f" mode="output">
+ <xsl:element name="draw:equation">
+ <xsl:attribute name="draw:formula">
+ <xsl:call-template name="v-formula2o-formula">
+ <xsl:with-param name="v-formula" select="@eqn"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="draw:name">
+ <xsl:value-of select="'f'"/>
+ <xsl:variable name="the-number">
+ <xsl:number format="1" level="single"/>
+ </xsl:variable>
+ <xsl:value-of select="$the-number - 1"/>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="v-formula2o-formula">
+ <xsl:param name="v-formula"/>
+ <xsl:variable name="command" select="substring-before(normalize-space($v-formula), ' ')"/>
+ <xsl:variable name="tmp" select="normalize-space(substring-after($v-formula, $command ))"/>
+ <xsl:variable name="step1">
+ <xsl:choose>
+ <xsl:when test="$command ='val'">
+ <xsl:value-of select="$tmp"/>
+ </xsl:when>
+ <!-- (sum a b c) = (a + b - c)-->
+ <xsl:when test="$command = 'sum' ">
+ <xsl:call-template name="replace-space">
+ <xsl:with-param name="value" select="$tmp"/>
+ <xsl:with-param name="replace1" select="'+'"/>
+ <xsl:with-param name="replace2" select="'-'"/>
+ </xsl:call-template>
+ </xsl:when>
+ <!-- (prod a b c) = (a * b / c)-->
+ <xsl:when test="$command = 'prod'">
+ <xsl:call-template name="replace-space">
+ <xsl:with-param name="value" select="$tmp"/>
+ <xsl:with-param name="replace1" select="'*'"/>
+ <xsl:with-param name="replace2" select="'/'"/>
+ </xsl:call-template>
+ </xsl:when>
+ <!-- (mid a b) = ((a + b) / 2)-->
+ <xsl:when test="$command = 'mid'">
+ <xsl:value-of select="concat('(' , translate($tmp,' ', '+') , ') / 2' )"/>
+ </xsl:when>
+ <!-- (if a b c) = (a>0? b : c) Conditional testing. -->
+ <xsl:when test="$command = 'if' ">
+ <xsl:value-of select="concat('if(' , translate($tmp,' ', ',') , ')' )"/>
+ </xsl:when>
+ <!-- (min a b) = (min (a , b) )-->
+ <!-- (max a b) = (max (a , b) )-->
+ <xsl:when test="$command = 'min' or $command = 'max'">
+ <xsl:value-of select="concat($command, '(' , translate($tmp,' ', ',') , ')' )"/>
+ </xsl:when>
+ <xsl:when test="$command = 'abs' or $command = 'sqrt'">
+ <xsl:value-of select="concat($command, '(' , $tmp , ')' )"/>
+ </xsl:when>
+ <!-- sin(a,b) = a*sin(b) -->
+ <xsl:when test="$command = 'sin' or $command = 'cos' or $command = 'tan' ">
+ <!-- atan is not this kind 2 $command = 'atan2' "-->
+ <xsl:variable name="value1" select="substring-before($tmp,' ')"/>
+ <xsl:variable name="value2" select="substring-after($tmp,' ')"/>
+ <xsl:value-of select="concat( $value1 , ' * ' , $command, '(' , $value2 , ')' )"/>
+ </xsl:when>
+ <!-- -->
+ <xsl:when test="$command = 'atan2' ">
+ <xsl:variable name="value1" select="substring-before($tmp,' ')"/>
+ <xsl:variable name="value2" select="substring-after($tmp,' ')"/>
+ <xsl:value-of select="concat( $command , '( ' , $value2, ',' , $value1 , ')' )"/>
+ </xsl:when>
+ <!-- -->
+ <!--><xsl:when test="$command = 'atan2' ">
+ <xsl:variable name="value1" select="substring-before($tmp,' ')"/>
+ <xsl:variable name="value2" select="substring-after($tmp,' ')"/>
+ <xsl:value-of select="concat( 'atan' , '( ' , $value2, '/' , $value1 , ')' )"/>
+ </xsl:when><- -->
+ <!-- ellipse and sumangle are always used by arc commans like this
+ eqn="ellipse @24 @4 height" ; and eqn="sumangle @2 360 0"
+ mod is always used too.-->
+ <!--mod =sqrt( v*v + P1×P1 + P2×P2). ( 3 parameters )-->
+ <xsl:when test="$command='mod' ">
+ <xsl:variable name="value1" select="substring-before($tmp,' ')"/>
+ <xsl:variable name="value2" select="substring-before(substring-after($tmp,' '), ' ')"/>
+ <xsl:variable name="value3" select="substring-after(substring-after($tmp,' '), ' ')"/>
+ <xsl:value-of select="concat( 'sqrt( ' , $value3, ' * ',$value3, ' + ' ,$value2, ' * ' ,$value2, ' + ' ,$value1, ' * ', $value1, ' )' )"/>
+ </xsl:when>
+ <!--ellipse= P2* sqrt(1 - v*v /P1*P1) ( 3 parameters )-->
+ <xsl:when test="$command='ellipse' ">
+ <xsl:variable name="value1" select="substring-before($tmp,' ')"/>
+ <xsl:variable name="value2" select="substring-before(substring-after($tmp,' '), ' ')"/>
+ <xsl:variable name="value3" select="substring-after(substring-after($tmp,' '), ' ')"/>
+ <xsl:value-of select="concat( $value3 , ' * sqrt( ' , $value2 , ' * ' , $value2, ' - ',$value1 , ' * ', $value1, ' )' ,'/',$value2 )"/>
+ </xsl:when>
+ <!--sumangle =v + P1×2^16 - P2×2^16. ( 3 parameters )-->
+ <!--<xsl:when test="$command='sumangle' ">
+ <xsl:variable name="value1" select="substring-before($tmp,' ')"/>
+ <xsl:variable name="value2" select="substring-before(substring-after($tmp,' '), ' ')"/>
+ <xsl:variable name="value3" select="substring-after(substring-after($tmp,' '), ' ')"/>
+ <xsl:value-of select="concat( $value1 , '+' , $value2 , ' * ' , '65535',' + ', $value2,' - ' ,$value3 , ' * ', '65535', ' - ', $value3)"/>
+ </xsl:when>-->
+ <!--sumangle =v + P1×2^16 - P2×2^16. ( 3 parameters )-->
+ <xsl:when test="$command='sumangle' ">
+ <xsl:variable name="value1" select="substring-before($tmp,' ')"/>
+ <xsl:variable name="value2" select="substring-before(substring-after($tmp,' '), ' ')"/>
+ <xsl:variable name="value3" select="substring-after(substring-after($tmp,' '), ' ')"/>
+ <xsl:value-of select="concat( $value1 , '+' , $value2 , '*pi/180',' - ' ,$value3 , '*pi/180' )"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>Find a unsupported formule:<xsl:value-of select="$v-formula"/>
+ </xsl:message>
+ <!--<xsl:value-of select="'0'"/><-for release use-->
+ <xsl:value-of select="concat('not found this:', $v-formula)"/>
+ <!--for Debug use-->
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="step2">
+ <xsl:value-of select="translate($step1,'#','$')"/>
+ </xsl:variable>
+ <xsl:call-template name="replace-at">
+ <xsl:with-param name="value" select="$step2"/>
+ </xsl:call-template>
+ </xsl:template>
+ <xsl:template name="replace-space">
+ <xsl:param name="value"/>
+ <xsl:param name="replace1"/>
+ <xsl:param name="replace2"/>
+ <xsl:value-of select=" concat( substring-before($value,' ') , $replace1, translate(substring-after($value,' '), ' ', $replace2 ) ) "/>
+ </xsl:template>
+ <xsl:template name="replace-at">
+ <xsl:param name="value"/>
+ <xsl:param name="position" select="1"/>
+ <xsl:choose>
+ <xsl:when test="string-length($value) &lt; $position">
+ <xsl:value-of select="$value"/>
+ </xsl:when>
+ <xsl:when test="substring($value,$position,1) = '@'">
+ <xsl:call-template name="replace-at">
+ <xsl:with-param name="value" select="concat(substring($value,1,$position -1) , '?f' , substring($value,$position+1)) "/>
+ <xsl:with-param name="position" select="$position + 2"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="replace-at">
+ <xsl:with-param name="value" select="$value"/>
+ <xsl:with-param name="position" select="$position + 1"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test=" substring($value,$position,1) = '@'">
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="v:handles" mode="output">
+ <xsl:apply-templates select="v:h" mode="output"/>
+ </xsl:template>
+ <xsl:template match="v:h" mode="output">
+ <xsl:element name="draw:handle">
+ <xsl:if test="@position">
+ <xsl:attribute name="draw:handle-position">
+ <xsl:value-of select="translate(@position,'#,' , '$ ')"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@switch">
+ <xsl:attribute name="draw:handle-switched">
+ <xsl:value-of select="@switch"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@xrange">
+ <xsl:attribute name="draw:handle-range-x-maximum">
+ <xsl:value-of select="substring-after(@xrange,',')"/>
+ </xsl:attribute>
+ <xsl:attribute name="draw:handle-range-x-minimum">
+ <xsl:value-of select="substring-before(@xrange,',')"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@yrange">
+ <xsl:attribute name="draw:handle-range-y-maximum">
+ <xsl:value-of select="substring-after(@yrange,',')"/>
+ </xsl:attribute>
+ <xsl:attribute name="draw:handle-range-y-minimum">
+ <xsl:value-of select="substring-before(@yrange,',')"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:template>
+ <!--this template map word's points to svg:viewbox's point they are quite differect because word's use pt but svg's use 0.001cm as a unit-->
+ <xsl:template name="wordpoints2oopoints">
+ <xsl:param name="input_points"/>
+ <xsl:param name="input_x"/>
+ <xsl:param name="input_y"/>
+ <xsl:param name="input_width"/>
+ <xsl:param name="input_height"/>
+ <xsl:param name="input_boxwidth"/>
+ <xsl:param name="input_boxheight"/>
+ <xsl:variable name="ptx" select="substring-before($input_points,',')"/>
+ <xsl:variable name="tempstr" select="substring-after($input_points,',')"/>
+ <xsl:variable name="pty" select="substring-before($tempstr,',')"/>
+ <xsl:variable name="nextinput" select="substring-after ($tempstr,',')"/>
+ <xsl:if test="$ptx and $pty">
+ <xsl:variable name="val_ptx">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="$ptx"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="val_pty">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="$pty"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="round( $input_boxwidth - ( $val_ptx - $input_x ) * 1000 )"/>
+ <xsl:value-of select="','"/>
+ <xsl:value-of select="round( ( $val_pty - $input_y ) * 1000 )"/>
+ </xsl:if>
+ <xsl:if test="contains($nextinput,',')">
+ <xsl:value-of select="' '"/>
+ <!--Leave a blank first as mark of points group-->
+ <xsl:call-template name="wordpoints2oopoints">
+ <xsl:with-param name="input_points" select="$nextinput"/>
+ <xsl:with-param name="input_x" select="$input_x"/>
+ <xsl:with-param name="input_y" select="$input_y"/>
+ <xsl:with-param name="input_width" select="$input_width"/>
+ <xsl:with-param name="input_height" select="$input_height"/>
+ <xsl:with-param name="input_boxwidth" select="$input_boxwidth"/>
+ <xsl:with-param name="input_boxheight" select="$input_boxheight"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <!--template MapConstColor:input is a color in form of const e.g 'red' or number e.g '#ff0010' output is a number color-->
+ <xsl:template name="MapConstColor">
+ <xsl:param name="color"/>
+ <xsl:choose>
+ <xsl:when test="$color='black'">#000000</xsl:when>
+ <xsl:when test="$color='olive'">#808000</xsl:when>
+ <xsl:when test="$color='red'">#ff0000</xsl:when>
+ <xsl:when test="$color='teal'">#008080</xsl:when>
+ <xsl:when test="$color='green'">#00ff00</xsl:when>
+ <xsl:when test="$color='gray'">#808080</xsl:when>
+ <xsl:when test="$color='blue'">#0000ff</xsl:when>
+ <xsl:when test="$color='navy'">#000080</xsl:when>
+ <xsl:when test="$color='white'">#ffffff</xsl:when>
+ <xsl:when test="$color='lime'">#00ff00</xsl:when>
+ <xsl:when test="$color='yellow'">#ffff00</xsl:when>
+ <xsl:when test="$color='fuchsia'">#ff00ff</xsl:when>
+ <xsl:when test="$color='purple'">#800080</xsl:when>
+ <xsl:when test="$color='aqua'">#00ffff</xsl:when>
+ <xsl:when test="$color='maroon'">#800000</xsl:when>
+ <xsl:when test="$color='silver'">#c0c0c0</xsl:when>
+ <xsl:when test="$color='window'">#ffffff</xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="string-length($color) =7">
+ <xsl:value-of select="$color"/>
+ </xsl:when>
+ <xsl:when test="string-length($color) =4">
+ <!--short form representation of color-->
+ <xsl:variable name="valr">
+ <xsl:value-of select="concat(substring($color,2,1),substring($color,2,1))"/>
+ <!--<xsl:call-template name="shortcolorconv"><xsl:with-param name="value" select="substring($color,2,1)"/></xsl:call-template>-->
+ </xsl:variable>
+ <xsl:variable name="valg" select="concat(substring($color,3,1),substring($color,3,1))"/>
+ <xsl:variable name="valb" select="concat(substring($color,4,1),substring($color,4,1))"/>
+ <xsl:value-of select="concat('#',$valr,$valg,$valb)"/>
+ </xsl:when>
+ <xsl:otherwise>#000000</xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="shortcolorconv">
+ <xsl:param name="value"/>
+ <xsl:choose>
+ <xsl:when test="$value='1'">11</xsl:when>
+ <xsl:when test="$value='2'">22</xsl:when>
+ <xsl:when test="$value='3'">33</xsl:when>
+ <xsl:when test="$value='4'">44</xsl:when>
+ <xsl:when test="$value='5'">55</xsl:when>
+ <xsl:when test="$value='6'">66</xsl:when>
+ <xsl:when test="$value='7'">77</xsl:when>
+ <xsl:when test="$value='8'">88</xsl:when>
+ <xsl:when test="$value='9'">99</xsl:when>
+ <xsl:when test="$value='a'">aa</xsl:when>
+ <xsl:when test="$value='b'">bb</xsl:when>
+ <xsl:when test="$value='c'">cc</xsl:when>
+ <xsl:when test="$value='d'">dd</xsl:when>
+ <xsl:when test="$value='e'">ee</xsl:when>
+ <xsl:when test="$value='f'">ff</xsl:when>
+ <!--I just guess it, maybe it is not right-->
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="MapArrowStyle">
+ <!--What is a block?normal arrow?-->
+ <xsl:param name="arrow-name"/>
+ <xsl:choose>
+ <xsl:when test="$arrow-name = 'Block' ">Arrow</xsl:when>
+ <xsl:when test="$arrow-name = 'Diamond' ">Square</xsl:when>
+ <xsl:when test="$arrow-name = 'Open' ">Line Arrow</xsl:when>
+ <xsl:when test="$arrow-name = 'Oval' ">Circle</xsl:when>
+ <xsl:when test="$arrow-name = 'Diamond' ">Square 45</xsl:when>
+ <xsl:when test="$arrow-name = 'Classic' ">Arrow concave</xsl:when>
+ <xsl:otherwise>Arrow</xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="Add-with-Measure">
+ <xsl:param name="value1"/>
+ <xsl:param name="value2"/>
+ <xsl:variable name="Current-MeasureMark">
+ <xsl:choose>
+ <xsl:when test="string-length(translate($value1 ,'-.0123456789 ','' )) &gt; 0">
+ <xsl:value-of select="translate($value1 ,'-.0123456789 ','' )"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="translate($value2 ,'-.0123456789 ','' )"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="number-value1">
+ <xsl:call-template name="get-number">
+ <xsl:with-param name="value" select="$value1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="number-value2">
+ <xsl:call-template name="get-number">
+ <xsl:with-param name="value" select="$value2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="concat( $number-value1 + $number-value2 , $Current-MeasureMark)"/>
+ </xsl:template>
+ <xsl:template name="convert-with-scale-and-measure">
+ <xsl:param name="value"/>
+ <xsl:param name="group-value" select="0"/>
+ <xsl:param name="coord-value" select="0"/>
+ <xsl:param name="scale" select="1"/>
+ <xsl:param name="MeasureMark" select="''"/>
+ <xsl:param name="Target-Measure" select="''"/>
+ <xsl:variable name="Current-MeasureMark">
+ <xsl:choose>
+ <xsl:when test="not (translate($value ,'-. 0123456789 ','' ) = '') ">
+ <xsl:value-of select="translate($value ,'-. 0123456789 ','' ) "/>
+ </xsl:when>
+ <xsl:when test="string-length($MeasureMark) &gt; 0">
+ <xsl:value-of select="$MeasureMark"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="translate($value ,'-. 0123456789 ','' ) "/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="number-value">
+ <xsl:call-template name="get-number">
+ <xsl:with-param name="value" select="$value"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="value-string" select="( $number-value - $coord-value) div $scale + $group-value"/>
+ <xsl:choose>
+ <xsl:when test="$value-string = 0">0cm</xsl:when>
+ <xsl:when test="$Target-Measure = $Current-MeasureMark">
+ <xsl:value-of select="concat($value-string , $Current-MeasureMark)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat($value-string , $Current-MeasureMark)"/>
+ </xsl:call-template>
+ <xsl:value-of select=" 'cm' "/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-number">
+ <xsl:param name="value"/>
+ <xsl:choose>
+ <xsl:when test="translate($value,'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ','') = '' ">0</xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="number(translate($value,'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',''))"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xalan:component prefix="oleextracter" elements="init exit" functions="getByName insertByName">
+ <xalan:script lang="javaclass" src="xalan://XSLTFilterOLEExtracter"/>
+ </xalan:component>
+</xsl:stylesheet>
diff --git a/filter/source/xslt/import/wordml/wordml2ooo_field.xsl b/filter/source/xslt/import/wordml/wordml2ooo_field.xsl
new file mode 100644
index 000000000000..6c77f63e66a6
--- /dev/null
+++ b/filter/source/xslt/import/wordml/wordml2ooo_field.xsl
@@ -0,0 +1,1587 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="w wx aml o dt fo v">
+ <!--Generally, The MS fields can be represented in two forms, simple field w:fldsimple or complicated field
+ w:fldChar, so when importing we have to take care of two possible forms of the same type field -->
+ <xsl:template match="w:instrText">
+ <!-- ===this template is to process the w:fldChar fields ====== -->
+ <xsl:choose>
+ <xsl:when test="substring(normalize-space(.),1,7) = 'PAGEREF' ">
+ <xsl:variable name="bookmarkname">
+ <xsl:value-of select="normalize-space(substring-before (substring-after( . , 'PAGEREF' ), '\*')) "/>
+ </xsl:variable>
+ <text:bookmark-ref text:reference-format="page" text:ref-name="{$bookmarkname}">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </text:bookmark-ref>
+ </xsl:when>
+ <xsl:when test="substring( normalize-space(.),1,9) = 'HYPERLINK' ">
+ <xsl:variable name="hyper-str" select="normalize-space(.)"/>
+ <xsl:variable name="hyper-dest" select="substring-before( substring($hyper-str, 12), '&quot;')"/>
+ <xsl:variable name="hyper-bookmark">
+ <xsl:if test="contains( $hyper-str, ' \l ')">
+ <xsl:value-of select="concat( '#', substring-before( substring-after( substring-after( $hyper-str, ' \l '), '&quot;'), '&quot;') )"/>
+ </xsl:if>
+ </xsl:variable>
+ <text:a xlink:type="simple" xlink:href="{concat( $hyper-dest, $hyper-bookmark)}">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </text:a>
+ </xsl:when>
+ <xsl:when test="substring( normalize-space(.),1,3) = 'REF' ">
+ <text:bookmark-ref text:reference-format="text" text:ref-name="{normalize-space( substring-before (substring-after(text(), 'REF') , '\') )}">
+
+ </text:bookmark-ref>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(.),1,4) = 'DATE' or substring(normalize-space(.),1,4) = 'TIME' ">
+ <text:date>
+ <xsl:choose>
+ <xsl:when test="contains(text(), '\@')">
+ <xsl:attribute name="style:data-style-name">ND<xsl:number count="w:instrText | w:fldSimple" from="/w:wordDocument/w:body" level="any" format="1"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:data-style-name"><xsl:value-of select=" 'NDF1' "/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </text:date>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(.),1,9) = 'PRINTDATE' ">
+ <text:print-date>
+ <xsl:choose>
+ <xsl:when test="contains(text(), '\@')">
+ <xsl:attribute name="style:data-style-name">ND<xsl:number count="w:instrText | w:fldSimple" from="/w:wordDocument/w:body" level="any" format="1"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:data-style-name"><xsl:value-of select=" 'NDF1' "/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </text:print-date>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(.),1,10) = 'CREATEDATE' ">
+ <text:creation-date>
+ <xsl:choose>
+ <xsl:when test="contains(text(), '\@')">
+ <xsl:attribute name="style:data-style-name">ND<xsl:number count="w:instrText | w:fldSimple" from="/w:wordDocument/w:body" level="any" format="1"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:data-style-name"><xsl:value-of select=" 'NDF1' "/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </text:creation-date>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(.),1,8) = 'SAVEDATE' ">
+ <text:modification-date>
+ <xsl:choose>
+ <xsl:when test="contains(text(), '\@')">
+ <xsl:attribute name="style:data-style-name">ND<xsl:number count="w:instrText | w:fldSimple" from="/w:wordDocument/w:body" level="any" format="1"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:data-style-name"><xsl:value-of select=" 'NDF1' "/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </text:modification-date>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(.),1,4) = 'PAGE' ">
+ <text:page-number text:select-page="current">
+ <xsl:variable name="num-format">
+ <xsl:call-template name="get_field_num_format">
+ <xsl:with-param name="input_MS_num_format" select="normalize-space(substring-after(text(), '\*' ))"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="style:num-format"><xsl:value-of select="$num-format"/></xsl:attribute>
+ </text:page-number>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(.),1,8) = 'NUMPAGES' ">
+ <text:page-count>
+ <xsl:variable name="num-format">
+ <xsl:call-template name="get_field_num_format">
+ <xsl:with-param name="input_MS_num_format" select="normalize-space(substring-after(text(), '\*' ))"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="style:num-format"><xsl:value-of select="$num-format"/></xsl:attribute>
+ </text:page-count>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(.),1,8) = 'NUMWORDS' ">
+ <text:word-count>
+ <xsl:variable name="num-format">
+ <xsl:call-template name="get_field_num_format">
+ <xsl:with-param name="input_MS_num_format" select="normalize-space(substring-after(text(), '\*' ))"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="style:num-format"><xsl:value-of select="$num-format"/></xsl:attribute>
+ </text:word-count>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(.),1,8) = 'NUMCHARS' ">
+ <text:character-count>
+ <xsl:variable name="num-format">
+ <xsl:call-template name="get_field_num_format">
+ <xsl:with-param name="input_MS_num_format" select="normalize-space(substring-after(text(), '\*' ))"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="style:num-format"><xsl:value-of select="$num-format"/></xsl:attribute>
+ </text:character-count>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(.),1,6) = 'REVNUM' ">
+ <text:editing-cycles>
+ <xsl:value-of select="w:r"/>
+ </text:editing-cycles>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(.),1,7) = 'AUTONUM' or substring(normalize-space(.),1,10) = 'AUTONUMLGL' or substring(normalize-space(.),1,10) = 'AUTONUMOUT' ">
+ <text:sequence>
+ <xsl:attribute name="text:ref-name">RefAutoNum<xsl:number count="w:instrText[contains(text(), 'AUTONUM') or contains(text(), 'AUTONUMLGL') or contains( text(), 'AUTONUMOUT') ] | w:fldSimple[contains(@w:instr,'AUTONUM') or contains(@w:instr, 'AUTONUMLGL') or contains(@w:instr, 'AUTONUMOUT') ] " from="/w:wordDocument/w:body" level="any" format="1"/></xsl:attribute>
+ <xsl:attribute name="text:name"><xsl:value-of select=" 'AutoNr' "/></xsl:attribute>
+ <xsl:attribute name="text:formula"><xsl:value-of select=" 'ooow:AutoNr + 1' "/></xsl:attribute>
+ <xsl:variable name="num-format">
+ <xsl:call-template name="get_field_num_format">
+ <xsl:with-param name="input_MS_num_format" select="normalize-space(substring-after(text(), '\*' ))"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="style:num-format"><xsl:value-of select="$num-format"/></xsl:attribute>
+ </text:sequence>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(.),1,3) = 'SEQ' ">
+ <text:sequence>
+ <xsl:attribute name="text:ref-name">Ref<xsl:number count="w:instrText[contains(text(), 'SEQ') ] | w:fldSimple[contains(@w:instr,'SEQ') ] " from="/w:wordDocument/w:body" level="any" format="1"/></xsl:attribute>
+ <xsl:variable name="seq_text_name">
+ <xsl:call-template name="get_seq_name">
+ <xsl:with-param name="input_seq_string" select="normalize-space(substring-after(text(), 'SEQ'))"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="text:name"><xsl:value-of select="$seq_text_name"/></xsl:attribute>
+ <xsl:attribute name="text:formula"><xsl:value-of select="concat (concat('ooow:',$seq_text_name), ' + 1' )"/></xsl:attribute>
+ <xsl:variable name="num-format">
+ <xsl:call-template name="get_field_num_format">
+ <xsl:with-param name="input_MS_num_format" select="normalize-space(substring-after(text(), '\*' ))"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="style:num-format"><xsl:value-of select="$num-format"/></xsl:attribute>
+ </text:sequence>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(.),1,6) = 'AUTHOR' ">
+ <text:initial-creator>
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </text:initial-creator>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(.),1,5) = 'TITLE' ">
+ <text:title>
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </text:title>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(.),1,7) = 'SUBJECT' ">
+ <text:subject>
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </text:subject>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(.),1,8) = 'KEYWORDS' ">
+ <text:keywords>
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </text:keywords>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(.),1,6) = 'FILLIN' ">
+ <text:text-input>
+ <xsl:attribute name="text:description"><xsl:value-of select="substring-before(substring-after(text(), 'FILLIN'), '\*')"/></xsl:attribute>
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </text:text-input>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(.),1,11) = 'DOCPROPERTY' ">
+ <xsl:variable name="instr_command">
+ <xsl:value-of select="normalize-space (substring-after(text(), 'DOCPROPERTY' ))"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="contains($instr_command, 'Author' ) ">
+ <text:user-field-get text:name="Author">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Bytes' ) ">
+ <text:user-field-get text:name="Bytes">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'CharactersWithSpaces' ) ">
+ <text:user-field-get text:name="CharactersWithSpaces">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Category' ) ">
+ <text:user-field-get text:name="Category">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Characters' ) ">
+ <text:user-field-get text:name="Characters">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Comments' ) ">
+ <text:user-field-get text:name="Comments">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Company' ) ">
+ <text:user-field-get text:name="Company">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'CreateTime' ) ">
+ <text:user-field-get text:name="CreateTime">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'HyperlinkBase' ) ">
+ <text:user-field-get text:name="HyperlinkBase">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Keywords' ) ">
+ <text:user-field-get text:name="Keywords">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'LastPrinted' ) ">
+ <text:user-field-get text:name="LastPrinted">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'LastSavedBy' ) ">
+ <text:user-field-get text:name="LastSavedBy">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'LastSavedTime' ) ">
+ <text:user-field-get text:name="LastSavedTime">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Lines' ) ">
+ <text:user-field-get text:name="Lines">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Manager' ) ">
+ <text:user-field-get text:name="Manager">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'NameofApplication' ) ">
+ <text:user-field-get text:name="NameofApplication">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'ODMADocId' ) ">
+ <text:user-field-get text:name="ODMADocId">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Pages' ) ">
+ <text:user-field-get text:name="Pages">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Paragraphs' ) ">
+ <text:user-field-get text:name="Paragraphs">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'RevisionNumber' ) ">
+ <text:user-field-get text:name="RevisionNumber">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Security' ) ">
+ <text:user-field-get text:name="Security">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Subject' ) ">
+ <text:user-field-get text:name="Subject">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Template' ) ">
+ <text:user-field-get text:name="Template">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Title' ) ">
+ <text:user-field-get text:name="Title">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'TotalEditingTime' ) ">
+ <text:user-field-get text:name="TotalEditingTime">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Words' ) ">
+ <text:user-field-get text:name="Words">
+ </text:user-field-get>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(.),1,10) = 'MERGEFIELD' ">
+ <text:database-display text:database-name="" text:table-name="" text:table-type="table">
+ <xsl:attribute name="text:column-name"><xsl:value-of select="substring-before(substring-after(normalize-space(.), 'MERGEFIELD' ), ' ' ) "/></xsl:attribute>
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </text:database-display>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(.),1,8) = 'MERGEREC' ">
+ <text:database-row-number text:database-name="" text:table-name="" text:table-type="table" style:num-format="A" text:value="0">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </text:database-row-number>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(.),1,4) = 'NEXT' ">
+ <text:database-next text:database-name="" text:table-name="" text:table-type="table" text:condition="">
+ </text:database-next>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="w:fldChar">
+ <!-- for complicated field w:fldChar, we only process the w:instrText, please see the template processing w:instrText -->
+ </xsl:template>
+ <xsl:template name="get-fldchar-content">
+ <!-- this template is to get the content of fldchar in-between w:instrText and w:fldChar/@w:fldCharType ='end' -->
+ <xsl:param name="next_node"/>
+ <xsl:param name="sibling_number"/>
+ <xsl:if test="not ($next_node/w:fldChar/@w:fldCharType ='end' ) and $next_node ">
+ <xsl:if test="$next_node/w:br">
+ <xsl:text>&#x0A;</xsl:text>
+ </xsl:if>
+ <xsl:value-of select="$next_node//w:t"/>
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[$sibling_number + 1]"/>
+ <xsl:with-param name="sibling_number" select="$sibling_number + 1"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <!-- ====== this template is to process the w:fldsimple fields ======= -->
+ <xsl:template match="w:fldSimple">
+ <xsl:choose>
+ <xsl:when test="substring(normalize-space(@w:instr),1,7) = 'PAGEREF' ">
+ <xsl:variable name="bookmarkname">
+ <xsl:value-of select="normalize-space(substring-before (substring-after( @w:instr , 'PAGEREF' ), '\*')) "/>
+ </xsl:variable>
+ <text:bookmark-ref text:reference-format="page" text:ref-name="{$bookmarkname}">
+ <xsl:value-of select=" .//w:t"/>
+ </text:bookmark-ref>
+ </xsl:when>
+ <xsl:when test="substring( normalize-space(@w:instr),1,9) = 'HYPERLINK' ">
+ <xsl:variable name="hyper-str" select="normalize-space(@w:instr)"/>
+ <xsl:variable name="hyper-dest" select="substring-before( substring($hyper-str, 12), '&quot;')"/>
+ <xsl:variable name="hyper-bookmark">
+ <xsl:if test="contains( $hyper-str, ' \l ')">
+ <xsl:value-of select="concat( '#', substring-before( substring-after( substring-after( $hyper-str, ' \l '), '&quot;'), '&quot;') )"/>
+ </xsl:if>
+ </xsl:variable>
+ <text:a xlink:type="simple" xlink:href="{concat( $hyper-dest, $hyper-bookmark)}">
+ <xsl:value-of select=" .//w:t"/>
+ </text:a>
+ </xsl:when>
+ <xsl:when test="substring( normalize-space(@w:instr),1,3) = 'REF' ">
+ <text:bookmark-ref text:reference-format="text" text:ref-name="{normalize-space( substring-before (substring-after(@w:instr, 'REF') , '\') )}">
+
+ </text:bookmark-ref>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(@w:instr),1,4) = 'DATE' or substring(normalize-space(@w:instr),1,4) = 'TIME' ">
+ <text:date>
+ <xsl:attribute name="style:data-style-name"><xsl:value-of select=" 'NDF1' "/></xsl:attribute>
+ <xsl:value-of select=".//w:t"/>
+ </text:date>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(@w:instr),1,9) = 'PRINTDATE' ">
+ <text:print-date>
+ <xsl:attribute name="style:data-style-name"><xsl:value-of select=" 'NDF1' "/></xsl:attribute>
+ <xsl:value-of select=".//w:t"/>
+ </text:print-date>
+ </xsl:when>
+ <xsl:when test=" substring(normalize-space(@w:instr),1,10) = 'CREATEDATE' ">
+ <text:creation-date>
+ <xsl:attribute name="style:data-style-name"><xsl:value-of select=" 'NDF1' "/></xsl:attribute>
+ <xsl:value-of select=".//w:t"/>
+ </text:creation-date>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(@w:instr),1,8) = 'SAVEDATE' ">
+ <text:modification-date>
+ <xsl:attribute name="style:data-style-name"><xsl:value-of select=" 'NDF1' "/></xsl:attribute>
+ <xsl:value-of select=".//w:t"/>
+ </text:modification-date>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(@w:instr),1,4) = 'PAGE' ">
+ <text:page-number text:select-page="current">
+ <xsl:variable name="num-format">
+ <xsl:call-template name="get_field_num_format">
+ <xsl:with-param name="input_MS_num_format" select="normalize-space(substring-after(@w:instr, '\*' ))"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="style:num-format"><xsl:value-of select="$num-format"/></xsl:attribute>
+ </text:page-number>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(@w:instr),1,8) = 'NUMPAGES' ">
+ <text:page-count>
+ <xsl:variable name="num-format">
+ <xsl:call-template name="get_field_num_format">
+ <xsl:with-param name="input_MS_num_format" select="normalize-space(substring-after(@w:instr, '\*' ))"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="style:num-format"><xsl:value-of select="$num-format"/></xsl:attribute>
+ </text:page-count>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(@w:instr),1,8) = 'NUMWORDS' ">
+ <text:word-count>
+ <xsl:variable name="num-format">
+ <xsl:call-template name="get_field_num_format">
+ <xsl:with-param name="input_MS_num_format" select="normalize-space(substring-after(@w:instr, '\*' ))"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="style:num-format"><xsl:value-of select="$num-format"/></xsl:attribute>
+ </text:word-count>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(@w:instr),1,8) = 'NUMCHARS' ">
+ <text:character-count>
+ <xsl:variable name="num-format">
+ <xsl:call-template name="get_field_num_format">
+ <xsl:with-param name="input_MS_num_format" select="normalize-space(substring-after(@w:instr, '\*' ))"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="style:num-format"><xsl:value-of select="$num-format"/></xsl:attribute>
+ </text:character-count>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(@w:instr),1,6) = 'REVNUM' ">
+ <text:editing-cycles>
+ <xsl:value-of select="w:r"/>
+ </text:editing-cycles>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(@w:instr),1,7) = 'AUTONUM' or substring(normalize-space(@w:instr),1,10) = 'AUTONUMLGL' or substring(normalize-space(@w:instr),1,10) = 'AUTONUMOUT' ">
+ <text:sequence>
+ <xsl:attribute name="text:ref-name">RefAutoNum<xsl:number count="w:instrText[contains(text(), 'AUTONUM') or contains(text(), 'AUTONUMLGL') or contains( text(), 'AUTONUMOUT') ] | w:fldSimple[contains(@w:instr,'AUTONUM') or contains(@w:instr, 'AUTONUMLGL') or contains(@w:instr, 'AUTONUMOUT') ] " from="/w:wordDocument/w:body" level="any" format="1"/></xsl:attribute>
+ <xsl:attribute name="text:name"><xsl:value-of select=" 'AutoNr' "/></xsl:attribute>
+ <xsl:attribute name="text:formula"><xsl:value-of select=" 'ooow:AutoNr + 1' "/></xsl:attribute>
+ <xsl:variable name="num-format">
+ <xsl:call-template name="get_field_num_format">
+ <xsl:with-param name="input_MS_num_format" select="normalize-space(substring-after(@w:instr, '\*' ))"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="style:num-format"><xsl:value-of select="$num-format"/></xsl:attribute>
+ </text:sequence>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(@w:instr),1,3) = 'SEQ' ">
+ <text:sequence>
+ <xsl:attribute name="text:ref-name">Ref<xsl:number count="w:instrText[contains(text(), 'SEQ') ] | w:fldSimple[contains(@w:instr,'SEQ') ] " from="/w:wordDocument/w:body" level="any" format="1"/></xsl:attribute>
+ <xsl:variable name="seq_text_name">
+ <xsl:call-template name="get_seq_name">
+ <xsl:with-param name="input_seq_string" select="normalize-space(substring-after(@w:instr, 'SEQ'))"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="text:name"><xsl:value-of select="$seq_text_name "/></xsl:attribute>
+ <xsl:attribute name="text:formula"><xsl:value-of select="concat (concat('ooow:',$seq_text_name), ' + 1' )"/></xsl:attribute>
+ <xsl:variable name="num-format">
+ <xsl:call-template name="get_field_num_format">
+ <xsl:with-param name="input_MS_num_format" select="normalize-space(substring-after(@w:instr, '\*' ))"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="style:num-format"><xsl:value-of select="$num-format"/></xsl:attribute>
+ </text:sequence>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(@w:instr),1,6) = 'AUTHOR' ">
+ <text:initial-creator>
+ <xsl:value-of select=" .//w:t"/>
+ </text:initial-creator>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(@w:instr),1,5) = 'TITLE' ">
+ <text:title>
+ <xsl:value-of select=" .//w:t"/>
+ </text:title>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(@w:instr),1,7) = 'SUBJECT' ">
+ <text:subject>
+ <xsl:value-of select=" .//w:t"/>
+ </text:subject>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(@w:instr),1,8) = 'KEYWORDS' ">
+ <text:keywords>
+ <xsl:value-of select=" .//w:t"/>
+ </text:keywords>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(@w:instr),1,6) = 'FILLIN' ">
+ <text:text-input>
+ <xsl:attribute name="text:description"><xsl:value-of select="substring-before(substring-after(@w:instr, '&quot;'), '&quot;')"/></xsl:attribute>
+ <xsl:value-of select=" .//w:t"/>
+ </text:text-input>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(@w:instr),1,11) = 'DOCPROPERTY' ">
+ <xsl:variable name="instr_command">
+ <xsl:value-of select="normalize-space (substring-after(@w:instr, 'DOCPROPERTY' ))"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="contains($instr_command, 'Author' ) ">
+ <text:user-field-get text:name="Author">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Bytes' ) ">
+ <text:user-field-get text:name="Bytes">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Category' ) ">
+ <text:user-field-get text:name="Category">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'CharactersWithSpaces' ) ">
+ <text:user-field-get text:name="CharactersWithSpaces">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Characters' ) ">
+ <text:user-field-get text:name="Characters">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Comments' ) ">
+ <text:user-field-get text:name="Comments">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Company' ) ">
+ <text:user-field-get text:name="Company">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'CreateTime' ) ">
+ <text:user-field-get text:name="CreateTime">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'HyperlinkBase' ) ">
+ <text:user-field-get text:name="HyperlinkBase">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Keywords' ) ">
+ <text:user-field-get text:name="Keywords">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'LastPrinted' ) ">
+ <text:user-field-get text:name="LastPrinted">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'LastSavedBy' ) ">
+ <text:user-field-get text:name="LastSavedBy">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'LastSavedTime' ) ">
+ <text:user-field-get text:name="LastSavedTime">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Lines' ) ">
+ <text:user-field-get text:name="Lines">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Manager' ) ">
+ <text:user-field-get text:name="Manager">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'NameofApplication' ) ">
+ <text:user-field-get text:name="NameofApplication">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'ODMADocId' ) ">
+ <text:user-field-get text:name="ODMADocId">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Pages' ) ">
+ <text:user-field-get text:name="Pages">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Paragraphs' ) ">
+ <text:user-field-get text:name="Paragraphs">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'RevisionNumber' ) ">
+ <text:user-field-get text:name="RevisionNumber">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Security' ) ">
+ <text:user-field-get text:name="Security">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Subject' ) ">
+ <text:user-field-get text:name="Subject">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Template' ) ">
+ <text:user-field-get text:name="Template">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Title' ) ">
+ <text:user-field-get text:name="Title">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'TotalEditingTime' ) ">
+ <text:user-field-get text:name="TotalEditingTime">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Words' ) ">
+ <text:user-field-get text:name="Words">
+ </text:user-field-get>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(@w:instr),1,10) = 'MERGEFIELD' ">
+ <text:database-display text:database-name="" text:table-name="" text:table-type="table">
+ <xsl:attribute name="text:column-name"><xsl:value-of select="substring-before(substring-after(normalize-space(.), 'MERGEFIELD' ), ' ' ) "/></xsl:attribute>
+ <xsl:value-of select=" .//w:t"/>
+ </text:database-display>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(@w:instr),1,8) = 'MERGEREC' ">
+ <text:database-row-number text:database-name="" text:table-name="" text:table-type="table" style:num-format="A" text:value="0">
+ <xsl:value-of select=" .//w:t"/>
+ </text:database-row-number>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(@w:instr),1,4) = 'NEXT' ">
+ <text:database-next text:database-name="" text:table-name="" text:table-type="table" text:condition="">
+ <xsl:value-of select=" .//w:t"/>
+ </text:database-next>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- for MS simple fields that can not map to OOo writer fields, we just import the content of these fields -->
+ <xsl:value-of select="w:r"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get_seq_name">
+ <!-- this template is to get the identifier from the input MS seq string -->
+ <xsl:param name="input_seq_string"/>
+ <xsl:choose>
+ <xsl:when test="contains( $input_seq_string, ' ' )">
+ <xsl:value-of select="substring-before($input_seq_string, ' ' )"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$input_seq_string"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="default_seqence_declaration">
+ <text:sequence-decl text:display-outline-level="0" text:name="Illustration">
+ </text:sequence-decl>
+ <text:sequence-decl text:display-outline-level="0" text:name="Table">
+ </text:sequence-decl>
+ <text:sequence-decl text:display-outline-level="0" text:name="Text">
+ </text:sequence-decl>
+ <text:sequence-decl text:display-outline-level="0" text:name="Drawing">
+ </text:sequence-decl>
+ <text:sequence-decl text:display-outline-level="0" text:name="AutoNr">
+ </text:sequence-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="sequence_declare">
+ <text:sequence-decl text:display-outline-level="0">
+ <xsl:variable name="seq_variable_name">
+ <xsl:choose>
+ <xsl:when test=" name() = 'w:instrText' ">
+ <xsl:if test="substring(normalize-space(text()),1,3) = 'SEQ' ">
+ <xsl:call-template name="get_seq_name">
+ <xsl:with-param name="input_seq_string" select="normalize-space( substring-after(text(), 'SEQ' ))"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:when>
+ <xsl:when test=" name() = 'w:fldSimple' ">
+ <xsl:if test="substring(normalize-space(@w:instr),1,3) = 'SEQ' ">
+ <xsl:call-template name="get_seq_name">
+ <xsl:with-param name="input_seq_string" select="normalize-space( substring-after(@w:instr, 'SEQ' ))"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="text:name"><xsl:value-of select="$seq_variable_name"/></xsl:attribute>
+ </text:sequence-decl>
+ </xsl:template>
+ <!-- ===== the following templates are to generate the user fields declarations for MS word DocProperty field importing == -->
+ <xsl:template name="user_fields_declare_docproperty">
+ <xsl:variable name="document-field-root" select="/w:wordDocument/w:body//w:instrText[substring(normalize-space(text()),1,11) = 'DOCPROPERTY' ] | /w:wordDocument/w:body//w:fldSimple[substring(normalize-space(@w:instr),1,11) = 'DOCPROPERTY' ] "/>
+ <xsl:variable name="field_Author_nodeset" select="$document-field-root[contains(text(), 'Author')] | $document-field-root[contains(@w:instr, 'Author')]"/>
+ <xsl:variable name="field_Bytes_nodeset" select="$document-field-root[contains(text(), 'Bytes')] | $document-field-root[contains(@w:instr, 'Bytes')]"/>
+ <xsl:variable name="field_Category_nodeset" select="$document-field-root[contains(text(), 'Category')] | $document-field-root[contains(@w:instr, 'Category')]"/>
+ <xsl:variable name="field_Characters_nodeset" select="$document-field-root[contains(text(), 'Characters')] | $document-field-root[contains(@w:instr, 'Characters')]"/>
+ <xsl:variable name="field_CharactersWithSpaces_nodeset" select="$document-field-root[contains(text(), 'CharactersWithSpaces')] | $document-field-root[contains(@w:instr, 'CharactersWithSpaces')]"/>
+ <xsl:variable name="field_Comments_nodeset" select="$document-field-root[contains(text(), 'Comments')] | $document-field-root[contains(@w:instr, 'Comments')]"/>
+ <xsl:variable name="field_Company_nodeset" select="$document-field-root[contains(text(), 'Company')] | $document-field-root[contains(@w:instr, 'Company')]"/>
+ <xsl:variable name="field_CreateTime_nodeset" select="$document-field-root[contains(text(), 'CreateTime')] | $document-field-root[contains(@w:instr, 'CreateTime')]"/>
+ <xsl:variable name="field_HyperlinkBase_nodeset" select="$document-field-root[contains(text(), 'HyperlinkBase')] | $document-field-root[contains(@w:instr, 'HyperlinkBase')]"/>
+ <xsl:variable name="field_Keywords_nodeset" select="$document-field-root[contains(text(), 'Keywords')] | $document-field-root[contains(@w:instr, 'Keywords')]"/>
+ <xsl:variable name="field_LastPrinted_nodeset" select="$document-field-root[contains(text(), 'LastPrinted')] | $document-field-root[contains(@w:instr, 'LastPrinted')]"/>
+ <xsl:variable name="field_LastSavedBy_nodeset" select="$document-field-root[contains(text(), 'LastSavedBy')] | $document-field-root[contains(@w:instr, 'LastSavedBy')]"/>
+ <xsl:variable name="field_LastSavedTime_nodeset" select="$document-field-root[contains(text(), 'LastSavedTime')] | $document-field-root[contains(@w:instr, 'LastSavedTime')]"/>
+ <xsl:variable name="field_Lines_nodeset" select="$document-field-root[contains(text(), 'Lines')] | $document-field-root[contains(@w:instr, 'Lines')]"/>
+ <xsl:variable name="field_Manager_nodeset" select="$document-field-root[contains(text(), 'Manager')] | $document-field-root[contains(@w:instr, 'Manager')]"/>
+ <xsl:variable name="field_NameofApplication_nodeset" select="$document-field-root[contains(text(), 'NameofApplication')] | $document-field-root[contains(@w:instr, 'NameofApplication')]"/>
+ <xsl:variable name="field_ODMADocId_nodeset" select="$document-field-root[contains(text(), 'ODMADocId')] | $document-field-root[contains(@w:instr, 'ODMADocId')]"/>
+ <xsl:variable name="field_Pages_nodeset" select="$document-field-root[contains(text(), 'Pages')] | $document-field-root[contains(@w:instr, 'Pages')]"/>
+ <xsl:variable name="field_Paragraphs_nodeset" select="$document-field-root[contains(text(), 'Paragraphs')] | $document-field-root[contains(@w:instr, 'Paragraphs')]"/>
+ <xsl:variable name="field_RevisionNumber_nodeset" select="$document-field-root[contains(text(), 'RevisionNumber')] | $document-field-root[contains(@w:instr, 'RevisionNumber')]"/>
+ <xsl:variable name="field_Security_nodeset" select="$document-field-root[contains(text(), 'Security')] | $document-field-root[contains(@w:instr, 'Security')]"/>
+ <xsl:variable name="field_Subject_nodeset" select="$document-field-root[contains(text(), 'Subject')] | $document-field-root[contains(@w:instr, 'Subject')]"/>
+ <xsl:variable name="field_Template_nodeset" select="$document-field-root[contains(text(), 'Template')] | $document-field-root[contains(@w:instr, 'Template')]"/>
+ <xsl:variable name="field_Title_nodeset" select="$document-field-root[contains(text(), 'Title')] | $document-field-root[contains(@w:instr, 'Title')]"/>
+ <xsl:variable name="field_TotalEditingTime_nodeset" select="$document-field-root[contains(text(), 'TotalEditingTime')] | $document-field-root[contains(@w:instr, 'TotalEditingTime')]"/>
+ <xsl:variable name="field_Words_nodeset" select="$document-field-root[contains(text(), 'Words')] | $document-field-root[contains(@w:instr, 'Words')]"/>
+ <xsl:apply-templates select="$field_Author_nodeset[1]" mode="user_field_Author_declare"/>
+ <xsl:apply-templates select="$field_Bytes_nodeset[1]" mode="user_field_Bytes_declare"/>
+ <xsl:apply-templates select="$field_Category_nodeset[1]" mode="user_field_Category_declare"/>
+ <xsl:apply-templates select="$field_Characters_nodeset[1]" mode="user_field_Characters_declare"/>
+ <xsl:apply-templates select="$field_CharactersWithSpaces_nodeset[1]" mode="user_field_CharactersWithSpaces_declare"/>
+ <xsl:apply-templates select="$field_Comments_nodeset[1]" mode="user_field_Comments_declare"/>
+ <xsl:apply-templates select="$field_Company_nodeset[1]" mode="user_field_Company_declare"/>
+ <xsl:apply-templates select="$field_CreateTime_nodeset[1]" mode="user_field_CreateTime_declare"/>
+ <xsl:apply-templates select="$field_HyperlinkBase_nodeset[1]" mode="user_field_HyperlinkBase_declare"/>
+ <xsl:apply-templates select="$field_Keywords_nodeset[1]" mode="user_field_Keywords_declare"/>
+ <xsl:apply-templates select="$field_LastPrinted_nodeset[1]" mode="user_field_LastPrinted_declare"/>
+ <xsl:apply-templates select="$field_LastSavedBy_nodeset[1]" mode="user_field_LastSavedBy_declare"/>
+ <xsl:apply-templates select="$field_LastSavedTime_nodeset[1]" mode="user_field_LastSavedTime_declare"/>
+ <xsl:apply-templates select="$field_Lines_nodeset[1]" mode="user_field_Lines_declare"/>
+ <xsl:apply-templates select="$field_Manager_nodeset[1]" mode="user_field_Manager_declare"/>
+ <xsl:apply-templates select="$field_NameofApplication_nodeset[1]" mode="user_field_NameofApplication_declare"/>
+ <xsl:apply-templates select="$field_ODMADocId_nodeset[1]" mode="user_field_ODMADocId_declare"/>
+ <xsl:apply-templates select="$field_Pages_nodeset[1]" mode="user_field_Pages_declare"/>
+ <xsl:apply-templates select="$field_Paragraphs_nodeset[1]" mode="user_field_Paragraphs_declare"/>
+ <xsl:apply-templates select="$field_RevisionNumber_nodeset[1]" mode="user_field_RevisionNumber_declare"/>
+ <xsl:apply-templates select="$field_Security_nodeset[1]" mode="user_field_Security_declare"/>
+ <xsl:apply-templates select="$field_Subject_nodeset[1]" mode="user_field_Subject_declare"/>
+ <xsl:apply-templates select="$field_Template_nodeset[1]" mode="user_field_Template_declare"/>
+ <xsl:apply-templates select="$field_Title_nodeset[1]" mode="user_field_Title_declare"/>
+ <xsl:apply-templates select="$field_TotalEditingTime_nodeset[1]" mode="user_field_TotalEditingTime_declare"/>
+ <xsl:apply-templates select="$field_Words_nodeset[1]" mode="user_field_Words_declare"/>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Author_declare">
+ <text:user-field-decl office:value-type="string" text:name="Author">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Bytes_declare">
+ <text:user-field-decl office:value-type="string" text:name="Bytes">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Category_declare">
+ <text:user-field-decl office:value-type="string" text:name="Category">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Characters_declare">
+ <text:user-field-decl office:value-type="string" text:name="Characters">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_CharactersWithSpaces_declare">
+ <text:user-field-decl office:value-type="string" text:name="CharactersWithSpaces">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Comments_declare">
+ <text:user-field-decl office:value-type="string" text:name="Comments">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Company_declare">
+ <text:user-field-decl office:value-type="string" text:name="Company">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_CreateTime_declare">
+ <text:user-field-decl office:value-type="string" text:name="CreateTime">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_HyperlinkBase_declare">
+ <text:user-field-decl office:value-type="string" text:name="HyperlinkBase">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Keywords_declare">
+ <text:user-field-decl office:value-type="string" text:name="Keywords">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_LastPrinted_declare">
+ <text:user-field-decl office:value-type="string" text:name="LastPrinted">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_LastSavedBy_declare">
+ <text:user-field-decl office:value-type="string" text:name="LastSavedBy">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_LastSavedTime_declare">
+ <text:user-field-decl office:value-type="string" text:name="LastSavedTime">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Lines_declare">
+ <text:user-field-decl office:value-type="string" text:name="Lines">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Manager_declare">
+ <text:user-field-decl office:value-type="string" text:name="Manager">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_NameofApplication_declare">
+ <text:user-field-decl office:value-type="string" text:name="NameofApplication">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_ODMADocId_declare">
+ <text:user-field-decl office:value-type="string" text:name="ODMADocId">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Pages_declare">
+ <text:user-field-decl office:value-type="string" text:name="Pages">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Paragraphs_declare">
+ <text:user-field-decl office:value-type="string" text:name="Paragraphs">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_RevisionNumber_declare">
+ <text:user-field-decl office:value-type="string" text:name="RevisionNumber">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Security_declare">
+ <text:user-field-decl office:value-type="string" text:name="Security">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Subject_declare">
+ <text:user-field-decl office:value-type="string" text:name="Subject">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Template_declare">
+ <text:user-field-decl office:value-type="string" text:name="Template">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Title_declare">
+ <text:user-field-decl office:value-type="string" text:name="Title">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_TotalEditingTime_declare">
+ <text:user-field-decl office:value-type="string" text:name="TotalEditingTime">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Words_declare">
+ <text:user-field-decl office:value-type="string" text:name="Words">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <!-- =========this following template to convert the ms number format to OOo wirter format === -->
+ <xsl:template name="get_field_num_format">
+ <xsl:param name="input_MS_num_format"/>
+ <xsl:choose>
+ <xsl:when test="contains($input_MS_num_format, 'Arabic' ) ">
+ <xsl:text>1</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($input_MS_num_format, 'roman' ) ">
+ <xsl:text>i</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($input_MS_num_format, 'ROMAN' ) ">
+ <xsl:text>I</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($input_MS_num_format, 'alphabetic' ) ">
+ <xsl:text>a</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($input_MS_num_format, 'ALPHABETIC' ) ">
+ <xsl:text>A</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>1</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!--xsl:template name="get_field_num_format">
+ <xsl:param name="input_MS_num_format"/>
+ <xsl:choose>
+ <xsl:when test="contains($input_MS_num_format, 'Arabic' ) ">
+ <xsl:text>1</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains ($input_MS_num_format, 'CircleNum' )">
+ <xsl:text>â‘ , â‘¡, â‘¢, ...</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($input_MS_num_format, 'roman' ) ">
+ <xsl:text>i</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($input_MS_num_format, 'ROMAN' ) ">
+ <xsl:text>I</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($input_MS_num_format, 'CHINESENUM3' )">
+ <xsl:text>一, 二, 三, ...</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($input_MS_num_format, 'CHINESENUM2' )">
+ <xsl:text>壹, è²³, åƒ, ...</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($input_MS_num_format, 'DBNUM3' ) ">
+ <xsl:text>壱, å¼, å‚, ...</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($input_MS_num_format, 'ZODIAC2' ) ">
+ <xsl:text>å­, 丑, 寅, ...</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($input_MS_num_format, 'ZODIAC1' ) ">
+ <xsl:text>甲, 乙, 丙, ...</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($input_MS_num_format, 'Iroha' ) ">
+ <xsl:text>イ, ロ, ãƒ, ...</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($input_MS_num_format, 'Aiueo' ) ">
+ <xsl:text>ï½±, ï½², ï½³, ...</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($input_MS_num_format, 'alphabetic' ) ">
+ <xsl:text>a</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($input_MS_num_format, 'ALPHABETIC' ) ">
+ <xsl:text>A</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($input_MS_num_format, 'hebrew2' ) ">
+ <xsl:text>×, ב, ×’, ...</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($input_MS_num_format, 'ArabicAlpha' ) ">
+ <xsl:text>أ, ب, ت, ...</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($input_MS_num_format, 'ThaiLetter' ) ">
+ <xsl:text>à¸, ข, ฃ, ...</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($input_MS_num_format, 'Chosung' ) ">
+ <xsl:text>ㄱ, ㄴ, ㄷ, ...</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($input_MS_num_format, 'Ganada' ) ">
+ <xsl:text>가, 나, 다, ...</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($input_MS_num_format, 'Aiueo' ) ">
+ <xsl:text>ア, イ, ウ, ...</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>1</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template -->
+ <!-- ========= the following code is to generate the date styles for date/time fields ============ -->
+ <!--the default date styel content -->
+ <xsl:template name="default_date_style_content">
+ <number:year number:style="long">
+ </number:year>
+ <number:text>/</number:text>
+ <number:month>
+ </number:month>
+ <number:text>/</number:text>
+ <number:day>
+ </number:day>
+ <number:text> </number:text>
+ <number:hours>
+ </number:hours>
+ <number:text>:</number:text>
+ <number:minutes number:style="long">
+ </number:minutes>
+ <number:text>:</number:text>
+ <number:seconds number:style="long">
+ </number:seconds>
+ <number:am-pm>
+ </number:am-pm>
+ </xsl:template>
+ <!--the default date styel -->
+ <xsl:template name="default_date_style">
+ <number:date-style style:name="NDF1">
+ <xsl:call-template name="default_date_style_content"/>
+ </number:date-style>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="style">
+ <!-- this template is to generate the date, time styles according to the content of DateFormatString ( the string after \@ ) in w:instrText | w:fldSimple/@w:instr -->
+ <xsl:choose>
+ <xsl:when test=" name() = 'w:instrText' ">
+ <xsl:if test="substring(normalize-space(.),1,4) = 'DATE' or substring(normalize-space(.),1,4) = 'TIME' or substring(normalize-space(.),1,9) = 'PRINTDATE' or substring(normalize-space(.),1,10) = 'CREATEDATE' or substring(normalize-space(.),1,8) = 'SAVEDATE' ">
+ <number:date-style>
+ <xsl:attribute name="style:name">ND<xsl:number count="w:instrText | w:fldSimple" from="/w:wordDocument/w:body" level="any" format="1"/></xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="contains(text(), '\@' )">
+ <!-- if has the date format string then call the template parse_field_date_format to produce the style-->
+ <xsl:variable name="MS_date_format">
+ <xsl:value-of select="normalize-space(substring-before(substring-after(normalize-space(substring-after(text(), '\@')), '&#x22;'), '&#x22;'))"/>
+ </xsl:variable>
+ <xsl:if test="string-length($MS_date_format) &gt;=1">
+ <xsl:call-template name="parse_field_date_format">
+ <xsl:with-param name="input_MS_date_format" select="$MS_date_format"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="string-length($MS_date_format) &lt;1">
+ <xsl:call-template name="default_date_style_content"/>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- if doesn't have date format string so we use the following default format -->
+ <xsl:call-template name="default_date_style_content"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </number:date-style>
+ </xsl:if>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:if test="substring(normalize-space(@w:instr),1,4) = 'DATE' or substring(normalize-space(@w:instr),1,4) = 'TIME' or substring(normalize-space(@w:instr),1,9) = 'PRINTDATE' or substring(normalize-space(@w:instr),1,10) = 'CREATEDATE' or substring(normalize-space(@w:instr),1,8) = 'SAVEDATE' ">
+ <!-- we use the default date/time style for w:fldsimple -->
+ <number:date-style>
+ <xsl:attribute name="style:name">NDF1</xsl:attribute>
+ <xsl:call-template name="default_date_style_content"/>
+ </number:date-style>
+ </xsl:if>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="parse_field_date_format">
+ <!--this template is to parse and generate the content of the date-time style base on the content of input_MS_date_format -->
+ <xsl:param name="input_MS_date_format"/>
+ <xsl:if test="string-length($input_MS_date_format) &gt;= 1">
+ <xsl:variable name="date_token_start_position">
+ <!-- to find the start position of the token ' d, M, yy, YY,m etc. -->
+ <xsl:call-template name="find_token_startposition">
+ <xsl:with-param name="input_string" select="$input_MS_date_format"/>
+ <xsl:with-param name="token_start_position" select="1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="date_token">
+ <!-- get the matched the token such as MM, YYYY, yy,MMMM etc. -->
+ <xsl:call-template name="get_date_token">
+ <xsl:with-param name="input_string2" select="substring($input_MS_date_format,$date_token_start_position)"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="number($date_token_start_position) &gt; 1">
+ <!-- print the text between the tokens -->
+ <number:text>
+ <xsl:value-of select="substring($input_MS_date_format,1, number($date_token_start_position - 1) )"/>
+ </number:text>
+ </xsl:if>
+ <xsl:call-template name="map_date_format_pattern">
+ <xsl:with-param name="input_date_format_pattern" select="$date_token"/>
+ </xsl:call-template>
+ <xsl:variable name="unparsed_string">
+ <xsl:value-of select="substring($input_MS_date_format,$date_token_start_position + string-length($date_token))"/>
+ </xsl:variable>
+ <xsl:call-template name="parse_field_date_format">
+ <xsl:with-param name="input_MS_date_format" select="$unparsed_string"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="find_token_startposition">
+ <xsl:param name="input_string"/>
+ <xsl:param name="token_start_position"/>
+ <xsl:choose>
+ <xsl:when test="starts-with( $input_string,'yy') or starts-with($input_string,'YY') or starts-with($input_string,'HH') or starts-with($input_string,'hh') or starts-with($input_string,'ss') or starts-with($input_string,'SS')">
+ <xsl:value-of select="$token_start_position"/>
+ </xsl:when>
+ <xsl:when test="starts-with($input_string, 'M') or starts-with($input_string,'d') or starts-with($input_string, 'm') or starts-with($input_string,'D') or starts-with($input_string,'h') or starts-with($input_string,'H') or starts-with($input_string,'s') or starts-with($input_string,'S')">
+ <xsl:value-of select="$token_start_position"/>
+ </xsl:when>
+ <xsl:when test="starts-with($input_string, 'am/pm') or starts-with($input_string, 'AM/PM') ">
+ <xsl:value-of select="$token_start_position"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="new_string">
+ <xsl:value-of select="substring($input_string, 2)"/>
+ </xsl:variable>
+ <xsl:call-template name="find_token_startposition">
+ <xsl:with-param name="input_string" select="$new_string"/>
+ <xsl:with-param name="token_start_position" select="$token_start_position +1"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get_date_token">
+ <xsl:param name="input_string2"/>
+ <xsl:choose>
+ <xsl:when test="starts-with($input_string2, 'am/pm') or starts-with($input_string2, 'AM/PM') ">
+ <xsl:value-of select=" 'am/pm' "/>
+ </xsl:when>
+ <xsl:when test="starts-with($input_string2, 'yyyy') or starts-with($input_string2, 'YYYY')">
+ <xsl:value-of select=" 'yyyy' "/>
+ </xsl:when>
+ <xsl:when test="starts-with($input_string2, 'yy') or starts-with($input_string2, 'YY')">
+ <xsl:value-of select=" 'yy' "/>
+ </xsl:when>
+ <xsl:when test="starts-with($input_string2, 'MMMM') ">
+ <xsl:value-of select=" 'MMMM' "/>
+ </xsl:when>
+ <xsl:when test="starts-with($input_string2, 'MMM')">
+ <xsl:value-of select=" 'MMM' "/>
+ </xsl:when>
+ <xsl:when test="starts-with($input_string2, 'MM')">
+ <xsl:value-of select=" 'MM' "/>
+ </xsl:when>
+ <xsl:when test="starts-with($input_string2, 'M') ">
+ <xsl:value-of select=" 'M' "/>
+ </xsl:when>
+ <xsl:when test="starts-with($input_string2, 'dddd') or starts-with($input_string2, 'DDDD')">
+ <xsl:value-of select=" 'dddd' "/>
+ </xsl:when>
+ <xsl:when test="starts-with($input_string2, 'ddd') or starts-with($input_string2, 'DDD')">
+ <xsl:value-of select=" 'ddd' "/>
+ </xsl:when>
+ <xsl:when test="starts-with($input_string2, 'dd') or starts-with($input_string2, 'dd')">
+ <xsl:value-of select=" 'dd' "/>
+ </xsl:when>
+ <xsl:when test="starts-with($input_string2, 'd') or starts-with($input_string2, 'D')">
+ <xsl:value-of select=" 'd' "/>
+ </xsl:when>
+ <xsl:when test="starts-with($input_string2, 'mm')">
+ <xsl:value-of select=" 'mm' "/>
+ </xsl:when>
+ <xsl:when test="starts-with($input_string2, 'm')">
+ <xsl:value-of select=" 'm' "/>
+ </xsl:when>
+ <xsl:when test="starts-with($input_string2, 'hh') or starts-with($input_string2, 'HH')">
+ <xsl:value-of select=" 'hh' "/>
+ </xsl:when>
+ <xsl:when test="starts-with($input_string2, 'h') or starts-with($input_string2, 'H')">
+ <xsl:value-of select=" 'h' "/>
+ </xsl:when>
+ <xsl:when test="starts-with($input_string2, 'ss') or starts-with($input_string2, 'SS')">
+ <xsl:value-of select=" 'ss' "/>
+ </xsl:when>
+ <xsl:when test="starts-with($input_string2, 's') or starts-with($input_string2, 'S')">
+ <xsl:value-of select=" 's' "/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="map_date_format_pattern">
+ <!-- this template map the MS date time format to OOo date time format -->
+ <xsl:param name="input_date_format_pattern"/>
+ <xsl:choose>
+ <xsl:when test="$input_date_format_pattern = 'am/pm' ">
+ <number:am-pm>
+ </number:am-pm>
+ </xsl:when>
+ <xsl:when test="$input_date_format_pattern = 'yyyy' ">
+ <number:year number:style="long">
+ </number:year>
+ </xsl:when>
+ <xsl:when test="$input_date_format_pattern = 'yy' ">
+ <number:year>
+ </number:year>
+ </xsl:when>
+ <xsl:when test="$input_date_format_pattern = 'MMMM' ">
+ <number:month number:style="long" number:textual="true">
+ </number:month>
+ </xsl:when>
+ <xsl:when test="$input_date_format_pattern = 'MMM' ">
+ <number:month number:textual="true">
+ </number:month>
+ </xsl:when>
+ <xsl:when test="$input_date_format_pattern = 'MM' ">
+ <number:month number:style="long">
+ </number:month>
+ </xsl:when>
+ <xsl:when test="$input_date_format_pattern = 'M' ">
+ <number:month>
+ </number:month>
+ </xsl:when>
+ <xsl:when test="$input_date_format_pattern = 'dddd' ">
+ <number:day-of-week number:style="long">
+ </number:day-of-week>
+ </xsl:when>
+ <xsl:when test="$input_date_format_pattern = 'ddd' ">
+ <number:day-of-week>
+ </number:day-of-week>
+ </xsl:when>
+ <xsl:when test="$input_date_format_pattern = 'dd' ">
+ <number:day number:style="long">
+ </number:day>
+ </xsl:when>
+ <xsl:when test="$input_date_format_pattern = 'd' ">
+ <number:day>
+ </number:day>
+ </xsl:when>
+ <xsl:when test="$input_date_format_pattern = 'mm' ">
+ <number:minutes number:style="long">
+ </number:minutes>
+ </xsl:when>
+ <xsl:when test="$input_date_format_pattern = 'm' ">
+ <number:minutes>
+ </number:minutes>
+ </xsl:when>
+ <xsl:when test="$input_date_format_pattern = 'hh' ">
+ <number:hours number:style="long">
+ </number:hours>
+ </xsl:when>
+ <xsl:when test="$input_date_format_pattern = 'h' ">
+ <number:hours>
+ </number:hours>
+ </xsl:when>
+ <xsl:when test="$input_date_format_pattern = 'ss' ">
+ <number:seconds number:style="long">
+ </number:seconds>
+ </xsl:when>
+ <xsl:when test="$input_date_format_pattern = 's' ">
+ <number:seconds>
+ </number:seconds>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/filter/source/xslt/import/wordml/wordml2ooo_list.xsl b/filter/source/xslt/import/wordml/wordml2ooo_list.xsl
new file mode 100644
index 000000000000..8bbe57a5e3ec
--- /dev/null
+++ b/filter/source/xslt/import/wordml/wordml2ooo_list.xsl
@@ -0,0 +1,657 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="w wx aml o dt v">
+ <xsl:template match="w:listPr" mode="style">
+ <xsl:variable name="currlistid" select="w:ilfo/@w:val"/>
+ <xsl:variable name="currlist" select="."/>
+ <xsl:variable name="rootlistid" select="/w:wordDocument/w:lists/w:list[@w:ilfo=$currlistid]/w:ilst/@w:val"/>
+ <xsl:variable name="rootlist" select="/w:wordDocument/w:lists/w:listDef[@w:listDefId =$rootlistid ]"/>
+ <xsl:if test="not(ancestor::w:p/preceding-sibling::w:p/w:pPr/w:listPr[1]/w:ilfo/@w:val= $currlistid) and $rootlist/w:lvl ">
+ <xsl:element name="text:list-style">
+ <xsl:attribute name="style:name">List<xsl:value-of select="count(preceding::w:listPr)"/>
+ </xsl:attribute>
+ <xsl:apply-templates select="$rootlist/w:lvl"/>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="w:lvl">
+ <xsl:variable name="listtype">
+ <xsl:choose>
+ <xsl:when test="w:nfc/@w:val">
+ <xsl:value-of select="w:nfc/@w:val"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$listtype =23 and w:lvlPicBulletId">
+ <!-- image characters. wym -->
+ <xsl:element name="text:list-level-style-image">
+ <xsl:call-template name="list-styles-image"/>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="$listtype =23">
+ <!-- nfcBullet: Bullet character. glu -->
+ <xsl:element name="text:list-level-style-bullet">
+ <xsl:call-template name="list-styles-common">
+ <xsl:with-param name="listtype" select="$listtype"/>
+ <xsl:with-param name="currlevel" select="number(@w:ilvl)+1"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- all kinds of numbering characters. glu :( -->
+ <xsl:element name="text:list-level-style-number">
+ <xsl:call-template name="list-styles-common">
+ <xsl:with-param name="listtype" select="$listtype"/>
+ <xsl:with-param name="currlevel" select="number(@w:ilvl)+1"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="list-styles-common">
+ <xsl:param name="listtype"/>
+ <xsl:param name="currlevel"/>
+ <xsl:variable name="startval" select="w:start/@w:val"/>
+ <xsl:attribute name="text:level">
+ <xsl:value-of select="$currlevel"/>
+ </xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="$listtype = 23">
+ <!-- bullet character. glu -->
+ <xsl:attribute name="text:style-name">Bullet_20_Symbols</xsl:attribute>
+ <xsl:if test="not (contains(w:lvlText/@w:val,'%'))">
+ <xsl:attribute name="text:bullet-char">
+ <xsl:value-of select="w:lvlText/@w:val"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="contains(w:lvlText/@w:val,'%')">
+ <xsl:attribute name="text:bullet-char">
+ <xsl:value-of select=" '·' "/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:when>
+ <xsl:when test="($listtype &gt;= 0) and ($listtype &lt; 60)">
+ <xsl:attribute name="text:style-name">Numbering_20_Symbols</xsl:attribute>
+ <xsl:if test="$startval">
+ <xsl:choose>
+ <xsl:when test="$startval &gt; 0">
+ <xsl:attribute name="text:start-value">
+ <xsl:value-of select="$startval"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="text:start-value">
+ <xsl:value-of select=" '1' "/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!--xsl:attribute name="text:start-value"><xsl:value-of select="$startval"/></xsl:attribute -->
+ </xsl:if>
+ <xsl:attribute name="text:display-levels">
+ <xsl:value-of select="string-length(w:lvlText/@w:val) - string-length(translate(w:lvlText/@w:val,'%','') ) + 1"/>
+ </xsl:attribute>
+ <xsl:call-template name="nfc2numformat">
+ <xsl:with-param name="nfcvalue" select="$listtype"/>
+ <xsl:with-param name="prefix" select="substring-before(w:lvlText/@w:val, '%')"/>
+ <xsl:with-param name="suffix" select="substring-after(w:lvlText/@w:val, concat('%', $currlevel) )"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="text:style-name">Numbering_20_Symbols</xsl:attribute>
+ <xsl:if test="$startval">
+ <xsl:choose>
+ <xsl:when test="$startval &gt; 0">
+ <xsl:attribute name="text:start-value">
+ <xsl:value-of select="$startval"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="text:start-value">
+ <xsl:value-of select=" '1' "/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!-- xsl:attribute name="text:start-value"><xsl:value-of select="$startval"/></xsl:attribute -->
+ </xsl:if>
+ <xsl:attribute name="text:display-levels">
+ <xsl:value-of select="string-length(w:lvlText/@w:val) - string-length(translate(w:lvlText/@w:val,'%','') ) + 1"/>
+ </xsl:attribute>
+ <!-- 'none' in Word 2003. wym -->
+ <xsl:attribute name="style:num-format"/>
+ <xsl:attribute name="style:num-prefix">
+ <xsl:value-of select="substring-before(w:lvlText/@w:val, '%')"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:num-suffix">
+ <xsl:value-of select="substring-after(w:lvlText/@w:val, concat('%', $currlevel + 1) )"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:element name="style:list-level-properties">
+ <xsl:choose>
+ <xsl:when test="w:lvlJc/@w:val='right'">
+ <xsl:attribute name="fo:text-align">end</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:lvlJc/@w:val='center'">
+ <xsl:attribute name="fo:text-align">center</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:text-align">start</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:variable name="labelwidth">
+ <xsl:choose>
+ <xsl:when test="w:pPr/w:ind/@w:hanging">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat(w:pPr/w:ind/@w:hanging,'twip')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="w:pPr/w:ind/@w:first-line">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat('-',w:pPr/w:ind/@w:first-line,'twip')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="leftwidth">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat(w:pPr/w:ind/@w:left,'twip')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="w:pPr/w:ind/@w:left">
+ <xsl:attribute name="text:space-before">
+ <xsl:choose>
+ <xsl:when test=" ( number($leftwidth)-number($labelwidth) ) &gt; 0">
+ <xsl:value-of select="concat(number($leftwidth)-number($labelwidth),'cm')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select=" '0cm' "/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="text:min-label-width">
+ <xsl:choose>
+ <xsl:when test="$labelwidth &gt; 0">
+ <xsl:value-of select="concat($labelwidth,'cm')"/>
+ </xsl:when>
+ <xsl:otherwise>0cm</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <!-- In binary word translation, text:min-label-distance do not generate. So, the width of number-symbol will not effect the start position of text. But first line always start same position of second line, no indent. If text:min-label-distance generate, the look of list will change because of uncountable number-symbol's width, now use 0.25cm as default width-->
+ <xsl:choose>
+ <xsl:when test="w:suff/@w:val='Space'">
+ <xsl:attribute name="text:min-label-distance">0.20cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:pPr/w:tabs/w:tab/@w:pos">
+ <xsl:variable name="tabpos">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat(w:pPr/w:tabs/w:tab/@w:pos,'twip')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="number($tabpos) &gt; (number($leftwidth)-number($labelwidth))">
+ <xsl:variable name="min-label-distance">
+ <xsl:choose>
+ <xsl:when test="number($tabpos)+number($labelwidth)-number($leftwidth)-0.25 &lt; 0">0</xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="number($tabpos)+number($labelwidth)-number($leftwidth)-0.25"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="text:min-label-distance">
+ <xsl:value-of select="concat($min-label-distance,'cm')"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:when>
+ </xsl:choose>
+ <!-- Find the node that corresponds to the level being processed. We can use this to determine the indentation to be used
+ <xsl:variable name="currNode" select="/w:wordDocument/w:body//w:listPr[w:ilvl/@w:val = $currlevel][w:ilfo/@w:val = $currlist/w:ilfo/@w:val]"/>
+ <xsl:choose>
+ <xsl:when test="($currNode/wx:t/@wx:wTabBefore ) and ($currNode/wx:t/@wx:wTabAfter ) and (not($currNode/following-sibling::w:jc) or $currNode/following-sibling::w:jc/@w:val = 'left')">
+ <xsl:attribute name="text:space-before"><xsl:value-of select="(number($currNode/wx:t/@wx:wTabBefore)div 1440) * 2.54"/>cm</xsl:attribute>
+ <xsl:attribute name="text:min-label-distance"><xsl:value-of select="(number($currNode/wx:t/@wx:wTabAfter)div 1440) * 2.54"/>cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="text:space-before"><xsl:value-of select="((number(w:pPr/w:ind/@w:left) div 1440) * 2.54) "/>cm</xsl:attribute>
+ <xsl:attribute name="text:min-label-distance"><xsl:value-of select="(number($currlist/wx:t/@wx:wTabAfter) div 1440) * 2.54"/>cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>-->
+ <xsl:if test="w:rPr/w:rFonts">
+ <xsl:if test="w:rPr/w:rFonts/@w:ascii">
+ <xsl:attribute name="style:font-name">
+ <xsl:value-of select="w:rPr/w:rFonts/@w:ascii"/>
+ </xsl:attribute>
+ </xsl:if>
+ <!-- in Oasis format the style:font-name-asian is not allowed to appear here -->
+ <!--xsl:if test="w:rPr/w:rFonts/@w:fareast">
+ <xsl:attribute name="style:font-name-asian"><xsl:value-of select="w:rPr/w:rFonts/@w:fareast"/></xsl:attribute>
+ </xsl:if -->
+ <!--
+ <xsl:if test="w:rPr/w:rFonts/@w:cs">
+ <xsl:attribute name="style:font-name-complex"><xsl:value-of select="w:rPr/w:rFonts/@w:cs"/></xsl:attribute>
+ </xsl:if>
+ -->
+ </xsl:if>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="list-styles-image">
+ <xsl:variable name="currlevel" select="number(@w:ilvl)"/>
+ <xsl:attribute name="text:level">
+ <xsl:value-of select="$currlevel+1"/>
+ </xsl:attribute>
+ <xsl:variable name="picid" select="w:lvlPicBulletId/@w:val"/>
+ <office:binary-data>
+ <xsl:value-of select="/descendant::w:lists/w:listPicBullet[@w:listPicBulletId=$picid]/w:pict/w:binData"/>
+ </office:binary-data>
+ <xsl:element name="style:list-level-properties">
+ <xsl:attribute name="style:vertical-pos">middle</xsl:attribute>
+ <xsl:attribute name="style:vertical-rel">line</xsl:attribute>
+ <xsl:variable name="picsize" select="/descendant::w:lists/w:listPicBullet[@w:listPicBulletId=$picid]/w:pict/v:shape/@style"/>
+ <xsl:attribute name="fo:text-align">left</xsl:attribute>
+ <xsl:attribute name="fo:width">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="substring-before(substring-after($picsize,'width:'), ';')"/>
+ </xsl:call-template>
+ <xsl:text>cm</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute name="fo:height">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="substring-after($picsize,'height:')"/>
+ </xsl:call-template>
+ <xsl:text>cm</xsl:text>
+ </xsl:attribute>
+ <xsl:variable name="labelwidth">
+ <xsl:choose>
+ <xsl:when test="w:pPr/w:ind/@w:hanging">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat(w:pPr/w:ind/@w:hanging,'twip')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="w:pPr/w:ind/@w:first-line">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat('-',w:pPr/w:ind/@w:first-line,'twip')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="leftwidth">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat(w:pPr/w:ind/@w:left,'twip')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="text:space-before">
+ <xsl:choose>
+ <xsl:when test="(number($leftwidth)-number($labelwidth)) &gt; 0 ">
+ <xsl:value-of select="concat(number($leftwidth)-number($labelwidth),'cm')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select=" '0cm' "/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:attribute name="text:min-label-width">
+ <xsl:choose>
+ <xsl:when test="$labelwidth &gt; 0">
+ <xsl:value-of select="concat($labelwidth,'cm')"/>
+ </xsl:when>
+ <xsl:otherwise>0cm</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="w:suff/@w:val='Space'">
+ <xsl:attribute name="text:min-label-distance">0.20cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:pPr/w:tabs/w:tab/@w:pos">
+ <xsl:variable name="tabpos">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat(w:pPr/w:tabs/w:tab/@w:pos,'twip')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="number($tabpos) &gt; (number($leftwidth)-number($labelwidth))">
+ <xsl:attribute name="text:min-label-distance">
+ <xsl:value-of select="concat(number($tabpos)+number($labelwidth)-number($leftwidth),'cm')"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:template>
+ <!-- avoid listPr in textbox. :( glu -->
+ <xsl:template match="w:p[w:pPr/w:listPr[w:ilvl and w:ilfo]]">
+ <xsl:call-template name="genlist"/>
+ </xsl:template>
+ <xsl:template name="genlist">
+ <xsl:variable name="currlistid" select="w:pPr/w:listPr/w:ilfo/@w:val"/>
+ <xsl:variable name="currlistlvl" select="w:pPr/w:listPr/w:ilvl/@w:val"/>
+ <xsl:variable name="firstoccur" select="/descendant::w:pPr[w:listPr/w:ilfo/@w:val = $currlistid][1]"/>
+ <xsl:variable name="rootlistid" select="/w:wordDocument/w:lists/w:list[@w:ilfo=$currlistid]/w:ilst/@w:val"/>
+ <xsl:variable name="rootlistname" select="/w:wordDocument/w:lists/w:listDef[@w:listDefId =$rootlistid ]/w:listStyleLink/@w:val"/>
+ <xsl:element name="text:list">
+ <xsl:attribute name="text:style-name">
+ <xsl:choose>
+ <xsl:when test="string-length($rootlistname) &gt; 0">
+ <xsl:value-of select="translate($rootlistname,' ~`!@#$%^*(&#x26;)+/,;?&lt;&gt;{}[]:','_')"/>
+ </xsl:when>
+ <xsl:otherwise>List<xsl:value-of select="count($firstoccur/preceding::w:listPr)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="preceding::w:pPr/w:listPr/w:ilfo/@w:val = w:pPr/w:listPr/w:ilfo/@w:val">
+ <xsl:attribute name="text:continue-numbering">true</xsl:attribute>
+ <xsl:element name="text:list-item">
+ <xsl:call-template name="levels">
+ <xsl:with-param name="level" select="$currlistlvl"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="text:list-item">
+ <xsl:call-template name="levels">
+ <xsl:with-param name="level" select="$currlistlvl"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="levels">
+ <xsl:param name="level"/>
+ <xsl:choose>
+ <xsl:when test="$level = '0'">
+ <xsl:call-template name="process-common-paragraph"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="text:list">
+ <xsl:element name="text:list-item">
+ <xsl:call-template name="levels">
+ <xsl:with-param name="level" select="$level -1"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="w:style" mode="list">
+ <xsl:variable name="listname" select="@w:styleId"/>
+ <xsl:if test="/w:wordDocument/w:lists/w:listDef[w:styleLink/@w:val=$listname]">
+ <text:list-style style:name="{$listname}">
+ <xsl:apply-templates select="/w:wordDocument/w:lists/w:listDef[w:styleLink/@w:val=$listname]/w:lvl"/>
+ </text:list-style>
+ </xsl:if>
+ </xsl:template>
+ <!-- for create outline style in office:styles -->
+ <xsl:template name="create-outline-style">
+ <xsl:element name="text:outline-style">
+ <xsl:call-template name="outline-level-style">
+ <xsl:with-param name="level" select="1"/>
+ </xsl:call-template>
+ <xsl:call-template name="outline-level-style">
+ <xsl:with-param name="level" select="2"/>
+ </xsl:call-template>
+ <xsl:call-template name="outline-level-style">
+ <xsl:with-param name="level" select="3"/>
+ </xsl:call-template>
+ <xsl:call-template name="outline-level-style">
+ <xsl:with-param name="level" select="4"/>
+ </xsl:call-template>
+ <xsl:call-template name="outline-level-style">
+ <xsl:with-param name="level" select="5"/>
+ </xsl:call-template>
+ <xsl:call-template name="outline-level-style">
+ <xsl:with-param name="level" select="6"/>
+ </xsl:call-template>
+ <xsl:call-template name="outline-level-style">
+ <xsl:with-param name="level" select="7"/>
+ </xsl:call-template>
+ <xsl:call-template name="outline-level-style">
+ <xsl:with-param name="level" select="8"/>
+ </xsl:call-template>
+ <xsl:call-template name="outline-level-style">
+ <xsl:with-param name="level" select="9"/>
+ </xsl:call-template>
+ <xsl:call-template name="outline-level-style">
+ <xsl:with-param name="level" select="10"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="outline-level-style">
+ <xsl:param name="level"/>
+ <xsl:element name="text:outline-level-style">
+ <xsl:choose>
+ <xsl:when test="(w:style[@w:type = 'paragraph' and w:pPr/w:outlineLvl/@w:val = $level -1 and w:pPr/w:listPr ]/w:pPr/w:listPr)[position()=1]">
+ <xsl:apply-templates select="(w:style[@w:type = 'paragraph' and w:pPr/w:outlineLvl/@w:val = $level -1 and w:pPr/w:listPr ]/w:pPr/w:listPr)[position()=1]" mode="outline">
+ <xsl:with-param name="outlinelevel" select="$level"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="text:level">
+ <xsl:value-of select="$level"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:num-format"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="w:listPr" mode="outline">
+ <xsl:param name="outlinelevel"/>
+ <xsl:variable name="currlistid" select="w:ilfo/@w:val"/>
+ <xsl:variable name="currlistlevel">
+ <xsl:choose>
+ <xsl:when test="w:ilvl">
+ <xsl:value-of select="w:ilvl/@w:val"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="rootlistid" select="/w:wordDocument/w:lists/w:list[@w:ilfo=$currlistid]/w:ilst/@w:val"/>
+ <xsl:variable name="rootlist" select="/w:wordDocument/w:lists/w:listDef[@w:listDefId =$rootlistid ]"/>
+ <xsl:if test="$rootlist/w:lvl[@w:ilvl=$currlistlevel]">
+ <xsl:for-each select="$rootlist/w:lvl[@w:ilvl=$currlistlevel]">
+ <xsl:call-template name="list-styles-common">
+ <xsl:with-param name="listtype">
+ <xsl:choose>
+ <xsl:when test="w:nfc/@w:val">
+ <xsl:value-of select="w:nfc/@w:val"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="currlevel" select="$outlinelevel"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:if test="not($rootlist/w:lvl[@w:ilvl=$currlistlevel])">
+ <xsl:attribute name="text:level">
+ <xsl:value-of select="'1'"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="nfc2numformat">
+ <xsl:param name="nfcvalue"/>
+ <xsl:param name="prefix"/>
+ <xsl:param name="suffix"/>
+ <xsl:choose>
+ <xsl:when test="$nfcvalue=0">
+ <xsl:attribute name="style:num-format">1</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=1">
+ <xsl:attribute name="style:num-format">I</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=2">
+ <xsl:attribute name="style:num-format">i</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=3">
+ <xsl:attribute name="style:num-format">A</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=4">
+ <xsl:attribute name="style:num-format">a</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:num-format">1</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="$nfcvalue=26">
+ <xsl:attribute name="style:num-prefix">
+ <xsl:value-of select="$prefix"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:num-suffix">
+ <xsl:value-of select="concat( '.' , $suffix )"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=27 or $nfcvalue=29">
+ <xsl:attribute name="style:num-prefix">
+ <xsl:value-of select="concat( $prefix, '(' )"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:num-suffix">
+ <xsl:value-of select="concat( ')' , $suffix )"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=57">
+ <xsl:attribute name="style:num-prefix">
+ <xsl:value-of select="concat( $prefix, '- ' )"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:num-suffix">
+ <xsl:value-of select="concat( ' -' , $suffix )"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:num-prefix">
+ <xsl:value-of select="$prefix"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:num-suffix">
+ <xsl:value-of select="$suffix"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- xsl:template name="nfc2numformat">
+ <xsl:param name="nfcvalue"/>
+ <xsl:param name="prefix"/>
+ <xsl:param name="suffix"/>
+ <xsl:choose>
+ <xsl:when test="$nfcvalue=0">
+ <xsl:attribute name="style:num-format">1</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=1">
+ <xsl:attribute name="style:num-format">I</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=2">
+ <xsl:attribute name="style:num-format">i</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=3">
+ <xsl:attribute name="style:num-format">A</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=4">
+ <xsl:attribute name="style:num-format">a</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=10 or $nfcvalue=11 or $nfcvalue=17 or $nfcvalue=29 or $nfcvalue=33 or $nfcvalue=35 or $nfcvalue=36 or $nfcvalue=37 or $nfcvalue=39 or $nfcvalue=44">
+ <xsl:attribute name="style:num-format">一, 二, 三, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=12">
+ <xsl:attribute name="style:num-format">ア, イ, ウ, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=13">
+ <xsl:attribute name="style:num-format">イ, ロ, ãƒ, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=14 or $nfcvalue=19">
+ <xsl:attribute name="style:num-format">1, 2, 3, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=16">
+ <xsl:attribute name="style:num-format">壱, å¼, å‚, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=18 or $nfcvalue=28">
+ <xsl:attribute name="style:num-format">â‘ , â‘¡, â‘¢, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=20">
+ <xsl:attribute name="style:num-format">ï½±, ï½², ï½³, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=21">
+ <xsl:attribute name="style:num-format">イ, ロ, ハ, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=24">
+ <xsl:attribute name="style:num-format">가, 나, 다, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=25">
+ <xsl:attribute name="style:num-format">ㄱ, ㄴ, ㄷ, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=30">
+ <xsl:attribute name="style:num-format">甲, 乙, 丙, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=31">
+ <xsl:attribute name="style:num-format">å­, 丑, 寅, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=34">
+ <xsl:attribute name="style:num-format">壹, è²³, åƒ, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=38">
+ <xsl:attribute name="style:num-format">壹, è´°, å, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=41 or $nfcvalue=42 or $nfcvalue=43">
+ <xsl:attribute name="style:num-format">ì¼, ì´, 삼, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=45 or $nfcvalue=47">
+ <xsl:attribute name="style:num-format">×, ב, ×’, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=46 or $nfcvalue=48">
+ <xsl:attribute name="style:num-format">أ, ب, ت, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=53">
+ <xsl:attribute name="style:num-format">à¸, ข, ฃ, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue!=57 and $nfcvalue &gt; 48 and $nfcvalue &lt; 60">
+ <xsl:attribute name="style:num-format">Native Numbering</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:num-format">1</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="$nfcvalue=26">
+ <xsl:attribute name="style:num-prefix"><xsl:value-of select="$prefix"/></xsl:attribute>
+ <xsl:attribute name="style:num-suffix"><xsl:value-of select="concat( '.' , $suffix )"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=27 or $nfcvalue=29">
+ <xsl:attribute name="style:num-prefix"><xsl:value-of select="concat( $prefix, '(' )"/></xsl:attribute>
+ <xsl:attribute name="style:num-suffix"><xsl:value-of select="concat( ')' , $suffix )"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=57">
+ <xsl:attribute name="style:num-prefix"><xsl:value-of select="concat( $prefix, '- ' )"/></xsl:attribute>
+ <xsl:attribute name="style:num-suffix"><xsl:value-of select="concat( ' -' , $suffix )"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:num-prefix"><xsl:value-of select="$prefix"/></xsl:attribute>
+ <xsl:attribute name="style:num-suffix"><xsl:value-of select="$suffix"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template -->
+</xsl:stylesheet>
diff --git a/filter/source/xslt/import/wordml/wordml2ooo_page.xsl b/filter/source/xslt/import/wordml/wordml2ooo_page.xsl
new file mode 100644
index 000000000000..8514594bf19a
--- /dev/null
+++ b/filter/source/xslt/import/wordml/wordml2ooo_page.xsl
@@ -0,0 +1,387 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="w wx aml o dt v">
+ <xsl:template match="w:footnotePr" mode="config">
+ <text:notes-configuration text:note-class="footnote" text:citation-style-name="Footnote_20_Symbol">
+ <xsl:if test="w:pos">
+ <xsl:choose>
+ <xsl:when test="w:pos/@w:val = 'beneath-text'">
+ <xsl:attribute name="text:footnotes-position">document</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="text:footnotes-position">page</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="w:numStart">
+ <xsl:choose>
+ <xsl:when test="w:numStart/@w:val - 1 &gt; 0">
+ <xsl:attribute name="text:start-value">
+ <xsl:value-of select="w:numStart/@w:val - 1"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="text:start-value">
+ <xsl:value-of select=" '1' "/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!--xsl:attribute name="text:start-value"><xsl:value-of select="w:numStart/@w:val - 1"/></xsl:attribute-->
+ </xsl:if>
+ <xsl:if test="w:numFmt">
+ <xsl:call-template name="convert-number-format">
+ <xsl:with-param name="number-format" select="w:numFmt/@w:val"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="w:numRestart">
+ <xsl:choose>
+ <xsl:when test="w:numRestart/@w:val = 'continuous'">
+ <xsl:attribute name="text:start-numbering-at">document</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:numRestart/@w:val = 'each-sect'">
+ <xsl:attribute name="text:start-numbering-at">chapter</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="text:start-numbering-at">page</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <!--
+ <xsl:if test="w:footnote[@w:type = 'continuation-separator']">
+ <text:footnote-continuation-notice-backward>
+ <xsl:value-of select="normalize-space(w:footnote[@w:type = 'continuation-separator'])"/>
+ </text:footnote-continuation-notice-backward>
+ </xsl:if>
+ <xsl:if test="w:footnote[@w:type = 'continuation-notice']">
+ <text:footnote-continuation-notice-forward>
+ <xsl:value-of select="normalize-space(w:footnote[@w:type = 'continuation-notice'])"/>
+ </text:footnote-continuation-notice-forward>
+ </xsl:if>
+ -->
+ </text:notes-configuration>
+ </xsl:template>
+ <xsl:template match="w:endnotePr" mode="config">
+ <text:notes-configuration text:note-class="endnote" text:citation-style-name="Endnote_20_Symbol">
+ <xsl:if test="w:numStart">
+ <xsl:choose>
+ <xsl:when test="(w:numStart/@w:val - 1) &gt; 0">
+ <xsl:attribute name="text:start-value">
+ <xsl:value-of select="w:numStart/@w:val - 1"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="text:start-value">
+ <xsl:value-of select=" '1' "/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!--xsl:attribute name="text:start-value"><xsl:value-of select="w:numStart/@w:val - 1"/></xsl:attribute -->
+ </xsl:if>
+ <xsl:if test="w:numFmt">
+ <xsl:call-template name="convert-number-format">
+ <xsl:with-param name="number-format" select="w:numFmt/@w:val"/>
+ </xsl:call-template>
+ </xsl:if>
+ </text:notes-configuration>
+ </xsl:template>
+ <xsl:template name="convert-number-format">
+ <xsl:param name="number-format"/>
+ <xsl:choose>
+ <xsl:when test="$number-format = 'decimal' or $number-format = 'decimal-half-width'">
+ <xsl:attribute name="style:num-format">1</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'decimal-zero'">
+ <xsl:attribute name="style:num-format">1</xsl:attribute>
+ <xsl:attribute name="style:num-prefix">0</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'decimal-enclosed-fullstop'">
+ <xsl:attribute name="style:num-format">1</xsl:attribute>
+ <xsl:attribute name="style:num-prefix">.</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'decimal-enclosed-paren'">
+ <xsl:attribute name="style:num-format">1</xsl:attribute>
+ <xsl:attribute name="style:num-prefix">(</xsl:attribute>
+ <xsl:attribute name="style:num-suffix">)</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'number-in-dash'">
+ <xsl:attribute name="style:num-format">1</xsl:attribute>
+ <xsl:attribute name="style:num-prefix">-</xsl:attribute>
+ <xsl:attribute name="style:num-suffix">-</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'upper-letter'">
+ <xsl:attribute name="style:num-format">A</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'lower-letter'">
+ <xsl:attribute name="style:num-format">a</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'upper-roman'">
+ <xsl:attribute name="style:num-format">I</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'lower-roman'">
+ <xsl:attribute name="style:num-format">i</xsl:attribute>
+ </xsl:when>
+ <!-- ordinal, cardinal-text, ordinal-text, hex, chicago, bullet, ideograph-zodiac-traditional,
+ vietnamese-counting, russian-lower, russian-upper, hindi-vowels, hindi-consonants, hindi-numbers, hindi-counting -->
+ <xsl:otherwise>
+ <xsl:attribute name="style:num-format">1</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="w:bgPict">
+ <xsl:if test="w:background/@w:bgcolor">
+ <xsl:attribute name="fo:background-color">
+ <xsl:call-template name="MapConstColor">
+ <xsl:with-param name="color" select="w:background/@w:bgcolor"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:background/@w:background">
+ <style:background-image>
+ <office:binary-data>
+ <xsl:variable name="the-image" select="key('imagedata',w:background/@w:background)"/>
+ <xsl:value-of select="translate($the-image/text(),'&#9;&#10;&#13;&#32;','' ) "/>
+ </office:binary-data>
+ </style:background-image>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="w:sectPr" mode="page-layout">
+ <style:page-layout>
+ <xsl:attribute name="style:name">pm<xsl:number from="/w:wordDocument/w:body" level="any" count="w:sectPr" format="1"/>
+ </xsl:attribute>
+ <style:page-layout-properties>
+ <xsl:call-template name="page-layout-properties"/>
+ <xsl:apply-templates select="/w:wordDocument/w:bgPict"/>
+ </style:page-layout-properties>
+ <style:header-style>
+ <style:header-footer-properties style:dynamic-spacing="true" fo:margin-bottom="0">
+ <xsl:attribute name="fo:min-height.value"><xsl:value-of select="concat('(.(twips2cm(?(>($0(-[', w:pgMar/@w:top, '](|[', w:pgMar/@w:header, '][720])))[0])($0)[0]))[cm])')"/></xsl:attribute>
+ </style:header-footer-properties>
+ </style:header-style>
+ </style:page-layout>
+ </xsl:template>
+ <xsl:template match="w:sectPr" mode="master-page">
+ <!-- style:page-layout style:style-->
+
+ <xsl:variable name="master-page-number">
+ <xsl:number count="w:sectPr" from="/w:wordDocument/w:body" level="any" format="1"/>
+ </xsl:variable>
+ <xsl:if test="$master-page-number = '1'">
+ <style:master-page style:next-style-name="Standard-1" style:page-layout-name="pm1" style:display-name="First Page" style:name="First_20_Page">
+ <style:header>
+ <xsl:apply-templates select="w:hdr[@w:type='first']/child::*" mode="dispatch"/>
+ </style:header>
+ <style:footer>
+ <xsl:apply-templates select="w:ftr[@w:type='first']/child::*" mode="dispatch"/>
+ </style:footer>
+ </style:master-page>
+ </xsl:if>
+ <xsl:element name="style:master-page">
+ <xsl:attribute name="style:name">Standard-<xsl:value-of select="$master-page-number"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:page-layout-name">
+ <xsl:value-of select="concat('pm', $master-page-number)"/>
+ </xsl:attribute>
+
+ <style:header>
+ <xsl:apply-templates select="w:hdr[@w:type='odd']/child::*" mode="dispatch"/>
+ </style:header>
+ <style:header-left>
+ <xsl:apply-templates select="w:hdr[@w:type='even']/child::*" mode="dispatch"/>
+ </style:header-left>
+ <style:footer>
+ <xsl:apply-templates select="w:ftr[@w:type='odd']/child::*" mode="dispatch"/>
+ </style:footer>
+ <style:footer-left>
+ <xsl:apply-templates select="w:ftr[@w:type='even']/child::*" mode="dispatch"/>
+ </style:footer-left>
+
+ <!-- Headers and footers-->
+ <!--
+ <style:header-style>
+ <style:header-footer-properties>
+ <xsl:attribute name="fo:min-height"><xsl:call-template name="ConvertMeasure"><xsl:with-param name="value" select="concat(w:pgMar/@w:header,'twip')"/></xsl:call-template>cm</xsl:attribute>
+ <xsl:attribute name="fo:margin-bottom">0.792cm</xsl:attribute>
+ <xsl:attribute name="style:dynamic-spacing">true</xsl:attribute>
+ </style:header-footer-properties>
+ </style:header-style>
+ <style:footer-style>
+ <style:header-footer-properties>
+ <xsl:attribute name="fo:min-height"><xsl:call-template name="ConvertMeasure"><xsl:with-param name="value" select="concat(w:pgMar/@w:footer,'twip')"/></xsl:call-template>cm</xsl:attribute>
+ <xsl:attribute name="fo:margin-top">0.792cm</xsl:attribute>
+ <xsl:attribute name="style:dynamic-spacing">true</xsl:attribute>
+ </style:header-footer-properties>
+ </style:footer-style>
+ -->
+
+ <!-- any examples for w:titlePg usage? -->
+ <xsl:if test="not(w:titlePg)">
+ <xsl:apply-templates select="w:hdr[@w:type='odd']"/>
+ <xsl:apply-templates select="w:hdr[@w:type='even']"/>
+ <xsl:apply-templates select="w:ftr[@w:type='odd']"/>
+ <xsl:apply-templates select="w:ftr[@w:type='even']"/>
+ </xsl:if>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="w:hdr">
+ <!--
+ <xsl:choose>
+ <xsl:when test="@w:type = 'odd'">
+ <style:header>
+ <xsl:apply-templates select="wx:pBdrGroup | w:p | w:tbl"/>
+ </style:header>
+ </xsl:when>
+ <xsl:when test="@w:type = 'even'">
+ <style:header>
+ <xsl:apply-templates select="wx:pBdrGroup | w:p | w:tbl"/>
+ </style:header>
+ </xsl:when>
+ </xsl:choose>
+ -->
+ </xsl:template>
+ <xsl:template match="w:ftr">
+ <!--
+ <xsl:choose>
+ <xsl:when test="@w:type = 'odd'">
+ <style:footer>
+ <xsl:apply-templates select="wx:pBdrGroup | w:p | w:tbl"/>
+ </style:footer>
+ </xsl:when>
+ <xsl:when test="@w:type = 'even'">
+ <style:footer-left>
+ <xsl:apply-templates select="wx:pBdrGroup | w:p | w:tbl"/>
+ </style:footer-left>
+ </xsl:when>
+ </xsl:choose>
+ -->
+ </xsl:template>
+ <xsl:template match="wx:pBdrGroup">
+ <xsl:apply-templates mode="dispatch"/>
+ </xsl:template>
+ <!-- xsl:template name="convert-number-format">
+ <xsl:param name="number-format"/>
+ <xsl:choose>
+ <xsl:when test="$number-format = 'decimal' or $number-format = 'decimal-half-width'">
+ <xsl:attribute name="style:num-format">1</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'decimal-zero'">
+ <xsl:attribute name="style:num-format">1</xsl:attribute>
+ <xsl:attribute name="style:num-prefix">0</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'decimal-enclosed-fullstop'">
+ <xsl:attribute name="style:num-format">1</xsl:attribute>
+ <xsl:attribute name="style:num-prefix">.</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'decimal-enclosed-paren'">
+ <xsl:attribute name="style:num-format">1</xsl:attribute>
+ <xsl:attribute name="style:num-prefix">(</xsl:attribute>
+ <xsl:attribute name="style:num-suffix">)</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'number-in-dash'">
+ <xsl:attribute name="style:num-format">1</xsl:attribute>
+ <xsl:attribute name="style:num-prefix">-</xsl:attribute>
+ <xsl:attribute name="style:num-suffix">-</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'upper-letter'">
+ <xsl:attribute name="style:num-format">A</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'lower-letter'">
+ <xsl:attribute name="style:num-format">a</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'upper-roman'">
+ <xsl:attribute name="style:num-format">I</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'lower-roman'">
+ <xsl:attribute name="style:num-format">i</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'decimal-full-width' or $number-format = 'decimal-full-width2'">
+ <xsl:attribute name="style:num-format">1, 2, 3, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'decimal-enclosed-circle-chinese' or $number-format = 'decimal-enclosed-circle'">
+ <xsl:attribute name="style:num-format">â‘ , â‘¡, â‘¢, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'ideograph-enclosed-circle'">
+ <xsl:attribute name="style:num-format">一, 二, 三, ...</xsl:attribute>
+ <xsl:attribute name="style:num-prefix">(</xsl:attribute>
+ <xsl:attribute name="style:num-suffix">)</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'chinese-counting-thousand' or $number-format = 'ideograph-digital' or $number-format = 'japanese-counting' or $number-format = 'japanese-digital-ten-thousand' or $number-format = 'taiwanese-counting-thousand' or $number-format = 'taiwanese-counting' or $number-format = 'taiwanese-digital' or $number-format = 'chinese-counting' or $number-format = 'korean-digital2' or $number-format = 'chinese-not-impl'">
+ <xsl:attribute name="style:num-format">一, 二, 三, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'chinese-legal-simplified'">
+ <xsl:attribute name="style:num-format">壹, è´°, å, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'ideograph-legal-traditional'">
+ <xsl:attribute name="style:num-format">壹, è²³, åƒ, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'ideograph-traditional'">
+ <xsl:attribute name="style:num-format">甲, 乙, 丙, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'ideograph-zodiac'">
+ <xsl:attribute name="style:num-format">å­, 丑, 寅, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'japanese-legal'">
+ <xsl:attribute name="style:num-format">壱, å¼, å‚, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'aiueo-full-width'">
+ <xsl:attribute name="style:num-format">ア, イ, ウ, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'aiueo'">
+ <xsl:attribute name="style:num-format">ï½±, ï½², ï½³, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'iroha-full-width'">
+ <xsl:attribute name="style:num-format">イ, ロ, ãƒ, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'iroha'">
+ <xsl:attribute name="style:num-format">イ, ロ, ハ, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'korean-digital' or $number-format = 'korean-counting' or $number-format = 'korean-legal'">
+ <xsl:attribute name="style:num-format">ì¼, ì´, 삼, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'chosung'">
+ <xsl:attribute name="style:num-format">ㄱ, ㄴ, ㄷ, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'ganada'">
+ <xsl:attribute name="style:num-format">가, 나, 다, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'arabic-alpha' or $number-format = 'arabic-abjad'">
+ <xsl:attribute name="style:num-format">أ, ب, ت, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'thai-letters' or $number-format = 'thai-numbers' or $number-format = 'thai-counting'">
+ <xsl:attribute name="style:num-format">à¸, ข, ฃ, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'hebrew-1' or $number-format = 'hebrew-2'">
+ <xsl:attribute name="style:num-format">×, ב, ×’, ...</xsl:attribute>
+ </xsl:when>
+ < ordinal, cardinal-text, ordinal-text, hex, chicago, bullet, ideograph-zodiac-traditional,
+ vietnamese-counting, russian-lower, russian-upper, hindi-vowels, hindi-consonants, hindi-numbers, hindi-counting >
+ <xsl:otherwise>
+ <xsl:attribute name="style:num-format">Native Numbering</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template -->
+</xsl:stylesheet>
diff --git a/filter/source/xslt/import/wordml/wordml2ooo_path.xsl b/filter/source/xslt/import/wordml/wordml2ooo_path.xsl
new file mode 100644
index 000000000000..2ad46a1a96a0
--- /dev/null
+++ b/filter/source/xslt/import/wordml/wordml2ooo_path.xsl
@@ -0,0 +1,1818 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="w wx aml o dt v">
+ <xsl:include href="../../common/math.xsl"/>
+ <xsl:template name="dummy">
+ <xsl:call-template name="test"/>
+ </xsl:template>
+ <xsl:template name="test-arc">
+ <xsl:call-template name="svg-arc2vml-arc">
+ <!-- M 125,75 a100,50 0 ?,? 100,50 -->
+ <xsl:with-param name="x0" select="125"/>
+ <xsl:with-param name="y0" select="75"/>
+ <xsl:with-param name="rx" select="100"/>
+ <xsl:with-param name="ry" select="50"/>
+ <xsl:with-param name="x-axis-rotation" select="0"/>
+ <xsl:with-param name="large-arc-flag" select="0"/>
+ <xsl:with-param name="sweep-flag" select="0"/>
+ <xsl:with-param name="x" select="225"/>
+ <xsl:with-param name="y" select="125"/>
+ </xsl:call-template>
+ </xsl:template>
+ <xsl:template name="test">
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="'m,l,4500,3420,2520,6120,4500r2160,l6660,3240,8460,2520,8460,,3960,540r360,720l2700,1260,3240,540,,xe'"/>
+ </xsl:call-template>
+ </xsl:template>
+ <xsl:template name="vmlpath2svgpath">
+ <xsl:param name="vml-path"/>
+ <xsl:param name="svg-path" select="''"/>
+ <xsl:param name="position" select="1"/>
+ <xsl:param name="last-command" select="'m'"/>
+ <xsl:param name="current-x" select="'0'"/>
+ <xsl:param name="current-y" select="'0'"/>
+ <xsl:variable name="command-and-newpos">
+ <xsl:call-template name="get-path-command">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$position"/>
+ <xsl:with-param name="last-command" select="$last-command"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="command" select="substring-before($command-and-newpos , ':')"/>
+ <xsl:variable name="newpos" select="substring-after($command-and-newpos , ':')"/>
+ <xsl:choose>
+ <xsl:when test="$command = 'm' ">
+ <!-- absolute moveto -->
+ <xsl:variable name="new-svg-path" select="concat($svg-path ,' M ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 't' ">
+ <!-- relative moveto -->
+ <xsl:variable name="new-svg-path" select="concat($svg-path ,' m ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') + $current-x"/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') + $current-y "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'l' ">
+ <!-- absolute lineto -->
+ <xsl:variable name="new-svg-path" select="concat($svg-path ,' L ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'r' ">
+ <!-- relative lineto -->
+ <!-- 'l' command is not supported currently, so we use 'L' -->
+ <xsl:message>'l' command is not supported currently, so we use 'L'. This may case problem.</xsl:message>
+ <xsl:variable name="new-svg-path" select="concat($svg-path ,' L ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="new-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') + $current-x "/>
+ <xsl:variable name="new-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') + $current-y "/>
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <!-- 'l' command is not supported currently-->
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , $new-x ,' ' , $new-y , ' ') "/>
+ <!-- xsl:with-param name="svg-path" select=" concat($new-svg-path , substring-before( $num-and-pos , ':') , ' ') "/ -->
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') + $current-x "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') + $current-y "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'dummyH' ">
+ <!-- absolute horizontal lineto -->
+ <xsl:variable name="new-svg-path" select="concat($svg-path ,' l ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , substring-before( $num-and-pos , ':') , ' ' , $current-y , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( $num-and-pos , ':') "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'dummyh' ">
+ <!-- relative horizontal lineto -->
+ <xsl:variable name="new-svg-path" select="concat($svg-path ,' l ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , substring-before( $num-and-pos , ':') + $current-x , ' ' , $current-y , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( $num-and-pos , ':') + $current-x"/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'dummyV' ">
+ <!-- absolute vertical lineto -->
+ <xsl:variable name="new-svg-path" select="concat($svg-path ,' l ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , $current-x , ' ' , substring-before( $num-and-pos , ':') , ' ' ) "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x"/>
+ <xsl:with-param name="current-y" select=" substring-before( $num-and-pos , ':') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'dummyv' ">
+ <!-- relative horizontal lineto -->
+ <xsl:variable name="new-svg-path" select="concat($svg-path ,' l ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , $current-x , ' ' , substring-before( $num-and-pos , ':') + $current-y , ' ' ) "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x"/>
+ <xsl:with-param name="current-y" select=" substring-before( $num-and-pos , ':') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'c' ">
+ <!-- absolute curveto -->
+ <xsl:variable name="new-svg-path" select="concat($svg-path ,' C ' ) "/>
+ <xsl:variable name="control-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="4"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="substring-after( $control-and-pos , ':') "/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , substring-before( $control-and-pos , ':') , ' ' , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'v' ">
+ <!-- relative curveto -->
+ <xsl:variable name="new-svg-path" select="concat($svg-path ,' c ' ) "/>
+ <xsl:variable name="control-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="4"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="substring-after( $control-and-pos , ':') "/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , substring-before( $control-and-pos , ':') , ' ' , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') + $current-x "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') + $current-y "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'dummyS' ">
+ <!-- absolute shorthand/smooth curveto -->
+ <xsl:variable name="new-svg-path" select="concat($svg-path ,' c ' ) "/>
+ <xsl:variable name="control-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="substring-after( $control-and-pos , ':') "/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="control-1">
+ <xsl:choose>
+ <xsl:when test="string-length(translate($last-command, 'CcSs','') )= 0 ">
+ <xsl:variable name="previous-control-2">
+ <xsl:call-template name="get-number-before">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$position"/>
+ <xsl:with-param name="count" select="2"/>
+ <xsl:with-param name="skipcount" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="substring-before($previous-control-2 , ':') "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-before($control-and-pos, ':') "/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , $control-1 , ' ' , substring-before( $control-and-pos , ':') , ' ' , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'dummys' ">
+ <!-- absolute shorthand/smooth curveto -->
+ <xsl:variable name="new-svg-path" select="concat($svg-path ,' v ' ) "/>
+ <xsl:variable name="control-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="substring-after( $control-and-pos , ':') "/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="control-1">
+ <xsl:choose>
+ <xsl:when test="string-length(translate($last-command, 'CcSs' , '')) = 0 ">
+ <xsl:variable name="previous-control-2">
+ <xsl:call-template name="get-number-before">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$position"/>
+ <xsl:with-param name="count" select="2"/>
+ <xsl:with-param name="skipcount" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="substring-before($previous-control-2 , ':') "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-before($control-and-pos, ':') "/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , $control-1 , ' ' , substring-before( $control-and-pos , ':') , ' ' , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') + $current-x "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') + $current-y "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'dummyQ' ">
+ <!-- absolute quadratic bézier curves -->
+ <xsl:variable name="new-svg-path" select="concat($svg-path ,' qb ' ) "/>
+ <xsl:variable name="control-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="substring-after( $control-and-pos , ':') "/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , substring-before( $control-and-pos , ':') , ' ' , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'dummyq' ">
+ <!-- relative quadratic bézier curves -->
+ <xsl:variable name="control-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="control" select="substring-before( $control-and-pos , ':') "/>
+ <xsl:variable name="new-svg-path" select="concat($svg-path ,' qb ' , substring-before($control,' ') + $current-x , ' ' , substring-after($control , ' ') + $current-y ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="substring-after( $control-and-pos , ':') "/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="number" select="substring-before($num-and-pos, ':')"/>
+ <xsl:variable name="absolute-number" select="concat(substring-before($number, ' ') + $current-x , ' ' , substring-after($number, ' ') + $current-y)"/>
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , ' ' , $absolute-number , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( $absolute-number , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( $absolute-number , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'x' ">
+ <!--dummy or $command = 'z' "-->
+ <!-- closepath -->
+ <xsl:variable name="new-svg-path" select="concat($svg-path ,' Z ' ) "/>
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'e' ">
+ <!-- end path -->
+ <xsl:variable name="new-svg-path" select="concat($svg-path ,' N ' )"/>
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <!--Code below is for the support of h-command like ha,hb....hi, maybe still need to revise-->
+ <xsl:when test="$command = 'ha' ">
+ <xsl:variable name="new-svg-path" select="$svg-path"/>
+ <!--simply did nothing which might be wrong-->
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'hb' ">
+ <xsl:variable name="new-svg-path" select="$svg-path"/>
+ <!--simply did nothing which might be wrong-->
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'hc' ">
+ <xsl:variable name="new-svg-path" select="$svg-path"/>
+ <!--simply did nothing which might be wrong-->
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'hd' ">
+ <xsl:variable name="new-svg-path" select="$svg-path"/>
+ <!--simply did nothing which might be wrong-->
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'he' ">
+ <xsl:variable name="new-svg-path" select="$svg-path"/>
+ <!--simply did nothing which might be wrong-->
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'hf' ">
+ <xsl:variable name="new-svg-path" select="$svg-path"/>
+ <!--simply did nothing which might be wrong-->
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'hg' ">
+ <xsl:variable name="new-svg-path" select="$svg-path"/>
+ <!--simply did nothing which might be wrong-->
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'hh' ">
+ <xsl:variable name="new-svg-path" select="$svg-path"/>
+ <!--simply did nothing which might be wrong-->
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'hi' ">
+ <xsl:variable name="new-svg-path" select="$svg-path"/>
+ <!--simply did nothing which might be wrong-->
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'nf' or $command = 'ns' ">
+ <xsl:variable name="new-svg-path" select="$svg-path"/>
+ <!--simply did nothing which might be wrong-->
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'al' ">
+ <!-- absolute moveto -->
+ <xsl:variable name="new-svg-path" select="concat($svg-path ,' W ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="6"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$svg-path"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!--
+ **Template vmlpath2enhancedpath**
+ The template is resposible for converting the vml-path to enhanced-path, because the svg:path
+ cann't support command a now.(But heard that will be supported in OOo3.0)
+ And the 2nd reason of using an enhanced-path is that enhanced-path have a perfect maping to
+ vmlpath.(You will find out that often,we even don't need to change the parameters).
+ -->
+ <xsl:template name="vmlpath2enhancedpath">
+ <xsl:param name="vml-path"/>
+ <xsl:param name="enhanced-path" select="''"/>
+ <xsl:param name="position" select="1"/>
+ <xsl:param name="last-command" select="'m'"/>
+ <xsl:param name="current-x" select="'0'"/>
+ <xsl:param name="current-y" select="'0'"/>
+ <xsl:variable name="command-and-newpos">
+ <xsl:call-template name="get-path-command">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$position"/>
+ <xsl:with-param name="last-command" select="$last-command"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="command" select="substring-before($command-and-newpos , ':')"/>
+ <xsl:variable name="newpos" select="substring-after($command-and-newpos , ':')"/>
+ <xsl:choose>
+ <xsl:when test="$command = 'm' ">
+ <!--####Notice that the "m 0,0,1,1,1,1" means two lines-->
+ <!-- absolute moveto -->
+ <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' M ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'l' ">
+ <!-- absolute lineto -->
+ <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' L ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'x' ">
+ <!--dummy or $command = 'z' "-->
+ <!-- closepath -->
+ <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' Z ' ) "/>
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'e' ">
+ <!-- end path -->
+ <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' N ' )"/>
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'c' ">
+ <!-- absolute curveto -->
+ <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' C ' ) "/>
+ <xsl:variable name="control-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="4"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="substring-after( $control-and-pos , ':') "/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , substring-before( $control-and-pos , ':') , ' ' , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 't' ">
+ <!-- relative moveto -->
+ <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' M ' ) "/>
+ <!--####maybe this is not crect because t r and v hasn't direct image in enhaced-path-->
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') + $current-x"/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') + $current-y "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'r' ">
+ <!-- relative lineto -->
+ <!--####maybe this is not crect because 't' 'r' and 'v' hasn't direct image in enhaced-path-->
+ <!-- 'l' command is not supported currently, so we use 'L' -->
+ <xsl:message>'l' command is not supported currently, so we use 'L'. This may case problem.</xsl:message>
+ <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' L ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="new-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') + $current-x "/>
+ <xsl:variable name="new-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') + $current-y "/>
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <!-- 'l' command is not supported currently-->
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , $new-x ,' ' , $new-y , ' ') "/>
+ <!-- xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , substring-before( $num-and-pos , ':') , ' ') "/ -->
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') + $current-x "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') + $current-y "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'v' ">
+ <!-- relative curveto -->
+ <!--####maybe this is not crect because 't' 'r' and 'v' hasn't direct image in enhaced-path-->
+ <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' C ' ) "/>
+ <!--<xsl:variable name="control-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="4"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="substring-after( $control-and-pos , ':') "/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , substring-before( $control-and-pos , ':') , ' ' , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') + $current-x "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') + $current-y "/>
+ </xsl:call-template>-
+ -->
+ <xsl:variable name="x1">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="y1">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="substring-after( $x1 , ':')"/>
+ <xsl:with-param name="count" select="1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="x2">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="substring-after( $y1 , ':')"/>
+ <xsl:with-param name="count" select="1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="y2">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="substring-after( $x2 , ':')"/>
+ <xsl:with-param name="count" select="1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="x">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="substring-after( $y2 , ':')"/>
+ <xsl:with-param name="count" select="1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="y">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="substring-after( $x , ':')"/>
+ <xsl:with-param name="count" select="1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="val_x1">
+ <xsl:value-of select="substring-before( $x1 , ':')+$current-x"/>
+ </xsl:variable>
+ <xsl:variable name="val_y1">
+ <xsl:value-of select="substring-before( $y1 , ':')+$current-y"/>
+ </xsl:variable>
+ <xsl:variable name="val_x2">
+ <xsl:value-of select="substring-before( $x2 , ':')+$current-x"/>
+ </xsl:variable>
+ <xsl:variable name="val_y2">
+ <xsl:value-of select="substring-before( $y2 , ':')+$current-y"/>
+ </xsl:variable>
+ <xsl:variable name="val_x">
+ <xsl:value-of select="substring-before( $x , ':')+$current-x"/>
+ </xsl:variable>
+ <xsl:variable name="val_y">
+ <xsl:value-of select="substring-before( $y , ':')+$current-y"/>
+ </xsl:variable>
+ <xsl:variable name="control-and-pos">
+ <xsl:value-of select="concat($val_x1, ' ',$val_y1, ' ',$val_x2, ' ',$val_y2, ' ' )"/>
+ </xsl:variable>
+ <xsl:variable name="num-and-pos">
+ <xsl:value-of select="concat($val_x, ' ',$val_y, ' ' )"/>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , ' ',$control-and-pos , ' ' , $num-and-pos , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $y , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $val_x "/>
+ <xsl:with-param name="current-y" select=" $val_y "/>
+ </xsl:call-template>
+ </xsl:when>
+ <!--Code below is for the support of h-command like ha,hb....hi, maybe still need to revise-->
+ <xsl:when test="$command = 'ha' ">
+ <xsl:variable name="new-enhanced-path" select="$enhanced-path"/>
+ <!--simply did nothing which might be wrong-->
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'hb' ">
+ <xsl:variable name="new-enhanced-path" select="$enhanced-path"/>
+ <!--simply did nothing which might be wrong-->
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'hc' ">
+ <xsl:variable name="new-enhanced-path" select="$enhanced-path"/>
+ <!--simply did nothing which might be wrong-->
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'hd' ">
+ <xsl:variable name="new-enhanced-path" select="$enhanced-path"/>
+ <!--simply did nothing which might be wrong-->
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'he' ">
+ <xsl:variable name="new-enhanced-path" select="$enhanced-path"/>
+ <!--simply did nothing which might be wrong-->
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'hf' ">
+ <xsl:variable name="new-enhanced-path" select="$enhanced-path"/>
+ <!--simply did nothing which might be wrong-->
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'hg' ">
+ <xsl:variable name="new-enhanced-path" select="$enhanced-path"/>
+ <!--simply did nothing which might be wrong-->
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'hh' ">
+ <xsl:variable name="new-enhanced-path" select="$enhanced-path"/>
+ <!--simply did nothing which might be wrong-->
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'hi' ">
+ <xsl:variable name="new-enhanced-path" select="$enhanced-path"/>
+ <!--simply did nothing which might be wrong-->
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'nf' ">
+ <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' F ' )"/>
+ <!--simply did nothing which might be wrong-->
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'ns' ">
+ <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' S ' )"/>
+ <!--simply did nothing which might be wrong-->
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <!--The following is 6 command which deal with arcs:
+ ae ->T al -> U
+ at -> A ar -> B
+ wa -> W wr ->V
+ These pairs of commands have shown the perfect mapping from vml-path to enhanced-path-->
+ <xsl:when test="$command = 'ae' ">
+ <!-- arc on the screen with the start and end angles -->
+ <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' T ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="6"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'al' ">
+ <!-- ae command plus a implicitly moveto startpoint-->
+ <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' U ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="6"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'at' ">
+ <!-- arc on the screen with the edge box ,start points and end points(Notice it's counter-clockwise)-->
+ <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' A ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="8"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'ar' ">
+ <!-- at command plus a implicitly moveto startpoint-->
+ <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' B ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="8"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'wa' ">
+ <!-- arc on the screen with the edge box ,start points and end points(Notice it's clockwise)-->
+ <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' W ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="8"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'wr' ">
+ <!-- wa command plus a implicitly moveto startpoint-->
+ <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' V ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="8"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'qx' ">
+ <!-- Draw a quarter ellipse retated to the x-axis-->
+ <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' X ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'qy' ">
+ <!-- Draw a quarter ellipse retated to the y-axis-->
+ <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' Y ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'qb' ">
+ <!-- quadratic Bezier-->
+ <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' Q ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="4"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$enhanced-path"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-number-before">
+ <!-- get $count number of number before current position , output format:number1 number2 ... numberN:newpostion
+ skip $skipcount of numbers
+ -->
+ <xsl:param name="vml-path"/>
+ <xsl:param name="position" select="1"/>
+ <xsl:param name="count" select="1"/>
+ <xsl:param name="skipcount" select="0"/>
+ <xsl:param name="number" select="''"/>
+ <xsl:choose>
+ <xsl:when test="$count = 0">
+ <xsl:value-of select=" concat($number , ':' , $position) "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="num-pos">
+ <xsl:call-template name="get-number-position">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$position"/>
+ <xsl:with-param name="direction" select="-1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="previous-num-and-pos">
+ <xsl:call-template name="get-previous-number">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$num-pos"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="$skipcount &gt; 0">
+ <xsl:call-template name="get-number-before">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="substring-after($previous-num-and-pos , ':')"/>
+ <xsl:with-param name="count" select="$count"/>
+ <xsl:with-param name="skipcount" select="$skipcount - 1"/>
+ <xsl:with-param name="number" select="$number"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="$skipcount = 0">
+ <xsl:variable name="new-number">
+ <xsl:if test="not($count = 1)">
+ <xsl:value-of select="' '"/>
+ </xsl:if>
+ <xsl:value-of select=" concat( substring-before($previous-num-and-pos , ':') , $number ) "/>
+ </xsl:variable>
+ <xsl:call-template name="get-number-before">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="substring-after($previous-num-and-pos , ':')"/>
+ <xsl:with-param name="count" select="$count - 1"/>
+ <xsl:with-param name="skipcount" select="0"/>
+ <xsl:with-param name="number" select="$new-number"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-number-after">
+ <!-- get $count number of number after current position, output format:number1 number2 ... numberN:newpostion
+ skip $skipcount of numbers
+ -->
+ <xsl:param name="vml-path"/>
+ <xsl:param name="position" select="1"/>
+ <xsl:param name="count" select="1"/>
+ <xsl:param name="skipcount" select="0"/>
+ <xsl:param name="number" select="''"/>
+ <xsl:choose>
+ <xsl:when test="$count = 0">
+ <xsl:value-of select=" concat($number , ':' , $position) "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="num-pos">
+ <xsl:call-template name="get-number-position">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$position"/>
+ <xsl:with-param name="direction" select="1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="next-num-and-pos">
+ <xsl:call-template name="get-next-number">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$num-pos"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="$skipcount &gt; 0">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="substring-after($next-num-and-pos , ':')"/>
+ <xsl:with-param name="count" select="$count"/>
+ <xsl:with-param name="skipcount" select="$skipcount - 1"/>
+ <xsl:with-param name="number" select="$number"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="$skipcount = 0">
+ <xsl:variable name="new-number">
+ <xsl:value-of select=" concat( $number , substring-before($next-num-and-pos , ':') ) "/>
+ <xsl:if test="not($count = 1)">
+ <xsl:value-of select="' '"/>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="substring-after($next-num-and-pos , ':')"/>
+ <xsl:with-param name="count" select="$count - 1"/>
+ <xsl:with-param name="skipcount" select="0"/>
+ <xsl:with-param name="number" select="$new-number"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-number-position">
+ <!-- get the next number start position, direction should be 1 or -1-->
+ <xsl:param name="vml-path"/>
+ <xsl:param name="position"/>
+ <xsl:param name="direction" select="1"/>
+ <xsl:choose>
+ <xsl:when test="$direction = 1 and $position &gt; string-length($vml-path) ">0</xsl:when>
+ <xsl:when test="$direction = -1 and not($position &gt; 0)">0</xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="curr-char">
+ <xsl:if test="$direction = 1">
+ <xsl:value-of select="substring($vml-path, $position , 1)"/>
+ </xsl:if>
+ <xsl:if test="$direction = -1">
+ <xsl:value-of select="substring($vml-path, $position -1 , 1)"/>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="string-length(translate($curr-char , '+-.0123456789@' ,'')) = 0 ">
+ <!-- number start-->
+ <xsl:value-of select="$position"/>
+ </xsl:when>
+ <xsl:when test="not($curr-char = ' ')">
+ <xsl:value-of select="$position"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="get-number-position">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$position + $direction"/>
+ <xsl:with-param name="direction" select="$direction"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="skip-space">
+ <xsl:param name="vml-path"/>
+ <xsl:param name="position"/>
+ <xsl:param name="skip-comma" select="'yes'"/>
+ <xsl:variable name="curr-char" select="substring($vml-path, $position , 1)"/>
+ <xsl:choose>
+ <xsl:when test="$curr-char = ',' and $skip-comma = 'yes'">
+ <xsl:call-template name="skip-space">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$position+1"/>
+ <xsl:with-param name="skip-comma" select="'no'"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$curr-char = ' '">
+ <xsl:call-template name="skip-space">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$position+1"/>
+ <xsl:with-param name="skip-comma" select="$skip-comma"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$position"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="format-number-pos">
+ <xsl:param name="number"/>
+ <xsl:param name="position"/>
+ <xsl:choose>
+ <xsl:when test="contains($number,'@')">
+ <xsl:value-of select="concat('?f',translate($number,'@',''),':' , $position ) "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select=" concat(round($number) , ':' , $position) "/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-next-number">
+ <!-- get the next number from current position-->
+ <xsl:param name="vml-path"/>
+ <xsl:param name="position"/>
+ <xsl:param name="number" select=" '' "/>
+ <xsl:choose>
+ <xsl:when test="$position &gt; string-length($vml-path) ">
+ <xsl:call-template name="format-number-pos">
+ <xsl:with-param name="number" select="$number"/>
+ <xsl:with-param name="position" select="$position"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="curr-char" select="substring($vml-path, $position , 1)"/>
+ <xsl:choose>
+ <xsl:when test="string-length(translate($curr-char , '.0123456789' ,'')) = 0 ">
+ <!-- is number -->
+ <xsl:call-template name="get-next-number">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$position +1"/>
+ <xsl:with-param name="number" select="concat( $number, $curr-char) "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="string-length(translate($curr-char , '@+-' ,'') ) = 0 and string-length($number) = 0">
+ <!-- is number -->
+ <xsl:call-template name="get-next-number">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$position +1"/>
+ <xsl:with-param name="number" select="concat( $number, $curr-char) "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test=" $number = '' and $curr-char = ',' ">
+ <xsl:variable name="new-pos">
+ <xsl:call-template name="skip-space">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$position"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="concat( '0:' , $new-pos )"/>
+ </xsl:when>
+ <xsl:when test=" $number = '' and not($curr-char = ',') ">
+ <xsl:variable name="new-pos">
+ <xsl:call-template name="skip-space">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$position"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="concat( '0:' , $new-pos)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="new-pos">
+ <xsl:call-template name="skip-space">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$position"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="format-number-pos">
+ <xsl:with-param name="number" select="$number"/>
+ <xsl:with-param name="position" select="$new-pos"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-previous-number">
+ <!-- get the previous number from current position-->
+ <xsl:param name="vml-path"/>
+ <xsl:param name="position"/>
+ <xsl:param name="number" select="''"/>
+ <xsl:choose>
+ <xsl:when test="not($position &gt; 0)">
+ <xsl:call-template name="format-number-pos">
+ <xsl:with-param name="number" select="$number"/>
+ <xsl:with-param name="position" select="'0'"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="curr-char" select="substring($vml-path, $position -1 , 1)"/>
+ <xsl:choose>
+ <xsl:when test="string-length(translate($curr-char , '.0123456789' ,'')) = 0 ">
+ <!-- is number -->
+ <xsl:call-template name="get-previous-number">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$position -1"/>
+ <xsl:with-param name="number" select="concat($curr-char , $number) "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="string-length(translate($curr-char , '@+-' ,'') ) = 0 and string-length($number) = 0">
+ <!-- skip it -->
+ <xsl:call-template name="get-previous-number">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$position -1"/>
+ <xsl:with-param name="number" select="$number "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="string-length(translate($curr-char , '+-' ,'') ) = 0 and string-length($number) &gt; 0">
+ <!-- finsh it with +/- -->
+ <xsl:call-template name="format-number-pos">
+ <xsl:with-param name="number" select="$number"/>
+ <xsl:with-param name="position" select="$position"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="format-number-pos">
+ <xsl:with-param name="number" select="$number"/>
+ <xsl:with-param name="position" select="$position"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-path-command_dummy">
+ <xsl:param name="vml-path"/>
+ <xsl:param name="position" select="1"/>
+ <xsl:param name="last-command"/>
+ <xsl:choose>
+ <xsl:when test="$position &gt; string-length($vml-path) "/>
+ <xsl:otherwise>
+ <xsl:variable name="curr-char" select="substring($vml-path, $position , 1)"/>
+ <xsl:choose>
+ <xsl:when test="string-length(translate($curr-char , 'mlcxetrvnfsawqyb' ,'')) = 0 ">
+ <!-- "MmZzLlHhVvCcSsQqTtAa" are all possiable command chars -->
+ <xsl:value-of select="concat( $curr-char , ':' , $position +1)"/>
+ </xsl:when>
+ <xsl:when test="string-length(translate($curr-char , '+-.0123456789@' ,'')) = 0 ">
+ <!-- number start, use last command -->
+ <xsl:if test="string-length($last-command) = 0">
+ <xsl:message>ooo2wordml_path.xsl: Find undefined command</xsl:message>
+ </xsl:if>
+ <xsl:value-of select="concat( $last-command , ':' , $position )"/>
+ </xsl:when>
+ <xsl:when test="string-length(translate($curr-char , ',&#9;&#10;&#13;&#32;' ,'')) = 0 ">
+ <!-- space or ',' should be skip -->
+ <xsl:call-template name="get-path-command">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$position +1"/>
+ <xsl:with-param name="last-command" select="$last-command"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>ooo2wordml_path.xsl: Find undefined command:<xsl:value-of select="$curr-char"/>
+ </xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!--
+ **get-path- command**
+ This function will collect the next command from a string. If the input string should has a start of number character,
+ we here implictly think the command is the last-command
+ All of the command of vml is listed as following:
+ __Basic commands:__
+ m l c x e t r v nf ns ae al at ar wa wr qx qy qb
+ __Edit behavior extensions commands__
+ ha hb hc hd he hf hg hh hi
+
+ So we know the longest command should be four character.The function is implemented on this basis:
+ -->
+ <xsl:template name="get-path-command">
+ <xsl:param name="vml-path"/>
+ <xsl:param name="position" select="1"/>
+ <xsl:param name="last-command"/>
+ <xsl:choose>
+ <xsl:when test="$position &gt; string-length($vml-path) "/>
+ <xsl:otherwise>
+ <xsl:variable name="curr-char" select="substring($vml-path, $position , 1)"/>
+ <xsl:variable name="curr-2char" select="substring($vml-path, $position - 1 , 2)"/>
+ <xsl:choose>
+ <xsl:when test="$curr-char = 'a' ">
+ <!--process the commands ae al at ar-->
+ <xsl:variable name="second-char" select="substring($vml-path, $position+1 , 1)"/>
+ <xsl:variable name="isvalid">
+ <xsl:choose>
+ <xsl:when test="$second-char='e' ">1</xsl:when>
+ <xsl:when test="$second-char='l' ">1</xsl:when>
+ <xsl:when test="$second-char='t' ">1</xsl:when>
+ <xsl:when test="$second-char='r' ">1</xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="$isvalid = '1' ">
+ <xsl:value-of select="concat( $curr-char,$second-char , ':' , $position +2)"/>
+ </xsl:if>
+ <xsl:if test="$isvalid = '0' ">
+ <xsl:message>ooo2wordml_path.xsl: Error command occured </xsl:message>
+ </xsl:if>
+ </xsl:when>
+ <xsl:when test="$curr-char = 'n' ">
+ <!--process the commands nf ns -->
+ <xsl:variable name="second-char" select="substring($vml-path, $position+1 , 1)"/>
+ <xsl:variable name="isvalid">
+ <xsl:choose>
+ <xsl:when test="$second-char='f' ">1</xsl:when>
+ <xsl:when test="$second-char='s' ">1</xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="$isvalid = '1' ">
+ <xsl:value-of select="concat( $curr-char,$second-char , ':' , $position +2)"/>
+ </xsl:if>
+ <xsl:if test="$isvalid = '0' ">
+ <xsl:message>ooo2wordml_path.xsl: Error command occured </xsl:message>
+ </xsl:if>
+ </xsl:when>
+ <xsl:when test="$curr-char = 'w' ">
+ <!--process the commands wa wr-->
+ <xsl:variable name="second-char" select="substring($vml-path, $position+1 , 1)"/>
+ <xsl:variable name="isvalid">
+ <xsl:choose>
+ <xsl:when test="$second-char='a' ">1</xsl:when>
+ <xsl:when test="$second-char='r' ">1</xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="$isvalid = '1' ">
+ <xsl:value-of select="concat( $curr-char,$second-char , ':' , $position +2)"/>
+ </xsl:if>
+ <xsl:if test="$isvalid = '0' ">
+ <xsl:message>ooo2wordml_path.xsl: Error command occured </xsl:message>
+ </xsl:if>
+ </xsl:when>
+ <xsl:when test="$curr-char = 'q' ">
+ <!--process the commands qx qy qb-->
+ <xsl:variable name="second-char" select="substring($vml-path, $position+1 , 1)"/>
+ <xsl:variable name="isvalid">
+ <xsl:choose>
+ <xsl:when test="$second-char='x' ">1</xsl:when>
+ <xsl:when test="$second-char='y' ">1</xsl:when>
+ <xsl:when test="$second-char='b' ">1</xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="$isvalid = '1' ">
+ <xsl:value-of select="concat( $curr-char,$second-char , ':' , $position +2)"/>
+ </xsl:if>
+ <xsl:if test="$isvalid = '0' ">
+ <xsl:message>ooo2wordml_path.xsl: Error command occured </xsl:message>
+ </xsl:if>
+ </xsl:when>
+ <xsl:when test="$curr-char = 'h' ">
+ <!--process the edit behavior extensions commands-->
+ <xsl:variable name="second-char" select="substring($vml-path, $position+1 , 1)"/>
+ <xsl:variable name="isvalid">
+ <xsl:choose>
+ <xsl:when test="string-length(translate($second-char , 'abcdefghi' ,'')) = 0">1</xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="$isvalid = '1' ">
+ <xsl:value-of select="concat( $curr-char,$second-char , ':' , $position +2)"/>
+ </xsl:if>
+ <xsl:if test="$isvalid = '0' ">
+ <xsl:message>ooo2wordml_path.xsl: Error command occured </xsl:message>
+ </xsl:if>
+ </xsl:when>
+ <xsl:when test="string-length(translate($curr-char , 'mlcxetrv' ,'')) = 0 ">
+ <!--process the single character commands m l c x e t r v -->
+ <xsl:value-of select="concat( $curr-char , ':' , $position +1)"/>
+ </xsl:when>
+ <xsl:when test="string-length(translate($curr-char , '+-.0123456789@' ,'')) = 0 ">
+ <!-- number start, use last command -->
+ <xsl:if test="string-length($last-command) = 0">
+ <xsl:message>ooo2wordml_path.xsl: Find undefined command</xsl:message>
+ </xsl:if>
+ <xsl:value-of select="concat( $last-command , ':' , $position )"/>
+ </xsl:when>
+ <xsl:when test="$curr-2char=',,' ">
+ <!-- here are two ',' -->
+ <xsl:if test="string-length($last-command) = 0">
+ <xsl:message>ooo2wordml_path.xsl: Find undefined command</xsl:message>
+ </xsl:if>
+ <xsl:value-of select="concat( $last-command , ':' , $position )"/>
+ </xsl:when>
+ <xsl:when test="string-length(translate($curr-char , ',&#9;&#10;&#13;&#32;' ,'')) = 0 ">
+ <!-- space or ',' should be skip -->
+ <xsl:call-template name="get-path-command">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$position +1"/>
+ <xsl:with-param name="last-command" select="$last-command"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>ooo2wordml_path.xsl: Find undefined command:<xsl:value-of select="$curr-char"/>
+ </xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="svg-arc2vml-arc">
+ <xsl:param name="x0"/>
+ <xsl:param name="y0"/>
+ <xsl:param name="rx"/>
+ <xsl:param name="ry"/>
+ <xsl:param name="x-axis-rotation" select="0"/>
+ <xsl:param name="large-arc-flag" select="0"/>
+ <xsl:param name="sweep-flag" select="0"/>
+ <xsl:param name="x"/>
+ <xsl:param name="y"/>
+ <!-- Compute 1/2 distance between current and final point -->
+ <xsl:variable name="dx2" select="($x0 - $x) div 2"/>
+ <xsl:variable name="dy2" select="($y0 - $y) div 2"/>
+ <!-- Convert from degrees to radians -->
+ <xsl:variable name="rotation-radian" select="$x-axis-rotation * $pi div 180"/>
+ <!-- Compute (x1, y1). What are x1,y1?-->
+ <xsl:variable name="cos-rotation">
+ <xsl:call-template name="cos">
+ <xsl:with-param name="x" select="$rotation-radian"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="sin-rotation">
+ <xsl:call-template name="sin">
+ <xsl:with-param name="x" select="$rotation-radian"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="x1" select="$cos-rotation * $dx2 + $sin-rotation * $dy2"/>
+ <xsl:variable name="y1" select="-1 * $sin-rotation * $dx2 + $cos-rotation * $dy2"/>
+ <!-- Make sure radii are large enough -->
+ <xsl:variable name="rx-abs">
+ <xsl:call-template name="abs">
+ <xsl:with-param name="x" select="$rx"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="ry-abs">
+ <xsl:call-template name="abs">
+ <xsl:with-param name="x" select="$ry"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="rx-sq" select="$rx-abs * $rx-abs"/>
+ <xsl:variable name="ry-sq" select="$ry-abs * $ry-abs"/>
+ <xsl:variable name="x1-sq" select="$x1 * $x1"/>
+ <xsl:variable name="y1-sq" select="$y1 * $y1"/>
+ <xsl:variable name="radius-check" select=" $x1-sq div $rx-sq + $y1-sq div $ry-sq "/>
+ <xsl:variable name="radius-check-sqrt">
+ <xsl:call-template name="sqrt">
+ <xsl:with-param name="x" select="$radius-check"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="new-rx">
+ <xsl:choose>
+ <xsl:when test="$radius-check &gt; 1">
+ <xsl:value-of select="$rx-abs * $radius-check-sqrt"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$rx-abs"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="new-ry">
+ <xsl:choose>
+ <xsl:when test="$radius-check &gt; 1">
+ <xsl:value-of select="$ry-abs * $radius-check-sqrt"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$ry-abs"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="new-ry-sq">
+ <xsl:choose>
+ <xsl:when test="$radius-check &gt; 1">
+ <xsl:value-of select="$new-ry * $new-ry"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$ry-sq"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="new-rx-sq">
+ <xsl:choose>
+ <xsl:when test="$radius-check &gt; 1">
+ <xsl:value-of select="$new-rx * $new-rx"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$rx-sq"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <!-- Step 2: Compute (cx1, cy1) -->
+ <xsl:variable name="sign">
+ <xsl:choose>
+ <xsl:when test="$large-arc-flag = $sweep-flag">-1</xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="unchecked-sq" select=" (($new-rx-sq * $new-ry-sq) - ($new-rx-sq * $y1-sq) - ($new-ry-sq * $x1-sq)) div (($new-rx-sq * $y1-sq) + ($new-ry-sq * $x1-sq)) "/>
+ <xsl:variable name="sq">
+ <xsl:choose>
+ <xsl:when test=" $unchecked-sq &lt; 0">0</xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$unchecked-sq"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="sq-sqrt">
+ <xsl:call-template name="sqrt">
+ <xsl:with-param name="x" select="$sq"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="coef" select="$sign * $sq-sqrt "/>
+ <xsl:variable name="cx1" select="$coef * $new-rx * $y1 div $new-ry"/>
+ <xsl:variable name="cy1" select=" -1 * $coef * $new-ry * $x1 div $new-rx"/>
+ <!-- Step 3: Compute (cx, cy) from (cx1, cy1) -->
+ <xsl:variable name="sx2" select="($x0 +$x) div 2 "/>
+ <xsl:variable name="sy2" select="($y0 +$y) div 2 "/>
+ <xsl:variable name="tmp1" select="$cos-rotation * $cx1 "/>
+ <xsl:variable name="tmp2" select="$cos-rotation * $cx1 "/>
+ <xsl:variable name="cx" select=" $sx2 + ( $cos-rotation * $cx1 - $sin-rotation * $cy1 ) "/>
+ <xsl:variable name="cy" select=" $sy2 + ( $sin-rotation * $cx1 + $cos-rotation * $cy1 ) "/>
+ <!-- Step 4: Compute angle start and angle extent -->
+ <xsl:variable name="ux" select="( $x1 - $cx1) div $new-rx"/>
+ <xsl:variable name="uy" select="( $y1 - $cy1) div $new-ry"/>
+ <xsl:variable name="vx" select="( - 1 * $x1 - $cx1) div $new-rx"/>
+ <xsl:variable name="vy" select="(- 1 * $y1 - $cy1) div $new-ry"/>
+ <xsl:variable name="n">
+ <xsl:call-template name="sqrt">
+ <xsl:with-param name="x" select=" ($ux * $ux) + ($uy * $uy) "/>
+ </xsl:call-template>
+ </xsl:variable>
+ <!-- 1 * ux + 0 * uy -->
+ <xsl:variable name="p" select="$ux"/>
+ <xsl:variable name="uy-sign">
+ <xsl:choose>
+ <xsl:when test=" $uy &lt; 0 ">-1</xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="acos-pn">
+ <xsl:call-template name="acos">
+ <xsl:with-param name="x" select="$p div $n"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="theta" select="( $uy-sign * $acos-pn * 180 div $pi ) mod 360 "/>
+ <xsl:variable name="n-delta">
+ <xsl:call-template name="sqrt">
+ <xsl:with-param name="x" select="($ux * $ux + $uy * $uy) * ($vx * $vx + $vy * $vy)"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="p-delta" select="$ux * $vx + $uy * $vy"/>
+ <xsl:variable name="vy-sign">
+ <xsl:choose>
+ <xsl:when test="($ux * $vy - $uy * $vx) &lt; 0 ">-1</xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="acos-pn-delta">
+ <xsl:call-template name="acos">
+ <xsl:with-param name="x" select="$p-delta div $n-delta"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="unchecked-delta" select="$vy-sign * $acos-pn-delta * 180 div $pi "/>
+ <xsl:variable name="delta">
+ <xsl:choose>
+ <xsl:when test=" $sweep-flag = 0 and $unchecked-delta &gt; 0 ">
+ <xsl:value-of select=" ($unchecked-delta - 360) mod 360 "/>
+ </xsl:when>
+ <xsl:when test=" $sweep-flag = 1 and $unchecked-delta &lt; 0 ">
+ <xsl:value-of select=" ($unchecked-delta + 360) mod 360 "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select=" $unchecked-delta mod 360 "/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:value-of select="concat ($cx, ' ' , $cy, ' ' , $rx, ' ' , $ry, ' ' , $theta, ' ' , $delta, ' ' , $x-axis-rotation) "/>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/filter/source/xslt/import/wordml/wordml2ooo_props.xsl b/filter/source/xslt/import/wordml/wordml2ooo_props.xsl
new file mode 100644
index 000000000000..76725f217d79
--- /dev/null
+++ b/filter/source/xslt/import/wordml/wordml2ooo_props.xsl
@@ -0,0 +1,107 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="w wx aml o dt v" xmlns:an="urn:flr:annotate">
+
+<an:page-layout-properties
+ context-node-input="w:sectPr"
+ context-node-output="style:page-layout-properties">
+<an:so-supported select="w:pgMar/@w:gutter"/>
+<an:so-supported select="w:pgSz/@w:code"/>
+</an:page-layout-properties>
+
+<xsl:template name="page-layout-properties">
+
+<xsl:attribute name="fo:margin-top.value">
+ <xsl:value-of select="concat('(.(twips2cm(?[',name(w:hdr),'](?(>=($0[',w:pgMar/@w:top,'])($1(|[',w:pgMar/@w:header,'][720])))($1)($0))[',w:pgMar/@w:top,']))[cm])')"/>
+</xsl:attribute>
+<xsl:attribute name="fo:margin-bottom.value">
+ <xsl:value-of select="concat('(.(twips2cm(?[',name(w:ftr),'](|[',w:pgMar/@w:footer,'][720])[',w:pgMar/@w:bottom,']))[cm])')"/>
+</xsl:attribute>
+<xsl:attribute name="fo:margin-left.value">
+ <xsl:value-of select="concat('(.(twips2cm[',w:pgMar/@w:left,'])[cm])')"/>
+</xsl:attribute>
+<xsl:attribute name="fo:margin-right.value">
+ <xsl:value-of select="concat('(.(twips2cm[',w:pgMar/@w:right,'])[cm])')"/>
+</xsl:attribute>
+
+<xsl:attribute name="fo:page-width.value">
+ <xsl:value-of select="concat('(.(twips2cm[',w:pgSz/@w:w,'])[cm])')"/>
+</xsl:attribute>
+<xsl:attribute name="fo:page-height.value">
+ <xsl:value-of select="concat('(.(twips2cm[',w:pgSz/@w:h,'])[cm])')"/>
+</xsl:attribute>
+<xsl:attribute name="style:footnote-max-height.value">
+ <xsl:value-of select="'[0cm]'"/>
+</xsl:attribute>
+<xsl:attribute name="style:print-orientation.value">
+ <xsl:value-of select="concat('(|[',w:pgSz/@w:orient,'][portrait])')"/>
+</xsl:attribute>
+<xsl:apply-templates select="//w:bgPict"/>
+<xsl:call-template name="column-properties"/>
+</xsl:template>
+
+
+<an:column-properties
+ context-node-input="w:sectPr"
+ context-node-output="style:page-layout-properties">
+<an:so-supported select="w:cols/@w:sep"/>
+</an:column-properties>
+<xsl:template name="column-properties">
+<style:columns>
+<xsl:attribute name="fo:column-count.value">
+ <xsl:value-of select="concat('(|[',w:cols/@w:num,'][1])')"/>
+</xsl:attribute>
+
+<xsl:if test="not(w:cols/w:col)">
+<!-- bug in the OASIS spec resp. bug in xmloff -->
+<xsl:attribute name="fo:column-gap.value">
+ <xsl:value-of select="concat('(.(twips2cm[',w:cols/@w:space,'])[cm])')"/>
+</xsl:attribute>
+</xsl:if>
+
+<xsl:for-each select="w:cols/w:col">
+ <style:column>
+ <xsl:attribute name="style:rel-width.value">
+ <xsl:value-of select="concat('(.[',@w:w,'][*])')"/>
+ </xsl:attribute>
+ <xsl:attribute name="fo:start-indent.value">
+ <xsl:value-of select="'[0cm]'"/>
+ </xsl:attribute>
+ <xsl:attribute name="fo:end-indent.value">
+ <xsl:value-of select="concat('(.(twips2cm(|[',@w:space,'][0]))[cm])')"/>
+ </xsl:attribute>
+ </style:column>
+</xsl:for-each>
+</style:columns>
+</xsl:template>
+
+<an:text-properties
+ context-node-input="w:rPr"
+ context-node-output="style:text-properties">
+</an:text-properties >
+<xsl:template name="text-properties">
+<xsl:attribute name="fo:font-weight.value">
+ <xsl:value-of select="concat('(switch(|[',w:b/@val,'][',local-name(w:b),'])[on][bold][off][normal][b][bold][])')"/>
+</xsl:attribute>
+<xsl:attribute name="style:font-weight-asian.value">
+ <xsl:value-of select="concat('(switch(|[',w:b/@val,'][',local-name(w:b),'])[on][bold][off][normal][b][bold][])')"/>
+</xsl:attribute>
+<xsl:attribute name="style:font-weight-complex.value">
+ <xsl:value-of select="concat('(switch(|[',w:b-cs/@val,'][',local-name(w:b-cs),'])[on][bold][off][normal][b-cs][bold][])')"/>
+</xsl:attribute>
+<xsl:attribute name="fo:font-style.value">
+ <xsl:value-of select="concat('(switch(|[',w:i/@val,'][',local-name(w:i),'])[on][italic][off][normal][i][italic][])')"/>
+</xsl:attribute>
+<xsl:attribute name="style:font-style-asian.value">
+ <xsl:value-of select="concat('(switch(|[',w:i/@val,'][',local-name(w:i),'])[on][italic][off][normal][i][italic][])')"/>
+</xsl:attribute>
+<xsl:attribute name="style:font-style-complex.value">
+ <xsl:value-of select="concat('(switch(|[',w:i-cs/@val,'][',local-name(w:i-cs),'])[on][italic][off][normal][i-cs][italic][])')"/>
+</xsl:attribute>
+<xsl:attribute name="fo:text-transform.value">
+ <xsl:value-of select="concat('(switch(|[',w:caps/@val,'][',local-name(w:caps),'])[on][uppercase][off][normal][caps][uppercase][])')"/>
+</xsl:attribute>
+<xsl:attribute name="fo:font-variant.value">
+ <xsl:value-of select="concat('(switch(|[',w:smallCaps/@val,'][',local-name(w:smallCaps),'])[on][small-caps][off][normal][smallCaps][small-caps][])')"/>
+</xsl:attribute>
+</xsl:template>
+
+</xsl:stylesheet> \ No newline at end of file
diff --git a/filter/source/xslt/import/wordml/wordml2ooo_settings.xsl b/filter/source/xslt/import/wordml/wordml2ooo_settings.xsl
new file mode 100644
index 000000000000..84696dcf5773
--- /dev/null
+++ b/filter/source/xslt/import/wordml/wordml2ooo_settings.xsl
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="w wx aml o dt v">
+ <xsl:template match="w:docPr">
+ <office:settings>
+ <config:config-item-set config:name="view-settings">
+ <config:config-item config:name="InBrowseMode" config:type="boolean">
+ <xsl:choose>
+ <xsl:when test="w:view/@w:val = 'outline'">true</xsl:when>
+ <xsl:when test="w:view/@w:val = 'print'">false</xsl:when>
+ <!-- others: web, reading, normal, master-pages, none. glu -->
+ <xsl:otherwise>true</xsl:otherwise>
+ </xsl:choose>
+ </config:config-item>
+ <config:config-item-map-indexed config:name="Views">
+ <config:config-item-map-entry>
+ <xsl:if test="w:zoom">
+ <!-- VisibleRight and VisibleBottom are arbitrary positive numbers. ;) glu -->
+ <config:config-item config:name="VisibleRight" config:type="int">1</config:config-item>
+ <config:config-item config:name="VisibleBottom" config:type="int">1</config:config-item>
+ <xsl:choose>
+ <xsl:when test="w:zoom/@w:val = 'best-fit'">
+ <config:config-item config:name="ZoomType" config:type="short">3</config:config-item>
+ </xsl:when>
+ <xsl:when test="w:zoom/@w:val = 'full-page'">
+ <config:config-item config:name="ZoomType" config:type="short">2</config:config-item>
+ </xsl:when>
+ <xsl:when test="w:zoom/@w:val = 'text-fit'">
+ <config:config-item config:name="ZoomType" config:type="short">1</config:config-item>
+ </xsl:when>
+ <xsl:otherwise>
+ <config:config-item config:name="ZoomType" config:type="short">0</config:config-item>
+ </xsl:otherwise>
+ </xsl:choose>
+ <config:config-item config:name="ZoomFactor" config:type="short">
+ <xsl:value-of select="w:zoom/@w:percent"/>
+ </config:config-item>
+ </xsl:if>
+ </config:config-item-map-entry>
+ </config:config-item-map-indexed>
+ </config:config-item-set>
+ </office:settings>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/filter/source/xslt/import/wordml/wordml2ooo_table.xsl b/filter/source/xslt/import/wordml/wordml2ooo_table.xsl
new file mode 100644
index 000000000000..113dd391b433
--- /dev/null
+++ b/filter/source/xslt/import/wordml/wordml2ooo_table.xsl
@@ -0,0 +1,1286 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="w wx aml o dt v">
+ <xsl:template match="w:style[@w:type='table']" mode="table">
+ <style:style style:family="table">
+ <xsl:attribute name="style:name">
+ <xsl:value-of select="concat('w',translate(@w:styleId,' ~`!@#$%^*(&#x26;)+/,;?&lt;&gt;{}[]:','_'))"/>
+ </xsl:attribute>
+ <xsl:if test="w:basedOn">
+ <xsl:attribute name="style:parent-style-name">
+ <xsl:value-of select="concat('w',translate(w:basedOn/@w:val,' ~`!@#$%^*(&#x26;)+/,;?&lt;&gt;{}[]:','_'))"/>
+ </xsl:attribute>
+ </xsl:if>
+ <style:table-properties table:align="margins"/>
+ </style:style>
+ </xsl:template>
+ <xsl:template match="w:tblPr" mode="style">
+ <xsl:variable name="table-number">
+ <xsl:number count="w:tbl" from="/w:wordDocument/w:body" level="any" format="1" />
+ </xsl:variable>
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name">
+ <xsl:text>Table</xsl:text>
+ <xsl:value-of select="$table-number"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:family">table</xsl:attribute>
+ <xsl:if test="w:tblStyle">
+ <xsl:attribute name="style:parent-style-name">
+ <xsl:value-of select="concat('w',translate(w:tblStyle/@w:val,' ~`!@#$%^*(&#x26;)+/,;?&lt;&gt;{}[]:','_'))"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:variable name="section-property-number" select="count(preceding::w:sectPr)"/>
+ <xsl:variable name="last-section-property" select="preceding::w:pPr/w:sectPr[1]"/>
+ <xsl:variable name="next-section-property" select="following::w:sectPr[1]"/>
+ <xsl:variable name="last-next-p-tbl" select="$last-section-property[last()]/following::*[name()='w:p' or name()='w:tbl']"/>
+ <xsl:choose>
+ <xsl:when test="not($next-section-property/w:type/@w:val = 'continuous') and generate-id($last-next-p-tbl[1]) = generate-id(..) and not(ancestor::w:sectPr or ancestor::w:styles)">
+ <xsl:attribute name="style:master-page-name">
+ <xsl:text>Standard</xsl:text>
+ <xsl:value-of select="$section-property-number + 1" />
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$table-number = 1 and not(preceding::w:p[ancestor::w:body])">
+ <xsl:attribute name="style:master-page-name">First_20_Page</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:element name="style:table-properties">
+ <xsl:choose>
+ <xsl:when test="w:jc/@w:val = 'left' or w:jc/@w:val = 'center' or w:jc/@w:val = 'right'">
+ <xsl:attribute name="table:align">
+ <xsl:value-of select="w:jc/@w:val"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="table:align">margins</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!-- adopt the width of table and column corresponding the width of page and margins. . -->
+ <xsl:variable name="sectPr" select="following::w:sectPr[1]"/>
+ <xsl:variable name="total-page-size" select="$sectPr/w:pgSz/@w:w"/>
+ <xsl:variable name="page-left-mar" select="$sectPr/w:pgMar/@w:left"/>
+ <xsl:variable name="page-right-mar" select="$sectPr/w:pgMar/@w:right"/>
+ <xsl:variable name="page-size-value" select="$total-page-size - $page-left-mar - $page-right-mar"/>
+ <xsl:variable name="page-size-inch">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="'in'"/>
+ <xsl:with-param name="value" select="concat($page-size-value, 'twip') "/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="gridcols" select="../w:tblGrid/w:gridCol"/>
+ <xsl:variable name="tblsize" select="sum($gridcols/@w:w)"/>
+ <xsl:variable name="table_indent">
+ <xsl:choose>
+ <xsl:when test="w:tblInd and w:tblInd/@w:w &gt; 0 ">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="'in'"/>
+ <xsl:with-param name="value" select="concat(w:tblInd/@w:w, 'twip') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="number( '0') "/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="rel-tblsize">
+ <xsl:choose>
+ <xsl:when test="w:tblW/@w:type = 'pct'">
+ <xsl:value-of select="(number(w:tblW/@w:w ) div 5000) * $page-size-inch"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="'in'"/>
+ <xsl:with-param name="value" select="concat($tblsize, 'twip')"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="style:width">
+ <xsl:value-of select="concat($rel-tblsize, 'in' )"/>
+ </xsl:attribute>
+ <xsl:variable name="tbl_margin_left">
+ <xsl:choose>
+ <xsl:when test="not(w:tblpPr ) ">
+ <xsl:choose>
+ <xsl:when test="w:bidiVisual">
+ <xsl:choose>
+ <xsl:when test=" number($page-size-inch - $table_indent - $rel-tblsize) &gt; 0">
+ <xsl:value-of select="$page-size-inch - $table_indent - $rel-tblsize"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>0</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$table_indent"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="w:tblpPr">
+ <!-- if the table is put into a draw:text-box, fo:margin-left and fo:margin-right should be 0 -->
+ <xsl:text>0</xsl:text>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="tbl_margin_right">
+ <xsl:choose>
+ <xsl:when test="not(w:tblpPr ) ">
+ <xsl:choose>
+ <xsl:when test="w:bidiVisual">
+ <xsl:value-of select="$table_indent"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test=" number($page-size-inch - $table_indent - $rel-tblsize) &gt; 0">
+ <xsl:value-of select="$page-size-inch - $table_indent - $rel-tblsize"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>0</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="w:tblpPr">
+ <!-- if the table is put into a draw:text-box, fo:margin-left and fo:margin-right should be 0 -->
+ <xsl:text>0</xsl:text>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="fo:margin-left">
+ <xsl:value-of select="concat( $tbl_margin_left, 'in')"/>
+ </xsl:attribute>
+ <xsl:attribute name="fo:margin-right">
+ <xsl:value-of select="concat($tbl_margin_right, 'in')"/>
+ </xsl:attribute>
+ <!-- If previous w:p has a page break, the table must have the page break attribute applied to it May need this for tables starting on new pages -->
+ <!-- <xsl:if test="parent::w:tbl/preceding-sibling::w:p[1][descendant::w:br/@w:type='page']">
+ <xsl:attribute name="fo:break-before">page</xsl:attribute></xsl:if> -->
+ <!-- initial values for tables-->
+ </xsl:element>
+ </xsl:element>
+ <!-- the following style is for conveting Word table text wrapping to SO Writer. Since SO Writer has no table text wrapping feature, so we use the draw:text-box as a container and put the table in draw:text-box -->
+ <xsl:if test="w:tblpPr">
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name">TableFrame<xsl:number count="w:tblpPr" from="/w:wordDocument/w:body" level="any" format="1"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:family">graphic</xsl:attribute>
+ <xsl:attribute name="style:parent-style-name">
+ <xsl:value-of select=" 'Frame' "/>
+ </xsl:attribute>
+ <xsl:element name="style:graphic-properties">
+ <xsl:if test="w:tblpPr/@w:leftFromText">
+ <xsl:variable name="left_margin_from_text">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="'in'"/>
+ <xsl:with-param name="value" select="concat (w:tblpPr/@w:leftFromText, 'twip') "/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="fo:margin-left">
+ <xsl:value-of select="concat( $left_margin_from_text, 'in') "/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:tblpPr/@w:rightFromText">
+ <xsl:variable name="right_margin_from_text">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="'in'"/>
+ <xsl:with-param name="value" select="concat (w:tblpPr/@w:rightFromText, 'twip') "/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="fo:margin-right">
+ <xsl:value-of select="concat( $right_margin_from_text, 'in') "/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:tblpPr/@w:topFromText">
+ <xsl:variable name="top_margin_from_text">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="'in'"/>
+ <xsl:with-param name="value" select="concat (w:tblpPr/@w:topFromText, 'twip') "/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="fo:margin-top">
+ <xsl:value-of select="concat( $top_margin_from_text, 'in') "/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:tblpPr/@w:bottomFromText">
+ <xsl:variable name="bottom_margin_from_text">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="'in'"/>
+ <xsl:with-param name="value" select="concat (w:tblpPr/@w:bottomFromText, 'twip') "/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="fo:margin-bottom">
+ <xsl:value-of select="concat( $bottom_margin_from_text, 'in') "/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="style:number-wrapped-paragraphs">
+ <xsl:text>no-limit</xsl:text>
+ </xsl:attribute>
+ <!--xsl:if test="w:tblpPr/@w:tblpYSpec" to get the vertical alignment-->
+ <xsl:variable name="vertical_alignment">
+ <xsl:choose>
+ <xsl:when test="w:tblpPr/@w:tblpYSpec = 'top' ">
+ <xsl:text>top</xsl:text>
+ </xsl:when>
+ <xsl:when test="w:tblpPr/@w:tblpYSpec = 'center' ">
+ <xsl:text>middle</xsl:text>
+ </xsl:when>
+ <xsl:when test="w:tblpPr/@w:tblpYSpec= 'bottom' ">
+ <xsl:text>bottom</xsl:text>
+ </xsl:when>
+ <xsl:when test="w:tblpPr/@w:tblpYSpec = 'inside' ">
+ <xsl:text>from-top</xsl:text>
+ </xsl:when>
+ <xsl:when test="w:tblpPr/@w:tblpYSpec= 'outside' ">
+ <xsl:text>top</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>from-top</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="style:vertical-pos">
+ <xsl:value-of select="$vertical_alignment"/>
+ </xsl:attribute>
+ <!--/xsl:if-->
+ <!--xsl:if test="w:tblpPr/@w:vertAnchor" to get the vertical anchor related area type -->
+ <xsl:variable name="frame_v_anchor">
+ <xsl:choose>
+ <xsl:when test="w:tblpPr/@w:vertAnchor = 'text' ">
+ <xsl:value-of select=" 'paragraph' "/>
+ </xsl:when>
+ <xsl:when test="w:tblpPr/@w:vertAnchor = 'margin' ">
+ <xsl:value-of select=" 'paragraph-content' "/>
+ </xsl:when>
+ <xsl:when test="w:tblpPr/@w:vertAnchor = 'page' ">
+ <xsl:value-of select="w:tblpPr/@w:vertAnchor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select=" 'page-content' "/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="style:vertical-rel">
+ <xsl:value-of select="$frame_v_anchor"/>
+ </xsl:attribute>
+ <!--/xsl:if-->
+ <!--xsl:if test="w:tblpPr/@w:tblpXSpec" to get the horizntal alignment-->
+ <xsl:variable name="horizental_alignment">
+ <xsl:choose>
+ <xsl:when test="w:tblpPr/@w:tblpXSpec = 'left' ">
+ <xsl:text>left</xsl:text>
+ </xsl:when>
+ <xsl:when test="w:tblpPr/@w:tblpXSpec = 'center' ">
+ <xsl:text>center</xsl:text>
+ </xsl:when>
+ <xsl:when test="w:tblpPr/@w:tblpXSpec = 'right' ">
+ <xsl:text>right</xsl:text>
+ </xsl:when>
+ <xsl:when test="w:tblpPr/@w:tblpXSpec = 'inside' ">
+ <xsl:text>from-left</xsl:text>
+ </xsl:when>
+ <xsl:when test="w:tblpPr/@w:tblpXSpec = 'outside' ">
+ <xsl:text>outside</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>left</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="style:horizontal-pos">
+ <xsl:value-of select="$horizental_alignment"/>
+ </xsl:attribute>
+ <!--/xsl:if-->
+ <!--xsl:if test="w:tblpPr/@w:horzAnchor" to get the horizental anchor related area type-->
+ <xsl:variable name="frame_h_anchor">
+ <xsl:choose>
+ <xsl:when test="w:tblpPr/@w:horzAnchor = 'text' ">
+ <xsl:value-of select=" 'paragraph' "/>
+ </xsl:when>
+ <xsl:when test="w:tblpPr/@w:horzAnchor = 'margin' ">
+ <xsl:value-of select=" 'page-content' "/>
+ </xsl:when>
+ <xsl:when test="w:tblpPr/@w:horzAnchor = 'page' ">
+ <xsl:value-of select="w:tblpPr/@w:horzAnchor"/>
+ </xsl:when>
+ <xsl:when test="w:tblpPr/@w:horzAnchor= 'inside' ">
+ <xsl:value-of select=" 'paragraph-start-margin' "/>
+ </xsl:when>
+ <xsl:when test="w:tblpPr/@w:horzAnchor= 'outside' ">
+ <xsl:value-of select=" 'paragraph-end-margin' "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select=" 'paragraph-content' "/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="style:horizontal-rel">
+ <xsl:value-of select="$frame_h_anchor"/>
+ </xsl:attribute>
+ <!--/xsl:if-->
+ <xsl:attribute name="fo:background-color">
+ <xsl:text>#ffffff</xsl:text>
+ </xsl:attribute>
+ <!-- xsl:attribute name="style:background-transparency"><xsl:text>100%</xsl:text></xsl:attribute -->
+ <xsl:attribute name="style:wrap">
+ <xsl:text>parallel</xsl:text>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="w:gridCol" mode="style">
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:family">table-column</xsl:attribute>
+ <xsl:attribute name="style:name">Table<xsl:number count="w:tbl" from="/w:wordDocument/w:body" level="any" format="1"/>.C<xsl:number count="w:gridCol" from="/w:wordDocument/w:body" level="single" format="1"/>
+ </xsl:attribute>
+ <xsl:element name="style:table-column-properties">
+ <xsl:variable name="column_width">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="'in'"/>
+ <xsl:with-param name="value" select="concat(@w:w, 'twip') "/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="style:column-width">
+ <xsl:value-of select="concat($column_width,'in') "/>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="w:trPr" mode="style">
+ <!-- to generate style:style of table-row height. -->
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:family">table-row</xsl:attribute>
+ <xsl:attribute name="style:name">Table<xsl:number count="w:tbl" from="/w:wordDocument/w:body" level="any" format="1"/>.R<xsl:number count="w:tr" from="/w:wordDocument/w:body" level="single" format="1"/>
+ </xsl:attribute>
+ <xsl:element name="style:table-row-properties">
+ <xsl:choose>
+ <xsl:when test="w:trHeight/@w:val">
+ <xsl:variable name="tbl_row_height">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="'in'"/>
+ <xsl:with-param name="value" select="concat(w:trHeight/@w:val, 'twip') "/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="style:min-row-height">
+ <xsl:value-of select="concat($tbl_row_height, 'in' )"/>
+ </xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="w:tcPr" mode="style">
+ <style:style>
+ <xsl:attribute name="style:name">Table<xsl:number count="w:tbl" from="/w:wordDocument/w:body" level="any" format="1"/>.R<xsl:number count="w:tr" from="/w:wordDocument/w:body" level="single" format="1"/>C<xsl:number count="w:tc" from="/w:wordDocument/w:body" level="single" format="1"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:family">table-cell</xsl:attribute>
+ <xsl:variable name="rootStyle" select="ancestor::w:tbl/w:tblPr/w:tblStyle/@w:val"/>
+ <xsl:variable name="rootStyleNode" select="/w:wordDocument/w:styles/w:style[@w:styleId = $rootStyle]"/>
+ <xsl:element name="style:table-cell-properties">
+ <!-- cell background color start -->
+ <xsl:variable name="tbl_cell_background_color">
+ <xsl:choose>
+ <xsl:when test="w:shd/@w:fill">
+ <xsl:value-of select="w:shd/@w:fill"/>
+ </xsl:when>
+ <xsl:when test="$rootStyleNode/w:tblpr/w:shd/@w:fill">
+ <xsl:value-of select="$rootStyleNode/w:tblpr/w:shd/@w:fill"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test=" string-length($tbl_cell_background_color) &gt; 0 and not( $tbl_cell_background_color ='auto' )">
+ <xsl:attribute name="fo:background-color">
+ <xsl:value-of select="concat('#',$tbl_cell_background_color)"/>
+ </xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <!--cell background color end -->
+ <!-- table cell vertical alignment start -->
+ <xsl:if test="w:vAlign">
+ <xsl:variable name="tbl_cell_alignment">
+ <xsl:choose>
+ <xsl:when test="w:vAlign/@w:val = 'top' ">
+ <xsl:text>top</xsl:text>
+ </xsl:when>
+ <xsl:when test="w:vAlign/@w:val = 'center' ">
+ <xsl:text>middle</xsl:text>
+ </xsl:when>
+ <xsl:when test="w:vAlign/@w:val = 'bottom' ">
+ <xsl:text>bottom</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>automatic</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="style:vertical-align">
+ <xsl:value-of select="$tbl_cell_alignment"/>
+ </xsl:attribute>
+ </xsl:if>
+ <!--table cell alignment end -->
+ <!-- cell margin start -->
+ <xsl:variable name="tblcell_leftmargin">
+ <xsl:choose>
+ <xsl:when test="w:tcMar/w:left">
+ <xsl:call-template name="convert2in_special">
+ <xsl:with-param name="original_value" select="concat(w:tcMar/w:left/@w:w , w:tcMar/w:left/@w:type) "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$rootStyleNode/w:tblPr/w:tblCellMar/w:left">
+ <xsl:call-template name="convert2in_special">
+ <xsl:with-param name="original_value" select="concat($rootStyleNode/w:tblPr/w:tblCellMar/w:left/@w:w , $rootStyleNode/w:tblPr/w:tblCellMar/w:left/@w:type)"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>0</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="tblcell_rightmargin">
+ <xsl:choose>
+ <xsl:when test="w:tcMar/w:right">
+ <xsl:call-template name="convert2in_special">
+ <xsl:with-param name="original_value" select="concat(w:tcMar/w:right/@w:w , w:tcMar/w:right/@w:type) "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$rootStyleNode/w:tblPr/w:tblCellMar/w:right">
+ <xsl:call-template name="convert2in_special">
+ <xsl:with-param name="original_value" select="concat($rootStyleNode/w:tblPr/w:tblCellMar/w:right/@w:w , $rootStyleNode/w:tblPr/w:tblCellMar/w:right/@w:type)"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>0</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="tblcell_topmargin">
+ <xsl:choose>
+ <xsl:when test="w:tcMar/w:top">
+ <xsl:call-template name="convert2in_special">
+ <xsl:with-param name="original_value" select="concat(w:tcMar/w:top/@w:w , w:tcMar/w:top/@w:type) "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$rootStyleNode/w:tblPr/w:tblCellMar/w:top">
+ <xsl:call-template name="convert2in_special">
+ <xsl:with-param name="original_value" select="concat($rootStyleNode/w:tblPr/w:tblCellMar/w:top/@w:w , $rootStyleNode/w:tblPr/w:tblCellMar/w:top/@w:type)"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>0</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="tblcell_bottommargin">
+ <xsl:choose>
+ <xsl:when test="w:tcMar/w:bottom">
+ <xsl:call-template name="convert2in_special">
+ <xsl:with-param name="original_value" select="concat(w:tcMar/w:bottom/@w:w , w:tcMar/w:bottom/@w:type) "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$rootStyleNode/w:tblPr/w:tblCellMar/w:bottom">
+ <xsl:call-template name="convert2in_special">
+ <xsl:with-param name="original_value" select="concat($rootStyleNode/w:tblPr/w:tblCellMar/w:bottom/@w:w , $rootStyleNode/w:tblPr/w:tblCellMar/w:bottom/@w:type)"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>0</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="string-length($tblcell_leftmargin) &gt; 0 ">
+ <xsl:attribute name="fo:padding-left">
+ <xsl:value-of select="concat($tblcell_leftmargin, 'in' )"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="string-length($tblcell_rightmargin) &gt; 0">
+ <xsl:attribute name="fo:padding-right">
+ <xsl:value-of select="concat($tblcell_rightmargin, 'in' )"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="string-length($tblcell_topmargin) &gt; 0 ">
+ <xsl:attribute name="fo:padding-top">
+ <xsl:value-of select="concat($tblcell_topmargin, 'in' )"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="string-length($tblcell_bottommargin) &gt; 0">
+ <xsl:attribute name="fo:padding-bottom">
+ <xsl:value-of select="concat($tblcell_bottommargin, 'in' )"/>
+ </xsl:attribute>
+ </xsl:if>
+ <!-- cell margin end -->
+ <xsl:variable name="row-position">
+ <xsl:number count="w:tr" from="/w:wordDocument/w:body" level="single" format="1"/>
+ </xsl:variable>
+ <!-- cell borders should be carefully converted. a little complex. glu :( -->
+ <xsl:variable name="Borders" select="ancestor::w:tbl/w:tblPr/w:tblBorders"/>
+ <xsl:choose>
+ <xsl:when test="$row-position &gt; 1">
+ <xsl:call-template name="get-table-border">
+ <xsl:with-param name="style-pos" select="'top'"/>
+ <xsl:with-param name="style-position-0" select="w:tcBorders/w:top"/>
+ <xsl:with-param name="style-position-1" select="$Borders/w:insideH"/>
+ <xsl:with-param name="style-position-2" select="$rootStyleNode/w:tblPr/w:tblBorders/w:insideH"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="get-table-border">
+ <xsl:with-param name="style-pos" select="'top'"/>
+ <xsl:with-param name="style-position-0" select="w:tcBorders/w:top"/>
+ <xsl:with-param name="style-position-1" select="$Borders/w:top"/>
+ <xsl:with-param name="style-position-2" select="$rootStyleNode/w:tblPr/w:tblBorders/w:top"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="count(ancestor::w:tr/following-sibling::w:tr) &gt; 0">
+ <xsl:call-template name="get-table-border">
+ <xsl:with-param name="style-pos" select="'bottom'"/>
+ <xsl:with-param name="style-position-0" select="w:tcBorders/w:bottom"/>
+ <xsl:with-param name="style-position-1" select="$Borders/w:insideH"/>
+ <xsl:with-param name="style-position-2" select="$rootStyleNode/w:tblPr/w:tblBorders/w:insideH"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="get-table-border">
+ <xsl:with-param name="style-pos" select="'bottom'"/>
+ <xsl:with-param name="style-position-0" select="w:tcBorders/w:bottom"/>
+ <xsl:with-param name="style-position-1" select="$Borders/w:bottom"/>
+ <xsl:with-param name="style-position-2" select="$rootStyleNode/w:tblPr/w:tblBorders/w:bottom"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="count(ancestor::w:tc/preceding-sibling::w:tc) &gt; 0">
+ <xsl:call-template name="get-table-border">
+ <xsl:with-param name="style-pos" select="'left'"/>
+ <xsl:with-param name="style-position-0" select="w:tcBorders/w:left"/>
+ <xsl:with-param name="style-position-1" select="$Borders/w:insideV"/>
+ <xsl:with-param name="style-position-2" select="$rootStyleNode/w:tblPr/w:tblBorders/w:insideV"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="get-table-border">
+ <xsl:with-param name="style-pos" select="'left'"/>
+ <xsl:with-param name="style-position-0" select="w:tcBorders/w:left"/>
+ <xsl:with-param name="style-position-1" select="$Borders/w:left"/>
+ <xsl:with-param name="style-position-2" select="$rootStyleNode/w:tblPr/w:tblBorders/w:left"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="count(ancestor::w:tc/following-sibling::w:tc) &gt; 0">
+ <xsl:call-template name="get-table-border">
+ <xsl:with-param name="style-pos" select="'right'"/>
+ <xsl:with-param name="style-position-0" select="w:tcBorders/w:right"/>
+ <xsl:with-param name="style-position-1" select="$Borders/w:insideV"/>
+ <xsl:with-param name="style-position-2" select="$rootStyleNode/w:tblPr/w:tblBorders/w:insideV"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="get-table-border">
+ <xsl:with-param name="style-pos" select="'right'"/>
+ <xsl:with-param name="style-position-0" select="w:tcBorders/w:right"/>
+ <xsl:with-param name="style-position-1" select="$Borders/w:right"/>
+ <xsl:with-param name="style-position-2" select="$rootStyleNode/w:tblPr/w:tblBorders/w:right"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </style:style>
+ </xsl:template>
+ <xsl:template name="get-table-border">
+ <xsl:param name="style-pos"/>
+ <xsl:param name="style-position-0"/>
+ <xsl:param name="style-position-1"/>
+ <xsl:param name="style-position-2"/>
+ <xsl:variable name="size-style">
+ <xsl:choose>
+ <xsl:when test="$style-position-0">
+ <xsl:value-of select="$style-position-0/@w:sz"/>
+ </xsl:when>
+ <xsl:when test="$style-position-1">
+ <xsl:value-of select="$style-position-1/@w:sz"/>
+ </xsl:when>
+ <xsl:when test="$style-position-2">
+ <xsl:value-of select="$style-position-2/@w:sz"/>
+ </xsl:when>
+ <xsl:otherwise>2</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="border-style">
+ <xsl:choose>
+ <xsl:when test="$style-position-0">
+ <xsl:value-of select="$style-position-0/@w:val"/>
+ </xsl:when>
+ <xsl:when test="$style-position-1">
+ <xsl:value-of select="$style-position-1/@w:val"/>
+ </xsl:when>
+ <xsl:when test="$style-position-2">
+ <xsl:value-of select="$style-position-2/@w:val"/>
+ </xsl:when>
+ <xsl:otherwise>single</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="color-border">
+ <xsl:choose>
+ <xsl:when test="$style-position-0 and string-length($style-position-0/@w:color) = 6">
+ <xsl:value-of select="$style-position-0/@w:color"/>
+ </xsl:when>
+ <xsl:when test="$style-position-0 and $style-position-0/@w:color = 'auto' and contains($border-style, 'set')">
+ <xsl:text>c0c0c0</xsl:text>
+ </xsl:when>
+ <xsl:when test="$style-position-1 and string-length($style-position-1/@w:color) = 6">
+ <xsl:value-of select="$style-position-1/@w:color"/>
+ </xsl:when>
+ <xsl:when test="$style-position-1 and $style-position-1/@w:color = 'auto' and contains($border-style, 'set')">
+ <xsl:text>c0c0c0</xsl:text>
+ </xsl:when>
+ <xsl:when test="$style-position-2 and string-length($style-position-2/@w:color) = 6">
+ <xsl:value-of select="$style-position-2/@w:color"/>
+ </xsl:when>
+ <xsl:when test="$style-position-2 and $style-position-2/@w:color = 'auto' and contains($border-style, 'set')">
+ <xsl:text>c0c0c0</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>000000</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <!-- mapping border line widths. glu -->
+ <xsl:choose>
+ <xsl:when test="$border-style = 'nil' or $border-style = 'none'">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">hidden</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$border-style = 'single'">
+ <xsl:choose>
+ <xsl:when test="$size-style &lt; 7">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.002cm solid #', $color-border)"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 20">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.035cm solid #', $color-border)"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 30">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.088cm solid #', $color-border)"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 40">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.141cm solid #', $color-border)"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.176cm solid #', $color-border)"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$border-style = 'double'">
+ <xsl:choose>
+ <xsl:when test="$size-style &lt; 10">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.039cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.035cm 0.002cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 15">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.092cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.002cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 20">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.106cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.035cm 0.035cm 0.035cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.265cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.088cm 0.088cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$border-style = 'triple'">
+ <xsl:choose>
+ <xsl:when test="$size-style &lt; 5">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.039cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.035cm 0.002cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 10">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.092cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">.002cm 0.088cm 0.002cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 15">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.106cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.035cm 0.035cm 0.035cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.265cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.088cm 0.088cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$border-style = 'thin-thick-small-gap' or $border-style = 'thick-thin-small-gap'">
+ <xsl:choose>
+ <xsl:when test="($border-style = 'thin-thick-small-gap' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'thick-thin-small-gap' and ($style-pos = 'right' or $style-pos = 'bottom'))">
+ <xsl:choose>
+ <xsl:when test="$size-style &lt; 20">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.125cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.035cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 30">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.178cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.088cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.231cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.141cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.159cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.035cm 0.035cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$border-style = 'thin-thick-thin-small-gap'">
+ <xsl:choose>
+ <xsl:when test="$size-style &lt; 20">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.178cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.088cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 40">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.231cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.141cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.318cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.088cm 0.141cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$border-style = 'thin-thick-medium-gap' or $border-style = 'thick-thin-medium-gap'">
+ <xsl:choose>
+ <xsl:when test="$size-style &lt; 10">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.039cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.035cm 0.002cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 15">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.106cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.035cm 0.035cm 0.035cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 30">
+ <xsl:choose>
+ <xsl:when test="($border-style = 'thin-thick-medium-gap' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'thick-thin-medium-gap' and ($style-pos = 'right' or $style-pos = 'bottom'))">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.212cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.035cm 0.088cm 0.088cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.159cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.035cm 0.035cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.318cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="($border-style = 'thin-thick-medium-gap' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'thick-thin-medium-gap' and ($style-pos = 'right' or $style-pos = 'bottom'))">
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.088cm 0.141cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.141cm 0.088cm 0.088cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$border-style = 'thin-thick-thin-medium-gap'">
+ <xsl:choose>
+ <xsl:when test="$size-style &lt; 10">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.039cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.035cm 0.002cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 15">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.106cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.035cm 0.035cm 0.035cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 30">
+ <xsl:choose>
+ <xsl:when test="$style-pos = 'left' or $style-pos = 'top'">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.159cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.035cm 0.035cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.212cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.035cm 0.088cm 0.088cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.318cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="$style-pos = 'left' or $style-pos = 'top'">
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.141cm 0.088cm 0.088cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.088cm 0.141cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$border-style = 'thin-thick-large-gap' or $border-style = 'thick-thin-large-gap'">
+ <xsl:choose>
+ <xsl:when test="$size-style &lt; 7">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.092cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.002cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 10">
+ <xsl:choose>
+ <xsl:when test="($border-style = 'thin-thick-large-gap' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'thick-thin-large-gap' and ($style-pos = 'right' or $style-pos = 'bottom'))">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.125cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.035cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.092cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.002cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 15">
+ <xsl:choose>
+ <xsl:when test="($border-style = 'thin-thick-large-gap' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'thick-thin-large-gap' and ($style-pos = 'right' or $style-pos = 'bottom'))">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.125cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.035cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.159cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.035cm 0.035cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 30">
+ <xsl:choose>
+ <xsl:when test="($border-style = 'thin-thick-large-gap' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'thick-thin-large-gap' and ($style-pos = 'right' or $style-pos = 'bottom'))">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.178cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.088cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.159cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.035cm 0.035cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 40">
+ <xsl:choose>
+ <xsl:when test="($border-style = 'thin-thick-large-gap' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'thick-thin-large-gap' and ($style-pos = 'right' or $style-pos = 'bottom'))">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.231cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.141cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.159cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.035cm 0.035cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.318cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="($border-style = 'thin-thick-large-gap' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'thick-thin-large-gap' and ($style-pos = 'right' or $style-pos = 'bottom'))">
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.088cm 0.141cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.141cm 0.088cm 0.088cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$border-style = 'thin-thick-thin-large-gap'">
+ <xsl:choose>
+ <xsl:when test="$size-style &lt; 5">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.125cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.035cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 10">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.178cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.088cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 20">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.231cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.141cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.318cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.088cm 0.141cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="contains( $border-style, 'wave') or $border-style = 'dash-dot-stroked'">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.106cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.035cm 0.035cm 0.035cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="contains( $border-style, 'three-d')">
+ <xsl:choose>
+ <xsl:when test="$size-style &lt; 10">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.035cm solid #', $color-border)"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 20">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.088cm solid #', $color-border)"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 30">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.176cm solid #', $color-border)"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 40">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.265cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.088cm 0.088cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.318cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.088cm 0.141cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="contains( $border-style, 'set')">
+ <xsl:choose>
+ <xsl:when test="$size-style &lt; 7">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.092cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.002cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 10">
+ <xsl:choose>
+ <xsl:when test="($border-style = 'outset' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'inset' and ($style-pos = 'right' or $style-pos = 'bottom'))">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.092cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.002cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.125cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.035cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 15">
+ <xsl:choose>
+ <xsl:when test="($border-style = 'outset' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'inset' and ($style-pos = 'right' or $style-pos = 'bottom'))">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.159cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.035cm 0.035cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.125cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.035cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 30">
+ <xsl:choose>
+ <xsl:when test="($border-style = 'outset' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'inset' and ($style-pos = 'right' or $style-pos = 'bottom'))">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.159cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.035cm 0.035cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.178cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.088cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 40">
+ <xsl:choose>
+ <xsl:when test="($border-style = 'outset' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'inset' and ($style-pos = 'right' or $style-pos = 'bottom'))">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.159cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.035cm 0.035cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.231cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.141cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.318cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="($border-style = 'outset' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'inset' and ($style-pos = 'right' or $style-pos = 'bottom'))">
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.141cm 0.088cm 0.088cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.231cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.088cm 0.141cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">0.002cm solid #000000</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="w:tbl">
+ <xsl:choose>
+ <xsl:when test="w:tblPr/w:tblpPr">
+ <!-- if the table is surrounded by text then put the table into a draw:text-box -->
+ <xsl:element name="text:p">
+ <xsl:element name="draw:frame">
+ <xsl:attribute name="draw:style-name">
+ <xsl:text>TableFrame</xsl:text>
+ <xsl:number count="w:tblpPr" from="/w:wordDocument/w:body" level="any" format="1"/>
+ </xsl:attribute>
+ <xsl:attribute name="draw:name">TableFr<xsl:number count="w:tblpPr" from="/w:wordDocument/w:body" level="any" format="1"/>
+ </xsl:attribute>
+ <xsl:variable name="tbl_anchor_type">
+ <xsl:choose>
+ <xsl:when test="name(..) = 'w:tc' ">
+ <xsl:text>as-char</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>paragraph</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="text:anchor-type">
+ <xsl:value-of select="$tbl_anchor_type"/>
+ </xsl:attribute>
+ <xsl:variable name="tbl_draw_textbox_width">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="'in'"/>
+ <!-- adjust the width of draw:text-box containing a table with 20dxa + table-width -->
+ <xsl:with-param name="value" select="concat(string(number(sum(w:tblGrid/w:gridCol/@w:w) +20)), 'twip' )"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="svg:width">
+ <xsl:value-of select="concat ($tbl_draw_textbox_width, 'in') "/>
+ </xsl:attribute>
+ <xsl:if test="w:tblPr/w:tblpPr/@w:tblpX">
+ <xsl:variable name="x_distance_from_anchor">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="'in'"/>
+ <xsl:with-param name="value" select="concat(w:tblPr/w:tblpPr/@w:tblpX, 'twip' ) "/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="svg:x">
+ <xsl:value-of select="concat ($x_distance_from_anchor, 'in' )"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:tblPr/w:tblpPr/@w:tblpY">
+ <xsl:variable name="y_distance_from_anchor">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="'in'"/>
+ <xsl:with-param name="value" select="concat(w:tblPr/w:tblpPr/@w:tblpY, 'twip' ) "/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="svg:y">
+ <xsl:value-of select="concat ($y_distance_from_anchor, 'in' )"/>
+ </xsl:attribute>
+ </xsl:if>
+ <!--create table in draw:text-box to produce table wrapping text effect-->
+ <xsl:element name="draw:text-box">
+ <xsl:element name="table:table">
+ <xsl:if test="w:tblPr">
+ <xsl:attribute name="table:style-name">Table<xsl:number count="w:tbl" from="/w:wordDocument/w:body" level="any" format="1"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates mode="dispatch"/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:element>
+ <!--draw:text-box end -->
+ </xsl:element>
+ <!-- text:p end -->
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- if the table is not surrounded by text then put the table into a draw:text-box -->
+ <xsl:element name="table:table">
+ <xsl:if test="w:tblPr">
+ <xsl:attribute name="table:style-name">Table<xsl:number count="w:tbl" from="/w:wordDocument/w:body" level="any" format="1"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates mode="dispatch"/>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="w:tblGrid">
+ <xsl:apply-templates select="w:gridCol"/>
+ </xsl:template>
+ <xsl:template match="w:gridCol">
+ <xsl:element name="table:table-column">
+ <xsl:attribute name="table:style-name">Table<xsl:number count="w:tbl" from="/w:wordDocument/w:body" level="any" format="1"/>.C<xsl:number count="w:gridCol" from="/w:wordDocument/w:body" level="single" format="1"/>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="w:tr">
+ <xsl:element name="table:table-row">
+ <!-- generate row in table and add attribute of table:style-name if the style:style exists. cp tom chen. -->
+ <xsl:if test="w:trPr/w:trHeight">
+ <xsl:attribute name="table:style-name">Table<xsl:number count="w:tbl" from="/w:wordDocument/w:body" level="any" format="1"/>.R<xsl:number count="w:tr" from="/w:wordDocument/w:body" level="single" format="1"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates mode="dispatch"/>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="w:tc">
+ <xsl:element name="table:table-cell">
+ <xsl:attribute name="table:style-name">Table<xsl:number count="w:tbl" from="/w:wordDocument/w:body" level="any" format="1"/>.R<xsl:number count="w:tr" from="/w:wordDocument/w:body" level="single" format="1"/>C<xsl:number count="w:tc" from="/w:wordDocument/w:body" level="single" format="1"/>
+ </xsl:attribute>
+ <xsl:if test="w:tcPr/w:gridSpan and w:tcPr/w:gridSpan/@w:val &gt; 0">
+ <xsl:attribute name="table:number-columns-spanned">
+ <xsl:value-of select="w:tcPr/w:gridSpan/@w:val"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates mode="dispatch"/>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="convert2in_special">
+ <!-- this template is specially to deal with w:type ='dxa' situation -->
+ <xsl:param name="orignal_value"/>
+ <xsl:choose>
+ <xsl:when test="contains($orignal_value, 'dxa') ">
+ <xsl:variable name="table_measurement_new_value">
+ <xsl:value-of select="concat( substring-before($orignal_value,'dxa'), 'twip')"/>
+ </xsl:variable>
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="'in'"/>
+ <xsl:with-param name="value" select="$table_measurement_new_value"/>
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/filter/source/xslt/import/wordml/wordml2ooo_text.xsl b/filter/source/xslt/import/wordml/wordml2ooo_text.xsl
new file mode 100644
index 000000000000..a00656a9ed32
--- /dev/null
+++ b/filter/source/xslt/import/wordml/wordml2ooo_text.xsl
@@ -0,0 +1,1058 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="w wx aml o dt v">
+ <xsl:template name="create-default-paragraph-styles">
+ <xsl:variable name="default-paragraph-style" select="w:style[@w:default = 'on' and @w:type = 'paragraph']"/>
+ <xsl:if test="$default-paragraph-style">
+ <style:default-style style:family="paragraph">
+ <style:paragraph-properties>
+ <xsl:attribute name="style:tab-stop-distance">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat(/w:wordDocument/w:docPr/w:defaultTabStop/@w:val,'twip')"/>
+ </xsl:call-template>cm</xsl:attribute>
+ </style:paragraph-properties>
+ <style:text-properties style:use-window-font-color="true">
+ <xsl:choose>
+ <xsl:when test="/w:wordDocument/w:fonts/w:defaultFonts">
+ <xsl:attribute name="style:font-name">
+ <xsl:value-of select="/w:wordDocument/w:fonts/w:defaultFonts/@w:ascii"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:font-name-asian">
+ <xsl:value-of select="/w:wordDocument/w:fonts/w:defaultFonts/@w:fareast"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:font-name-complex">
+ <xsl:value-of select="/w:wordDocument/w:fonts/w:defaultFonts/@w:cs"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:font-name">Times New Roman</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="$default-paragraph-style/w:rPr/w:sz">
+ <xsl:attribute name="fo:font-size">
+ <xsl:value-of select="translate($default-paragraph-style/w:rPr/w:sz/@w:val,'Na','0') div 2"/>pt</xsl:attribute>
+ <xsl:attribute name="style:font-size-asian">
+ <xsl:value-of select="translate($default-paragraph-style/w:rPr/w:sz/@w:val,'Na','0') div 2"/>pt</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$default-paragraph-style/w:rPr/w:sz-cs">
+ <xsl:attribute name="style:font-size-complex">
+ <xsl:value-of select="$default-paragraph-style/w:rPr/w:sz-cs/@w:val div 2"/>pt</xsl:attribute>
+ </xsl:if>
+ <!-- if not defined default font size in Word, make it out as 10pt. glu -->
+ <xsl:if test="not($default-paragraph-style/w:rPr/w:sz or w:rPr/w:sz-cs)">
+ <xsl:attribute name="fo:font-size">10pt</xsl:attribute>
+ <xsl:attribute name="style:font-size-asian">10pt</xsl:attribute>
+ <xsl:attribute name="style:font-size-complex">10pt</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$default-paragraph-style/w:rPr/w:lang">
+ <xsl:if test="$default-paragraph-style/w:rPr/w:lang/@w:val">
+ <xsl:attribute name="fo:language">
+ <xsl:choose>
+ <xsl:when test="contains($default-paragraph-style/w:rPr/w:lang/@w:val, '-')">
+ <xsl:value-of select="substring-before( $default-paragraph-style/w:rPr/w:lang/@w:val, '-')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$default-paragraph-style/w:rPr/w:lang/@w:val"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!--xsl:value-of select="substring-before( $default-paragraph-style/w:rPr/w:lang/@w:val, '-')"/ -->
+ </xsl:attribute>
+ <xsl:attribute name="fo:country">
+ <xsl:choose>
+ <xsl:when test="contains($default-paragraph-style/w:rPr/w:lang/@w:val, '-')">
+ <xsl:value-of select="substring-before( $default-paragraph-style/w:rPr/w:lang/@w:val, '-')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$default-paragraph-style/w:rPr/w:lang/@w:val"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!--xsl:value-of select="substring-after( $default-paragraph-style/w:rPr/w:lang/@w:val, '-')"/-->
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$default-paragraph-style/w:rPr/w:lang/@w:fareast">
+ <xsl:attribute name="style:language-asian">
+ <xsl:choose>
+ <xsl:when test="contains($default-paragraph-style/w:rPr/w:lang/@w:fareast, '-')">
+ <xsl:value-of select="substring-before( $default-paragraph-style/w:rPr/w:lang/@w:fareast, '-')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$default-paragraph-style/w:rPr/w:lang/@w:fareast"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!--xsl:value-of select="substring-before( $default-paragraph-style/w:rPr/w:lang/@w:fareast, '-')"/-->
+ </xsl:attribute>
+ <xsl:attribute name="style:country-asian">
+ <xsl:choose>
+ <xsl:when test="contains($default-paragraph-style/w:rPr/w:lang/@w:fareast, '-')">
+ <xsl:value-of select="substring-before( $default-paragraph-style/w:rPr/w:lang/@w:fareast, '-')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$default-paragraph-style/w:rPr/w:lang/@w:fareast"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!--xsl:value-of select="substring-after( $default-paragraph-style/w:rPr/w:lang/@w:fareast, '-')"/ -->
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$default-paragraph-style/w:rPr/w:lang/@w:bidi">
+ <xsl:attribute name="style:language-complex">
+ <xsl:choose>
+ <xsl:when test="contains( $default-paragraph-style/w:rPr/w:lang/@w:bidi, '-') ">
+ <xsl:value-of select="substring-after( $default-paragraph-style/w:rPr/w:lang/@w:bidi, '-')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$default-paragraph-style/w:rPr/w:lang/@w:bidi "/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!--xsl:value-of select="substring-before( $default-paragraph-style/w:rPr/w:lang/@w:bidi, '-')"/-->
+ </xsl:attribute>
+ <xsl:attribute name="style:country-complex">
+ <xsl:choose>
+ <xsl:when test="contains($default-paragraph-style/w:rPr/w:lang/@w:bidi, '-')">
+ <xsl:value-of select="substring-after( $default-paragraph-style/w:rPr/w:lang/@w:bidi, '-')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$default-paragraph-style/w:rPr/w:lang/@w:bidi"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!-- xsl:value-of select="substring-after( $default-paragraph-style/w:rPr/w:lang/@w:bidi, '-')"/ -->
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ </style:text-properties>
+ </style:default-style>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="create-default-text-styles">
+ <style:style style:name="Footnote_20_Symbol" style:display-name="Footnote Symbol" style:family="text"/>
+ <style:style style:name="Numbering_20_Symbols" style:display-name="Numbering Symbols" style:family="text"/>
+ <style:style style:name="Bullet_20_Symbols" style:display-name="Bullet Symbols" style:family="text">
+ <style:text-properties style:font-name="StarSymbol" fo:font-size="9pt" style:font-name-asian="StarSymbol" style:font-size-asian="9pt" style:font-name-complex="StarSymbol" style:font-size-complex="9pt"/>
+ </style:style>
+ <style:style style:name="Endnote_20_Symbol" style:display-name="Endnote Symbol" style:family="text"/>
+ <style:style style:name="Footnote_20_anchor" style:display-name="Footnote anchor" style:family="text">
+ <style:text-properties style:text-position="super 58%"/>
+ </style:style>
+ </xsl:template>
+ <xsl:template match="w:p" mode="style">
+ <xsl:variable name="paragraph-number">
+ <xsl:number from="/w:wordDocument/w:body" level="any" count="w:p" format="1"/>
+ </xsl:variable>
+ <xsl:variable name="section-property-number" select="count(preceding::w:sectPr)"/>
+ <xsl:variable name="last-section-property" select="preceding::w:pPr/w:sectPr[1]"/>
+ <xsl:variable name="next-section-property" select="following::w:sectPr[1]"/>
+ <style:style style:family="paragraph" style:name="P{$paragraph-number}">
+ <xsl:choose>
+ <xsl:when test="w:pPr/w:pStyle">
+ <xsl:attribute name="style:parent-style-name">
+ <xsl:value-of select="concat('w',translate(w:pPr/w:pStyle/@w:val,' ~`!@#$%^*(&#x26;)+/,;?&lt;&gt;{}[]:','_'))" />
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:parent-style-name">wNormal</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="not($next-section-property/w:type/@w:val = 'continuous') and generate-id($last-section-property[last()]/following::w:p[1]) = generate-id(.) and not(ancestor::w:sectPr or ancestor::w:tbl)">
+ <xsl:attribute name="style:master-page-name">Standard-1<xsl:value-of select="$section-property-number + 1"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$paragraph-number = 1">
+ <xsl:attribute name="style:master-page-name">First_20_Page</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <style:paragraph-properties>
+ <xsl:apply-templates select="w:pPr"/>
+ </style:paragraph-properties>
+ <style:text-properties>
+ <xsl:apply-templates select="w:pPr/w:rPr"/>
+ <xsl:apply-templates select="w:rPr"/>
+ </style:text-properties>
+ </style:style>
+ <xsl:if test="w:r/w:br/@w:type='page'">
+ <style:style style:family="paragraph" style:name="P{$paragraph-number}page-break">
+ <xsl:if test="w:pPr/w:pStyle">
+ <xsl:attribute name="style:parent-style-name">
+ <xsl:value-of select="concat('w',translate(w:pPr/w:pStyle/@w:val,' ~`!@#$%^*(&#x26;)+/,;?&lt;&gt;{}[]:','_'))"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="generate-id($last-section-property[last()]/following::w:p[1]) = generate-id(.) and not(ancestor::w:sectPr or ancestor::w:tbl)">
+ <xsl:attribute name="style:master-page-name">Standard-1<xsl:value-of select="$section-property-number + 1"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$paragraph-number = 1">
+ <xsl:attribute name="style:master-page-name">First_20_Page</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <style:paragraph-properties fo:break-before="page">
+ <xsl:apply-templates select="w:pPr"/>
+ </style:paragraph-properties>
+ </style:style>
+ </xsl:if>
+ <xsl:if test="w:r/w:br/@w:type='column'">
+ <style:style style:family="paragraph" style:name="P{$paragraph-number}column-break">
+ <xsl:if test="w:pPr/w:pStyle">
+ <xsl:attribute name="style:parent-style-name">
+ <xsl:value-of select="concat('w',translate(w:pPr/w:pStyle/@w:val,' ~`!@#$%^*(&#x26;)+/,;?&lt;&gt;{}[]:','_'))"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="generate-id($last-section-property[last()]/following::w:p[1]) = generate-id(.) and not(ancestor::w:sectPr or ancestor::w:tbl)">
+ <xsl:attribute name="style:master-page-name">Standard-1<xsl:value-of select="$section-property-number + 1"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$paragraph-number = 1">
+ <xsl:attribute name="style:master-page-name">First_20_Page</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <style:paragraph-properties fo:break-before="column">
+ <xsl:apply-templates select="w:pPr"/>
+ </style:paragraph-properties>
+ </style:style>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="w:pPr">
+ <xsl:if test="w:ind/@w:left">
+ <xsl:attribute name="fo:margin-left">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat(w:ind/@w:left, 'twip')"/>
+ </xsl:call-template>cm</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:ind/@w:right">
+ <xsl:attribute name="fo:margin-right">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat(w:ind/@w:right, 'twip')"/>
+ </xsl:call-template>cm</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:ind/@w:first-line">
+ <xsl:attribute name="fo:text-indent">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat(w:ind/@w:first-line, 'twip')"/>
+ </xsl:call-template>cm</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:ind/@w:hanging">
+ <xsl:attribute name="fo:text-indent">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat('-',w:ind/@w:hanging, 'twip')"/>
+ </xsl:call-template>cm</xsl:attribute>
+ </xsl:if>
+ <!-- bi-directional support-->
+ <xsl:if test="w:bidi">
+ <xsl:choose>
+ <xsl:when test="w:bidi/@w:val = 'off'">
+ <xsl:attribute name="fo:text-align">start</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:writing-mode">rl-tb</xsl:attribute>
+ <xsl:attribute name="fo:text-align">end</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="w:jc">
+ <xsl:choose>
+ <xsl:when test="w:jc/@w:val = 'center'">
+ <xsl:attribute name="fo:text-align">center</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:jc/@w:val = 'left'">
+ <xsl:choose>
+ <xsl:when test="w:bidi and not(w:bidi/@w:val = 'off')">
+ <xsl:attribute name="fo:text-align">end</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:text-align">start</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="w:jc/@w:val = 'right'">
+ <xsl:choose>
+ <xsl:when test="w:bidi and not(w:bidi/@w:val = 'off')">
+ <xsl:attribute name="fo:text-align">start</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:text-align">end</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:text-align">justify</xsl:attribute>
+ <xsl:attribute name="style:justify-single-word">false</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="w:spacing">
+ <xsl:choose>
+ <xsl:when test="w:spacing/@w:line-rule = 'at-least'">
+ <xsl:attribute name="style:line-height-at-least">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat(w:spacing/@w:line, 'twip')"/>
+ </xsl:call-template>cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:spacing/@w:line-rule = 'auto'">
+ <xsl:attribute name="fo:line-height">
+ <xsl:value-of select="round(w:spacing/@w:line div 240 * 100)"/>%</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:spacing/@w:line-rule = 'exact'">
+ <xsl:attribute name="fo:line-height">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat(w:spacing/@w:line, 'twip')"/>
+ </xsl:call-template>cm</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="w:spacing/@w:before">
+ <xsl:attribute name="fo:margin-top">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat(w:spacing/@w:before, 'twip')"/>
+ </xsl:call-template>cm</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:spacing/@w:after">
+ <xsl:attribute name="fo:margin-bottom">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat(w:spacing/@w:after, 'twip')"/>
+ </xsl:call-template>cm</xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="w:shd">
+ <xsl:variable name="background-color">
+ <xsl:choose>
+ <xsl:when test="string-length(w:shd/@w:fill) = 6">
+ <xsl:value-of select="concat('#', w:shd/@w:fill)"/>
+ </xsl:when>
+ <xsl:otherwise>#000000</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="w:shd/@w:val = 'solid'">
+ <xsl:attribute name="fo:background-color">
+ <xsl:value-of select="$background-color"/>
+ </xsl:attribute>
+ </xsl:when>
+ <!-- patterns are necessary in the future. glu -->
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="w:pageBreakBefore and not(w:pageBreakBefore/@w:val = 'off')">
+ <xsl:attribute name="fo:break-before">page</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:pageBreakBefore and w:pageBreakBefore/@w:val = 'off'">
+ <xsl:attribute name="fo:break-before">auto</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:keepNext">
+ <xsl:attribute name="fo:keep-with-next">always</xsl:attribute>
+ </xsl:if>
+ <!--
+ <xsl:if test="w:keepLines">
+ <xsl:attribute name="style:break-inside">avoid</xsl:attribute>
+ </xsl:if>
+ -->
+ <xsl:if test="w:widowControl='on'">
+ <xsl:attribute name="fo:widows">2</xsl:attribute>
+ <xsl:attribute name="fo:orphans">2</xsl:attribute>
+ </xsl:if>
+ <!--
+ <xsl:if test="w:suppressAutoHyphens">
+ <xsl:attribute name="fo:hyphenate">false</xsl:attribute>
+ </xsl:if>
+ -->
+ <xsl:if test="w:kinsoku/@w:val='off'">
+ <xsl:attribute name="style:line-break">normal</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:overflowPunct/@w:val='off'">
+ <xsl:attribute name="style:punctuation-wrap">simple</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:autoSpaceDE/@w:val='off' or w:autoSpaceDN/@w:val='off'">
+ <xsl:attribute name="style:text-autospace">none</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:textAlignment">
+ <xsl:choose>
+ <xsl:when test="w:textAlignment/@w:val='center'">
+ <xsl:attribute name="style:vertical-align">middle</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:textAlignment/@w:val='baseline'">
+ <xsl:attribute name="style:vertical-align">bottom</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:vertical-align">
+ <xsl:value-of select="w:textAlignment/@w:val"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="w:pBdr">
+ <xsl:if test="w:pBdr/w:top">
+ <xsl:call-template name="get-table-border">
+ <xsl:with-param name="style-pos" select="'top'"/>
+ <xsl:with-param name="style-position-0" select="w:pBdr/w:top"/>
+ </xsl:call-template>
+ <xsl:attribute name="fo:padding-top">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat(w:pBdr/w:top/@w:space,'pt')"/>
+ </xsl:call-template>cm</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:pBdr/w:left">
+ <xsl:call-template name="get-table-border">
+ <xsl:with-param name="style-pos" select="'left'"/>
+ <xsl:with-param name="style-position-0" select="w:pBdr/w:left"/>
+ </xsl:call-template>
+ <xsl:attribute name="fo:padding-left">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat(w:pBdr/w:left/@w:space,'pt')"/>
+ </xsl:call-template>cm</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:pBdr/w:right">
+ <xsl:call-template name="get-table-border">
+ <xsl:with-param name="style-pos" select="'right'"/>
+ <xsl:with-param name="style-position-0" select="w:pBdr/w:right"/>
+ </xsl:call-template>
+ <xsl:attribute name="fo:padding-right">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat(w:pBdr/w:right/@w:space,'pt')"/>
+ </xsl:call-template>cm</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:pBdr/w:bottom">
+ <xsl:call-template name="get-table-border">
+ <xsl:with-param name="style-pos" select="'bottom'"/>
+ <xsl:with-param name="style-position-0" select="w:pBdr/w:bottom"/>
+ </xsl:call-template>
+ <xsl:attribute name="fo:padding-bottom">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat(w:pBdr/w:bottom/@w:space,'pt')"/>
+ </xsl:call-template>cm</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:pBdr/*/@w:shadow='on'">
+ <xsl:attribute name="style:shadow">#000000 0.15cm 0.15cm</xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="w:snapToGrid/@w:val='off'">
+ <xsl:attribute name="style:snap-to-layout-grid">false</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:tabs">
+ <xsl:element name="style:tab-stops">
+ <xsl:for-each select="w:tabs/w:tab">
+ <xsl:element name="style:tab-stop">
+ <xsl:attribute name="style:position">
+ <xsl:if test="@w:pos &lt; 0">
+ <xsl:message>
+ We meet a negative w:pos:<xsl:value-of select="@w:pos"/>.
+ </xsl:message>
+ <xsl:value-of select="'0cm'"/>
+ </xsl:if>
+ <xsl:if test="not(@w:pos &lt; 0)">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat(@w:pos, 'twip')"/>
+ </xsl:call-template>cm</xsl:if>
+ </xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="@w:val = 'decimal'">
+ <xsl:attribute name="style:type">char</xsl:attribute>
+ <xsl:attribute name="style:char">
+ <xsl:value-of select="' '"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@w:val = 'left' or @w:val = 'right' or @w:val = 'center' ">
+ <xsl:attribute name="style:type">
+ <xsl:value-of select="@w:val"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:type">char</xsl:attribute>
+ <xsl:attribute name="style:char">
+ <xsl:value-of select="' '"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!-- Detect leader chars in tabs (rp) -->
+ <xsl:choose>
+ <xsl:when test="@w:leader = 'hyphen'">
+ <xsl:attribute name="style:leader-style">solid</xsl:attribute>
+ <xsl:attribute name="style:leader-text">-</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@w:leader = 'underscore'">
+ <xsl:attribute name="style:leader-style">solid</xsl:attribute>
+ <xsl:attribute name="style:leader-text">_</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@w:leader = 'dot'">
+ <xsl:attribute name="style:leader-style">dotted</xsl:attribute>
+ <xsl:attribute name="style:leader-text">.</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <!-- end leader chars (rp) -->
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:if>
+ <xsl:apply-templates select="w:rPr" mode="paragraph-properties"/>
+ </xsl:template>
+ <xsl:template match="w:rPr" mode="style">
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name">T<xsl:number from="/w:wordDocument/w:body" level="any" count="w:rPr" format="1"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:family">text</xsl:attribute>
+ <xsl:if test="w:rStyle">
+ <xsl:attribute name="style:parent-style-name">
+ <xsl:value-of select="concat('w',translate(w:rStyle/@w:val,' ~`!@#$%^*(&#x26;)+/,;?&lt;&gt;{}[]:','_'))"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:element name="style:text-properties">
+
+ <xsl:apply-templates select="current()"/>
+<!-- <xsl:call-template name="text-properties"/> -->
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="w:rPr">
+ <xsl:if test="w:rFonts">
+ <xsl:if test="w:rFonts/@w:ascii">
+ <xsl:attribute name="style:font-name">
+ <xsl:value-of select="w:rFonts/@w:ascii"/>
+ </xsl:attribute>
+ <xsl:if test="ancestor::w:body">
+ <xsl:attribute name="style:font-name-asian">
+ <xsl:value-of select="w:rFonts/@w:ascii"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:font-name-complex">
+ <xsl:value-of select="w:rFonts/@w:ascii"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="ancestor::w:styles">
+ <xsl:if test="w:rFonts/@w:fareast">
+ <xsl:attribute name="style:font-name-asian">
+ <xsl:value-of select="w:rFonts/@w:fareast"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:rFonts/@w:cs">
+ <xsl:attribute name="style:font-name-complex">
+ <xsl:value-of select="w:rFonts/@w:cs"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="parent::w:r">
+ <xsl:if test="w:b">
+ <xsl:attribute name="fo:font-weight">bold</xsl:attribute>
+ <xsl:attribute name="style:font-weight-asian">bold</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:b-cs">
+ <xsl:attribute name="style:font-weight-complex">bold</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:i">
+ <xsl:attribute name="fo:font-style">italic</xsl:attribute>
+ <xsl:attribute name="style:font-style-asian">italic</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:i-cs">
+ <xsl:attribute name="style:font-style-complex">italic</xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="w:caps">
+ <xsl:attribute name="fo:text-transform">uppercase</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:smallCaps">
+ <xsl:attribute name="fo:font-variant">small-caps</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:strike">
+ <xsl:attribute name="style:text-line-through-style">solid</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:dstrike">
+ <xsl:attribute name="style:text-line-through-style">solid</xsl:attribute>
+ <xsl:attribute name="style:text-line-through-type">double</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:outline">
+ <xsl:attribute name="style:text-outline">true</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:shadow">
+ <xsl:attribute name="fo:text-shadow">1pt 1pt</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:imprint">
+ <xsl:attribute name="style:font-relief">engraved</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:emboss">
+ <xsl:attribute name="style:font-relief">embossed</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:vanish">
+ <xsl:attribute name="text:display">true</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:color[not(@w:val = 'auto')]">
+ <xsl:attribute name="fo:color">#<xsl:value-of select="w:color/@w:val"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:spacing">
+ <xsl:attribute name="fo:letter-spacing">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat(w:spacing/@w:val,'twip')"/>
+ </xsl:call-template>cm</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:w/@w:val">
+ <xsl:attribute name="style:text-scale">
+ <xsl:value-of select="concat(w:w/@w:val, '%')"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:vertAlign or w:position">
+ <xsl:variable name="height">
+ <xsl:choose>
+ <xsl:when test="w:vertAlign[@w:val = 'superscript' or @w:val = 'subscript']">58%</xsl:when>
+ <xsl:otherwise>100%</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="position">
+ <xsl:choose>
+ <xsl:when test="w:position">
+ <!-- con't get font height easily, so just set w:val as percentage. glu -->
+ <xsl:value-of select="concat( w:position/@w:val, '%')"/>
+ </xsl:when>
+ <xsl:when test="w:vertAlign[@w:val = 'superscript']">super</xsl:when>
+ <xsl:when test="w:vertAlign[@w:val = 'subscript']">sub</xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="style:text-position">
+ <xsl:value-of select="concat($position, ' ', $height)"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:sz">
+ <xsl:attribute name="fo:font-size">
+ <xsl:value-of select="translate(w:sz/@w:val,'Na','0') div 2"/>pt</xsl:attribute>
+ <xsl:attribute name="style:font-size-asian">
+ <xsl:value-of select="translate(w:sz/@w:val,'Na','0') div 2"/>pt</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:sz-cs">
+ <xsl:attribute name="style:font-size-complex">
+ <xsl:value-of select="w:sz-cs/@w:val div 2"/>pt</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:highlight">
+ <xsl:choose>
+ <xsl:when test="w:highlight/@w:val='black'">
+ <xsl:attribute name="fo:background-color">#000000</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:highlight/@w:val='yellow'">
+ <xsl:attribute name="fo:background-color">#ffff00</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:highlight/@w:val='green'">
+ <xsl:attribute name="fo:background-color">#00ff00</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:highlight/@w:val='cyan'">
+ <xsl:attribute name="fo:background-color">#00ffff</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:highlight/@w:val='magenta'">
+ <xsl:attribute name="fo:background-color">#ff00ff</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:highlight/@w:val='blue'">
+ <xsl:attribute name="fo:background-color">#0000ff</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:highlight/@w:val='red'">
+ <xsl:attribute name="fo:background-color">#ff0000</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:highlight/@w:val='dark-blue'">
+ <xsl:attribute name="fo:background-color">#000080</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:highlight/@w:val='dark-cyan'">
+ <xsl:attribute name="fo:background-color">#008080</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:highlight/@w:val='dark-green'">
+ <xsl:attribute name="fo:background-color">#008000</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:highlight/@w:val='dark-magenta'">
+ <xsl:attribute name="fo:background-color">#800080</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:highlight/@w:val='dark-red'">
+ <xsl:attribute name="fo:background-color">#800000</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:highlight/@w:val='dark-yellow'">
+ <xsl:attribute name="fo:background-color">#808000</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:highlight/@w:val='dark-gray'">
+ <xsl:attribute name="fo:background-color">#808080</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:highlight/@w:val='light-gray'">
+ <xsl:attribute name="fo:background-color">#c0c0c0</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="w:u">
+ <xsl:if test="w:u/@w:val = 'thick' or contains(w:u/@w:val,'-heavy')">
+ <xsl:attribute name="style:text-underline-width">bold</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:u/@w:val = 'double' or contains(w:u/@w:val,'-double')">
+ <xsl:attribute name="style:text-underline-type">double</xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="w:u/@w:val = 'words' or w:u/@w:val = 'single' or w:u/@w:val = 'thick' or w:u/@w:val = 'double'">
+ <xsl:attribute name="style:text-underline-style">solid</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="contains(w:u/@w:val , 'dotted')">
+ <xsl:attribute name="style:text-underline-style">dotted</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:u/@w:val = 'dashed-heavy' or w:u/@w:val = 'dash'">
+ <xsl:attribute name="style:text-underline-style">dash</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:u/@w:val = 'dash-long' or w:u/@w:val = 'dash-long-heavy'">
+ <xsl:attribute name="style:text-underline-style">long-dash</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:u/@w:val = 'dash-dot-heavy' or w:u/@w:val = 'dot-dash'">
+ <xsl:attribute name="style:text-underline-style">dot-dash</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:u/@w:val = 'dash-dot-dot-heavy' or w:u/@w:val = 'dot-dot-dash'">
+ <xsl:attribute name="style:text-underline-style">dot-dot-dash</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:u/@w:val = 'wavy-heavy' or w:u/@w:val = 'wavy-double' or w:u/@w:val = 'wavy'">
+ <xsl:attribute name="style:text-underline-style">wave</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="string-length(style:text-underline-style) &gt; 0">
+ <xsl:attribute name="style:text-underline-style">
+ <xsl:value-of select="w:u/@w:val"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="w:u/@w:color and not(w:u/@w:color = 'auto')">
+ <xsl:attribute name="style:text-underline-color">#<xsl:value-of select="w:u/@w:color"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="w:effect[@w:val = 'blink-background']">
+ <xsl:attribute name="style:text-blinking">true</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:shd and not(w:highlight)">
+ <xsl:if test="string-length(w:shd/@w:fill) = 6">
+ <xsl:attribute name="fo:background-color">#<xsl:value-of select="w:shd/@w:fill"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="w:em">
+ <xsl:choose>
+ <xsl:when test="w:em/@w:val = 'comma'">
+ <xsl:attribute name="style:text-emphasize">accent below</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:em/@w:val = 'under-dot'">
+ <xsl:attribute name="style:text-emphasize">disc below</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:em/@w:val = 'dot' or w:em/@w:val = 'circle' ">
+ <xsl:attribute name="style:text-emphasize">
+ <xsl:value-of select=" concat(w:em/@w:val,' below') "/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:text-emphasize">none</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="w:lang">
+ <xsl:if test="w:lang/@w:val">
+ <xsl:attribute name="fo:language">
+ <xsl:choose>
+ <xsl:when test="contains(w:lang/@w:val, '-')">
+ <xsl:value-of select="substring-before( w:lang/@w:val, '-')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="w:lang/@w:val"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!--xsl:value-of select="substring-before( w:lang/@w:val, '-')"/-->
+ </xsl:attribute>
+ <xsl:attribute name="fo:country">
+ <xsl:choose>
+ <xsl:when test="contains(w:lang/@w:val, '-')">
+ <xsl:value-of select="substring-before( w:lang/@w:val, '-')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="w:lang/@w:val"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!--xsl:value-of select="substring-after( w:lang/@w:val, '-')"/-->
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="w:rPr" mode="paragraph-properties">
+ <!-- right-to-left support-->
+ <xsl:if test="w:rtl and not(w:rtl/@w:val = 'off')">
+ <xsl:attribute name="style:writing-mode">rl-tb</xsl:attribute>
+ <xsl:attribute name="fo:text-align">end</xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="w:p">
+ <xsl:choose>
+ <!-- because word treats page breaks as separate tags, we must split some paragraphs up so that we can
+ give the sub para a fo:break-before ="page" or column attribute. -->
+ <xsl:when test="w:r[w:br/@w:type='page' or w:br/@w:type='column']">
+ <xsl:call-template name="process-breaks-in-paragraph"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="process-common-paragraph"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="process-breaks-in-paragraph">
+ <xsl:variable name="textruns-with-break" select="w:r[w:br/@w:type='page' or w:br/@w:type='column']"/>
+ <xsl:call-template name="create-sub-paragraph">
+ <xsl:with-param name="textruns" select="$textruns-with-break[1]/preceding-sibling::w:r"/>
+ </xsl:call-template>
+ <xsl:for-each select="$textruns-with-break">
+ <xsl:variable name="break-position" select="position()"/>
+ <xsl:call-template name="create-sub-paragraph">
+ <!-- added following-sibling::w:fldSimple | following-sibling::w:hlink | following-sibling::aml:annotation to enable these elements to be processed when there are breaks happen G.Yang -->
+ <xsl:with-param name="textruns" select="following-sibling::w:r[not(w:br/@w:type='page' or w:br/@w:type='column') and (count(preceding::w:r[w:br/@w:type='page' or w:br/@w:type='column']) = $break-position)] | following-sibling::w:fldSimple[count(preceding::w:r[w:br/@w:type='page' or w:br/@w:type='column']) = $break-position] | following-sibling::w:hlink[count(preceding::w:r[w:br/@w:type='page' or w:br/@w:type='column']) = $break-position] | following-sibling::aml:annotation[count(preceding::w:r[w:br/@w:type='page' or w:br/@w:type='column']) = $break-position] "/>
+ <xsl:with-param name="textruns-with-break" select="current()"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="create-sub-paragraph">
+ <xsl:param name="textruns"/>
+ <xsl:param name="textruns-with-break"/>
+ <xsl:if test="$textruns or $textruns-with-break">
+ <xsl:variable name="curr-num">
+ <xsl:number from="/w:wordDocument/w:body" level="any" count="w:p" format="1"/>
+ </xsl:variable>
+ <text:p>
+ <xsl:choose>
+ <xsl:when test="$textruns-with-break">
+ <xsl:attribute name="text:style-name">
+ <xsl:value-of select="concat('P',$curr-num,w:br/@w:type, '-break')"/>
+ </xsl:attribute>
+ <xsl:apply-templates select="$textruns-with-break"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="text:style-name">
+ <xsl:value-of select="concat( 'P', $curr-num)"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="$textruns">
+ <xsl:apply-templates select="$textruns"/>
+ </xsl:if>
+ </text:p>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="process-common-paragraph">
+ <xsl:variable name="heading-or-paragraph">
+ <xsl:choose>
+ <xsl:when test="key('heading-style', w:pPr/w:pStyle/@w:val)">text:h</xsl:when>
+ <xsl:otherwise>text:p</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:element name="{$heading-or-paragraph}">
+ <xsl:if test="$heading-or-paragraph = 'text:h'">
+ <xsl:attribute name="text:outline-level">
+ <xsl:value-of select="key('heading-style',w:pPr/w:pStyle/@w:val)/w:pPr/w:outlineLvl/@w:val + 1"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:variable name="curr-num">
+ <xsl:number from="/w:wordDocument/w:body" level="any" count="w:p" format="1"/>
+ </xsl:variable>
+ <xsl:attribute name="text:style-name">
+ <xsl:value-of select="concat( 'P', $curr-num)"/>
+ </xsl:attribute>
+ <xsl:variable name="bookmark-and-paragraph" select="preceding::aml:annotation[(@w:type = 'Word.Bookmark.Start' or @w:type = 'Word.Bookmark.End') and not(ancestor::w:p)] | preceding::w:p"/>
+ <xsl:if test="count($bookmark-and-paragraph) &gt; 0 and name($bookmark-and-paragraph[last()]) = 'aml:annotation'">
+ <xsl:call-template name="create-bookmark">
+ <xsl:with-param name="bookmark-and-paragraph" select="$bookmark-and-paragraph"/>
+ <xsl:with-param name="position" select="count($bookmark-and-paragraph)"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:apply-templates mode="dispatch"/>
+ <xsl:if test="not(following::w:p)">
+ <xsl:apply-templates select="following::aml:annotation[(@w:type = 'Word.Bookmark.Start' or @w:type = 'Word.Bookmark.End') and not(ancestor::w:p)]"/>
+ </xsl:if>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="create-bookmark">
+ <xsl:param name="bookmark-and-paragraph"/>
+ <xsl:param name="position"/>
+ <xsl:choose>
+ <xsl:when test="name($bookmark-and-paragraph[$position]) = 'aml:annotation'">
+ <xsl:if test="$position &gt; 0">
+ <xsl:call-template name="create-bookmark">
+ <xsl:with-param name="bookmark-and-paragraph" select="$bookmark-and-paragraph"/>
+ <xsl:with-param name="position" select="$position - 1"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="output-bookmark">
+ <xsl:with-param name="bookmark-and-paragraph" select="$bookmark-and-paragraph"/>
+ <xsl:with-param name="position" select="$position + 1"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="output-bookmark">
+ <xsl:param name="bookmark-and-paragraph"/>
+ <xsl:param name="position"/>
+ <xsl:apply-templates select="$bookmark-and-paragraph[$position]"/>
+ <xsl:if test="$position &lt; count($bookmark-and-paragraph)">
+ <xsl:call-template name="output-bookmark">
+ <xsl:with-param name="bookmark-and-paragraph" select="$bookmark-and-paragraph"/>
+ <xsl:with-param name="position" select="$position + 1"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <!-- WordML contains multiple w:t within one w:r, so in Star Writer text:span should correspond to w:t glu -->
+ <xsl:template match="w:r">
+ <xsl:choose>
+ <xsl:when test="(preceding-sibling::w:r) or (w:rPr)">
+ <!-- add this condition to prevent from printing the value of DATE, TIME, PRINTDATE, CREATEDATE, SAVEDATE, PAGE, NUMPAGES etc. fields in-between w:fldchar begin and w:fldchar end G.Yang.-->
+ <xsl:if test="not (preceding-sibling::w:r/w:instrText[substring(normalize-space(.),1,4) = 'DATE' or substring(normalize-space(.),1,4) = 'TIME' or substring(normalize-space(.),1,9) = 'PRINTDATE' or substring(normalize-space(.),1,10) = 'CREATEDATE' or substring(normalize-space(.),1,8) = 'SAVEDATE' or substring(normalize-space(.),1,4) = 'PAGE' or substring(normalize-space(.),1,8) = 'NUMPAGES' or substring(normalize-space(.),1,8) = 'NUMWORDS' or substring(normalize-space(.),1,8) = 'NUMCHARS' or substring(normalize-space(.),1,6) = 'REVNUM' or substring(normalize-space(.),1,7) = 'AUTONUM' or substring(normalize-space(.),1,10) = 'AUTONUMLGL' or substring(normalize-space(.),1,10) = 'AUTONUMOUT' or substring(normalize-space(.),1,3) = 'SEQ' or substring(normalize-space(.),1,6) = 'AUTHOR' or substring(normalize-space(.),1,5) = 'TITLE' or substring(normalize-space(.),1,7) = 'SUBJECT' or substring(normalize-space(.),1,8) = 'KEYWORDS' or substring(normalize-space(.),1,6) = 'FILLIN' or substring(normalize-space(.),1,11) = 'DOCPROPERTY' or substring(normalize-space(.),1,10) = 'MERGEFIELD' or substring(normalize-space(.),1,8) = 'MERGEREC' or substring(normalize-space(.),1,4) = 'NEXT' or substring( normalize-space(.),1,9) = 'HYPERLINK' or substring( normalize-space(.),1,3) = 'REF' ][1] and (following-sibling::w:r/w:fldChar[@w:fldCharType='end'] or ( not(preceding-sibling::w:r/w:fldChar[@w:fldCharType='end'] ) and parent::w:p/following-sibling::w:p/w:r/w:fldChar[@w:fldCharType='end'])) )">
+ <text:span>
+ <xsl:choose>
+ <xsl:when test="w:rPr/w:rStyle">
+ <xsl:attribute name="text:style-name">
+ <xsl:value-of select="concat('w', translate(w:rPr/w:rStyle/@w:val,' ~`!@#$%^*(&#x26;)+/,;?&lt;&gt;{}[]:','_'))"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:rPr">
+ <xsl:variable name="position">
+ <xsl:number from="/w:wordDocument/w:body" level="any" count="w:rPr" format="1"/>
+ </xsl:variable>
+ <xsl:attribute name="text:style-name">T<xsl:value-of select="$position + 1"/>
+ </xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:apply-templates mode="dispatch"/>
+ </text:span>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- add this condition to prevent from printing the value of DATE, TIME, PRINTDATE, CREATEDATE, SAVEDATE, PAGE, NUMPAGES, etc. fields in-between w:fldchar begin and w:fldchar end G.Yang.-->
+ <xsl:if test="not( preceding-sibling::w:r/w:instrText[substring(normalize-space(.),1,4) = 'DATE' or substring(normalize-space(.),1,4) = 'TIME' or substring(normalize-space(.),1,9) = 'PRINTDATE' or substring(normalize-space(.),1,10) = 'CREATEDATE' or substring(normalize-space(.),1,8) = 'SAVEDATE' or substring(normalize-space(.),1,4) = 'PAGE' or substring(normalize-space(.),1,8) = 'NUMPAGES' or substring(normalize-space(.),1,8) = 'NUMWORDS' or substring(normalize-space(.),1,8) = 'NUMCHARS' or substring(normalize-space(.),1,6) = 'REVNUM' or substring(normalize-space(.),1,7) = 'AUTONUM' or substring(normalize-space(.),1,10) = 'AUTONUMLGL' or substring(normalize-space(.),1,10) = 'AUTONUMOUT' or substring(normalize-space(.),1,3) = 'SEQ' or substring(normalize-space(.),1,6) = 'AUTHOR' or substring(normalize-space(.),1,5) = 'TITLE' or substring(normalize-space(.),1,7) = 'SUBJECT' or substring(normalize-space(.),1,8) = 'KEYWORDS' or substring(normalize-space(.),1,6) = 'FILLIN' or substring(normalize-space(.),1,11) = 'DOCPROPERTY' or substring(normalize-space(.),1,10) = 'MERGEFIELD' or substring(normalize-space(.),1,8) = 'MERGEREC' or substring(normalize-space(.),1,4) = 'NEXT' or substring( normalize-space(.),1,9) = 'HYPERLINK' or substring( normalize-space(.),1,3) = 'REF' ][1] and (following-sibling::w:r/w:fldChar[@w:fldCharType='end'] or ( not(preceding-sibling::w:r/w:fldChar[@w:fldCharType='end'] ) and parent::w:p/following-sibling::w:p/w:r/w:fldChar[@w:fldCharType='end'])) )">
+ <xsl:apply-templates mode="dispatch"/>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="aml:annotation">
+ <xsl:choose>
+ <xsl:when test="@w:type = 'Word.Bookmark.Start'">
+ <text:bookmark-start text:name="{@w:name}"/>
+ </xsl:when>
+ <xsl:when test="@w:type = 'Word.Bookmark.End'">
+ <xsl:variable name="id" select="@aml:id"/>
+ <text:bookmark-end text:name="{preceding::aml:annotation[@aml:id = $id]/@w:name}"/>
+ </xsl:when>
+ <xsl:when test="@w:type = 'Word.Comment'">
+ <office:annotation office:display="true">
+ <dc:creator>
+ <xsl:value-of select="@aml:author"/>
+ </dc:creator>
+ <dc:date>
+ <xsl:value-of select="substring(@aml:createdate,1,10)"/>
+ </dc:date>
+ <xsl:apply-templates select="aml:content/w:p"/>
+ </office:annotation>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="w:hlink">
+ <xsl:element name="text:a">
+ <xsl:attribute name="xlink:type">simple</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="@w:dest and @w:bookmark">
+ <xsl:attribute name="xlink:href">
+ <xsl:value-of select="concat( @w:dest, concat('#', @w:bookmark) )"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@w:dest">
+ <xsl:attribute name="xlink:href">
+ <xsl:value-of select="@w:dest"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@w:bookmark">
+ <xsl:attribute name="xlink:href">
+ <xsl:value-of select="concat('#', @w:bookmark)"/>
+ </xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="@w:target">
+ <xsl:attribute name="office:target-frame-name">
+ <xsl:value-of select="@w:target"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates mode="dispatch"/>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="w:t">
+ <xsl:choose>
+ <xsl:when test="string(.) = ' ' ">
+ <xsl:element name="text:s"/>
+ </xsl:when>
+ <xsl:when test="contains(.,' ')">
+ <xsl:call-template name="replace-spaces">
+ <xsl:with-param name="curr-string" select="."/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="replace-spaces">
+ <xsl:param name="curr-string"/>
+ <xsl:if test="contains($curr-string,' ')">
+ <xsl:value-of select="substring-before($curr-string,' ')"/>
+ <text:s text:c="2"/>
+ <xsl:variable name="next-string" select="substring-after($curr-string,' ')"/>
+ <xsl:choose>
+ <xsl:when test="contains($next-string, ' ')">
+ <xsl:call-template name="replace-spaces">
+ <xsl:with-param name="curr-string" select="$next-string"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$next-string"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="w:tab">
+ <xsl:element name="text:tab"/>
+ </xsl:template>
+ <xsl:template match="w:br">
+ <xsl:if test="@w:type='text-wrapping' or not(@w:type)">
+ <text:line-break/>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="w:footnote">
+ <xsl:variable name="footnote-position">
+ <xsl:number from="/w:wordDocument/w:body" count="w:footnote" level="any"/>
+ </xsl:variable>
+ <text:note text:note-class="footnote" text:id="ftn{$footnote-position}">
+ <text:note-citation/>
+ <text:note-body>
+ <xsl:apply-templates mode="dispatch"/>
+ </text:note-body>
+ </text:note>
+ </xsl:template>
+ <xsl:template match="w:endnote">
+ <xsl:variable name="endnote-position">
+ <xsl:number from="/w:wordDocument/w:body" count="w:endnote" level="any" format="1"/>
+ </xsl:variable>
+ <text:endnote text:id="edn{$endnote-position}">
+ <text:endnote-body>
+ <xsl:apply-templates mode="dispatch"/>
+ </text:endnote-body>
+ </text:endnote>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/filter/source/xslt/odf2xhtml/export/common/body.xsl b/filter/source/xslt/odf2xhtml/export/common/body.xsl
new file mode 100644
index 000000000000..96f7d3ce691c
--- /dev/null
+++ b/filter/source/xslt/odf2xhtml/export/common/body.xsl
@@ -0,0 +1,422 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<!--
+ For further documentation and updates visit http://xml.openoffice.org/odf2xhtml
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:java="http://xml.apache.org/xslt/java" xmlns:urlencoder="http://www.jclark.com/xt/java/java.net.URLEncoder" exclude-result-prefixes="chart config dc dom dr3d draw fo form math meta number office ooo oooc ooow script style svg table text xforms xlink xsd xsi java urlencoder">
+
+
+ <xsl:include href="table_of_content.xsl"/>
+
+
+ <!-- ****************** -->
+ <!-- *** Whitespace *** -->
+ <!-- ****************** -->
+
+ <xsl:template match="text:s">
+ <xsl:call-template name="write-breakable-whitespace">
+ <xsl:with-param name="whitespaces" select="@text:c"/>
+ </xsl:call-template>
+ </xsl:template>
+
+
+ <!--write the number of 'whitespaces' -->
+ <xsl:template name="write-breakable-whitespace">
+ <xsl:param name="whitespaces"/>
+
+ <!--write two space chars as the normal white space character will be stripped
+ and the other is able to break -->
+ <xsl:text>&#160;</xsl:text>
+ <xsl:if test="$whitespaces >= 2">
+ <xsl:call-template name="write-breakable-whitespace-2">
+ <xsl:with-param name="whitespaces" select="$whitespaces - 1"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+
+
+ <!--write the number of 'whitespaces' -->
+ <xsl:template name="write-breakable-whitespace-2">
+ <xsl:param name="whitespaces"/>
+ <!--write two space chars as the normal white space character will be stripped
+ and the other is able to break -->
+ <xsl:text> </xsl:text>
+ <xsl:if test="$whitespaces >= 2">
+ <xsl:call-template name="write-breakable-whitespace">
+ <xsl:with-param name="whitespaces" select="$whitespaces - 1"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+
+ <!-- currentSolution: 8 non-breakable-spaces instead of a TAB is an approximation.
+ Sometimes less spaces than 8 might be needed and the output might be more difficult to read-->
+ <xsl:template match="text:tab">
+ <xsl:param name="globalData"/>
+
+ <xsl:call-template name="write-breakable-whitespace">
+ <xsl:with-param name="whitespaces" select="8"/>
+ </xsl:call-template>
+ </xsl:template>
+
+
+
+ <!-- *************** -->
+ <!-- *** Textbox *** -->
+ <!-- *************** -->
+
+ <!-- ID / NAME of text-box -->
+ <xsl:template match="@draw:name">
+ <xsl:attribute name="id">
+ <xsl:choose>
+ <xsl:when test="number(substring(.,1,1))">
+ <!-- Heuristic: If the first character is a number a 'a_' will be set
+ as prefix, as id have to be of type NMTOKEN -->
+ <xsl:value-of select="concat('a_',translate(., '&#xA;&amp;&lt;&gt;.,;: %()[]/\+', '___________________________'))"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="translate(., '&#xA;&amp;&lt;&gt;.,;: %()[]/\+', '___________________________')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:template>
+
+
+ <xsl:template match="text:line-break">
+ <xsl:param name="listIndent"/>
+
+ <xsl:element namespace="{$namespace}" name="br"/>
+
+ <!-- line breaks in lists need an indent similar to the list label -->
+ <xsl:if test="$listIndent">
+ <xsl:element namespace="{$namespace}" name="span">
+ <xsl:attribute name="style">margin-left:<xsl:value-of select="$listIndent"/>cm</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+
+
+ <!-- currently there have to be an explicit call of the style attribute nodes, maybe the attributes nodes have no priority only order relevant-->
+ <xsl:template name="apply-styles-and-content">
+ <xsl:param name="globalData"/>
+ <xsl:param name="footnotePrefix" />
+ <xsl:apply-templates select="@*">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ <!-- the footnote symbol is the prefix for a footnote in the footer -->
+ <xsl:copy-of select="$footnotePrefix"/>
+ <xsl:apply-templates select="node()">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:template>
+
+
+ <!-- ******************* -->
+ <!-- *** References *** -->
+ <!-- ******************* -->
+
+ <xsl:template match="text:reference-ref | text:sequence-ref">
+ <xsl:param name="globalData"/>
+ <xsl:element namespace="{$namespace}" name="a">
+ <xsl:attribute name="href">
+ <xsl:text>#</xsl:text>
+ <xsl:choose>
+ <xsl:when test="number(substring(@text:ref-name,1,1))">
+ <!-- Heuristic: If the first character is a number a 'a_' will be set
+ as prefix, as id have to be of type NMTOKEN -->
+ <xsl:value-of select="concat('a_',translate(@text:ref-name, '&#xA;&amp;&lt;&gt;.,;: %()[]/\+', '___________________________'))"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="translate(@text:ref-name, '&#xA;&amp;&lt;&gt;.,;: %()[]/\+', '___________________________')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+
+ <xsl:apply-templates select="@* | node()">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="@text:name">
+ <xsl:attribute name="id">
+ <xsl:choose>
+ <xsl:when test="number(substring(.,1,1))">
+ <!-- Heuristic: If the first character is a number a 'a_' will be set
+ as prefix, as id have to be of type NMTOKEN -->
+ <xsl:value-of select="concat('a_',translate(., '&#xA;&amp;&lt;&gt;.,;: %()[]/\+', '___________________________'))"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="translate(., '&#xA;&amp;&lt;&gt;.,;: %()[]/\+', '___________________________')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:template>
+
+ <xsl:template match="text:sequence">
+ <xsl:param name="globalData"/>
+
+ <xsl:element namespace="{$namespace}" name="a">
+ <xsl:apply-templates select="@*" />
+ <xsl:attribute name="id">
+ <xsl:choose>
+ <xsl:when test="number(substring(@text:ref-name,1,1))">
+ <!-- Heuristic: If the first character is a number a 'a_' will be set
+ as prefix, as id have to be of type NMTOKEN -->
+ <xsl:value-of select="concat('a_',translate(@text:ref-name, '&#xA;&amp;&lt;&gt;.,;: %()[]/\+', '___________________________'))"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="translate(@text:ref-name, '&#xA;&amp;&lt;&gt;.,;: %()[]/\+', '___________________________')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:element>
+
+ <xsl:apply-templates>
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:template>
+
+ <xsl:template match="text:reference-mark">
+ <xsl:param name="globalData"/>
+
+ <xsl:element namespace="{$namespace}" name="a">
+ <xsl:apply-templates select="@*" />
+ <xsl:attribute name="id">
+ <xsl:choose>
+ <xsl:when test="number(substring(@text:name,1,1))">
+ <!-- Heuristic: If the first character is a number a 'a_' will be set
+ as prefix, as id have to be of type NMTOKEN -->
+ <xsl:value-of select="concat('a_',translate(@text:name, '&#xA;&amp;&lt;&gt;.,;: %()[]/\+', '___________________________'))"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="translate(@text:name, '&#xA;&amp;&lt;&gt;.,;: %()[]/\+', '___________________________')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:element>
+
+ <xsl:apply-templates>
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:template>
+
+
+ <xsl:template match="text:reference-mark-start">
+ <xsl:param name="globalData"/>
+
+ <xsl:element namespace="{$namespace}" name="a">
+ <xsl:apply-templates select="@*" />
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="text:bibliography-mark">
+ <xsl:param name="globalData"/>
+
+ <xsl:element namespace="{$namespace}" name="a">
+ <xsl:apply-templates select="@* | node()">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:element>
+ </xsl:template>
+
+ <!-- @text:title exist only in text:bibliography-mark -->
+ <xsl:template match="@text:title">
+ <xsl:attribute name="title">
+ <xsl:value-of select="."/>
+ </xsl:attribute>
+ </xsl:template>
+
+ <!-- @text:url exist only in text:bibliography-mark -->
+ <xsl:template match="@text:url">
+ <xsl:attribute name="href">
+ <xsl:value-of select="."/>
+ </xsl:attribute>
+ </xsl:template>
+
+ <xsl:template match="text:user-defined">
+ <xsl:apply-templates/>
+ </xsl:template>
+
+
+ <xsl:template match="office:annotation">
+ <xsl:element name="span">
+ <xsl:attribute name="title">annotation</xsl:attribute>
+ <xsl:attribute name="class">annotation_style_by_filter</xsl:attribute>
+ <xsl:apply-templates select="@*" />
+ <br/>
+ <xsl:text>[ANNOTATION:</xsl:text>
+ <br/>
+ <xsl:apply-templates select="*" mode="annotation"/>
+ <xsl:text>]</xsl:text>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="text:p" mode="annotation">
+ <br/>
+ <xsl:element name="span">
+ <xsl:text>NOTE: '</xsl:text>
+ <xsl:apply-templates />
+ <xsl:text>'</xsl:text>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="dc:creator" mode="annotation">
+ <br/>
+ <xsl:element name="span">
+ <xsl:attribute name="title">dc:creator</xsl:attribute>
+ <xsl:text>BY '</xsl:text>
+ <xsl:apply-templates />
+ <xsl:text>'</xsl:text>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="dc:date" mode="annotation">
+ <br/>
+ <xsl:element name="span">
+ <xsl:attribute name="title">dc:date</xsl:attribute>
+ <xsl:text>ON '</xsl:text>
+ <xsl:apply-templates />
+ <xsl:text>'</xsl:text>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="meta:date-string" mode="annotation">
+ <br/>
+ <xsl:element name="span">
+ <xsl:attribute name="title">meta-date-string</xsl:attribute>
+ <xsl:text>META DATE '</xsl:text>
+ <xsl:apply-templates />
+ <xsl:text>'</xsl:text>
+ </xsl:element>
+ </xsl:template>
+
+
+ <!-- *************** -->
+ <!-- *** HELPER *** -->
+ <!-- *************** -->
+
+
+ <xsl:template name="create-href">
+ <xsl:param name="href"/>
+
+ <xsl:choose>
+ <!-- internal OOo URL used in content tables -->
+ <xsl:when test="contains($href, '%7Coutline')">
+ <!-- the simple workaround for content tables in a single document is to create create an anchor from every heading element
+ work-around downside: Multiple identical headings won't refer always to the first.
+ -->
+ <xsl:text>#</xsl:text>
+ <xsl:variable name="title">
+ <xsl:apply-templates mode="concatenate"/>
+ </xsl:variable>
+
+ <xsl:value-of select="concat('a_', translate(normalize-space($title), '.,;: %()[]/\+', '_____________'))"/>
+ </xsl:when>
+ <xsl:when test="self::draw:image[office:binary-data]">
+ <xsl:text>data:image/*;base64,</xsl:text><xsl:value-of select="office:binary-data"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <!-- in case of packed open office document -->
+ <xsl:when test="starts-with($sourceBaseURL, 'jar:') or $isPackageFormat">
+ <xsl:choose>
+ <!-- for images relative to open office document -->
+ <xsl:when test="starts-with($href, '../')">
+ <!-- creating an absolute http URL to the packed image file (removing the '.')-->
+ <xsl:value-of select="concat(substring-after(substring-before($sourceBaseURL, '!'), 'jar:'), '/', $href, $optionalURLSuffix)"/>
+ </xsl:when>
+ <!-- for absolute URLs & absolute paths -->
+ <xsl:when test="contains($href, ':') or starts-with($href, '/')">
+ <xsl:value-of select="concat($href, $optionalURLSuffix)"/>
+ </xsl:when>
+ <!-- for images jared in open office document -->
+ <xsl:otherwise>
+ <xsl:value-of select="concat($sourceBaseURL, $href, $optionalURLSuffix)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <!-- for absolute URLs & Paths -->
+ <xsl:when test="contains($href, ':') or starts-with($href, '/')">
+ <xsl:value-of select="concat($href, $optionalURLSuffix)"/>
+ </xsl:when>
+ <!-- for relative URLs -->
+ <xsl:otherwise>
+ <xsl:value-of select="concat($sourceBaseURL, $href, $optionalURLSuffix)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ </xsl:template>
+
+ <xsl:template match="text()" mode="concatenate">
+ <xsl:value-of select="."/>
+ </xsl:template>
+ <xsl:template match="*" mode="concatenate">
+ <xsl:apply-templates mode="concatenate"/>
+ </xsl:template>
+
+
+ <!-- ******************** -->
+ <!-- *** Common Rules *** -->
+ <!-- ******************** -->
+
+ <!-- ignore / neglect the following elements -->
+ <xsl:template match="draw:custom-shape | draw:g | office:forms | text:alphabetical-index-mark | text:alphabetical-index-mark-end | text:alphabetical-index-mark-start | text:bibliography-source | text:number | text:reference-mark-end | text:sequence-decls | text:soft-page-break | text:table-of-content-source | text:tracked-changes | text:user-field-decls"/>
+
+ <!-- default template used by purpose-->
+ <xsl:template match="text:bibliography | text:change-end | text:change-start">
+ <xsl:param name="globalData"/>
+
+ <xsl:apply-templates>
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:template>
+
+ <!-- default template for not recognized elements -->
+ <xsl:template match="*">
+ <xsl:param name="globalData"/>
+ <xsl:message>Using default element rule for ODF element '<xsl:value-of select="name()"/>'.</xsl:message>
+
+ <xsl:apply-templates>
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:template>
+
+ <xsl:template match="@*"/>
+
+ <!-- allowing all matched text nodes -->
+ <xsl:template match="text()">
+ <xsl:value-of select="."/>
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/filter/source/xslt/odf2xhtml/export/common/styles/style_collector.xsl b/filter/source/xslt/odf2xhtml/export/common/styles/style_collector.xsl
new file mode 100644
index 000000000000..2aa2fdc50bc3
--- /dev/null
+++ b/filter/source/xslt/odf2xhtml/export/common/styles/style_collector.xsl
@@ -0,0 +1,828 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<!--
+ For further documentation and updates visit http://xml.openoffice.org/odf2xhtml
+-->
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
+ xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0"
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:dom="http://www.w3.org/2001/xml-events"
+ xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
+ xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
+ xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
+ xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
+ xmlns:math="http://www.w3.org/1998/Math/MathML"
+ xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
+ xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
+ xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
+ xmlns:ooo="http://openoffice.org/2004/office"
+ xmlns:oooc="http://openoffice.org/2004/calc"
+ xmlns:ooow="http://openoffice.org/2004/writer"
+ xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
+ xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
+ xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
+ xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
+ xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
+ xmlns:xforms="http://www.w3.org/2002/xforms"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:xt="http://www.jclark.com/xt"
+ xmlns:common="http://exslt.org/common"
+ xmlns:xalan="http://xml.apache.org/xalan"
+ exclude-result-prefixes="chart config dc dom dr3d draw fo form math meta number office ooo oooc ooow script style svg table text xforms xlink xsd xsi xt common xalan">
+
+
+
+ <!-- ***************************************** -->
+ <!-- *** Gathering office style properties *** -->
+ <!-- ***************************************** -->
+
+ <!-- REASON FOR STYLESHEET:
+ In the OpenOffice documents styles are represented by a hierarchy.
+ (e.g. most styles are inherited from a default style).
+ Many other languages (as XHTML/CSS) do not support inherited styles.
+ The style inheritance have to be made flat/absolute for each style.
+
+ A further reason was, that the earlier style collection mechanism
+ had problems with CSS inline, which do not inherit from XML office defaults
+ nor font:family defaults as the style header does
+ (cp. stylesheet 'style_collector.xsl' and the 'write-default-styles' template)
+
+ RESULT OF STYLESHEET:
+ All styles will be returned in a variable containing styles with their inherited *:
+
+ <all-styles>
+ <style style:family="foo" style:name="x1">
+ <* fo:padding-left="0cm" fo:margin-right="0cm" />
+ </style>
+ <style style:family="muh" style:name="x2" >
+ <* fo:padding-left="3cm" ... />
+ </style>
+ ...
+
+ </all-styles>
+ -->
+
+
+ <xsl:template name="collect-global-odf-properties">
+ <!-- to access the variable as a node-set by XPATH expressions, it is necessary to convert it
+ from a result-tree-fragment (RTF) to a node set by a in a XSLT 1.0 non standarized function -->
+ <xsl:variable name="globalDataRTF">
+ <xsl:call-template name="collect-document-links-RTF" />
+ </xsl:variable>
+
+ <xsl:choose>
+ <xsl:when test="function-available('common:node-set')">
+ <xsl:call-template name="collect-style-properties">
+ <xsl:with-param name="globalData" select="common:node-set($globalDataRTF)" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="function-available('xalan:nodeset')">
+ <xsl:call-template name="collect-style-properties">
+ <xsl:with-param name="globalData" select="xalan:nodeset($globalDataRTF)" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="function-available('xt:node-set')">
+ <xsl:call-template name="collect-style-properties">
+ <xsl:with-param name="globalData" select="xt:node-set($globalDataRTF)" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message terminate="yes">The required node-set function was not found!</xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+
+ <xsl:template name="collect-style-properties">
+ <xsl:param name="globalData" />
+
+ <!-- Add the input file references to the new collected style properties -->
+ <xsl:variable name="globalDataRTF">
+ <xsl:copy-of select="$globalData" />
+ <xsl:call-template name="collect-style-properties-RTF">
+ <xsl:with-param name="globalData" select="$globalData" />
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:choose>
+ <xsl:when test="function-available('common:node-set')">
+ <xsl:call-template name="map-odf-style-properties">
+ <xsl:with-param name="globalData" select="common:node-set($globalDataRTF)" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="function-available('xalan:nodeset')">
+ <xsl:call-template name="map-odf-style-properties">
+ <xsl:with-param name="globalData" select="xalan:nodeset($globalDataRTF)" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="function-available('xt:node-set')">
+ <xsl:call-template name="map-odf-style-properties">
+ <xsl:with-param name="globalData" select="xt:node-set($globalDataRTF)" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message terminate="yes">The required node-set function was not found!</xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <xsl:template name="collect-document-links-RTF">
+ <!-- works for zipped office files, unzipped office files as for flat filter single office file format as well -->
+ <xsl:variable name="documentLinksRTF">
+ <xsl:choose>
+ <xsl:when test="office:document-content">
+ <xsl:element name="styles-file" namespace="">
+ <xsl:copy-of select="document(concat($sourceBaseURL, 'styles.xml'))" />
+ </xsl:element>
+ <xsl:element name="meta-file" namespace="">
+ <xsl:copy-of select="document(concat($sourceBaseURL, 'meta.xml'))" />
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="styles-file" namespace="">
+ <xsl:copy-of select="/" />
+ </xsl:element>
+ <xsl:element name="meta-file" namespace="">
+ <xsl:copy-of select="/" />
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:choose>
+ <xsl:when test="function-available('common:node-set')">
+ <xsl:call-template name="collect-document-links">
+ <xsl:with-param name="documentLinks" select="common:node-set($documentLinksRTF)" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="function-available('xalan:nodeset')">
+ <xsl:call-template name="collect-document-links">
+ <xsl:with-param name="documentLinks" select="xalan:nodeset($documentLinksRTF)" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="function-available('xt:node-set')">
+ <xsl:call-template name="collect-document-links">
+ <xsl:with-param name="documentLinks" select="xt:node-set($documentLinksRTF)" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message terminate="yes">The required node-set function was not found!</xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ </xsl:template>
+
+
+ <xsl:template name="collect-document-links">
+ <xsl:param name="documentLinks" />
+
+ <xsl:element name="styles-file" namespace="">
+ <xsl:copy-of select="$documentLinks/styles-file/*" />
+ </xsl:element>
+
+ <xsl:element name="meta-file" namespace="">
+ <xsl:copy-of select="$documentLinks/meta-file/*" />
+ </xsl:element>
+
+ <xsl:copy-of select="$documentLinks/styles-file/*/office:styles" />
+ <xsl:copy-of select="$documentLinks/styles-file/*/office:font-face-decls" />
+
+ <!-- office:automatic-styles may be containted in two files (i.e. content.xml and styles.xml).
+ Wild card necessary as top level element differs from flat office files ("SampleName.fsxw") -->
+ <xsl:copy-of select="/*/office:automatic-styles" />
+
+ </xsl:template>
+
+
+ <xsl:template name="collect-style-properties-RTF">
+ <xsl:param name="globalData" />
+
+ <!--** DEFAULT STYLES: First adding some office defaults unwritten in XML -->
+ <xsl:variable name="defaultOfficeStyle-RTF">
+ <xsl:element name="style" namespace="">
+ <xsl:element name="style:properties" />
+ </xsl:element>
+ </xsl:variable>
+
+ <xsl:choose>
+ <xsl:when test="function-available('common:node-set')">
+ <xsl:call-template name="collect-properties-defaults">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="defaultOfficeStyle" select="common:node-set($defaultOfficeStyle-RTF)" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="function-available('xalan:nodeset')">
+ <xsl:call-template name="collect-properties-defaults">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="defaultOfficeStyle" select="xalan:nodeset($defaultOfficeStyle-RTF)" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="function-available('xt:node-set')">
+ <xsl:call-template name="collect-properties-defaults">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="defaultOfficeStyle" select="xt:node-set($defaultOfficeStyle-RTF)" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message terminate="yes">ERROR: Function not found: 'Nodeset'</xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <xsl:template name="collect-properties-defaults">
+ <xsl:param name="globalData" />
+ <xsl:param name="defaultOfficeStyle" />
+
+ <!--** DEFAULT STYLES: Adding the default styles of a style:family, by adding each office:styles/style:default-style element **-->
+ <xsl:variable name="defaultFamilyStyles-RTF">
+ <xsl:for-each select="$globalData/office:styles/style:default-style">
+ <xsl:element name="style" namespace="">
+ <xsl:copy-of select="@style:family" />
+ <xsl:call-template name="create-inherited-style-properties">
+ <xsl:with-param name="inheritedStyleProperties" select="$defaultOfficeStyle/style/*" />
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:variable>
+
+ <xsl:choose>
+ <xsl:when test="function-available('common:node-set')">
+ <xsl:call-template name="collect-properties">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="defaultOfficeStyle" select="$defaultOfficeStyle" />
+ <xsl:with-param name="defaultFamilyStyles" select="common:node-set($defaultFamilyStyles-RTF)" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="function-available('xalan:nodeset')">
+ <xsl:call-template name="collect-properties">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="defaultOfficeStyle" select="$defaultOfficeStyle" />
+ <xsl:with-param name="defaultFamilyStyles" select="xalan:nodeset($defaultFamilyStyles-RTF)" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="function-available('xt:node-set')">
+ <xsl:call-template name="collect-properties">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="defaultOfficeStyle" select="$defaultOfficeStyle" />
+ <xsl:with-param name="defaultFamilyStyles" select="xt:node-set($defaultFamilyStyles-RTF)" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message terminate="yes">ERROR: Function not found: nodeset</xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <xsl:template name="collect-properties">
+ <xsl:param name="globalData" />
+ <xsl:param name="defaultOfficeStyle" />
+ <xsl:param name="defaultFamilyStyles" />
+
+ <!--** traversee all style trees - branch after branch - collecting style properties **-->
+ <xsl:element name="all-doc-styles" namespace="">
+
+ <!-- Background Information:
+
+ There are two different types of styles in the Office:
+ 1) The office:styles from the user pre-defined style templates
+ 2) The automatic:styles, which are created whenever a user uses explicit style formatting.
+
+ The office:styles only have parent styles in the office:styles,
+ but automatic:styles may inherit from both office:styles and themself.
+ -->
+
+ <!--** traversee all office:styles trees beginning with the top-level styles **-->
+ <xsl:for-each select="$globalData/office:styles/style:style[not(@style:parent-style-name)]">
+ <!-- Looking for parents from style:family
+ <xsl:for-each select="$globalData/office:styles/style:style[@style:family=current()/@style:family][not(@style:parent-style-name)]"> -->
+ <xsl:choose>
+ <xsl:when test="$defaultFamilyStyles/style[@style:family=current()/@style:family]">
+ <xsl:call-template name="inherit-style-for-self-and-children">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="inheritedStyleProperties" select="$defaultFamilyStyles/style[@style:family=current()/@style:family]/*" />
+ <xsl:with-param name="searchOnlyInAutomaticStyles" select="false()" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="inherit-style-for-self-and-children">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="inheritedStyleProperties" select="$defaultOfficeStyle/style/*" />
+ <xsl:with-param name="searchOnlyInAutomaticStyles" select="false()" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!--** creates a style element with style:name and style:family attribute and
+ an element representing the absolute style properties style:property ** -->
+ </xsl:for-each>
+
+ <!--** traversee all office:automatic-styles trees beginning with the top-level styles **-->
+ <xsl:for-each select="$globalData/office:automatic-styles/style:style[not(@style:parent-style-name)]">
+ <!--** creates a style element with style:name and style:family attribute and
+ an element representing the absolute style properties style:property ** -->
+ <xsl:choose>
+ <xsl:when test="$defaultFamilyStyles/style[@style:family=current()/@style:family]">
+ <xsl:call-template name="inherit-style-for-self-and-children">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="inheritedStyleProperties" select="$defaultFamilyStyles/style[@style:family=current()/@style:family]/*" />
+ <xsl:with-param name="searchOnlyInAutomaticStyles" select="true()" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="inherit-style-for-self-and-children">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="inheritedStyleProperties" select="$defaultOfficeStyle/style/*" />
+ <xsl:with-param name="searchOnlyInAutomaticStyles" select="true()" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ </xsl:for-each>
+
+ </xsl:element>
+ <!-- debug output in case only styles should be given out (regression test) -->
+ <xsl:if test="$onlyStyleOutputEnabled">
+ <xsl:element name="defaultOfficeStyle" namespace="">
+ <xsl:copy-of select="$defaultOfficeStyle" />
+ </xsl:element>
+ <xsl:element name="defaultFamilyStyles" namespace="">
+ <xsl:copy-of select="$defaultFamilyStyles" />
+ </xsl:element>
+ </xsl:if>
+
+ </xsl:template>
+
+
+ <xsl:template name="inherit-style-for-self-and-children">
+ <xsl:param name="globalData" />
+ <xsl:param name="inheritedStyleProperties" />
+ <xsl:param name="searchOnlyInAutomaticStyles" />
+
+ <!--** create an absolute style by inherting properties from the given parent properties **-->
+ <xsl:variable name="newStyleProperties-RTF">
+ <xsl:call-template name="create-inherited-style-properties">
+ <xsl:with-param name="inheritedStyleProperties" select="$inheritedStyleProperties" />
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="function-available('common:node-set')">
+ <xsl:variable name="newStyleProperties" select="common:node-set($newStyleProperties-RTF)" />
+
+ <xsl:element name="style" namespace="">
+ <xsl:copy-of select="@style:family" />
+ <xsl:copy-of select="@style:name" />
+ <xsl:copy-of select="$newStyleProperties" />
+ </xsl:element>
+
+ <xsl:choose>
+ <xsl:when test="$searchOnlyInAutomaticStyles">
+ <xsl:call-template name="get-children">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="searchOnlyInAutomaticStyles" select="true()" />
+ <xsl:with-param name="inheritedStyleProperties" select="$newStyleProperties/*" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <!--** for all automatic-children of the current office:styles **-->
+ <xsl:call-template name="get-children">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="searchOnlyInAutomaticStyles" select="false()" />
+ <xsl:with-param name="inheritedStyleProperties" select="$newStyleProperties/*" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="function-available('xalan:nodeset')">
+ <xsl:variable name="newStyleProperties" select="xalan:nodeset($newStyleProperties-RTF)" />
+
+ <xsl:element name="style" namespace="">
+ <xsl:copy-of select="@style:family" />
+ <xsl:copy-of select="@style:name" />
+ <xsl:copy-of select="$newStyleProperties" />
+ </xsl:element>
+
+ <xsl:choose>
+ <xsl:when test="$searchOnlyInAutomaticStyles">
+ <xsl:call-template name="get-children">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="searchOnlyInAutomaticStyles" select="true()" />
+ <xsl:with-param name="inheritedStyleProperties" select="$newStyleProperties/*" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <!--** for all automatic-children of the current office:styles **-->
+ <xsl:call-template name="get-children">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="searchOnlyInAutomaticStyles" select="false()" />
+ <xsl:with-param name="inheritedStyleProperties" select="$newStyleProperties/*" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="function-available('xt:node-set')">
+ <xsl:variable name="newStyleProperties" select="xt:node-set($newStyleProperties-RTF)" />
+
+ <xsl:element name="style" namespace="">
+ <xsl:copy-of select="@style:family" />
+ <xsl:copy-of select="@style:name" />
+ <xsl:copy-of select="$newStyleProperties" />
+ </xsl:element>
+
+ <xsl:choose>
+ <xsl:when test="$searchOnlyInAutomaticStyles">
+ <xsl:call-template name="get-children">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="searchOnlyInAutomaticStyles" select="true()" />
+ <xsl:with-param name="inheritedStyleProperties" select="$newStyleProperties/*" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <!--** for all automatic-children of the current office:styles **-->
+ <xsl:call-template name="get-children">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="searchOnlyInAutomaticStyles" select="false()" />
+ <xsl:with-param name="inheritedStyleProperties" select="$newStyleProperties/*" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message terminate="yes">ERROR: Function not found: nodeset</xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <xsl:template name="get-children">
+ <xsl:param name="globalData" />
+ <xsl:param name="searchOnlyInAutomaticStyles" />
+ <xsl:param name="inheritedStyleProperties" select="*" />
+
+<!-- QUESTION: Parent style is only unique by name and family, but what about cross family inheritance? -->
+ <!-- For each child style (that is every style which has the given parentStyleName as style:parent-style-name and the same style:family -->
+ <xsl:variable name="parentStyleFamily" select="@style:family" />
+ <xsl:variable name="parentStyleName" select="@style:name" />
+ <xsl:if test="not($searchOnlyInAutomaticStyles)">
+ <xsl:for-each select="$globalData/office:styles/style:style[@style:family=$parentStyleFamily and @style:parent-style-name=$parentStyleName]">
+ <xsl:call-template name="inherit-style-for-self-and-children">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="inheritedStyleProperties" select="$inheritedStyleProperties" />
+ <xsl:with-param name="searchOnlyInAutomaticStyles" select="$searchOnlyInAutomaticStyles" />
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:for-each select="$globalData/office:automatic-styles/style:style[@style:family=$parentStyleFamily and @style:parent-style-name=$parentStyleName]">
+ <xsl:call-template name="inherit-style-for-self-and-children">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="inheritedStyleProperties" select="$inheritedStyleProperties" />
+ <xsl:with-param name="searchOnlyInAutomaticStyles" select="$searchOnlyInAutomaticStyles" />
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:template>
+
+
+ <xsl:template name="create-inherited-style-properties">
+ <xsl:param name="inheritedStyleProperties" />
+
+ <xsl:element name="style:properties">
+ <!-- Writing all inherited style properties -->
+ <xsl:for-each select="$inheritedStyleProperties/@*">
+ <xsl:sort select="name()" />
+ <xsl:copy-of select="." />
+ </xsl:for-each>
+
+ <!--All current attributes will override already inserted attributes of the same name
+ XSLT Spec: "Adding an attribute to an element replaces any existing attribute of that element with the same expanded-name." -->
+ <xsl:for-each select="*/@*[name() != 'style:font-size-rel']">
+ <xsl:copy-of select="." />
+ </xsl:for-each>
+
+ <xsl:if test="*/@style:font-size-rel">
+<!--
+ The intheritedStyleProperties should include a absolute Font Size, but
+ <style:properties
+ xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
+ xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
+ style:font-name="Courier New"
+ fo:language="en"
+ fo:country="US"
+ style:font-name-asian=Courier New"
+ style:font-name-complex="Courier New"/>
+-->
+ <xsl:variable name="fontSizeAbsolute">
+ <xsl:call-template name="convert2pt">
+ <xsl:with-param name="value" select="$inheritedStyleProperties/@fo:font-size" />
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:variable name="fontSizeRelative">
+ <xsl:call-template name="convert2pt">
+ <xsl:with-param name="value" select="*/@style:font-size-rel" />
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:attribute name="fo:font-size">
+ <xsl:value-of select="$fontSizeAbsolute + $fontSizeRelative"/>
+ <xsl:text>pt</xsl:text>
+ </xsl:attribute>
+ </xsl:if>
+
+ <!-- providing tabulator indentation -->
+ <xsl:copy-of select="$inheritedStyleProperties/style:tab-stops"/>
+ <xsl:copy-of select="*/style:tab-stops"/>
+ </xsl:element>
+ </xsl:template>
+
+ <!-- debugging & testing purpose -->
+ <xsl:template name="write-collected-styles">
+ <xsl:param name="globalData" />
+
+ <xsl:message>&lt;all-doc-styles&gt;</xsl:message>
+ <xsl:for-each select="$globalData/all-doc-styles/style">
+ <xsl:message>&lt;style</xsl:message>
+ <xsl:message>style:family="<xsl:value-of select="current()/@style:family" />"&gt;</xsl:message>
+ <xsl:message>style:name="<xsl:value-of select="current()/@style:name" />" </xsl:message>
+ <xsl:message> &lt;*</xsl:message>
+ <xsl:for-each select="*/@*">
+ <xsl:message>
+ <xsl:text></xsl:text>
+ <xsl:value-of select="name()" />="<xsl:value-of select="." />"</xsl:message>
+ </xsl:for-each>
+ <xsl:message>/&gt;</xsl:message>
+ <xsl:message>&lt;/style&gt;</xsl:message>
+ </xsl:for-each>
+ <xsl:message>&lt;/all-doc-styles&gt;</xsl:message>
+ </xsl:template>
+
+ <xsl:template name="map-odf-style-properties">
+ <xsl:param name="globalData" />
+
+ <xsl:choose>
+ <!--+++++ DEBUG STYLE OUTPUT FOR REGRESSION TEST +++++-->
+ <!-- create styles file from the style variable (testing switch) -->
+ <xsl:when test="$onlyStyleOutputEnabled">
+
+ <xsl:element name="debug-output" namespace="">
+ <xsl:copy-of select="$globalData" />
+ <xsl:call-template name="map-odf-properties">
+ <xsl:with-param name="globalData" select="$globalData" />
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:when>
+
+ <!-- create XHTML file -->
+ <xsl:otherwise>
+ <!-- to access the variable like a node-set it is necessary to convert it
+ from a result-tree-fragment (RTF) to a node set using the James Clark extension -->
+ <xsl:variable name="globalDataRTF">
+ <!-- raw properties still needed for table width attribute creation -->
+ <xsl:copy-of select="$globalData" />
+ <xsl:call-template name="map-odf-properties">
+ <xsl:with-param name="globalData" select="$globalData" />
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:choose>
+ <xsl:when test="function-available('common:node-set')">
+ <xsl:call-template name="start-main">
+ <xsl:with-param name="globalData" select="common:node-set($globalDataRTF)" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="function-available('xalan:nodeset')">
+ <xsl:call-template name="start-main">
+ <xsl:with-param name="globalData" select="xalan:nodeset($globalDataRTF)" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="function-available('xt:node-set')">
+ <xsl:call-template name="start-main">
+ <xsl:with-param name="globalData" select="xt:node-set($globalDataRTF)" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message terminate="yes">ERROR: Function not found: nodeset</xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- REASON FOR TEMPLATE:
+ The OpenOffice style properities gathered in the variable 'globalData' have to be mapped to the CSS style format
+ -->
+ <xsl:template name="map-odf-properties">
+ <xsl:param name="globalData" />
+ <xsl:element name="all-styles" namespace="">
+ <xsl:for-each select="$globalData/all-doc-styles/style">
+ <xsl:sort select="@style:family" />
+ <xsl:sort select="@style:name" />
+
+ <xsl:call-template name="writeUsedStyles">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="style" select="."/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:key name="elementUsingStyle" match="/*/office:body//*" use="@text:style-name | @draw:style-name | @draw:text-style-name | @table:style-name | @table:default-cell-style-name"/>
+ <xsl:key name="listLabelStyleInStyles" match="/*/office:styles/text:list-style/* |
+ /*/office:styles/style:graphic-properties/text:list-style/*" use="@text:style-name"/>
+
+ <xsl:key name="listLabelStyleInContent" match="/*/office:automatic-styles/text:list-style/* | /*/office:automatic-styles/style:graphic-properties/text:list-style/*" use="@text:style-name"/>
+
+
+ <xsl:variable name="documentRoot" select="/" />
+ <xsl:template name="writeUsedStyles">
+ <xsl:param name="globalData" />
+ <xsl:param name="style"/>
+
+ <!-- for-each changes the key environment from the previously globalData back to the document root -->
+ <xsl:for-each select="$documentRoot">
+ <!-- only styles, which are used in the content are written as CSS styles -->
+ <xsl:choose>
+ <xsl:when test="key('elementUsingStyle', $style/@style:name)/@* or key('listLabelStyleInContent', $style/@style:name)/@*">
+ <xsl:call-template name="writeUsedStyles2">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="style" select="$style" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="not(office:document-content)">
+ <xsl:if test="key('listLabelStyleInStyles', $style/@style:name)/@* or /*/office:styles/text:notes-configuration[@text:citation-style-name = $style/@style:name or /*/office:styles/@text:citation-body-style-name=$style/@style:name]">
+ <!-- if there are consecutive paragraphs with borders (OR background AND margin ), only the first and the last have the top/bottom border
+ unless style:join-border="false" -->
+ <xsl:call-template name="writeUsedStyles2">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="style" select="$style" />
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:for-each select="document($stylesFileURL)">
+ <xsl:if test="key('listLabelStyleInStyles', $style/@style:name)/@* or /*/office:styles/text:notes-configuration[@text:citation-style-name = $style/@style:name or /*/office:styles/@text:citation-body-style-name=$style/@style:name]">
+ <!-- if there are consecutive paragraphs with borders (OR background AND margin ), only the first and the last have the top/bottom border
+ unless style:join-border="false" -->
+ <xsl:call-template name="writeUsedStyles2">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="style" select="$style" />
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:template>
+
+ <xsl:template name="writeUsedStyles2">
+ <xsl:param name="globalData" />
+ <xsl:param name="style"/>
+ <xsl:choose>
+ <xsl:when test="
+ $style/@style:family='paragraph'
+ and((
+ (
+ $style/*/@fo:border-top
+ or $style/*/@fo:border-bottom
+ or $style/*/@fo:border
+ )
+ and
+ (
+ not($style/*/@style:join-border)
+ or $style/*/@style:join-border = 'true'
+ )
+ )
+ or
+ (
+ (
+ $style/*/@fo:margin-top
+ or $style/*/@fo:margin-bottom
+ or $style/*/@fo:margin
+ )
+ and
+ ( $style/*/@fo:background-color
+ and
+ not($style/*/fo:background-color='transparent')
+ )
+ )
+ )">
+ <xsl:element name="style" namespace="">
+ <xsl:copy-of select="$style/@style:family" />
+ <xsl:attribute name="style:name"><xsl:value-of select="concat($style/@style:name, '_borderStart')" /></xsl:attribute>
+ <xsl:element name="final-properties" namespace="">
+ <xsl:apply-templates select="$style/*/@*[not(name() = 'fo:border-bottom')][not(name() = 'fo:padding-bottom')][not(name() = 'fo:margin-bottom')][not(name() = 'fo:margin')]">
+ <xsl:with-param name="globalData" select="$globalData" />
+ </xsl:apply-templates>
+ <xsl:apply-templates mode="paragraphMerge" select="$style/*/@*[name() = 'fo:margin-bottom' or name() = 'fo:margin']">
+ <xsl:with-param name="globalData" select="$globalData" />
+ </xsl:apply-templates>
+ <xsl:text> border-bottom-style:none; </xsl:text>
+ </xsl:element>
+ </xsl:element>
+ <xsl:element name="style" namespace="">
+ <xsl:copy-of select="$style/@style:family" />
+ <xsl:copy-of select="$style/@style:name" />
+ <xsl:attribute name="mergedBorders"><xsl:value-of select="true()" /></xsl:attribute>
+ <xsl:element name="final-properties" namespace="">
+ <xsl:apply-templates select="$style/*/@*[not(name() = 'fo:border-top') and not(name() = 'fo:border-bottom')][not(name() = 'fo:padding-top') and not(name() = 'fo:padding-bottom')][not(name() = 'fo:margin-top') and not(name() = 'fo:margin-bottom')][not(name() = 'fo:margin')]">
+ <xsl:with-param name="globalData" select="$globalData" />
+ </xsl:apply-templates>
+ <xsl:apply-templates mode="paragraphMerge" select="$style/*/@*[name() = 'fo:margin-top' or name() = 'fo:margin-bottom' or name() = 'fo:margin']">
+ <xsl:with-param name="globalData" select="$globalData" />
+ </xsl:apply-templates>
+ <xsl:text> border-top-style:none; border-bottom-style:none; </xsl:text>
+ </xsl:element>
+ </xsl:element>
+ <xsl:element name="style" namespace="">
+ <xsl:copy-of select="$style/@style:family" />
+ <xsl:attribute name="style:name"><xsl:value-of select="concat($style/@style:name, '_borderEnd')" /></xsl:attribute>
+ <xsl:element name="final-properties" namespace="">
+ <xsl:apply-templates select="$style/*/@*[not(name() = 'fo:border-top')][not(name() = 'fo:padding-top')][not(name() = 'fo:margin-top')][not(name() = 'fo:margin')]">
+ <xsl:with-param name="globalData" select="$globalData" />
+ </xsl:apply-templates>
+ <xsl:apply-templates mode="paragraphMerge" select="$style/*/@*[name() = 'fo:margin-top' or name() = 'fo:margin']">
+ <xsl:with-param name="globalData" select="$globalData" />
+ </xsl:apply-templates>
+ <xsl:text> border-top-style:none;</xsl:text>
+ </xsl:element>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="not(key('listLabelStyleInStyles', $style/@style:name)/@*)">
+ <xsl:element name="style" namespace="">
+ <xsl:copy-of select="$style/@style:family" />
+ <xsl:copy-of select="$style/@style:name" />
+ <xsl:element name="final-properties" namespace="">
+ <xsl:apply-templates select="$style/*/@*">
+ <xsl:with-param name="globalData" select="$globalData" />
+ </xsl:apply-templates>
+ </xsl:element>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="style" namespace="">
+ <xsl:attribute name="style:family">none</xsl:attribute>
+ <xsl:attribute name="style:name"><xsl:value-of select="$style/@style:name"/></xsl:attribute>
+ <xsl:element name="final-properties" namespace="">
+ <xsl:apply-templates select="$style/*/@*">
+ <xsl:with-param name="globalData" select="$globalData" />
+ </xsl:apply-templates>
+ </xsl:element>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template mode="paragraphMerge" match="@fo:margin | @fo:margin-top | @fo:margin-bottom | @fo:margin-left | @fo:margin-right">
+ <xsl:text>padding</xsl:text>
+ <xsl:value-of select="substring-after(name(), 'fo:margin')"/>
+ <xsl:text>:</xsl:text>
+ <!-- Map once erroneusly used inch shortage 'inch' to CSS shortage 'in' -->
+ <xsl:choose>
+ <xsl:when test="contains(., 'inch')">
+ <xsl:value-of select="substring-before(.,'ch')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:text>; </xsl:text>
+ </xsl:template>
+</xsl:stylesheet> \ No newline at end of file
diff --git a/filter/source/xslt/odf2xhtml/export/common/styles/style_mapping_css.xsl b/filter/source/xslt/odf2xhtml/export/common/styles/style_mapping_css.xsl
new file mode 100644
index 000000000000..cfd38dcd9a3d
--- /dev/null
+++ b/filter/source/xslt/odf2xhtml/export/common/styles/style_mapping_css.xsl
@@ -0,0 +1,355 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<!--
+ For further documentation and updates visit http://xml.openoffice.org/odf2xhtml
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" exclude-result-prefixes="chart config dc dom dr3d draw fo form math meta number office ooo oooc ooow script style svg table text xforms xlink xsd xsi">
+
+
+ <!-- *** Properties with a 'fo:' prefix *** -->
+ <xsl:template match="@fo:background-color">
+ <xsl:text>background-color:</xsl:text>
+ <xsl:value-of select="."/>
+ <xsl:text>; </xsl:text>
+ </xsl:template>
+
+ <xsl:template match="@fo:border | @fo:border-top | @fo:border-bottom | @fo:border-left | @fo:border-right">
+ <xsl:variable name="borderType" select="substring-after(name(), ':')"/>
+ <xsl:choose>
+ <xsl:when test=". = 'none'">
+ <xsl:value-of select="$borderType"/>
+ <xsl:text>-style:none; </xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="borderWidth" select="substring-before(., ' ')"/>
+ <xsl:variable name="borderStyle" select="substring-before(substring-after(., ' '), ' ')"/>
+ <xsl:variable name="borderColor" select="substring-after(substring-after(., ' '), ' ')"/>
+
+ <!-- More information at template 'round-up-border-width' -->
+ <xsl:variable name="borderWidthFixed">
+ <xsl:call-template name="round-up-border-width">
+ <xsl:with-param name="borderWidth" select="$borderWidth"/>
+ <xsl:with-param name="multiplier">
+ <xsl:choose>
+ <xsl:when test="$borderStyle = 'double'">3</xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:value-of select="$borderType"/>
+ <xsl:text>-width:</xsl:text>
+ <xsl:value-of select="$borderWidthFixed"/>
+ <xsl:text>; </xsl:text>
+ <xsl:value-of select="$borderType"/>
+ <xsl:text>-style:</xsl:text>
+ <xsl:value-of select="$borderStyle"/>
+ <xsl:text>; </xsl:text>
+ <xsl:value-of select="$borderType"/>
+ <xsl:text>-color:</xsl:text>
+ <xsl:value-of select="$borderColor"/>
+ <xsl:text>; </xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- NOTE: Still there have to be placed a <br clear='all' /> to disable the flow!!!!-->
+ <xsl:template match="@fo:clear">
+ <xsl:text>clear:both; </xsl:text>
+ </xsl:template>
+
+ <!-- text-shadow is a CSS2 feature and yet not common used in user-agents -->
+ <xsl:template match="@fo:color |@svg:font-family |@fo:font-size |@fo:font-style |@fo:font-weight |@fo:text-indent |@fo:text-shadow">
+ <xsl:value-of select="substring-after(name(), ':')"/>
+ <xsl:text>:</xsl:text>
+ <xsl:value-of select="."/>
+ <xsl:text>; </xsl:text>
+ </xsl:template>
+
+ <!-- Maps fo:margin as well fo:margin-top, fo:margin-bottom, fo:padding-left, fo:margin-right -->
+ <!-- Maps fo:padding as well fo:padding-top, fo:padding-bottom, fo:padding-left, fo:padding-right -->
+ <xsl:template match="@fo:letter-spacing | @fo:line-height | @fo:width |@fo:margin | @fo:margin-top | @fo:margin-bottom | @fo:margin-left | @fo:margin-right | @fo:padding | @fo:padding-top | @fo:padding-bottom | @fo:padding-left | @fo:padding-right">
+ <xsl:value-of select="substring-after(name(), ':')"/>
+ <xsl:text>:</xsl:text>
+ <!-- Map once erroneusly used inch shortage 'inch' to CSS shortage 'in' -->
+ <xsl:choose>
+ <xsl:when test="contains(., 'inch')">
+ <xsl:value-of select="substring-before(.,'ch')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:text>; </xsl:text>
+ </xsl:template>
+
+ <xsl:template match="@fo:text-align">
+ <!-- 'important' is necessary as table cell value alignment is decided by runtime over the valuetype
+ Otherwise a table cell style-class would always be outnumbered by the run-time alignment value -->
+ <xsl:choose>
+ <xsl:when test="contains(., 'start')">
+ <xsl:choose>
+ <xsl:when test="parent::*/@style:writing-mode and contains(parent::*/@style:writing-mode, 'rl')">
+ <xsl:text>text-align:right ! important; </xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>text-align:left ! important; </xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="contains(., 'end')">
+ <xsl:choose>
+ <xsl:when test="parent::*/@style:writing-mode and contains(parent::*/@style:writing-mode, 'rl')">
+ <xsl:text>text-align:left ! important;</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>text-align:right ! important; </xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>text-align:</xsl:text>
+ <xsl:value-of select="."/>
+ <xsl:text> ! important; </xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="@style:vertical-align">
+ <xsl:choose>
+ <xsl:when test="contains(., 'bottom')">
+ <xsl:text>vertical-align:bottom; </xsl:text>
+ </xsl:when>
+ <xsl:when test="contains(., 'middle')">
+ <xsl:text>vertical-align:middle; </xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>vertical-align:top; </xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+<!-- *** Properties with a 'style:' prefix *** -->
+ <!-- NOTE: Can 'inside' | 'from-inside' better be handled:
+ <!ATTLIST * style:horizontal-pos (from-left|left|center|right|from-inside|inside|outside)#IMPLIED>-->
+ <xsl:template match="@style:horizontal-pos">
+ <xsl:choose>
+ <xsl:when test=".='left'">
+ <xsl:text>text-align:left; </xsl:text>
+ </xsl:when>
+ <xsl:when test=". = 'right'">
+ <xsl:text>text-align:right; </xsl:text>
+ </xsl:when>
+ <xsl:when test=".='center'">
+ <xsl:text>text-align:center; </xsl:text>
+ </xsl:when>
+ <!-- NOTE: currently other values are not used.
+ If the property value is from-left or from-inside,
+ the svg:x attribute associated with the frame element specifies
+ the horizontal position of the frame.
+ Otherwise the svg:x attribute is ignored for text documents.
+ -->
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="@style:column-width">
+ <xsl:text>width:</xsl:text>
+ <xsl:choose>
+ <!-- changing the distance measure: inch to in -->
+ <xsl:when test="contains(., 'inch')">
+ <xsl:value-of select="substring-before(.,'ch')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:text>; </xsl:text>
+ </xsl:template>
+
+ <xsl:template match="@style:text-underline-style">
+ <xsl:text>text-decoration:</xsl:text>
+ <xsl:choose>
+ <!-- changing the distance measure: inch to in -->
+ <xsl:when test=".='none'">
+ <xsl:text>none ! important</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>underline</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:text>; </xsl:text>
+ </xsl:template>
+
+ <xsl:template match="@style:font-name">
+ <xsl:param name="globalData" />
+
+ <xsl:text>font-family:</xsl:text>
+ <xsl:variable name="content" select="."/>
+ <xsl:variable name="quote">'</xsl:variable>
+ <xsl:variable name="fontName" select="$globalData/office:font-face-decls/style:font-face[@style:name=$content]/@svg:font-family" />
+ <xsl:value-of select="translate($fontName, $quote, '')"/>
+ <xsl:text>; </xsl:text>
+ </xsl:template>
+
+ <xsl:template match="@style:row-height">
+ <xsl:text>height:</xsl:text>
+ <xsl:choose>
+ <!-- changing the distance measure: inch to in -->
+ <xsl:when test="contains(., 'inch')">
+ <xsl:value-of select="substring-before(.,'ch')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:text>; </xsl:text>
+ </xsl:template>
+
+ <xsl:template match="@svg:strikethrough-position">
+ <xsl:if test="not(.='none')">
+ <xsl:text>text-decoration:line-through; </xsl:text>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="@style:text-position">
+ <xsl:if test="contains(., 'sub')">
+ <xsl:text>vertical-align:sub; </xsl:text>
+ <xsl:if test="contains(., '%')">
+ <xsl:text>font-size:</xsl:text>
+ <xsl:value-of select="substring-after(., 'sub ')"/>
+ <xsl:text>;</xsl:text>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="contains(., 'super')">
+ <xsl:text>vertical-align:super; </xsl:text>
+ <xsl:if test="contains(., '%')">
+ <xsl:text>font-size:</xsl:text>
+ <xsl:value-of select="substring-after(., 'super ')"/>
+ <xsl:text>;</xsl:text>
+ </xsl:if>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template match="@style:vertical-pos">
+ <xsl:choose>
+ <xsl:when test=".='from-top'">
+ <xsl:text>vertical-align:top; </xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>vertical-align:</xsl:text>
+ <xsl:value-of select="."/>
+ <xsl:text>; </xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="@style:width">
+ <xsl:text>width:</xsl:text>
+ <xsl:choose>
+ <!-- changing the distance measure: inch to in -->
+ <xsl:when test="contains(., 'inch')">
+ <xsl:value-of select="substring-before(.,'ch')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:text>; </xsl:text>
+ </xsl:template>
+ <xsl:template match="@style:wrap">
+ <xsl:choose>
+ <xsl:when test=".='left'">
+ <xsl:text>float:right; </xsl:text>
+ </xsl:when>
+ <xsl:when test=".='right'">
+ <xsl:text>float:left; </xsl:text>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="@style:writing-mode">
+ <xsl:text>writing-mode:</xsl:text>
+ <xsl:value-of select="."/>
+ <xsl:text>; </xsl:text>
+ </xsl:template>
+ <!-- *** Properties with a no 'fo:' or 'style:' prefix *** -->
+ <xsl:template match="@table:align">
+ <xsl:choose>
+ <xsl:when test=".='left'">
+ <!-- Note: problems with meeting minutes example
+ <xsl:text>float:right; </xsl:text> --></xsl:when>
+ <xsl:when test=".='right'">
+ <!-- Note: problems with meeting minutes example
+ <xsl:text>float:left; </xsl:text> --></xsl:when>
+ <xsl:otherwise>
+ <xsl:text>float:none; </xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="style:background-image">
+ <xsl:text>background-image:url(</xsl:text>
+ <xsl:value-of select="@xlink:href"/>
+ <xsl:text>); </xsl:text>
+ <xsl:choose>
+ <xsl:when test="@style:repeat = 'repeat'">
+ <xsl:text>background-repeat:repeat; </xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>background-repeat:no-repeat; </xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- Changing border width measure to cm and enlarging border-width to the Mozilla browser(1.7)
+ visible minimum width
+ - 0.0133cm for solid style
+ - 0.0399cm for double style
+ as there are three border lines painted -->
+ <xsl:template name="round-up-border-width">
+ <xsl:param name="borderWidth"/>
+ <xsl:param name="multiplier"/>
+
+ <xsl:variable name="borderWidthByCentimeter">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="$borderWidth"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="minimalBorderWidth" select="0.0133 * $multiplier"/>
+ <xsl:choose>
+ <xsl:when test="number($borderWidthByCentimeter) &lt; $minimalBorderWidth">
+ <xsl:value-of select="$minimalBorderWidth"/>
+ <xsl:text>cm</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$borderWidthByCentimeter"/>
+ <xsl:text>cm</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+</xsl:stylesheet>
+
diff --git a/filter/source/xslt/odf2xhtml/export/common/table/table.xsl b/filter/source/xslt/odf2xhtml/export/common/table/table.xsl
new file mode 100644
index 000000000000..a380088a26f7
--- /dev/null
+++ b/filter/source/xslt/odf2xhtml/export/common/table/table.xsl
@@ -0,0 +1,164 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<!--
+ For further documentation and updates visit http://xml.openoffice.org/odf2xhtml
+-->
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
+ xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0"
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:dom="http://www.w3.org/2001/xml-events"
+ xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
+ xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
+ xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
+ xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
+ xmlns:math="http://www.w3.org/1998/Math/MathML"
+ xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
+ xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
+ xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
+ xmlns:ooo="http://openoffice.org/2004/office"
+ xmlns:oooc="http://openoffice.org/2004/calc"
+ xmlns:ooow="http://openoffice.org/2004/writer"
+ xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
+ xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
+ xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
+ xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
+ xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
+ xmlns:xforms="http://www.w3.org/2002/xforms"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ exclude-result-prefixes="chart config dc dom dr3d draw fo form math meta number office ooo oooc ooow script style svg table text xforms xlink xsd xsi">
+
+
+ <!-- table row handling -->
+ <xsl:include href="table_rows.xsl" />
+ <!-- table column handling -->
+ <xsl:include href="table_columns.xsl" />
+ <!-- table cell handling -->
+ <xsl:include href="table_cells.xsl" />
+
+ <xsl:param name="tableElement" select="'table'" />
+
+ <!-- ******************* -->
+ <!-- *** main table *** -->
+ <!-- ******************* -->
+
+
+ <xsl:template match="table:table" name="table:table">
+ <xsl:param name="globalData" />
+
+ <!-- The table will only be created if the table:scenario is active -->
+ <xsl:if test="not(table:scenario) or table:scenario/@table:is-active">
+ <xsl:call-template name="create-table">
+ <xsl:with-param name="globalData" select="$globalData" />
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+
+
+
+ <xsl:template name="create-table">
+ <xsl:param name="globalData" />
+
+ <!-- by default '1', for each new sub/inner/nested table the number counts one up -->
+ <xsl:variable name="tableLevel" select="count(ancestor-or-self::table:table)" />
+ <!-- collecting all visible "table:table-row" elements of the table -->
+ <xsl:variable name="allVisibleTableRows" select="table:table-row[not(@table:visibility = 'collapse' or @table:visibility = 'filter')][count(ancestor-or-self::table:table) = $tableLevel] |
+ table:table-header-rows/descendant::table:table-row[not(@table:visibility = 'collapse' or @table:visibility = 'filter')][count(ancestor-or-self::table:table) = $tableLevel] |
+ table:table-row-group/descendant::table:table-row[not(@table:visibility = 'collapse' or @table:visibility = 'filter')][count(ancestor-or-self::table:table) = $tableLevel]" />
+ <!-- As the alignment of a table is by 'align' attribut is deprecated and as the CSS 'float' attribute not well displayed,
+ we do a trick by encapsulating the table with a aligned 'div' element-->
+ <xsl:variable name="table-alignment" select="key('styles', @style:name = current()/@table:style-name)/*/@table:align" />
+ <xsl:choose>
+ <xsl:when test="string-length($table-alignment) != 0">
+ <xsl:element namespace="{$namespace}" name="div">
+ <xsl:attribute name="style">
+ <xsl:choose>
+ <xsl:when test='$table-alignment="left" or $table-alignment="margins"'>
+ <xsl:text>text-align:left</xsl:text>
+ </xsl:when>
+ <xsl:when test='$table-alignment="right"'>
+ <xsl:text>text-align:right</xsl:text>
+ </xsl:when>
+ <xsl:when test='$table-alignment="center"'>
+ <xsl:text>text-align:center</xsl:text>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:call-template name="create-table-element">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="allVisibleTableRows" select="$allVisibleTableRows" />
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="create-table-element">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="allVisibleTableRows" select="$allVisibleTableRows" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <xsl:template name="create-table-element">
+ <xsl:param name="globalData" />
+ <xsl:param name="allVisibleTableRows" />
+
+ <xsl:element namespace="{$namespace}" name="{$tableElement}">
+ <xsl:attribute name="border">0</xsl:attribute>
+ <xsl:attribute name="cellspacing">0</xsl:attribute>
+ <xsl:attribute name="cellpadding">0</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test='name()="table:table"'>
+ <xsl:variable name="value" select="$globalData/all-doc-styles/style[@style:name = current()/@table:style-name]/*/@style:rel-width" />
+ <xsl:if test="$value">
+ <xsl:attribute name="width">
+ <xsl:value-of select="$value" />
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="width">100%</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ <xsl:apply-templates select="@table:style-name">
+ <xsl:with-param name="globalData" select="$globalData" />
+ </xsl:apply-templates>
+
+ <xsl:call-template name="create-column-style-variable">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="allVisibleTableRows" select="$allVisibleTableRows" />
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/filter/source/xslt/odf2xhtml/export/common/table/table_cells.xsl b/filter/source/xslt/odf2xhtml/export/common/table/table_cells.xsl
new file mode 100644
index 000000000000..b5398742a315
--- /dev/null
+++ b/filter/source/xslt/odf2xhtml/export/common/table/table_cells.xsl
@@ -0,0 +1,279 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<!--
+ For further documentation and updates visit http://xml.openoffice.org/odf2xhtml
+-->
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
+ xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0"
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:dom="http://www.w3.org/2001/xml-events"
+ xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
+ xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
+ xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
+ xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
+ xmlns:math="http://www.w3.org/1998/Math/MathML"
+ xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
+ xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
+ xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
+ xmlns:ooo="http://openoffice.org/2004/office"
+ xmlns:oooc="http://openoffice.org/2004/calc"
+ xmlns:ooow="http://openoffice.org/2004/writer"
+ xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
+ xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
+ xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
+ xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
+ xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
+ xmlns:xforms="http://www.w3.org/2002/xforms"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:xt="http://www.jclark.com/xt"
+ xmlns:common="http://exslt.org/common"
+ xmlns:xalan="http://xml.apache.org/xalan"
+ exclude-result-prefixes="chart config dc dom dr3d draw fo form math meta number office ooo oooc ooow script style svg table text xforms xlink xsd xsi xt common xalan">
+
+
+ <!-- *********************************** -->
+ <!-- *** write repeating table cells *** -->
+ <!-- *********************************** -->
+
+
+ <!-- matching cells to give out -> covered table cells are not written out -->
+ <xsl:template match="table:table-cell">
+ <xsl:param name="globalData" />
+ <!-- position of the current input cell to get the correct colum style (hidden are also counted)-->
+ <xsl:param name="allTableColumns" />
+ <xsl:param name="maxRowLength" />
+ <xsl:param name="tableDataType" />
+
+
+ <!-- The column position of the current cell has to be determined
+ to get the adequate column styles during later cell creation,
+ or hiding the cell when @table:visibility is not set to 'visible'.
+
+ The position is archieved by adding up all table:number-columns-repeated of the preceding cells.
+ Step1: creating '$precedingCells/quantity/@table:number-columns-repeated').
+ Step2: sum(xxx:nodeset($precedingCells)/quantity) + 1 -->
+ <xsl:variable name="precedingCells">
+ <xsl:for-each select="preceding-sibling::*">
+ <xsl:choose>
+ <!-- maybe a parser is used, which reads the DTD files (e.g. Xerces),
+ then '1' is the default for 'table:number-columns-repeated' -->
+ <xsl:when test="not(@table:number-columns-repeated and @table:number-columns-repeated > 1)">
+ <xsl:element name="quantity" namespace="">
+ <xsl:text>1</xsl:text>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="quantity" namespace="">
+ <xsl:value-of select="@table:number-columns-repeated" />
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:variable>
+
+
+
+ <xsl:choose>
+ <xsl:when test="function-available('common:node-set')">
+ <xsl:call-template name="create-table-cell">
+ <!-- position of the current input cell to get the correct colum style (hidden are also counted)-->
+ <xsl:with-param name="allTableColumns" select="$allTableColumns" />
+ <xsl:with-param name="maxRowLength" select="$maxRowLength" />
+ <xsl:with-param name="precedingColumns" select="sum(common:node-set($precedingCells)/*)" />
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="tableDataType" select="$tableDataType" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="function-available('xalan:nodeset')">
+ <xsl:call-template name="create-table-cell">
+ <!-- position of the current input cell to get the correct colum style (hidden are also counted)-->
+ <xsl:with-param name="allTableColumns" select="$allTableColumns" />
+ <xsl:with-param name="maxRowLength" select="$maxRowLength" />
+ <xsl:with-param name="precedingColumns" select="sum(xalan:nodeset($precedingCells)/*)" />
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="tableDataType" select="$tableDataType" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="function-available('xt:node-set')">
+ <xsl:call-template name="create-table-cell">
+ <!-- position of the current input cell to get the correct colum style (hidden are also counted)-->
+ <xsl:with-param name="allTableColumns" select="$allTableColumns" />
+ <xsl:with-param name="maxRowLength" select="$maxRowLength" />
+ <xsl:with-param name="precedingColumns" select="sum(xt:node-set($precedingCells)/*)" />
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="tableDataType" select="$tableDataType" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message terminate="yes">ERROR: Function not found: nodeset</xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <!-- current node is a table:table-cell -->
+ <xsl:template name="create-table-cell">
+ <!-- position of the current input cell to get the correct colum style (hidden are also counted)-->
+ <xsl:param name="allTableColumns" />
+ <xsl:param name="globalData" />
+ <xsl:param name="maxRowLength" />
+ <xsl:param name="precedingColumns" select="0" />
+ <xsl:param name="tableDataType" />
+
+ <xsl:variable name="columnPosition" select="$precedingColumns + 1" />
+
+ <xsl:if test="$debugEnabled">
+ <xsl:message>
+ <xsl:text>
+ table:table-cell #</xsl:text>
+ <xsl:value-of select="$columnPosition" />
+ <xsl:text> has been entered with node value: </xsl:text>
+ <xsl:value-of select="." />
+ <xsl:text>
+ table:number-columns-repeated: </xsl:text>
+ <xsl:value-of select="@table:number-columns-repeated" />
+ <xsl:text>
+ maxRowLength: </xsl:text>
+ <xsl:value-of select="$maxRowLength" />
+ </xsl:message>
+ </xsl:if>
+
+ <!-- only non hidden column will be given out -->
+ <xsl:variable name="currentTableColumn" select="$allTableColumns/table:table-column[position() = $columnPosition]" />
+ <xsl:if test="$currentTableColumn[not(@table:visibility = 'collapse' or @table:visibility = 'filter')]">
+ <xsl:choose>
+ <!-- if parser reads DTD the default is set to '1' -->
+ <xsl:when test="@table:number-columns-repeated > 1">
+ <!-- writes multiple entries of a cell -->
+ <xsl:call-template name="repeat-write-cell">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="allTableColumns" select="$allTableColumns" />
+ <xsl:with-param name="columnPosition" select="$columnPosition" />
+ <xsl:with-param name="currentTableColumn" select="$currentTableColumn" />
+ <xsl:with-param name="maxRowLength" select="$maxRowLength" />
+ <xsl:with-param name="numberColumnsRepeated" select="@table:number-columns-repeated" />
+ <xsl:with-param name="tableDataType" select="$tableDataType" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- writes an entry of a cell -->
+ <xsl:call-template name="write-cell">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="allTableColumns" select="$allTableColumns" />
+ <xsl:with-param name="columnPosition" select="$columnPosition" />
+ <xsl:with-param name="currentTableColumn" select="$currentTableColumn" />
+ <xsl:with-param name="maxRowLength" select="$maxRowLength" />
+ <xsl:with-param name="tableDataType" select="$tableDataType" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:template>
+
+
+ <xsl:template name="repeat-write-cell">
+ <xsl:param name="globalData" />
+ <xsl:param name="allTableColumns" />
+ <xsl:param name="columnPosition" />
+ <xsl:param name="currentTableColumn" />
+ <xsl:param name="maxRowLength" />
+ <xsl:param name="numberColumnsRepeated" />
+ <xsl:param name="tableDataType" />
+
+ <xsl:choose>
+ <!-- This is the current workaround for the flood of cells, simulation background by repeating cell -->
+ <xsl:when test="$numberColumnsRepeated > 1 and $maxRowLength > $columnPosition">
+
+ <!-- writes an entry of a cell -->
+ <xsl:call-template name="write-cell">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="allTableColumns" select="$allTableColumns" />
+ <xsl:with-param name="columnPosition" select="$columnPosition" />
+ <xsl:with-param name="currentTableColumn" select="$currentTableColumn" />
+ <xsl:with-param name="tableDataType" select="$tableDataType" />
+ </xsl:call-template>
+ <!-- repeat calling this method until all elements written out -->
+ <xsl:if test="$debugEnabled">
+ <xsl:message>+++++++++ cell repetition +++++++++</xsl:message>
+ </xsl:if>
+ <xsl:call-template name="repeat-write-cell">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="allTableColumns" select="$allTableColumns" />
+ <xsl:with-param name="columnPosition" select="$columnPosition + 1" />
+ <xsl:with-param name="currentTableColumn" select="$allTableColumns/table:table-column[position() = ($columnPosition + 1)]" />
+ <xsl:with-param name="maxRowLength" select="$maxRowLength" />
+ <xsl:with-param name="numberColumnsRepeated" select="$numberColumnsRepeated - 1" />
+ <xsl:with-param name="tableDataType" select="$tableDataType" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- This is the current workaround for the flood of cells, simulation background by repeating cell -->
+ <!-- When the maxRowLength is reached a last entry of a cell is written -->
+ <xsl:call-template name="write-cell">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="allTableColumns" select="$allTableColumns" />
+ <xsl:with-param name="columnPosition" select="$columnPosition" />
+ <xsl:with-param name="currentTableColumn" select="$currentTableColumn" />
+ <xsl:with-param name="tableDataType" select="$tableDataType" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <xsl:template name="write-cell">
+ <xsl:param name="globalData" />
+ <xsl:param name="allTableColumns" />
+ <xsl:param name="columnPosition" />
+ <xsl:param name="currentTableColumn" />
+ <xsl:param name="tableDataType" />
+
+ <!-- a non hidden column will be give out -->
+ <xsl:choose>
+ <xsl:when test="$currentTableColumn[not(@table:visibility = 'collapse' or @table:visibility = 'filter')]">
+ <xsl:call-template name="create-table-cell-content">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="allTableColumns" select="$allTableColumns" />
+ <xsl:with-param name="columnPosition" select="$columnPosition" />
+ <xsl:with-param name="currentTableColumn" select="$currentTableColumn" />
+ <xsl:with-param name="tableDataType" select="$tableDataType" />
+ </xsl:call-template>
+ </xsl:when>
+ <!-- a hidden column -->
+ <xsl:otherwise>
+ <xsl:if test="$debugEnabled">
+ <xsl:message>table column is hidden!</xsl:message>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/filter/source/xslt/odf2xhtml/export/common/table/table_columns.xsl b/filter/source/xslt/odf2xhtml/export/common/table/table_columns.xsl
new file mode 100644
index 000000000000..ee578e158a63
--- /dev/null
+++ b/filter/source/xslt/odf2xhtml/export/common/table/table_columns.xsl
@@ -0,0 +1,243 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<!--
+ For further documentation and updates visit http://xml.openoffice.org/odf2xhtml
+-->
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
+ xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0"
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:dom="http://www.w3.org/2001/xml-events"
+ xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
+ xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
+ xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
+ xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
+ xmlns:math="http://www.w3.org/1998/Math/MathML"
+ xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
+ xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
+ xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
+ xmlns:ooo="http://openoffice.org/2004/office"
+ xmlns:oooc="http://openoffice.org/2004/calc"
+ xmlns:ooow="http://openoffice.org/2004/writer"
+ xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
+ xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
+ xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
+ xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
+ xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
+ xmlns:xforms="http://www.w3.org/2002/xforms"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:xt="http://www.jclark.com/xt"
+ xmlns:common="http://exslt.org/common"
+ xmlns:xalan="http://xml.apache.org/xalan"
+ exclude-result-prefixes="chart config dc dom dr3d draw fo form math meta number office ooo oooc ooow script style svg table text xforms xlink xsd xsi xt common xalan">
+
+ <xsl:param name="tableColumnElement" select="'col'" />
+
+ <!-- ******************************************** -->
+ <!-- *** Create table columns style variable *** -->
+ <!-- ******************************************** -->
+
+ <!-- current node is a table:table -->
+ <xsl:template name="create-column-style-variable">
+ <xsl:param name="globalData" />
+ <xsl:param name="allVisibleTableRows" />
+
+ <!-- all columns of the table -->
+ <xsl:variable name="allTableColumns" select="table:table-column |
+ table:table-column-group/descendant::table:table-column |
+ table:table-header-columns/descendant::table:table-column" />
+ <!-- allTableColumns: Containing all columns of the table, hidden and viewed.
+ - if a column is hidden, if table:visibility has the value 'collapse' or 'filter', otherwise the value is 'visible'
+ - if a column is being repeated, each repeated column is explicitly written as entry in this variable.
+ Later (during template "write-cell") the style of the column will be mixed with the cell-style by using
+ the position() of the column entry and comparing it with the iterating cell number. -->
+ <xsl:variable name="allTableColumns-RTF">
+ <xsl:for-each select="$allTableColumns">
+ <xsl:call-template name="adding-column-styles-entries">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="allTableColumns" select="$allTableColumns" />
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:variable>
+
+ <xsl:choose>
+ <xsl:when test="function-available('common:node-set')">
+ <xsl:call-template name="create-table-children">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="allVisibleTableRows" select="$allVisibleTableRows" />
+ <xsl:with-param name="allTableColumns" select="common:node-set($allTableColumns-RTF)" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="function-available('xalan:nodeset')">
+ <xsl:call-template name="create-table-children">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="allVisibleTableRows" select="$allVisibleTableRows" />
+ <xsl:with-param name="allTableColumns" select="xalan:nodeset($allTableColumns-RTF)" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="function-available('xt:node-set')">
+ <xsl:call-template name="create-table-children">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="allVisibleTableRows" select="$allVisibleTableRows" />
+ <xsl:with-param name="allTableColumns" select="xt:node-set($allTableColumns-RTF)" />
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- current node is a table:table -->
+ <xsl:template name="create-table-children">
+ <xsl:param name="globalData" />
+ <xsl:param name="allVisibleTableRows" />
+ <xsl:param name="allTableColumns" />
+
+
+ <xsl:for-each select="$allTableColumns/table:table-column">
+ <xsl:if test="not(@table:visibility = 'collapse' or @table:visibility = 'filter')">
+
+ <xsl:call-template name="create-column-element">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="allVisibleTableRows" select="$allVisibleTableRows" />
+ <xsl:with-param name="allTableColumns" select="$allTableColumns" />
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:for-each>
+
+ <xsl:call-template name="create-table-rows">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="allVisibleTableRows" select="$allVisibleTableRows" />
+ <xsl:with-param name="allTableColumns" select="$allTableColumns" />
+ </xsl:call-template>
+ </xsl:template>
+
+ <!-- To be OVERWRITTEN -->
+ <xsl:template name="create-column-element" />
+
+ <!-- current node is a table:table-column -->
+ <xsl:template name="adding-column-styles-entries">
+ <xsl:param name="globalData" />
+ <xsl:param name="allTableColumns" />
+
+ <xsl:choose>
+ <!-- if parser reads DTD the default is set to '1' -->
+ <xsl:when test="not(@table:number-columns-repeated and @table:number-columns-repeated > 1)">
+ <!-- writes an entry of a column in the columns-variable -->
+ <xsl:copy-of select="." />
+ </xsl:when>
+ <!-- No higher repetition of cells greater than 99 for the last and second last column.
+ This is a workaround for some sample document (Waehrungsumrechner.sxc),
+ having 230 repeated columns in the second last column to emulate background -->
+ <!-- NOTE: Testcase with a table containing table:table-column-group and/or table:table-header-columns -->
+ <xsl:when test="(last() or (last() - 1)) and @table:number-columns-repeated &gt; 99">
+ <!-- writes an entry of a column in the columns-variable -->
+ <xsl:call-template name="repeat-adding-table-column">
+ <xsl:with-param name="numberColumnsRepeated" select="1" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- repeated colums will be written explicit several times in the variable-->
+ <xsl:call-template name="repeat-adding-table-column">
+ <xsl:with-param name="numberColumnsRepeated" select="@table:number-columns-repeated" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <!-- WRITES THE REPEATED COLUMN STYLE EXPLICIT AS AN ELEMENT IN THE COLUMNS-VARIABLE -->
+ <!-- current node is a table:table-column -->
+ <xsl:template name="repeat-adding-table-column">
+ <xsl:param name="table:table-column" />
+ <xsl:param name="numberColumnsRepeated" />
+
+
+ <xsl:choose>
+ <xsl:when test="$numberColumnsRepeated > 1">
+ <!-- writes an entry of a column in the columns-variable -->
+ <xsl:copy-of select="." />
+ <!-- repeat calling this method until all elements written out -->
+ <xsl:call-template name="repeat-adding-table-column">
+ <xsl:with-param name="numberColumnsRepeated" select="$numberColumnsRepeated - 1" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- writes an entry of a column in the columns-variable -->
+ <xsl:copy-of select="." />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <!--debugEnabled-START-->
+ <!-- giving out the 'allColumnStyle' variable:
+ For each 'table:table-column' of the 'allTableColumns' variable the style-name is given out.
+ In case of 'column-hidden-flag' attribute the text 'Column is hidden is given out.-->
+ <!-- current node is a table:table -->
+ <xsl:template name="table-debug-allTableColumns">
+ <xsl:param name="allTableColumns" />
+
+ <!-- debug output as table summary attribut in html -->
+ <xsl:attribute name="summary">
+ <xsl:call-template name="table-debug-column-out">
+ <xsl:with-param name="allTableColumns" select="$allTableColumns" />
+ </xsl:call-template>
+ </xsl:attribute>
+ <!-- debug output to console -->
+ <xsl:message>
+ <xsl:call-template name="table-debug-column-out">
+ <xsl:with-param name="allTableColumns" select="$allTableColumns" />
+ </xsl:call-template>
+ </xsl:message>
+ </xsl:template>
+
+ <!-- current node is a table:table -->
+ <xsl:template name="table-debug-column-out">
+ <xsl:param name="allTableColumns" />
+ <xsl:text>
+ DebugInformation: For each 'table:table-column' of the 'allTableColumns' variable the style-name is given out.
+ In case of table:visibility attribute unequal 'visible' the 'column is hidden' no text is given out.
+ </xsl:text>
+ <xsl:for-each select="$allTableColumns/table:table-column">
+ <xsl:choose>
+ <xsl:when test="@table:visibility = 'collapse' or @table:visibility = 'filter' ">
+ <xsl:text> </xsl:text><xsl:value-of select="@table:style-name" /><xsl:text>column is hidden</xsl:text><xsl:text>
+ </xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text> </xsl:text><xsl:value-of select="@table:style-name" /><xsl:text> </xsl:text><xsl:value-of select="@table:default-cell-style-name" /><xsl:text>
+ </xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:template>
+ <!--debugEnabled-END-->
+
+</xsl:stylesheet>
diff --git a/filter/source/xslt/odf2xhtml/export/common/table/table_rows.xsl b/filter/source/xslt/odf2xhtml/export/common/table/table_rows.xsl
new file mode 100644
index 000000000000..1cf51362b1b5
--- /dev/null
+++ b/filter/source/xslt/odf2xhtml/export/common/table/table_rows.xsl
@@ -0,0 +1,212 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<!--
+ For further documentation and updates visit http://xml.openoffice.org/odf2xhtml
+-->
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
+ xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0"
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:dom="http://www.w3.org/2001/xml-events"
+ xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
+ xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
+ xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
+ xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
+ xmlns:math="http://www.w3.org/1998/Math/MathML"
+ xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
+ xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
+ xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
+ xmlns:ooo="http://openoffice.org/2004/office"
+ xmlns:oooc="http://openoffice.org/2004/calc"
+ xmlns:ooow="http://openoffice.org/2004/writer"
+ xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
+ xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
+ xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
+ xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
+ xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
+ xmlns:xforms="http://www.w3.org/2002/xforms"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ exclude-result-prefixes="chart config dc dom dr3d draw fo form math meta number office ooo oooc ooow script style svg table text xforms xlink xsd xsi">
+
+
+ <xsl:param name="rowElement" select="'tr'" />
+
+ <!-- ********************************** -->
+ <!-- *** write repeating table rows *** -->
+ <!-- ********************************** -->
+
+ <!-- current node is a table:table -->
+ <xsl:template name="create-table-rows">
+ <xsl:param name="globalData" />
+ <xsl:param name="allVisibleTableRows" />
+ <xsl:param name="allTableColumns" />
+
+ <!-- Some Office Calc documents simulate a background by repeating one of the later cells until end of used space
+ (The value of "table:number-columns-repeated" is enourmous). Writing out all these cells would be fatal in time
+ and output size. Therefore, this global variable shows us the longest row with content. -->
+ <xsl:variable name="maxRowLength" select="count($allTableColumns/table:table-column)" />
+ <xsl:if test="$debugEnabled">
+ <xsl:message>maxRowLength: <xsl:value-of select="$maxRowLength" /></xsl:message>
+ <xsl:call-template name="table-debug-allTableColumns">
+ <xsl:with-param name="allTableColumns" select="$allTableColumns" />
+ </xsl:call-template>
+ </xsl:if>
+
+ <!-- a table is a table header, when it has a "table:table-header-rows" ancestor -->
+ <xsl:variable name="tableDataType">
+ <xsl:choose>
+ <xsl:when test="ancestor::table:table-header-rows">
+ <xsl:text>th</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>td</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <!-- removes repetition of rows, most probably done for background emulating -->
+ <xsl:for-each select="$allVisibleTableRows">
+ <xsl:choose>
+ <xsl:when test="(last() or (last() - 1)) and @table:number-rows-repeated &gt; 99">
+ <xsl:call-template name="repeat-write-row">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="allTableColumns" select="$allTableColumns" />
+ <xsl:with-param name="numberRowsRepeated" select="1" />
+ <xsl:with-param name="maxRowLength" select="$maxRowLength" />
+ <xsl:with-param name="tableDataType" select="$tableDataType" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="repeat-write-row">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="allTableColumns" select="$allTableColumns" />
+ <xsl:with-param name="numberRowsRepeated" select="@table:number-rows-repeated" />
+ <xsl:with-param name="maxRowLength" select="$maxRowLength" />
+ <xsl:with-param name="tableDataType" select="$tableDataType" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:template>
+
+
+ <xsl:template name="repeat-write-row">
+ <xsl:param name="globalData" />
+ <xsl:param name="allTableColumns" />
+ <xsl:param name="numberRowsRepeated" select="1" />
+ <xsl:param name="maxRowLength" />
+ <xsl:param name="tableDataType" />
+
+ <xsl:choose>
+ <!-- write an entry of a row and repeat calling this method until all elements are written out -->
+ <xsl:when test="$numberRowsRepeated > 1 and table:table-cell">
+ <xsl:call-template name="write-row">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="allTableColumns" select="$allTableColumns" />
+ <xsl:with-param name="maxRowLength" select="$maxRowLength" />
+ <xsl:with-param name="tableDataType" select="$tableDataType" />
+ </xsl:call-template>
+
+ <!-- NOTE: take variable from the output of repeated write-row and iterate giving out the variable -->
+ <xsl:call-template name="repeat-write-row">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="allTableColumns" select="$allTableColumns" />
+ <xsl:with-param name="maxRowLength" select="$maxRowLength" />
+ <xsl:with-param name="numberRowsRepeated" select="$numberRowsRepeated - 1" />
+ <xsl:with-param name="tableDataType" select="$tableDataType" />
+ </xsl:call-template>
+ </xsl:when>
+ <!-- write a single entry of a row -->
+ <xsl:otherwise>
+ <xsl:call-template name="write-row">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="allTableColumns" select="$allTableColumns" />
+ <xsl:with-param name="maxRowLength" select="$maxRowLength" />
+ <xsl:with-param name="tableDataType" select="$tableDataType" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <xsl:template name="add-table-row-attributes">
+ <xsl:param name="globalData" />
+
+ <!-- writing the style of the row -->
+ <xsl:if test="@table:style-name">
+ <xsl:call-template name='add-style-properties'>
+ <xsl:with-param name="globalData" select="$globalData" />
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template name="write-row">
+ <xsl:param name="globalData" />
+ <xsl:param name="allTableColumns" />
+ <xsl:param name="maxRowLength" />
+ <xsl:param name="tableDataType" />
+
+
+ <xsl:element namespace="{$namespace}" name="{$rowElement}">
+ <xsl:call-template name='add-table-row-attributes'>
+ <xsl:with-param name="globalData" select="$globalData" />
+ </xsl:call-template>
+
+ <xsl:if test="$debugEnabled">
+ <xsl:message>'tr' element has been added!</xsl:message>
+ </xsl:if>
+
+ <xsl:apply-templates select="table:table-cell">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="allTableColumns" select="$allTableColumns" />
+ <xsl:with-param name="maxRowLength" select="$maxRowLength" />
+ <xsl:with-param name="tableDataType" select="$tableDataType" />
+ </xsl:apply-templates>
+
+ </xsl:element>
+ </xsl:template>
+
+
+ <!-- **************************** -->
+ <!-- *** HELPER: table styles *** -->
+ <!-- **************************** -->
+
+ <xsl:template name="add-style-properties">
+ <xsl:param name="globalData" />
+ <xsl:param name="allTableColumns" />
+ <xsl:param name="node-position" />
+
+ <xsl:attribute name="class">
+ <xsl:value-of select="translate(@table:style-name, '. %()/\+', '')" />
+ </xsl:attribute>
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/filter/source/xslt/odf2xhtml/export/common/table_of_content.xsl b/filter/source/xslt/odf2xhtml/export/common/table_of_content.xsl
new file mode 100644
index 000000000000..5934e2e3a87e
--- /dev/null
+++ b/filter/source/xslt/odf2xhtml/export/common/table_of_content.xsl
@@ -0,0 +1,554 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<!--
+ For further documentation and updates visit http://xml.openoffice.org/odf2xhtml
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:java="http://xml.apache.org/xslt/java" xmlns:sxg="http://www.jclark.com/xt/java/org.openoffice.xslt.OOoMasterDocument" xmlns:common="http://exslt.org/common" xmlns:xt="http://www.jclark.com/xt" xmlns:xalan="http://xml.apache.org/xalan" exclude-result-prefixes="chart config dc dom dr3d draw fo form math meta number office ooo oooc ooow script style svg table text xforms xlink xsd xsi java sxg xt common xalan">
+
+ <!-- ****************************** -->
+ <!-- *** Table of Content *** -->
+ <!-- ****************************** -->
+
+ <xsl:param name="currentChildContentRef" />
+ <xsl:param name="contentTableHeadings" />
+ <xsl:param name="contentTableURL" />
+ <xsl:template match="text:table-of-content">
+ <xsl:param name="globalData"/>
+
+ <xsl:apply-templates>
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:template>
+
+
+ <xsl:template match="text:index-body">
+ <xsl:param name="globalData"/>
+
+ <xsl:choose>
+ <xsl:when test="*/text:tab[1] or */*/text:tab[1]">
+ <xsl:call-template name="createIndexBodyTable">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates>
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="text:index-title" mode="content-table">
+ <xsl:param name="globalData"/>
+
+ <xsl:apply-templates>
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:template>
+
+ <xsl:template name="createIndexBodyTable">
+ <xsl:param name="globalData"/>
+ <xsl:variable name="allStyleTabStops-RTF">
+ <xsl:element name="style:tab-stops">
+ <xsl:call-template name="get-tab-stops">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="styleName" select="current()/@text:style-name"/>
+
+ <!--
+ Currently only the style of text:index-body is recognized, but not of a paragraph child containing the text:tab element!
+ <xsl:with-param name="styleName" select="descendant-or-self::*/@text:style-name"/>
+
+ The column width needs to be tabstop plus fo:margin-left paragraph-properties
+ -->
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:variable>
+ <xsl:element namespace="{$namespace}" name="table">
+
+ <xsl:attribute name="border">0</xsl:attribute>
+ <xsl:attribute name="cellspacing">0</xsl:attribute>
+ <xsl:attribute name="cellpadding">0</xsl:attribute>
+ <xsl:if test="parent::*/@text:style-name">
+ <!-- parent as index:body has no style -->
+ <xsl:variable name="value" select="$globalData/all-doc-styles/style[@style:name = current()/parent::*/@text:style-name]/*/@style:rel-width"/>
+ <xsl:if test="$value">
+ <xsl:attribute name="width">
+ <xsl:value-of select="$value"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="class">
+ <xsl:value-of select="translate(parent::*/@text:style-name, '.,;: %()[]/\+', '_____________')"/>
+ </xsl:attribute>
+ </xsl:if>
+
+ <xsl:element namespace="{$namespace}" name="colgroup">
+ <xsl:choose>
+ <xsl:when test="function-available('common:node-set')">
+ <xsl:call-template name="create-col-element">
+ <xsl:with-param name="lastNodePosition" select="count(common:node-set($allStyleTabStops-RTF)/style:tab-stops/style:tab-stop)"/>
+ <xsl:with-param name="allStyleTabStops" select="common:node-set($allStyleTabStops-RTF)"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="function-available('xalan:nodeset')">
+ <xsl:call-template name="create-col-element">
+ <xsl:with-param name="lastNodePosition" select="count(xalan:nodeset($allStyleTabStops-RTF)/style:tab-stops/style:tab-stop)"/>
+ <xsl:with-param name="allStyleTabStops" select="xalan:nodeset($allStyleTabStops-RTF)"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="function-available('xt:node-set')">
+ <xsl:call-template name="create-col-element">
+ <xsl:with-param name="lastNodePosition" select="count(xt:node-set($allStyleTabStops-RTF)/style:tab-stops/style:tab-stop)"/>
+ <xsl:with-param name="allStyleTabStops" select="xt:node-set($allStyleTabStops-RTF)"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message terminate="yes">ERROR: Function not found: nodeset</xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+
+ <!-- add table data -->
+ <xsl:choose>
+ <xsl:when test="function-available('common:node-set')">
+ <xsl:apply-templates mode="content-table">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="allStyleTabStops" select="common:node-set($allStyleTabStops-RTF)"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:when test="function-available('xalan:nodeset')">
+ <xsl:apply-templates mode="content-table">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="allStyleTabStops" select="xalan:nodeset($allStyleTabStops-RTF)"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:when test="function-available('xt:node-set')">
+ <xsl:apply-templates mode="content-table">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="allStyleTabStops" select="xt:node-set($allStyleTabStops-RTF)"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message terminate="yes">ERROR: Function not found: nodeset</xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ </xsl:element>
+ </xsl:template>
+
+
+ <!-- ************************************************ -->
+ <!-- *** Create Table for Content Table Paragraph *** -->
+ <!-- ************************************************ -->
+
+ <!-- Usually the paragraph in a content-table are ordered by tab-stops, which can not be displayed correctly by XHTML/CSS
+ Therefore they will be simulated by a table -->
+ <xsl:template match="text:p" mode="content-table">
+ <xsl:param name="globalData"/>
+ <xsl:param name="allStyleTabStops"/>
+
+ <!-- all elements before the first tabStop -->
+ <xsl:variable name="testNo-RTF">
+ <xsl:apply-templates select="node()" mode="cell-content"/>
+ </xsl:variable>
+
+ <xsl:choose>
+ <xsl:when test="function-available('common:node-set')">
+ <xsl:variable name="tabNodePositions" select="common:node-set($testNo-RTF)"/>
+ <xsl:element namespace="{$namespace}" name="tr">
+ <xsl:call-template name="create-td-elements">
+ <xsl:with-param name="lastNodePosition" select="count($allStyleTabStops/style:tab-stops/style:tab-stop)"/>
+ <xsl:with-param name="position" select="1"/>
+ <xsl:with-param name="allStyleTabStops" select="$allStyleTabStops"/>
+ <xsl:with-param name="tabNodePositions" select="$tabNodePositions"/>
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="function-available('xalan:nodeset')">
+ <xsl:variable name="tabNodePositions" select="xalan:nodeset($testNo-RTF)"/>
+ <xsl:element namespace="{$namespace}" name="tr">
+ <xsl:call-template name="create-td-elements">
+ <xsl:with-param name="lastNodePosition" select="count($allStyleTabStops/style:tab-stops/style:tab-stop)"/>
+ <xsl:with-param name="position" select="1"/>
+ <xsl:with-param name="allStyleTabStops" select="$allStyleTabStops"/>
+ <xsl:with-param name="tabNodePositions" select="$tabNodePositions"/>
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="function-available('xt:node-set')">
+ <xsl:variable name="tabNodePositions" select="xt:node-set($testNo-RTF)"/>
+ <xsl:element namespace="{$namespace}" name="tr">
+ <xsl:call-template name="create-td-elements">
+ <xsl:with-param name="lastNodePosition" select="count($allStyleTabStops/style:tab-stops/style:tab-stop)"/>
+ <xsl:with-param name="position" select="1"/>
+ <xsl:with-param name="allStyleTabStops" select="$allStyleTabStops"/>
+ <xsl:with-param name="tabNodePositions" select="$tabNodePositions"/>
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message terminate="yes">ERROR: Function not found: nodeset</xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- Gathering all style:tab-stops from a style-hierarchy as siblings -->
+ <xsl:template name="get-tab-stops">
+ <xsl:param name="globalData"/>
+ <xsl:param name="styleName"/>
+ <xsl:variable name="tabStyle" select="key('styles', $styleName)"/>
+
+ <xsl:if test="$tabStyle/*/style:tab-stops/style:tab-stop/@style:position">
+ <xsl:for-each select="$tabStyle/*/style:tab-stops/style:tab-stop">
+ <xsl:copy-of select="."/>
+ </xsl:for-each>
+ </xsl:if>
+
+ <xsl:if test="$tabStyle/@style:parent-style-name">
+ <xsl:call-template name="get-tab-stops">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="styleName" select="$tabStyle/@style:parent-style-name"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template name="create-col-element">
+ <xsl:param name="lastNodePosition"/>
+ <xsl:param name="allStyleTabStops"/>
+
+ <xsl:for-each select="$allStyleTabStops/style:tab-stops/style:tab-stop">
+ <xsl:element namespace="{$namespace}" name="col">
+ <xsl:attribute name="style">
+ <xsl:text>width: </xsl:text>
+ <xsl:choose>
+ <xsl:when test="contains(@style:position, 'cm')">
+ <xsl:call-template name="create-cell-width">
+ <xsl:with-param name="width" select="number(substring-before(@style:position,'cm'))"/>
+ <xsl:with-param name="unit" select="'cm'"/>
+ <xsl:with-param name="position" select="position() - 1"/>
+ <xsl:with-param name="allStyleTabStops" select="$allStyleTabStops"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="contains(@style:position, 'in')">
+ <xsl:call-template name="create-cell-width">
+ <xsl:with-param name="width" select="number(substring-before(@style:position,'in'))"/>
+ <xsl:with-param name="unit" select="'in'"/>
+ <xsl:with-param name="position" select="position() - 1"/>
+ <xsl:with-param name="allStyleTabStops" select="$allStyleTabStops"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="contains(@style:position, 'ch')">
+ <xsl:call-template name="create-cell-width">
+ <xsl:with-param name="width" select="number(substring-before(@style:position,'ch'))"/>
+ <xsl:with-param name="unit" select="'ch'"/>
+ <xsl:with-param name="position" select="position() - 1"/>
+ <xsl:with-param name="allStyleTabStops" select="$allStyleTabStops"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="contains(@style:position, 'pt')">
+ <xsl:call-template name="create-cell-width">
+ <xsl:with-param name="width" select="number(substring-before(@style:position,'pt'))"/>
+ <xsl:with-param name="unit" select="'pt'"/>
+ <xsl:with-param name="position" select="position() - 1"/>
+ <xsl:with-param name="allStyleTabStops" select="$allStyleTabStops"/>
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:for-each>
+
+ </xsl:template>
+<!--
+Scenarios tabstops
+
+1) style:type of style:tab-stop is 'right' and earlier tabStop is not right
+ -> Earlier text-nodes and following text-nodes, will be put into an inner table, with two TD first aligned left, with proceding textnodes, the latter aligned right.
+
+2) style:type is 'right' and earlier tabStop is right
+ -> following text-nodes, will be put into a right aligned TD
+
+3) style:type is 'non-right' and earlier tabStop 'non-right' as well
+ -> put the preceding tab stops into a TD (left aligned is default)
+
+4) first style:type would have no right preceding tabStop
+ -> works well with first sceanrios 1 and 3
+
+5) last style:type would be a special case, if it would be left aligned, but this won't happen in our case.. :D
+
+Scenarios unmatched:
+- text:styleposition 'center' will not be matched in our case (effort for nothing), there will be only 'right' and not 'right'
+- If the last tabStop is not from text:stylepostion 'right', the length of the last cell is undefined and a document length must be found.
+ Not happens in our master document case. Also the algorithm below would have to be expanded (cp. scenario 5).
+
+-->
+ <xsl:template name="create-td-elements">
+ <xsl:param name="globalData"/>
+ <xsl:param name="lastNodePosition"/>
+ <xsl:param name="position"/>
+ <xsl:param name="allStyleTabStops"/>
+ <xsl:param name="tabNodePositions"/>
+
+ <xsl:variable name="currentTabStop" select="$allStyleTabStops/style:tab-stops/style:tab-stop[$position]"/>
+ <xsl:variable name="earlierTabStop" select="$allStyleTabStops/style:tab-stops/style:tab-stop[$position - 1]"/>
+ <xsl:choose>
+ <xsl:when test="not($currentTabStop/@style:position) and not($earlierTabStop/@style:position)">
+ <!-- in case no TAB STOP is being set -->
+ <xsl:element namespace="{$namespace}" name="td">
+ <xsl:element namespace="{$namespace}" name="p">
+ <xsl:if test="$position = 1">
+ <xsl:attribute name="class">
+ <xsl:value-of select="translate(@text:style-name, '.,;: %()[]/\+', '_____________')"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates mode="content-table">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:element>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="$currentTabStop/@style:type = 'right'">
+ <xsl:choose>
+ <xsl:when test="$earlierTabStop/@style:type = 'right'">
+ <!--
+ 2) style:type is 'right' and earlier tabStop is right
+ -> following text-nodes, will be put into a right aligned TD -->
+ <xsl:element namespace="{$namespace}" name="td">
+ <xsl:attribute name="style">
+ <xsl:text>align: right</xsl:text>
+ </xsl:attribute>
+ <xsl:element namespace="{$namespace}" name="p">
+ <xsl:if test="$position = 1">
+ <xsl:attribute name="class">
+ <xsl:value-of select="translate(@text:style-name, '.,;: %()[]/\+', '_____________')"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:call-template name="grab-cell-content-before-tab-stop">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="endingTabStopPosition" select="$position + 1"/>
+ <xsl:with-param name="lastNodePosition" select="$lastNodePosition"/>
+ <xsl:with-param name="tabNodePositions" select="$tabNodePositions"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element namespace="{$namespace}" name="td">
+ <xsl:element namespace="{$namespace}" name="p">
+ <xsl:if test="$position = 1">
+ <xsl:attribute name="class">
+ <xsl:value-of select="translate(@text:style-name, '.,;: %()[]/\+', '_____________')"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:call-template name="grab-cell-content-before-tab-stop">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="endingTabStopPosition" select="$position"/>
+ <xsl:with-param name="lastNodePosition" select="$lastNodePosition"/>
+ <xsl:with-param name="tabNodePositions" select="$tabNodePositions"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="$earlierTabStop/@style:type = 'right'"></xsl:when>
+ <xsl:otherwise>
+ <!--
+ 3) style:type is 'non-right' and earlier tabStop 'non-right' as well
+ -> put the preceding tab stops into a TD (left aligned is default) -->
+ <xsl:element namespace="{$namespace}" name="p">
+ <xsl:if test="$position = 1">
+ <xsl:attribute name="class">
+ <xsl:value-of select="translate(@text:style-name, '.,;: %()[]/\+', '_____________')"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:element namespace="{$namespace}" name="td">
+ <xsl:call-template name="grab-cell-content-before-tab-stop">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="endingTabStopPosition" select="$position"/>
+ <xsl:with-param name="lastNodePosition" select="$lastNodePosition"/>
+ <xsl:with-param name="tabNodePositions" select="$tabNodePositions"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ <xsl:if test="$position != $lastNodePosition">
+ <xsl:call-template name="create-td-elements">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="lastNodePosition" select="$lastNodePosition"/>
+ <xsl:with-param name="position" select="$position + 1"/>
+ <xsl:with-param name="allStyleTabStops" select="$allStyleTabStops"/>
+ <xsl:with-param name="tabNodePositions" select="$tabNodePositions"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="grab-cell-content-before-tab-stop">
+ <xsl:param name="globalData"/>
+ <xsl:param name="endingTabStopPosition"/>
+ <xsl:param name="tabNodePositions"/>
+ <xsl:param name="lastNodePosition"/>
+
+ <xsl:choose>
+ <xsl:when test="$endingTabStopPosition = 1">
+ <xsl:apply-templates mode="content-table" select="node()[position() &lt; $tabNodePositions/tab-stop-node-position[$endingTabStopPosition]]">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:when test="$endingTabStopPosition > $lastNodePosition">
+ <xsl:apply-templates mode="content-table" select="node()[position() > $tabNodePositions/tab-stop-node-position[$endingTabStopPosition - 1]]">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="nodesOfNextColumn" select="node()[position() &lt; $tabNodePositions/tab-stop-node-position[$endingTabStopPosition]][position() &gt; $tabNodePositions/tab-stop-node-position[$endingTabStopPosition - 1]]"/>
+ <xsl:choose>
+ <xsl:when test="$nodesOfNextColumn != ''">
+ <xsl:apply-templates mode="content-table" select="$nodesOfNextColumn">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates mode="content-table">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- As the span width will be mapped to column width, the preceding span widths have to be substracted -->
+ <xsl:template name="create-cell-width">
+ <xsl:param name="width"/>
+ <xsl:param name="unit"/>
+ <xsl:param name="position"/>
+ <xsl:param name="allStyleTabStops"/>
+
+ <xsl:choose>
+ <!-- beyond second width -->
+ <xsl:when test="$position > 1">
+ <xsl:call-template name="create-cell-width">
+ <xsl:with-param name="width" select="$width - number(substring-before($allStyleTabStops/style:tab-stops/style:tab-stop[$position]/@style:position,$unit))"/>
+ <xsl:with-param name="unit" select="$unit"/>
+ <xsl:with-param name="position" select="$position - 1"/>
+ <xsl:with-param name="allStyleTabStops" select="$allStyleTabStops"/>
+ </xsl:call-template>
+ </xsl:when>
+ <!-- second width -->
+ <xsl:when test="$position = 1">
+ <xsl:value-of select="concat($width - number(substring-before($allStyleTabStops/style:tab-stops/style:tab-stop[$position]/@style:position,$unit)), $unit)"/>
+ </xsl:when>
+ <!-- first width -->
+ <xsl:otherwise>
+ <xsl:value-of select="concat($width, $unit)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <!-- ************************************** -->
+ <!-- CREATION OF A CONTENT TABLE LINK -->
+ <!-- ************************************** -->
+
+
+ <!-- content table link -->
+ <xsl:template match="text:a" mode="content-table">
+ <xsl:param name="globalData"/>
+
+ <xsl:variable name="text">
+ <xsl:choose>
+ <!-- heuristic assumption that first in a content table row, there is numbering (if at all) and than the text,
+ furthermore that a tab will separate the to be neglected page number -->
+ <xsl:when test="text:tab">
+ <xsl:value-of select="text()[1]"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="text()"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <!-- REFERENCE HANDLING - HREF -->
+ <xsl:element namespace="{$namespace}" name="a">
+ <xsl:attribute name="href">
+ <xsl:text>#</xsl:text>
+ <xsl:value-of select='concat("a_", translate(normalize-space($text), "&#xA;&amp;&lt;&gt;.,;: %()[]/\+", "_______________________________"))'/>
+ </xsl:attribute>
+ <xsl:value-of select="$text"/>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="text:s" mode="content-table">
+ <xsl:call-template name="write-breakable-whitespace">
+ <xsl:with-param name="whitespaces" select="@text:c"/>
+ </xsl:call-template>
+ </xsl:template>
+
+ <!-- ******************** -->
+ <!-- *** Common Rules *** -->
+ <!-- ******************** -->
+
+ <xsl:template match="*" mode="content-table">
+ <xsl:param name="globalData"/>
+
+ <xsl:apply-templates select=".">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:template>
+
+ <xsl:template match="*" mode="cell-content">
+ <xsl:if test="name() = 'text:tab' or *[name() = 'text:tab']">
+ <xsl:element name="tab-stop-node-position" namespace="">
+ <xsl:value-of select="position()"/>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template match="text()" mode="content-table">
+ <!-- Heuristic to remove page numbers (useless in HTML) in the content table
+ usually after a tab -->
+ <xsl:if test="name(preceding-sibling::*[1]) != 'text:tab' and not(number() &gt; -1)">
+ <xsl:value-of select="."/>
+ </xsl:if>
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl b/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
new file mode 100644
index 000000000000..6229544cf02f
--- /dev/null
+++ b/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
@@ -0,0 +1,2872 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<!--
+ For further documentation and updates visit http://xml.openoffice.org/odf2xhtml
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xt="http://www.jclark.com/xt" xmlns:common="http://exslt.org/common" xmlns:xalan="http://xml.apache.org/xalan" exclude-result-prefixes="chart config dc dom dr3d draw fo form math meta number office ooo oooc ooow script style svg table text xforms xlink xsd xsi xt common xalan" xmlns="http://www.w3.org/1999/xhtml">
+
+
+ <!--+++++ INCLUDED XSL MODULES +++++-->
+
+ <!-- helper collection, to convert measures (e.g. inch to pixel using DPI (dots per inch) parameter)-->
+ <xsl:import href="../../common/measure_conversion.xsl"/>
+
+ <!-- common office body element handling -->
+ <xsl:import href="../common/body.xsl"/>
+
+ <!-- common table handling -->
+ <xsl:import href="../common/table/table.xsl"/>
+
+ <!-- xhtml table handling -->
+ <xsl:include href="table.xsl"/>
+
+ <!-- Useful in case of 'style:map', conditional formatting, where a style references to another -->
+ <xsl:key name="styles" match="/*/office:styles/style:style | /*/office:automatic-styles/style:style" use="@style:name"/>
+
+
+ <!-- ************ -->
+ <!-- *** body *** -->
+ <!-- ************ -->
+
+ <xsl:key match="style:style/@style:master-page-name" name="masterPage" use="'count'"/>
+ <xsl:key match="style:master-page" name="masterPageElements" use="@style:name"/>
+ <xsl:key match="style:page-layout" name="pageLayoutElements" use="@style:name"/>
+ <xsl:key name="writingModeStyles" match="/*/office:styles/style:style/style:paragraph-properties/@style:writing-mode | /*/office:automatic-styles/style:style/style:paragraph-properties/@style:writing-mode" use="'test'"/>
+ <xsl:template name="create-body">
+ <xsl:param name="globalData"/>
+
+ <!-- approximation to find the correct master page style (with page dimensions) -->
+ <xsl:variable name="masterPageNames">
+ <!-- Loop over every style:style containing a @style:master-page-name attribute -->
+ <xsl:for-each select="key('masterPage','count')">
+ <!-- Check if this style is being used in the body -->
+ <xsl:if test="key('elementUsingStyle', ../@style:name)">
+ <!-- Check every master-page-name if it is not emtpy and return as ';' separated list -->
+ <xsl:if test="string-length(../@style:master-page-name) &gt; 0">
+ <xsl:value-of select="../@style:master-page-name"/>;</xsl:if>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:variable>
+
+ <!-- Take the first of the masterpage list and get the according style:master-page element and find the @style:page-layout-name -->
+ <xsl:variable name="pageLayoutName" select="key('masterPageElements', substring-before($masterPageNames,';'))/@style:page-layout-name"/>
+ <xsl:variable name="pageProperties">
+ <xsl:choose>
+ <xsl:when test="not($pageLayoutName) or $pageLayoutName = ''">
+ <xsl:copy-of select="$globalData/styles-file/*/office:automatic-styles/style:page-layout[1]/style:page-layout-properties"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- Find the according style:page-layout and store the properties in a variable -->
+ <xsl:copy-of select="key('pageLayoutElements', $pageLayoutName)/style:page-layout-properties"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:element name="body">
+ <!-- direction of text flow -->
+ <xsl:variable name="writingMode" select="$pageProperties/style:page-layout-properties/@style:writing-mode"/>
+ <xsl:choose>
+ <xsl:when test="$writingMode">
+ <xsl:choose>
+ <xsl:when test="contains($writingMode, 'lr')">
+ <xsl:attribute name="dir">ltr</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="contains($writingMode, 'rl')">
+ <xsl:attribute name="dir">rtl</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- As CSS writing-mode is not implemented by all browsers, a heuristic is done -->
+ <xsl:variable name="writingMode" select="key('writingModeStyles', 'test')"/>
+ <xsl:if test="contains($writingMode, 'rl')">
+ <xsl:attribute name="dir">rtl</xsl:attribute>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!-- adapt page size -->
+ <xsl:variable name="pageWidth" select="$pageProperties/style:page-layout-properties/@fo:page-width"/>
+
+ <!-- multiple backgroundimages for different page styles (never used in html) -->
+ <xsl:variable name="backgroundImage" select="$pageProperties/style:page-layout-properties/style:background-image"/>
+ <!-- page margins & background image -->
+ <xsl:if test="$pageWidth or $pageProperties/style:page-layout-properties/@fo:* or $backgroundImage/@xlink:href">
+ <xsl:attribute name="style">
+ <xsl:if test="$pageWidth">
+ <xsl:text>max-width:</xsl:text>
+ <xsl:value-of select="$pageWidth"/>
+ <xsl:text>;</xsl:text>
+ </xsl:if>
+ <xsl:if test="$pageProperties/style:page-layout-properties/@fo:* or $backgroundImage/@xlink:href">
+ <xsl:apply-templates select="$pageProperties/style:page-layout-properties/@fo:*"/>
+ <xsl:if test="$backgroundImage/@xlink:href">
+ <xsl:text>background-image:url(</xsl:text>
+ <xsl:call-template name="create-href">
+ <xsl:with-param name="href" select="$backgroundImage/@xlink:href"/>
+ </xsl:call-template>
+ <xsl:text>);</xsl:text>
+
+ <xsl:if test="$backgroundImage/@style:repeat">
+ <xsl:choose>
+ <xsl:when test="$backgroundImage/@style:repeat = 'no-repeat'">
+ <xsl:text>background-repeat:no-repeat;</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>background-repeat:repeat;</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="$backgroundImage/@style:position">
+ <xsl:text>background-position:</xsl:text>
+ <xsl:value-of select="$backgroundImage/@style:position"/>
+ <xsl:text>;</xsl:text>
+ </xsl:if>
+ </xsl:if>
+ </xsl:if>
+ </xsl:attribute>
+ </xsl:if>
+ <!-- processing the content of the OpenDocument content file -->
+ <xsl:apply-templates select="/*/office:body/*">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+
+ </xsl:element>
+ </xsl:template>
+
+ <!-- processing the content of the OpenDocument content file -->
+ <xsl:template match="office:body/*">
+ <xsl:param name="globalData"/>
+
+ <!-- not using of 'apply-styles-and-content' as the content table information migth have been added to 'globalData' variable -->
+ <xsl:apply-templates select="@text:style-name | @draw:style-name | @draw:text-style-name | @table:style-name"><!-- | @presentation:style-name -->
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+
+ <xsl:apply-templates>
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+
+ <!-- writing the footer- and endnotes beyond the body -->
+ <xsl:call-template name="write-text-nodes">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:call-template>
+ </xsl:template>
+
+ <!-- ******************************* -->
+ <!-- *** User Field Declarations *** -->
+ <!-- ******************************* -->
+
+ <xsl:template match="text:user-field-get | text:user-field-input">
+ <xsl:param name="globalData"/>
+
+ <xsl:value-of select="."/>
+ </xsl:template>
+
+ <xsl:template match="text:conditional-text">
+ <xsl:param name="globalData"/>
+
+ <xsl:value-of select="."/>
+ </xsl:template>
+
+ <!-- ODF text fields -->
+ <xsl:template match="text:author-initials | text:author-name | text:chapter | text:character-count | text:creation-date | text:creation-time | text:creator | text:date | text:description | text:editing-cycles | text:editing-duration | text:file-name | text:image-count | text:initial-creator | text:keywords | text:modification-date | text:modification-time | text:object-count | text:page-continuation | text:page-count | text:page-number | text:paragraph-count | text:print-date | text:print-time | text:printed-by | text:sender-city | text:sender-company | text:sender-country | text:sender-email | text:sender-fax | text:sender-firstname | text:sender-initials | text:sender-lastname | text:sender-phone-private | text:sender-phone-work | text:sender-position | text:sender-postal-code | text:sender-state-or-province | text:sender-street | text:sender-title | text:sheet-name | text:subject | text:table-count | text:time | text:title | text:user-defined | text:word-count">
+ <xsl:param name="globalData"/>
+
+ <xsl:element name="span">
+ <xsl:attribute name="title">
+ <xsl:value-of select="local-name()"/>
+ </xsl:attribute>
+ <xsl:apply-templates>
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:element>
+ </xsl:template>
+
+
+
+ <!-- *************** -->
+ <!-- *** Textbox *** -->
+ <!-- *************** -->
+
+ <xsl:template match="draw:text-box">
+ <xsl:param name="globalData"/>
+
+ <xsl:comment>Next 'div' was a 'draw:text-box'.</xsl:comment>
+ <xsl:element name="div">
+ <xsl:variable name="dimension">
+ <xsl:apply-templates select="@fo:min-width"/>
+ <xsl:apply-templates select="@fo:max-width"/>
+ <xsl:apply-templates select="@fo:min-height"/>
+ <xsl:apply-templates select="@fo:max-height"/>
+ </xsl:variable>
+ <xsl:if test="$dimension">
+ <xsl:attribute name="style">
+ <xsl:value-of select="$dimension"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates select="@draw:name">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+
+ <xsl:apply-templates select="node()">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="@fo:min-width">
+ <xsl:text>min-width:</xsl:text>
+ <xsl:value-of select="."/>
+ <xsl:text>;</xsl:text>
+ </xsl:template>
+ <xsl:template match="@fo:max-width">
+ <xsl:text>max-width:</xsl:text>
+ <xsl:value-of select="."/>
+ <xsl:text>;</xsl:text>
+ </xsl:template>
+ <xsl:template match="@fo:min-height">
+ <xsl:text>min-height:</xsl:text>
+ <xsl:value-of select="."/>
+ <xsl:text>;</xsl:text>
+ </xsl:template>
+ <xsl:template match="@fo:max-height">
+ <xsl:text>max-height:</xsl:text>
+ <xsl:value-of select="."/>
+ <xsl:text>;</xsl:text>
+ </xsl:template>
+
+
+ <!-- inline style helper for the 'div' boxes -->
+ <xsl:template name="svg:height">
+ <xsl:text>height:</xsl:text>
+ <xsl:choose>
+ <!-- changing the distance measure: inch to in -->
+ <xsl:when test="contains(@svg:height, 'inch')">
+ <xsl:value-of select="substring-before(@svg:height, 'ch')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="@svg:height"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:text>;</xsl:text>
+ </xsl:template>
+
+ <!-- inline style helper for the 'div' boxes -->
+ <xsl:template name="svg:width">
+ <xsl:text>width:</xsl:text>
+ <xsl:choose>
+ <!-- changing the distance measure: inch to in -->
+ <xsl:when test="contains(@svg:width, 'inch')">
+ <xsl:value-of select="substring-before(@svg:width, 'ch')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="@svg:width"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:text>;</xsl:text>
+ </xsl:template>
+
+
+
+ <!-- ****************** -->
+ <!-- *** Paragraphs *** -->
+ <!-- ****************** -->
+
+ <xsl:template match="text:p | draw:page">
+ <xsl:param name="globalData"/>
+ <!-- The footnote symbol is the prefix for a footnote in the footer -->
+ <xsl:param name="footnotePrefix"/>
+ <!-- 1) In ODF sometimes the followig children are nested
+ <text:p>
+ <draw:frame>
+ <draw:text-box>
+ <text:p>
+ Which results in a paragraphs (the last text:p) having a paragraph as its anchestor.
+ In HTML a 'p' can only have inline documents (no other 'p' as children'),
+ a 'div' will be given for the ancestors instead.
+ 2) ODF images are embedded in a paragraph, but CSS is not able to express a horizontal alignment for an HTML image (text:align is only valid for block elements).
+ A surrounding 'div' element taking over the image style solves that problem, but the div is invalid as child of a paragraph
+ Therefore the paragraph has to be exchanged with a HTML div element
+ -->
+ <!-- 2DO page alignment fix - PART1 -->
+ <xsl:variable name="childText"><xsl:apply-templates mode="getAllTextChildren"/></xsl:variable>
+ <xsl:choose>
+ <xsl:when test="name() = 'text:p' and not(*) and (normalize-space($childText) = '')">
+ <!-- WorkAround: Test if the empty paragraph was added after an image, which OOO often does -->
+ <xsl:variable name="isFollowingImage">
+ <xsl:call-template name="follows-empty-paragraphs-and-image">
+ <xsl:with-param name="precedingElement" select="preceding-sibling::node()[1]"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="$isFollowingImage = 'no'">
+ <xsl:call-template name="create-paragraph">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="footnotePrefix" select="$footnotePrefix" />
+ </xsl:call-template>
+ </xsl:if>
+
+ </xsl:when>
+ <xsl:when test="draw:frame and ((normalize-space($childText) != '') or (((count(*) - count(text:soft-page-break)) &gt; 1)))">
+ <!-- If there is a 'draw:frame' child with text (not being whitespace alone) and more than the draw:frame alone and
+ not the draw:frame and a soft-page-break alone (which is quite often) -->
+
+ <!-- If there is a frame within the text:p or draw:page, its siblings are surrounded as well by a div and are floating (CSS float) -->
+ <!-- But it makes no sense to create floating if the frame is alone or only together with a soft-page-break not usable for HTML -->
+ <!-- The paragraph is written as DIV as there might be nested paragraphs (see above choose block) -->
+ <xsl:choose>
+ <xsl:when test="name() = 'text:p'">
+ <xsl:comment>Next 'div' was a 'text:p'.</xsl:comment>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:comment>Next 'div' was a 'draw:page'.</xsl:comment>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:element name="div">
+ <xsl:apply-templates select="@*">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ <!-- the footnote symbol is the prefix for a footnote in the footer -->
+ <xsl:copy-of select="$footnotePrefix"/>
+ <!-- start floating of frame (and siblings) -->
+ <xsl:apply-templates select="node()[1]" mode="frameFloating">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="previousFrameWidths" select="0"/>
+ <xsl:with-param name="previousFrameHeights" select="0"/>
+ <!-- 2DO for me (Svante) - Not used, uncertain 4now..
+ <xsl:with-param name="pageMarginLeft">
+ <xsl:call-template name="getPageMarginLeft"/>
+ </xsl:with-param>-->
+ </xsl:apply-templates>
+ </xsl:element>
+ <!-- after the last draw:frame sibling the CSS float is disabled
+ &#160; is an unbreakable whitespace to give conent to the element and force a browser not to ignore the element -->
+ <div style="clear:both; line-height:0; width:0; height:0; margin:0; padding:0;">&#160;</div>
+ </xsl:when>
+ <xsl:when test="text:tab">
+ <!-- If there is a tabulator (ie. text:tab) within a paragraph, a heuristic for ODF tabulators creates a
+ span for every text:tab embracing the following text nodes aligning them according to the tabulator.
+ A line break or another text:tab starts a new text:span, line break even the tab counter for the line.
+ -->
+ <xsl:element name="p">
+ <xsl:apply-templates select="@*">
+ <xsl:with-param name="globalData" select="$globalData" />
+ </xsl:apply-templates>
+ <!-- start with first child of the paragraph -->
+ <xsl:variable name="firstChildNode" select="node()[1]" />
+ <xsl:apply-templates select="$firstChildNode" mode="tabHandling">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="tabStops" select="$globalData/all-doc-styles/style[@style:name = current()/@text:style-name]/*/style:tab-stops"/>
+ <xsl:with-param name="parentMarginLeft">
+ <!-- Styles of first paragraph in list item, including ancestor styles (inheritance) -->
+ <xsl:variable name="paragraphName" select="@text:style-name" />
+ <xsl:variable name="imageParagraphStyle" select="$globalData/all-styles/style[@style:name = $paragraphName]/final-properties"/>
+ <!-- Only the left margin of the first paragraph of a list item will be added to the margin of the complete list (all levels)-->
+<!-- 2DO: left-margin in order with bidirectional -->
+ <xsl:choose>
+ <xsl:when test="contains($imageParagraphStyle, 'margin-left:')">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="normalize-space(substring-before(substring-after($imageParagraphStyle, 'margin-left:'), ';'))"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="pageMarginLeft">
+ <xsl:call-template name="getPageMarginLeft"/>
+ </xsl:with-param>
+ </xsl:apply-templates>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <!-- !!Check if paragraph is empty!!
+ OOo writes out empty paragraphs layouted behind an image (= draw:image within draw:frame)
+ those have to be neglected in HTML -->
+ <xsl:when test="name() = 'text:p' and not($childText) and not(*)">
+ <xsl:variable name="isFollowingImage">
+ <xsl:call-template name="follows-empty-paragraphs-and-image">
+ <xsl:with-param name="precedingElement" select="preceding-sibling::node()[1]"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="$isFollowingImage = 'no'">
+ <xsl:call-template name="create-paragraph">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="footnotePrefix" select="$footnotePrefix" />
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="create-paragraph">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="footnotePrefix" select="$footnotePrefix" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- Return the text -->
+ <xsl:template match="text()" mode="getAllTextChildren">
+ <xsl:value-of select="."/>
+ </xsl:template>
+
+ <!-- A span will be created for every text:tab embracing the following text nodes.
+ A line break or another text:tab starts a new text:span -->
+ <xsl:template match="* | text()" mode="tabHandling">
+ <xsl:param name="globalData"/>
+ <xsl:param name="tabStops"/>
+ <!-- there can be multiple tabs in one line, tabNo guesses the one to apply. By default the first i.e. "1" -->
+ <xsl:param name="tabCount" select="0"/>
+ <xsl:param name="parentMarginLeft" />
+ <xsl:param name="pageMarginLeft" />
+
+<!-- 2DO: EXCHANGE FOLLOING SIBLING BY VARIABLE -->
+ <xsl:variable name="followingSiblingNode" select="following-sibling::node()[1]"/>
+
+
+ <!--
+ Every tabulator indents its following content, encapuslated in a span
+ element.
+
+ This template have two modes:
+
+ 1) Before the first tabulator it will match as usually paragraph content
+ to HTML.
+ 2) After the first paragraph it will always triggers two recursions.
+ One embraces the following content of a paragraph element into a span.
+ (tabContentHandling)
+ The other calls this template and will now ignore anything else than
+ TAB and LINE-BREAK.
+
+
+ The tabulators and linebreaks are being iterated, one by one to keep track of the tab number
+ -->
+
+
+ <xsl:choose>
+ <xsl:when test="name() = 'text:tab'">
+ <!-- every frame sibling have to be incapuslated within a div with left indent -->
+ <xsl:element name="span">
+ <xsl:choose>
+ <xsl:when test="count($tabStops/style:tab-stop) &lt; 3">
+ <!-- only allow the heuristic when the style has less than 3 TABS -->
+ <xsl:attribute name="style">
+ <xsl:call-template name="createTabIndent">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="tabStops" select="$tabStops"/>
+ <xsl:with-param name="tabCount" select="$tabCount + 1"/>
+ <xsl:with-param name="parentMarginLeft" select="$parentMarginLeft"/>
+ <xsl:with-param name="pageMarginLeft" select="$pageMarginLeft"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- if there are more than 3 TABS in the style, create a none-breakable-space as whitespace -->
+ <xsl:text>&#160;</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="tabContentHandling">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:element>
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="tabHandling">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="tabStops" select="$tabStops"/>
+ <xsl:with-param name="tabCount" select="$tabCount + 1"/>
+ <xsl:with-param name="parentMarginLeft" select="$parentMarginLeft"/>
+ <xsl:with-param name="pageMarginLeft" select="$pageMarginLeft"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:when test="name() = 'text:line-break'">
+ <!-- A line-break resets the tabCount to '0' -->
+ <br/>
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="tabHandling">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="tabStops" select="$tabStops"/>
+ <xsl:with-param name="tabCount" select="0"/>
+ <xsl:with-param name="parentMarginLeft" select="$parentMarginLeft"/>
+ <xsl:with-param name="pageMarginLeft" select="$pageMarginLeft"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- only before the first tab all content is written out -->
+ <xsl:if test="$tabCount = 0">
+ <xsl:apply-templates select=".">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:if>
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="tabHandling">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="tabStops" select="$tabStops"/>
+ <xsl:with-param name="tabCount" select="$tabCount"/>
+ <xsl:with-param name="parentMarginLeft" select="$parentMarginLeft"/>
+ <xsl:with-param name="pageMarginLeft" select="$pageMarginLeft"/>
+ </xsl:apply-templates>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!--
+ This recursion creates the content of a tab (i.e. following siblings
+ till next TAB or LINE BREAK) and ends with the next
+ TAB, LINE-BREAK or with the end of the paragraph.
+ -->
+ <xsl:template match="* | text()" mode="tabContentHandling">
+ <xsl:param name="globalData"/>
+
+ <xsl:if test="(name() != 'text:tab') and (name() != 'text:line-break')">
+ <!-- Write out content -->
+ <xsl:apply-templates select=".">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ <!-- Apply for the next node -->
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="tabContentHandling">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template name="createTabIndent">
+ <xsl:param name="globalData"/>
+ <xsl:param name="tabStops"/>
+ <xsl:param name="tabCount"/>
+ <xsl:param name="parentMarginLeft" />
+ <xsl:param name="pageMarginLeft" />
+
+ <xsl:text>position:absolute;left:</xsl:text>
+ <xsl:variable name="tabPosition">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="$tabStops/style:tab-stop[$tabCount]/@style:position"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="tabIndent">
+ <xsl:choose>
+ <xsl:when test="$tabStops/style:tab-stop[$tabCount]/@style:type = 'center'">
+ <!-- in case of style:type 'center' the text is even before the tab stop,
+ centered around the beginning. As I see currently no way in mapping this,
+ therefore I do some HEURISTIC (minus -2.5cm) -->
+ <xsl:value-of select="$tabPosition + $parentMarginLeft + $pageMarginLeft - 2.5"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$tabPosition + $parentMarginLeft + $pageMarginLeft"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$tabIndent='NaN'">
+ <xsl:variable name="tabPosition">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="$tabStops/style:tab-stop[last()]/@style:position"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <!-- Heuristic: for every tab that is more than specified give a further 1 cm -->
+ <xsl:value-of select="$parentMarginLeft + $tabPosition + count($tabStops/style:tab-stop) - $tabCount"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$tabIndent"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:text>cm;</xsl:text>
+ <xsl:apply-templates select="$tabStops/style:tab-stop[$tabCount]/@style:type"/>
+ </xsl:template>
+
+ <!-- OOo writes out empty paragraphs layouted behind an image,
+ those have to be neglected in HTML
+ This method checks if an empty paragraph is of that kind! -->
+ <xsl:template name="follows-empty-paragraphs-and-image">
+ <xsl:param name="precedingElement" />
+ <xsl:param name="elementToCheck" select="1"/>
+ <xsl:choose>
+ <!-- OOo writes out empty paragraphs layouted behind the image,
+ those have to be neglected in HTML
+ <xsl:when test="name() = 'text:p' and (normalize-space($childText) = '')"> -->
+ <!-- WorkAround: Test if the empty paragraph was added after an image, which OOO often does -->
+ <xsl:when test="(name($precedingElement) = 'text:p' and not($precedingElement/text()) and not($precedingElement/*))">
+ <xsl:call-template name="follows-empty-paragraphs-and-image">
+ <xsl:with-param name="precedingElement" select="preceding-sibling::*[$elementToCheck]"/>
+ <xsl:with-param name="elementToCheck" select="$elementToCheck +1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$precedingElement/draw:frame">yes</xsl:when>
+ <xsl:otherwise>no</xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="create-paragraph">
+ <xsl:param name="globalData"/>
+ <!-- the footnote symbol is the prefix for a footnote in the footer -->
+ <xsl:param name="footnotePrefix"/>
+
+ <!-- xhtml:p may only contain inline elements.
+ If there is one frame beyond, div must be used! -->
+ <xsl:variable name="elementName">
+ <xsl:choose>
+ <xsl:when test="descendant::draw:frame[1] or descendant::text:p[1]">div</xsl:when>
+ <xsl:otherwise>p</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:element name="{$elementName}">
+ <xsl:choose>
+ <!-- in ODF borders of paragraphs will be merged by default. Merging means the adjactend paragraphs are building a unit,
+ where only the first and the last will have have a border to the surrounding (top / bottom border)
+ <xsl:variable name="precedingParagraphStyle" select="preceding-sibling::*[1][name() = 'text:p']/@text:style-name"/>
+ <xsl:variable name="followingParagraphStyle" select="following-sibling::*[1][name() = 'text:p']/@text:style-name"/>
+ -->
+ <xsl:when test="$globalData/all-styles/style[@style:name = current()/@text:style-name]/@mergedBorders">
+ <xsl:variable name="precedingParagraphStyle" select="preceding-sibling::*[1][name() = 'text:p']/@text:style-name"/>
+ <xsl:variable name="followingParagraphStyle" select="following-sibling::*[1][name() = 'text:p']/@text:style-name"/>
+ <xsl:choose>
+ <xsl:when test="$precedingParagraphStyle or $followingParagraphStyle">
+ <xsl:variable name="isPrecedingBorderParagraph" select="$globalData/all-styles/style[@style:name = $precedingParagraphStyle]/@mergedBorders"/>
+ <xsl:variable name="isFollowingBorderParagraph" select="$globalData/all-styles/style[@style:name = $followingParagraphStyle]/@mergedBorders"/>
+ <xsl:choose>
+ <xsl:when test="not($isPrecedingBorderParagraph) and $isFollowingBorderParagraph">
+ <xsl:attribute name="class">
+ <xsl:value-of select="concat(translate(@text:style-name, '.,;: %()[]/\+', '_____________'), '_borderStart')"/>
+ </xsl:attribute>
+ <xsl:apply-templates>
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:when test="$isPrecedingBorderParagraph and not($isFollowingBorderParagraph)">
+ <xsl:attribute name="class">
+ <xsl:value-of select="concat(translate(@text:style-name, '.,;: %()[]/\+', '_____________'), '_borderEnd')"/>
+ </xsl:attribute>
+ <xsl:apply-templates>
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="class">
+ <xsl:value-of select="translate(@text:style-name, '.,;: %()[]/\+', '_____________')"/>
+ </xsl:attribute>
+ <xsl:apply-templates>
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="write-paragraph">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="write-paragraph">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="footnotePrefix" select="$footnotePrefix" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template name="write-paragraph">
+ <xsl:param name="globalData"/>
+ <!-- the footnote symbol is the prefix for a footnote in the footer -->
+ <xsl:param name="footnotePrefix" />
+
+ <!-- empty paragraph tags does not provoke an carridge return,
+ therefore an non breakable space (&nbsp) have been inserted.-->
+ <xsl:choose>
+ <xsl:when test="node()">
+ <xsl:call-template name="apply-styles-and-content">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="footnotePrefix" select="$footnotePrefix" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="apply-styles-and-content">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="footnotePrefix" select="$footnotePrefix" />
+ </xsl:call-template>
+ <xsl:text>&#160;</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="style:tab-stop/@style:type">
+ <xsl:text>text-align:</xsl:text>
+ <xsl:choose>
+ <xsl:when test=". = 'left'">left</xsl:when>
+ <xsl:when test=". = 'right'">right</xsl:when>
+ <xsl:when test=". = 'center'">center</xsl:when>
+ <xsl:otherwise>justify</xsl:otherwise>
+ </xsl:choose>
+ <xsl:text>;</xsl:text>
+ </xsl:template>
+
+ <!-- As soon a frame is within a paragraph (text:p) or page:frame, every child element is floating (CSS) and worked out in sequence.
+ Accumulating prior frame width and adding parent's left margin -->
+ <!-- Matching all elements and text beyond a paragraph/text:page which are sibling of a draw:frame -->
+ <xsl:template match="* | text()" mode="frameFloating">
+ <xsl:param name="globalData"/>
+ <xsl:param name="previousFrameWidths" select="0"/>
+ <xsl:param name="previousFrameHeights" select="0" />
+ <!-- it becomes true for siblings after a draw:frame -->
+ <xsl:param name="createDiv" select="false()"/>
+ <xsl:param name="noDivBefore" select="true()"/>
+ <xsl:param name="leftPosition" />
+ <xsl:param name="parentMarginLeft" />
+ <xsl:param name="frameAlignedToParagraphWithSvgY" />
+
+ <xsl:choose>
+ <xsl:when test="name() = 'draw:frame'">
+ <xsl:copy-of select="$frameAlignedToParagraphWithSvgY"/>
+
+ <!-- if the first node is a draw:frame create a div -->
+ <xsl:call-template name="createDrawFrame">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="previousFrameWidths" select="$previousFrameWidths"/>
+ <xsl:with-param name="previousFrameHeights" select="$previousFrameHeights"/>
+ <xsl:with-param name="parentMarginLeft" select="$parentMarginLeft"/>
+ </xsl:call-template>
+ <!-- next elements will be called after the creation with the new indent (plus width of frame) -->
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="nextSiblingIsFrame" select="name(following-sibling::node()[1]) = 'draw:frame'"/>
+ <xsl:choose>
+ <xsl:when test="$createDiv and normalize-space(.) != ''">
+ <!-- every following frame sibling till the next draw:frame
+ have to be incapuslated within a div with left indent.
+ To be moved alltogether arcording the indent (usually right) -->
+ <xsl:comment>Next 'div' added for floating.</xsl:comment>
+ <xsl:element name="div">
+ <xsl:attribute name="style">
+ <xsl:text>position:relative; left:</xsl:text>
+ <xsl:value-of select="$leftPosition"/>
+ <xsl:text>cm;</xsl:text>
+ </xsl:attribute>
+ <xsl:apply-templates select=".">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ <!-- if it is a frame sibling it will be NOT incapuslated within the div (as already within one) -->
+ <xsl:if test="not($nextSiblingIsFrame)">
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="frameFloating">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="previousFrameWidths" select="$previousFrameWidths"/>
+ <xsl:with-param name="previousFrameHeights" select="$previousFrameHeights"/>
+ <xsl:with-param name="parentMarginLeft" select="$parentMarginLeft"/>
+ <xsl:with-param name="leftPosition" select="$leftPosition"/>
+ <xsl:with-param name="createDiv" select="false()"/>
+ <xsl:with-param name="noDivBefore" select="$noDivBefore"/>
+ <xsl:with-param name="frameAlignedToParagraphWithSvgY" select="$frameAlignedToParagraphWithSvgY"/>
+ </xsl:apply-templates>
+ </xsl:if>
+ </xsl:element>
+ <xsl:copy-of select="$frameAlignedToParagraphWithSvgY"/>
+
+ <!-- Other draw:frame will be created outside of the div element -->
+ <xsl:apply-templates select="following-sibling::draw:frame[1]" mode="frameFloating">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="previousFrameWidths" select="$previousFrameWidths"/>
+ <xsl:with-param name="previousFrameHeights" select="$previousFrameHeights"/>
+ <xsl:with-param name="parentMarginLeft" select="$parentMarginLeft"/>
+ <xsl:with-param name="leftPosition" select="$leftPosition"/>
+ <xsl:with-param name="frameAlignedToParagraphWithSvgY" select="$frameAlignedToParagraphWithSvgY"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:when test="not($createDiv)">
+ <xsl:apply-templates select=".">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="frameAlignedToParagraphWithSvgY" select="$frameAlignedToParagraphWithSvgY"/>
+ </xsl:apply-templates>
+ <xsl:if test="not($nextSiblingIsFrame) or $noDivBefore">
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="frameFloating">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="previousFrameWidths" select="$previousFrameWidths"/>
+ <xsl:with-param name="previousFrameHeights" select="$previousFrameHeights"/>
+ <xsl:with-param name="parentMarginLeft" select="$parentMarginLeft"/>
+ <xsl:with-param name="leftPosition" select="$leftPosition"/>
+ <xsl:with-param name="createDiv" select="false()"/>
+ <xsl:with-param name="noDivBefore" select="$noDivBefore"/>
+ <xsl:with-param name="frameAlignedToParagraphWithSvgY" select="$frameAlignedToParagraphWithSvgY"/>
+ </xsl:apply-templates>
+ </xsl:if>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- A XML node other than text or element (e.g. commment) should not stop the recursion -->
+ <xsl:template match="comment()" mode="frameFloating">
+ <xsl:param name="globalData"/>
+ <xsl:param name="previousFrameWidths" select="0"/>
+ <xsl:param name="previousFrameHeights" select="0" />
+ <!-- it becomes true for siblings after a draw:frame -->
+ <xsl:param name="createDiv" select="false()"/>
+ <xsl:param name="noDivBefore" select="true()"/>
+ <xsl:param name="leftPosition" />
+ <xsl:param name="parentMarginLeft" />
+ <xsl:param name="frameAlignedToParagraphWithSvgY" />
+
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="frameFloating">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="previousFrameWidths" select="$previousFrameWidths"/>
+ <xsl:with-param name="parentMarginLeft" select="$parentMarginLeft"/>
+ <xsl:with-param name="leftPosition" select="$leftPosition"/>
+ <xsl:with-param name="createDiv" select="$createDiv"/>
+ <xsl:with-param name="noDivBefore" select="$noDivBefore"/>
+ </xsl:apply-templates>
+ </xsl:template>
+
+
+
+ <!-- As draw:fame may occure within more elements than in text:p and draw:page -->
+ <xsl:template match="draw:frame">
+ <xsl:param name="globalData"/>
+ <xsl:param name="previousFrameWidths" select="0"/>
+ <xsl:param name="previousFrameHeights" select="0" />
+
+ <xsl:call-template name="createDrawFrame">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="previousFrameWidths" select="$previousFrameWidths"/>
+ <xsl:with-param name="previousFrameHeights" select="$previousFrameHeights"/>
+ </xsl:call-template>
+ <!-- after the last draw:frame sibling the CSS float is disabled -->
+ <div style="clear:both; line-height:0; width:0; height:0; margin:0; padding:0;">&#160;</div>
+ </xsl:template>
+
+ <xsl:template name="getPageMarginLeft">
+ <!-- approximation to find the correct master page style (with page dimensions) -->
+ <xsl:variable name="masterPageNames">
+ <!-- Loop over every style:style containing a @style:master-page-name attribute -->
+ <xsl:for-each select="key('masterPage','count')">
+ <!-- Check if this style is being used in the body -->
+ <xsl:if test="key('elementUsingStyle', ../@style:name)">
+ <!-- Check every master-page-name if it is not emtpy and return as ';' separated list -->
+ <xsl:if test="string-length(../@style:master-page-name) &gt; 0">
+ <xsl:value-of select="../@style:master-page-name"/>;</xsl:if>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:variable>
+ <!-- Take the first of the masterpage list and get the according style:master-page element and find the @style:page-layout-name -->
+ <xsl:variable name="pageLayoutName" select="key('masterPageElements', substring-before($masterPageNames,';'))/@style:page-layout-name"/>
+ <!-- Find the according style:page-layout and store the properties in a variable -->
+ <xsl:variable name="pageMarginLeftAttr" select="key('pageLayoutElements', $pageLayoutName)/style:page-layout-properties/@fo:margin-left"/>
+ <xsl:choose>
+ <xsl:when test="$pageMarginLeftAttr">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="$pageMarginLeftAttr"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- Elements and text aside of a draw:frame are floating, here a div is being created.
+ Either for a draw:frame or for text and other elements floating aside -->
+ <xsl:template name="createDrawFrame">
+ <xsl:param name="globalData"/>
+ <xsl:param name="previousFrameWidths" select="0"/>
+ <xsl:param name="previousFrameHeights" select="0" />
+ <xsl:param name="parentMarginLeft"/>
+
+ <xsl:variable name="parentMarginLeftNew">
+ <xsl:choose>
+ <xsl:when test="string-length(normalize-space($parentMarginLeft)) &lt; 1">
+ <!-- Styles of first paragraph in list item, including ancestor styles (inheritance) -->
+ <xsl:variable name="paragraphName" select="parent::*/@text:style-name" />
+ <xsl:variable name="imageParagraphStyle" select="$globalData/all-styles/style[@style:name = $paragraphName]/final-properties"/>
+ <!-- Only the left margin of the first paragraph of a list item will be added to the margin of the complete list (all levels)-->
+ <xsl:choose>
+ <xsl:when test="contains($imageParagraphStyle, 'margin-left:')">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="normalize-space(substring-before(substring-after($imageParagraphStyle, 'margin-left:'), ';'))"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$parentMarginLeft"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="svgWidth">
+ <xsl:choose>
+ <xsl:when test="@svg:width">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="@svg:width"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="svgX">
+ <xsl:choose>
+ <xsl:when test="@svg:x">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="@svg:x"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="leftPosition" select="$svgX - $parentMarginLeftNew - $previousFrameWidths"/>
+ <xsl:variable name="svgY">
+ <xsl:choose>
+ <xsl:when test="@svg:y">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="@svg:y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <!-- if the frame is anchored on a paragraph -->
+ <xsl:if test="@text:anchor-type='paragraph'">
+ <xsl:comment>Next 'div' is emulating the top hight of a draw:frame.</xsl:comment>
+ <!-- When the svg:y is set relativ to the paragraph content, the best way to emulate a positive height,
+ is to add an invisbile division inbetween with a height.
+ Often text will flow into this 'gap', which is handled separately!
+ -->
+ <xsl:if test="$svgY &gt; 0">
+ <xsl:element name="div">
+ <xsl:attribute name="style">
+ <xsl:text>height:</xsl:text>
+ <xsl:value-of select="$svgY"/>
+ <xsl:text>cm;</xsl:text>
+ </xsl:attribute>
+ <xsl:text>&#160;</xsl:text>
+ </xsl:element>
+ </xsl:if>
+ </xsl:if>
+
+
+ <!--
+ <xsl:variable name="followingSibling" select="following-sibling::node()[1]"/>
+ <xsl:choose>
+ HEURISTIC: if the frame is anchored on a paragraph and the above gab is big enough to hold a text line,
+ move it behind the text
+ <xsl:when test="@text:anchor-type='paragraph' and
+ (
+ ($svgY &gt; 0.5) or
+ ($svgX &gt; 4)
+ ) and normalize-space($followingSibling) != ''">
+ <xsl:apply-templates select="$followingSibling" mode="frameFloating">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="previousFrameWidths" select="$previousFrameWidths + $svgWidth"/>
+ <xsl:with-param name="parentMarginLeft" select="$parentMarginLeftNew"/>
+ <xsl:with-param name="leftPosition" select="$leftPosition"/>
+ <xsl:with-param name="createDiv" select="true()"/>
+ <xsl:with-param name="noDivBefore" select="false()"/>
+ <xsl:with-param name="frameAlignedToParagraphWithSvgY">
+ <xsl:call-template name="createDrawFrame2">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="previousFrameWidths" select="$previousFrameWidths + $svgWidth"/>
+ <xsl:with-param name="parentMarginLeftNew" select="$parentMarginLeftNew"/>
+ <xsl:with-param name="leftPosition" select="$leftPosition"/>
+ <xsl:with-param name="svgY" select="$svgY"/>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>-->
+ <xsl:call-template name="createDrawFrame2">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="previousFrameWidths" select="$previousFrameWidths + $svgWidth"/>
+ <xsl:with-param name="parentMarginLeftNew" select="$parentMarginLeftNew"/>
+ <xsl:with-param name="leftPosition" select="$leftPosition"/>
+ <xsl:with-param name="svgY" select="$svgY"/>
+ </xsl:call-template>
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="frameFloating">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="previousFrameWidths" select="$previousFrameWidths + $svgWidth"/>
+ <xsl:with-param name="parentMarginLeft" select="$parentMarginLeftNew"/>
+ <xsl:with-param name="leftPosition" select="$leftPosition"/>
+ <xsl:with-param name="createDiv" select="true()"/>
+ <xsl:with-param name="noDivBefore" select="false()"/>
+ </xsl:apply-templates>
+ <!--
+
+ </xsl:otherwise>
+ </xsl:choose> -->
+ </xsl:template>
+
+ <xsl:template name="createDrawFrame2">
+ <xsl:param name="globalData"/>
+ <xsl:param name="previousFrameWidths" />
+ <xsl:param name="parentMarginLeftNew"/>
+ <xsl:param name="leftPosition" />
+ <xsl:param name="svgY" />
+
+ <xsl:comment>Next 'div' is a draw:frame.</xsl:comment>
+ <xsl:element name="div">
+ <xsl:attribute name="style">
+ <xsl:call-template name="widthAndHeight"/>
+
+ <!-- all images float (CSS float reltaive) with a left position calculated by svg:x - parentMarginLeft - previousFrameWidths -->
+ <xsl:text> float:left; padding:0; position:relative; left:</xsl:text>
+ <xsl:value-of select="$leftPosition"/>
+ <xsl:text>cm; </xsl:text>
+ <!-- if the frame is anchored on a char -->
+ <xsl:if test="@text:anchor-type='char'">
+ <xsl:text>top:</xsl:text>
+ <xsl:value-of select="$svgY"/>
+ <xsl:text>cm; </xsl:text>
+ </xsl:if>
+ </xsl:attribute>
+ <xsl:apply-templates select="@*">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ <xsl:apply-templates select="node()">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template name="widthAndHeight">
+ <xsl:if test="@svg:height | @svg:width">
+ <xsl:choose>
+ <xsl:when test="not(@svg:width)">
+ <xsl:call-template name="svg:height"/>
+ </xsl:when>
+ <xsl:when test="not(@svg:height)">
+ <xsl:call-template name="svg:width"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="svg:height"/>
+ <xsl:call-template name="svg:width"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:template>
+
+ <!-- ***************** -->
+ <!-- *** Text Span *** -->
+ <!-- ***************** -->
+
+ <xsl:template match="text:span">
+ <xsl:param name="globalData"/>
+
+ <xsl:choose>
+ <xsl:when test="draw:frame">
+ <!-- sometimes an ODF image is anchored as character and the
+ image frame appears within a span (which is not valid for HTML)
+ Heuristic: Neglecting the span assuming no text content aside
+ of frame within span -->
+ <xsl:apply-templates>
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="span">
+ <xsl:call-template name="apply-styles-and-content">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+
+ <!-- **************** -->
+ <!-- *** Headings *** -->
+ <!-- **************** -->
+
+ <xsl:template match="text:h">
+ <xsl:param name="globalData"/>
+
+ <!-- no creation of empty headings (without text content) -->
+ <xsl:if test="text() or descendant::text()">
+ <!-- The URL linking of an table-of-content is due to a bug (cp. bug id# 102311) not mapped as URL in the XML.
+ Linking of the table-of-content can therefore only be archieved by a work-around in HTML -->
+ <xsl:call-template name="create-heading">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+
+ <!-- default matching for header elements -->
+ <xsl:template name="create-heading">
+ <xsl:param name="globalData"/>
+
+ <xsl:variable name="headingLevel">
+ <xsl:choose>
+ <xsl:when test="@text:outline-level &lt; 6">
+ <xsl:value-of select="@text:outline-level"/>
+ </xsl:when>
+ <xsl:otherwise>6</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="headertyp" select="concat('h', $headingLevel)"/>
+ <xsl:element name="{$headertyp}">
+ <!-- outline style 'text:min-label-width' is interpreted as a CSS 'margin-right' attribute
+ NOTE: Should be handled as CSS style in style header -->
+ <xsl:variable name="min-label" select="$globalData/office:styles/text:outline-style/text:outline-level-style[@text:level = current()/@text:outline-level]/*/@text:min-label-width"/>
+ <xsl:attribute name="class">
+ <xsl:value-of select="translate(@text:style-name, '.,;: %()[]/\+', '_____________')"/>
+ </xsl:attribute>
+
+ <xsl:call-template name="create-heading-anchor">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:call-template>
+
+ <xsl:apply-templates>
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:element>
+
+ </xsl:template>
+
+ <xsl:template name="create-heading-anchor">
+ <xsl:param name="globalData"/>
+
+ <!-- writing out a heading number if desired.-->
+ <!-- if a corresponding 'text:outline-style' exist or is not empty -->
+ <xsl:choose>
+ <xsl:when test="$globalData/office:styles/text:outline-style/text:outline-level-style[@text:level = current()/@text:outline-level]/@style:num-format != ''">
+
+ <!-- Every heading element will get an unique anchor for its file, from its hiearchy level and name:
+ For example: The heading title 'My favorite heading' might get <a name="1_2_2_My_favorite_heading" /> -->
+ <!-- creating an anchor for referencing the heading (e.g. from content table) -->
+ <xsl:variable name="headingNumber">
+ <xsl:call-template name="get-heading-number">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="create-heading-anchor2">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="headingNumber" select="$headingNumber"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="create-heading-anchor2">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <xsl:template name="get-heading-number">
+ <xsl:param name="globalData"/>
+
+ <!-- write number prefix -->
+ <xsl:value-of select="$globalData/office:styles/text:outline-style/text:outline-level-style[@text:level = current()/@text:outline-level]/@style:num-prefix"/>
+ <xsl:call-template name="write-heading-number">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:call-template>
+ <!-- write number suffix -->
+ <xsl:value-of select="$globalData/office:styles/text:outline-style/text:outline-level-style[@text:level = current()/@text:outline-level]/@style:num-suffix"/>
+ </xsl:template>
+
+ <!-- creating an anchor for referencing the heading -->
+ <xsl:template name="create-heading-anchor2">
+ <xsl:param name="globalData"/>
+ <xsl:param name="headingNumber" />
+
+ <xsl:variable name="title">
+ <xsl:apply-templates mode="concatenate"/>
+ </xsl:variable>
+ <!-- REFERENCE HANDLING - ANCHOR -->
+ <xsl:element namespace="{$namespace}" name="a">
+ <xsl:attribute name="id">
+ <xsl:value-of select="translate(concat('a_',$headingNumber, '_', normalize-space($title)), '&#xA;&amp;&lt;&gt;.,;: %()[]/\+', '___________________________')"/>
+ </xsl:attribute>
+
+ <xsl:element name="span">
+ <!-- outline style 'text:min-label-distance' is interpreted as a CSS 'margin-right' attribute
+ NOTE: Should be handled as CSS style in style header -->
+ <xsl:variable name="minLabelDistance" select="$globalData/office:styles/text:outline-style/text:outline-level-style[@text:level = current()/@text:outline-level]/*/@text:min-label-distance"/>
+ <xsl:variable name="minLabelWidth" select="$globalData/office:styles/text:outline-style/text:outline-level-style[@text:level = current()/@text:outline-level]/*/@text:min-label-width"/>
+
+ <xsl:if test="$minLabelDistance | $minLabelWidth">
+ <xsl:attribute name="style">
+ <xsl:if test="$minLabelDistance">
+ <xsl:text>margin-right:</xsl:text>
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="$minLabelDistance"/>
+ </xsl:call-template>
+ <xsl:text>cm;</xsl:text>
+ </xsl:if>
+ <xsl:if test="$minLabelWidth">
+ <xsl:text>min-width:</xsl:text>
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="$minLabelWidth"/>
+ </xsl:call-template>
+ <xsl:text>cm;</xsl:text>
+ </xsl:if>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:copy-of select="$headingNumber"/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template name="write-heading-number">
+ <xsl:param name="globalData"/>
+
+ <!-- By default heading start with '1', the parameter 'textStartValue' will only be set, if the attribute @text:start-value exist -->
+ <xsl:choose>
+ <xsl:when test="$globalData/office:styles/text:outline-style/text:outline-level-style[@text:level = current()/@text:outline-level]/@text:start-value">
+ <xsl:call-template name="calc-heading-number">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="outlineLevel" select="@text:outline-level"/>
+ <xsl:with-param name="textStartValue" select="$globalData/office:styles/text:outline-style/text:outline-level-style[@text:level = current()/@text:outline-level]/@text:start-value"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="calc-heading-number">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="outlineLevel" select="@text:outline-level"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!--
+ Find the correct heading no., which is the sum of 'text:start-value'
+ and preceding siblings of 'text:h' with the same 'text:outline-level' (until a text:outline-level with lower value is found).
+ If the 'text:start-value is not set the default value of '1' has to be taken.
+ If a heading number is found (e.g. text:outline-level='3') all heading numbers
+ for the higher levels have to be written out -->
+ <xsl:template name="calc-heading-number">
+ <xsl:param name="globalData"/>
+ <xsl:param name="outlineLevel"/><!-- text level of the heading -->
+ <xsl:param name="iOutlineLevel" select="1"/><!-- iterator, counts from 1 to the text level of the heading -->
+ <xsl:param name="textStartValue" select="1"/><!-- text level to start with, default is '1' -->
+
+ <xsl:choose>
+ <!-- iText levels counts up from '1' to outlineLevel
+ Which means writing a heading number from left to right -->
+ <xsl:when test="$iOutlineLevel &lt; $outlineLevel">
+
+ <!-- Write preceding heading numbers -->
+ <xsl:call-template name="writeNumber">
+ <xsl:with-param name="numberDigit">
+ <xsl:call-template name="calc-heading-digit">
+ <xsl:with-param name="value" select="0"/>
+ <xsl:with-param name="currentoutlineLevel" select="$iOutlineLevel"/>
+ </xsl:call-template>
+ </xsl:with-param>
+ <xsl:with-param name="numberFormat" select="$globalData/office:styles/text:outline-style/text:outline-level-style[@text:level = ($outlineLevel)]/@style:num-format"/>
+ </xsl:call-template>
+ <xsl:choose>
+ <xsl:when test="$globalData/office:styles/text:outline-style/text:outline-level-style[@text:level = ($iOutlineLevel + 1)]/@text:start-value">
+ <xsl:call-template name="calc-heading-number">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="outlineLevel" select="$outlineLevel"/>
+ <xsl:with-param name="iOutlineLevel" select="$iOutlineLevel + 1"/>
+ <xsl:with-param name="textStartValue" select="$globalData/office:styles/text:outline-style/text:outline-level-style[@text:level = ($iOutlineLevel + 1)]/@text:start-value"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="calc-heading-number">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="outlineLevel" select="$outlineLevel"/>
+ <xsl:with-param name="iOutlineLevel" select="$iOutlineLevel + 1"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- Write preceding heading numbers -->
+ <xsl:call-template name="writeNumber">
+ <xsl:with-param name="numberDigit">
+ <xsl:call-template name="calc-heading-digit">
+ <xsl:with-param name="value" select="$textStartValue"/>
+ <xsl:with-param name="currentoutlineLevel" select="$iOutlineLevel"/>
+ </xsl:call-template>
+ </xsl:with-param>
+ <xsl:with-param name="numberFormat" select="$globalData/office:styles/text:outline-style/text:outline-level-style[@text:level = $outlineLevel]/@style:num-format"/>
+ <xsl:with-param name="last" select="true()"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="writeNumber">
+ <xsl:param name="numberDigit"/>
+ <xsl:param name="numberFormat"/>
+ <xsl:param name="last"/>
+
+ <xsl:choose>
+ <xsl:when test="not($numberFormat)">
+ <xsl:number value="$numberDigit" format="1."/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="$last">
+ <xsl:number value="$numberDigit" format="{$numberFormat}"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:number value="$numberDigit" format="{$numberFormat}."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="calc-heading-digit">
+ <xsl:param name="value"/>
+ <xsl:param name="currentoutlineLevel"/>
+ <xsl:param name="i" select="1"/>
+
+ <xsl:variable name="precedingoutlineLevel" select="preceding-sibling::text:h[$i]/@text:outline-level"/>
+ <xsl:choose>
+ <xsl:when test="$currentoutlineLevel = $precedingoutlineLevel">
+ <xsl:call-template name="calc-heading-digit">
+ <xsl:with-param name="value" select="$value + 1"/>
+ <xsl:with-param name="currentoutlineLevel" select="$currentoutlineLevel"/>
+ <xsl:with-param name="i" select="$i + 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$currentoutlineLevel &lt; $precedingoutlineLevel">
+ <xsl:call-template name="calc-heading-digit">
+ <xsl:with-param name="value" select="$value"/>
+ <xsl:with-param name="currentoutlineLevel" select="$currentoutlineLevel"/>
+ <xsl:with-param name="i" select="$i + 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- Neglect Annotations -->
+ <xsl:template match="office:annotation" mode="concatenate"/>
+
+ <!-- Match text:placeholder child nodes (e.g. text) -->
+ <xsl:template match="text:placeholder">
+ <xsl:param name="globalData"/>
+
+ <xsl:call-template name="apply-styles-and-content">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:call-template>
+ </xsl:template>
+
+ <!-- ************* -->
+ <!-- *** Link *** -->
+ <!-- ************* -->
+
+ <xsl:template match="text:a | draw:a">
+ <xsl:param name="globalData"/>
+
+ <xsl:call-template name="create-common-anchor-link">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:call-template>
+ </xsl:template>
+
+
+ <xsl:template name="create-common-anchor-link">
+ <xsl:param name="globalData"/>
+
+ <xsl:element name="a">
+ <xsl:attribute name="href">
+ <xsl:call-template name="create-href">
+ <xsl:with-param name="href" select="@xlink:href"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:call-template name="apply-styles-and-content">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:template>
+
+
+
+ <!-- ******************* -->
+ <!-- *** Image Link *** -->
+ <!-- ******************* -->
+
+ <!-- currently suggesting that all draw:object-ole elements are images -->
+ <xsl:template match="draw:image | draw:object-ole">
+ <xsl:param name="globalData"/>
+
+ <xsl:choose>
+ <xsl:when test="ancestor::text:p or parent::text:span or parent::text:h or parent::draw:a or parent::text:a or text:ruby-base">
+ <!-- XHTML does not allow the mapped elements to contain paragraphs -->
+ <xsl:call-template name="create-image-element">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- images are embedded in a paragraph, but are in CSS not able to express a horizontal alignment for themself.
+ A 'div' element taking over the image style would solve that problem, but is invalid as child of a paragraph -->
+ <xsl:element name="p">
+ <xsl:apply-templates select="@draw:style-name">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+
+ <xsl:call-template name="create-image-element">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="create-image-element">
+ <xsl:param name="globalData"/>
+
+ <xsl:element name="img">
+ <xsl:if test="../@svg:width or ../@svg:height">
+ <xsl:attribute name="style">
+ <xsl:if test="../@svg:height">
+ <xsl:text>height:</xsl:text>
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="../@svg:height"/>
+ </xsl:call-template>
+ <xsl:text>cm;</xsl:text>
+ </xsl:if>
+ <xsl:if test="../@svg:width">
+ <xsl:text>width:</xsl:text>
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="../@svg:width"/>
+ </xsl:call-template>
+ <xsl:text>cm;</xsl:text>
+ </xsl:if>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="alt">
+ <xsl:choose>
+ <xsl:when test="../svg:desc">
+ <xsl:value-of select="../svg:desc"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>
+ Accessibility Warning:
+ No alternate text ('svg:desc' element) set for
+ image '<xsl:value-of select="@xlink:href"/>'!</xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+
+ <xsl:attribute name="src">
+ <xsl:call-template name="create-href">
+ <xsl:with-param name="href" select="@xlink:href"/>
+ </xsl:call-template>
+ </xsl:attribute>
+
+ <!-- style interpretation only, as no subelements are allowed for img in XHTML -->
+ <xsl:apply-templates select="@draw:style-name">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:element>
+ </xsl:template>
+
+ <!-- ************ -->
+ <!-- *** list *** -->
+ <!-- ************ -->
+ <!--
+ Due to the requirements below the ODF list functionality is not handled by CSS, but the list labels calculated and written by XSLT.
+
+ REQUIREMENTS:
+ =============
+
+ A)
+ One significant difference between XHTML and Office List elements is that a list without text nodes but only further list children
+ would not show a list symbol in the Office, but in the browser from XHTML.
+
+ B)
+ Since OASIS Open Document XML (implemented in OOo2.0) only one parent type exists for list items
+ the 'text:list' element. The XHTML element 'ol', 'ul' will be choosen upon the list style type.
+
+ C)
+ An Office list may be spread over the whole document. Linked by their style and text:continue-numbering='true'.
+
+ D)
+ An Office list can use characters or images as list label.
+
+ E)
+ An Office list can have a prefix and suffix around the list label.
+
+ F)
+ An Office list style may have the attribute consecutive numbering, which resolves in a list counting for all levels
+
+ G)
+ An Office list may (re)start on any arbitrary value by using @text:start-value on the text:list-item
+
+ INDENDATION:
+ ============
+
+ The indent of a list label is not only calculated by using the text:space-before of the list level (listLevelStyle), but
+ as well taking the left margin of the first paragraph (or heading) of the list into account as loy match="" name="" use=""/>ng it is not negative.
+
+ | MARGIN LEFT | LABEL |
+
+ | text:space-before (listlevelstyle) | text:min-label-width |
+ | + fo:left-margin (firstParagraph) | |
+
+ Further details beyond text:list-list..
+ -->
+ <xsl:key name="listStyles" match=" /*/office:styles/text:list-style | /*/office:automatic-styles/text:list-style | /*/office:styles/style:graphic-properties/text:list-style | /*/office:automatic-styles/style:graphic-properties/text:list-style | /*/office:styles/text:list-style | /*/office:automatic-styles/text:list-style | /*/office:styles/style:graphic-properties/text:list-style | /*/office:automatic-styles/style:graphic-properties/text:list-style" use="@style:name"/>
+
+ <!--
+ A text list may only have text:list-item and text:list-header as children.
+ -->
+ <xsl:template match="text:list">
+ <xsl:param name="globalData"/>
+ <xsl:param name="isListNumberingReset"/>
+ <xsl:param name="isNextLevelNumberingReset"/>
+ <xsl:param name="listLevel" select="1"/>
+ <xsl:param name="listRestart" select="false()"/>
+ <xsl:param name="itemLabel" select="''"/>
+ <xsl:param name="listStyle"/>
+ <xsl:param name="listStyleName" select="@text:style-name"/>
+
+ <!-- To choose list type - get the list style, with the same 'text:style-name' and same 'text:level' >-->
+ <xsl:variable name="listStyleRTF">
+ <xsl:variable name="listStyleInContentFile" select="key('listStyles', $listStyleName)"/>
+ <xsl:choose>
+ <xsl:when test="$listStyleInContentFile">
+ <xsl:copy-of select="$listStyleInContentFile"/>
+ </xsl:when>
+ <xsl:when test="$globalData/office:styles/text:list-style[@style:name = $listStyleName]">
+ <xsl:copy-of select="$globalData/office:styles/text:list-style[@style:name = $listStyleName]"/>
+ </xsl:when>
+ <xsl:when test="$globalData/office:styles/style:graphic-properties/text:list-style[@style:name = $listStyleName]">
+ <xsl:copy-of select="$globalData/office:styles/style:graphic-properties/text:list-style[@style:name = $listStyleName]"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:choose>
+ <xsl:when test="function-available('common:node-set')">
+ <xsl:call-template name="create-list-type">
+ <xsl:with-param name="listStyle" select="common:node-set($listStyleRTF)" />
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="isListNumberingReset" select="$isListNumberingReset"/>
+ <xsl:with-param name="isNextLevelNumberingReset" select="$isNextLevelNumberingReset"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listRestart" select="$listRestart"/>
+ <xsl:with-param name="itemLabel" select="$itemLabel"/>
+ <xsl:with-param name="listStyleName" select="$listStyleName" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="function-available('xalan:nodeset')">
+ <xsl:call-template name="create-list-type">
+ <xsl:with-param name="listStyle" select="xalan:nodeset($listStyleRTF)" />
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="isListNumberingReset" select="$isListNumberingReset"/>
+ <xsl:with-param name="isNextLevelNumberingReset" select="$isNextLevelNumberingReset"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listRestart" select="$listRestart"/>
+ <xsl:with-param name="itemLabel" select="$itemLabel"/>
+ <xsl:with-param name="listStyleName" select="$listStyleName" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="function-available('xt:node-set')">
+ <xsl:call-template name="create-list-type">
+ <xsl:with-param name="listStyle" select="xt:node-set($listStyleRTF)" />
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="isListNumberingReset" select="$isListNumberingReset"/>
+ <xsl:with-param name="isNextLevelNumberingReset" select="$isNextLevelNumberingReset"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listRestart" select="$listRestart"/>
+ <xsl:with-param name="itemLabel" select="$itemLabel"/>
+ <xsl:with-param name="listStyleName" select="$listStyleName" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message terminate="yes">The required node-set function was not found!</xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="create-list-type">
+ <xsl:param name="globalData"/>
+ <xsl:param name="isListNumberingReset"/>
+ <xsl:param name="isNextLevelNumberingReset"/>
+ <xsl:param name="listLevel" />
+ <xsl:param name="listRestart" />
+ <xsl:param name="itemLabel"/>
+ <xsl:param name="listStyle"/>
+ <xsl:param name="listStyleName" />
+
+ <!-- $globalData/styles-file/*/office:styles/ -->
+ <xsl:variable name="listLevelStyle" select="$listStyle/*/*[@text:level = number($listLevel)]"/>
+ <xsl:variable name="listIndent">
+ <xsl:call-template name="getListIndent">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
+ <xsl:with-param name="firstPara" select="*[1]/*[name() = 'text:p' or name() = 'text:h'][1]"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="isEmptyList" select="not(*[1]/*[name() = 'text:h' or name() = 'text:p' or name() = 'text:name'])"/>
+ <xsl:variable name="listType">
+ <xsl:choose>
+ <!-- ordered list -->
+ <xsl:when test="name($listLevelStyle) = 'text:list-level-style-number'">
+ <xsl:text>ol</xsl:text>
+ </xsl:when>
+ <!-- unordered list (bullet or image) -->
+ <xsl:otherwise>
+ <xsl:text>ul</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:element name="{$listType}">
+ <xsl:apply-templates select="*[1]" mode="listItemSibling">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="isEmptyList" select="$isEmptyList"/>
+ <xsl:with-param name="isListNumberingReset" select="$isNextLevelNumberingReset"/>
+ <xsl:with-param name="isNextLevelNumberingReset">
+ <xsl:choose>
+ <xsl:when test="$isListNumberingReset">
+ <xsl:value-of select="true()"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- A list is empty if a text:list does not have a text:list-header or text:list-item (wildcard as only those can exist beyond a text:list), which contains a text:h or text:p -->
+ <xsl:value-of select="not($isEmptyList)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="itemLabel" select="$itemLabel"/>
+ <xsl:with-param name="listIndent" select="$listIndent"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
+ <xsl:with-param name="listRestart">
+ <xsl:choose>
+ <xsl:when test="$listRestart">
+ <xsl:value-of select="$listRestart"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- descdendants restart their list numbering, when an ancestor is not empty -->
+ <xsl:value-of select="not($isEmptyList)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="listStyle" select="$listStyle"/>
+ <xsl:with-param name="listStyleName" select="$listStyleName"/>
+ <xsl:with-param name="minLabelDist">
+ <xsl:choose>
+ <xsl:when test="$listLevelStyle/*/@text:min-label-distance">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="$listLevelStyle/*/@text:min-label-distance"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="minLabelWidth">
+ <xsl:choose>
+ <xsl:when test="$listLevelStyle/*/@text:min-label-width">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="$listLevelStyle/*/@text:min-label-width"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ </xsl:apply-templates>
+ </xsl:element>
+ </xsl:template>
+
+ <!-- See comment before text:list template -->
+ <xsl:template name="getListIndent">
+ <xsl:param name="globalData"/>
+ <xsl:param name="listLevelStyle"/>
+ <!-- The first paragraph of the list item (heading is special paragraph in ODF) -->
+ <xsl:param name="firstPara" />
+
+ <!-- Styles of first paragraph in list item, including ancestor styles (inheritance) -->
+ <xsl:variable name="firstParaStyles" select="$globalData/all-styles/style[@style:name = $firstPara/@text:style-name]/final-properties"/>
+
+ <!-- Only the left margin of the first paragraph of a list item will be added to the margin of the complete list (all levels)-->
+ <xsl:variable name="firstParaLeftMargin">
+ <xsl:choose>
+ <xsl:when test="contains($firstParaStyles, 'margin-left:')">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="normalize-space(substring-before(substring-after($firstParaStyles, 'margin-left:'), ';'))"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="spaceBefore">
+ <xsl:choose>
+ <xsl:when test="$listLevelStyle/*/@text:space-before">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="$listLevelStyle/*/@text:space-before"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <!-- Only if the left-margin of the first paragraph is positive the sum
+ text:space-before and fo:left-margin is taken as list indent -->
+ <xsl:choose>
+ <xsl:when test="$firstParaLeftMargin &gt; 0">
+ <xsl:value-of select="$firstParaLeftMargin + $spaceBefore"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$spaceBefore"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- ****************** -->
+ <!-- *** list item *** -->
+ <!-- ****************** -->
+<!--
+ Left margin of the complete list:
+ The space between left page and the list symbol (left-margin) is in the Office implemented by
+ the sum of three values:
+ 1) 'text:space-before', which is part of the 'text:list-style' element.
+ 2) 'margin:left' from the style of the first child (e.g. paragraph).
+ 3) 'fo:text-indent' the indent of the first line of some child (e.g. paragraph) (applied by CSS class style)
+
+ Possible list children:
+ <!ELEMENT text:list-item (text:p|text:h|text:list|text:list)+>
+
+ In the Office the list label before the text depends on two attributes:
+ - 'text:min-label-width': the distance between list label and all text of the list item.
+ - 'text:min-label-distance': the distance between list label and text of the first line,
+ only used, when text does not fit in text:min-label-width (ignored)
+
+-->
+ <xsl:template match="text:list-item | text:list-header" mode="listItemSibling">
+ <xsl:param name="globalData"/>
+ <xsl:param name="firstitemLabelWidth"/>
+ <xsl:param name="isEmptyList" select="not(*[name() = 'text:h' or name() = 'text:p' or name() = 'text:name'])"/>
+ <xsl:param name="isListNumberingReset"/>
+ <xsl:param name="isNextLevelNumberingReset"/>
+ <xsl:param name="itemNumber"/>
+ <xsl:param name="itemLabel"/>
+ <xsl:param name="listLevel"/>
+ <xsl:param name="listLevelStyle"/>
+ <xsl:param name="listRestart"/>
+ <xsl:param name="listStyle"/>
+ <xsl:param name="listStyleName"/>
+ <xsl:param name="minLabelDist"/>
+ <xsl:param name="minLabelWidth"/>
+ <xsl:param name="listIndent" />
+
+
+ <xsl:variable name="listIndentNew">
+ <xsl:choose>
+ <xsl:when test="$listIndent">
+ <xsl:value-of select="$listIndent"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="getListIndent">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
+ <xsl:with-param name="firstPara" select="*[name() = 'text:p' or name() = 'text:h'][1]" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="itemNumberNew">
+ <xsl:if test="$listStyle/text:list-style/text:list-level-style-number">
+ <xsl:choose>
+ <xsl:when test="$isEmptyList">
+ <!-- An empty list item (no text:h/text:p as child), will not count as item and does not increment the count. -->
+ <xsl:variable name="tempItemNumber">
+ <xsl:choose>
+ <!-- siblings will be incremented by one -->
+ <xsl:when test="$itemNumber">
+ <xsl:value-of select="$itemNumber + 1"/>
+ </xsl:when>
+ <!-- if a higher list level had content the numbering starts with 1 -->
+ <xsl:when test="$isListNumberingReset and $listLevel &gt; 1">
+ <xsl:value-of select="1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="getItemNumber">
+ <xsl:with-param name="listStyleName" select="$listStyleName"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
+ <xsl:with-param name="listStyle" select="$listStyle"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <!-- in case the empty list-item is the first list-item in document -->
+ <xsl:when test="$tempItemNumber = 1">
+ <xsl:value-of select="1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$tempItemNumber - 1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="@text:start-value">
+ <xsl:value-of select="@text:start-value"/>
+ </xsl:when>
+ <!-- text:start-value from list level style will only be taken on the first list-item of a list -->
+ <xsl:when test="$listLevelStyle/@text:start-value and count(preceding-sibling::text:list-item) = 0">
+ <xsl:value-of select="$listLevelStyle/@text:start-value"/>
+ </xsl:when>
+ <!-- siblings will be incremented by one -->
+ <xsl:when test="$itemNumber">
+ <xsl:value-of select="$itemNumber + 1"/>
+ </xsl:when>
+ <!-- if a higher list level had content the numbering starts with 1 -->
+ <xsl:when test="$isListNumberingReset and $listLevel &gt; 1">
+ <xsl:value-of select="1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="getItemNumber">
+ <xsl:with-param name="listStyleName" select="$listStyleName"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
+ <xsl:with-param name="listStyle" select="$listStyle"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:variable name="itemLabelNew">
+ <xsl:if test="$listStyle/text:list-style/text:list-level-style-number">
+ <!--
+ A numbered label (e.g. 2.C.III) is created for every text:list-item/header.
+ Above list levels are listed in the label, if the list-style requires this. Levels are separated by a '.'
+ Formatation is dependent for every list level depth.
+ The label is passed from anchestor text:list-item/header and if requrired truncated.
+ The prefix/suffix (as well list level dependent) comes before and after the complete label (after truncation)
+ -->
+ <!-- Numbered label will be generated -->
+ <xsl:call-template name="createItemLabel">
+ <xsl:with-param name="itemNumber" select="$itemNumberNew"/>
+ <xsl:with-param name="itemLabel" select="$itemLabel"/>
+ <xsl:with-param name="listLevelsToDisplay">
+ <xsl:variable name="display" select="$listLevelStyle/@text:display-levels"/>
+ <xsl:choose>
+ <xsl:when test="$display">
+ <xsl:value-of select="$display"/>
+ </xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:element name="li">
+ <xsl:choose>
+ <xsl:when test="$isEmptyList">
+ <xsl:apply-templates>
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="itemLabel" select="$itemLabelNew"/>
+ <xsl:with-param name="listLevel" select="$listLevel + 1"/>
+ <xsl:with-param name="listStyleName" select="$listStyleName"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- Possible following children are text:h, text:p, list:text, text:soft-page-break -->
+ <xsl:apply-templates mode="list-item-children" select="*[1]">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="isEmptyList" select="$isEmptyList"/>
+ <xsl:with-param name="isNextLevelNumberingReset" select="$isNextLevelNumberingReset"/>
+ <!-- The new created label is given to the children -->
+ <xsl:with-param name="itemLabel" select="$itemLabelNew"/>
+ <xsl:with-param name="listLabelElement">
+ <xsl:choose>
+ <xsl:when test="name() = 'text:list-header'"/>
+ <xsl:otherwise>
+ <xsl:variable name="listLabelWidth">
+ <xsl:choose>
+ <xsl:when test="$minLabelWidth &gt; $minLabelDist">
+ <xsl:value-of select="$minLabelWidth"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$minLabelDist"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <!-- Numbering is being done by this transformation creating a HTML span representing the number label
+ The html:span represents the list item/header label (e.g. 1.A.III)
+ As the html:span is usually a inline element is formated by CSS as block element to use width upon it,
+ to disable the caridge return float:left is used and later neglected -->
+ <xsl:element name="span">
+ <xsl:if test="$listLevelStyle/@text:style-name">
+ <xsl:attribute name="class">
+ <xsl:value-of select="$listLevelStyle/@text:style-name"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="style">
+ <xsl:text>display:block;float:</xsl:text>
+ <!-- 2DO: Svante - copy this functionality for other used margin:left (in western country 'left') -->
+ <xsl:call-template name="getOppositeWritingDirection">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="paraStyleName" select="descendant-or-self::*/@text:style-name"/>
+ </xsl:call-template>
+ <xsl:text>;min-width:</xsl:text>
+ <xsl:value-of select="$listLabelWidth"/>
+ <xsl:text>cm</xsl:text>
+ </xsl:attribute>
+ <xsl:variable name="labelContent">
+ <xsl:choose>
+ <xsl:when test="text:number">
+ <xsl:apply-templates select="text:number" mode="listnumber"/>
+ </xsl:when>
+ <xsl:when test="name($listLevelStyle) = 'text:list-level-style-bullet'">
+ <xsl:value-of select="$listLevelStyle/@style:num-prefix"/>
+ <xsl:value-of select="$listLevelStyle/@text:bullet-char"/>
+ <xsl:value-of select="$listLevelStyle/@style:num-suffix"/>
+ </xsl:when>
+ <xsl:when test="name($listLevelStyle) = 'text:list-level-style-number'">
+ <xsl:value-of select="$listLevelStyle/@style:num-prefix"/>
+ <xsl:value-of select="$itemLabelNew"/>
+ <xsl:value-of select="$listLevelStyle/@style:num-suffix"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- Listing with image as bullets, taken from the list style's href -->
+ <xsl:value-of select="$listLevelStyle/@xlink:href"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <!-- Some browsers have problem with stand-alone elements (e.g. <span/>)
+ Therefore a comment is being inserted into an empty label -->
+ <xsl:choose>
+ <xsl:when test="$labelContent != ''">
+ <xsl:value-of select="$labelContent"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:comment>&#160;</xsl:comment>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="listLabelEmptyElement">
+ <xsl:variable name="listLabelWidth">
+ <xsl:choose>
+ <xsl:when test="$minLabelWidth &gt; $minLabelDist">
+ <xsl:value-of select="$minLabelWidth"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$minLabelDist"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:element name="span">
+ <xsl:if test="$listLevelStyle/@text:style-name">
+ <xsl:attribute name="class">
+ <xsl:value-of select="$listLevelStyle/@text:style-name"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="style">
+ <xsl:text>display:block;float:</xsl:text>
+ <xsl:call-template name="getOppositeWritingDirection">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="paraStyleName" select="descendant-or-self::*/@text:style-name"/>
+ </xsl:call-template>
+ <xsl:text>;min-width:</xsl:text>
+ <xsl:value-of select="$listLabelWidth"/>
+ <xsl:text>cm</xsl:text>
+ </xsl:attribute>
+ <xsl:comment>&#160;</xsl:comment>
+ </xsl:element>
+ </xsl:with-param>
+ <xsl:with-param name="listLevel" select="$listLevel + 1"/>
+ <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
+ <xsl:with-param name="listRestart" select="$listRestart"/>
+ <xsl:with-param name="listStyle" select="$listStyle"/>
+ <xsl:with-param name="listStyleName" select="$listStyleName"/>
+ <xsl:with-param name="listIndent" select="$listIndentNew"/>
+ <xsl:with-param name="minLabelWidth" select="$minLabelWidth"/>
+ </xsl:apply-templates>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:apply-templates select="following-sibling::*[1]" mode="listItemSibling">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="isListNumberingReset" select="$isListNumberingReset"/>
+ <xsl:with-param name="isNextLevelNumberingReset" select="$isNextLevelNumberingReset"/>
+ <xsl:with-param name="itemNumber" select="$itemNumberNew"/>
+ <xsl:with-param name="listIndent">
+ <xsl:choose>
+ <xsl:when test="not($isEmptyList)">
+ <xsl:value-of select="$listIndentNew"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:with-param>
+ <!-- Receives the same parent label -->
+ <xsl:with-param name="itemLabel" select="$itemLabel"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
+ <xsl:with-param name="listStyle" select="$listStyle"/>
+ <xsl:with-param name="listStyleName" select="$listStyleName"/>
+ <xsl:with-param name="minLabelDist" select="$minLabelDist"/>
+ <xsl:with-param name="minLabelWidth" select="$minLabelWidth"/>
+ </xsl:apply-templates>
+ </xsl:template>
+
+ <xsl:template name="getOppositeWritingDirection">
+ <xsl:param name="globalData"/>
+ <xsl:param name="paraStyleName"/>
+
+ <xsl:variable name="imageParagraphStyle" select="$globalData/all-styles/style[@style:name = $paraStyleName]/final-properties"/>
+
+ <xsl:choose>
+ <xsl:when test="contains($imageParagraphStyle, 'writing-mode:')">
+ <xsl:choose>
+ <xsl:when test="contains(substring-before(substring-after($imageParagraphStyle, 'writing-mode:'), ';'), 'rl')">right</xsl:when>
+ <xsl:otherwise>left</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>left</xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="text:number" mode="listnumber">
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <xsl:template match="text:number" mode="list-item-children">
+ <xsl:param name="globalData"/>
+ <xsl:param name="listLabelElement"/>
+ <xsl:param name="listLabelEmptyElement"/>
+ <xsl:param name="isEmptyList"/>
+ <xsl:param name="isListNumberingReset"/>
+ <xsl:param name="isNextLevelNumberingReset"/>
+ <xsl:param name="itemLabel"/>
+ <xsl:param name="itemNumber"/>
+ <xsl:param name="listIndent"/>
+ <xsl:param name="listLevel"/>
+ <xsl:param name="listLevelStyle" />
+ <xsl:param name="listRestart"/>
+ <xsl:param name="listStyle"/>
+ <xsl:param name="listStyleName"/>
+ <xsl:param name="minLabelWidth"/>
+
+ <xsl:apply-templates mode="list-item-children" select="following-sibling::*[1]">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="isEmptyList" select="$isEmptyList"/>
+ <xsl:with-param name="isNextLevelNumberingReset" select="$isNextLevelNumberingReset"/>
+ <xsl:with-param name="itemLabel" select="$itemLabel"/>
+ <xsl:with-param name="listLabelElement" select="$listLabelElement"/>
+ <xsl:with-param name="listLabelEmptyElement" select="$listLabelEmptyElement"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
+ <xsl:with-param name="listRestart" select="$listRestart"/>
+ <xsl:with-param name="listStyle" select="$listStyle"/>
+ <xsl:with-param name="listStyleName" select="$listStyleName"/>
+ <xsl:with-param name="listIndent" select="$listIndent"/>
+ <xsl:with-param name="minLabelWidth" select="$minLabelWidth"/>
+ </xsl:apply-templates>
+ </xsl:template>
+
+ <!-- Each key element holds the set of all text:list-item/text:list-header of a certain level and a certain style -->
+ <xsl:key name="getListItemsByLevelAndStyle" use="concat(count(ancestor::text:list), ancestor::text:list/@text:style-name)" match="text:list-item | text:list-header"/>
+ <!-- Each key element holds the set of all text:list-item/text:list-header of a certain style -->
+ <xsl:key name="getListItemsByStyle" use="ancestor::text:list/@text:style-name" match="text:list-item | text:list-header"/>
+
+
+ <!-- The Numbering start value (or offset from regular counteing) is used at the first item of offset,
+ but have to be reused on following item/headers with no text:start-value -->
+ <xsl:template name="getItemNumber">
+ <xsl:param name="listLevel"/>
+ <xsl:param name="listLevelStyle"/>
+ <xsl:param name="listStyleName"/>
+ <xsl:param name="listStyle"/>
+
+ <xsl:call-template name="countListItemTillStartValue">
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
+ <xsl:with-param name="listStyleName" select="$listStyleName"/>
+ <xsl:with-param name="listStyle" select="$listStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameLevelAndStyle" select="preceding::text:list-item[generate-id(key('getListItemsByLevelAndStyle', concat($listLevel, $listStyleName))) = generate-id(key('getListItemsByLevelAndStyle', concat(count(ancestor::text:list), ancestor::text:list/@text:style-name)))]"/>
+
+ <xsl:with-param name="precedingListItemsOfSameStyle" select="preceding::text:list-item[generate-id(key('getListItemsByStyle', $listStyleName)) = generate-id(key('getListItemsByStyle', ancestor::text:list/@text:style-name))]"/>
+ </xsl:call-template>
+ </xsl:template>
+
+ <!-- When there is a text:start-value the last have to be found and added to the number -->
+ <xsl:template name="countListItemTillStartValue">
+ <xsl:param name="IteratorSameLevelAndStyle" select="1"/>
+ <xsl:param name="IteratorSameStyle" select="1"/>
+ <xsl:param name="itemNumber" select="1"/>
+ <xsl:param name="listLevel"/>
+ <xsl:param name="listLevelStyle"/>
+ <xsl:param name="listStyle"/>
+ <xsl:param name="listStyleName"/>
+ <xsl:param name="precedingListItemsOfSameLevelAndStyle" />
+ <xsl:param name="precedingListItemsOfSameLevelAndStyleCount" select="count($precedingListItemsOfSameLevelAndStyle)"/>
+ <xsl:param name="precedingListItemsOfSameStyle" />
+ <xsl:param name="precedingListItemsOfSameStyleCount" select="count($precedingListItemsOfSameStyle)"/>
+ <!-- E.g.: If a list level 2 number is searched, a level 3 with content found with only a level 1 parent with content,
+ the level 3 gets a 'pseudoLevel' -->
+ <xsl:param name="pseudoLevel" select="0" />
+
+ <!-- set the next of preceding list items. Starting from the current to the next previous text:list-item -->
+ <xsl:variable name="precedingListItemOfSameLevelAndStyle" select="$precedingListItemsOfSameLevelAndStyle[$precedingListItemsOfSameLevelAndStyleCount - $IteratorSameLevelAndStyle + 1]"/>
+ <xsl:variable name="precedingListItemOfSameStyle" select="$precedingListItemsOfSameStyle[$precedingListItemsOfSameStyleCount - $IteratorSameStyle + 1]"/>
+ <xsl:choose>
+ <xsl:when test="($precedingListItemOfSameStyle and $precedingListItemOfSameLevelAndStyle) or ($precedingListItemOfSameStyle and $listStyle/text:list-style/@text:consecutive-numbering)">
+ <xsl:for-each select="$precedingListItemOfSameStyle">
+ <xsl:choose>
+ <!-- if it is a higher list level element -->
+ <xsl:when test="$listStyle/text:list-style/@text:consecutive-numbering">
+
+ <xsl:call-template name="countListItem">
+ <xsl:with-param name="IteratorSameLevelAndStyle" select="$IteratorSameLevelAndStyle" />
+ <xsl:with-param name="IteratorSameStyle" select="$IteratorSameStyle"/>
+ <xsl:with-param name="itemNumber" select="$itemNumber"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
+ <xsl:with-param name="listStyle" select="$listStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameLevelAndStyle" select="$precedingListItemsOfSameLevelAndStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameLevelAndStyleCount" select="$precedingListItemsOfSameLevelAndStyleCount"/>
+ <xsl:with-param name="precedingListItemsOfSameStyle" select="$precedingListItemsOfSameStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameStyleCount" select="$precedingListItemsOfSameStyleCount"/>
+ <xsl:with-param name="pseudoLevel" select="$pseudoLevel" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- NOT CONSECUTIVE NUMBERING -->
+ <xsl:variable name="currentListLevel" select="count(ancestor::text:list)"/>
+ <xsl:choose>
+ <!-- IF IT IS A HIGHER LIST LEVEL ELEMENT -->
+ <xsl:when test="$currentListLevel &lt; $listLevel">
+ <xsl:choose>
+ <!-- if it has content the counting is ended -->
+ <xsl:when test="*[name() = 'text:h' or name() = 'text:p']">
+ <!-- 2DO: Perhaps the children still have to be processed -->
+ <xsl:value-of select="$itemNumber + $pseudoLevel"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- if it is empty the counting continues -->
+ <xsl:call-template name="countListItemTillStartValue">
+ <xsl:with-param name="IteratorSameLevelAndStyle" select="$IteratorSameLevelAndStyle" />
+ <xsl:with-param name="IteratorSameStyle" select="$IteratorSameStyle + 1"/>
+ <xsl:with-param name="itemNumber" select="$itemNumber"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
+ <xsl:with-param name="listStyle" select="$listStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameLevelAndStyle" select="$precedingListItemsOfSameLevelAndStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameLevelAndStyleCount" select="$precedingListItemsOfSameLevelAndStyleCount"/>
+ <xsl:with-param name="precedingListItemsOfSameStyle" select="$precedingListItemsOfSameStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameStyleCount" select="$precedingListItemsOfSameStyleCount"/>
+ <xsl:with-param name="pseudoLevel" select="$pseudoLevel" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <!-- IF IT IS A LIST LEVEL ELEMENT OF THE COUNTING LEVEL -->
+ <xsl:when test="$currentListLevel = $listLevel">
+ <xsl:call-template name="countListItem">
+ <xsl:with-param name="IteratorSameLevelAndStyle" select="$IteratorSameLevelAndStyle" />
+ <xsl:with-param name="IteratorSameStyle" select="$IteratorSameStyle"/>
+ <xsl:with-param name="itemNumber" select="$itemNumber"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
+ <xsl:with-param name="listStyle" select="$listStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameLevelAndStyle" select="$precedingListItemsOfSameLevelAndStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameLevelAndStyleCount" select="$precedingListItemsOfSameLevelAndStyleCount"/>
+ <xsl:with-param name="precedingListItemsOfSameStyle" select="$precedingListItemsOfSameStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameStyleCount" select="$precedingListItemsOfSameStyleCount"/>
+ <xsl:with-param name="pseudoLevel" select="$pseudoLevel" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- list item below the current level does not count -->
+ <xsl:call-template name="countListItemTillStartValue">
+ <xsl:with-param name="IteratorSameLevelAndStyle" select="$IteratorSameLevelAndStyle" />
+ <xsl:with-param name="IteratorSameStyle" select="$IteratorSameStyle + 1"/>
+ <xsl:with-param name="itemNumber" select="$itemNumber"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
+ <xsl:with-param name="listStyle" select="$listStyle"/>
+ <xsl:with-param name="listStyleName" select="$listStyleName"/>
+ <xsl:with-param name="precedingListItemsOfSameLevelAndStyle" select="$precedingListItemsOfSameLevelAndStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameLevelAndStyleCount" select="$precedingListItemsOfSameLevelAndStyleCount"/>
+ <xsl:with-param name="precedingListItemsOfSameStyle" select="$precedingListItemsOfSameStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameStyleCount" select="$precedingListItemsOfSameStyleCount"/>
+ <xsl:with-param name="pseudoLevel">
+ <xsl:choose>
+ <!-- empty list item does not count -->
+ <xsl:when test="not(*[name() = 'text:h' or name() = 'text:p'])">
+ <xsl:value-of select="$pseudoLevel"/>
+ </xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$itemNumber"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="countListItem">
+ <xsl:param name="IteratorSameLevelAndStyle"/>
+ <xsl:param name="IteratorSameStyle"/>
+ <xsl:param name="itemNumber"/>
+ <xsl:param name="listLevel"/>
+ <xsl:param name="listLevelStyle"/>
+ <xsl:param name="listStyle"/>
+ <xsl:param name="listStyleName"/>
+ <xsl:param name="precedingListItemsOfSameLevelAndStyle"/>
+ <xsl:param name="precedingListItemsOfSameLevelAndStyleCount"/>
+ <xsl:param name="precedingListItemsOfSameStyle"/>
+ <xsl:param name="precedingListItemsOfSameStyleCount"/>
+ <xsl:param name="pseudoLevel" />
+
+ <xsl:choose>
+ <xsl:when test="@text:start-value">
+ <xsl:choose>
+ <xsl:when test="not(*[name() = 'text:h' or name() = 'text:p'])">
+ <!-- empty list item does not count -->
+ <xsl:call-template name="countListItemTillStartValue">
+ <xsl:with-param name="IteratorSameLevelAndStyle" select="$IteratorSameLevelAndStyle + 1" />
+ <xsl:with-param name="IteratorSameStyle" select="$IteratorSameStyle + 1"/>
+ <xsl:with-param name="itemNumber" select="$itemNumber"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
+ <xsl:with-param name="listStyle" select="$listStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameLevelAndStyle" select="$precedingListItemsOfSameLevelAndStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameLevelAndStyleCount" select="$precedingListItemsOfSameLevelAndStyleCount"/>
+ <xsl:with-param name="precedingListItemsOfSameStyle" select="$precedingListItemsOfSameStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameStyleCount" select="$precedingListItemsOfSameStyleCount"/>
+ <xsl:with-param name="pseudoLevel" select="$pseudoLevel" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$itemNumber + @text:start-value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$listLevelStyle/@text:start-value">
+ <xsl:choose>
+ <xsl:when test="not(*[name() = 'text:h' or name() = 'text:p'])">
+ <!-- empty list item does not count -->
+ <xsl:call-template name="countListItemTillStartValue">
+ <xsl:with-param name="IteratorSameLevelAndStyle" select="$IteratorSameLevelAndStyle + 1" />
+ <xsl:with-param name="IteratorSameStyle" select="$IteratorSameStyle + 1"/>
+ <xsl:with-param name="itemNumber" select="$itemNumber"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
+ <xsl:with-param name="listStyle" select="$listStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameLevelAndStyle" select="$precedingListItemsOfSameLevelAndStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameLevelAndStyleCount" select="$precedingListItemsOfSameLevelAndStyleCount"/>
+ <xsl:with-param name="precedingListItemsOfSameStyle" select="$precedingListItemsOfSameStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameStyleCount" select="$precedingListItemsOfSameStyleCount"/>
+ <xsl:with-param name="pseudoLevel" select="$pseudoLevel" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$itemNumber + $listLevelStyle/@text:start-value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="not(*[name() = 'text:h' or name() = 'text:p'])">
+ <!-- empty list item does not count -->
+ <xsl:call-template name="countListItemTillStartValue">
+ <xsl:with-param name="IteratorSameLevelAndStyle" select="$IteratorSameLevelAndStyle + 1" />
+ <xsl:with-param name="IteratorSameStyle" select="$IteratorSameStyle + 1"/>
+ <xsl:with-param name="itemNumber" select="$itemNumber"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
+ <xsl:with-param name="listStyle" select="$listStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameLevelAndStyle" select="$precedingListItemsOfSameLevelAndStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameLevelAndStyleCount" select="$precedingListItemsOfSameLevelAndStyleCount"/>
+ <xsl:with-param name="precedingListItemsOfSameStyle" select="$precedingListItemsOfSameStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameStyleCount" select="$precedingListItemsOfSameStyleCount"/>
+ <xsl:with-param name="pseudoLevel" select="$pseudoLevel" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- count on till you find a start-value or the end is reached -->
+ <xsl:call-template name="countListItemTillStartValue">
+ <xsl:with-param name="IteratorSameLevelAndStyle" select="$IteratorSameLevelAndStyle + 1" />
+ <xsl:with-param name="IteratorSameStyle" select="$IteratorSameStyle + 1"/>
+ <xsl:with-param name="itemNumber" select="$itemNumber + 1"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
+ <xsl:with-param name="listStyle" select="$listStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameLevelAndStyle" select="$precedingListItemsOfSameLevelAndStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameLevelAndStyleCount" select="$precedingListItemsOfSameLevelAndStyleCount"/>
+ <xsl:with-param name="precedingListItemsOfSameStyle" select="$precedingListItemsOfSameStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameStyleCount" select="$precedingListItemsOfSameStyleCount"/>
+ <xsl:with-param name="pseudoLevel" select="0" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <!-- Creates the list label containing the number, which is separated by '.' between the levels.
+ Depending on the levels to display (listLevelsToDisplay) -->
+ <xsl:template name="createItemLabel">
+ <xsl:param name="itemLabel" select="''"/>
+ <xsl:param name="itemNumber" />
+ <xsl:param name="listLevel" />
+ <xsl:param name="listLevelStyle" />
+ <xsl:param name="listLevelsToDisplay" />
+
+ <xsl:choose>
+ <xsl:when test="$listLevelsToDisplay &lt; $listLevel">
+ <xsl:call-template name="truncLabel">
+ <xsl:with-param name="itemLabel" select="$itemLabel"/>
+ <xsl:with-param name="itemNumber" select="$itemNumber" />
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listLevelStyle" select="$listLevelStyle" />
+ <xsl:with-param name="listLevelsToDisplay" select="$listLevelsToDisplay"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="numberedSymbol">
+ <xsl:comment>&#160;</xsl:comment>
+ <!-- only give out a number when number format is not empty -->
+ <xsl:if test="$listLevelStyle/@style:num-format != ''">
+ <xsl:number value="$itemNumber" format="{$listLevelStyle/@style:num-format}"/>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$listLevelsToDisplay != 1">
+ <xsl:value-of select="concat($itemLabel, '.' , $numberedSymbol)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$numberedSymbol"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="truncLabel">
+ <xsl:param name="itemLabel" />
+ <xsl:param name="itemNumber" />
+ <xsl:param name="listLevel" />
+ <xsl:param name="listLevelStyle" />
+ <xsl:param name="listLevelsToDisplay" />
+ <xsl:param name="listStyle" />
+ <xsl:param name="listStyleName" />
+
+ <xsl:call-template name="createItemLabel">
+ <xsl:with-param name="itemLabel">
+ <xsl:if test="contains($itemLabel, '.')">
+ <xsl:value-of select="substring-after($itemLabel, '.')"/>
+ </xsl:if>
+ </xsl:with-param>
+ <xsl:with-param name="itemNumber" select="$itemNumber"/>
+ <xsl:with-param name="listLevel" select="$listLevel - 1"/>
+ <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
+ <xsl:with-param name="listLevelsToDisplay" select="$listLevelsToDisplay"/>
+ </xsl:call-template>
+ </xsl:template>
+
+
+ <xsl:template match="text:p" mode="list-item-children">
+ <xsl:param name="globalData"/>
+ <xsl:param name="listLabelElement"/>
+ <xsl:param name="listLabelEmptyElement"/>
+ <xsl:param name="isEmptyList"/>
+ <xsl:param name="isListNumberingReset"/>
+ <xsl:param name="isNextLevelNumberingReset"/>
+ <xsl:param name="itemLabel"/>
+ <xsl:param name="itemNumber"/>
+ <xsl:param name="listIndent"/>
+ <xsl:param name="listLevel"/>
+ <xsl:param name="listRestart"/>
+ <xsl:param name="listStyle"/>
+ <xsl:param name="listStyleName"/>
+ <xsl:param name="minLabelWidth"/>
+
+ <!-- 2DO page alignment fix - PART1 -->
+
+ <!-- xhtml:p may only contain inline elements.
+ If there is one frame beyond, div must be used! -->
+ <xsl:variable name="elementName">
+ <xsl:choose>
+ <xsl:when test="descendant::draw:frame[1] or descendant::text:p[1]">div</xsl:when>
+ <xsl:otherwise>p</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:element name="{$elementName}">
+ <xsl:call-template name="create-list-style">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="listIndent" select="$listIndent"/>
+ <xsl:with-param name="styleName" select="@text:style-name"/>
+ </xsl:call-template>
+ <xsl:choose>
+ <xsl:when test="$listLabelElement">
+ <xsl:copy-of select="$listLabelElement"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:copy-of select="$listLabelEmptyElement"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:apply-templates>
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="listIndent" select="$minLabelWidth"/>
+ </xsl:apply-templates>
+ <!-- this span disables the float necessary to bring two block elements on one line. It contains a space as IE6 bug workaround -->
+ <span class="odfLiEnd"></span>
+ <xsl:text>&#160;</xsl:text>
+ </xsl:element>
+
+ <xsl:apply-templates mode="list-item-children" select="following-sibling::*[1]">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="isEmptyList" select="$isEmptyList"/>
+ <xsl:with-param name="isListNumberingReset" select="$isListNumberingReset"/>
+ <xsl:with-param name="isNextLevelNumberingReset" select="$isNextLevelNumberingReset"/>
+ <xsl:with-param name="itemLabel" select="$itemLabel"/>
+ <xsl:with-param name="itemNumber" select="$itemNumber"/>
+ <xsl:with-param name="listLabelEmptyElement" select="$listLabelEmptyElement"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listRestart" select="$listRestart"/>
+ <xsl:with-param name="listStyle" select="$listStyle"/>
+ <xsl:with-param name="listStyleName" select="$listStyleName"/>
+ <xsl:with-param name="listIndent" select="$listIndent"/>
+ <xsl:with-param name="minLabelWidth" select="$minLabelWidth"/>
+ </xsl:apply-templates>
+ </xsl:template>
+
+
+ <!-- Neglecting the left margin behavior for headings for now -->
+ <xsl:template match="text:h" mode="list-item-children">
+ <xsl:param name="globalData"/>
+ <xsl:param name="listLabelElement"/>
+ <xsl:param name="listLabelEmptyElement"/>
+ <xsl:param name="isEmptyList"/>
+ <xsl:param name="isListNumberingReset"/>
+ <xsl:param name="isNextLevelNumberingReset"/>
+ <xsl:param name="itemLabel"/>
+ <xsl:param name="itemNumber"/>
+ <xsl:param name="listIndent"/>
+ <xsl:param name="listLevel"/>
+ <xsl:param name="listRestart"/>
+ <xsl:param name="listStyle"/>
+ <xsl:param name="listStyleName"/>
+ <xsl:param name="minLabelWidth"/>
+
+ <xsl:element name="h">
+ <xsl:call-template name="create-list-style">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="listIndent" select="$listIndent"/>
+ <xsl:with-param name="styleName" select="@text:style-name"/>
+ </xsl:call-template>
+ <xsl:variable name="title">
+ <xsl:apply-templates mode="concatenate"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$listLabelElement">
+ <xsl:copy-of select="$listLabelElement"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:copy-of select="$listLabelEmptyElement"/>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ <!-- REFERENCE HANDLING - ANCHOR -->
+ <xsl:element namespace="{$namespace}" name="a">
+ <xsl:attribute name="id">
+ <xsl:value-of select="translate(concat('a_',$listLabelElement, '_', normalize-space($title)), '&#xA;&amp;&lt;&gt;.,;: %()[]/\+', '___________________________')"/>
+ </xsl:attribute>
+ <xsl:apply-templates>
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="listIndent" select="$minLabelWidth"/>
+ </xsl:apply-templates>
+ </xsl:element>
+
+ <!-- this span disables the float necessary to bring two block elements on one line. It contains a space as IE6 bug workaround -->
+ <span class="odfLiEnd"></span>
+ <xsl:text>&#160;</xsl:text>
+ </xsl:element>
+
+ <xsl:apply-templates mode="list-item-children" select="following-sibling::*[1]">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="isEmptyList" select="$isEmptyList"/>
+ <xsl:with-param name="isListNumberingReset" select="$isListNumberingReset"/>
+ <xsl:with-param name="isNextLevelNumberingReset" select="$isNextLevelNumberingReset"/>
+ <xsl:with-param name="itemLabel" select="$itemLabel"/>
+ <xsl:with-param name="itemNumber" select="$itemNumber"/>
+ <xsl:with-param name="listLabelEmptyElement" select="$listLabelEmptyElement"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listRestart" select="$listRestart"/>
+ <xsl:with-param name="listStyle" select="$listStyle"/>
+ <xsl:with-param name="listStyleName" select="$listStyleName"/>
+ <xsl:with-param name="listIndent" select="$listIndent"/>
+ <xsl:with-param name="minLabelWidth" select="$minLabelWidth"/>
+ </xsl:apply-templates>
+ </xsl:template>
+
+
+ <xsl:template match="*" mode="list-item-children">
+ <xsl:param name="globalData"/>
+ <xsl:param name="isEmptyList"/>
+ <xsl:param name="listLabelEmptyElement"/>
+ <xsl:param name="isListNumberingReset"/>
+ <xsl:param name="isNextLevelNumberingReset"/>
+ <xsl:param name="itemLabel"/>
+ <xsl:param name="itemNumber"/>
+ <xsl:param name="listIndent"/>
+ <xsl:param name="listLevel"/>
+ <xsl:param name="listRestart"/>
+ <xsl:param name="listStyle"/>
+ <xsl:param name="listStyleName"/>
+ <xsl:param name="minLabelWidth"/>
+
+ <xsl:apply-templates select="self::*">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="isEmptyList" select="$isEmptyList"/>
+ <xsl:with-param name="isListNumberingReset" select="$isListNumberingReset"/>
+ <xsl:with-param name="isNextLevelNumberingReset" select="$isNextLevelNumberingReset"/>
+ <xsl:with-param name="listLabelEmptyElement" select="$listLabelEmptyElement"/>
+ <xsl:with-param name="itemLabel" select="$itemLabel"/>
+ <xsl:with-param name="itemNumber" select="$itemNumber"/>
+ <xsl:with-param name="listIndent" select="$listIndent"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listRestart" select="$listRestart"/>
+ <xsl:with-param name="listStyle" select="$listStyle"/>
+ <xsl:with-param name="listStyleName" select="$listStyleName"/>
+ </xsl:apply-templates>
+
+ <xsl:apply-templates mode="list-item-children" select="following-sibling::*[1]">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="isEmptyList" select="$isEmptyList"/>
+ <xsl:with-param name="isListNumberingReset" select="$isListNumberingReset"/>
+ <xsl:with-param name="isNextLevelNumberingReset" select="$isNextLevelNumberingReset"/>
+ <xsl:with-param name="itemLabel" select="$itemLabel"/>
+ <xsl:with-param name="itemNumber" select="$itemNumber"/>
+ <xsl:with-param name="listLabelEmptyElement" select="$listLabelEmptyElement"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listRestart" select="$listRestart"/>
+ <xsl:with-param name="listStyle" select="$listStyle"/>
+ <xsl:with-param name="listStyleName" select="$listStyleName"/>
+ <xsl:with-param name="listIndent" select="$listIndent"/>
+ <xsl:with-param name="minLabelWidth" select="$minLabelWidth"/>
+ </xsl:apply-templates>
+ </xsl:template>
+
+ <xsl:template match="*" mode="listItemSibling">
+ <xsl:param name="globalData"/>
+ <xsl:param name="isEmptyList"/>
+ <xsl:param name="isListNumberingReset"/>
+ <xsl:param name="isNextLevelNumberingReset"/>
+ <xsl:param name="itemLabel"/>
+ <xsl:param name="itemNumber"/>
+ <xsl:param name="listIndent"/>
+ <xsl:param name="listLevel"/>
+ <xsl:param name="listRestart"/>
+ <xsl:param name="listStyle"/>
+ <xsl:param name="listStyleName"/>
+
+ <xsl:apply-templates select="self::*">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="isEmptyList" select="$isEmptyList"/>
+ <xsl:with-param name="isListNumberingReset" select="$isListNumberingReset"/>
+ <xsl:with-param name="isNextLevelNumberingReset" select="$isNextLevelNumberingReset"/>
+ <xsl:with-param name="itemNumber" select="$itemNumber"/>
+ <xsl:with-param name="listIndent" select="$listIndent"/>
+ <!-- receives the same parent label, only with a different itemNumber -->
+ <xsl:with-param name="itemLabel" select="$itemLabel"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listStyle" select="$listStyle"/>
+ <xsl:with-param name="listStyleName" select="$listStyleName"/>
+ </xsl:apply-templates>
+ <xsl:apply-templates select="following-sibling::*[1]" mode="listItemSibling">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="isEmptyList" select="$isEmptyList"/>
+ <xsl:with-param name="isListNumberingReset" select="$isListNumberingReset"/>
+ <xsl:with-param name="isNextLevelNumberingReset" select="$isNextLevelNumberingReset"/>
+ <xsl:with-param name="itemNumber" select="$itemNumber"/>
+ <xsl:with-param name="listIndent" select="$listIndent"/>
+ <!-- receives the same parent label, only with a different itemNumber -->
+ <xsl:with-param name="itemLabel" select="$itemLabel"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listStyle" select="$listStyle"/>
+ <xsl:with-param name="listStyleName" select="$listStyleName"/>
+ </xsl:apply-templates>
+ </xsl:template>
+
+ <xsl:template match="text()" mode="list-item-children">
+ <xsl:value-of select="."/>
+ </xsl:template>
+
+
+ <xsl:template name="create-list-style">
+ <xsl:param name="globalData"/>
+ <xsl:param name="listIndent" select="0"/>
+ <xsl:param name="styleName"/>
+
+ <xsl:if test="$styleName">
+ <xsl:attribute name="class">
+ <xsl:value-of select="translate($styleName, '.,;: %()[]/\+', '_____________')"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="style">
+ <xsl:text>margin-</xsl:text>
+ <xsl:call-template name="getOppositeWritingDirection">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="paraStyleName" select="descendant-or-self::*/@text:style-name"/>
+ </xsl:call-template>
+ <xsl:text>:</xsl:text>
+ <xsl:value-of select="$listIndent"/>
+ <xsl:text>cm;</xsl:text>
+ </xsl:attribute>
+ </xsl:template>
+
+
+ <!-- ********************************************** -->
+ <!-- *** Text Section (contains: draw:text-box) *** -->
+ <!-- ********************************************** -->
+
+ <xsl:template match="text:section">
+ <xsl:param name="globalData"/>
+
+ <xsl:if test="not(contains(@text:display, 'none'))">
+ <xsl:comment>Next 'div' was a 'text:section'.</xsl:comment>
+ <xsl:element name="div">
+ <xsl:call-template name="apply-styles-and-content">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+
+
+ <!-- Hidden text dependend on Office variables:
+ The text is not shown, if condition is 'true'.
+ Implemented solely for conditons as '<VARIABLE>==0' or '<VARIABLE>==1'
+ -->
+ <xsl:key match="text:variable-set" name="varSet" use="@text:name"/>
+ <xsl:template match="text:hidden-text">
+ <xsl:param name="globalData"/>
+
+ <xsl:variable name="varName" select="substring-before(@text:condition, '==')"/>
+ <xsl:variable name="varValue" select="substring-after(@text:condition, '==')"/>
+ <xsl:choose>
+ <xsl:when test="key('varSet', $varName)/@text:value != $varValue">
+ <xsl:value-of select="@text:string-value"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:comment>
+ <xsl:value-of select="$varName"/>
+ <xsl:value-of select="@text:string-value"/>
+ <xsl:value-of select="$varName"/>
+ </xsl:comment>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="@text:style-name | @draw:style-name | @draw:text-style-name | @table:style-name"><!-- | @presentation:style-name-->
+ <xsl:param name="globalData"/>
+
+ <xsl:attribute name="class">
+ <xsl:value-of select="translate(., '.,;: %()[]/\+', '_____________')"/>
+ </xsl:attribute>
+ </xsl:template>
+
+
+ <!-- ***************** -->
+ <!-- *** Footnotes *** -->
+ <!-- ***************** -->
+
+ <xsl:template match="text:note">
+ <xsl:param name="globalData"/>
+
+ <!-- get style configuration -->
+ <xsl:variable name="footnoteConfig" select="$globalData/office:styles/text:notes-configuration[@text:note-class=current()/@text:note-class]" />
+
+ <xsl:variable name="titlePrefix">
+ <xsl:choose>
+ <xsl:when test="@text:note-class = 'footnote'">
+ <xsl:text>Footnote: </xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>Endnote: </xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <!-- write anchor -->
+ <xsl:element name="span">
+ <xsl:attribute name="class">
+ <xsl:value-of select="$footnoteConfig/@text:citation-body-style-name"/>
+ </xsl:attribute>
+ <xsl:attribute name="title">
+ <xsl:value-of select="$titlePrefix"/>
+ <xsl:apply-templates mode="textOnly" select="text:note-body"/>
+ </xsl:attribute>
+ <xsl:element name="a">
+ <xsl:attribute name="href">
+ <xsl:value-of select="concat('#', @text:id)"/>
+ </xsl:attribute>
+ <xsl:attribute name="id">
+ <xsl:value-of select="concat('body_', @text:id)"/>
+ </xsl:attribute>
+ <xsl:apply-templates mode="textOnly" select="text:note-citation"/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="*" mode="textOnly">
+ <xsl:apply-templates select="* | text()" mode="textOnly" />
+ </xsl:template>
+
+ <xsl:template match="text()" mode="textOnly">
+ <xsl:value-of select="."/>
+ </xsl:template>
+
+ <!-- Useful in case of 'style:map', conditional formatting, where a style references to another -->
+ <xsl:key name="textNotes" match="text:note" use="@text:note-class"/>
+
+ <!-- writing the footer- and endnotes beyond the body -->
+ <xsl:template name="write-text-nodes">
+ <xsl:param name="globalData"/>
+
+ <!-- write footnote body -->
+ <xsl:for-each select="key('textNotes', 'footnote')">
+ <xsl:call-template name="write-text-node">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="footnoteConfig" select="$globalData/office:styles/text:notes-configuration[@text:note-class=current()/@text:note-class]" />
+ </xsl:call-template>
+ </xsl:for-each>
+
+ <!-- write endnote body -->
+ <xsl:for-each select="key('textNotes', 'endnote')">
+ <xsl:call-template name="write-text-node">
+
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="footnoteConfig" select="$globalData/office:styles/text:notes-configuration[@text:note-class=current()/@text:note-class]" />
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:template>
+
+ <xsl:template name="write-text-node">
+ <xsl:param name="globalData"/>
+ <xsl:param name="footnoteConfig"/>
+
+ <xsl:apply-templates select="text:note-body/*[1]">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="footnotePrefix">
+ <xsl:element name="span">
+ <xsl:attribute name="class">footnodeNumber</xsl:attribute>
+ <xsl:element name="a">
+ <xsl:attribute name="class">
+ <xsl:value-of select="$footnoteConfig/@text:citation-style-name"/>
+ </xsl:attribute>
+ <xsl:attribute name="id">
+ <xsl:value-of select="@text:id"/>
+ </xsl:attribute>
+ <xsl:attribute name="href">
+ <xsl:value-of select="concat('#body_', @text:id)"/>
+ </xsl:attribute>
+ <xsl:apply-templates mode="textOnly" select="text:note-citation"/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:with-param>
+ </xsl:apply-templates>
+ <xsl:apply-templates select="text:note-body/*[position()&gt;1]">
+ <xsl:with-param name="globalData" select="$globalData" />
+ </xsl:apply-templates>
+ </xsl:template>
+
+ <!-- DISABLING this tab handling as the tab width is only relative
+ <xsl:template match="text:tab">
+ <xsl:param name="globalData"/>
+
+ <xsl:variable name="tabNo">
+ <xsl:choose>
+ <xsl:when test="preceding-sibling::text:line-break">
+ <xsl:call-template name="countTextTab"/>
+ </xsl:when>
+ <xsl:when test="preceding-sibling::text:tab">
+ <xsl:value-of select="count(preceding-sibling::text:tab)"/>
+ </xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:element name="span">
+ <xsl:attribute name="style">margin-left:<xsl:value-of select="$globalData/all-doc-styles/style[@style:name = current()/parent::*/@text:style-name]/*/style:tab-stops/style:tab-stop[$tabNo]/@style:position"/>;</xsl:attribute>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template name="countTextTab">
+ <xsl:param name="tabCount" select="1"/>
+ <xsl:param name="context" select="."/>
+
+ <xsl:choose>
+ <xsl:when test="preceding-sibling::*[1]">
+ <xsl:for-each select="preceding-sibling::*[1]">
+ <xsl:call-template name="countTextTab">
+ <xsl:with-param name="tabCout">
+ <xsl:choose>
+ <xsl:when test="name(.) = 'text:tab'">
+ <xsl:value-of select="$tabCount + 1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$tabCount"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="context" select="preceding-sibling::*[1]" />
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$tabCount"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+-->
+ <!-- MathML -->
+ <xsl:template match="draw:object[math:math]">
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
+ <xsl:apply-templates select="math:math/math:semantics/*" mode="math"/>
+ </math>
+ </xsl:template>
+
+ <xsl:template match="*" mode="math">
+ <xsl:element name="{local-name()}" namespace="http://www.w3.org/1998/Math/MathML">
+ <xsl:apply-templates select="@*|node()" mode="math"/>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="@*" mode="math">
+ <xsl:attribute name="{local-name()}">
+ <xsl:value-of select="."/>
+ </xsl:attribute>
+ </xsl:template>
+
+ <xsl:template match="math:annotation" mode="math"/>
+
+</xsl:stylesheet>
diff --git a/filter/source/xslt/odf2xhtml/export/xhtml/header.xsl b/filter/source/xslt/odf2xhtml/export/xhtml/header.xsl
new file mode 100644
index 000000000000..ab2c9bbaa866
--- /dev/null
+++ b/filter/source/xslt/odf2xhtml/export/xhtml/header.xsl
@@ -0,0 +1,484 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<!--
+ For further documentation and updates visit http://xml.openoffice.org/odf2xhtml
+-->
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
+ xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0"
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:dom="http://www.w3.org/2001/xml-events"
+ xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
+ xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
+ xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
+ xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
+ xmlns:math="http://www.w3.org/1998/Math/MathML"
+ xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
+ xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
+ xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
+ xmlns:ooo="http://openoffice.org/2004/office"
+ xmlns:oooc="http://openoffice.org/2004/calc"
+ xmlns:ooow="http://openoffice.org/2004/writer"
+ xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
+ xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
+ xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
+ xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
+ xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
+ xmlns:xforms="http://www.w3.org/2002/xforms"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ exclude-result-prefixes="chart config dc dom dr3d draw fo form math meta number office ooo oooc ooow script style svg table text xforms xlink xsd xsi xforms xsd xsi"
+ xmlns="http://www.w3.org/1999/xhtml">
+
+
+ <!-- ************** -->
+ <!-- *** header *** -->
+ <!-- ************** -->
+
+ <xsl:template name="create-header">
+ <xsl:param name="globalData" />
+
+ <xsl:element name="head">
+ <xsl:attribute name="profile">http://dublincore.org/documents/dcmi-terms/</xsl:attribute>
+ <xsl:if test="$debugEnabled"><xsl:message>CSS helper variable will be created....</xsl:message></xsl:if>
+ <xsl:call-template name='xhtml-header-properties'>
+ <xsl:with-param name="globalData" select="$globalData" />
+ </xsl:call-template>
+
+ <xsl:if test="$debugEnabled"><xsl:message>CSS variable ready, header will be created....</xsl:message></xsl:if>
+ <!-- constructing the css header simulating inheritance of style-families by style order -->
+ <xsl:call-template name='create-css-styleheader'>
+ <xsl:with-param name="globalData" select="$globalData" />
+ </xsl:call-template>
+ <xsl:if test="$debugEnabled"><xsl:message>CSS header creation finished!</xsl:message></xsl:if>
+ </xsl:element>
+
+ </xsl:template>
+
+
+ <!-- Creating a CSS style header from the collected styles of the 'globalData' parameter -->
+ <xsl:template name='create-css-styleheader'>
+ <xsl:param name="globalData" />
+
+ <xsl:element name="style">
+ <xsl:attribute name="type">text/css</xsl:attribute>
+<xsl:text>
+ </xsl:text>
+ <xsl:call-template name='create-page-layout'>
+ <xsl:with-param name="globalData" select="$globalData" />
+ </xsl:call-template>
+<xsl:text>table { border-collapse:collapse; border-spacing:0; empty-cells:show }
+ </xsl:text>
+ <xsl:choose>
+ <xsl:when test="/*/office:body/office:spreadsheet"><xsl:text>td, th { vertical-align:top; font-size:10pt;}
+ </xsl:text></xsl:when>
+ <xsl:otherwise><xsl:text>td, th { vertical-align:top; font-size:12pt;}
+ </xsl:text></xsl:otherwise>
+ </xsl:choose>
+<xsl:text>h1, h2, h3, h4, h5, h6 { clear:both }
+ </xsl:text>
+<xsl:text>ol, ul { margin:0; padding:0;}
+ </xsl:text>
+<xsl:text>li { list-style: none; margin:0; padding:0;}
+ </xsl:text>
+<xsl:comment> "li span.odfLiEnd" - IE 7 issue</xsl:comment>
+<xsl:text>
+ </xsl:text>
+<xsl:text>li span. { clear: both; line-height:0; width:0; height:0; margin:0; padding:0; }
+ </xsl:text>
+<xsl:text>span.footnodeNumber { padding-right:1em; }
+ </xsl:text>
+<xsl:text>span.annotation_style_by_filter { font-size:95%; font-family:Arial; background-color:#fff000; margin:0; border:0; padding:0; }
+ </xsl:text>
+<xsl:text>* { margin:0;}
+ </xsl:text>
+ <xsl:call-template name="write-mapped-CSS-styles">
+ <xsl:with-param name="globalData" select="$globalData" />
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template name="write-mapped-CSS-styles">
+ <xsl:param name="globalData" />
+ <xsl:param name="styleNo" select="1"/>
+ <xsl:param name="emptyStyles"/>
+
+ <xsl:choose>
+ <xsl:when test="$globalData/all-styles/style[$styleNo]">
+ <!-- If there is still a style to be written -->
+ <!-- setting the context -->
+ <xsl:for-each select="$globalData/all-styles/style[$styleNo]">
+ <xsl:choose>
+ <xsl:when test="final-properties != ''">
+ <!-- NOTE: easy process, as only the style family in conjunction with the style name, makes the style unambigous -->
+ <xsl:text>.</xsl:text><!--<xsl:value-of select="@style:family" /><xsl:text>:</xsl:text>--><xsl:value-of select="translate(@style:name, '.,;: %()[]/\+', '_____________')"/><xsl:text> { </xsl:text> <xsl:value-of select="final-properties" /><xsl:text>}
+ </xsl:text>
+ <xsl:call-template name="write-mapped-CSS-styles">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="emptyStyles" select="$emptyStyles"/>
+ <xsl:with-param name="styleNo" select="$styleNo + 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="write-mapped-CSS-styles">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="emptyStyles" select="concat($emptyStyles, '.', @style:name, ' ')"/>
+ <xsl:with-param name="styleNo" select="$styleNo + 1"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- Otherwise all styles have been processed and the empty styles have to be given out -->
+ <xsl:comment> ODF styles with no properties representable as CSS </xsl:comment><xsl:text>
+ </xsl:text><xsl:value-of select="$emptyStyles"/><xsl:text>{ }
+ </xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <!-- Creating CSS page layout based on first office master style -->
+ <xsl:template name='create-page-layout'>
+ <xsl:param name="globalData" />
+
+ <!-- approximation to find the correct master page style (with page dimensions) -->
+ <xsl:variable name="masterPageNames">
+ <!-- set context to styles.xml -->
+ <xsl:for-each select="$globalData/all-doc-styles/style">
+ <!-- Loop over every style:style containing a @style:master-page-name attribute -->
+ <xsl:for-each select="key('masterPage','count')">
+ <!-- set context to styles.xml -->
+ <xsl:for-each select="/*/office:body">
+ <!-- Check if this style is being used in the body -->
+ <xsl:if test="key('elementUsingStyle', ../@style:name)">
+ <!-- Check every master-page-name if it is not emtpy and return as ';' separated list -->
+ <xsl:if test="string-length(../@style:master-page-name) &gt; 0"><xsl:value-of select="../@style:master-page-name"/>;</xsl:if>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:for-each>
+ </xsl:for-each>
+ </xsl:variable>
+ <!-- Take the first of the masterpage list and get the according style:master-page element and find the @style:page-layout-name -->
+ <xsl:variable name="pageLayoutName" select="key('masterPageElements', substring-before($masterPageNames,';'))/@style:page-layout-name"/>
+ <!-- Find the according style:page-layout and store the properties in a variable -->
+ <xsl:variable name="pageProperties" select="key('pageLayoutElements', $pageLayoutName)/style:page-layout-properties"/>
+
+<xsl:text>@page { </xsl:text>
+
+ <xsl:call-template name="page-size">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="pageProperties" select="$pageProperties" />
+ </xsl:call-template>
+ <xsl:call-template name="page-margin">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="pageProperties" select="$pageProperties" />
+ </xsl:call-template>
+
+<xsl:text> }
+ </xsl:text>
+
+ </xsl:template>
+
+
+ <xsl:template name="page-size">
+ <xsl:param name="globalData" />
+ <xsl:param name="pageProperties" />
+
+ <xsl:variable name="printOrientation" select="$pageProperties/@style:print-orientation" />
+ <xsl:variable name="pageWidth" select="$pageProperties/@fo:page-width" />
+ <xsl:variable name="pageHeight" select="$pageProperties/@fo:page-height" />
+ <xsl:choose>
+ <xsl:when test="$pageWidth and $pageHeight">
+ <xsl:text>size: </xsl:text>
+ <xsl:value-of select="$pageWidth" />
+ <xsl:text> </xsl:text>
+ <xsl:value-of select="$pageHeight" />
+ <xsl:text>; </xsl:text>
+ </xsl:when>
+ <xsl:when test="$printOrientation">
+ <xsl:text>size: </xsl:text>
+ <xsl:value-of select="$printOrientation" />
+ <xsl:text>; </xsl:text>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+
+
+
+ <xsl:template name="page-margin">
+ <xsl:param name="globalData" />
+ <xsl:param name="pageProperties" />
+
+ <xsl:variable name="marginTop" select="$pageProperties/@fo:margin-top" />
+ <xsl:if test="$marginTop">
+ <xsl:text>margin-top: </xsl:text>
+ <xsl:value-of select="$marginTop" />
+ <xsl:text>; </xsl:text>
+ </xsl:if>
+ <xsl:variable name="marginBottom" select="$pageProperties/@fo:margin-bottom" />
+ <xsl:if test="$marginBottom">
+ <xsl:text>margin-bottom: </xsl:text>
+ <xsl:value-of select="$marginBottom" />
+ <xsl:text>; </xsl:text>
+ </xsl:if>
+ <xsl:variable name="marginLeft" select="$pageProperties/@fo:margin-left" />
+ <xsl:if test="$marginLeft">
+ <xsl:text>margin-left: </xsl:text>
+ <xsl:value-of select="$marginLeft" />
+ <xsl:text>; </xsl:text>
+ </xsl:if>
+ <xsl:variable name="marginRight" select="$pageProperties/@fo:margin-right" />
+ <xsl:if test="$marginRight">
+ <xsl:text>margin-right: </xsl:text>
+ <xsl:value-of select="$marginRight" />
+ </xsl:if>
+ </xsl:template>
+
+
+ <!-- *************************** -->
+ <!-- *** Common XHTML header *** -->
+ <!-- *************************** -->
+
+ <xsl:template name='xhtml-header-properties'>
+ <xsl:param name="globalData" />
+
+ <xsl:variable name="netloc">
+ <xsl:for-each select="$globalData/meta-file/*/office:meta/meta:user-defined">
+ <xsl:if test="./@meta:name='ODF.base'">
+ <xsl:value-of select="." />
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:for-each select="$globalData/meta-file/*/office:meta/meta:user-defined">
+ <xsl:if test="./@meta:name='ODF.filename'">
+ <xsl:value-of select="." />
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:variable>
+
+ <xsl:variable name="lang">
+ <xsl:choose>
+ <xsl:when test="$globalData/meta-file/*/office:meta/dc:language">
+ <xsl:value-of select="$globalData/meta-file/*/office:meta/dc:language" />
+ </xsl:when>
+ <xsl:otherwise>en-US</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:variable name="prov">
+ <xsl:choose>
+ <xsl:when test="$globalData/meta-file/*/office:meta/meta:printed-by">
+ <xsl:value-of select="concat('Printed by &quot;',$globalData/meta-file/*/office:meta/meta:printed-by,'&quot;[dc:publisher] on &quot;',$globalData/meta-file/*/office:meta/meta:print-date,'&quot;[dc:date] in &quot;',$lang,'&quot;[dc:language]')" />
+ </xsl:when>
+ <xsl:otherwise />
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:variable name="keywords">
+ <xsl:for-each select="$globalData/meta-file/*/office:meta/meta:keyword">
+ <xsl:value-of select="." />
+ <xsl:if test="position() != last()">
+ <xsl:text>, </xsl:text>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:variable>
+
+ <!-- explicit output content-type for low-tech browser (e.g. IE6) -->
+ <xsl:element name="meta">
+ <xsl:attribute name="http-equiv">Content-Type</xsl:attribute>
+ <xsl:attribute name="content">application/xhtml+xml; charset=utf-8</xsl:attribute>
+ </xsl:element>
+
+ <!-- title of document for browser frame title -->
+ <xsl:element name="title">
+ <xsl:attribute name="lang" namespace="http://www.w3.org/XML/1998/namespace">
+ <xsl:value-of select="$lang" />
+ </xsl:attribute>
+
+ <xsl:choose>
+ <xsl:when test="$globalData/meta-file/*/office:meta/dc:title">
+ <xsl:value-of select="$globalData/meta-file/*/office:meta/dc:title" />
+ </xsl:when>
+ <!-- providing the mandatory title is a workaround for an IE bug-->
+ <xsl:otherwise>
+ <xsl:text>- no title specified</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+
+ <!-- title, in DC syntax -->
+ <xsl:element name="meta">
+ <xsl:attribute name="name">DCTERMS.title</xsl:attribute>
+ <xsl:attribute name="content">
+ <xsl:value-of select="$globalData/meta-file/*/office:meta/dc:title" />
+ </xsl:attribute>
+ <xsl:attribute name="lang" namespace="http://www.w3.org/XML/1998/namespace">
+ <xsl:value-of select="$lang" />
+ </xsl:attribute>
+ </xsl:element>
+
+ <!-- the identifier for source (identifier) -->
+ <xsl:call-template name="add-meta-tag">
+ <xsl:with-param name="meta-name" select="'DCTERMS.identifier'" />
+ <xsl:with-param name="meta-data" select="translate($netloc, ' ','')" />
+ <xsl:with-param name="meta-enc" select="'DCTERMS.URI'" />
+ </xsl:call-template>
+
+ <!-- the language for source (language) -->
+ <xsl:call-template name="add-meta-tag">
+ <xsl:with-param name="meta-name" select="'DCTERMS.language'" />
+ <xsl:with-param name="meta-data" select="$lang" />
+ <xsl:with-param name="meta-enc" select="'DCTERMS.RFC4646'" />
+ </xsl:call-template>
+
+ <!-- a bit commercial (generator) -->
+ <xsl:element name="meta">
+ <xsl:attribute name="name">DCTERMS.source</xsl:attribute>
+ <xsl:attribute name="content">http://xml.openoffice.org/odf2xhtml</xsl:attribute>
+ </xsl:element>
+
+ <!-- the author of the input source (author) -->
+ <xsl:call-template name="add-meta-tag">
+ <xsl:with-param name="meta-name" select="'DCTERMS.creator'" />
+ <xsl:with-param name="meta-data" select="$globalData/meta-file/*/office:meta/meta:initial-creator" />
+ </xsl:call-template>
+
+ <!-- creation-date of the input source (issued) -->
+ <xsl:call-template name="add-meta-tag">
+ <xsl:with-param name="meta-name" select="'DCTERMS.issued'" />
+ <xsl:with-param name="meta-data" select="$globalData/meta-file/*/office:meta/meta:creation-date" />
+ <xsl:with-param name="meta-enc" select="'DCTERMS.W3CDTF'" />
+ </xsl:call-template>
+
+ <!-- name of last changing person of the input source (changedby) -->
+ <xsl:call-template name="add-meta-tag">
+ <xsl:with-param name="meta-name" select="'DCTERMS.contributor'" />
+ <xsl:with-param name="meta-data" select="$globalData/meta-file/*/office:meta/dc:creator" />
+ </xsl:call-template>
+
+ <!-- last changing date of the input source (changed) -->
+ <xsl:call-template name="add-meta-tag">
+ <xsl:with-param name="meta-name" select="'DCTERMS.modified'" />
+ <xsl:with-param name="meta-data" select="$globalData/meta-file/*/office:meta/dc:date" />
+ <xsl:with-param name="meta-enc" select="'DCTERMS.W3CDTF'" />
+ </xsl:call-template>
+
+ <!-- Last print, as provenance -->
+ <xsl:if test="$prov">
+ <xsl:call-template name="add-meta-tag">
+ <xsl:with-param name="meta-name" select="'DCTERMS.provenance'" />
+ <xsl:with-param name="meta-data" select="$prov" />
+ <xsl:with-param name="meta-lang" select="$lang" />
+ </xsl:call-template>
+ </xsl:if>
+
+ <!-- keywords about the input source (keywords) -->
+ <xsl:call-template name="add-meta-tag">
+ <xsl:with-param name="meta-name" select="'DCTERMS.subject'" />
+ <xsl:with-param name="meta-data" select="normalize-space(concat($globalData/meta-file/*/office:meta/dc:subject,', ',$keywords))" />
+ <xsl:with-param name="meta-lang" select="$lang" />
+ </xsl:call-template>
+
+ <!-- detailed description about the input source (description) -->
+ <xsl:call-template name="add-meta-tag">
+ <xsl:with-param name="meta-name" select="'DCTERMS.description'" />
+ <xsl:with-param name="meta-data" select="$globalData/meta-file/*/office:meta/dc:description" />
+ <xsl:with-param name="meta-lang" select="$lang" />
+ </xsl:call-template>
+
+
+ <!-- user defined use of DCTERM tags -->
+ <xsl:for-each select="$globalData/meta-file/*/office:meta/meta:user-defined[starts-with(@meta:name,'DCTERMS.')][not(.='')]">
+ <xsl:call-template name="add-meta-tag">
+ <xsl:with-param name="meta-name" select="@meta:name" />
+ <xsl:with-param name="meta-data" select="." />
+ <!-- <xsl:with-param name="meta-lang" select="$lang" /> -->
+ </xsl:call-template>
+ </xsl:for-each>
+ <!-- user defined use of DC tags (legacy) -->
+ <xsl:for-each select="$globalData/meta-file/*/office:meta/meta:user-defined[starts-with(@meta:name,'DC.')][not(.='')]">
+ <xsl:call-template name="add-meta-tag">
+ <xsl:with-param name="meta-name" select="@meta:name" />
+ <xsl:with-param name="meta-data" select="." />
+ <!-- <xsl:with-param name="meta-lang" select="$lang" /> -->
+ </xsl:call-template>
+ </xsl:for-each>
+
+ <link rel="schema.DC" href="http://purl.org/dc/elements/1.1/" hreflang="en" />
+ <link rel="schema.DCTERMS" href="http://purl.org/dc/terms/" hreflang="en" />
+ <link rel="schema.DCTYPE" href="http://purl.org/dc/dcmitype/" hreflang="en" />
+ <link rel="schema.DCAM" href="http://purl.org/dc/dcam/" hreflang="en" />
+ <!-- W3C GRDDL Profile -->
+ <!--
+ <link rel="transformation" href="http://xml.openoffice.org/odf2xhtml/rdf-extract.xsl" />
+ -->
+
+ <!-- base URL of document for resolving relative links -->
+ <xsl:element name="base">
+ <xsl:attribute name="href">
+ <!-- earlier 'targetURL' was used for an absoulte reference of base provided by the Office (file URL)
+ <xsl:value-of select="$targetURL" />
+ now '.' let relative links work, even if document has been moved -->
+ <xsl:text>.</xsl:text>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:template>
+
+ <!-- generic template for adding common meta tags -->
+ <xsl:template name="add-meta-tag">
+ <xsl:param name="meta-name" />
+ <xsl:param name="meta-data" />
+ <xsl:param name="meta-enc" />
+ <xsl:param name="meta-lang" />
+
+ <xsl:if test="$meta-data">
+ <xsl:element name="meta">
+ <xsl:attribute name="name">
+ <xsl:value-of select="$meta-name" />
+ </xsl:attribute>
+ <xsl:attribute name="content">
+ <xsl:value-of select="$meta-data" />
+ </xsl:attribute>
+ <xsl:if test="$meta-enc">
+ <xsl:attribute name="scheme">
+ <xsl:value-of select="$meta-enc" />
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$meta-lang">
+ <xsl:attribute name="lang" namespace="http://www.w3.org/XML/1998/namespace">
+ <xsl:value-of select="$meta-lang" />
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/filter/source/xslt/odf2xhtml/export/xhtml/opendoc2xhtml.xsl b/filter/source/xslt/odf2xhtml/export/xhtml/opendoc2xhtml.xsl
new file mode 100644
index 000000000000..f0ac642a00eb
--- /dev/null
+++ b/filter/source/xslt/odf2xhtml/export/xhtml/opendoc2xhtml.xsl
@@ -0,0 +1,183 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<!--
+ For further documentation and updates visit http://xml.openoffice.org/odf2xhtml
+-->
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
+ xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0"
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:dom="http://www.w3.org/2001/xml-events"
+ xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
+ xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
+ xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
+ xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
+ xmlns:math="http://www.w3.org/1998/Math/MathML"
+ xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
+ xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
+ xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
+ xmlns:ooo="http://openoffice.org/2004/office"
+ xmlns:oooc="http://openoffice.org/2004/calc"
+ xmlns:ooow="http://openoffice.org/2004/writer"
+ xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
+ xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
+ xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
+ xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
+ xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
+ xmlns:xforms="http://www.w3.org/2002/xforms"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ exclude-result-prefixes="chart config dc dom dr3d draw fo form math meta number office ooo oooc ooow script style svg table text xforms xlink xsd xsi xforms xsd xsi"
+ xmlns="http://www.w3.org/1999/xhtml">
+
+
+ <!--+++++ INCLUDED XSL MODULES +++++-->
+
+ <!-- inheritance of office style properties is resolved into absolute styles. Office properties gathered as elements -->
+ <xsl:include href="../common/styles/style_collector.xsl" />
+
+ <!-- mapping rules of office style properties to CSS/HTML properties -->
+ <xsl:include href="../common/styles/style_mapping_css.xsl" />
+
+ <!-- office header element handling especially for XHTML -->
+ <xsl:include href="header.xsl" />
+
+ <!-- office body element handling especially for XHTML -->
+ <xsl:include href="body.xsl" />
+
+
+ <xsl:output method = "xml"
+ encoding = "UTF-8"
+ media-type = "application/xhtml+xml"
+ indent = "no"
+ omit-xml-declaration = "no"
+ doctype-public = "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN"
+ doctype-system = "http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd" />
+
+
+
+ <xsl:variable name="namespace" select="'http://www.w3.org/1999/xhtml'" />
+
+ <!--+++++ PARAMETER SECTION +++++-->
+
+ <!-- OPTIONAL: if the document content is provided in a directory structure. Opposite to a single flat XML stream -->
+ <xsl:param name="isPackageFormat" />
+
+ <!-- OPTIONAL: (MANDATORY: for all input document with relative external links): parameter is a absolute file URL to the target directory.
+ Relative links from the office document (e.g. to external graphics) will get this parameter as a prefix -->
+ <xsl:param name="targetBaseURL" select="'./'" />
+
+ <!-- OPTIONAL: (MANDATORY: for all input document with content table) : parameter is a absolute file URL to the target document.
+ Relative links to this office document (e.g. to internal anchor) will get this parameter as a prefix -->
+ <xsl:param name="targetURL" select="'./'" />
+
+ <!-- OPTIONAL: (MANDATORY: for input document with relative internal links)
+ To access contents of a office file (content like the meta.xml, styles.xml file or graphics) a URL could be choosen.
+ This could be even a JAR URL. The sourceBase of the content URL "jar:file:/C:/temp/Test.sxw!/content.xml" would be
+ "jar:file:/C:/temp/Test.sxw!/" for example.
+ When working with OpenOffice API a Package-URL encoded over HTTP can be used to access the jared contents of the the jared document. -->
+ <xsl:param name="sourceBaseURL" select="'./'" />
+
+ <!-- OPTIONAL: (MANDATORY: for session management by URL rewriting)
+ Useful for WebApplications: if a HTTP session is not cookie based, URL rewriting is beeing used (the session is appended to the URL).
+ This URL session is used for example when links to graphics are created by XSLT. Otherwise the user havt to log again in for every graphic he liks to see. -->
+ <xsl:param name="optionalURLSuffix" />
+
+ <!-- OPTIONAL: URL to office meta file (flat xml use the URL to the input file) -->
+ <xsl:param name="metaFileURL" />
+
+ <!-- OPTIONAL: URL to office meta file (flat xml use the URL to the input file) -->
+ <xsl:param name="stylesFileURL" />
+
+ <!-- OPTIONAL: DPI (dots per inch) the standard resolution of given pictures (necessary for the conversion of 'cm' into 'pixel')-->
+ <!-- Although many pictures have a 96 dpi resolution, a higher resoltion give better results for common browsers -->
+ <!-- Cp. measure_conversion.xsl:
+ <xsl:param name="dpi" select="111" /> -->
+
+
+ <!-- OPTIONAL: in case of using a different processor than a JAVA XSLT, you can unable the Java functionality
+ (e.g. encoding chapter names for the content-table as href and anchors ) -->
+ <xsl:param name="java" select="true()" />
+ <xsl:param name="javaEnabled" select="boolean($java)" />
+
+ <!-- OPTIONAL: for activating the debug mode set the variable here to 'true()' or give any value from outside -->
+ <xsl:param name="debug" select="false()" />
+ <xsl:param name="debugEnabled" select="boolean($debug)" />
+ <xsl:param name="onlyStyleOutput" select="false()" />
+ <xsl:param name="onlyStyleOutputEnabled" select="boolean($onlyStyleOutput)" />
+
+ <!-- ************************************* -->
+ <!-- *** build the propriate HTML file *** -->
+ <!-- ************************************* -->
+ <xsl:template match="/">
+ <!-- debug output of parameter value set -->
+ <xsl:if test="$debugEnabled">
+ <xsl:call-template name="debug-check-paramter" />
+ </xsl:if>
+ <!-- gathers style properties and
+ returns them as globalData parameter to the 'start-main' template -->
+ <xsl:call-template name="collect-global-odf-properties" />
+ </xsl:template>
+
+
+ <!-- *************************** -->
+ <!-- *** Built up XHTML file *** -->
+ <!-- *************************** -->
+ <xsl:template name="start-main">
+ <xsl:param name="globalData" />
+
+ <xsl:element name="html">
+ <xsl:comment>This file was converted to xhtml by OpenOffice.org - see http://xml.openoffice.org/odf2xhtml for more info.</xsl:comment>
+ <xsl:call-template name='create-header'>
+ <xsl:with-param name="globalData" select="$globalData" />
+ </xsl:call-template>
+
+ <xsl:call-template name='create-body'>
+ <xsl:with-param name="globalData" select="$globalData" />
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:template>
+
+
+ <!-- debug purpose only:
+ verbose checking of the parameters of this template-->
+ <xsl:template name="debug-check-paramter">
+ <xsl:message>Parameter dpi: <xsl:value-of select="$dpi" /></xsl:message>
+ <xsl:message>Parameter metaFileURL: <xsl:value-of select="$metaFileURL" /></xsl:message>
+ <xsl:message>Parameter stylesFileURL: <xsl:value-of select="$stylesFileURL" /></xsl:message>
+ <xsl:message>Parameter sourceBaseURL: <xsl:value-of select="$sourceBaseURL" /></xsl:message>
+ <xsl:message>Parameter targetBaseURL: <xsl:value-of select="$targetBaseURL" /></xsl:message>
+ <xsl:message>Parameter onlyStyleOutputEnabled: <xsl:value-of select="$onlyStyleOutputEnabled" /></xsl:message>
+ <xsl:message>Parameter debugEnabled: <xsl:value-of select="$debugEnabled" /></xsl:message>
+ <xsl:message>Parameter java: <xsl:value-of select="$java" /></xsl:message>
+ <xsl:message>Parameter javaEnabled: <xsl:value-of select="$javaEnabled" /></xsl:message>
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/filter/source/xslt/odf2xhtml/export/xhtml/table.xsl b/filter/source/xslt/odf2xhtml/export/xhtml/table.xsl
new file mode 100644
index 000000000000..a63c6d1af3ce
--- /dev/null
+++ b/filter/source/xslt/odf2xhtml/export/xhtml/table.xsl
@@ -0,0 +1,222 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<!--
+ For further documentation and updates visit http://xml.openoffice.org/odf2xhtml
+-->
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
+ xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0"
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:dom="http://www.w3.org/2001/xml-events"
+ xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
+ xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
+ xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
+ xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
+ xmlns:math="http://www.w3.org/1998/Math/MathML"
+ xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
+ xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
+ xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
+ xmlns:ooo="http://openoffice.org/2004/office"
+ xmlns:oooc="http://openoffice.org/2004/calc"
+ xmlns:ooow="http://openoffice.org/2004/writer"
+ xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
+ xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
+ xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
+ xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
+ xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
+ xmlns:xforms="http://www.w3.org/2002/xforms"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ exclude-result-prefixes="chart config dc dom dr3d draw fo form math meta number office ooo oooc ooow script style svg table text xforms xlink xsd xsi"
+ xmlns="http://www.w3.org/1999/xhtml">
+
+
+
+ <!-- current node is a table:table -->
+ <xsl:template name="create-table-children">
+ <xsl:param name="globalData" />
+ <xsl:param name="allVisibleTableRows" />
+ <xsl:param name="allTableColumns" />
+
+ <xsl:element name="colgroup">
+ <xsl:for-each select="$allTableColumns/table:table-column">
+ <xsl:if test="not(@table:visibility = 'collapse' or @table:visibility = 'filter')">
+ <xsl:element name="col">
+ <xsl:variable name="value" select="$globalData/all-doc-styles/style[@style:name = current()/@table:style-name]/*/@style:column-width" />
+ <xsl:if test="$value">
+ <xsl:attribute name="width">
+ <!-- using the absolute width, problems with the relative in browser (in OOo style:rel-column-width) -->
+ <xsl:call-template name="convert2px">
+ <xsl:with-param name="value" select="$globalData/all-doc-styles/style[@style:name = current()/@table:style-name]/*/@style:column-width" />
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <!-- *** the column-style ***
+ <xsl:attribute name="width">
+ <xsl:variable name="currentColumnStyleName" select="$allTableColumns/table:table-column[position() = $columnPosition]/@table:style-name" />
+ <xsl:value-of select="$globalData/all-doc-styles/style[@style:name = $currentColumnStyleName]/*/@style:column-width" />
+ </xsl:attribute>-->
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:element>
+
+ <xsl:call-template name="create-table-rows">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="allVisibleTableRows" select="$allVisibleTableRows" />
+ <xsl:with-param name="allTableColumns" select="$allTableColumns" />
+ </xsl:call-template>
+ </xsl:template>
+
+
+
+ <!-- Creating the content of a table content using CSS styles -->
+ <xsl:template name="create-table-cell-content">
+ <xsl:param name="tableDataType" />
+ <xsl:param name="globalData" />
+ <xsl:param name="allTableColumns" />
+ <xsl:param name="columnPosition" />
+ <xsl:param name="currentTableColumn" />
+
+ <xsl:element name="{$tableDataType}">
+
+ <!-- if parser reads DTD the default is set to '1' -->
+ <xsl:if test="@table:number-columns-spanned and @table:number-columns-spanned > 1">
+ <xsl:attribute name="colspan">
+ <xsl:value-of select="@table:number-columns-spanned" />
+ </xsl:attribute>
+ </xsl:if>
+ <!-- if parser reads DTD the default is set to '1' -->
+ <xsl:if test="@table:number-rows-spanned and @table:number-rows-spanned > 1">
+ <xsl:attribute name="rowspan">
+ <xsl:value-of select="@table:number-rows-spanned" />
+ </xsl:attribute>
+ </xsl:if>
+
+
+ <!-- *** the cell-style *** -->
+ <!-- The cell style has no conclusion with the column style, so we switch the order/priorities due to browser issues
+
+ The cell-style depends on two attributes:
+
+ 1) table:style-name - the style properties of cell. When they exist, a default alignement (cp. below) will be added for the
+ case of no alignment in the style exist.
+
+ 2) office:value-type - the value type of the table-cell giving the default alignments.
+ By default a string value is left aligned, all other are aligned:right.
+ -->
+ <xsl:choose>
+ <xsl:when test="@table:style-name">
+ <xsl:call-template name="set-styles">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="styleName" select="@table:style-name" />
+ <xsl:with-param name="currentTableColumn" select="$currentTableColumn" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- Cells without a style use the 'table:default-cell-style-name'
+ when there is no default cell style specified for the current column. -->
+ <xsl:variable name="defaultCellStyleName" select="$currentTableColumn/@table:default-cell-style-name" />
+ <xsl:choose>
+ <xsl:when test="$defaultCellStyleName">
+ <xsl:call-template name="set-styles">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="styleName" select="$defaultCellStyleName" />
+ <xsl:with-param name="currentTableColumn" select="$currentTableColumn" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- No cell style exists, nor a default table cell style for the column -->
+ <xsl:attribute name="style">
+ <!-- sets cell alignment dependent of cell value type -->
+ <xsl:call-template name="set-cell-alignment" />
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ <xsl:if test="$debugEnabled">
+ <xsl:message>A table cell '<xsl:value-of select="$tableDataType" />' element has been added!</xsl:message>
+ </xsl:if>
+
+ <!-- empty cell tags produce problems with width CSS style on itself other table cells as well
+ therefore an non breakable space (&nbsp;/&#160;) have been inserted.-->
+ <xsl:choose>
+ <xsl:when test="node()">
+ <xsl:call-template name="apply-styles-and-content">
+ <xsl:with-param name="globalData" select="$globalData" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="apply-styles-and-content">
+ <xsl:with-param name="globalData" select="$globalData" />
+ </xsl:call-template>
+ <xsl:text>&#160;</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ </xsl:element>
+ </xsl:template>
+
+
+ <!-- Sets the cell alignment by the 'office:value-type' of the 'table:table-cell'.
+ Strings have a left alignment, other values right -->
+ <xsl:template name="set-cell-alignment">
+ <xsl:choose>
+ <xsl:when test="@office:value-type and not(@office:value-type = 'string')">text-align:right; </xsl:when>
+ <xsl:otherwise>text-align:left;</xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+
+ <!-- Sets styles of a cell -->
+ <xsl:template name="set-styles">
+ <xsl:param name="globalData" />
+ <xsl:param name="styleName" />
+ <xsl:param name="currentTableColumn" />
+
+ <xsl:attribute name="style">
+ <!-- sets cell alignment dependent of cell value type -->
+ <xsl:call-template name="set-cell-alignment" />
+
+ <!-- set column style (disjunct of cell style) -->
+ <xsl:value-of select="$globalData/all-styles/style[@style:name = $currentTableColumn/@table:style-name]/final-properties" />
+
+ </xsl:attribute>
+
+ <!-- cell style header -->
+ <xsl:attribute name="class">
+ <xsl:value-of select="translate($styleName, '.,;: %()[]/\+', '_____________')"/>
+ </xsl:attribute>
+ </xsl:template>
+</xsl:stylesheet>
+
diff --git a/filter/source/xsltdialog/exports.dxp b/filter/source/xsltdialog/exports.dxp
new file mode 100644
index 000000000000..9630d7e06768
--- /dev/null
+++ b/filter/source/xsltdialog/exports.dxp
@@ -0,0 +1,3 @@
+component_getImplementationEnvironment
+component_writeInfo
+component_getFactory
diff --git a/filter/source/xsltdialog/hidother.src b/filter/source/xsltdialog/hidother.src
new file mode 100644
index 000000000000..efac7d4451be
--- /dev/null
+++ b/filter/source/xsltdialog/hidother.src
@@ -0,0 +1,78 @@
+/*************************************************************************
+ *
+ * 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 "xmlfilterhelpids.hrc"
+
+hidspecial HID_XML_SOURCE_FILE_DIALOG { HelpId = HID_XML_SOURCE_FILE_DIALOG; };
+hidspecial HID_XML_SOURCE_FILE_VALIDATE { HelpId = HID_XML_SOURCE_FILE_VALIDATE; };
+hidspecial HID_XML_FILTER_SETTINGS_DIALOG { HelpId = HID_XML_FILTER_SETTINGS_DIALOG; };
+hidspecial HID_XML_FILTER_LIST { HelpId = HID_XML_FILTER_LIST; };
+hidspecial HID_XML_FILTER_NEW { HelpId = HID_XML_FILTER_NEW; };
+hidspecial HID_XML_FILTER_EDIT { HelpId = HID_XML_FILTER_EDIT; };
+hidspecial HID_XML_FILTER_TEST { HelpId = HID_XML_FILTER_TEST; };
+hidspecial HID_XML_FILTER_DELETE { HelpId = HID_XML_FILTER_DELETE; };
+hidspecial HID_XML_FILTER_SAVE { HelpId = HID_XML_FILTER_SAVE; };
+hidspecial HID_XML_FILTER_OPEN { HelpId = HID_XML_FILTER_OPEN; };
+hidspecial HID_XML_FILTER_CLOSE { HelpId = HID_XML_FILTER_CLOSE; };
+
+hidspecial HID_XML_FILTER_TABDIALOG { HelpId = HID_XML_FILTER_TABDIALOG; };
+hidspecial HID_XML_FILTER_TABPAGE_BASIC { HelpId = HID_XML_FILTER_TABPAGE_BASIC; };
+hidspecial HID_XML_FILTER_TABPAGE_XSLT { HelpId = HID_XML_FILTER_TABPAGE_XSLT; };
+hidspecial HID_XML_FILTER_NAME { HelpId = HID_XML_FILTER_NAME; };
+hidspecial HID_XML_FILTER_APPLICATION { HelpId = HID_XML_FILTER_APPLICATION; };
+hidspecial HID_XML_FILTER_INTERFACE_NAME { HelpId = HID_XML_FILTER_INTERFACE_NAME; };
+hidspecial HID_XML_FILTER_EXTENSION { HelpId = HID_XML_FILTER_EXTENSION; };
+hidspecial HID_XML_FILTER_DESCRIPTION { HelpId = HID_XML_FILTER_DESCRIPTION; };
+hidspecial HID_XML_FILTER_DOCTYPE { HelpId = HID_XML_FILTER_DOCTYPE; };
+hidspecial HID_XML_FILTER_DTD { HelpId = HID_XML_FILTER_DTD; };
+hidspecial HID_XML_FILTER_DTD_BROWSE { HelpId = HID_XML_FILTER_DTD_BROWSE; };
+hidspecial HID_XML_FILTER_EXPORT_XSLT { HelpId = HID_XML_FILTER_EXPORT_XSLT; };
+hidspecial HID_XML_FILTER_EXPORT_XSLT_BROWSE { HelpId = HID_XML_FILTER_EXPORT_XSLT_BROWSE; };
+hidspecial HID_XML_FILTER_IMPORT_XSLT { HelpId = HID_XML_FILTER_IMPORT_XSLT; };
+hidspecial HID_XML_FILTER_IMPORT_XSLT_BROWSE { HelpId = HID_XML_FILTER_IMPORT_XSLT_BROWSE; };
+hidspecial HID_XML_FILTER_IMPORT_TEMPLATE { HelpId = HID_XML_FILTER_IMPORT_TEMPLATE; };
+hidspecial HID_XML_FILTER_IMPORT_TEMPLATE_BROWSE { HelpId = HID_XML_FILTER_IMPORT_TEMPLATE_BROWSE; };
+
+hidspecial HID_XML_FILTER_TEST_DIALOG { HelpId = HID_XML_FILTER_TEST_DIALOG; };
+
+hidspecial HID_XML_FILTER_TEST_EXPORT_BROWSE { HelpId = HID_XML_FILTER_TEST_EXPORT_BROWSE; };
+hidspecial HID_XML_FILTER_TEST_EXPORT_CURRENT { HelpId = HID_XML_FILTER_TEST_EXPORT_CURRENT; };
+hidspecial HID_XML_FILTER_TEST_EXPORT_CURRENT_FILE { HelpId = HID_XML_FILTER_TEST_EXPORT_CURRENT_FILE; };
+
+hidspecial HID_XML_FILTER_TEST_IMPORT_XSLT_FILE { HelpId = HID_XML_FILTER_TEST_IMPORT_XSLT_FILE; };
+hidspecial HID_XML_FILTER_TEST_IMPORT_TEMPLATE_FILE { HelpId = HID_XML_FILTER_TEST_IMPORT_TEMPLATE_FILE; };
+hidspecial HID_XML_FILTER_TEST_IMPORT_DISPLAY_SOURCE { HelpId = HID_XML_FILTER_TEST_IMPORT_DISPLAY_SOURCE; };
+hidspecial HID_XML_FILTER_TEST_IMPORT_BROWSE { HelpId = HID_XML_FILTER_TEST_IMPORT_BROWSE; };
+hidspecial HID_XML_FILTER_TEST_IMPORT_RECENT { HelpId = HID_XML_FILTER_TEST_IMPORT_RECENT; };
+hidspecial HID_XML_FILTER_TEST_IMPORT_RECENT_FILE { HelpId = HID_XML_FILTER_TEST_IMPORT_RECENT_FILE; };
+hidspecial HID_XML_FILTER_TEST_CLOSE { HelpId = HID_XML_FILTER_TEST_CLOSE; };
+
+hidspecial HID_XML_FILTER_TEST_VALIDATE_OUPUT { HelpId = HID_XML_FILTER_TEST_VALIDATE_OUPUT; };
+hidspecial HID_XML_FILTER_OUTPUT_WINDOW { HelpId = HID_XML_FILTER_OUTPUT_WINDOW; };
+
+hidspecial HID_XML_FILTER_TEST_EXPORT_XSLT_FILE { HelpId = HID_XML_FILTER_TEST_EXPORT_XSLT_FILE; };
+hidspecial HID_XML_FILTER_TABPAGE_CTRL { HelpId = HID_XML_FILTER_TABPAGE_CTRL; };
diff --git a/filter/source/xsltdialog/makefile.mk b/filter/source/xsltdialog/makefile.mk
new file mode 100644
index 000000000000..728a94bf0d36
--- /dev/null
+++ b/filter/source/xsltdialog/makefile.mk
@@ -0,0 +1,94 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ=..$/..
+PRJNAME=filter
+TARGET=xsltdlg
+
+ENABLE_EXCEPTIONS=TRUE
+USE_DEFFILE=TRUE
+#GEN_HID=TRUE
+GEN_HID_OTHER=TRUE
+
+# --- Settings ----------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Files -------------------------------------
+
+SRS1NAME=$(TARGET)
+SRC1FILES = xmlfiltersettingsdialog.src \
+ xmlfiltertabdialog.src \
+ xmlfiltertabpagebasic.src \
+ xmlfiltertabpagexslt.src \
+ xmlfiltertestdialog.src \
+ xmlfileview.src \
+ xmlfilterdialogstrings.src
+
+SLOFILES= $(SLO)$/typedetectionimport.obj \
+ $(SLO)$/typedetectionexport.obj \
+ $(SLO)$/xmlfilterjar.obj \
+ $(SLO)$/xmlfilterdialogcomponent.obj \
+ $(SLO)$/xmlfiltersettingsdialog.obj \
+ $(SLO)$/xmlfiltertabdialog.obj \
+ $(SLO)$/xmlfiltertabpagebasic.obj \
+ $(SLO)$/xmlfiltertabpagexslt.obj \
+ $(SLO)$/xmlfiltertestdialog.obj \
+ $(SLO)$/xmlfileview.obj
+
+# --- Library -----------------------------------
+
+RESLIB1NAME=$(TARGET)
+RESLIB1SRSFILES= $(SRS)$/$(TARGET).srs
+
+SHL1TARGET=$(TARGET)$(DLLPOSTFIX)
+
+SHL1STDLIBS=\
+ $(SFX2LIB) \
+ $(SVTOOLLIB) \
+ $(SVLLIB) \
+ $(TKLIB) \
+ $(CPPULIB) \
+ $(CPPUHELPERLIB) \
+ $(COMPHELPERLIB) \
+ $(SALLIB) \
+ $(TOOLSLIB) \
+ $(VCLLIB) \
+ $(UNOTOOLSLIB) \
+ $(ONELIB)
+
+SHL1DEPN=
+SHL1IMPLIB= i$(SHL1TARGET)
+SHL1LIBS= $(SLB)$/$(TARGET).lib
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+
+DEF1NAME=$(SHL1TARGET)
+DEF1EXPORTFILE=exports.dxp
+
+# --- Targets ----------------------------------
+
+.INCLUDE : target.mk
diff --git a/filter/source/xsltdialog/typedetectionexport.cxx b/filter/source/xsltdialog/typedetectionexport.cxx
new file mode 100644
index 000000000000..e3cccd8dd6c1
--- /dev/null
+++ b/filter/source/xsltdialog/typedetectionexport.cxx
@@ -0,0 +1,298 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#ifndef _COM_SUN_STAR_XML_SAX_XATTRIBUTELIST_HXX
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#endif
+#ifndef _COM_SUN_STAR_XML_BEANS_PROPERTYVALUE_HPP
+#include <com/sun/star/beans/PropertyValue.hpp>
+#endif
+#include <com/sun/star/io/XActiveDataSource.hpp>
+#include <tools/urlobj.hxx>
+
+#include "typedetectionexport.hxx"
+#include "xmlfiltersettingsdialog.hxx"
+
+#include <comphelper/attributelist.hxx>
+
+using namespace rtl;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::io;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::xml::sax;
+
+TypeDetectionExporter::TypeDetectionExporter( Reference< XMultiServiceFactory >& xMSF )
+: mxMSF( xMSF )
+{
+}
+
+static OUString createRelativeURL( const OUString& rFilterName, const OUString& rURL )
+{
+ if( rURL.getLength() &&
+ (rURL.compareToAscii( RTL_CONSTASCII_STRINGPARAM("http:") ) != 0) &&
+ (rURL.compareToAscii( RTL_CONSTASCII_STRINGPARAM("shttp:") ) != 0) &&
+ (rURL.compareToAscii( RTL_CONSTASCII_STRINGPARAM("jar:") ) != 0) &&
+ (rURL.compareToAscii( RTL_CONSTASCII_STRINGPARAM("ftp:") ) != 0))
+ {
+ INetURLObject aURL( rURL );
+ OUString aName( aURL.GetName() );
+ if( aName.getLength() == 0 )
+ {
+ sal_Int32 nPos = rURL.lastIndexOf( sal_Unicode( '/' ) );
+ if( nPos == -1 )
+ {
+ aName = rURL;
+ }
+ else
+ {
+ aName = rURL.copy( nPos + 1 );
+ }
+ }
+
+ OUString aRelURL( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.Package:" ) );
+ aRelURL += rFilterName;
+ aRelURL += OUString( sal_Unicode( '/' ) );
+ aRelURL += aName;
+ return aRelURL;
+ }
+ else
+ {
+ return rURL;
+ }
+}
+
+void TypeDetectionExporter::doExport( Reference< XOutputStream > xOS, const XMLFilterVector& rFilters )
+{
+ try
+ {
+ const OUString sComponentData ( RTL_CONSTASCII_USTRINGPARAM ( "oor:component-data" ) );
+ const OUString sNode ( RTL_CONSTASCII_USTRINGPARAM ( "node" ) );
+ const OUString sName ( RTL_CONSTASCII_USTRINGPARAM ( "oor:name" ) );
+ const OUString sWhiteSpace ( RTL_CONSTASCII_USTRINGPARAM ( " " ) );
+ const OUString sUIName ( RTL_CONSTASCII_USTRINGPARAM ( "UIName" ) );
+ const OUString sComma ( RTL_CONSTASCII_USTRINGPARAM ( "," ) );
+ const OUString sDelim ( RTL_CONSTASCII_USTRINGPARAM ( ";" ) );
+ const OUString sData ( RTL_CONSTASCII_USTRINGPARAM ( "Data" ) );
+ const OUString sDocTypePrefix ( RTL_CONSTASCII_USTRINGPARAM ( "doctype:" ) );
+ const OUString sFilterAdaptorService( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Writer.XmlFilterAdaptor" ) );
+ const OUString sXSLTFilterService ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.documentconversion.XSLTFilter" ) );
+ const OUString sCdataAttribute ( RTL_CONSTASCII_USTRINGPARAM( "CDATA" ) );
+
+
+ // set up sax writer and connect to given output stream
+ Reference< XDocumentHandler > xHandler( mxMSF->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.sax.Writer" ) ) ), UNO_QUERY );
+ Reference< XActiveDataSource > xDocSrc( xHandler, UNO_QUERY );
+ xDocSrc->setOutputStream( xOS );
+
+ ::comphelper::AttributeList * pAttrList = new ::comphelper::AttributeList;
+ pAttrList->AddAttribute ( OUString::createFromAscii( "xmlns:oor" ), sCdataAttribute, OUString::createFromAscii( "http://openoffice.org/2001/registry" ) );
+ pAttrList->AddAttribute ( OUString::createFromAscii( "xmlns:xs" ), sCdataAttribute, OUString::createFromAscii( "http://www.w3.org/2001/XMLSchema" ) );
+ pAttrList->AddAttribute ( sName, sCdataAttribute, OUString::createFromAscii( "TypeDetection" ) );
+ pAttrList->AddAttribute ( OUString::createFromAscii( "oor:package" ), sCdataAttribute, OUString::createFromAscii( "org.openoffice.Office" ) );
+ Reference < XAttributeList > xAttrList (pAttrList);
+
+ xHandler->startDocument();
+ xHandler->ignorableWhitespace ( sWhiteSpace );
+ xHandler->startElement( sComponentData, xAttrList );
+
+ // export types
+ {
+ xAttrList = pAttrList = new ::comphelper::AttributeList;
+ pAttrList->AddAttribute ( sName, sCdataAttribute, OUString::createFromAscii( "Types" ) );
+ xHandler->ignorableWhitespace ( sWhiteSpace );
+ xHandler->startElement( sNode, xAttrList );
+
+ XMLFilterVector::const_iterator aIter( rFilters.begin() );
+ while( aIter != rFilters.end() )
+ {
+ const filter_info_impl* pFilter = (*aIter);
+
+ xAttrList = pAttrList = new ::comphelper::AttributeList;
+ pAttrList->AddAttribute( sName, sCdataAttribute, pFilter->maType );
+ xHandler->ignorableWhitespace ( sWhiteSpace );
+ xHandler->startElement( sNode, xAttrList );
+ OUString sValue( sal_Unicode('0') );
+ sValue += sComma;
+ sValue += sComma;
+ if( pFilter->maDocType.getLength() )
+ {
+ sValue += sDocTypePrefix;
+ sValue += pFilter->maDocType;
+ }
+ sValue += sComma;
+ sValue += sComma;
+ sValue += pFilter->maExtension;
+ sValue += sComma;
+ sValue += OUString::valueOf( pFilter->mnDocumentIconID );
+ sValue += sComma;
+
+ addProperty( xHandler, sData, sValue );
+ addLocaleProperty( xHandler, sUIName, pFilter->maInterfaceName );
+ xHandler->ignorableWhitespace ( sWhiteSpace );
+ xHandler->endElement( sNode );
+
+ aIter++;
+ }
+
+ xHandler->ignorableWhitespace ( sWhiteSpace );
+ xHandler->endElement( sNode );
+ }
+
+ // export filters
+ {
+ xAttrList = pAttrList = new ::comphelper::AttributeList;
+ pAttrList->AddAttribute ( sName, sCdataAttribute, OUString::createFromAscii( "Filters" ) );
+ xHandler->ignorableWhitespace ( sWhiteSpace );
+ xHandler->startElement( sNode, xAttrList );
+
+ XMLFilterVector::const_iterator aIter( rFilters.begin() );
+ while( aIter != rFilters.end() )
+ {
+ const filter_info_impl* pFilter = (*aIter);
+
+ xAttrList = pAttrList = new ::comphelper::AttributeList;
+ pAttrList->AddAttribute( sName, sCdataAttribute, pFilter->maFilterName );
+ xHandler->ignorableWhitespace ( sWhiteSpace );
+ xHandler->startElement( sNode, xAttrList );
+ addLocaleProperty( xHandler, sUIName, pFilter->maInterfaceName );
+
+ OUString sValue( sal_Unicode('0') );
+ sValue += sComma;
+ sValue += pFilter->maType;
+ sValue += sComma,
+ sValue += pFilter->maDocumentService;
+ sValue += sComma,
+ sValue += sFilterAdaptorService;
+ sValue += sComma,
+ sValue += OUString::valueOf( pFilter->maFlags );
+ sValue += sComma;
+ sValue += sXSLTFilterService;
+ sValue += sDelim;
+ sValue += sDelim;
+
+ const application_info_impl* pAppInfo = getApplicationInfo( pFilter->maExportService );
+ sValue += pAppInfo->maXMLImporter;
+ sValue += sDelim;
+ sValue += pAppInfo->maXMLExporter;
+ sValue += sDelim;
+
+ sValue += createRelativeURL( pFilter->maFilterName, pFilter->maImportXSLT );
+ sValue += sDelim;
+ sValue += createRelativeURL( pFilter->maFilterName, pFilter->maExportXSLT );
+ sValue += sDelim;
+ sValue += createRelativeURL( pFilter->maFilterName, pFilter->maDTD );
+ sValue += sDelim;
+ sValue += pFilter->maComment;
+ sValue += sComma;
+ sValue += OUString( sal_Unicode('0') );
+ sValue += sComma;
+ sValue += createRelativeURL( pFilter->maFilterName, pFilter->maImportTemplate );
+ addProperty( xHandler, sData, sValue );
+ xHandler->ignorableWhitespace ( sWhiteSpace );
+ xHandler->endElement( sNode );
+ aIter++;
+ }
+
+ xHandler->endElement( sNode );
+ }
+
+ // finish
+ xHandler->ignorableWhitespace ( sWhiteSpace );
+ xHandler->endElement( sComponentData );
+ xHandler->endDocument();
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR( "TypeDetectionExporter::doExport exception catched!" );
+ }
+}
+
+void TypeDetectionExporter::addProperty( Reference< XDocumentHandler > xHandler, const OUString& rName, const OUString& rValue )
+{
+ try
+ {
+ const OUString sCdataAttribute( RTL_CONSTASCII_USTRINGPARAM( "CDATA" ) );
+ const OUString sProp( RTL_CONSTASCII_USTRINGPARAM( "prop" ) );
+ const OUString sValue( RTL_CONSTASCII_USTRINGPARAM( "value" ) );
+ const OUString sWhiteSpace ( RTL_CONSTASCII_USTRINGPARAM ( " " ) );
+
+ ::comphelper::AttributeList * pAttrList = new ::comphelper::AttributeList;
+ pAttrList->AddAttribute ( OUString::createFromAscii( "oor:name" ), sCdataAttribute, rName );
+ pAttrList->AddAttribute ( OUString::createFromAscii( "oor:type" ), sCdataAttribute, OUString::createFromAscii( "xs:string" ) );
+ Reference < XAttributeList > xAttrList (pAttrList);
+
+ xHandler->ignorableWhitespace ( sWhiteSpace );
+ xHandler->startElement( sProp, xAttrList );
+ xAttrList = NULL;
+ xHandler->ignorableWhitespace ( sWhiteSpace );
+ xHandler->startElement( sValue,xAttrList );
+ xHandler->characters( rValue );
+ xHandler->endElement( sValue );
+ xHandler->ignorableWhitespace ( sWhiteSpace );
+ xHandler->endElement( sProp );
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR( "TypeDetectionExporter::addProperty exception catched!" );
+ }
+}
+
+void TypeDetectionExporter::addLocaleProperty( Reference< XDocumentHandler > xHandler, const OUString& rName, const OUString& rValue )
+{
+ try
+ {
+ const OUString sCdataAttribute( RTL_CONSTASCII_USTRINGPARAM( "CDATA" ) );
+ const OUString sProp( RTL_CONSTASCII_USTRINGPARAM( "prop" ) );
+ const OUString sValue( RTL_CONSTASCII_USTRINGPARAM( "value" ) );
+ const OUString sWhiteSpace ( RTL_CONSTASCII_USTRINGPARAM ( " " ) );
+
+ ::comphelper::AttributeList * pAttrList = new ::comphelper::AttributeList;
+ pAttrList->AddAttribute ( OUString::createFromAscii( "oor:name" ), sCdataAttribute, rName );
+ pAttrList->AddAttribute ( OUString::createFromAscii( "oor:type" ), sCdataAttribute, OUString::createFromAscii( "xs:string" ) );
+ Reference < XAttributeList > xAttrList (pAttrList);
+
+ xHandler->ignorableWhitespace ( sWhiteSpace );
+ xHandler->startElement( sProp, xAttrList );
+ xAttrList = pAttrList = new ::comphelper::AttributeList;
+ pAttrList->AddAttribute ( OUString::createFromAscii( "xml:lang" ), sCdataAttribute, OUString::createFromAscii( "en-US" ) );
+ xHandler->ignorableWhitespace ( sWhiteSpace );
+ xHandler->startElement( sValue, xAttrList );
+ xHandler->characters( rValue );
+ xHandler->endElement( sValue );
+ xHandler->ignorableWhitespace ( sWhiteSpace );
+ xHandler->endElement( sProp );
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR( "TypeDetectionExporter::addLocaleProperty exception catched!" );
+ }
+}
+
diff --git a/filter/source/xsltdialog/typedetectionexport.hxx b/filter/source/xsltdialog/typedetectionexport.hxx
new file mode 100644
index 000000000000..09dfb5d12d4d
--- /dev/null
+++ b/filter/source/xsltdialog/typedetectionexport.hxx
@@ -0,0 +1,53 @@
+/*************************************************************************
+ *
+ * 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 _TYPEDETECTION_EXPORT_HXX
+#define _TYPEDETECTION_EXPORT_HXX
+
+#ifndef _COM_SUN_STAR_XML_SAX_XDOCUMENTHANDLER_HXX
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#endif
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+
+#include "xmlfilterjar.hxx"
+
+class TypeDetectionExporter
+{
+public:
+ TypeDetectionExporter( com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xMSF );
+
+ void doExport(com::sun::star::uno::Reference < com::sun::star::io::XOutputStream > xOS, const XMLFilterVector& rFilters );
+
+private:
+ void addProperty( com::sun::star::uno::Reference< com::sun::star::xml::sax::XDocumentHandler > xWriter, const rtl::OUString& rName, const rtl::OUString& rValue );
+ void addLocaleProperty( com::sun::star::uno::Reference< com::sun::star::xml::sax::XDocumentHandler > xWriter, const rtl::OUString& rName, const rtl::OUString& rValue );
+
+ com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > mxMSF;
+};
+
+#endif
diff --git a/filter/source/xsltdialog/typedetectionimport.cxx b/filter/source/xsltdialog/typedetectionimport.cxx
new file mode 100644
index 000000000000..392e034ceae3
--- /dev/null
+++ b/filter/source/xsltdialog/typedetectionimport.cxx
@@ -0,0 +1,362 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+#include <com/sun/star/xml/sax/InputSource.hpp>
+#include <com/sun/star/xml/sax/XParser.hpp>
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <tools/debug.hxx>
+
+#include "typedetectionimport.hxx"
+#include "xmlfiltersettingsdialog.hxx"
+
+using namespace com::sun::star::lang;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::io;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::xml::sax;
+using namespace com::sun::star;
+using namespace rtl;
+using namespace std;
+
+TypeDetectionImporter::TypeDetectionImporter( Reference< XMultiServiceFactory >& xMSF )
+: mxMSF(xMSF),
+ sRootNode( RTL_CONSTASCII_USTRINGPARAM( "oor:component-data" ) ),
+ sNode( RTL_CONSTASCII_USTRINGPARAM( "node" ) ),
+ sName( RTL_CONSTASCII_USTRINGPARAM( "oor:name" ) ),
+ sProp( RTL_CONSTASCII_USTRINGPARAM( "prop" ) ),
+ sValue( RTL_CONSTASCII_USTRINGPARAM( "value" ) ),
+ sUIName( RTL_CONSTASCII_USTRINGPARAM( "UIName" ) ),
+ sData( RTL_CONSTASCII_USTRINGPARAM( "Data" ) ),
+ sFilters( RTL_CONSTASCII_USTRINGPARAM( "Filters" ) ),
+ sTypes( RTL_CONSTASCII_USTRINGPARAM( "Types" ) ),
+ sFilterAdaptorService( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Writer.XmlFilterAdaptor" ) ),
+ sXSLTFilterService( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.documentconversion.XSLTFilter" ) ),
+ sCdataAttribute( RTL_CONSTASCII_USTRINGPARAM( "CDATA" ) ),
+ sWhiteSpace( RTL_CONSTASCII_USTRINGPARAM( " " ) )
+{
+}
+
+TypeDetectionImporter::~TypeDetectionImporter (void )
+{
+}
+
+void TypeDetectionImporter::doImport( Reference< XMultiServiceFactory >& xMSF, Reference< XInputStream > xIS, XMLFilterVector& rFilters )
+{
+ try
+ {
+ Reference< XParser > xParser( xMSF->createInstance(OUString::createFromAscii( "com.sun.star.xml.sax.Parser" ) ), UNO_QUERY );
+ if( xParser.is() )
+ {
+ TypeDetectionImporter* pImporter = new TypeDetectionImporter( xMSF );
+ Reference < XDocumentHandler > xDocHandler( pImporter );
+ xParser->setDocumentHandler( xDocHandler );
+
+ InputSource source;
+ source.aInputStream = xIS;
+
+ // start parsing
+ xParser->parseStream( source );
+
+ pImporter->fillFilterVector( rFilters );
+ }
+ }
+ catch( Exception& /* e */ )
+ {
+ DBG_ERROR( "TypeDetectionImporter::doImport exception catched!" );
+ }
+}
+
+void TypeDetectionImporter::fillFilterVector( XMLFilterVector& rFilters )
+{
+ // create filter infos from imported filter nodes
+ NodeVector::iterator aIter = maFilterNodes.begin();
+ while( aIter != maFilterNodes.end() )
+ {
+ filter_info_impl* pFilter = createFilterForNode( (*aIter) );
+ if( pFilter )
+ rFilters.push_back( pFilter );
+
+ delete (*aIter++);
+ }
+
+ // now delete type nodes
+ aIter = maTypeNodes.begin();
+ while( aIter != maTypeNodes.end() )
+ delete (*aIter++);
+}
+
+static OUString getSubdata( int index, sal_Unicode delimeter, const OUString& rData )
+{
+ sal_Int32 nLastIndex = 0;
+
+ sal_Int32 nNextIndex = rData.indexOf( delimeter );
+
+ OUString aSubdata;
+
+ while( index )
+ {
+ nLastIndex = nNextIndex + 1;
+ nNextIndex = rData.indexOf( delimeter, nLastIndex );
+
+ index--;
+
+ if( (index > 0) && (nLastIndex == 0) )
+ return aSubdata;
+ }
+
+ if( nNextIndex == -1 )
+ {
+ aSubdata = rData.copy( nLastIndex );
+ }
+ else
+ {
+ aSubdata = rData.copy( nLastIndex, nNextIndex - nLastIndex );
+ }
+
+ return aSubdata;
+}
+
+Node* TypeDetectionImporter::findTypeNode( const OUString& rType )
+{
+ // now delete type nodes
+ NodeVector::iterator aIter = maTypeNodes.begin();
+ while( aIter != maTypeNodes.end() )
+ {
+ if( (*aIter)->maName == rType )
+ return (*aIter);
+
+ aIter++;
+ }
+
+ return NULL;
+}
+
+filter_info_impl* TypeDetectionImporter::createFilterForNode( Node * pNode )
+{
+ filter_info_impl* pFilter = new filter_info_impl;
+
+ pFilter->maFilterName = pNode->maName;
+ pFilter->maInterfaceName = pNode->maPropertyMap[sUIName];
+
+ OUString aData = pNode->maPropertyMap[sData];
+
+ sal_Unicode aComma(',');
+
+ pFilter->maType = getSubdata( 1, aComma, aData );
+ pFilter->maDocumentService = getSubdata( 2, aComma, aData );
+
+ OUString aFilterService( getSubdata( 3, aComma, aData ) );
+ pFilter->maFlags = getSubdata( 4, aComma, aData ).toInt32();
+
+ // parse filter user data
+ sal_Unicode aDelim(';');
+ OUString aFilterUserData( getSubdata( 5, aComma, aData ) );
+
+ OUString aAdapterService( getSubdata( 0, aDelim, aFilterUserData ) );
+ //Import/ExportService
+ pFilter->maImportService = getSubdata( 2, aDelim, aFilterUserData );
+ pFilter->maExportService = getSubdata( 3, aDelim, aFilterUserData );
+ pFilter->maImportXSLT = getSubdata( 4, aDelim, aFilterUserData );
+ pFilter->maExportXSLT = getSubdata( 5, aDelim, aFilterUserData );
+ pFilter->maDTD = getSubdata( 6, aDelim, aFilterUserData );
+ pFilter->maComment = getSubdata( 7, aDelim, aFilterUserData );
+
+
+ pFilter->maImportTemplate = getSubdata( 7, aComma, aData );
+
+ Node* pTypeNode = findTypeNode( pFilter->maType );
+ if( pTypeNode )
+ {
+ OUString aTypeUserData( pTypeNode->maPropertyMap[sData] );
+
+ pFilter->maDocType = getSubdata( 2, aComma, aTypeUserData );
+ pFilter->maExtension = getSubdata( 4, aComma, aTypeUserData );
+ pFilter->mnDocumentIconID = getSubdata( 5, aComma, aTypeUserData ).toInt32();
+ }
+
+ bool bOk = true;
+
+ if( pTypeNode == NULL )
+ bOk = false;
+
+ if( pFilter->maFilterName.getLength() == 0 )
+ bOk = false;
+
+ if( pFilter->maInterfaceName.getLength() == 0 )
+ bOk = false;
+
+ if( pFilter->maType.getLength() == 0 )
+ bOk = false;
+
+ if( pFilter->maFlags == 0 )
+ bOk = false;
+
+ if( aFilterService != sFilterAdaptorService )
+ bOk = false;
+
+ if( aAdapterService != sXSLTFilterService )
+ bOk = false;
+
+ if( pFilter->maExtension.getLength() == 0 )
+ bOk = false;
+
+ if( !bOk )
+ {
+ delete pFilter;
+ pFilter = NULL;
+ }
+
+ return pFilter;
+}
+
+void SAL_CALL TypeDetectionImporter::startDocument( )
+ throw(xml::sax::SAXException, uno::RuntimeException)
+{
+}
+
+void SAL_CALL TypeDetectionImporter::endDocument( )
+ throw(xml::sax::SAXException, uno::RuntimeException)
+{
+}
+
+void SAL_CALL TypeDetectionImporter::startElement( const OUString& aName, const uno::Reference< xml::sax::XAttributeList >& xAttribs )
+ throw(xml::sax::SAXException, uno::RuntimeException)
+{
+ ImportState eNewState = e_Unknown;
+
+ if( maStack.empty() )
+ {
+ // #109668# support legacy name as well on import
+ if( aName == sRootNode || aName.equalsAscii("oor:node") )
+ {
+ eNewState = e_Root;
+ }
+ }
+ else if( maStack.top() == e_Root )
+ {
+ if( aName == sNode )
+ {
+ OUString aNodeName( xAttribs->getValueByName( sName ) );
+
+ if( aNodeName == sFilters )
+ {
+ eNewState = e_Filters;
+ }
+ else if( aNodeName == sTypes )
+ {
+ eNewState = e_Types;
+ }
+ }
+ }
+ else if( (maStack.top() == e_Filters) || (maStack.top() == e_Types) )
+ {
+ if( aName == sNode )
+ {
+ maNodeName = xAttribs->getValueByName( sName );
+
+ eNewState = (maStack.top() == e_Filters) ? e_Filter : e_Type;
+ }
+ }
+ else if( (maStack.top() == e_Filter) || (maStack.top() == e_Type))
+ {
+ if( aName == sProp )
+ {
+ maPropertyName = xAttribs->getValueByName( sName );
+ eNewState = e_Property;
+ }
+ }
+ else if( maStack.top() == e_Property )
+ {
+ if( aName == sValue )
+ {
+ eNewState = e_Value;
+ maValue = OUString();
+ }
+ }
+
+ maStack.push( eNewState );
+}
+void SAL_CALL TypeDetectionImporter::endElement( const OUString& /* aName */ )
+ throw(xml::sax::SAXException, uno::RuntimeException)
+{
+ if( !maStack.empty() )
+ {
+ ImportState eCurrentState = maStack.top();
+ switch( eCurrentState )
+ {
+ case e_Filter:
+ case e_Type:
+ {
+ Node* pNode = new Node;
+ pNode->maName = maNodeName;
+ pNode->maPropertyMap = maPropertyMap;
+ maPropertyMap.clear();
+
+ if( eCurrentState == e_Filter )
+ {
+ maFilterNodes.push_back( pNode );
+ }
+ else
+ {
+ maTypeNodes.push_back( pNode );
+ }
+ }
+ break;
+
+ case e_Property:
+ maPropertyMap[ maPropertyName ] = maValue;
+ break;
+ default: break;
+ }
+
+ maStack.pop();
+ }
+}
+void SAL_CALL TypeDetectionImporter::characters( const OUString& aChars )
+ throw(xml::sax::SAXException, uno::RuntimeException)
+{
+ if( !maStack.empty() && maStack.top() == e_Value )
+ {
+ maValue += aChars;
+ }
+}
+void SAL_CALL TypeDetectionImporter::ignorableWhitespace( const OUString& /* aWhitespaces */ )
+ throw(xml::sax::SAXException, uno::RuntimeException)
+{
+}
+void SAL_CALL TypeDetectionImporter::processingInstruction( const OUString& /* aTarget */, const OUString& /* aData */ )
+ throw(xml::sax::SAXException, uno::RuntimeException)
+{
+}
+void SAL_CALL TypeDetectionImporter::setDocumentLocator( const uno::Reference< xml::sax::XLocator >& /* xLocator */ )
+ throw(xml::sax::SAXException, uno::RuntimeException)
+{
+}
+
diff --git a/filter/source/xsltdialog/typedetectionimport.hxx b/filter/source/xsltdialog/typedetectionimport.hxx
new file mode 100644
index 000000000000..b4c13ff44a9c
--- /dev/null
+++ b/filter/source/xsltdialog/typedetectionimport.hxx
@@ -0,0 +1,129 @@
+/*************************************************************************
+ *
+ * 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 _TYPEDETECTION_IMPORT_HXX
+#define _TYPEDETECTION_IMPORT_HXX
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <cppuhelper/implbase1.hxx> // helper for implementations
+#ifndef _COM_SUN_STAR_XML_SAX_XDUCUMENTHANDLER_HPP_
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#endif
+#include <comphelper/stl_types.hxx>
+
+#include "xmlfilterjar.hxx"
+
+#include <vector>
+#include <stack>
+
+namespace com { namespace sun { namespace star {
+ namespace xml { namespace sax { class XAttributeList; } }
+ namespace beans { struct PropertyValue; }
+} } }
+
+enum ImportState
+{
+ e_Root,
+ e_Filters,
+ e_Types,
+ e_Filter,
+ e_Type,
+ e_Property,
+ e_Value,
+ e_Unknown
+};
+
+DECLARE_STL_USTRINGACCESS_MAP( ::rtl::OUString, PropertyMap );
+
+struct Node
+{
+ ::rtl::OUString maName;
+ PropertyMap maPropertyMap;
+};
+
+typedef std::vector< Node* > NodeVector;
+
+class TypeDetectionImporter : public cppu::WeakImplHelper1 < com::sun::star::xml::sax::XDocumentHandler >
+{
+public:
+ TypeDetectionImporter( com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xMSF );
+ virtual ~TypeDetectionImporter( void );
+
+ static void doImport( com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xMSF, com::sun::star::uno::Reference < com::sun::star::io::XInputStream > xOS, XMLFilterVector& rFilters );
+
+ 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 void SAL_CALL startElement( const ::rtl::OUString& aName, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttribs )
+ throw(::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL endElement( const ::rtl::OUString& aName )
+ throw(::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL characters( const ::rtl::OUString& aChars )
+ throw(::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL ignorableWhitespace( const ::rtl::OUString& aWhitespaces )
+ throw(::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL processingInstruction( const ::rtl::OUString& aTarget, const ::rtl::OUString& aData )
+ throw(::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setDocumentLocator( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator >& xLocator )
+ throw(::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ void fillFilterVector( XMLFilterVector& rFilters );
+ filter_info_impl* createFilterForNode( Node * pNode );
+ Node* findTypeNode( const ::rtl::OUString& rType );
+
+ com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > mxMSF;
+
+ std::stack< ImportState > maStack;
+ PropertyMap maPropertyMap;
+
+ NodeVector maFilterNodes;
+ NodeVector maTypeNodes;
+
+ ::rtl::OUString maValue;
+ ::rtl::OUString maNodeName;
+ ::rtl::OUString maPropertyName;
+
+ const ::rtl::OUString sRootNode;
+ const ::rtl::OUString sNode;
+ const ::rtl::OUString sName;
+ const ::rtl::OUString sProp;
+ const ::rtl::OUString sValue;
+ const ::rtl::OUString sUIName;
+ const ::rtl::OUString sData;
+ const ::rtl::OUString sFilters;
+ const ::rtl::OUString sTypes;
+ const ::rtl::OUString sFilterAdaptorService;
+ const ::rtl::OUString sXSLTFilterService;
+
+ const ::rtl::OUString sCdataAttribute;
+ const ::rtl::OUString sWhiteSpace;
+
+};
+#endif
diff --git a/filter/source/xsltdialog/xmlfileview.cxx b/filter/source/xsltdialog/xmlfileview.cxx
new file mode 100644
index 000000000000..a9cb18bed8d2
--- /dev/null
+++ b/filter/source/xsltdialog/xmlfileview.cxx
@@ -0,0 +1,990 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <com/sun/star/xml/sax/XErrorHandler.hpp>
+#include <com/sun/star/xml/sax/SAXParseException.hpp>
+#include <com/sun/star/xml/XImportFilter.hpp>
+#include <com/sun/star/io/XActiveDataSource.hpp>
+#include <comphelper/oslfile2streamwrap.hxx>
+
+#include <rtl/tencinfo.h>
+#include <vcl/svapp.hxx>
+#include <vos/mutex.hxx>
+#include <svtools/textview.hxx>
+#ifndef _SCRBAR_HXX //autogen
+#include <vcl/scrbar.hxx>
+#endif
+#include <tools/stream.hxx>
+#include <tools/time.hxx>
+#include <osl/file.hxx>
+#include <vcl/msgbox.hxx>
+#include <svtools/colorcfg.hxx>
+#include <svtools/htmltokn.h>
+#include <svtools/txtattr.hxx>
+
+#include "xmlfilterdialogstrings.hrc"
+#include "xmlfiltersettingsdialog.hxx"
+#include "xmlfileview.hxx"
+#include "xmlfileview.hrc"
+#include "xmlfilterhelpids.hrc"
+
+using namespace rtl;
+using namespace osl;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::io;
+using namespace com::sun::star::xml;
+using namespace com::sun::star::xml::sax;
+
+
+#define MAX_SYNTAX_HIGHLIGHT 20
+#define MAX_HIGHLIGHTTIME 200
+#define SYNTAX_HIGHLIGHT_TIMEOUT 200
+
+
+struct SwTextPortion
+{
+ USHORT nLine;
+ USHORT nStart, nEnd;
+ svtools::ColorConfigEntry eType;
+};
+
+SV_DECL_VARARR(SwTextPortions, SwTextPortion,16,16)
+SV_IMPL_VARARR(SwTextPortions, SwTextPortion);
+
+class XMLErrorHandler : public ::cppu::WeakImplHelper1< XErrorHandler >
+{
+public:
+ XMLErrorHandler( XMLSourceFileDialog* pParent, ListBox& rListBox );
+
+ // Methods
+ virtual void SAL_CALL error( const Any& aSAXParseException ) throw (SAXException, RuntimeException);
+ virtual void SAL_CALL fatalError( const Any& aSAXParseException ) throw (SAXException, RuntimeException);
+ virtual void SAL_CALL warning( const Any& aSAXParseException ) throw (SAXException, RuntimeException);
+
+private:
+ XMLSourceFileDialog* mpParent;
+ ListBox& mrListBox;
+};
+
+XMLErrorHandler::XMLErrorHandler( XMLSourceFileDialog* pParent, ListBox& rListBox )
+: mpParent( pParent ),
+ mrListBox( rListBox )
+{
+}
+
+// XMLErrorHandler
+void SAL_CALL XMLErrorHandler::error( const Any& aSAXParseException ) throw (SAXException, RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ SAXParseException e;
+ if( aSAXParseException >>= e )
+ {
+ String sErr( String::CreateFromInt32( e.LineNumber ) );
+ sErr += String( RTL_CONSTASCII_USTRINGPARAM( " : " ) );
+ sErr += String( e.Message );
+ USHORT nEntry = mrListBox.InsertEntry( sErr );
+ mrListBox.SetEntryData( nEntry, (void*)e.LineNumber );
+ }
+}
+
+void SAL_CALL XMLErrorHandler::fatalError( const Any& aSAXParseException ) throw (SAXException, RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ SAXParseException e;
+ if( aSAXParseException >>= e )
+ {
+ String sErr( String::CreateFromInt32( e.LineNumber ) );
+ sErr += String( RTL_CONSTASCII_USTRINGPARAM( " : " ) );
+ sErr += String( e.Message );
+ USHORT nEntry = mrListBox.InsertEntry( sErr );
+ mrListBox.SetEntryData( nEntry, (void*)e.LineNumber );
+ }
+}
+
+void SAL_CALL XMLErrorHandler::warning( const Any& /* aSAXParseException */ ) throw (SAXException, RuntimeException)
+{
+/*
+ SAXParseException e;
+ if( aSAXParseException >>= e )
+ {
+ String sErr( String::CreateFromInt32( e.LineNumber ) );
+ sErr += String( RTL_CONSTASCII_USTRINGPARAM( " : " ) );
+ sErr += String( e.Message );
+ USHORT nEntry = mrListBox.InsertEntry( sErr );
+ mrListBox.SetEntryData( nEntry, (void*)e.LineNumber );
+ }
+*/
+}
+
+
+XMLFileWindow::XMLFileWindow( Window* pParent ) :
+ Window( pParent, WB_BORDER|WB_CLIPCHILDREN ),
+ pTextEngine(0),
+ pOutWin(0),
+ pHScrollbar(0),
+ pVScrollbar(0),
+ nCurTextWidth(0),
+ nStartLine(USHRT_MAX),
+ eSourceEncoding(gsl_getSystemTextEncoding()),
+ bHighlighting(false)
+{
+ CreateTextEngine();
+}
+
+XMLFileWindow::~XMLFileWindow()
+{
+ if ( pTextEngine )
+ {
+ EndListening( *pTextEngine );
+ pTextEngine->RemoveView( pTextView );
+
+ delete pHScrollbar;
+ delete pVScrollbar;
+
+ delete pTextView;
+ delete pTextEngine;
+ }
+ delete pOutWin;
+}
+
+void XMLFileWindow::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ Window::DataChanged( rDCEvt );
+
+ switch ( rDCEvt.GetType() )
+ {
+ case DATACHANGED_SETTINGS:
+ // ScrollBars neu anordnen bzw. Resize ausloesen, da sich
+ // ScrollBar-Groesse geaendert haben kann. Dazu muss dann im
+ // Resize-Handler aber auch die Groesse der ScrollBars aus
+ // den Settings abgefragt werden.
+ if( rDCEvt.GetFlags() & SETTINGS_STYLE )
+ Resize();
+ break;
+ }
+}
+
+void XMLFileWindow::Resize()
+{
+ // ScrollBars, etc. passiert in Adjust...
+ if ( pTextView )
+ {
+ long nVisY = pTextView->GetStartDocPos().Y();
+ pTextView->ShowCursor();
+ Size aOutSz( GetOutputSizePixel() );
+ long nMaxVisAreaStart = pTextView->GetTextEngine()->GetTextHeight() - aOutSz.Height();
+ if ( nMaxVisAreaStart < 0 )
+ nMaxVisAreaStart = 0;
+ if ( pTextView->GetStartDocPos().Y() > nMaxVisAreaStart )
+ {
+ Point aStartDocPos( pTextView->GetStartDocPos() );
+ aStartDocPos.Y() = nMaxVisAreaStart;
+ pTextView->SetStartDocPos( aStartDocPos );
+ pTextView->ShowCursor();
+ }
+ long nScrollStd = GetSettings().GetStyleSettings().GetScrollBarSize();
+ Size aScrollSz(aOutSz.Width() - nScrollStd, nScrollStd );
+ Point aScrollPos(0, aOutSz.Height() - nScrollStd);
+
+ pHScrollbar->SetPosSizePixel( aScrollPos, aScrollSz);
+
+ aScrollSz.Width() = aScrollSz.Height();
+ aScrollSz.Height() = aOutSz.Height() - aScrollSz.Height();
+ aScrollPos = Point(aOutSz.Width() - nScrollStd, 0);
+
+ pVScrollbar->SetPosSizePixel( aScrollPos, aScrollSz);
+ aOutSz.Width() -= nScrollStd;
+ aOutSz.Height() -= nScrollStd;
+ pOutWin->SetOutputSizePixel(aOutSz);
+ InitScrollBars();
+
+ // Zeile im ersten Resize setzen
+ if(USHRT_MAX != nStartLine)
+ {
+ if(nStartLine < pTextEngine->GetParagraphCount())
+ {
+ TextSelection aSel(TextPaM( nStartLine, 0 ), TextPaM( nStartLine, 0x0 ));
+ pTextView->SetSelection(aSel);
+ pTextView->ShowCursor();
+ }
+ nStartLine = USHRT_MAX;
+ }
+
+ if ( nVisY != pTextView->GetStartDocPos().Y() )
+ InvalidateWindow();
+ }
+
+}
+
+void TextViewOutWin::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ Window::DataChanged( rDCEvt );
+
+ switch( rDCEvt.GetType() )
+ {
+ case DATACHANGED_SETTINGS:
+ // den Settings abgefragt werden.
+ if( rDCEvt.GetFlags() & SETTINGS_STYLE )
+ {
+ const Color &rCol = GetSettings().GetStyleSettings().GetWindowColor();
+ SetBackground( rCol );
+ Font aFont( pTextView->GetTextEngine()->GetFont() );
+ aFont.SetFillColor( rCol );
+ pTextView->GetTextEngine()->SetFont( aFont );
+ }
+ break;
+ }
+}
+
+void TextViewOutWin::MouseMove( const MouseEvent &rEvt )
+{
+ if ( pTextView )
+ pTextView->MouseMove( rEvt );
+}
+
+void TextViewOutWin::MouseButtonUp( const MouseEvent &rEvt )
+{
+ if ( pTextView )
+ pTextView->MouseButtonUp( rEvt );
+}
+
+void TextViewOutWin::MouseButtonDown( const MouseEvent &rEvt )
+{
+ GrabFocus();
+ if ( pTextView )
+ pTextView->MouseButtonDown( rEvt );
+}
+
+void TextViewOutWin::Command( const CommandEvent& rCEvt )
+{
+ switch(rCEvt.GetCommand())
+ {
+ case COMMAND_CONTEXTMENU:
+ break;
+ case COMMAND_WHEEL:
+ case COMMAND_STARTAUTOSCROLL:
+ case COMMAND_AUTOSCROLL:
+ {
+ const CommandWheelData* pWData = rCEvt.GetWheelData();
+ if( !pWData || COMMAND_WHEEL_ZOOM != pWData->GetMode() )
+ {
+ ((XMLFileWindow*)GetParent())->HandleWheelCommand( rCEvt );
+ }
+ }
+ break;
+
+ default:
+ if ( pTextView )
+ pTextView->Command( rCEvt );
+ else
+ Window::Command(rCEvt);
+ }
+}
+
+void TextViewOutWin::KeyInput( const KeyEvent& rKEvt )
+{
+ if(!TextEngine::DoesKeyChangeText( rKEvt ))
+ pTextView->KeyInput( rKEvt );
+}
+
+void TextViewOutWin::Paint( const Rectangle& rRect )
+{
+ pTextView->Paint( rRect );
+}
+
+void XMLFileWindow::CreateTextEngine()
+{
+ const Color &rCol = GetSettings().GetStyleSettings().GetWindowColor();
+ pOutWin = new TextViewOutWin(this, 0);
+ pOutWin->SetBackground(Wallpaper(rCol));
+ pOutWin->SetPointer(Pointer(POINTER_TEXT));
+ pOutWin->Show();
+
+ //Scrollbars anlegen
+ pHScrollbar = new ScrollBar(this, WB_3DLOOK |WB_HSCROLL|WB_DRAG);
+ pHScrollbar->SetScrollHdl(LINK(this, XMLFileWindow, ScrollHdl));
+ pHScrollbar->Show();
+
+ pVScrollbar = new ScrollBar(this, WB_3DLOOK |WB_VSCROLL|WB_DRAG);
+ pVScrollbar->SetScrollHdl(LINK(this, XMLFileWindow, ScrollHdl));
+ pHScrollbar->EnableDrag();
+ pVScrollbar->Show();
+
+ pTextEngine = new TextEngine;
+ pTextView = new TextView( pTextEngine, pOutWin );
+ pTextView->SetAutoIndentMode(TRUE);
+ pOutWin->SetTextView(pTextView);
+
+ pTextEngine->SetUpdateMode( FALSE );
+ pTextEngine->InsertView( pTextView );
+
+ Font aFont;
+ aFont.SetTransparent( FALSE );
+ aFont.SetFillColor( rCol );
+ SetPointFont( aFont );
+ aFont = GetFont();
+ aFont.SetFillColor( rCol );
+ pOutWin->SetFont( aFont );
+ pTextEngine->SetFont( aFont );
+
+ aSyntaxIdleTimer.SetTimeout( SYNTAX_HIGHLIGHT_TIMEOUT );
+ aSyntaxIdleTimer.SetTimeoutHdl( LINK( this, XMLFileWindow, SyntaxTimerHdl ) );
+
+ pTextEngine->EnableUndo( FALSE );
+ pTextEngine->SetUpdateMode( TRUE );
+
+// pTextView->ShowCursor( TRUE, TRUE );
+ pTextView->HideCursor();
+
+ InitScrollBars();
+ StartListening( *pTextEngine );
+}
+
+void XMLFileWindow::SetScrollBarRanges()
+{
+ pHScrollbar->SetRange( Range( 0, nCurTextWidth-1 ) );
+ pVScrollbar->SetRange( Range(0, pTextEngine->GetTextHeight()-1) );
+}
+
+void XMLFileWindow::InitScrollBars()
+{
+ SetScrollBarRanges();
+
+ Size aOutSz( pOutWin->GetOutputSizePixel() );
+ pVScrollbar->SetVisibleSize( aOutSz.Height() );
+ pVScrollbar->SetPageSize( aOutSz.Height() * 8 / 10 );
+ pVScrollbar->SetLineSize( pOutWin->GetTextHeight() );
+ pVScrollbar->SetThumbPos( pTextView->GetStartDocPos().Y() );
+ pHScrollbar->SetVisibleSize( aOutSz.Width() );
+ pHScrollbar->SetPageSize( aOutSz.Width() * 8 / 10 );
+ pHScrollbar->SetLineSize( pOutWin->GetTextWidth( 'x' ) );
+ pHScrollbar->SetThumbPos( pTextView->GetStartDocPos().X() );
+
+}
+
+IMPL_LINK(XMLFileWindow, ScrollHdl, ScrollBar*, pScroll)
+{
+ if(pScroll == pVScrollbar)
+ {
+ long nDiff = pTextView->GetStartDocPos().Y() - pScroll->GetThumbPos();
+ GetTextView()->Scroll( 0, nDiff );
+ pTextView->ShowCursor( FALSE, TRUE );
+ pScroll->SetThumbPos( pTextView->GetStartDocPos().Y() );
+ }
+ else
+ {
+ long nDiff = pTextView->GetStartDocPos().X() - pScroll->GetThumbPos();
+ GetTextView()->Scroll( nDiff, 0 );
+ pTextView->ShowCursor( FALSE, TRUE );
+ pScroll->SetThumbPos( pTextView->GetStartDocPos().X() );
+ }
+ return 0;
+}
+
+void XMLFileWindow::Notify( SfxBroadcaster& /* rBC */, const SfxHint& rHint )
+{
+ if ( rHint.ISA( TextHint ) )
+ {
+ const TextHint& rTextHint = (const TextHint&)rHint;
+ if( rTextHint.GetId() == TEXT_HINT_VIEWSCROLLED )
+ {
+ pHScrollbar->SetThumbPos( pTextView->GetStartDocPos().X() );
+ pVScrollbar->SetThumbPos( pTextView->GetStartDocPos().Y() );
+ }
+ else if( rTextHint.GetId() == TEXT_HINT_TEXTHEIGHTCHANGED )
+ {
+ if ( (long)pTextEngine->GetTextHeight() < pOutWin->GetOutputSizePixel().Height() )
+ pTextView->Scroll( 0, pTextView->GetStartDocPos().Y() );
+ pVScrollbar->SetThumbPos( pTextView->GetStartDocPos().Y() );
+ SetScrollBarRanges();
+ }
+ else if( rTextHint.GetId() == TEXT_HINT_FORMATPARA )
+ {
+ DoDelayedSyntaxHighlight( (USHORT)rTextHint.GetValue() );
+ }
+ }
+}
+
+void XMLFileWindow::InvalidateWindow()
+{
+ pOutWin->Invalidate();
+ Window::Invalidate();
+
+}
+
+void XMLFileWindow::Command( const CommandEvent& rCEvt )
+{
+ switch(rCEvt.GetCommand())
+ {
+ case COMMAND_WHEEL:
+ case COMMAND_STARTAUTOSCROLL:
+ case COMMAND_AUTOSCROLL:
+ {
+ const CommandWheelData* pWData = rCEvt.GetWheelData();
+ if( !pWData || COMMAND_WHEEL_ZOOM != pWData->GetMode() )
+ HandleScrollCommand( rCEvt, pHScrollbar, pVScrollbar );
+ }
+ break;
+ default:
+ Window::Command(rCEvt);
+ }
+}
+
+void XMLFileWindow::HandleWheelCommand( const CommandEvent& rCEvt )
+{
+ pTextView->Command(rCEvt);
+ HandleScrollCommand( rCEvt, pHScrollbar, pVScrollbar );
+}
+
+void XMLFileWindow::GetFocus()
+{
+ pOutWin->GrabFocus();
+}
+
+void XMLFileWindow::ShowWindow( const rtl::OUString& rFileName )
+{
+ String aFileName( rFileName );
+ SvFileStream aStream( aFileName, STREAM_READ );
+
+ // since the xml files we load are utf-8 encoded, we need to set
+ // this encoding at the SvFileStream, else the TextEngine will
+ // use its default encoding which is not UTF8
+ const sal_Char *pCharSet = rtl_getBestMimeCharsetFromTextEncoding( RTL_TEXTENCODING_UTF8 );
+ rtl_TextEncoding eDestEnc = rtl_getTextEncodingFromMimeCharset( pCharSet );
+ aStream.SetStreamCharSet( eDestEnc );
+
+ if( Read( aStream ) )
+ {
+ long nPrevTextWidth = nCurTextWidth;
+ nCurTextWidth = pTextEngine->CalcTextWidth() + 25; // kleine Toleranz
+ if ( nCurTextWidth != nPrevTextWidth )
+ SetScrollBarRanges();
+
+ TextPaM aPaM( pTextView->CursorStartOfDoc() );
+ TextSelection aSelection( aPaM, aPaM );
+ pTextView->SetSelection( aSelection, true );
+
+ Window::Show();
+ }
+}
+
+void XMLFileWindow::showLine( sal_Int32 nLine )
+{
+ TextPaM aPaM( pTextView->CursorStartOfDoc() );
+ while( nLine-- )
+ aPaM = pTextView->CursorDown( aPaM );
+
+ TextSelection aSelection( pTextView->CursorEndOfLine( aPaM ), aPaM );
+ pTextView->SetSelection( aSelection, true );
+}
+
+
+XMLSourceFileDialog::XMLSourceFileDialog( Window* pParent, ResMgr& rResMgr, const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rxMSF )
+: WorkWindow( pParent, ResId( DLG_XML_SOURCE_FILE_DIALOG, rResMgr ) ),
+ mnOutputHeight( LogicToPixel( Size( 80, 80 ), MAP_APPFONT ).Height() ),
+ mxMSF( rxMSF ),
+ mrResMgr( rResMgr ),
+ maLBOutput( this ),
+ maPBValidate( this, ResId( PB_VALIDATE, rResMgr ) )
+{
+
+ FreeResource();
+
+ maPBValidate.SetClickHdl(LINK( this, XMLSourceFileDialog, ClickHdl_Impl ) );
+ maLBOutput.SetSelectHdl(LINK(this, XMLSourceFileDialog, SelectHdl_Impl ) );
+ mpTextWindow = new XMLFileWindow( this );
+ mpTextWindow->SetHelpId( HID_XML_FILTER_OUTPUT_WINDOW );
+ maLBOutput.SetHelpId( HID_XML_FILTER_TEST_VALIDATE_OUPUT );
+
+ Resize();
+}
+
+XMLSourceFileDialog::~XMLSourceFileDialog()
+{
+ if( maFileURL.getLength() )
+ osl::File::remove( maFileURL );
+
+ delete mpTextWindow;
+}
+
+void XMLSourceFileDialog::ShowWindow( const rtl::OUString& rFileName, const filter_info_impl* pFilterInfo )
+{
+ EnterWait();
+ if( maFileURL.getLength() )
+ {
+ osl::File::remove( maFileURL );
+ delete mpTextWindow;
+ mpTextWindow = new XMLFileWindow( this );
+ maLBOutput.Hide();
+ maLBOutput.Clear();
+ maPBValidate.Enable(TRUE);
+ Resize();
+ }
+
+ mpFilterInfo = pFilterInfo;
+ maFileURL = rFileName;
+ mpTextWindow->ShowWindow( rFileName );
+ WorkWindow::Show();
+ LeaveWait();
+}
+
+void XMLSourceFileDialog::Resize()
+{
+ bool bOutputVisible = maLBOutput.IsVisible() != 0;
+
+ Point aSpacing( LogicToPixel( Point( 6, 6 ), MAP_APPFONT ) );
+ Size aButton( maPBValidate.GetSizePixel() );
+
+ Size aDialogSize( GetOutputSizePixel() );
+
+// Point aButtonPos( aSpacing.X(), aSpacing.Y() );
+// maPBValidate.SetPosSizePixel( aButtonPos, aButton );
+
+ Size aOutputSize( aDialogSize.Width(), bOutputVisible ? mnOutputHeight : 0 );
+
+ Point aTextWindowPos( 0, 2* aSpacing.Y() + aButton.Height() );
+ Size aTextWindowSize( aDialogSize.Width(), aDialogSize.Height() - aTextWindowPos.Y() - aOutputSize.Height() );
+
+ mpTextWindow->SetPosSizePixel( aTextWindowPos, aTextWindowSize );
+
+ if( bOutputVisible )
+ {
+ Point aOutputPos( 0, aTextWindowPos.Y() + aTextWindowSize.Height() );
+ maLBOutput.SetPosSizePixel( aOutputPos, aOutputSize );
+ }
+}
+
+
+IMPL_LINK(XMLSourceFileDialog, SelectHdl_Impl, ListBox *, pListBox )
+{
+ USHORT nEntry = pListBox->GetSelectEntryPos();
+ if( LISTBOX_ENTRY_NOTFOUND != nEntry )
+ {
+ int nLine = (int)(sal_IntPtr)pListBox->GetEntryData(nEntry);
+ if( -1 != nLine )
+ {
+ if( nLine > 0 )
+ nLine--;
+
+ showLine( nLine );
+ }
+ }
+ return 0;
+}
+
+IMPL_LINK(XMLSourceFileDialog, ClickHdl_Impl, PushButton *, /* pButton */ )
+{
+ onValidate();
+ return 0;
+}
+
+void XMLSourceFileDialog::onValidate()
+{
+ EnterWait();
+
+ maLBOutput.Show();
+ maPBValidate.Enable(FALSE);
+ Resize();
+
+ try
+ {
+ Reference< XImportFilter > xImporter( mxMSF->createInstance( OUString::createFromAscii( "com.sun.star.documentconversion.XSLTValidate" ) ), UNO_QUERY );
+ if( xImporter.is() )
+ {
+ osl::File aInputFile( maFileURL );
+ /* osl::File::RC rc = */ aInputFile.open( OpenFlag_Read );
+
+ Reference< XInputStream > xIS( new comphelper::OSLInputStreamWrapper( aInputFile ) );
+
+ Sequence< PropertyValue > aSourceData(3);
+ aSourceData[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "InputStream" ) );
+ aSourceData[0].Value <<= xIS;
+
+ aSourceData[1].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "FileName" ) );
+ aSourceData[1].Value <<= maFileURL;
+
+ aSourceData[2].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "ErrorHandler" ) );
+ Reference< XErrorHandler > xHandle( new XMLErrorHandler( this, maLBOutput ) );
+ aSourceData[2].Value <<= xHandle;
+
+ Reference< XDocumentHandler > xWriter( mxMSF->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.sax.Writer" ) ) ), UNO_QUERY );
+ Reference< XOutputStream > xOS( mxMSF->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.io.Pipe" ) ) ), UNO_QUERY );
+ Reference< XActiveDataSource > xDocSrc( xWriter, UNO_QUERY );
+ xDocSrc->setOutputStream( xOS );
+
+ Sequence< OUString > aFilterUserData( mpFilterInfo->getFilterUserData() );
+ xImporter->importer( aSourceData, xWriter, aFilterUserData );
+ }
+ }
+ catch(Exception& e)
+ {
+ String sErr( e.Message );
+ USHORT nEntry = maLBOutput.InsertEntry( sErr );
+ maLBOutput.SetEntryData( nEntry, (void*)-1 );
+ }
+
+ if( 0 == maLBOutput.GetEntryCount() )
+ {
+ String sErr( RESID( STR_NO_ERRORS_FOUND ) );
+ USHORT nEntry = maLBOutput.InsertEntry( sErr );
+ maLBOutput.SetEntryData( nEntry, (void*)-1 );
+ }
+
+ LeaveWait();
+}
+
+void XMLSourceFileDialog::showLine( sal_Int32 nLine )
+{
+ mpTextWindow->showLine( nLine );
+}
+
+
+///////////////////////////////////////////////////////////////////////
+
+void lcl_Highlight(const String& rSource, SwTextPortions& aPortionList)
+{
+ const sal_Unicode cOpenBracket = '<';
+ const sal_Unicode cCloseBracket= '>';
+ const sal_Unicode cSlash = '/';
+ const sal_Unicode cExclamation = '!';
+// const sal_Unicode cQuote = '"';
+// const sal_Unicode cSQuote = '\'';
+ const sal_Unicode cMinus = '-';
+ const sal_Unicode cSpace = ' ';
+ const sal_Unicode cTab = 0x09;
+ const sal_Unicode cLF = 0x0a;
+ const sal_Unicode cCR = 0x0d;
+
+
+ const USHORT nStrLen = rSource.Len();
+ USHORT nInsert = 0; // Anzahl der eingefuegten Portions
+ USHORT nActPos = 0; //Position, an der '<' gefunden wurde
+ USHORT nOffset = 0; //Offset von nActPos zur '<'
+ USHORT nPortStart = USHRT_MAX; // fuer die TextPortion
+ USHORT nPortEnd = 0; //
+ SwTextPortion aText;
+ while(nActPos < nStrLen)
+ {
+ svtools::ColorConfigEntry eFoundType = svtools::HTMLUNKNOWN;
+ if(rSource.GetChar(nActPos) == cOpenBracket && nActPos < nStrLen - 2 )
+ {
+ // 'leere' Portion einfuegen
+ if(nPortEnd < nActPos - 1 )
+ {
+ aText.nLine = 0;
+ // am Anfang nicht verschieben
+ aText.nStart = nPortEnd;
+ if(nInsert)
+ aText.nStart += 1;
+ aText.nEnd = nActPos - 1;
+ aText.eType = svtools::HTMLUNKNOWN;
+ aPortionList.Insert(aText, nInsert++);
+ }
+ sal_Unicode cFollowFirst = rSource.GetChar((xub_StrLen)(nActPos + 1));
+ sal_Unicode cFollowNext = rSource.GetChar((xub_StrLen)(nActPos + 2));
+ if(cExclamation == cFollowFirst)
+ {
+ // "<!" SGML oder Kommentar
+ if(cMinus == cFollowNext &&
+ nActPos < nStrLen - 3 && cMinus == rSource.GetChar((xub_StrLen)(nActPos + 3)))
+ {
+ eFoundType = svtools::HTMLCOMMENT;
+ }
+ else
+ eFoundType = svtools::HTMLSGML;
+ nPortStart = nActPos;
+ nPortEnd = nActPos + 1;
+ }
+ else if(cSlash == cFollowFirst)
+ {
+ // "</" Slash ignorieren
+ nPortStart = nActPos;
+ nActPos++;
+ nOffset++;
+ }
+ if(svtools::HTMLUNKNOWN == eFoundType)
+ {
+ //jetzt koennte hier ein keyword folgen
+ USHORT nSrchPos = nActPos;
+ while(++nSrchPos < nStrLen - 1)
+ {
+ sal_Unicode cNext = rSource.GetChar(nSrchPos);
+ if( cNext == cSpace ||
+ cNext == cTab ||
+ cNext == cLF ||
+ cNext == cCR)
+ break;
+ else if(cNext == cCloseBracket)
+ {
+ break;
+ }
+ }
+ if(nSrchPos > nActPos + 1)
+ {
+ //irgend ein String wurde gefunden
+ String sToken = rSource.Copy(nActPos + 1, nSrchPos - nActPos - 1 );
+ sToken.ToUpperAscii();
+// int nToken = ::GetHTMLToken(sToken);
+// if(nToken)
+ {
+ //Token gefunden
+ eFoundType = svtools::HTMLKEYWORD;
+ nPortEnd = nSrchPos;
+ nPortStart = nActPos;
+ }
+/*
+ else
+ {
+ //was war das denn?
+#ifdef DEBUG
+ DBG_ERROR("Token nicht erkannt!")
+ DBG_ERROR(ByteString(sToken, gsl_getSystemTextEncoding()).GetBuffer())
+#endif
+ }
+*/
+
+ }
+ }
+ // jetzt muss noch '>' gesucht werden
+ if(svtools::HTMLUNKNOWN != eFoundType)
+ {
+ BOOL bFound = FALSE;
+ for(USHORT i = nPortEnd; i < nStrLen; i++)
+ if(cCloseBracket == rSource.GetChar(i))
+ {
+ bFound = TRUE;
+ nPortEnd = i;
+ break;
+ }
+ if(!bFound && (eFoundType == svtools::HTMLCOMMENT))
+ {
+ // Kommentar ohne Ende in dieser Zeile
+ bFound = TRUE;
+ nPortEnd = nStrLen - 1;
+ }
+
+ if(bFound ||(eFoundType == svtools::HTMLCOMMENT))
+ {
+ SwTextPortion aText2;
+ aText2.nLine = 0;
+ aText2.nStart = nPortStart + 1;
+ aText2.nEnd = nPortEnd;
+ aText2.eType = eFoundType;
+ aPortionList.Insert(aText2, nInsert++);
+ eFoundType = svtools::HTMLUNKNOWN;
+ }
+
+ }
+ }
+ nActPos++;
+ }
+ if(nInsert && nPortEnd < nActPos - 1)
+ {
+ aText.nLine = 0;
+ aText.nStart = nPortEnd + 1;
+ aText.nEnd = nActPos - 1;
+ aText.eType = svtools::HTMLUNKNOWN;
+ aPortionList.Insert(aText, nInsert++);
+ }
+}
+
+void XMLFileWindow::DoDelayedSyntaxHighlight( USHORT nPara )
+{
+ if ( !bHighlighting )
+ {
+ aSyntaxLineTable.Insert( nPara, (void*)(USHORT)1 );
+ aSyntaxIdleTimer.Start();
+ }
+}
+
+void XMLFileWindow::ImpDoHighlight( const String& rSource, USHORT nLineOff )
+{
+ SwTextPortions aPortionList;
+ lcl_Highlight(rSource, aPortionList);
+
+ USHORT nCount = aPortionList.Count();
+ if ( !nCount )
+ return;
+
+ SwTextPortion& rLast = aPortionList[nCount-1];
+ if ( rLast.nStart > rLast.nEnd ) // Nur bis Bug von MD behoeben
+ {
+ nCount--;
+ aPortionList.Remove( nCount);
+ if ( !nCount )
+ return;
+ }
+
+ // Evtl. Optimieren:
+ // Wenn haufig gleiche Farbe, dazwischen Blank ohne Farbe,
+ // ggf. zusammenfassen, oder zumindest das Blank,
+ // damit weniger Attribute
+ BOOL bOptimizeHighlight = TRUE; // war in der BasicIDE static
+ if ( bOptimizeHighlight )
+ {
+ // Es muessen nur die Blanks und Tabs mit attributiert werden.
+ // Wenn zwei gleiche Attribute hintereinander eingestellt werden,
+ // optimiert das die TextEngine.
+ USHORT nLastEnd = 0;
+ for ( USHORT i = 0; i < nCount; i++ )
+ {
+ SwTextPortion& r = aPortionList[i];
+ DBG_ASSERT( r.nLine == aPortionList[0].nLine, "doch mehrere Zeilen ?" );
+ if ( r.nStart > r.nEnd ) // Nur bis Bug von MD behoeben
+ continue;
+
+ if ( r.nStart > nLastEnd )
+ {
+ // Kann ich mich drauf verlassen, dass alle ausser
+ // Blank und Tab gehighlightet wird ?!
+ r.nStart = nLastEnd;
+ }
+ nLastEnd = r.nEnd+1;
+ if ( ( i == (nCount-1) ) && ( r.nEnd < rSource.Len() ) )
+ r.nEnd = rSource.Len();
+ }
+ }
+
+ svtools::ColorConfig aConfig;
+ for ( USHORT i = 0; i < aPortionList.Count(); i++ )
+ {
+ SwTextPortion& r = aPortionList[i];
+ if ( r.nStart > r.nEnd ) // Nur bis Bug von MD behoeben
+ continue;
+// USHORT nCol = r.eType;
+ if(r.eType != svtools::HTMLSGML &&
+ r.eType != svtools::HTMLCOMMENT &&
+ r.eType != svtools::HTMLKEYWORD &&
+ r.eType != svtools::HTMLUNKNOWN)
+ r.eType = (svtools::ColorConfigEntry)svtools::HTMLUNKNOWN;
+ Color aColor((ColorData)aConfig.GetColorValue((svtools::ColorConfigEntry)r.eType).nColor);
+ USHORT nLine = nLineOff+r.nLine; //
+ pTextEngine->SetAttrib( TextAttribFontColor( aColor ), nLine, r.nStart, r.nEnd+1 );
+ }
+}
+
+IMPL_LINK( XMLFileWindow, SyntaxTimerHdl, Timer *, pTimer )
+{
+ Time aSyntaxCheckStart;
+ DBG_ASSERT( pTextView, "Noch keine View, aber Syntax-Highlight ?!" );
+ pTextEngine->SetUpdateMode( FALSE );
+
+ bHighlighting = TRUE;
+ USHORT nLine;
+ USHORT nCount = 0;
+ // zuerst wird der Bereich um dem Cursor bearbeitet
+ TextSelection aSel = pTextView->GetSelection();
+ USHORT nCur = (USHORT)aSel.GetStart().GetPara();
+ if(nCur > 40)
+ nCur -= 40;
+ else
+ nCur = 0;
+ if(aSyntaxLineTable.Count())
+ for(USHORT i = 0; i < 80 && nCount < 40; i++, nCur++)
+ {
+ void * p = aSyntaxLineTable.Get(nCur);
+ if(p)
+ {
+ DoSyntaxHighlight( nCur );
+ aSyntaxLineTable.Remove( nCur );
+ nCount++;
+ if(!aSyntaxLineTable.Count())
+ break;
+ if((Time().GetTime() - aSyntaxCheckStart.GetTime()) > MAX_HIGHLIGHTTIME )
+ {
+ pTimer->SetTimeout( 2 * SYNTAX_HIGHLIGHT_TIMEOUT );
+ break;
+ }
+ }
+ }
+
+ // wenn dann noch etwas frei ist, wird von Beginn an weitergearbeitet
+ void* p = aSyntaxLineTable.First();
+ while ( p && nCount < MAX_SYNTAX_HIGHLIGHT)
+ {
+ nLine = (USHORT)aSyntaxLineTable.GetCurKey();
+ DoSyntaxHighlight( nLine );
+ USHORT nC = (USHORT)aSyntaxLineTable.GetCurKey();
+ p = aSyntaxLineTable.Next();
+ aSyntaxLineTable.Remove(nC);
+ nCount ++;
+ if(Time().GetTime() - aSyntaxCheckStart.GetTime() > MAX_HIGHLIGHTTIME)
+ {
+ pTimer->SetTimeout( 2 * SYNTAX_HIGHLIGHT_TIMEOUT );
+ break;
+ }
+ }
+ // os: #43050# hier wird ein TextView-Problem umpopelt:
+ // waehrend des Highlightings funktionierte das Scrolling nicht
+ TextView* pTmp = pTextEngine->GetActiveView();
+ pTextEngine->SetActiveView(0);
+ pTextEngine->SetUpdateMode( TRUE );
+ pTextEngine->SetActiveView(pTmp);
+ pTextView->ShowCursor(FALSE, FALSE);
+
+ if(aSyntaxLineTable.Count() && !pTimer->IsActive())
+ pTimer->Start();
+ // SyntaxTimerHdl wird gerufen, wenn Text-Aenderung
+ // => gute Gelegenheit, Textbreite zu ermitteln!
+ long nPrevTextWidth = nCurTextWidth;
+ nCurTextWidth = pTextEngine->CalcTextWidth() + 25; // kleine Toleranz
+ if ( nCurTextWidth != nPrevTextWidth )
+ SetScrollBarRanges();
+ bHighlighting = FALSE;
+
+ return 0;
+}
+
+void XMLFileWindow::DoSyntaxHighlight( USHORT nPara )
+{
+ // Durch das DelayedSyntaxHighlight kann es passieren,
+ // dass die Zeile nicht mehr existiert!
+ if ( nPara < pTextEngine->GetParagraphCount() )
+ {
+ pTextEngine->RemoveAttribs( nPara );
+ String aSource( pTextEngine->GetText( nPara ) );
+ pTextEngine->SetUpdateMode( FALSE );
+ ImpDoHighlight( aSource, nPara );
+ // os: #43050# hier wird ein TextView-Problem umpopelt:
+ // waehrend des Highlightings funktionierte das Scrolling nicht
+ TextView* pTmp = pTextEngine->GetActiveView();
+ pTmp->SetAutoScroll(FALSE);
+ pTextEngine->SetActiveView(0);
+ pTextEngine->SetUpdateMode( TRUE );
+ pTextEngine->SetActiveView(pTmp);
+ // Bug 72887 show the cursor
+ pTmp->SetAutoScroll(TRUE);
+ pTmp->ShowCursor( FALSE/*pTmp->IsAutoScroll()*/ );
+ }
+}
diff --git a/filter/source/xsltdialog/xmlfileview.hrc b/filter/source/xsltdialog/xmlfileview.hrc
new file mode 100644
index 000000000000..7d4216fa9d27
--- /dev/null
+++ b/filter/source/xsltdialog/xmlfileview.hrc
@@ -0,0 +1,36 @@
+/*************************************************************************
+ *
+ * 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 _XMLFILEVIEWDIALOG_HRC_
+#define _XMLFILEVIEWDIALOG_HRC_
+
+#include "xmlfiltercommon.hrc"
+
+#define CTRL_SOURCE_VIEW 1
+#define PB_VALIDATE 2
+
+#endif
diff --git a/filter/source/xsltdialog/xmlfileview.hxx b/filter/source/xsltdialog/xmlfileview.hxx
new file mode 100644
index 000000000000..190c52254374
--- /dev/null
+++ b/filter/source/xsltdialog/xmlfileview.hxx
@@ -0,0 +1,177 @@
+/*************************************************************************
+ *
+ * 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 _XMLFILEVIEW_HXX
+#define _XMLFILEVIEW_HXX
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <svl/lstner.hxx>
+#include <vcl/timer.hxx>
+
+#ifndef _TABLE_HXX //autogen
+#include <tools/table.hxx>
+#endif
+#include <svtools/xtextedt.hxx>
+#include <vcl/timer.hxx>
+#ifndef _TABLE_HXX //autogen
+#include <tools/table.hxx>
+#endif
+#include <vcl/wrkwin.hxx>
+#include <vcl/ctrl.hxx>
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+#include <vcl/lstbox.hxx>
+
+class ScrollBar;
+class XMLFileWindow;
+class TextEngine;
+class TextView;
+class DataChangedEvent;
+class filter_info_impl;
+
+class TextViewOutWin : public Window
+{
+ TextView* pTextView;
+
+protected:
+ virtual void Paint( const Rectangle& );
+ virtual void KeyInput( const KeyEvent& rKeyEvt );
+ virtual void MouseMove( const MouseEvent& rMEvt );
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void MouseButtonUp( const MouseEvent& rMEvt );
+ virtual void Command( const CommandEvent& rCEvt );
+ virtual void DataChanged( const DataChangedEvent& );
+
+public:
+ TextViewOutWin(Window* pParent, WinBits nBits) :
+ Window(pParent, nBits), pTextView(0){}
+
+ void SetTextView( TextView* pView ) {pTextView = pView;}
+
+};
+
+//------------------------------------------------------------
+
+class XMLFileWindow : public Window, public SfxListener
+{
+ using Window::Notify;
+
+private:
+ TextView* pTextView;
+ TextEngine* pTextEngine;
+
+ TextViewOutWin* pOutWin;
+ ScrollBar *pHScrollbar,
+ *pVScrollbar;
+
+ long nCurTextWidth;
+ USHORT nStartLine;
+ rtl_TextEncoding eSourceEncoding;
+
+ Timer aSyntaxIdleTimer;
+ Table aSyntaxLineTable;
+
+ bool bHighlighting;
+protected:
+ DECL_LINK( SyntaxTimerHdl, Timer * );
+ void ImpDoHighlight( const String& rSource, USHORT nLineOff );
+
+ virtual void Resize();
+ virtual void DataChanged( const DataChangedEvent& );
+ virtual void GetFocus();
+
+ void CreateTextEngine();
+
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+
+ DECL_LINK(ScrollHdl, ScrollBar*);
+
+ void DoDelayedSyntaxHighlight( USHORT nPara );
+
+ void DoSyntaxHighlight( USHORT nPara );
+
+public:
+ XMLFileWindow( Window* pParent );
+ ~XMLFileWindow();
+
+ void SetScrollBarRanges();
+ void InitScrollBars();
+ ULONG Read( SvStream& rInput) { return pTextEngine->Read(rInput); }
+
+ void ShowWindow( const rtl::OUString& rFileName );
+
+ TextView* GetTextView() { return pTextView; }
+ TextEngine* GetTextEngine() { return pTextEngine; }
+
+ TextViewOutWin* GetOutWin() { return pOutWin; }
+ void InvalidateWindow();
+
+ void CreateScrollbars();
+
+ void SetStartLine(USHORT nLine) {nStartLine = nLine;}
+
+ virtual void Command( const CommandEvent& rCEvt );
+ void HandleWheelCommand( const CommandEvent& rCEvt );
+
+ TextView* getTextView() { return pTextView; }
+
+ void showLine( sal_Int32 nLine );
+};
+
+class XMLSourceFileDialog : public WorkWindow
+{
+
+public:
+ XMLSourceFileDialog( Window* pParent, ResMgr& rResMgr, const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rxMSF );
+ virtual ~XMLSourceFileDialog();
+
+ void ShowWindow( const rtl::OUString& rFileName, const filter_info_impl* pFilterInfo );
+
+ virtual void Resize();
+
+ DECL_LINK(ClickHdl_Impl, PushButton * );
+ DECL_LINK(SelectHdl_Impl, ListBox * );
+
+ void showLine( sal_Int32 nLine );
+
+ sal_Int32 mnOutputHeight;
+private:
+ void onValidate();
+
+ const filter_info_impl* mpFilterInfo;
+ rtl::OUString maFileURL;
+
+ com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > mxMSF;
+ ResMgr& mrResMgr;
+
+ XMLFileWindow* mpTextWindow;
+ ListBox maLBOutput;
+// Control maCtrlSourceView;
+ PushButton maPBValidate;
+};
+
+#endif
diff --git a/filter/source/xsltdialog/xmlfileview.src b/filter/source/xsltdialog/xmlfileview.src
new file mode 100644
index 000000000000..588c3dd47883
--- /dev/null
+++ b/filter/source/xsltdialog/xmlfileview.src
@@ -0,0 +1,64 @@
+/*************************************************************************
+ *
+ * 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 "xmlfileview.hrc"
+#include "xmlfilterhelpids.hrc"
+
+#define DIALOG_WIDTH 500
+#define DIALOG_HEIGHT 400
+
+WorkWindow DLG_XML_SOURCE_FILE_DIALOG
+{
+ Size = MAP_APPFONT( DIALOG_WIDTH, DIALOG_HEIGHT );
+ HelpId = HID_XML_SOURCE_FILE_DIALOG;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Sizeable = TRUE ;
+ Minable = TRUE ;
+ Maxable = TRUE ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ Text [ en-US ] = "XML Filter output" ;
+
+ PushButton PB_VALIDATE
+ {
+ Pos = MAP_APPFONT ( 6 , 6 ) ;
+ Size = MAP_APPFONT ( 60 , 14 ) ;
+ TabStop = TRUE ;
+ HelpId = HID_XML_SOURCE_FILE_VALIDATE;
+ Text [ en-US ] = "~Validate";
+ };
+};
+
+
+
+
+
+
+
+
+
diff --git a/filter/source/xsltdialog/xmlfiltercommon.hrc b/filter/source/xsltdialog/xmlfiltercommon.hrc
new file mode 100644
index 000000000000..e3e51bf250dd
--- /dev/null
+++ b/filter/source/xsltdialog/xmlfiltercommon.hrc
@@ -0,0 +1,41 @@
+/*************************************************************************
+ *
+ * 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 _XMLFILTERCOMMON_HRC_
+#define _XMLFILTERCOMMON_HRC_
+
+#ifndef _FILTER_HRC
+#include "filter.hrc"
+#endif
+
+#define DLG_XML_SOURCE_FILE_DIALOG (RID_XSLT_DIALOG_START+0)
+#define DLG_XML_FILTER_SETTINGS_DIALOG (RID_XSLT_DIALOG_START+1)
+#define DLG_XML_FILTER_TABDIALOG (RID_XSLT_DIALOG_START+2)
+#define RID_XML_FILTER_TABPAGE_BASIC (RID_XSLT_DIALOG_START+3)
+#define RID_XML_FILTER_TABPAGE_XSLT (RID_XSLT_DIALOG_START+4)
+#define DLG_XML_FILTER_TEST_DIALOG (RID_XSLT_DIALOG_START+5)
+
+#endif
diff --git a/filter/source/xsltdialog/xmlfiltercommon.hxx b/filter/source/xsltdialog/xmlfiltercommon.hxx
new file mode 100644
index 000000000000..91e11bdad79a
--- /dev/null
+++ b/filter/source/xsltdialog/xmlfiltercommon.hxx
@@ -0,0 +1,107 @@
+/*************************************************************************
+ *
+ * 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 _XMLFILTERCOMMON_HXX_
+#define _XMLFILTERCOMMON_HXX_
+
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/container/XHierarchicalName.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+
+#include <vector>
+
+// --------------------------------------------------------------------
+
+extern ::rtl::OUString string_encode( const ::rtl::OUString & rText );
+extern ::rtl::OUString string_decode( const ::rtl::OUString & rText );
+
+// --------------------------------------------------------------------
+
+extern bool isFileURL( const ::rtl::OUString & rURL );
+
+// --------------------------------------------------------------------
+
+bool copyStreams( ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > xIS, ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > xOS );
+bool createDirectory( ::rtl::OUString& rURL );
+
+// --------------------------------------------------------------------
+
+class filter_info_impl
+{
+public:
+ rtl::OUString maFilterName;
+ rtl::OUString maType;
+ rtl::OUString maDocumentService;
+ rtl::OUString maFilterService;
+ rtl::OUString maInterfaceName;
+ rtl::OUString maComment;
+ rtl::OUString maExtension;
+ rtl::OUString maDTD;
+ rtl::OUString maExportXSLT;
+ rtl::OUString maImportXSLT;
+ rtl::OUString maImportTemplate;
+ rtl::OUString maDocType;
+ rtl::OUString maImportService;
+ rtl::OUString maExportService;
+
+ sal_Int32 maFlags;
+ sal_Int32 maFileFormatVersion;
+ sal_Int32 mnDocumentIconID;
+
+ sal_Bool mbReadonly;
+ filter_info_impl();
+ filter_info_impl( const filter_info_impl& rInfo );
+ int operator==( const filter_info_impl& ) const;
+
+ com::sun::star::uno::Sequence< rtl::OUString > getFilterUserData() const;
+};
+
+// --------------------------------------------------------------------
+
+struct application_info_impl
+{
+ rtl::OUString maDocumentService;
+ rtl::OUString maDocumentUIName;
+ rtl::OUString maXMLImporter;
+ rtl::OUString maXMLExporter;
+
+ application_info_impl( const sal_Char * pDocumentService, ResId& rUINameRes, const sal_Char * mpXMLImporter, const sal_Char * mpXMLExporter );
+};
+
+// --------------------------------------------------------------------
+
+extern std::vector< application_info_impl* >& getApplicationInfos();
+extern rtl::OUString getApplicationUIName( const rtl::OUString& rServiceName );
+extern const application_info_impl* getApplicationInfo( const rtl::OUString& rServiceName );
+
+extern ResMgr* getXSLTDialogResMgr();
+
+#define RESID(x) ResId(x, *getXSLTDialogResMgr() )
+
+#endif
diff --git a/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx b/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx
new file mode 100644
index 000000000000..c744a65fc274
--- /dev/null
+++ b/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx
@@ -0,0 +1,466 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+#include <osl/mutex.hxx>
+#include <vos/mutex.hxx>
+#include <toolkit/awt/vclxwindow.hxx>
+
+#include <osl/thread.h>
+#include <cppuhelper/factory.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <cppuhelper/component.hxx>
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <com/sun/star/frame/XDesktop.hpp>
+#include <com/sun/star/frame/XTerminateListener.hpp>
+#include <cppuhelper/implbase4.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/awt/XWindow.hpp>
+#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <toolkit/awt/vclxwindow.hxx>
+#include <tools/resmgr.hxx>
+#include <vcl/svapp.hxx>
+
+#include <svl/solar.hrc>
+
+#include "xmlfiltersettingsdialog.hxx"
+
+//using namespace ::comphelper;
+using namespace ::rtl;
+using namespace ::cppu;
+using namespace ::osl;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::registry;
+using namespace ::com::sun::star::frame;
+
+
+class XMLFilterDialogComponentBase
+{
+protected:
+ ::osl::Mutex maMutex;
+};
+
+
+class XMLFilterDialogComponent : public XMLFilterDialogComponentBase,
+ public OComponentHelper,
+ public ::com::sun::star::ui::dialogs::XExecutableDialog,
+ public XServiceInfo,
+ public XInitialization,
+ public XTerminateListener
+{
+public:
+ XMLFilterDialogComponent( const Reference< XMultiServiceFactory >& rxMSF );
+ virtual ~XMLFilterDialogComponent();
+
+protected:
+ // XInterface
+ virtual Any SAL_CALL queryInterface( const Type& aType ) throw (RuntimeException);
+ virtual Any SAL_CALL queryAggregation( Type const & rType ) throw (RuntimeException);
+ virtual void SAL_CALL acquire() throw ();
+ virtual void SAL_CALL release() throw ();
+
+ // XTypeProvider
+ virtual Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(RuntimeException);
+ virtual Sequence< Type > SAL_CALL getTypes() throw (RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw(com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService(const ::rtl::OUString& ServiceName) throw(RuntimeException);
+ virtual Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (RuntimeException);
+
+ // XExecutableDialog
+ virtual void SAL_CALL setTitle( const ::rtl::OUString& aTitle ) throw(RuntimeException);
+ virtual sal_Int16 SAL_CALL execute( ) throw(RuntimeException);
+
+ // XInitialization
+ virtual void SAL_CALL initialize( const Sequence< Any >& aArguments ) throw(Exception, RuntimeException);
+
+ // XTerminateListener
+ virtual void SAL_CALL queryTermination( const EventObject& Event ) throw (TerminationVetoException, RuntimeException);
+ virtual void SAL_CALL notifyTermination( const EventObject& Event ) throw (RuntimeException);
+ virtual void SAL_CALL disposing( const EventObject& Source ) throw (RuntimeException);
+
+ /** Called in dispose method after the listeners were notified.
+ */
+ virtual void SAL_CALL disposing();
+
+private:
+ com::sun::star::uno::Reference<com::sun::star::awt::XWindow> mxParent; /// parent window
+ com::sun::star::uno::Reference< XMultiServiceFactory > mxMSF;
+
+ static ResMgr* mpResMgr;
+ XMLFilterSettingsDialog* mpDialog;
+};
+
+//-------------------------------------------------------------------------
+
+ResMgr* XMLFilterDialogComponent::mpResMgr = NULL;
+
+XMLFilterDialogComponent::XMLFilterDialogComponent( const com::sun::star::uno::Reference< XMultiServiceFactory >& rxMSF ) :
+ OComponentHelper( maMutex ),
+ mxMSF( rxMSF ),
+ mpDialog( NULL )
+{
+ Reference< XDesktop > xDesktop( mxMSF->createInstance( OUString::createFromAscii( "com.sun.star.frame.Desktop" ) ), UNO_QUERY );
+ if( xDesktop.is() )
+ {
+ Reference< XTerminateListener > xListener( this );
+ xDesktop->addTerminateListener( xListener );
+ }
+}
+
+//-------------------------------------------------------------------------
+
+XMLFilterDialogComponent::~XMLFilterDialogComponent()
+{
+}
+
+//-------------------------------------------------------------------------
+
+// XInterface
+Any SAL_CALL XMLFilterDialogComponent::queryInterface( const Type& aType ) throw (RuntimeException)
+{
+ return OComponentHelper::queryInterface( aType );
+}
+
+//-------------------------------------------------------------------------
+
+Any SAL_CALL XMLFilterDialogComponent::queryAggregation( Type const & rType ) throw (RuntimeException)
+{
+ if (rType == ::getCppuType( (Reference< ::com::sun::star::ui::dialogs::XExecutableDialog > const *)0 ))
+ {
+ void * p = static_cast< ::com::sun::star::ui::dialogs::XExecutableDialog * >( this );
+ return Any( &p, rType );
+ }
+ else if (rType == ::getCppuType( (Reference< XServiceInfo > const *)0 ))
+ {
+ void * p = static_cast< XServiceInfo * >( this );
+ return Any( &p, rType );
+ }
+ else if (rType == ::getCppuType( (Reference< XInitialization > const *)0 ))
+ {
+ void * p = static_cast< XInitialization * >( this );
+ return Any( &p, rType );
+ }
+ else if (rType == ::getCppuType( (Reference< XTerminateListener > const *)0 ))
+ {
+ void * p = static_cast< XTerminateListener * >( this );
+ return Any( &p, rType );
+ }
+ return OComponentHelper::queryAggregation( rType );
+}
+
+//-------------------------------------------------------------------------
+
+void SAL_CALL XMLFilterDialogComponent::acquire() throw ()
+{
+ OComponentHelper::acquire();
+}
+
+//-------------------------------------------------------------------------
+
+void SAL_CALL XMLFilterDialogComponent::release() throw ()
+{
+ OComponentHelper::release();
+}
+
+//-------------------------------------------------------------------------
+
+OUString XMLFilterDialogComponent_getImplementationName() throw ( RuntimeException )
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "XMLFilterDialogComponent" ) );
+}
+
+//-------------------------------------------------------------------------
+
+Sequence< OUString > SAL_CALL XMLFilterDialogComponent_getSupportedServiceNames() throw ( RuntimeException )
+{
+ OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.ui.XSLTFilterDialog" ) );
+ Sequence< ::rtl::OUString > aSupported( &aServiceName, 1 );
+ return aSupported;
+}
+
+//-------------------------------------------------------------------------
+
+sal_Bool SAL_CALL XMLFilterDialogComponent_supportsService( const OUString& ServiceName ) throw ( RuntimeException )
+{
+ Sequence< ::rtl::OUString > aSupported(XMLFilterDialogComponent_getSupportedServiceNames());
+ const ::rtl::OUString* pArray = aSupported.getConstArray();
+ for (sal_Int32 i = 0; i < aSupported.getLength(); ++i, ++pArray)
+ if (pArray->equals(ServiceName))
+ return sal_True;
+ return sal_False;
+}
+
+//-------------------------------------------------------------------------
+
+Reference< XInterface > SAL_CALL XMLFilterDialogComponent_createInstance( const Reference< XMultiServiceFactory > & rSMgr) throw ( Exception )
+{
+ return (OWeakObject*)new XMLFilterDialogComponent( rSMgr );
+}
+
+//-------------------------------------------------------------------------
+::rtl::OUString SAL_CALL XMLFilterDialogComponent::getImplementationName() throw(com::sun::star::uno::RuntimeException)
+{
+ return XMLFilterDialogComponent_getImplementationName();
+}
+
+//-------------------------------------------------------------------------
+
+Sequence< sal_Int8 > SAL_CALL XMLFilterDialogComponent::getImplementationId( void ) throw( RuntimeException )
+{
+ static OImplementationId* pId = 0;
+ if( !pId )
+ {
+ MutexGuard aGuard( Mutex::getGlobalMutex() );
+ if( !pId)
+ {
+ static OImplementationId aId;
+ pId = &aId;
+ }
+ }
+ return pId->getImplementationId();
+}
+
+//-------------------------------------------------------------------------
+
+Sequence< Type > XMLFilterDialogComponent::getTypes() throw (RuntimeException)
+{
+ static OTypeCollection * s_pTypes = 0;
+ if (! s_pTypes)
+ {
+ MutexGuard aGuard( Mutex::getGlobalMutex() );
+ if (! s_pTypes)
+ {
+ static OTypeCollection s_aTypes(
+ ::getCppuType( (const Reference< XComponent > *)0 ),
+ ::getCppuType( (const Reference< XTypeProvider > *)0 ),
+ ::getCppuType( (const Reference< XAggregation > *)0 ),
+ ::getCppuType( (const Reference< XWeak > *)0 ),
+ ::getCppuType( (const Reference< XServiceInfo > *)0 ),
+ ::getCppuType( (const Reference< XInitialization > *)0 ),
+ ::getCppuType( (const Reference< XTerminateListener > *)0 ),
+ ::getCppuType( (const Reference< ::com::sun::star::ui::dialogs::XExecutableDialog > *)0 ));
+ s_pTypes = &s_aTypes;
+ }
+ }
+ return s_pTypes->getTypes();
+}
+
+//-------------------------------------------------------------------------
+
+Sequence< ::rtl::OUString > SAL_CALL XMLFilterDialogComponent::getSupportedServiceNames() throw(com::sun::star::uno::RuntimeException)
+{
+ return XMLFilterDialogComponent_getSupportedServiceNames();
+}
+
+//-------------------------------------------------------------------------
+sal_Bool SAL_CALL XMLFilterDialogComponent::supportsService(const ::rtl::OUString& ServiceName) throw(RuntimeException)
+{
+ return XMLFilterDialogComponent_supportsService( ServiceName );
+}
+
+//-------------------------------------------------------------------------
+
+/** Called in dispose method after the listeners were notified.
+*/
+void SAL_CALL XMLFilterDialogComponent::disposing()
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ if( mpDialog )
+ {
+ delete mpDialog;
+ mpDialog = NULL;
+ }
+
+ if( mpResMgr )
+ {
+ delete mpResMgr;
+ mpResMgr = NULL;
+ }
+}
+
+//-------------------------------------------------------------------------
+
+// XTerminateListener
+void SAL_CALL XMLFilterDialogComponent::queryTermination( const EventObject& /* Event */ ) throw (TerminationVetoException, RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ // we will never give a veto here
+ if( mpDialog && !mpDialog->isClosable() )
+ {
+ mpDialog->ToTop();
+ throw TerminationVetoException();
+ }
+}
+
+//-------------------------------------------------------------------------
+
+void SAL_CALL XMLFilterDialogComponent::notifyTermination( const EventObject& /* Event */ ) throw (RuntimeException)
+{
+ // we are going down, so dispose us!
+ dispose();
+}
+
+void SAL_CALL XMLFilterDialogComponent::disposing( const EventObject& /* Source */ ) throw (RuntimeException)
+{
+}
+
+//-------------------------------------------------------------------------
+void SAL_CALL XMLFilterDialogComponent::setTitle( const ::rtl::OUString& /* _rTitle */ ) throw(RuntimeException)
+{
+}
+
+//-------------------------------------------------------------------------
+sal_Int16 SAL_CALL XMLFilterDialogComponent::execute( ) throw(RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ if( NULL == mpResMgr )
+ {
+ ByteString aResMgrName( "xsltdlg" );
+
+ mpResMgr = ResMgr::CreateResMgr( aResMgrName.GetBuffer(), Application::GetSettings().GetUILocale() );
+ }
+
+ if( NULL == mpDialog )
+ {
+ Window* pParent = NULL;
+ if( mxParent.is() )
+ {
+ VCLXWindow* pImplementation = VCLXWindow::GetImplementation(mxParent);
+ if (pImplementation)
+ pParent = pImplementation->GetWindow();
+ }
+
+ Reference< XComponent > xComp( this );
+ mpDialog = new XMLFilterSettingsDialog( pParent, *mpResMgr, mxMSF );
+ mpDialog->ShowWindow();
+ }
+ else if( !mpDialog->IsVisible() )
+ {
+ mpDialog->ShowWindow();
+ }
+ mpDialog->ToTop();
+
+ return 0;
+}
+
+//-------------------------------------------------------------------------
+void SAL_CALL XMLFilterDialogComponent::initialize( const Sequence< Any >& aArguments ) throw(Exception, RuntimeException)
+{
+ const Any* pArguments = aArguments.getConstArray();
+ for(sal_Int32 i=0; i<aArguments.getLength(); ++i, ++pArguments)
+ {
+ PropertyValue aProperty;
+ if(*pArguments >>= aProperty)
+ {
+ if( aProperty.Name.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "ParentWindow" ) ) == 0 )
+ {
+ aProperty.Value >>= mxParent;
+ }
+ }
+ }
+}
+
+
+extern "C"
+{
+//==================================================================================================
+void SAL_CALL component_getImplementationEnvironment(
+ const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */ )
+{
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+//==================================================================================================
+
+void singlecomponent_writeInfo( Reference< XRegistryKey >& xNewKey, const Sequence< OUString > & rSNL )
+{
+ const OUString * pArray = rSNL.getConstArray();
+ for ( sal_Int32 nPos = rSNL.getLength(); nPos--; )
+ xNewKey->createKey( pArray[nPos] );
+}
+
+sal_Bool SAL_CALL component_writeInfo(
+ void * /* pServiceManager */, void * pRegistryKey )
+{
+ if (pRegistryKey)
+ {
+ try
+ {
+ Reference< XRegistryKey > xNewKey(
+ reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( XMLFilterDialogComponent_getImplementationName() ) );
+ xNewKey = xNewKey->createKey( OUString::createFromAscii( "/UNO/SERVICES" ) );
+
+ singlecomponent_writeInfo( xNewKey, XMLFilterDialogComponent_getSupportedServiceNames() );
+
+ return sal_True;
+ }
+ catch (InvalidRegistryException &)
+ {
+ OSL_ENSURE( sal_False, "### InvalidRegistryException!" );
+ }
+ }
+ return sal_False;
+}
+//==================================================================================================
+void * SAL_CALL component_getFactory(
+ const sal_Char * pImplName, void * pServiceManager, void * /* pRegistryKey */ )
+{
+ void * pRet = 0;
+
+ if( pServiceManager )
+ {
+ Reference< XSingleServiceFactory > xFactory;
+
+ OUString implName = OUString::createFromAscii( pImplName );
+ if ( implName.equals(XMLFilterDialogComponent_getImplementationName()) )
+ {
+ xFactory = createOneInstanceFactory(
+ reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
+ OUString::createFromAscii( pImplName ),
+ XMLFilterDialogComponent_createInstance, XMLFilterDialogComponent_getSupportedServiceNames() );
+
+ }
+
+ if (xFactory.is())
+ {
+ xFactory->acquire();
+ pRet = xFactory.get();
+ }
+ }
+
+ return pRet;
+}
+}
diff --git a/filter/source/xsltdialog/xmlfilterdialogstrings.hrc b/filter/source/xsltdialog/xmlfilterdialogstrings.hrc
new file mode 100644
index 000000000000..a70b5d503df5
--- /dev/null
+++ b/filter/source/xsltdialog/xmlfilterdialogstrings.hrc
@@ -0,0 +1,72 @@
+/*************************************************************************
+ *
+ * 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 _XMLFILTERDIALOGSTRINGS_HRC_
+#define _XMLFILTERDIALOGSTRINGS_HRC_
+
+#include "xmlfiltercommon.hrc"
+
+#define STR_COLUMN_HEADER_NAME (RID_XSLT_DIALOG_START + 0)
+#define STR_COLUMN_HEADER_TYPE (RID_XSLT_DIALOG_START + 1)
+#define STR_UNKNOWN_APPLICATION (RID_XSLT_DIALOG_START + 2)
+#define STR_IMPORT_ONLY (RID_XSLT_DIALOG_START + 3)
+#define STR_IMPORT_EXPORT (RID_XSLT_DIALOG_START + 4)
+#define STR_EXPORT_ONLY (RID_XSLT_DIALOG_START + 5)
+
+#define STR_WARN_DELETE (RID_XSLT_DIALOG_START + 10)
+#define STR_NO_ERRORS_FOUND (RID_XSLT_DIALOG_START + 11)
+#define STR_NOT_SPECIFIED (RID_XSLT_DIALOG_START + 12)
+
+#define STR_DEFAULT_FILTER_NAME (RID_XSLT_DIALOG_START + 13)
+#define STR_DEFAULT_EXTENSION (RID_XSLT_DIALOG_START + 14)
+
+#define STR_ERROR_FILTER_NAME_EXISTS (RID_XSLT_DIALOG_START + 15)
+#define STR_ERROR_TYPE_NAME_EXISTS (RID_XSLT_DIALOG_START + 16)
+#define STR_ERROR_DTD_NOT_FOUND (RID_XSLT_DIALOG_START + 17)
+#define STR_ERROR_EXPORT_XSLT_NOT_FOUND (RID_XSLT_DIALOG_START + 18)
+#define STR_ERROR_IMPORT_XSLT_NOT_FOUND (RID_XSLT_DIALOG_START + 19)
+#define STR_ERROR_IMPORT_TEMPLATE_NOT_FOUND (RID_XSLT_DIALOG_START + 20)
+#define STR_DEFAULT_UI_NAME (RID_XSLT_DIALOG_START + 21)
+#define STR_UNDEFINED_FILTER (RID_XSLT_DIALOG_START + 22)
+
+#define STR_FILTER_HAS_BEEN_SAVED (RID_XSLT_DIALOG_START + 23)
+#define STR_FILTERS_HAVE_BEEN_SAVED (RID_XSLT_DIALOG_START + 24)
+#define STR_FILTER_PACKAGE (RID_XSLT_DIALOG_START + 25)
+#define STR_FILTER_INSTALLED (RID_XSLT_DIALOG_START + 26)
+#define STR_FILTERS_INSTALLED (RID_XSLT_DIALOG_START + 27)
+#define STR_NO_FILTERS_FOUND (RID_XSLT_DIALOG_START + 28)
+
+#define STR_APPL_NAME_WRITER (RID_XSLT_DIALOG_START + 30)
+#define STR_APPL_NAME_CALC (RID_XSLT_DIALOG_START + 31)
+#define STR_APPL_NAME_IMPRESS (RID_XSLT_DIALOG_START + 32)
+#define STR_APPL_NAME_DRAW (RID_XSLT_DIALOG_START + 33)
+#define STR_APPL_NAME_OASIS_WRITER (RID_XSLT_DIALOG_START + 34)
+#define STR_APPL_NAME_OASIS_CALC (RID_XSLT_DIALOG_START + 35)
+#define STR_APPL_NAME_OASIS_IMPRESS (RID_XSLT_DIALOG_START + 36)
+#define STR_APPL_NAME_OASIS_DRAW (RID_XSLT_DIALOG_START + 37)
+
+#endif
diff --git a/filter/source/xsltdialog/xmlfilterdialogstrings.src b/filter/source/xsltdialog/xmlfilterdialogstrings.src
new file mode 100644
index 000000000000..ee47ea279db6
--- /dev/null
+++ b/filter/source/xsltdialog/xmlfilterdialogstrings.src
@@ -0,0 +1,203 @@
+/*************************************************************************
+ *
+ * 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 "xmlfilterdialogstrings.hrc"
+
+
+String STR_COLUMN_HEADER_NAME
+{
+ Text [ en-US ] = "Name";
+};
+
+String STR_COLUMN_HEADER_TYPE
+{
+ Text [ en-US ] = "Type";
+};
+
+String STR_UNKNOWN_APPLICATION
+{
+ Text [ en-US ] = "Unknown";
+};
+
+String STR_IMPORT_ONLY
+{
+ Text [ en-US ] = "import filter";
+};
+
+String STR_IMPORT_EXPORT
+{
+ Text [ en-US ] = "import/export filter";
+};
+
+String STR_EXPORT_ONLY
+{
+ Text [ en-US ] = "export filter";
+};
+
+String STR_APPL_NAME_WRITER
+{
+ Text = "%PRODUCTNAME Writer (.sxw)";
+};
+
+String STR_APPL_NAME_CALC
+{
+ Text = "%PRODUCTNAME Calc (.sxc)";
+};
+
+String STR_APPL_NAME_IMPRESS
+{
+ Text = "%PRODUCTNAME Impress (.sxi)";
+};
+
+String STR_APPL_NAME_DRAW
+{
+ Text = "%PRODUCTNAME Draw (.sxd)";
+};
+
+String STR_APPL_NAME_OASIS_WRITER
+{
+ Text = "%PRODUCTNAME Writer (.odt)";
+};
+
+String STR_APPL_NAME_OASIS_CALC
+{
+ Text = "%PRODUCTNAME Calc (.ods)";
+};
+
+String STR_APPL_NAME_OASIS_IMPRESS
+{
+ Text = "%PRODUCTNAME Impress (.odp)";
+};
+
+String STR_APPL_NAME_OASIS_DRAW
+{
+ Text = "%PRODUCTNAME Draw (.odg)";
+};
+
+String STR_WARN_DELETE
+{
+ Text [ en-US ] = "Do you really want to delete the XML Filter '%s'? This action cannot be undone.";
+};
+
+String STR_ERROR_FILTER_NAME_EXISTS
+{
+ Text [ en-US ] = "An XML filter with the name '%s' already exists. Please enter a different name.";
+};
+
+String STR_ERROR_TYPE_NAME_EXISTS
+{
+ Text [ en-US ] = "The name for the user interface '%s1' is already used by the XML filter '%s2'. Please enter a different name.";
+};
+
+String STR_ERROR_DTD_NOT_FOUND
+{
+ Text [ en-US ] = "The DTD could not be found. Please enter a valid path.";
+};
+
+String STR_ERROR_EXPORT_XSLT_NOT_FOUND
+{
+ Text [ en-US ] = "The XSLT for export cannot be found. Please enter a valid path.";
+};
+
+String STR_ERROR_IMPORT_XSLT_NOT_FOUND
+{
+ Text [ en-US ] = "The XSLT for import cannot be found. Please enter a valid path.";
+};
+
+String STR_ERROR_IMPORT_TEMPLATE_NOT_FOUND
+{
+ Text [ en-US ] = "The given import template cannot be found. Please enter a valid path.";
+};
+
+String STR_NOT_SPECIFIED
+{
+ Text [ en-US ] = "Not specified";
+};
+
+String STR_NO_ERRORS_FOUND
+{
+ Text = "No errors found.";
+};
+
+String STR_DEFAULT_FILTER_NAME
+{
+ Text [ en-US ] = "New Filter";
+};
+
+String STR_DEFAULT_UI_NAME
+{
+ Text [ en-US ] = "Untitled";
+};
+
+String STR_DEFAULT_EXTENSION
+{
+ Text = "xml";
+};
+
+String STR_UNDEFINED_FILTER
+{
+ Text [ en-US ] = "undefined filter";
+};
+
+String STR_FILTER_HAS_BEEN_SAVED
+{
+ Text [ en-US ] = "The XML filter '%s' has been saved as package '%s'. ";
+};
+
+String STR_FILTERS_HAVE_BEEN_SAVED
+{
+ Text [ en-US ] = "%s XML filters have been saved in the package '%s'.";
+};
+
+String STR_FILTER_PACKAGE
+{
+ Text [ en-US ] = "XSLT filter package";
+};
+
+String STR_FILTER_INSTALLED
+{
+ Text [ en-US ] = "The XML filter '%s' has been installed successfully.";
+};
+
+String STR_FILTERS_INSTALLED
+{
+ Text [ en-US ] = "%s XML filters have been installed successfully.";
+};
+
+String STR_NO_FILTERS_FOUND
+{
+ Text [ en-US ] = "No XML filter could be installed because the package '%s' does not contain any XML filters.";
+};
+
+
+
+
+
+
+
+
+
diff --git a/filter/source/xsltdialog/xmlfilterhelpids.hrc b/filter/source/xsltdialog/xmlfilterhelpids.hrc
new file mode 100644
index 000000000000..9c49d0537723
--- /dev/null
+++ b/filter/source/xsltdialog/xmlfilterhelpids.hrc
@@ -0,0 +1,88 @@
+/*************************************************************************
+ *
+ * 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 _XMLFILTERHELPIDS_HRC_
+#define _XMLFILTERHELPIDS_HRC_
+
+#ifndef _FILTER_HRC
+#include "filter.hrc"
+#endif
+
+#define HID_XML_SOURCE_FILE_DIALOG (HID_FILTER_XSLT_START + 0)
+#define HID_XML_SOURCE_FILE_VALIDATE (HID_FILTER_XSLT_START + 1)
+#define HID_XML_FILTER_SETTINGS_DIALOG (HID_FILTER_XSLT_START + 2)
+#define HID_XML_FILTER_LIST (HID_FILTER_XSLT_START + 3)
+#define HID_XML_FILTER_NEW (HID_FILTER_XSLT_START + 4)
+#define HID_XML_FILTER_EDIT (HID_FILTER_XSLT_START + 5)
+#define HID_XML_FILTER_TEST (HID_FILTER_XSLT_START + 6)
+#define HID_XML_FILTER_DELETE (HID_FILTER_XSLT_START + 7)
+#define HID_XML_FILTER_SAVE (HID_FILTER_XSLT_START + 8)
+#define HID_XML_FILTER_OPEN (HID_FILTER_XSLT_START + 9)
+#define HID_XML_FILTER_CLOSE (HID_FILTER_XSLT_START + 10)
+
+#define HID_XML_FILTER_TABDIALOG (HID_FILTER_XSLT_START + 11)
+#define HID_XML_FILTER_TABPAGE_BASIC (HID_FILTER_XSLT_START + 12)
+#define HID_XML_FILTER_TABPAGE_XSLT (HID_FILTER_XSLT_START + 13)
+#define HID_XML_FILTER_NAME (HID_FILTER_XSLT_START + 14)
+#define HID_XML_FILTER_APPLICATION (HID_FILTER_XSLT_START + 15)
+#define HID_XML_FILTER_INTERFACE_NAME (HID_FILTER_XSLT_START + 16)
+#define HID_XML_FILTER_EXTENSION (HID_FILTER_XSLT_START + 17)
+#define HID_XML_FILTER_DESCRIPTION (HID_FILTER_XSLT_START + 18)
+#define HID_XML_FILTER_DOCTYPE (HID_FILTER_XSLT_START + 19)
+#define HID_XML_FILTER_DTD (HID_FILTER_XSLT_START + 20)
+#define HID_XML_FILTER_DTD_BROWSE (HID_FILTER_XSLT_START + 21)
+#define HID_XML_FILTER_EXPORT_XSLT (HID_FILTER_XSLT_START + 22)
+#define HID_XML_FILTER_EXPORT_XSLT_BROWSE (HID_FILTER_XSLT_START + 23)
+#define HID_XML_FILTER_IMPORT_XSLT (HID_FILTER_XSLT_START + 24)
+#define HID_XML_FILTER_IMPORT_XSLT_BROWSE (HID_FILTER_XSLT_START + 25)
+#define HID_XML_FILTER_IMPORT_TEMPLATE (HID_FILTER_XSLT_START + 26)
+#define HID_XML_FILTER_TEST_DIALOG (HID_FILTER_XSLT_START + 27)
+
+#define HID_XML_FILTER_TEST_EXPORT_BROWSE (HID_FILTER_XSLT_START + 28)
+#define HID_XML_FILTER_TEST_EXPORT_CURRENT (HID_FILTER_XSLT_START + 29)
+#define HID_XML_FILTER_TEST_EXPORT_CURRENT_FILE (HID_FILTER_XSLT_START + 30)
+
+#define HID_XML_FILTER_TEST_IMPORT_XSLT_FILE (HID_FILTER_XSLT_START + 31)
+#define HID_XML_FILTER_TEST_IMPORT_TEMPLATE_FILE (HID_FILTER_XSLT_START + 32)
+#define HID_XML_FILTER_TEST_IMPORT_DISPLAY_SOURCE (HID_FILTER_XSLT_START + 33)
+#define HID_XML_FILTER_TEST_IMPORT_BROWSE (HID_FILTER_XSLT_START + 34)
+#define HID_XML_FILTER_TEST_IMPORT_RECENT (HID_FILTER_XSLT_START + 35)
+#define HID_XML_FILTER_TEST_IMPORT_RECENT_FILE (HID_FILTER_XSLT_START + 36)
+#define HID_XML_FILTER_TEST_CLOSE (HID_FILTER_XSLT_START + 37)
+
+#define HID_XML_FILTER_IMPORT_TEMPLATE_BROWSE (HID_FILTER_XSLT_START + 38)
+
+#define HID_XML_FILTER_TEST_VALIDATE_OUPUT (HID_FILTER_XSLT_START + 39)
+#define HID_XML_FILTER_OUTPUT_WINDOW (HID_FILTER_XSLT_START + 40)
+
+#define HID_XML_FILTER_TEST_EXPORT_XSLT_FILE (HID_FILTER_XSLT_START + 41)
+
+#define HID_XML_FILTER_TABPAGE_CTRL (HID_FILTER_XSLT_START + 42)
+
+// last help id is HID_FILTER_XSLT_END !
+// #define HID_FILTER_XSLT_END (HID_FILTER_START + 99)
+
+#endif
diff --git a/filter/source/xsltdialog/xmlfilterjar.cxx b/filter/source/xsltdialog/xmlfilterjar.cxx
new file mode 100644
index 000000000000..5592c331713f
--- /dev/null
+++ b/filter/source/xsltdialog/xmlfilterjar.cxx
@@ -0,0 +1,397 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+#include <com/sun/star/io/XActiveDataControl.hpp>
+#include <com/sun/star/io/XActiveDataSource.hpp>
+#include <com/sun/star/frame/XConfigManager.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/io/XActiveDataSink.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/container/XChild.hpp>
+#include <com/sun/star/util/XChangesBatch.hpp>
+
+
+#include <comphelper/oslfile2streamwrap.hxx>
+#include <comphelper/storagehelper.hxx>
+#include <unotools/streamwrap.hxx>
+#include <tools/stream.hxx>
+#include <tools/urlobj.hxx>
+#include <unotools/tempfile.hxx>
+#include <svl/urihelper.hxx>
+#include <osl/file.hxx>
+
+#include <rtl/uri.hxx>
+
+#include "xmlfilterjar.hxx"
+#include "xmlfilterdialogstrings.hrc"
+#include "xmlfiltersettingsdialog.hxx"
+#include "typedetectionexport.hxx"
+#include "typedetectionimport.hxx"
+
+using namespace rtl;
+using namespace osl;
+using namespace comphelper;
+using namespace com::sun::star;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::frame;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::util;
+using namespace com::sun::star::container;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::io;
+
+XMLFilterJarHelper::XMLFilterJarHelper( Reference< XMultiServiceFactory >& xMSF )
+: mxMSF( xMSF ),
+ sVndSunStarPackage( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.Package:" ) ),
+ sXSLTPath( RTL_CONSTASCII_USTRINGPARAM( "$(user)/xslt/" ) ),
+ sDTDPath( RTL_CONSTASCII_USTRINGPARAM( "$(user)/dtd/" ) ),
+ sTemplatePath( RTL_CONSTASCII_USTRINGPARAM( "$(user)/template/") ),
+ sSpecialConfigManager( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.config.SpecialConfigManager" ) ),
+ sPump( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.io.Pump" ) ),
+ sProgPath( RTL_CONSTASCII_USTRINGPARAM( "$(prog)/" ) )
+{
+ try
+ {
+ Reference< XConfigManager > xCfgMgr( xMSF->createInstance(OUString::createFromAscii("com.sun.star.config.SpecialConfigManager")), UNO_QUERY );
+ if( xCfgMgr.is() )
+ {
+ sProgPath = xCfgMgr->substituteVariables( sProgPath );
+ sXSLTPath = xCfgMgr->substituteVariables( sXSLTPath );
+ sDTDPath = xCfgMgr->substituteVariables( sDTDPath );
+ sTemplatePath = xCfgMgr->substituteVariables( sTemplatePath );
+ }
+ }
+ catch(Exception&)
+ {
+ }
+}
+
+static OUString encodeZipUri( const OUString& rURI )
+{
+ return Uri::encode( rURI, rtl_UriCharClassUric, rtl_UriEncodeCheckEscapes, RTL_TEXTENCODING_UTF8 );
+}
+
+static Reference< XInterface > addFolder( Reference< XInterface >& xRootFolder, Reference< XSingleServiceFactory >& xFactory, const OUString& rName ) throw( Exception )
+{
+ Sequence< Any > aArgs(1);
+ aArgs[0] <<= (sal_Bool)sal_True;
+
+ Reference< XInterface > xFolder( xFactory->createInstanceWithArguments(aArgs) );
+ Reference< XNamed > xNamed( xFolder, UNO_QUERY );
+ Reference< XChild > xChild( xFolder, UNO_QUERY );
+
+ if( xNamed.is() && xChild.is() )
+ {
+ OUString aName( encodeZipUri( rName ) );
+ xNamed->setName( aName );
+ xChild->setParent( xRootFolder );
+ }
+
+ return xFolder;
+}
+
+static void _addFile( Reference< XInterface >& xRootFolder, Reference< XSingleServiceFactory >& xFactory, Reference< XInputStream >& xInput, OUString aName ) throw( Exception )
+{
+
+ Reference< XActiveDataSink > xSink( xFactory->createInstance(), UNO_QUERY );
+ Reference< XUnoTunnel > xTunnel( xSink, UNO_QUERY );
+ if( xSink.is() && xTunnel.is())
+ {
+ Reference< XNameContainer > xNameContainer(xRootFolder, UNO_QUERY );
+ xNameContainer->insertByName(aName = encodeZipUri( aName ), makeAny(xTunnel));
+ xSink->setInputStream( xInput );
+ }
+}
+
+/*
+static void addFile( Reference< XInterface > xRootFolder, Reference< XSingleServiceFactory > xFactory, const OUString& rSourceFile, const OUString& rName ) throw( Exception )
+{
+ Reference< XInputStream > xInput( new utl::OSeekableInputStreamWrapper( new SvFileStream(rSourceFile, STREAM_READ ), true ) );
+ _addFile( xRootFolder, xFactory, xInput, rName );
+}
+*/
+
+void XMLFilterJarHelper::addFile( Reference< XInterface > xRootFolder, Reference< XSingleServiceFactory > xFactory, const OUString& rSourceFile ) throw( Exception )
+{
+ if( rSourceFile.getLength() &&
+ (rSourceFile.compareToAscii( RTL_CONSTASCII_STRINGPARAM("http:") ) != 0) &&
+ (rSourceFile.compareToAscii( RTL_CONSTASCII_STRINGPARAM("shttp:") ) != 0) &&
+ (rSourceFile.compareToAscii( RTL_CONSTASCII_STRINGPARAM("jar:") ) != 0) &&
+ (rSourceFile.compareToAscii( RTL_CONSTASCII_STRINGPARAM("ftp:") ) != 0))
+ {
+ OUString aFileURL( rSourceFile );
+
+ if( !aFileURL.matchIgnoreAsciiCase( OUString( RTL_CONSTASCII_USTRINGPARAM("file://") ) ) )
+ {
+ aFileURL = URIHelper::SmartRel2Abs( sProgPath, aFileURL, Link(), false );
+ }
+
+ INetURLObject aURL( aFileURL );
+ OUString aName( aURL.getName() );
+
+ SvFileStream* pStream = new SvFileStream(aFileURL, STREAM_READ );
+ Reference< XInputStream > xInput( new utl::OSeekableInputStreamWrapper( pStream, true ) );
+ _addFile( xRootFolder, xFactory, xInput, aName );
+ }
+}
+
+bool XMLFilterJarHelper::savePackage( const OUString& rPackageURL, const XMLFilterVector& rFilters )
+{
+ try
+ {
+ osl::File::remove( rPackageURL );
+
+ // create the package jar file
+
+ Sequence< Any > aArguments( 2 );
+ aArguments[ 0 ] <<= rPackageURL;
+
+ // let ZipPackage be used ( no manifest.xml is required )
+ beans::NamedValue aArg;
+ aArg.Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StorageFormat" ) );
+ aArg.Value <<= ZIP_STORAGE_FORMAT_STRING;
+ aArguments[ 1 ] <<= aArg;
+
+ Reference< XHierarchicalNameAccess > xIfc(
+ mxMSF->createInstanceWithArguments(
+ rtl::OUString::createFromAscii(
+ "com.sun.star.packages.comp.ZipPackage" ),
+ aArguments ), UNO_QUERY );
+
+ if( xIfc.is() )
+ {
+ Reference< XSingleServiceFactory > xFactory( xIfc, UNO_QUERY );
+
+ // get root zip folder
+ Reference< XInterface > xRootFolder;
+ OUString szRootFolder( RTL_CONSTASCII_USTRINGPARAM("/") );
+ xIfc->getByHierarchicalName( szRootFolder ) >>= xRootFolder;
+
+ // export filters files
+ XMLFilterVector::const_iterator aIter( rFilters.begin() );
+ while( aIter != rFilters.end() )
+ {
+ const filter_info_impl* pFilter = (*aIter);
+
+ Reference< XInterface > xFilterRoot( addFolder( xRootFolder, xFactory, pFilter->maFilterName ) );
+
+ if( xFilterRoot.is() )
+ {
+ if( pFilter->maDTD.getLength() )
+ addFile( xFilterRoot, xFactory, pFilter->maDTD );
+
+ if( pFilter->maExportXSLT.getLength() )
+ addFile( xFilterRoot, xFactory, pFilter->maExportXSLT );
+ try
+ {
+ if( pFilter->maImportXSLT.getLength() )
+ addFile( xFilterRoot, xFactory, pFilter->maImportXSLT );
+ }
+ catch( com::sun::star::container::ElementExistException&)
+ {
+ // in case of same named import / export XSLT the latter
+ // is ignored
+ DBG_ERROR( "XMLFilterJarHelper::same named xslt filter exception!" );
+ }
+
+ if( pFilter->maImportTemplate.getLength() )
+ addFile( xFilterRoot, xFactory, pFilter->maImportTemplate );
+ }
+
+ aIter++;
+ }
+
+ // create TypeDetection.xcu
+ utl::TempFile aTempFile;
+ aTempFile.EnableKillingFile();
+ OUString aTempFileURL( aTempFile.GetURL() );
+
+ {
+ osl::File aOutputFile( aTempFileURL );
+ /* osl::File::RC rc = */ aOutputFile.open( OpenFlag_Write );
+ Reference< XOutputStream > xOS( new OSLOutputStreamWrapper( aOutputFile ) );
+
+ TypeDetectionExporter aExporter( mxMSF );
+ aExporter.doExport(xOS,rFilters);
+ }
+
+ Reference< XInputStream > XIS( new utl::OSeekableInputStreamWrapper( new SvFileStream(aTempFileURL, STREAM_READ ), true ) );
+ OUString szTypeDetection( RTL_CONSTASCII_USTRINGPARAM( "TypeDetection.xcu" ) );
+ _addFile( xRootFolder, xFactory, XIS, szTypeDetection );
+
+ Reference< XChangesBatch > xBatch( xIfc, UNO_QUERY );
+ if( xBatch.is() )
+ xBatch->commitChanges();
+
+ return true;
+ }
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR( "XMLFilterJarHelper::savePackage exception catched!" );
+ }
+
+ osl::File::remove( rPackageURL );
+
+ return false;
+}
+
+
+
+//
+
+void XMLFilterJarHelper::openPackage( const OUString& rPackageURL, XMLFilterVector& rFilters )
+{
+ try
+ {
+ // create the package jar file
+
+ Sequence< Any > aArguments( 2 );
+ aArguments[ 0 ] <<= rPackageURL;
+
+ // let ZipPackage be used ( no manifest.xml is required )
+ beans::NamedValue aArg;
+ aArg.Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StorageFormat" ) );
+ aArg.Value <<= ZIP_STORAGE_FORMAT_STRING;
+ aArguments[ 1 ] <<= aArg;
+
+ Reference< XHierarchicalNameAccess > xIfc(
+ mxMSF->createInstanceWithArguments(
+ rtl::OUString::createFromAscii(
+ "com.sun.star.packages.comp.ZipPackage" ),
+ aArguments ), UNO_QUERY );
+
+ if( xIfc.is() )
+ {
+ Reference< XSingleServiceFactory > xFactory( xIfc, UNO_QUERY );
+
+ // get root zip folder
+ Reference< XInterface > xRootFolder;
+ OUString szRootFolder( RTL_CONSTASCII_USTRINGPARAM("/") );
+ xIfc->getByHierarchicalName( szRootFolder ) >>= xRootFolder;
+
+ OUString szTypeDetection( RTL_CONSTASCII_USTRINGPARAM("TypeDetection.xcu") );
+ if( xIfc->hasByHierarchicalName( szTypeDetection ) )
+ {
+ Reference< XActiveDataSink > xTypeDetection;
+ xIfc->getByHierarchicalName( szTypeDetection ) >>= xTypeDetection;
+
+ if( xTypeDetection.is() )
+ {
+ Reference< XInputStream > xIS( xTypeDetection->getInputStream() );
+
+ XMLFilterVector aFilters;
+ TypeDetectionImporter::doImport( mxMSF, xIS, aFilters );
+
+ // copy all files used by the filters imported from the
+ // typedetection to office/user/xslt
+ XMLFilterVector::iterator aIter( aFilters.begin() );
+ while( aIter != aFilters.end() )
+ {
+ if( copyFiles( xIfc, (*aIter) ) )
+ {
+ rFilters.push_back( (*aIter) );
+ }
+ else
+ {
+ // failed to copy all files
+ delete (*aIter);
+ }
+ aIter++;
+ }
+ }
+ }
+ }
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR( "XMLFilterJarHelper::savePackage exception catched!" );
+ }
+}
+
+bool XMLFilterJarHelper::copyFiles( Reference< XHierarchicalNameAccess > xIfc, filter_info_impl* pFilter )
+{
+ bool bOk = copyFile( xIfc, pFilter->maDTD, sDTDPath );
+
+ if( bOk )
+ bOk = copyFile( xIfc, pFilter->maExportXSLT, sXSLTPath );
+
+ if( bOk )
+ bOk = copyFile( xIfc, pFilter->maImportXSLT, sXSLTPath );
+
+ if( bOk )
+ bOk = copyFile( xIfc, pFilter->maImportTemplate, sTemplatePath );
+
+ return bOk;
+}
+
+bool XMLFilterJarHelper::copyFile( Reference< XHierarchicalNameAccess > xIfc, OUString& rURL, const OUString& rTargetURL )
+{
+ if( !rURL.matchIgnoreAsciiCase( sVndSunStarPackage ) )
+ return true;
+
+ try
+ {
+ OUString szPackagePath( encodeZipUri( rURL.copy( sVndSunStarPackage.getLength() ) ) );
+
+ if( xIfc->hasByHierarchicalName( szPackagePath ) )
+ {
+ Reference< XActiveDataSink > xFileEntry;
+ xIfc->getByHierarchicalName( szPackagePath ) >>= xFileEntry;
+
+ if( xFileEntry.is() )
+ {
+ Reference< XInputStream > xIS( xFileEntry->getInputStream() );
+
+ INetURLObject aBaseURL( rTargetURL );
+
+ rURL = URIHelper::SmartRel2Abs( aBaseURL, szPackagePath, Link(), false );
+
+ if( rURL.getLength() )
+ {
+ // create output directory if needed
+ if( !createDirectory( rURL ) )
+ return false;
+
+ SvFileStream aOutputStream(rURL, STREAM_WRITE );
+ Reference< XOutputStream > xOS( new utl::OOutputStreamWrapper( aOutputStream ) );
+
+ return copyStreams( xIS, xOS );
+ }
+ }
+ }
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR( "XMLFilterJarHelper::copyFile exception catched" );
+ }
+ return false;
+}
diff --git a/filter/source/xsltdialog/xmlfilterjar.hxx b/filter/source/xsltdialog/xmlfilterjar.hxx
new file mode 100644
index 000000000000..a196905edabf
--- /dev/null
+++ b/filter/source/xsltdialog/xmlfilterjar.hxx
@@ -0,0 +1,65 @@
+/*************************************************************************
+ *
+ * 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 _XMLFILTERJAR_HXX_
+#define _XMLFILTERJAR_HXX_
+
+#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+#include <vector>
+
+class filter_info_impl;
+
+typedef std::vector< filter_info_impl* > XMLFilterVector;
+
+class XMLFilterJarHelper
+{
+public:
+ XMLFilterJarHelper( com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xMSF );
+
+ bool savePackage( const rtl::OUString& rPackageURL, const XMLFilterVector& rFilters );
+ void openPackage( const rtl::OUString& rPackageURL, XMLFilterVector& rFilters );
+
+private:
+ void addFile( com::sun::star::uno::Reference< com::sun::star::uno::XInterface > xRootFolder, com::sun::star::uno::Reference< com::sun::star::lang::XSingleServiceFactory > xFactory, const ::rtl::OUString& rSourceFile ) throw( com::sun::star::uno::Exception );
+
+ bool copyFile( com::sun::star::uno::Reference< com::sun::star::container::XHierarchicalNameAccess > xIfc, ::rtl::OUString& rURL, const ::rtl::OUString& rTargetURL );
+ bool copyFiles( com::sun::star::uno::Reference< com::sun::star::container::XHierarchicalNameAccess > xIfc, filter_info_impl* pFilter );
+
+ com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > mxMSF;
+
+ ::rtl::OUString sVndSunStarPackage;
+ ::rtl::OUString sXSLTPath;
+ ::rtl::OUString sDTDPath;
+ ::rtl::OUString sTemplatePath;
+ ::rtl::OUString sSpecialConfigManager;
+ ::rtl::OUString sPump;
+ ::rtl::OUString sProgPath;
+};
+
+#endif
diff --git a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx
new file mode 100644
index 000000000000..46cab18f6c77
--- /dev/null
+++ b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx
@@ -0,0 +1,1799 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+#include <com/sun/star/frame/XConfigManager.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/util/XFlushable.hpp>
+
+#ifndef _COM_SUN_STAR_BEANS_NAMEDVALUE_HPP_
+#include <com/sun/star/beans/PropertyValue.hpp>
+#endif
+
+#include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
+#include <tools/urlobj.hxx>
+#include <svtools/headbar.hxx>
+#include <unotools/streamwrap.hxx>
+#include <osl/file.hxx>
+#include <vcl/msgbox.hxx>
+#include <sfx2/filedlghelper.hxx>
+
+#include <rtl/uri.hxx>
+
+#include <algorithm>
+
+#include "xmlfilterdialogstrings.hrc"
+#include "xmlfiltersettingsdialog.hxx"
+#include "xmlfiltersettingsdialog.hrc"
+#include "xmlfiltertabdialog.hxx"
+#include "xmlfiltertestdialog.hxx"
+#include "xmlfilterjar.hxx"
+#include "xmlfilterhelpids.hrc"
+
+using namespace rtl;
+using namespace osl;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::io;
+using namespace com::sun::star::frame;
+using namespace com::sun::star::container;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::util;
+
+ResMgr* XMLFilterSettingsDialog::mpResMgr = NULL;
+
+XMLFilterSettingsDialog::XMLFilterSettingsDialog( Window* pParent, ResMgr& rResMgr, const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rxMSF ) :
+ WorkWindow( pParent, ResId( DLG_XML_FILTER_SETTINGS_DIALOG, rResMgr ) ),
+ mxMSF( rxMSF ),
+ maCtrlFilterList( this, ResId( CTRL_XML_FILTER_LIST, rResMgr ) ),
+ maPBNew( this, ResId( PB_XML_FILTER_NEW, rResMgr ) ),
+ maPBEdit( this, ResId( PB_XML_FILTER_EDIT, rResMgr ) ),
+ maPBTest( this, ResId( PB_XML_FILTER_TEST, rResMgr ) ),
+ maPBDelete( this, ResId( PB_XML_FILTER_DELETE, rResMgr ) ),
+ maPBSave( this, ResId( PB_XML_FILTER_SAVE, rResMgr ) ),
+ maPBOpen( this, ResId( PB_XML_FILTER_OPEN, rResMgr ) ),
+ maPBHelp( this, ResId( BTN_XML_FILTER_HELP, rResMgr ) ),
+ maPBClose( this, ResId( PB_XML_FILTER_CLOSE, rResMgr ) ),
+ mbIsClosable(true),
+ sTemplatePath( RTL_CONSTASCII_USTRINGPARAM( "$(user)/template/") ),
+ sDocTypePrefix( RTL_CONSTASCII_USTRINGPARAM( "doctype:") )
+{
+ FreeResource();
+
+ mpResMgr = &rResMgr;
+
+ mpFilterListBox = new XMLFilterListBox( &maCtrlFilterList );
+ mpFilterListBox->SetSelectHdl( LINK( this, XMLFilterSettingsDialog, SelectionChangedHdl_Impl ) );
+ mpFilterListBox->SetDeselectHdl( LINK( this, XMLFilterSettingsDialog, SelectionChangedHdl_Impl ) );
+ mpFilterListBox->SetDoubleClickHdl( LINK( this, XMLFilterSettingsDialog, DoubleClickHdl_Impl ) );
+ mpFilterListBox->SetHelpId( HID_XML_FILTER_LIST );
+
+ maPBNew.SetClickHdl(LINK( this, XMLFilterSettingsDialog, ClickHdl_Impl ) );
+ maPBEdit.SetClickHdl(LINK( this, XMLFilterSettingsDialog, ClickHdl_Impl ) );
+ maPBTest.SetClickHdl(LINK( this, XMLFilterSettingsDialog, ClickHdl_Impl ) );
+ maPBDelete.SetClickHdl(LINK( this, XMLFilterSettingsDialog, ClickHdl_Impl ) );
+ maPBSave.SetClickHdl(LINK( this, XMLFilterSettingsDialog, ClickHdl_Impl ) );
+ maPBOpen.SetClickHdl(LINK( this, XMLFilterSettingsDialog, ClickHdl_Impl ) );
+ maPBClose.SetClickHdl(LINK( this, XMLFilterSettingsDialog, ClickHdl_Impl ) );
+
+ try
+ {
+ mxFilterContainer = Reference< XNameContainer >::query( rxMSF->createInstance( OUString::createFromAscii("com.sun.star.document.FilterFactory" ) ) );
+ mxTypeDetection = Reference< XNameContainer >::query( rxMSF->createInstance( OUString::createFromAscii("com.sun.star.document.TypeDetection" ) ));
+ mxExtendedTypeDetection = Reference< XNameContainer >::query( rxMSF->createInstance( OUString::createFromAscii("com.sun.star.document.ExtendedTypeDetectionFactory" ) ) );
+
+ Reference< XConfigManager > xCfgMgr( mxMSF->createInstance(OUString::createFromAscii("com.sun.star.config.SpecialConfigManager") ), UNO_QUERY );
+ if( xCfgMgr.is() )
+ {
+ sTemplatePath = xCfgMgr->substituteVariables( sTemplatePath );
+ }
+ }
+ catch(Exception&)
+ {
+ DBG_ERROR( "XMLFilterSettingsDialog::XMLFilterSettingsDialog exception catched!" );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+XMLFilterSettingsDialog::~XMLFilterSettingsDialog()
+{
+ delete mpFilterListBox;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK(XMLFilterSettingsDialog, ClickHdl_Impl, PushButton *, pButton )
+{
+ mbIsClosable = false;
+
+ if( &maPBNew == pButton )
+ {
+ onNew();
+ }
+ else if( &maPBEdit == pButton )
+ {
+ onEdit();
+ }
+ else if( &maPBTest == pButton )
+ {
+ onTest();
+ }
+ else if( &maPBDelete == pButton )
+ {
+ onDelete();
+ }
+ else if( &maPBSave == pButton )
+ {
+ onSave();
+ }
+ else if( &maPBOpen == pButton )
+ {
+ onOpen();
+ }
+ else if( &maPBClose == pButton )
+ {
+ onClose();
+ }
+
+ mbIsClosable = true;
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK(XMLFilterSettingsDialog, SelectionChangedHdl_Impl, void *, EMPTYARG )
+{
+ updateStates();
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK(XMLFilterSettingsDialog, DoubleClickHdl_Impl, void *, EMPTYARG )
+{
+ onEdit();
+ return 0;
+}
+
+bool XMLFilterSettingsDialog::isClosable()
+{
+ return mbIsClosable;
+}
+
+// -----------------------------------------------------------------------
+
+void XMLFilterSettingsDialog::ShowWindow()
+{
+ maCtrlFilterList.GrabFocus();
+ disposeFilterList();
+ mpFilterListBox->Clear();
+ initFilterList();
+ updateStates();
+ mpFilterListBox->Reset();
+
+ WorkWindow::Show( TRUE );
+}
+
+// -----------------------------------------------------------------------
+
+void XMLFilterSettingsDialog::updateStates()
+{
+ SvLBoxEntry* pSelectedEntry = mpFilterListBox->FirstSelected();
+
+ bool bHasSelection = pSelectedEntry != NULL;
+
+ bool bMultiSelection = bHasSelection && (mpFilterListBox->NextSelected( pSelectedEntry ) != NULL );
+ bool bIsReadonly = false;
+ bool bIsDefault = false;
+ if(pSelectedEntry)
+ {
+ filter_info_impl* pInfo = (filter_info_impl*)pSelectedEntry->GetUserData();
+ bIsReadonly = 0 != pInfo->mbReadonly;
+
+ sal_Int32 nFact = SvtModuleOptions::E_WRITER;
+ while(nFact <= SvtModuleOptions::E_BASIC)
+ {
+ ::rtl::OUString sDefault = maModuleOpt.GetFactoryDefaultFilter((SvtModuleOptions::EFactory)nFact);
+ if( sDefault == pInfo->maFilterName )
+ {
+ bIsDefault = true;
+ break;
+ }
+ ++nFact;
+ }
+ }
+ maPBEdit.Enable( bHasSelection && !bMultiSelection && !bIsReadonly);
+ maPBTest.Enable( bHasSelection && !bMultiSelection );
+ maPBDelete.Enable( bHasSelection && !bMultiSelection && !bIsReadonly && !bIsDefault);
+ maPBSave.Enable( bHasSelection );
+}
+
+// -----------------------------------------------------------------------
+
+/** is called when the user clicks on the "New" button */
+void XMLFilterSettingsDialog::onNew()
+{
+ filter_info_impl aTempInfo;
+
+ // create a unique filter name
+ aTempInfo.maFilterName = createUniqueFilterName( String( RESID( STR_DEFAULT_FILTER_NAME ) ) );
+
+ // init default extension
+ String aDefaultExtension( RESID( STR_DEFAULT_EXTENSION ) );
+ aTempInfo.maExtension = aDefaultExtension;
+
+ // set default ui name
+ aTempInfo.maInterfaceName = createUniqueInterfaceName( String( RESID( STR_DEFAULT_UI_NAME ) ) );
+
+ // set default application
+ aTempInfo.maDocumentService = OUString::createFromAscii("com.sun.star.text.TextDocument");
+
+ // execute XML Filter Dialog
+ XMLFilterTabDialog aDlg( this, *mpResMgr, mxMSF, &aTempInfo );
+ if ( aDlg.Execute() == RET_OK )
+ {
+ // insert the new filter
+ insertOrEdit( aDlg.getNewFilterInfo() );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+/** is called when the user clicks on the "Edit" Button */
+void XMLFilterSettingsDialog::onEdit()
+{
+ // get selected filter entry
+ SvLBoxEntry* pEntry = mpFilterListBox->FirstSelected();
+ if( pEntry )
+ {
+ // get its filter info
+ filter_info_impl* pOldInfo = (filter_info_impl*)pEntry->GetUserData();
+
+ // execute XML Filter Dialog
+ XMLFilterTabDialog aDlg( this, *mpResMgr, mxMSF, pOldInfo );
+ if ( aDlg.Execute() == RET_OK )
+ {
+ filter_info_impl* pNewInfo = aDlg.getNewFilterInfo();
+
+ if( !(*pOldInfo == *pNewInfo) )
+ {
+ // change filter
+ insertOrEdit( pNewInfo, pOldInfo );
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+/** helper to create a sequence of strings from an extensions strings
+ "ext1;ext2;ext3" will become { "ext1", "ext2", "ext3" } */
+static Sequence< OUString > createExtensionsSequence( const rtl::OUString& rExtensions )
+{
+ // first count how many extensions we have inside the string
+ int nExtensions = 0;
+
+ int nLength = rExtensions.getLength();
+ if( nLength )
+ {
+ // a non empty string has at least one extension
+ nExtensions++;
+
+ // now count the delimeters ';'
+ const sal_Unicode * pString = rExtensions.getStr();
+ int i;
+ for( i = 0; i < nLength; i++, pString++ )
+ {
+ if( *pString == sal_Unicode( ';' ) )
+ nExtensions++;
+ }
+ }
+
+ Sequence< OUString > aExtensions( nExtensions );
+
+ // extract the extensions from the source string and fill the sequence
+
+ int nLastIndex = 0;
+ int nCurrentIndex = 0;
+ int i;
+
+ for( i = 0; i < nExtensions; i++ )
+ {
+ nLastIndex = rExtensions.indexOf( sal_Unicode( ';' ), nLastIndex );
+
+ if( nLastIndex == -1 )
+ {
+ aExtensions[i] = rExtensions.copy( nCurrentIndex );
+ break;
+ }
+ else
+ {
+ aExtensions[i] = rExtensions.copy( nCurrentIndex, nLastIndex - nCurrentIndex );
+ nCurrentIndex = nLastIndex + 1;
+ nLastIndex = nCurrentIndex;
+ }
+ }
+
+ return aExtensions;
+}
+
+// -----------------------------------------------------------------------
+
+/** checks if the given name is unique inside the filter factory. If not,
+ numbers are added until the returned name is unique */
+OUString XMLFilterSettingsDialog::createUniqueFilterName( const OUString& rFilterName )
+{
+ OUString aFilterName( rFilterName );
+ OUString aSpace( sal_Unicode( ' ' ) );
+
+ sal_Int32 nId = 2;
+
+ while( mxFilterContainer->hasByName( aFilterName ) )
+ {
+ aFilterName = rFilterName;
+ aFilterName += aSpace;
+ aFilterName += OUString::valueOf( nId++ );
+ }
+
+ return aFilterName;
+}
+
+// -----------------------------------------------------------------------
+
+/** checks if the given name is unique inside the type detection. If not,
+ numbers are added until the returned name is unique */
+OUString XMLFilterSettingsDialog::createUniqueTypeName( const OUString& rTypeName )
+{
+ OUString aTypeName( rTypeName );
+ OUString aSpace( sal_Unicode( ' ' ) );
+
+ sal_Int32 nId = 2;
+
+ while( mxFilterContainer->hasByName( aTypeName ) )
+ {
+ aTypeName = rTypeName;
+ aTypeName += aSpace;
+ aTypeName += OUString::valueOf( nId++ );
+ }
+
+ return aTypeName;
+}
+
+/** checks if the given name is a unique ui name inside the filter factory. If not,
+ numbers are added until the returned name is unique */
+OUString XMLFilterSettingsDialog::createUniqueInterfaceName( const OUString& rInterfaceName )
+{
+ sal_Int32 nDefaultNumber = 0;
+
+ try
+ {
+ Sequence< OUString > aFilterNames( mxFilterContainer->getElementNames() );
+ OUString* pFilterName = aFilterNames.getArray();
+
+ const sal_Int32 nCount = aFilterNames.getLength();
+ sal_Int32 nFilter;
+
+ Sequence< PropertyValue > aValues;
+ for( nFilter = 0; (nFilter < nCount); nFilter++, pFilterName++ )
+ {
+ Any aAny( mxFilterContainer->getByName( *pFilterName ) );
+ if( !(aAny >>= aValues) )
+ continue;
+
+ const sal_Int32 nValueCount( aValues.getLength() );
+ PropertyValue* pValues = aValues.getArray();
+ sal_Int32 nValue;
+
+ for( nValue = 0; nValue < nValueCount; nValue++, pValues++ )
+ {
+ if( pValues->Name.equalsAscii( "UIName" ) )
+ {
+ OUString aInterfaceName;
+ pValues->Value >>= aInterfaceName;
+
+
+ // see if this filter matches our default filter name
+ if( aInterfaceName.match( rInterfaceName ) )
+ {
+ // if yes, make sure we generate a unique name with a higher number
+ // this is dump but fast
+ sal_Int32 nNumber = aInterfaceName.copy( rInterfaceName.getLength() ).toInt32();
+ if( nNumber >= nDefaultNumber )
+ nDefaultNumber = nNumber + 1;
+ }
+ }
+ }
+ }
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR( "XMLFilterSettingsDialog::createUniqueInterfaceName exception catched!" );
+ }
+
+ OUString aInterfaceName( rInterfaceName );
+ if( nDefaultNumber )
+ {
+ aInterfaceName += OUString( sal_Unicode( ' ' ) );
+ aInterfaceName += String::CreateFromInt32( nDefaultNumber );
+ }
+
+ return aInterfaceName;
+}
+
+// -----------------------------------------------------------------------
+
+/** inserts a new filter into the ui and configuration if pOldInfo is NULL.
+ If pOldInfo is not null, the old filter will be replaced with the new settings */
+bool XMLFilterSettingsDialog::insertOrEdit( filter_info_impl* pNewInfo, const filter_info_impl* pOldInfo )
+{
+ bool bOk = true;
+
+ if( pOldInfo )
+ {
+ // see if we need to update the type name
+ if( pOldInfo->maFilterName != pNewInfo->maFilterName )
+ {
+ if( pOldInfo->maType == pOldInfo->maFilterName )
+ {
+ pNewInfo->maType = OUString();
+ }
+ }
+
+ // see if we need to clean up old stuff first
+ try
+ {
+ // if filter name changed, we need to remove the old filter first
+ if( pOldInfo->maFilterName != pNewInfo->maFilterName )
+ mxFilterContainer->removeByName( pOldInfo->maFilterName );
+
+ // if type name changed, we need to remove the old type first
+ if( pOldInfo->maType != pNewInfo->maType )
+ mxTypeDetection->removeByName( pOldInfo->maType );
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR( "XMLFilterSettingsDialog::insertOrEdit exception catched!" );
+ bOk = false;
+ }
+ }
+
+ filter_info_impl* pFilterEntry( NULL );
+
+ if( bOk )
+ {
+ // create or copy filter info
+ if( pOldInfo )
+ {
+ // change existing filter entry in filter list box
+ pFilterEntry = const_cast<filter_info_impl*>(pOldInfo);
+ *pFilterEntry = *pNewInfo;
+ }
+ else
+ {
+ // add new entry to filter list box
+ pFilterEntry = new filter_info_impl( *pNewInfo );
+ }
+ }
+
+ // check if we need to copy the template
+ if( pFilterEntry->maImportTemplate.getLength() )
+ {
+ if( !pFilterEntry->maImportTemplate.matchIgnoreAsciiCase( sTemplatePath ) )
+ {
+ INetURLObject aSourceURL( pFilterEntry->maImportTemplate );
+ if( aSourceURL.GetName().getLength() != 0 )
+ {
+ OUString aDestURL( sTemplatePath );
+ aDestURL += pFilterEntry->maFilterName;
+ aDestURL += OUString( sal_Unicode('/') );
+ if( createDirectory( aDestURL ) )
+ {
+ aDestURL += aSourceURL.GetName();
+
+ SvFileStream aInputStream(pFilterEntry->maImportTemplate, STREAM_READ );
+ Reference< XInputStream > xIS( new utl::OInputStreamWrapper( aInputStream ) );
+ SvFileStream aOutputStream(aDestURL, STREAM_WRITE );
+ Reference< XOutputStream > xOS( new utl::OOutputStreamWrapper( aOutputStream ) );
+
+ if( copyStreams( xIS, xOS ) )
+ pFilterEntry->maImportTemplate = aDestURL;
+ }
+ }
+ }
+ }
+
+ if( bOk )
+ {
+ if( pFilterEntry->maType.getLength() == 0 )
+ {
+ pFilterEntry->maType = createUniqueTypeName( pNewInfo->maFilterName );
+ }
+
+ // update import/export flags
+ if( pFilterEntry->maImportXSLT.getLength() )
+ {
+ pFilterEntry->maFlags |= 1;
+ }
+ else
+ {
+ pFilterEntry->maFlags &= ~1;
+ }
+
+ if( pFilterEntry->maExportXSLT.getLength() )
+ {
+ pFilterEntry->maFlags |= 2;
+ }
+ else
+ {
+ pFilterEntry->maFlags &= ~2;
+ }
+ pFilterEntry->maFlags |= 0x80040;
+
+ // 2. create user data for filter entry
+ Sequence< OUString > aUserData( pFilterEntry->getFilterUserData());
+
+ // 3. create property values for filter entry
+ Sequence< PropertyValue > aFilterData( 8 );
+
+ aFilterData[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Type" ) );
+ aFilterData[0].Value <<= pFilterEntry->maType;
+
+ aFilterData[1].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "UIName" ) );
+ aFilterData[1].Value <<= pFilterEntry->maInterfaceName;
+
+ aFilterData[2].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "DocumentService" ) );
+ aFilterData[2].Value <<= pFilterEntry->maDocumentService;
+
+ aFilterData[3].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "FilterService" ) );
+ aFilterData[3].Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Writer.XmlFilterAdaptor" ) );
+
+ aFilterData[4].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Flags" ) );
+ aFilterData[4].Value <<= pFilterEntry->maFlags;
+
+ aFilterData[5].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "UserData" ) );
+ aFilterData[5].Value <<= aUserData;
+
+ aFilterData[6].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "FileFormatVersion" ) );
+ aFilterData[6].Value <<= pFilterEntry->maFileFormatVersion;
+
+ aFilterData[7].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "TemplateName" ) );
+ aFilterData[7].Value <<= pFilterEntry->maImportTemplate;
+
+ // 4. insert new or replace existing filter
+ try
+ {
+ Any aAny( makeAny( aFilterData ) );
+ if( mxFilterContainer->hasByName( pFilterEntry->maFilterName ) )
+ {
+ mxFilterContainer->replaceByName( pFilterEntry->maFilterName, aAny );
+ }
+ else
+ {
+ mxFilterContainer->insertByName( pFilterEntry->maFilterName, aAny );
+ }
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR( "XMLFilterSettingsDialog::insertOrEdit exception catched!" );
+ bOk = false;
+ }
+ }
+
+ // 5. prepare type information
+ if( bOk )
+ {
+ Sequence< PropertyValue > aValues(4);
+
+ aValues[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "UIName" ) );
+ aValues[0].Value <<= pFilterEntry->maInterfaceName;
+/*
+ aValues[i ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "MediaType" ) );
+ aValues[i++].Value <<= pFilterEntry->maDocType;
+*/
+ aValues[1].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "ClipboardFormat" ) );
+ OUString aDocType;
+ if( !pFilterEntry->maDocType.match( sDocTypePrefix ) )
+ {
+ aDocType = sDocTypePrefix;
+ aDocType += pFilterEntry->maDocType;
+ }
+ else
+ {
+ aDocType = pFilterEntry->maDocType;
+ }
+ if (aDocType == sDocTypePrefix)
+ aValues[1].Value <<= OUString();
+ else
+ aValues[1].Value <<= aDocType;
+
+ aValues[2].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "DocumentIconID" ) );
+ aValues[2].Value <<= pFilterEntry->mnDocumentIconID;
+
+ aValues[3].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Extensions" ) );
+ aValues[3].Value <<= createExtensionsSequence( pFilterEntry->maExtension );
+
+ // the detect service will only be registered, if a doctype/search token was specified
+ if (aDocType.getLength() > sDocTypePrefix.getLength())
+ {
+ aValues.realloc(5);
+ aValues[4].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "DetectService" ) );
+ aValues[4].Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.filters.XMLFilterDetect" ) );
+ }
+
+ // 6. insert new or replace existing type information
+ if( mxTypeDetection.is() )
+ {
+ try
+ {
+ Any aAny( makeAny( aValues ) );
+ if( mxTypeDetection->hasByName( pFilterEntry->maType ) )
+ {
+ mxTypeDetection->replaceByName( pFilterEntry->maType, aAny );
+ }
+ else
+ {
+ mxTypeDetection->insertByName( pFilterEntry->maType, aAny );
+ }
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR( "XMLFilterSettingsDialog::insertOrEdit exception catched!" );
+ bOk = false;
+ }
+ }
+
+ if( bOk )
+ {
+ try
+ {
+ Reference< XFlushable > xFlushable = Reference< XFlushable >::query( mxTypeDetection );
+ if( xFlushable.is() )
+ xFlushable->flush();
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR( "XMLFilterSettingsDialog::insertOrEdit exception catched!" );
+ bOk = false;
+ }
+ }
+
+ if( !bOk )
+ {
+ // we failed to add the type, so lets remove the filter
+ try
+ {
+ mxFilterContainer->removeByName( pFilterEntry->maFilterName );
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR( "XMLFilterSettingsDialog::insertOrEdit exception catched!" );
+ bOk = false;
+ }
+ }
+ else
+ {
+ if( bOk )
+ {
+ try
+ {
+ Reference< XFlushable > xFlushable( mxFilterContainer, UNO_QUERY );
+ if( xFlushable.is() )
+ xFlushable->flush();
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR( "XMLFilterSettingsDialog::insertOrEdit exception catched!" );
+ bOk = false;
+ }
+
+ if( !bOk )
+ {
+ // we failed to add the filter, so lets remove the type
+ try
+ {
+ mxTypeDetection->removeByName( pFilterEntry->maType );
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR( "XMLFilterSettingsDialog::insertOrEdit exception catched!" );
+ }
+ }
+
+ }
+ }
+ }
+
+ if( bOk )
+ {
+ if( mxExtendedTypeDetection.is() )
+ {
+ OUString sFilterDetectService( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.filters.XMLFilterDetect") );
+ if( mxExtendedTypeDetection->hasByName( sFilterDetectService ) )
+ {
+ Sequence< PropertyValue > aSequence;
+ if( mxExtendedTypeDetection->getByName( sFilterDetectService ) >>= aSequence )
+ {
+ sal_Int32 nCount = aSequence.getLength();
+ sal_Int32 nIndex;
+ for( nIndex = 0; nIndex < nCount; nIndex++ )
+ {
+ OUString aName( aSequence[nIndex].Name );
+ if( aSequence[nIndex].Name.equalsAscii( "Types" ) )
+ {
+ Sequence< OUString > aTypes;
+ if( aSequence[nIndex].Value >>= aTypes )
+ {
+ sal_Int32 nStrCount = aTypes.getLength();
+ sal_Int32 nStr;
+ for( nStr = 0; nStr < nStrCount; nStr++ )
+ {
+ OUString aType( aTypes[nStr] );
+ if( aTypes[nStr] == pFilterEntry->maType )
+ break;
+ }
+
+ if( nStr == nStrCount )
+ {
+ aTypes.realloc( nStrCount + 1 );
+ aTypes[nStrCount] = pFilterEntry->maType;
+
+ aSequence[nIndex].Value <<= aTypes;
+
+ mxExtendedTypeDetection->replaceByName( sFilterDetectService, makeAny( aSequence ) );
+
+ Reference< XFlushable > xFlushable( mxExtendedTypeDetection, UNO_QUERY );
+ if( xFlushable.is() )
+ xFlushable->flush();
+ }
+ }
+
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // update ui
+ if( bOk )
+ {
+ if( pOldInfo )
+ {
+ mpFilterListBox->changeEntry( pFilterEntry );
+ }
+ else
+ {
+ mpFilterListBox->addFilterEntry( pFilterEntry );
+ maFilterVector.push_back( pFilterEntry );
+ }
+ }
+
+ return bOk;
+}
+
+// -----------------------------------------------------------------------
+
+/** is called when the user clicks the "Test" button */
+void XMLFilterSettingsDialog::onTest()
+{
+ // get the first selected filter
+ SvLBoxEntry* pEntry = mpFilterListBox->FirstSelected();
+ if( pEntry )
+ {
+ filter_info_impl* pInfo = (filter_info_impl*)pEntry->GetUserData();
+
+ XMLFilterTestDialog aDlg( this, *mpResMgr, mxMSF );
+ aDlg.test( *pInfo );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void XMLFilterSettingsDialog::onDelete()
+{
+ SvLBoxEntry* pEntry = mpFilterListBox->FirstSelected();
+ if( pEntry )
+ {
+ filter_info_impl* pInfo = (filter_info_impl*)pEntry->GetUserData();
+
+ String aPlaceHolder( RTL_CONSTASCII_USTRINGPARAM("%s") );
+ String aMessage(RESID(STR_WARN_DELETE));
+ aMessage.SearchAndReplace( aPlaceHolder, pInfo->maFilterName );
+
+ WarningBox aWarnBox(this, (WinBits)(WB_YES_NO | WB_DEF_YES), aMessage );
+ if( aWarnBox.Execute() == RET_YES )
+ {
+ try
+ {
+ if( mxFilterContainer->hasByName( pInfo->maFilterName ) )
+ {
+ mxFilterContainer->removeByName( pInfo->maFilterName );
+
+ bool bTypeStillUsed = false;
+
+ // now loop over all filter and see if someone else uses the same type
+ Sequence< OUString > aFilterNames( mxFilterContainer->getElementNames() );
+ OUString* pFilterName = aFilterNames.getArray();
+
+ const sal_Int32 nCount = aFilterNames.getLength();
+ sal_Int32 nFilter;
+ Sequence< PropertyValue > aValues;
+
+ for( nFilter = 0; (nFilter < nCount) && !bTypeStillUsed; nFilter++, pFilterName++ )
+ {
+ Any aAny( mxFilterContainer->getByName( *pFilterName ) );
+ if( !(aAny >>= aValues) )
+ continue;
+
+ const sal_Int32 nValueCount( aValues.getLength() );
+ PropertyValue* pValues = aValues.getArray();
+ sal_Int32 nValue;
+
+ for( nValue = 0; (nValue < nValueCount) && !bTypeStillUsed; nValue++, pValues++ )
+ {
+ if( pValues->Name.equalsAscii( "Type" ) )
+ {
+ OUString aType;
+ pValues->Value >>= aType;
+ if( aType == pInfo->maType )
+ bTypeStillUsed = true;
+
+ break;
+ }
+ }
+ }
+
+ // if the type is not used anymore, remove it also
+ if( !bTypeStillUsed )
+ {
+ if( mxTypeDetection->hasByName( pInfo->maType ) )
+ {
+ mxTypeDetection->removeByName( pInfo->maType );
+ }
+ }
+
+ Reference< XFlushable > xFlushable( mxFilterContainer, UNO_QUERY );
+ if( xFlushable.is() )
+ xFlushable->flush();
+
+ xFlushable = Reference< XFlushable >::query( mxTypeDetection );
+ if( xFlushable.is() )
+ xFlushable->flush();
+
+ // now remove entry from ui
+ mpFilterListBox->RemoveSelection();
+
+ // and delete the filter entry
+ maFilterVector.erase(std::find( maFilterVector.begin(), maFilterVector.end(), pInfo ));
+
+ delete pInfo;
+ }
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR( "XMLFilterSettingsDialog::onDelete exception catched!" );
+ }
+ }
+ }
+
+ updateStates();
+}
+
+// -----------------------------------------------------------------------
+
+void XMLFilterSettingsDialog::onSave()
+{
+ XMLFilterVector aFilters;
+
+ int nFilters = 0;
+
+ SvLBoxEntry* pEntry = mpFilterListBox->FirstSelected();
+ while( pEntry )
+ {
+ filter_info_impl* pInfo = (filter_info_impl*)pEntry->GetUserData();
+ aFilters.push_back( pInfo );
+ pEntry = mpFilterListBox->NextSelected( pEntry );
+ nFilters++;
+ }
+
+ // Open Fileopen-Dialog
+ ::sfx2::FileDialogHelper aDlg(
+ com::sun::star::ui::dialogs::TemplateDescription::FILESAVE_AUTOEXTENSION,
+ 0 );
+
+ String aExtensions( RTL_CONSTASCII_USTRINGPARAM("*.jar") );
+ String aFilterName( RESID( STR_FILTER_PACKAGE ) );
+ aFilterName += String( RTL_CONSTASCII_USTRINGPARAM(" (") );
+ aFilterName += aExtensions;
+ aFilterName += sal_Unicode(')');
+
+ aDlg.AddFilter( aFilterName, aExtensions );
+
+ if ( aDlg.Execute() == ERRCODE_NONE )
+ {
+ XMLFilterJarHelper aJarHelper( mxMSF );
+ aJarHelper.savePackage( aDlg.GetPath(), aFilters );
+
+ INetURLObject aURL( aDlg.GetPath() );
+
+ String sPlaceholder( RTL_CONSTASCII_USTRINGPARAM( "%s" ) );
+
+ String aMsg;
+ if( nFilters > 0 )
+ {
+ aMsg = String( RESID( STR_FILTERS_HAVE_BEEN_SAVED ) );
+ aMsg.SearchAndReplace( sPlaceholder, String::CreateFromInt32(nFilters) );
+ aMsg.SearchAndReplace( sPlaceholder, aURL.GetName() );
+ }
+ else
+ {
+ aMsg = String( RESID( STR_FILTER_HAS_BEEN_SAVED ) );
+ aMsg.SearchAndReplace( sPlaceholder, (*aFilters.begin())->maFilterName );
+ aMsg.SearchAndReplace( sPlaceholder, aURL.GetName() );
+ }
+
+ InfoBox aBox(this, aMsg );
+ aBox.Execute();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void XMLFilterSettingsDialog::onOpen()
+{
+ XMLFilterVector aFilters;
+
+ // Open Fileopen-Dialog
+ ::sfx2::FileDialogHelper aDlg(
+ com::sun::star::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, 0 );
+
+ String aExtensions( RTL_CONSTASCII_USTRINGPARAM("*.jar") );
+ String aFilterName( RESID( STR_FILTER_PACKAGE ) );
+ aFilterName += String( RTL_CONSTASCII_USTRINGPARAM(" (") );
+ aFilterName += aExtensions;
+ aFilterName += sal_Unicode(')');
+
+ aDlg.AddFilter( aFilterName, aExtensions );
+
+ if ( aDlg.Execute() == ERRCODE_NONE )
+ {
+ OUString aURL( aDlg.GetPath() );
+
+ XMLFilterJarHelper aJarHelper( mxMSF );
+ aJarHelper.openPackage( aURL, aFilters );
+
+ int nFilters = 0;
+ XMLFilterVector::iterator aIter( aFilters.begin() );
+ while( aIter != aFilters.end() )
+ {
+ filter_info_impl* pInfo = (*aIter++);
+
+ if( insertOrEdit( pInfo ) )
+ {
+ aFilterName = pInfo->maFilterName;
+ nFilters++;
+ }
+
+ delete pInfo;
+ }
+
+ disposeFilterList();
+ initFilterList();
+
+ String sPlaceholder( RTL_CONSTASCII_USTRINGPARAM( "%s" ) );
+ String aMsg;
+ if( nFilters == 0 )
+ {
+ INetURLObject aURLObj( aURL );
+ aMsg = String( RESID( STR_NO_FILTERS_FOUND ) );
+ aMsg.SearchAndReplace( sPlaceholder, aURLObj.GetName() );
+ }
+ else if( nFilters == 1 )
+ {
+ aMsg = String( RESID( STR_FILTER_INSTALLED ) );
+ aMsg.SearchAndReplace( sPlaceholder, aFilterName );
+
+ }
+ else
+ {
+ aMsg = String( RESID( STR_FILTERS_INSTALLED ) );
+ aMsg.SearchAndReplace( sPlaceholder, String::CreateFromInt32(nFilters) );
+ }
+
+ InfoBox aBox(this, aMsg );
+ aBox.Execute();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void XMLFilterSettingsDialog::onClose()
+{
+ Close();
+}
+
+long XMLFilterSettingsDialog::Notify( NotifyEvent& rNEvt )
+{
+ // Zuerst Basisklasse rufen wegen TabSteuerung
+ long nRet = WorkWindow::Notify( rNEvt );
+ if ( !nRet )
+ {
+ if ( rNEvt.GetType() == EVENT_KEYINPUT )
+ {
+ const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
+ KeyCode aKeyCode = pKEvt->GetKeyCode();
+ USHORT nKeyCode = aKeyCode.GetCode();
+
+ if( nKeyCode == KEY_ESCAPE )
+ {
+ Close();
+ return TRUE;
+ }
+ }
+ }
+
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+void XMLFilterSettingsDialog::disposeFilterList()
+{
+ std::vector< filter_info_impl* >::iterator aIter( maFilterVector.begin() );
+ while( aIter != maFilterVector.end() )
+ {
+ delete (*aIter++);
+ }
+ maFilterVector.clear();
+
+ mpFilterListBox->Clear();
+}
+
+// -----------------------------------------------------------------------
+
+void XMLFilterSettingsDialog::initFilterList()
+{
+ if( mxFilterContainer.is() )
+ {
+ Sequence< OUString > aFilterNames( mxFilterContainer->getElementNames() );
+ OUString* pFilterName = aFilterNames.getArray();
+
+ const sal_Int32 nCount = aFilterNames.getLength();
+ sal_Int32 nFilter;
+
+ Sequence< PropertyValue > aValues;
+
+ filter_info_impl* pTempFilter = new filter_info_impl;
+ Sequence< OUString > aUserData;
+
+ for( nFilter = 0; nFilter < nCount; nFilter++, pFilterName++ )
+ {
+ aUserData.realloc(0);
+
+ try
+ {
+ Any aAny( mxFilterContainer->getByName( *pFilterName ) );
+ if( !(aAny >>= aValues) )
+ continue;
+
+ OUString aFilterService;
+ pTempFilter->maFilterName = *pFilterName;
+
+ const sal_Int32 nValueCount( aValues.getLength() );
+ PropertyValue* pValues = aValues.getArray();
+ sal_Int32 nValue;
+
+ for( nValue = 0; nValue < nValueCount; nValue++, pValues++ )
+ {
+ if( pValues->Name.equalsAscii( "Type" ) )
+ {
+ pValues->Value >>= pTempFilter->maType;
+ }
+ else if( pValues->Name.equalsAscii( "UIName" ) )
+ {
+ pValues->Value >>= pTempFilter->maInterfaceName;
+ }
+ else if( pValues->Name.equalsAscii( "DocumentService" ) )
+ {
+ pValues->Value >>= pTempFilter->maDocumentService;
+ }
+ else if( pValues->Name.equalsAscii( "FilterService" ) )
+ {
+ pValues->Value >>= aFilterService;
+ }
+ else if( pValues->Name.equalsAscii( "Flags" ) )
+ {
+ pValues->Value >>= pTempFilter->maFlags;
+ }
+ else if( pValues->Name.equalsAscii( "UserData" ) )
+ {
+ pValues->Value >>= aUserData;
+ }
+ else if( pValues->Name.equalsAscii( "FileFormatVersion" ) )
+ {
+ pValues->Value >>= pTempFilter->maFileFormatVersion;
+ }
+ else if( pValues->Name.equalsAscii( "TemplateName" ) )
+ {
+ pValues->Value >>= pTempFilter->maImportTemplate;
+ }
+ else if(pValues->Name.equalsAscii( "Finalized" ))
+ {
+ pValues->Value >>= pTempFilter->mbReadonly;
+ }
+ }
+
+ // if this is not a XmlFilterAdaptor entry, skip it
+ if( !aFilterService.equalsAscii( "com.sun.star.comp.Writer.XmlFilterAdaptor" ) )
+ continue;
+
+
+ // if we don't have the needed user data, skip it
+ if( aUserData.getLength() < 6 )
+ continue;
+
+ // if this is not an XSLTFilter entry, skip it
+ if( !aUserData[0].equalsAscii( "com.sun.star.documentconversion.XSLTFilter" ) )
+ continue;
+
+ // get filter information from userdata
+ pTempFilter->maImportService = aUserData[2];
+ pTempFilter->maExportService = aUserData[3];
+ pTempFilter->maImportXSLT = aUserData[4];
+ pTempFilter->maExportXSLT = aUserData[5];
+ if( aUserData.getLength() >= 7 )
+ pTempFilter->maDTD = aUserData[6];
+ if( aUserData.getLength() >= 8 )
+ pTempFilter->maComment = aUserData[7];
+
+ // get type information
+ if( mxTypeDetection.is() )
+ {
+ try
+ {
+ aAny = mxTypeDetection->getByName( pTempFilter->maType );
+ Sequence< PropertyValue > aValues2;
+
+ if( aAny >>= aValues2 )
+ {
+ const sal_Int32 nValueCount2( aValues2.getLength() );
+ PropertyValue* pValues2 = aValues2.getArray();
+ sal_Int32 nValue2;
+
+ for( nValue2 = 0; nValue2 < nValueCount2; nValue2++, pValues2++ )
+ {
+/*
+ if( pValues2->Name.equalsAscii( "MediaType" ) )
+ {
+ pValues2->Value >>= pTempFilter->maDocType;
+ } else
+*/
+ if( pValues2->Name.equalsAscii( "ClipboardFormat" ) )
+ {
+ OUString aDocType;
+ pValues2->Value >>= aDocType;
+
+ if( aDocType.match( sDocTypePrefix ) )
+ aDocType = aDocType.copy( sDocTypePrefix.getLength() );
+
+ pTempFilter->maDocType = aDocType;
+ }
+ else if( pValues2->Name.equalsAscii( "Extensions" ) )
+ {
+ Sequence< OUString > aExtensions;
+ if( pValues2->Value >>= aExtensions )
+ {
+ pTempFilter->maExtension = OUString();
+
+ sal_Int32 nCount3( aExtensions.getLength() );
+ OUString* pExtensions = aExtensions.getArray();
+ sal_Int32 n;
+ for( n = 0; n < nCount3; n++ )
+ {
+ if( n > 0 )
+ pTempFilter->maExtension += OUString( sal_Unicode(';') );
+ pTempFilter->maExtension += (*pExtensions++);
+ }
+ }
+ }
+ else if( pValues2->Name.equalsAscii( "DocumentIconID" ) )
+ {
+ pValues2->Value >>= pTempFilter->mnDocumentIconID;
+ }
+ else if(pValues2->Name.equalsAscii( "Finalized" ))
+ {
+ // both the filter and the type may be finalized
+ sal_Bool bTemp = sal_False;
+ pValues2->Value >>= bTemp;
+ pTempFilter->mbReadonly |= bTemp;
+ }
+ }
+ }
+ }
+ catch( ::com::sun::star::container::NoSuchElementException& )
+ {
+ DBG_ERROR( "Type not found, user error?" ); // TODO: error?
+ }
+ }
+
+ // add entry to internal container and to ui filter list box
+ maFilterVector.push_back( pTempFilter );
+ mpFilterListBox->addFilterEntry( pTempFilter );
+
+
+ pTempFilter = new filter_info_impl;
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR( "XMLFilterSettingsDialog::initFilterList exception catched!" );
+ }
+
+ }
+
+ delete pTempFilter;
+ }
+
+ SvLBoxEntry* pEntry = mpFilterListBox->GetEntry( 0 );
+ if( pEntry )
+ mpFilterListBox->Select( pEntry );
+}
+
+// -----------------------------------------------------------------------
+
+// -----------------------------------------------------------------------
+
+application_info_impl::application_info_impl( const sal_Char * pDocumentService, ResId& rUINameRes, const sal_Char * mpXMLImporter, const sal_Char * mpXMLExporter )
+: maDocumentService( pDocumentService, strlen( pDocumentService ), RTL_TEXTENCODING_ASCII_US ),
+ maDocumentUIName( String( rUINameRes ) ),
+ maXMLImporter( mpXMLImporter, strlen( mpXMLImporter ), RTL_TEXTENCODING_ASCII_US ),
+ maXMLExporter( mpXMLExporter, strlen( mpXMLExporter ), RTL_TEXTENCODING_ASCII_US )
+{
+}
+
+// -----------------------------------------------------------------------
+
+std::vector< application_info_impl* >& getApplicationInfos()
+{
+ static std::vector< application_info_impl* > aInfos;
+
+ if( aInfos.empty() )
+ {
+ ResId aResId1( STR_APPL_NAME_WRITER, *getXSLTDialogResMgr() );
+ aInfos.push_back( new application_info_impl(
+ "com.sun.star.text.TextDocument",
+ aResId1,
+ "com.sun.star.comp.Writer.XMLImporter",
+ "com.sun.star.comp.Writer.XMLExporter" ) );
+
+ ResId aResId2( STR_APPL_NAME_CALC, *getXSLTDialogResMgr() );
+ aInfos.push_back( new application_info_impl(
+ "com.sun.star.sheet.SpreadsheetDocument",
+ aResId2,
+ "com.sun.star.comp.Calc.XMLImporter",
+ "com.sun.star.comp.Calc.XMLExporter" ) );
+
+ ResId aResId3( STR_APPL_NAME_IMPRESS, *getXSLTDialogResMgr() );
+ aInfos.push_back( new application_info_impl(
+ "com.sun.star.presentation.PresentationDocument",
+ aResId3,
+ "com.sun.star.comp.Impress.XMLImporter",
+ "com.sun.star.comp.Impress.XMLExporter" ) );
+
+ ResId aResId4( STR_APPL_NAME_DRAW, *getXSLTDialogResMgr() );
+ aInfos.push_back( new application_info_impl(
+ "com.sun.star.drawing.DrawingDocument",
+ aResId4,
+ "com.sun.star.comp.Draw.XMLImporter",
+ "com.sun.star.comp.Draw.XMLExporter" ) );
+
+ // --- oasis file formats...
+ ResId aResId5( STR_APPL_NAME_OASIS_WRITER, *getXSLTDialogResMgr() );
+ aInfos.push_back( new application_info_impl(
+ "com.sun.star.text.TextDocument",
+ aResId5,
+ "com.sun.star.comp.Writer.XMLOasisImporter",
+ "com.sun.star.comp.Writer.XMLOasisExporter" ) );
+
+ ResId aResId6( STR_APPL_NAME_OASIS_CALC, *getXSLTDialogResMgr() );
+ aInfos.push_back( new application_info_impl(
+ "com.sun.star.sheet.SpreadsheetDocument",
+ aResId6,
+ "com.sun.star.comp.Calc.XMLOasisImporter",
+ "com.sun.star.comp.Calc.XMLOasisExporter" ) );
+
+ ResId aResId7( STR_APPL_NAME_OASIS_IMPRESS, *getXSLTDialogResMgr() );
+ aInfos.push_back( new application_info_impl(
+ "com.sun.star.presentation.PresentationDocument",
+ aResId7,
+ "com.sun.star.comp.Impress.XMLOasisImporter",
+ "com.sun.star.comp.Impress.XMLOasisExporter" ) );
+
+ ResId aResId8( STR_APPL_NAME_OASIS_DRAW, *getXSLTDialogResMgr() );
+ aInfos.push_back( new application_info_impl(
+ "com.sun.star.drawing.DrawingDocument",
+ aResId8,
+ "com.sun.star.comp.Draw.XMLOasisImporter",
+ "com.sun.star.comp.Draw.XMLOasisExporter" ) );
+}
+
+ return aInfos;
+}
+
+// -----------------------------------------------------------------------
+
+const application_info_impl* getApplicationInfo( const OUString& rServiceName )
+{
+ std::vector< application_info_impl* >& rInfos = getApplicationInfos();
+ std::vector< application_info_impl* >::iterator aIter( rInfos.begin() );
+ while( aIter != rInfos.end() )
+ {
+ // if( rServiceName == (*aIter)->maDocumentService )
+ if( rServiceName == (*aIter)->maXMLExporter ||
+ rServiceName == (*aIter)->maXMLImporter)
+ {
+ return (*aIter);
+ }
+ aIter++;
+ }
+ return NULL;
+}
+
+// -----------------------------------------------------------------------
+
+OUString getApplicationUIName( const OUString& rServiceName )
+{
+ const application_info_impl* pInfo = getApplicationInfo( rServiceName );
+ if( pInfo )
+ {
+ return pInfo->maDocumentUIName;
+ }
+ else
+ {
+ OUString aRet = String( RESID( STR_UNKNOWN_APPLICATION ) );
+ if( rServiceName.getLength() )
+ {
+ aRet += OUString::createFromAscii(" (");
+ aRet += rServiceName;
+ aRet += OUString::createFromAscii(")");
+ }
+ return aRet;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+ResMgr* getXSLTDialogResMgr()
+{
+ return XMLFilterSettingsDialog::mpResMgr;
+}
+
+// -----------------------------------------------------------------------
+
+// -----------------------------------------------------------------------
+
+long SvxPathControl_Impl::Notify( NotifyEvent& rNEvt )
+{
+ long nRet = Control::Notify( rNEvt );
+
+ if ( m_pFocusCtrl && rNEvt.GetWindow() != m_pFocusCtrl && rNEvt.GetType() == EVENT_GETFOCUS )
+ m_pFocusCtrl->GrabFocus();
+ return nRet;
+}
+
+#define ITEMID_NAME 1
+#define ITEMID_TYPE 2
+
+XMLFilterListBox::XMLFilterListBox( SvxPathControl_Impl * pParent )
+: SvTabListBox( pParent, WB_SORT | WB_HSCROLL | WB_CLIPCHILDREN | WB_TABSTOP ),
+ mbFirstPaint( true )
+{
+ Size aBoxSize( pParent->GetOutputSizePixel() );
+
+ mpHeaderBar = new HeaderBar( pParent, /*WB_BUTTONSTYLE | */ WB_BOTTOMBORDER );
+ mpHeaderBar->SetPosSizePixel( Point( 0, 0 ), Size( aBoxSize.Width(), 16 ) );
+ mpHeaderBar->SetEndDragHdl( LINK( this, XMLFilterListBox, HeaderEndDrag_Impl ) );
+
+ String aStr1( RESID( STR_COLUMN_HEADER_NAME ) );
+ String aStr2( RESID( STR_COLUMN_HEADER_TYPE ) );
+
+ long nTabSize = aBoxSize.Width() / 2;
+
+ mpHeaderBar->InsertItem( ITEMID_NAME, aStr1, nTabSize,
+ HIB_LEFT | HIB_VCENTER );
+ mpHeaderBar->InsertItem( ITEMID_TYPE, aStr2, nTabSize,
+ HIB_LEFT | HIB_VCENTER );
+
+ static long nTabs[] = {3, 0, nTabSize, 2*nTabSize };
+ Size aHeadSize( mpHeaderBar->GetSizePixel() );
+
+ WinBits nBits = WB_SORT | WB_HSCROLL | WB_CLIPCHILDREN | WB_TABSTOP;
+ pParent->SetFocusControl( this );
+ SetWindowBits( nBits );
+// SetDoubleClickHdl( aLink );
+// SetSelectHdl( LINK( this, SvxPathTabPage, PathSelect_Impl ) );
+ SetSelectionMode( MULTIPLE_SELECTION );
+ SetPosSizePixel( Point( 0, aHeadSize.Height() ), Size( aBoxSize.Width(), aBoxSize.Height() - aHeadSize.Height() ) );
+ SetTabs( &nTabs[0], MAP_PIXEL );
+ SetScrolledHdl( LINK( this, XMLFilterListBox, TabBoxScrollHdl_Impl ) );
+ SetHighlightRange();
+// SetHelpId( HID_OPTPATH_CTL_PATH );
+// mpHeaderBar->SetHelpId( HID_OPTPATH_HEADERBAR );
+ Show();
+ mpHeaderBar->Show();
+}
+
+// -----------------------------------------------------------------------
+
+XMLFilterListBox::~XMLFilterListBox()
+{
+ delete mpHeaderBar;
+}
+
+// -----------------------------------------------------------------------
+
+void XMLFilterListBox::Reset()
+{
+ Size aBoxSize( Window::GetParent()->GetOutputSizePixel() );
+ long nTabSize = aBoxSize.Width() / 2;
+ static long nTabs[] = {3, 0, nTabSize, 2*nTabSize };
+ SetTabs( &nTabs[0], MAP_PIXEL );
+ mpHeaderBar->SetItemSize( ITEMID_NAME, nTabSize );
+ mpHeaderBar->SetItemSize( ITEMID_TYPE, nTabSize );
+}
+
+// -----------------------------------------------------------------------
+
+void XMLFilterListBox::Paint( const Rectangle& rRect )
+{
+ if( mbFirstPaint )
+ {
+ mbFirstPaint = false;
+ RepaintScrollBars();
+ }
+
+ SvTabListBox::Paint( rRect );
+}
+
+IMPL_LINK( XMLFilterListBox, TabBoxScrollHdl_Impl, SvTabListBox*, /* pList */ )
+{
+ mpHeaderBar->SetOffset( -GetXOffset() );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( XMLFilterListBox, HeaderSelect_Impl, HeaderBar*, pBar )
+{
+ if ( pBar && pBar->GetCurItemId() != ITEMID_NAME )
+ return 0;
+
+ HeaderBarItemBits nBits = mpHeaderBar->GetItemBits(ITEMID_TYPE);
+ BOOL bUp = ( ( nBits & HIB_UPARROW ) == HIB_UPARROW );
+ SvSortMode eMode = SortAscending;
+
+ if ( bUp )
+ {
+ nBits &= ~HIB_UPARROW;
+ nBits |= HIB_DOWNARROW;
+ eMode = SortDescending;
+ }
+ else
+ {
+ nBits &= ~HIB_DOWNARROW;
+ nBits |= HIB_UPARROW;
+ }
+ mpHeaderBar->SetItemBits( ITEMID_NAME, nBits );
+ SvTreeList* pMod = GetModel();
+ pMod->SetSortMode( eMode );
+ pMod->Resort();
+ return 1;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( XMLFilterListBox, HeaderEndDrag_Impl, HeaderBar*, pBar )
+{
+ if ( pBar && !pBar->GetCurItemId() )
+ return 0;
+
+ if ( !mpHeaderBar->IsItemMode() )
+ {
+ Size aSz;
+ USHORT nTabs = mpHeaderBar->GetItemCount();
+ long nTmpSz = 0;
+ long nWidth = mpHeaderBar->GetItemSize(ITEMID_NAME);
+ long nBarWidth = mpHeaderBar->GetSizePixel().Width();
+
+ if(nWidth < 30)
+ mpHeaderBar->SetItemSize( ITEMID_TYPE, 30);
+ else if ( ( nBarWidth - nWidth ) < 30 )
+ mpHeaderBar->SetItemSize( ITEMID_TYPE, nBarWidth - 30 );
+
+ for ( USHORT i = 1; i <= nTabs; ++i )
+ {
+ long nW = mpHeaderBar->GetItemSize(i);
+ aSz.Width() = nW + nTmpSz;
+ nTmpSz += nW;
+ SetTab( i, PixelToLogic( aSz, MapMode(MAP_APPFONT) ).Width(), MAP_APPFONT );
+ }
+ }
+ return 1;
+}
+
+// -----------------------------------------------------------------------
+
+/** adds a new filter info entry to the ui filter list */
+void XMLFilterListBox::addFilterEntry( const filter_info_impl* pInfo )
+{
+ const XubString aEntryStr( getEntryString( pInfo ) );
+ InsertEntryToColumn( aEntryStr, LIST_APPEND, 0xffff, (void*)pInfo );
+}
+
+// -----------------------------------------------------------------------
+
+void XMLFilterListBox::changeEntry( const filter_info_impl* pInfo )
+{
+ const ULONG nCount = GetEntryCount();
+ ULONG nPos;
+ for( nPos = 0; nPos < nCount; nPos++ )
+ {
+ SvLBoxEntry* pEntry = GetEntry( nPos );
+ if( (filter_info_impl*)pEntry->GetUserData() == pInfo )
+ {
+ XubString aEntryText( getEntryString( pInfo ) );
+ SetEntryText( aEntryText, pEntry );
+ break;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+String XMLFilterListBox::getEntryString( const filter_info_impl* pInfo ) const
+{
+ String aEntryStr( pInfo->maFilterName );
+ aEntryStr += '\t';
+ // aEntryStr += String( getApplicationUIName( pInfo->maDocumentService ) );
+ if ( pInfo->maExportService.getLength() > 0 )
+ aEntryStr += String( getApplicationUIName( pInfo->maExportService ) );
+ else
+ aEntryStr += String( getApplicationUIName( pInfo->maImportService ) );
+ aEntryStr += ' ';
+ aEntryStr += '-';
+ aEntryStr += ' ';
+
+ if( pInfo->maFlags & 1 )
+ {
+ if( pInfo->maFlags & 2 )
+ {
+ aEntryStr += String( RESID( STR_IMPORT_EXPORT ) );
+ }
+ else
+ {
+ aEntryStr += String( RESID( STR_IMPORT_ONLY ) );
+ }
+ }
+ else if( pInfo->maFlags & 2 )
+ {
+ aEntryStr += String( RESID( STR_EXPORT_ONLY ) );
+ }
+ else
+ {
+ aEntryStr += String( RESID( STR_UNDEFINED_FILTER ) );
+ }
+
+ return aEntryStr;
+}
+
+// -----------------------------------------------------------------------
+
+// -----------------------------------------------------------------------
+
+filter_info_impl::filter_info_impl()
+: maFlags(0x00080040),
+ maFileFormatVersion(0),
+ mnDocumentIconID(0),
+ mbReadonly(sal_False)
+{
+}
+
+// -----------------------------------------------------------------------
+
+filter_info_impl::filter_info_impl( const filter_info_impl& rInfo ) :
+ maFilterName( rInfo.maFilterName ),
+ maType( rInfo.maType ),
+ maDocumentService( rInfo.maDocumentService ),
+ maFilterService( rInfo.maFilterService ),
+ maInterfaceName( rInfo.maInterfaceName ),
+ maComment( rInfo.maComment ),
+ maExtension( rInfo.maExtension ),
+ maDTD( rInfo.maDTD ),
+ maExportXSLT( rInfo.maExportXSLT ),
+ maImportXSLT( rInfo.maImportXSLT ),
+ maImportTemplate( rInfo.maImportTemplate ),
+ maDocType( rInfo.maDocType ),
+ maImportService( rInfo.maImportService ),
+ maExportService( rInfo.maExportService ),
+ maFlags( rInfo.maFlags ),
+ maFileFormatVersion( rInfo.maFileFormatVersion ),
+ mnDocumentIconID( rInfo.mnDocumentIconID ),
+ mbReadonly( rInfo.mbReadonly )
+{
+}
+
+// -----------------------------------------------------------------------
+
+int filter_info_impl::operator==( const filter_info_impl& r ) const
+{
+ if( maFilterName != r.maFilterName ||
+ maType != r.maType ||
+ maDocumentService != r.maDocumentService ||
+ maFilterService != r.maFilterService ||
+ maInterfaceName != r.maInterfaceName ||
+ maComment != r.maComment ||
+ maExtension != r.maExtension ||
+ maDocType != r.maDocType ||
+ maDTD != r.maDTD ||
+ maExportXSLT != r.maExportXSLT ||
+ maImportXSLT != r.maImportXSLT ||
+ maExportService != r.maExportService ||
+ maImportService != r.maImportService ||
+ maImportTemplate != r.maImportTemplate ||
+ maFlags != r.maFlags ||
+ maFileFormatVersion != r.maFileFormatVersion )
+ return false;
+
+ return true;
+}
+
+// -----------------------------------------------------------------------
+
+Sequence< OUString > filter_info_impl::getFilterUserData() const
+{
+ Sequence< OUString > aUserData(8);
+
+ aUserData[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.documentconversion.XSLTFilter" ) );
+ /*
+ const application_info_impl* pInfo = getApplicationInfo( maDocumentService );
+ if( pInfo )
+ {
+ aUserData[2] = pInfo->maXMLImporter;
+ aUserData[3] = pInfo->maXMLExporter;
+ }
+ */
+ aUserData[2] = maImportService;
+ aUserData[3] = maExportService;
+ aUserData[4] = maImportXSLT;
+ aUserData[5] = maExportXSLT;
+ aUserData[6] = maDTD;
+ aUserData[7] = maComment;
+
+ return aUserData;
+}
+
+
+// -----------------------------------------------------------------------
+
+OUString string_encode( const OUString & rText )
+{
+
+ static sal_Bool const aCharClass[]
+ = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* UricNoSlash */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, /* !"#$%&'()*+,-./*/
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, /*0123456789:;<=>?*/
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*@ABCDEFGHIJKLMNO*/
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, /*PQRSTUVWXYZ[\]^_*/
+ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*`abcdefghijklmno*/
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0 /*pqrstuvwxyz{|}~ */
+ };
+
+
+ return Uri::encode( rText, aCharClass, rtl_UriEncodeCheckEscapes, RTL_TEXTENCODING_UTF8 );
+}
+
+// -----------------------------------------------------------------------
+
+OUString string_decode( const OUString & rText )
+{
+ return Uri::decode( rText, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 );
+}
+
+// -----------------------------------------------------------------------
+
+bool isFileURL( const ::rtl::OUString & rURL )
+{
+ return rURL.compareToAscii( RTL_CONSTASCII_STRINGPARAM("file:") ) == 0;
+}
+
+// -----------------------------------------------------------------------
+
+bool copyStreams( Reference< XInputStream > xIS, Reference< XOutputStream > xOS )
+{
+ try
+ {
+ sal_Int32 nBufferSize = 512;
+ Sequence< sal_Int8 > aDataBuffer(nBufferSize);
+
+ sal_Int32 nRead;
+ do
+ {
+ nRead = xIS->readBytes( aDataBuffer, nBufferSize );
+
+ if( nRead )
+ {
+ if( nRead < nBufferSize )
+ {
+ nBufferSize = nRead;
+ aDataBuffer.realloc(nRead);
+ }
+
+ xOS->writeBytes( aDataBuffer );
+ }
+ }
+ while( nRead );
+
+ xOS->flush();
+
+ return true;
+ }
+ catch(Exception&)
+ {
+ DBG_ERROR( "copyStreams() exception catched!" );
+ }
+
+ return false;
+}
+
+// -----------------------------------------------------------------------
+
+bool createDirectory( OUString& rURL )
+{
+ sal_Int32 nLastIndex = sizeof( "file:///" ) - 2;
+ while( nLastIndex != -1 )
+ {
+ nLastIndex = rURL.indexOf( sal_Unicode('/'), nLastIndex + 1);
+ if( nLastIndex != -1 )
+ {
+ OUString aDirURL( rURL.copy( 0, nLastIndex ) );
+ Directory aDir( aDirURL );
+ Directory::RC rc = aDir.open();
+ if( rc == Directory::E_NOENT )
+ rc = osl::Directory::create( aDirURL );
+
+ if( rc != Directory::E_None )
+ {
+ return false;
+ }
+ }
+ }
+
+ return true;
+}
diff --git a/filter/source/xsltdialog/xmlfiltersettingsdialog.hrc b/filter/source/xsltdialog/xmlfiltersettingsdialog.hrc
new file mode 100644
index 000000000000..48ed1a2a4ee7
--- /dev/null
+++ b/filter/source/xsltdialog/xmlfiltersettingsdialog.hrc
@@ -0,0 +1,43 @@
+/*************************************************************************
+ *
+ * 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 _XMLFILTERSETTINGSDIALOG_HRC_
+#define _XMLFILTERSETTINGSDIALOG_HRC_
+
+#include "xmlfiltercommon.hrc"
+
+#define CTRL_XML_FILTER_LIST 1
+#define PB_XML_FILTER_NEW 2
+#define PB_XML_FILTER_EDIT 3
+#define PB_XML_FILTER_TEST 4
+#define PB_XML_FILTER_DELETE 5
+#define PB_XML_FILTER_SAVE 6
+#define PB_XML_FILTER_OPEN 7
+#define BTN_XML_FILTER_HELP 8
+#define PB_XML_FILTER_CLOSE 9
+
+#endif
diff --git a/filter/source/xsltdialog/xmlfiltersettingsdialog.hxx b/filter/source/xsltdialog/xmlfiltersettingsdialog.hxx
new file mode 100644
index 000000000000..5abf2bba0df3
--- /dev/null
+++ b/filter/source/xsltdialog/xmlfiltersettingsdialog.hxx
@@ -0,0 +1,161 @@
+/*************************************************************************
+ *
+ * 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 _XMLFILTERSETTINGSDIALOG_HXX_
+#define _XMLFILTERSETTINGSDIALOG_HXX_
+
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/container/XHierarchicalName.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <vcl/wrkwin.hxx>
+
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+#include <svtools/svtabbx.hxx>
+#include <svl/poolitem.hxx>
+#include <unotools/moduleoptions.hxx>
+
+#include "xmlfiltercommon.hxx"
+
+// --------------------------------------------------------------------
+
+class SvxPathControl_Impl : public Control
+{
+private:
+ Control* m_pFocusCtrl;
+
+public:
+ SvxPathControl_Impl( Window* pParent, const ResId& rId ) :
+ Control( pParent, rId ), m_pFocusCtrl( NULL ) {}
+
+ void SetFocusControl( Control* pCtrl ) { m_pFocusCtrl = pCtrl; }
+
+ virtual long Notify( NotifyEvent& rNEvt );
+};
+
+// --------------------------------------------------------------------
+
+class HeaderBar;
+
+class XMLFilterListBox : public SvTabListBox
+{
+private:
+ bool mbFirstPaint;
+ HeaderBar* mpHeaderBar;
+
+ DECL_LINK( TabBoxScrollHdl_Impl, SvTabListBox* );
+ DECL_LINK( HeaderSelect_Impl, HeaderBar* );
+ DECL_LINK( HeaderEndDrag_Impl, HeaderBar* );
+
+ String getEntryString( const filter_info_impl* pInfo ) const;
+
+public:
+ XMLFilterListBox( SvxPathControl_Impl* pParent );
+ ~XMLFilterListBox();
+
+ void Reset();
+
+ /** adds a new filter info entry to the ui filter list */
+ void addFilterEntry( const filter_info_impl* pInfo );
+
+ void changeEntry( const filter_info_impl* pInfo );
+
+ virtual void Paint( const Rectangle& rRect );
+};
+
+// --------------------------------------------------------------------
+
+class XMLFilterTestDialog;
+
+class XMLFilterSettingsDialog : public WorkWindow
+{
+public:
+ XMLFilterSettingsDialog( Window* pParent, ResMgr& rResMgr, const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rxMSF );
+ virtual ~XMLFilterSettingsDialog();
+
+ DECL_LINK(ClickHdl_Impl, PushButton * );
+ DECL_LINK(SelectionChangedHdl_Impl, void * );
+ DECL_LINK(DoubleClickHdl_Impl, void * );
+
+ void ShowWindow();
+
+ void onNew();
+ void onEdit();
+ void onTest();
+ void onDelete();
+ void onSave();
+ void onOpen();
+ void onClose();
+
+ void updateStates();
+
+ virtual long Notify( NotifyEvent& rNEvt );
+
+ bool isClosable();
+
+ static ResMgr* mpResMgr;
+
+private:
+ void initFilterList();
+ void disposeFilterList();
+
+ bool insertOrEdit( filter_info_impl* pNewInfo, const filter_info_impl* pOldInfo = NULL );
+
+ rtl::OUString createUniqueFilterName( const rtl::OUString& rUIName );
+ rtl::OUString createUniqueTypeName( const rtl::OUString& rTypeName );
+ rtl::OUString createUniqueInterfaceName( const rtl::OUString& rInterfaceName );
+
+private:
+
+ com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > mxMSF;
+ com::sun::star::uno::Reference< com::sun::star::container::XNameContainer > mxFilterContainer;
+ com::sun::star::uno::Reference< com::sun::star::container::XNameContainer > mxTypeDetection;
+ com::sun::star::uno::Reference< com::sun::star::container::XNameContainer > mxExtendedTypeDetection;
+
+ std::vector< filter_info_impl* > maFilterVector;
+
+ XMLFilterListBox* mpFilterListBox;
+ SvxPathControl_Impl maCtrlFilterList;
+ PushButton maPBNew;
+ PushButton maPBEdit;
+ PushButton maPBTest;
+ PushButton maPBDelete;
+ PushButton maPBSave;
+ PushButton maPBOpen;
+ HelpButton maPBHelp;
+ PushButton maPBClose;
+
+ bool mbIsClosable;
+
+ ::rtl::OUString sTemplatePath;
+ ::rtl::OUString sDocTypePrefix;
+
+ SvtModuleOptions maModuleOpt;
+};
+
+#endif
diff --git a/filter/source/xsltdialog/xmlfiltersettingsdialog.src b/filter/source/xsltdialog/xmlfiltersettingsdialog.src
new file mode 100644
index 000000000000..b80dff3bfe50
--- /dev/null
+++ b/filter/source/xsltdialog/xmlfiltersettingsdialog.src
@@ -0,0 +1,139 @@
+/*************************************************************************
+ *
+ * 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 "xmlfiltersettingsdialog.hrc"
+#include "xmlfilterhelpids.hrc"
+
+#define BUTTONS_LEFT 248
+#define BUTTONS_TOP 6
+#define BUTTONS_SPACEING 3
+#define BUTTONS_WIDTH 66
+#define BUTTONS_HEIGHT 14
+
+WorkWindow DLG_XML_FILTER_SETTINGS_DIALOG
+{
+ Size = MAP_APPFONT( 320, 154 );
+ HelpId = HID_XML_FILTER_SETTINGS_DIALOG;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ Sizeable = FALSE;
+ DialogControl = TRUE ;
+ Text [ en-US ] = "XML Filter Settings" ;
+
+ Control CTRL_XML_FILTER_LIST
+ {
+ Pos = MAP_APPFONT ( 6 , 6 ) ;
+ Size = MAP_APPFONT ( 235 , 142 );
+ Border = TRUE ;
+ TabStop = TRUE ;
+ };
+
+ PushButton PB_XML_FILTER_NEW
+ {
+ Pos = MAP_APPFONT ( BUTTONS_LEFT , BUTTONS_TOP + 0 * BUTTONS_HEIGHT + 0 * BUTTONS_SPACEING ) ;
+ Size = MAP_APPFONT ( BUTTONS_WIDTH , BUTTONS_HEIGHT ) ;
+ HelpId = HID_XML_FILTER_NEW;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~New...";
+ };
+
+ PushButton PB_XML_FILTER_EDIT
+ {
+ Pos = MAP_APPFONT ( BUTTONS_LEFT , BUTTONS_TOP + 1 * BUTTONS_HEIGHT + 1 * BUTTONS_SPACEING ) ;
+ Size = MAP_APPFONT ( BUTTONS_WIDTH , BUTTONS_HEIGHT ) ;
+ HelpId = HID_XML_FILTER_EDIT;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Edit...";
+ };
+
+ PushButton PB_XML_FILTER_TEST
+ {
+ Pos = MAP_APPFONT ( BUTTONS_LEFT , BUTTONS_TOP + 2 * BUTTONS_HEIGHT + 2 * BUTTONS_SPACEING ) ;
+ Size = MAP_APPFONT ( BUTTONS_WIDTH , BUTTONS_HEIGHT ) ;
+ HelpId = HID_XML_FILTER_TEST;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Test XSLTs...";
+ };
+
+ PushButton PB_XML_FILTER_DELETE
+ {
+ Pos = MAP_APPFONT ( BUTTONS_LEFT , BUTTONS_TOP + 3 * BUTTONS_HEIGHT + 4 * BUTTONS_SPACEING ) ;
+ Size = MAP_APPFONT ( BUTTONS_WIDTH , BUTTONS_HEIGHT ) ;
+ HelpId = HID_XML_FILTER_DELETE;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Delete...";
+ };
+
+ PushButton PB_XML_FILTER_SAVE
+ {
+ Pos = MAP_APPFONT ( BUTTONS_LEFT , BUTTONS_TOP + 4 * BUTTONS_HEIGHT + 6 * BUTTONS_SPACEING ) ;
+ Size = MAP_APPFONT ( BUTTONS_WIDTH , BUTTONS_HEIGHT ) ;
+ HelpId = HID_XML_FILTER_SAVE;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Save as Package...";
+ };
+
+ PushButton PB_XML_FILTER_OPEN
+ {
+ Pos = MAP_APPFONT ( BUTTONS_LEFT , BUTTONS_TOP + 5 * BUTTONS_HEIGHT + 7 * BUTTONS_SPACEING ) ;
+ Size = MAP_APPFONT ( BUTTONS_WIDTH , BUTTONS_HEIGHT ) ;
+ HelpId = HID_XML_FILTER_OPEN;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Open Package...";
+ TabStop = TRUE ;
+ };
+
+ HelpButton BTN_XML_FILTER_HELP
+ {
+ Pos = MAP_APPFONT ( BUTTONS_LEFT, BUTTONS_TOP + 6 * BUTTONS_HEIGHT + 9 * BUTTONS_SPACEING );
+ Size = MAP_APPFONT ( BUTTONS_WIDTH, BUTTONS_HEIGHT );
+ };
+
+ PushButton PB_XML_FILTER_CLOSE
+ {
+ Pos = MAP_APPFONT ( BUTTONS_LEFT , BUTTONS_TOP + 7 * BUTTONS_HEIGHT + 10 * BUTTONS_SPACEING ) ;
+ Size = MAP_APPFONT ( BUTTONS_WIDTH , BUTTONS_HEIGHT ) ;
+ HelpId = HID_XML_FILTER_CLOSE;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Close";
+ };
+
+};
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/filter/source/xsltdialog/xmlfiltertabdialog.cxx b/filter/source/xsltdialog/xmlfiltertabdialog.cxx
new file mode 100644
index 000000000000..63c369610295
--- /dev/null
+++ b/filter/source/xsltdialog/xmlfiltertabdialog.cxx
@@ -0,0 +1,373 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+#include <com/sun/star/container/XNameAccess.hpp>
+#ifndef _COM_SUN_STAR_BEANS_NAMEDVALUE_HPP_
+#include <com/sun/star/beans/PropertyValue.hpp>
+#endif
+#include <tools/resid.hxx>
+#include <vcl/msgbox.hxx>
+#include <osl/file.hxx>
+
+#include "xmlfilterdialogstrings.hrc"
+#include "xmlfiltertabdialog.hxx"
+#include "xmlfiltertabdialog.hrc"
+#include "xmlfiltertabpagebasic.hrc"
+#include "xmlfiltertabpagexslt.hrc"
+#include "xmlfiltertabpagebasic.hxx"
+#include "xmlfiltertabpagexslt.hxx"
+#include "xmlfiltersettingsdialog.hxx"
+#include "xmlfiltersettingsdialog.hrc"
+#include "xmlfilterhelpids.hrc"
+
+using namespace rtl;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::container;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::lang;
+
+XMLFilterTabDialog::XMLFilterTabDialog( Window *pParent, ResMgr& rResMgr, const Reference< XMultiServiceFactory >& rxMSF, const filter_info_impl* pInfo ) :
+ TabDialog( pParent, ResId( DLG_XML_FILTER_TABDIALOG, rResMgr ) ),
+ mxMSF( rxMSF ),
+ mrResMgr( rResMgr ),
+ maTabCtrl( this, ResId( 1, rResMgr ) ),
+ maOKBtn( this ),
+ maCancelBtn( this ),
+ maHelpBtn( this )
+{
+ FreeResource();
+
+ maTabCtrl.SetHelpId( HID_XML_FILTER_TABPAGE_CTRL );
+
+ mpOldInfo = pInfo;
+ mpNewInfo = new filter_info_impl( *mpOldInfo );
+
+ String aTitle( GetText() );
+ aTitle.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM("%s") ), mpNewInfo->maFilterName );
+ SetText( aTitle );
+
+ maTabCtrl.Show();
+ maOKBtn.Show();
+ maCancelBtn.Show();
+ maHelpBtn.Show();
+
+ maOKBtn.SetClickHdl( LINK( this, XMLFilterTabDialog, OkHdl ) );
+
+ maTabCtrl.SetActivatePageHdl( LINK( this, XMLFilterTabDialog, ActivatePageHdl ) );
+ maTabCtrl.SetDeactivatePageHdl( LINK( this, XMLFilterTabDialog, DeactivatePageHdl ) );
+
+ mpBasicPage = new XMLFilterTabPageBasic( &maTabCtrl, mrResMgr );
+ mpBasicPage->SetInfo( mpNewInfo );
+
+ maTabCtrl.SetTabPage( RID_XML_FILTER_TABPAGE_BASIC, mpBasicPage );
+
+ Size aSiz = mpBasicPage->GetSizePixel();
+ Size aCtrlSiz = maTabCtrl.GetTabPageSizePixel();
+ // set size on TabControl only if smaller than TabPage
+ if ( aCtrlSiz.Width() < aSiz.Width() || aCtrlSiz.Height() < aSiz.Height() )
+ {
+ maTabCtrl.SetTabPageSizePixel( aSiz );
+ aCtrlSiz = aSiz;
+ }
+
+ mpXSLTPage = new XMLFilterTabPageXSLT( &maTabCtrl, mrResMgr, mxMSF );
+ mpXSLTPage->SetInfo( mpNewInfo );
+
+ maTabCtrl.SetTabPage( RID_XML_FILTER_TABPAGE_XSLT, mpXSLTPage );
+
+ aSiz = mpXSLTPage->GetSizePixel();
+ if ( aCtrlSiz.Width() < aSiz.Width() || aCtrlSiz.Height() < aSiz.Height() )
+ {
+ maTabCtrl.SetTabPageSizePixel( aSiz );
+ aCtrlSiz = aSiz;
+ }
+
+ ActivatePageHdl( &maTabCtrl );
+
+ AdjustLayout();
+}
+
+// -----------------------------------------------------------------------
+
+XMLFilterTabDialog::~XMLFilterTabDialog()
+{
+ delete mpBasicPage;
+ delete mpXSLTPage;
+ delete mpNewInfo;
+}
+
+// -----------------------------------------------------------------------
+
+bool XMLFilterTabDialog::onOk()
+{
+ mpXSLTPage->FillInfo( mpNewInfo );
+ mpBasicPage->FillInfo( mpNewInfo );
+
+ sal_uInt16 nErrorPage = 0;
+ sal_uInt16 nErrorId = 0;
+ Window* pFocusWindow = NULL;
+ String aReplace1;
+ String aReplace2;
+
+ // 1. see if the filter name is ok
+ if( (mpNewInfo->maFilterName.getLength() == 0) || (mpNewInfo->maFilterName != mpOldInfo->maFilterName) )
+ {
+ // if the user deleted the filter name, we reset the original filter name
+ if( mpNewInfo->maFilterName.getLength() == 0 )
+ {
+ mpNewInfo->maFilterName = mpOldInfo->maFilterName;
+ }
+ else
+ {
+ try
+ {
+ Reference< XNameAccess > xFilterContainer( mxMSF->createInstance( OUString::createFromAscii("com.sun.star.document.FilterFactory" ) ), UNO_QUERY );
+ if( xFilterContainer.is() )
+ {
+ if( xFilterContainer->hasByName( mpNewInfo->maFilterName ) )
+ {
+ nErrorPage = RID_XML_FILTER_TABPAGE_BASIC;
+ nErrorId = STR_ERROR_FILTER_NAME_EXISTS;
+ pFocusWindow = &(mpBasicPage->maEDFilterName);
+ aReplace1 = mpNewInfo->maFilterName;
+ }
+
+ }
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR( "XMLFilterTabDialog::onOk exception catched!" );
+ }
+ }
+ }
+
+ // 2. see if the interface name is ok
+ if( (mpNewInfo->maInterfaceName.getLength() == 0) || (mpNewInfo->maInterfaceName != mpOldInfo->maInterfaceName) )
+ {
+ // if the user deleted the interface name, we reset the original filter name
+ if( mpNewInfo->maInterfaceName.getLength() == 0 )
+ {
+ mpNewInfo->maInterfaceName = mpOldInfo->maInterfaceName;
+ }
+ else
+ {
+ try
+ {
+ Reference< XNameAccess > xFilterContainer( mxMSF->createInstance( OUString::createFromAscii("com.sun.star.document.FilterFactory" ) ), UNO_QUERY );
+ if( xFilterContainer.is() )
+ {
+ Sequence< OUString > aFilterNames( xFilterContainer->getElementNames() );
+ OUString* pFilterName = aFilterNames.getArray();
+
+ const sal_Int32 nCount = aFilterNames.getLength();
+ sal_Int32 nFilter;
+
+ Sequence< PropertyValue > aValues;
+ for( nFilter = 0; (nFilter < nCount) && (nErrorId == 0); nFilter++, pFilterName++ )
+ {
+ Any aAny( xFilterContainer->getByName( *pFilterName ) );
+ if( !(aAny >>= aValues) )
+ continue;
+
+ const sal_Int32 nValueCount( aValues.getLength() );
+ PropertyValue* pValues = aValues.getArray();
+ sal_Int32 nValue;
+
+ for( nValue = 0; (nValue < nValueCount) && (nErrorId == 0); nValue++, pValues++ )
+ {
+ if( pValues->Name.equalsAscii( "UIName" ) )
+ {
+ OUString aInterfaceName;
+ pValues->Value >>= aInterfaceName;
+ if( aInterfaceName == mpNewInfo->maInterfaceName )
+ {
+ nErrorPage = RID_XML_FILTER_TABPAGE_BASIC;
+ nErrorId = STR_ERROR_TYPE_NAME_EXISTS;
+ pFocusWindow = &(mpBasicPage->maEDInterfaceName);
+ aReplace1 = mpNewInfo->maInterfaceName;
+ aReplace2 = *pFilterName;
+ }
+ }
+ }
+ }
+ }
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR( "XMLFilterTabDialog::onOk exception catched!" );
+ }
+ }
+ }
+
+ // 3. see if the dtd is valid
+ if( 0 == nErrorId )
+ {
+ if( (mpNewInfo->maDTD != mpOldInfo->maDTD) && isFileURL( mpNewInfo->maDTD ) )
+ {
+ osl::File aFile( mpNewInfo->maDTD );
+ osl::File::RC aRC = aFile.open( OpenFlag_Read );
+ if( aRC != osl::File::E_None )
+ {
+ nErrorId = STR_ERROR_DTD_NOT_FOUND;
+ nErrorPage = RID_XML_FILTER_TABPAGE_XSLT;
+ pFocusWindow = &(mpXSLTPage->maEDDTDSchema);
+ }
+ }
+ }
+
+ if( 0 == nErrorId )
+ {
+ // 4. see if the export xslt is valid
+ if( (mpNewInfo->maExportXSLT != mpOldInfo->maExportXSLT) && isFileURL( mpNewInfo->maExportXSLT ) )
+ {
+ osl::File aFile( mpNewInfo->maExportXSLT );
+ osl::File::RC aRC = aFile.open( OpenFlag_Read );
+ if( aRC != osl::File::E_None )
+ {
+ nErrorId = STR_ERROR_EXPORT_XSLT_NOT_FOUND;
+ nErrorPage = RID_XML_FILTER_TABPAGE_XSLT;
+ pFocusWindow = &(mpXSLTPage->maEDExportXSLT);
+ }
+ }
+ }
+
+ if( 0 == nErrorId )
+ {
+ // 5. see if the import xslt is valid
+ if( (mpNewInfo->maImportXSLT != mpOldInfo->maImportXSLT) && isFileURL( mpNewInfo->maImportXSLT ) )
+ {
+ osl::File aFile( mpNewInfo->maImportXSLT );
+ osl::File::RC aRC = aFile.open( OpenFlag_Read );
+ if( aRC != osl::File::E_None )
+ {
+ nErrorId = STR_ERROR_IMPORT_XSLT_NOT_FOUND;
+ nErrorPage = RID_XML_FILTER_TABPAGE_XSLT;
+ pFocusWindow = &(mpXSLTPage->maEDImportTemplate);
+ }
+ }
+ }
+
+ // see if we have at least an import or an export dtd
+ if((mpNewInfo->maImportXSLT.getLength() == 0) && (mpNewInfo->maExportXSLT.getLength() == 0) )
+ {
+ nErrorId = STR_ERROR_EXPORT_XSLT_NOT_FOUND;
+ nErrorPage = RID_XML_FILTER_TABPAGE_XSLT;
+ pFocusWindow = &(mpXSLTPage->maEDExportXSLT);
+ }
+
+ if( 0 == nErrorId )
+ {
+ // 6. see if the import template is valid
+ if( (mpNewInfo->maImportTemplate != mpOldInfo->maImportTemplate) && isFileURL( mpNewInfo->maImportTemplate ) )
+ {
+ osl::File aFile( mpNewInfo->maImportTemplate );
+ osl::File::RC aRC = aFile.open( OpenFlag_Read );
+ if( aRC != osl::File::E_None )
+ {
+ nErrorId = STR_ERROR_IMPORT_TEMPLATE_NOT_FOUND;
+ nErrorPage = RID_XML_FILTER_TABPAGE_XSLT;
+ pFocusWindow = &(mpXSLTPage->maEDImportTemplate);
+ }
+ }
+ }
+
+ if( 0 != nErrorId )
+ {
+ maTabCtrl.SetCurPageId( (USHORT)nErrorPage );
+ ActivatePageHdl( &maTabCtrl );
+
+ ResId aResId( nErrorId, mrResMgr );
+ String aMessage( aResId );
+
+ if( aReplace2.Len() )
+ {
+ aMessage.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM("%s1") ), aReplace1 );
+ aMessage.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM("%s2") ), aReplace2 );
+ }
+ else if( aReplace1.Len() )
+ {
+ aMessage.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM("%s") ), aReplace1 );
+ }
+
+ ErrorBox aBox(this, (WinBits)(WB_OK), aMessage );
+ aBox.Execute();
+
+ if( pFocusWindow )
+ pFocusWindow->GrabFocus();
+
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+filter_info_impl* XMLFilterTabDialog::getNewFilterInfo() const
+{
+ return mpNewInfo;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( XMLFilterTabDialog, CancelHdl, Button*, /* pButton */ )
+{
+ Close();
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( XMLFilterTabDialog, OkHdl, Button *, EMPTYARG )
+{
+ if( onOk() )
+ EndDialog(1);
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( XMLFilterTabDialog, ActivatePageHdl, TabControl *, pTabCtrl )
+{
+ const USHORT nId = pTabCtrl->GetCurPageId();
+ TabPage* pTabPage = pTabCtrl->GetTabPage( nId );
+ pTabPage->Show();
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( XMLFilterTabDialog, DeactivatePageHdl, TabControl *, /* pTabCtrl */ )
+{
+ return TRUE;
+}
diff --git a/filter/source/xsltdialog/xmlfiltertabdialog.hrc b/filter/source/xsltdialog/xmlfiltertabdialog.hrc
new file mode 100644
index 000000000000..a4b9844895e3
--- /dev/null
+++ b/filter/source/xsltdialog/xmlfiltertabdialog.hrc
@@ -0,0 +1,33 @@
+/*************************************************************************
+ *
+ * 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 _XMLFILTERTABDIALOG_HRC_
+#define _XMLFILTERTABDIALOG_HRC_
+
+#include "xmlfiltercommon.hrc"
+
+#endif
diff --git a/filter/source/xsltdialog/xmlfiltertabdialog.hxx b/filter/source/xsltdialog/xmlfiltertabdialog.hxx
new file mode 100644
index 000000000000..5e514353e11a
--- /dev/null
+++ b/filter/source/xsltdialog/xmlfiltertabdialog.hxx
@@ -0,0 +1,75 @@
+/*************************************************************************
+ *
+ * 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 _XMLFILTERTABDIALOG_HXX_
+#define _XMLFILTERTABDIALOG_HXX_
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <sfx2/tabdlg.hxx>
+
+class Window;
+class ResMgr;
+
+class filter_info_impl;
+class XMLFilterTabPageBasic;
+class XMLFilterTabPageXSLT;
+
+class XMLFilterTabDialog: public TabDialog
+{
+public:
+ XMLFilterTabDialog( Window *pParent, ResMgr& rResMgr, const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rxMSF, const filter_info_impl* pInfo );
+ virtual ~XMLFilterTabDialog();
+
+ ResMgr& getResMgr() { return mrResMgr; }
+
+ bool onOk();
+
+ filter_info_impl* getNewFilterInfo() const;
+
+private:
+ com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > mxMSF;
+
+ DECL_LINK( ActivatePageHdl, TabControl * );
+ DECL_LINK( DeactivatePageHdl, TabControl * );
+ DECL_LINK( OkHdl, Button * );
+ DECL_LINK( CancelHdl, Button * );
+
+ ResMgr& mrResMgr;
+
+ const filter_info_impl* mpOldInfo;
+ filter_info_impl* mpNewInfo;
+
+ TabControl maTabCtrl;
+ OKButton maOKBtn;
+ CancelButton maCancelBtn;
+ HelpButton maHelpBtn;
+
+ XMLFilterTabPageBasic* mpBasicPage;
+ XMLFilterTabPageXSLT* mpXSLTPage;
+};
+
+
+#endif
diff --git a/filter/source/xsltdialog/xmlfiltertabdialog.src b/filter/source/xsltdialog/xmlfiltertabdialog.src
new file mode 100644
index 000000000000..7bfed35d0b87
--- /dev/null
+++ b/filter/source/xsltdialog/xmlfiltertabdialog.src
@@ -0,0 +1,65 @@
+/*************************************************************************
+ *
+ * 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 "xmlfiltertabdialog.hrc"
+#include "xmlfiltertabpagebasic.hrc"
+#include "xmlfiltertabpagexslt.hrc"
+#include "xmlfilterhelpids.hrc"
+
+TabDialog DLG_XML_FILTER_TABDIALOG
+{
+ HelpId = HID_XML_FILTER_TABDIALOG;
+ OutputSize = TRUE ;
+ SvLook = TRUE ;
+ Moveable = TRUE ;
+ Text [ en-US ] = "XML Filter: %s" ;
+ TabControl 1
+ {
+ OutputSize = TRUE ;
+ PageList =
+ {
+ PageItem RID_XML_FILTER_TABPAGE_BASIC
+ {
+ Identifier = RID_XML_FILTER_TABPAGE_BASIC ;
+ Text [ en-US ] = "General" ;
+ };
+ PageItem RID_XML_FILTER_TABPAGE_XSLT
+ {
+ Identifier = RID_XML_FILTER_TABPAGE_XSLT ;
+ Text [ en-US ] = "Transformation" ;
+ };
+ };
+ };
+};
+
+
+
+
+
+
+
+
diff --git a/filter/source/xsltdialog/xmlfiltertabpagebasic.cxx b/filter/source/xsltdialog/xmlfiltertabpagebasic.cxx
new file mode 100644
index 000000000000..b88e9ff802a4
--- /dev/null
+++ b/filter/source/xsltdialog/xmlfiltertabpagebasic.cxx
@@ -0,0 +1,153 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+#include <rtl/ustrbuf.hxx>
+
+#include "xmlfilterdialogstrings.hrc"
+#include "xmlfiltertabpagebasic.hxx"
+#include "xmlfiltertabpagebasic.hrc"
+#include "xmlfiltersettingsdialog.hxx"
+#include "xmlfilterhelpids.hrc"
+
+using namespace rtl;
+
+XMLFilterTabPageBasic::XMLFilterTabPageBasic( Window* pParent, ResMgr& rResMgr ) :
+ TabPage( pParent, ResId( RID_XML_FILTER_TABPAGE_BASIC, rResMgr ) ),
+ maFTFilterName( this, ResId( FT_XML_FILTER_NAME, rResMgr ) ),
+ maEDFilterName( this, ResId( ED_XML_FILTER_NAME, rResMgr ) ),
+ maFTApplication( this, ResId( FT_XML_APPLICATION, rResMgr ) ),
+ maCBApplication( this, ResId( CB_XML_APPLICATION, rResMgr ) ),
+ maFTInterfaceName( this, ResId( FT_XML_INTERFACE_NAME, rResMgr ) ),
+ maEDInterfaceName( this, ResId( ED_XML_INTERFACE_NAME, rResMgr ) ),
+ maFTExtension( this, ResId( FT_XML_EXTENSION, rResMgr ) ),
+ maEDExtension( this, ResId( ED_XML_EXTENSION, rResMgr ) ),
+ maFTDescription( this, ResId( FT_XML_DESCRIPTION, rResMgr ) ),
+ maEDDescription( this, ResId( ED_XML_DESCRIPTION, rResMgr ) )
+{
+ maCBApplication.SetHelpId( HID_XML_FILTER_APPLICATION );
+ maEDDescription.SetHelpId( HID_XML_FILTER_DESCRIPTION );
+
+ FreeResource();
+
+ std::vector< application_info_impl* >& rInfos = getApplicationInfos();
+ std::vector< application_info_impl* >::iterator aIter( rInfos.begin() );
+ while( aIter != rInfos.end() )
+ {
+ XubString aEntry( (*aIter++)->maDocumentUIName );
+ maCBApplication.InsertEntry( aEntry );
+ }
+}
+
+XMLFilterTabPageBasic::~XMLFilterTabPageBasic()
+{
+}
+
+static OUString checkExtensions( const String& rExtensions )
+{
+ const sal_Unicode* pSource = rExtensions.GetBuffer();
+ sal_Int32 nCount = rExtensions.Len();
+
+ String aRet;
+ while( nCount-- )
+ {
+ switch(*pSource)
+ {
+ case sal_Unicode(','):
+ aRet += sal_Unicode(';');
+ break;
+ case sal_Unicode('.'):
+ case sal_Unicode('*'):
+ break;
+ default:
+ aRet += *pSource;
+ }
+
+ pSource++;
+ }
+
+ return aRet;
+}
+
+bool XMLFilterTabPageBasic::FillInfo( filter_info_impl* pInfo )
+{
+ if( pInfo )
+ {
+ if( maEDFilterName.GetText().Len() )
+ pInfo->maFilterName = maEDFilterName.GetText();
+
+ if( maCBApplication.GetText().Len() )
+ pInfo->maDocumentService = maCBApplication.GetText();
+
+ if( maEDInterfaceName.GetText().Len() )
+ pInfo->maInterfaceName = maEDInterfaceName.GetText();
+
+ if( maEDExtension.GetText().Len() )
+ pInfo->maExtension = checkExtensions( maEDExtension.GetText() );
+
+ pInfo->maComment = string_encode( maEDDescription.GetText() );
+
+ if( pInfo->maDocumentService.getLength() )
+ {
+ std::vector< application_info_impl* >& rInfos = getApplicationInfos();
+ std::vector< application_info_impl* >::iterator aIter( rInfos.begin() );
+ while( aIter != rInfos.end() )
+ {
+ if( pInfo->maDocumentService == (*aIter)->maDocumentUIName )
+ {
+ pInfo->maDocumentService = (*aIter)->maDocumentService;
+ pInfo->maExportService = (*aIter)->maXMLExporter;
+ pInfo->maImportService = (*aIter)->maXMLImporter;
+ break;
+ }
+ aIter++;
+ }
+ }
+ }
+
+ return true;
+}
+
+void XMLFilterTabPageBasic::SetInfo(const filter_info_impl* pInfo)
+{
+ if( pInfo )
+ {
+ maEDFilterName.SetText( string_decode(pInfo->maFilterName) );
+ /*
+ if( pInfo->maDocumentService.getLength() )
+ maCBApplication.SetText( getApplicationUIName( pInfo->maDocumentService ) );
+ */
+ if( pInfo->maExportService.getLength() )
+ maCBApplication.SetText( getApplicationUIName( pInfo->maExportService ) );
+ else
+ maCBApplication.SetText( getApplicationUIName( pInfo->maImportService ) );
+ maEDInterfaceName.SetText( string_decode(pInfo->maInterfaceName) );
+ maEDExtension.SetText( pInfo->maExtension );
+ maEDDescription.SetText( string_decode( pInfo->maComment ) );
+ }
+}
diff --git a/filter/source/xsltdialog/xmlfiltertabpagebasic.hrc b/filter/source/xsltdialog/xmlfiltertabpagebasic.hrc
new file mode 100644
index 000000000000..eea4f91e1698
--- /dev/null
+++ b/filter/source/xsltdialog/xmlfiltertabpagebasic.hrc
@@ -0,0 +1,44 @@
+/*************************************************************************
+ *
+ * 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 _XMLFILTERTABPAGEBASIC_HRC_
+#define _XMLFILTERTABPAGEBASIC_HRC_
+
+#include "xmlfiltercommon.hrc"
+
+#define FT_XML_FILTER_NAME 1
+#define ED_XML_FILTER_NAME 2
+#define FT_XML_APPLICATION 3
+#define CB_XML_APPLICATION 4
+#define FT_XML_INTERFACE_NAME 5
+#define ED_XML_INTERFACE_NAME 6
+#define FT_XML_EXTENSION 7
+#define ED_XML_EXTENSION 8
+#define FT_XML_DESCRIPTION 9
+#define ED_XML_DESCRIPTION 10
+
+#endif
diff --git a/filter/source/xsltdialog/xmlfiltertabpagebasic.hxx b/filter/source/xsltdialog/xmlfiltertabpagebasic.hxx
new file mode 100644
index 000000000000..0fd1fcda3cd5
--- /dev/null
+++ b/filter/source/xsltdialog/xmlfiltertabpagebasic.hxx
@@ -0,0 +1,67 @@
+/*************************************************************************
+ *
+ * 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 _XMLFILTERTABPAGEBASIC_HXX_
+#define _XMLFILTERTABPAGEBASIC_HXX_
+
+#include <sfx2/tabdlg.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/combobox.hxx>
+#include <svtools/svmedit.hxx>
+
+class Window;
+class ResMgr;
+class filter_info_impl;
+
+class XMLFilterTabPageBasic : public TabPage
+{
+public:
+ XMLFilterTabPageBasic( Window* pParent, ResMgr& rResMgr );
+ virtual ~XMLFilterTabPageBasic();
+
+ bool FillInfo( filter_info_impl* pInfo );
+ void SetInfo(const filter_info_impl* pInfo);
+
+ static rtl::OUString decodeComment( const rtl::OUString& rComment );
+ static rtl::OUString encodeComment( const rtl::OUString& rComment );
+
+ FixedText maFTFilterName;
+ Edit maEDFilterName;
+
+ FixedText maFTApplication;
+ ComboBox maCBApplication;
+
+ FixedText maFTInterfaceName;
+ Edit maEDInterfaceName;
+
+ FixedText maFTExtension;
+ Edit maEDExtension;
+ FixedText maFTDescription;
+ MultiLineEdit maEDDescription;
+};
+
+#endif
diff --git a/filter/source/xsltdialog/xmlfiltertabpagebasic.src b/filter/source/xsltdialog/xmlfiltertabpagebasic.src
new file mode 100644
index 000000000000..e2c3ffb15213
--- /dev/null
+++ b/filter/source/xsltdialog/xmlfiltertabpagebasic.src
@@ -0,0 +1,152 @@
+/*************************************************************************
+ *
+ * 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 "xmlfiltertabpagebasic.hrc"
+#include "xmlfilterhelpids.hrc"
+
+#define TAB_PAGE_WIDTH 260
+#define TAB_PAGE_HEIGHT 185
+
+#define SPACING 3
+
+#define FIRST_ROW_X 6
+#define FIRST_ROW_Y 6
+#define FIRST_ROW_WIDTH 60
+
+#define SECOND_ROW_X (FIRST_ROW_X + FIRST_ROW_WIDTH + SPACING)
+#define SECOND_ROW_Y 6
+#define SECOND_ROW_WIDTH (TAB_PAGE_WIDTH - SECOND_ROW_X - SPACING)
+
+#define FIXED_TEXT_OFFSET 2
+
+#define ROW_HEIGHT 12
+
+
+TabPage RID_XML_FILTER_TABPAGE_BASIC
+{
+ HelpId = HID_XML_FILTER_TABPAGE_BASIC;
+ Hide = TRUE;
+ Size = MAP_APPFONT ( TAB_PAGE_WIDTH , TAB_PAGE_HEIGHT );
+ Text [ en-US ] = "General";
+
+ // Filter Name ----------------------------------------------------
+
+ FixedText FT_XML_FILTER_NAME
+ {
+ Pos = MAP_APPFONT ( FIRST_ROW_X , FIRST_ROW_Y + 0 * ROW_HEIGHT + 0 * SPACING + FIXED_TEXT_OFFSET ) ;
+ Size = MAP_APPFONT ( FIRST_ROW_WIDTH , 8 ) ;
+ Text [ en-US ] = "Filter name";
+ };
+
+ Edit ED_XML_FILTER_NAME
+ {
+ Pos = MAP_APPFONT ( SECOND_ROW_X , SECOND_ROW_Y + 0 * ROW_HEIGHT + 0 * SPACING ) ;
+ Size = MAP_APPFONT ( 102 , 12 ) ;
+ HelpId = HID_XML_FILTER_NAME;
+ Border = TRUE;
+ };
+
+ // Application ----------------------------------------------------
+
+ FixedText FT_XML_APPLICATION
+ {
+ Pos = MAP_APPFONT ( FIRST_ROW_X , FIRST_ROW_Y + 1 * ROW_HEIGHT + 1 * SPACING + FIXED_TEXT_OFFSET ) ;
+ Size = MAP_APPFONT ( FIRST_ROW_WIDTH , 8 ) ;
+ Text [ en-US ] = "Application";
+ };
+
+ ComboBox CB_XML_APPLICATION
+ {
+ Pos = MAP_APPFONT ( SECOND_ROW_X , SECOND_ROW_Y + 1 * ROW_HEIGHT + 1 * SPACING ) ;
+ Size = MAP_APPFONT ( 102 , 60 ) ;
+ HelpId = HID_XML_FILTER_APPLICATION;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ Sort = TRUE ;
+ };
+
+ // Interface Name -------------------------------------------------
+
+ FixedText FT_XML_INTERFACE_NAME
+ {
+ Pos = MAP_APPFONT ( FIRST_ROW_X , FIRST_ROW_Y + 2 * ROW_HEIGHT + 2 * SPACING ) ; // + FIXED_TEXT_OFFSET ) ;
+ Size = MAP_APPFONT ( FIRST_ROW_WIDTH , 16 ) ;
+ Text [ en-US ] = "Name of\nfile type";
+ };
+
+ Edit ED_XML_INTERFACE_NAME
+ {
+ Pos = MAP_APPFONT ( SECOND_ROW_X , 2 + SECOND_ROW_Y + 2 * ROW_HEIGHT + 2 * SPACING ) ;
+ Size = MAP_APPFONT ( 102 , 12 ) ;
+ HelpId = HID_XML_FILTER_INTERFACE_NAME;
+ Border = TRUE;
+ };
+
+ // Extension ------------------------------------------------------
+
+ FixedText FT_XML_EXTENSION
+ {
+ Pos = MAP_APPFONT ( FIRST_ROW_X , 4 + FIRST_ROW_Y + 3 * ROW_HEIGHT + 3 * SPACING + FIXED_TEXT_OFFSET) ;
+ Size = MAP_APPFONT ( FIRST_ROW_WIDTH , 8 ) ;
+ Text [ en-US ] = "File extension";
+ };
+
+ Edit ED_XML_EXTENSION
+ {
+ Pos = MAP_APPFONT ( SECOND_ROW_X , 4 + SECOND_ROW_Y + 3 * ROW_HEIGHT + 3 * SPACING ) ;
+ Size = MAP_APPFONT ( 32 , 12 ) ;
+ HelpId = HID_XML_FILTER_EXTENSION;
+ Border = TRUE;
+ };
+
+ // Description ----------------------------------------------------
+
+ FixedText FT_XML_DESCRIPTION
+ {
+ Pos = MAP_APPFONT ( FIRST_ROW_X , 4 + FIRST_ROW_Y + 4 * ROW_HEIGHT + 4 * SPACING + FIXED_TEXT_OFFSET ) ;
+ Size = MAP_APPFONT ( FIRST_ROW_WIDTH , 8 ) ;
+ Text [ en-US ] = "Comments";
+ };
+
+ MultiLineEdit ED_XML_DESCRIPTION
+ {
+ Pos = MAP_APPFONT ( SECOND_ROW_X , 4 + SECOND_ROW_Y + 4 * ROW_HEIGHT + 4 * SPACING ) ;
+ Size = MAP_APPFONT ( SECOND_ROW_WIDTH , 3*ROW_HEIGHT ) ;
+ HelpId = HID_XML_FILTER_DESCRIPTION;
+ Border = TRUE;
+ IgnoreTab = TRUE ;
+ };
+};
+
+
+
+
+
+
+
+
diff --git a/filter/source/xsltdialog/xmlfiltertabpagexslt.cxx b/filter/source/xsltdialog/xmlfiltertabpagexslt.cxx
new file mode 100644
index 000000000000..17743a09d321
--- /dev/null
+++ b/filter/source/xsltdialog/xmlfiltertabpagexslt.cxx
@@ -0,0 +1,221 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+#include <com/sun/star/frame/XConfigManager.hpp>
+
+#include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
+#include <sfx2/filedlghelper.hxx>
+#include <unotools/localfilehelper.hxx>
+#include <osl/file.hxx>
+#include <svl/urihelper.hxx>
+
+#include "xmlfiltertabpagexslt.hxx"
+#include "xmlfiltertabpagexslt.hrc"
+#include "xmlfiltersettingsdialog.hxx"
+#include "xmlfilterhelpids.hrc"
+
+using namespace ::rtl;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::lang;
+
+XMLFilterTabPageXSLT::XMLFilterTabPageXSLT( Window* pParent, ResMgr& rResMgr, const Reference< XMultiServiceFactory >& rxMSF ) :
+ TabPage( pParent, ResId( RID_XML_FILTER_TABPAGE_XSLT, rResMgr ) ),
+
+ maFTDocType( this, ResId( FT_XML_DOCTYPE, rResMgr ) ),
+ maEDDocType( this, ResId( ED_XML_DOCTYPE, rResMgr ) ),
+
+ maFTDTDSchema( this, ResId( FT_XML_DTD_SCHEMA, rResMgr ) ),
+ maEDDTDSchema( this, ResId( ED_XML_DTD_SCHEMA, rResMgr ), INET_PROT_FILE ),
+ maPBDTDSchemaBrowse( this, ResId( ED_XML_DTD_SCHEMA_BROWSE, rResMgr ) ),
+
+ maFTExportXSLT( this, ResId( FT_XML_EXPORT_XSLT, rResMgr ) ),
+ maEDExportXSLT( this, ResId( ED_XML_EXPORT_XSLT, rResMgr ), INET_PROT_FILE ),
+ maPBExprotXSLT( this, ResId( PB_XML_EXPORT_XSLT_BROWSE, rResMgr ) ),
+
+ maFTImportXSLT( this, ResId( FT_XML_IMPORT_XSLT, rResMgr ) ),
+ maEDImportXSLT( this, ResId( ED_XML_IMPORT_XSLT, rResMgr ), INET_PROT_FILE ),
+ maPBImportXSLT( this, ResId( PB_XML_IMPORT_XSLT_BROWSE, rResMgr ) ),
+
+ maFTImportTemplate( this, ResId( FT_XML_IMPORT_TEMPLATE, rResMgr ) ),
+ maEDImportTemplate( this, ResId( ED_XML_IMPORT_TEMPLATE, rResMgr ), INET_PROT_FILE ),
+ maPBImportTemplate( this, ResId( PB_XML_IMPORT_TEMPLATE_BROWSE, rResMgr ) ),
+
+ sHTTPSchema( RTL_CONSTASCII_USTRINGPARAM( "http://" ) ),
+ sSHTTPSchema( RTL_CONSTASCII_USTRINGPARAM( "shttp://" ) ),
+ sFILESchema( RTL_CONSTASCII_USTRINGPARAM( "file://" ) ),
+ sFTPSchema( RTL_CONSTASCII_USTRINGPARAM( "ftp://" ) ),
+ sInstPath( RTL_CONSTASCII_USTRINGPARAM( "$(prog)/" ) )
+{
+ FreeResource();
+
+ try
+ {
+ Reference< XConfigManager > xCfgMgr( rxMSF->createInstance(OUString::createFromAscii("com.sun.star.config.SpecialConfigManager")), UNO_QUERY );
+ if( xCfgMgr.is() )
+ sInstPath = xCfgMgr->substituteVariables( sInstPath );
+ }
+ catch(Exception&)
+ {
+ DBG_ERROR( "XMLFilterTabPageXSLT::XMLFilterTabPageXSLT exception catched!" );
+ }
+
+ maPBDTDSchemaBrowse.SetClickHdl( LINK ( this, XMLFilterTabPageXSLT, ClickBrowseHdl_Impl ) );
+ maPBExprotXSLT.SetClickHdl( LINK ( this, XMLFilterTabPageXSLT, ClickBrowseHdl_Impl ) );
+ maPBImportXSLT.SetClickHdl( LINK ( this, XMLFilterTabPageXSLT, ClickBrowseHdl_Impl ) );
+ maPBImportTemplate.SetClickHdl( LINK ( this, XMLFilterTabPageXSLT, ClickBrowseHdl_Impl ) );
+
+ maEDDTDSchema.SetHelpId( HID_XML_FILTER_DTD );
+ maEDExportXSLT.SetHelpId( HID_XML_FILTER_EXPORT_XSLT );
+ maEDImportXSLT.SetHelpId( HID_XML_FILTER_IMPORT_XSLT );
+ maEDImportTemplate.SetHelpId( HID_XML_FILTER_IMPORT_TEMPLATE );
+}
+
+XMLFilterTabPageXSLT::~XMLFilterTabPageXSLT()
+{
+}
+
+bool XMLFilterTabPageXSLT::FillInfo( filter_info_impl* pInfo )
+{
+ if( pInfo )
+ {
+ pInfo->maDocType = maEDDocType.GetText();
+ pInfo->maDTD = GetURL( maEDDTDSchema );
+ pInfo->maExportXSLT = GetURL( maEDExportXSLT );
+ pInfo->maImportXSLT = GetURL( maEDImportXSLT );
+ pInfo->maImportTemplate = GetURL( maEDImportTemplate );
+ }
+
+ return true;
+}
+
+void XMLFilterTabPageXSLT::SetInfo(const filter_info_impl* pInfo)
+{
+ if( pInfo )
+ {
+ maEDDocType.SetText( pInfo->maDocType );
+
+ SetURL( maEDDTDSchema, pInfo->maDTD );
+ SetURL( maEDExportXSLT, pInfo->maExportXSLT );
+ SetURL( maEDImportXSLT, pInfo->maImportXSLT );
+ SetURL( maEDImportTemplate, pInfo->maImportTemplate );
+ }
+}
+
+void XMLFilterTabPageXSLT::SetURL( SvtURLBox& rURLBox, const OUString& rURL )
+{
+ OUString aPath;
+
+ if( rURL.matchIgnoreAsciiCase( OUString( RTL_CONSTASCII_USTRINGPARAM( "file://" ) ) ) )
+ {
+ osl::FileBase::getSystemPathFromFileURL( rURL, aPath );
+
+ rURLBox.SetBaseURL( rURL );
+ rURLBox.SetText( aPath );
+ }
+ else if( rURL.matchIgnoreAsciiCase( OUString( RTL_CONSTASCII_USTRINGPARAM( "http://" ) ) ) ||
+ rURL.matchIgnoreAsciiCase( OUString( RTL_CONSTASCII_USTRINGPARAM( "shttp://" ) ) ) ||
+ rURL.matchIgnoreAsciiCase( OUString( RTL_CONSTASCII_USTRINGPARAM( "ftp://" ) ) ) )
+ {
+ rURLBox.SetBaseURL( rURL );
+ rURLBox.SetText( rURL );
+ }
+ else if( rURL.getLength() )
+ {
+ rtl::OUString aURL( rURL );
+ aURL = URIHelper::SmartRel2Abs( sInstPath, aURL, Link(), false );
+ osl::FileBase::getSystemPathFromFileURL( aURL, aPath );
+
+ rURLBox.SetBaseURL( aURL );
+ rURLBox.SetText( aPath );
+ }
+ else
+ {
+ rURLBox.SetBaseURL( sInstPath );
+ String aEmpty;
+ rURLBox.SetText( aEmpty );
+ }
+}
+
+OUString XMLFilterTabPageXSLT::GetURL( SvtURLBox& rURLBox )
+{
+ OUString aURL;
+ OUString aStrPath ( rURLBox.GetText() );
+ if( aStrPath.matchIgnoreAsciiCase( OUString( RTL_CONSTASCII_USTRINGPARAM( "http://" ) ) ) ||
+ aStrPath.matchIgnoreAsciiCase( OUString( RTL_CONSTASCII_USTRINGPARAM( "shttp://" ) ) ) ||
+ aStrPath.matchIgnoreAsciiCase( OUString( RTL_CONSTASCII_USTRINGPARAM( "ftp://" ) ) ) )
+ {
+ return aStrPath;
+ }
+ else
+ {
+ const String aBaseURL ( rURLBox.GetBaseURL() );
+ osl::FileBase::getFileURLFromSystemPath( aStrPath, aURL );
+ }
+
+ return aURL;
+}
+
+IMPL_LINK ( XMLFilterTabPageXSLT, ClickBrowseHdl_Impl, PushButton *, pButton )
+{
+ SvtURLBox* pURLBox;
+
+ if( pButton == &maPBDTDSchemaBrowse )
+ {
+ pURLBox = &maEDDTDSchema;
+ }
+ else if( pButton == &maPBExprotXSLT )
+ {
+ pURLBox = &maEDExportXSLT;
+ }
+ else if( pButton == &maPBImportXSLT )
+ {
+ pURLBox = &maEDImportXSLT;
+ }
+ else
+ {
+ pURLBox = &maEDImportTemplate;
+ }
+
+ // Open Fileopen-Dialog
+ ::sfx2::FileDialogHelper aDlg(
+ com::sun::star::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, 0 );
+
+ aDlg.SetDisplayDirectory( GetURL( *pURLBox ) );
+
+ if ( aDlg.Execute() == ERRCODE_NONE )
+ {
+ OUString aURL( aDlg.GetPath() );
+
+ SetURL( *pURLBox, aURL );
+ }
+
+ return( 0L );
+}
+
diff --git a/filter/source/xsltdialog/xmlfiltertabpagexslt.hrc b/filter/source/xsltdialog/xmlfiltertabpagexslt.hrc
new file mode 100644
index 000000000000..e5b768da6846
--- /dev/null
+++ b/filter/source/xsltdialog/xmlfiltertabpagexslt.hrc
@@ -0,0 +1,48 @@
+/*************************************************************************
+ *
+ * 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 _XMLFILTERTABPAGEXSLT_HRC_
+#define _XMLFILTERTABPAGEXSLT_HRC_
+
+#include "xmlfiltercommon.hrc"
+
+#define FT_XML_DOCTYPE 1
+#define ED_XML_DOCTYPE 2
+#define FT_XML_DTD_SCHEMA 3
+#define ED_XML_DTD_SCHEMA 4
+#define ED_XML_DTD_SCHEMA_BROWSE 5
+#define FT_XML_EXPORT_XSLT 6
+#define ED_XML_EXPORT_XSLT 7
+#define PB_XML_EXPORT_XSLT_BROWSE 8
+#define FT_XML_IMPORT_XSLT 9
+#define ED_XML_IMPORT_XSLT 10
+#define PB_XML_IMPORT_XSLT_BROWSE 11
+#define FT_XML_IMPORT_TEMPLATE 12
+#define ED_XML_IMPORT_TEMPLATE 13
+#define PB_XML_IMPORT_TEMPLATE_BROWSE 14
+
+#endif
diff --git a/filter/source/xsltdialog/xmlfiltertabpagexslt.hxx b/filter/source/xsltdialog/xmlfiltertabpagexslt.hxx
new file mode 100644
index 000000000000..9aa131e228db
--- /dev/null
+++ b/filter/source/xsltdialog/xmlfiltertabpagexslt.hxx
@@ -0,0 +1,82 @@
+/*************************************************************************
+ *
+ * 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 _XMLFILTERTABPAGEXSLT_HXX_
+#define _XMLFILTERTABPAGEXSLT_HXX_
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <sfx2/tabdlg.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/combobox.hxx>
+#include <svtools/inettbc.hxx>
+
+class Window;
+class ResMgr;
+class filter_info_impl;
+
+class XMLFilterTabPageXSLT : public TabPage
+{
+public:
+ XMLFilterTabPageXSLT( Window* pParent, ResMgr& rResMgr, const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rxMSF );
+ virtual ~XMLFilterTabPageXSLT();
+
+ bool FillInfo( filter_info_impl* pInfo );
+ void SetInfo(const filter_info_impl* pInfo);
+
+ DECL_LINK( ClickBrowseHdl_Impl, PushButton * );
+
+ FixedText maFTDocType;
+ Edit maEDDocType;
+
+ FixedText maFTDTDSchema;
+ SvtURLBox maEDDTDSchema;
+ PushButton maPBDTDSchemaBrowse;
+
+ FixedText maFTExportXSLT;
+ SvtURLBox maEDExportXSLT;
+ PushButton maPBExprotXSLT;
+
+ FixedText maFTImportXSLT;
+ SvtURLBox maEDImportXSLT;
+ PushButton maPBImportXSLT;
+
+ FixedText maFTImportTemplate;
+ SvtURLBox maEDImportTemplate;
+ PushButton maPBImportTemplate;
+
+private:
+ void SetURL( SvtURLBox& rURLBox, const rtl::OUString& rURL );
+ rtl::OUString GetURL( SvtURLBox& rURLBox );
+
+ ::rtl::OUString sHTTPSchema;
+ ::rtl::OUString sSHTTPSchema;
+ ::rtl::OUString sFILESchema;
+ ::rtl::OUString sFTPSchema;
+ ::rtl::OUString sInstPath;
+};
+
+#endif
diff --git a/filter/source/xsltdialog/xmlfiltertabpagexslt.src b/filter/source/xsltdialog/xmlfiltertabpagexslt.src
new file mode 100644
index 000000000000..43a5bb1a6f39
--- /dev/null
+++ b/filter/source/xsltdialog/xmlfiltertabpagexslt.src
@@ -0,0 +1,176 @@
+/*************************************************************************
+ *
+ * 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 "xmlfiltertabpagexslt.hrc"
+#include "xmlfilterhelpids.hrc"
+
+#define TAB_PAGE_WIDTH 260
+#define TAB_PAGE_HEIGHT 120
+
+#define SPACING 3
+
+#define FIRST_ROW_X 6
+#define FIRST_ROW_Y 6
+#define FIRST_ROW_WIDTH 75
+
+#define SECOND_ROW_X (FIRST_ROW_X + FIRST_ROW_WIDTH + SPACING)
+#define SECOND_ROW_Y 6
+#define SECOND_ROW_WIDTH (TAB_PAGE_WIDTH - SECOND_ROW_X - 2*SPACING)
+#define BROWSE_WIDTH 50
+
+#define EDIT_OFFSET 1
+#define FIXED_TEXT_OFFSET 2
+
+#define ROW_HEIGHT 14
+
+
+TabPage RID_XML_FILTER_TABPAGE_XSLT
+{
+ HelpId = HID_XML_FILTER_TABPAGE_XSLT;
+ Hide = TRUE;
+ Size = MAP_APPFONT ( TAB_PAGE_WIDTH , TAB_PAGE_HEIGHT );
+ Text [ en-US ] = "Transformation";
+
+ // DocType --------------------------------------------------------
+
+ FixedText FT_XML_DOCTYPE
+ {
+ Pos = MAP_APPFONT ( FIRST_ROW_X , FIRST_ROW_Y + 0 * ROW_HEIGHT + 0 * SPACING + FIXED_TEXT_OFFSET + EDIT_OFFSET ) ;
+ Size = MAP_APPFONT ( FIRST_ROW_WIDTH , 8 ) ;
+ Text [ en-US ] = "DocType";
+ };
+
+ Edit ED_XML_DOCTYPE
+ {
+ Pos = MAP_APPFONT ( SECOND_ROW_X , SECOND_ROW_Y + 0 * ROW_HEIGHT + 0 * SPACING + EDIT_OFFSET ) ;
+ Size = MAP_APPFONT ( SECOND_ROW_WIDTH - SPACING - BROWSE_WIDTH, 12 ) ;
+ HelpId = HID_XML_FILTER_DOCTYPE;
+ Border = TRUE;
+ };
+
+ // DTD/Schema -----------------------------------------------------
+
+ FixedText FT_XML_DTD_SCHEMA
+ {
+ Pos = MAP_APPFONT ( FIRST_ROW_X , FIRST_ROW_Y + 1 * ROW_HEIGHT + 1 * SPACING + FIXED_TEXT_OFFSET + EDIT_OFFSET ) ;
+ Size = MAP_APPFONT ( FIRST_ROW_WIDTH , 8 ) ;
+ Text [ en-US ] = "DTD";
+ };
+
+ ComboBox ED_XML_DTD_SCHEMA
+ {
+ Pos = MAP_APPFONT ( SECOND_ROW_X , SECOND_ROW_Y + 1 * ROW_HEIGHT + 1 * SPACING + EDIT_OFFSET ) ;
+ Size = MAP_APPFONT ( SECOND_ROW_WIDTH - SPACING - BROWSE_WIDTH, 12 ) ;
+ HelpId = HID_XML_FILTER_DTD;
+ Border = TRUE;
+ DropDown = FALSE ;
+ };
+
+ PushButton ED_XML_DTD_SCHEMA_BROWSE
+ {
+ Pos = MAP_APPFONT ( SECOND_ROW_X + SECOND_ROW_WIDTH - BROWSE_WIDTH , FIRST_ROW_Y + 1 * ROW_HEIGHT + 1 * SPACING ) ;
+ Size = MAP_APPFONT ( BROWSE_WIDTH , 14 ) ;
+ HelpId = HID_XML_FILTER_DTD_BROWSE;
+ Text [ en-US ] = "Browse...";
+ };
+
+ // Export XSLT ----------------------------------------------------
+
+ FixedText FT_XML_EXPORT_XSLT
+ {
+ Pos = MAP_APPFONT ( FIRST_ROW_X , FIRST_ROW_Y + 2 * ROW_HEIGHT + 2 * SPACING + FIXED_TEXT_OFFSET + EDIT_OFFSET ) ;
+ Size = MAP_APPFONT ( FIRST_ROW_WIDTH, 8 ) ;
+ Text [ en-US ] = "XSLT for export";
+ };
+
+ ComboBox ED_XML_EXPORT_XSLT
+ {
+ Pos = MAP_APPFONT ( SECOND_ROW_X , FIRST_ROW_Y + 2 * ROW_HEIGHT + 2 * SPACING + EDIT_OFFSET ) ;
+ Size = MAP_APPFONT ( SECOND_ROW_WIDTH - SPACING - BROWSE_WIDTH , 12 ) ;
+ HelpId = HID_XML_FILTER_EXPORT_XSLT;
+ Border = TRUE;
+ };
+
+ PushButton PB_XML_EXPORT_XSLT_BROWSE
+ {
+ Pos = MAP_APPFONT ( SECOND_ROW_X + SECOND_ROW_WIDTH - BROWSE_WIDTH , FIRST_ROW_Y + 2 * ROW_HEIGHT + 2 * SPACING ) ;
+ Size = MAP_APPFONT ( BROWSE_WIDTH , 14 ) ;
+ HelpId = HID_XML_FILTER_EXPORT_XSLT_BROWSE;
+ Text [ en-US ] = "Browse...";
+ };
+
+ // Import XSLT ----------------------------------------------------
+
+ FixedText FT_XML_IMPORT_XSLT
+ {
+ Pos = MAP_APPFONT ( FIRST_ROW_X , FIRST_ROW_Y + 3 * ROW_HEIGHT + 3 * SPACING + FIXED_TEXT_OFFSET + EDIT_OFFSET ) ;
+ Size = MAP_APPFONT ( FIRST_ROW_WIDTH , 8 ) ;
+ Text [ en-US ] = "XSLT for import";
+ };
+
+ ComboBox ED_XML_IMPORT_XSLT
+ {
+ Pos = MAP_APPFONT ( SECOND_ROW_X , FIRST_ROW_Y + 3 * ROW_HEIGHT + 3 * SPACING + EDIT_OFFSET ) ;
+ Size = MAP_APPFONT ( SECOND_ROW_WIDTH - SPACING - BROWSE_WIDTH , 12 ) ;
+ HelpId = HID_XML_FILTER_IMPORT_XSLT;
+ Border = TRUE;
+ };
+
+ PushButton PB_XML_IMPORT_XSLT_BROWSE
+ {
+ Pos = MAP_APPFONT ( SECOND_ROW_X + SECOND_ROW_WIDTH - BROWSE_WIDTH , FIRST_ROW_Y + 3 * ROW_HEIGHT + 3 * SPACING ) ;
+ Size = MAP_APPFONT ( BROWSE_WIDTH , 14 ) ;
+ HelpId = HID_XML_FILTER_IMPORT_XSLT_BROWSE;
+ Text [ en-US ] = "Browse...";
+ };
+
+ // Import Template ------------------------------------------------
+
+ FixedText FT_XML_IMPORT_TEMPLATE
+ {
+ Pos = MAP_APPFONT ( FIRST_ROW_X , FIRST_ROW_Y + 4 * ROW_HEIGHT + 4 * SPACING + FIXED_TEXT_OFFSET + EDIT_OFFSET ) ;
+ Size = MAP_APPFONT ( FIRST_ROW_WIDTH , 8 ) ;
+ Text [ en-US ] = "Template for import";
+ };
+
+ ComboBox ED_XML_IMPORT_TEMPLATE
+ {
+ Pos = MAP_APPFONT ( SECOND_ROW_X , FIRST_ROW_Y + 4 * ROW_HEIGHT + 4 * SPACING + EDIT_OFFSET ) ;
+ Size = MAP_APPFONT ( SECOND_ROW_WIDTH - SPACING - BROWSE_WIDTH , 12 ) ;
+ HelpId = HID_XML_FILTER_IMPORT_TEMPLATE;
+ Border = TRUE;
+ };
+
+ PushButton PB_XML_IMPORT_TEMPLATE_BROWSE
+ {
+ Pos = MAP_APPFONT ( SECOND_ROW_X + SECOND_ROW_WIDTH - BROWSE_WIDTH , FIRST_ROW_Y + 4 * ROW_HEIGHT + 4 * SPACING ) ;
+ Size = MAP_APPFONT ( BROWSE_WIDTH , 14 ) ;
+ HelpId = HID_XML_FILTER_IMPORT_TEMPLATE_BROWSE;
+ Text [ en-US ] = "Browse...";
+ };
+};
+
diff --git a/filter/source/xsltdialog/xmlfiltertestdialog.cxx b/filter/source/xsltdialog/xmlfiltertestdialog.cxx
new file mode 100644
index 000000000000..30238b08c1b5
--- /dev/null
+++ b/filter/source/xsltdialog/xmlfiltertestdialog.cxx
@@ -0,0 +1,783 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+#include <com/sun/star/frame/XConfigManager.hpp>
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#ifndef _COM_SUN_STAR_DOCUMENT_XGRAPHICOBJECTRESOLVER_HXX_
+#include <com/sun/star/document/XGraphicObjectResolver.hpp>
+#endif
+#ifndef _COM_SUN_STAR_DOCUMENT_XEMBEDDEDOBJECTRESOLVER_HXX_
+#include <com/sun/star/document/XEmbeddedObjectResolver.hpp>
+#endif
+#include <com/sun/star/xml/XImportFilter.hpp>
+#include <com/sun/star/xml/XExportFilter.hpp>
+#include <com/sun/star/io/XActiveDataSource.hpp>
+#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
+#include <com/sun/star/frame/XComponentLoader.hpp>
+#include <com/sun/star/frame/XStorable.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/frame/XDesktop.hpp>
+#include <com/sun/star/document/XFilter.hpp>
+#include <comphelper/oslfile2streamwrap.hxx>
+#include <com/sun/star/document/XExporter.hpp>
+#include <com/sun/star/task/XInteractionHandler.hpp>
+
+#include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
+#include <vcl/svapp.hxx>
+#include <vos/mutex.hxx>
+#include <sfx2/filedlghelper.hxx>
+#include <osl/file.hxx>
+#include <unotools/tempfile.hxx>
+#include <tools/urlobj.hxx>
+
+#include "xmlfilterdialogstrings.hrc"
+#include "xmlfiltersettingsdialog.hxx"
+#include "xmlfiltertestdialog.hxx"
+#include "xmlfiltertestdialog.hrc"
+#include "xmlfileview.hxx"
+
+
+using namespace rtl;
+using namespace utl;
+using namespace osl;
+using namespace vos;
+using namespace comphelper;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::container;
+using namespace com::sun::star::document;
+using namespace com::sun::star::frame;
+using namespace com::sun::star::task;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::io;
+using namespace com::sun::star::xml;
+using namespace com::sun::star::xml::sax;
+
+class GlobalEventListenerImpl : public ::cppu::WeakImplHelper1< com::sun::star::document::XEventListener >
+{
+public:
+ GlobalEventListenerImpl( XMLFilterTestDialog* pDialog );
+
+ // XEventListener
+ virtual void SAL_CALL notifyEvent( const com::sun::star::document::EventObject& Event ) throw (RuntimeException);
+
+ // lang::XEventListener
+ virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw (RuntimeException);
+private:
+ XMLFilterTestDialog* mpDialog;
+};
+
+GlobalEventListenerImpl::GlobalEventListenerImpl( XMLFilterTestDialog* pDialog )
+: mpDialog( pDialog )
+{
+}
+
+void SAL_CALL GlobalEventListenerImpl::notifyEvent( const com::sun::star::document::EventObject& Event ) throw (RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+ if( (Event.EventName.compareToAscii( RTL_CONSTASCII_STRINGPARAM("OnFocus") ) == 0) ||
+ (Event.EventName.compareToAscii( RTL_CONSTASCII_STRINGPARAM("OnUnload") ) == 0) )
+ {
+ Reference< XComponent > xComp( Event.Source, UNO_QUERY );
+ mpDialog->updateCurrentDocumentButtonState( &xComp );
+ }
+}
+
+void SAL_CALL GlobalEventListenerImpl::disposing( const com::sun::star::lang::EventObject& /* Source */ ) throw (RuntimeException)
+{
+}
+
+/** returns true if the given component supports the given service */
+static bool checkComponent( Reference< XComponent >& rxComponent, const OUString& rServiceName )
+{
+ try
+ {
+ Reference< XServiceInfo > xInfo( rxComponent, UNO_QUERY );
+ if( xInfo.is() )
+ {
+ if( xInfo->supportsService( rServiceName ) )
+ {
+ // special case for impress documents which supports same service as draw documents
+ if( rServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.drawing.DrawingDocument" ) ) )
+ {
+ // so if we want a draw we need to check if its not an impress
+ if( !xInfo->supportsService( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.presentation.PresentationDocument") ) ) )
+ return true;
+ }
+ else
+ {
+ return true;
+ }
+ }
+ }
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR( "checkComponent exception catched!" );
+ }
+
+ return false;
+}
+
+XMLFilterTestDialog::XMLFilterTestDialog( Window* pParent, ResMgr& rResMgr, const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rxMSF ) :
+ ModalDialog( pParent, ResId( DLG_XML_FILTER_TEST_DIALOG, rResMgr ) ),
+ mxMSF( rxMSF ),
+ mrResMgr( rResMgr ),
+
+ maFLExport( this, ResId( FL_EXPORT, rResMgr ) ),
+ maFTExportXSLT( this, ResId( FT_EXPORT_XSLT, rResMgr ) ),
+ maFTExportXSLTFile( this, ResId( FT_EXPORT_XSLT_FILE, rResMgr ) ),
+ maFTTransformDocument( this, ResId( FT_TRANSFORM_DOCUMENT, rResMgr ) ),
+ maPBExportBrowse( this, ResId( PB_EXPORT_BROWSE, rResMgr ) ),
+ maPBCurrentDocument( this, ResId( PB_CURRENT_DOCUMENT, rResMgr ) ),
+ maFTNameOfCurentFile( this, ResId( FT_NAME_OF_CURRENT_FILE, rResMgr ) ),
+ maFLImport( this, ResId( FL_IMPORT, rResMgr ) ),
+ maFTImportXSLT( this, ResId( FT_IMPORT_XSLT, rResMgr ) ),
+ maFTImportXSLTFile( this, ResId( FT_IMPORT_XSLT_FILE, rResMgr ) ),
+ maFTImportTemplate( this, ResId( FT_IMPORT_TEMPLATE, rResMgr ) ),
+ maFTImportTemplateFile( this, ResId( FT_IMPORT_TEMPLATE_FILE, rResMgr ) ),
+ maFTTransformFile( this, ResId( FT_TRANSFORM_FILE, rResMgr ) ),
+ maCBXDisplaySource( this, ResId( CBX_DISPLAY_SOURCE, rResMgr ) ),
+ maPBImportBrowse( this, ResId( PB_IMPORT_BROWSE, rResMgr ) ),
+ maPBRecentDocument( this, ResId( PB_RECENT_DOCUMENT, rResMgr ) ),
+ maFTNameOfRecentFile( this, ResId( FT_NAME_OF_RECENT_FILE, rResMgr ) ),
+ maPBClose( this, ResId( PB_CLOSE, rResMgr ) ),
+ maPBHelp( this, ResId( PB_HELP, rResMgr ) ),
+ mpSourceDLG( NULL ),
+ mpFilterInfo( NULL ),
+ sDTDPath( RTL_CONSTASCII_USTRINGPARAM( "$(inst)/share/dtd/officedocument/1_0/office.dtd" ) )
+{
+ FreeResource();
+
+ maPBExportBrowse.SetClickHdl(LINK( this, XMLFilterTestDialog, ClickHdl_Impl ) );
+ maPBCurrentDocument.SetClickHdl(LINK( this, XMLFilterTestDialog, ClickHdl_Impl ) );
+ maPBImportBrowse.SetClickHdl(LINK( this, XMLFilterTestDialog, ClickHdl_Impl ) );
+ maPBRecentDocument.SetClickHdl(LINK( this, XMLFilterTestDialog, ClickHdl_Impl ) );
+ maPBClose.SetClickHdl(LINK( this, XMLFilterTestDialog, ClickHdl_Impl ) );
+
+ maDialogTitle = GetText();
+
+ try
+ {
+ Reference< XConfigManager > xCfgMgr( mxMSF->createInstance( OUString::createFromAscii("com.sun.star.config.SpecialConfigManager")), UNO_QUERY );
+ if( xCfgMgr.is() )
+ sDTDPath = xCfgMgr->substituteVariables( sDTDPath );
+
+ mxGlobalBroadcaster = Reference < XEventBroadcaster >::query( mxMSF->createInstance(::rtl::OUString::createFromAscii("com.sun.star.frame.GlobalEventBroadcaster") ) );
+ if ( mxGlobalBroadcaster.is() )
+ {
+ mxGlobalEventListener = new GlobalEventListenerImpl( this );
+ mxGlobalBroadcaster->addEventListener( mxGlobalEventListener );
+ }
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR( "XMLFilterTestDialog::XMLFilterTestDialog exception catched!" );
+ }
+}
+
+XMLFilterTestDialog::~XMLFilterTestDialog()
+{
+ try
+ {
+ if( mxGlobalBroadcaster.is() )
+ mxGlobalBroadcaster->removeEventListener( mxGlobalEventListener );
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR( "XMLFilterTestDialog::~XMLFilterTestDialog exception catched!" );
+ }
+
+ delete mpSourceDLG;
+ delete mpFilterInfo;
+}
+
+void XMLFilterTestDialog::test( const filter_info_impl& rFilterInfo )
+{
+ delete mpFilterInfo;
+ mpFilterInfo = new filter_info_impl( rFilterInfo );
+
+ maImportRecentFile = OUString();
+
+ initDialog();
+
+ Execute();
+}
+
+static OUString getFileNameFromURL( OUString& rURL )
+{
+ INetURLObject aURL( rURL );
+ OUString aName( aURL.getName(INetURLObject::LAST_SEGMENT, sal_True, INetURLObject::DECODE_WITH_CHARSET) );
+ return aName;
+}
+
+void XMLFilterTestDialog::updateCurrentDocumentButtonState( Reference< XComponent > * pRef /* = NULL */ )
+{
+ if( pRef && pRef->is() )
+ {
+ if( checkComponent( *pRef, mpFilterInfo->maDocumentService ) )
+ mxLastFocusModel = *pRef;
+ }
+
+ bool bExport = (mpFilterInfo->maFlags & 2) == 2;
+ Reference< XComponent > xCurrentDocument;
+ if( bExport )
+ xCurrentDocument = getFrontMostDocument( mpFilterInfo->maDocumentService );
+ maPBCurrentDocument.Enable( bExport && xCurrentDocument.is() );
+ maFTNameOfCurentFile.Enable( bExport && xCurrentDocument.is() );
+
+ if( xCurrentDocument.is() )
+ {
+ OUString aTitle;
+ Reference< XDocumentPropertiesSupplier > xDPS( xCurrentDocument, UNO_QUERY );
+ if( xDPS.is() )
+ {
+ Reference< XDocumentProperties > xProps( xDPS->getDocumentProperties() );
+ if( xProps.is() )
+ {
+ aTitle = xProps->getTitle();
+ }
+ }
+
+ if( 0 == aTitle.getLength() )
+ {
+ Reference< XStorable > xStorable( xCurrentDocument, UNO_QUERY );
+ if( xStorable.is() )
+ {
+ if( xStorable->hasLocation() )
+ {
+ OUString aURL( xStorable->getLocation() );
+ aTitle = getFileNameFromURL( aURL );
+ }
+ }
+ }
+
+ maFTNameOfCurentFile.SetText( aTitle );
+ }
+}
+
+void XMLFilterTestDialog::initDialog()
+{
+ DBG_ASSERT( mpFilterInfo, "i need a filter I can test!" );
+ if( NULL == mpFilterInfo )
+ return;
+
+ String aTitle( maDialogTitle );
+ aTitle.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM("%s") ), mpFilterInfo->maFilterName );
+ SetText( aTitle );
+
+ String aEmpty;
+ bool bImport = (mpFilterInfo->maFlags & 1) == 1;
+ bool bExport = (mpFilterInfo->maFlags & 2) == 2;
+
+ updateCurrentDocumentButtonState();
+
+ maFLExport.Enable( bExport );
+ maFTExportXSLT.Enable( bExport );
+ maFTExportXSLTFile.Enable( bExport );
+ maFTTransformDocument.Enable( bExport );
+ maPBExportBrowse.Enable( bExport );
+
+ maFTExportXSLTFile.SetText( getFileNameFromURL( mpFilterInfo->maExportXSLT ) );
+
+ // ---
+
+ maFLImport.Enable( bImport );
+ maFTImportXSLT.Enable( bImport );
+ maFTImportXSLTFile.Enable( bImport );
+ maFTImportTemplate.Enable( bImport && mpFilterInfo->maImportTemplate.getLength() );
+ maFTImportTemplateFile.Enable( bImport && mpFilterInfo->maImportTemplate.getLength() );
+ maFTTransformFile.Enable( bImport );
+ maCBXDisplaySource.Enable( bImport );
+ maPBImportBrowse.Enable( bImport );
+ maPBRecentDocument.Enable( bImport && maImportRecentFile.getLength() );
+ maFTNameOfRecentFile.Enable( bImport && maImportRecentFile.getLength() );
+
+ maFTImportXSLTFile.SetText( getFileNameFromURL( mpFilterInfo->maImportXSLT ) );
+ maFTImportTemplateFile.SetText( getFileNameFromURL( mpFilterInfo->maImportTemplate ) );
+ maFTNameOfRecentFile.SetText( getFileNameFromURL( maImportRecentFile ) );
+}
+
+void XMLFilterTestDialog::onExportBrowse()
+{
+ try
+ {
+ // Open Fileopen-Dialog
+ ::sfx2::FileDialogHelper aDlg(
+ com::sun::star::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE,
+ 0 );
+
+ Reference< XNameAccess > xFilterContainer( mxMSF->createInstance( OUString::createFromAscii("com.sun.star.document.FilterFactory" ) ), UNO_QUERY );
+ Reference< XNameAccess > xTypeDetection( mxMSF->createInstance( OUString::createFromAscii("com.sun.star.document.TypeDetection" ) ), UNO_QUERY );
+ if( xFilterContainer.is() && xTypeDetection.is() )
+ {
+ Sequence< OUString > aFilterNames( xFilterContainer->getElementNames() );
+ OUString* pFilterName = aFilterNames.getArray();
+
+ for( sal_Int32 nFilter = 0; nFilter < aFilterNames.getLength(); nFilter++, pFilterName++ )
+ {
+ Sequence< PropertyValue > aValues;
+
+ Any aAny( xFilterContainer->getByName( *pFilterName ) );
+ if( !(aAny >>= aValues) )
+ continue;
+
+ OUString aInterfaceName;
+ PropertyValue* pValues = aValues.getArray();
+ OUString aType, aService;
+ sal_Int32 nFlags( 0 );
+
+ int nFound = 0;
+
+ for( sal_Int32 nValue = 0; (nValue < aValues.getLength()) && (nFound != 15); nValue++, pValues++ )
+ {
+ if( pValues->Name.equalsAscii( "Type" ) )
+ {
+ pValues->Value >>= aType;
+ nFound |= 1;
+ }
+ else if( pValues->Name.equalsAscii( "DocumentService" ) )
+ {
+ pValues->Value >>= aService;
+ nFound |= 2;
+ }
+ else if( pValues->Name.equalsAscii( "Flags" ) )
+ {
+ pValues->Value >>= nFlags;
+ nFound |= 4;
+ }
+ if( pValues->Name.equalsAscii( "UIName" ) )
+ {
+ pValues->Value >>= aInterfaceName;
+ nFound |= 8;
+ }
+
+ }
+
+ if( (nFound == 15) && (aType.getLength() && aService == mpFilterInfo->maDocumentService) )
+ {
+ // see if this filter is not supressed in dialog
+ if( (nFlags & 0x1000) == 0 )
+ {
+ aAny = xTypeDetection->getByName( aType );
+ Sequence< PropertyValue > aValues2;
+
+ if( aAny >>= aValues2 )
+ {
+ PropertyValue* pValues2 = aValues2.getArray();
+ sal_Int32 nValue;
+
+ OUString aExtension;
+ for( nValue = 0; nValue < aValues2.getLength(); nValue++, pValues2++ )
+ {
+ if( pValues2->Name.equalsAscii( "Extensions" ) )
+ {
+ Sequence< OUString > aExtensions;
+ if( pValues2->Value >>= aExtensions )
+ {
+ const sal_Int32 nCount( aExtensions.getLength() );
+ OUString* pExtensions = aExtensions.getArray();
+ sal_Int32 n;
+ for( n = 0; n < nCount; n++ )
+ {
+ if( n > 0 )
+ aExtension += OUString( sal_Unicode(';') );
+ aExtension += OUString::createFromAscii("*.");
+ aExtension += (*pExtensions++);
+ }
+ }
+ }
+ }
+
+ String aExtensions( aExtension );
+ String aFilterName( aInterfaceName );
+ aFilterName += String( RTL_CONSTASCII_USTRINGPARAM(" (") );
+ aFilterName += aExtensions;
+ aFilterName += sal_Unicode(')');
+
+ aDlg.AddFilter( aFilterName, aExtensions );
+
+ if( (nFlags & 0x100) == 0x100 )
+ aDlg.SetCurrentFilter( aFilterName );
+ }
+ }
+ }
+
+ }
+ }
+
+ aDlg.SetDisplayDirectory( maExportRecentFile );
+
+ if ( aDlg.Execute() == ERRCODE_NONE )
+ {
+ maExportRecentFile = aDlg.GetPath();
+
+ Reference< XComponentLoader > xLoader( mxMSF->createInstance( OUString::createFromAscii( "com.sun.star.frame.Desktop" ) ), UNO_QUERY );
+ Reference< XInteractionHandler > xInter( mxMSF->createInstance( OUString::createFromAscii( "com.sun.star.task.InteractionHandler" ) ), UNO_QUERY );
+ if( xLoader.is() && xInter.is() )
+ {
+ OUString aFrame( RTL_CONSTASCII_USTRINGPARAM( "_default" ) );
+ Sequence< PropertyValue > aArguments(1);
+ aArguments[0].Name = OUString::createFromAscii( "InteractionHandler" );
+ aArguments[0].Value <<= xInter;
+ Reference< XComponent > xComp( xLoader->loadComponentFromURL( maExportRecentFile, aFrame, 0, aArguments ) );
+ if( xComp.is() )
+ {
+ doExport( xComp );
+ }
+ }
+ }
+ }
+ catch(Exception&)
+ {
+ DBG_ERROR("XMLFilterTestDialog::onExportBrowse exception caught!");
+ }
+
+ initDialog();
+}
+
+void XMLFilterTestDialog::onExportCurrentDocument()
+{
+ doExport( getFrontMostDocument( mpFilterInfo->maDocumentService ) );
+}
+
+void XMLFilterTestDialog::doExport( Reference< XComponent > xComp )
+{
+ try
+ {
+ Reference< XStorable > xStorable( xComp, UNO_QUERY );
+ if( xStorable.is() )
+ {
+ utl::TempFile aTempFile;
+ OUString aTempFileURL( aTempFile.GetURL() );
+
+ const application_info_impl* pAppInfo = getApplicationInfo( mpFilterInfo->maExportService );
+ if( pAppInfo )
+ {
+ File aOutputFile( aTempFileURL );
+ /* File::RC rc = */ aOutputFile.open( OpenFlag_Write );
+
+ // create xslt exporter
+ Reference< XOutputStream > xIS( new comphelper::OSLOutputStreamWrapper( aOutputFile ) );
+
+ int bUseDTD = (mpFilterInfo->maDTD.getLength() != 0) ? 1 : 0 ;
+ int bUseDocType = (mpFilterInfo->maDocType.getLength() != 0 ) ? 1 : 0;
+ Sequence< PropertyValue > aSourceData( 2 + bUseDTD + bUseDocType );
+ int i = 0;
+
+ aSourceData[i ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "OutputStream" ) );
+ aSourceData[i++].Value <<= xIS;
+
+ aSourceData[i].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Indent" ) );
+ aSourceData[i++].Value <<= (sal_Bool)sal_True;
+
+ if( bUseDTD )
+ {
+ aSourceData[i ].Name = OUString(RTL_CONSTASCII_USTRINGPARAM("DocType_System"));
+ aSourceData[i++].Value <<= mpFilterInfo->maDTD;
+ }
+
+ if( bUseDocType )
+ {
+ aSourceData[i ].Name = OUString(RTL_CONSTASCII_USTRINGPARAM("DocType_Public"));
+ aSourceData[i++].Value <<= mpFilterInfo->maDocType;
+ }
+
+ Reference< XExportFilter > xExporter( mxMSF->createInstance( OUString::createFromAscii( "com.sun.star.documentconversion.XSLTFilter" ) ), UNO_QUERY );
+ Reference< XDocumentHandler > xHandler( xExporter, UNO_QUERY );
+ if( xHandler.is() )
+ {
+ Sequence< OUString > aFilterUserData( mpFilterInfo->getFilterUserData() );
+ xExporter->exporter( aSourceData, aFilterUserData );
+
+ Reference< XMultiServiceFactory > xDocFac( xComp, UNO_QUERY );
+
+ Reference< XEmbeddedObjectResolver > xObjectResolver;
+ Reference< XGraphicObjectResolver > xGrfResolver;
+
+ if( xDocFac.is() )
+ {
+ try
+ {
+ xGrfResolver = Reference< XGraphicObjectResolver >::query( xDocFac->createInstance( OUString::createFromAscii("com.sun.star.document.ExportGraphicObjectResolver") ) );
+ xObjectResolver = Reference< XEmbeddedObjectResolver >::query( xDocFac->createInstance( OUString::createFromAscii("com.sun.star.document.ExportEmbeddedObjectResolver") ) );
+ }
+ catch( Exception& )
+ {
+ }
+ }
+
+ Sequence< Any > aArgs( 1 + ( xGrfResolver.is() ? 1 : 0 ) + ( xObjectResolver.is() ? 1 : 0 ) );
+ Any* pArgs = aArgs.getArray();
+ if( xGrfResolver.is() ) *pArgs++ <<= xGrfResolver;
+ if( xObjectResolver.is() ) *pArgs++ <<= xObjectResolver;
+
+ // *pArgs++ <<= xInfoSet;
+ *pArgs <<= xHandler;
+
+ Reference< XFilter > xFilter( mxMSF->createInstanceWithArguments( pAppInfo->maXMLExporter, aArgs ), UNO_QUERY );
+ if( xFilter.is() )
+ {
+ Reference< XExporter > xExporter2( xFilter, UNO_QUERY );
+ if( xExporter2.is() )
+ {
+ xExporter2->setSourceDocument( xComp );
+
+ Sequence< PropertyValue > aDescriptor( 1 );
+ aDescriptor[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "FileName" ) );
+ aDescriptor[0].Value <<= aTempFileURL;
+
+ if( xFilter->filter( aDescriptor ) )
+ displayXMLFile( aTempFileURL );
+ }
+ }
+ }
+ }
+ }
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR( "XMLFilterTestDialog::doExport exception catched!" );
+ }
+}
+
+void XMLFilterTestDialog::displayXMLFile( const OUString& rURL )
+{
+ if( NULL == mpSourceDLG )
+ mpSourceDLG = new XMLSourceFileDialog( NULL, mrResMgr, mxMSF );
+
+ mpSourceDLG->ShowWindow( rURL, mpFilterInfo);
+}
+
+void XMLFilterTestDialog::onImportBrowse()
+{
+ // Open Fileopen-Dialog
+ ::sfx2::FileDialogHelper aDlg(
+ com::sun::star::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, 0 );
+ String aFilterName( mpFilterInfo->maInterfaceName );
+ String aExtensions;
+
+ int nLastIndex = 0;
+ int nCurrentIndex = 0;
+ for( int i = 0; nLastIndex != -1; i++ )
+ {
+ nLastIndex = mpFilterInfo->maExtension.indexOf( sal_Unicode( ';' ), nLastIndex );
+
+ if( i > 0 )
+ aExtensions += ';';
+
+ aExtensions += String( RTL_CONSTASCII_STRINGPARAM("*.") );
+
+ if( nLastIndex == -1 )
+ {
+
+ aExtensions += String( mpFilterInfo->maExtension.copy( nCurrentIndex ) );
+ }
+ else
+ {
+ aExtensions += String( mpFilterInfo->maExtension.copy( nCurrentIndex, nLastIndex - nCurrentIndex ) );
+ nCurrentIndex = nLastIndex + 1;
+ nLastIndex = nCurrentIndex;
+ }
+ }
+
+ aFilterName += String( RTL_CONSTASCII_USTRINGPARAM( " (" ) );
+ aFilterName += aExtensions;
+ aFilterName += sal_Unicode(')');
+
+ aDlg.AddFilter( aFilterName, aExtensions );
+ aDlg.SetDisplayDirectory( maImportRecentFile );
+
+ if ( aDlg.Execute() == ERRCODE_NONE )
+ {
+ maImportRecentFile = aDlg.GetPath();
+ import( maImportRecentFile );
+ }
+
+ initDialog();
+}
+
+void XMLFilterTestDialog::onImportRecentDocument()
+{
+ import( maImportRecentFile );
+}
+
+void XMLFilterTestDialog::import( const OUString& rURL )
+{
+ try
+ {
+ Reference< XComponentLoader > xLoader( mxMSF->createInstance( OUString::createFromAscii( "com.sun.star.frame.Desktop" ) ), UNO_QUERY );
+ Reference< XInteractionHandler > xInter( mxMSF->createInstance( OUString::createFromAscii( "com.sun.star.task.InteractionHandler" ) ), UNO_QUERY );
+ if( xLoader.is() && xInter.is() )
+ {
+
+ OUString aFrame( RTL_CONSTASCII_USTRINGPARAM( "_default" ) );
+ Sequence< PropertyValue > aArguments(2);
+ aArguments[0].Name = OUString::createFromAscii( "FilterName" );
+ aArguments[0].Value <<= mpFilterInfo->maFilterName;
+ aArguments[1].Name = OUString::createFromAscii( "InteractionHandler" );
+ aArguments[1].Value <<= xInter;
+
+ xLoader->loadComponentFromURL( rURL, aFrame, 0, aArguments );
+ }
+
+ if( maCBXDisplaySource.IsChecked() )
+ {
+ TempFile aTempFile;
+ OUString aTempFileURL( aTempFile.GetURL() );
+
+ Reference< XImportFilter > xImporter( mxMSF->createInstance( OUString::createFromAscii( "com.sun.star.documentconversion.XSLTFilter" ) ), UNO_QUERY );
+ if( xImporter.is() )
+ {
+ osl::File aInputFile( rURL );
+ osl::File::RC rc = aInputFile.open( OpenFlag_Read );
+
+ Reference< XInputStream > xIS( new comphelper::OSLInputStreamWrapper( aInputFile ) );
+
+ Sequence< PropertyValue > aSourceData( 5 );
+ int i = 0;
+
+ aSourceData[i ].Name = OUString::createFromAscii( "InputStream" );
+ aSourceData[i++].Value <<= xIS;
+
+ aSourceData[i ].Name = OUString::createFromAscii( "FileName" );
+ aSourceData[i++].Value <<= rURL;
+
+ aSourceData[i ].Name = OUString::createFromAscii( "Indent" );
+ aSourceData[i++].Value <<= (sal_Bool)sal_True;
+
+ aSourceData[i ].Name = OUString::createFromAscii("DocType_Public");
+ aSourceData[i++].Value <<= OUString::createFromAscii("-//OpenOffice.org//DTD OfficeDocument 1.0//EN");
+
+ aSourceData[i ].Name = OUString::createFromAscii("DocType_System");
+ aSourceData[i++].Value <<= sDTDPath;
+
+ Reference< XDocumentHandler > xWriter( mxMSF->createInstance( OUString::createFromAscii( "com.sun.star.xml.sax.Writer" ) ), UNO_QUERY );
+
+ File aOutputFile( aTempFileURL );
+ rc = aOutputFile.open( OpenFlag_Write );
+
+ Reference< XOutputStream > xOS( new OSLOutputStreamWrapper( aOutputFile ) );
+ Reference< XActiveDataSource > xDocSrc( xWriter, UNO_QUERY );
+ xDocSrc->setOutputStream( xOS );
+
+ Sequence< OUString > aFilterUserData( mpFilterInfo->getFilterUserData() );
+ xImporter->importer( aSourceData, xWriter, aFilterUserData );
+ }
+
+ displayXMLFile( aTempFileURL );
+ }
+ }
+ catch(Exception&)
+ {
+ DBG_ERROR("XMLFilterTestDialog::import catched an exception" );
+ }
+}
+
+IMPL_LINK(XMLFilterTestDialog, ClickHdl_Impl, PushButton *, pButton )
+{
+ if( &maPBExportBrowse == pButton )
+ {
+ onExportBrowse();
+ }
+ else if( &maPBCurrentDocument == pButton )
+ {
+ onExportCurrentDocument();
+ }
+ else if( &maPBImportBrowse == pButton )
+ {
+ onImportBrowse();
+ }
+ else if( &maPBRecentDocument == pButton )
+ {
+ onImportRecentDocument();
+ }
+ else if( &maPBClose == pButton )
+ {
+ Close();
+ }
+
+ return 0;
+}
+
+/** returns the front most open component that supports the given service */
+Reference< XComponent > XMLFilterTestDialog::getFrontMostDocument( const OUString& rServiceName )
+{
+ Reference< XComponent > xRet;
+
+ try
+ {
+ Reference< XDesktop > xDesktop( mxMSF->createInstance( OUString::createFromAscii( "com.sun.star.frame.Desktop" ) ), UNO_QUERY );
+ if( xDesktop.is() )
+ {
+ Reference< XComponent > xTest( mxLastFocusModel );
+ if( checkComponent( xTest, rServiceName ) )
+ {
+ xRet = xTest;
+ }
+ else
+ {
+ xTest = (Reference< XComponent >)xDesktop->getCurrentComponent();
+
+ if( checkComponent( xTest, rServiceName ) )
+ {
+ xRet = xTest;
+ }
+ else
+ {
+ Reference< XEnumerationAccess > xAccess( xDesktop->getComponents() );
+ if( xAccess.is() )
+ {
+ Reference< XEnumeration > xEnum( xAccess->createEnumeration() );
+ if( xEnum.is() )
+ {
+ while( xEnum->hasMoreElements() )
+ {
+ if( (xEnum->nextElement() >>= xTest) && xTest.is() )
+ {
+ if( checkComponent( xTest, rServiceName ) )
+ {
+ xRet = xTest;
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR( "XMLFilterTestDialog::getFrontMostDocument exception catched!" );
+ }
+
+ return xRet;
+}
diff --git a/filter/source/xsltdialog/xmlfiltertestdialog.hrc b/filter/source/xsltdialog/xmlfiltertestdialog.hrc
new file mode 100644
index 000000000000..49a2faeb5479
--- /dev/null
+++ b/filter/source/xsltdialog/xmlfiltertestdialog.hrc
@@ -0,0 +1,53 @@
+/*************************************************************************
+ *
+ * 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 _XMLFILTERTESTDIALOG_HRC_
+#define _XMLFILTERTESTDIALOG_HRC_
+
+#include "xmlfiltercommon.hrc"
+
+#define FL_EXPORT 1
+#define FT_EXPORT_XSLT 2
+#define FT_EXPORT_XSLT_FILE 3
+#define FT_TRANSFORM_DOCUMENT 4
+#define PB_EXPORT_BROWSE 5
+#define PB_CURRENT_DOCUMENT 6
+#define FT_NAME_OF_CURRENT_FILE 7
+#define FL_IMPORT 8
+#define FT_IMPORT_XSLT 9
+#define FT_IMPORT_XSLT_FILE 10
+#define FT_IMPORT_TEMPLATE 11
+#define FT_IMPORT_TEMPLATE_FILE 12
+#define FT_TRANSFORM_FILE 13
+#define CBX_DISPLAY_SOURCE 14
+#define PB_IMPORT_BROWSE 15
+#define PB_RECENT_DOCUMENT 16
+#define FT_NAME_OF_RECENT_FILE 17
+#define PB_HELP 18
+#define PB_CLOSE 19
+
+#endif
diff --git a/filter/source/xsltdialog/xmlfiltertestdialog.hxx b/filter/source/xsltdialog/xmlfiltertestdialog.hxx
new file mode 100644
index 000000000000..a287447937f2
--- /dev/null
+++ b/filter/source/xsltdialog/xmlfiltertestdialog.hxx
@@ -0,0 +1,107 @@
+/*************************************************************************
+ *
+ * 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 _XMLFILTERTESTDIALOG_HXX_
+#define _XMLFILTERTESTDIALOG_HXX_
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/document/XEventBroadcaster.hpp>
+#include <vcl/dialog.hxx>
+
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+#include <vcl/fixed.hxx>
+#include <svl/poolitem.hxx>
+
+class filter_info_impl;
+class XMLSourceFileDialog;
+
+class XMLFilterTestDialog : public ModalDialog
+{
+public:
+ XMLFilterTestDialog( Window* pParent, ResMgr& rResMgr, const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rxMSF );
+ virtual ~XMLFilterTestDialog();
+
+ void test( const filter_info_impl& rFilterInfo );
+
+ void updateCurrentDocumentButtonState( com::sun::star::uno::Reference< com::sun::star::lang::XComponent > * pRef = NULL );
+
+private:
+ DECL_LINK(ClickHdl_Impl, PushButton * );
+
+ void onExportBrowse();
+ void onExportCurrentDocument();
+ void onImportBrowse();
+ void onImportRecentDocument();
+ void initDialog();
+
+ com::sun::star::uno::Reference< com::sun::star::lang::XComponent > getFrontMostDocument( const rtl::OUString& rServiceName );
+ void import( const rtl::OUString& rURL );
+ void displayXMLFile( const rtl::OUString& rURL );
+ void doExport( com::sun::star::uno::Reference< com::sun::star::lang::XComponent > xComp );
+
+private:
+ com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > mxMSF;
+ com::sun::star::uno::Reference< com::sun::star::document::XEventBroadcaster > mxGlobalBroadcaster;
+ com::sun::star::uno::Reference< com::sun::star::document::XEventListener > mxGlobalEventListener;
+ com::sun::star::uno::WeakReference< com::sun::star::lang::XComponent > mxLastFocusModel;
+
+ ResMgr& mrResMgr;
+
+ rtl::OUString maImportRecentFile;
+ rtl::OUString maExportRecentFile;
+
+ FixedLine maFLExport;
+ FixedText maFTExportXSLT;
+ FixedText maFTExportXSLTFile;
+ FixedText maFTTransformDocument;
+ PushButton maPBExportBrowse;
+ PushButton maPBCurrentDocument;
+ FixedText maFTNameOfCurentFile;
+ FixedLine maFLImport;
+ FixedText maFTImportXSLT;
+ FixedText maFTImportXSLTFile;
+ FixedText maFTImportTemplate;
+ FixedText maFTImportTemplateFile;
+ FixedText maFTTransformFile;
+ CheckBox maCBXDisplaySource;
+ PushButton maPBImportBrowse;
+ PushButton maPBRecentDocument;
+ FixedText maFTNameOfRecentFile;
+ PushButton maPBClose;
+ HelpButton maPBHelp;
+
+ XMLSourceFileDialog* mpSourceDLG;
+ filter_info_impl* mpFilterInfo;
+
+ String maDialogTitle;
+
+ ::rtl::OUString sDTDPath;
+};
+
+#endif
diff --git a/filter/source/xsltdialog/xmlfiltertestdialog.src b/filter/source/xsltdialog/xmlfiltertestdialog.src
new file mode 100644
index 000000000000..94127275c9bb
--- /dev/null
+++ b/filter/source/xsltdialog/xmlfiltertestdialog.src
@@ -0,0 +1,210 @@
+/*************************************************************************
+ *
+ * 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 "xmlfiltertestdialog.hrc"
+#include "xmlfilterhelpids.hrc"
+
+#define DIALOG_WIDTH 200
+#define DIALOG_HEIGHT 230
+
+#define SPACING 3
+
+#define FIRST_ROW_X 6
+#define FIRST_ROW_Y 6
+#define COLUMN_WIDTH ((DIALOG_WIDTH-(5*SPACING))/2)
+
+#define SECOND_ROW_X FIRST_ROW_X + COLUMN_WIDTH+SPACING
+
+#define FIXED_TEXT_OFFSET 3
+
+#define ROW_HEIGHT 14
+
+ModalDialog DLG_XML_FILTER_TEST_DIALOG
+{
+ HelpId = HID_XML_FILTER_TEST_DIALOG;
+ Size = MAP_APPFONT( DIALOG_WIDTH, DIALOG_HEIGHT );
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ Text [ en-US ] = "Test XML Filter: %s" ;
+
+ FixedLine FL_EXPORT
+ {
+ Pos = MAP_APPFONT( 4, FIRST_ROW_Y + 0 * ROW_HEIGHT + 0 * SPACING + FIXED_TEXT_OFFSET);
+ Size = MAP_APPFONT( DIALOG_WIDTH - 2*SPACING, 8 );
+ Text [ en-US ] = "Export";
+ };
+
+ FixedText FT_EXPORT_XSLT
+ {
+ Pos = MAP_APPFONT ( FIRST_ROW_X , FIRST_ROW_Y + 1 * ROW_HEIGHT + 1 * SPACING + FIXED_TEXT_OFFSET ) ;
+ Size = MAP_APPFONT ( COLUMN_WIDTH , 8 ) ;
+ Text [ en-US ] = "XSLT for export";
+ };
+
+ FixedText FT_EXPORT_XSLT_FILE
+ {
+ Pos = MAP_APPFONT ( SECOND_ROW_X , FIRST_ROW_Y + 1 * ROW_HEIGHT + 1 * SPACING + FIXED_TEXT_OFFSET ) ;
+ Size = MAP_APPFONT ( 2*COLUMN_WIDTH , 8 ) ;
+ HelpId = HID_XML_FILTER_TEST_EXPORT_XSLT_FILE;
+ };
+
+ FixedText FT_TRANSFORM_DOCUMENT
+ {
+ Pos = MAP_APPFONT ( FIRST_ROW_X , FIRST_ROW_Y + 2 * ROW_HEIGHT + 2 * SPACING + FIXED_TEXT_OFFSET ) ;
+ Size = MAP_APPFONT ( COLUMN_WIDTH , 8 ) ;
+ Text [ en-US ] = "Transform document";
+ };
+
+ PushButton PB_EXPORT_BROWSE
+ {
+ Pos = MAP_APPFONT ( SECOND_ROW_X , FIRST_ROW_Y + 2 * ROW_HEIGHT + 2 * SPACING ) ;
+ Size = MAP_APPFONT ( COLUMN_WIDTH , 14 ) ;
+ TabStop = TRUE ;
+ HelpId = HID_XML_FILTER_TEST_EXPORT_BROWSE;
+ Text [ en-US ] = "~Browse...";
+ };
+
+ PushButton PB_CURRENT_DOCUMENT
+ {
+ Pos = MAP_APPFONT ( SECOND_ROW_X , FIRST_ROW_Y + 3 * ROW_HEIGHT + 3 * SPACING ) ;
+ Size = MAP_APPFONT ( COLUMN_WIDTH , 14 ) ;
+ HelpId = HID_XML_FILTER_TEST_EXPORT_CURRENT;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Current Document";
+ };
+
+ FixedText FT_NAME_OF_CURRENT_FILE
+ {
+ Pos = MAP_APPFONT ( FIRST_ROW_X , FIRST_ROW_Y + 4 * ROW_HEIGHT + 4 * SPACING + FIXED_TEXT_OFFSET ) ;
+ Size = MAP_APPFONT ( 2*COLUMN_WIDTH , 8 ) ;
+ HelpId = HID_XML_FILTER_TEST_EXPORT_CURRENT_FILE;
+ Right = TRUE;
+ };
+
+ // import ---------------------------------------------------------
+
+ FixedLine FL_IMPORT
+ {
+ Pos = MAP_APPFONT( 4, FIRST_ROW_Y + 5 * ROW_HEIGHT + 5 * SPACING + FIXED_TEXT_OFFSET );
+ Size = MAP_APPFONT( DIALOG_WIDTH - 2*SPACING, 8 );
+ Text [ en-US ] = "Import";
+ };
+
+ FixedText FT_IMPORT_XSLT
+ {
+ Pos = MAP_APPFONT ( FIRST_ROW_X , FIRST_ROW_Y + 6 * ROW_HEIGHT + 6 * SPACING + FIXED_TEXT_OFFSET ) ;
+ Size = MAP_APPFONT ( COLUMN_WIDTH , 8 ) ;
+ Text [ en-US ] = "XSLT for import";
+ };
+
+ FixedText FT_IMPORT_XSLT_FILE
+ {
+ Pos = MAP_APPFONT ( SECOND_ROW_X , FIRST_ROW_Y + 6 * ROW_HEIGHT + 6 * SPACING + FIXED_TEXT_OFFSET ) ;
+ Size = MAP_APPFONT ( 2*COLUMN_WIDTH , 8 ) ;
+ HelpId = HID_XML_FILTER_TEST_IMPORT_XSLT_FILE;
+ };
+
+ FixedText FT_IMPORT_TEMPLATE
+ {
+ Pos = MAP_APPFONT ( FIRST_ROW_X , FIRST_ROW_Y + 7 * ROW_HEIGHT + 7 * SPACING + FIXED_TEXT_OFFSET ) ;
+ Size = MAP_APPFONT ( COLUMN_WIDTH , 8 ) ;
+ Text [ en-US ] = "Template for import";
+ };
+
+ FixedText FT_IMPORT_TEMPLATE_FILE
+ {
+ Pos = MAP_APPFONT ( SECOND_ROW_X , FIRST_ROW_Y + 7 * ROW_HEIGHT + 7 * SPACING + FIXED_TEXT_OFFSET ) ;
+ Size = MAP_APPFONT ( 2*COLUMN_WIDTH , 8 ) ;
+ HelpId = HID_XML_FILTER_TEST_IMPORT_TEMPLATE_FILE;
+ };
+
+ FixedText FT_TRANSFORM_FILE
+ {
+ Pos = MAP_APPFONT ( FIRST_ROW_X , FIRST_ROW_Y + 8 * ROW_HEIGHT + 8 * SPACING + FIXED_TEXT_OFFSET ) ;
+ Size = MAP_APPFONT ( COLUMN_WIDTH , 8 ) ;
+ Text [ en-US ] = "Transform file";
+ };
+
+ CheckBox CBX_DISPLAY_SOURCE
+ {
+ Pos = MAP_APPFONT ( SECOND_ROW_X , FIRST_ROW_Y + 8 * ROW_HEIGHT + 8 * SPACING + 1 ) ;
+ Size = MAP_APPFONT ( COLUMN_WIDTH , 10 ) ;
+ HelpId = HID_XML_FILTER_TEST_IMPORT_DISPLAY_SOURCE;
+ Text [ en-US ] = "~Display source";
+ };
+
+ PushButton PB_IMPORT_BROWSE
+ {
+ Pos = MAP_APPFONT ( SECOND_ROW_X , FIRST_ROW_Y + 9 * ROW_HEIGHT + 9 * SPACING ) ;
+ Size = MAP_APPFONT ( COLUMN_WIDTH , 14 ) ;
+ HelpId = HID_XML_FILTER_TEST_IMPORT_BROWSE;
+ TabStop = TRUE ;
+ Text [ en-US ] = "B~rowse...";
+ };
+
+ PushButton PB_RECENT_DOCUMENT
+ {
+ Pos = MAP_APPFONT ( SECOND_ROW_X , FIRST_ROW_Y + 10 * ROW_HEIGHT + 10 * SPACING ) ;
+ Size = MAP_APPFONT ( COLUMN_WIDTH , 14 ) ;
+ HelpId = HID_XML_FILTER_TEST_IMPORT_RECENT;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Recent File";
+ };
+
+ FixedText FT_NAME_OF_RECENT_FILE
+ {
+ Pos = MAP_APPFONT ( FIRST_ROW_X , FIRST_ROW_Y + 11 * ROW_HEIGHT + 11 * SPACING + FIXED_TEXT_OFFSET ) ;
+ Size = MAP_APPFONT ( 2*COLUMN_WIDTH, 8 ) ;
+ HelpId = HID_XML_FILTER_TEST_IMPORT_RECENT_FILE;
+ Right = TRUE;
+ };
+
+ PushButton PB_CLOSE
+ {
+ Pos = MAP_APPFONT ( DIALOG_WIDTH - 2*50 - 2*6 , DIALOG_HEIGHT - 6 - 14 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ HelpId = HID_XML_FILTER_TEST_CLOSE;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Close";
+ };
+
+ HelpButton PB_HELP
+ {
+ Pos = MAP_APPFONT ( DIALOG_WIDTH - 1*50 - 1*6 , DIALOG_HEIGHT - 6 - 14 );
+ Size = MAP_APPFONT ( 50, 14 );
+ };
+};
+
+
+
+
+
+
+
+
diff --git a/filter/source/xsltfilter/Base64.java b/filter/source/xsltfilter/Base64.java
new file mode 100644
index 000000000000..1032282ea8a6
--- /dev/null
+++ b/filter/source/xsltfilter/Base64.java
@@ -0,0 +1,1833 @@
+/************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+/**
+ * <p>Encodes and decodes to and from Base64 notation.</p>
+ * <p>Homepage: <a href="http://iharder.net/base64">http://iharder.net/base64</a>.</p>
+ *
+ * <p>The <tt>options</tt> parameter, which appears in a few places, is used to pass
+ * several pieces of information to the encoder. In the "higher level" methods such as
+ * encodeBytes( bytes, options ) the options parameter can be used to indicate such
+ * things as first gzipping the bytes before encoding them, not inserting linefeeds
+ * (though that breaks strict Base64 compatibility), and encoding using the URL-safe
+ * and Ordered dialects.</p>
+ *
+ * <p>The constants defined in Base64 can be OR-ed together to combine options, so you
+ * might make a call like this:</p>
+ *
+ * <code>String encoded = Base64.encodeBytes( mybytes, Base64.GZIP | Base64.DONT_BREAK_LINES );</code>
+ *
+ * <p>to compress the data before encoding it and then making the output have no newline characters.</p>
+ *
+ *
+ * <p>
+ * Change Log:
+ * </p>
+ * <ul>
+ * <li>v2.2.2 - Fixed encodeFileToFile and decodeFileToFile to use the
+ * Base64.InputStream class to encode and decode on the fly which uses
+ * less memory than encoding/decoding an entire file into memory before writing.</li>
+ * <li>v2.2.1 - Fixed bug using URL_SAFE and ORDERED encodings. Fixed bug
+ * when using very small files (~< 40 bytes).</li>
+ * <li>v2.2 - Added some helper methods for encoding/decoding directly from
+ * one file to the next. Also added a main() method to support command line
+ * encoding/decoding from one file to the next. Also added these Base64 dialects:
+ * <ol>
+ * <li>The default is RFC3548 format.</li>
+ * <li>Calling Base64.setFormat(Base64.BASE64_FORMAT.URLSAFE_FORMAT) generates
+ * URL and file name friendly format as described in Section 4 of RFC3548.
+ * http://www.faqs.org/rfcs/rfc3548.html</li>
+ * <li>Calling Base64.setFormat(Base64.BASE64_FORMAT.ORDERED_FORMAT) generates
+ * URL and file name friendly format that preserves lexical ordering as described
+ * in http://www.faqs.org/qa/rfcc-1940.html</li>
+ * </ol>
+ * Special thanks to Jim Kellerman at <a href="http://www.powerset.com/">http://www.powerset.com/</a>
+ * for contributing the new Base64 dialects.
+ * </li>
+ *
+ * <li>v2.1 - Cleaned up javadoc comments and unused variables and methods. Added
+ * some convenience methods for reading and writing to and from files.</li>
+ * <li>v2.0.2 - Now specifies UTF-8 encoding in places where the code fails on systems
+ * with other encodings (like EBCDIC).</li>
+ * <li>v2.0.1 - Fixed an error when decoding a single byte, that is, when the
+ * encoded data was a single byte.</li>
+ * <li>v2.0 - I got rid of methods that used booleans to set options.
+ * Now everything is more consolidated and cleaner. The code now detects
+ * when data that's being decoded is gzip-compressed and will decompress it
+ * automatically. Generally things are cleaner. You'll probably have to
+ * change some method calls that you were making to support the new
+ * options format (<tt>int</tt>s that you "OR" together).</li>
+ * <li>v1.5.1 - Fixed bug when decompressing and decoding to a
+ * byte[] using <tt>decode( String s, boolean gzipCompressed )</tt>.
+ * Added the ability to "suspend" encoding in the Output Stream so
+ * you can turn on and off the encoding if you need to embed base64
+ * data in an otherwise "normal" stream (like an XML file).</li>
+ * <li>v1.5 - Output stream pases on flush() command but doesn't do anything itself.
+ * This helps when using GZIP streams.
+ * Added the ability to GZip-compress objects before encoding them.</li>
+ * <li>v1.4 - Added helper methods to read/write files.</li>
+ * <li>v1.3.6 - Fixed OutputStream.flush() so that 'position' is reset.</li>
+ * <li>v1.3.5 - Added flag to turn on and off line breaks. Fixed bug in input stream
+ * where last buffer being read, if not completely full, was not returned.</li>
+ * <li>v1.3.4 - Fixed when "improperly padded stream" error was thrown at the wrong time.</li>
+ * <li>v1.3.3 - Fixed I/O streams which were totally messed up.</li>
+ * </ul>
+ *
+ * <p>
+ * I am placing this code in the Public Domain. Do with it as you will.
+ * This software comes with no guarantees or warranties but with
+ * plenty of well-wishing instead!
+ * Please visit <a href="http://iharder.net/base64">http://iharder.net/base64</a>
+ * periodically to check for updates or to contribute improvements.
+ * </p>
+ *
+ * @author Robert Harder
+ * @author rob@iharder.net
+ * @version 2.2.2
+ */
+public class Base64
+{
+
+/* ******** P U B L I C F I E L D S ******** */
+
+
+ /** No options specified. Value is zero. */
+ public final static int NO_OPTIONS = 0;
+
+ /** Specify encoding. */
+ public final static int ENCODE = 1;
+
+
+ /** Specify decoding. */
+ public final static int DECODE = 0;
+
+
+ /** Specify that data should be gzip-compressed. */
+ public final static int GZIP = 2;
+
+
+ /** Don't break lines when encoding (violates strict Base64 specification) */
+ public final static int DONT_BREAK_LINES = 8;
+
+ /**
+ * Encode using Base64-like encoding that is URL- and Filename-safe as described
+ * in Section 4 of RFC3548:
+ * <a href="http://www.faqs.org/rfcs/rfc3548.html">http://www.faqs.org/rfcs/rfc3548.html</a>.
+ * It is important to note that data encoded this way is <em>not</em> officially valid Base64,
+ * or at the very least should not be called Base64 without also specifying that is
+ * was encoded using the URL- and Filename-safe dialect.
+ */
+ public final static int URL_SAFE = 16;
+
+
+ /**
+ * Encode using the special "ordered" dialect of Base64 described here:
+ * <a href="http://www.faqs.org/qa/rfcc-1940.html">http://www.faqs.org/qa/rfcc-1940.html</a>.
+ */
+ public final static int ORDERED = 32;
+
+
+/* ******** P R I V A T E F I E L D S ******** */
+
+
+ /** Maximum line length (76) of Base64 output. */
+ private final static int MAX_LINE_LENGTH = 76;
+
+
+ /** The equals sign (=) as a byte. */
+ private final static byte EQUALS_SIGN = (byte)'=';
+
+
+ /** The new line character (\n) as a byte. */
+ private final static byte NEW_LINE = (byte)'\n';
+
+
+ /** Preferred encoding. */
+ private final static String PREFERRED_ENCODING = "UTF-8";
+
+
+ // I think I end up not using the BAD_ENCODING indicator.
+ //private final static byte BAD_ENCODING = -9; // Indicates error in encoding
+ private final static byte WHITE_SPACE_ENC = -5; // Indicates white space in encoding
+ private final static byte EQUALS_SIGN_ENC = -1; // Indicates equals sign in encoding
+
+
+/* ******** S T A N D A R D B A S E 6 4 A L P H A B E T ******** */
+
+ /** The 64 valid Base64 values. */
+ //private final static byte[] ALPHABET;
+ /* Host platform me be something funny like EBCDIC, so we hardcode these values. */
+ private final static byte[] _STANDARD_ALPHABET =
+ {
+ (byte)'A', (byte)'B', (byte)'C', (byte)'D', (byte)'E', (byte)'F', (byte)'G',
+ (byte)'H', (byte)'I', (byte)'J', (byte)'K', (byte)'L', (byte)'M', (byte)'N',
+ (byte)'O', (byte)'P', (byte)'Q', (byte)'R', (byte)'S', (byte)'T', (byte)'U',
+ (byte)'V', (byte)'W', (byte)'X', (byte)'Y', (byte)'Z',
+ (byte)'a', (byte)'b', (byte)'c', (byte)'d', (byte)'e', (byte)'f', (byte)'g',
+ (byte)'h', (byte)'i', (byte)'j', (byte)'k', (byte)'l', (byte)'m', (byte)'n',
+ (byte)'o', (byte)'p', (byte)'q', (byte)'r', (byte)'s', (byte)'t', (byte)'u',
+ (byte)'v', (byte)'w', (byte)'x', (byte)'y', (byte)'z',
+ (byte)'0', (byte)'1', (byte)'2', (byte)'3', (byte)'4', (byte)'5',
+ (byte)'6', (byte)'7', (byte)'8', (byte)'9', (byte)'+', (byte)'/'
+ };
+
+
+ /**
+ * Translates a Base64 value to either its 6-bit reconstruction value
+ * or a negative number indicating some other meaning.
+ **/
+ private final static byte[] _STANDARD_DECODABET =
+ {
+ -9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 0 - 8
+ -5,-5, // Whitespace: Tab and Linefeed
+ -9,-9, // Decimal 11 - 12
+ -5, // Whitespace: Carriage Return
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 14 - 26
+ -9,-9,-9,-9,-9, // Decimal 27 - 31
+ -5, // Whitespace: Space
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 33 - 42
+ 62, // Plus sign at decimal 43
+ -9,-9,-9, // Decimal 44 - 46
+ 63, // Slash at decimal 47
+ 52,53,54,55,56,57,58,59,60,61, // Numbers zero through nine
+ -9,-9,-9, // Decimal 58 - 60
+ -1, // Equals sign at decimal 61
+ -9,-9,-9, // Decimal 62 - 64
+ 0,1,2,3,4,5,6,7,8,9,10,11,12,13, // Letters 'A' through 'N'
+ 14,15,16,17,18,19,20,21,22,23,24,25, // Letters 'O' through 'Z'
+ -9,-9,-9,-9,-9,-9, // Decimal 91 - 96
+ 26,27,28,29,30,31,32,33,34,35,36,37,38, // Letters 'a' through 'm'
+ 39,40,41,42,43,44,45,46,47,48,49,50,51, // Letters 'n' through 'z'
+ -9,-9,-9,-9 // Decimal 123 - 126
+ /*,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 127 - 139
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 140 - 152
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 153 - 165
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 166 - 178
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 179 - 191
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 192 - 204
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 205 - 217
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 218 - 230
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 231 - 243
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9 // Decimal 244 - 255 */
+ };
+
+
+/* ******** U R L S A F E B A S E 6 4 A L P H A B E T ******** */
+
+ /**
+ * Used in the URL- and Filename-safe dialect described in Section 4 of RFC3548:
+ * <a href="http://www.faqs.org/rfcs/rfc3548.html">http://www.faqs.org/rfcs/rfc3548.html</a>.
+ * Notice that the last two bytes become "hyphen" and "underscore" instead of "plus" and "slash."
+ */
+ private final static byte[] _URL_SAFE_ALPHABET =
+ {
+ (byte)'A', (byte)'B', (byte)'C', (byte)'D', (byte)'E', (byte)'F', (byte)'G',
+ (byte)'H', (byte)'I', (byte)'J', (byte)'K', (byte)'L', (byte)'M', (byte)'N',
+ (byte)'O', (byte)'P', (byte)'Q', (byte)'R', (byte)'S', (byte)'T', (byte)'U',
+ (byte)'V', (byte)'W', (byte)'X', (byte)'Y', (byte)'Z',
+ (byte)'a', (byte)'b', (byte)'c', (byte)'d', (byte)'e', (byte)'f', (byte)'g',
+ (byte)'h', (byte)'i', (byte)'j', (byte)'k', (byte)'l', (byte)'m', (byte)'n',
+ (byte)'o', (byte)'p', (byte)'q', (byte)'r', (byte)'s', (byte)'t', (byte)'u',
+ (byte)'v', (byte)'w', (byte)'x', (byte)'y', (byte)'z',
+ (byte)'0', (byte)'1', (byte)'2', (byte)'3', (byte)'4', (byte)'5',
+ (byte)'6', (byte)'7', (byte)'8', (byte)'9', (byte)'-', (byte)'_'
+ };
+
+ /**
+ * Used in decoding URL- and Filename-safe dialects of Base64.
+ */
+ private final static byte[] _URL_SAFE_DECODABET =
+ {
+ -9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 0 - 8
+ -5,-5, // Whitespace: Tab and Linefeed
+ -9,-9, // Decimal 11 - 12
+ -5, // Whitespace: Carriage Return
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 14 - 26
+ -9,-9,-9,-9,-9, // Decimal 27 - 31
+ -5, // Whitespace: Space
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 33 - 42
+ -9, // Plus sign at decimal 43
+ -9, // Decimal 44
+ 62, // Minus sign at decimal 45
+ -9, // Decimal 46
+ -9, // Slash at decimal 47
+ 52,53,54,55,56,57,58,59,60,61, // Numbers zero through nine
+ -9,-9,-9, // Decimal 58 - 60
+ -1, // Equals sign at decimal 61
+ -9,-9,-9, // Decimal 62 - 64
+ 0,1,2,3,4,5,6,7,8,9,10,11,12,13, // Letters 'A' through 'N'
+ 14,15,16,17,18,19,20,21,22,23,24,25, // Letters 'O' through 'Z'
+ -9,-9,-9,-9, // Decimal 91 - 94
+ 63, // Underscore at decimal 95
+ -9, // Decimal 96
+ 26,27,28,29,30,31,32,33,34,35,36,37,38, // Letters 'a' through 'm'
+ 39,40,41,42,43,44,45,46,47,48,49,50,51, // Letters 'n' through 'z'
+ -9,-9,-9,-9 // Decimal 123 - 126
+ /*,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 127 - 139
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 140 - 152
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 153 - 165
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 166 - 178
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 179 - 191
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 192 - 204
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 205 - 217
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 218 - 230
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 231 - 243
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9 // Decimal 244 - 255 */
+ };
+
+
+
+/* ******** O R D E R E D B A S E 6 4 A L P H A B E T ******** */
+
+ /**
+ * I don't get the point of this technique, but it is described here:
+ * <a href="http://www.faqs.org/qa/rfcc-1940.html">http://www.faqs.org/qa/rfcc-1940.html</a>.
+ */
+ private final static byte[] _ORDERED_ALPHABET =
+ {
+ (byte)'-',
+ (byte)'0', (byte)'1', (byte)'2', (byte)'3', (byte)'4',
+ (byte)'5', (byte)'6', (byte)'7', (byte)'8', (byte)'9',
+ (byte)'A', (byte)'B', (byte)'C', (byte)'D', (byte)'E', (byte)'F', (byte)'G',
+ (byte)'H', (byte)'I', (byte)'J', (byte)'K', (byte)'L', (byte)'M', (byte)'N',
+ (byte)'O', (byte)'P', (byte)'Q', (byte)'R', (byte)'S', (byte)'T', (byte)'U',
+ (byte)'V', (byte)'W', (byte)'X', (byte)'Y', (byte)'Z',
+ (byte)'_',
+ (byte)'a', (byte)'b', (byte)'c', (byte)'d', (byte)'e', (byte)'f', (byte)'g',
+ (byte)'h', (byte)'i', (byte)'j', (byte)'k', (byte)'l', (byte)'m', (byte)'n',
+ (byte)'o', (byte)'p', (byte)'q', (byte)'r', (byte)'s', (byte)'t', (byte)'u',
+ (byte)'v', (byte)'w', (byte)'x', (byte)'y', (byte)'z'
+ };
+
+ /**
+ * Used in decoding the "ordered" dialect of Base64.
+ */
+ private final static byte[] _ORDERED_DECODABET =
+ {
+ -9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 0 - 8
+ -5,-5, // Whitespace: Tab and Linefeed
+ -9,-9, // Decimal 11 - 12
+ -5, // Whitespace: Carriage Return
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 14 - 26
+ -9,-9,-9,-9,-9, // Decimal 27 - 31
+ -5, // Whitespace: Space
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 33 - 42
+ -9, // Plus sign at decimal 43
+ -9, // Decimal 44
+ 0, // Minus sign at decimal 45
+ -9, // Decimal 46
+ -9, // Slash at decimal 47
+ 1,2,3,4,5,6,7,8,9,10, // Numbers zero through nine
+ -9,-9,-9, // Decimal 58 - 60
+ -1, // Equals sign at decimal 61
+ -9,-9,-9, // Decimal 62 - 64
+ 11,12,13,14,15,16,17,18,19,20,21,22,23, // Letters 'A' through 'M'
+ 24,25,26,27,28,29,30,31,32,33,34,35,36, // Letters 'N' through 'Z'
+ -9,-9,-9,-9, // Decimal 91 - 94
+ 37, // Underscore at decimal 95
+ -9, // Decimal 96
+ 38,39,40,41,42,43,44,45,46,47,48,49,50, // Letters 'a' through 'm'
+ 51,52,53,54,55,56,57,58,59,60,61,62,63, // Letters 'n' through 'z'
+ -9,-9,-9,-9 // Decimal 123 - 126
+ /*,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 127 - 139
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 140 - 152
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 153 - 165
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 166 - 178
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 179 - 191
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 192 - 204
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 205 - 217
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 218 - 230
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 231 - 243
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9 // Decimal 244 - 255 */
+ };
+
+
+/* ******** D E T E R M I N E W H I C H A L H A B E T ******** */
+
+
+ /**
+ * Returns one of the _SOMETHING_ALPHABET byte arrays depending on
+ * the options specified.
+ * It's possible, though silly, to specify ORDERED and URLSAFE
+ * in which case one of them will be picked, though there is
+ * no guarantee as to which one will be picked.
+ */
+ private final static byte[] getAlphabet( int options )
+ {
+ if( (options & URL_SAFE) == URL_SAFE ) return _URL_SAFE_ALPHABET;
+ else if( (options & ORDERED) == ORDERED ) return _ORDERED_ALPHABET;
+ else return _STANDARD_ALPHABET;
+
+ } // end getAlphabet
+
+
+ /**
+ * Returns one of the _SOMETHING_DECODABET byte arrays depending on
+ * the options specified.
+ * It's possible, though silly, to specify ORDERED and URL_SAFE
+ * in which case one of them will be picked, though there is
+ * no guarantee as to which one will be picked.
+ */
+ private final static byte[] getDecodabet( int options )
+ {
+ if( (options & URL_SAFE) == URL_SAFE ) return _URL_SAFE_DECODABET;
+ else if( (options & ORDERED) == ORDERED ) return _ORDERED_DECODABET;
+ else return _STANDARD_DECODABET;
+
+ } // end getAlphabet
+
+
+
+ /** Defeats instantiation. */
+ private Base64(){}
+
+
+ /**
+ * Encodes or decodes two files from the command line;
+ * <strong>feel free to delete this method (in fact you probably should)
+ * if you're embedding this code into a larger program.</strong>
+ */
+ public final static void main( String[] args )
+ {
+ if( args.length < 3 ){
+ usage("Not enough arguments.");
+ } // end if: args.length < 3
+ else {
+ String flag = args[0];
+ String infile = args[1];
+ String outfile = args[2];
+ if( flag.equals( "-e" ) ){
+ Base64.encodeFileToFile( infile, outfile );
+ } // end if: encode
+ else if( flag.equals( "-d" ) ) {
+ Base64.decodeFileToFile( infile, outfile );
+ } // end else if: decode
+ else {
+ usage( "Unknown flag: " + flag );
+ } // end else
+ } // end else
+ } // end main
+
+ /**
+ * Prints command line usage.
+ *
+ * @param msg A message to include with usage info.
+ */
+ private final static void usage( String msg )
+ {
+ System.err.println( msg );
+ System.err.println( "Usage: java Base64 -e|-d inputfile outputfile" );
+ } // end usage
+
+
+/* ******** E N C O D I N G M E T H O D S ******** */
+
+
+ /**
+ * Encodes up to the first three bytes of array <var>threeBytes</var>
+ * and returns a four-byte array in Base64 notation.
+ * The actual number of significant bytes in your array is
+ * given by <var>numSigBytes</var>.
+ * The array <var>threeBytes</var> needs only be as big as
+ * <var>numSigBytes</var>.
+ * Code can reuse a byte array by passing a four-byte array as <var>b4</var>.
+ *
+ * @param b4 A reusable byte array to reduce array instantiation
+ * @param threeBytes the array to convert
+ * @param numSigBytes the number of significant bytes in your array
+ * @return four byte array in Base64 notation.
+ * @since 1.5.1
+ */
+ private static byte[] encode3to4( byte[] b4, byte[] threeBytes, int numSigBytes, int options )
+ {
+ encode3to4( threeBytes, 0, numSigBytes, b4, 0, options );
+ return b4;
+ } // end encode3to4
+
+
+ /**
+ * <p>Encodes up to three bytes of the array <var>source</var>
+ * and writes the resulting four Base64 bytes to <var>destination</var>.
+ * The source and destination arrays can be manipulated
+ * anywhere along their length by specifying
+ * <var>srcOffset</var> and <var>destOffset</var>.
+ * This method does not check to make sure your arrays
+ * are large enough to accomodate <var>srcOffset</var> + 3 for
+ * the <var>source</var> array or <var>destOffset</var> + 4 for
+ * the <var>destination</var> array.
+ * The actual number of significant bytes in your array is
+ * given by <var>numSigBytes</var>.</p>
+ * <p>This is the lowest level of the encoding methods with
+ * all possible parameters.</p>
+ *
+ * @param source the array to convert
+ * @param srcOffset the index where conversion begins
+ * @param numSigBytes the number of significant bytes in your array
+ * @param destination the array to hold the conversion
+ * @param destOffset the index where output will be put
+ * @return the <var>destination</var> array
+ * @since 1.3
+ */
+ private static byte[] encode3to4(
+ byte[] source, int srcOffset, int numSigBytes,
+ byte[] destination, int destOffset, int options )
+ {
+ byte[] ALPHABET = getAlphabet( options );
+
+ // 1 2 3
+ // 01234567890123456789012345678901 Bit position
+ // --------000000001111111122222222 Array position from threeBytes
+ // --------| || || || | Six bit groups to index ALPHABET
+ // >>18 >>12 >> 6 >> 0 Right shift necessary
+ // 0x3f 0x3f 0x3f Additional AND
+
+ // Create buffer with zero-padding if there are only one or two
+ // significant bytes passed in the array.
+ // We have to shift left 24 in order to flush out the 1's that appear
+ // when Java treats a value as negative that is cast from a byte to an int.
+ int inBuff = ( numSigBytes > 0 ? ((source[ srcOffset ] << 24) >>> 8) : 0 )
+ | ( numSigBytes > 1 ? ((source[ srcOffset + 1 ] << 24) >>> 16) : 0 )
+ | ( numSigBytes > 2 ? ((source[ srcOffset + 2 ] << 24) >>> 24) : 0 );
+
+ switch( numSigBytes )
+ {
+ case 3:
+ destination[ destOffset ] = ALPHABET[ (inBuff >>> 18) ];
+ destination[ destOffset + 1 ] = ALPHABET[ (inBuff >>> 12) & 0x3f ];
+ destination[ destOffset + 2 ] = ALPHABET[ (inBuff >>> 6) & 0x3f ];
+ destination[ destOffset + 3 ] = ALPHABET[ (inBuff ) & 0x3f ];
+ return destination;
+
+ case 2:
+ destination[ destOffset ] = ALPHABET[ (inBuff >>> 18) ];
+ destination[ destOffset + 1 ] = ALPHABET[ (inBuff >>> 12) & 0x3f ];
+ destination[ destOffset + 2 ] = ALPHABET[ (inBuff >>> 6) & 0x3f ];
+ destination[ destOffset + 3 ] = EQUALS_SIGN;
+ return destination;
+
+ case 1:
+ destination[ destOffset ] = ALPHABET[ (inBuff >>> 18) ];
+ destination[ destOffset + 1 ] = ALPHABET[ (inBuff >>> 12) & 0x3f ];
+ destination[ destOffset + 2 ] = EQUALS_SIGN;
+ destination[ destOffset + 3 ] = EQUALS_SIGN;
+ return destination;
+
+ default:
+ return destination;
+ } // end switch
+ } // end encode3to4
+
+
+
+ /**
+ * Serializes an object and returns the Base64-encoded
+ * version of that serialized object. If the object
+ * cannot be serialized or there is another error,
+ * the method will return <tt>null</tt>.
+ * The object is not GZip-compressed before being encoded.
+ *
+ * @param serializableObject The object to encode
+ * @return The Base64-encoded object
+ * @since 1.4
+ */
+ public static String encodeObject( java.io.Serializable serializableObject )
+ {
+ return encodeObject( serializableObject, NO_OPTIONS );
+ } // end encodeObject
+
+
+
+ /**
+ * Serializes an object and returns the Base64-encoded
+ * version of that serialized object. If the object
+ * cannot be serialized or there is another error,
+ * the method will return <tt>null</tt>.
+ * <p>
+ * Valid options:<pre>
+ * GZIP: gzip-compresses object before encoding it.
+ * DONT_BREAK_LINES: don't break lines at 76 characters
+ * <i>Note: Technically, this makes your encoding non-compliant.</i>
+ * </pre>
+ * <p>
+ * Example: <code>encodeObject( myObj, Base64.GZIP )</code> or
+ * <p>
+ * Example: <code>encodeObject( myObj, Base64.GZIP | Base64.DONT_BREAK_LINES )</code>
+ *
+ * @param serializableObject The object to encode
+ * @param options Specified options
+ * @return The Base64-encoded object
+ * @see Base64#GZIP
+ * @see Base64#DONT_BREAK_LINES
+ * @since 2.0
+ */
+ public static String encodeObject( java.io.Serializable serializableObject, int options )
+ {
+ // Streams
+ java.io.ByteArrayOutputStream baos = null;
+ java.io.OutputStream b64os = null;
+ java.io.ObjectOutputStream oos = null;
+ java.util.zip.GZIPOutputStream gzos = null;
+
+ // Isolate options
+ int gzip = (options & GZIP);
+ int dontBreakLines = (options & DONT_BREAK_LINES);
+
+ try
+ {
+ // ObjectOutputStream -> (GZIP) -> Base64 -> ByteArrayOutputStream
+ baos = new java.io.ByteArrayOutputStream();
+ b64os = new Base64.OutputStream( baos, ENCODE | options );
+
+ // GZip?
+ if( gzip == GZIP )
+ {
+ gzos = new java.util.zip.GZIPOutputStream( b64os );
+ oos = new java.io.ObjectOutputStream( gzos );
+ } // end if: gzip
+ else
+ oos = new java.io.ObjectOutputStream( b64os );
+
+ oos.writeObject( serializableObject );
+ } // end try
+ catch( java.io.IOException e )
+ {
+ e.printStackTrace();
+ return null;
+ } // end catch
+ finally
+ {
+ try{ oos.close(); } catch( Exception e ){}
+ try{ gzos.close(); } catch( Exception e ){}
+ try{ b64os.close(); } catch( Exception e ){}
+ try{ baos.close(); } catch( Exception e ){}
+ } // end finally
+
+ // Return value according to relevant encoding.
+ try
+ {
+ return new String( baos.toByteArray(), PREFERRED_ENCODING );
+ } // end try
+ catch (java.io.UnsupportedEncodingException uue)
+ {
+ return new String( baos.toByteArray() );
+ } // end catch
+
+ } // end encode
+
+
+
+ /**
+ * Encodes a byte array into Base64 notation.
+ * Does not GZip-compress data.
+ *
+ * @param source The data to convert
+ * @since 1.4
+ */
+ public static String encodeBytes( byte[] source )
+ {
+ return encodeBytes( source, 0, source.length, NO_OPTIONS );
+ } // end encodeBytes
+
+
+
+ /**
+ * Encodes a byte array into Base64 notation.
+ * <p>
+ * Valid options:<pre>
+ * GZIP: gzip-compresses object before encoding it.
+ * DONT_BREAK_LINES: don't break lines at 76 characters
+ * <i>Note: Technically, this makes your encoding non-compliant.</i>
+ * </pre>
+ * <p>
+ * Example: <code>encodeBytes( myData, Base64.GZIP )</code> or
+ * <p>
+ * Example: <code>encodeBytes( myData, Base64.GZIP | Base64.DONT_BREAK_LINES )</code>
+ *
+ *
+ * @param source The data to convert
+ * @param options Specified options
+ * @see Base64#GZIP
+ * @see Base64#DONT_BREAK_LINES
+ * @since 2.0
+ */
+ public static String encodeBytes( byte[] source, int options )
+ {
+ return encodeBytes( source, 0, source.length, options );
+ } // end encodeBytes
+
+
+ /**
+ * Encodes a byte array into Base64 notation.
+ * Does not GZip-compress data.
+ *
+ * @param source The data to convert
+ * @param off Offset in array where conversion should begin
+ * @param len Length of data to convert
+ * @since 1.4
+ */
+ public static String encodeBytes( byte[] source, int off, int len )
+ {
+ return encodeBytes( source, off, len, NO_OPTIONS );
+ } // end encodeBytes
+
+
+
+ /**
+ * Encodes a byte array into Base64 notation.
+ * <p>
+ * Valid options:<pre>
+ * GZIP: gzip-compresses object before encoding it.
+ * DONT_BREAK_LINES: don't break lines at 76 characters
+ * <i>Note: Technically, this makes your encoding non-compliant.</i>
+ * </pre>
+ * <p>
+ * Example: <code>encodeBytes( myData, Base64.GZIP )</code> or
+ * <p>
+ * Example: <code>encodeBytes( myData, Base64.GZIP | Base64.DONT_BREAK_LINES )</code>
+ *
+ *
+ * @param source The data to convert
+ * @param off Offset in array where conversion should begin
+ * @param len Length of data to convert
+ * @param options Specified options
+ * @param options alphabet type is pulled from this (standard, url-safe, ordered)
+ * @see Base64#GZIP
+ * @see Base64#DONT_BREAK_LINES
+ * @since 2.0
+ */
+ public static String encodeBytes( byte[] source, int off, int len, int options )
+ {
+ // Isolate options
+ int dontBreakLines = ( options & DONT_BREAK_LINES );
+ int gzip = ( options & GZIP );
+
+ // Compress?
+ if( gzip == GZIP )
+ {
+ java.io.ByteArrayOutputStream baos = null;
+ java.util.zip.GZIPOutputStream gzos = null;
+ Base64.OutputStream b64os = null;
+
+
+ try
+ {
+ // GZip -> Base64 -> ByteArray
+ baos = new java.io.ByteArrayOutputStream();
+ b64os = new Base64.OutputStream( baos, ENCODE | options );
+ gzos = new java.util.zip.GZIPOutputStream( b64os );
+
+ gzos.write( source, off, len );
+ gzos.close();
+ } // end try
+ catch( java.io.IOException e )
+ {
+ e.printStackTrace();
+ return null;
+ } // end catch
+ finally
+ {
+ try{ gzos.close(); } catch( Exception e ){}
+ try{ b64os.close(); } catch( Exception e ){}
+ try{ baos.close(); } catch( Exception e ){}
+ } // end finally
+
+ // Return value according to relevant encoding.
+ try
+ {
+ return new String( baos.toByteArray(), PREFERRED_ENCODING );
+ } // end try
+ catch (java.io.UnsupportedEncodingException uue)
+ {
+ return new String( baos.toByteArray() );
+ } // end catch
+ } // end if: compress
+
+ // Else, don't compress. Better not to use streams at all then.
+ else
+ {
+ // Convert option to boolean in way that code likes it.
+ boolean breakLines = dontBreakLines == 0;
+
+ int len43 = len * 4 / 3;
+ byte[] outBuff = new byte[ ( len43 ) // Main 4:3
+ + ( (len % 3) > 0 ? 4 : 0 ) // Account for padding
+ + (breakLines ? ( len43 / MAX_LINE_LENGTH ) : 0) ]; // New lines
+ int d = 0;
+ int e = 0;
+ int len2 = len - 2;
+ int lineLength = 0;
+ for( ; d < len2; d+=3, e+=4 )
+ {
+ encode3to4( source, d+off, 3, outBuff, e, options );
+
+ lineLength += 4;
+ if( breakLines && lineLength == MAX_LINE_LENGTH )
+ {
+ outBuff[e+4] = NEW_LINE;
+ e++;
+ lineLength = 0;
+ } // end if: end of line
+ } // en dfor: each piece of array
+
+ if( d < len )
+ {
+ encode3to4( source, d+off, len - d, outBuff, e, options );
+ e += 4;
+ } // end if: some padding needed
+
+
+ // Return value according to relevant encoding.
+ try
+ {
+ return new String( outBuff, 0, e, PREFERRED_ENCODING );
+ } // end try
+ catch (java.io.UnsupportedEncodingException uue)
+ {
+ return new String( outBuff, 0, e );
+ } // end catch
+
+ } // end else: don't compress
+
+ } // end encodeBytes
+
+
+
+
+
+/* ******** D E C O D I N G M E T H O D S ******** */
+
+
+ /**
+ * Decodes four bytes from array <var>source</var>
+ * and writes the resulting bytes (up to three of them)
+ * to <var>destination</var>.
+ * The source and destination arrays can be manipulated
+ * anywhere along their length by specifying
+ * <var>srcOffset</var> and <var>destOffset</var>.
+ * This method does not check to make sure your arrays
+ * are large enough to accomodate <var>srcOffset</var> + 4 for
+ * the <var>source</var> array or <var>destOffset</var> + 3 for
+ * the <var>destination</var> array.
+ * This method returns the actual number of bytes that
+ * were converted from the Base64 encoding.
+ * <p>This is the lowest level of the decoding methods with
+ * all possible parameters.</p>
+ *
+ *
+ * @param source the array to convert
+ * @param srcOffset the index where conversion begins
+ * @param destination the array to hold the conversion
+ * @param destOffset the index where output will be put
+ * @param options alphabet type is pulled from this (standard, url-safe, ordered)
+ * @return the number of decoded bytes converted
+ * @since 1.3
+ */
+ private static int decode4to3( byte[] source, int srcOffset, byte[] destination, int destOffset, int options )
+ {
+ byte[] DECODABET = getDecodabet( options );
+
+ // Example: Dk==
+ if( source[ srcOffset + 2] == EQUALS_SIGN )
+ {
+ // Two ways to do the same thing. Don't know which way I like best.
+ //int outBuff = ( ( DECODABET[ source[ srcOffset ] ] << 24 ) >>> 6 )
+ // | ( ( DECODABET[ source[ srcOffset + 1] ] << 24 ) >>> 12 );
+ int outBuff = ( ( DECODABET[ source[ srcOffset ] ] & 0xFF ) << 18 )
+ | ( ( DECODABET[ source[ srcOffset + 1] ] & 0xFF ) << 12 );
+
+ destination[ destOffset ] = (byte)( outBuff >>> 16 );
+ return 1;
+ }
+
+ // Example: DkL=
+ else if( source[ srcOffset + 3 ] == EQUALS_SIGN )
+ {
+ // Two ways to do the same thing. Don't know which way I like best.
+ //int outBuff = ( ( DECODABET[ source[ srcOffset ] ] << 24 ) >>> 6 )
+ // | ( ( DECODABET[ source[ srcOffset + 1 ] ] << 24 ) >>> 12 )
+ // | ( ( DECODABET[ source[ srcOffset + 2 ] ] << 24 ) >>> 18 );
+ int outBuff = ( ( DECODABET[ source[ srcOffset ] ] & 0xFF ) << 18 )
+ | ( ( DECODABET[ source[ srcOffset + 1 ] ] & 0xFF ) << 12 )
+ | ( ( DECODABET[ source[ srcOffset + 2 ] ] & 0xFF ) << 6 );
+
+ destination[ destOffset ] = (byte)( outBuff >>> 16 );
+ destination[ destOffset + 1 ] = (byte)( outBuff >>> 8 );
+ return 2;
+ }
+
+ // Example: DkLE
+ else
+ {
+ try{
+ // Two ways to do the same thing. Don't know which way I like best.
+ //int outBuff = ( ( DECODABET[ source[ srcOffset ] ] << 24 ) >>> 6 )
+ // | ( ( DECODABET[ source[ srcOffset + 1 ] ] << 24 ) >>> 12 )
+ // | ( ( DECODABET[ source[ srcOffset + 2 ] ] << 24 ) >>> 18 )
+ // | ( ( DECODABET[ source[ srcOffset + 3 ] ] << 24 ) >>> 24 );
+ int outBuff = ( ( DECODABET[ source[ srcOffset ] ] & 0xFF ) << 18 )
+ | ( ( DECODABET[ source[ srcOffset + 1 ] ] & 0xFF ) << 12 )
+ | ( ( DECODABET[ source[ srcOffset + 2 ] ] & 0xFF ) << 6)
+ | ( ( DECODABET[ source[ srcOffset + 3 ] ] & 0xFF ) );
+
+
+ destination[ destOffset ] = (byte)( outBuff >> 16 );
+ destination[ destOffset + 1 ] = (byte)( outBuff >> 8 );
+ destination[ destOffset + 2 ] = (byte)( outBuff );
+
+ return 3;
+ }catch( Exception e){
+ System.out.println(""+source[srcOffset]+ ": " + ( DECODABET[ source[ srcOffset ] ] ) );
+ System.out.println(""+source[srcOffset+1]+ ": " + ( DECODABET[ source[ srcOffset + 1 ] ] ) );
+ System.out.println(""+source[srcOffset+2]+ ": " + ( DECODABET[ source[ srcOffset + 2 ] ] ) );
+ System.out.println(""+source[srcOffset+3]+ ": " + ( DECODABET[ source[ srcOffset + 3 ] ] ) );
+ return -1;
+ } // end catch
+ }
+ } // end decodeToBytes
+
+
+
+
+ /**
+ * Very low-level access to decoding ASCII characters in
+ * the form of a byte array. Does not support automatically
+ * gunzipping or any other "fancy" features.
+ *
+ * @param source The Base64 encoded data
+ * @param off The offset of where to begin decoding
+ * @param len The length of characters to decode
+ * @return decoded data
+ * @since 1.3
+ */
+ public static byte[] decode( byte[] source, int off, int len, int options )
+ {
+ byte[] DECODABET = getDecodabet( options );
+
+ int len34 = len * 3 / 4;
+ byte[] outBuff = new byte[ len34 ]; // Upper limit on size of output
+ int outBuffPosn = 0;
+
+ byte[] b4 = new byte[4];
+ int b4Posn = 0;
+ int i = 0;
+ byte sbiCrop = 0;
+ byte sbiDecode = 0;
+ for( i = off; i < off+len; i++ )
+ {
+ sbiCrop = (byte)(source[i] & 0x7f); // Only the low seven bits
+ sbiDecode = DECODABET[ sbiCrop ];
+
+ if( sbiDecode >= WHITE_SPACE_ENC ) // White space, Equals sign or better
+ {
+ if( sbiDecode >= EQUALS_SIGN_ENC )
+ {
+ b4[ b4Posn++ ] = sbiCrop;
+ if( b4Posn > 3 )
+ {
+ outBuffPosn += decode4to3( b4, 0, outBuff, outBuffPosn, options );
+ b4Posn = 0;
+
+ // If that was the equals sign, break out of 'for' loop
+ if( sbiCrop == EQUALS_SIGN )
+ break;
+ } // end if: quartet built
+
+ } // end if: equals sign or better
+
+ } // end if: white space, equals sign or better
+ else
+ {
+ System.err.println( "Bad Base64 input character at " + i + ": " + source[i] + "(decimal)" );
+ return null;
+ } // end else:
+ } // each input character
+
+ byte[] out = new byte[ outBuffPosn ];
+ System.arraycopy( outBuff, 0, out, 0, outBuffPosn );
+ return out;
+ } // end decode
+
+
+
+
+ /**
+ * Decodes data from Base64 notation, automatically
+ * detecting gzip-compressed data and decompressing it.
+ *
+ * @param s the string to decode
+ * @return the decoded data
+ * @since 1.4
+ */
+ public static byte[] decode( String s )
+ {
+ return decode( s, NO_OPTIONS );
+ }
+
+
+ /**
+ * Decodes data from Base64 notation, automatically
+ * detecting gzip-compressed data and decompressing it.
+ *
+ * @param s the string to decode
+ * @param options encode options such as URL_SAFE
+ * @return the decoded data
+ * @since 1.4
+ */
+ public static byte[] decode( String s, int options )
+ {
+ byte[] bytes;
+ try
+ {
+ bytes = s.getBytes( PREFERRED_ENCODING );
+ } // end try
+ catch( java.io.UnsupportedEncodingException uee )
+ {
+ bytes = s.getBytes();
+ } // end catch
+ //</change>
+
+ // Decode
+ bytes = decode( bytes, 0, bytes.length, options );
+
+
+ // Check to see if it's gzip-compressed
+ // GZIP Magic Two-Byte Number: 0x8b1f (35615)
+ if( bytes != null && bytes.length >= 4 )
+ {
+
+ int head = ((int)bytes[0] & 0xff) | ((bytes[1] << 8) & 0xff00);
+ if( java.util.zip.GZIPInputStream.GZIP_MAGIC == head )
+ {
+ java.io.ByteArrayInputStream bais = null;
+ java.util.zip.GZIPInputStream gzis = null;
+ java.io.ByteArrayOutputStream baos = null;
+ byte[] buffer = new byte[2048];
+ int length = 0;
+
+ try
+ {
+ baos = new java.io.ByteArrayOutputStream();
+ bais = new java.io.ByteArrayInputStream( bytes );
+ gzis = new java.util.zip.GZIPInputStream( bais );
+
+ while( ( length = gzis.read( buffer ) ) >= 0 )
+ {
+ baos.write(buffer,0,length);
+ } // end while: reading input
+
+ // No error? Get new bytes.
+ bytes = baos.toByteArray();
+
+ } // end try
+ catch( java.io.IOException e )
+ {
+ // Just return originally-decoded bytes
+ } // end catch
+ finally
+ {
+ try{ baos.close(); } catch( Exception e ){}
+ try{ gzis.close(); } catch( Exception e ){}
+ try{ bais.close(); } catch( Exception e ){}
+ } // end finally
+
+ } // end if: gzipped
+ } // end if: bytes.length >= 2
+
+ return bytes;
+ } // end decode
+
+
+
+
+ /**
+ * Attempts to decode Base64 data and deserialize a Java
+ * Object within. Returns <tt>null</tt> if there was an error.
+ *
+ * @param encodedObject The Base64 data to decode
+ * @return The decoded and deserialized object
+ * @since 1.5
+ */
+ public static Object decodeToObject( String encodedObject )
+ {
+ // Decode and gunzip if necessary
+ byte[] objBytes = decode( encodedObject );
+
+ java.io.ByteArrayInputStream bais = null;
+ java.io.ObjectInputStream ois = null;
+ Object obj = null;
+
+ try
+ {
+ bais = new java.io.ByteArrayInputStream( objBytes );
+ ois = new java.io.ObjectInputStream( bais );
+
+ obj = ois.readObject();
+ } // end try
+ catch( java.io.IOException e )
+ {
+ e.printStackTrace();
+ obj = null;
+ } // end catch
+ catch( java.lang.ClassNotFoundException e )
+ {
+ e.printStackTrace();
+ obj = null;
+ } // end catch
+ finally
+ {
+ try{ bais.close(); } catch( Exception e ){}
+ try{ ois.close(); } catch( Exception e ){}
+ } // end finally
+
+ return obj;
+ } // end decodeObject
+
+
+
+ /**
+ * Convenience method for encoding data to a file.
+ *
+ * @param dataToEncode byte array of data to encode in base64 form
+ * @param filename Filename for saving encoded data
+ * @return <tt>true</tt> if successful, <tt>false</tt> otherwise
+ *
+ * @since 2.1
+ */
+ public static boolean encodeToFile( byte[] dataToEncode, String filename )
+ {
+ boolean success = false;
+ Base64.OutputStream bos = null;
+ try
+ {
+ bos = new Base64.OutputStream(
+ new java.io.FileOutputStream( filename ), Base64.ENCODE );
+ bos.write( dataToEncode );
+ success = true;
+ } // end try
+ catch( java.io.IOException e )
+ {
+
+ success = false;
+ } // end catch: IOException
+ finally
+ {
+ try{ bos.close(); } catch( Exception e ){}
+ } // end finally
+
+ return success;
+ } // end encodeToFile
+
+
+ /**
+ * Convenience method for decoding data to a file.
+ *
+ * @param dataToDecode Base64-encoded data as a string
+ * @param filename Filename for saving decoded data
+ * @return <tt>true</tt> if successful, <tt>false</tt> otherwise
+ *
+ * @since 2.1
+ */
+ public static boolean decodeToFile( String dataToDecode, String filename )
+ {
+ boolean success = false;
+ Base64.OutputStream bos = null;
+ try
+ {
+ bos = new Base64.OutputStream(
+ new java.io.FileOutputStream( filename ), Base64.DECODE );
+ bos.write( dataToDecode.getBytes( PREFERRED_ENCODING ) );
+ success = true;
+ } // end try
+ catch( java.io.IOException e )
+ {
+ success = false;
+ } // end catch: IOException
+ finally
+ {
+ try{ bos.close(); } catch( Exception e ){}
+ } // end finally
+
+ return success;
+ } // end decodeToFile
+
+
+
+
+ /**
+ * Convenience method for reading a base64-encoded
+ * file and decoding it.
+ *
+ * @param filename Filename for reading encoded data
+ * @return decoded byte array or null if unsuccessful
+ *
+ * @since 2.1
+ */
+ public static byte[] decodeFromFile( String filename )
+ {
+ byte[] decodedData = null;
+ Base64.InputStream bis = null;
+ try
+ {
+ // Set up some useful variables
+ java.io.File file = new java.io.File( filename );
+ byte[] buffer = null;
+ int length = 0;
+ int numBytes = 0;
+
+ // Check for size of file
+ if( file.length() > Integer.MAX_VALUE )
+ {
+ System.err.println( "File is too big for this convenience method (" + file.length() + " bytes)." );
+ return null;
+ } // end if: file too big for int index
+ buffer = new byte[ (int)file.length() ];
+
+ // Open a stream
+ bis = new Base64.InputStream(
+ new java.io.BufferedInputStream(
+ new java.io.FileInputStream( file ) ), Base64.DECODE );
+
+ // Read until done
+ while( ( numBytes = bis.read( buffer, length, 4096 ) ) >= 0 )
+ length += numBytes;
+
+ // Save in a variable to return
+ decodedData = new byte[ length ];
+ System.arraycopy( buffer, 0, decodedData, 0, length );
+
+ } // end try
+ catch( java.io.IOException e )
+ {
+ System.err.println( "Error decoding from file " + filename );
+ } // end catch: IOException
+ finally
+ {
+ try{ bis.close(); } catch( Exception e) {}
+ } // end finally
+
+ return decodedData;
+ } // end decodeFromFile
+
+
+
+ /**
+ * Convenience method for reading a binary file
+ * and base64-encoding it.
+ *
+ * @param filename Filename for reading binary data
+ * @return base64-encoded string or null if unsuccessful
+ *
+ * @since 2.1
+ */
+ public static String encodeFromFile( String filename )
+ {
+ String encodedData = null;
+ Base64.InputStream bis = null;
+ try
+ {
+ // Set up some useful variables
+ java.io.File file = new java.io.File( filename );
+ byte[] buffer = new byte[ Math.max((int)(file.length() * 1.4),40) ]; // Need max() for math on small files (v2.2.1)
+ int length = 0;
+ int numBytes = 0;
+
+ // Open a stream
+ bis = new Base64.InputStream(
+ new java.io.BufferedInputStream(
+ new java.io.FileInputStream( file ) ), Base64.ENCODE );
+
+ // Read until done
+ while( ( numBytes = bis.read( buffer, length, 4096 ) ) >= 0 )
+ length += numBytes;
+
+ // Save in a variable to return
+ encodedData = new String( buffer, 0, length, Base64.PREFERRED_ENCODING );
+
+ } // end try
+ catch( java.io.IOException e )
+ {
+ System.err.println( "Error encoding from file " + filename );
+ } // end catch: IOException
+ finally
+ {
+ try{ bis.close(); } catch( Exception e) {}
+ } // end finally
+
+ return encodedData;
+ } // end encodeFromFile
+
+
+
+
+ /**
+ * Reads <tt>infile</tt> and encodes it to <tt>outfile</tt>.
+ *
+ * @param infile Input file
+ * @param outfile Output file
+ * @return true if the operation is successful
+ * @since 2.2
+ */
+ public static boolean encodeFileToFile( String infile, String outfile )
+ {
+ boolean success = false;
+ java.io.InputStream in = null;
+ java.io.OutputStream out = null;
+ try{
+ in = new Base64.InputStream(
+ new java.io.BufferedInputStream(
+ new java.io.FileInputStream( infile ) ),
+ Base64.ENCODE );
+ out = new java.io.BufferedOutputStream( new java.io.FileOutputStream( outfile ) );
+ byte[] buffer = new byte[65536]; // 64K
+ int read = -1;
+ while( ( read = in.read(buffer) ) >= 0 ){
+ out.write( buffer,0,read );
+ } // end while: through file
+ success = true;
+ } catch( java.io.IOException exc ){
+ exc.printStackTrace();
+ } finally{
+ try{ in.close(); } catch( Exception exc ){}
+ try{ out.close(); } catch( Exception exc ){}
+ } // end finally
+
+ return success;
+ } // end encodeFileToFile
+
+
+
+ /**
+ * Reads <tt>infile</tt> and decodes it to <tt>outfile</tt>.
+ *
+ * @param infile Input file
+ * @param outfile Output file
+ * @return true if the operation is successful
+ * @since 2.2
+ */
+ public static boolean decodeFileToFile( String infile, String outfile )
+ {
+ boolean success = false;
+ java.io.InputStream in = null;
+ java.io.OutputStream out = null;
+ try{
+ in = new Base64.InputStream(
+ new java.io.BufferedInputStream(
+ new java.io.FileInputStream( infile ) ),
+ Base64.DECODE );
+ out = new java.io.BufferedOutputStream( new java.io.FileOutputStream( outfile ) );
+ byte[] buffer = new byte[65536]; // 64K
+ int read = -1;
+ while( ( read = in.read(buffer) ) >= 0 ){
+ out.write( buffer,0,read );
+ } // end while: through file
+ success = true;
+ } catch( java.io.IOException exc ){
+ exc.printStackTrace();
+ } finally{
+ try{ in.close(); } catch( Exception exc ){}
+ try{ out.close(); } catch( Exception exc ){}
+ } // end finally
+
+ return success;
+ } // end decodeFileToFile
+
+
+ /* ******** I N N E R C L A S S I N P U T S T R E A M ******** */
+
+
+
+ /**
+ * A {@link Base64.InputStream} will read data from another
+ * <tt>java.io.InputStream</tt>, given in the constructor,
+ * and encode/decode to/from Base64 notation on the fly.
+ *
+ * @see Base64
+ * @since 1.3
+ */
+ public static class InputStream extends java.io.FilterInputStream
+ {
+ private boolean encode; // Encoding or decoding
+ private int position; // Current position in the buffer
+ private byte[] buffer; // Small buffer holding converted data
+ private int bufferLength; // Length of buffer (3 or 4)
+ private int numSigBytes; // Number of meaningful bytes in the buffer
+ private int lineLength;
+ private boolean breakLines; // Break lines at less than 80 characters
+ private int options; // Record options used to create the stream.
+ private byte[] alphabet; // Local copies to avoid extra method calls
+ private byte[] decodabet; // Local copies to avoid extra method calls
+
+
+ /**
+ * Constructs a {@link Base64.InputStream} in DECODE mode.
+ *
+ * @param in the <tt>java.io.InputStream</tt> from which to read data.
+ * @since 1.3
+ */
+ public InputStream( java.io.InputStream in )
+ {
+ this( in, DECODE );
+ } // end constructor
+
+
+ /**
+ * Constructs a {@link Base64.InputStream} in
+ * either ENCODE or DECODE mode.
+ * <p>
+ * Valid options:<pre>
+ * ENCODE or DECODE: Encode or Decode as data is read.
+ * DONT_BREAK_LINES: don't break lines at 76 characters
+ * (only meaningful when encoding)
+ * <i>Note: Technically, this makes your encoding non-compliant.</i>
+ * </pre>
+ * <p>
+ * Example: <code>new Base64.InputStream( in, Base64.DECODE )</code>
+ *
+ *
+ * @param in the <tt>java.io.InputStream</tt> from which to read data.
+ * @param options Specified options
+ * @see Base64#ENCODE
+ * @see Base64#DECODE
+ * @see Base64#DONT_BREAK_LINES
+ * @since 2.0
+ */
+ public InputStream( java.io.InputStream in, int options )
+ {
+ super( in );
+ this.breakLines = (options & DONT_BREAK_LINES) != DONT_BREAK_LINES;
+ this.encode = (options & ENCODE) == ENCODE;
+ this.bufferLength = encode ? 4 : 3;
+ this.buffer = new byte[ bufferLength ];
+ this.position = -1;
+ this.lineLength = 0;
+ this.options = options; // Record for later, mostly to determine which alphabet to use
+ this.alphabet = getAlphabet(options);
+ this.decodabet = getDecodabet(options);
+ } // end constructor
+
+ /**
+ * Reads enough of the input stream to convert
+ * to/from Base64 and returns the next byte.
+ *
+ * @return next byte
+ * @since 1.3
+ */
+ public int read() throws java.io.IOException
+ {
+ // Do we need to get data?
+ if( position < 0 )
+ {
+ if( encode )
+ {
+ byte[] b3 = new byte[3];
+ int numBinaryBytes = 0;
+ for( int i = 0; i < 3; i++ )
+ {
+ try
+ {
+ int b = in.read();
+
+ // If end of stream, b is -1.
+ if( b >= 0 )
+ {
+ b3[i] = (byte)b;
+ numBinaryBytes++;
+ } // end if: not end of stream
+
+ } // end try: read
+ catch( java.io.IOException e )
+ {
+ // Only a problem if we got no data at all.
+ if( i == 0 )
+ throw e;
+
+ } // end catch
+ } // end for: each needed input byte
+
+ if( numBinaryBytes > 0 )
+ {
+ encode3to4( b3, 0, numBinaryBytes, buffer, 0, options );
+ position = 0;
+ numSigBytes = 4;
+ } // end if: got data
+ else
+ {
+ return -1;
+ } // end else
+ } // end if: encoding
+
+ // Else decoding
+ else
+ {
+ byte[] b4 = new byte[4];
+ int i = 0;
+ for( i = 0; i < 4; i++ )
+ {
+ // Read four "meaningful" bytes:
+ int b = 0;
+ do{ b = in.read(); }
+ while( b >= 0 && decodabet[ b & 0x7f ] <= WHITE_SPACE_ENC );
+
+ if( b < 0 )
+ break; // Reads a -1 if end of stream
+
+ b4[i] = (byte)b;
+ } // end for: each needed input byte
+
+ if( i == 4 )
+ {
+ numSigBytes = decode4to3( b4, 0, buffer, 0, options );
+ position = 0;
+ } // end if: got four characters
+ else if( i == 0 ){
+ return -1;
+ } // end else if: also padded correctly
+ else
+ {
+ // Must have broken out from above.
+ throw new java.io.IOException( "Improperly padded Base64 input." );
+ } // end
+
+ } // end else: decode
+ } // end else: get data
+
+ // Got data?
+ if( position >= 0 )
+ {
+ // End of relevant data?
+ if( /*!encode &&*/ position >= numSigBytes )
+ return -1;
+
+ if( encode && breakLines && lineLength >= MAX_LINE_LENGTH )
+ {
+ lineLength = 0;
+ return '\n';
+ } // end if
+ else
+ {
+ lineLength++; // This isn't important when decoding
+ // but throwing an extra "if" seems
+ // just as wasteful.
+
+ int b = buffer[ position++ ];
+
+ if( position >= bufferLength )
+ position = -1;
+
+ return b & 0xFF; // This is how you "cast" a byte that's
+ // intended to be unsigned.
+ } // end else
+ } // end if: position >= 0
+
+ // Else error
+ else
+ {
+ // When JDK1.4 is more accepted, use an assertion here.
+ throw new java.io.IOException( "Error in Base64 code reading stream." );
+ } // end else
+ } // end read
+
+
+ /**
+ * Calls {@link #read()} repeatedly until the end of stream
+ * is reached or <var>len</var> bytes are read.
+ * Returns number of bytes read into array or -1 if
+ * end of stream is encountered.
+ *
+ * @param dest array to hold values
+ * @param off offset for array
+ * @param len max number of bytes to read into array
+ * @return bytes read into array or -1 if end of stream is encountered.
+ * @since 1.3
+ */
+ public int read( byte[] dest, int off, int len ) throws java.io.IOException
+ {
+ int i;
+ int b;
+ for( i = 0; i < len; i++ )
+ {
+ b = read();
+
+ //if( b < 0 && i == 0 )
+ // return -1;
+
+ if( b >= 0 )
+ dest[off + i] = (byte)b;
+ else if( i == 0 )
+ return -1;
+ else
+ break; // Out of 'for' loop
+ } // end for: each byte read
+ return i;
+ } // end read
+
+ } // end inner class InputStream
+
+
+
+
+
+
+ /* ******** I N N E R C L A S S O U T P U T S T R E A M ******** */
+
+
+
+ /**
+ * A {@link Base64.OutputStream} will write data to another
+ * <tt>java.io.OutputStream</tt>, given in the constructor,
+ * and encode/decode to/from Base64 notation on the fly.
+ *
+ * @see Base64
+ * @since 1.3
+ */
+ public static class OutputStream extends java.io.FilterOutputStream
+ {
+ private boolean encode;
+ private int position;
+ private byte[] buffer;
+ private int bufferLength;
+ private int lineLength;
+ private boolean breakLines;
+ private byte[] b4; // Scratch used in a few places
+ private boolean suspendEncoding;
+ private int options; // Record for later
+ private byte[] alphabet; // Local copies to avoid extra method calls
+ private byte[] decodabet; // Local copies to avoid extra method calls
+
+ /**
+ * Constructs a {@link Base64.OutputStream} in ENCODE mode.
+ *
+ * @param out the <tt>java.io.OutputStream</tt> to which data will be written.
+ * @since 1.3
+ */
+ public OutputStream( java.io.OutputStream out )
+ {
+ this( out, ENCODE );
+ } // end constructor
+
+
+ /**
+ * Constructs a {@link Base64.OutputStream} in
+ * either ENCODE or DECODE mode.
+ * <p>
+ * Valid options:<pre>
+ * ENCODE or DECODE: Encode or Decode as data is read.
+ * DONT_BREAK_LINES: don't break lines at 76 characters
+ * (only meaningful when encoding)
+ * <i>Note: Technically, this makes your encoding non-compliant.</i>
+ * </pre>
+ * <p>
+ * Example: <code>new Base64.OutputStream( out, Base64.ENCODE )</code>
+ *
+ * @param out the <tt>java.io.OutputStream</tt> to which data will be written.
+ * @param options Specified options.
+ * @see Base64#ENCODE
+ * @see Base64#DECODE
+ * @see Base64#DONT_BREAK_LINES
+ * @since 1.3
+ */
+ public OutputStream( java.io.OutputStream out, int options )
+ {
+ super( out );
+ this.breakLines = (options & DONT_BREAK_LINES) != DONT_BREAK_LINES;
+ this.encode = (options & ENCODE) == ENCODE;
+ this.bufferLength = encode ? 3 : 4;
+ this.buffer = new byte[ bufferLength ];
+ this.position = 0;
+ this.lineLength = 0;
+ this.suspendEncoding = false;
+ this.b4 = new byte[4];
+ this.options = options;
+ this.alphabet = getAlphabet(options);
+ this.decodabet = getDecodabet(options);
+ } // end constructor
+
+
+ /**
+ * Writes the byte to the output stream after
+ * converting to/from Base64 notation.
+ * When encoding, bytes are buffered three
+ * at a time before the output stream actually
+ * gets a write() call.
+ * When decoding, bytes are buffered four
+ * at a time.
+ *
+ * @param theByte the byte to write
+ * @since 1.3
+ */
+ public void write(int theByte) throws java.io.IOException
+ {
+ // Encoding suspended?
+ if( suspendEncoding )
+ {
+ super.out.write( theByte );
+ return;
+ } // end if: supsended
+
+ // Encode?
+ if( encode )
+ {
+ buffer[ position++ ] = (byte)theByte;
+ if( position >= bufferLength ) // Enough to encode.
+ {
+ out.write( encode3to4( b4, buffer, bufferLength, options ) );
+
+ lineLength += 4;
+ if( breakLines && lineLength >= MAX_LINE_LENGTH )
+ {
+ out.write( NEW_LINE );
+ lineLength = 0;
+ } // end if: end of line
+
+ position = 0;
+ } // end if: enough to output
+ } // end if: encoding
+
+ // Else, Decoding
+ else
+ {
+ // Meaningful Base64 character?
+ if( decodabet[ theByte & 0x7f ] > WHITE_SPACE_ENC )
+ {
+ buffer[ position++ ] = (byte)theByte;
+ if( position >= bufferLength ) // Enough to output.
+ {
+ int len = Base64.decode4to3( buffer, 0, b4, 0, options );
+ out.write( b4, 0, len );
+ //out.write( Base64.decode4to3( buffer ) );
+ position = 0;
+ } // end if: enough to output
+ } // end if: meaningful base64 character
+ else if( decodabet[ theByte & 0x7f ] != WHITE_SPACE_ENC )
+ {
+ throw new java.io.IOException( "Invalid character in Base64 data." );
+ } // end else: not white space either
+ } // end else: decoding
+ } // end write
+
+
+
+ /**
+ * Calls {@link #write(int)} repeatedly until <var>len</var>
+ * bytes are written.
+ *
+ * @param theBytes array from which to read bytes
+ * @param off offset for array
+ * @param len max number of bytes to read into array
+ * @since 1.3
+ */
+ public void write( byte[] theBytes, int off, int len ) throws java.io.IOException
+ {
+ // Encoding suspended?
+ if( suspendEncoding )
+ {
+ super.out.write( theBytes, off, len );
+ return;
+ } // end if: supsended
+
+ for( int i = 0; i < len; i++ )
+ {
+ write( theBytes[ off + i ] );
+ } // end for: each byte written
+
+ } // end write
+
+
+
+ /**
+ * Method added by PHIL. [Thanks, PHIL. -Rob]
+ * This pads the buffer without closing the stream.
+ */
+ public void flushBase64() throws java.io.IOException
+ {
+ if( position > 0 )
+ {
+ if( encode )
+ {
+ out.write( encode3to4( b4, buffer, position, options ) );
+ position = 0;
+ } // end if: encoding
+ else
+ {
+ throw new java.io.IOException( "Base64 input not properly padded." );
+ } // end else: decoding
+ } // end if: buffer partially full
+
+ } // end flush
+
+
+ /**
+ * Flushes and closes (I think, in the superclass) the stream.
+ *
+ * @since 1.3
+ */
+ public void close() throws java.io.IOException
+ {
+ // 1. Ensure that pending characters are written
+ flushBase64();
+
+ // 2. Actually close the stream
+ // Base class both flushes and closes.
+ super.close();
+
+ buffer = null;
+ out = null;
+ } // end close
+
+
+
+ /**
+ * Suspends encoding of the stream.
+ * May be helpful if you need to embed a piece of
+ * base640-encoded data in a stream.
+ *
+ * @since 1.5.1
+ */
+ public void suspendEncoding() throws java.io.IOException
+ {
+ flushBase64();
+ this.suspendEncoding = true;
+ } // end suspendEncoding
+
+
+ /**
+ * Resumes encoding of the stream.
+ * May be helpful if you need to embed a piece of
+ * base640-encoded data in a stream.
+ *
+ * @since 1.5.1
+ */
+ public void resumeEncoding()
+ {
+ this.suspendEncoding = false;
+ } // end resumeEncoding
+
+
+
+ } // end inner class OutputStream
+
+
+} // end class Base64
diff --git a/filter/source/xsltfilter/Manifest b/filter/source/xsltfilter/Manifest
new file mode 100644
index 000000000000..b189662d31e3
--- /dev/null
+++ b/filter/source/xsltfilter/Manifest
@@ -0,0 +1,3 @@
+RegistrationClassName: XSLTransformer
+Class-Path: saxon9.jar
+UNO-Type-Path:
diff --git a/filter/source/xsltfilter/XSLTFilter.cxx b/filter/source/xsltfilter/XSLTFilter.cxx
new file mode 100644
index 000000000000..2ee532086ef5
--- /dev/null
+++ b/filter/source/xsltfilter/XSLTFilter.cxx
@@ -0,0 +1,731 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include <stdio.h>
+
+#include <cppuhelper/factory.hxx>
+#include <cppuhelper/servicefactory.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/implbase3.hxx>
+#include <cppuhelper/implbase4.hxx>
+#include <cppuhelper/implbase.hxx>
+
+#include <osl/time.h>
+#include <osl/conditn.h>
+#include <tools/urlobj.hxx>
+#include <osl/module.h>
+#include <osl/file.hxx>
+#include <osl/process.h>
+
+#include <com/sun/star/lang/XComponent.hpp>
+
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Type.hxx>
+
+#include <com/sun/star/beans/PropertyValue.hpp>
+
+#include <com/sun/star/xml/sax/XParser.hpp>
+#include <com/sun/star/xml/sax/InputSource.hpp>
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
+#include <com/sun/star/xml/sax/SAXException.hpp>
+#include <com/sun/star/xml/XImportFilter.hpp>
+#include <com/sun/star/xml/XExportFilter.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/util/XMacroExpander.hpp>
+
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/io/XActiveDataSource.hpp>
+#include <com/sun/star/io/XActiveDataSink.hpp>
+#include <com/sun/star/io/XActiveDataControl.hpp>
+#include <com/sun/star/io/XStreamListener.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/lang/EventObject.hpp>
+#include <com/sun/star/util/XStringSubstitution.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
+
+#include <xmloff/attrlist.hxx>
+#include <fla.hxx>
+
+using namespace ::rtl;
+using namespace ::cppu;
+using namespace ::osl;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::io;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::registry;
+using namespace ::com::sun::star::xml;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::com::sun::star::util;
+
+namespace XSLT {
+
+
+class FLABridge : public WeakImplHelper1< XDocumentHandler>
+{
+private:
+ const Reference<XDocumentHandler>& m_rDocumentHandler;
+ const sal_Unicode *eval(const sal_Unicode *expr, sal_Int32 exprLen);
+ FLA::Evaluator ev;
+ bool active;
+
+public:
+ FLABridge(const Reference<XDocumentHandler>& m_rDocumentHandler);
+
+ // XDocumentHandler
+ virtual void SAL_CALL startDocument()
+ throw (SAXException,RuntimeException);
+ virtual void SAL_CALL endDocument()
+ throw (SAXException, RuntimeException);
+ virtual void SAL_CALL startElement(const OUString& str, const Reference<XAttributeList>& attriblist)
+ throw (SAXException,RuntimeException);
+ virtual void SAL_CALL endElement(const OUString& str)
+ throw (SAXException, RuntimeException);
+ virtual void SAL_CALL characters(const OUString& str)
+ throw (SAXException, RuntimeException);
+ virtual void SAL_CALL ignorableWhitespace(const OUString& str)
+ throw (SAXException, RuntimeException);
+ virtual void SAL_CALL processingInstruction(const OUString& str, const OUString& str2)
+ throw (com::sun::star::xml::sax::SAXException,RuntimeException);
+ virtual void SAL_CALL setDocumentLocator(const Reference<XLocator>& doclocator)
+ throw (SAXException,RuntimeException);
+
+};
+
+FLABridge::FLABridge(const Reference<XDocumentHandler>& _rDocumentHandler) : m_rDocumentHandler(_rDocumentHandler), active(false)
+{
+}
+
+void FLABridge::startDocument() throw (SAXException,RuntimeException){
+ OSL_ASSERT(m_rDocumentHandler.is());
+ m_rDocumentHandler->startDocument();
+}
+
+void FLABridge::endDocument() throw (SAXException,RuntimeException){
+ OSL_ASSERT(m_rDocumentHandler.is());
+ m_rDocumentHandler->endDocument();
+
+}
+
+
+void FLABridge::startElement(const OUString& str, const Reference<XAttributeList>& attriblist)
+ throw (SAXException, RuntimeException)
+{
+ OSL_ASSERT(m_rDocumentHandler.is());
+ if (active)
+ {
+// SvXMLAttributeList* _attriblist=SvXMLAttributeList::getImplementation(attriblist);
+ const int len=attriblist->getLength();
+ SvXMLAttributeList *_newattriblist= new SvXMLAttributeList();
+ for(int i=0;i<len;i++)
+ {
+ const OUString& name=attriblist->getNameByIndex( sal::static_int_cast<sal_Int16>( i ) );
+ sal_Int32 pos;
+ static const OUString _value_(".value", 6, RTL_TEXTENCODING_ASCII_US);
+ if ((pos=name.lastIndexOf(L'.'))!=-1 && name.match(_value_, pos))
+ {
+ const OUString newName(name, pos);
+ const OUString& value=attriblist->getValueByIndex( sal::static_int_cast<sal_Int16>( i ) );
+ const OUString newValue(ev.eval(value.getStr(), value.getLength()));
+ if (newValue.getLength()>0)
+ {
+ _newattriblist->AddAttribute(newName, newValue);
+ }
+ }
+ else
+ {
+ _newattriblist->AddAttribute(name, attriblist->getValueByIndex( sal::static_int_cast<sal_Int16>( i )));
+ }
+ };
+ const Reference<XAttributeList> newattriblist(_newattriblist);
+ m_rDocumentHandler->startElement(str, newattriblist);
+ }
+ else
+ {
+ if (str.compareToAscii("fla:fla.activate")==0)
+ {
+ active=1;
+ }
+ m_rDocumentHandler->startElement(str, attriblist);
+ }
+}
+
+void FLABridge::endElement(const OUString& str)
+ throw (SAXException, RuntimeException)
+{
+ OSL_ASSERT(m_rDocumentHandler.is());
+ m_rDocumentHandler->endElement(str);
+}
+
+void FLABridge::characters(const OUString& str)
+ throw (SAXException, RuntimeException)
+{
+ OSL_ASSERT(m_rDocumentHandler.is());
+ m_rDocumentHandler->characters(str);
+}
+
+void FLABridge::ignorableWhitespace(const OUString& str)
+ throw (SAXException, RuntimeException)
+{
+ OSL_ASSERT(m_rDocumentHandler.is());
+ m_rDocumentHandler->ignorableWhitespace(str);
+}
+
+void FLABridge::processingInstruction(const OUString& str, const OUString& str2)
+ throw (SAXException, RuntimeException)
+{
+ OSL_ASSERT(m_rDocumentHandler.is());
+ m_rDocumentHandler->processingInstruction(str, str2);
+}
+
+void FLABridge::setDocumentLocator(const Reference<XLocator>& doclocator)
+ throw (SAXException, RuntimeException)
+{
+ OSL_ASSERT(m_rDocumentHandler.is());
+ m_rDocumentHandler->setDocumentLocator(doclocator);
+}
+
+
+
+class XSLTFilter : public WeakImplHelper4< XImportFilter, XExportFilter, XDocumentHandler, XStreamListener>
+{
+private:
+ // the UNO ServiceFactory
+ Reference< XMultiServiceFactory > m_rServiceFactory;
+
+ // DocumentHandler interface of the css::xml::sax::Writer service
+ Reference < XExtendedDocumentHandler > m_rDocumentHandler;
+ Reference < XOutputStream > m_rOutputStream;
+
+ // controls pretty-printing
+ sal_Bool m_bPrettyPrint;
+
+ Reference< XActiveDataControl > m_tcontrol;
+ oslCondition m_cTransformed;
+ sal_Bool m_bTerminated;
+ sal_Bool m_bError;
+
+ OUString m_aExportBaseUrl;
+ OUString m_aOldBaseUrl;
+
+ OUString rel2abs(const OUString&);
+ OUString expandUrl(const OUString&);
+
+public:
+
+ // ctor...
+ XSLTFilter( const Reference< XMultiServiceFactory > &r );
+
+ // XStreamListener
+ virtual void SAL_CALL error(const Any& a) throw (RuntimeException);
+ virtual void SAL_CALL closed() throw (RuntimeException);
+ virtual void SAL_CALL terminated() throw (RuntimeException);
+ virtual void SAL_CALL started() throw (RuntimeException);
+ virtual void SAL_CALL disposing(const EventObject& e) throw (RuntimeException);
+
+
+ // XImportFilter
+ virtual sal_Bool SAL_CALL importer(
+ const Sequence<PropertyValue>& aSourceData,
+ const Reference<XDocumentHandler>& xHandler,
+ const Sequence<OUString>& msUserData)
+ throw(RuntimeException);
+
+ // XExportFilter
+ virtual sal_Bool SAL_CALL exporter(
+ const Sequence<PropertyValue>& aSourceData,
+ const Sequence<OUString>& msUserData)
+ throw(RuntimeException);
+
+ // XDocumentHandler
+ virtual void SAL_CALL startDocument()
+ throw (SAXException,RuntimeException);
+ virtual void SAL_CALL endDocument()
+ throw (SAXException, RuntimeException);
+ virtual void SAL_CALL startElement(const OUString& str, const Reference<XAttributeList>& attriblist)
+ throw (SAXException,RuntimeException);
+ virtual void SAL_CALL endElement(const OUString& str)
+ throw (SAXException, RuntimeException);
+ virtual void SAL_CALL characters(const OUString& str)
+ throw (SAXException, RuntimeException);
+ virtual void SAL_CALL ignorableWhitespace(const OUString& str)
+ throw (SAXException, RuntimeException);
+ virtual void SAL_CALL processingInstruction(const OUString& str, const OUString& str2)
+ throw (com::sun::star::xml::sax::SAXException,RuntimeException);
+ virtual void SAL_CALL setDocumentLocator(const Reference<XLocator>& doclocator)
+ throw (SAXException,RuntimeException);
+};
+
+XSLTFilter::XSLTFilter( const Reference< XMultiServiceFactory > &r )
+ : m_rServiceFactory(r)
+ , m_bPrettyPrint(sal_True)
+ , m_bTerminated(sal_False)
+ , m_bError(sal_False)
+{
+ m_cTransformed = osl_createCondition();
+}
+
+void XSLTFilter::disposing(const EventObject& ) throw (RuntimeException)
+{
+}
+
+::rtl::OUString XSLTFilter::expandUrl( const ::rtl::OUString& sUrl )
+{
+ ::rtl::OUString sExpandedUrl;
+ try
+ {
+ Reference< XComponentContext > xContext;
+ Reference< XPropertySet > xProps( m_rServiceFactory, UNO_QUERY_THROW );
+ xContext.set( xProps->getPropertyValue( ::rtl::OUString::createFromAscii( "DefaultContext" ) ), UNO_QUERY_THROW );
+ Reference< XMacroExpander > xMacroExpander( xContext->getValueByName( ::rtl::OUString::createFromAscii( "/singletons/com.sun.star.util.theMacroExpander" ) ), UNO_QUERY_THROW );
+ sExpandedUrl = xMacroExpander->expandMacros(sUrl);
+ sal_Int32 nPos = sExpandedUrl.indexOf(::rtl::OUString::createFromAscii("vnd.sun.star.expand:"));
+ if ( nPos != -1 )
+ sExpandedUrl = sExpandedUrl.copy(nPos+20);
+ }
+ catch (Exception&) {}
+ return sExpandedUrl;
+}
+
+void XSLTFilter::started() throw (RuntimeException)
+{
+ osl_resetCondition(m_cTransformed);
+}
+void XSLTFilter::error(const Any& a) throw (RuntimeException)
+{
+ Exception e;
+ if ( a >>= e)
+ {
+ OString aMessage("XSLTFilter::error was called: ");
+ aMessage += OUStringToOString(e.Message, RTL_TEXTENCODING_ASCII_US);
+ OSL_ENSURE(sal_False, aMessage);
+ }
+ m_bError = sal_True;
+ osl_setCondition(m_cTransformed);
+}
+void XSLTFilter::closed() throw (RuntimeException)
+{
+ osl_setCondition(m_cTransformed);
+}
+void XSLTFilter::terminated() throw (RuntimeException)
+{
+ m_bTerminated = sal_True;
+ osl_setCondition(m_cTransformed);
+}
+
+OUString XSLTFilter::rel2abs(const OUString& s)
+{
+
+ Reference< XStringSubstitution > subs(m_rServiceFactory->createInstance(
+ OUString::createFromAscii("com.sun.star.util.PathSubstitution")), UNO_QUERY);
+ OUString aWorkingDir = subs->getSubstituteVariableValue(OUString::createFromAscii("$(progurl)"));
+ INetURLObject aObj( aWorkingDir );
+ aObj.setFinalSlash();
+ bool bWasAbsolute;
+ INetURLObject aURL = aObj.smartRel2Abs(
+ s, bWasAbsolute, false, INetURLObject::WAS_ENCODED, RTL_TEXTENCODING_UTF8, true );
+ return aURL.GetMainURL(INetURLObject::NO_DECODE);
+}
+
+
+
+sal_Bool XSLTFilter::importer(
+ const Sequence<PropertyValue>& aSourceData,
+ const Reference<XDocumentHandler>& xHandler,
+ const Sequence<OUString>& msUserData)
+ throw (RuntimeException)
+{
+ if ( msUserData.getLength() < 5 )
+ return sal_False;
+
+ OUString udImport = msUserData[2];
+ OUString udStyleSheet = rel2abs(msUserData[4]);
+
+ // get information from media descriptor
+ // the imput stream that represents the imported file
+ // is most important here since we need to supply it to
+ // the sax parser that drives the supplied document handler
+ sal_Int32 nLength = aSourceData.getLength();
+ OUString aName, aFileName, aURL;
+ Reference< XInputStream > xInputStream;
+ for ( sal_Int32 i = 0 ; i < nLength; i++)
+ {
+ aName = aSourceData[i].Name;
+ if (aName.equalsAscii("InputStream"))
+ aSourceData[i].Value >>= xInputStream;
+ else if ( aName.equalsAscii("FileName"))
+ aSourceData[i].Value >>= aFileName;
+ else if ( aName.equalsAscii("URL"))
+ aSourceData[i].Value >>= aURL;
+ }
+ OSL_ASSERT(xInputStream.is());
+ if (!xInputStream.is()) return sal_False;
+
+ // create SAX parser that will read the document file
+ // and provide events to xHandler passed to this call
+ Reference < XParser > xSaxParser( m_rServiceFactory->createInstance(
+ OUString::createFromAscii("com.sun.star.xml.sax.Parser")), UNO_QUERY );
+ OSL_ASSERT(xSaxParser.is());
+ if(!xSaxParser.is())return sal_False;
+
+ // create transformer
+ Sequence< Any > args(3);
+ NamedValue nv;
+
+ nv.Name = OUString::createFromAscii("StylesheetURL");
+ nv.Value <<= expandUrl(udStyleSheet); args[0] <<= nv;
+ nv.Name = OUString::createFromAscii("SourceURL");
+ nv.Value <<= aURL; args[1] <<= nv;
+ nv.Name = OUString::createFromAscii("SourceBaseURL");
+ nv.Value <<= OUString(INetURLObject(aURL).getBase());
+ args[2] <<= nv;
+
+ m_tcontrol = Reference< XActiveDataControl >(m_rServiceFactory->createInstanceWithArguments(
+ OUString::createFromAscii("com.sun.star.comp.JAXTHelper"), args), UNO_QUERY);
+
+ OSL_ASSERT(xHandler.is());
+ OSL_ASSERT(xInputStream.is());
+ OSL_ASSERT(m_tcontrol.is());
+ if (xHandler.is() && xInputStream.is() && m_tcontrol.is())
+ {
+ try
+ {
+ // we want to be notfied when the processing is done...
+ m_tcontrol->addListener(Reference< XStreamListener >(this));
+
+ // connect input to transformer
+ Reference< XActiveDataSink > tsink(m_tcontrol, UNO_QUERY);
+ tsink->setInputStream(xInputStream);
+
+ // create pipe
+ Reference< XOutputStream > pipeout(m_rServiceFactory->createInstance(
+ OUString::createFromAscii("com.sun.star.io.Pipe")), UNO_QUERY);
+ Reference< XInputStream > pipein(pipeout, UNO_QUERY);
+
+ //connect transformer to pipe
+ Reference< XActiveDataSource > tsource(m_tcontrol, UNO_QUERY);
+ tsource->setOutputStream(pipeout);
+
+ // connect pipe to sax parser
+ InputSource aInput;
+ aInput.sSystemId = aURL;
+ aInput.sPublicId = aURL;
+ aInput.aInputStream = pipein;
+
+ // set doc handler
+ xSaxParser->setDocumentHandler(new FLABridge(xHandler));
+
+ // transform
+ m_tcontrol->start();
+ // osl_waitCondition(m_cTransformed, 0);
+ if (!m_bError && !m_bTerminated)
+ {
+ // parse the transformed XML buffered in the pipe
+ xSaxParser->parseStream(aInput);
+ osl_waitCondition(m_cTransformed, 0);
+ return sal_True;
+ } else {
+ return sal_False;
+ }
+ }
+#if OSL_DEBUG_LEVEL > 0
+ catch( Exception& exc)
+#else
+ catch( Exception& )
+#endif
+ {
+ // something went wrong
+ OSL_ENSURE(0, OUStringToOString(exc.Message, RTL_TEXTENCODING_ASCII_US).getStr());
+ return sal_False;
+ }
+ } else
+ {
+ return sal_False;
+ }
+}
+
+sal_Bool XSLTFilter::exporter(
+ const Sequence<PropertyValue>& aSourceData,
+ const Sequence<OUString>& msUserData)
+ throw (RuntimeException)
+{
+ if ( msUserData.getLength() < 6 )
+ return sal_False;
+
+ // get interesting values from user data
+ OUString udImport = msUserData[2];
+ OUString udStyleSheet = rel2abs(msUserData[5]);
+
+ // read source data
+ // we are especialy interested in the output stream
+ // since that is where our xml-writer will push the data
+ // from it's data-source interface
+ OUString aName, sURL;
+ sal_Bool bIndent = sal_False;
+ OUString aDoctypePublic;
+ OUString aDoctypeSystem;
+ // Reference<XOutputStream> rOutputStream;
+ sal_Int32 nLength = aSourceData.getLength();
+ for ( sal_Int32 i = 0 ; i < nLength; i++)
+ {
+ aName = aSourceData[i].Name;
+ if ( aName.equalsAscii("Indent"))
+ aSourceData[i].Value >>= bIndent;
+ if ( aName.equalsAscii("DocType_Public"))
+ aSourceData[i].Value >>= aDoctypePublic;
+ if ( aName.equalsAscii("DocType_System"))
+ aSourceData[i].Value >>= aDoctypeSystem;
+ if ( aName.equalsAscii("OutputStream"))
+ aSourceData[i].Value >>= m_rOutputStream;
+ else if ( aName.equalsAscii("URL" ))
+ aSourceData[i].Value >>= sURL;
+ }
+
+ if (!m_rDocumentHandler.is()) {
+ // get the document writer
+ m_rDocumentHandler = Reference<XExtendedDocumentHandler>(
+ m_rServiceFactory->createInstance(
+ OUString::createFromAscii("com.sun.star.xml.sax.Writer")),
+ UNO_QUERY);
+ }
+
+ // create transformer
+ Sequence< Any > args(4);
+ NamedValue nv;
+ nv.Name = OUString::createFromAscii("StylesheetURL");
+ nv.Value <<= expandUrl(udStyleSheet); args[0] <<= nv;
+ nv.Name = OUString::createFromAscii("TargetURL");
+ nv.Value <<= sURL; args[1] <<= nv;
+ nv.Name = OUString::createFromAscii("DoctypeSystem");
+ nv.Value <<= aDoctypeSystem; args[2] <<= nv;
+ nv.Name = OUString::createFromAscii("DoctypePublic");
+ nv.Value <<= aDoctypePublic; args[3] <<= nv;
+ nv.Name = OUString::createFromAscii("TargetBaseURL");
+ INetURLObject ineturl(sURL);
+ ineturl.removeSegment();
+ m_aExportBaseUrl = ineturl.GetMainURL(INetURLObject::NO_DECODE);
+ nv.Value <<= m_aExportBaseUrl;
+ args[3] <<= nv;
+
+ m_tcontrol = Reference< XActiveDataControl >(m_rServiceFactory->createInstanceWithArguments(
+ OUString::createFromAscii("com.sun.star.comp.JAXTHelper"), args), UNO_QUERY);
+
+ OSL_ASSERT(m_rDocumentHandler.is());
+ OSL_ASSERT(m_rOutputStream.is());
+ OSL_ASSERT(m_tcontrol.is());
+ if (m_tcontrol.is() && m_rOutputStream.is() && m_rDocumentHandler.is())
+ {
+ // we want to be notfied when the processing is done...
+ m_tcontrol->addListener(Reference< XStreamListener >(this));
+
+ // create pipe
+ Reference< XOutputStream > pipeout(m_rServiceFactory->createInstance(
+ OUString::createFromAscii("com.sun.star.io.Pipe")), UNO_QUERY);
+ Reference< XInputStream > pipein(pipeout, UNO_QUERY);
+
+ // connect sax writer to pipe
+ Reference< XActiveDataSource > xmlsource(m_rDocumentHandler, UNO_QUERY);
+ xmlsource->setOutputStream(pipeout);
+
+ // connect pipe to transformer
+ Reference< XActiveDataSink > tsink(m_tcontrol, UNO_QUERY);
+ tsink->setInputStream(pipein);
+
+ // connect transformer to output
+ Reference< XActiveDataSource > tsource(m_tcontrol, UNO_QUERY);
+ tsource->setOutputStream(m_rOutputStream);
+
+ // we will start receiving events after returning 'true'.
+ // we will start the transformation as soon as we receive the startDocument
+ // event.
+ return sal_True;
+ }
+ else
+ {
+ return sal_False;
+ }
+}
+
+// for the DocumentHandler implementation, we just proxy the the
+// events to the XML writer that we created upon the output stream
+// that was provided by the XMLFilterAdapter
+void XSLTFilter::startDocument() throw (SAXException,RuntimeException){
+ OSL_ASSERT(m_rDocumentHandler.is());
+ m_rDocumentHandler->startDocument();
+ m_tcontrol->start();
+}
+
+void XSLTFilter::endDocument() throw (SAXException, RuntimeException){
+ OSL_ASSERT(m_rDocumentHandler.is());
+ m_rDocumentHandler->endDocument();
+ // wait for the transformer to finish
+ osl_waitCondition(m_cTransformed, 0);
+ if (!m_bError && !m_bTerminated)
+ {
+ return;
+ } else {
+ throw RuntimeException();
+ }
+
+}
+
+void XSLTFilter::startElement(const OUString& str, const Reference<XAttributeList>& attriblist)
+ throw (SAXException, RuntimeException)
+{
+ OSL_ASSERT(m_rDocumentHandler.is());
+// SvXMLAttributeList* _attriblist=SvXMLAttributeList::getImplementation(attriblist);
+ m_rDocumentHandler->startElement(str, attriblist);
+}
+
+void XSLTFilter::endElement(const OUString& str)
+ throw (SAXException, RuntimeException)
+{
+ OSL_ASSERT(m_rDocumentHandler.is());
+ m_rDocumentHandler->endElement(str);
+}
+
+void XSLTFilter::characters(const OUString& str)
+ throw (SAXException, RuntimeException)
+{
+ OSL_ASSERT(m_rDocumentHandler.is());
+ m_rDocumentHandler->characters(str);
+}
+
+void XSLTFilter::ignorableWhitespace(const OUString& str)
+ throw (SAXException, RuntimeException)
+{
+ OSL_ASSERT(m_rDocumentHandler.is());
+ if (!m_bPrettyPrint) return;
+ m_rDocumentHandler->ignorableWhitespace(str);
+}
+
+void XSLTFilter::processingInstruction(const OUString& str, const OUString& str2)
+ throw (SAXException, RuntimeException)
+{
+ OSL_ASSERT(m_rDocumentHandler.is());
+ m_rDocumentHandler->processingInstruction(str, str2);
+}
+
+void XSLTFilter::setDocumentLocator(const Reference<XLocator>& doclocator)
+ throw (SAXException, RuntimeException)
+{
+ OSL_ASSERT(m_rDocumentHandler.is());
+ m_rDocumentHandler->setDocumentLocator(doclocator);
+}
+
+// --------------------------------------
+// Component management
+// --------------------------------------
+#define SERVICE_NAME "com.sun.star.documentconversion.XSLTFilter"
+#define IMPLEMENTATION_NAME "com.sun.star.comp.documentconversion.XSLTFilter"
+
+static Reference< XInterface > SAL_CALL CreateInstance( const Reference< XMultiServiceFactory > &r)
+{
+ return Reference< XInterface >(( OWeakObject *)new XSLTFilter(r));
+}
+
+static Sequence< OUString > getSupportedServiceNames()
+{
+ static Sequence < OUString > *pNames = 0;
+ if( ! pNames )
+ {
+ MutexGuard guard( Mutex::getGlobalMutex() );
+ if( !pNames )
+ {
+ static Sequence< OUString > seqNames(1);
+ seqNames.getArray()[0] = OUString::createFromAscii(SERVICE_NAME);
+ pNames = &seqNames;
+ }
+ }
+ return *pNames;
+}
+
+}
+
+using namespace XSLT;
+
+extern "C"
+{
+void SAL_CALL component_getImplementationEnvironment(
+ const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */ )
+{
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+
+sal_Bool SAL_CALL component_writeInfo(void * /* pServiceManager */, void * pRegistryKey )
+{
+ if (pRegistryKey)
+ {
+ try
+ {
+ Reference< XRegistryKey > xNewKey(
+ reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey(
+ OUString::createFromAscii( "/" IMPLEMENTATION_NAME "/UNO/SERVICES" ) ) );
+
+ const Sequence< OUString > & rSNL = getSupportedServiceNames();
+ const OUString * pArray = rSNL.getConstArray();
+ for ( sal_Int32 nPos = rSNL.getLength(); nPos--; )
+ xNewKey->createKey( pArray[nPos] );
+
+ return sal_True;
+ }
+ catch (InvalidRegistryException &)
+ {
+ OSL_ENSURE( sal_False, "### InvalidRegistryException!" );
+ }
+ }
+ return sal_False;
+}
+
+void * SAL_CALL component_getFactory(
+ const sal_Char * pImplName, void * pServiceManager, void * /* pRegistryKey */ )
+{
+ void * pRet = 0;
+
+ if (pServiceManager && rtl_str_compare( pImplName, IMPLEMENTATION_NAME ) == 0)
+ {
+ Reference< XSingleServiceFactory > xFactory( createSingleFactory(
+ reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
+ OUString::createFromAscii( pImplName ),
+ CreateInstance, getSupportedServiceNames() ) );
+
+ if (xFactory.is())
+ {
+ xFactory->acquire();
+ pRet = xFactory.get();
+ }
+ }
+ return pRet;
+}
+
+} // extern "C"
diff --git a/filter/source/xsltfilter/XSLTFilterOLEExtracter.java b/filter/source/xsltfilter/XSLTFilterOLEExtracter.java
new file mode 100644
index 000000000000..f91146b45bb9
--- /dev/null
+++ b/filter/source/xsltfilter/XSLTFilterOLEExtracter.java
@@ -0,0 +1,393 @@
+/************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+//Standard Java classes
+import java.io.FileWriter;
+import java.util.zip.Inflater;
+import java.util.zip.Deflater;
+
+//StarOffice Interfaces and UNO
+import com.sun.star.bridge.XBridgeFactory;
+import com.sun.star.bridge.XBridge;
+import com.sun.star.connection.XConnector;
+import com.sun.star.connection.XConnection;
+import com.sun.star.container.XNameContainer;
+import com.sun.star.embed.XTransactedObject;
+import com.sun.star.io.XStream;
+import com.sun.star.io.XSeekable;
+import com.sun.star.io.XInputStream;
+import com.sun.star.io.XOutputStream;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.lang.XComponent;
+import com.sun.star.uno.XComponentContext;
+import com.sun.star.uno.UnoRuntime;
+
+/** This class is an xalan extension class. It provider 2 elements
+ * and 2 functions to used in xslt script. With this elements and functions
+ * we can convert between oledata between Wordml and OOo flat.
+ * To use it, we need a running OOo. There are two ways to get the XMultiServiceFactory.
+ * When called by OOo xslt filter, an XMultiServiceFactory will be add to the transformer
+ * by setParameter(), then we can get it using getParameter(). Another way is using an
+ * XConnection to connect to a running OOo. We connect to a running OOo, we need know the
+ * uno url. It can be set in the xslt script. The default uno url is:
+ * "uno:socket,host=localhost,port=8100;urp;StarOffice.ServiceManager"
+ * see XSLTXalanOLEExtracter.java
+ */
+public class XSLTFilterOLEExtracter {
+
+ protected XMultiServiceFactory m_xMSF;
+ protected XNameContainer m_Storage;
+ protected XStream m_RootStream;
+ protected XConnection m_Connection;
+ protected String sConnectionString;
+ private static final String UNO_URL = "uno:socket,host=localhost,port=8100;urp;StarOffice.ServiceManager";
+
+ public XSLTFilterOLEExtracter() {
+ }
+
+ public void init(String unoUrl) {
+ if (unoUrl == null || unoUrl.equals("")) {
+ unoUrl = UNO_URL;
+ }
+ debugln("Init with uno url=" + unoUrl);
+ if (null == m_xMSF) {
+ try {
+ m_xMSF = connectAwareGetServiceFactory();
+ } catch (Exception ex) {
+ System.err.println("Could not connect to the office '" + unoUrl + "'\n" + ex.getMessage());
+ }
+ }
+ }
+
+ public void exit() {
+ m_Storage = null;
+ m_xMSF = null;
+ if (null != m_Connection) {
+ try {
+ m_Connection.close();
+ } catch (Exception ex) {
+ System.err.println("Could not close connection to the office.\n" + ex.getMessage());
+ }
+ }
+ }
+ //If aName = "oledata.mso" then we load the root storage from the given base64 string
+ //Otherwise we compress the stream and add it to the root storage under the name of aName
+ public void insertByName(String aName, String aBase64) {
+ debugln("insertByName(" + aName + " : " + aBase64 + ")");
+ if (aName.equals("oledata.mso")) {
+ loadRootStorageFromBase64(aBase64);
+ } else {
+ ensureCreateRootStorage();
+ insertSubStorage(aName, aBase64);
+ }
+ }
+ //If aName = "oledata.mso" then we return the base64 encoded string of the root storage
+ //Otherwise we return the base64 encoded string of the sub stream under the name of aName
+ public String getByName(String aName) {
+ if (aName.equals("oledata.mso")) {
+ try {
+ //get the length and seek to 0
+ XSeekable xSeek = (XSeekable) UnoRuntime.queryInterface(XSeekable.class, m_RootStream);
+ int oleLength = (int) xSeek.getLength();
+ xSeek.seek(0);
+ xSeek = null;
+ //read all bytes
+ XInputStream xInput = m_RootStream.getInputStream();
+ byte oledata[][] = new byte[1][oleLength];
+ xInput.readBytes(oledata, oleLength);
+ //return the base64 encoded string
+ return Base64.encodeBytes(oledata[0]);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ } else {
+ return getEncodedSubStorage(aName);
+ }
+ return "";
+ }
+ //get the sub stream which name = aName, decompress it and return the base64 encoded string
+ public String getEncodedSubStorage(String aName) {
+ debugln("getByName(" + aName + ")");
+ try {
+ if (!m_Storage.hasByName(aName)) {
+ return "Not Found:" + aName;
+ }
+ Object oSubStream = m_Storage.getByName(aName);
+ if (oSubStream == null) {
+ return "Not Found:" + aName;
+ }
+ XInputStream xSubStream = (XInputStream) UnoRuntime.queryInterface(XInputStream.class,
+ oSubStream);
+ if (xSubStream == null) {
+ return "Not Found:" + aName;
+ }
+ //The first four byte are the length of the uncompressed data
+ byte pLength[][] = new byte[1][4];
+ XSeekable xSeek = (XSeekable) UnoRuntime.queryInterface(XSeekable.class, xSubStream);
+ xSeek.seek(0);
+ xSeek = null;
+ //Get the uncompressed length
+ int readbytes = xSubStream.readBytes(pLength, 4);
+ if (4 != readbytes) {
+ System.out.println("readbytes:" + readbytes);
+ return "Can not read the length.";
+ }
+ int oleLength = (pLength[0][0] << 0) + (pLength[0][1] << 8) + (pLength[0][2] << 16) + (pLength[0][3] << 24);
+ byte pContents[][] = new byte[1][oleLength];
+ //Read all bytes. The compressed length should less then the uncompressed length
+ readbytes = xSubStream.readBytes(pContents, oleLength);
+ if (oleLength < readbytes) {
+ return "oleLength :" + oleLength + " readbytes: " + readbytes;
+ }
+
+ // Decompress the bytes
+ Inflater decompresser = new Inflater();
+ decompresser.setInput(pContents[0], 0, readbytes);
+ byte[] result = new byte[oleLength];
+ int resultLength = decompresser.inflate(result);
+ decompresser.end();
+
+ //return the base64 string of the uncompressed data
+ return Base64.encodeBytes(result);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ return "";
+ }
+
+ public XStream CreateTempFileStream(XMultiServiceFactory xMSF) {
+ // try to get temporary file representation
+ XStream xTempFileStream = null;
+ try {
+ Object oTempFile = xMSF.createInstance("com.sun.star.io.TempFile");
+ xTempFileStream = (XStream) UnoRuntime.queryInterface(XStream.class, oTempFile);
+ } catch (Exception e) {
+ }
+
+ if (xTempFileStream == null) {
+ System.out.println("Can't create temporary file!");
+ }
+
+ return xTempFileStream;
+ }
+ //decode the base64 string and create an com.sun.star.embed.OLESimpleStorage from it
+ public void loadRootStorageFromBase64(String aBase64) {
+ try {
+ //Decode and write the data to an temp stream
+ byte[] oledata = Base64.decode(aBase64);
+ m_RootStream = CreateTempFileStream(m_xMSF);
+ XOutputStream xOutput = m_RootStream.getOutputStream();
+ xOutput.writeBytes(oledata);
+ xOutput.flush();
+ //Get the input stream and seek to begin
+ XInputStream xInput = m_RootStream.getInputStream();
+ XSeekable xSeek = (XSeekable) UnoRuntime.queryInterface(XSeekable.class, xInput);
+ xSeek.seek(0);
+ oledata = null;
+ xSeek = null;
+
+ //create an com.sun.star.embed.OLESimpleStorage from the temp stream
+ Object pArgs[] = new Object[1];
+ pArgs[0] = (Object) xInput;
+ Object oTempStorage = m_xMSF.createInstanceWithArguments("com.sun.star.embed.OLESimpleStorage", pArgs);
+ pArgs = null;
+
+ m_Storage = (XNameContainer) UnoRuntime.queryInterface(XNameContainer.class, oTempStorage);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ //Create a empty OLESimpleStorage if there is not one
+ public void ensureCreateRootStorage() {
+ if (null == m_RootStream || null == m_Storage) {
+ try {
+ m_RootStream = CreateTempFileStream(m_xMSF);
+
+ Object pArgs[] = new Object[1];
+ pArgs[0] = (Object) m_RootStream;
+ Object oTempStorage = m_xMSF.createInstanceWithArguments("com.sun.star.embed.OLESimpleStorage", pArgs);
+ pArgs = null;
+
+ m_Storage = (XNameContainer) UnoRuntime.queryInterface(XNameContainer.class, oTempStorage);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ //decode the base64 string and insert the length and the compressed data of it to
+ //the root storage as a sub stream under aName
+ public void insertSubStorage(String aName, String aBase64) {
+ try {
+ //decode the base64 string
+ byte[] oledata = Base64.decode(aBase64);
+ //create a temp stream to write data to
+ XStream subStream = CreateTempFileStream(m_xMSF);
+ XInputStream xInput = subStream.getInputStream();
+ XOutputStream xOutput = subStream.getOutputStream();
+ //write the length to the temp stream
+ byte oleHead[] = new byte[4];
+ oleHead[0] = (byte) ((oledata.length >>> 0) & 0xFF);
+ oleHead[1] = (byte) ((oledata.length >>> 8) & 0xFF);
+ oleHead[2] = (byte) ((oledata.length >>> 16) & 0xFF);
+ oleHead[3] = (byte) ((oledata.length >>> 24) & 0xFF);
+ xOutput.writeBytes(oleHead);
+
+ // Compress the bytes
+ byte[] output = new byte[oledata.length];
+ Deflater compresser = new Deflater();
+ compresser.setInput(oledata);
+ compresser.finish();
+ int compressedDataLength = compresser.deflate(output);
+ //realloc the data length
+ byte[] compressedBytes = new byte[compressedDataLength];
+ for (int i = 0; i < compressedDataLength; i++) {
+ compressedBytes[i] = output[i];
+ }
+
+ //write the compressed data to the temp stream
+ xOutput.writeBytes(compressedBytes);
+ //seek to 0
+ XSeekable xSeek = (XSeekable) UnoRuntime.queryInterface(XSeekable.class, xInput);
+ xSeek.seek(0);
+ xSeek = null;
+ oledata = null;
+
+ //insert the temp stream as a sub stream and use an XTransactedObject to commit it immediately
+ XTransactedObject xTransact = (XTransactedObject) UnoRuntime.queryInterface(XTransactedObject.class, m_Storage);
+ m_Storage.insertByName(aName, xInput);
+ xTransact.commit();
+ xTransact = null;
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ /** separtates the uno-url into 3 different parts.
+ */
+ protected static String[] parseUnoUrl(String url) {
+ String[] aRet = new String[3];
+
+ if (!url.startsWith("uno:")) {
+ return null;
+ }
+
+ int semicolon = url.indexOf(';');
+ if (semicolon == -1) {
+ return null;
+ }
+
+ aRet[0] = url.substring(4, semicolon);
+ int nextSemicolon = url.indexOf(';', semicolon + 1);
+
+ if (semicolon == -1) {
+ return null;
+ }
+ aRet[1] = url.substring(semicolon + 1, nextSemicolon);
+
+ aRet[2] = url.substring(nextSemicolon + 1);
+ return aRet;
+ }
+ //connect to running OOo and keep an XConnection object so that we can disconnect from OOo as we wish
+ protected XMultiServiceFactory connectAwareGetServiceFactory() throws com.sun.star.uno.Exception,
+ com.sun.star.uno.RuntimeException,
+ Exception {
+
+ // Get component context
+ XComponentContext xComponentContext =
+ com.sun.star.comp.helper.Bootstrap.createInitialComponentContext(null);
+
+ // instantiate connector service
+ Object x = xComponentContext.getServiceManager().createInstanceWithContext(
+ "com.sun.star.connection.Connector", xComponentContext);
+
+ XConnector xConnector = (XConnector) UnoRuntime.queryInterface(XConnector.class, x);
+
+ String a[] = parseUnoUrl(sConnectionString);
+ if (null == a) {
+ throw new com.sun.star.uno.Exception("Couldn't parse uno-url " + sConnectionString);
+ }
+
+ // connect using the connection string part of the uno-url only.
+ m_Connection = xConnector.connect(a[0]);
+
+ x = xComponentContext.getServiceManager().createInstanceWithContext(
+ "com.sun.star.bridge.BridgeFactory", xComponentContext);
+
+ XBridgeFactory xBridgeFactory = (XBridgeFactory) UnoRuntime.queryInterface(
+ XBridgeFactory.class, x);
+
+ // create a nameless bridge with no instance provider
+ // using the middle part of the uno-url
+ XBridge bridge = xBridgeFactory.createBridge("", a[1], m_Connection, null);
+
+ // query for the XComponent interface and add this as event listener
+ XComponent xComponent = (XComponent) UnoRuntime.queryInterface(
+ XComponent.class, bridge);
+
+ // get the remote instance
+ x = bridge.getInstance(a[2]);
+
+ // Did the remote server export this object ?
+ if (null == x) {
+ throw new com.sun.star.uno.Exception(
+ "Server didn't provide an instance for" + a[2], null);
+ }
+
+ XMultiServiceFactory xFac = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, x);
+ return xFac;
+ }
+ protected static boolean DEBUG = false;
+ protected static boolean DEBUGCHK = false;
+ protected static String debugfile;
+
+ protected static void debugln(String s) {
+ debug(s + "\n");
+ }
+
+ protected static void debug(String s) {
+ if (!DEBUGCHK) {
+ if (System.getProperty("xsltfilter.debug") == null) {
+ DEBUGCHK = true;
+ return;
+ } else {
+ debugfile = System.getProperty("xsltfilter.debug");
+ DEBUG = true;
+ }
+ }
+ if (!DEBUG) {
+ return;
+ }
+ try {
+ FileWriter dbgwriter = new FileWriter(debugfile, true);
+ dbgwriter.write(s);
+ dbgwriter.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/filter/source/xsltfilter/XSLTransformer.java b/filter/source/xsltfilter/XSLTransformer.java
new file mode 100644
index 000000000000..4806c18b8161
--- /dev/null
+++ b/filter/source/xsltfilter/XSLTransformer.java
@@ -0,0 +1,484 @@
+/************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+//Standard Java classes
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.PrintStream;
+import java.io.StringReader;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Vector;
+
+// Imported TraX classes
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.URIResolver;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+
+//StarOffice Interfaces and UNO
+import com.sun.star.beans.NamedValue;
+import com.sun.star.comp.loader.FactoryHelper;
+import com.sun.star.io.XActiveDataControl;
+import com.sun.star.io.XActiveDataSink;
+import com.sun.star.io.XActiveDataSource;
+import com.sun.star.io.XInputStream;
+import com.sun.star.io.XOutputStream;
+import com.sun.star.io.XSeekable;
+import com.sun.star.io.XStreamListener;
+import com.sun.star.lang.XInitialization;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.lang.XServiceInfo;
+import com.sun.star.lang.XServiceName;
+import com.sun.star.lang.XSingleServiceFactory;
+import com.sun.star.lang.XTypeProvider;
+import com.sun.star.registry.XRegistryKey;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+
+//Uno to java Adaptor
+import com.sun.star.lib.uno.adapter.XInputStreamToInputStreamAdapter;
+import com.sun.star.lib.uno.adapter.XOutputStreamToOutputStreamAdapter;
+
+import net.sf.saxon.FeatureKeys;
+
+/** This outer class provides an inner class to implement the service
+ * description, a method to instantiate the
+ * component on demand (__getServiceFactory()), and a method to give
+ * information about the component (__writeRegistryServiceInfo()).
+ */
+public class XSLTransformer
+ implements XTypeProvider, XServiceName, XServiceInfo, XActiveDataSink,
+ XActiveDataSource, XActiveDataControl, XInitialization, URIResolver, EntityResolver {
+
+ /**
+ * This component provides java based XSL transformations
+ * A SAX based interface is not feasible when crossing language bordes
+ * since too much time would be wasted by bridging the events between environments
+ * example: 190 pages document, 82000 events 8seconds transform 40(!) sec. bridging
+ *
+ */
+ private XInputStream m_xis;
+ private XOutputStream m_xos; // private static HashMap templatecache;
+ private static final int STREAM_BUFFER_SIZE = 4000;
+ private static final String STATSPROP = "XSLTransformer.statsfile";
+ private static PrintStream statsp;
+ private String stylesheeturl;
+ private String targeturl;
+ private String targetbaseurl;
+ private String sourceurl;
+ private String sourcebaseurl;
+ private String pubtype = new String();
+ private String systype = new String(); // processing thread
+ private Thread t; // listeners
+ private Vector listeners = new Vector(); //
+ private XMultiServiceFactory svcfactory; // cache for transformations by stylesheet
+ private static Hashtable transformers = new Hashtable();
+ // struct for cached stylesheets
+ private static class Transformation {
+
+ public Transformer transformer;
+ public long lastmod;
+ }
+ // Resolve URIs to an empty source
+ public Source resolve(String href, String base) {
+ return new StreamSource(new StringReader(""));
+ }
+
+ public InputSource resolveEntity(String publicId, String systemId) throws SAXException, java.io.IOException {
+ return new InputSource(new StringReader(""));
+ }
+ // --- Initialization ---
+ public XSLTransformer(XMultiServiceFactory msf) {
+ svcfactory = msf;
+ }
+
+ public void initialize(Object[] values) throws com.sun.star.uno.Exception {
+ // some configurable debugging
+ String statsfilepath = null;
+ if ((statsfilepath = System.getProperty(STATSPROP)) != null) {
+ try {
+ File statsfile = new File(statsfilepath);
+ statsp = new PrintStream(new FileOutputStream(statsfile.getPath(), false));
+ } catch (java.lang.Exception e) {
+ System.err.println("XSLTransformer: could not open statsfile'" + statsfilepath + "'");
+ System.err.println(" " + e.getClass().getName() + ": " + e.getMessage());
+ System.err.println(" output disabled");
+ }
+ }
+
+ // reading the values
+ NamedValue nv = null;
+ debug("The transformation's parameters as 'name = value' pairs:\n");
+
+ for (int i = 0; i < values.length; i++) {
+ nv = (NamedValue) AnyConverter.toObject(new Type(NamedValue.class), values[i]);
+
+ if (nv.Name != null && !nv.Name.equals("")) {
+ debug(nv.Name + " = " + nv.Value);
+ }
+
+ if (nv.Name.equals("StylesheetURL")) {
+ stylesheeturl = (String) AnyConverter.toObject(
+ new Type(String.class), nv.Value);
+ } else if (nv.Name.equals("SourceURL")) {
+ sourceurl = (String) AnyConverter.toObject(
+ new Type(String.class), nv.Value);
+ } else if (nv.Name.equals("TargetURL")) {
+ targeturl = (String) AnyConverter.toObject(
+ new Type(String.class), nv.Value);
+ } else if (nv.Name.equals("SourceBaseURL")) {
+ sourcebaseurl = (String) AnyConverter.toObject(
+ new Type(String.class), nv.Value);
+ } else if (nv.Name.equals("TargetBaseURL")) {
+ targetbaseurl = (String) AnyConverter.toObject(
+ new Type(String.class), nv.Value);
+ } else if (nv.Name.equals("SystemType")) {
+ systype = (String) AnyConverter.toObject(
+ new Type(String.class), nv.Value);
+ } else if (nv.Name.equals("PublicType")) {
+ pubtype = (String) AnyConverter.toObject(
+ new Type(String.class), nv.Value);
+ }
+ }
+ }
+
+ // --- XActiveDataSink xistream = aStream;
+ public void setInputStream(XInputStream aStream) {
+ m_xis = aStream;
+ }
+
+ public com.sun.star.io.XInputStream getInputStream() {
+ return m_xis;
+ }
+
+ // --- XActiveDataSource
+ public void setOutputStream(XOutputStream aStream) {
+ m_xos = aStream;
+ }
+
+ public com.sun.star.io.XOutputStream getOutputStream() {
+ return m_xos;
+ }
+
+ // --- XActiveDataControl
+ public void addListener(XStreamListener aListener) {
+ if (aListener != null && !listeners.contains(aListener)) {
+ listeners.add(aListener);
+ }
+ }
+
+ public void removeListener(XStreamListener aListener) {
+ if (aListener != null) {
+ listeners.removeElement(aListener);
+ }
+
+ }
+
+ public void start() {
+ // notify listeners
+ t = new Thread() {
+
+ @Override
+ public void run() {
+
+ // Local variabes used outside try block in finally block
+ InputStream is = null;
+ Source source = null;
+ BufferedOutputStream os = null;
+ PrintStream origOut = System.out;
+ PrintStream origErr = System.err;
+ if (statsp != null) {
+ System.setErr(statsp);
+ System.setOut(statsp);
+ }
+ try {
+ debug("\n\nStarting transformation...");
+
+ // Set up context class loader for SAXParserFactory and
+ // TransformerFactory calls below:
+ setContextClassLoader(this.getClass().getClassLoader());
+
+ for (Enumeration e = listeners.elements(); e.hasMoreElements();) {
+ XStreamListener l = (XStreamListener) e.nextElement();
+ l.started();
+ }
+
+ XSeekable xseek = (XSeekable) UnoRuntime.queryInterface(XSeekable.class, m_xis);
+ if (xseek != null) {
+ xseek.seek(0);
+ }
+
+ is = new BufferedInputStream(
+ new XInputStreamToInputStreamAdapter(m_xis));
+ //Source xmlsource = new StreamSource(xmlinput);
+ SAXParserFactory spf = SAXParserFactory.newInstance();
+ spf.setValidating(false);
+ spf.setNamespaceAware(true);
+ XMLReader xmlReader = spf.newSAXParser().getXMLReader();
+ xmlReader.setEntityResolver(XSLTransformer.this);
+ source = new SAXSource(xmlReader, new InputSource(is));
+
+ // in order to help performance and to remedy a a possible memory
+ // leak in xalan, where it seems, that Transformer instances cannot
+ // be reclaimed though they are no longer referenced here, we use
+ // a cache of weak references to transformers created for specific
+ // style sheet URLs see also #i48384#
+
+ Transformer transformer = null;
+ Transformation transformation = null;
+ // File stylefile = new File(new URI(stylesheeturl));
+ long lastmod = 0;
+ try {
+ URL uStyle = new URL(stylesheeturl);
+ URLConnection c = uStyle.openConnection();
+ lastmod = c.getLastModified();
+ } catch (java.lang.Exception ex) {
+ // lastmod will remain at 0;
+ if (statsp != null) {
+ statsp.println(ex.getClass().getName() + ": " + ex.getMessage());
+ ex.printStackTrace(statsp);
+ }
+ }
+
+ synchronized (transformers) {
+ java.lang.ref.WeakReference ref = null;
+ // try to get the transformer reference from the cache
+ if ((ref = (java.lang.ref.WeakReference) transformers.get(stylesheeturl)) == null ||
+ (transformation = ((Transformation) ref.get())) == null ||
+ ((Transformation) ref.get()).lastmod < lastmod) {
+ // we cannot find a valid reference for this stylesheet
+ // or the stylsheet was updated
+ if (ref != null) {
+ transformers.remove(stylesheeturl);
+ }
+ // create new transformer for this stylesheet
+ TransformerFactory tfactory = TransformerFactory.newInstance();
+ debug("TransformerFactory is '" + tfactory.getClass().getName() + "'");
+ // some external saxons (Debian, Ubuntu, ...) have this disabled
+ // per default
+ tfactory.setAttribute(FeatureKeys.ALLOW_EXTERNAL_FUNCTIONS, new Boolean(true));
+ transformer = tfactory.newTransformer(new StreamSource(stylesheeturl));
+ transformer.setOutputProperty("encoding", "UTF-8");
+ // transformer.setURIResolver(XSLTransformer.this);
+
+ // store the transformation into the cache
+ transformation = new Transformation();
+ transformation.lastmod = lastmod;
+ transformation.transformer = transformer;
+ ref = new java.lang.ref.WeakReference(transformation);
+ transformers.put(stylesheeturl, ref);
+ }
+ }
+ transformer = transformation.transformer;
+
+ // invalid to set 'null' as parameter as 'null' is not a valid Java object
+ if (sourceurl != null) {
+ transformer.setParameter("sourceURL", sourceurl);
+ }
+ if (sourcebaseurl != null) {
+ transformer.setParameter("sourceBaseURL", sourcebaseurl);
+ }
+ if (targeturl != null) {
+ transformer.setParameter("targetURL", targeturl);
+ }
+ if (targetbaseurl != null) {
+ transformer.setParameter("targetBaseURL", targetbaseurl);
+ }
+ if (pubtype != null) {
+ transformer.setParameter("publicType", pubtype);
+ }
+ if (systype != null) {
+ transformer.setParameter("systemType", systype);
+ }
+ if (svcfactory != null) {
+ transformer.setParameter("XMultiServiceFactory", svcfactory);
+ }
+ os = new BufferedOutputStream(
+ new XOutputStreamToOutputStreamAdapter(m_xos));
+ StreamResult sr = new StreamResult(os);
+ long tstart = System.currentTimeMillis();
+ transformer.transform(source, sr);
+ debug("finished transformation in " + (System.currentTimeMillis() - tstart) + "ms");
+
+ } catch (java.lang.Throwable ex) {
+ // notify any listeners about close
+ for (Enumeration e = listeners.elements(); e.hasMoreElements();) {
+
+ XStreamListener l = (XStreamListener) e.nextElement();
+ l.error(new com.sun.star.uno.Exception(ex.getClass().getName() + ": " + ex.getMessage()));
+ }
+ if (statsp != null) {
+ statsp.println(ex.getClass().getName() + ": " + ex.getMessage());
+ ex.printStackTrace(statsp);
+ }
+ } finally {
+ // dereference input buffer
+ source = null;
+ try {
+ if (is != null) {
+ is.close();
+ }
+ if (os != null) {
+ os.close();
+ }
+ if (m_xis != null) {
+ m_xis.closeInput();
+ }
+ if (m_xos != null) {
+ m_xos.closeOutput();
+ }
+ } catch (java.lang.Throwable ex) {
+ if (statsp != null) {
+ statsp.println(ex.getClass().getName() + ": " + ex.getMessage());
+ ex.printStackTrace(statsp);
+ }
+ }
+
+ // resetting standard input/error streams from logfile to default
+ if (statsp != null) {
+ System.setErr(origErr);
+ System.setOut(origOut);
+ }
+ // try to release references asap...
+ m_xos = null;
+ m_xis = null;
+ is = null;
+ os = null;
+ // notify any listeners about close
+ if (listeners != null) {
+ for (Enumeration e = listeners.elements(); e.hasMoreElements();) {
+ XStreamListener l = (XStreamListener) e.nextElement();
+ l.closed();
+ }
+ }
+ }
+ }
+ };
+ t.start();
+ } /* a statsfile have to be created as precondition to use this function */
+
+
+ private static final void debug(String s) {
+ if (statsp != null) {
+ statsp.println(s);
+ }
+ }
+
+ public void terminate() {
+ try {
+ debug("terminate called");
+ if (t.isAlive()) {
+ t.interrupt();
+ for (Enumeration e = listeners.elements(); e.hasMoreElements();) {
+ XStreamListener l = (XStreamListener) e.nextElement();
+ l.terminated();
+ }
+ }
+ } catch (java.lang.Exception ex) {
+ if (statsp != null) {
+ statsp.println(ex.getClass().getName() + ": " + ex.getMessage());
+ ex.printStackTrace(statsp);
+ }
+ }
+ } // --- component management interfaces... ---
+ private final static String _serviceName = "com.sun.star.comp.JAXTHelper";
+
+ // Implement methods from interface XTypeProvider
+ public byte[] getImplementationId() {
+ byte[] byteReturn = {};
+ byteReturn = new String("" + this.hashCode()).getBytes();
+ return (byteReturn);
+ }
+
+ public com.sun.star.uno.Type[] getTypes() {
+ Type[] typeReturn = {};
+ try {
+ typeReturn = new Type[]{
+ new Type(XTypeProvider.class),
+ new Type(XServiceName.class),
+ new Type(XServiceInfo.class),
+ new Type(XActiveDataSource.class),
+ new Type(XActiveDataSink.class),
+ new Type(XActiveDataControl.class),
+ new Type(XInitialization.class)
+ };
+ } catch (java.lang.Exception exception) {
+ }
+
+ return (typeReturn);
+ }
+
+ // --- Implement method from interface XServiceName ---
+ public String getServiceName() {
+ return (_serviceName);
+ }
+
+ // --- Implement methods from interface XServiceInfo ---
+ public boolean supportsService(String stringServiceName) {
+ return (stringServiceName.equals(_serviceName));
+ }
+
+ public String getImplementationName() {
+ return (XSLTransformer.class.getName());
+ }
+
+ public String[] getSupportedServiceNames() {
+ String[] stringSupportedServiceNames = {_serviceName};
+ return stringSupportedServiceNames;
+ }
+
+ // --- component registration methods ---
+ public static XSingleServiceFactory __getServiceFactory(
+ String implName, XMultiServiceFactory multiFactory, XRegistryKey regKey) {
+ XSingleServiceFactory xSingleServiceFactory = null;
+ if (implName.equals(XSLTransformer.class.getName())) {
+ xSingleServiceFactory = FactoryHelper.getServiceFactory(XSLTransformer.class,
+ _serviceName, multiFactory, regKey);
+ }
+ return xSingleServiceFactory;
+ }
+
+ public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) {
+ return FactoryHelper.writeRegistryServiceInfo(XSLTransformer.class.getName(),
+ _serviceName, regKey);
+ }
+}
diff --git a/filter/source/xsltfilter/fla.cxx b/filter/source/xsltfilter/fla.cxx
new file mode 100644
index 000000000000..d375f008607d
--- /dev/null
+++ b/filter/source/xsltfilter/fla.cxx
@@ -0,0 +1,327 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+/*
+This file include an implementation of FLA - a simple Funtional Language for Attributes.
+The language is LISP-like and has the following grammar:
+FLA_Expression ::= '(' FLA_Operation FLA_Attribute+ ')'
+FLA_Attribtute ::= FLA_Constant | FLA_Expression
+FLA_Constant ::= '[' String ']'
+The language currently supports the following operations:
+"+"-Operation, e.g. (+[1][2]) = [3]
+"-"-Operation, e.g. (-[3][2]) = [1]
+"*"-Operation, e.g. (*[3][2]) = [6]
+"/"-Operation, e.g. (-[6][2]) = [3]
+"<"-Operation, e.g. (<[3][4]) = [t] resp. (<[4][3]) = []
+"<="-Operation, e.g. (<=[3][4]) = [t] resp. (<=[4][3]) = []
+">"-Operation, e.g. (>[3][4]) = [] resp. (>[4][3]) = [t]
+">="-Operation, e.g. (>=[3][4]) = [] resp. (>=[4][3]) = [t]
+Variable assignment, e.g. ($var1[4])
+Variable access, e.g. (+($var1[4])($var1)($var1)) = [8]
+Condition, e.g. (?[t][3][4])=[3] resp. (?[][3][4])=4
+Priorized Choice, e.g. (|[4][5])=[4] resp. (|[][5])=[5]; i.e. result is the first occurrence of a non-[].
+*/
+
+#include "fla.hxx"
+#include "sal/main.h"
+
+
+namespace FLA {
+
+
+sal_Int32 Evaluator::evalFunc(const sal_Unicode*op, sal_Int32 opLen, sal_Int32 args, sal_Unicode* argv[10], sal_Unicode *result)
+{
+ if (opLen==1 && op[0]==L'+')
+ {
+ double res=0;
+ for(sal_Int32 i=0;i<args;i++)
+ {
+ double v=rtl_ustr_toDouble(argv[i]);
+ res+=v;
+ }
+ return rtl_ustr_valueOfDouble(result, res);
+ }
+ else if (opLen==1 && op[0]==L'-' && args>0)
+ {
+ double res=rtl_ustr_toDouble(argv[0]);
+ for(sal_Int32 i=1;i<args;i++)
+ {
+ double v=rtl_ustr_toDouble(argv[i]);
+ res-=v;
+ }
+ sal_Int32 _len= rtl_ustr_valueOfDouble(result, res);
+ return _len;
+ }
+ else if (opLen==1 && op[0]==L'*')
+ {
+ double res=1;
+ for(sal_Int32 i=0;i<args;i++)
+ {
+ double v=rtl_ustr_toDouble(argv[i]);
+ res*=v;
+ }
+ return rtl_ustr_valueOfDouble(result, res);
+ }
+ else if (opLen==1 && op[0]==L'/' && args>0)
+ {
+ double res=rtl_ustr_toDouble(argv[0]);
+ for(sal_Int32 i=1;i<args;i++)
+ {
+ double v=rtl_ustr_toDouble(argv[i]);
+ res/=v;
+ }
+ return rtl_ustr_valueOfDouble(result, res);
+ }
+ else if (opLen==1 && op[0]==L'>' && args==2)
+ {
+ double p1=rtl_ustr_toDouble(argv[0]);
+ double p2=rtl_ustr_toDouble(argv[1]);
+ if (p1>p2)
+ {
+ result[0]=L't';
+ return 1;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+ else if (opLen==1 && op[0]==L'<' && args==2)
+ {
+ double p1=rtl_ustr_toDouble(argv[0]);
+ double p2=rtl_ustr_toDouble(argv[1]);
+ if (p1<p2)
+ {
+ result[0]=L't';
+ return 1;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+ else if (opLen==2 && op[0]==L'<' && op[1]==L'=' && args==2)
+ {
+ double p1=rtl_ustr_toDouble(argv[0]);
+ double p2=rtl_ustr_toDouble(argv[1]);
+ if (p1<=p2)
+ {
+ result[0]=L't';
+ return 1;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+ else if (opLen==2 && op[0]==L'>' && op[1]==L'=' && args==2)
+ {
+ double p1=rtl_ustr_toDouble(argv[0]);
+ double p2=rtl_ustr_toDouble(argv[1]);
+ if (p1>=p2)
+ {
+ result[0]=L't';
+ return 1;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+ else if (opLen>1 && op[0]==L'$' && args==0)
+ {
+ sal_Int32 reg=rtl_ustr_toInt32(op+1, 10);
+ int i=0; while(i<99 && environment[reg][i]!=L'\0') { result[i]=environment[reg][i]; i++; }
+ result[i]=0;
+ return i;
+ }
+ else if (opLen>1 && op[0]==L'$' && args==1)
+ {
+ sal_Int32 reg=rtl_ustr_toInt32(op+1, 10);
+ int i=0; while(i<99 && argv[0]!=NULL) { result[i]=argv[0][i]; environment[reg][i]=argv[0][i]; i++; }
+ environment[reg][i]=0; result[i]=0;
+ return i;
+ }
+ else if (opLen==1 && op[0]==L'?' && args==3)
+ {
+ sal_Unicode *source;
+ if (argv[0][0]==L'\0')
+ {
+ source=argv[2];
+ }
+ else
+ {
+ source=argv[1];
+ }
+ int len=0; while (*source!=L'\0') result[len++]=*source++;
+ result[len]=0;
+ return len;
+ }
+ else if (opLen==1 && op[0]==L'|' && args>0)
+ {
+ sal_Unicode *source;
+ int i=0; while (i<args && argv[i][0]==L'\0') i++;
+ if (i<args)
+ {
+ source=argv[i];
+ int len=0; while (*source!=L'\0') result[len++]=*source++;
+ result[len]=0;
+ return len;
+ }
+ else
+ {
+ result[0]=0;
+ return 0;
+ }
+ }
+ else if (opLen==1 && op[0]==L'.' && args>0)
+ {
+ sal_Unicode *source;
+ int len=0;
+ for(sal_Int32 i=0;i<args;i++)
+ {
+ source=argv[i];
+ while (*source!=L'\0') result[len++]=*source++;
+ }
+ result[len]=0;
+ return len;
+ }
+ else if (opLen==8 && op[0]=='t' && op[1]=='w' && op[2]=='i' && op[3]=='p' && op[4]=='s' && op[5]=='2' && op[6]=='c' && op[7]=='m' && args==1)
+ {
+ double v=rtl_ustr_toDouble(argv[0]);
+ return rtl_ustr_valueOfDouble(result, (v/567.0));
+ }
+ else if (opLen==6 && op[0]=='s' && op[1]=='w' && op[2]=='i' && op[3]=='t' && op[4]=='c' && op[5]=='h' && args>2)
+ {
+ sal_Unicode *source;
+ for(int i=1;i<args-1;i+=2)
+ {
+ if (rtl_ustr_compare(argv[0], argv[i])==0)
+ {
+ source=argv[i+1]; int len=0; while (*source!=L'\0') result[len++]=*source++;
+ result[len]=0;
+ return len;
+ }
+ }
+ source=argv[args-1]; int len=0; while (*source!=L'\0') result[len++]=*source++;
+ result[len]=0;
+ return len;
+// double v=rtl_ustr_toDouble(argv[0]);
+// return rtl_ustr_valueOfDouble(result, (v/567.0L));
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+
+sal_Int32 Evaluator::evalExp(const sal_Unicode *expr, sal_Int32 exprLen, sal_Unicode *buf, sal_Int32 *bufLen)
+{
+ sal_Unicode ch;
+ sal_Unicode* argv[10];
+ sal_Int32 args=0;
+ int offset=0; while(offset<exprLen && expr[offset]==' ') offset++;
+ sal_Int32 startBuf=*bufLen;
+ if(expr[offset]==L'(')
+ {
+ offset++;
+ while(offset<exprLen && expr[offset]==' ') offset++;
+ int op=offset;
+ while(offset<exprLen && expr[offset]!=' ' && expr[offset]!='[' && expr[offset]!='('&& expr[offset]!=']' && expr[offset]!=')') offset++;
+ int opLen=offset-op;
+ bool done=false;
+ while(offset<exprLen && !done)
+ {
+ switch(expr[offset])
+ {
+ case '(':
+ case '[':
+ argv[args++]=buf+*bufLen;
+ offset+=evalExp(expr+offset, exprLen, buf, bufLen);
+ buf[(*bufLen)++]=0;
+ break;
+ case ')':
+ offset++;
+ done=true;
+ break;
+ case ' ': /* skip */
+ offset++;
+ break;
+ default: /* skip */
+ offset++;
+ break;
+ };
+ }
+ if (done)
+ {
+ sal_Int32 len=evalFunc(expr+op, opLen, args, argv, buf+startBuf);
+ *bufLen=startBuf+len;
+ }
+
+ }
+ else if(expr[offset]==L'[')
+ {
+ offset++;
+ argv[args++]=buf+*bufLen;
+ while (offset<exprLen && (ch=expr[offset++])!=']')
+ {
+ buf[(*bufLen)++]=ch;
+ }
+ buf[(*bufLen)++]=0;
+ }
+ return offset;
+}
+
+const sal_Unicode *Evaluator::eval(const sal_Unicode *expr, sal_Int32 exprLen)
+{
+
+ sal_Int32 len=0;
+ evalExp(expr, exprLen, _buf, &len);
+ OSL_ASSERT(len<1024);
+ return _buf;
+}
+
+}
+
+/*
+SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
+{
+ FLA::Evaluator ev;
+ for(int i=1;i<argc;i++)
+ {
+ rtl_uString *param=NULL;
+ rtl_uString_newFromAscii(&param, argv[i]);
+ ::rtl::OUString _param(param);
+ const sal_Unicode *res=ev.eval(_param.getStr(), _param.getLength());
+ }
+ return 0;
+}
+*/
diff --git a/filter/source/xsltfilter/fla.hxx b/filter/source/xsltfilter/fla.hxx
new file mode 100644
index 000000000000..f7e3e21ac07f
--- /dev/null
+++ b/filter/source/xsltfilter/fla.hxx
@@ -0,0 +1,53 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+/*
+Function Language for Attributes. See .cxx-File for Syntax. Used in WordML-Filter.
+*/
+#ifndef __FLA_HXX__
+#define __FLA_HXX__
+
+#include <sal/types.h>
+#include <rtl/ustring.hxx>
+namespace FLA {
+
+
+class Evaluator
+{
+private:
+ sal_Unicode environment[100][10];
+ sal_Unicode _buf[1024];
+ sal_Int32 evalFunc(const sal_Unicode*op, sal_Int32 opLen, sal_Int32 args, sal_Unicode* argv[10], sal_Unicode *result);
+ sal_Int32 evalExp(const sal_Unicode *expr, sal_Int32 exprLen, sal_Unicode *buf, sal_Int32 *bufLen);
+public:
+ const sal_Unicode *eval(const sal_Unicode *expr, sal_Int32 exprLen);
+};
+}
+
+
+
+#endif /* __FLA_HXX__ */
diff --git a/filter/source/xsltfilter/makefile.mk b/filter/source/xsltfilter/makefile.mk
new file mode 100644
index 000000000000..a5e27135e17a
--- /dev/null
+++ b/filter/source/xsltfilter/makefile.mk
@@ -0,0 +1,85 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+PRJ = ..$/..
+PRJNAME = filter
+#PACKAGE = com$/sun$/star$/documentconversion$/XSLTFilter
+TARGET =XSLTFilter
+ENABLE_EXCEPTIONS=TRUE
+LIBTARGET=NO
+
+# --- Settings -----------------------------------------------------
+CLASSDIR!:=$(CLASSDIR)$/$(TARGET)
+.INCLUDE: settings.mk
+
+SLOFILES=$(SLO)$/XSLTFilter.obj $(SLO)$/fla.obj
+LIBNAME=xsltfilter
+SHL1TARGETDEPN=makefile.mk
+SHL1OBJS=$(SLOFILES)
+SHL1TARGET=$(LIBNAME)$(DLLPOSTFIX)
+SHL1IMPLIB=i$(LIBNAME)
+SHL1VERSIONMAP=$(SOLARENV)/src/component.map
+SHL1DEF=$(MISC)$/$(SHL1TARGET).def
+DEF1NAME=$(SHL1TARGET)
+
+SHL1STDLIBS= \
+ $(TOOLSLIB) \
+ $(CPPUHELPERLIB) \
+ $(CPPULIB) \
+ $(XMLOFFLIB) \
+ $(SALLIB)
+
+.IF "$(SOLAR_JAVA)"!=""
+
+#USE_UDK_EXTENDED_MANIFESTFILE=TRUE
+#USE_EXTENDED_MANIFESTFILE=TRUE
+JARFILES = ridl.jar unoil.jar jurt.jar juh.jar
+
+JAVAFILES = $(subst,$(CLASSDIR)$/, $(subst,.class,.java $(JAVACLASSFILES)))
+CUSTOMMANIFESTFILE = Manifest
+
+JARCOMPRESS = TRUE
+JARCLASSDIRS = XSLTransformer*.class XSLTFilterOLEExtracter*.class
+JARTARGET = $(TARGET).jar
+
+.IF "$(SYSTEM_SAXON)" == "YES"
+XCLASSPATH:=$(XCLASSPATH)$(PATH_SEPERATOR)$(SAXON_JAR)
+.ELSE
+JARFILES += saxon9.jar
+.ENDIF
+
+# --- Files --------------------------------------------------------
+JAVACLASSFILES=$(CLASSDIR)$/XSLTransformer.class $(CLASSDIR)$/XSLTFilterOLEExtracter.class
+.ENDIF
+
+# --- Targets ------------------------------------------------------
+.INCLUDE : target.mk
+.IF "$(SOLAR_JAVA)"!=""
+$(JAVACLASSFILES) : $(CLASSDIR)
+
+$(CLASSDIR) :
+ $(MKDIR) $(CLASSDIR)
+.ENDIF
diff --git a/filter/source/xsltvalidate/Manifest b/filter/source/xsltvalidate/Manifest
new file mode 100644
index 000000000000..84787aa6e402
--- /dev/null
+++ b/filter/source/xsltvalidate/Manifest
@@ -0,0 +1,2 @@
+RegistrationClassName: XSLTValidate
+UNO-Type-Path:
diff --git a/filter/source/xsltvalidate/XSLTValidate.java b/filter/source/xsltvalidate/XSLTValidate.java
new file mode 100644
index 000000000000..6dba438f4e47
--- /dev/null
+++ b/filter/source/xsltvalidate/XSLTValidate.java
@@ -0,0 +1,347 @@
+/************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+
+import com.sun.star.comp.loader.FactoryHelper;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.lang.XServiceInfo;
+import com.sun.star.lang.XServiceName;
+import com.sun.star.lang.XSingleServiceFactory;
+import com.sun.star.lang.XTypeProvider;
+import com.sun.star.registry.XRegistryKey;
+import com.sun.star.uno.Type;
+import java.util.Enumeration;
+import java.util.Vector;
+import com.sun.star.xml.XImportFilter;
+import com.sun.star.xml.XExportFilter;
+
+// Imported TraX classes
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+import com.sun.star.uno.AnyConverter;
+
+//Uno to java Adaptor
+import com.sun.star.lib.uno.adapter.*;
+
+/** This outer class provides an inner class to implement the service
+ * description, a method to instantiate the
+ * component on demand (__getServiceFactory()), and a method to give
+ * information about the component (__writeRegistryServiceInfo()).
+ */
+public class XSLTValidate {
+
+ private static XMultiServiceFactory xMSF;
+ private static Vector parseErrors =new Vector();
+
+ /** This inner class provides the component as a concrete implementation
+ * of the service description. It implements the needed interfaces.
+ * @implements XTypeProvider
+ */
+ static public class _XSLTValidate implements
+ XImportFilter,
+ XServiceName,
+ XServiceInfo,
+ ErrorHandler,
+ XTypeProvider {
+
+ private com.sun.star.xml.sax.XErrorHandler xErrorHandler;
+
+ /** The component will be registered under this name.
+ */
+ static private final String __serviceName = "com.sun.star.documentconversion.XSLTValidate";
+
+ public _XSLTValidate() {
+ xErrorHandler = null;
+ }
+
+ public com.sun.star.uno.Type[] getTypes() {
+ Type[] typeReturn = {};
+
+ try {
+ typeReturn = new Type[] {
+ new Type( XTypeProvider.class ),
+ new Type( XExportFilter.class ),
+ new Type( XImportFilter.class ),
+ new Type( XServiceName.class ),
+ new Type( XServiceInfo.class ) };
+ }
+ catch( Exception exception ) {
+
+ }
+
+ return( typeReturn );
+ }
+
+
+ public boolean importer(com.sun.star.beans.PropertyValue[] aSourceData,
+ com.sun.star.xml.sax.XDocumentHandler xDocHandler,
+ java.lang.String[] msUserData) throws com.sun.star.uno.RuntimeException,com.sun.star.lang.IllegalArgumentException {
+
+ com.sun.star.io.XInputStream xis=null;
+ com.sun.star.beans.PropertyValue[] pValue = aSourceData;
+ for (int i = 0 ; i < pValue.length; i++)
+ {
+ try{
+ //System.out.println("\n"+pValue[i].Name+" "+pValue[i].Value);
+ if (pValue[i].Name.compareTo("InputStream")==0){
+ xis=(com.sun.star.io.XInputStream)AnyConverter.toObject(new Type(com.sun.star.io.XInputStream.class), pValue[i].Value);
+ }
+ else if (pValue[i].Name.compareTo("ErrorHandler")==0){
+ xErrorHandler=(com.sun.star.xml.sax.XErrorHandler)AnyConverter.toObject(new Type(com.sun.star.xml.sax.XErrorHandler.class), pValue[i].Value);
+ }
+ }
+ catch(com.sun.star.lang.IllegalArgumentException AnyExec){
+ System.out.println("\nIllegalArgumentException "+AnyExec);
+ }
+ }
+ try{
+ convert (xis);
+ }
+ catch (Exception AnyExec){
+ throw new com.sun.star.uno.RuntimeException(AnyExec.getMessage());
+ }
+ return true;
+ }
+
+ public void convert (com.sun.star.io.XInputStream xml) throws com.sun.star.uno.RuntimeException {
+ XInputStreamToInputStreamAdapter xis =new XInputStreamToInputStreamAdapter(xml);
+ parseErrors =new Vector();
+ //String defaultTimeOut = System.getProperty("sun.net.client.defaultConnectTimeout");
+ System.getProperties().setProperty("sun.net.client.defaultConnectTimeout", "10000");
+ try{
+ DocumentBuilderFactory dFactory = DocumentBuilderFactory.newInstance();
+ dFactory.setNamespaceAware(true);
+ dFactory.setValidating(true);
+ DocumentBuilder dBuilder = dFactory.newDocumentBuilder();
+ dBuilder.setErrorHandler(this);
+ dBuilder.parse(xis);
+ if (parseErrors.size()>0){
+ String errString ="";
+ for (Enumeration e = parseErrors.elements() ; e.hasMoreElements() ;) {
+ errString+=e.nextElement();
+ //System.out.println(e.nextElement());
+ }
+ throw new com.sun.star.uno.RuntimeException(errString);
+ }
+ }
+ catch (Exception e){
+ //System.out.println("\nException "+ e);
+ throw new com.sun.star.uno.RuntimeException(e.getLocalizedMessage());
+ }
+ }
+
+ public com.sun.star.uno.Any JavaSAXParseEceptionToUno( SAXParseException e )
+ {
+ com.sun.star.uno.XInterface xContext = null;
+
+ String aMessage = e.getMessage();
+ if( aMessage == null )
+ aMessage = new String();
+
+ String aPublicId = e.getPublicId();
+ if( aPublicId == null )
+ aPublicId = new String();
+
+ String aSystemId = e.getSystemId();
+ if( aSystemId == null )
+ aSystemId = new String();
+
+ return new com.sun.star.uno.Any( new Type(com.sun.star.xml.sax.SAXParseException.class),
+ new com.sun.star.xml.sax.SAXParseException( aMessage,
+ xContext,
+ com.sun.star.uno.Any.VOID,
+ aPublicId,
+ aSystemId,
+ e.getLineNumber(),
+ e.getColumnNumber() ) );
+
+ }
+
+ // Warning Event Handler
+ public void warning (SAXParseException e)
+ throws SAXException
+ {
+// System.out.println("\n_XSLTValidate::warning " + e.toString() );
+
+ if( xErrorHandler != null )
+ {
+ try
+ {
+ xErrorHandler.warning( JavaSAXParseEceptionToUno( e ) );
+ }
+ catch( com.sun.star.xml.sax.SAXException ex )
+ {
+ throw e;
+ }
+ }
+ else
+ {
+
+ //System.err.println ("Warning: "+e);
+ try{
+ //parseErrors.write (("\n"+e.getMessage()).getBytes());
+ }
+ catch(Exception genEx){
+ //System.out.print("\n Error while writing ParseErrors"+genEx);
+ }
+ }
+ }
+
+ // Error Event Handler
+ public void error (SAXParseException e)
+ throws SAXException
+ {
+// System.out.println("\n_XSLTValidate::error " + e.toString() );
+
+ if( xErrorHandler != null )
+ {
+ try
+ {
+ xErrorHandler.error( JavaSAXParseEceptionToUno( e ) );
+ }
+ catch( com.sun.star.xml.sax.SAXException ex )
+ {
+ throw e;
+ }
+ }
+ else
+ {
+ //System.err.println ("Error: "+e);
+ try{
+ parseErrors.add (e.getLocalizedMessage()+" "+e.getLineNumber()+" ");
+ }
+ catch(Exception genEx){
+ //System.out.print("\n Error while writing ParseErrors"+genEx);
+ }
+ }
+ }
+
+ // Fatal Error Event Handler
+ public void fatalError (SAXParseException e)
+ throws SAXException {
+// System.out.println("\n_XSLTValidate::fatalError " + e.toString() );
+
+ if( xErrorHandler != null )
+ {
+ try
+ {
+ xErrorHandler.fatalError( JavaSAXParseEceptionToUno( e ) );
+ }
+ catch( com.sun.star.xml.sax.SAXException ex )
+ {
+ throw e;
+ }
+ }
+ else
+ {
+ //System.err.println ("Fatal Error: "+e);
+ try{
+ parseErrors.add (e.getLocalizedMessage()+" "+e.getLineNumber()+" ");
+ }
+ catch(Exception genEx){
+ //System.out.print("\n Error while writing ParseErrors"+genEx);
+ }
+ }
+ }
+
+ // Implement methods from interface XTypeProvider
+ public byte[] getImplementationId() {
+ byte[] byteReturn = {};
+
+ byteReturn = new String( "" + this.hashCode() ).getBytes();
+
+ return( byteReturn );
+ }
+
+ // Implement method from interface XServiceName
+ public String getServiceName() {
+ return( __serviceName );
+ }
+
+ // Implement methods from interface XServiceInfo
+ public boolean supportsService(String stringServiceName) {
+ return( stringServiceName.equals( __serviceName ) );
+ }
+
+ public String getImplementationName() {
+ return( _XSLTValidate.class.getName() );
+ }
+
+ public String[] getSupportedServiceNames() {
+ String[] stringSupportedServiceNames = { __serviceName };
+ return( stringSupportedServiceNames );
+ }
+ }
+
+ /**
+ * Returns a factory for creating the service.
+ * This method is called by the <code>JavaLoader</code>
+ *
+ * @return returns a <code>XSingleServiceFactory</code> for creating the
+ * component
+ *
+ * @param implName the name of the implementation for which a
+ * service is desired
+ * @param multiFactory the service manager to be used if needed
+ * @param regKey the registryKey
+ *
+ * @see com.sun.star.comp.loader.JavaLoader
+ */
+ public static XSingleServiceFactory __getServiceFactory(String implName,
+ XMultiServiceFactory multiFactory,
+ XRegistryKey regKey) {
+ XSingleServiceFactory xSingleServiceFactory = null;
+ xMSF= multiFactory;
+ if (implName.equals(_XSLTValidate.class.getName()) ) {
+ xSingleServiceFactory = FactoryHelper.getServiceFactory(_XSLTValidate.class,
+ _XSLTValidate.__serviceName,
+ multiFactory,
+ regKey);
+ }
+
+ return xSingleServiceFactory;
+ }
+
+ /**
+ * Writes the service information into the given registry key.
+ * This method is called by the <code>JavaLoader</code>
+ * <p>
+ * @return returns true if the operation succeeded
+ * @param regKey the registryKey
+ * @see com.sun.star.comp.loader.JavaLoader
+ */
+ public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) {
+
+ return FactoryHelper.writeRegistryServiceInfo(_XSLTValidate.class.getName(),
+ _XSLTValidate.__serviceName, regKey);
+ }
+}
diff --git a/filter/source/xsltvalidate/makefile.mk b/filter/source/xsltvalidate/makefile.mk
new file mode 100644
index 000000000000..5337d31a4bd7
--- /dev/null
+++ b/filter/source/xsltvalidate/makefile.mk
@@ -0,0 +1,76 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+PRJ = ..$/..
+PRJNAME = filter
+#PACKAGE = com$/sun$/star$/documentconversion$/XSLTValidate
+TARGET =XSLTValidate
+# --- Settings -----------------------------------------------------
+.IF "$(XML_CLASSPATH)" != ""
+XCLASSPATH+=":$(XML_CLASSPATH)"
+.ENDIF
+.INCLUDE: settings.mk
+CLASSDIR!:=$(CLASSDIR)$/$(TARGET)
+#USE_UDK_EXTENDED_MANIFESTFILE=TRUE
+#USE_EXTENDED_MANIFESTFILE=TRUE
+JARFILES = ridl.jar unoil.jar jurt.jar juh.jar crimson.jar
+
+.IF "$(SYSTEM_XALAN)" == "YES"
+EXTRAJARFILES += $(XALAN_JAR)
+.ELSE
+JARFILES += xalan.jar
+.ENDIF
+
+.IF "$(SYSTEM_XML_APIS)" == "YES"
+EXTRAJARFILES += $(XML_APIS_JAR)
+.ELSE
+JARFILES += xml-apis.jar
+.ENDIF
+
+JAVAFILES = $(subst,$(CLASSDIR)$/, $(subst,.class,.java $(JAVACLASSFILES)))
+CUSTOMMANIFESTFILE = Manifest
+#JARMANIFEST = Manifest
+JARCOMPRESS = TRUE
+JARCLASSDIRS = XSLTValidate*.class
+JARTARGET = $(TARGET).jar
+
+
+# --- Files --------------------------------------------------------
+JAVACLASSFILES=$(CLASSDIR)$/XSLTValidate.class
+#---Manifest -------------------------------------------------------
+#$(OUT)$/class$/$(TARGET)$/META-INF: META-INF
+# + $(COPY) $(COPYRECURSE) META-INF $(OUT)$/class$/META-INF
+# --- Targets ------------------------------------------------------
+.IF "$(SOLAR_JAVA)"!=""
+.INCLUDE : target.mk
+$(JAVACLASSFILES) : $(CLASSDIR)
+.IF "$(JARMANIFEST)"!=""
+$(JARMANIFEST) : $(CLASSDIR)
+.ENDIF # "$(JARMANIFEST)"!=""
+.ENDIF
+
+$(CLASSDIR) :
+ $(MKDIR) $(CLASSDIR)